eat-js-sdk 2.4.2 → 2.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5453,6 +5453,23 @@ async function typesetMathJax(element) {
5453
5453
  el.setAttribute("tabindex", "-1");
5454
5454
  });
5455
5455
  }
5456
+ async function getMathJaxSpeechText(html2) {
5457
+ const staging = document.createElement("div");
5458
+ staging.style.cssText = "position:absolute;left:-9999px;width:1px;height:1px;overflow:hidden";
5459
+ staging.innerHTML = html2;
5460
+ document.body.appendChild(staging);
5461
+ try {
5462
+ await typesetMathJax(staging);
5463
+ staging.querySelectorAll("mjx-container").forEach((container) => {
5464
+ const assistive = container.querySelector("mjx-assistive-mml");
5465
+ const text2 = assistive?.textContent?.trim() ?? "";
5466
+ container.replaceWith(document.createTextNode(text2));
5467
+ });
5468
+ return staging.textContent?.trim() ?? "";
5469
+ } finally {
5470
+ if (staging.parentNode) staging.remove();
5471
+ }
5472
+ }
5456
5473
  var root_1$o = /* @__PURE__ */ from_html(`<div><!></div>`);
5457
5474
  function CommonStringToHtml($$anchor, $$props) {
5458
5475
  push($$props, true);
@@ -6982,9 +6999,9 @@ function useImageModalSize() {
6982
6999
  };
6983
7000
  }
6984
7001
  var root_4$8 = /* @__PURE__ */ from_html(`<span class="w-6 h-6 flex items-center justify-center"><!></span>`);
6985
- var root_5$8 = /* @__PURE__ */ from_html(`<span class="w-6 h-6 flex items-center justify-center"><!></span>`);
6986
- var root_7$5 = /* @__PURE__ */ from_html(`<span class="sr-only"><!></span>`);
6987
- var root_6$5 = /* @__PURE__ */ from_html(`<div><!> <span aria-hidden="true"><!></span></div>`);
7002
+ var root_5$a = /* @__PURE__ */ from_html(`<span class="w-6 h-6 flex items-center justify-center"><!></span>`);
7003
+ var root_7$7 = /* @__PURE__ */ from_html(`<span class="sr-only"><!></span>`);
7004
+ var root_6$4 = /* @__PURE__ */ from_html(`<div><!> <span aria-hidden="true"><!></span></div>`);
6988
7005
  var root_10$3 = /* @__PURE__ */ from_html(`<span class="w-4 h-4 flex items-center justify-center"><!></span>`);
6989
7006
  var root_11$2 = /* @__PURE__ */ from_html(`<span class="w-4 h-4 flex items-center justify-center"><!></span>`);
6990
7007
  var root_2$f = /* @__PURE__ */ from_html(`<div class="absolute inset-0 m-0"><div class="w-full h-full px-0 md:px-[82px] lg:px-[128px] pt-14 pb-[72px] relative lg:py-24 flex flex-col items-center justify-center"><div aria-live="polite" aria-atomic="true" class="sr-only"><!> <!></div> <div class="w-full h-full flex flex-col md:flex-row md:justify-center items-center justify-between"><div class="md:hidden"></div> <!> <!> <div><div class="flex-shrink-0 flex items-center justify-between py-1 px-2 md:px-4 border-border-minimal border rounded-t-md lg:rounded-t-lg md:gap-4 h-8.5 md:h-fit"><!> <!> <!></div> <div class="rounded-b-md"><img class="mx-auto block rounded-b-md lg:rounded-b-lg object-contain max-w-full max-h-[calc(100vh-168px-34px)] md:max-h-[calc(100vh-128px-54px)] lg:max-h-[calc(100vh-192px-54px)] pointer-events-none"/></div></div> <div class="md:hidden flex justify-center items-center gap-1 flex-shrink-0 h-6 mt-4"><!> <!></div></div></div></div>`);
@@ -7256,7 +7273,7 @@ function MCQImageModal($$anchor, $$props) {
7256
7273
  dataTestId: "img-viewer-next",
7257
7274
  onclick: navigateNext,
7258
7275
  children: ($$anchor4, $$slotProps2) => {
7259
- var span_1 = root_5$8();
7276
+ var span_1 = root_5$a();
7260
7277
  var node_6 = child(span_1);
7261
7278
  SvgLoader(node_6, {
7262
7279
  svgName: "smallChevronRight",
@@ -7284,11 +7301,11 @@ function MCQImageModal($$anchor, $$props) {
7284
7301
  return get$1(fullAnswerText);
7285
7302
  },
7286
7303
  children: ($$anchor4, $$slotProps2) => {
7287
- var div_6 = root_6$5();
7304
+ var div_6 = root_6$4();
7288
7305
  var node_8 = child(div_6);
7289
7306
  {
7290
7307
  var consequent_1 = ($$anchor5) => {
7291
- var span_2 = root_7$5();
7308
+ var span_2 = root_7$7();
7292
7309
  var node_9 = child(span_2);
7293
7310
  {
7294
7311
  let $02 = /* @__PURE__ */ user_derived(() => get$1(currentOption)?.answer);
@@ -7615,9 +7632,9 @@ function InteractionSection($$anchor, $$props) {
7615
7632
  return pop($$exports);
7616
7633
  }
7617
7634
  create_custom_element(InteractionSection, { children: {} }, [], [], true);
7618
- var root_5$7 = /* @__PURE__ */ from_html(`<div></div>`);
7635
+ var root_5$9 = /* @__PURE__ */ from_html(`<div></div>`);
7619
7636
  var root_4$7 = /* @__PURE__ */ from_html(`<div class="px-4 w-full max-w-[1008px] mx-auto flex-shrink-0 text-center font-semibold text-sm md:text-lg leading-[150%] text-white" aria-hidden="true" data-testid="img-viewer-cap-txt"> </div> <!>`, 1);
7620
- var root_7$4 = /* @__PURE__ */ from_html(`<div></div>`);
7637
+ var root_7$6 = /* @__PURE__ */ from_html(`<div></div>`);
7621
7638
  var root_2$e = /* @__PURE__ */ from_html(`<div class="absolute inset-0"><div class="w-full h-full flex items-center justify-center pt-14 pb-[72px] lg:py-24"><div aria-live="polite" aria-atomic="true" class="sr-only"> </div> <div class="flex flex-col items-center overflow-y-auto overflow-x-hidden w-full px-0 md:px-6 lg:px-16"><div class="relative bg-white rounded-md md:rounded-lg shadow-sm overflow-hidden flex-shrink-0"><img class="block object-contain w-full h-auto max-w-full mx-auto"/> <!></div> <!></div></div></div>`);
7622
7639
  function PromptStimulusImageModal($$anchor, $$props) {
7623
7640
  push($$props, true);
@@ -7789,7 +7806,7 @@ function PromptStimulusImageModal($$anchor, $$props) {
7789
7806
  var node_3 = sibling(div_5, 2);
7790
7807
  {
7791
7808
  var consequent = ($$anchor5) => {
7792
- var div_6 = root_5$7();
7809
+ var div_6 = root_5$9();
7793
7810
  template_effect(() => set_style(div_6, `height:${get$1(bottomSpacerHeight) ?? ""}px`));
7794
7811
  append($$anchor5, div_6);
7795
7812
  };
@@ -7808,7 +7825,7 @@ function PromptStimulusImageModal($$anchor, $$props) {
7808
7825
  var node_4 = first_child(fragment_4);
7809
7826
  {
7810
7827
  var consequent_2 = ($$anchor5) => {
7811
- var div_7 = root_7$4();
7828
+ var div_7 = root_7$6();
7812
7829
  template_effect(() => set_style(div_7, `height:${get$1(bottomSpacerHeight) ?? ""}px`));
7813
7830
  append($$anchor5, div_7);
7814
7831
  };
@@ -8272,7 +8289,7 @@ const shouldRenderSection = (section) => section.condition !== false;
8272
8289
  const getClassString = (classes = []) => classes.join(" ");
8273
8290
  const getStyleString = (styles = {}) => Object.entries(styles).map(([k, v]) => `${k}:${v}`).join(";");
8274
8291
  var root_4$6 = /* @__PURE__ */ from_html(`<p class="text-lg leading-[22px] text-blue-1000 font-semibold mt-4" data-testid="img-cap-txt"> </p>`);
8275
- var root_5$6 = /* @__PURE__ */ from_html(`<div class="mt-6 w-full"><button class="flex items-center font-semibold leading-[1.5] outline-none group w-fit h-11 text-charcoal" aria-controls="long-description-content" aria-labelledby="image-description-label" type="button"><div class="w-6 h-6 flex items-center justify-center mr-2" data-testid="img-desc-txt"><!></div> <div id="image-description-label" class="image-description-accordion group-[.active]:border-b-2">Image Description</div></button> <div id="long-description-content" data-testid="img-desc-txt"><!></div></div>`);
8292
+ var root_5$8 = /* @__PURE__ */ from_html(`<div class="mt-6 w-full"><button class="flex items-center font-semibold leading-[1.5] outline-none group w-fit h-11 text-charcoal" aria-controls="long-description-content" aria-labelledby="image-description-label" type="button"><div class="w-6 h-6 flex items-center justify-center mr-2" data-testid="img-desc-txt"><!></div> <div id="image-description-label" class="image-description-accordion group-[.active]:border-b-2">Image Description</div></button> <div id="long-description-content" data-testid="img-desc-txt"><!></div></div>`);
8276
8293
  var root_2$d = /* @__PURE__ */ from_html(`<div class="flex flex-col justify-center items-center text-center"><div class="flex flex-col items-center"><div class="relative inline-block"><img/> <!></div> <!></div></div> <!>`, 1);
8277
8294
  var root_1$j = /* @__PURE__ */ from_html(`<div class="w-full"><!></div>`);
8278
8295
  function CommonMedia($$anchor, $$props) {
@@ -8405,7 +8422,7 @@ function CommonMedia($$anchor, $$props) {
8405
8422
  var node_4 = sibling(div_1, 2);
8406
8423
  {
8407
8424
  var consequent_1 = ($$anchor4) => {
8408
- var div_4 = root_5$6();
8425
+ var div_4 = root_5$8();
8409
8426
  var button = child(div_4);
8410
8427
  button.__click = toggleLongDescription;
8411
8428
  button.__keydown = handleKeyDown;
@@ -8494,11 +8511,11 @@ create_custom_element(
8494
8511
  true
8495
8512
  );
8496
8513
  var root_4$5 = /* @__PURE__ */ from_html(`<div data-testid="stimulus-txt-ctr"><!></div>`);
8497
- var root_5$5 = /* @__PURE__ */ from_html(`<div data-testid="stimulus-img-ctr"><!></div>`);
8514
+ var root_5$7 = /* @__PURE__ */ from_html(`<div data-testid="stimulus-img-ctr"><!></div>`);
8498
8515
  var root_3$b = /* @__PURE__ */ from_html(`<!> <!>`, 1);
8499
- var root_7$3 = /* @__PURE__ */ from_html(`<div data-testid="stimulus-img-ctr"><!></div>`);
8500
- var root_8$7 = /* @__PURE__ */ from_html(`<div data-testid="stimulus-txt-ctr"><!></div>`);
8501
- var root_6$4 = /* @__PURE__ */ from_html(`<!> <!>`, 1);
8516
+ var root_7$5 = /* @__PURE__ */ from_html(`<div data-testid="stimulus-img-ctr"><!></div>`);
8517
+ var root_8$6 = /* @__PURE__ */ from_html(`<div data-testid="stimulus-txt-ctr"><!></div>`);
8518
+ var root_6$3 = /* @__PURE__ */ from_html(`<!> <!>`, 1);
8502
8519
  var root_1$i = /* @__PURE__ */ from_html(`<div class="stimulus-section flex flex-col w-full"><!> <div><!></div></div>`);
8503
8520
  function StimulusSection($$anchor, $$props) {
8504
8521
  push($$props, true);
@@ -8612,7 +8629,7 @@ function StimulusSection($$anchor, $$props) {
8612
8629
  var node_5 = sibling(node_3, 2);
8613
8630
  {
8614
8631
  var consequent_2 = ($$anchor4) => {
8615
- var div_3 = root_5$5();
8632
+ var div_3 = root_5$7();
8616
8633
  let classes_2;
8617
8634
  var node_6 = child(div_3);
8618
8635
  CommonMedia(node_6, {
@@ -8647,11 +8664,11 @@ function StimulusSection($$anchor, $$props) {
8647
8664
  append($$anchor3, fragment_2);
8648
8665
  };
8649
8666
  var alternate = ($$anchor3) => {
8650
- var fragment_3 = root_6$4();
8667
+ var fragment_3 = root_6$3();
8651
8668
  var node_7 = first_child(fragment_3);
8652
8669
  {
8653
8670
  var consequent_4 = ($$anchor4) => {
8654
- var div_4 = root_7$3();
8671
+ var div_4 = root_7$5();
8655
8672
  let classes_3;
8656
8673
  var node_8 = child(div_4);
8657
8674
  CommonMedia(node_8, {
@@ -8686,7 +8703,7 @@ function StimulusSection($$anchor, $$props) {
8686
8703
  var node_9 = sibling(node_7, 2);
8687
8704
  {
8688
8705
  var consequent_5 = ($$anchor4) => {
8689
- var div_5 = root_8$7();
8706
+ var div_5 = root_8$6();
8690
8707
  var node_10 = child(div_5);
8691
8708
  CommonStringToHtml(node_10, {
8692
8709
  get htmlString() {
@@ -8735,7 +8752,7 @@ create_custom_element(
8735
8752
  [],
8736
8753
  true
8737
8754
  );
8738
- var root_8$6 = /* @__PURE__ */ from_html(`<div class="divider my-6"></div>`);
8755
+ var root_8$5 = /* @__PURE__ */ from_html(`<div class="divider my-6"></div>`);
8739
8756
  var root_13$3 = /* @__PURE__ */ from_html(`<div class="divider my-6"></div>`);
8740
8757
  var root_15$1 = /* @__PURE__ */ from_html(`<div aria-live="polite"><!></div>`);
8741
8758
  var root_1$h = /* @__PURE__ */ from_html(`<div><!></div>`);
@@ -8914,7 +8931,7 @@ function PromptContainer($$anchor, $$props) {
8914
8931
  var node_3 = first_child(fragment_6);
8915
8932
  {
8916
8933
  var consequent_3 = ($$anchor6) => {
8917
- var div_4 = root_8$6();
8934
+ var div_4 = root_8$5();
8918
8935
  append($$anchor6, div_4);
8919
8936
  };
8920
8937
  var alternate_2 = ($$anchor6) => {
@@ -9127,10 +9144,10 @@ var root_1$g = /* @__PURE__ */ from_html(`<div class="sr-only" tabindex="-1"><!>
9127
9144
  var root_2$c = /* @__PURE__ */ from_html(`<span> </span>`);
9128
9145
  var root_3$a = /* @__PURE__ */ from_html(`<span>Missing answer</span>`);
9129
9146
  var root_4$4 = /* @__PURE__ */ from_html(`<span class="sr-only"> </span>`);
9130
- var root_5$4 = /* @__PURE__ */ from_html(`<span class="sr-only"> </span>`);
9131
- var root_6$3 = /* @__PURE__ */ from_html(`<p>Missing answer</p>`);
9132
- var root_7$2 = /* @__PURE__ */ from_html(`<p class="text-red-400 text-sm font-semibold leading-[1.3] pr-2.5 hidden md:block"> </p>`);
9133
- var root_8$5 = /* @__PURE__ */ from_html(`<span aria-hidden="true"><!></span>`);
9147
+ var root_5$6 = /* @__PURE__ */ from_html(`<span class="sr-only"> </span>`);
9148
+ var root_6$2 = /* @__PURE__ */ from_html(`<p>Missing answer</p>`);
9149
+ var root_7$4 = /* @__PURE__ */ from_html(`<p class="text-red-400 text-sm font-semibold leading-[1.3] pr-2.5 hidden md:block"> </p>`);
9150
+ var root_8$4 = /* @__PURE__ */ from_html(`<span aria-hidden="true"><!></span>`);
9134
9151
  var root_12$3 = /* @__PURE__ */ from_html(`<span class="w-3 h-2 flex items-center justify-center"><!></span>`);
9135
9152
  var root_11$1 = /* @__PURE__ */ from_html(`<span><!></span>`);
9136
9153
  var root_13$2 = /* @__PURE__ */ from_html(`<div class="w-full overflow-hidden bg-white rounded-b-lg flex items-center justify-center relative"><img class="mcq-opt-img min-h-[154px] max-h-[184px] w-auto max-w-full object-contain pointer-events-none" data-testid="mcq-opt-img" loading="lazy"/></div>`);
@@ -9322,7 +9339,7 @@ function MCQOption($$anchor, $$props) {
9322
9339
  var node_6 = sibling(node_5, 2);
9323
9340
  {
9324
9341
  var consequent_4 = ($$anchor2) => {
9325
- var span_8 = root_5$4();
9342
+ var span_8 = root_5$6();
9326
9343
  var text_3 = child(span_8, true);
9327
9344
  reset(span_8);
9328
9345
  template_effect(() => set_text(text_3, get$1(labelSuffix)));
@@ -9338,7 +9355,7 @@ function MCQOption($$anchor, $$props) {
9338
9355
  var node_7 = child(span_9);
9339
9356
  {
9340
9357
  var consequent_5 = ($$anchor2) => {
9341
- var p = root_6$3();
9358
+ var p = root_6$2();
9342
9359
  template_effect(() => set_class(p, 1, `text-green-750 text-sm font-semibold leading-[1.3] hidden md:block
9343
9360
  ${get$1(totalCorrectAnswers) > 1 ? "pr-2.5" : ""}`));
9344
9361
  append($$anchor2, p);
@@ -9350,7 +9367,7 @@ function MCQOption($$anchor, $$props) {
9350
9367
  var node_8 = sibling(node_7, 2);
9351
9368
  {
9352
9369
  var consequent_6 = ($$anchor2) => {
9353
- var p_1 = root_7$2();
9370
+ var p_1 = root_7$4();
9354
9371
  var text_4 = child(p_1, true);
9355
9372
  reset(p_1);
9356
9373
  template_effect(() => set_text(text_4, get$1(isInteractiveMode2) ? "Your answer" : get$1(isPreviewMode2) ? "" : "Student's answer"));
@@ -9363,7 +9380,7 @@ function MCQOption($$anchor, $$props) {
9363
9380
  var node_9 = sibling(node_8, 2);
9364
9381
  {
9365
9382
  var consequent_8 = ($$anchor2) => {
9366
- var span_10 = root_8$5();
9383
+ var span_10 = root_8$4();
9367
9384
  var node_10 = child(span_10);
9368
9385
  {
9369
9386
  var consequent_7 = ($$anchor3) => {
@@ -10407,7 +10424,7 @@ create_custom_element(
10407
10424
  var root_1$d = /* @__PURE__ */ from_html(`<p class="p2 text-red-400 mb-3">Student's answer</p>`);
10408
10425
  var root_3$8 = /* @__PURE__ */ from_html(`<span class="w-8 h-8 absolute right-2 top-2.5 flex items-center justify-center" aria-hidden="true"><!></span>`);
10409
10426
  var root_2$9 = /* @__PURE__ */ from_html(`<div class="relative"><textarea autocomplete="off" rows="3"></textarea> <!></div>`);
10410
- var root_5$3 = /* @__PURE__ */ from_html(`<span class="w-8 h-8 absolute right-2 top-2.5 flex items-center justify-center" aria-hidden="true"><!></span>`);
10427
+ var root_5$5 = /* @__PURE__ */ from_html(`<span class="w-8 h-8 absolute right-2 top-2.5 flex items-center justify-center" aria-hidden="true"><!></span>`);
10411
10428
  var root_4$2 = /* @__PURE__ */ from_html(`<div class="relative"><input autocomplete="off"/> <!></div>`);
10412
10429
  var root$b = /* @__PURE__ */ from_html(`<div class="relative"><!> <!></div>`);
10413
10430
  function TypeInTextField($$anchor, $$props) {
@@ -10611,7 +10628,7 @@ function TypeInTextField($$anchor, $$props) {
10611
10628
  var node_4 = sibling(input, 2);
10612
10629
  {
10613
10630
  var consequent_3 = ($$anchor3) => {
10614
- var span_1 = root_5$3();
10631
+ var span_1 = root_5$5();
10615
10632
  var node_5 = child(span_1);
10616
10633
  {
10617
10634
  let $0 = /* @__PURE__ */ user_derived(() => isSkipped() ? false : Boolean(isCorrect()));
@@ -10747,8 +10764,8 @@ action.destroy = n.destroy;
10747
10764
  var root_1$c = /* @__PURE__ */ from_html(`<label data-testid="qn-number-txt" aria-hidden="true"><span></span> <span> </span></label>`);
10748
10765
  var root_2$8 = /* @__PURE__ */ from_html(`<div role="textbox" aria-readonly="true"><!></div>`);
10749
10766
  var root_4$1 = /* @__PURE__ */ from_html(`<div role="textbox" aria-readonly="true" data-testid="ans-sum-corr-txb"><!></div>`);
10750
- var root_5$2 = /* @__PURE__ */ from_html(`<textarea rows="1" readonly=""></textarea>`);
10751
- var root_6$2 = /* @__PURE__ */ from_html(`<span class="w-6 h-6 absolute right-4 top-[calc(50%+0.375rem)] -translate-y-1/2 flex items-center justify-center"><!></span>`);
10767
+ var root_5$4 = /* @__PURE__ */ from_html(`<textarea rows="1" readonly=""></textarea>`);
10768
+ var root_6$1 = /* @__PURE__ */ from_html(`<span class="w-6 h-6 absolute right-4 top-[calc(50%+0.375rem)] -translate-y-1/2 flex items-center justify-center"><!></span>`);
10752
10769
  var root$a = /* @__PURE__ */ from_html(`<div><!> <!> <!></div>`);
10753
10770
  function AnswerDisplay($$anchor, $$props) {
10754
10771
  push($$props, true);
@@ -10951,7 +10968,7 @@ function AnswerDisplay($$anchor, $$props) {
10951
10968
  append($$anchor3, div_2);
10952
10969
  };
10953
10970
  var alternate = ($$anchor3) => {
10954
- var textarea = root_5$2();
10971
+ var textarea = root_5$4();
10955
10972
  remove_textarea_child(textarea);
10956
10973
  action$1(textarea, ($$node) => action?.($$node));
10957
10974
  template_effect(() => {
@@ -10983,7 +11000,7 @@ function AnswerDisplay($$anchor, $$props) {
10983
11000
  var node_5 = sibling(node_1, 2);
10984
11001
  {
10985
11002
  var consequent_3 = ($$anchor2) => {
10986
- var span_2 = root_6$2();
11003
+ var span_2 = root_6$1();
10987
11004
  var node_6 = child(span_2);
10988
11005
  {
10989
11006
  let $0 = /* @__PURE__ */ user_derived(() => isCorrect() ? "text-green-900" : "text-red-900");
@@ -11451,7 +11468,7 @@ create_custom_element(
11451
11468
  true
11452
11469
  );
11453
11470
  var root_3$7 = /* @__PURE__ */ from_html(`<p></p>`);
11454
- var root_8$4 = /* @__PURE__ */ from_html(`<div class="absolute inset-0 bg-transparent z-50"></div>`);
11471
+ var root_8$3 = /* @__PURE__ */ from_html(`<div class="absolute inset-0 bg-transparent z-50"></div>`);
11455
11472
  var root_2$6 = /* @__PURE__ */ from_html(`<div class="inline-typein-container mt-6 relative"><!> <div class="divider my-6"></div> <!></div>`);
11456
11473
  var root_10$2 = /* @__PURE__ */ from_html(`<div class="mb-4"><!></div>`);
11457
11474
  var root_13$1 = /* @__PURE__ */ from_html(`<div role="textbox" tabindex="0" aria-readonly="true" aria-labelledby="missing-answer-label" class="typein-textbox typein-textbox-missing border-2 border-green-700 py-[9px] px-4"><!></div>`);
@@ -11765,7 +11782,7 @@ function TypeInComponent($$anchor, $$props) {
11765
11782
  var node_5 = sibling(node_1, 4);
11766
11783
  {
11767
11784
  var consequent_2 = ($$anchor4) => {
11768
- var div_1 = root_8$4();
11785
+ var div_1 = root_8$3();
11769
11786
  append($$anchor4, div_1);
11770
11787
  };
11771
11788
  if_block(node_5, ($$render) => {
@@ -14466,11 +14483,12 @@ function isInt(value) {
14466
14483
  })(parseFloat(value));
14467
14484
  }
14468
14485
  var root_1$9 = /* @__PURE__ */ from_html(`<span class="sr-only"> </span>`);
14469
- var root_2$5 = /* @__PURE__ */ from_html(`<span class="text-green-800 preview-icon"><!></span>`);
14470
- var root_4 = /* @__PURE__ */ from_html(`<span class="text-red-800 preview-icon"><!></span>`);
14471
- var root_6$1 = /* @__PURE__ */ from_html(`<span class="text-green-800"><!></span>`);
14472
- var root_8$3 = /* @__PURE__ */ from_html(`<span class="preview-vertical hidden"><!></span>`);
14473
- var root$7 = /* @__PURE__ */ from_html(`<button data-item-button=""><span class="sr-only"> </span> <span><!></span> <!> <div aria-hidden="true"><span></span> <span class="absolute"><!> <!></span></div></button>`);
14486
+ var root_2$5 = /* @__PURE__ */ from_html(`<span class="sr-only"> </span>`);
14487
+ var root_3$6 = /* @__PURE__ */ from_html(`<span class="text-green-800 preview-icon"><!></span>`);
14488
+ var root_5$3 = /* @__PURE__ */ from_html(`<span class="text-red-800 preview-icon"><!></span>`);
14489
+ var root_7$3 = /* @__PURE__ */ from_html(`<span class="text-green-800"><!></span>`);
14490
+ var root_9$2 = /* @__PURE__ */ from_html(`<span class="preview-vertical hidden"><!></span>`);
14491
+ var root$7 = /* @__PURE__ */ from_html(`<button data-item-button=""><!> <span><!></span> <!> <div><span></span> <span class="absolute"><!> <!></span></div></button>`);
14474
14492
  function CategoriseItem($$anchor, $$props) {
14475
14493
  push($$props, true);
14476
14494
  let itemId = prop($$props, "itemId", 7), itemText = prop($$props, "itemText", 7), containerId = prop($$props, "containerId", 7), mode = prop($$props, "mode", 7), selectedItemId = prop($$props, "selectedItemId", 7, void 0), isLocked = prop($$props, "isLocked", 7, false), isCollapsed = prop($$props, "isCollapsed", 7, false), resultType = prop($$props, "resultType", 7, ""), isCurrentMobileItem = prop($$props, "isCurrentMobileItem", 7, true), isClonedItem = prop($$props, "isClonedItem", 7, false), isConsideredItem = prop($$props, "isConsideredItem", 7, false), activeContainerForKeyboard = prop($$props, "activeContainerForKeyboard", 7, void 0), onclick = prop($$props, "onclick", 7), onfocus = prop($$props, "onfocus", 7), onblur = prop($$props, "onblur", 7), onkeydown = prop($$props, "onkeydown", 7);
@@ -14483,7 +14501,7 @@ function CategoriseItem($$anchor, $$props) {
14483
14501
  const isSelected = /* @__PURE__ */ user_derived(() => selectedItemId() === get$1(cleanItemId));
14484
14502
  const hasAnyItemSelected = /* @__PURE__ */ user_derived(() => !!selectedItemId());
14485
14503
  const canInteract = /* @__PURE__ */ user_derived(() => !isLocked() && (!resultType() || mode() === MODES.INTERACTIVE));
14486
- const ariaPrefix = /* @__PURE__ */ user_derived(() => () => {
14504
+ const ariaPrefix = /* @__PURE__ */ user_derived(() => {
14487
14505
  if (resultType() === ANSWER_RESULTS.INCORRECT && isWordBin && !get$1(isSelected)) {
14488
14506
  return "Skipped answer:";
14489
14507
  }
@@ -14495,12 +14513,15 @@ function CategoriseItem($$anchor, $$props) {
14495
14513
  }
14496
14514
  return `${get$1(isSelected) ? "Selected option" : "Option"}:`;
14497
14515
  });
14498
- const ariaSuffix = /* @__PURE__ */ user_derived(() => () => {
14516
+ const ariaSuffix = /* @__PURE__ */ user_derived(() => {
14499
14517
  if ((resultType() === ANSWER_RESULTS.CORRECT || resultType() === ANSWER_RESULTS.INCORRECT) && !get$1(isSelected)) {
14500
14518
  return `(${resultType()})`;
14501
14519
  }
14502
14520
  return "";
14503
14521
  });
14522
+ const itemHasMath = /* @__PURE__ */ user_derived(() => hasMathJax(itemText()));
14523
+ const cleanItemText = /* @__PURE__ */ user_derived(() => useRemoveRichTextHtmlTags(itemText()));
14524
+ const itemAriaLabel = /* @__PURE__ */ user_derived(() => !get$1(itemHasMath) ? [get$1(ariaPrefix), get$1(cleanItemText), get$1(ariaSuffix)].filter(Boolean).join(" ") : void 0);
14504
14525
  const handleFocus = (event2) => {
14505
14526
  set(lastFocusTime, Date.now(), true);
14506
14527
  if (onfocus()) {
@@ -14567,7 +14588,7 @@ function CategoriseItem($$anchor, $$props) {
14567
14588
  }
14568
14589
  }
14569
14590
  };
14570
- const itemTabIndex = /* @__PURE__ */ user_derived(() => () => {
14591
+ const itemTabIndex = /* @__PURE__ */ user_derived(() => {
14571
14592
  if (get$1(isSelected)) return 0;
14572
14593
  if (isCollapsed()) return -1;
14573
14594
  if (get$1(hasAnyItemSelected)) return -1;
@@ -14575,7 +14596,7 @@ function CategoriseItem($$anchor, $$props) {
14575
14596
  if (isWordBin && isCurrentMobileItem()) return 0;
14576
14597
  return -1;
14577
14598
  });
14578
- const buttonClasses = /* @__PURE__ */ user_derived(() => () => {
14599
+ const buttonClasses = /* @__PURE__ */ user_derived(() => {
14579
14600
  const classes = [
14580
14601
  "focus-ring",
14581
14602
  "flex",
@@ -14620,24 +14641,24 @@ function CategoriseItem($$anchor, $$props) {
14620
14641
  }
14621
14642
  return classes.join(" ");
14622
14643
  });
14623
- const textClasses = /* @__PURE__ */ user_derived(() => () => {
14644
+ const textClasses = /* @__PURE__ */ user_derived(() => {
14624
14645
  return `text-charcoal text-base pl-3 mr-4 ${get$1(isSelected) ? "text-white" : ""}`;
14625
14646
  });
14626
- const iconContainerClasses = /* @__PURE__ */ user_derived(() => () => {
14647
+ const iconContainerClasses = /* @__PURE__ */ user_derived(() => {
14627
14648
  const base = "group text-blue-1000 h-11 w-11 min-w-[44px] flex items-center justify-center btn-vertical-icon";
14628
14649
  if (!get$1(hasAnyItemSelected) && get$1(canInteract) && !get$1(isSelected)) {
14629
14650
  return `${base} td:hover:cursor-grab td:hover:text-soft-blue`;
14630
14651
  }
14631
14652
  return base;
14632
14653
  });
14633
- const iconBgClasses = /* @__PURE__ */ user_derived(() => () => {
14654
+ const iconBgClasses = /* @__PURE__ */ user_derived(() => {
14634
14655
  const base = "w-full h-full relative rounded-lg";
14635
14656
  if (!get$1(hasAnyItemSelected) && get$1(canInteract) && !get$1(isSelected)) {
14636
14657
  return `${base} td:group-hover:bg-black td:group-hover:opacity-5`;
14637
14658
  }
14638
14659
  return base;
14639
14660
  });
14640
- const getItemTestId = /* @__PURE__ */ user_derived(() => () => {
14661
+ const getItemTestId = /* @__PURE__ */ user_derived(() => {
14641
14662
  if (mode() === MODES.SESSION || mode() === MODES.INTERACTIVE) {
14642
14663
  if (resultType() === ANSWER_RESULTS.INCORRECT && isWordBin && !get$1(isSelected)) {
14643
14664
  return "cat-skip-ans-btn";
@@ -14773,40 +14794,56 @@ function CategoriseItem($$anchor, $$props) {
14773
14794
  button.__touchmove = handleTouchMove;
14774
14795
  button.__touchend = handleTouchEnd;
14775
14796
  button.__keydown = handleKeyDown;
14776
- var span = child(button);
14777
- var text2 = child(span, true);
14778
- reset(span);
14779
- var span_1 = sibling(span, 2);
14780
- var node = child(span_1);
14781
- CommonStringToHtml(node, {
14782
- get htmlString() {
14783
- return itemText();
14784
- },
14785
- otherClass: "inline-block w-full"
14786
- });
14787
- reset(span_1);
14788
- var node_1 = sibling(span_1, 2);
14797
+ var node = child(button);
14789
14798
  {
14790
14799
  var consequent = ($$anchor2) => {
14791
- var span_2 = root_1$9();
14800
+ var span = root_1$9();
14801
+ var text2 = child(span, true);
14802
+ reset(span);
14803
+ template_effect(() => set_text(text2, get$1(ariaPrefix)));
14804
+ append($$anchor2, span);
14805
+ };
14806
+ if_block(node, ($$render) => {
14807
+ if (get$1(itemHasMath)) $$render(consequent);
14808
+ });
14809
+ }
14810
+ var span_1 = sibling(node, 2);
14811
+ var node_1 = child(span_1);
14812
+ {
14813
+ let $0 = /* @__PURE__ */ user_derived(() => !get$1(itemHasMath));
14814
+ CommonStringToHtml(node_1, {
14815
+ get htmlString() {
14816
+ return itemText();
14817
+ },
14818
+ otherClass: "inline-block w-full",
14819
+ get ariaHidden() {
14820
+ return get$1($0);
14821
+ }
14822
+ });
14823
+ }
14824
+ reset(span_1);
14825
+ var node_2 = sibling(span_1, 2);
14826
+ {
14827
+ var consequent_1 = ($$anchor2) => {
14828
+ var span_2 = root_2$5();
14792
14829
  var text_1 = child(span_2, true);
14793
14830
  reset(span_2);
14794
- template_effect(($0) => set_text(text_1, $0), [() => get$1(ariaSuffix)()]);
14831
+ template_effect(() => set_text(text_1, get$1(ariaSuffix)));
14795
14832
  append($$anchor2, span_2);
14796
14833
  };
14797
- if_block(node_1, ($$render) => {
14798
- if (get$1(ariaSuffix)()) $$render(consequent);
14834
+ if_block(node_2, ($$render) => {
14835
+ if (get$1(itemHasMath) && get$1(ariaSuffix)) $$render(consequent_1);
14799
14836
  });
14800
14837
  }
14801
- var div = sibling(node_1, 2);
14838
+ var div = sibling(node_2, 2);
14802
14839
  var span_3 = child(div);
14803
14840
  var span_4 = sibling(span_3, 2);
14804
- var node_2 = child(span_4);
14841
+ var node_3 = child(span_4);
14805
14842
  {
14806
- var consequent_1 = ($$anchor2) => {
14807
- var span_5 = root_2$5();
14808
- var node_3 = child(span_5);
14809
- SvgLoader(node_3, {
14843
+ var consequent_2 = ($$anchor2) => {
14844
+ var span_5 = root_3$6();
14845
+ var node_4 = child(span_5);
14846
+ SvgLoader(node_4, {
14810
14847
  svgName: "successSolid",
14811
14848
  className: "correct-icon",
14812
14849
  dataTestId: "icon-correct"
@@ -14816,12 +14853,12 @@ function CategoriseItem($$anchor, $$props) {
14816
14853
  };
14817
14854
  var alternate_2 = ($$anchor2) => {
14818
14855
  var fragment = comment();
14819
- var node_4 = first_child(fragment);
14856
+ var node_5 = first_child(fragment);
14820
14857
  {
14821
- var consequent_2 = ($$anchor3) => {
14822
- var span_6 = root_4();
14823
- var node_5 = child(span_6);
14824
- SvgLoader(node_5, {
14858
+ var consequent_3 = ($$anchor3) => {
14859
+ var span_6 = root_5$3();
14860
+ var node_6 = child(span_6);
14861
+ SvgLoader(node_6, {
14825
14862
  svgName: "errorSolid",
14826
14863
  className: "incorrect-icon",
14827
14864
  dataTestId: "icon-incorrect"
@@ -14831,12 +14868,12 @@ function CategoriseItem($$anchor, $$props) {
14831
14868
  };
14832
14869
  var alternate_1 = ($$anchor3) => {
14833
14870
  var fragment_1 = comment();
14834
- var node_6 = first_child(fragment_1);
14871
+ var node_7 = first_child(fragment_1);
14835
14872
  {
14836
- var consequent_3 = ($$anchor4) => {
14837
- var span_7 = root_6$1();
14838
- var node_7 = child(span_7);
14839
- SvgLoader(node_7, {
14873
+ var consequent_4 = ($$anchor4) => {
14874
+ var span_7 = root_7$3();
14875
+ var node_8 = child(span_7);
14876
+ SvgLoader(node_8, {
14840
14877
  svgName: "success",
14841
14878
  className: "missing-correct-icon",
14842
14879
  dataTestId: "icon-miss-corr"
@@ -14852,9 +14889,9 @@ function CategoriseItem($$anchor, $$props) {
14852
14889
  });
14853
14890
  };
14854
14891
  if_block(
14855
- node_6,
14892
+ node_7,
14856
14893
  ($$render) => {
14857
- if (resultType() === ANSWER_RESULTS.MISSED) $$render(consequent_3);
14894
+ if (resultType() === ANSWER_RESULTS.MISSED) $$render(consequent_4);
14858
14895
  else $$render(alternate, false);
14859
14896
  },
14860
14897
  true
@@ -14863,9 +14900,9 @@ function CategoriseItem($$anchor, $$props) {
14863
14900
  append($$anchor3, fragment_1);
14864
14901
  };
14865
14902
  if_block(
14866
- node_4,
14903
+ node_5,
14867
14904
  ($$render) => {
14868
- if (resultType() === ANSWER_RESULTS.INCORRECT && !get$1(isSelected)) $$render(consequent_2);
14905
+ if (resultType() === ANSWER_RESULTS.INCORRECT && !get$1(isSelected)) $$render(consequent_3);
14869
14906
  else $$render(alternate_1, false);
14870
14907
  },
14871
14908
  true
@@ -14873,17 +14910,17 @@ function CategoriseItem($$anchor, $$props) {
14873
14910
  }
14874
14911
  append($$anchor2, fragment);
14875
14912
  };
14876
- if_block(node_2, ($$render) => {
14877
- if (resultType() === ANSWER_RESULTS.CORRECT && !get$1(isSelected)) $$render(consequent_1);
14913
+ if_block(node_3, ($$render) => {
14914
+ if (resultType() === ANSWER_RESULTS.CORRECT && !get$1(isSelected)) $$render(consequent_2);
14878
14915
  else $$render(alternate_2, false);
14879
14916
  });
14880
14917
  }
14881
- var node_8 = sibling(node_2, 2);
14918
+ var node_9 = sibling(node_3, 2);
14882
14919
  {
14883
- var consequent_4 = ($$anchor2) => {
14884
- var span_8 = root_8$3();
14885
- var node_9 = child(span_8);
14886
- SvgLoader(node_9, {
14920
+ var consequent_5 = ($$anchor2) => {
14921
+ var span_8 = root_9$2();
14922
+ var node_10 = child(span_8);
14923
+ SvgLoader(node_10, {
14887
14924
  svgName: "gripVertical",
14888
14925
  className: "grip-icon",
14889
14926
  dataTestId: "icon-grip"
@@ -14891,35 +14928,24 @@ function CategoriseItem($$anchor, $$props) {
14891
14928
  reset(span_8);
14892
14929
  append($$anchor2, span_8);
14893
14930
  };
14894
- if_block(node_8, ($$render) => {
14895
- if (resultType() === ANSWER_RESULTS.CORRECT || resultType() === ANSWER_RESULTS.INCORRECT) $$render(consequent_4);
14931
+ if_block(node_9, ($$render) => {
14932
+ if (resultType() === ANSWER_RESULTS.CORRECT || resultType() === ANSWER_RESULTS.INCORRECT) $$render(consequent_5);
14896
14933
  });
14897
14934
  }
14898
14935
  reset(span_4);
14899
14936
  reset(div);
14900
14937
  reset(button);
14901
- template_effect(
14902
- ($0, $1, $2, $3, $4, $5, $6) => {
14903
- set_attribute(button, "id", itemId());
14904
- set_class(button, 1, $0);
14905
- set_attribute(button, "data-testid", $1);
14906
- set_attribute(button, "tabindex", $2);
14907
- button.disabled = isLocked() && !resultType();
14908
- set_text(text2, $3);
14909
- set_class(span_1, 1, $4);
14910
- set_class(div, 1, $5);
14911
- set_class(span_3, 1, $6);
14912
- },
14913
- [
14914
- () => clsx(get$1(buttonClasses)()),
14915
- () => get$1(getItemTestId)(),
14916
- () => get$1(itemTabIndex)(),
14917
- () => get$1(ariaPrefix)(),
14918
- () => clsx(get$1(textClasses)()),
14919
- () => clsx(get$1(iconContainerClasses)()),
14920
- () => clsx(get$1(iconBgClasses)())
14921
- ]
14922
- );
14938
+ template_effect(() => {
14939
+ set_attribute(button, "id", itemId());
14940
+ set_class(button, 1, clsx(get$1(buttonClasses)));
14941
+ set_attribute(button, "data-testid", get$1(getItemTestId));
14942
+ set_attribute(button, "tabindex", get$1(itemTabIndex));
14943
+ button.disabled = isLocked() && !resultType();
14944
+ set_attribute(button, "aria-label", get$1(itemAriaLabel));
14945
+ set_class(span_1, 1, clsx(get$1(textClasses)));
14946
+ set_class(div, 1, clsx(get$1(iconContainerClasses)));
14947
+ set_class(span_3, 1, clsx(get$1(iconBgClasses)));
14948
+ });
14923
14949
  event("focus", button, handleFocus);
14924
14950
  event("blur", button, handleBlur);
14925
14951
  append($$anchor, button);
@@ -14951,14 +14977,13 @@ create_custom_element(
14951
14977
  true
14952
14978
  );
14953
14979
  var root_2$4 = /* @__PURE__ */ from_html(`<span class="sr-only"> </span> <!>`, 1);
14954
- var root_3$6 = /* @__PURE__ */ from_html(`<span class="sr-only"> </span>`);
14955
14980
  var root_1$8 = /* @__PURE__ */ from_html(`<button tabindex="0"><!></button>`);
14956
- var root_9$2 = /* @__PURE__ */ from_html(`<div class="w-full text-base text-charcoal font-semibold mt-1 mb-2">Missing answers:</div>`);
14957
- var root_8$2 = /* @__PURE__ */ from_html(`<!> <!>`, 1);
14981
+ var root_8$2 = /* @__PURE__ */ from_html(`<div class="w-full text-base text-charcoal font-semibold mt-1 mb-2">Missing answers:</div>`);
14982
+ var root_7$2 = /* @__PURE__ */ from_html(`<!> <!>`, 1);
14958
14983
  var root$6 = /* @__PURE__ */ from_html(`<!> <section><!></section>`, 1);
14959
14984
  function CategoriseDndContainer($$anchor, $$props) {
14960
14985
  push($$props, true);
14961
- let containerId = prop($$props, "containerId", 7), containerLabel = prop($$props, "containerLabel", 7, ""), containerLabelHtml = prop($$props, "containerLabelHtml", 7, ""), containerIndex = prop($$props, "containerIndex", 7, 0), containerClass = prop($$props, "containerClass", 7, ""), showButton = prop($$props, "showButton", 7, true), items = prop($$props, "items", 23, () => []), selectedItemId = prop($$props, "selectedItemId", 7, void 0), isLocked = prop($$props, "isLocked", 7, false), isMobile = prop($$props, "isMobile", 7, false), mode = prop($$props, "mode", 7), paddingTop = prop($$props, "paddingTop", 7, 0), dndType = prop($$props, "dndType", 7, "categorise"), activeContainerForKeyboard = prop($$props, "activeContainerForKeyboard", 7, void 0), isCollapsed = prop($$props, "isCollapsed", 7, false), onitemdrop = prop($$props, "onitemdrop", 7), onitemselect = prop($$props, "onitemselect", 7), oncontainerclick = prop($$props, "oncontainerclick", 7), onitemfocus = prop($$props, "onitemfocus", 7), onitemblur = prop($$props, "onitemblur", 7), onitemkeydown = prop($$props, "onitemkeydown", 7), ondraghover = prop($$props, "ondraghover", 7), ondragstart = prop($$props, "ondragstart", 7), children = prop($$props, "children", 7);
14986
+ let containerId = prop($$props, "containerId", 7), containerLabel = prop($$props, "containerLabel", 7, ""), containerLabelHtml = prop($$props, "containerLabelHtml", 7, ""), containerHasMath = prop($$props, "containerHasMath", 7, false), containerIndex = prop($$props, "containerIndex", 7, 0), containerClass = prop($$props, "containerClass", 7, ""), showButton = prop($$props, "showButton", 7, true), items = prop($$props, "items", 23, () => []), selectedItemId = prop($$props, "selectedItemId", 7, void 0), isLocked = prop($$props, "isLocked", 7, false), isMobile = prop($$props, "isMobile", 7, false), mode = prop($$props, "mode", 7), paddingTop = prop($$props, "paddingTop", 7, 0), dndType = prop($$props, "dndType", 7, "categorise"), activeContainerForKeyboard = prop($$props, "activeContainerForKeyboard", 7, void 0), isCollapsed = prop($$props, "isCollapsed", 7, false), onitemdrop = prop($$props, "onitemdrop", 7), onitemselect = prop($$props, "onitemselect", 7), oncontainerclick = prop($$props, "oncontainerclick", 7), onitemfocus = prop($$props, "onitemfocus", 7), onitemblur = prop($$props, "onitemblur", 7), onitemkeydown = prop($$props, "onitemkeydown", 7), ondraghover = prop($$props, "ondraghover", 7), ondragstart = prop($$props, "ondragstart", 7), children = prop($$props, "children", 7);
14962
14987
  let considerItemId = /* @__PURE__ */ state(void 0);
14963
14988
  let isHoveringDrag = /* @__PURE__ */ state(false);
14964
14989
  let dragCounter = /* @__PURE__ */ state(0);
@@ -15112,6 +15137,13 @@ function CategoriseDndContainer($$anchor, $$props) {
15112
15137
  containerLabelHtml($$value);
15113
15138
  flushSync();
15114
15139
  },
15140
+ get containerHasMath() {
15141
+ return containerHasMath();
15142
+ },
15143
+ set containerHasMath($$value = false) {
15144
+ containerHasMath($$value);
15145
+ flushSync();
15146
+ },
15115
15147
  get containerIndex() {
15116
15148
  return containerIndex();
15117
15149
  },
@@ -15283,20 +15315,15 @@ function CategoriseDndContainer($$anchor, $$props) {
15283
15315
  template_effect(() => set_text(text2, `Category ${containerIndex() ?? ""}:`));
15284
15316
  append($$anchor3, fragment_1);
15285
15317
  };
15286
- var alternate = ($$anchor3) => {
15287
- var span_1 = root_3$6();
15288
- var text_1 = child(span_1, true);
15289
- reset(span_1);
15290
- template_effect(() => set_text(text_1, containerLabel()));
15291
- append($$anchor3, span_1);
15292
- };
15293
15318
  if_block(node_1, ($$render) => {
15294
- if (containerLabelHtml()) $$render(consequent);
15295
- else $$render(alternate, false);
15319
+ if (containerHasMath()) $$render(consequent);
15296
15320
  });
15297
15321
  }
15298
15322
  reset(button);
15299
- template_effect(() => set_class(button, 1, `focus-ring absolute inset-0 bg-transparent rounded-lg z-10 pointer-events-auto focus-visible:border ${containerId() === "container-word-bin" ? "focus-visible:border-gray-400" : "focus-visible:border-gray-800"}`));
15323
+ template_effect(() => {
15324
+ set_class(button, 1, `focus-ring absolute inset-0 bg-transparent rounded-lg z-10 pointer-events-auto focus-visible:border ${containerId() === "container-word-bin" ? "focus-visible:border-gray-400" : "focus-visible:border-gray-800"}`);
15325
+ set_attribute(button, "aria-label", !containerHasMath() ? containerLabel() : void 0);
15326
+ });
15300
15327
  append($$anchor2, button);
15301
15328
  };
15302
15329
  if_block(node, ($$render) => {
@@ -15327,7 +15354,7 @@ function CategoriseDndContainer($$anchor, $$props) {
15327
15354
  }
15328
15355
  append($$anchor2, fragment_2);
15329
15356
  };
15330
- var alternate_1 = ($$anchor2) => {
15357
+ var alternate = ($$anchor2) => {
15331
15358
  var fragment_4 = comment();
15332
15359
  var node_6 = first_child(fragment_4);
15333
15360
  {
@@ -15336,11 +15363,11 @@ function CategoriseDndContainer($$anchor, $$props) {
15336
15363
  var node_7 = first_child(fragment_5);
15337
15364
  each(node_7, 19, () => get$1(localItems), (item) => `${item.id}-${get$1(dragCounter)}`, ($$anchor4, item, index2) => {
15338
15365
  const itemResultType = /* @__PURE__ */ user_derived(() => getItemResultType(get$1(item).isClonedItem && get$1(item).cloneId ? get$1(item).cloneId : get$1(item).id));
15339
- var fragment_6 = root_8$2();
15366
+ var fragment_6 = root_7$2();
15340
15367
  var node_8 = first_child(fragment_6);
15341
15368
  {
15342
15369
  var consequent_4 = ($$anchor5) => {
15343
- var div = root_9$2();
15370
+ var div = root_8$2();
15344
15371
  append($$anchor5, div);
15345
15372
  };
15346
15373
  if_block(node_8, ($$render) => {
@@ -15410,7 +15437,7 @@ function CategoriseDndContainer($$anchor, $$props) {
15410
15437
  };
15411
15438
  if_block(node_3, ($$render) => {
15412
15439
  if (get$1(isEmpty)) $$render(consequent_3);
15413
- else $$render(alternate_1, false);
15440
+ else $$render(alternate, false);
15414
15441
  });
15415
15442
  }
15416
15443
  reset(section);
@@ -15433,6 +15460,7 @@ create_custom_element(
15433
15460
  containerId: {},
15434
15461
  containerLabel: {},
15435
15462
  containerLabelHtml: {},
15463
+ containerHasMath: {},
15436
15464
  containerIndex: {},
15437
15465
  containerClass: {},
15438
15466
  showButton: {},
@@ -15459,10 +15487,12 @@ create_custom_element(
15459
15487
  [],
15460
15488
  true
15461
15489
  );
15462
- var root_2$3 = /* @__PURE__ */ from_svg(`<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24" data-testid="icon-chevron-coll"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"></path></svg>`);
15463
- var root_3$5 = /* @__PURE__ */ from_svg(`<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24" data-testid="icon-chevron-exp"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 15l7-7 7 7"></path></svg>`);
15464
- var root_1$7 = /* @__PURE__ */ from_html(`<button type="button" class="focus-ring flex items-center rounded-[32px] p-1.5 text-charcoal text-sm border border-gray-800 bg-gray-50 min-w-[85px] ml-3 whitespace-nowrap active:raw-focus-ring active:bg-black-55"><span class="mx-0.5"> </span> <span class="w-4 h-4 text-inherit flex items-center justify-center"><!></span></button>`);
15465
- var root$5 = /* @__PURE__ */ from_html(`<div role="group" data-testid="cat-ctr"><div><span class="sr-only"> </span> <!> <span class="sr-only"> </span> <!></div> <!></div>`);
15490
+ var root_1$7 = /* @__PURE__ */ from_html(`<span class="sr-only"> </span>`);
15491
+ var root_2$3 = /* @__PURE__ */ from_html(`<span class="sr-only"> </span>`);
15492
+ var root_4 = /* @__PURE__ */ from_svg(`<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24" data-testid="icon-chevron-coll"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"></path></svg>`);
15493
+ var root_5$2 = /* @__PURE__ */ from_svg(`<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24" data-testid="icon-chevron-exp"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 15l7-7 7 7"></path></svg>`);
15494
+ var root_3$5 = /* @__PURE__ */ from_html(`<button type="button" class="focus-ring flex items-center rounded-[32px] p-1.5 text-charcoal text-sm border border-gray-800 bg-gray-50 min-w-[85px] ml-3 whitespace-nowrap active:raw-focus-ring active:bg-black-55"><span class="mx-0.5"> </span> <span class="w-4 h-4 text-inherit flex items-center justify-center"><!></span></button>`);
15495
+ var root$5 = /* @__PURE__ */ from_html(`<div role="group" data-testid="cat-ctr"><div><!> <!> <!> <!></div> <!></div>`);
15466
15496
  function CategoriseCategory($$anchor, $$props) {
15467
15497
  push($$props, true);
15468
15498
  let categoryId = prop($$props, "categoryId", 7), categoryTitle = prop($$props, "categoryTitle", 7), categoryIndex = prop($$props, "categoryIndex", 7, 1), items = prop($$props, "items", 23, () => []), selectedItemId = prop($$props, "selectedItemId", 7, void 0), isLocked = prop($$props, "isLocked", 7, false), isCollapsed = prop($$props, "isCollapsed", 7, false), isDraggingOver = prop($$props, "isDraggingOver", 7, false), dropContainerId = prop($$props, "dropContainerId", 7, void 0), hasAddItemAnimation = prop($$props, "hasAddItemAnimation", 7, false), dragSourceContainerId = prop($$props, "dragSourceContainerId", 7, void 0), mode = prop($$props, "mode", 7), isMobile = prop($$props, "isMobile", 7, false), hasStimulus = prop($$props, "hasStimulus", 7, false), dndType = prop($$props, "dndType", 7, "categorise"), tabindex = prop($$props, "tabindex", 7, 0), activeContainerForKeyboard = prop($$props, "activeContainerForKeyboard", 7, void 0), onitemdrop = prop($$props, "onitemdrop", 7), onitemselect = prop($$props, "onitemselect", 7), oncontainerclick = prop($$props, "oncontainerclick", 7), ontogglecollapse = prop($$props, "ontogglecollapse", 7), onitemfocus = prop($$props, "onitemfocus", 7), onitemblur = prop($$props, "onitemblur", 7), onitemkeydown = prop($$props, "onitemkeydown", 7), onkeydown = prop($$props, "onkeydown", 7), ondraghover = prop($$props, "ondraghover", 7), ondragstart = prop($$props, "ondragstart", 7);
@@ -15493,6 +15523,8 @@ function CategoriseCategory($$anchor, $$props) {
15493
15523
  ${get$1(effectiveIsCollapsed) && isDraggingOver() && get$1(isNotSourceContainer) ? "!bg-violet-100 md:!bg-white" : ""}
15494
15524
  ${get$1(effectiveIsCollapsed) && isMobile() ? "rounded-b-lg md:rounded-b-none" : ""}`);
15495
15525
  const adjustedTabindex = /* @__PURE__ */ user_derived(tabindex);
15526
+ const categoryHasMath = /* @__PURE__ */ user_derived(() => hasMathJax(categoryTitle()));
15527
+ const shouldShowAriaLabel = /* @__PURE__ */ user_derived(() => !get$1(categoryHasMath) && (!get$1(hasSelectedItem) || !get$1(isNotSourceContainer)));
15496
15528
  const handleToggle = () => {
15497
15529
  if (isMobile() && ontogglecollapse()) {
15498
15530
  ontogglecollapse()(categoryId());
@@ -15709,23 +15741,46 @@ function CategoriseCategory($$anchor, $$props) {
15709
15741
  };
15710
15742
  div.__click = handleContainerClick;
15711
15743
  var div_1 = child(div);
15712
- var span = child(div_1);
15713
- var text2 = child(span);
15714
- reset(span);
15715
- var node = sibling(span, 2);
15716
- CommonStringToHtml(node, {
15744
+ var node = child(div_1);
15745
+ {
15746
+ var consequent = ($$anchor2) => {
15747
+ var span = root_1$7();
15748
+ var text2 = child(span);
15749
+ reset(span);
15750
+ template_effect(() => set_text(text2, `Category ${categoryIndex() ?? ""}:`));
15751
+ append($$anchor2, span);
15752
+ };
15753
+ if_block(node, ($$render) => {
15754
+ if (get$1(categoryHasMath)) $$render(consequent);
15755
+ });
15756
+ }
15757
+ var node_1 = sibling(node, 2);
15758
+ CommonStringToHtml(node_1, {
15717
15759
  get htmlString() {
15718
15760
  return categoryTitle();
15719
15761
  },
15720
- otherClass: "text-base leading-5 !text-gray-900 md:item-heading"
15762
+ otherClass: "text-base leading-5 !text-gray-900 md:item-heading",
15763
+ get ariaHidden() {
15764
+ return get$1(shouldShowAriaLabel);
15765
+ }
15721
15766
  });
15722
- var span_1 = sibling(node, 2);
15723
- var text_1 = child(span_1);
15724
- reset(span_1);
15725
- var node_1 = sibling(span_1, 2);
15767
+ var node_2 = sibling(node_1, 2);
15726
15768
  {
15727
15769
  var consequent_1 = ($$anchor2) => {
15728
- var button = root_1$7();
15770
+ var span_1 = root_2$3();
15771
+ var text_1 = child(span_1);
15772
+ reset(span_1);
15773
+ template_effect(() => set_text(text_1, `. ${get$1(getTotalWords) ?? ""} added.`));
15774
+ append($$anchor2, span_1);
15775
+ };
15776
+ if_block(node_2, ($$render) => {
15777
+ if (get$1(categoryHasMath)) $$render(consequent_1);
15778
+ });
15779
+ }
15780
+ var node_3 = sibling(node_2, 2);
15781
+ {
15782
+ var consequent_3 = ($$anchor2) => {
15783
+ var button = root_3$5();
15729
15784
  button.__click = handleToggle;
15730
15785
  button.__keydown = (e2) => {
15731
15786
  if (e2.key === "Enter" || e2.key === " ") {
@@ -15736,18 +15791,18 @@ function CategoriseCategory($$anchor, $$props) {
15736
15791
  var text_2 = child(span_2, true);
15737
15792
  reset(span_2);
15738
15793
  var span_3 = sibling(span_2, 2);
15739
- var node_2 = child(span_3);
15794
+ var node_4 = child(span_3);
15740
15795
  {
15741
- var consequent = ($$anchor3) => {
15742
- var svg = root_2$3();
15796
+ var consequent_2 = ($$anchor3) => {
15797
+ var svg = root_4();
15743
15798
  append($$anchor3, svg);
15744
15799
  };
15745
15800
  var alternate = ($$anchor3) => {
15746
- var svg_1 = root_3$5();
15801
+ var svg_1 = root_5$2();
15747
15802
  append($$anchor3, svg_1);
15748
15803
  };
15749
- if_block(node_2, ($$render) => {
15750
- if (get$1(effectiveIsCollapsed)) $$render(consequent);
15804
+ if_block(node_4, ($$render) => {
15805
+ if (get$1(effectiveIsCollapsed)) $$render(consequent_2);
15751
15806
  else $$render(alternate, false);
15752
15807
  });
15753
15808
  }
@@ -15760,14 +15815,14 @@ function CategoriseCategory($$anchor, $$props) {
15760
15815
  });
15761
15816
  append($$anchor2, button);
15762
15817
  };
15763
- if_block(node_1, ($$render) => {
15764
- if (isMobile()) $$render(consequent_1);
15818
+ if_block(node_3, ($$render) => {
15819
+ if (isMobile()) $$render(consequent_3);
15765
15820
  });
15766
15821
  }
15767
15822
  reset(div_1);
15768
15823
  bind_this(div_1, ($$value) => set(titleElement, $$value), () => get$1(titleElement));
15769
- var node_3 = sibling(div_1, 2);
15770
- key(node_3, () => `${categoryId()}-${get$1(effectiveIsCollapsed)}-${isMobile()}`, ($$anchor2) => {
15824
+ var node_5 = sibling(div_1, 2);
15825
+ key(node_5, () => `${categoryId()}-${get$1(effectiveIsCollapsed)}-${isMobile()}`, ($$anchor2) => {
15771
15826
  {
15772
15827
  const children = ($$anchor3) => {
15773
15828
  };
@@ -15784,6 +15839,9 @@ function CategoriseCategory($$anchor, $$props) {
15784
15839
  get containerLabelHtml() {
15785
15840
  return categoryTitle();
15786
15841
  },
15842
+ get containerHasMath() {
15843
+ return get$1(categoryHasMath);
15844
+ },
15787
15845
  get containerIndex() {
15788
15846
  return categoryIndex();
15789
15847
  },
@@ -15850,10 +15908,9 @@ function CategoriseCategory($$anchor, $$props) {
15850
15908
  bind_this(div, ($$value) => set(categoryElement, $$value), () => get$1(categoryElement));
15851
15909
  template_effect(() => {
15852
15910
  set_attribute(div, "tabindex", get$1(adjustedTabindex));
15911
+ set_attribute(div, "aria-label", get$1(shouldShowAriaLabel) ? `Category ${categoryIndex()}: ${get$1(cleanCategoryTitle)}. ${get$1(getTotalWords)} added.` : void 0);
15853
15912
  set_class(div, 1, `cat-ctr ${get$1(outerClasses) ?? ""}`);
15854
15913
  set_class(div_1, 1, clsx(get$1(titleClasses)));
15855
- set_text(text2, `Category ${categoryIndex() ?? ""}:`);
15856
- set_text(text_1, `. ${get$1(getTotalWords) ?? ""} added.`);
15857
15914
  });
15858
15915
  bind_element_size(div_1, "clientHeight", ($$value) => set(categoryTitleHeight, $$value));
15859
15916
  append($$anchor, div);
@@ -16465,7 +16522,7 @@ var root_2$1 = /* @__PURE__ */ from_html(`<button aria-label="Reset words" class
16465
16522
  text-blue-1000 px-3 py-2 absolute right-0 -top-2.5 hover:bg-blue-100" data-testid="cat-reset-btn"><span class="h-6 w-6 flex items-center justify-center"><!></span> <span class="text-base leading-4 font-bold ml-1 group-hover:underline">Reset <span class="hidden md:inline-block">words</span></span></button>`);
16466
16523
  var root_1$4 = /* @__PURE__ */ from_html(
16467
16524
  `<button type="button" aria-label="Skip to Word Bin" class="flex items-center text-charcoal border-l-6 border-charcoal bg-yellow-1000 py-1.5 pr-3 pl-4 focus-visible:border-charcoal
16468
- left-[-9999px] z-0 focus-within:left-0 focus-within:right-0 focus-within:top-0 absolute focus-within:z-30 focus-visible:outline-none"><span class="test-base font-semibold underline mr-1">Skip to Word Bin</span> <span class="text-inherit h-6 w-6 flex items-center justify-center"><!></span></button> <div class="w-full relative"><div class="sr-only" role="status" aria-live="polite" aria-atomic="true" tabindex="-1"> </div> <div class="mt-7.5 mb-6 relative md:text-center md:mb-8 md:mt-14"><p class="text-base leading-5 !text-gray-900 font-semibold md:item-heading">Categories</p> <!></div> <!> <!> <!></div>`,
16525
+ left-[-9999px] z-0 focus-within:left-0 focus-within:right-0 focus-within:top-0 absolute focus-within:z-30 focus-visible:outline-none"><span class="test-base font-semibold underline mr-1">Skip to Word Bin</span> <span class="text-inherit h-6 w-6 flex items-center justify-center"><!></span></button> <div class="w-full relative"><div role="status" class="sr-only" tabindex="-1"> </div> <div class="mt-7.5 mb-6 relative md:text-center md:mb-8 md:mt-14"><p class="text-base leading-5 !text-gray-900 font-semibold md:item-heading">Categories</p> <!></div> <!> <!> <!></div>`,
16469
16526
  1
16470
16527
  );
16471
16528
  function CategoriseComponent($$anchor, $$props) {
@@ -16543,14 +16600,12 @@ function CategoriseComponent($$anchor, $$props) {
16543
16600
  onstateChange()(new CustomEvent("statechange", { detail: { state: get$1(interactionState), serialized } }));
16544
16601
  }
16545
16602
  };
16546
- const announceToScreenReader = async (message, hasMath = false) => {
16603
+ const announceToScreenReader = async (message) => {
16604
+ const containsMath = hasMathJax(message);
16605
+ const speechText = containsMath ? await getMathJaxSpeechText(processMathJax(message)) : message;
16547
16606
  set(announcement, "");
16548
16607
  await tick();
16549
- set(announcement, message, true);
16550
- await tick();
16551
- if (hasMath && get$1(srDivRef)) {
16552
- await typesetMathJax(get$1(srDivRef));
16553
- }
16608
+ set(announcement, speechText, true);
16554
16609
  setTimeout(
16555
16610
  () => {
16556
16611
  set(announcement, "");
@@ -16638,12 +16693,11 @@ function CategoriseComponent($$anchor, $$props) {
16638
16693
  const targetCategoryIndex = config().category_groups.findIndex((c) => c.id === targetContainerId);
16639
16694
  const targetCategory = targetCategoryIndex >= 0 ? config().category_groups[targetCategoryIndex] : void 0;
16640
16695
  if (item) {
16641
- const itemName = useRemoveRichTextHtmlTags(item.name);
16642
- const categoryName = targetCategory ? useRemoveRichTextHtmlTags(targetCategory.name) : null;
16696
+ const cleanItemName = useRemoveRichTextHtmlTags(item.name);
16697
+ const cleanCategoryName = targetCategory ? useRemoveRichTextHtmlTags(targetCategory.name) : null;
16643
16698
  const itemCount = targetContainerId === CATEGORISE.CONTAINER_WORD_BIN_ID ? get$1(interactionState).data.wordBinItems.length : api().getCategoryItems(get$1(interactionState), targetContainerId).length;
16644
- const message = createItemPlacementAnnouncement(itemName, categoryName, targetCategoryIndex, itemCount, targetContainerId);
16645
- const containsMath = hasMathJax(message);
16646
- await announceToScreenReader(containsMath ? processMathJax(message) : message, containsMath);
16699
+ const message = createItemPlacementAnnouncement(cleanItemName, cleanCategoryName, targetCategoryIndex, itemCount, targetContainerId);
16700
+ await announceToScreenReader(message);
16647
16701
  }
16648
16702
  await playDropAnimation(targetContainerId);
16649
16703
  };
@@ -16694,12 +16748,11 @@ function CategoriseComponent($$anchor, $$props) {
16694
16748
  const targetCategoryIndex = containerId === CATEGORISE.CONTAINER_WORD_BIN_ID ? -1 : config().category_groups.findIndex((c) => c.id === containerId);
16695
16749
  const targetCategory = targetCategoryIndex >= 0 ? config().category_groups[targetCategoryIndex] : null;
16696
16750
  if (item) {
16697
- const itemName = useRemoveRichTextHtmlTags(item.name);
16698
- const categoryName = targetCategory ? useRemoveRichTextHtmlTags(targetCategory.name) : null;
16751
+ const cleanItemName = useRemoveRichTextHtmlTags(item.name);
16752
+ const cleanCategoryName = targetCategory ? useRemoveRichTextHtmlTags(targetCategory.name) : null;
16699
16753
  const itemCount = containerId === CATEGORISE.CONTAINER_WORD_BIN_ID ? get$1(interactionState).data.wordBinItems.length : api().getCategoryItems(get$1(interactionState), containerId).length;
16700
- const message = createItemPlacementAnnouncement(itemName, categoryName, targetCategoryIndex, itemCount, containerId);
16701
- const containsMath = hasMathJax(message);
16702
- await announceToScreenReader(containsMath ? processMathJax(message) : message, containsMath);
16754
+ const message = createItemPlacementAnnouncement(cleanItemName, cleanCategoryName, targetCategoryIndex, itemCount, containerId);
16755
+ await announceToScreenReader(message);
16703
16756
  }
16704
16757
  await playDropAnimation(containerId);
16705
16758
  await tick();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "eat-js-sdk",
3
- "version": "2.4.2",
4
- "change version": "2.4.0",
3
+ "version": "2.5.1",
4
+ "change version": "2.5.0",
5
5
  "description": "Authoring tool frontend SDK",
6
6
  "contributors": [
7
7
  {