eat-js-sdk 0.0.8 → 0.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -562,7 +562,7 @@
562
562
  }
563
563
  component.$$.dirty[i / 31 | 0] |= 1 << i % 31;
564
564
  }
565
- function init(component, options, instance6, create_fragment7, not_equal, props, append_styles2 = null, dirty = [-1]) {
565
+ function init(component, options, instance7, create_fragment11, not_equal, props, append_styles2 = null, dirty = [-1]) {
566
566
  const parent_component = current_component;
567
567
  set_current_component(component);
568
568
  const $$ = component.$$ = {
@@ -588,7 +588,7 @@
588
588
  };
589
589
  append_styles2 && append_styles2($$.root);
590
590
  let ready = false;
591
- $$.ctx = instance6 ? instance6(component, options.props || {}, (i, ret, ...rest) => {
591
+ $$.ctx = instance7 ? instance7(component, options.props || {}, (i, ret, ...rest) => {
592
592
  const value = rest.length ? rest[0] : ret;
593
593
  if ($$.ctx && not_equal($$.ctx[i], $$.ctx[i] = value)) {
594
594
  if (!$$.skip_bound && $$.bound[i])
@@ -601,7 +601,7 @@
601
601
  $$.update();
602
602
  ready = true;
603
603
  run_all($$.before_update);
604
- $$.fragment = create_fragment7 ? create_fragment7($$.ctx) : false;
604
+ $$.fragment = create_fragment11 ? create_fragment11($$.ctx) : false;
605
605
  if (options.target) {
606
606
  if (options.hydrate) {
607
607
  start_hydrating();
@@ -1244,6 +1244,389 @@
1244
1244
  customElements.define("prompt-body", create_custom_element(PromptBody, { "rubric": {}, "prompt": {} }, ["default"], [], true));
1245
1245
  var PromptBody_default = PromptBody;
1246
1246
 
1247
+ // src/lib/assets/img/messaging/SuccessSolid.svelte
1248
+ function create_fragment2(ctx) {
1249
+ let svg;
1250
+ let path;
1251
+ return {
1252
+ c() {
1253
+ svg = svg_element("svg");
1254
+ path = svg_element("path");
1255
+ attr(path, "fill-rule", "evenodd");
1256
+ attr(path, "clip-rule", "evenodd");
1257
+ attr(path, "d", "M10 0C15.5228 0 20 4.47715 20 10C20 15.5228 15.5228 20 10 20C4.47715 20 0 15.5228 0 10C0 4.47715 4.47715 0 10 0ZM14.7284 6.79289C14.3378 6.40237 13.7047 6.40237 13.3141 6.79289L8.02125 12.0858L6.20711 10.2716C5.81658 9.88112 5.18342 9.88112 4.79289 10.2716C4.40237 10.6622 4.40237 11.2953 4.79289 11.6859L7.31414 14.2071C7.70467 14.5976 8.33783 14.5976 8.72836 14.2071L14.7284 8.20711C15.1189 7.81658 15.1189 7.18342 14.7284 6.79289Z");
1258
+ attr(path, "fill", "currentColor");
1259
+ attr(svg, "width", "20");
1260
+ attr(svg, "height", "20");
1261
+ attr(svg, "viewBox", "0 0 20 20");
1262
+ attr(svg, "fill", "none");
1263
+ attr(svg, "xmlns", "http://www.w3.org/2000/svg");
1264
+ },
1265
+ m(target, anchor) {
1266
+ insert(target, svg, anchor);
1267
+ append(svg, path);
1268
+ },
1269
+ p: noop,
1270
+ i: noop,
1271
+ o: noop,
1272
+ d(detaching) {
1273
+ if (detaching) {
1274
+ detach(svg);
1275
+ }
1276
+ }
1277
+ };
1278
+ }
1279
+ var SuccessSolid = class extends SvelteComponent {
1280
+ constructor(options) {
1281
+ super();
1282
+ init(this, options, null, create_fragment2, safe_not_equal, {});
1283
+ }
1284
+ };
1285
+ create_custom_element(SuccessSolid, {}, [], [], true);
1286
+ var SuccessSolid_default = SuccessSolid;
1287
+
1288
+ // src/lib/assets/img/messaging/InfoSolid.svelte
1289
+ function create_fragment3(ctx) {
1290
+ let svg;
1291
+ let path;
1292
+ return {
1293
+ c() {
1294
+ svg = svg_element("svg");
1295
+ path = svg_element("path");
1296
+ attr(path, "fill-rule", "evenodd");
1297
+ attr(path, "clip-rule", "evenodd");
1298
+ attr(path, "d", "M10 0C15.5228 0 20 4.47715 20 10C20 15.5228 15.5228 20 10 20C4.47715 20 0 15.5228 0 10C0 4.47715 4.47715 0 10 0ZM10 9C9.44772 9 9 9.44772 9 10V14.5C9 15.0523 9.44772 15.5 10 15.5C10.5523 15.5 11 15.0523 11 14.5V10C11 9.44772 10.5523 9 10 9ZM10 5C9.44772 5 9 5.44772 9 6C9 6.55228 9.44772 7 10 7C10.5523 7 11 6.55228 11 6C11 5.44772 10.5523 5 10 5Z");
1299
+ attr(path, "fill", "currentColor");
1300
+ attr(svg, "width", "20");
1301
+ attr(svg, "height", "20");
1302
+ attr(svg, "viewBox", "0 0 20 20");
1303
+ attr(svg, "fill", "none");
1304
+ attr(svg, "xmlns", "http://www.w3.org/2000/svg");
1305
+ },
1306
+ m(target, anchor) {
1307
+ insert(target, svg, anchor);
1308
+ append(svg, path);
1309
+ },
1310
+ p: noop,
1311
+ i: noop,
1312
+ o: noop,
1313
+ d(detaching) {
1314
+ if (detaching) {
1315
+ detach(svg);
1316
+ }
1317
+ }
1318
+ };
1319
+ }
1320
+ var InfoSolid = class extends SvelteComponent {
1321
+ constructor(options) {
1322
+ super();
1323
+ init(this, options, null, create_fragment3, safe_not_equal, {});
1324
+ }
1325
+ };
1326
+ create_custom_element(InfoSolid, {}, [], [], true);
1327
+ var InfoSolid_default = InfoSolid;
1328
+
1329
+ // src/lib/components/prompt/template/PromptResultFeedback.svelte
1330
+ function create_if_block2(ctx) {
1331
+ let div0;
1332
+ let span0;
1333
+ let current_block_type_index;
1334
+ let if_block;
1335
+ let span0_class_value;
1336
+ let t0;
1337
+ let span3;
1338
+ let span1;
1339
+ let t1;
1340
+ let t2;
1341
+ let span2;
1342
+ let t3;
1343
+ let div0_class_value;
1344
+ let t4;
1345
+ let div1;
1346
+ let current;
1347
+ const if_block_creators = [create_if_block_12, create_else_block];
1348
+ const if_blocks = [];
1349
+ function select_block_type(ctx2, dirty) {
1350
+ if (
1351
+ /*isResultCorrect*/
1352
+ ctx2[2]
1353
+ )
1354
+ return 0;
1355
+ return 1;
1356
+ }
1357
+ current_block_type_index = select_block_type(ctx, -1);
1358
+ if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);
1359
+ return {
1360
+ c() {
1361
+ div0 = element("div");
1362
+ span0 = element("span");
1363
+ if_block.c();
1364
+ t0 = space();
1365
+ span3 = element("span");
1366
+ span1 = element("span");
1367
+ t1 = text(
1368
+ /*resultFeedbackTitle*/
1369
+ ctx[1]
1370
+ );
1371
+ t2 = space();
1372
+ span2 = element("span");
1373
+ t3 = text(
1374
+ /*resultFeedback*/
1375
+ ctx[0]
1376
+ );
1377
+ t4 = space();
1378
+ div1 = element("div");
1379
+ attr(span0, "class", span0_class_value = "mr-2 p-0.5 " + /*isResultCorrect*/
1380
+ (ctx[2] ? "text-green-800" : "text-red-800"));
1381
+ attr(span1, "class", "block mb-1 font-semibold");
1382
+ attr(span3, "class", "text-base");
1383
+ attr(div0, "class", div0_class_value = "flex items-start my-6 p-4 border-l-[6px] text-charcoal " + /*isResultCorrect*/
1384
+ (ctx[2] ? "border-green-800 bg-green-300" : "border-red-800 bg-red-300"));
1385
+ attr(div1, "class", "divider my-6");
1386
+ },
1387
+ m(target, anchor) {
1388
+ insert(target, div0, anchor);
1389
+ append(div0, span0);
1390
+ if_blocks[current_block_type_index].m(span0, null);
1391
+ append(div0, t0);
1392
+ append(div0, span3);
1393
+ append(span3, span1);
1394
+ append(span1, t1);
1395
+ append(span3, t2);
1396
+ append(span3, span2);
1397
+ append(span2, t3);
1398
+ insert(target, t4, anchor);
1399
+ insert(target, div1, anchor);
1400
+ current = true;
1401
+ },
1402
+ p(ctx2, dirty) {
1403
+ let previous_block_index = current_block_type_index;
1404
+ current_block_type_index = select_block_type(ctx2, dirty);
1405
+ if (current_block_type_index !== previous_block_index) {
1406
+ group_outros();
1407
+ transition_out(if_blocks[previous_block_index], 1, 1, () => {
1408
+ if_blocks[previous_block_index] = null;
1409
+ });
1410
+ check_outros();
1411
+ if_block = if_blocks[current_block_type_index];
1412
+ if (!if_block) {
1413
+ if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx2);
1414
+ if_block.c();
1415
+ } else {
1416
+ }
1417
+ transition_in(if_block, 1);
1418
+ if_block.m(span0, null);
1419
+ }
1420
+ if (!current || dirty & /*isResultCorrect*/
1421
+ 4 && span0_class_value !== (span0_class_value = "mr-2 p-0.5 " + /*isResultCorrect*/
1422
+ (ctx2[2] ? "text-green-800" : "text-red-800"))) {
1423
+ attr(span0, "class", span0_class_value);
1424
+ }
1425
+ if (!current || dirty & /*resultFeedbackTitle*/
1426
+ 2)
1427
+ set_data(
1428
+ t1,
1429
+ /*resultFeedbackTitle*/
1430
+ ctx2[1]
1431
+ );
1432
+ if (!current || dirty & /*resultFeedback*/
1433
+ 1)
1434
+ set_data(
1435
+ t3,
1436
+ /*resultFeedback*/
1437
+ ctx2[0]
1438
+ );
1439
+ if (!current || dirty & /*isResultCorrect*/
1440
+ 4 && div0_class_value !== (div0_class_value = "flex items-start my-6 p-4 border-l-[6px] text-charcoal " + /*isResultCorrect*/
1441
+ (ctx2[2] ? "border-green-800 bg-green-300" : "border-red-800 bg-red-300"))) {
1442
+ attr(div0, "class", div0_class_value);
1443
+ }
1444
+ },
1445
+ i(local) {
1446
+ if (current)
1447
+ return;
1448
+ transition_in(if_block);
1449
+ current = true;
1450
+ },
1451
+ o(local) {
1452
+ transition_out(if_block);
1453
+ current = false;
1454
+ },
1455
+ d(detaching) {
1456
+ if (detaching) {
1457
+ detach(div0);
1458
+ detach(t4);
1459
+ detach(div1);
1460
+ }
1461
+ if_blocks[current_block_type_index].d();
1462
+ }
1463
+ };
1464
+ }
1465
+ function create_else_block(ctx) {
1466
+ let infosolid;
1467
+ let current;
1468
+ infosolid = new InfoSolid_default({});
1469
+ return {
1470
+ c() {
1471
+ create_component(infosolid.$$.fragment);
1472
+ },
1473
+ m(target, anchor) {
1474
+ mount_component(infosolid, target, anchor);
1475
+ current = true;
1476
+ },
1477
+ i(local) {
1478
+ if (current)
1479
+ return;
1480
+ transition_in(infosolid.$$.fragment, local);
1481
+ current = true;
1482
+ },
1483
+ o(local) {
1484
+ transition_out(infosolid.$$.fragment, local);
1485
+ current = false;
1486
+ },
1487
+ d(detaching) {
1488
+ destroy_component(infosolid, detaching);
1489
+ }
1490
+ };
1491
+ }
1492
+ function create_if_block_12(ctx) {
1493
+ let successsolid;
1494
+ let current;
1495
+ successsolid = new SuccessSolid_default({});
1496
+ return {
1497
+ c() {
1498
+ create_component(successsolid.$$.fragment);
1499
+ },
1500
+ m(target, anchor) {
1501
+ mount_component(successsolid, target, anchor);
1502
+ current = true;
1503
+ },
1504
+ i(local) {
1505
+ if (current)
1506
+ return;
1507
+ transition_in(successsolid.$$.fragment, local);
1508
+ current = true;
1509
+ },
1510
+ o(local) {
1511
+ transition_out(successsolid.$$.fragment, local);
1512
+ current = false;
1513
+ },
1514
+ d(detaching) {
1515
+ destroy_component(successsolid, detaching);
1516
+ }
1517
+ };
1518
+ }
1519
+ function create_fragment4(ctx) {
1520
+ let if_block_anchor;
1521
+ let current;
1522
+ let if_block = (
1523
+ /*resultFeedback*/
1524
+ ctx[0] && create_if_block2(ctx)
1525
+ );
1526
+ return {
1527
+ c() {
1528
+ if (if_block)
1529
+ if_block.c();
1530
+ if_block_anchor = empty();
1531
+ },
1532
+ m(target, anchor) {
1533
+ if (if_block)
1534
+ if_block.m(target, anchor);
1535
+ insert(target, if_block_anchor, anchor);
1536
+ current = true;
1537
+ },
1538
+ p(ctx2, [dirty]) {
1539
+ if (
1540
+ /*resultFeedback*/
1541
+ ctx2[0]
1542
+ ) {
1543
+ if (if_block) {
1544
+ if_block.p(ctx2, dirty);
1545
+ if (dirty & /*resultFeedback*/
1546
+ 1) {
1547
+ transition_in(if_block, 1);
1548
+ }
1549
+ } else {
1550
+ if_block = create_if_block2(ctx2);
1551
+ if_block.c();
1552
+ transition_in(if_block, 1);
1553
+ if_block.m(if_block_anchor.parentNode, if_block_anchor);
1554
+ }
1555
+ } else if (if_block) {
1556
+ group_outros();
1557
+ transition_out(if_block, 1, 1, () => {
1558
+ if_block = null;
1559
+ });
1560
+ check_outros();
1561
+ }
1562
+ },
1563
+ i(local) {
1564
+ if (current)
1565
+ return;
1566
+ transition_in(if_block);
1567
+ current = true;
1568
+ },
1569
+ o(local) {
1570
+ transition_out(if_block);
1571
+ current = false;
1572
+ },
1573
+ d(detaching) {
1574
+ if (detaching) {
1575
+ detach(if_block_anchor);
1576
+ }
1577
+ if (if_block)
1578
+ if_block.d(detaching);
1579
+ }
1580
+ };
1581
+ }
1582
+ function instance2($$self, $$props, $$invalidate) {
1583
+ let { resultFeedback = null } = $$props;
1584
+ let { resultFeedbackTitle = null } = $$props;
1585
+ let { isResultCorrect: isResultCorrect2 = true } = $$props;
1586
+ $$self.$$set = ($$props2) => {
1587
+ if ("resultFeedback" in $$props2)
1588
+ $$invalidate(0, resultFeedback = $$props2.resultFeedback);
1589
+ if ("resultFeedbackTitle" in $$props2)
1590
+ $$invalidate(1, resultFeedbackTitle = $$props2.resultFeedbackTitle);
1591
+ if ("isResultCorrect" in $$props2)
1592
+ $$invalidate(2, isResultCorrect2 = $$props2.isResultCorrect);
1593
+ };
1594
+ return [resultFeedback, resultFeedbackTitle, isResultCorrect2];
1595
+ }
1596
+ var PromptResultFeedback = class extends SvelteComponent {
1597
+ constructor(options) {
1598
+ super();
1599
+ init(this, options, instance2, create_fragment4, safe_not_equal, {
1600
+ resultFeedback: 0,
1601
+ resultFeedbackTitle: 1,
1602
+ isResultCorrect: 2
1603
+ });
1604
+ }
1605
+ get resultFeedback() {
1606
+ return this.$$.ctx[0];
1607
+ }
1608
+ set resultFeedback(resultFeedback) {
1609
+ this.$$set({ resultFeedback });
1610
+ flush();
1611
+ }
1612
+ get resultFeedbackTitle() {
1613
+ return this.$$.ctx[1];
1614
+ }
1615
+ set resultFeedbackTitle(resultFeedbackTitle) {
1616
+ this.$$set({ resultFeedbackTitle });
1617
+ flush();
1618
+ }
1619
+ get isResultCorrect() {
1620
+ return this.$$.ctx[2];
1621
+ }
1622
+ set isResultCorrect(isResultCorrect2) {
1623
+ this.$$set({ isResultCorrect: isResultCorrect2 });
1624
+ flush();
1625
+ }
1626
+ };
1627
+ customElements.define("prompt-result-feedback", create_custom_element(PromptResultFeedback, { "resultFeedback": {}, "resultFeedbackTitle": {}, "isResultCorrect": { "type": "Boolean" } }, [], [], true));
1628
+ var PromptResultFeedback_default = PromptResultFeedback;
1629
+
1247
1630
  // src/lib/composables/useMCQ.ts
1248
1631
  var useAlphabetEquivalent = (index) => {
1249
1632
  const alphabetArr = [
@@ -1278,27 +1661,72 @@
1278
1661
  };
1279
1662
  var useMCQ_default = useAlphabetEquivalent;
1280
1663
 
1664
+ // src/lib/assets/img/messaging/ErrorSolid.svelte
1665
+ function create_fragment5(ctx) {
1666
+ let svg;
1667
+ let path;
1668
+ return {
1669
+ c() {
1670
+ svg = svg_element("svg");
1671
+ path = svg_element("path");
1672
+ attr(path, "fill-rule", "evenodd");
1673
+ attr(path, "clip-rule", "evenodd");
1674
+ attr(path, "d", "M10 0C15.5228 0 20 4.47715 20 10C20 15.5228 15.5228 20 10 20C4.47715 20 0 15.5228 0 10C0 4.47715 4.47715 0 10 0ZM7.70711 6.29289C7.31658 5.90237 6.68342 5.90237 6.29289 6.29289C5.90237 6.68342 5.90237 7.31658 6.29289 7.70711L8.585 10L6.29289 12.2929C5.93241 12.6534 5.90468 13.2206 6.2097 13.6129L6.29289 13.7071C6.68342 14.0976 7.31658 14.0976 7.70711 13.7071L10 11.415L12.2929 13.7071C12.6534 14.0676 13.2206 14.0953 13.6129 13.7903L13.7071 13.7071C14.0976 13.3166 14.0976 12.6834 13.7071 12.2929L11.415 10L13.7071 7.70711C14.0676 7.34662 14.0953 6.77939 13.7903 6.3871L13.7071 6.29289C13.3166 5.90237 12.6834 5.90237 12.2929 6.29289L10 8.585L7.70711 6.29289Z");
1675
+ attr(path, "fill", "currentColor");
1676
+ attr(svg, "width", "20");
1677
+ attr(svg, "height", "20");
1678
+ attr(svg, "viewBox", "0 0 20 20");
1679
+ attr(svg, "fill", "none");
1680
+ attr(svg, "xmlns", "http://www.w3.org/2000/svg");
1681
+ },
1682
+ m(target, anchor) {
1683
+ insert(target, svg, anchor);
1684
+ append(svg, path);
1685
+ },
1686
+ p: noop,
1687
+ i: noop,
1688
+ o: noop,
1689
+ d(detaching) {
1690
+ if (detaching) {
1691
+ detach(svg);
1692
+ }
1693
+ }
1694
+ };
1695
+ }
1696
+ var ErrorSolid = class extends SvelteComponent {
1697
+ constructor(options) {
1698
+ super();
1699
+ init(this, options, null, create_fragment5, safe_not_equal, {});
1700
+ }
1701
+ };
1702
+ create_custom_element(ErrorSolid, {}, [], [], true);
1703
+ var ErrorSolid_default = ErrorSolid;
1704
+
1281
1705
  // src/lib/components/prompt/mcq/PromptMCQ.svelte
1282
1706
  function get_each_context(ctx, list, i) {
1283
1707
  const child_ctx = ctx.slice();
1284
- child_ctx[11] = list[i][0];
1285
- child_ctx[12] = list[i][1];
1286
- child_ctx[14] = i;
1708
+ child_ctx[15] = list[i][0];
1709
+ child_ctx[16] = list[i][1];
1710
+ child_ctx[18] = i;
1287
1711
  return child_ctx;
1288
1712
  }
1289
- function create_if_block2(ctx) {
1713
+ function create_if_block_13(ctx) {
1290
1714
  let div1;
1291
1715
  let div0;
1292
1716
  let div0_class_value;
1293
1717
  let t2;
1718
+ let current;
1294
1719
  let each_value = ensure_array_like(Object.entries(
1295
1720
  /*options*/
1296
- ctx[4]
1721
+ ctx[7]
1297
1722
  ));
1298
1723
  let each_blocks = [];
1299
1724
  for (let i = 0; i < each_value.length; i += 1) {
1300
1725
  each_blocks[i] = create_each_block(get_each_context(ctx, each_value, i));
1301
1726
  }
1727
+ const out = (i) => transition_out(each_blocks[i], 1, 1, () => {
1728
+ each_blocks[i] = null;
1729
+ });
1302
1730
  return {
1303
1731
  c() {
1304
1732
  div1 = element("div");
@@ -1320,35 +1748,54 @@
1320
1748
  each_blocks[i].m(div1, null);
1321
1749
  }
1322
1750
  }
1751
+ current = true;
1323
1752
  },
1324
1753
  p(ctx2, dirty) {
1325
- if (dirty & /*isDataSaving*/
1754
+ if (!current || dirty & /*isDataSaving*/
1326
1755
  1 && div0_class_value !== (div0_class_value = /*isDataSaving*/
1327
1756
  ctx2[0] ? "absolute inset-0 bg-transparent z-50" : "")) {
1328
1757
  attr(div0, "class", div0_class_value);
1329
1758
  }
1330
- if (dirty & /*selectedOption, Object, options, handleOptionClick*/
1331
- 50) {
1759
+ if (dirty & /*selectedOption, Object, options, isFinished, isResultCorrect, handleOptionClick*/
1760
+ 398) {
1332
1761
  each_value = ensure_array_like(Object.entries(
1333
1762
  /*options*/
1334
- ctx2[4]
1763
+ ctx2[7]
1335
1764
  ));
1336
1765
  let i;
1337
1766
  for (i = 0; i < each_value.length; i += 1) {
1338
1767
  const child_ctx = get_each_context(ctx2, each_value, i);
1339
1768
  if (each_blocks[i]) {
1340
1769
  each_blocks[i].p(child_ctx, dirty);
1770
+ transition_in(each_blocks[i], 1);
1341
1771
  } else {
1342
1772
  each_blocks[i] = create_each_block(child_ctx);
1343
1773
  each_blocks[i].c();
1774
+ transition_in(each_blocks[i], 1);
1344
1775
  each_blocks[i].m(div1, null);
1345
1776
  }
1346
1777
  }
1347
- for (; i < each_blocks.length; i += 1) {
1348
- each_blocks[i].d(1);
1778
+ group_outros();
1779
+ for (i = each_value.length; i < each_blocks.length; i += 1) {
1780
+ out(i);
1349
1781
  }
1350
- each_blocks.length = each_value.length;
1782
+ check_outros();
1783
+ }
1784
+ },
1785
+ i(local) {
1786
+ if (current)
1787
+ return;
1788
+ for (let i = 0; i < each_value.length; i += 1) {
1789
+ transition_in(each_blocks[i]);
1790
+ }
1791
+ current = true;
1792
+ },
1793
+ o(local) {
1794
+ each_blocks = each_blocks.filter(Boolean);
1795
+ for (let i = 0; i < each_blocks.length; i += 1) {
1796
+ transition_out(each_blocks[i]);
1351
1797
  }
1798
+ current = false;
1352
1799
  },
1353
1800
  d(detaching) {
1354
1801
  if (detaching) {
@@ -1358,86 +1805,276 @@
1358
1805
  }
1359
1806
  };
1360
1807
  }
1808
+ function create_if_block_2(ctx) {
1809
+ let span;
1810
+ let current_block_type_index;
1811
+ let if_block;
1812
+ let span_class_value;
1813
+ let current;
1814
+ const if_block_creators = [create_if_block_3, create_else_block2];
1815
+ const if_blocks = [];
1816
+ function select_block_type(ctx2, dirty) {
1817
+ if (
1818
+ /*isResultCorrect*/
1819
+ ctx2[2]
1820
+ )
1821
+ return 0;
1822
+ return 1;
1823
+ }
1824
+ current_block_type_index = select_block_type(ctx, -1);
1825
+ if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);
1826
+ return {
1827
+ c() {
1828
+ span = element("span");
1829
+ if_block.c();
1830
+ attr(span, "class", span_class_value = /*isResultCorrect*/
1831
+ (ctx[2] ? "text-green-800" : "text-red-800") + " p-0.5");
1832
+ },
1833
+ m(target, anchor) {
1834
+ insert(target, span, anchor);
1835
+ if_blocks[current_block_type_index].m(span, null);
1836
+ current = true;
1837
+ },
1838
+ p(ctx2, dirty) {
1839
+ let previous_block_index = current_block_type_index;
1840
+ current_block_type_index = select_block_type(ctx2, dirty);
1841
+ if (current_block_type_index !== previous_block_index) {
1842
+ group_outros();
1843
+ transition_out(if_blocks[previous_block_index], 1, 1, () => {
1844
+ if_blocks[previous_block_index] = null;
1845
+ });
1846
+ check_outros();
1847
+ if_block = if_blocks[current_block_type_index];
1848
+ if (!if_block) {
1849
+ if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx2);
1850
+ if_block.c();
1851
+ } else {
1852
+ }
1853
+ transition_in(if_block, 1);
1854
+ if_block.m(span, null);
1855
+ }
1856
+ if (!current || dirty & /*isResultCorrect*/
1857
+ 4 && span_class_value !== (span_class_value = /*isResultCorrect*/
1858
+ (ctx2[2] ? "text-green-800" : "text-red-800") + " p-0.5")) {
1859
+ attr(span, "class", span_class_value);
1860
+ }
1861
+ },
1862
+ i(local) {
1863
+ if (current)
1864
+ return;
1865
+ transition_in(if_block);
1866
+ current = true;
1867
+ },
1868
+ o(local) {
1869
+ transition_out(if_block);
1870
+ current = false;
1871
+ },
1872
+ d(detaching) {
1873
+ if (detaching) {
1874
+ detach(span);
1875
+ }
1876
+ if_blocks[current_block_type_index].d();
1877
+ }
1878
+ };
1879
+ }
1880
+ function create_else_block2(ctx) {
1881
+ let errorsolid;
1882
+ let current;
1883
+ errorsolid = new ErrorSolid_default({});
1884
+ return {
1885
+ c() {
1886
+ create_component(errorsolid.$$.fragment);
1887
+ },
1888
+ m(target, anchor) {
1889
+ mount_component(errorsolid, target, anchor);
1890
+ current = true;
1891
+ },
1892
+ i(local) {
1893
+ if (current)
1894
+ return;
1895
+ transition_in(errorsolid.$$.fragment, local);
1896
+ current = true;
1897
+ },
1898
+ o(local) {
1899
+ transition_out(errorsolid.$$.fragment, local);
1900
+ current = false;
1901
+ },
1902
+ d(detaching) {
1903
+ destroy_component(errorsolid, detaching);
1904
+ }
1905
+ };
1906
+ }
1907
+ function create_if_block_3(ctx) {
1908
+ let successsolid;
1909
+ let current;
1910
+ successsolid = new SuccessSolid_default({});
1911
+ return {
1912
+ c() {
1913
+ create_component(successsolid.$$.fragment);
1914
+ },
1915
+ m(target, anchor) {
1916
+ mount_component(successsolid, target, anchor);
1917
+ current = true;
1918
+ },
1919
+ i(local) {
1920
+ if (current)
1921
+ return;
1922
+ transition_in(successsolid.$$.fragment, local);
1923
+ current = true;
1924
+ },
1925
+ o(local) {
1926
+ transition_out(successsolid.$$.fragment, local);
1927
+ current = false;
1928
+ },
1929
+ d(detaching) {
1930
+ destroy_component(successsolid, detaching);
1931
+ }
1932
+ };
1933
+ }
1361
1934
  function create_each_block(ctx) {
1362
1935
  let button;
1363
- let span;
1936
+ let span1;
1937
+ let span0;
1364
1938
  let t1;
1365
1939
  let t2_value = (
1366
1940
  /*option*/
1367
- ctx[12].answer + ""
1941
+ ctx[16].answer + ""
1368
1942
  );
1369
1943
  let t2;
1370
1944
  let t3;
1945
+ let t4;
1371
1946
  let button_aria_label_value;
1372
1947
  let button_class_value;
1948
+ let current;
1373
1949
  let mounted;
1374
1950
  let dispose;
1951
+ let if_block = (
1952
+ /*selectedOption*/
1953
+ ctx[3] === /*option*/
1954
+ ctx[16].id && /*isFinished*/
1955
+ ctx[1] && create_if_block_2(ctx)
1956
+ );
1375
1957
  function click_handler() {
1376
1958
  return (
1377
1959
  /*click_handler*/
1378
- ctx[7](
1960
+ ctx[10](
1379
1961
  /*option*/
1380
- ctx[12]
1962
+ ctx[16]
1381
1963
  )
1382
1964
  );
1383
1965
  }
1384
1966
  return {
1385
1967
  c() {
1386
1968
  button = element("button");
1387
- span = element("span");
1388
- span.textContent = `${useMCQ_default(
1969
+ span1 = element("span");
1970
+ span0 = element("span");
1971
+ span0.textContent = `${useMCQ_default(
1389
1972
  /*index*/
1390
- ctx[14]
1973
+ ctx[18]
1391
1974
  )}`;
1392
1975
  t1 = space();
1393
1976
  t2 = text(t2_value);
1394
1977
  t3 = space();
1395
- attr(span, "class", "choice group-active:border-2 group-active:border-blue-1000 group-active:p-[7px]");
1978
+ if (if_block)
1979
+ if_block.c();
1980
+ t4 = space();
1981
+ attr(span0, "class", "choice group-active:border-2 group-active:border-blue-1000 group-active:p-[7px]");
1982
+ attr(span1, "class", "grow flex items-center");
1396
1983
  attr(button, "aria-label", button_aria_label_value = `${/*selectedOption*/
1397
- ctx[1] === /*option*/
1398
- ctx[12].id ? "Selected option" : "Option"} ${useMCQ_default(
1984
+ ctx[3] === /*option*/
1985
+ ctx[16].id ? "Selected option" : "Option"} ${useMCQ_default(
1399
1986
  /*index*/
1400
- ctx[14]
1987
+ ctx[18]
1401
1988
  )}: ${/*option*/
1402
- ctx[12].answer}`);
1989
+ ctx[16].answer}`);
1403
1990
  attr(button, "class", button_class_value = "btn-mcq-option group text-left " + /*selectedOption*/
1404
- (ctx[1] === /*option*/
1405
- ctx[12].id ? "selected" : ""));
1991
+ (ctx[3] === /*option*/
1992
+ ctx[16].id ? "selected" : "") + " " + (!/*isFinished*/
1993
+ ctx[1] ? "" : (
1994
+ /*isResultCorrect*/
1995
+ ctx[2] ? "correct" : "incorrect"
1996
+ )));
1406
1997
  },
1407
1998
  m(target, anchor) {
1408
1999
  insert(target, button, anchor);
1409
- append(button, span);
1410
- append(button, t1);
1411
- append(button, t2);
2000
+ append(button, span1);
2001
+ append(span1, span0);
2002
+ append(span1, t1);
2003
+ append(span1, t2);
1412
2004
  append(button, t3);
2005
+ if (if_block)
2006
+ if_block.m(button, null);
2007
+ append(button, t4);
2008
+ current = true;
1413
2009
  if (!mounted) {
1414
2010
  dispose = listen(button, "click", click_handler);
1415
2011
  mounted = true;
1416
2012
  }
1417
- },
1418
- p(new_ctx, dirty) {
1419
- ctx = new_ctx;
1420
- if (dirty & /*selectedOption*/
1421
- 2 && button_aria_label_value !== (button_aria_label_value = `${/*selectedOption*/
1422
- ctx[1] === /*option*/
1423
- ctx[12].id ? "Selected option" : "Option"} ${useMCQ_default(
2013
+ },
2014
+ p(new_ctx, dirty) {
2015
+ ctx = new_ctx;
2016
+ if (
2017
+ /*selectedOption*/
2018
+ ctx[3] === /*option*/
2019
+ ctx[16].id && /*isFinished*/
2020
+ ctx[1]
2021
+ ) {
2022
+ if (if_block) {
2023
+ if_block.p(ctx, dirty);
2024
+ if (dirty & /*selectedOption, isFinished*/
2025
+ 10) {
2026
+ transition_in(if_block, 1);
2027
+ }
2028
+ } else {
2029
+ if_block = create_if_block_2(ctx);
2030
+ if_block.c();
2031
+ transition_in(if_block, 1);
2032
+ if_block.m(button, t4);
2033
+ }
2034
+ } else if (if_block) {
2035
+ group_outros();
2036
+ transition_out(if_block, 1, 1, () => {
2037
+ if_block = null;
2038
+ });
2039
+ check_outros();
2040
+ }
2041
+ if (!current || dirty & /*selectedOption*/
2042
+ 8 && button_aria_label_value !== (button_aria_label_value = `${/*selectedOption*/
2043
+ ctx[3] === /*option*/
2044
+ ctx[16].id ? "Selected option" : "Option"} ${useMCQ_default(
1424
2045
  /*index*/
1425
- ctx[14]
2046
+ ctx[18]
1426
2047
  )}: ${/*option*/
1427
- ctx[12].answer}`)) {
2048
+ ctx[16].answer}`)) {
1428
2049
  attr(button, "aria-label", button_aria_label_value);
1429
2050
  }
1430
- if (dirty & /*selectedOption*/
1431
- 2 && button_class_value !== (button_class_value = "btn-mcq-option group text-left " + /*selectedOption*/
1432
- (ctx[1] === /*option*/
1433
- ctx[12].id ? "selected" : ""))) {
2051
+ if (!current || dirty & /*selectedOption, isFinished, isResultCorrect*/
2052
+ 14 && button_class_value !== (button_class_value = "btn-mcq-option group text-left " + /*selectedOption*/
2053
+ (ctx[3] === /*option*/
2054
+ ctx[16].id ? "selected" : "") + " " + (!/*isFinished*/
2055
+ ctx[1] ? "" : (
2056
+ /*isResultCorrect*/
2057
+ ctx[2] ? "correct" : "incorrect"
2058
+ )))) {
1434
2059
  attr(button, "class", button_class_value);
1435
2060
  }
1436
2061
  },
2062
+ i(local) {
2063
+ if (current)
2064
+ return;
2065
+ transition_in(if_block);
2066
+ current = true;
2067
+ },
2068
+ o(local) {
2069
+ transition_out(if_block);
2070
+ current = false;
2071
+ },
1437
2072
  d(detaching) {
1438
2073
  if (detaching) {
1439
2074
  detach(button);
1440
2075
  }
2076
+ if (if_block)
2077
+ if_block.d();
1441
2078
  mounted = false;
1442
2079
  dispose();
1443
2080
  }
@@ -1445,9 +2082,10 @@
1445
2082
  }
1446
2083
  function create_default_slot(ctx) {
1447
2084
  let if_block_anchor;
2085
+ let current;
1448
2086
  let if_block = (
1449
2087
  /*options*/
1450
- ctx[4] && create_if_block2(ctx)
2088
+ ctx[7] && create_if_block_13(ctx)
1451
2089
  );
1452
2090
  return {
1453
2091
  c() {
@@ -1459,14 +2097,25 @@
1459
2097
  if (if_block)
1460
2098
  if_block.m(target, anchor);
1461
2099
  insert(target, if_block_anchor, anchor);
2100
+ current = true;
1462
2101
  },
1463
2102
  p(ctx2, dirty) {
1464
2103
  if (
1465
2104
  /*options*/
1466
- ctx2[4]
2105
+ ctx2[7]
1467
2106
  )
1468
2107
  if_block.p(ctx2, dirty);
1469
2108
  },
2109
+ i(local) {
2110
+ if (current)
2111
+ return;
2112
+ transition_in(if_block);
2113
+ current = true;
2114
+ },
2115
+ o(local) {
2116
+ transition_out(if_block);
2117
+ current = false;
2118
+ },
1470
2119
  d(detaching) {
1471
2120
  if (detaching) {
1472
2121
  detach(if_block_anchor);
@@ -1476,60 +2125,166 @@
1476
2125
  }
1477
2126
  };
1478
2127
  }
1479
- function create_fragment2(ctx) {
2128
+ function create_if_block3(ctx) {
2129
+ let promptresult;
2130
+ let current;
2131
+ promptresult = new PromptResultFeedback_default({
2132
+ props: {
2133
+ isResultCorrect: (
2134
+ /*isResultCorrect*/
2135
+ ctx[2]
2136
+ ),
2137
+ resultFeedbackTitle: (
2138
+ /*isResultCorrect*/
2139
+ ctx[2] ? "Well done!" : "Nice try!"
2140
+ ),
2141
+ resultFeedback: (
2142
+ /*resultFeedback*/
2143
+ ctx[4]
2144
+ )
2145
+ }
2146
+ });
2147
+ return {
2148
+ c() {
2149
+ create_component(promptresult.$$.fragment);
2150
+ },
2151
+ m(target, anchor) {
2152
+ mount_component(promptresult, target, anchor);
2153
+ current = true;
2154
+ },
2155
+ p(ctx2, dirty) {
2156
+ const promptresult_changes = {};
2157
+ if (dirty & /*isResultCorrect*/
2158
+ 4)
2159
+ promptresult_changes.isResultCorrect = /*isResultCorrect*/
2160
+ ctx2[2];
2161
+ if (dirty & /*isResultCorrect*/
2162
+ 4)
2163
+ promptresult_changes.resultFeedbackTitle = /*isResultCorrect*/
2164
+ ctx2[2] ? "Well done!" : "Nice try!";
2165
+ if (dirty & /*resultFeedback*/
2166
+ 16)
2167
+ promptresult_changes.resultFeedback = /*resultFeedback*/
2168
+ ctx2[4];
2169
+ promptresult.$set(promptresult_changes);
2170
+ },
2171
+ i(local) {
2172
+ if (current)
2173
+ return;
2174
+ transition_in(promptresult.$$.fragment, local);
2175
+ current = true;
2176
+ },
2177
+ o(local) {
2178
+ transition_out(promptresult.$$.fragment, local);
2179
+ current = false;
2180
+ },
2181
+ d(detaching) {
2182
+ destroy_component(promptresult, detaching);
2183
+ }
2184
+ };
2185
+ }
2186
+ function create_fragment6(ctx) {
1480
2187
  let promptbody;
2188
+ let t2;
2189
+ let if_block_anchor;
1481
2190
  let current;
1482
2191
  promptbody = new PromptBody_default({
1483
2192
  props: {
1484
2193
  rubric: (
1485
2194
  /*rubric*/
1486
- ctx[2].text
2195
+ ctx[5].text
1487
2196
  ),
1488
2197
  prompt: (
1489
2198
  /*prompt*/
1490
- ctx[3]
2199
+ ctx[6]
1491
2200
  ),
1492
2201
  $$slots: { default: [create_default_slot] },
1493
2202
  $$scope: { ctx }
1494
2203
  }
1495
2204
  });
2205
+ let if_block = (
2206
+ /*isFinished*/
2207
+ ctx[1] && create_if_block3(ctx)
2208
+ );
1496
2209
  return {
1497
2210
  c() {
1498
2211
  create_component(promptbody.$$.fragment);
2212
+ t2 = space();
2213
+ if (if_block)
2214
+ if_block.c();
2215
+ if_block_anchor = empty();
1499
2216
  },
1500
2217
  m(target, anchor) {
1501
2218
  mount_component(promptbody, target, anchor);
2219
+ insert(target, t2, anchor);
2220
+ if (if_block)
2221
+ if_block.m(target, anchor);
2222
+ insert(target, if_block_anchor, anchor);
1502
2223
  current = true;
1503
2224
  },
1504
2225
  p(ctx2, [dirty]) {
1505
2226
  const promptbody_changes = {};
1506
- if (dirty & /*$$scope, selectedOption, isDataSaving*/
1507
- 32771) {
2227
+ if (dirty & /*$$scope, selectedOption, isFinished, isResultCorrect, isDataSaving*/
2228
+ 524303) {
1508
2229
  promptbody_changes.$$scope = { dirty, ctx: ctx2 };
1509
2230
  }
1510
2231
  promptbody.$set(promptbody_changes);
2232
+ if (
2233
+ /*isFinished*/
2234
+ ctx2[1]
2235
+ ) {
2236
+ if (if_block) {
2237
+ if_block.p(ctx2, dirty);
2238
+ if (dirty & /*isFinished*/
2239
+ 2) {
2240
+ transition_in(if_block, 1);
2241
+ }
2242
+ } else {
2243
+ if_block = create_if_block3(ctx2);
2244
+ if_block.c();
2245
+ transition_in(if_block, 1);
2246
+ if_block.m(if_block_anchor.parentNode, if_block_anchor);
2247
+ }
2248
+ } else if (if_block) {
2249
+ group_outros();
2250
+ transition_out(if_block, 1, 1, () => {
2251
+ if_block = null;
2252
+ });
2253
+ check_outros();
2254
+ }
1511
2255
  },
1512
2256
  i(local) {
1513
2257
  if (current)
1514
2258
  return;
1515
2259
  transition_in(promptbody.$$.fragment, local);
2260
+ transition_in(if_block);
1516
2261
  current = true;
1517
2262
  },
1518
2263
  o(local) {
1519
2264
  transition_out(promptbody.$$.fragment, local);
2265
+ transition_out(if_block);
1520
2266
  current = false;
1521
2267
  },
1522
2268
  d(detaching) {
2269
+ if (detaching) {
2270
+ detach(t2);
2271
+ detach(if_block_anchor);
2272
+ }
1523
2273
  destroy_component(promptbody, detaching);
2274
+ if (if_block)
2275
+ if_block.d(detaching);
1524
2276
  }
1525
2277
  };
1526
2278
  }
1527
- function instance2($$self, $$props, $$invalidate) {
2279
+ function instance3($$self, $$props, $$invalidate) {
1528
2280
  let { sessionData } = $$props;
1529
2281
  let { isDataSaving } = $$props;
1530
- const { rubric, interaction, metadata } = sessionData;
2282
+ let { isFinished: isFinished2 = false } = $$props;
2283
+ let { isResultCorrect: isResultCorrect2 = false } = $$props;
2284
+ const { rubric, interaction, metadata, scoringMetadata } = sessionData;
1531
2285
  const { prompt, options } = interaction;
1532
- let selectedOption;
2286
+ let selectedOption = null;
2287
+ let resultFeedback = null;
1533
2288
  const dispatch = createEventDispatcher();
1534
2289
  if (metadata) {
1535
2290
  const { events } = metadata.interactions;
@@ -1537,10 +2292,18 @@
1537
2292
  const { answer_id: answerChoiceId } = currentOption;
1538
2293
  selectedOption = answerChoiceId[0];
1539
2294
  }
2295
+ if (isFinished2) {
2296
+ if (options && selectedOption) {
2297
+ const feedbackData = Object.values(options).filter((option) => option.id === selectedOption);
2298
+ resultFeedback = feedbackData[0].feedback || resultFeedback;
2299
+ }
2300
+ const { answerId, has_answer } = scoringMetadata;
2301
+ selectedOption = answerId && has_answer ? answerId : selectedOption;
2302
+ }
1540
2303
  const handleOptionClick = (optionId, option) => {
1541
- if (isDataSaving || optionId === selectedOption)
2304
+ if (isDataSaving || optionId === selectedOption || isFinished2)
1542
2305
  return;
1543
- $$invalidate(1, selectedOption = optionId);
2306
+ $$invalidate(3, selectedOption = optionId);
1544
2307
  dispatch("saveOption", {
1545
2308
  answer_id: [optionId],
1546
2309
  answer_choice: [option]
@@ -1549,13 +2312,20 @@
1549
2312
  const click_handler = (option) => handleOptionClick(option.id, option.answer);
1550
2313
  $$self.$$set = ($$props2) => {
1551
2314
  if ("sessionData" in $$props2)
1552
- $$invalidate(6, sessionData = $$props2.sessionData);
2315
+ $$invalidate(9, sessionData = $$props2.sessionData);
1553
2316
  if ("isDataSaving" in $$props2)
1554
2317
  $$invalidate(0, isDataSaving = $$props2.isDataSaving);
2318
+ if ("isFinished" in $$props2)
2319
+ $$invalidate(1, isFinished2 = $$props2.isFinished);
2320
+ if ("isResultCorrect" in $$props2)
2321
+ $$invalidate(2, isResultCorrect2 = $$props2.isResultCorrect);
1555
2322
  };
1556
2323
  return [
1557
2324
  isDataSaving,
2325
+ isFinished2,
2326
+ isResultCorrect2,
1558
2327
  selectedOption,
2328
+ resultFeedback,
1559
2329
  rubric,
1560
2330
  prompt,
1561
2331
  options,
@@ -1567,10 +2337,15 @@
1567
2337
  var PromptMCQ = class extends SvelteComponent {
1568
2338
  constructor(options) {
1569
2339
  super();
1570
- init(this, options, instance2, create_fragment2, safe_not_equal, { sessionData: 6, isDataSaving: 0 });
2340
+ init(this, options, instance3, create_fragment6, safe_not_equal, {
2341
+ sessionData: 9,
2342
+ isDataSaving: 0,
2343
+ isFinished: 1,
2344
+ isResultCorrect: 2
2345
+ });
1571
2346
  }
1572
2347
  get sessionData() {
1573
- return this.$$.ctx[6];
2348
+ return this.$$.ctx[9];
1574
2349
  }
1575
2350
  set sessionData(sessionData) {
1576
2351
  this.$$set({ sessionData });
@@ -1583,8 +2358,22 @@
1583
2358
  this.$$set({ isDataSaving });
1584
2359
  flush();
1585
2360
  }
2361
+ get isFinished() {
2362
+ return this.$$.ctx[1];
2363
+ }
2364
+ set isFinished(isFinished2) {
2365
+ this.$$set({ isFinished: isFinished2 });
2366
+ flush();
2367
+ }
2368
+ get isResultCorrect() {
2369
+ return this.$$.ctx[2];
2370
+ }
2371
+ set isResultCorrect(isResultCorrect2) {
2372
+ this.$$set({ isResultCorrect: isResultCorrect2 });
2373
+ flush();
2374
+ }
1586
2375
  };
1587
- customElements.define("prompt-mcq", create_custom_element(PromptMCQ, { "sessionData": {}, "isDataSaving": {} }, [], [], true));
2376
+ customElements.define("prompt-mcq", create_custom_element(PromptMCQ, { "sessionData": {}, "isDataSaving": {}, "isFinished": { "type": "Boolean" }, "isResultCorrect": { "type": "Boolean" } }, [], [], true));
1588
2377
  var PromptMCQ_default = PromptMCQ;
1589
2378
 
1590
2379
  // node_modules/autosize/dist/autosize.esm.js
@@ -1659,9 +2448,15 @@
1659
2448
  action.destroy = autosize_esm_default.destroy;
1660
2449
  var svelte_autosize_default = action;
1661
2450
 
2451
+ // src/lib/constants/index.ts
2452
+ var INTERACTION_TYPE_MCQ = "multipleChoiceInteraction";
2453
+ var INTERACTION_TYPE_TYPEIN = "typeInInteraction";
2454
+ var TYPEIN_TYPE_SHORT = "Short-Text";
2455
+
1662
2456
  // src/lib/components/prompt/typein/PromptTypeIn.svelte
1663
- function create_else_block(ctx) {
2457
+ function create_else_block_1(ctx) {
1664
2458
  let textarea;
2459
+ let textarea_class_value;
1665
2460
  let autosize_action;
1666
2461
  let mounted;
1667
2462
  let dispose;
@@ -1669,11 +2464,13 @@
1669
2464
  c() {
1670
2465
  textarea = element("textarea");
1671
2466
  attr(textarea, "id", idLabel);
2467
+ attr(textarea, "aria-label", placeholder);
1672
2468
  attr(textarea, "placeholder", placeholder);
1673
2469
  attr(textarea, "rows", "3");
1674
- attr(textarea, "class", "typein-textbox overflow-hidden");
2470
+ attr(textarea, "class", textarea_class_value = "typein-textbox overflow-hidden " + (!isFinished ? "" : isResultCorrect ? "border-2 border-green-800" : "border-2 border-red-800"));
1675
2471
  textarea.disabled = /*isDataSaving*/
1676
2472
  ctx[0];
2473
+ attr(textarea, "autocomplete", "off");
1677
2474
  },
1678
2475
  m(target, anchor) {
1679
2476
  insert(target, textarea, anchor);
@@ -1688,19 +2485,38 @@
1688
2485
  textarea,
1689
2486
  "input",
1690
2487
  /*textarea_input_handler*/
1691
- ctx[11]
2488
+ ctx[13]
2489
+ ),
2490
+ listen(
2491
+ textarea,
2492
+ "mousedown",
2493
+ /*mousedown_handler*/
2494
+ ctx[14]
2495
+ ),
2496
+ listen(
2497
+ textarea,
2498
+ "touchstart",
2499
+ /*touchstart_handler*/
2500
+ ctx[15],
2501
+ { passive: true }
2502
+ ),
2503
+ listen(
2504
+ textarea,
2505
+ "focus",
2506
+ /*focus_handler*/
2507
+ ctx[16]
1692
2508
  ),
1693
2509
  listen(
1694
2510
  textarea,
1695
2511
  "focusout",
1696
2512
  /*focusout_handler_1*/
1697
- ctx[12]
2513
+ ctx[17]
1698
2514
  ),
1699
2515
  listen(
1700
2516
  textarea,
1701
2517
  "keydown",
1702
2518
  /*keydown_handler_1*/
1703
- ctx[13]
2519
+ ctx[18]
1704
2520
  ),
1705
2521
  action_destroyer(autosize_action = svelte_autosize_default.call(null, textarea))
1706
2522
  ];
@@ -1731,8 +2547,9 @@
1731
2547
  }
1732
2548
  };
1733
2549
  }
1734
- function create_if_block3(ctx) {
2550
+ function create_if_block_22(ctx) {
1735
2551
  let input;
2552
+ let input_class_value;
1736
2553
  let mounted;
1737
2554
  let dispose;
1738
2555
  return {
@@ -1740,10 +2557,12 @@
1740
2557
  input = element("input");
1741
2558
  attr(input, "type", "text");
1742
2559
  attr(input, "id", idLabel);
2560
+ attr(input, "aria-label", placeholder);
1743
2561
  attr(input, "placeholder", placeholder);
1744
- attr(input, "class", "typein-textbox");
2562
+ attr(input, "class", input_class_value = "typein-textbox " + (!isFinished ? "" : isResultCorrect ? "border-2 border-green-800" : "border-2 border-red-800"));
1745
2563
  input.disabled = /*isDataSaving*/
1746
2564
  ctx[0];
2565
+ attr(input, "autocomplete", "off");
1747
2566
  },
1748
2567
  m(target, anchor) {
1749
2568
  insert(target, input, anchor);
@@ -1758,19 +2577,19 @@
1758
2577
  input,
1759
2578
  "input",
1760
2579
  /*input_input_handler*/
1761
- ctx[8]
2580
+ ctx[10]
1762
2581
  ),
1763
2582
  listen(
1764
2583
  input,
1765
2584
  "focusout",
1766
2585
  /*focusout_handler*/
1767
- ctx[9]
2586
+ ctx[11]
1768
2587
  ),
1769
2588
  listen(
1770
2589
  input,
1771
2590
  "keydown",
1772
2591
  /*keydown_handler*/
1773
- ctx[10]
2592
+ ctx[12]
1774
2593
  )
1775
2594
  ];
1776
2595
  mounted = true;
@@ -1806,10 +2625,10 @@
1806
2625
  function select_block_type(ctx2, dirty) {
1807
2626
  if (
1808
2627
  /*typeinType*/
1809
- ctx2[4] === "Short-Text"
2628
+ ctx2[4] === TYPEIN_TYPE_SHORT
1810
2629
  )
1811
- return create_if_block3;
1812
- return create_else_block;
2630
+ return create_if_block_22;
2631
+ return create_else_block_1;
1813
2632
  }
1814
2633
  let current_block_type = select_block_type(ctx, -1);
1815
2634
  let if_block = current_block_type(ctx);
@@ -1833,8 +2652,140 @@
1833
2652
  }
1834
2653
  };
1835
2654
  }
1836
- function create_fragment3(ctx) {
2655
+ function create_if_block4(ctx) {
2656
+ let div;
2657
+ let span0;
2658
+ let current_block_type_index;
2659
+ let if_block;
2660
+ let span0_class_value;
2661
+ let t0;
2662
+ let span1;
2663
+ let div_class_value;
2664
+ let t2;
2665
+ let promptresult;
2666
+ let current;
2667
+ const if_block_creators = [create_if_block_14, create_else_block3];
2668
+ const if_blocks = [];
2669
+ function select_block_type_1(ctx2, dirty) {
2670
+ if (isResultCorrect)
2671
+ return 0;
2672
+ return 1;
2673
+ }
2674
+ current_block_type_index = select_block_type_1(ctx, -1);
2675
+ if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);
2676
+ promptresult = new PromptResultFeedback_default({
2677
+ props: {
2678
+ isResultCorrect,
2679
+ resultFeedbackTitle: isResultCorrect ? "Well done!" : "Not quite, but you\u2019re close!",
2680
+ resultFeedback: "You applied the principles of [specific theory] perfectly in your response."
2681
+ }
2682
+ });
2683
+ return {
2684
+ c() {
2685
+ div = element("div");
2686
+ span0 = element("span");
2687
+ if_block.c();
2688
+ t0 = space();
2689
+ span1 = element("span");
2690
+ span1.textContent = `${isResultCorrect ? "[Generic \u201Ccorrect\u201D message]" : "[Generic \u201Cincorrect\u201D message]"}`;
2691
+ t2 = space();
2692
+ create_component(promptresult.$$.fragment);
2693
+ attr(span0, "class", span0_class_value = (isResultCorrect ? "text-green-800" : "text-red-800") + " mr-2 p-0.5");
2694
+ attr(span1, "class", "p2");
2695
+ attr(div, "class", div_class_value = "flex items-center text-charcoal " + /*typeinType*/
2696
+ (ctx[4] === TYPEIN_TYPE_SHORT ? "mt-2" : "mt-0.5"));
2697
+ },
2698
+ m(target, anchor) {
2699
+ insert(target, div, anchor);
2700
+ append(div, span0);
2701
+ if_blocks[current_block_type_index].m(span0, null);
2702
+ append(div, t0);
2703
+ append(div, span1);
2704
+ insert(target, t2, anchor);
2705
+ mount_component(promptresult, target, anchor);
2706
+ current = true;
2707
+ },
2708
+ p: noop,
2709
+ i(local) {
2710
+ if (current)
2711
+ return;
2712
+ transition_in(if_block);
2713
+ transition_in(promptresult.$$.fragment, local);
2714
+ current = true;
2715
+ },
2716
+ o(local) {
2717
+ transition_out(if_block);
2718
+ transition_out(promptresult.$$.fragment, local);
2719
+ current = false;
2720
+ },
2721
+ d(detaching) {
2722
+ if (detaching) {
2723
+ detach(div);
2724
+ detach(t2);
2725
+ }
2726
+ if_blocks[current_block_type_index].d();
2727
+ destroy_component(promptresult, detaching);
2728
+ }
2729
+ };
2730
+ }
2731
+ function create_else_block3(ctx) {
2732
+ let errorsolid;
2733
+ let current;
2734
+ errorsolid = new ErrorSolid_default({});
2735
+ return {
2736
+ c() {
2737
+ create_component(errorsolid.$$.fragment);
2738
+ },
2739
+ m(target, anchor) {
2740
+ mount_component(errorsolid, target, anchor);
2741
+ current = true;
2742
+ },
2743
+ i(local) {
2744
+ if (current)
2745
+ return;
2746
+ transition_in(errorsolid.$$.fragment, local);
2747
+ current = true;
2748
+ },
2749
+ o(local) {
2750
+ transition_out(errorsolid.$$.fragment, local);
2751
+ current = false;
2752
+ },
2753
+ d(detaching) {
2754
+ destroy_component(errorsolid, detaching);
2755
+ }
2756
+ };
2757
+ }
2758
+ function create_if_block_14(ctx) {
2759
+ let successsolid;
2760
+ let current;
2761
+ successsolid = new SuccessSolid_default({});
2762
+ return {
2763
+ c() {
2764
+ create_component(successsolid.$$.fragment);
2765
+ },
2766
+ m(target, anchor) {
2767
+ mount_component(successsolid, target, anchor);
2768
+ current = true;
2769
+ },
2770
+ i(local) {
2771
+ if (current)
2772
+ return;
2773
+ transition_in(successsolid.$$.fragment, local);
2774
+ current = true;
2775
+ },
2776
+ o(local) {
2777
+ transition_out(successsolid.$$.fragment, local);
2778
+ current = false;
2779
+ },
2780
+ d(detaching) {
2781
+ destroy_component(successsolid, detaching);
2782
+ }
2783
+ };
2784
+ }
2785
+ function create_fragment7(ctx) {
1837
2786
  let promptbody;
2787
+ let t2;
2788
+ let if_block_anchor;
1838
2789
  let current;
1839
2790
  promptbody = new PromptBody_default({
1840
2791
  props: {
@@ -1850,45 +2801,67 @@
1850
2801
  $$scope: { ctx }
1851
2802
  }
1852
2803
  });
2804
+ let if_block = isFinished && create_if_block4(ctx);
1853
2805
  return {
1854
2806
  c() {
1855
2807
  create_component(promptbody.$$.fragment);
2808
+ t2 = space();
2809
+ if (if_block)
2810
+ if_block.c();
2811
+ if_block_anchor = empty();
1856
2812
  },
1857
2813
  m(target, anchor) {
1858
2814
  mount_component(promptbody, target, anchor);
2815
+ insert(target, t2, anchor);
2816
+ if (if_block)
2817
+ if_block.m(target, anchor);
2818
+ insert(target, if_block_anchor, anchor);
1859
2819
  current = true;
1860
2820
  },
1861
2821
  p(ctx2, [dirty]) {
1862
2822
  const promptbody_changes = {};
1863
2823
  if (dirty & /*$$scope, isDataSaving, typeinAnswer*/
1864
- 262147) {
2824
+ 16777219) {
1865
2825
  promptbody_changes.$$scope = { dirty, ctx: ctx2 };
1866
2826
  }
1867
2827
  promptbody.$set(promptbody_changes);
2828
+ if (isFinished)
2829
+ if_block.p(ctx2, dirty);
1868
2830
  },
1869
2831
  i(local) {
1870
2832
  if (current)
1871
2833
  return;
1872
2834
  transition_in(promptbody.$$.fragment, local);
2835
+ transition_in(if_block);
1873
2836
  current = true;
1874
2837
  },
1875
2838
  o(local) {
1876
2839
  transition_out(promptbody.$$.fragment, local);
2840
+ transition_out(if_block);
1877
2841
  current = false;
1878
2842
  },
1879
2843
  d(detaching) {
2844
+ if (detaching) {
2845
+ detach(t2);
2846
+ detach(if_block_anchor);
2847
+ }
1880
2848
  destroy_component(promptbody, detaching);
2849
+ if (if_block)
2850
+ if_block.d(detaching);
1881
2851
  }
1882
2852
  };
1883
2853
  }
1884
2854
  var idLabel = "answerText";
1885
2855
  var placeholder = "Type your answer here";
1886
- function instance3($$self, $$props, $$invalidate) {
2856
+ var isFinished = false;
2857
+ var isResultCorrect = false;
2858
+ function instance4($$self, $$props, $$invalidate) {
1887
2859
  let { sessionData } = $$props;
1888
2860
  let { isDataSaving } = $$props;
1889
2861
  const dispatch = createEventDispatcher();
1890
2862
  let typeinAnswer;
1891
2863
  let latestAnswer = "";
2864
+ let focusOrigin = "tab";
1892
2865
  const { rubric, interaction, metadata } = sessionData;
1893
2866
  const { prompt, typein_type: typeinType } = interaction;
1894
2867
  if (metadata) {
@@ -1896,6 +2869,7 @@
1896
2869
  latestAnswer = typeinAnswer = events.answer;
1897
2870
  }
1898
2871
  const saveAnswer = () => {
2872
+ focusOrigin = "tab";
1899
2873
  if (isDataSaving || typeinAnswer === latestAnswer || !typeinAnswer && !latestAnswer)
1900
2874
  return;
1901
2875
  latestAnswer = typeinAnswer;
@@ -1907,6 +2881,16 @@
1907
2881
  saveAnswer();
1908
2882
  }
1909
2883
  };
2884
+ const handleFocus = (event) => {
2885
+ if (focusOrigin !== "click") {
2886
+ const textarea = event.target;
2887
+ textarea.select();
2888
+ textarea.setSelectionRange(0, textarea.value.length);
2889
+ }
2890
+ };
2891
+ const handleClick = () => {
2892
+ focusOrigin = "click";
2893
+ };
1910
2894
  function input_input_handler() {
1911
2895
  typeinAnswer = this.value;
1912
2896
  $$invalidate(1, typeinAnswer);
@@ -1917,11 +2901,14 @@
1917
2901
  typeinAnswer = this.value;
1918
2902
  $$invalidate(1, typeinAnswer);
1919
2903
  }
2904
+ const mousedown_handler = () => handleClick();
2905
+ const touchstart_handler = () => handleClick();
2906
+ const focus_handler = (event) => handleFocus(event);
1920
2907
  const focusout_handler_1 = () => saveAnswer();
1921
2908
  const keydown_handler_1 = (event) => saveOnEnter(event);
1922
2909
  $$self.$$set = ($$props2) => {
1923
2910
  if ("sessionData" in $$props2)
1924
- $$invalidate(7, sessionData = $$props2.sessionData);
2911
+ $$invalidate(9, sessionData = $$props2.sessionData);
1925
2912
  if ("isDataSaving" in $$props2)
1926
2913
  $$invalidate(0, isDataSaving = $$props2.isDataSaving);
1927
2914
  };
@@ -1933,11 +2920,16 @@
1933
2920
  typeinType,
1934
2921
  saveAnswer,
1935
2922
  saveOnEnter,
2923
+ handleFocus,
2924
+ handleClick,
1936
2925
  sessionData,
1937
2926
  input_input_handler,
1938
2927
  focusout_handler,
1939
2928
  keydown_handler,
1940
2929
  textarea_input_handler,
2930
+ mousedown_handler,
2931
+ touchstart_handler,
2932
+ focus_handler,
1941
2933
  focusout_handler_1,
1942
2934
  keydown_handler_1
1943
2935
  ];
@@ -1945,10 +2937,10 @@
1945
2937
  var PromptTypeIn = class extends SvelteComponent {
1946
2938
  constructor(options) {
1947
2939
  super();
1948
- init(this, options, instance3, create_fragment3, safe_not_equal, { sessionData: 7, isDataSaving: 0 });
2940
+ init(this, options, instance4, create_fragment7, safe_not_equal, { sessionData: 9, isDataSaving: 0 });
1949
2941
  }
1950
2942
  get sessionData() {
1951
- return this.$$.ctx[7];
2943
+ return this.$$.ctx[9];
1952
2944
  }
1953
2945
  set sessionData(sessionData) {
1954
2946
  this.$$set({ sessionData });
@@ -1966,7 +2958,7 @@
1966
2958
  var PromptTypeIn_default = PromptTypeIn;
1967
2959
 
1968
2960
  // src/lib/components/prompt/skeleton/PromptSkeleton.svelte
1969
- function create_fragment4(ctx) {
2961
+ function create_fragment8(ctx) {
1970
2962
  let div3;
1971
2963
  return {
1972
2964
  c() {
@@ -1989,14 +2981,14 @@
1989
2981
  var PromptSkeleton = class extends SvelteComponent {
1990
2982
  constructor(options) {
1991
2983
  super();
1992
- init(this, options, null, create_fragment4, safe_not_equal, {});
2984
+ init(this, options, null, create_fragment8, safe_not_equal, {});
1993
2985
  }
1994
2986
  };
1995
2987
  customElements.define("prompt-skeleton", create_custom_element(PromptSkeleton, {}, [], [], true));
1996
2988
  var PromptSkeleton_default = PromptSkeleton;
1997
2989
 
1998
2990
  // src/lib/components/common/InvalidBanner.svelte
1999
- function create_fragment5(ctx) {
2991
+ function create_fragment9(ctx) {
2000
2992
  let p;
2001
2993
  let t2;
2002
2994
  return {
@@ -2030,7 +3022,7 @@
2030
3022
  }
2031
3023
  };
2032
3024
  }
2033
- function instance4($$self, $$props, $$invalidate) {
3025
+ function instance5($$self, $$props, $$invalidate) {
2034
3026
  let { bannerLabel: bannerLabel2 = "Invalid." } = $$props;
2035
3027
  $$self.$$set = ($$props2) => {
2036
3028
  if ("bannerLabel" in $$props2)
@@ -2041,7 +3033,7 @@
2041
3033
  var InvalidBanner = class extends SvelteComponent {
2042
3034
  constructor(options) {
2043
3035
  super();
2044
- init(this, options, instance4, create_fragment5, safe_not_equal, { bannerLabel: 0 });
3036
+ init(this, options, instance5, create_fragment9, safe_not_equal, { bannerLabel: 0 });
2045
3037
  }
2046
3038
  get bannerLabel() {
2047
3039
  return this.$$.ctx[0];
@@ -2056,9 +3048,9 @@
2056
3048
 
2057
3049
  // src/lib/components/prompt/PromptBuilder.svelte
2058
3050
  function add_css(target) {
2059
- append_styles(target, "svelte-1h69jp4", '*,:after,:before{border:0 solid #e5e7eb;box-sizing:border-box}:after,:before{--tw-content:""}html{-webkit-text-size-adjust:100%;font-feature-settings:normal;font-family:Mulish, sans-serif;font-variation-settings:normal;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4}body{line-height:inherit;margin:0}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-0.25em}sup{top:-0.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}button,input,optgroup,select,textarea{font-feature-settings:inherit;color:inherit;font-family:inherit;font-size:100%;font-variation-settings:inherit;font-weight:inherit;line-height:inherit;margin:0;padding:0}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{color:#9ca3af;opacity:1}input::placeholder,textarea::placeholder{color:#9ca3af;opacity:1}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}[hidden]{display:none}*{font-family:Mulish, sans-serif}*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.item-heading{--tw-text-opacity:1;color:rgb(8 38 99/var(--tw-text-opacity));font-size:1.25rem;letter-spacing:-0.025em;line-height:1.5rem}.divider{--tw-border-opacity:1;border-bottom-width:1px;border-color:rgb(107 121 121/var(--tw-border-opacity))}@keyframes svelte-1h69jp4-pulse{{opacity:0.5}}.animate-skeleton{--tw-bg-opacity:1;animation:svelte-1h69jp4-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;background-color:rgb(226 232 240/var(--tw-bg-opacity))}.btn-mcq-option:focus-visible{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);--tw-ring-opacity:1;--tw-ring-color:rgb(84 101 251/var(--tw-ring-opacity));--tw-ring-offset-width:4px;box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 rgba(0, 0, 0, 0));outline:2px solid transparent;outline-offset:2px;transition-duration:50ms}.btn-mcq-option{--tw-text-opacity:1;--tw-border-opacity:1;--tw-bg-opacity:1;align-items:center;background-color:rgb(247 250 250/var(--tw-bg-opacity));border-color:rgb(113 115 119/var(--tw-border-opacity));border-radius:0.5rem;border-width:1px;color:rgb(33 37 41/var(--tw-text-opacity));display:flex;font-size:1rem;line-height:1.5rem;margin-bottom:1rem;min-height:48px;padding:0.5rem 0.75rem 0.5rem 0.5rem;width:100%}.btn-mcq-option:active{--tw-border-opacity:1;--tw-bg-opacity:1;background-color:rgb(222 222 255/var(--tw-bg-opacity));border-color:rgb(8 38 99/var(--tw-border-opacity));border-width:2px}@media(hover: hover) and (pointer: fine){.btn-mcq-option:hover{--tw-bg-opacity:1;background-color:rgb(222 222 255/var(--tw-bg-opacity))}}.btn-mcq-option>.choice{--tw-border-opacity:1;--tw-bg-opacity:1;--tw-text-opacity:1;align-items:center;background-color:rgb(255 255 255/var(--tw-bg-opacity));border-color:rgb(113 115 119/var(--tw-border-opacity));border-radius:1rem;border-width:1px;color:rgb(93 99 107/var(--tw-text-opacity));display:flex;font-size:1rem;font-weight:700;height:2rem;justify-content:center;letter-spacing:0.05em;line-height:1rem;margin-right:1rem;padding:0.5rem;width:2rem}.btn-mcq-option.selected{--tw-border-opacity:1;--tw-bg-opacity:1;background-color:rgb(222 222 255/var(--tw-bg-opacity))}.btn-mcq-option.selected,.btn-mcq-option.selected>.choice{border-color:rgb(8 38 99/var(--tw-border-opacity));border-width:2px}.btn-mcq-option.selected>.choice{--tw-border-opacity:1}.typein-textbox:focus-visible{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);--tw-ring-opacity:1;--tw-ring-color:rgb(84 101 251/var(--tw-ring-opacity));--tw-ring-offset-width:4px;box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 rgba(0, 0, 0, 0));outline:2px solid transparent;outline-offset:2px;transition-duration:50ms}.typein-textbox{--tw-border-opacity:1;--tw-bg-opacity:1;--tw-text-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity));border-color:rgb(93 99 107/var(--tw-border-opacity));border-radius:0.5rem;border-width:1px;color:rgb(33 37 41/var(--tw-text-opacity));font-size:1rem;line-height:1.5rem;padding:0.75rem 1rem;width:100%}.typein-textbox::-moz-placeholder{--tw-placeholder-opacity:1;color:rgb(93 99 107/var(--tw-placeholder-opacity))}.typein-textbox::placeholder{--tw-placeholder-opacity:1;color:rgb(93 99 107/var(--tw-placeholder-opacity))}.typein-textbox:focus{--tw-border-opacity:1;border-color:rgb(84 101 251/var(--tw-border-opacity));border-width:2px}@media(hover: hover) and (pointer: fine){.typein-textbox:hover{--tw-border-opacity:1;border-color:rgb(84 101 251/var(--tw-border-opacity));border-width:2px;outline:2px solid transparent;outline-offset:2px}}.typein-textbox:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color)!important;--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color)!important;box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 rgba(0, 0, 0, 0)) !important}@media(hover: hover) and (pointer: fine){.typein-textbox:hover{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);--tw-ring-opacity:1;--tw-ring-color:rgb(84 101 251/var(--tw-ring-opacity));--tw-ring-offset-width:4px;box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 rgba(0, 0, 0, 0));transition-duration:50ms}}.absolute{position:absolute}.relative{position:relative}.inset-0{inset:0}.z-50{z-index:50}.my-6{margin-bottom:1.5rem;margin-top:1.5rem}.mb-12{margin-bottom:3rem}.mb-2{margin-bottom:0.5rem}.h-52{height:13rem}.h-6{height:1.5rem}.w-full{width:100%}.overflow-hidden{overflow:hidden}.rounded{border-radius:0.25rem}.border-2{border-width:2px}.border-red-600{--tw-border-opacity:1;border-color:rgb(220 38 38/var(--tw-border-opacity))}.bg-red-200{--tw-bg-opacity:1;background-color:rgb(254 202 202/var(--tw-bg-opacity))}.bg-transparent{background-color:transparent}.p-2{padding:0.5rem}.text-left{text-align:left}.font-semibold{font-weight:600}.group:active .group-active\\:border-2{border-width:2px}.group:active .group-active\\:border-blue-1000{--tw-border-opacity:1;border-color:rgb(8 38 99/var(--tw-border-opacity))}.group:active .group-active\\:p-\\[7px\\]{padding:7px}@media(min-width: 732px){.md\\:mb-4{margin-bottom:1rem}}');
3051
+ append_styles(target, "svelte-14zs2vw", '*,:after,:before{border:0 solid #e5e7eb;box-sizing:border-box}:after,:before{--tw-content:""}html{-webkit-text-size-adjust:100%;font-feature-settings:normal;font-family:Mulish, sans-serif;font-variation-settings:normal;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4}body{line-height:inherit;margin:0}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-0.25em}sup{top:-0.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}button,input,optgroup,select,textarea{font-feature-settings:inherit;color:inherit;font-family:inherit;font-size:100%;font-variation-settings:inherit;font-weight:inherit;line-height:inherit;margin:0;padding:0}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{color:#9ca3af;opacity:1}input::placeholder,textarea::placeholder{color:#9ca3af;opacity:1}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}[hidden]{display:none}*{font-family:Mulish, sans-serif}input::-moz-selection,textarea::-moz-selection{background-color:hsla(0, 0%, 85%, 0.4)}input::selection,textarea::selection{background-color:hsla(0, 0%, 85%, 0.4)}*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.p2{font-size:0.875rem;font-weight:600;line-height:1.25rem;line-height:1.5}.item-heading{--tw-text-opacity:1;color:rgb(8 38 99/var(--tw-text-opacity));font-size:1.25rem;letter-spacing:-0.025em;line-height:1.5rem}.divider{--tw-border-opacity:1;border-bottom-width:1px;border-color:rgb(107 121 121/var(--tw-border-opacity))}@keyframes svelte-14zs2vw-pulse{{opacity:0.5}}.animate-skeleton{--tw-bg-opacity:1;animation:svelte-14zs2vw-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;background-color:rgb(226 232 240/var(--tw-bg-opacity))}.btn-mcq-option:focus-visible{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);--tw-ring-opacity:1;--tw-ring-color:rgb(84 101 251/var(--tw-ring-opacity));--tw-ring-offset-width:4px;box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 rgba(0, 0, 0, 0));outline:2px solid transparent;outline-offset:2px;transition-duration:50ms}.btn-mcq-option{--tw-text-opacity:1;--tw-border-opacity:1;--tw-bg-opacity:1;align-items:center;background-color:rgb(247 250 250/var(--tw-bg-opacity));border-color:rgb(113 115 119/var(--tw-border-opacity));border-radius:0.5rem;border-width:1px;color:rgb(33 37 41/var(--tw-text-opacity));display:flex;font-size:1rem;justify-content:space-between;line-height:1.5rem;margin-bottom:1rem;min-height:48px;padding:0.5rem 0.75rem 0.5rem 0.5rem;width:100%}.btn-mcq-option:active{--tw-border-opacity:1;--tw-bg-opacity:1;background-color:rgb(222 222 255/var(--tw-bg-opacity));border-color:rgb(8 38 99/var(--tw-border-opacity));border-width:2px}@media(hover: hover) and (pointer: fine){.btn-mcq-option:hover{--tw-bg-opacity:1;background-color:rgb(222 222 255/var(--tw-bg-opacity))}}.btn-mcq-option>span>.choice{--tw-border-opacity:1;--tw-bg-opacity:1;--tw-text-opacity:1;align-items:center;background-color:rgb(255 255 255/var(--tw-bg-opacity));border-color:rgb(113 115 119/var(--tw-border-opacity));border-radius:1rem;border-width:1px;color:rgb(93 99 107/var(--tw-text-opacity));display:flex;font-size:1rem;font-weight:700;height:2rem;justify-content:center;letter-spacing:0.05em;line-height:1rem;margin-right:1rem;padding:0.5rem;width:2rem}.btn-mcq-option.selected{--tw-border-opacity:1;--tw-bg-opacity:1;background-color:rgb(222 222 255/var(--tw-bg-opacity))}.btn-mcq-option.selected,.btn-mcq-option.selected>span>.choice{border-color:rgb(8 38 99/var(--tw-border-opacity));border-width:2px}.btn-mcq-option.selected>span>.choice{--tw-border-opacity:1}.btn-mcq-option.selected.correct{--tw-border-opacity:1;--tw-bg-opacity:1;background-color:rgb(241 254 241/var(--tw-bg-opacity));border-color:rgb(0 102 5/var(--tw-border-opacity));border-width:1px}.btn-mcq-option.selected.incorrect{--tw-border-opacity:1;--tw-bg-opacity:1;background-color:rgb(253 243 247/var(--tw-bg-opacity));border-color:rgb(217 12 85/var(--tw-border-opacity));border-width:1px}.btn-mcq-option.selected.correct>span>.choice,.btn-mcq-option.selected.incorrect>span>.choice{--tw-border-opacity:1;border-color:rgb(113 115 119/var(--tw-border-opacity));border-width:1px}.typein-textbox:focus-visible{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);--tw-ring-opacity:1;--tw-ring-color:rgb(84 101 251/var(--tw-ring-opacity));--tw-ring-offset-width:4px;box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 rgba(0, 0, 0, 0));outline:2px solid transparent;outline-offset:2px;transition-duration:50ms}.typein-textbox{--tw-border-opacity:1;--tw-bg-opacity:1;--tw-text-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity));border-color:rgb(93 99 107/var(--tw-border-opacity));border-radius:0.5rem;border-width:1px;color:rgb(33 37 41/var(--tw-text-opacity));font-size:1rem;line-height:1.5rem;padding:0.75rem 1rem;width:100%}.typein-textbox::-moz-placeholder{--tw-placeholder-opacity:1;color:rgb(93 99 107/var(--tw-placeholder-opacity))}.typein-textbox::placeholder{--tw-placeholder-opacity:1;color:rgb(93 99 107/var(--tw-placeholder-opacity))}.typein-textbox:focus{--tw-border-opacity:1;border-color:rgb(84 101 251/var(--tw-border-opacity));border-width:2px}@media(hover: hover) and (pointer: fine){.typein-textbox:hover{--tw-border-opacity:1;border-color:rgb(84 101 251/var(--tw-border-opacity));border-width:2px;outline:2px solid transparent;outline-offset:2px}}.typein-textbox:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color)!important;--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color)!important;box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 rgba(0, 0, 0, 0)) !important}@media(hover: hover) and (pointer: fine){.typein-textbox:hover{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);--tw-ring-opacity:1;--tw-ring-color:rgb(84 101 251/var(--tw-ring-opacity));--tw-ring-offset-width:4px;box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 rgba(0, 0, 0, 0));transition-duration:50ms}}.absolute{position:absolute}.relative{position:relative}.inset-0{inset:0}.z-50{z-index:50}.my-6{margin-bottom:1.5rem;margin-top:1.5rem}.mb-1{margin-bottom:0.25rem}.mb-12{margin-bottom:3rem}.mb-2{margin-bottom:0.5rem}.mr-2{margin-right:0.5rem}.mt-0{margin-top:0}.mt-0\\.5{margin-top:0.125rem}.mt-2{margin-top:0.5rem}.block{display:block}.flex{display:flex}.h-52{height:13rem}.h-6{height:1.5rem}.w-full{width:100%}.grow{flex-grow:1}.items-start{align-items:flex-start}.items-center{align-items:center}.overflow-hidden{overflow:hidden}.rounded{border-radius:0.25rem}.border-2{border-width:2px}.border-l-\\[6px\\]{border-left-width:6px}.border-green-800{--tw-border-opacity:1;border-color:rgb(0 102 5/var(--tw-border-opacity))}.border-red-600{--tw-border-opacity:1;border-color:rgb(220 38 38/var(--tw-border-opacity))}.border-red-800{--tw-border-opacity:1;border-color:rgb(217 12 85/var(--tw-border-opacity))}.bg-green-300{--tw-bg-opacity:1;background-color:rgb(241 254 241/var(--tw-bg-opacity))}.bg-red-200{--tw-bg-opacity:1;background-color:rgb(254 202 202/var(--tw-bg-opacity))}.bg-red-300{--tw-bg-opacity:1;background-color:rgb(253 243 247/var(--tw-bg-opacity))}.bg-transparent{background-color:transparent}.p-0{padding:0}.p-0\\.5{padding:0.125rem}.p-2{padding:0.5rem}.p-4{padding:1rem}.text-left{text-align:left}.text-base{font-size:1rem;line-height:1.5rem}.font-semibold{font-weight:600}.text-charcoal{--tw-text-opacity:1;color:rgb(33 37 41/var(--tw-text-opacity))}.text-green-800{--tw-text-opacity:1;color:rgb(0 102 5/var(--tw-text-opacity))}.text-red-800{--tw-text-opacity:1;color:rgb(217 12 85/var(--tw-text-opacity))}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.group:active .group-active\\:border-2{border-width:2px}.group:active .group-active\\:border-blue-1000{--tw-border-opacity:1;border-color:rgb(8 38 99/var(--tw-border-opacity))}.group:active .group-active\\:p-\\[7px\\]{padding:7px}@media(min-width: 732px){.md\\:mb-4{margin-bottom:1rem}}');
2060
3052
  }
2061
- function create_else_block_1(ctx) {
3053
+ function create_else_block_12(ctx) {
2062
3054
  let invalidbanner;
2063
3055
  let current;
2064
3056
  invalidbanner = new InvalidBanner_default({ props: { bannerLabel } });
@@ -2086,22 +3078,22 @@
2086
3078
  }
2087
3079
  };
2088
3080
  }
2089
- function create_if_block_12(ctx) {
3081
+ function create_if_block_15(ctx) {
2090
3082
  let current_block_type_index;
2091
3083
  let if_block;
2092
3084
  let if_block_anchor;
2093
3085
  let current;
2094
- const if_block_creators = [create_if_block_2, create_if_block_3, create_else_block2];
3086
+ const if_block_creators = [create_if_block_23, create_if_block_32, create_else_block4];
2095
3087
  const if_blocks = [];
2096
3088
  function select_block_type_1(ctx2, dirty) {
2097
3089
  if (
2098
3090
  /*interactionType*/
2099
- ctx2[3] === "multipleChoiceInteraction"
3091
+ ctx2[3] === INTERACTION_TYPE_MCQ
2100
3092
  )
2101
3093
  return 0;
2102
3094
  if (
2103
3095
  /*interactionType*/
2104
- ctx2[3] === "typeInInteraction"
3096
+ ctx2[3] === INTERACTION_TYPE_TYPEIN
2105
3097
  )
2106
3098
  return 1;
2107
3099
  return 2;
@@ -2158,7 +3150,7 @@
2158
3150
  }
2159
3151
  };
2160
3152
  }
2161
- function create_if_block4(ctx) {
3153
+ function create_if_block5(ctx) {
2162
3154
  let promptskeleton;
2163
3155
  let current;
2164
3156
  promptskeleton = new PromptSkeleton_default({});
@@ -2186,7 +3178,7 @@
2186
3178
  }
2187
3179
  };
2188
3180
  }
2189
- function create_else_block2(ctx) {
3181
+ function create_else_block4(ctx) {
2190
3182
  let invalidbanner;
2191
3183
  let current;
2192
3184
  invalidbanner = new InvalidBanner_default({ props: { bannerLabel } });
@@ -2214,7 +3206,7 @@
2214
3206
  }
2215
3207
  };
2216
3208
  }
2217
- function create_if_block_3(ctx) {
3209
+ function create_if_block_32(ctx) {
2218
3210
  let prompttypein;
2219
3211
  let current;
2220
3212
  prompttypein = new PromptTypeIn_default({
@@ -2232,7 +3224,7 @@
2232
3224
  prompttypein.$on(
2233
3225
  "saveAnswer",
2234
3226
  /*saveEvent*/
2235
- ctx[4]
3227
+ ctx[6]
2236
3228
  );
2237
3229
  return {
2238
3230
  c() {
@@ -2269,7 +3261,7 @@
2269
3261
  }
2270
3262
  };
2271
3263
  }
2272
- function create_if_block_2(ctx) {
3264
+ function create_if_block_23(ctx) {
2273
3265
  let promptmcq;
2274
3266
  let current;
2275
3267
  promptmcq = new PromptMCQ_default({
@@ -2281,13 +3273,21 @@
2281
3273
  isDataSaving: (
2282
3274
  /*isDataSaving*/
2283
3275
  ctx[2]
3276
+ ),
3277
+ isFinished: (
3278
+ /*isFinished*/
3279
+ ctx[4]
3280
+ ),
3281
+ isResultCorrect: (
3282
+ /*isResultCorrect*/
3283
+ ctx[5]
2284
3284
  )
2285
3285
  }
2286
3286
  });
2287
3287
  promptmcq.$on(
2288
3288
  "saveOption",
2289
3289
  /*saveEvent*/
2290
- ctx[4]
3290
+ ctx[6]
2291
3291
  );
2292
3292
  return {
2293
3293
  c() {
@@ -2307,6 +3307,14 @@
2307
3307
  4)
2308
3308
  promptmcq_changes.isDataSaving = /*isDataSaving*/
2309
3309
  ctx2[2];
3310
+ if (dirty & /*isFinished*/
3311
+ 16)
3312
+ promptmcq_changes.isFinished = /*isFinished*/
3313
+ ctx2[4];
3314
+ if (dirty & /*isResultCorrect*/
3315
+ 32)
3316
+ promptmcq_changes.isResultCorrect = /*isResultCorrect*/
3317
+ ctx2[5];
2310
3318
  promptmcq.$set(promptmcq_changes);
2311
3319
  },
2312
3320
  i(local) {
@@ -2324,12 +3332,12 @@
2324
3332
  }
2325
3333
  };
2326
3334
  }
2327
- function create_fragment6(ctx) {
3335
+ function create_fragment10(ctx) {
2328
3336
  let current_block_type_index;
2329
3337
  let if_block;
2330
3338
  let if_block_anchor;
2331
3339
  let current;
2332
- const if_block_creators = [create_if_block4, create_if_block_12, create_else_block_1];
3340
+ const if_block_creators = [create_if_block5, create_if_block_15, create_else_block_12];
2333
3341
  const if_blocks = [];
2334
3342
  function select_block_type(ctx2, dirty) {
2335
3343
  if (
@@ -2397,18 +3405,23 @@
2397
3405
  };
2398
3406
  }
2399
3407
  var bannerLabel = "Invalid session id.";
2400
- function instance5($$self, $$props, $$invalidate) {
3408
+ function instance6($$self, $$props, $$invalidate) {
2401
3409
  const { "session-id": sessionId } = $$props;
2402
3410
  useSetupAPI();
2403
3411
  let sessionData;
2404
3412
  let isDataFetching = true;
2405
3413
  let isDataSaving = false;
2406
3414
  let interactionType = null;
3415
+ let isFinished2 = false;
3416
+ let isLocked = false;
3417
+ let isResultCorrect2 = false;
2407
3418
  const skipUserValidationStr = get_store_value(skipUserValidation) ? "?skip_user_validation=true" : "";
2408
3419
  const getSessionData = async (sessionId2) => {
2409
3420
  try {
2410
3421
  const { data } = await useGet(`sessions/${sessionId2}${skipUserValidationStr}`);
2411
- const { item_id: itemId, metadata } = data;
3422
+ const { item_id: itemId, metadata, is_finished: isSessionFinished, is_locked: isSessionLocked } = data;
3423
+ isLocked = isSessionLocked;
3424
+ $$invalidate(4, isFinished2 = isSessionFinished);
2412
3425
  if (itemId) {
2413
3426
  await getItemData(itemId, metadata);
2414
3427
  }
@@ -2418,9 +3431,13 @@
2418
3431
  };
2419
3432
  const getItemData = async (itemId, metadata) => {
2420
3433
  try {
2421
- const { data } = await useGet(`items/${itemId}`);
3434
+ const includeAnswer = isFinished2 && isLocked ? "?include=[correct_answer]" : "";
3435
+ const { data } = await useGet(`items/${itemId}${includeAnswer}`);
2422
3436
  $$invalidate(3, interactionType = getInteractionType(data));
2423
3437
  $$invalidate(0, sessionData = { ...data, metadata });
3438
+ if (isFinished2 && isLocked) {
3439
+ await getSessionScore();
3440
+ }
2424
3441
  } catch (error) {
2425
3442
  } finally {
2426
3443
  $$invalidate(1, isDataFetching = false);
@@ -2437,7 +3454,27 @@
2437
3454
  }
2438
3455
  return interactionType2;
2439
3456
  };
3457
+ const getSessionScore = async () => {
3458
+ try {
3459
+ const { data } = await useGet(`sessions/${sessionId}/score`);
3460
+ if (data) {
3461
+ const { metadata, has_answer: hasAnswer, scoring } = data[0];
3462
+ const scoringMetadata = {
3463
+ hasAnswer: !!hasAnswer,
3464
+ answerId: metadata.answer[0],
3465
+ correctAnswerId: metadata.correctAnswerId[0]
3466
+ };
3467
+ $$invalidate(0, sessionData = { ...sessionData, scoringMetadata });
3468
+ $$invalidate(5, isResultCorrect2 = scoring.score_earned);
3469
+ }
3470
+ } catch (error) {
3471
+ } finally {
3472
+ $$invalidate(1, isDataFetching = false);
3473
+ }
3474
+ };
2440
3475
  const saveEvent = async ({ detail }) => {
3476
+ if (isLocked || isFinished2)
3477
+ return;
2441
3478
  try {
2442
3479
  $$invalidate(2, isDataSaving = true);
2443
3480
  await usePatch(`sessions/${sessionId}${skipUserValidationStr}`, detail);
@@ -2451,15 +3488,23 @@
2451
3488
  getSessionData(sessionId);
2452
3489
  }
2453
3490
  $$self.$$set = ($$new_props) => {
2454
- $$invalidate(10, $$props = assign(assign({}, $$props), exclude_internal_props($$new_props)));
3491
+ $$invalidate(14, $$props = assign(assign({}, $$props), exclude_internal_props($$new_props)));
2455
3492
  };
2456
3493
  $$props = exclude_internal_props($$props);
2457
- return [sessionData, isDataFetching, isDataSaving, interactionType, saveEvent];
3494
+ return [
3495
+ sessionData,
3496
+ isDataFetching,
3497
+ isDataSaving,
3498
+ interactionType,
3499
+ isFinished2,
3500
+ isResultCorrect2,
3501
+ saveEvent
3502
+ ];
2458
3503
  }
2459
3504
  var PromptBuilder = class extends SvelteComponent {
2460
3505
  constructor(options) {
2461
3506
  super();
2462
- init(this, options, instance5, create_fragment6, safe_not_equal, {}, add_css);
3507
+ init(this, options, instance6, create_fragment10, safe_not_equal, {}, add_css);
2463
3508
  }
2464
3509
  };
2465
3510
  customElements.define("prompt-builder", create_custom_element(PromptBuilder, {}, [], [], true));