@pie-element/categorize 13.1.0-next.19 → 13.1.1-next.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/dist/author/defaults.d.ts +223 -0
- package/dist/author/defaults.js +170 -0
- package/dist/author/design/builder.d.ts +10 -0
- package/dist/author/design/builder.js +24 -0
- package/dist/author/design/buttons.d.ts +28 -0
- package/dist/author/design/buttons.js +36 -0
- package/dist/author/design/categories/RowLabel.d.ts +23 -0
- package/dist/author/design/categories/RowLabel.js +47 -0
- package/dist/author/design/categories/alternateResponses.d.ts +31 -0
- package/dist/author/design/categories/alternateResponses.js +62 -0
- package/dist/author/design/categories/category.d.ts +44 -0
- package/dist/author/design/categories/category.js +98 -0
- package/dist/author/design/categories/choice-preview.d.ts +25 -0
- package/dist/author/design/categories/choice-preview.js +60 -0
- package/dist/author/design/categories/droppable-placeholder.d.ts +11 -0
- package/dist/author/design/categories/droppable-placeholder.js +71 -0
- package/dist/author/design/categories/index.d.ts +41 -0
- package/dist/author/design/categories/index.js +146 -0
- package/dist/author/design/choices/choice.d.ts +11 -0
- package/dist/author/design/choices/choice.js +129 -0
- package/dist/author/design/choices/config.d.ts +21 -0
- package/dist/author/design/choices/config.js +33 -0
- package/dist/author/design/choices/index.d.ts +41 -0
- package/dist/author/design/choices/index.js +110 -0
- package/dist/author/design/header.d.ts +24 -0
- package/dist/author/design/header.js +49 -0
- package/dist/author/design/index.d.ts +52 -0
- package/dist/author/design/index.js +417 -0
- package/dist/author/design/input-header.d.ts +39 -0
- package/dist/author/design/input-header.js +69 -0
- package/dist/author/design/utils.d.ts +9 -0
- package/dist/author/design/utils.js +7 -0
- package/dist/author/index.d.ts +51 -0
- package/dist/author/index.js +87 -0
- package/dist/author/main.d.ts +23 -0
- package/dist/author/main.js +30 -0
- package/dist/author/utils.d.ts +16 -0
- package/dist/author/utils.js +17 -0
- package/dist/controller/defaults.d.ts +34 -0
- package/dist/controller/defaults.js +29 -0
- package/dist/controller/index.d.ts +61 -0
- package/dist/controller/index.js +155 -0
- package/dist/controller/utils.d.ts +20 -0
- package/dist/controller/utils.js +35 -0
- package/dist/delivery/categorize/categories.d.ts +34 -0
- package/dist/delivery/categorize/categories.js +66 -0
- package/dist/delivery/categorize/category.d.ts +28 -0
- package/dist/delivery/categorize/category.js +48 -0
- package/dist/delivery/categorize/choice.d.ts +27 -0
- package/dist/delivery/categorize/choice.js +94 -0
- package/dist/delivery/categorize/choices.d.ts +39 -0
- package/dist/delivery/categorize/choices.js +51 -0
- package/dist/delivery/categorize/droppable-placeholder.d.ts +32 -0
- package/dist/delivery/categorize/droppable-placeholder.js +64 -0
- package/dist/delivery/categorize/grid-content.d.ts +25 -0
- package/dist/delivery/categorize/grid-content.js +39 -0
- package/dist/delivery/categorize/index.d.ts +57 -0
- package/dist/delivery/categorize/index.js +260 -0
- package/dist/delivery/index.d.ts +27 -0
- package/dist/delivery/index.js +152 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.iife.d.ts +8 -0
- package/dist/index.iife.js +152 -0
- package/dist/index.js +2 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_DataView.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Hash.js +16 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_ListCache.js +16 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Map.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_MapCache.js +16 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Promise.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Set.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Stack.js +14 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Symbol.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Uint8Array.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_WeakMap.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayEach.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayFilter.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayLikeKeys.js +15 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayPush.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_assignValue.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_assocIndexOf.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseAssign.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseAssignIn.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseAssignValue.js +12 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseClone.js +57 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseCreate.js +14 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseGetAllKeys.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseGetTag.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsArguments.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsMap.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsNative.js +11 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsSet.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsTypedArray.js +11 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseKeys.js +12 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseKeysIn.js +13 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseTimes.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseUnary.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneArrayBuffer.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneBuffer.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneDataView.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneRegExp.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneSymbol.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneTypedArray.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copyArray.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copyObject.js +14 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copySymbols.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copySymbolsIn.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_coreJsData.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_defineProperty.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_freeGlobal.js +4 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getAllKeys.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getAllKeysIn.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getMapData.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getNative.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getPrototype.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getRawTag.js +14 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getSymbols.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getSymbolsIn.js +11 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getTag.js +23 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getValue.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashClear.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashDelete.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashGet.js +13 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashHas.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashSet.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_initCloneArray.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_initCloneByTag.js +33 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_initCloneObject.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isIndex.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isKeyable.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isMasked.js +11 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isPrototype.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheClear.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheDelete.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheGet.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheHas.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheSet.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheClear.js +13 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheDelete.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheGet.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheHas.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheSet.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nativeCreate.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nativeKeys.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nativeKeysIn.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nodeUtil.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_objectToString.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_overArg.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_root.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackClear.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackDelete.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackGet.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackHas.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackSet.js +16 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_toSource.js +15 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/cloneDeep.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/eq.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArguments.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArray.js +4 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArrayLike.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isBuffer.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isEmpty.js +21 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isFunction.js +11 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isLength.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isMap.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isObject.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isObjectLike.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isSet.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isTypedArray.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/keys.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/keysIn.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/stubArray.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/stubFalse.js +6 -0
- package/package.json +53 -17
- package/CHANGELOG.json +0 -1637
- package/CHANGELOG.md +0 -2524
- package/LICENSE.md +0 -5
- package/README.md +0 -5
- package/configure/CHANGELOG.json +0 -1202
- package/configure/CHANGELOG.md +0 -2107
- package/configure/lib/defaults.js +0 -222
- package/configure/lib/defaults.js.map +0 -1
- package/configure/lib/design/builder.js +0 -55
- package/configure/lib/design/builder.js.map +0 -1
- package/configure/lib/design/buttons.js +0 -59
- package/configure/lib/design/buttons.js.map +0 -1
- package/configure/lib/design/categories/RowLabel.js +0 -66
- package/configure/lib/design/categories/RowLabel.js.map +0 -1
- package/configure/lib/design/categories/alternateResponses.js +0 -116
- package/configure/lib/design/categories/alternateResponses.js.map +0 -1
- package/configure/lib/design/categories/category.js +0 -153
- package/configure/lib/design/categories/category.js.map +0 -1
- package/configure/lib/design/categories/choice-preview.js +0 -79
- package/configure/lib/design/categories/choice-preview.js.map +0 -1
- package/configure/lib/design/categories/droppable-placeholder.js +0 -93
- package/configure/lib/design/categories/droppable-placeholder.js.map +0 -1
- package/configure/lib/design/categories/index.js +0 -256
- package/configure/lib/design/categories/index.js.map +0 -1
- package/configure/lib/design/choices/choice.js +0 -187
- package/configure/lib/design/choices/choice.js.map +0 -1
- package/configure/lib/design/choices/config.js +0 -58
- package/configure/lib/design/choices/config.js.map +0 -1
- package/configure/lib/design/choices/index.js +0 -197
- package/configure/lib/design/choices/index.js.map +0 -1
- package/configure/lib/design/header.js +0 -71
- package/configure/lib/design/header.js.map +0 -1
- package/configure/lib/design/index.js +0 -727
- package/configure/lib/design/index.js.map +0 -1
- package/configure/lib/design/input-header.js +0 -105
- package/configure/lib/design/input-header.js.map +0 -1
- package/configure/lib/design/utils.js +0 -12
- package/configure/lib/design/utils.js.map +0 -1
- package/configure/lib/index.js +0 -147
- package/configure/lib/index.js.map +0 -1
- package/configure/lib/main.js +0 -44
- package/configure/lib/main.js.map +0 -1
- package/configure/lib/utils.js +0 -43
- package/configure/lib/utils.js.map +0 -1
- package/configure/package.json +0 -32
- package/controller/CHANGELOG.json +0 -452
- package/controller/CHANGELOG.md +0 -1366
- package/controller/lib/defaults.js +0 -33
- package/controller/lib/defaults.js.map +0 -1
- package/controller/lib/index.js +0 -479
- package/controller/lib/index.js.map +0 -1
- package/controller/lib/utils.js +0 -69
- package/controller/lib/utils.js.map +0 -1
- package/controller/package.json +0 -18
- package/docs/config-schema.json +0 -2897
- package/docs/config-schema.json.md +0 -2138
- package/docs/demo/config.js +0 -8
- package/docs/demo/generate.js +0 -357
- package/docs/demo/index.html +0 -1
- package/docs/demo/session.js +0 -12
- package/docs/pie-schema.json +0 -1784
- package/docs/pie-schema.json.md +0 -1046
- package/lib/categorize/categories.js +0 -135
- package/lib/categorize/categories.js.map +0 -1
- package/lib/categorize/category.js +0 -67
- package/lib/categorize/category.js.map +0 -1
- package/lib/categorize/choice.js +0 -140
- package/lib/categorize/choice.js.map +0 -1
- package/lib/categorize/choices.js +0 -99
- package/lib/categorize/choices.js.map +0 -1
- package/lib/categorize/droppable-placeholder.js +0 -84
- package/lib/categorize/droppable-placeholder.js.map +0 -1
- package/lib/categorize/grid-content.js +0 -55
- package/lib/categorize/grid-content.js.map +0 -1
- package/lib/categorize/index.js +0 -450
- package/lib/categorize/index.js.map +0 -1
- package/lib/index.js +0 -316
- package/lib/index.js.map +0 -1
package/lib/index.js
DELETED
|
@@ -1,316 +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 _mathRendering = require("@pie-lib/math-rendering");
|
|
12
|
-
var _renderUi = require("@pie-lib/render-ui");
|
|
13
|
-
var _piePlayerEvents = require("@pie-framework/pie-player-events");
|
|
14
|
-
var _categorize = _interopRequireDefault(require("./categorize"));
|
|
15
|
-
class Categorize extends HTMLElement {
|
|
16
|
-
constructor() {
|
|
17
|
-
super();
|
|
18
|
-
(0, _defineProperty2.default)(this, "_scheduleMathRender", () => {
|
|
19
|
-
if (this._mathRenderPending) return;
|
|
20
|
-
this._mathRenderPending = true;
|
|
21
|
-
requestAnimationFrame(() => {
|
|
22
|
-
if (this._mathObserver && !this._mathObserverPaused) {
|
|
23
|
-
this._mathObserver.disconnect();
|
|
24
|
-
}
|
|
25
|
-
(0, _mathRendering.renderMath)(this);
|
|
26
|
-
this._mathRenderPending = false;
|
|
27
|
-
setTimeout(() => {
|
|
28
|
-
if (this._mathObserver && !this._mathObserverPaused) {
|
|
29
|
-
this._mathObserver.observe(this, {
|
|
30
|
-
childList: true,
|
|
31
|
-
subtree: true,
|
|
32
|
-
characterData: false
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
}, 50);
|
|
36
|
-
});
|
|
37
|
-
});
|
|
38
|
-
(0, _defineProperty2.default)(this, "pauseMathObserver", () => {
|
|
39
|
-
if (this._mathObserver) {
|
|
40
|
-
this._mathObserver.disconnect();
|
|
41
|
-
this._mathObserverPaused = true;
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
(0, _defineProperty2.default)(this, "resumeMathObserver", () => {
|
|
45
|
-
if (this._mathObserverPaused) {
|
|
46
|
-
this._mathObserverPaused = false;
|
|
47
|
-
if (this._mathObserver) {
|
|
48
|
-
this._mathObserver.observe(this, {
|
|
49
|
-
childList: true,
|
|
50
|
-
subtree: true,
|
|
51
|
-
characterData: false
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
this._root = null;
|
|
57
|
-
this._mathObserver = null;
|
|
58
|
-
this._mathRenderPending = false;
|
|
59
|
-
}
|
|
60
|
-
_initMathObserver() {
|
|
61
|
-
if (this._mathObserver) return;
|
|
62
|
-
this._mathObserver = new MutationObserver(() => {
|
|
63
|
-
this._scheduleMathRender();
|
|
64
|
-
});
|
|
65
|
-
this._mathObserver.observe(this, {
|
|
66
|
-
childList: true,
|
|
67
|
-
subtree: true,
|
|
68
|
-
characterData: false
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
_disconnectMathObserver() {
|
|
72
|
-
if (this._mathObserver) {
|
|
73
|
-
this._mathObserver.disconnect();
|
|
74
|
-
this._mathObserver = null;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
set model(m) {
|
|
78
|
-
this._model = m;
|
|
79
|
-
this.eliminateBlindAnswersFromSession();
|
|
80
|
-
this.dispatchEvent(new _piePlayerEvents.ModelSetEvent(this.tagName.toLowerCase(), this.isComplete(), !!this._model));
|
|
81
|
-
// reset the audioInitialized to false since the model changed, and we might need to reinitialize the audio
|
|
82
|
-
this._audioInitialized = false;
|
|
83
|
-
this.render();
|
|
84
|
-
}
|
|
85
|
-
isComplete() {
|
|
86
|
-
const {
|
|
87
|
-
autoplayAudioEnabled,
|
|
88
|
-
choices,
|
|
89
|
-
completeAudioEnabled,
|
|
90
|
-
hasUnplacedChoices,
|
|
91
|
-
possibleResponses,
|
|
92
|
-
responseAreasToBeFilled
|
|
93
|
-
} = this._model || {};
|
|
94
|
-
const elementContext = this;
|
|
95
|
-
|
|
96
|
-
// check audio completion if audio settings are enabled and audio actually exists
|
|
97
|
-
if (autoplayAudioEnabled && completeAudioEnabled && !this.audioComplete) {
|
|
98
|
-
if (elementContext) {
|
|
99
|
-
const audio = elementContext.querySelector('audio');
|
|
100
|
-
const isInsidePrompt = audio && audio.closest('#preview-prompt');
|
|
101
|
-
|
|
102
|
-
// only require audio completion if audio exists and is inside the prompt
|
|
103
|
-
if (audio && isInsidePrompt) {
|
|
104
|
-
return false;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
if (!this._session || !this._session.answers) {
|
|
109
|
-
return false;
|
|
110
|
-
}
|
|
111
|
-
const {
|
|
112
|
-
answers
|
|
113
|
-
} = this._session;
|
|
114
|
-
if (!Array.isArray(answers)) {
|
|
115
|
-
return false;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
// filter answers by category and count the ones with content
|
|
119
|
-
const filledResponseAreas = answers.filter(answer => answer.choices.length).length;
|
|
120
|
-
// check if an answer choice was added to at least as many response areas
|
|
121
|
-
// as the number of populated response areas in the correct answer
|
|
122
|
-
const areResponseAreasFilled = filledResponseAreas >= responseAreasToBeFilled;
|
|
123
|
-
// check if multiple placements are allowed
|
|
124
|
-
const duplicatesAllowed = (choices || []).some(choice => choice.categoryCount === 0);
|
|
125
|
-
if (duplicatesAllowed) {
|
|
126
|
-
// an answer choice can be used multiple times
|
|
127
|
-
return areResponseAreasFilled;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
// any correct answer have any unplaced answer choices (by the author)
|
|
131
|
-
if (hasUnplacedChoices) {
|
|
132
|
-
return areResponseAreasFilled;
|
|
133
|
-
}
|
|
134
|
-
const allAnswersIds = answers.map(answer => answer.choices).flat();
|
|
135
|
-
|
|
136
|
-
// check if any correct answer have any unplaced answer choices (by the student)
|
|
137
|
-
const requiredAnswersPlaced = (possibleResponses || []).some(response => response.every(val => allAnswersIds.includes(val)));
|
|
138
|
-
|
|
139
|
-
// true - all choices (required for a correct response) were placed into a response area
|
|
140
|
-
return requiredAnswersPlaced;
|
|
141
|
-
}
|
|
142
|
-
set session(s) {
|
|
143
|
-
if (s && !s.answers) {
|
|
144
|
-
s.answers = [];
|
|
145
|
-
}
|
|
146
|
-
this._session = s;
|
|
147
|
-
this.render();
|
|
148
|
-
}
|
|
149
|
-
get session() {
|
|
150
|
-
return this._session;
|
|
151
|
-
}
|
|
152
|
-
eliminateBlindAnswersFromSession() {
|
|
153
|
-
const {
|
|
154
|
-
answers = []
|
|
155
|
-
} = this._session || {};
|
|
156
|
-
const {
|
|
157
|
-
choices = []
|
|
158
|
-
} = this._model || {};
|
|
159
|
-
const mappedChoices = choices.map(c => c.id) || [];
|
|
160
|
-
const filteredAnswers = answers.map(answer => {
|
|
161
|
-
const answerChoices = answer?.choices || [];
|
|
162
|
-
answer.choices = answerChoices.filter(c => mappedChoices.includes(c));
|
|
163
|
-
return answer;
|
|
164
|
-
});
|
|
165
|
-
if (filteredAnswers.length > 0) {
|
|
166
|
-
this.changeAnswers(filteredAnswers);
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
changeAnswers(answers) {
|
|
170
|
-
this._session.answers = answers;
|
|
171
|
-
this._session.selector = 'Mouse';
|
|
172
|
-
this.dispatchEvent(new _piePlayerEvents.SessionChangedEvent(this.tagName.toLowerCase(), this.isComplete()));
|
|
173
|
-
this.render();
|
|
174
|
-
}
|
|
175
|
-
onShowCorrectToggle() {
|
|
176
|
-
(0, _mathRendering.renderMath)(this);
|
|
177
|
-
}
|
|
178
|
-
_createAudioInfoToast() {
|
|
179
|
-
const info = document.createElement('div');
|
|
180
|
-
info.id = 'play-audio-info';
|
|
181
|
-
Object.assign(info.style, {
|
|
182
|
-
position: 'absolute',
|
|
183
|
-
top: 0,
|
|
184
|
-
width: '100%',
|
|
185
|
-
height: '100%',
|
|
186
|
-
display: 'flex',
|
|
187
|
-
justifyContent: 'center',
|
|
188
|
-
alignItems: 'center',
|
|
189
|
-
background: 'white',
|
|
190
|
-
zIndex: '1000',
|
|
191
|
-
cursor: 'pointer'
|
|
192
|
-
});
|
|
193
|
-
const img = document.createElement('img');
|
|
194
|
-
img.src = _renderUi.EnableAudioAutoplayImage;
|
|
195
|
-
img.alt = 'Click anywhere to enable audio autoplay';
|
|
196
|
-
img.width = 500;
|
|
197
|
-
img.height = 300;
|
|
198
|
-
info.appendChild(img);
|
|
199
|
-
return info;
|
|
200
|
-
}
|
|
201
|
-
connectedCallback() {
|
|
202
|
-
this._initMathObserver();
|
|
203
|
-
|
|
204
|
-
// Observation: audio in Chrome will have the autoplay attribute,
|
|
205
|
-
// while other browsers will not have the autoplay attribute and will need a user interaction to play the audio
|
|
206
|
-
// This workaround fixes the issue of audio being cached and played on any user interaction in Safari and Firefox
|
|
207
|
-
const observer = new MutationObserver((mutationsList, observer) => {
|
|
208
|
-
mutationsList.forEach(mutation => {
|
|
209
|
-
if (mutation.type === 'childList') {
|
|
210
|
-
if (this._audioInitialized) return;
|
|
211
|
-
const audio = this.querySelector('audio');
|
|
212
|
-
const isInsidePrompt = audio && audio.closest('#preview-prompt');
|
|
213
|
-
if (!this._model) return;
|
|
214
|
-
if (!this._model.autoplayAudioEnabled) return;
|
|
215
|
-
if (audio && !isInsidePrompt) return;
|
|
216
|
-
if (!audio) return;
|
|
217
|
-
const info = this._createAudioInfoToast();
|
|
218
|
-
const container = this.querySelector('#main-container');
|
|
219
|
-
const enableAudio = () => {
|
|
220
|
-
if (this.querySelector('#play-audio-info')) {
|
|
221
|
-
audio.play();
|
|
222
|
-
container.removeChild(info);
|
|
223
|
-
}
|
|
224
|
-
document.removeEventListener('click', enableAudio);
|
|
225
|
-
};
|
|
226
|
-
|
|
227
|
-
// if the audio is paused, it means the user has not interacted with the page yet and the audio will not play
|
|
228
|
-
// FIX FOR SAFARI: play with a slight delay to check if autoplay was blocked
|
|
229
|
-
setTimeout(() => {
|
|
230
|
-
if (audio.paused && !this.querySelector('#play-audio-info')) {
|
|
231
|
-
// add info message as a toast to enable audio playback
|
|
232
|
-
container.appendChild(info);
|
|
233
|
-
document.addEventListener('click', enableAudio);
|
|
234
|
-
} else {
|
|
235
|
-
document.removeEventListener('click', enableAudio);
|
|
236
|
-
}
|
|
237
|
-
}, 500);
|
|
238
|
-
|
|
239
|
-
// we need to listen for the playing event to remove the toast in case the audio plays because of re-rendering
|
|
240
|
-
const handlePlaying = () => {
|
|
241
|
-
//timestamp when auto-played audio started playing
|
|
242
|
-
this._session.audioStartTime = this._session.audioStartTime || new Date().getTime();
|
|
243
|
-
const info = this.querySelector('#play-audio-info');
|
|
244
|
-
if (info) {
|
|
245
|
-
container.removeChild(info);
|
|
246
|
-
}
|
|
247
|
-
audio.removeEventListener('playing', handlePlaying);
|
|
248
|
-
};
|
|
249
|
-
audio.addEventListener('playing', handlePlaying);
|
|
250
|
-
|
|
251
|
-
// we need to listen for the ended event to update the isComplete state
|
|
252
|
-
const handleEnded = () => {
|
|
253
|
-
//timestamp when auto-played audio completed playing
|
|
254
|
-
this._session.audioEndTime = this._session.audioEndTime || new Date().getTime();
|
|
255
|
-
let {
|
|
256
|
-
audioStartTime,
|
|
257
|
-
audioEndTime,
|
|
258
|
-
waitTime
|
|
259
|
-
} = this._session;
|
|
260
|
-
if (!waitTime && audioStartTime && audioEndTime) {
|
|
261
|
-
// waitTime is elapsed time the user waited for auto-played audio to finish
|
|
262
|
-
this._session.waitTime = audioEndTime - audioStartTime;
|
|
263
|
-
}
|
|
264
|
-
this.audioComplete = true;
|
|
265
|
-
this.dispatchEvent(new _piePlayerEvents.SessionChangedEvent(this.tagName.toLowerCase(), this.isComplete()));
|
|
266
|
-
audio.removeEventListener('ended', handleEnded);
|
|
267
|
-
};
|
|
268
|
-
audio.addEventListener('ended', handleEnded);
|
|
269
|
-
|
|
270
|
-
// store references to remove later
|
|
271
|
-
this._audio = audio;
|
|
272
|
-
this._handlePlaying = handlePlaying;
|
|
273
|
-
this._handleEnded = handleEnded;
|
|
274
|
-
this._enableAudio = enableAudio;
|
|
275
|
-
// set to true to prevent multiple initializations
|
|
276
|
-
this._audioInitialized = true;
|
|
277
|
-
observer.disconnect();
|
|
278
|
-
}
|
|
279
|
-
});
|
|
280
|
-
});
|
|
281
|
-
observer.observe(this, {
|
|
282
|
-
childList: true,
|
|
283
|
-
subtree: true
|
|
284
|
-
});
|
|
285
|
-
}
|
|
286
|
-
disconnectedCallback() {
|
|
287
|
-
this._disconnectMathObserver();
|
|
288
|
-
document.removeEventListener('click', this._enableAudio);
|
|
289
|
-
if (this._audio) {
|
|
290
|
-
this._audio.removeEventListener('playing', this._handlePlaying);
|
|
291
|
-
this._audio.removeEventListener('ended', this._handleEnded);
|
|
292
|
-
this._audio = null;
|
|
293
|
-
}
|
|
294
|
-
if (this._root) {
|
|
295
|
-
this._root.unmount();
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
render() {
|
|
299
|
-
if (this._model && this._session) {
|
|
300
|
-
const el = /*#__PURE__*/_react.default.createElement(_categorize.default, {
|
|
301
|
-
model: this._model,
|
|
302
|
-
session: this._session,
|
|
303
|
-
onAnswersChange: this.changeAnswers.bind(this),
|
|
304
|
-
onShowCorrectToggle: this.onShowCorrectToggle.bind(this),
|
|
305
|
-
pauseMathObserver: this.pauseMathObserver,
|
|
306
|
-
resumeMathObserver: this.resumeMathObserver
|
|
307
|
-
});
|
|
308
|
-
if (!this._root) {
|
|
309
|
-
this._root = (0, _client.createRoot)(this);
|
|
310
|
-
}
|
|
311
|
-
this._root.render(el);
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
exports.default = Categorize;
|
|
316
|
-
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_react","_interopRequireDefault","require","_client","_mathRendering","_renderUi","_piePlayerEvents","_categorize","Categorize","HTMLElement","constructor","_defineProperty2","default","_mathRenderPending","requestAnimationFrame","_mathObserver","_mathObserverPaused","disconnect","renderMath","setTimeout","observe","childList","subtree","characterData","_root","_initMathObserver","MutationObserver","_scheduleMathRender","_disconnectMathObserver","model","m","_model","eliminateBlindAnswersFromSession","dispatchEvent","ModelSetEvent","tagName","toLowerCase","isComplete","_audioInitialized","render","autoplayAudioEnabled","choices","completeAudioEnabled","hasUnplacedChoices","possibleResponses","responseAreasToBeFilled","elementContext","audioComplete","audio","querySelector","isInsidePrompt","closest","_session","answers","Array","isArray","filledResponseAreas","filter","answer","length","areResponseAreasFilled","duplicatesAllowed","some","choice","categoryCount","allAnswersIds","map","flat","requiredAnswersPlaced","response","every","val","includes","session","s","mappedChoices","c","id","filteredAnswers","answerChoices","changeAnswers","selector","SessionChangedEvent","onShowCorrectToggle","_createAudioInfoToast","info","document","createElement","Object","assign","style","position","top","width","height","display","justifyContent","alignItems","background","zIndex","cursor","img","src","EnableAudioAutoplayImage","alt","appendChild","connectedCallback","observer","mutationsList","forEach","mutation","type","container","enableAudio","play","removeChild","removeEventListener","paused","addEventListener","handlePlaying","audioStartTime","Date","getTime","handleEnded","audioEndTime","waitTime","_audio","_handlePlaying","_handleEnded","_enableAudio","disconnectedCallback","unmount","el","React","CategorizeComponent","onAnswersChange","bind","pauseMathObserver","resumeMathObserver","createRoot","exports"],"sources":["../src/index.js"],"sourcesContent":["import React from 'react';\nimport { createRoot } from 'react-dom/client';\nimport { renderMath } from '@pie-lib/math-rendering';\nimport { EnableAudioAutoplayImage } from '@pie-lib/render-ui';\nimport { SessionChangedEvent, ModelSetEvent } from '@pie-framework/pie-player-events';\nimport CategorizeComponent from './categorize';\n\nexport default class Categorize extends HTMLElement {\n constructor() {\n super();\n this._root = null;\n this._mathObserver = null;\n this._mathRenderPending = false;\n }\n\n _scheduleMathRender = () => {\n if (this._mathRenderPending) return;\n\n this._mathRenderPending = true;\n\n requestAnimationFrame(() => {\n if (this._mathObserver && !this._mathObserverPaused) {\n this._mathObserver.disconnect();\n }\n\n renderMath(this);\n\n this._mathRenderPending = false;\n\n setTimeout(() => {\n if (this._mathObserver && !this._mathObserverPaused) {\n this._mathObserver.observe(this, {\n childList: true,\n subtree: true,\n characterData: false,\n });\n }\n }, 50);\n });\n };\n\n _initMathObserver() {\n if (this._mathObserver) return;\n\n this._mathObserver = new MutationObserver(() => {\n this._scheduleMathRender();\n });\n\n this._mathObserver.observe(this, {\n childList: true,\n subtree: true,\n characterData: false,\n });\n }\n\n _disconnectMathObserver() {\n if (this._mathObserver) {\n this._mathObserver.disconnect();\n this._mathObserver = null;\n }\n }\n\n pauseMathObserver = () => {\n if (this._mathObserver) {\n this._mathObserver.disconnect();\n this._mathObserverPaused = true;\n }\n };\n\n resumeMathObserver = () => {\n if (this._mathObserverPaused) {\n this._mathObserverPaused = false;\n\n if (this._mathObserver) {\n this._mathObserver.observe(this, {\n childList: true,\n subtree: true,\n characterData: false,\n });\n }\n }\n };\n\n set model(m) {\n this._model = m;\n\n this.eliminateBlindAnswersFromSession();\n this.dispatchEvent(new ModelSetEvent(this.tagName.toLowerCase(), this.isComplete(), !!this._model));\n // reset the audioInitialized to false since the model changed, and we might need to reinitialize the audio\n this._audioInitialized = false;\n\n this.render();\n }\n\n isComplete() {\n const {\n autoplayAudioEnabled,\n choices,\n completeAudioEnabled,\n hasUnplacedChoices,\n possibleResponses,\n responseAreasToBeFilled,\n } = this._model || {};\n const elementContext = this;\n\n // check audio completion if audio settings are enabled and audio actually exists\n if (autoplayAudioEnabled && completeAudioEnabled && !this.audioComplete) {\n if (elementContext) {\n const audio = elementContext.querySelector('audio');\n const isInsidePrompt = audio && audio.closest('#preview-prompt');\n\n // only require audio completion if audio exists and is inside the prompt\n if (audio && isInsidePrompt) {\n return false;\n }\n }\n }\n\n if (!this._session || !this._session.answers) {\n return false;\n }\n\n const { answers } = this._session;\n\n if (!Array.isArray(answers)) {\n return false;\n }\n\n // filter answers by category and count the ones with content\n const filledResponseAreas = answers.filter((answer) => answer.choices.length).length;\n // check if an answer choice was added to at least as many response areas\n // as the number of populated response areas in the correct answer\n const areResponseAreasFilled = filledResponseAreas >= responseAreasToBeFilled;\n // check if multiple placements are allowed\n const duplicatesAllowed = (choices || []).some((choice) => choice.categoryCount === 0);\n\n if (duplicatesAllowed) {\n // an answer choice can be used multiple times\n return areResponseAreasFilled;\n }\n\n // any correct answer have any unplaced answer choices (by the author)\n if (hasUnplacedChoices) {\n return areResponseAreasFilled;\n }\n\n const allAnswersIds = answers.map((answer) => answer.choices).flat();\n\n // check if any correct answer have any unplaced answer choices (by the student)\n const requiredAnswersPlaced = (possibleResponses || []).some((response) =>\n response.every((val) => allAnswersIds.includes(val)),\n );\n\n // true - all choices (required for a correct response) were placed into a response area\n return requiredAnswersPlaced;\n }\n\n set session(s) {\n if (s && !s.answers) {\n s.answers = [];\n }\n\n this._session = s;\n this.render();\n }\n\n get session() {\n return this._session;\n }\n\n eliminateBlindAnswersFromSession() {\n const { answers = [] } = this._session || {};\n const { choices = [] } = this._model || {};\n\n const mappedChoices = choices.map((c) => c.id) || [];\n const filteredAnswers = answers.map((answer) => {\n const answerChoices = answer?.choices || [];\n answer.choices = answerChoices.filter((c) => mappedChoices.includes(c));\n\n return answer;\n });\n\n if (filteredAnswers.length > 0) {\n this.changeAnswers(filteredAnswers);\n }\n }\n\n changeAnswers(answers) {\n this._session.answers = answers;\n this._session.selector = 'Mouse';\n\n this.dispatchEvent(new SessionChangedEvent(this.tagName.toLowerCase(), this.isComplete()));\n\n this.render();\n }\n\n onShowCorrectToggle() {\n renderMath(this);\n }\n\n _createAudioInfoToast() {\n const info = document.createElement('div');\n info.id = 'play-audio-info';\n\n Object.assign(info.style, {\n position: 'absolute',\n top: 0,\n width: '100%',\n height: '100%',\n display: 'flex',\n justifyContent: 'center',\n alignItems: 'center',\n background: 'white',\n zIndex: '1000',\n cursor: 'pointer',\n });\n\n const img = document.createElement('img');\n img.src = EnableAudioAutoplayImage;\n img.alt = 'Click anywhere to enable audio autoplay';\n img.width = 500;\n img.height = 300;\n\n info.appendChild(img);\n return info;\n }\n\n connectedCallback() {\n this._initMathObserver();\n \n // Observation: audio in Chrome will have the autoplay attribute,\n // while other browsers will not have the autoplay attribute and will need a user interaction to play the audio\n // This workaround fixes the issue of audio being cached and played on any user interaction in Safari and Firefox\n const observer = new MutationObserver((mutationsList, observer) => {\n mutationsList.forEach((mutation) => {\n if (mutation.type === 'childList') {\n if (this._audioInitialized) return;\n const audio = this.querySelector('audio');\n const isInsidePrompt = audio && audio.closest('#preview-prompt');\n\n if (!this._model) return;\n if (!this._model.autoplayAudioEnabled) return;\n if (audio && !isInsidePrompt) return;\n if (!audio) return;\n\n const info = this._createAudioInfoToast();\n const container = this.querySelector('#main-container');\n const enableAudio = () => {\n if (this.querySelector('#play-audio-info')) {\n audio.play();\n container.removeChild(info);\n }\n\n document.removeEventListener('click', enableAudio);\n };\n\n // if the audio is paused, it means the user has not interacted with the page yet and the audio will not play\n // FIX FOR SAFARI: play with a slight delay to check if autoplay was blocked\n setTimeout(() => {\n if (audio.paused && !this.querySelector('#play-audio-info')) {\n // add info message as a toast to enable audio playback\n container.appendChild(info);\n document.addEventListener('click', enableAudio);\n } else {\n document.removeEventListener('click', enableAudio);\n }\n }, 500);\n\n // we need to listen for the playing event to remove the toast in case the audio plays because of re-rendering\n const handlePlaying = () => {\n //timestamp when auto-played audio started playing\n this._session.audioStartTime = this._session.audioStartTime || new Date().getTime();\n\n const info = this.querySelector('#play-audio-info');\n if (info) {\n container.removeChild(info);\n }\n\n audio.removeEventListener('playing', handlePlaying);\n };\n\n audio.addEventListener('playing', handlePlaying);\n\n // we need to listen for the ended event to update the isComplete state\n const handleEnded = () => {\n //timestamp when auto-played audio completed playing\n this._session.audioEndTime = this._session.audioEndTime || new Date().getTime();\n\n let { audioStartTime, audioEndTime, waitTime } = this._session;\n if (!waitTime && audioStartTime && audioEndTime) {\n // waitTime is elapsed time the user waited for auto-played audio to finish\n this._session.waitTime = audioEndTime - audioStartTime;\n }\n\n this.audioComplete = true;\n this.dispatchEvent(new SessionChangedEvent(this.tagName.toLowerCase(), this.isComplete()));\n\n audio.removeEventListener('ended', handleEnded);\n };\n\n audio.addEventListener('ended', handleEnded);\n\n // store references to remove later\n this._audio = audio;\n this._handlePlaying = handlePlaying;\n this._handleEnded = handleEnded;\n this._enableAudio = enableAudio;\n // set to true to prevent multiple initializations\n this._audioInitialized = true;\n\n observer.disconnect();\n }\n });\n });\n\n observer.observe(this, { childList: true, subtree: true });\n }\n\n disconnectedCallback() {\n this._disconnectMathObserver();\n \n document.removeEventListener('click', this._enableAudio);\n\n if (this._audio) {\n this._audio.removeEventListener('playing', this._handlePlaying);\n this._audio.removeEventListener('ended', this._handleEnded);\n this._audio = null;\n }\n\n if (this._root) {\n this._root.unmount();\n }\n }\n\n render() {\n if (this._model && this._session) {\n const el = React.createElement(CategorizeComponent, {\n model: this._model,\n session: this._session,\n onAnswersChange: this.changeAnswers.bind(this),\n onShowCorrectToggle: this.onShowCorrectToggle.bind(this),\n pauseMathObserver: this.pauseMathObserver,\n resumeMathObserver: this.resumeMathObserver,\n });\n\n if (!this._root) {\n this._root = createRoot(this);\n }\n this._root.render(el);\n }\n }\n}\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,cAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,gBAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAN,sBAAA,CAAAC,OAAA;AAEe,MAAMM,UAAU,SAASC,WAAW,CAAC;EAClDC,WAAWA,CAAA,EAAG;IACZ,KAAK,CAAC,CAAC;IAAC,IAAAC,gBAAA,CAAAC,OAAA,+BAMY,MAAM;MAC1B,IAAI,IAAI,CAACC,kBAAkB,EAAE;MAE7B,IAAI,CAACA,kBAAkB,GAAG,IAAI;MAE9BC,qBAAqB,CAAC,MAAM;QAC1B,IAAI,IAAI,CAACC,aAAa,IAAI,CAAC,IAAI,CAACC,mBAAmB,EAAE;UACnD,IAAI,CAACD,aAAa,CAACE,UAAU,CAAC,CAAC;QACjC;QAEA,IAAAC,yBAAU,EAAC,IAAI,CAAC;QAEhB,IAAI,CAACL,kBAAkB,GAAG,KAAK;QAE/BM,UAAU,CAAC,MAAM;UACf,IAAI,IAAI,CAACJ,aAAa,IAAI,CAAC,IAAI,CAACC,mBAAmB,EAAE;YACnD,IAAI,CAACD,aAAa,CAACK,OAAO,C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