@pie-element/complex-rubric 2.19.3-next.7 → 2.19.3-next.8

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.
@@ -7,7 +7,7 @@
7
7
  "test": "echo \"Error: no test specified\" && exit 1"
8
8
  },
9
9
  "dependencies": {
10
- "@pie-lib/pie-toolbox": "1.30.2",
10
+ "@pie-lib/pie-toolbox": "1.31.0",
11
11
  "lodash": "^4.17.15"
12
12
  },
13
13
  "author": "",
@@ -1,4 +1,4 @@
1
- import {_dll_react, _dll_prop_types, _dll_classnames, _dll_react_dom, _dll_debug, _dll_lodash, _dll_react_dom_server, _dll_pie_framework__mathquill} from "../../../@pie-lib/pie-toolbox-math-rendering-module@1.23.1/module/index.js";
1
+ import {_dll_react, _dll_prop_types, _dll_classnames, _dll_react_dom, _dll_debug, _dll_lodash, _dll_react_dom_server, _dll_pie_framework__mathquill} from "../../../@pie-lib/pie-toolbox-math-rendering-module@1.23.2/module/index.js";
2
2
  import RubricConfigure from '@pie-element/rubric/configure/lib';
3
3
  import {_dll_pie_lib__pie_toolbox_editable_html, _dll_pie_lib__pie_toolbox_render_ui, _dll_pie_lib__pie_toolbox_config_ui} from "../../../@pie-lib/pie-toolbox-module@4.24.3/module/index.js";
4
4
  function _mergeNamespaces(n, m) {
@@ -42038,34 +42038,49 @@ var mathjaxScript = {};
42038
42038
  Object.defineProperty(mathjaxScript, "__esModule", {
42039
42039
  value: true
42040
42040
  });
42041
- mathjaxScript.initializeMathJax = mathjaxScript.MathJaxVersion = void 0;
42041
+ mathjaxScript.mathRenderingKEY = mathjaxScript.mathRenderingAccessibleKEY = mathjaxScript.initializeMathJax = mathjaxScript.MathJaxVersion = void 0;
42042
42042
  var _renderMath = renderMath$1;
42043
42043
  var MathJaxVersion = '3.2.2';
42044
42044
  mathjaxScript.MathJaxVersion = MathJaxVersion;
42045
- var initializeMathJax = function initializeMathJax(renderOpts) {
42046
- if (renderOpts !== null && renderOpts !== void 0 && renderOpts.useSingleDollar) {
42047
- console.warn('[math-rendering] using $ is not advisable, please use $$..$$ or \\(...\\)');
42048
- }
42049
- var texConfig = renderOpts !== null && renderOpts !== void 0 && renderOpts.useSingleDollar ? {
42050
- macros: {
42051
- parallelogram: "\\lower.2em{\\Huge\\unicode{x25B1}}",
42052
- overarc: '\\overparen',
42053
- napprox: '\\not\\approx',
42054
- longdiv: '\\enclose{longdiv}'
42055
- },
42056
- inlineMath: [['$', '$'], ['\\(', '\\)']],
42057
- processEscapes: true,
42058
- displayMath: [['$$', '$$'], ['\\[', '\\]']]
42059
- } : {
42060
- macros: {
42061
- parallelogram: "\\lower.2em{\\Huge\\unicode{x25B1}}",
42062
- overarc: '\\overparen',
42063
- napprox: '\\not\\approx',
42064
- longdiv: '\\enclose{longdiv}'
42065
- },
42066
- displayMath: [['$$', '$$'], ['\\[', '\\]']]
42067
- };
42068
- window.mathjaxLoadedP = new Promise(function (resolve) {
42045
+ var mathRenderingKEY = '@pie-lib/math-rendering@2';
42046
+ mathjaxScript.mathRenderingKEY = mathRenderingKEY;
42047
+ var mathRenderingAccessibleKEY = '@pie-lib/math-rendering-accessible@1';
42048
+ mathjaxScript.mathRenderingAccessibleKEY = mathRenderingAccessibleKEY;
42049
+ var getMathJaxCustomKey = function getMathJaxCustomKey() {
42050
+ var _window, _window$MathJax, _window2, _window2$MathJax, _window2$MathJax$conf;
42051
+ return ((_window = window) === null || _window === void 0 ? void 0 : (_window$MathJax = _window.MathJax) === null || _window$MathJax === void 0 ? void 0 : _window$MathJax.customKey) || ((_window2 = window) === null || _window2 === void 0 ? void 0 : (_window2$MathJax = _window2.MathJax) === null || _window2$MathJax === void 0 ? void 0 : (_window2$MathJax$conf = _window2$MathJax.config) === null || _window2$MathJax$conf === void 0 ? void 0 : _window2$MathJax$conf.customKey);
42052
+ };
42053
+ var mathJaxCustomKey = getMathJaxCustomKey();
42054
+ var defaultOpts = function defaultOpts() {
42055
+ return (0, _renderMath.getGlobal)().opts || ({});
42056
+ };
42057
+ var initializeMathJax = function initializeMathJax(renderOpts, processMathJaxFullPage) {
42058
+ window.MathJaxInitialised = true;
42059
+ renderOpts = renderOpts || defaultOpts();
42060
+ if ((!window.MathJax || window.MathJax.version !== MathJaxVersion) && !window.mathjaxLoadedP || mathJaxCustomKey && mathJaxCustomKey !== mathRenderingAccessibleKEY) {
42061
+ var _renderOpts, _renderOpts2;
42062
+ if ((_renderOpts = renderOpts) !== null && _renderOpts !== void 0 && _renderOpts.useSingleDollar) {
42063
+ console.warn('[math-rendering] using $ is not advisable, please use $$..$$ or \\(...\\)');
42064
+ }
42065
+ var texConfig = (_renderOpts2 = renderOpts) !== null && _renderOpts2 !== void 0 && _renderOpts2.useSingleDollar ? {
42066
+ macros: {
42067
+ parallelogram: "\\lower.2em{\\Huge\\unicode{x25B1}}",
42068
+ overarc: '\\overparen',
42069
+ napprox: '\\not\\approx',
42070
+ longdiv: '\\enclose{longdiv}'
42071
+ },
42072
+ inlineMath: [['$', '$'], ['\\(', '\\)']],
42073
+ processEscapes: true,
42074
+ displayMath: [['$$', '$$'], ['\\[', '\\]']]
42075
+ } : {
42076
+ macros: {
42077
+ parallelogram: "\\lower.2em{\\Huge\\unicode{x25B1}}",
42078
+ overarc: '\\overparen',
42079
+ napprox: '\\not\\approx',
42080
+ longdiv: '\\enclose{longdiv}'
42081
+ },
42082
+ displayMath: [['$$', '$$'], ['\\[', '\\]']]
42083
+ };
42069
42084
  window.MathJax = {
42070
42085
  startup: {
42071
42086
  typeset: false,
@@ -42084,7 +42099,10 @@ var initializeMathJax = function initializeMathJax(renderOpts) {
42084
42099
  MathJax.startup.defaultReady();
42085
42100
  var globalObj = (0, _renderMath.getGlobal)();
42086
42101
  globalObj.instance = MathJax;
42087
- resolve();
42102
+ if (processMathJaxFullPage) {
42103
+ processMathJaxFullPage();
42104
+ }
42105
+ window.MathJaxLoaded = true;
42088
42106
  }
42089
42107
  },
42090
42108
  loader: {
@@ -42115,7 +42133,7 @@ var initializeMathJax = function initializeMathJax(renderOpts) {
42115
42133
  script.src = ("https://cdn.jsdelivr.net/npm/mathjax@").concat(MathJaxVersion, "/es5/tex-chtml-full.js");
42116
42134
  script.async = true;
42117
42135
  document.body.appendChild(script);
42118
- });
42136
+ }
42119
42137
  };
42120
42138
  mathjaxScript.initializeMathJax = initializeMathJax;
42121
42139
  var normalization$1 = {};
@@ -101718,7 +101736,7 @@ getDefaultExportFromCjs(mathRendering);
101718
101736
  Object.defineProperty(exports, "__esModule", {
101719
101737
  value: true
101720
101738
  });
101721
- exports.getGlobal = exports.fixMathElements = exports.fixMathElement = exports["default"] = void 0;
101739
+ exports.initializeMathJaxScript = exports.getGlobal = exports.fixMathElements = exports.fixMathElement = exports["default"] = void 0;
101722
101740
  var _typeof2 = _interopRequireDefault(_typeof$s.exports);
101723
101741
  var _mathjaxScript = mathjaxScript;
101724
101742
  var _normalization = normalization$1;
@@ -101769,22 +101787,17 @@ getDefaultExportFromCjs(mathRendering);
101769
101787
  };
101770
101788
  var NEWLINE_BLOCK_REGEX = /\\embed\{newLine\}\[\]/g;
101771
101789
  var NEWLINE_LATEX = '\\newline ';
101772
- var mathRenderingKEY = '@pie-lib/math-rendering@2';
101773
- var mathRenderingAccessibleKEY = '@pie-lib/math-rendering-accessible@1';
101774
101790
  var getGlobal = function getGlobal() {
101775
101791
  if (typeof window !== 'undefined') {
101776
- if (!window[mathRenderingAccessibleKEY]) {
101777
- window[mathRenderingAccessibleKEY] = {};
101792
+ if (!window[_mathjaxScript.mathRenderingAccessibleKEY]) {
101793
+ window[_mathjaxScript.mathRenderingAccessibleKEY] = {};
101778
101794
  }
101779
- return window[mathRenderingAccessibleKEY];
101795
+ return window[_mathjaxScript.mathRenderingAccessibleKEY];
101780
101796
  } else {
101781
101797
  return {};
101782
101798
  }
101783
101799
  };
101784
101800
  exports.getGlobal = getGlobal;
101785
- var defaultOpts = function defaultOpts() {
101786
- return getGlobal().opts || ({});
101787
- };
101788
101801
  var fixMathElement = function fixMathElement(element) {
101789
101802
  if (element.dataset.mathHandled) {
101790
101803
  return;
@@ -101849,80 +101862,84 @@ getDefaultExportFromCjs(mathRendering);
101849
101862
  }
101850
101863
  });
101851
101864
  };
101852
- var getMathJaxCustomKey = function getMathJaxCustomKey() {
101853
- var _window, _window$MathJax, _window2, _window2$MathJax, _window2$MathJax$conf;
101854
- return ((_window = window) === null || _window === void 0 ? void 0 : (_window$MathJax = _window.MathJax) === null || _window$MathJax === void 0 ? void 0 : _window$MathJax.customKey) || ((_window2 = window) === null || _window2 === void 0 ? void 0 : (_window2$MathJax = _window2.MathJax) === null || _window2$MathJax === void 0 ? void 0 : (_window2$MathJax$conf = _window2$MathJax.config) === null || _window2$MathJax$conf === void 0 ? void 0 : _window2$MathJax$conf.customKey);
101865
+ var processMathJaxFullPage = function processMathJaxFullPage(executeOn) {
101866
+ executeOn = executeOn || document.body;
101867
+ var mathJaxInstance = getGlobal().instance;
101868
+ if (mathJaxInstance) {
101869
+ mathJaxInstance.texReset();
101870
+ mathJaxInstance.typesetClear();
101871
+ mathJaxInstance.typesetPromise([executeOn]).then(function () {
101872
+ try {
101873
+ removeExcessMjxContainers(executeOn);
101874
+ removePlaceholdersAndRestoreDisplay();
101875
+ var updatedDocument = mathJaxInstance.startup.document;
101876
+ var list = updatedDocument.math.list;
101877
+ for (var item = list.next; (0, _typeof2["default"])(item.data) !== 'symbol'; item = item.next) {
101878
+ var mathMl = toMMl(item.data.root);
101879
+ var parsedMathMl = mathMl.replaceAll('\n', '');
101880
+ item.data.typesetRoot.setAttribute('data-mathml', parsedMathMl);
101881
+ }
101882
+ } catch (e) {
101883
+ console.error('Error post-processing MathJax typesetting:', e.toString());
101884
+ }
101885
+ mathJaxInstance.startup.document.clear();
101886
+ })["catch"](function (error) {
101887
+ console.error('Error in typesetting with MathJax:', error);
101888
+ });
101889
+ }
101890
+ };
101891
+ var initializeMathJaxScript = function initializeMathJaxScript(renderOpts) {
101892
+ if (!window.MathJaxInitialised) {
101893
+ (0, _mathjaxScript.initializeMathJax)(renderOpts, processMathJaxFullPage);
101894
+ }
101855
101895
  };
101896
+ exports.initializeMathJaxScript = initializeMathJaxScript;
101856
101897
  var renderMath = function renderMath(el, renderOpts) {
101857
101898
  var isString = typeof el === 'string';
101899
+ var _ref = renderOpts || ({}), skipWaitForMathRenderingLib = _ref.skipWaitForMathRenderingLib;
101858
101900
  var executeOn = document.body;
101859
101901
  if (isString) {
101860
101902
  var div = document.createElement('div');
101861
101903
  div.innerHTML = el;
101862
101904
  executeOn = div;
101863
101905
  }
101864
- var _ref = renderOpts || ({}), skipWaitForMathRenderingLib = _ref.skipWaitForMathRenderingLib;
101865
101906
  var renderMathAccessible = function renderMathAccessible() {
101866
101907
  fixMathElements(executeOn);
101867
101908
  adjustMathMLStyle(executeOn);
101868
- var mathJaxCustomKey = getMathJaxCustomKey();
101869
- if ((!window.MathJax || window.MathJax.version !== _mathjaxScript.MathJaxVersion) && !window.mathjaxLoadedP || mathJaxCustomKey && mathJaxCustomKey !== mathRenderingAccessibleKEY) {
101870
- renderOpts = renderOpts || defaultOpts();
101871
- (0, _mathjaxScript.initializeMathJax)(renderOpts);
101872
- }
101873
- if (isString && window.MathJax && window.mathjaxLoadedP) {
101874
- try {
101875
- MathJax.texReset();
101876
- MathJax.typesetClear();
101877
- window.MathJax.typeset([executeOn]);
101878
- var updatedDocument = window.MathJax.startup.document;
101879
- var list = updatedDocument.math.list;
101880
- var item = list.next;
101881
- var mathMl = toMMl(item.data.root);
101882
- var parsedMathMl = mathMl.replaceAll('\n', '');
101883
- return parsedMathMl;
101884
- } catch (error) {
101885
- console.error('Error rendering math:', error.message);
101886
- }
101909
+ if (!window.MathJaxInitialised) {
101910
+ (0, _mathjaxScript.initializeMathJax)(renderOpts, function () {
101911
+ return processMathJaxFullPage(executeOn);
101912
+ });
101913
+ return;
101887
101914
  }
101888
- if (window.mathjaxLoadedP) {
101889
- window.mathjaxLoadedP.then(function () {
101890
- var mathJaxInstance = getGlobal().instance;
101891
- if (mathJaxInstance) {
101892
- mathJaxInstance.texReset();
101893
- mathJaxInstance.typesetClear();
101894
- mathJaxInstance.typesetPromise([executeOn]).then(function () {
101895
- try {
101896
- removeExcessMjxContainers(executeOn);
101897
- removePlaceholdersAndRestoreDisplay();
101898
- var _updatedDocument = mathJaxInstance.startup.document;
101899
- var _list = _updatedDocument.math.list;
101900
- for (var _item = _list.next; (0, _typeof2["default"])(_item.data) !== 'symbol'; _item = _item.next) {
101901
- var _mathMl = toMMl(_item.data.root);
101902
- var _parsedMathMl = _mathMl.replaceAll('\n', '');
101903
- _item.data.typesetRoot.setAttribute('data-mathml', _parsedMathMl);
101904
- }
101905
- } catch (e) {
101906
- console.error('Error post-processing MathJax typesetting:', e.toString());
101907
- }
101908
- mathJaxInstance.startup.document.clear();
101909
- })["catch"](function (error) {
101910
- console.error('Error in typesetting with MathJax:', error);
101911
- });
101915
+ if (window.MathJaxLoaded) {
101916
+ if (isString) {
101917
+ try {
101918
+ MathJax.texReset();
101919
+ MathJax.typesetClear();
101920
+ window.MathJax.typeset([executeOn]);
101921
+ var updatedDocument = window.MathJax.startup.document;
101922
+ var list = updatedDocument.math.list;
101923
+ var item = list.next;
101924
+ var mathMl = toMMl(item.data.root);
101925
+ var parsedMathMl = mathMl.replaceAll('\n', '');
101926
+ return parsedMathMl;
101927
+ } catch (error) {
101928
+ console.error('Error rendering math:', error.message);
101929
+ return '';
101912
101930
  }
101913
- })["catch"](function (error) {
101914
- console.error('Error in initializing MathJax:', error);
101915
- });
101931
+ }
101932
+ processMathJaxFullPage(executeOn);
101916
101933
  }
101917
101934
  };
101918
101935
  if (skipWaitForMathRenderingLib) {
101919
101936
  return renderMathAccessible();
101920
101937
  } else {
101921
- if (window.hasOwnProperty(mathRenderingKEY) && window[mathRenderingKEY].instance) {
101938
+ if (window.hasOwnProperty(_mathjaxScript.mathRenderingKEY) && window[_mathjaxScript.mathRenderingKEY].instance) {
101922
101939
  removePlaceholdersAndRestoreDisplay();
101923
101940
  return mr.renderMath(executeOn, renderOpts);
101924
101941
  }
101925
- if (window.hasOwnProperty(mathRenderingAccessibleKEY) && window[mathRenderingAccessibleKEY].instance) {
101942
+ if (window.hasOwnProperty(_mathjaxScript.mathRenderingAccessibleKEY) && window[_mathjaxScript.mathRenderingAccessibleKEY].instance) {
101926
101943
  return renderMathAccessible();
101927
101944
  }
101928
101945
  var waitForMathRenderingLib = function waitForMathRenderingLib(renderMathAccessibleCallback) {
@@ -101932,7 +101949,7 @@ getDefaultExportFromCjs(mathRendering);
101932
101949
  var maxWaitTime = 500;
101933
101950
  var startTime = Date.now();
101934
101951
  var checkForLib = function checkForLib() {
101935
- var mathRenderingHasLoaded = window.hasOwnProperty(mathRenderingKEY) && window[mathRenderingKEY].instance;
101952
+ var mathRenderingHasLoaded = window.hasOwnProperty(_mathjaxScript.mathRenderingKEY) && window[_mathjaxScript.mathRenderingKEY].instance;
101936
101953
  var hasExceededMaxWait = Date.now() - startTime > maxWaitTime;
101937
101954
  if (mathRenderingHasLoaded || hasExceededMaxWait) {
101938
101955
  clearInterval(checkIntervalId);
@@ -101967,9 +101984,16 @@ var mmlToLatex = {};
101967
101984
  getDefaultExportFromCjs(mmlToLatex);
101968
101985
  (function (exports) {
101969
101986
  var _interopRequireDefault = interopRequireDefault.exports;
101987
+ var _typeof = _typeof$s.exports;
101970
101988
  Object.defineProperty(exports, "__esModule", {
101971
101989
  value: true
101972
101990
  });
101991
+ Object.defineProperty(exports, "initializeMathJaxScript", {
101992
+ enumerable: true,
101993
+ get: function get() {
101994
+ return _renderMath.initializeMathJaxScript;
101995
+ }
101996
+ });
101973
101997
  Object.defineProperty(exports, "mmlToLatex", {
101974
101998
  enumerable: true,
101975
101999
  get: function get() {
@@ -101994,9 +102018,48 @@ getDefaultExportFromCjs(mmlToLatex);
101994
102018
  return _normalization.wrapMath;
101995
102019
  }
101996
102020
  });
101997
- var _renderMath = _interopRequireDefault(renderMath$1);
102021
+ var _renderMath = _interopRequireWildcard(renderMath$1);
101998
102022
  var _mmlToLatex = _interopRequireDefault(mmlToLatex);
101999
102023
  var _normalization = normalization$1;
102024
+ function _getRequireWildcardCache(nodeInterop) {
102025
+ if (typeof WeakMap !== "function") return null;
102026
+ var cacheBabelInterop = new WeakMap();
102027
+ var cacheNodeInterop = new WeakMap();
102028
+ return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) {
102029
+ return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
102030
+ })(nodeInterop);
102031
+ }
102032
+ function _interopRequireWildcard(obj, nodeInterop) {
102033
+ if (!nodeInterop && obj && obj.__esModule) {
102034
+ return obj;
102035
+ }
102036
+ if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") {
102037
+ return {
102038
+ "default": obj
102039
+ };
102040
+ }
102041
+ var cache = _getRequireWildcardCache(nodeInterop);
102042
+ if (cache && cache.has(obj)) {
102043
+ return cache.get(obj);
102044
+ }
102045
+ var newObj = {};
102046
+ var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
102047
+ for (var key in obj) {
102048
+ if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
102049
+ var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
102050
+ if (desc && (desc.get || desc.set)) {
102051
+ Object.defineProperty(newObj, key, desc);
102052
+ } else {
102053
+ newObj[key] = obj[key];
102054
+ }
102055
+ }
102056
+ }
102057
+ newObj["default"] = obj;
102058
+ if (cache) {
102059
+ cache.set(obj, newObj);
102060
+ }
102061
+ return newObj;
102062
+ }
102000
102063
  })(mathRenderingAccessible);
102001
102064
  getDefaultExportFromCjs(mathRenderingAccessible);
102002
102065
  const require$$8$y = _dll_react;
package/module/element.js CHANGED
@@ -1,4 +1,4 @@
1
- import {_dll_react, _dll_prop_types, _dll_react_dom, _dll_classnames, _dll_debug, _dll_lodash, _dll_react_dom_server, _dll_pie_framework__mathquill} from "../../../@pie-lib/pie-toolbox-math-rendering-module@1.23.1/module/index.js";
1
+ import {_dll_react, _dll_prop_types, _dll_react_dom, _dll_classnames, _dll_debug, _dll_lodash, _dll_react_dom_server, _dll_pie_framework__mathquill} from "../../../@pie-lib/pie-toolbox-math-rendering-module@1.23.2/module/index.js";
2
2
  import {_dll_pie_lib__pie_toolbox_render_ui} from "../../../@pie-lib/pie-toolbox-module@4.24.3/module/index.js";
3
3
  function _mergeNamespaces(n, m) {
4
4
  m.forEach(function (e) {
@@ -65364,34 +65364,49 @@ var mathjaxScript = {};
65364
65364
  Object.defineProperty(mathjaxScript, "__esModule", {
65365
65365
  value: true
65366
65366
  });
65367
- mathjaxScript.initializeMathJax = mathjaxScript.MathJaxVersion = void 0;
65367
+ mathjaxScript.mathRenderingKEY = mathjaxScript.mathRenderingAccessibleKEY = mathjaxScript.initializeMathJax = mathjaxScript.MathJaxVersion = void 0;
65368
65368
  var _renderMath = renderMath$1;
65369
65369
  var MathJaxVersion = '3.2.2';
65370
65370
  mathjaxScript.MathJaxVersion = MathJaxVersion;
65371
- var initializeMathJax = function initializeMathJax(renderOpts) {
65372
- if (renderOpts !== null && renderOpts !== void 0 && renderOpts.useSingleDollar) {
65373
- console.warn('[math-rendering] using $ is not advisable, please use $$..$$ or \\(...\\)');
65374
- }
65375
- var texConfig = renderOpts !== null && renderOpts !== void 0 && renderOpts.useSingleDollar ? {
65376
- macros: {
65377
- parallelogram: "\\lower.2em{\\Huge\\unicode{x25B1}}",
65378
- overarc: '\\overparen',
65379
- napprox: '\\not\\approx',
65380
- longdiv: '\\enclose{longdiv}'
65381
- },
65382
- inlineMath: [['$', '$'], ['\\(', '\\)']],
65383
- processEscapes: true,
65384
- displayMath: [['$$', '$$'], ['\\[', '\\]']]
65385
- } : {
65386
- macros: {
65387
- parallelogram: "\\lower.2em{\\Huge\\unicode{x25B1}}",
65388
- overarc: '\\overparen',
65389
- napprox: '\\not\\approx',
65390
- longdiv: '\\enclose{longdiv}'
65391
- },
65392
- displayMath: [['$$', '$$'], ['\\[', '\\]']]
65393
- };
65394
- window.mathjaxLoadedP = new Promise(function (resolve) {
65371
+ var mathRenderingKEY = '@pie-lib/math-rendering@2';
65372
+ mathjaxScript.mathRenderingKEY = mathRenderingKEY;
65373
+ var mathRenderingAccessibleKEY = '@pie-lib/math-rendering-accessible@1';
65374
+ mathjaxScript.mathRenderingAccessibleKEY = mathRenderingAccessibleKEY;
65375
+ var getMathJaxCustomKey = function getMathJaxCustomKey() {
65376
+ var _window, _window$MathJax, _window2, _window2$MathJax, _window2$MathJax$conf;
65377
+ return ((_window = window) === null || _window === void 0 ? void 0 : (_window$MathJax = _window.MathJax) === null || _window$MathJax === void 0 ? void 0 : _window$MathJax.customKey) || ((_window2 = window) === null || _window2 === void 0 ? void 0 : (_window2$MathJax = _window2.MathJax) === null || _window2$MathJax === void 0 ? void 0 : (_window2$MathJax$conf = _window2$MathJax.config) === null || _window2$MathJax$conf === void 0 ? void 0 : _window2$MathJax$conf.customKey);
65378
+ };
65379
+ var mathJaxCustomKey = getMathJaxCustomKey();
65380
+ var defaultOpts = function defaultOpts() {
65381
+ return (0, _renderMath.getGlobal)().opts || ({});
65382
+ };
65383
+ var initializeMathJax = function initializeMathJax(renderOpts, processMathJaxFullPage) {
65384
+ window.MathJaxInitialised = true;
65385
+ renderOpts = renderOpts || defaultOpts();
65386
+ if ((!window.MathJax || window.MathJax.version !== MathJaxVersion) && !window.mathjaxLoadedP || mathJaxCustomKey && mathJaxCustomKey !== mathRenderingAccessibleKEY) {
65387
+ var _renderOpts, _renderOpts2;
65388
+ if ((_renderOpts = renderOpts) !== null && _renderOpts !== void 0 && _renderOpts.useSingleDollar) {
65389
+ console.warn('[math-rendering] using $ is not advisable, please use $$..$$ or \\(...\\)');
65390
+ }
65391
+ var texConfig = (_renderOpts2 = renderOpts) !== null && _renderOpts2 !== void 0 && _renderOpts2.useSingleDollar ? {
65392
+ macros: {
65393
+ parallelogram: "\\lower.2em{\\Huge\\unicode{x25B1}}",
65394
+ overarc: '\\overparen',
65395
+ napprox: '\\not\\approx',
65396
+ longdiv: '\\enclose{longdiv}'
65397
+ },
65398
+ inlineMath: [['$', '$'], ['\\(', '\\)']],
65399
+ processEscapes: true,
65400
+ displayMath: [['$$', '$$'], ['\\[', '\\]']]
65401
+ } : {
65402
+ macros: {
65403
+ parallelogram: "\\lower.2em{\\Huge\\unicode{x25B1}}",
65404
+ overarc: '\\overparen',
65405
+ napprox: '\\not\\approx',
65406
+ longdiv: '\\enclose{longdiv}'
65407
+ },
65408
+ displayMath: [['$$', '$$'], ['\\[', '\\]']]
65409
+ };
65395
65410
  window.MathJax = {
65396
65411
  startup: {
65397
65412
  typeset: false,
@@ -65410,7 +65425,10 @@ var initializeMathJax = function initializeMathJax(renderOpts) {
65410
65425
  MathJax.startup.defaultReady();
65411
65426
  var globalObj = (0, _renderMath.getGlobal)();
65412
65427
  globalObj.instance = MathJax;
65413
- resolve();
65428
+ if (processMathJaxFullPage) {
65429
+ processMathJaxFullPage();
65430
+ }
65431
+ window.MathJaxLoaded = true;
65414
65432
  }
65415
65433
  },
65416
65434
  loader: {
@@ -65441,7 +65459,7 @@ var initializeMathJax = function initializeMathJax(renderOpts) {
65441
65459
  script.src = ("https://cdn.jsdelivr.net/npm/mathjax@").concat(MathJaxVersion, "/es5/tex-chtml-full.js");
65442
65460
  script.async = true;
65443
65461
  document.body.appendChild(script);
65444
- });
65462
+ }
65445
65463
  };
65446
65464
  mathjaxScript.initializeMathJax = initializeMathJax;
65447
65465
  var normalization$1 = {};
@@ -124979,7 +124997,7 @@ getDefaultExportFromCjs(mathRendering);
124979
124997
  Object.defineProperty(exports, "__esModule", {
124980
124998
  value: true
124981
124999
  });
124982
- exports.getGlobal = exports.fixMathElements = exports.fixMathElement = exports["default"] = void 0;
125000
+ exports.initializeMathJaxScript = exports.getGlobal = exports.fixMathElements = exports.fixMathElement = exports["default"] = void 0;
124983
125001
  var _typeof2 = _interopRequireDefault(_typeof$s.exports);
124984
125002
  var _mathjaxScript = mathjaxScript;
124985
125003
  var _normalization = normalization$1;
@@ -125030,22 +125048,17 @@ getDefaultExportFromCjs(mathRendering);
125030
125048
  };
125031
125049
  var NEWLINE_BLOCK_REGEX = /\\embed\{newLine\}\[\]/g;
125032
125050
  var NEWLINE_LATEX = '\\newline ';
125033
- var mathRenderingKEY = '@pie-lib/math-rendering@2';
125034
- var mathRenderingAccessibleKEY = '@pie-lib/math-rendering-accessible@1';
125035
125051
  var getGlobal = function getGlobal() {
125036
125052
  if (typeof window !== 'undefined') {
125037
- if (!window[mathRenderingAccessibleKEY]) {
125038
- window[mathRenderingAccessibleKEY] = {};
125053
+ if (!window[_mathjaxScript.mathRenderingAccessibleKEY]) {
125054
+ window[_mathjaxScript.mathRenderingAccessibleKEY] = {};
125039
125055
  }
125040
- return window[mathRenderingAccessibleKEY];
125056
+ return window[_mathjaxScript.mathRenderingAccessibleKEY];
125041
125057
  } else {
125042
125058
  return {};
125043
125059
  }
125044
125060
  };
125045
125061
  exports.getGlobal = getGlobal;
125046
- var defaultOpts = function defaultOpts() {
125047
- return getGlobal().opts || ({});
125048
- };
125049
125062
  var fixMathElement = function fixMathElement(element) {
125050
125063
  if (element.dataset.mathHandled) {
125051
125064
  return;
@@ -125110,80 +125123,84 @@ getDefaultExportFromCjs(mathRendering);
125110
125123
  }
125111
125124
  });
125112
125125
  };
125113
- var getMathJaxCustomKey = function getMathJaxCustomKey() {
125114
- var _window, _window$MathJax, _window2, _window2$MathJax, _window2$MathJax$conf;
125115
- return ((_window = window) === null || _window === void 0 ? void 0 : (_window$MathJax = _window.MathJax) === null || _window$MathJax === void 0 ? void 0 : _window$MathJax.customKey) || ((_window2 = window) === null || _window2 === void 0 ? void 0 : (_window2$MathJax = _window2.MathJax) === null || _window2$MathJax === void 0 ? void 0 : (_window2$MathJax$conf = _window2$MathJax.config) === null || _window2$MathJax$conf === void 0 ? void 0 : _window2$MathJax$conf.customKey);
125126
+ var processMathJaxFullPage = function processMathJaxFullPage(executeOn) {
125127
+ executeOn = executeOn || document.body;
125128
+ var mathJaxInstance = getGlobal().instance;
125129
+ if (mathJaxInstance) {
125130
+ mathJaxInstance.texReset();
125131
+ mathJaxInstance.typesetClear();
125132
+ mathJaxInstance.typesetPromise([executeOn]).then(function () {
125133
+ try {
125134
+ removeExcessMjxContainers(executeOn);
125135
+ removePlaceholdersAndRestoreDisplay();
125136
+ var updatedDocument = mathJaxInstance.startup.document;
125137
+ var list = updatedDocument.math.list;
125138
+ for (var item = list.next; (0, _typeof2["default"])(item.data) !== 'symbol'; item = item.next) {
125139
+ var mathMl = toMMl(item.data.root);
125140
+ var parsedMathMl = mathMl.replaceAll('\n', '');
125141
+ item.data.typesetRoot.setAttribute('data-mathml', parsedMathMl);
125142
+ }
125143
+ } catch (e) {
125144
+ console.error('Error post-processing MathJax typesetting:', e.toString());
125145
+ }
125146
+ mathJaxInstance.startup.document.clear();
125147
+ })["catch"](function (error) {
125148
+ console.error('Error in typesetting with MathJax:', error);
125149
+ });
125150
+ }
125151
+ };
125152
+ var initializeMathJaxScript = function initializeMathJaxScript(renderOpts) {
125153
+ if (!window.MathJaxInitialised) {
125154
+ (0, _mathjaxScript.initializeMathJax)(renderOpts, processMathJaxFullPage);
125155
+ }
125116
125156
  };
125157
+ exports.initializeMathJaxScript = initializeMathJaxScript;
125117
125158
  var renderMath = function renderMath(el, renderOpts) {
125118
125159
  var isString = typeof el === 'string';
125160
+ var _ref = renderOpts || ({}), skipWaitForMathRenderingLib = _ref.skipWaitForMathRenderingLib;
125119
125161
  var executeOn = document.body;
125120
125162
  if (isString) {
125121
125163
  var div = document.createElement('div');
125122
125164
  div.innerHTML = el;
125123
125165
  executeOn = div;
125124
125166
  }
125125
- var _ref = renderOpts || ({}), skipWaitForMathRenderingLib = _ref.skipWaitForMathRenderingLib;
125126
125167
  var renderMathAccessible = function renderMathAccessible() {
125127
125168
  fixMathElements(executeOn);
125128
125169
  adjustMathMLStyle(executeOn);
125129
- var mathJaxCustomKey = getMathJaxCustomKey();
125130
- if ((!window.MathJax || window.MathJax.version !== _mathjaxScript.MathJaxVersion) && !window.mathjaxLoadedP || mathJaxCustomKey && mathJaxCustomKey !== mathRenderingAccessibleKEY) {
125131
- renderOpts = renderOpts || defaultOpts();
125132
- (0, _mathjaxScript.initializeMathJax)(renderOpts);
125133
- }
125134
- if (isString && window.MathJax && window.mathjaxLoadedP) {
125135
- try {
125136
- MathJax.texReset();
125137
- MathJax.typesetClear();
125138
- window.MathJax.typeset([executeOn]);
125139
- var updatedDocument = window.MathJax.startup.document;
125140
- var list = updatedDocument.math.list;
125141
- var item = list.next;
125142
- var mathMl = toMMl(item.data.root);
125143
- var parsedMathMl = mathMl.replaceAll('\n', '');
125144
- return parsedMathMl;
125145
- } catch (error) {
125146
- console.error('Error rendering math:', error.message);
125147
- }
125170
+ if (!window.MathJaxInitialised) {
125171
+ (0, _mathjaxScript.initializeMathJax)(renderOpts, function () {
125172
+ return processMathJaxFullPage(executeOn);
125173
+ });
125174
+ return;
125148
125175
  }
125149
- if (window.mathjaxLoadedP) {
125150
- window.mathjaxLoadedP.then(function () {
125151
- var mathJaxInstance = getGlobal().instance;
125152
- if (mathJaxInstance) {
125153
- mathJaxInstance.texReset();
125154
- mathJaxInstance.typesetClear();
125155
- mathJaxInstance.typesetPromise([executeOn]).then(function () {
125156
- try {
125157
- removeExcessMjxContainers(executeOn);
125158
- removePlaceholdersAndRestoreDisplay();
125159
- var _updatedDocument = mathJaxInstance.startup.document;
125160
- var _list = _updatedDocument.math.list;
125161
- for (var _item = _list.next; (0, _typeof2["default"])(_item.data) !== 'symbol'; _item = _item.next) {
125162
- var _mathMl = toMMl(_item.data.root);
125163
- var _parsedMathMl = _mathMl.replaceAll('\n', '');
125164
- _item.data.typesetRoot.setAttribute('data-mathml', _parsedMathMl);
125165
- }
125166
- } catch (e) {
125167
- console.error('Error post-processing MathJax typesetting:', e.toString());
125168
- }
125169
- mathJaxInstance.startup.document.clear();
125170
- })["catch"](function (error) {
125171
- console.error('Error in typesetting with MathJax:', error);
125172
- });
125176
+ if (window.MathJaxLoaded) {
125177
+ if (isString) {
125178
+ try {
125179
+ MathJax.texReset();
125180
+ MathJax.typesetClear();
125181
+ window.MathJax.typeset([executeOn]);
125182
+ var updatedDocument = window.MathJax.startup.document;
125183
+ var list = updatedDocument.math.list;
125184
+ var item = list.next;
125185
+ var mathMl = toMMl(item.data.root);
125186
+ var parsedMathMl = mathMl.replaceAll('\n', '');
125187
+ return parsedMathMl;
125188
+ } catch (error) {
125189
+ console.error('Error rendering math:', error.message);
125190
+ return '';
125173
125191
  }
125174
- })["catch"](function (error) {
125175
- console.error('Error in initializing MathJax:', error);
125176
- });
125192
+ }
125193
+ processMathJaxFullPage(executeOn);
125177
125194
  }
125178
125195
  };
125179
125196
  if (skipWaitForMathRenderingLib) {
125180
125197
  return renderMathAccessible();
125181
125198
  } else {
125182
- if (window.hasOwnProperty(mathRenderingKEY) && window[mathRenderingKEY].instance) {
125199
+ if (window.hasOwnProperty(_mathjaxScript.mathRenderingKEY) && window[_mathjaxScript.mathRenderingKEY].instance) {
125183
125200
  removePlaceholdersAndRestoreDisplay();
125184
125201
  return mr.renderMath(executeOn, renderOpts);
125185
125202
  }
125186
- if (window.hasOwnProperty(mathRenderingAccessibleKEY) && window[mathRenderingAccessibleKEY].instance) {
125203
+ if (window.hasOwnProperty(_mathjaxScript.mathRenderingAccessibleKEY) && window[_mathjaxScript.mathRenderingAccessibleKEY].instance) {
125187
125204
  return renderMathAccessible();
125188
125205
  }
125189
125206
  var waitForMathRenderingLib = function waitForMathRenderingLib(renderMathAccessibleCallback) {
@@ -125193,7 +125210,7 @@ getDefaultExportFromCjs(mathRendering);
125193
125210
  var maxWaitTime = 500;
125194
125211
  var startTime = Date.now();
125195
125212
  var checkForLib = function checkForLib() {
125196
- var mathRenderingHasLoaded = window.hasOwnProperty(mathRenderingKEY) && window[mathRenderingKEY].instance;
125213
+ var mathRenderingHasLoaded = window.hasOwnProperty(_mathjaxScript.mathRenderingKEY) && window[_mathjaxScript.mathRenderingKEY].instance;
125197
125214
  var hasExceededMaxWait = Date.now() - startTime > maxWaitTime;
125198
125215
  if (mathRenderingHasLoaded || hasExceededMaxWait) {
125199
125216
  clearInterval(checkIntervalId);
@@ -125228,9 +125245,16 @@ var mmlToLatex = {};
125228
125245
  getDefaultExportFromCjs(mmlToLatex);
125229
125246
  (function (exports) {
125230
125247
  var _interopRequireDefault = interopRequireDefault.exports;
125248
+ var _typeof = _typeof$s.exports;
125231
125249
  Object.defineProperty(exports, "__esModule", {
125232
125250
  value: true
125233
125251
  });
125252
+ Object.defineProperty(exports, "initializeMathJaxScript", {
125253
+ enumerable: true,
125254
+ get: function get() {
125255
+ return _renderMath.initializeMathJaxScript;
125256
+ }
125257
+ });
125234
125258
  Object.defineProperty(exports, "mmlToLatex", {
125235
125259
  enumerable: true,
125236
125260
  get: function get() {
@@ -125255,9 +125279,48 @@ getDefaultExportFromCjs(mmlToLatex);
125255
125279
  return _normalization.wrapMath;
125256
125280
  }
125257
125281
  });
125258
- var _renderMath = _interopRequireDefault(renderMath$1);
125282
+ var _renderMath = _interopRequireWildcard(renderMath$1);
125259
125283
  var _mmlToLatex = _interopRequireDefault(mmlToLatex);
125260
125284
  var _normalization = normalization$1;
125285
+ function _getRequireWildcardCache(nodeInterop) {
125286
+ if (typeof WeakMap !== "function") return null;
125287
+ var cacheBabelInterop = new WeakMap();
125288
+ var cacheNodeInterop = new WeakMap();
125289
+ return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) {
125290
+ return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
125291
+ })(nodeInterop);
125292
+ }
125293
+ function _interopRequireWildcard(obj, nodeInterop) {
125294
+ if (!nodeInterop && obj && obj.__esModule) {
125295
+ return obj;
125296
+ }
125297
+ if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") {
125298
+ return {
125299
+ "default": obj
125300
+ };
125301
+ }
125302
+ var cache = _getRequireWildcardCache(nodeInterop);
125303
+ if (cache && cache.has(obj)) {
125304
+ return cache.get(obj);
125305
+ }
125306
+ var newObj = {};
125307
+ var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
125308
+ for (var key in obj) {
125309
+ if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
125310
+ var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
125311
+ if (desc && (desc.get || desc.set)) {
125312
+ Object.defineProperty(newObj, key, desc);
125313
+ } else {
125314
+ newObj[key] = obj[key];
125315
+ }
125316
+ }
125317
+ }
125318
+ newObj["default"] = obj;
125319
+ if (cache) {
125320
+ cache.set(obj, newObj);
125321
+ }
125322
+ return newObj;
125323
+ }
125261
125324
  })(mathRenderingAccessible);
125262
125325
  getDefaultExportFromCjs(mathRenderingAccessible);
125263
125326
  const require$$8$l = _dll_react;
@@ -4,7 +4,7 @@
4
4
  "modules": [
5
5
  {
6
6
  "name": "@pie-lib/pie-toolbox-math-rendering-module",
7
- "version": "1.23.1"
7
+ "version": "1.23.2"
8
8
  },
9
9
  {
10
10
  "name": "@pie-lib/pie-toolbox-module",
package/module/print.js CHANGED
@@ -1,4 +1,4 @@
1
- import {_dll_react, _dll_prop_types, _dll_react_dom, _dll_classnames, _dll_debug, _dll_lodash, _dll_react_dom_server, _dll_pie_framework__mathquill} from "../../../@pie-lib/pie-toolbox-math-rendering-module@1.23.1/module/index.js";
1
+ import {_dll_react, _dll_prop_types, _dll_react_dom, _dll_classnames, _dll_debug, _dll_lodash, _dll_react_dom_server, _dll_pie_framework__mathquill} from "../../../@pie-lib/pie-toolbox-math-rendering-module@1.23.2/module/index.js";
2
2
  import {_dll_pie_lib__pie_toolbox_render_ui} from "../../../@pie-lib/pie-toolbox-module@4.24.3/module/index.js";
3
3
  function _mergeNamespaces(n, m) {
4
4
  m.forEach(function (e) {
@@ -65364,34 +65364,49 @@ var mathjaxScript = {};
65364
65364
  Object.defineProperty(mathjaxScript, "__esModule", {
65365
65365
  value: true
65366
65366
  });
65367
- mathjaxScript.initializeMathJax = mathjaxScript.MathJaxVersion = void 0;
65367
+ mathjaxScript.mathRenderingKEY = mathjaxScript.mathRenderingAccessibleKEY = mathjaxScript.initializeMathJax = mathjaxScript.MathJaxVersion = void 0;
65368
65368
  var _renderMath = renderMath$1;
65369
65369
  var MathJaxVersion = '3.2.2';
65370
65370
  mathjaxScript.MathJaxVersion = MathJaxVersion;
65371
- var initializeMathJax = function initializeMathJax(renderOpts) {
65372
- if (renderOpts !== null && renderOpts !== void 0 && renderOpts.useSingleDollar) {
65373
- console.warn('[math-rendering] using $ is not advisable, please use $$..$$ or \\(...\\)');
65374
- }
65375
- var texConfig = renderOpts !== null && renderOpts !== void 0 && renderOpts.useSingleDollar ? {
65376
- macros: {
65377
- parallelogram: "\\lower.2em{\\Huge\\unicode{x25B1}}",
65378
- overarc: '\\overparen',
65379
- napprox: '\\not\\approx',
65380
- longdiv: '\\enclose{longdiv}'
65381
- },
65382
- inlineMath: [['$', '$'], ['\\(', '\\)']],
65383
- processEscapes: true,
65384
- displayMath: [['$$', '$$'], ['\\[', '\\]']]
65385
- } : {
65386
- macros: {
65387
- parallelogram: "\\lower.2em{\\Huge\\unicode{x25B1}}",
65388
- overarc: '\\overparen',
65389
- napprox: '\\not\\approx',
65390
- longdiv: '\\enclose{longdiv}'
65391
- },
65392
- displayMath: [['$$', '$$'], ['\\[', '\\]']]
65393
- };
65394
- window.mathjaxLoadedP = new Promise(function (resolve) {
65371
+ var mathRenderingKEY = '@pie-lib/math-rendering@2';
65372
+ mathjaxScript.mathRenderingKEY = mathRenderingKEY;
65373
+ var mathRenderingAccessibleKEY = '@pie-lib/math-rendering-accessible@1';
65374
+ mathjaxScript.mathRenderingAccessibleKEY = mathRenderingAccessibleKEY;
65375
+ var getMathJaxCustomKey = function getMathJaxCustomKey() {
65376
+ var _window, _window$MathJax, _window2, _window2$MathJax, _window2$MathJax$conf;
65377
+ return ((_window = window) === null || _window === void 0 ? void 0 : (_window$MathJax = _window.MathJax) === null || _window$MathJax === void 0 ? void 0 : _window$MathJax.customKey) || ((_window2 = window) === null || _window2 === void 0 ? void 0 : (_window2$MathJax = _window2.MathJax) === null || _window2$MathJax === void 0 ? void 0 : (_window2$MathJax$conf = _window2$MathJax.config) === null || _window2$MathJax$conf === void 0 ? void 0 : _window2$MathJax$conf.customKey);
65378
+ };
65379
+ var mathJaxCustomKey = getMathJaxCustomKey();
65380
+ var defaultOpts = function defaultOpts() {
65381
+ return (0, _renderMath.getGlobal)().opts || ({});
65382
+ };
65383
+ var initializeMathJax = function initializeMathJax(renderOpts, processMathJaxFullPage) {
65384
+ window.MathJaxInitialised = true;
65385
+ renderOpts = renderOpts || defaultOpts();
65386
+ if ((!window.MathJax || window.MathJax.version !== MathJaxVersion) && !window.mathjaxLoadedP || mathJaxCustomKey && mathJaxCustomKey !== mathRenderingAccessibleKEY) {
65387
+ var _renderOpts, _renderOpts2;
65388
+ if ((_renderOpts = renderOpts) !== null && _renderOpts !== void 0 && _renderOpts.useSingleDollar) {
65389
+ console.warn('[math-rendering] using $ is not advisable, please use $$..$$ or \\(...\\)');
65390
+ }
65391
+ var texConfig = (_renderOpts2 = renderOpts) !== null && _renderOpts2 !== void 0 && _renderOpts2.useSingleDollar ? {
65392
+ macros: {
65393
+ parallelogram: "\\lower.2em{\\Huge\\unicode{x25B1}}",
65394
+ overarc: '\\overparen',
65395
+ napprox: '\\not\\approx',
65396
+ longdiv: '\\enclose{longdiv}'
65397
+ },
65398
+ inlineMath: [['$', '$'], ['\\(', '\\)']],
65399
+ processEscapes: true,
65400
+ displayMath: [['$$', '$$'], ['\\[', '\\]']]
65401
+ } : {
65402
+ macros: {
65403
+ parallelogram: "\\lower.2em{\\Huge\\unicode{x25B1}}",
65404
+ overarc: '\\overparen',
65405
+ napprox: '\\not\\approx',
65406
+ longdiv: '\\enclose{longdiv}'
65407
+ },
65408
+ displayMath: [['$$', '$$'], ['\\[', '\\]']]
65409
+ };
65395
65410
  window.MathJax = {
65396
65411
  startup: {
65397
65412
  typeset: false,
@@ -65410,7 +65425,10 @@ var initializeMathJax = function initializeMathJax(renderOpts) {
65410
65425
  MathJax.startup.defaultReady();
65411
65426
  var globalObj = (0, _renderMath.getGlobal)();
65412
65427
  globalObj.instance = MathJax;
65413
- resolve();
65428
+ if (processMathJaxFullPage) {
65429
+ processMathJaxFullPage();
65430
+ }
65431
+ window.MathJaxLoaded = true;
65414
65432
  }
65415
65433
  },
65416
65434
  loader: {
@@ -65441,7 +65459,7 @@ var initializeMathJax = function initializeMathJax(renderOpts) {
65441
65459
  script.src = ("https://cdn.jsdelivr.net/npm/mathjax@").concat(MathJaxVersion, "/es5/tex-chtml-full.js");
65442
65460
  script.async = true;
65443
65461
  document.body.appendChild(script);
65444
- });
65462
+ }
65445
65463
  };
65446
65464
  mathjaxScript.initializeMathJax = initializeMathJax;
65447
65465
  var normalization$1 = {};
@@ -124979,7 +124997,7 @@ getDefaultExportFromCjs(mathRendering);
124979
124997
  Object.defineProperty(exports, "__esModule", {
124980
124998
  value: true
124981
124999
  });
124982
- exports.getGlobal = exports.fixMathElements = exports.fixMathElement = exports["default"] = void 0;
125000
+ exports.initializeMathJaxScript = exports.getGlobal = exports.fixMathElements = exports.fixMathElement = exports["default"] = void 0;
124983
125001
  var _typeof2 = _interopRequireDefault(_typeof$s.exports);
124984
125002
  var _mathjaxScript = mathjaxScript;
124985
125003
  var _normalization = normalization$1;
@@ -125030,22 +125048,17 @@ getDefaultExportFromCjs(mathRendering);
125030
125048
  };
125031
125049
  var NEWLINE_BLOCK_REGEX = /\\embed\{newLine\}\[\]/g;
125032
125050
  var NEWLINE_LATEX = '\\newline ';
125033
- var mathRenderingKEY = '@pie-lib/math-rendering@2';
125034
- var mathRenderingAccessibleKEY = '@pie-lib/math-rendering-accessible@1';
125035
125051
  var getGlobal = function getGlobal() {
125036
125052
  if (typeof window !== 'undefined') {
125037
- if (!window[mathRenderingAccessibleKEY]) {
125038
- window[mathRenderingAccessibleKEY] = {};
125053
+ if (!window[_mathjaxScript.mathRenderingAccessibleKEY]) {
125054
+ window[_mathjaxScript.mathRenderingAccessibleKEY] = {};
125039
125055
  }
125040
- return window[mathRenderingAccessibleKEY];
125056
+ return window[_mathjaxScript.mathRenderingAccessibleKEY];
125041
125057
  } else {
125042
125058
  return {};
125043
125059
  }
125044
125060
  };
125045
125061
  exports.getGlobal = getGlobal;
125046
- var defaultOpts = function defaultOpts() {
125047
- return getGlobal().opts || ({});
125048
- };
125049
125062
  var fixMathElement = function fixMathElement(element) {
125050
125063
  if (element.dataset.mathHandled) {
125051
125064
  return;
@@ -125110,80 +125123,84 @@ getDefaultExportFromCjs(mathRendering);
125110
125123
  }
125111
125124
  });
125112
125125
  };
125113
- var getMathJaxCustomKey = function getMathJaxCustomKey() {
125114
- var _window, _window$MathJax, _window2, _window2$MathJax, _window2$MathJax$conf;
125115
- return ((_window = window) === null || _window === void 0 ? void 0 : (_window$MathJax = _window.MathJax) === null || _window$MathJax === void 0 ? void 0 : _window$MathJax.customKey) || ((_window2 = window) === null || _window2 === void 0 ? void 0 : (_window2$MathJax = _window2.MathJax) === null || _window2$MathJax === void 0 ? void 0 : (_window2$MathJax$conf = _window2$MathJax.config) === null || _window2$MathJax$conf === void 0 ? void 0 : _window2$MathJax$conf.customKey);
125126
+ var processMathJaxFullPage = function processMathJaxFullPage(executeOn) {
125127
+ executeOn = executeOn || document.body;
125128
+ var mathJaxInstance = getGlobal().instance;
125129
+ if (mathJaxInstance) {
125130
+ mathJaxInstance.texReset();
125131
+ mathJaxInstance.typesetClear();
125132
+ mathJaxInstance.typesetPromise([executeOn]).then(function () {
125133
+ try {
125134
+ removeExcessMjxContainers(executeOn);
125135
+ removePlaceholdersAndRestoreDisplay();
125136
+ var updatedDocument = mathJaxInstance.startup.document;
125137
+ var list = updatedDocument.math.list;
125138
+ for (var item = list.next; (0, _typeof2["default"])(item.data) !== 'symbol'; item = item.next) {
125139
+ var mathMl = toMMl(item.data.root);
125140
+ var parsedMathMl = mathMl.replaceAll('\n', '');
125141
+ item.data.typesetRoot.setAttribute('data-mathml', parsedMathMl);
125142
+ }
125143
+ } catch (e) {
125144
+ console.error('Error post-processing MathJax typesetting:', e.toString());
125145
+ }
125146
+ mathJaxInstance.startup.document.clear();
125147
+ })["catch"](function (error) {
125148
+ console.error('Error in typesetting with MathJax:', error);
125149
+ });
125150
+ }
125151
+ };
125152
+ var initializeMathJaxScript = function initializeMathJaxScript(renderOpts) {
125153
+ if (!window.MathJaxInitialised) {
125154
+ (0, _mathjaxScript.initializeMathJax)(renderOpts, processMathJaxFullPage);
125155
+ }
125116
125156
  };
125157
+ exports.initializeMathJaxScript = initializeMathJaxScript;
125117
125158
  var renderMath = function renderMath(el, renderOpts) {
125118
125159
  var isString = typeof el === 'string';
125160
+ var _ref = renderOpts || ({}), skipWaitForMathRenderingLib = _ref.skipWaitForMathRenderingLib;
125119
125161
  var executeOn = document.body;
125120
125162
  if (isString) {
125121
125163
  var div = document.createElement('div');
125122
125164
  div.innerHTML = el;
125123
125165
  executeOn = div;
125124
125166
  }
125125
- var _ref = renderOpts || ({}), skipWaitForMathRenderingLib = _ref.skipWaitForMathRenderingLib;
125126
125167
  var renderMathAccessible = function renderMathAccessible() {
125127
125168
  fixMathElements(executeOn);
125128
125169
  adjustMathMLStyle(executeOn);
125129
- var mathJaxCustomKey = getMathJaxCustomKey();
125130
- if ((!window.MathJax || window.MathJax.version !== _mathjaxScript.MathJaxVersion) && !window.mathjaxLoadedP || mathJaxCustomKey && mathJaxCustomKey !== mathRenderingAccessibleKEY) {
125131
- renderOpts = renderOpts || defaultOpts();
125132
- (0, _mathjaxScript.initializeMathJax)(renderOpts);
125133
- }
125134
- if (isString && window.MathJax && window.mathjaxLoadedP) {
125135
- try {
125136
- MathJax.texReset();
125137
- MathJax.typesetClear();
125138
- window.MathJax.typeset([executeOn]);
125139
- var updatedDocument = window.MathJax.startup.document;
125140
- var list = updatedDocument.math.list;
125141
- var item = list.next;
125142
- var mathMl = toMMl(item.data.root);
125143
- var parsedMathMl = mathMl.replaceAll('\n', '');
125144
- return parsedMathMl;
125145
- } catch (error) {
125146
- console.error('Error rendering math:', error.message);
125147
- }
125170
+ if (!window.MathJaxInitialised) {
125171
+ (0, _mathjaxScript.initializeMathJax)(renderOpts, function () {
125172
+ return processMathJaxFullPage(executeOn);
125173
+ });
125174
+ return;
125148
125175
  }
125149
- if (window.mathjaxLoadedP) {
125150
- window.mathjaxLoadedP.then(function () {
125151
- var mathJaxInstance = getGlobal().instance;
125152
- if (mathJaxInstance) {
125153
- mathJaxInstance.texReset();
125154
- mathJaxInstance.typesetClear();
125155
- mathJaxInstance.typesetPromise([executeOn]).then(function () {
125156
- try {
125157
- removeExcessMjxContainers(executeOn);
125158
- removePlaceholdersAndRestoreDisplay();
125159
- var _updatedDocument = mathJaxInstance.startup.document;
125160
- var _list = _updatedDocument.math.list;
125161
- for (var _item = _list.next; (0, _typeof2["default"])(_item.data) !== 'symbol'; _item = _item.next) {
125162
- var _mathMl = toMMl(_item.data.root);
125163
- var _parsedMathMl = _mathMl.replaceAll('\n', '');
125164
- _item.data.typesetRoot.setAttribute('data-mathml', _parsedMathMl);
125165
- }
125166
- } catch (e) {
125167
- console.error('Error post-processing MathJax typesetting:', e.toString());
125168
- }
125169
- mathJaxInstance.startup.document.clear();
125170
- })["catch"](function (error) {
125171
- console.error('Error in typesetting with MathJax:', error);
125172
- });
125176
+ if (window.MathJaxLoaded) {
125177
+ if (isString) {
125178
+ try {
125179
+ MathJax.texReset();
125180
+ MathJax.typesetClear();
125181
+ window.MathJax.typeset([executeOn]);
125182
+ var updatedDocument = window.MathJax.startup.document;
125183
+ var list = updatedDocument.math.list;
125184
+ var item = list.next;
125185
+ var mathMl = toMMl(item.data.root);
125186
+ var parsedMathMl = mathMl.replaceAll('\n', '');
125187
+ return parsedMathMl;
125188
+ } catch (error) {
125189
+ console.error('Error rendering math:', error.message);
125190
+ return '';
125173
125191
  }
125174
- })["catch"](function (error) {
125175
- console.error('Error in initializing MathJax:', error);
125176
- });
125192
+ }
125193
+ processMathJaxFullPage(executeOn);
125177
125194
  }
125178
125195
  };
125179
125196
  if (skipWaitForMathRenderingLib) {
125180
125197
  return renderMathAccessible();
125181
125198
  } else {
125182
- if (window.hasOwnProperty(mathRenderingKEY) && window[mathRenderingKEY].instance) {
125199
+ if (window.hasOwnProperty(_mathjaxScript.mathRenderingKEY) && window[_mathjaxScript.mathRenderingKEY].instance) {
125183
125200
  removePlaceholdersAndRestoreDisplay();
125184
125201
  return mr.renderMath(executeOn, renderOpts);
125185
125202
  }
125186
- if (window.hasOwnProperty(mathRenderingAccessibleKEY) && window[mathRenderingAccessibleKEY].instance) {
125203
+ if (window.hasOwnProperty(_mathjaxScript.mathRenderingAccessibleKEY) && window[_mathjaxScript.mathRenderingAccessibleKEY].instance) {
125187
125204
  return renderMathAccessible();
125188
125205
  }
125189
125206
  var waitForMathRenderingLib = function waitForMathRenderingLib(renderMathAccessibleCallback) {
@@ -125193,7 +125210,7 @@ getDefaultExportFromCjs(mathRendering);
125193
125210
  var maxWaitTime = 500;
125194
125211
  var startTime = Date.now();
125195
125212
  var checkForLib = function checkForLib() {
125196
- var mathRenderingHasLoaded = window.hasOwnProperty(mathRenderingKEY) && window[mathRenderingKEY].instance;
125213
+ var mathRenderingHasLoaded = window.hasOwnProperty(_mathjaxScript.mathRenderingKEY) && window[_mathjaxScript.mathRenderingKEY].instance;
125197
125214
  var hasExceededMaxWait = Date.now() - startTime > maxWaitTime;
125198
125215
  if (mathRenderingHasLoaded || hasExceededMaxWait) {
125199
125216
  clearInterval(checkIntervalId);
@@ -125228,9 +125245,16 @@ var mmlToLatex = {};
125228
125245
  getDefaultExportFromCjs(mmlToLatex);
125229
125246
  (function (exports) {
125230
125247
  var _interopRequireDefault = interopRequireDefault.exports;
125248
+ var _typeof = _typeof$s.exports;
125231
125249
  Object.defineProperty(exports, "__esModule", {
125232
125250
  value: true
125233
125251
  });
125252
+ Object.defineProperty(exports, "initializeMathJaxScript", {
125253
+ enumerable: true,
125254
+ get: function get() {
125255
+ return _renderMath.initializeMathJaxScript;
125256
+ }
125257
+ });
125234
125258
  Object.defineProperty(exports, "mmlToLatex", {
125235
125259
  enumerable: true,
125236
125260
  get: function get() {
@@ -125255,9 +125279,48 @@ getDefaultExportFromCjs(mmlToLatex);
125255
125279
  return _normalization.wrapMath;
125256
125280
  }
125257
125281
  });
125258
- var _renderMath = _interopRequireDefault(renderMath$1);
125282
+ var _renderMath = _interopRequireWildcard(renderMath$1);
125259
125283
  var _mmlToLatex = _interopRequireDefault(mmlToLatex);
125260
125284
  var _normalization = normalization$1;
125285
+ function _getRequireWildcardCache(nodeInterop) {
125286
+ if (typeof WeakMap !== "function") return null;
125287
+ var cacheBabelInterop = new WeakMap();
125288
+ var cacheNodeInterop = new WeakMap();
125289
+ return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) {
125290
+ return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
125291
+ })(nodeInterop);
125292
+ }
125293
+ function _interopRequireWildcard(obj, nodeInterop) {
125294
+ if (!nodeInterop && obj && obj.__esModule) {
125295
+ return obj;
125296
+ }
125297
+ if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") {
125298
+ return {
125299
+ "default": obj
125300
+ };
125301
+ }
125302
+ var cache = _getRequireWildcardCache(nodeInterop);
125303
+ if (cache && cache.has(obj)) {
125304
+ return cache.get(obj);
125305
+ }
125306
+ var newObj = {};
125307
+ var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
125308
+ for (var key in obj) {
125309
+ if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
125310
+ var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
125311
+ if (desc && (desc.get || desc.set)) {
125312
+ Object.defineProperty(newObj, key, desc);
125313
+ } else {
125314
+ newObj[key] = obj[key];
125315
+ }
125316
+ }
125317
+ }
125318
+ newObj["default"] = obj;
125319
+ if (cache) {
125320
+ cache.set(obj, newObj);
125321
+ }
125322
+ return newObj;
125323
+ }
125261
125324
  })(mathRenderingAccessible);
125262
125325
  getDefaultExportFromCjs(mathRenderingAccessible);
125263
125326
  const require$$8$l = _dll_react;
package/package.json CHANGED
@@ -1,21 +1,21 @@
1
1
  {
2
2
  "name": "@pie-element/complex-rubric",
3
3
  "repository": "pie-framework/pie-elements",
4
- "version": "2.19.3-next.7+d2fdd045c",
4
+ "version": "2.19.3-next.8+1dd6cd9ce",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
8
8
  "dependencies": {
9
9
  "@material-ui/core": "^3.9.2",
10
- "@pie-element/multi-trait-rubric": "^3.19.3-next.7+d2fdd045c",
11
- "@pie-element/rubric": "^3.19.3-next.7+d2fdd045c",
10
+ "@pie-element/multi-trait-rubric": "^3.19.3-next.8+1dd6cd9ce",
11
+ "@pie-element/rubric": "^3.19.3-next.8+1dd6cd9ce",
12
12
  "@pie-framework/pie-player-events": "^0.1.0",
13
13
  "classnames": "^2.2.5",
14
14
  "debug": "^4.1.1",
15
15
  "lodash": "^4.17.11",
16
16
  "prop-types": "^15.7.2"
17
17
  },
18
- "gitHead": "d2fdd045c473c5d60fb2a848dcaeb21acae2c356",
18
+ "gitHead": "1dd6cd9ce2b68e511748963f567e94c1af5cb32c",
19
19
  "scripts": {
20
20
  "postpublish": "../../scripts/postpublish"
21
21
  },