@pie-element/select-text 13.1.2-next.0 → 13.1.2-next.10

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 (151) hide show
  1. package/dist/author/design.d.ts +2 -2
  2. package/dist/author/design.js +78 -79
  3. package/dist/author/index.js +2 -2
  4. package/dist/browser/{Check-CXevxzJJ.js → Check-DfUn7PkH.js} +2708 -3429
  5. package/dist/browser/Check-DfUn7PkH.js.map +1 -0
  6. package/dist/browser/author/index.js +24219 -21826
  7. package/dist/browser/author/index.js.map +1 -1
  8. package/dist/browser/controller/index.js +12 -13
  9. package/dist/browser/controller/index.js.map +1 -1
  10. package/dist/browser/delivery/index.js +3 -3
  11. package/dist/browser/delivery/index.js.map +1 -1
  12. package/dist/browser/{_getTag-x1UozeM0.js → dist-BamN0-DG.js} +102 -160
  13. package/dist/browser/dist-BamN0-DG.js.map +1 -0
  14. package/dist/browser/{main-4aycOoI5.js → main-B3z36nHt.js} +1030 -1022
  15. package/dist/browser/main-B3z36nHt.js.map +1 -0
  16. package/dist/browser/print/index.js +7 -8
  17. package/dist/browser/print/index.js.map +1 -1
  18. package/dist/controller/index.js +19 -19
  19. package/dist/delivery/index.js +1 -1
  20. package/dist/delivery/main.d.ts +2 -0
  21. package/dist/delivery/main.js +58 -49
  22. package/dist/index.iife.js +40 -40
  23. package/dist/print/index.js +9 -9
  24. package/dist/runtime-support.d.ts +12 -0
  25. package/dist/runtime-support.js +12 -0
  26. package/module/print.js +20113 -0
  27. package/module/print.js.map +1 -0
  28. package/package.json +28 -12
  29. package/print.js +2 -0
  30. package/dist/browser/Check-CXevxzJJ.js.map +0 -1
  31. package/dist/browser/_getTag-x1UozeM0.js.map +0 -1
  32. package/dist/browser/debounce-CUpLfqAu.js +0 -86
  33. package/dist/browser/debounce-CUpLfqAu.js.map +0 -1
  34. package/dist/browser/isEmpty-Bsms1e2W.js +0 -16
  35. package/dist/browser/isEmpty-Bsms1e2W.js.map +0 -1
  36. package/dist/browser/main-4aycOoI5.js.map +0 -1
  37. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_DataView.js +0 -6
  38. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Hash.js +0 -16
  39. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_ListCache.js +0 -16
  40. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Map.js +0 -6
  41. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_MapCache.js +0 -16
  42. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Promise.js +0 -6
  43. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Set.js +0 -6
  44. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Stack.js +0 -14
  45. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Symbol.js +0 -5
  46. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Uint8Array.js +0 -5
  47. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_WeakMap.js +0 -6
  48. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayEach.js +0 -7
  49. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayFilter.js +0 -10
  50. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayLikeKeys.js +0 -15
  51. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayPush.js +0 -7
  52. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_assignValue.js +0 -10
  53. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_assocIndexOf.js +0 -8
  54. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseAssign.js +0 -8
  55. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseAssignIn.js +0 -8
  56. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseAssignValue.js +0 -12
  57. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseClone.js +0 -57
  58. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseCreate.js +0 -14
  59. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseGetAllKeys.js +0 -9
  60. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseGetTag.js +0 -10
  61. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsArguments.js +0 -9
  62. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsMap.js +0 -9
  63. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsNative.js +0 -11
  64. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsSet.js +0 -9
  65. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsTypedArray.js +0 -11
  66. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseKeys.js +0 -12
  67. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseKeysIn.js +0 -13
  68. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseTimes.js +0 -7
  69. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseTrim.js +0 -8
  70. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseUnary.js +0 -8
  71. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneArrayBuffer.js +0 -8
  72. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneBuffer.js +0 -10
  73. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneDataView.js +0 -8
  74. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneRegExp.js +0 -8
  75. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneSymbol.js +0 -8
  76. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneTypedArray.js +0 -8
  77. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copyArray.js +0 -8
  78. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copyObject.js +0 -14
  79. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copySymbols.js +0 -8
  80. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copySymbolsIn.js +0 -8
  81. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_coreJsData.js +0 -5
  82. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_defineProperty.js +0 -10
  83. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_freeGlobal.js +0 -4
  84. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getAllKeys.js +0 -9
  85. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getAllKeysIn.js +0 -9
  86. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getMapData.js +0 -8
  87. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getNative.js +0 -9
  88. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getPrototype.js +0 -5
  89. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getRawTag.js +0 -14
  90. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getSymbols.js +0 -10
  91. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getSymbolsIn.js +0 -11
  92. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getTag.js +0 -23
  93. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getValue.js +0 -6
  94. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashClear.js +0 -7
  95. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashDelete.js +0 -7
  96. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashGet.js +0 -13
  97. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashHas.js +0 -9
  98. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashSet.js +0 -9
  99. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_initCloneArray.js +0 -8
  100. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_initCloneByTag.js +0 -33
  101. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_initCloneObject.js +0 -9
  102. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isIndex.js +0 -8
  103. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isKeyable.js +0 -7
  104. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isMasked.js +0 -11
  105. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isPrototype.js +0 -8
  106. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheClear.js +0 -6
  107. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheDelete.js +0 -9
  108. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheGet.js +0 -8
  109. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheHas.js +0 -7
  110. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheSet.js +0 -8
  111. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheClear.js +0 -13
  112. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheDelete.js +0 -8
  113. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheGet.js +0 -7
  114. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheHas.js +0 -7
  115. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheSet.js +0 -8
  116. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nativeCreate.js +0 -5
  117. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nativeKeys.js +0 -5
  118. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nativeKeysIn.js +0 -8
  119. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nodeUtil.js +0 -9
  120. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_objectToString.js +0 -7
  121. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_overArg.js +0 -8
  122. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_root.js +0 -5
  123. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackClear.js +0 -7
  124. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackDelete.js +0 -7
  125. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackGet.js +0 -6
  126. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackHas.js +0 -6
  127. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackSet.js +0 -16
  128. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_toSource.js +0 -15
  129. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_trimmedEndIndex.js +0 -8
  130. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/cloneDeep.js +0 -8
  131. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/debounce.js +0 -50
  132. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/eq.js +0 -6
  133. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArguments.js +0 -10
  134. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArray.js +0 -4
  135. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArrayLike.js +0 -8
  136. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isBuffer.js +0 -6
  137. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isEmpty.js +0 -21
  138. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isFunction.js +0 -11
  139. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isLength.js +0 -7
  140. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isMap.js +0 -7
  141. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isObject.js +0 -7
  142. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isObjectLike.js +0 -6
  143. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isSet.js +0 -7
  144. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isSymbol.js +0 -9
  145. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isTypedArray.js +0 -7
  146. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/keys.js +0 -9
  147. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/keysIn.js +0 -9
  148. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/now.js +0 -7
  149. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/stubArray.js +0 -6
  150. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/stubFalse.js +0 -6
  151. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/toNumber.js +0 -19
@@ -1,7 +1,6 @@
1
- import { b as e, w as t } from "../_getTag-x1UozeM0.js";
2
- import { t as n } from "../isEmpty-Bsms1e2W.js";
1
+ import { a as e, b as t, g as n } from "../dist-BamN0-DG.js";
3
2
  //#region ../../shared/feedback/dist/index.js
4
- var r = /* @__PURE__ */ t(e(), 1), i = {
3
+ var r = /* @__PURE__ */ t(n(), 1), i = {
5
4
  correct: {
6
5
  type: "default",
7
6
  default: "Correct",
@@ -55,7 +54,7 @@ var c = Object.defineProperty, l = /* @__PURE__ */ ((e, t) => {
55
54
  return t || c(n, Symbol.toStringTag, { value: "Module" }), n;
56
55
  })({ enabled: () => u });
57
56
  function u(e, t, n) {
58
- return e?.partialScoring === !1 || t?.partialScoring === !1 ? !1 : typeof n == "boolean" ? n : !0;
57
+ return e?.partialScoring === !1 || t?.partialScoring === !1 ? !1 : typeof n != "boolean" || n;
59
58
  }
60
59
  //#endregion
61
60
  //#region src/controller/defaults.ts
@@ -92,9 +91,9 @@ var d = {
92
91
  if (r.length > 0) return "partially-correct";
93
92
  }
94
93
  return r.length > 0 ? "partially-correct" : "incorrect";
95
- }, g = (e, t) => (t || []).filter((t) => e.findIndex((e) => e.correct && p(e, t)) !== -1), _ = (e, t, r) => {
96
- if (!t || n(t)) return 0;
97
- let i = g(e.tokens, t.selectedTokens).length, a = (e.tokens || []).filter((e) => e.correct === !0), o = i - (t.selectedTokens && t.selectedTokens.length > a.length ? t.selectedTokens && t.selectedTokens.length - i : 0), s = o < 0 ? 0 : o;
94
+ }, g = (e, t) => (t || []).filter((t) => e.findIndex((e) => e.correct && p(e, t)) !== -1), _ = (t, n, r) => {
95
+ if (!n || e(n)) return 0;
96
+ let i = g(t.tokens, n.selectedTokens).length, a = (t.tokens || []).filter((e) => e.correct === !0), o = i - (n.selectedTokens && n.selectedTokens.length > a.length ? n.selectedTokens && n.selectedTokens.length - i : 0), s = o < 0 ? 0 : o;
98
97
  return r.length ? parseFloat((s / r.length).toFixed(2)) : 0;
99
98
  }, v = (e, t, n) => {
100
99
  let r = [], i = t?.selectedTokens || [], a = e?.tokens || [];
@@ -111,21 +110,21 @@ var d = {
111
110
  d ? (r.push("Score calculated using partial scoring."), r.push("Score is based on the number of correct minus incorrect selections, divided by the total number of correct tokens."), u > 0 && i.length > o && r.push("Extra selected tokens beyond the correct set reduce the score.")) : (r.push("Score calculated using all-or-nothing scoring."), r.push("Student must select all correct tokens and no incorrect tokens to receive full credit."));
112
111
  let f = _(e, t, a.filter((e) => e.correct)), m = d ? f : +(f === 1);
113
112
  return r.push(`Final score: ${m}.`), r;
114
- }, y = (e, t, r) => new Promise((i) => {
115
- if ((!t || n(t)) && i({
113
+ }, y = (t, n, r) => new Promise((i) => {
114
+ if ((!n || e(n)) && i({
116
115
  score: 0,
117
116
  empty: !0,
118
117
  logTrace: ["Student did not select any token."]
119
- }), t = x(t), r.mode !== "evaluate") i({
118
+ }), n = x(n), r.mode !== "evaluate") i({
120
119
  score: void 0,
121
120
  completed: void 0,
122
121
  logTrace: []
123
122
  });
124
123
  else {
125
- let n = l.enabled(e, r, !0), a = e.tokens.filter((e) => e.correct), o = _(e, t, a);
124
+ let e = l.enabled(t, r, !0), a = t.tokens.filter((e) => e.correct), o = _(t, n, a);
126
125
  i({
127
- score: n ? o : +(o === 1),
128
- logTrace: v(e, t, r)
126
+ score: e ? o : +(o === 1),
127
+ logTrace: v(t, n, r)
129
128
  });
130
129
  }
131
130
  });
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../../../shared/feedback/dist/index.js","../../../../../shared/controller-utils/dist/index.js","../../../src/controller/defaults.ts","../../../src/controller/index.ts"],"sourcesContent":["//#region src/defaults.ts\nvar e = {\n\tcorrect: {\n\t\ttype: \"default\",\n\t\tdefault: \"Correct\",\n\t\tcustom: \"Correct\"\n\t},\n\tincorrect: {\n\t\ttype: \"default\",\n\t\tdefault: \"Incorrect\",\n\t\tcustom: \"Incorrect\"\n\t},\n\tpartial: {\n\t\ttype: \"default\",\n\t\tdefault: \"Nearly\",\n\t\tcustom: \"Nearly\"\n\t},\n\tunanswered: {\n\t\ttype: \"default\",\n\t\tdefault: \"You have not entered a response\",\n\t\tcustom: \"You have not entered a response\"\n\t}\n};\n//#endregion\n//#region src/utils.ts\nfunction t(e) {\n\treturn e === \"partially-correct\" ? \"partial\" : e;\n}\n//#endregion\n//#region src/index.ts\nfunction n(n, i = {}) {\n\treturn new Promise((a) => {\n\t\tlet o = {\n\t\t\t...e,\n\t\t\t...i\n\t\t}, s = t(n), c = o[s], l = e[s];\n\t\tr(c, l[c.type]).then(a);\n\t});\n}\nfunction r(e, t) {\n\treturn new Promise((n) => {\n\t\tif (!e || e.type === \"none\") {\n\t\t\tn(void 0);\n\t\t\treturn;\n\t\t}\n\t\tn(e[e.type] || t);\n\t});\n}\nfunction i(n, r = {}) {\n\tlet i = {\n\t\t...e,\n\t\t...r\n\t}, o = t(n), s = i[o], c = e[o];\n\treturn a(s, c[s.type]);\n}\nfunction a(e, t) {\n\tif (!(!e || e.type === \"none\")) return e[e.type] || t;\n}\n//#endregion\nexport { e as defaultFeedback, a as getActualFeedback, i as getActualFeedbackForCorrectness, r as getFeedback, n as getFeedbackForCorrectness, t as normalizeCorrectness };\n","//#region \\0rolldown/runtime.js\nvar e = Object.defineProperty, t = (t, n) => {\n\tlet r = {};\n\tfor (var i in t) e(r, i, {\n\t\tget: t[i],\n\t\tenumerable: !0\n\t});\n\treturn n || e(r, Symbol.toStringTag, { value: \"Module\" }), r;\n};\n//#endregion\n//#region src/persistence.ts\nfunction n(e) {\n\treturn Array.isArray(e) ? e.filter((e) => e != null) : [];\n}\nfunction r(e) {\n\tlet t = [...e];\n\tfor (let e = t.length - 1; e > 0; e--) {\n\t\tlet n = Math.floor(Math.random() * (e + 1));\n\t\t[t[e], t[n]] = [t[n], t[e]];\n\t}\n\treturn t;\n}\nfunction i(e) {\n\treturn e == null ? !0 : Array.isArray(e) ? e.length === 0 : typeof e == \"object\" ? Object.keys(e).length === 0 : !1;\n}\nasync function a(e, t, a, o = \"value\") {\n\tlet s = n(t?.data?.shuffledValues ?? t?.shuffledValues ?? []);\n\tif (!t) {\n\t\tconsole.warn(\"Unable to save shuffled choices because there's no session.\");\n\t\treturn;\n\t}\n\tif (!i(s)) return n(s.map((t) => e.find((e) => e[o] === t)));\n\tlet c = r(e);\n\tif (a && typeof a == \"function\") try {\n\t\tlet e = n(c.map((e) => e[o]));\n\t\ti(e) ? console.error(`shuffledValues is an empty array - refusing to call updateSession. shuffledChoices: ${JSON.stringify(c)}, key: ${o}`) : t.id && t.element && await a(t.id, t.element, { shuffledValues: e });\n\t} catch (e) {\n\t\tconsole.warn(\"Unable to save shuffled order for choices\"), console.error(e);\n\t}\n\telse console.warn(\"Unable to save shuffled choices, shuffle will happen every time.\");\n\treturn c;\n}\nfunction o(e, t, n) {\n\treturn !!(e.lockChoiceOrder || n[\"@pie-element\"]?.lockChoiceOrder || (n.role ?? \"student\") === \"instructor\");\n}\n//#endregion\n//#region src/partial-scoring.ts\nvar s = /* @__PURE__ */ t({ enabled: () => c });\nfunction c(e, t, n) {\n\treturn e?.partialScoring === !1 || t?.partialScoring === !1 ? !1 : typeof n == \"boolean\" ? n : !0;\n}\n//#endregion\nexport { a as getShuffledChoices, o as lockChoices, s as partialScoring };\n","// @ts-nocheck\n/**\n * @synced-from pie-elements/packages/select-text/controller/src/defaults.js\n * @auto-generated\n *\n * This file is automatically synced from pie-elements and converted to TypeScript.\n * Manual edits will be overwritten on next sync.\n * To make changes, edit the upstream JavaScript file and run sync again.\n */\n\nexport default {\n feedbackEnabled: false,\n highlightChoices: false,\n maxSelections: 0,\n mode: 'sentence',\n partialScoring: false,\n prompt: '',\n promptEnabled: true,\n rationale: '',\n rationaleEnabled: true,\n scoringType: 'auto',\n studentInstructionsEnabled: true,\n teacherInstructions: '',\n teacherInstructionsEnabled: true,\n text: '',\n tokens: [],\n toolbarEditorPosition: 'bottom',\n};\n","// @ts-nocheck\n/**\n * @synced-from pie-elements/packages/select-text/controller/src/index.js\n * @auto-generated\n *\n * This file is automatically synced from pie-elements and converted to TypeScript.\n * Manual edits will be overwritten on next sync.\n * To make changes, edit the upstream JavaScript file and run sync again.\n */\n\nimport debug from 'debug';\nimport { isEmpty } from 'lodash-es';\nimport { getFeedbackForCorrectness } from '@pie-element/shared-feedback';\nimport { partialScoring } from '@pie-element/shared-controller-utils';\nimport defaults from './defaults.js';\n\nconst log = debug('@pie-element:select-text:controller');\n\nconst equalTokens = (token1 = {}, token2 = {}) =>\n (token1?.start === token2?.start && token1?.end === token2?.end) ||\n // this case is used for the cases when the token's start & end were recalculated\n (token1?.start === token2?.oldStart && token1?.end === token2?.oldEnd);\n\nconst normalizeTokens = (tokens = [], selectedTokens = [], evaluateMode = false) =>\n (tokens || []).map((token) => {\n const isCorrect = !!token.correct;\n // search if correct token is missing from session\n const isMissing = isCorrect && !(selectedTokens || []).find((selectedToken) => equalTokens(token, selectedToken));\n\n return {\n ...token,\n correct: evaluateMode ? isCorrect : undefined,\n isMissing: evaluateMode ? isMissing : undefined,\n };\n });\n\nexport const getCorrectness = (tokens, selected) => {\n const correct = tokens.filter((t) => t.correct === true);\n\n if (correct.length === 0) {\n return 'unknown';\n }\n\n const correctSelected = getCorrectSelected(tokens, selected);\n\n if (correctSelected.length === selected.length) {\n if (correctSelected.length === correct.length) {\n return 'correct';\n } else if (correctSelected.length > 0) {\n return 'partially-correct';\n }\n }\n\n if (correctSelected.length > 0) {\n return 'partially-correct';\n }\n\n return 'incorrect';\n};\n\nconst getCorrectSelected = (tokens, selected) =>\n (selected || []).filter((s) => tokens.findIndex((token) => token.correct && equalTokens(token, s)) !== -1);\n\nexport const getPartialScore = (question, session, totalCorrect) => {\n if (!session || isEmpty(session)) {\n return 0;\n }\n\n const correctCount = getCorrectSelected(question.tokens, session.selectedTokens).length;\n const correctTokens = (question.tokens || []).filter((t) => t.correct === true);\n const extraSelected = session.selectedTokens ? session.selectedTokens.length > correctTokens.length : 0;\n const incorrectCount = extraSelected ? session.selectedTokens && session.selectedTokens.length - correctCount : 0;\n const count = correctCount - incorrectCount;\n const positiveCount = count < 0 ? 0 : count;\n\n return totalCorrect.length ? parseFloat((positiveCount / totalCorrect.length).toFixed(2)) : 0;\n};\n\n/**\n * Generates detailed trace log for select-text scoring evaluation\n * @param {Object} question - the question model\n * @param {Object} session - the student session\n * @param {Object} env - the environment\n * @returns {Array<string>} traceLog\n */\nexport const getLogTrace = (question, session, env) => {\n const traceLog = [];\n\n const selectedTokens = session?.selectedTokens || [];\n const tokens = question?.tokens || [];\n\n if (selectedTokens.length === 0) {\n traceLog.push('Student did not select any token.');\n return traceLog;\n }\n\n traceLog.push(`Student selected ${selectedTokens.length} token(s).`);\n\n let totalCorrectTokens = 0;\n let correctSelected = 0;\n let missingCount = 0;\n\n for (let i = 0; i < tokens.length; i++) {\n const token = tokens[i];\n if (token.correct) {\n totalCorrectTokens++;\n const matched = selectedTokens.some((s) => equalTokens(token, s));\n if (matched) {\n correctSelected++;\n } else {\n missingCount++;\n }\n }\n }\n\n const incorrectSelected = selectedTokens.length - correctSelected;\n\n if (correctSelected > 0) {\n traceLog.push(`${correctSelected} correct token(s) selected.`);\n }\n\n if (incorrectSelected > 0) {\n traceLog.push(`${incorrectSelected} incorrect token(s) selected.`);\n }\n\n if (missingCount > 0) {\n traceLog.push(`${missingCount} required correct token(s) were not selected.`);\n }\n\n const partialScoringEnabled = partialScoring.enabled(question, env, true);\n\n if (partialScoringEnabled) {\n traceLog.push('Score calculated using partial scoring.');\n traceLog.push(\n 'Score is based on the number of correct minus incorrect selections, divided by the total number of correct tokens.',\n );\n\n if (incorrectSelected > 0 && selectedTokens.length > totalCorrectTokens) {\n traceLog.push(\n 'Extra selected tokens beyond the correct set reduce the score.',\n );\n }\n } else {\n traceLog.push('Score calculated using all-or-nothing scoring.');\n traceLog.push(\n 'Student must select all correct tokens and no incorrect tokens to receive full credit.',\n );\n }\n\n const rawScore = getPartialScore(question, session, tokens.filter((t) => t.correct));\n const finalScore = partialScoringEnabled ? rawScore : rawScore === 1 ? 1 : 0;\n\n traceLog.push(`Final score: ${finalScore}.`);\n\n return traceLog;\n};\n\nexport const outcome = (question, session, env) =>\n new Promise((resolve) => {\n if (!session || isEmpty(session)) {\n resolve({ score: 0, empty: true, logTrace: ['Student did not select any token.'] });\n }\n\n session = normalizeSession(session);\n\n if (env.mode !== 'evaluate') {\n resolve({ score: undefined, completed: undefined, logTrace: [] });\n } else {\n const enabled = partialScoring.enabled(question, env, true);\n const totalCorrect = question.tokens.filter((t) => t.correct);\n const score = getPartialScore(question, session, totalCorrect);\n resolve({\n score: enabled ? score : score === 1 ? 1 : 0,\n logTrace: getLogTrace(question, session, env),\n });\n }\n });\n\nexport function createDefaultModel(model = {}) {\n return new Promise((resolve) => {\n resolve({ ...defaults, ...model });\n });\n}\n\nexport const normalizeSession = (session) => ({ selectedTokens: [], ...session });\n\nexport const normalize = (question) => ({ ...defaults, ...question });\n\nexport const model = (question, session, env) => {\n session = session || { selectedToken: [] };\n session.selectedTokens = session.selectedTokens || [];\n const normalizedQuestion = normalize(question);\n\n return new Promise((resolve) => {\n log('[model]', 'normalizedQuestion: ', normalizedQuestion);\n log('[model]', 'session: ', session);\n\n const tokens = normalizeTokens(normalizedQuestion.tokens, session.selectedTokens, env.mode === 'evaluate');\n log('[model] tokens:', tokens);\n\n const correctness =\n env.mode === 'evaluate' ? getCorrectness(normalizedQuestion.tokens, session.selectedTokens) : undefined;\n\n const fb =\n env.mode === 'evaluate' && normalizedQuestion.feedbackEnabled\n ? getFeedbackForCorrectness(correctness, normalizedQuestion.feedback)\n : Promise.resolve(undefined);\n\n fb.then((feedback) => {\n const out = {\n tokens,\n highlightChoices: normalizedQuestion.highlightChoices,\n prompt: normalizedQuestion.promptEnabled ? normalizedQuestion.prompt : null,\n text: normalizedQuestion.text,\n disabled: env.mode !== 'gather',\n maxSelections: normalizedQuestion.maxSelections,\n correctness,\n env,\n feedback,\n incorrect: env.mode === 'evaluate' ? correctness !== 'correct' : undefined,\n language: normalizedQuestion.language,\n extraCSSRules: normalizedQuestion.extraCSSRules,\n };\n\n if (env.role === 'instructor' && (env.mode === 'view' || env.mode === 'evaluate')) {\n out.rationale = normalizedQuestion.rationaleEnabled ? normalizedQuestion.rationale : null;\n out.teacherInstructions = normalizedQuestion.teacherInstructionsEnabled\n ? normalizedQuestion.teacherInstructions\n : null;\n } else {\n out.rationale = null;\n out.teacherInstructions = null;\n }\n\n resolve(out);\n });\n });\n};\n\nexport const createCorrectResponseSession = (question, env) => {\n return new Promise((resolve) => {\n if (env.mode !== 'evaluate' && env.role === 'instructor') {\n const { tokens } = question;\n const selectedTokens = tokens.filter((t) => t.correct);\n\n resolve({\n id: '1',\n selectedTokens,\n });\n } else {\n resolve(null);\n }\n });\n};\n\n// remove all html tags\nconst getInnerText = (html) => (html || '').replaceAll(/<[^>]*>/g, '');\n\n// remove all html tags except img, iframe and source tag for audio\nconst getContent = (html) => (html || '').replace(/(<(?!img|iframe|source)([^>]+)>)/gi, '');\n\nexport const validate = (model = {}, config = {}) => {\n const { tokens } = model;\n const { minTokens = 2, maxTokens, maxSelections } = config;\n const errors = {};\n const nbOfTokens = (tokens || []).length;\n\n ['teacherInstructions', 'prompt', 'rationale'].forEach((field) => {\n if (config[field]?.required && !getContent(model[field])) {\n errors[field] = 'This field is required.';\n }\n });\n\n const nbOfSelections = (tokens || []).reduce((acc, token) => (token.correct ? acc + 1 : acc), 0);\n\n if (nbOfTokens < minTokens) {\n errors.tokensError = `There should be at least ${minTokens} tokens defined.`;\n } else if (nbOfTokens > maxTokens) {\n errors.tokensError = `No more than ${maxTokens} tokens should be defined.`;\n }\n\n if (nbOfSelections < 1) {\n errors.selectionsError = 'There should be at least 1 token selected.';\n } else if (nbOfSelections > maxSelections) {\n errors.selectionsError = `No more than ${maxSelections} tokens should be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,EAAI,SAAS,iBAAiB,EAAI,SAAS,UAAU,EAAI,SAAS,eACpE,EAAI,YAAY,EAAmB,mBAAmB,EAAmB,YAAY,MACrF,EAAI,sBAAsB,EAAmB,6BACzC,EAAmB,sBACnB,SAEJ,EAAI,YAAY,MAChB,EAAI,sBAAsB,OAG5B,EAAQ,CAAG;EACb,CAAC;CACH,CAAC;AACH,GAEa,KAAgC,GAAU,MAC9C,IAAI,SAAS,MAAY;CAC9B,IAAI,EAAI,SAAS,cAAc,EAAI,SAAS,cAAc;EACxD,IAAM,EAAE,cAAW;EAGnB,EAAQ;GACN,IAAI;GACJ,gBAJqB,EAAO,QAAQ,MAAM,EAAE,OAI5C;EACF,CAAC;CACH,OACE,EAAQ,IAAI;AAEhB,CAAC,GAOG,KAAc,OAAU,KAAQ,IAAI,QAAQ,sCAAsC,EAAE,GAE7E,KAAY,IAAQ,CAAC,GAAG,IAAS,CAAC,MAAM;CACnD,IAAM,EAAE,cAAW,GACb,EAAE,eAAY,GAAG,cAAW,qBAAkB,GAC9C,IAAS,CAAC,GACV,KAAc,KAAU,CAAC,GAAG;CAElC;EAAC;EAAuB;EAAU;CAAW,EAAE,SAAS,MAAU;EAChE,AAAI,EAAO,IAAQ,YAAY,CAAC,EAAW,EAAM,EAAM,MACrD,EAAO,KAAS;CAEpB,CAAC;CAED,IAAM,KAAkB,KAAU,CAAC,GAAG,QAAQ,GAAK,MAAW,EAAM,UAAU,IAAM,IAAI,GAAM,CAAC;CAc/F,OAZI,IAAa,IACf,EAAO,cAAc,4BAA4B,EAAU,oBAClD,IAAa,MACtB,EAAO,cAAc,gBAAgB,EAAU,8BAG7C,IAAiB,IACnB,EAAO,kBAAkB,+CAChB,IAAiB,MAC1B,EAAO,kBAAkB,gBAAgB,EAAc,+BAGlD;AACT"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../../../shared/feedback/dist/index.js","../../../../../shared/controller-utils/dist/index.js","../../../src/controller/defaults.ts","../../../src/controller/index.ts"],"sourcesContent":["//#region src/defaults.ts\nvar e = {\n\tcorrect: {\n\t\ttype: \"default\",\n\t\tdefault: \"Correct\",\n\t\tcustom: \"Correct\"\n\t},\n\tincorrect: {\n\t\ttype: \"default\",\n\t\tdefault: \"Incorrect\",\n\t\tcustom: \"Incorrect\"\n\t},\n\tpartial: {\n\t\ttype: \"default\",\n\t\tdefault: \"Nearly\",\n\t\tcustom: \"Nearly\"\n\t},\n\tunanswered: {\n\t\ttype: \"default\",\n\t\tdefault: \"You have not entered a response\",\n\t\tcustom: \"You have not entered a response\"\n\t}\n};\n//#endregion\n//#region src/utils.ts\nfunction t(e) {\n\treturn e === \"partially-correct\" ? \"partial\" : e;\n}\n//#endregion\n//#region src/index.ts\nfunction n(n, i = {}) {\n\treturn new Promise((a) => {\n\t\tlet o = {\n\t\t\t...e,\n\t\t\t...i\n\t\t}, s = t(n), c = o[s], l = e[s];\n\t\tr(c, l[c.type]).then(a);\n\t});\n}\nfunction r(e, t) {\n\treturn new Promise((n) => {\n\t\tif (!e || e.type === \"none\") {\n\t\t\tn(void 0);\n\t\t\treturn;\n\t\t}\n\t\tn(e[e.type] || t);\n\t});\n}\nfunction i(n, r = {}) {\n\tlet i = {\n\t\t...e,\n\t\t...r\n\t}, o = t(n), s = i[o], c = e[o];\n\treturn a(s, c[s.type]);\n}\nfunction a(e, t) {\n\tif (!(!e || e.type === \"none\")) return e[e.type] || t;\n}\n//#endregion\nexport { e as defaultFeedback, a as getActualFeedback, i as getActualFeedbackForCorrectness, r as getFeedback, n as getFeedbackForCorrectness, t as normalizeCorrectness };\n","//#region \\0rolldown/runtime.js\nvar e = Object.defineProperty, t = (t, n) => {\n\tlet r = {};\n\tfor (var i in t) e(r, i, {\n\t\tget: t[i],\n\t\tenumerable: !0\n\t});\n\treturn n || e(r, Symbol.toStringTag, { value: \"Module\" }), r;\n};\n//#endregion\n//#region src/persistence.ts\nfunction n(e) {\n\treturn Array.isArray(e) ? e.filter((e) => e != null) : [];\n}\nfunction r(e) {\n\tlet t = [...e];\n\tfor (let e = t.length - 1; e > 0; e--) {\n\t\tlet n = Math.floor(Math.random() * (e + 1));\n\t\t[t[e], t[n]] = [t[n], t[e]];\n\t}\n\treturn t;\n}\nfunction i(e) {\n\treturn e == null ? !0 : Array.isArray(e) ? e.length === 0 : typeof e == \"object\" && Object.keys(e).length === 0;\n}\nasync function a(e, t, a, o = \"value\") {\n\tlet s = n(t?.data?.shuffledValues ?? t?.shuffledValues ?? []);\n\tif (!t) {\n\t\tconsole.warn(\"Unable to save shuffled choices because there's no session.\");\n\t\treturn;\n\t}\n\tif (!i(s)) return n(s.map((t) => e.find((e) => e[o] === t)));\n\tlet c = r(e);\n\tif (a && typeof a == \"function\") try {\n\t\tlet e = n(c.map((e) => e[o]));\n\t\ti(e) ? console.error(`shuffledValues is an empty array - refusing to call updateSession. shuffledChoices: ${JSON.stringify(c)}, key: ${o}`) : t.id && t.element && await a(t.id, t.element, { shuffledValues: e });\n\t} catch (e) {\n\t\tconsole.warn(\"Unable to save shuffled order for choices\"), console.error(e);\n\t}\n\telse console.warn(\"Unable to save shuffled choices, shuffle will happen every time.\");\n\treturn c;\n}\nfunction o(e, t, n) {\n\treturn !!(e.lockChoiceOrder || n[\"@pie-element\"]?.lockChoiceOrder || (n.role ?? \"student\") === \"instructor\");\n}\n//#endregion\n//#region src/partial-scoring.ts\nvar s = /* @__PURE__ */ t({ enabled: () => c });\nfunction c(e, t, n) {\n\treturn e?.partialScoring === !1 || t?.partialScoring === !1 ? !1 : typeof n != \"boolean\" || n;\n}\n//#endregion\nexport { a as getShuffledChoices, o as lockChoices, s as partialScoring };\n","// @ts-nocheck\n/**\n * @synced-from pie-elements/packages/select-text/controller/src/defaults.js\n * @auto-generated\n *\n * This file is automatically synced from pie-elements and converted to TypeScript.\n * Manual edits will be overwritten on next sync.\n * To make changes, edit the upstream JavaScript file and run sync again.\n */\n\nexport default {\n feedbackEnabled: false,\n highlightChoices: false,\n maxSelections: 0,\n mode: 'sentence',\n partialScoring: false,\n prompt: '',\n promptEnabled: true,\n rationale: '',\n rationaleEnabled: true,\n scoringType: 'auto',\n studentInstructionsEnabled: true,\n teacherInstructions: '',\n teacherInstructionsEnabled: true,\n text: '',\n tokens: [],\n toolbarEditorPosition: 'bottom',\n};\n","// @ts-nocheck\n/**\n * @synced-from pie-elements/packages/select-text/controller/src/index.js\n * @auto-generated\n *\n * This file is automatically synced from pie-elements and converted to TypeScript.\n * Manual edits will be overwritten on next sync.\n * To make changes, edit the upstream JavaScript file and run sync again.\n */\n\nimport debug from 'debug';\nimport { isEmpty } from '@pie-element/shared-lodash';\nimport { getFeedbackForCorrectness } from '@pie-element/shared-feedback';\nimport { partialScoring } from '@pie-element/shared-controller-utils';\nimport defaults from './defaults.js';\n\nconst log = debug('@pie-element:select-text:controller');\n\nconst equalTokens = (token1 = {}, token2 = {}) =>\n (token1?.start === token2?.start && token1?.end === token2?.end) ||\n // this case is used for the cases when the token's start & end were recalculated\n (token1?.start === token2?.oldStart && token1?.end === token2?.oldEnd);\n\nconst normalizeTokens = (tokens = [], selectedTokens = [], evaluateMode = false) =>\n (tokens || []).map((token) => {\n const isCorrect = !!token.correct;\n // search if correct token is missing from session\n const isMissing = isCorrect && !(selectedTokens || []).find((selectedToken) => equalTokens(token, selectedToken));\n\n return {\n ...token,\n correct: evaluateMode ? isCorrect : undefined,\n isMissing: evaluateMode ? isMissing : undefined,\n };\n });\n\nexport const getCorrectness = (tokens, selected) => {\n const correct = tokens.filter((t) => t.correct === true);\n\n if (correct.length === 0) {\n return 'unknown';\n }\n\n const correctSelected = getCorrectSelected(tokens, selected);\n\n if (correctSelected.length === selected.length) {\n if (correctSelected.length === correct.length) {\n return 'correct';\n } else if (correctSelected.length > 0) {\n return 'partially-correct';\n }\n }\n\n if (correctSelected.length > 0) {\n return 'partially-correct';\n }\n\n return 'incorrect';\n};\n\nconst getCorrectSelected = (tokens, selected) =>\n (selected || []).filter((s) => tokens.findIndex((token) => token.correct && equalTokens(token, s)) !== -1);\n\nexport const getPartialScore = (question, session, totalCorrect) => {\n if (!session || isEmpty(session)) {\n return 0;\n }\n\n const correctCount = getCorrectSelected(question.tokens, session.selectedTokens).length;\n const correctTokens = (question.tokens || []).filter((t) => t.correct === true);\n const extraSelected = session.selectedTokens ? session.selectedTokens.length > correctTokens.length : 0;\n const incorrectCount = extraSelected ? session.selectedTokens && session.selectedTokens.length - correctCount : 0;\n const count = correctCount - incorrectCount;\n const positiveCount = count < 0 ? 0 : count;\n\n return totalCorrect.length ? parseFloat((positiveCount / totalCorrect.length).toFixed(2)) : 0;\n};\n\n/**\n * Generates detailed trace log for select-text scoring evaluation\n * @param {Object} question - the question model\n * @param {Object} session - the student session\n * @param {Object} env - the environment\n * @returns {Array<string>} traceLog\n */\nexport const getLogTrace = (question, session, env) => {\n const traceLog = [];\n\n const selectedTokens = session?.selectedTokens || [];\n const tokens = question?.tokens || [];\n\n if (selectedTokens.length === 0) {\n traceLog.push('Student did not select any token.');\n return traceLog;\n }\n\n traceLog.push(`Student selected ${selectedTokens.length} token(s).`);\n\n let totalCorrectTokens = 0;\n let correctSelected = 0;\n let missingCount = 0;\n\n for (let i = 0; i < tokens.length; i++) {\n const token = tokens[i];\n if (token.correct) {\n totalCorrectTokens++;\n const matched = selectedTokens.some((s) => equalTokens(token, s));\n if (matched) {\n correctSelected++;\n } else {\n missingCount++;\n }\n }\n }\n\n const incorrectSelected = selectedTokens.length - correctSelected;\n\n if (correctSelected > 0) {\n traceLog.push(`${correctSelected} correct token(s) selected.`);\n }\n\n if (incorrectSelected > 0) {\n traceLog.push(`${incorrectSelected} incorrect token(s) selected.`);\n }\n\n if (missingCount > 0) {\n traceLog.push(`${missingCount} required correct token(s) were not selected.`);\n }\n\n const partialScoringEnabled = partialScoring.enabled(question, env, true);\n\n if (partialScoringEnabled) {\n traceLog.push('Score calculated using partial scoring.');\n traceLog.push(\n 'Score is based on the number of correct minus incorrect selections, divided by the total number of correct tokens.',\n );\n\n if (incorrectSelected > 0 && selectedTokens.length > totalCorrectTokens) {\n traceLog.push(\n 'Extra selected tokens beyond the correct set reduce the score.',\n );\n }\n } else {\n traceLog.push('Score calculated using all-or-nothing scoring.');\n traceLog.push(\n 'Student must select all correct tokens and no incorrect tokens to receive full credit.',\n );\n }\n\n const rawScore = getPartialScore(question, session, tokens.filter((t) => t.correct));\n const finalScore = partialScoringEnabled ? rawScore : rawScore === 1 ? 1 : 0;\n\n traceLog.push(`Final score: ${finalScore}.`);\n\n return traceLog;\n};\n\nexport const outcome = (question, session, env) =>\n new Promise((resolve) => {\n if (!session || isEmpty(session)) {\n resolve({ score: 0, empty: true, logTrace: ['Student did not select any token.'] });\n }\n\n session = normalizeSession(session);\n\n if (env.mode !== 'evaluate') {\n resolve({ score: undefined, completed: undefined, logTrace: [] });\n } else {\n const enabled = partialScoring.enabled(question, env, true);\n const totalCorrect = question.tokens.filter((t) => t.correct);\n const score = getPartialScore(question, session, totalCorrect);\n resolve({\n score: enabled ? score : score === 1 ? 1 : 0,\n logTrace: getLogTrace(question, session, env),\n });\n }\n });\n\nexport function createDefaultModel(model = {}) {\n return new Promise((resolve) => {\n resolve({ ...defaults, ...model });\n });\n}\n\nexport const normalizeSession = (session) => ({ selectedTokens: [], ...session });\n\nexport const normalize = (question) => ({ ...defaults, ...question });\n\nexport const model = (question, session, env) => {\n session = session || { selectedToken: [] };\n session.selectedTokens = session.selectedTokens || [];\n const normalizedQuestion = normalize(question);\n\n return new Promise((resolve) => {\n log('[model]', 'normalizedQuestion: ', normalizedQuestion);\n log('[model]', 'session: ', session);\n\n const tokens = normalizeTokens(normalizedQuestion.tokens, session.selectedTokens, env.mode === 'evaluate');\n log('[model] tokens:', tokens);\n\n const correctness =\n env.mode === 'evaluate' ? getCorrectness(normalizedQuestion.tokens, session.selectedTokens) : undefined;\n\n const fb =\n env.mode === 'evaluate' && normalizedQuestion.feedbackEnabled\n ? getFeedbackForCorrectness(correctness, normalizedQuestion.feedback)\n : Promise.resolve(undefined);\n\n fb.then((feedback) => {\n const out = {\n tokens,\n highlightChoices: normalizedQuestion.highlightChoices,\n prompt: normalizedQuestion.promptEnabled ? normalizedQuestion.prompt : null,\n text: normalizedQuestion.text,\n disabled: env.mode !== 'gather',\n maxSelections: normalizedQuestion.maxSelections,\n correctness,\n env,\n feedback,\n incorrect: env.mode === 'evaluate' ? correctness !== 'correct' : undefined,\n language: normalizedQuestion.language,\n extraCSSRules: normalizedQuestion.extraCSSRules,\n };\n\n if (env.role === 'instructor' && (env.mode === 'view' || env.mode === 'evaluate')) {\n out.rationale = normalizedQuestion.rationaleEnabled ? normalizedQuestion.rationale : null;\n out.teacherInstructions = normalizedQuestion.teacherInstructionsEnabled\n ? normalizedQuestion.teacherInstructions\n : null;\n } else {\n out.rationale = null;\n out.teacherInstructions = null;\n }\n\n resolve(out);\n });\n });\n};\n\nexport const createCorrectResponseSession = (question, env) => {\n return new Promise((resolve) => {\n if (env.mode !== 'evaluate' && env.role === 'instructor') {\n const { tokens } = question;\n const selectedTokens = tokens.filter((t) => t.correct);\n\n resolve({\n id: '1',\n selectedTokens,\n });\n } else {\n resolve(null);\n }\n });\n};\n\n// remove all html tags\nconst getInnerText = (html) => (html || '').replaceAll(/<[^>]*>/g, '');\n\n// remove all html tags except img, iframe and source tag for audio\nconst getContent = (html) => (html || '').replace(/(<(?!img|iframe|source)([^>]+)>)/gi, '');\n\nexport const validate = (model = {}, config = {}) => {\n const { tokens } = model;\n const { minTokens = 2, maxTokens, maxSelections } = config;\n const errors = {};\n const nbOfTokens = (tokens || []).length;\n\n ['teacherInstructions', 'prompt', 'rationale'].forEach((field) => {\n if (config[field]?.required && !getContent(model[field])) {\n errors[field] = 'This field is required.';\n }\n });\n\n const nbOfSelections = (tokens || []).reduce((acc, token) => (token.correct ? acc + 1 : acc), 0);\n\n if (nbOfTokens < minTokens) {\n errors.tokensError = `There should be at least ${minTokens} tokens defined.`;\n } else if (nbOfTokens > maxTokens) {\n errors.tokensError = `No more than ${maxTokens} tokens should be defined.`;\n }\n\n if (nbOfSelections < 1) {\n errors.selectionsError = 'There should be at least 1 token selected.';\n } else if (nbOfSelections > maxSelections) {\n errors.selectionsError = `No more than ${maxSelections} tokens should be selected.`;\n }\n\n return errors;\n};\n"],"mappings":";;mCACI,IAAI;CACP,SAAS;EACR,MAAM;EACN,SAAS;EACT,QAAQ;CACT;CACA,WAAW;EACV,MAAM;EACN,SAAS;EACT,QAAQ;CACT;CACA,SAAS;EACR,MAAM;EACN,SAAS;EACT,QAAQ;CACT;CACA,YAAY;EACX,MAAM;EACN,SAAS;EACT,QAAQ;CACT;AACD;AAGA,SAAS,EAAE,GAAG;CACb,OAAO,MAAM,sBAAsB,YAAY;AAChD;AAGA,SAAS,EAAE,GAAG,IAAI,CAAC,GAAG;CACrB,OAAO,IAAI,SAAS,MAAM;EACzB,IAAI,IAAI;GACP,GAAG;GACH,GAAG;EACJ,GAAG,IAAI,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,IAAI,EAAE;EAC7B,EAAE,GAAG,EAAE,EAAE,KAAK,CAAC,CAAC,KAAK,CAAC;CACvB,CAAC;AACF;AACA,SAAS,EAAE,GAAG,GAAG;CAChB,OAAO,IAAI,SAAS,MAAM;EACzB,IAAI,CAAC,KAAK,EAAE,SAAS,QAAQ;GAC5B,EAAE,KAAK,CAAC;GACR;EACD;EACA,EAAE,EAAE,EAAE,SAAS,CAAC;CACjB,CAAC;AACF;;;AC9CA,IAAI,IAAI,OAAO,gBA8CX,IAAoB,kBA9CY,GAAG,MAAM;CAC5C,IAAI,IAAI,CAAC;CACT,KAAK,IAAI,KAAK,GAAG,EAAE,GAAG,GAAG;EACxB,KAAK,EAAE;EACP,YAAY,CAAC;CACd,CAAC;CACD,OAAO,KAAK,EAAE,GAAG,OAAO,aAAa,EAAE,OAAO,SAAS,CAAC,GAAG;AAC5D,EAuCwB,CAAE,EAAE,eAAe,EAAE,CAAC;AAC9C,SAAS,EAAE,GAAG,GAAG,GAAG;CACnB,OAAO,GAAG,mBAAmB,CAAC,KA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AAY,IAAQ,CAAC,GAAG,IAAS,CAAC,MAAM;CACnD,IAAM,EAAE,cAAW,GACb,EAAE,eAAY,GAAG,cAAW,qBAAkB,GAC9C,IAAS,CAAC,GACV,KAAc,KAAU,CAAC,EAAA,CAAG;CAElC;EAAC;EAAuB;EAAU;CAAW,CAAC,CAAC,SAAS,MAAU;EAChE,AAAI,EAAO,EAAM,EAAE,YAAY,CAAC,EAAW,EAAM,EAAM,MACrD,EAAO,KAAS;CAEpB,CAAC;CAED,IAAM,KAAkB,KAAU,CAAC,EAAA,CAAG,QAAQ,GAAK,MAAW,EAAM,UAAU,IAAM,IAAI,GAAM,CAAC;CAc/F,OAZI,IAAa,IACf,EAAO,cAAc,4BAA4B,EAAU,oBAClD,IAAa,MACtB,EAAO,cAAc,gBAAgB,EAAU,8BAG7C,IAAiB,IACnB,EAAO,kBAAkB,+CAChB,IAAiB,MAC1B,EAAO,kBAAkB,gBAAgB,EAAc,+BAGlD;AACT"}
@@ -1,5 +1,5 @@
1
- import { q as e } from "../Check-CXevxzJJ.js";
2
- import { n as t, t as n } from "../main-4aycOoI5.js";
1
+ import { C as e } from "../Check-DfUn7PkH.js";
2
+ import { n as t, t as n } from "../main-B3z36nHt.js";
3
3
  import r from "react";
4
4
  import { createRoot as i } from "react-dom/client";
5
5
  //#region ../../shared/player-events/dist/index.js
@@ -80,7 +80,7 @@ var a = class e extends CustomEvent {
80
80
  }
81
81
  }
82
82
  disconnectedCallback() {
83
- this._root && this._root.unmount();
83
+ this._root &&= (this._root.unmount(), null);
84
84
  }
85
85
  };
86
86
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../../../shared/player-events/dist/index.js","../../../src/delivery/index.ts"],"sourcesContent":["//#region src/index.ts\nvar e = class e extends CustomEvent {\n\tstatic {\n\t\tthis.TYPE = \"model-set\";\n\t}\n\tconstructor(t, n, r) {\n\t\tsuper(e.TYPE, {\n\t\t\tbubbles: !0,\n\t\t\tcomposed: !0,\n\t\t\tdetail: {\n\t\t\t\tcomplete: n,\n\t\t\t\tcomponent: t,\n\t\t\t\thasModel: r\n\t\t\t}\n\t\t}), this.component = t, this.complete = n;\n\t}\n}, t = class e extends CustomEvent {\n\tstatic {\n\t\tthis.TYPE = \"session-changed\";\n\t}\n\tconstructor(t, n) {\n\t\tsuper(e.TYPE, {\n\t\t\tbubbles: !0,\n\t\t\tcomposed: !0,\n\t\t\tdetail: {\n\t\t\t\tcomplete: n,\n\t\t\t\tcomponent: t\n\t\t\t}\n\t\t}), this.component = t, this.complete = n;\n\t}\n};\n//#endregion\nexport { e as ModelSetEvent, t as SessionChangedEvent };\n","// @ts-nocheck\n/**\n * @synced-from pie-elements/packages/select-text/src/index.js\n * @auto-generated\n *\n * This file is automatically synced from pie-elements and converted to TypeScript.\n * Manual edits will be overwritten on next sync.\n * To make changes, edit the upstream JavaScript file and run sync again.\n */\n\nimport React from 'react';\nimport { createRoot } from 'react-dom/client';\nimport { SessionChangedEvent, ModelSetEvent } from '@pie-element/shared-player-events';\nimport Main from './main.js';\nimport { renderMath } from '@pie-element/shared-math-rendering-mathjax';\nimport generateModel from './utils.js';\n\nexport default class SelectText extends HTMLElement {\n constructor() {\n super();\n this._root = null;\n }\n\n set model(m) {\n this._model = m;\n\n this.render();\n this.dispatchEvent(\n new ModelSetEvent(this.tagName.toLowerCase(), this.isSessionComplete(), this._model !== undefined),\n );\n }\n\n set session(s) {\n this._session = s;\n\n if (this._model) {\n const generatedModel = generateModel(this._model) || {};\n const { tokens } = generatedModel;\n let { selectedTokens } = s || {};\n\n selectedTokens = selectedTokens || [];\n\n // This case was introduced mostly for createCorrectSession:\n // make sure initial session tokens are parsed and have correct start and end (according to the regenerated model)\n const selectedTokenExistsInGeneratedTokens = (s) =>\n tokens.find(({ start: tStart, end: tEnd }) => s.start === tStart && s.end === tEnd);\n\n // check if ALL the selectedTokens have the correct start and end\n const allAreCorrect = selectedTokens.reduce(\n (acc, selectedToken) => acc && selectedTokenExistsInGeneratedTokens(selectedToken),\n true,\n );\n\n if (!allAreCorrect) {\n // otherwise, make sure to parse selectedTokens as well\n const generatedModel = generateModel({ ...this._model, tokens: selectedTokens }) || {};\n const { tokens } = generatedModel;\n\n if (tokens) {\n this._session.selectedTokens = tokens;\n }\n }\n }\n\n if (!Array.isArray(this._session.selectedTokens)) {\n this._session.selectedTokens = [];\n }\n this.render();\n }\n\n get session() {\n return this._session;\n }\n\n isSessionComplete() {\n const { selectedTokens } = this._session || {};\n return Array.isArray(selectedTokens) && selectedTokens.length > 0;\n }\n\n selectionChanged(selection) {\n this._session.selectedTokens = selection;\n\n this.dispatchEvent(new SessionChangedEvent(this.tagName.toLowerCase(), this.isSessionComplete()));\n }\n\n connectedCallback() {\n this.render();\n }\n\n render() {\n if (this._model && this._session) {\n const el = React.createElement(Main, {\n model: this._model,\n session: this._session,\n onSelectionChange: this.selectionChanged.bind(this),\n });\n\n if (!this._root) {\n this._root = createRoot(this);\n }\n this._root.render(el);\n queueMicrotask(() => {\n renderMath(this);\n });\n }\n }\n\n disconnectedCallback() {\n if (this._root) {\n this._root.unmount();\n }\n }\n}\n"],"mappings":";;;;;AACA,IAAI,IAAI,MAAM,UAAU,YAAY;CACnC;EACC,KAAK,OAAO;CACb;CACA,YAAY,GAAG,GAAG,GAAG;EACpB,MAAM,EAAE,MAAM;GACb,SAAS,CAAC;GACV,UAAU,CAAC;GACX,QAAQ;IACP,UAAU;IACV,WAAW;IACX,UAAU;GACX;EACD,CAAC,GAAG,KAAK,YAAY,GAAG,KAAK,WAAW;CACzC;AACD,GAAG,IAAI,MAAM,UAAU,YAAY;CAClC;EACC,KAAK,OAAO;CACb;CACA,YAAY,GAAG,GAAG;EACjB,MAAM,EAAE,MAAM;GACb,SAAS,CAAC;GACV,UAAU,CAAC;GACX,QAAQ;IACP,UAAU;IACV,WAAW;GACZ;EACD,CAAC,GAAG,KAAK,YAAY,GAAG,KAAK,WAAW;CACzC;AACD,GCbqB,IAArB,cAAwC,YAAY;CAClD,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M,cAAc,GAAM;IACnC,OAAO,KAAK;IACZ,SAAS,KAAK;IACd,mBAAmB,KAAK,iBAAiB,KAAK,IAAI;GACpD,CAAC;GAMD,AAJA,AACE,KAAK,UAAQ,EAAW,IAAI,GAE9B,KAAK,MAAM,OAAO,CAAE,GACpB,qBAAqB;IACnB,EAAW,IAAI;GACjB,CAAC;EACH;CACF;CAEA,uBAAuB;EACrB,AAAI,KAAK,SACP,KAAK,MAAM,QAAQ;CAEvB;AACF"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../../../shared/player-events/dist/index.js","../../../src/delivery/index.ts"],"sourcesContent":["//#region src/index.ts\nvar e = class e extends CustomEvent {\n\tstatic {\n\t\tthis.TYPE = \"model-set\";\n\t}\n\tconstructor(t, n, r) {\n\t\tsuper(e.TYPE, {\n\t\t\tbubbles: !0,\n\t\t\tcomposed: !0,\n\t\t\tdetail: {\n\t\t\t\tcomplete: n,\n\t\t\t\tcomponent: t,\n\t\t\t\thasModel: r\n\t\t\t}\n\t\t}), this.component = t, this.complete = n;\n\t}\n}, t = class e extends CustomEvent {\n\tstatic {\n\t\tthis.TYPE = \"session-changed\";\n\t}\n\tconstructor(t, n) {\n\t\tsuper(e.TYPE, {\n\t\t\tbubbles: !0,\n\t\t\tcomposed: !0,\n\t\t\tdetail: {\n\t\t\t\tcomplete: n,\n\t\t\t\tcomponent: t\n\t\t\t}\n\t\t}), this.component = t, this.complete = n;\n\t}\n};\n//#endregion\nexport { e as ModelSetEvent, t as SessionChangedEvent };\n","// @ts-nocheck\n/**\n * @synced-from pie-elements/packages/select-text/src/index.js\n * @auto-generated\n *\n * This file is automatically synced from pie-elements and converted to TypeScript.\n * Manual edits will be overwritten on next sync.\n * To make changes, edit the upstream JavaScript file and run sync again.\n */\n\nimport React from 'react';\nimport { createRoot } from 'react-dom/client';\nimport { SessionChangedEvent, ModelSetEvent } from '@pie-element/shared-player-events';\nimport Main from './main.js';\nimport { renderMath } from '@pie-element/shared-math-rendering-mathjax';\nimport generateModel from './utils.js';\n\nexport default class SelectText extends HTMLElement {\n constructor() {\n super();\n this._root = null;\n }\n\n set model(m) {\n this._model = m;\n\n this.render();\n this.dispatchEvent(\n new ModelSetEvent(this.tagName.toLowerCase(), this.isSessionComplete(), this._model !== undefined),\n );\n }\n\n set session(s) {\n this._session = s;\n\n if (this._model) {\n const generatedModel = generateModel(this._model) || {};\n const { tokens } = generatedModel;\n let { selectedTokens } = s || {};\n\n selectedTokens = selectedTokens || [];\n\n // This case was introduced mostly for createCorrectSession:\n // make sure initial session tokens are parsed and have correct start and end (according to the regenerated model)\n const selectedTokenExistsInGeneratedTokens = (s) =>\n tokens.find(({ start: tStart, end: tEnd }) => s.start === tStart && s.end === tEnd);\n\n // check if ALL the selectedTokens have the correct start and end\n const allAreCorrect = selectedTokens.reduce(\n (acc, selectedToken) => acc && selectedTokenExistsInGeneratedTokens(selectedToken),\n true,\n );\n\n if (!allAreCorrect) {\n // otherwise, make sure to parse selectedTokens as well\n const generatedModel = generateModel({ ...this._model, tokens: selectedTokens }) || {};\n const { tokens } = generatedModel;\n\n if (tokens) {\n this._session.selectedTokens = tokens;\n }\n }\n }\n\n if (!Array.isArray(this._session.selectedTokens)) {\n this._session.selectedTokens = [];\n }\n this.render();\n }\n\n get session() {\n return this._session;\n }\n\n isSessionComplete() {\n const { selectedTokens } = this._session || {};\n return Array.isArray(selectedTokens) && selectedTokens.length > 0;\n }\n\n selectionChanged(selection) {\n this._session.selectedTokens = selection;\n\n this.dispatchEvent(new SessionChangedEvent(this.tagName.toLowerCase(), this.isSessionComplete()));\n }\n\n connectedCallback() {\n this.render();\n }\n\n render() {\n if (this._model && this._session) {\n const el = React.createElement(Main, {\n model: this._model,\n session: this._session,\n onSelectionChange: this.selectionChanged.bind(this),\n });\n\n if (!this._root) {\n this._root = createRoot(this);\n }\n this._root.render(el);\n queueMicrotask(() => {\n renderMath(this);\n });\n }\n }\n\n disconnectedCallback() {\n if (this._root) {\n this._root.unmount();\n this._root = null;\n }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AAI,MACF,KAAK,SAAS,iBAAiB;GAEnC;EACF;EAKA,AAHK,MAAM,QAAQ,KAAK,SAAS,cAAc,MAC7C,KAAK,SAAS,iBAAiB,CAAC,IAElC,KAAK,OAAO;CACd;CAEA,IAAI,UAAU;EACZ,OAAO,KAAK;CACd;CAEA,oBAAoB;EAClB,IAAM,EAAE,sBAAmB,KAAK,YAAY,CAAC;EAC7C,OAAO,MAAM,QAAQ,CAAc,KAAK,EAAe,SAAS;CAClE;CAEA,iBAAiB,GAAW;EAG1B,AAFA,KAAK,SAAS,iBAAiB,GAE/B,KAAK,cAAc,IAAI,EAAoB,KAAK,QAAQ,YAAY,GAAG,KAAK,kBAAkB,CAAC,CAAC;CAClG;CAEA,oBAAoB;EAClB,KAAK,OAAO;CACd;CAEA,SAAS;EACP,IAAI,KAAK,UAAU,KAAK,UAAU;GAChC,IAAM,IAAK,EAAM,cAAc,GAAM;IACnC,OAAO,KAAK;IACZ,SAAS,KAAK;IACd,mBAAmB,KAAK,iBAAiB,KAAK,IAAI;GACpD,CAAC;GAMD,AAJA,AACE,KAAK,UAAQ,EAAW,IAAI,GAE9B,KAAK,MAAM,OAAO,CAAE,GACpB,qBAAqB;IACnB,EAAW,IAAI;GACjB,CAAC;EACH;CACF;CAEA,uBAAuB;EACrB,AAEE,KAAK,WADL,KAAK,MAAM,QAAQ,GACN;CAEjB;AACF"}
@@ -1,3 +1,15 @@
1
+ import * as __pieBrowserCjsReactRequire from "react";
2
+ const __pieBrowserCjsRequire = (specifier) => {
3
+ switch (specifier) {
4
+ case "react": return __pieBrowserCjsReactRequire;
5
+
6
+
7
+
8
+
9
+ default:
10
+ throw new Error(`Unsupported browser CJS require: ${specifier}`);
11
+ }
12
+ };
1
13
  //#region \0rolldown/runtime.js
2
14
  var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescriptor, r = Object.getOwnPropertyNames, i = Object.getPrototypeOf, a = Object.prototype.hasOwnProperty, o = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), s = (e, n) => {
3
15
  let r = {};
@@ -15,10 +27,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
15
27
  }, l = (n, r, a) => (a = n == null ? {} : e(i(n)), c(r || !n || !n.__esModule ? t(a, "default", {
16
28
  value: n,
17
29
  enumerable: !0
18
- }) : a, n)), u = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy < "u" ? new Proxy(e, { get: (e, t) => (typeof require < "u" ? require : e)[t] }) : e)(function(e) {
19
- if (typeof require < "u") return require.apply(this, arguments);
20
- throw Error("Calling `require` for \"" + e + "\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.");
21
- }), d = /* @__PURE__ */ o(((e, t) => {
30
+ }) : a, n)), u = __pieBrowserCjsRequire, d = /* @__PURE__ */ o(((e, t) => {
22
31
  var n = 1e3, r = n * 60, i = r * 60, a = i * 24, o = a * 7, s = a * 365.25;
23
32
  t.exports = function(e, t) {
24
33
  t ||= {};
@@ -81,7 +90,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
81
90
  var i = t >= n * 1.5;
82
91
  return Math.round(e / n) + " " + r + (i ? "s" : "");
83
92
  }
84
- })), ee = /* @__PURE__ */ o(((e, t) => {
93
+ })), f = /* @__PURE__ */ o(((e, t) => {
85
94
  function n(e) {
86
95
  n.debug = n, n.default = n, n.coerce = c, n.disable = o, n.enable = i, n.enabled = s, n.humanize = d(), n.destroy = l, Object.keys(e).forEach((t) => {
87
96
  n[t] = e[t];
@@ -154,7 +163,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
154
163
  return n.enable(n.load()), n;
155
164
  }
156
165
  t.exports = n;
157
- })), te = /* @__PURE__ */ o(((e, t) => {
166
+ })), p = /* @__PURE__ */ o(((e, t) => {
158
167
  e.formatArgs = r, e.save = i, e.load = a, e.useColors = n, e.storage = o(), e.destroy = (() => {
159
168
  let e = !1;
160
169
  return () => {
@@ -194,7 +203,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
194
203
  return localStorage;
195
204
  } catch {}
196
205
  }
197
- t.exports = ee()(e);
206
+ t.exports = f()(e);
198
207
  var { formatters: s } = t.exports;
199
208
  s.j = function(e) {
200
209
  try {
@@ -203,179 +212,112 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
203
212
  return "[UnexpectedJSONParseError]: " + e.message;
204
213
  }
205
214
  };
206
- })), f = typeof global == "object" && global && global.Object === Object && global, ne = typeof self == "object" && self && self.Object === Object && self, p = f || ne || Function("return this")(), m = p.Symbol, h = Object.prototype, re = h.hasOwnProperty, ie = h.toString, g = m ? m.toStringTag : void 0;
207
- function ae(e) {
208
- var t = re.call(e, g), n = e[g];
209
- try {
210
- e[g] = void 0;
211
- var r = !0;
212
- } catch {}
213
- var i = ie.call(e);
214
- return r && (t ? e[g] = n : delete e[g]), i;
215
+ })), m = Object.prototype;
216
+ function h(e) {
217
+ return typeof e == "object" && !!e;
215
218
  }
216
- //#endregion
217
- //#region ../../../node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_objectToString.js
218
- var oe = Object.prototype.toString;
219
- function se(e) {
220
- return oe.call(e);
219
+ function g(e) {
220
+ return Array.isArray(e) ? e : typeof e == "number" ? [e] : e.replace(/\[(\d+)\]/g, ".$1").split(".").filter(Boolean);
221
+ }
222
+ function _(e) {
223
+ return Array.isArray(e) ? e.slice() : h(e) ? { ...e } : e;
221
224
  }
222
- //#endregion
223
- //#region ../../../node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseGetTag.js
224
- var ce = "[object Null]", le = "[object Undefined]", _ = m ? m.toStringTag : void 0;
225
225
  function v(e) {
226
- return e == null ? e === void 0 ? le : ce : _ && _ in Object(e) ? ae(e) : se(e);
226
+ if (!h(e)) return e;
227
+ if (e instanceof Date) return new Date(e.getTime());
228
+ if (Array.isArray(e)) return e.map((e) => v(e));
229
+ let t = {};
230
+ for (let [n, r] of Object.entries(e)) t[n] = v(r);
231
+ return t;
227
232
  }
228
- //#endregion
229
- //#region ../../../node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isObjectLike.js
230
233
  function y(e) {
231
- return typeof e == "object" && !!e;
234
+ return (e ?? []).filter(Boolean);
232
235
  }
233
- //#endregion
234
- //#region ../../../node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArray.js
235
- var ue = Array.isArray;
236
- //#endregion
237
- //#region ../../../node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isObject.js
238
- function b(e) {
239
- var t = typeof e;
240
- return e != null && (t == "object" || t == "function");
236
+ function b(e, t = 0, n = {}) {
237
+ let r, i, a, o, s, c = n.leading === !0, l = n.trailing !== !1, u = () => {
238
+ if (!a) return s;
239
+ let t = a, n = o;
240
+ return a = void 0, o = void 0, s = e.apply(n, t), s;
241
+ }, d = () => {
242
+ r && clearTimeout(r), i && clearTimeout(i), r = void 0, i = void 0, a = void 0, o = void 0;
243
+ }, f = function(...e) {
244
+ let d = c && !r;
245
+ return a = e, o = this, d && u(), r && clearTimeout(r), r = setTimeout(() => {
246
+ r = void 0, i &&= (clearTimeout(i), void 0), l ? u() : (a = void 0, o = void 0);
247
+ }, t), n.maxWait !== void 0 && !i && (i = setTimeout(() => {
248
+ r && clearTimeout(r), r = void 0, i = void 0, l || !c ? u() : (a = void 0, o = void 0);
249
+ }, n.maxWait)), s;
250
+ };
251
+ return f.cancel = d, f.flush = () => (r &&= (clearTimeout(r), void 0), i &&= (clearTimeout(i), void 0), u()), f;
241
252
  }
242
- //#endregion
243
- //#region ../../../node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isFunction.js
244
- var de = "[object AsyncFunction]", fe = "[object Function]", pe = "[object GeneratorFunction]", x = "[object Proxy]";
245
- function S(e) {
246
- if (!b(e)) return !1;
247
- var t = v(e);
248
- return t == fe || t == pe || t == de || t == x;
253
+ function x(e, t, n) {
254
+ return (e ?? []).filter((e) => !(t ?? []).some((t) => n(e, t)));
249
255
  }
250
- //#endregion
251
- //#region ../../../node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_coreJsData.js
252
- var C = p["__core-js_shared__"], w = function() {
253
- var e = /[^.]+$/.exec(C && C.keys && C.keys.IE_PROTO || "");
254
- return e ? "Symbol(src)_1." + e : "";
255
- }();
256
- function me(e) {
257
- return !!w && w in e;
256
+ function S(e) {
257
+ let t = [];
258
+ for (let n of e ?? []) Array.isArray(n) ? t.push(...n) : t.push(n);
259
+ return t;
258
260
  }
259
- //#endregion
260
- //#region ../../../node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_toSource.js
261
- var he = Function.prototype.toString;
262
- function T(e) {
263
- if (e != null) {
264
- try {
265
- return he.call(e);
266
- } catch {}
267
- try {
268
- return e + "";
269
- } catch {}
261
+ function C(e, t, n) {
262
+ if (!Array.isArray(t) && e != null && Object.prototype.hasOwnProperty.call(Object(e), t)) {
263
+ let r = e[t];
264
+ return r === void 0 ? n : r;
270
265
  }
271
- return "";
266
+ let r = e;
267
+ for (let e of g(t)) {
268
+ if (r == null) return n;
269
+ r = r[e];
270
+ }
271
+ return r === void 0 ? n : r;
272
272
  }
273
- //#endregion
274
- //#region ../../../node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsNative.js
275
- var ge = /[\\^$.*+?()[\]{}|]/g, _e = /^\[object .+?Constructor\]$/, ve = Function.prototype, ye = Object.prototype, be = ve.toString, xe = ye.hasOwnProperty, Se = RegExp("^" + be.call(xe).replace(ge, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$");
276
- function Ce(e) {
277
- return !b(e) || me(e) ? !1 : (S(e) ? Se : _e).test(T(e));
273
+ function w(e) {
274
+ return e == null ? !0 : typeof e == "string" || Array.isArray(e) ? e.length === 0 : e instanceof Map || e instanceof Set ? e.size === 0 : !h(e) || Object.keys(e).length === 0;
278
275
  }
279
- //#endregion
280
- //#region ../../../node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getValue.js
281
- function we(e, t) {
282
- return e?.[t];
276
+ function T(e, t, n) {
277
+ let r = n?.(e, t);
278
+ if (r !== void 0) return !!r;
279
+ if (Object.is(e, t)) return !0;
280
+ if (!h(e) || !h(t)) return !1;
281
+ if (e instanceof Date || t instanceof Date) return e instanceof Date && t instanceof Date && e.getTime() === t.getTime();
282
+ if (Array.isArray(e) || Array.isArray(t)) return Array.isArray(e) && Array.isArray(t) && e.length === t.length && e.every((e, r) => T(e, t[r], n));
283
+ let i = Object.keys(e), a = Object.keys(t);
284
+ return i.length === a.length && i.every((r) => m.hasOwnProperty.call(t, r) && T(e[r], t[r], n));
283
285
  }
284
- //#endregion
285
- //#region ../../../node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getNative.js
286
286
  function E(e, t) {
287
- var n = we(e, t);
288
- return Ce(n) ? n : void 0;
289
- }
290
- //#endregion
291
- //#region ../../../node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_WeakMap.js
292
- var D = E(p, "WeakMap"), Te = 9007199254740991;
293
- function O(e) {
294
- return typeof e == "number" && e > -1 && e % 1 == 0 && e <= Te;
295
- }
296
- //#endregion
297
- //#region ../../../node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArrayLike.js
298
- function Ee(e) {
299
- return e != null && O(e.length) && !S(e);
300
- }
301
- //#endregion
302
- //#region ../../../node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isPrototype.js
303
- var De = Object.prototype;
304
- function k(e) {
305
- var t = e && e.constructor;
306
- return e === (typeof t == "function" && t.prototype || De);
287
+ return T(e, t);
307
288
  }
308
- //#endregion
309
- //#region ../../../node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsArguments.js
310
- var Oe = "[object Arguments]";
311
- function A(e) {
312
- return y(e) && v(e) == Oe;
289
+ function D(e) {
290
+ return Number.isFinite(e);
313
291
  }
314
- //#endregion
315
- //#region ../../../node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArguments.js
316
- var j = Object.prototype, ke = j.hasOwnProperty, Ae = j.propertyIsEnumerable, je = A(function() {
317
- return arguments;
318
- }()) ? A : function(e) {
319
- return y(e) && ke.call(e, "callee") && !Ae.call(e, "callee");
320
- };
321
- //#endregion
322
- //#region ../../../node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/stubFalse.js
323
- function Me() {
324
- return !1;
292
+ function O(e, ...t) {
293
+ for (let n of t) if (n) for (let [t, r] of Object.entries(n)) h(r) && !Array.isArray(r) && h(e[t]) ? O(e[t], r) : e[t] = v(r);
294
+ return e;
325
295
  }
326
- //#endregion
327
- //#region ../../../node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isBuffer.js
328
- var M = typeof exports == "object" && exports && !exports.nodeType && exports, N = M && typeof module == "object" && module && !module.nodeType && module, P = N && N.exports === M ? p.Buffer : void 0, Ne = (P ? P.isBuffer : void 0) || Me, Pe = "[object Arguments]", Fe = "[object Array]", Ie = "[object Boolean]", Le = "[object Date]", Re = "[object Error]", ze = "[object Function]", Be = "[object Map]", Ve = "[object Number]", He = "[object Object]", Ue = "[object RegExp]", We = "[object Set]", Ge = "[object String]", F = "[object WeakMap]", Ke = "[object ArrayBuffer]", qe = "[object DataView]", Je = "[object Float32Array]", Ye = "[object Float64Array]", Xe = "[object Int8Array]", Ze = "[object Int16Array]", Qe = "[object Int32Array]", $e = "[object Uint8Array]", et = "[object Uint8ClampedArray]", tt = "[object Uint16Array]", nt = "[object Uint32Array]", I = {};
329
- I[Je] = I[Ye] = I[Xe] = I[Ze] = I[Qe] = I[$e] = I[et] = I[tt] = I[nt] = !0, I[Pe] = I[Fe] = I[Ke] = I[Ie] = I[qe] = I[Le] = I[Re] = I[ze] = I[Be] = I[Ve] = I[He] = I[Ue] = I[We] = I[Ge] = I[F] = !1;
330
- function rt(e) {
331
- return y(e) && O(e.length) && !!I[v(e)];
296
+ function k(e, t) {
297
+ let n = { ...e ?? {} };
298
+ for (let e of Array.isArray(t) ? t : [t]) delete n[e];
299
+ return n;
332
300
  }
333
- //#endregion
334
- //#region ../../../node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseUnary.js
335
- function L(e) {
336
- return function(t) {
337
- return e(t);
338
- };
301
+ function A(e, t, n) {
302
+ let r = g(t), i = e;
303
+ return r.forEach((e, t) => {
304
+ if (t === r.length - 1) {
305
+ i[e] = n;
306
+ return;
307
+ }
308
+ let a = r[t + 1];
309
+ i[e] ??= typeof a == "number" || /^\d+$/.test(String(a)) ? [] : {}, i = i[e];
310
+ }), e;
339
311
  }
340
- //#endregion
341
- //#region ../../../node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nodeUtil.js
342
- var R = typeof exports == "object" && exports && !exports.nodeType && exports, z = R && typeof module == "object" && module && !module.nodeType && module, B = z && z.exports === R && f.process, V = function() {
343
- try {
344
- return z && z.require && z.require("util").types || B && B.binding && B.binding("util");
345
- } catch {}
346
- }(), H = V && V.isTypedArray, it = H ? L(H) : rt;
347
- //#endregion
348
- //#region ../../../node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_overArg.js
349
- function U(e, t) {
350
- return function(n) {
351
- return e(t(n));
352
- };
312
+ function j(e, t) {
313
+ let n = t ?? ((e) => e);
314
+ return Array.from({ length: Math.max(0, e) }, (e, t) => n(t));
353
315
  }
354
- //#endregion
355
- //#region ../../../node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nativeKeys.js
356
- var at = U(Object.keys, Object), ot = Object.prototype.hasOwnProperty;
357
- function st(e) {
358
- if (!k(e)) return at(e);
359
- var t = [];
360
- for (var n in Object(e)) ot.call(e, n) && n != "constructor" && t.push(n);
361
- return t;
316
+ function M(...e) {
317
+ let t = Math.max(0, ...e.map((e) => e.length));
318
+ return Array.from({ length: t }, (t, n) => e.map((e) => e[n]));
362
319
  }
363
320
  //#endregion
364
- //#region ../../../node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Map.js
365
- var W = E(p, "Map"), G = E(p, "DataView"), K = E(p, "Promise"), q = E(p, "Set"), J = "[object Map]", ct = "[object Object]", Y = "[object Promise]", X = "[object Set]", Z = "[object WeakMap]", Q = "[object DataView]", lt = T(G), ut = T(W), dt = T(K), ft = T(q), pt = T(D), $ = v;
366
- (G && $(new G(/* @__PURE__ */ new ArrayBuffer(1))) != Q || W && $(new W()) != J || K && $(K.resolve()) != Y || q && $(new q()) != X || D && $(new D()) != Z) && ($ = function(e) {
367
- var t = v(e), n = t == ct ? e.constructor : void 0, r = n ? T(n) : "";
368
- if (r) switch (r) {
369
- case lt: return Q;
370
- case ut: return J;
371
- case dt: return Y;
372
- case ft: return X;
373
- case pt: return Z;
374
- }
375
- return t;
376
- });
377
- var mt = $;
378
- //#endregion
379
- export { u as C, s as S, v as _, it as a, te as b, Ne as c, Ee as d, E as f, y as g, ue as h, U as i, je as l, b as m, W as n, V as o, S as p, st as r, L as s, mt as t, k as u, m as v, l as w, o as x, p as y };
321
+ export { o as _, w as a, l as b, b as c, j as d, M as f, p as g, S as h, D as i, x as l, C as m, O as n, k as o, y as p, A as r, _ as s, E as t, v as u, s as v, u as y };
380
322
 
381
- //# sourceMappingURL=_getTag-x1UozeM0.js.map
323
+ //# sourceMappingURL=dist-BamN0-DG.js.map