@pie-element/multiple-choice 13.2.0-next.28 → 13.2.1-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 (243) hide show
  1. package/dist/author/defaults.d.ts +205 -0
  2. package/dist/author/defaults.js +151 -0
  3. package/dist/author/index.d.ts +26 -0
  4. package/dist/author/index.js +119 -0
  5. package/dist/author/main.d.ts +34 -0
  6. package/dist/author/main.js +287 -0
  7. package/dist/author/utils.d.ts +9 -0
  8. package/dist/author/utils.js +7 -0
  9. package/dist/controller/defaults.d.ts +35 -0
  10. package/dist/controller/defaults.js +29 -0
  11. package/dist/controller/index.d.ts +65 -0
  12. package/dist/controller/index.js +124 -0
  13. package/dist/controller/utils.d.ts +10 -0
  14. package/dist/controller/utils.js +8 -0
  15. package/dist/delivery/choice-input.d.ts +44 -0
  16. package/dist/delivery/choice-input.js +272 -0
  17. package/dist/delivery/choice.d.ts +20 -0
  18. package/dist/delivery/choice.js +105 -0
  19. package/dist/delivery/feedback-tick.d.ts +20 -0
  20. package/dist/delivery/feedback-tick.js +104 -0
  21. package/dist/delivery/index.d.ts +37 -0
  22. package/dist/delivery/index.js +214 -0
  23. package/dist/delivery/main.d.ts +31 -0
  24. package/dist/delivery/main.js +51 -0
  25. package/dist/delivery/multiple-choice.d.ts +61 -0
  26. package/dist/delivery/multiple-choice.js +244 -0
  27. package/dist/delivery/session-updater.d.ts +10 -0
  28. package/dist/delivery/session-updater.js +9 -0
  29. package/dist/index.d.ts +1 -0
  30. package/dist/index.iife.d.ts +8 -0
  31. package/dist/index.iife.js +148 -0
  32. package/dist/index.js +2 -0
  33. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_DataView.js +6 -0
  34. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Hash.js +16 -0
  35. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_ListCache.js +16 -0
  36. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Map.js +6 -0
  37. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_MapCache.js +16 -0
  38. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Promise.js +6 -0
  39. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Set.js +6 -0
  40. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_SetCache.js +11 -0
  41. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Stack.js +14 -0
  42. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Symbol.js +5 -0
  43. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Uint8Array.js +5 -0
  44. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_WeakMap.js +6 -0
  45. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_apply.js +12 -0
  46. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayEach.js +7 -0
  47. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayFilter.js +10 -0
  48. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayLikeKeys.js +15 -0
  49. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayPush.js +7 -0
  50. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arraySome.js +7 -0
  51. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_assignMergeValue.js +8 -0
  52. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_assignValue.js +10 -0
  53. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_assocIndexOf.js +8 -0
  54. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseAssign.js +8 -0
  55. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseAssignIn.js +8 -0
  56. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseAssignValue.js +12 -0
  57. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseClone.js +57 -0
  58. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseCreate.js +14 -0
  59. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseFor.js +5 -0
  60. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseGetAllKeys.js +9 -0
  61. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseGetTag.js +10 -0
  62. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsArguments.js +9 -0
  63. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsEqual.js +8 -0
  64. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsEqualDeep.js +30 -0
  65. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsMap.js +9 -0
  66. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsNative.js +11 -0
  67. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsSet.js +9 -0
  68. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsTypedArray.js +11 -0
  69. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseKeys.js +12 -0
  70. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseKeysIn.js +13 -0
  71. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseMerge.js +19 -0
  72. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseMergeDeep.js +31 -0
  73. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseRest.js +9 -0
  74. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseSetToString.js +14 -0
  75. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseTimes.js +7 -0
  76. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseTrim.js +8 -0
  77. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseUnary.js +8 -0
  78. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cacheHas.js +6 -0
  79. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneArrayBuffer.js +8 -0
  80. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneBuffer.js +10 -0
  81. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneDataView.js +8 -0
  82. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneRegExp.js +8 -0
  83. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneSymbol.js +8 -0
  84. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneTypedArray.js +8 -0
  85. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copyArray.js +8 -0
  86. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copyObject.js +14 -0
  87. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copySymbols.js +8 -0
  88. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copySymbolsIn.js +8 -0
  89. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_coreJsData.js +5 -0
  90. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_createAssigner.js +15 -0
  91. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_createBaseFor.js +12 -0
  92. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_defineProperty.js +10 -0
  93. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_equalArrays.js +35 -0
  94. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_equalByTag.js +35 -0
  95. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_equalObjects.js +32 -0
  96. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_freeGlobal.js +4 -0
  97. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getAllKeys.js +9 -0
  98. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getAllKeysIn.js +9 -0
  99. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getMapData.js +8 -0
  100. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getNative.js +9 -0
  101. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getPrototype.js +5 -0
  102. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getRawTag.js +14 -0
  103. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getSymbols.js +10 -0
  104. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getSymbolsIn.js +11 -0
  105. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getTag.js +23 -0
  106. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getValue.js +6 -0
  107. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashClear.js +7 -0
  108. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashDelete.js +7 -0
  109. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashGet.js +13 -0
  110. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashHas.js +9 -0
  111. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashSet.js +9 -0
  112. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_initCloneArray.js +8 -0
  113. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_initCloneByTag.js +33 -0
  114. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_initCloneObject.js +9 -0
  115. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isIndex.js +8 -0
  116. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isIterateeCall.js +12 -0
  117. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isKeyable.js +7 -0
  118. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isMasked.js +11 -0
  119. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isPrototype.js +8 -0
  120. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheClear.js +6 -0
  121. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheDelete.js +9 -0
  122. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheGet.js +8 -0
  123. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheHas.js +7 -0
  124. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheSet.js +8 -0
  125. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheClear.js +13 -0
  126. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheDelete.js +8 -0
  127. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheGet.js +7 -0
  128. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheHas.js +7 -0
  129. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheSet.js +8 -0
  130. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapToArray.js +9 -0
  131. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nativeCreate.js +5 -0
  132. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nativeKeys.js +5 -0
  133. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nativeKeysIn.js +8 -0
  134. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nodeUtil.js +9 -0
  135. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_objectToString.js +7 -0
  136. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_overArg.js +8 -0
  137. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_overRest.js +13 -0
  138. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_root.js +5 -0
  139. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_safeGet.js +6 -0
  140. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_setCacheAdd.js +7 -0
  141. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_setCacheHas.js +6 -0
  142. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_setToArray.js +9 -0
  143. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_setToString.js +6 -0
  144. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_shortOut.js +14 -0
  145. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackClear.js +7 -0
  146. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackDelete.js +7 -0
  147. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackGet.js +6 -0
  148. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackHas.js +6 -0
  149. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackSet.js +16 -0
  150. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_toSource.js +15 -0
  151. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_trimmedEndIndex.js +8 -0
  152. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/cloneDeep.js +8 -0
  153. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/constant.js +8 -0
  154. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/debounce.js +50 -0
  155. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/defaults.js +16 -0
  156. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/eq.js +6 -0
  157. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/identity.js +6 -0
  158. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArguments.js +10 -0
  159. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArray.js +4 -0
  160. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArrayLike.js +8 -0
  161. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArrayLikeObject.js +8 -0
  162. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isBuffer.js +6 -0
  163. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isEmpty.js +21 -0
  164. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isEqual.js +7 -0
  165. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isFunction.js +11 -0
  166. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isLength.js +7 -0
  167. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isMap.js +7 -0
  168. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isObject.js +7 -0
  169. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isObjectLike.js +6 -0
  170. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isPlainObject.js +14 -0
  171. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isSet.js +7 -0
  172. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isSymbol.js +9 -0
  173. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isTypedArray.js +7 -0
  174. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/keys.js +9 -0
  175. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/keysIn.js +9 -0
  176. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/merge.js +8 -0
  177. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/now.js +7 -0
  178. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/stubArray.js +6 -0
  179. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/stubFalse.js +6 -0
  180. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/toNumber.js +19 -0
  181. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/toPlainObject.js +8 -0
  182. package/dist/print/index.d.ts +15 -0
  183. package/dist/print/index.js +44 -0
  184. package/package.json +57 -27
  185. package/CHANGELOG.json +0 -1972
  186. package/CHANGELOG.md +0 -2704
  187. package/LICENSE.md +0 -5
  188. package/PRINT.md +0 -35
  189. package/README.md +0 -56
  190. package/choice.png +0 -0
  191. package/configure/CHANGELOG.json +0 -1387
  192. package/configure/CHANGELOG.md +0 -2054
  193. package/configure/lib/defaults.js +0 -203
  194. package/configure/lib/defaults.js.map +0 -1
  195. package/configure/lib/index.js +0 -202
  196. package/configure/lib/index.js.map +0 -1
  197. package/configure/lib/main.js +0 -484
  198. package/configure/lib/main.js.map +0 -1
  199. package/configure/lib/utils.js +0 -18
  200. package/configure/lib/utils.js.map +0 -1
  201. package/configure/package.json +0 -22
  202. package/controller/CHANGELOG.json +0 -527
  203. package/controller/CHANGELOG.md +0 -1394
  204. package/controller/lib/defaults.js +0 -33
  205. package/controller/lib/defaults.js.map +0 -1
  206. package/controller/lib/index.js +0 -288
  207. package/controller/lib/index.js.map +0 -1
  208. package/controller/lib/utils.js +0 -15
  209. package/controller/lib/utils.js.map +0 -1
  210. package/controller/package.json +0 -15
  211. package/docs/config-schema.json +0 -2993
  212. package/docs/config-schema.json.md +0 -2217
  213. package/docs/demo/config.js +0 -8
  214. package/docs/demo/generate.js +0 -61
  215. package/docs/demo/index.html +0 -1
  216. package/docs/demo/session.js +0 -7
  217. package/docs/pie-schema.json +0 -1332
  218. package/docs/pie-schema.json.md +0 -1015
  219. package/lib/choice-input.js +0 -374
  220. package/lib/choice-input.js.map +0 -1
  221. package/lib/choice.js +0 -192
  222. package/lib/choice.js.map +0 -1
  223. package/lib/feedback-tick.js +0 -134
  224. package/lib/feedback-tick.js.map +0 -1
  225. package/lib/index.js +0 -402
  226. package/lib/index.js.map +0 -1
  227. package/lib/main.js +0 -63
  228. package/lib/main.js.map +0 -1
  229. package/lib/multiple-choice.js +0 -397
  230. package/lib/multiple-choice.js.map +0 -1
  231. package/lib/print.js +0 -94
  232. package/lib/print.js.map +0 -1
  233. package/lib/session-updater.js +0 -37
  234. package/lib/session-updater.js.map +0 -1
  235. package/module/configure.js +0 -1
  236. package/module/controller.js +0 -3045
  237. package/module/demo.js +0 -86
  238. package/module/element.js +0 -1
  239. package/module/index.html +0 -21
  240. package/module/manifest.json +0 -14
  241. package/module/print-demo.js +0 -124
  242. package/module/print.html +0 -18
  243. package/module/print.js +0 -1
@@ -1,203 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- /** NOTE: teacherInstructions, studentInstructions, rationale & scoringType
8
- * functionalities are not defined yet - the value for those can belong to
9
- * model or to configure
10
- */
11
- var _default = exports.default = {
12
- model: {
13
- choiceMode: 'checkbox',
14
- choicePrefix: 'letters',
15
- choices: [],
16
- choicesLayout: 'vertical',
17
- feedbackEnabled: false,
18
- gridColumns: 2,
19
- lockChoiceOrder: true,
20
- partialScoring: true,
21
- prompt: '',
22
- promptEnabled: true,
23
- rationale: '',
24
- rationaleEnabled: true,
25
- scoringType: 'auto',
26
- studentInstructionsEnabled: true,
27
- teacherInstructions: '',
28
- teacherInstructionsEnabled: true,
29
- toolbarEditorPosition: 'bottom',
30
- selectedAnswerBackgroundColor: 'initial',
31
- keyboardEventsEnabled: false
32
- },
33
- configuration: {
34
- baseInputConfiguration: {
35
- h3: {
36
- disabled: true
37
- },
38
- audio: {
39
- disabled: false
40
- },
41
- video: {
42
- disabled: false
43
- },
44
- image: {
45
- disabled: false
46
- },
47
- textAlign: {
48
- disabled: true
49
- },
50
- showParagraphs: {
51
- disabled: false
52
- },
53
- separateParagraphs: {
54
- disabled: true
55
- }
56
- },
57
- choices: {
58
- inputConfiguration: {
59
- audio: {
60
- disabled: false
61
- },
62
- video: {
63
- disabled: false
64
- },
65
- image: {
66
- disabled: false
67
- }
68
- }
69
- },
70
- spellCheck: {
71
- label: 'Spellcheck',
72
- settings: false,
73
- enabled: true
74
- },
75
- choicesLayout: {
76
- settings: false,
77
- label: 'Choices Layout'
78
- },
79
- gridColumns: {
80
- label: 'Grid columns'
81
- },
82
- answerChoiceCount: 0,
83
- addChoiceButton: {
84
- settings: true,
85
- label: 'Add a Choice'
86
- },
87
- choiceMode: {
88
- settings: true,
89
- label: 'Response Type'
90
- },
91
- choicePrefix: {
92
- settings: true,
93
- label: 'Choice Labels'
94
- },
95
- deleteChoice: {
96
- settings: true
97
- },
98
- feedback: {
99
- settings: true,
100
- label: 'Feedback'
101
- },
102
- prompt: {
103
- settings: true,
104
- label: 'Prompt',
105
- inputConfiguration: {
106
- audio: {
107
- disabled: false
108
- },
109
- video: {
110
- disabled: false
111
- },
112
- image: {
113
- disabled: false
114
- }
115
- },
116
- required: false
117
- },
118
- lockChoiceOrder: {
119
- settings: true,
120
- label: 'Lock Choice Order'
121
- },
122
- partialScoring: {
123
- settings: false,
124
- label: 'Allow Partial Scoring'
125
- },
126
- rationale: {
127
- settings: true,
128
- label: 'Rationale',
129
- inputConfiguration: {
130
- audio: {
131
- disabled: true
132
- },
133
- video: {
134
- disabled: true
135
- },
136
- image: {
137
- disabled: false
138
- }
139
- },
140
- required: false
141
- },
142
- scoringType: {
143
- settings: false,
144
- label: 'Scoring Type'
145
- },
146
- studentInstructions: {
147
- settings: false,
148
- label: 'Student Instructions'
149
- },
150
- teacherInstructions: {
151
- settings: true,
152
- label: 'Teacher Instructions',
153
- inputConfiguration: {
154
- audio: {
155
- disabled: false
156
- },
157
- video: {
158
- disabled: false
159
- },
160
- image: {
161
- disabled: false
162
- }
163
- },
164
- required: false
165
- },
166
- toolbarEditorPosition: {
167
- settings: false,
168
- label: 'Toolbar Editor Position'
169
- },
170
- minAnswerChoices: 2,
171
- maxAnswerChoices: 5,
172
- maxImageWidth: {
173
- teacherInstructions: 300,
174
- prompt: 300,
175
- rationale: 636,
176
- choices: 900
177
- },
178
- maxImageHeight: {
179
- teacherInstructions: 300,
180
- prompt: 300,
181
- rationale: 300,
182
- choices: 300
183
- },
184
- withRubric: {
185
- settings: false,
186
- label: 'Add Rubric'
187
- },
188
- mathMlOptions: {
189
- mmlOutput: false,
190
- mmlEditing: false
191
- },
192
- language: {
193
- settings: false,
194
- label: 'Specify Language',
195
- enabled: false
196
- },
197
- languageChoices: {
198
- label: 'Language Choices',
199
- options: []
200
- }
201
- }
202
- };
203
- //# sourceMappingURL=defaults.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"defaults.js","names":["_default","exports","default","model","choiceMode","choicePrefix","choices","choicesLayout","feedbackEnabled","gridColumns","lockChoiceOrder","partialScoring","prompt","promptEnabled","rationale","rationaleEnabled","scoringType","studentInstructionsEnabled","teacherInstructions","teacherInstructionsEnabled","toolbarEditorPosition","selectedAnswerBackgroundColor","keyboardEventsEnabled","configuration","baseInputConfiguration","h3","disabled","audio","video","image","textAlign","showParagraphs","separateParagraphs","inputConfiguration","spellCheck","label","settings","enabled","answerChoiceCount","addChoiceButton","deleteChoice","feedback","required","studentInstructions","minAnswerChoices","maxAnswerChoices","maxImageWidth","maxImageHeight","withRubric","mathMlOptions","mmlOutput","mmlEditing","language","languageChoices","options"],"sources":["../src/defaults.js"],"sourcesContent":["/** NOTE: teacherInstructions, studentInstructions, rationale & scoringType\n * functionalities are not defined yet - the value for those can belong to\n * model or to configure\n */\nexport default {\n model: {\n choiceMode: 'checkbox',\n choicePrefix: 'letters',\n choices: [],\n choicesLayout: 'vertical',\n feedbackEnabled: false,\n gridColumns: 2,\n lockChoiceOrder: true,\n partialScoring: true,\n prompt: '',\n promptEnabled: true,\n rationale: '',\n rationaleEnabled: true,\n scoringType: 'auto',\n studentInstructionsEnabled: true,\n teacherInstructions: '',\n teacherInstructionsEnabled: true,\n toolbarEditorPosition: 'bottom',\n selectedAnswerBackgroundColor: 'initial',\n keyboardEventsEnabled: false,\n },\n configuration: {\n baseInputConfiguration: {\n h3: { disabled: true },\n audio: { disabled: false },\n video: { disabled: false },\n image: { disabled: false },\n textAlign: { disabled: true },\n showParagraphs: { disabled: false },\n separateParagraphs: { disabled: true },\n },\n choices: {\n inputConfiguration: {\n audio: { disabled: false },\n video: { disabled: false },\n image: { disabled: false },\n },\n },\n spellCheck: {\n label: 'Spellcheck',\n settings: false,\n enabled: true,\n },\n choicesLayout: {\n settings: false,\n label: 'Choices Layout',\n },\n gridColumns: {\n label: 'Grid columns',\n },\n answerChoiceCount: 0,\n addChoiceButton: {\n settings: true,\n label: 'Add a Choice',\n },\n choiceMode: {\n settings: true,\n label: 'Response Type',\n },\n choicePrefix: {\n settings: true,\n label: 'Choice Labels',\n },\n deleteChoice: {\n settings: true,\n },\n feedback: {\n settings: true,\n label: 'Feedback',\n },\n prompt: {\n settings: true,\n label: 'Prompt',\n inputConfiguration: {\n audio: { disabled: false },\n video: { disabled: false },\n image: { disabled: false },\n },\n required: false,\n },\n lockChoiceOrder: {\n settings: true,\n label: 'Lock Choice Order',\n },\n partialScoring: {\n settings: false,\n label: 'Allow Partial Scoring',\n },\n rationale: {\n settings: true,\n label: 'Rationale',\n inputConfiguration: {\n audio: { disabled: true },\n video: { disabled: true },\n image: { disabled: false },\n },\n required: false,\n },\n scoringType: {\n settings: false,\n label: 'Scoring Type',\n },\n studentInstructions: {\n settings: false,\n label: 'Student Instructions',\n },\n teacherInstructions: {\n settings: true,\n label: 'Teacher Instructions',\n inputConfiguration: {\n audio: { disabled: false },\n video: { disabled: false },\n image: { disabled: false },\n },\n required: false,\n },\n toolbarEditorPosition: {\n settings: false,\n label: 'Toolbar Editor Position',\n },\n minAnswerChoices: 2,\n maxAnswerChoices: 5,\n maxImageWidth: {\n teacherInstructions: 300,\n prompt: 300,\n rationale: 636,\n choices: 900,\n },\n maxImageHeight: {\n teacherInstructions: 300,\n prompt: 300,\n rationale: 300,\n choices: 300,\n },\n withRubric: {\n settings: false,\n label: 'Add Rubric',\n },\n mathMlOptions: {\n mmlOutput: false,\n mmlEditing: false,\n },\n language: {\n settings: false,\n label: 'Specify Language',\n enabled: false,\n },\n languageChoices: {\n label: 'Language Choices',\n options: [],\n },\n },\n};\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AAHA,IAAAA,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAIe;EACbC,KAAK,EAAE;IACLC,UAAU,EAAE,UAAU;IACtBC,YAAY,EAAE,SAAS;IACvBC,OAAO,EAAE,EAAE;IACXC,aAAa,EAAE,UAAU;IACzBC,eAAe,EAAE,KAAK;IACtBC,WAAW,EAAE,CAAC;IACdC,eAAe,EAAE,IAAI;IACrBC,cAAc,EAAE,IAAI;IACpBC,MAAM,EAAE,EAAE;IACVC,aAAa,EAAE,IAAI;IACnBC,SAAS,EAAE,EAAE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CAAC;QAC1BE,KAAK,EAAE;UAAEF,QAAQ,EAAE;QAAM,CAAC;QAC1BG,KAAK,EAAE;UAAEH,QAAQ,EAAE;QAAM;MAC3B,CAAC;MACDgB,QAAQ,EAAE;IACZ,CAAC;IACDtB,qBAAqB,EAAE;MACrBgB,QAAQ,EAAE,KAAK;MACfD,KAAK,EAAE;IACT,CAAC;IACDS,gBAAgB,EAAE,CAAC;IACnBC,gBAAgB,EAAE,CAAC;IACnBC,aAAa,EAAE;MACb5B,mBAAmB,EAAE,GAAG;MACxBN,MAAM,EAAE,GAAG;MACXE,SAAS,EAAE,GAAG;MACdR,OAAO,EAAE;IACX,CAAC;IACDyC,cAAc,EAAE;MACd7B,mBAAmB,EAAE,GAAG;MACxBN,MAAM,EAAE,GAAG;MACXE,SAAS,EAAE,GAAG;MACdR,OAAO,EAAE;IACX,CAAC;IACD0C,UAAU,EAAE;MACVZ,QAAQ,EAAE,KAAK;MACfD,KAAK,EAAE;IACT,CAAC;IACDc,aAAa,EAAE;MACbC,SAAS,EAAE,KAAK;MAChBC,UAAU,EAAE;IACd,CAAC;IACDC,QAAQ,EAAE;MACRhB,QAAQ,EAAE,KAAK;MACfD,KAAK,EAAE,kBAAkB;MACzBE,OAAO,EAAE;IACX,CAAC;IACDgB,eAAe,EAAE;MACflB,KAAK,EAAE,kBAAkB;MACzBmB,OAAO,EAAE;IACX;EACF;AACF,CAAC","ignoreList":[]}
@@ -1,202 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = void 0;
8
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
- var _react = _interopRequireDefault(require("react"));
10
- var _client = require("react-dom/client");
11
- var _debug = _interopRequireDefault(require("debug"));
12
- var _pieConfigureEvents = require("@pie-framework/pie-configure-events");
13
- var _main = _interopRequireDefault(require("./main"));
14
- var _configUi = require("@pie-lib/config-ui");
15
- var _lodashEs = require("lodash-es");
16
- var _defaults = _interopRequireDefault(require("./defaults"));
17
- const log = (0, _debug.default)('multiple-choice:configure');
18
- const generateFormattedChoices = (choices, choiceCount = 0) => {
19
- if (!choices || choices.length === 0) {
20
- let formattedChoices = [];
21
- for (let i = 0; i < choiceCount; i++) {
22
- formattedChoices.push({
23
- value: `${i}`,
24
- label: '',
25
- feedback: {
26
- type: 'none',
27
- value: ''
28
- }
29
- });
30
- }
31
- return formattedChoices;
32
- }
33
- return choices;
34
- };
35
- const prepareCustomizationObject = (config, model) => {
36
- const configuration = (0, _lodashEs.defaults)(config, _defaults.default.configuration);
37
- return {
38
- configuration,
39
- model: {
40
- ...model,
41
- choices: generateFormattedChoices(model && model.choices || [], configuration && configuration.answerChoiceCount)
42
- }
43
- };
44
- };
45
- class MultipleChoice extends HTMLElement {
46
- constructor() {
47
- super();
48
- this._root = null;
49
- this._reactContainer = null;
50
- this._model = MultipleChoice.createDefaultModel();
51
- this._configuration = _defaults.default.configuration;
52
- this.onModelChanged = this.onModelChanged.bind(this);
53
- this.onConfigurationChanged = this.onConfigurationChanged.bind(this);
54
- }
55
- set model(s) {
56
- this._model = MultipleChoice.createDefaultModel(s);
57
- this._render();
58
- }
59
- set configuration(c) {
60
- const info = prepareCustomizationObject(c, this._model);
61
- this.onModelChanged(info.model);
62
- const newConfiguration = {
63
- ..._defaults.default.configuration,
64
- ...info.configuration
65
- };
66
- this._configuration = newConfiguration;
67
-
68
- // if language:enabled is true, then the corresponding default item model should include a language value;
69
- // if it is false, then the language field should be omitted from the item model.
70
- // if a default item model includes a language value (e.g., en_US) and the corresponding authoring view settings have language:settings = true,
71
- // then (a) language:enabled should also be true, and (b) that default language value should be represented in languageChoices[] (as a key).
72
- if (newConfiguration?.language?.enabled) {
73
- if (newConfiguration?.languageChoices?.options?.length) {
74
- this._model.language = newConfiguration?.languageChoices.options[0].value;
75
- }
76
- } else if (newConfiguration.language.settings && this._model.language) {
77
- this._configuration.language.enabled = true;
78
- if (!this._configuration.languageChoices.options || !this._configuration.languageChoices.options.length) {
79
- this._configuration.languageChoices.options = [];
80
- }
81
-
82
- // check if the language is already included in the languageChoices.options array
83
- // and if not, then add it.
84
- if (!this._configuration.languageChoices.options.find(option => option.value === this._model.language)) {
85
- this._configuration.languageChoices.options.push({
86
- value: this._model.language,
87
- label: this._model.language
88
- });
89
- }
90
- } else {
91
- delete this._model.language;
92
- }
93
- this._render();
94
- }
95
- set disableSidePanel(s) {
96
- this._disableSidePanel = s;
97
- this._render();
98
- }
99
- dispatchModelUpdated(reset) {
100
- const resetValue = !!reset;
101
- this.dispatchEvent(new _pieConfigureEvents.ModelUpdatedEvent(this._model, resetValue));
102
- }
103
- onModelChanged(m, reset) {
104
- this._model = {
105
- ...this._model,
106
- ...m
107
- };
108
- this._render();
109
- this.dispatchModelUpdated(reset);
110
- }
111
- onConfigurationChanged(c) {
112
- this._configuration = prepareCustomizationObject(c, this._model).configuration;
113
- if (this._model) {
114
- this.onModelChanged(this._model);
115
- }
116
- this._render();
117
- }
118
-
119
- /** @param {done, progress, file} handler */
120
- insertImage(handler) {
121
- this.dispatchEvent(new _pieConfigureEvents.InsertImageEvent(handler));
122
- }
123
- onDeleteImage(src, done) {
124
- this.dispatchEvent(new _pieConfigureEvents.DeleteImageEvent(src, done));
125
- }
126
- insertSound(handler) {
127
- this.dispatchEvent(new _pieConfigureEvents.InsertSoundEvent(handler));
128
- }
129
- onDeleteSound(src, done) {
130
- this.dispatchEvent(new _pieConfigureEvents.DeleteSoundEvent(src, done));
131
- }
132
- _render() {
133
- log('_render - Starting render');
134
- log('_render - Model:', this._model ? 'present' : 'missing');
135
- log('_render - Configuration:', this._configuration ? 'present' : 'missing');
136
- log('_render - Root exists:', !!this._root);
137
- try {
138
- let element = /*#__PURE__*/_react.default.createElement(_main.default, {
139
- model: this._model,
140
- configuration: this._configuration,
141
- onModelChanged: this.onModelChanged,
142
- onConfigurationChanged: this.onConfigurationChanged,
143
- disableSidePanel: this._disableSidePanel,
144
- imageSupport: {
145
- add: this.insertImage.bind(this),
146
- delete: this.onDeleteImage.bind(this)
147
- },
148
- uploadSoundSupport: {
149
- add: this.insertSound.bind(this),
150
- delete: this.onDeleteSound.bind(this)
151
- }
152
- });
153
- if (!this._root) {
154
- log('_render - Creating React container');
155
-
156
- // Create a container div for React to render into
157
- this._reactContainer = document.createElement('div');
158
- this._reactContainer.className = 'pie-configure-wrapper';
159
- this.appendChild(this._reactContainer);
160
- log('_render - Creating new React root');
161
- this._root = (0, _client.createRoot)(this._reactContainer);
162
- log('_render - React root created successfully');
163
- }
164
- log('_render - Calling root.render()');
165
- this._root.render(element);
166
- log('_render - Render completed successfully');
167
- } catch (error) {
168
- console.error('❌ [multiple-choice-configure] Render error:', error);
169
- console.error('Error stack:', error.stack);
170
- throw error;
171
- }
172
- }
173
- connectedCallback() {
174
- log('connectedCallback - Component connected to DOM');
175
- log('connectedCallback - Model:', this._model ? 'present' : 'missing');
176
- log('connectedCallback - Configuration:', this._configuration ? 'present' : 'missing');
177
- }
178
- disconnectedCallback() {
179
- log('disconnectedCallback - Component disconnected from DOM');
180
- if (this._root) {
181
- log('disconnectedCallback - Unmounting React root');
182
- this._root.unmount();
183
- this._root = null;
184
- }
185
- if (this._reactContainer) {
186
- this._reactContainer = null;
187
- }
188
- }
189
- }
190
- exports.default = MultipleChoice;
191
- (0, _defineProperty2.default)(MultipleChoice, "createDefaultModel", (model = {}) => {
192
- const normalizedModel = _configUi.choiceUtils.normalizeChoices({
193
- ..._defaults.default.model,
194
- ...model,
195
- choices: generateFormattedChoices(model && model.choices || [])
196
- });
197
-
198
- // This is used for offering support for old models which have the property "verticalMode"
199
- normalizedModel.choicesLayout = model.choicesLayout || model.verticalMode === false && 'horizontal' || _defaults.default.model.choicesLayout;
200
- return normalizedModel;
201
- });
202
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","names":["_react","_interopRequireDefault","require","_client","_debug","_pieConfigureEvents","_main","_configUi","_lodashEs","_defaults","log","debug","generateFormattedChoices","choices","choiceCount","length","formattedChoices","i","push","value","label","feedback","type","prepareCustomizationObject","config","model","configuration","defaults","sensibleDefaults","answerChoiceCount","MultipleChoice","HTMLElement","constructor","_root","_reactContainer","_model","createDefaultModel","_configuration","onModelChanged","bind","onConfigurationChanged","s","_render","c","info","newConfiguration","language","enabled","languageChoices","options","settings","find","option","disableSidePanel","_disableSidePanel","dispatchModelUpdated","reset","resetValue","dispatchEvent","ModelUpdatedEvent","m","insertImage","handler","InsertImageEvent","onDeleteImage","src","done","DeleteImageEvent","insertSound","InsertSoundEvent","onDeleteSound","DeleteSoundEvent","element","React","createElement","Main","imageSupport","add","delete","uploadSoundSupport","document","className","appendChild","createRoot","render","error","console","stack","connectedCallback","disconnectedCallback","unmount","exports","default","_defineProperty2","normalizedModel","utils","normalizeChoices","choicesLayout","verticalMode"],"sources":["../src/index.js"],"sourcesContent":["import React from 'react';\nimport { createRoot } from 'react-dom/client';\nimport debug from 'debug';\nimport {\n DeleteImageEvent,\n InsertImageEvent,\n ModelUpdatedEvent,\n InsertSoundEvent,\n DeleteSoundEvent,\n} from '@pie-framework/pie-configure-events';\n\nimport Main from './main';\nimport { choiceUtils as utils } from '@pie-lib/config-ui';\nimport { defaults } from 'lodash-es';\n\nimport sensibleDefaults from './defaults';\n\nconst log = debug('multiple-choice:configure');\n\nconst generateFormattedChoices = (choices, choiceCount = 0) => {\n if (!choices || choices.length === 0) {\n let formattedChoices = [];\n\n for (let i = 0; i < choiceCount; i++) {\n formattedChoices.push({\n value: `${i}`,\n label: '',\n feedback: {\n type: 'none',\n value: '',\n },\n });\n }\n\n return formattedChoices;\n }\n\n return choices;\n};\n\nconst prepareCustomizationObject = (config, model) => {\n const configuration = defaults(config, sensibleDefaults.configuration);\n\n return {\n configuration,\n model: {\n ...model,\n choices: generateFormattedChoices(\n (model && model.choices) || [],\n configuration && configuration.answerChoiceCount,\n ),\n },\n };\n};\n\nexport default class MultipleChoice extends HTMLElement {\n static createDefaultModel = (model = {}) => {\n const normalizedModel = utils.normalizeChoices({\n ...sensibleDefaults.model,\n ...model,\n choices: generateFormattedChoices((model && model.choices) || []),\n });\n\n // This is used for offering support for old models which have the property \"verticalMode\"\n normalizedModel.choicesLayout =\n model.choicesLayout || (model.verticalMode === false && 'horizontal') || sensibleDefaults.model.choicesLayout;\n\n return normalizedModel;\n };\n\n constructor() {\n super();\n this._root = null;\n this._reactContainer = null;\n this._model = MultipleChoice.createDefaultModel();\n this._configuration = sensibleDefaults.configuration;\n this.onModelChanged = this.onModelChanged.bind(this);\n this.onConfigurationChanged = this.onConfigurationChanged.bind(this);\n }\n\n set model(s) {\n this._model = MultipleChoice.createDefaultModel(s);\n\n this._render();\n }\n\n set configuration(c) {\n const info = prepareCustomizationObject(c, this._model);\n\n this.onModelChanged(info.model);\n\n const newConfiguration = {\n ...sensibleDefaults.configuration,\n ...info.configuration,\n };\n this._configuration = newConfiguration;\n\n // if language:enabled is true, then the corresponding default item model should include a language value;\n // if it is false, then the language field should be omitted from the item model.\n // if a default item model includes a language value (e.g., en_US) and the corresponding authoring view settings have language:settings = true,\n // then (a) language:enabled should also be true, and (b) that default language value should be represented in languageChoices[] (as a key).\n if (newConfiguration?.language?.enabled) {\n if (newConfiguration?.languageChoices?.options?.length) {\n this._model.language = newConfiguration?.languageChoices.options[0].value;\n }\n } else if (newConfiguration.language.settings && this._model.language) {\n this._configuration.language.enabled = true;\n\n if (!this._configuration.languageChoices.options || !this._configuration.languageChoices.options.length) {\n this._configuration.languageChoices.options = [];\n }\n\n // check if the language is already included in the languageChoices.options array\n // and if not, then add it.\n if (!this._configuration.languageChoices.options.find((option) => option.value === this._model.language)) {\n this._configuration.languageChoices.options.push({\n value: this._model.language,\n label: this._model.language,\n });\n }\n } else {\n delete this._model.language;\n }\n\n this._render();\n }\n\n set disableSidePanel(s) {\n this._disableSidePanel = s;\n this._render();\n }\n\n dispatchModelUpdated(reset) {\n const resetValue = !!reset;\n\n this.dispatchEvent(new ModelUpdatedEvent(this._model, resetValue));\n }\n\n onModelChanged(m, reset) {\n this._model = {\n ...this._model,\n ...m,\n };\n this._render();\n\n this.dispatchModelUpdated(reset);\n }\n\n onConfigurationChanged(c) {\n this._configuration = prepareCustomizationObject(c, this._model).configuration;\n\n if (this._model) {\n this.onModelChanged(this._model);\n }\n\n this._render();\n }\n\n /** @param {done, progress, file} handler */\n insertImage(handler) {\n this.dispatchEvent(new InsertImageEvent(handler));\n }\n\n onDeleteImage(src, done) {\n this.dispatchEvent(new DeleteImageEvent(src, done));\n }\n\n insertSound(handler) {\n this.dispatchEvent(new InsertSoundEvent(handler));\n }\n\n onDeleteSound(src, done) {\n this.dispatchEvent(new DeleteSoundEvent(src, done));\n }\n\n _render() {\n log('_render - Starting render');\n log('_render - Model:', this._model ? 'present' : 'missing');\n log('_render - Configuration:', this._configuration ? 'present' : 'missing');\n log('_render - Root exists:', !!this._root);\n\n try {\n let element = React.createElement(Main, {\n model: this._model,\n configuration: this._configuration,\n onModelChanged: this.onModelChanged,\n onConfigurationChanged: this.onConfigurationChanged,\n disableSidePanel: this._disableSidePanel,\n imageSupport: {\n add: this.insertImage.bind(this),\n delete: this.onDeleteImage.bind(this),\n },\n uploadSoundSupport: {\n add: this.insertSound.bind(this),\n delete: this.onDeleteSound.bind(this),\n },\n });\n\n if (!this._root) {\n log('_render - Creating React container');\n\n // Create a container div for React to render into\n this._reactContainer = document.createElement('div');\n this._reactContainer.className = 'pie-configure-wrapper';\n this.appendChild(this._reactContainer);\n\n log('_render - Creating new React root');\n this._root = createRoot(this._reactContainer);\n log('_render - React root created successfully');\n }\n\n log('_render - Calling root.render()');\n this._root.render(element);\n log('_render - Render completed successfully');\n } catch (error) {\n console.error('❌ [multiple-choice-configure] Render error:', error);\n console.error('Error stack:', error.stack);\n throw error;\n }\n }\n\n connectedCallback() {\n log('connectedCallback - Component connected to DOM');\n log('connectedCallback - Model:', this._model ? 'present' : 'missing');\n log('connectedCallback - Configuration:', this._configuration ? 'present' : 'missing');\n }\n\n disconnectedCallback() {\n log('disconnectedCallback - Component disconnected from DOM');\n if (this._root) {\n log('disconnectedCallback - Unmounting React root');\n this._root.unmount();\n this._root = null;\n }\n if (this._reactContainer) {\n this._reactContainer = null;\n }\n }\n}\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,mBAAA,GAAAH,OAAA;AAQA,IAAAI,KAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AAEA,IAAAO,SAAA,GAAAR,sBAAA,CAAAC,OAAA;AAEA,MAAMQ,GAAG,GAAG,IAAAC,cAAK,EAAC,2BAA2B,CAAC;AAE9C,MAAMC,wBAAwB,GAAGA,CAACC,OAAO,EAAEC,WAAW,GAAG,CAAC,KAAK;EAC7D,IAAI,CAACD,OAAO,IAAIA,OAAO,CAACE,MAAM,KAAK,CAAC,EAAE;IACpC,IAAIC,gBAAgB,GAAG,EAAE;IAEzB,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGH,WAAW,EAAEG,CAAC,EAAE,EAAE;MACpCD,gBAAgB,CAACE,IAAI,CAAC;QACpBC,KAAK,EAAE,GAAGF,CAAC,EAAE;QACbG,KAAK,EAAE,EAAE;QACTC,QAAQ,EAAE;UACRC,IAAI,EAAE,MAAM;UACZH,KAAK,EAAE;QACT;MACF,CAAC,CAAC;IACJ;IAEA,OAAOH,gBAAgB;EACzB;EAEA,OAAOH,OAAO;AAChB,CAAC;AAED,MAAMU,0BAA0B,GAAGA,CAACC,MAAM,EAAEC,KAAK,KAAK;EACpD,MAAMC,aAAa,GAAG,IAAAC,kBAAQ,EAACH,MAAM,EAAEI,iBAAgB,CAACF,aAAa,CAAC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