@pie-element/matrix 2.3.4-next.3 → 3.0.0-beta.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 (50) hide show
  1. package/configure/lib/HeaderCommon.js +19 -22
  2. package/configure/lib/HeaderCommon.js.map +1 -1
  3. package/configure/lib/Main.js +116 -181
  4. package/configure/lib/Main.js.map +1 -1
  5. package/configure/lib/MatrixColumnsSizeHeaderInput.js +28 -48
  6. package/configure/lib/MatrixColumnsSizeHeaderInput.js.map +1 -1
  7. package/configure/lib/MatrixLabelEditableButton.js +134 -129
  8. package/configure/lib/MatrixLabelEditableButton.js.map +1 -1
  9. package/configure/lib/MatrixLabelTypeHeaderInput.js +45 -93
  10. package/configure/lib/MatrixLabelTypeHeaderInput.js.map +1 -1
  11. package/configure/lib/MatrixRowsSizeHeaderInput.js +28 -48
  12. package/configure/lib/MatrixRowsSizeHeaderInput.js.map +1 -1
  13. package/configure/lib/MatrixValues.js +150 -178
  14. package/configure/lib/MatrixValues.js.map +1 -1
  15. package/configure/lib/NumberInput.js +39 -60
  16. package/configure/lib/NumberInput.js.map +1 -1
  17. package/configure/lib/columnLabelsGenerator.js +23 -32
  18. package/configure/lib/columnLabelsGenerator.js.map +1 -1
  19. package/configure/lib/defaults.js +2 -4
  20. package/configure/lib/defaults.js.map +1 -1
  21. package/configure/lib/index.js +76 -140
  22. package/configure/lib/index.js.map +1 -1
  23. package/configure/lib/isNumeric.js +3 -5
  24. package/configure/lib/isNumeric.js.map +1 -1
  25. package/configure/lib/matrixEntities.js +1 -2
  26. package/configure/lib/matrixEntities.js.map +1 -1
  27. package/configure/package.json +10 -7
  28. package/controller/lib/defaults.js +2 -3
  29. package/controller/lib/defaults.js.map +1 -1
  30. package/controller/lib/index.js +44 -91
  31. package/controller/lib/index.js.map +1 -1
  32. package/controller/package.json +1 -1
  33. package/lib/ChoiceInput.js +31 -47
  34. package/lib/ChoiceInput.js.map +1 -1
  35. package/lib/Main.js +24 -58
  36. package/lib/Main.js.map +1 -1
  37. package/lib/Matrix.js +57 -66
  38. package/lib/Matrix.js.map +1 -1
  39. package/lib/index.js +59 -103
  40. package/lib/index.js.map +1 -1
  41. package/lib/session-updater.js +0 -1
  42. package/lib/session-updater.js.map +1 -1
  43. package/package.json +10 -7
  44. package/esm/configure.js +0 -26337
  45. package/esm/configure.js.map +0 -1
  46. package/esm/controller.js +0 -1084
  47. package/esm/controller.js.map +0 -1
  48. package/esm/element.js +0 -13321
  49. package/esm/element.js.map +0 -1
  50. package/esm/package.json +0 -3
package/esm/controller.js DELETED
@@ -1,1084 +0,0 @@
1
- function _extends() {
2
- _extends = Object.assign || function (target) {
3
- for (var i = 1; i < arguments.length; i++) {
4
- var source = arguments[i];
5
-
6
- for (var key in source) {
7
- if (Object.prototype.hasOwnProperty.call(source, key)) {
8
- target[key] = source[key];
9
- }
10
- }
11
- }
12
-
13
- return target;
14
- };
15
-
16
- return _extends.apply(this, arguments);
17
- }
18
-
19
- var defaults = {
20
- columnLabels: ['COLUMN 1', 'COLUMN 2', 'COLUMN 3'],
21
- labelType: 'agreement',
22
- matrixValues: {},
23
- prompt: '',
24
- promptEnabled: true,
25
- rowLabels: ['STATEMENT 1', 'STATEMENT 2'],
26
- teacherInstructions: '',
27
- teacherInstructionsEnabled: true
28
- };
29
-
30
- var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
31
-
32
- /** Used for built-in method references. */
33
-
34
- var objectProto$6 = Object.prototype;
35
-
36
- /**
37
- * Checks if `value` is likely a prototype object.
38
- *
39
- * @private
40
- * @param {*} value The value to check.
41
- * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
42
- */
43
- function isPrototype$2(value) {
44
- var Ctor = value && value.constructor,
45
- proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto$6;
46
-
47
- return value === proto;
48
- }
49
-
50
- var _isPrototype = isPrototype$2;
51
-
52
- /**
53
- * Creates a unary function that invokes `func` with its argument transformed.
54
- *
55
- * @private
56
- * @param {Function} func The function to wrap.
57
- * @param {Function} transform The argument transform.
58
- * @returns {Function} Returns the new function.
59
- */
60
-
61
- function overArg$1(func, transform) {
62
- return function(arg) {
63
- return func(transform(arg));
64
- };
65
- }
66
-
67
- var _overArg = overArg$1;
68
-
69
- var overArg = _overArg;
70
-
71
- /* Built-in method references for those with the same name as other `lodash` methods. */
72
- var nativeKeys$1 = overArg(Object.keys, Object);
73
-
74
- var _nativeKeys = nativeKeys$1;
75
-
76
- var isPrototype$1 = _isPrototype,
77
- nativeKeys = _nativeKeys;
78
-
79
- /** Used for built-in method references. */
80
- var objectProto$5 = Object.prototype;
81
-
82
- /** Used to check objects for own properties. */
83
- var hasOwnProperty$4 = objectProto$5.hasOwnProperty;
84
-
85
- /**
86
- * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
87
- *
88
- * @private
89
- * @param {Object} object The object to query.
90
- * @returns {Array} Returns the array of property names.
91
- */
92
- function baseKeys$1(object) {
93
- if (!isPrototype$1(object)) {
94
- return nativeKeys(object);
95
- }
96
- var result = [];
97
- for (var key in Object(object)) {
98
- if (hasOwnProperty$4.call(object, key) && key != 'constructor') {
99
- result.push(key);
100
- }
101
- }
102
- return result;
103
- }
104
-
105
- var _baseKeys = baseKeys$1;
106
-
107
- /** Detect free variable `global` from Node.js. */
108
-
109
- var freeGlobal$1 = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
110
-
111
- var _freeGlobal = freeGlobal$1;
112
-
113
- var freeGlobal = _freeGlobal;
114
-
115
- /** Detect free variable `self`. */
116
- var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
117
-
118
- /** Used as a reference to the global object. */
119
- var root$7 = freeGlobal || freeSelf || Function('return this')();
120
-
121
- var _root = root$7;
122
-
123
- var root$6 = _root;
124
-
125
- /** Built-in value references. */
126
- var Symbol$2 = root$6.Symbol;
127
-
128
- var _Symbol = Symbol$2;
129
-
130
- var Symbol$1 = _Symbol;
131
-
132
- /** Used for built-in method references. */
133
- var objectProto$4 = Object.prototype;
134
-
135
- /** Used to check objects for own properties. */
136
- var hasOwnProperty$3 = objectProto$4.hasOwnProperty;
137
-
138
- /**
139
- * Used to resolve the
140
- * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
141
- * of values.
142
- */
143
- var nativeObjectToString$1 = objectProto$4.toString;
144
-
145
- /** Built-in value references. */
146
- var symToStringTag$1 = Symbol$1 ? Symbol$1.toStringTag : undefined;
147
-
148
- /**
149
- * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
150
- *
151
- * @private
152
- * @param {*} value The value to query.
153
- * @returns {string} Returns the raw `toStringTag`.
154
- */
155
- function getRawTag$1(value) {
156
- var isOwn = hasOwnProperty$3.call(value, symToStringTag$1),
157
- tag = value[symToStringTag$1];
158
-
159
- try {
160
- value[symToStringTag$1] = undefined;
161
- var unmasked = true;
162
- } catch (e) {}
163
-
164
- var result = nativeObjectToString$1.call(value);
165
- if (unmasked) {
166
- if (isOwn) {
167
- value[symToStringTag$1] = tag;
168
- } else {
169
- delete value[symToStringTag$1];
170
- }
171
- }
172
- return result;
173
- }
174
-
175
- var _getRawTag = getRawTag$1;
176
-
177
- /** Used for built-in method references. */
178
-
179
- var objectProto$3 = Object.prototype;
180
-
181
- /**
182
- * Used to resolve the
183
- * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
184
- * of values.
185
- */
186
- var nativeObjectToString = objectProto$3.toString;
187
-
188
- /**
189
- * Converts `value` to a string using `Object.prototype.toString`.
190
- *
191
- * @private
192
- * @param {*} value The value to convert.
193
- * @returns {string} Returns the converted string.
194
- */
195
- function objectToString$1(value) {
196
- return nativeObjectToString.call(value);
197
- }
198
-
199
- var _objectToString = objectToString$1;
200
-
201
- var Symbol = _Symbol,
202
- getRawTag = _getRawTag,
203
- objectToString = _objectToString;
204
-
205
- /** `Object#toString` result references. */
206
- var nullTag = '[object Null]',
207
- undefinedTag = '[object Undefined]';
208
-
209
- /** Built-in value references. */
210
- var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
211
-
212
- /**
213
- * The base implementation of `getTag` without fallbacks for buggy environments.
214
- *
215
- * @private
216
- * @param {*} value The value to query.
217
- * @returns {string} Returns the `toStringTag`.
218
- */
219
- function baseGetTag$4(value) {
220
- if (value == null) {
221
- return value === undefined ? undefinedTag : nullTag;
222
- }
223
- return (symToStringTag && symToStringTag in Object(value))
224
- ? getRawTag(value)
225
- : objectToString(value);
226
- }
227
-
228
- var _baseGetTag = baseGetTag$4;
229
-
230
- /**
231
- * Checks if `value` is the
232
- * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
233
- * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
234
- *
235
- * @static
236
- * @memberOf _
237
- * @since 0.1.0
238
- * @category Lang
239
- * @param {*} value The value to check.
240
- * @returns {boolean} Returns `true` if `value` is an object, else `false`.
241
- * @example
242
- *
243
- * _.isObject({});
244
- * // => true
245
- *
246
- * _.isObject([1, 2, 3]);
247
- * // => true
248
- *
249
- * _.isObject(_.noop);
250
- * // => true
251
- *
252
- * _.isObject(null);
253
- * // => false
254
- */
255
-
256
- function isObject$2(value) {
257
- var type = typeof value;
258
- return value != null && (type == 'object' || type == 'function');
259
- }
260
-
261
- var isObject_1 = isObject$2;
262
-
263
- var baseGetTag$3 = _baseGetTag,
264
- isObject$1 = isObject_1;
265
-
266
- /** `Object#toString` result references. */
267
- var asyncTag = '[object AsyncFunction]',
268
- funcTag$1 = '[object Function]',
269
- genTag = '[object GeneratorFunction]',
270
- proxyTag = '[object Proxy]';
271
-
272
- /**
273
- * Checks if `value` is classified as a `Function` object.
274
- *
275
- * @static
276
- * @memberOf _
277
- * @since 0.1.0
278
- * @category Lang
279
- * @param {*} value The value to check.
280
- * @returns {boolean} Returns `true` if `value` is a function, else `false`.
281
- * @example
282
- *
283
- * _.isFunction(_);
284
- * // => true
285
- *
286
- * _.isFunction(/abc/);
287
- * // => false
288
- */
289
- function isFunction$2(value) {
290
- if (!isObject$1(value)) {
291
- return false;
292
- }
293
- // The use of `Object#toString` avoids issues with the `typeof` operator
294
- // in Safari 9 which returns 'object' for typed arrays and other constructors.
295
- var tag = baseGetTag$3(value);
296
- return tag == funcTag$1 || tag == genTag || tag == asyncTag || tag == proxyTag;
297
- }
298
-
299
- var isFunction_1 = isFunction$2;
300
-
301
- var root$5 = _root;
302
-
303
- /** Used to detect overreaching core-js shims. */
304
- var coreJsData$1 = root$5['__core-js_shared__'];
305
-
306
- var _coreJsData = coreJsData$1;
307
-
308
- var coreJsData = _coreJsData;
309
-
310
- /** Used to detect methods masquerading as native. */
311
- var maskSrcKey = (function() {
312
- var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
313
- return uid ? ('Symbol(src)_1.' + uid) : '';
314
- }());
315
-
316
- /**
317
- * Checks if `func` has its source masked.
318
- *
319
- * @private
320
- * @param {Function} func The function to check.
321
- * @returns {boolean} Returns `true` if `func` is masked, else `false`.
322
- */
323
- function isMasked$1(func) {
324
- return !!maskSrcKey && (maskSrcKey in func);
325
- }
326
-
327
- var _isMasked = isMasked$1;
328
-
329
- /** Used for built-in method references. */
330
-
331
- var funcProto$1 = Function.prototype;
332
-
333
- /** Used to resolve the decompiled source of functions. */
334
- var funcToString$1 = funcProto$1.toString;
335
-
336
- /**
337
- * Converts `func` to its source code.
338
- *
339
- * @private
340
- * @param {Function} func The function to convert.
341
- * @returns {string} Returns the source code.
342
- */
343
- function toSource$2(func) {
344
- if (func != null) {
345
- try {
346
- return funcToString$1.call(func);
347
- } catch (e) {}
348
- try {
349
- return (func + '');
350
- } catch (e) {}
351
- }
352
- return '';
353
- }
354
-
355
- var _toSource = toSource$2;
356
-
357
- var isFunction$1 = isFunction_1,
358
- isMasked = _isMasked,
359
- isObject = isObject_1,
360
- toSource$1 = _toSource;
361
-
362
- /**
363
- * Used to match `RegExp`
364
- * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
365
- */
366
- var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
367
-
368
- /** Used to detect host constructors (Safari). */
369
- var reIsHostCtor = /^\[object .+?Constructor\]$/;
370
-
371
- /** Used for built-in method references. */
372
- var funcProto = Function.prototype,
373
- objectProto$2 = Object.prototype;
374
-
375
- /** Used to resolve the decompiled source of functions. */
376
- var funcToString = funcProto.toString;
377
-
378
- /** Used to check objects for own properties. */
379
- var hasOwnProperty$2 = objectProto$2.hasOwnProperty;
380
-
381
- /** Used to detect if a method is native. */
382
- var reIsNative = RegExp('^' +
383
- funcToString.call(hasOwnProperty$2).replace(reRegExpChar, '\\$&')
384
- .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
385
- );
386
-
387
- /**
388
- * The base implementation of `_.isNative` without bad shim checks.
389
- *
390
- * @private
391
- * @param {*} value The value to check.
392
- * @returns {boolean} Returns `true` if `value` is a native function,
393
- * else `false`.
394
- */
395
- function baseIsNative$1(value) {
396
- if (!isObject(value) || isMasked(value)) {
397
- return false;
398
- }
399
- var pattern = isFunction$1(value) ? reIsNative : reIsHostCtor;
400
- return pattern.test(toSource$1(value));
401
- }
402
-
403
- var _baseIsNative = baseIsNative$1;
404
-
405
- /**
406
- * Gets the value at `key` of `object`.
407
- *
408
- * @private
409
- * @param {Object} [object] The object to query.
410
- * @param {string} key The key of the property to get.
411
- * @returns {*} Returns the property value.
412
- */
413
-
414
- function getValue$1(object, key) {
415
- return object == null ? undefined : object[key];
416
- }
417
-
418
- var _getValue = getValue$1;
419
-
420
- var baseIsNative = _baseIsNative,
421
- getValue = _getValue;
422
-
423
- /**
424
- * Gets the native function at `key` of `object`.
425
- *
426
- * @private
427
- * @param {Object} object The object to query.
428
- * @param {string} key The key of the method to get.
429
- * @returns {*} Returns the function if it's native, else `undefined`.
430
- */
431
- function getNative$5(object, key) {
432
- var value = getValue(object, key);
433
- return baseIsNative(value) ? value : undefined;
434
- }
435
-
436
- var _getNative = getNative$5;
437
-
438
- var getNative$4 = _getNative,
439
- root$4 = _root;
440
-
441
- /* Built-in method references that are verified to be native. */
442
- var DataView$1 = getNative$4(root$4, 'DataView');
443
-
444
- var _DataView = DataView$1;
445
-
446
- var getNative$3 = _getNative,
447
- root$3 = _root;
448
-
449
- /* Built-in method references that are verified to be native. */
450
- var Map$1 = getNative$3(root$3, 'Map');
451
-
452
- var _Map = Map$1;
453
-
454
- var getNative$2 = _getNative,
455
- root$2 = _root;
456
-
457
- /* Built-in method references that are verified to be native. */
458
- var Promise$2 = getNative$2(root$2, 'Promise');
459
-
460
- var _Promise = Promise$2;
461
-
462
- var getNative$1 = _getNative,
463
- root$1 = _root;
464
-
465
- /* Built-in method references that are verified to be native. */
466
- var Set$1 = getNative$1(root$1, 'Set');
467
-
468
- var _Set = Set$1;
469
-
470
- var getNative = _getNative,
471
- root = _root;
472
-
473
- /* Built-in method references that are verified to be native. */
474
- var WeakMap$1 = getNative(root, 'WeakMap');
475
-
476
- var _WeakMap = WeakMap$1;
477
-
478
- var DataView = _DataView,
479
- Map = _Map,
480
- Promise$1 = _Promise,
481
- Set = _Set,
482
- WeakMap = _WeakMap,
483
- baseGetTag$2 = _baseGetTag,
484
- toSource = _toSource;
485
-
486
- /** `Object#toString` result references. */
487
- var mapTag$2 = '[object Map]',
488
- objectTag$1 = '[object Object]',
489
- promiseTag = '[object Promise]',
490
- setTag$2 = '[object Set]',
491
- weakMapTag$1 = '[object WeakMap]';
492
-
493
- var dataViewTag$1 = '[object DataView]';
494
-
495
- /** Used to detect maps, sets, and weakmaps. */
496
- var dataViewCtorString = toSource(DataView),
497
- mapCtorString = toSource(Map),
498
- promiseCtorString = toSource(Promise$1),
499
- setCtorString = toSource(Set),
500
- weakMapCtorString = toSource(WeakMap);
501
-
502
- /**
503
- * Gets the `toStringTag` of `value`.
504
- *
505
- * @private
506
- * @param {*} value The value to query.
507
- * @returns {string} Returns the `toStringTag`.
508
- */
509
- var getTag$1 = baseGetTag$2;
510
-
511
- // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
512
- if ((DataView && getTag$1(new DataView(new ArrayBuffer(1))) != dataViewTag$1) ||
513
- (Map && getTag$1(new Map) != mapTag$2) ||
514
- (Promise$1 && getTag$1(Promise$1.resolve()) != promiseTag) ||
515
- (Set && getTag$1(new Set) != setTag$2) ||
516
- (WeakMap && getTag$1(new WeakMap) != weakMapTag$1)) {
517
- getTag$1 = function(value) {
518
- var result = baseGetTag$2(value),
519
- Ctor = result == objectTag$1 ? value.constructor : undefined,
520
- ctorString = Ctor ? toSource(Ctor) : '';
521
-
522
- if (ctorString) {
523
- switch (ctorString) {
524
- case dataViewCtorString: return dataViewTag$1;
525
- case mapCtorString: return mapTag$2;
526
- case promiseCtorString: return promiseTag;
527
- case setCtorString: return setTag$2;
528
- case weakMapCtorString: return weakMapTag$1;
529
- }
530
- }
531
- return result;
532
- };
533
- }
534
-
535
- var _getTag = getTag$1;
536
-
537
- /**
538
- * Checks if `value` is object-like. A value is object-like if it's not `null`
539
- * and has a `typeof` result of "object".
540
- *
541
- * @static
542
- * @memberOf _
543
- * @since 4.0.0
544
- * @category Lang
545
- * @param {*} value The value to check.
546
- * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
547
- * @example
548
- *
549
- * _.isObjectLike({});
550
- * // => true
551
- *
552
- * _.isObjectLike([1, 2, 3]);
553
- * // => true
554
- *
555
- * _.isObjectLike(_.noop);
556
- * // => false
557
- *
558
- * _.isObjectLike(null);
559
- * // => false
560
- */
561
-
562
- function isObjectLike$3(value) {
563
- return value != null && typeof value == 'object';
564
- }
565
-
566
- var isObjectLike_1 = isObjectLike$3;
567
-
568
- var baseGetTag$1 = _baseGetTag,
569
- isObjectLike$2 = isObjectLike_1;
570
-
571
- /** `Object#toString` result references. */
572
- var argsTag$1 = '[object Arguments]';
573
-
574
- /**
575
- * The base implementation of `_.isArguments`.
576
- *
577
- * @private
578
- * @param {*} value The value to check.
579
- * @returns {boolean} Returns `true` if `value` is an `arguments` object,
580
- */
581
- function baseIsArguments$1(value) {
582
- return isObjectLike$2(value) && baseGetTag$1(value) == argsTag$1;
583
- }
584
-
585
- var _baseIsArguments = baseIsArguments$1;
586
-
587
- var baseIsArguments = _baseIsArguments,
588
- isObjectLike$1 = isObjectLike_1;
589
-
590
- /** Used for built-in method references. */
591
- var objectProto$1 = Object.prototype;
592
-
593
- /** Used to check objects for own properties. */
594
- var hasOwnProperty$1 = objectProto$1.hasOwnProperty;
595
-
596
- /** Built-in value references. */
597
- var propertyIsEnumerable = objectProto$1.propertyIsEnumerable;
598
-
599
- /**
600
- * Checks if `value` is likely an `arguments` object.
601
- *
602
- * @static
603
- * @memberOf _
604
- * @since 0.1.0
605
- * @category Lang
606
- * @param {*} value The value to check.
607
- * @returns {boolean} Returns `true` if `value` is an `arguments` object,
608
- * else `false`.
609
- * @example
610
- *
611
- * _.isArguments(function() { return arguments; }());
612
- * // => true
613
- *
614
- * _.isArguments([1, 2, 3]);
615
- * // => false
616
- */
617
- var isArguments$1 = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
618
- return isObjectLike$1(value) && hasOwnProperty$1.call(value, 'callee') &&
619
- !propertyIsEnumerable.call(value, 'callee');
620
- };
621
-
622
- var isArguments_1 = isArguments$1;
623
-
624
- /**
625
- * Checks if `value` is classified as an `Array` object.
626
- *
627
- * @static
628
- * @memberOf _
629
- * @since 0.1.0
630
- * @category Lang
631
- * @param {*} value The value to check.
632
- * @returns {boolean} Returns `true` if `value` is an array, else `false`.
633
- * @example
634
- *
635
- * _.isArray([1, 2, 3]);
636
- * // => true
637
- *
638
- * _.isArray(document.body.children);
639
- * // => false
640
- *
641
- * _.isArray('abc');
642
- * // => false
643
- *
644
- * _.isArray(_.noop);
645
- * // => false
646
- */
647
-
648
- var isArray$1 = Array.isArray;
649
-
650
- var isArray_1 = isArray$1;
651
-
652
- /** Used as references for various `Number` constants. */
653
-
654
- var MAX_SAFE_INTEGER = 9007199254740991;
655
-
656
- /**
657
- * Checks if `value` is a valid array-like length.
658
- *
659
- * **Note:** This method is loosely based on
660
- * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
661
- *
662
- * @static
663
- * @memberOf _
664
- * @since 4.0.0
665
- * @category Lang
666
- * @param {*} value The value to check.
667
- * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
668
- * @example
669
- *
670
- * _.isLength(3);
671
- * // => true
672
- *
673
- * _.isLength(Number.MIN_VALUE);
674
- * // => false
675
- *
676
- * _.isLength(Infinity);
677
- * // => false
678
- *
679
- * _.isLength('3');
680
- * // => false
681
- */
682
- function isLength$2(value) {
683
- return typeof value == 'number' &&
684
- value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
685
- }
686
-
687
- var isLength_1 = isLength$2;
688
-
689
- var isFunction = isFunction_1,
690
- isLength$1 = isLength_1;
691
-
692
- /**
693
- * Checks if `value` is array-like. A value is considered array-like if it's
694
- * not a function and has a `value.length` that's an integer greater than or
695
- * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
696
- *
697
- * @static
698
- * @memberOf _
699
- * @since 4.0.0
700
- * @category Lang
701
- * @param {*} value The value to check.
702
- * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
703
- * @example
704
- *
705
- * _.isArrayLike([1, 2, 3]);
706
- * // => true
707
- *
708
- * _.isArrayLike(document.body.children);
709
- * // => true
710
- *
711
- * _.isArrayLike('abc');
712
- * // => true
713
- *
714
- * _.isArrayLike(_.noop);
715
- * // => false
716
- */
717
- function isArrayLike$1(value) {
718
- return value != null && isLength$1(value.length) && !isFunction(value);
719
- }
720
-
721
- var isArrayLike_1 = isArrayLike$1;
722
-
723
- var isBuffer$1 = {exports: {}};
724
-
725
- /**
726
- * This method returns `false`.
727
- *
728
- * @static
729
- * @memberOf _
730
- * @since 4.13.0
731
- * @category Util
732
- * @returns {boolean} Returns `false`.
733
- * @example
734
- *
735
- * _.times(2, _.stubFalse);
736
- * // => [false, false]
737
- */
738
-
739
- function stubFalse() {
740
- return false;
741
- }
742
-
743
- var stubFalse_1 = stubFalse;
744
-
745
- (function (module, exports) {
746
- var root = _root,
747
- stubFalse = stubFalse_1;
748
-
749
- /** Detect free variable `exports`. */
750
- var freeExports = exports && !exports.nodeType && exports;
751
-
752
- /** Detect free variable `module`. */
753
- var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
754
-
755
- /** Detect the popular CommonJS extension `module.exports`. */
756
- var moduleExports = freeModule && freeModule.exports === freeExports;
757
-
758
- /** Built-in value references. */
759
- var Buffer = moduleExports ? root.Buffer : undefined;
760
-
761
- /* Built-in method references for those with the same name as other `lodash` methods. */
762
- var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined;
763
-
764
- /**
765
- * Checks if `value` is a buffer.
766
- *
767
- * @static
768
- * @memberOf _
769
- * @since 4.3.0
770
- * @category Lang
771
- * @param {*} value The value to check.
772
- * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
773
- * @example
774
- *
775
- * _.isBuffer(new Buffer(2));
776
- * // => true
777
- *
778
- * _.isBuffer(new Uint8Array(2));
779
- * // => false
780
- */
781
- var isBuffer = nativeIsBuffer || stubFalse;
782
-
783
- module.exports = isBuffer;
784
- }(isBuffer$1, isBuffer$1.exports));
785
-
786
- var baseGetTag = _baseGetTag,
787
- isLength = isLength_1,
788
- isObjectLike = isObjectLike_1;
789
-
790
- /** `Object#toString` result references. */
791
- var argsTag = '[object Arguments]',
792
- arrayTag = '[object Array]',
793
- boolTag = '[object Boolean]',
794
- dateTag = '[object Date]',
795
- errorTag = '[object Error]',
796
- funcTag = '[object Function]',
797
- mapTag$1 = '[object Map]',
798
- numberTag = '[object Number]',
799
- objectTag = '[object Object]',
800
- regexpTag = '[object RegExp]',
801
- setTag$1 = '[object Set]',
802
- stringTag = '[object String]',
803
- weakMapTag = '[object WeakMap]';
804
-
805
- var arrayBufferTag = '[object ArrayBuffer]',
806
- dataViewTag = '[object DataView]',
807
- float32Tag = '[object Float32Array]',
808
- float64Tag = '[object Float64Array]',
809
- int8Tag = '[object Int8Array]',
810
- int16Tag = '[object Int16Array]',
811
- int32Tag = '[object Int32Array]',
812
- uint8Tag = '[object Uint8Array]',
813
- uint8ClampedTag = '[object Uint8ClampedArray]',
814
- uint16Tag = '[object Uint16Array]',
815
- uint32Tag = '[object Uint32Array]';
816
-
817
- /** Used to identify `toStringTag` values of typed arrays. */
818
- var typedArrayTags = {};
819
- typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
820
- typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
821
- typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
822
- typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
823
- typedArrayTags[uint32Tag] = true;
824
- typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
825
- typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
826
- typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
827
- typedArrayTags[errorTag] = typedArrayTags[funcTag] =
828
- typedArrayTags[mapTag$1] = typedArrayTags[numberTag] =
829
- typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
830
- typedArrayTags[setTag$1] = typedArrayTags[stringTag] =
831
- typedArrayTags[weakMapTag] = false;
832
-
833
- /**
834
- * The base implementation of `_.isTypedArray` without Node.js optimizations.
835
- *
836
- * @private
837
- * @param {*} value The value to check.
838
- * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
839
- */
840
- function baseIsTypedArray$1(value) {
841
- return isObjectLike(value) &&
842
- isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
843
- }
844
-
845
- var _baseIsTypedArray = baseIsTypedArray$1;
846
-
847
- /**
848
- * The base implementation of `_.unary` without support for storing metadata.
849
- *
850
- * @private
851
- * @param {Function} func The function to cap arguments for.
852
- * @returns {Function} Returns the new capped function.
853
- */
854
-
855
- function baseUnary$1(func) {
856
- return function(value) {
857
- return func(value);
858
- };
859
- }
860
-
861
- var _baseUnary = baseUnary$1;
862
-
863
- var _nodeUtil = {exports: {}};
864
-
865
- (function (module, exports) {
866
- var freeGlobal = _freeGlobal;
867
-
868
- /** Detect free variable `exports`. */
869
- var freeExports = exports && !exports.nodeType && exports;
870
-
871
- /** Detect free variable `module`. */
872
- var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
873
-
874
- /** Detect the popular CommonJS extension `module.exports`. */
875
- var moduleExports = freeModule && freeModule.exports === freeExports;
876
-
877
- /** Detect free variable `process` from Node.js. */
878
- var freeProcess = moduleExports && freeGlobal.process;
879
-
880
- /** Used to access faster Node.js helpers. */
881
- var nodeUtil = (function() {
882
- try {
883
- // Use `util.types` for Node.js 10+.
884
- var types = freeModule && freeModule.require && freeModule.require('util').types;
885
-
886
- if (types) {
887
- return types;
888
- }
889
-
890
- // Legacy `process.binding('util')` for Node.js < 10.
891
- return freeProcess && freeProcess.binding && freeProcess.binding('util');
892
- } catch (e) {}
893
- }());
894
-
895
- module.exports = nodeUtil;
896
- }(_nodeUtil, _nodeUtil.exports));
897
-
898
- var baseIsTypedArray = _baseIsTypedArray,
899
- baseUnary = _baseUnary,
900
- nodeUtil = _nodeUtil.exports;
901
-
902
- /* Node.js helper references. */
903
- var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
904
-
905
- /**
906
- * Checks if `value` is classified as a typed array.
907
- *
908
- * @static
909
- * @memberOf _
910
- * @since 3.0.0
911
- * @category Lang
912
- * @param {*} value The value to check.
913
- * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
914
- * @example
915
- *
916
- * _.isTypedArray(new Uint8Array);
917
- * // => true
918
- *
919
- * _.isTypedArray([]);
920
- * // => false
921
- */
922
- var isTypedArray$1 = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
923
-
924
- var isTypedArray_1 = isTypedArray$1;
925
-
926
- var baseKeys = _baseKeys,
927
- getTag = _getTag,
928
- isArguments = isArguments_1,
929
- isArray = isArray_1,
930
- isArrayLike = isArrayLike_1,
931
- isBuffer = isBuffer$1.exports,
932
- isPrototype = _isPrototype,
933
- isTypedArray = isTypedArray_1;
934
-
935
- /** `Object#toString` result references. */
936
- var mapTag = '[object Map]',
937
- setTag = '[object Set]';
938
-
939
- /** Used for built-in method references. */
940
- var objectProto = Object.prototype;
941
-
942
- /** Used to check objects for own properties. */
943
- var hasOwnProperty = objectProto.hasOwnProperty;
944
-
945
- /**
946
- * Checks if `value` is an empty object, collection, map, or set.
947
- *
948
- * Objects are considered empty if they have no own enumerable string keyed
949
- * properties.
950
- *
951
- * Array-like values such as `arguments` objects, arrays, buffers, strings, or
952
- * jQuery-like collections are considered empty if they have a `length` of `0`.
953
- * Similarly, maps and sets are considered empty if they have a `size` of `0`.
954
- *
955
- * @static
956
- * @memberOf _
957
- * @since 0.1.0
958
- * @category Lang
959
- * @param {*} value The value to check.
960
- * @returns {boolean} Returns `true` if `value` is empty, else `false`.
961
- * @example
962
- *
963
- * _.isEmpty(null);
964
- * // => true
965
- *
966
- * _.isEmpty(true);
967
- * // => true
968
- *
969
- * _.isEmpty(1);
970
- * // => true
971
- *
972
- * _.isEmpty([1, 2, 3]);
973
- * // => false
974
- *
975
- * _.isEmpty({ 'a': 1 });
976
- * // => false
977
- */
978
- function isEmpty(value) {
979
- if (value == null) {
980
- return true;
981
- }
982
- if (isArrayLike(value) &&
983
- (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' ||
984
- isBuffer(value) || isTypedArray(value) || isArguments(value))) {
985
- return !value.length;
986
- }
987
- var tag = getTag(value);
988
- if (tag == mapTag || tag == setTag) {
989
- return !value.size;
990
- }
991
- if (isPrototype(value)) {
992
- return !baseKeys(value).length;
993
- }
994
- for (var key in value) {
995
- if (hasOwnProperty.call(value, key)) {
996
- return false;
997
- }
998
- }
999
- return true;
1000
- }
1001
-
1002
- var isEmpty_1 = isEmpty;
1003
-
1004
- const createDefaultModel = (model = {}) => new Promise(resolve => resolve(_extends({}, defaults, model)));
1005
- /**
1006
- *
1007
- * @param {*} question
1008
- * @param {*} session
1009
- * @param {*} env
1010
- */
1011
-
1012
- async function model(question, session, env) {
1013
- const normalizedQuestion = _extends({}, defaults, question);
1014
-
1015
- const out = _extends({}, normalizedQuestion, {
1016
- disabled: env.mode !== 'gather',
1017
- mode: env.mode
1018
- });
1019
-
1020
- const {
1021
- role,
1022
- mode
1023
- } = env || {};
1024
-
1025
- if (role === 'instructor' && (mode === 'view' || mode === 'evaluate')) {
1026
- out.teacherInstructions = normalizedQuestion.teacherInstructionsEnabled ? normalizedQuestion.teacherInstructions : null;
1027
- } else {
1028
- out.teacherInstructions = null;
1029
- }
1030
-
1031
- return out;
1032
- }
1033
- function outcome(model, session) {
1034
- return new Promise(resolve => {
1035
- if (!session || isEmpty_1(session)) {
1036
- return resolve({
1037
- score: 0,
1038
- empty: true
1039
- });
1040
- }
1041
-
1042
- const score = Object.keys(session.value).reduce((acc, key) => {
1043
- const matrixValue = model.matrixValues[key];
1044
- return acc + (matrixValue || 0);
1045
- }, 0);
1046
- resolve({
1047
- score,
1048
- empty: false
1049
- });
1050
- });
1051
- }
1052
- const createCorrectResponseSession = (question, env) => {
1053
- return new Promise(resolve => {
1054
- if (env.mode !== 'evaluate' && env.role === 'instructor') {
1055
- const {
1056
- matrixValues
1057
- } = question || [];
1058
- resolve({
1059
- id: '1',
1060
- value: matrixValues
1061
- });
1062
- } else {
1063
- resolve(null);
1064
- }
1065
- });
1066
- }; // remove all html tags
1067
-
1068
-
1069
- const getContent = html => (html || '').replace(/(<(?!img|iframe|source)([^>]+)>)/gi, '');
1070
-
1071
- const validate = (model = {}, config = {}) => {
1072
- const errors = {};
1073
- ['teacherInstructions', 'prompt'].forEach(field => {
1074
- var _config$field;
1075
-
1076
- if ((_config$field = config[field]) != null && _config$field.required && !getContent(model[field])) {
1077
- errors[field] = 'This field is required.';
1078
- }
1079
- });
1080
- return errors;
1081
- };
1082
-
1083
- export { createCorrectResponseSession, createDefaultModel, model, outcome, validate };
1084
- //# sourceMappingURL=controller.js.map