@pie-element/matrix 3.0.0-beta.0 → 3.0.0-next.42

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