@orkg/scidquest 1.0.2 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/scidquest.es.js +105 -103
  2. package/package.json +1 -1
@@ -14,7 +14,7 @@ var ft = (i, e, t, n) => ({
14
14
  }
15
15
  });
16
16
  import { jsx as k, jsxs as V, Fragment as lm } from "react/jsx-runtime";
17
- import Ja, { createContext as Z1, useContext as X1, useMemo as Hi, useState as ce, useRef as vn, useCallback as on, useReducer as OW, forwardRef as OB, useImperativeHandle as NW, useEffect as Ve, useLayoutEffect as $W } from "react";
17
+ import Ja, { createContext as Z1, useContext as X1, useMemo as Hi, useState as ce, useRef as vn, useCallback as on, useReducer as OW, forwardRef as OB, useImperativeHandle as NW, useEffect as He, useLayoutEffect as $W } from "react";
18
18
  import { Provider as LW, useSelector as FW } from "react-redux";
19
19
  import { Box as le, Typography as ve, Button as Zs, List as ey, ListItem as D_, ListItemAvatar as BW, ListItemText as O_, IconButton as xi, Snackbar as ty, Alert as rc, Paper as B_, Tooltip as pa, TextField as ny, CircularProgress as iy, Dialog as pD, DialogTitle as gD, Chip as qs, DialogContent as mD, FormControl as jO, Select as HO, MenuItem as Xn, DialogActions as yD, Badge as MP, InputAdornment as VO, Accordion as zW, AccordionSummary as UW, AccordionDetails as jW, Menu as DP, Divider as dd, FormControlLabel as uS, Switch as dS, ListItemIcon as PT, Card as NB, CardHeader as $B, Collapse as WS, CardContent as LB, LinearProgress as HW, Skeleton as Qo, Tabs as VW, Tab as IT, useTheme as GW, useMediaQuery as WW } from "@mui/material";
20
20
  import qW from "@mui/icons-material/UploadFile";
@@ -20073,7 +20073,7 @@ const p8 = OB(function({ children: e, className: t, error: n = "Failed to load P
20073
20073
  function oe() {
20074
20074
  M({ type: "RESET" });
20075
20075
  }
20076
- Ve(oe, [a, M]);
20076
+ He(oe, [a, M]);
20077
20077
  const ke = on(async () => {
20078
20078
  if (!a)
20079
20079
  return null;
@@ -20094,7 +20094,7 @@ const p8 = OB(function({ children: e, className: t, error: n = "Failed to load P
20094
20094
  }
20095
20095
  return a;
20096
20096
  }, [a]);
20097
- Ve(() => {
20097
+ He(() => {
20098
20098
  const ge = qE(ke());
20099
20099
  return ge.promise.then((Ue) => {
20100
20100
  M({ type: "RESOLVE", value: Ue });
@@ -20103,7 +20103,7 @@ const p8 = OB(function({ children: e, className: t, error: n = "Failed to load P
20103
20103
  }), () => {
20104
20104
  hm(ge);
20105
20105
  };
20106
- }, [ke, M]), Ve(() => {
20106
+ }, [ke, M]), He(() => {
20107
20107
  if (!(typeof D > "u")) {
20108
20108
  if (D === !1) {
20109
20109
  te();
@@ -20118,9 +20118,9 @@ const p8 = OB(function({ children: e, className: t, error: n = "Failed to load P
20118
20118
  function R() {
20119
20119
  G && (Is(!1, G.toString()), f && f(G));
20120
20120
  }
20121
- Ve(function() {
20121
+ He(function() {
20122
20122
  F({ type: "RESET" });
20123
- }, [F, D]), Ve(function() {
20123
+ }, [F, D]), He(function() {
20124
20124
  if (!D)
20125
20125
  return;
20126
20126
  const Ue = x ? { ...D, ...x } : D, $e = jD(Ue);
@@ -20133,7 +20133,7 @@ const p8 = OB(function({ children: e, className: t, error: n = "Failed to load P
20133
20133
  }), () => {
20134
20134
  wt.destroy();
20135
20135
  };
20136
- }, [x, F, D]), Ve(() => {
20136
+ }, [x, F, D]), He(() => {
20137
20137
  if (!(typeof H > "u")) {
20138
20138
  if (H === !1) {
20139
20139
  R();
@@ -20141,7 +20141,7 @@ const p8 = OB(function({ children: e, className: t, error: n = "Failed to load P
20141
20141
  }
20142
20142
  K();
20143
20143
  }
20144
- }, [H]), Ve(function() {
20144
+ }, [H]), He(function() {
20145
20145
  z.current.setViewer(pe.current), z.current.setExternalLinkRel(s), z.current.setExternalLinkTarget(r);
20146
20146
  }, [s, r]);
20147
20147
  const Z = on((ge, Ue) => {
@@ -20218,9 +20218,9 @@ function g8() {
20218
20218
  function S() {
20219
20219
  x && (Is(!1, x.toString()), a && a(x));
20220
20220
  }
20221
- Ve(function() {
20221
+ He(function() {
20222
20222
  w({ type: "RESET" });
20223
- }, [w, d]), Ve(function() {
20223
+ }, [w, d]), He(function() {
20224
20224
  if (!d)
20225
20225
  return;
20226
20226
  const D = qE(d.getAnnotations()), O = D;
@@ -20231,7 +20231,7 @@ function g8() {
20231
20231
  }), () => {
20232
20232
  hm(O);
20233
20233
  };
20234
- }, [w, d]), Ve(() => {
20234
+ }, [w, d]), He(() => {
20235
20235
  if (v !== void 0) {
20236
20236
  if (v === !1) {
20237
20237
  S();
@@ -20247,7 +20247,7 @@ function g8() {
20247
20247
  Is(!1, `${M}`), c && c(M);
20248
20248
  }
20249
20249
  const P = Hi(() => d.getViewport({ scale: m, rotation: p }), [d, p, m]);
20250
- return Ve(function() {
20250
+ return He(function() {
20251
20251
  if (!h || !d || !r || !v)
20252
20252
  return;
20253
20253
  const { current: D } = A;
@@ -20418,9 +20418,9 @@ function w8() {
20418
20418
  function d() {
20419
20419
  a && (Is(!1, a.toString()), e && e(a));
20420
20420
  }
20421
- return Ve(function() {
20421
+ return He(function() {
20422
20422
  s({ type: "RESET" });
20423
- }, [s, c]), Ve(function() {
20423
+ }, [s, c]), He(function() {
20424
20424
  if (l || !c)
20425
20425
  return;
20426
20426
  const f = qE(c.getStructTree()), p = f;
@@ -20429,7 +20429,7 @@ function w8() {
20429
20429
  }).catch((m) => {
20430
20430
  s({ type: "REJECT", error: m });
20431
20431
  }), () => hm(p);
20432
- }, [l, c, s]), Ve(() => {
20432
+ }, [l, c, s]), He(() => {
20433
20433
  if (r !== void 0) {
20434
20434
  if (r === !1) {
20435
20435
  d();
@@ -20453,7 +20453,7 @@ function _8(i) {
20453
20453
  Zj(E) || (Is(!1, E.toString()), a && a(E));
20454
20454
  }
20455
20455
  const v = Hi(() => c.getViewport({ scale: f * r, rotation: h }), [r, c, h, f]), x = Hi(() => c.getViewport({ scale: f, rotation: h }), [c, h, f]);
20456
- Ve(function() {
20456
+ He(function() {
20457
20457
  if (!c)
20458
20458
  return;
20459
20459
  c.cleanup();
@@ -20477,7 +20477,7 @@ function _8(i) {
20477
20477
  const { current: E } = m;
20478
20478
  E && (E.width = 0, E.height = 0);
20479
20479
  }, []);
20480
- return Ve(() => A, [A]), k("canvas", { className: `${n}__canvas`, dir: "ltr", ref: Yj(p, m), style: {
20480
+ return He(() => A, [A]), k("canvas", { className: `${n}__canvas`, dir: "ltr", ref: Yj(p, m), style: {
20481
20481
  display: "block",
20482
20482
  userSelect: "none"
20483
20483
  }, children: d ? k(w8, {}) : null });
@@ -20498,9 +20498,9 @@ function x8() {
20498
20498
  function v() {
20499
20499
  m && (Is(!1, m.toString()), t && t(m));
20500
20500
  }
20501
- Ve(function() {
20501
+ He(function() {
20502
20502
  f({ type: "RESET" });
20503
- }, [a, f]), Ve(function() {
20503
+ }, [a, f]), He(function() {
20504
20504
  if (!a)
20505
20505
  return;
20506
20506
  const P = qE(a.getTextContent()), M = P;
@@ -20509,7 +20509,7 @@ function x8() {
20509
20509
  }).catch((D) => {
20510
20510
  f({ type: "REJECT", error: D });
20511
20511
  }), () => hm(M);
20512
- }, [a, f]), Ve(() => {
20512
+ }, [a, f]), He(() => {
20513
20513
  if (p !== void 0) {
20514
20514
  if (p === !1) {
20515
20515
  v();
@@ -20594,7 +20594,7 @@ function E8(i) {
20594
20594
  }
20595
20595
  return he * de;
20596
20596
  }, [m, X, wt, K, Z]);
20597
- Ve(function() {
20597
+ He(function() {
20598
20598
  return () => {
20599
20599
  mf(Ue) && s && R && R(Ue);
20600
20600
  };
@@ -20614,9 +20614,9 @@ function E8(i) {
20614
20614
  function Jo() {
20615
20615
  fe && (Is(!1, fe.toString()), P && P(fe));
20616
20616
  }
20617
- Ve(function() {
20617
+ He(function() {
20618
20618
  N({ type: "RESET" });
20619
- }, [N, q, Ue]), Ve(function() {
20619
+ }, [N, q, Ue]), He(function() {
20620
20620
  if (!q || !$e)
20621
20621
  return;
20622
20622
  const he = qE(q.getPage($e)), ye = he;
@@ -20625,7 +20625,7 @@ function E8(i) {
20625
20625
  }).catch((je) => {
20626
20626
  N({ type: "REJECT", error: je });
20627
20627
  }), () => hm(ye);
20628
- }, [N, q, $e]), Ve(() => {
20628
+ }, [N, q, $e]), He(() => {
20629
20629
  if (X !== void 0) {
20630
20630
  if (X === !1) {
20631
20631
  Jo();
@@ -20764,7 +20764,7 @@ const t$ = ({
20764
20764
  const M = parseInt(w, 10);
20765
20765
  isNaN(M) || E(M);
20766
20766
  }, C = () => y((P) => Math.min(P + 10, 200)), T = () => y((P) => Math.max(P - 10, 50));
20767
- return Ve(() => {
20767
+ return He(() => {
20768
20768
  if (!c || !i.current) return;
20769
20769
  const P = i.current, M = () => {
20770
20770
  const D = P.getBoundingClientRect(), O = D.top + D.height / 2;
@@ -20776,11 +20776,11 @@ const t$ = ({
20776
20776
  }), j !== f && (p(j), v(String(j)));
20777
20777
  };
20778
20778
  return P.addEventListener("scroll", M), () => P.removeEventListener("scroll", M);
20779
- }, [c, f, i]), Ve(() => {
20779
+ }, [c, f, i]), He(() => {
20780
20780
  n && n({ goToPage: E });
20781
- }, [n, c]), Ve(() => {
20781
+ }, [n, c]), He(() => {
20782
20782
  u(null), h(!1);
20783
- }, [e]), Ve(() => {
20783
+ }, [e]), He(() => {
20784
20784
  if (!e || !s || !l) return;
20785
20785
  let P = !1;
20786
20786
  return (async () => {
@@ -21057,9 +21057,9 @@ const hT = ({ desc: i, label: e }) => i ? /* @__PURE__ */ k(
21057
21057
  "aria-describedby": f
21058
21058
  }) => {
21059
21059
  const [p, m] = ce(i ?? "");
21060
- return Ve(() => {
21060
+ return He(() => {
21061
21061
  m(i ?? "");
21062
- }, [i]), Ve(() => {
21062
+ }, [i]), He(() => {
21063
21063
  if (l) return;
21064
21064
  const y = setTimeout(() => {
21065
21065
  (i ?? "") !== p && e(p);
@@ -21099,7 +21099,7 @@ const hT = ({ desc: i, label: e }) => i ? /* @__PURE__ */ k(
21099
21099
  }
21100
21100
  return {};
21101
21101
  }, n = t(), [s, r] = ce(n.provider || "mistral"), [a, l] = ce(n.openaiModel || "gpt-4o-mini"), [c, u] = ce(n.groqModel || "deepseek-r1-distill-llama-70b"), [d, h] = ce(n.mistralModel || "mistral-large-latest"), [f, p] = ce(n.openaiApiKey || ""), [m, y] = ce(n.groqApiKey || ""), [w, v] = ce(n.mistralApiKey || ""), [x, A] = ce(!1), [E, S] = ce(!1), [C, T] = ce(!1), [P, M] = ce(null), D = !!n.isConfigured;
21102
- Ve(() => {
21102
+ He(() => {
21103
21103
  if (i) {
21104
21104
  const F = t();
21105
21105
  r(F.provider || "mistral"), l(F.openaiModel || "gpt-4o-mini"), u(F.groqModel || "deepseek-r1-distill-llama-70b"), h(F.mistralModel || "mistral-large-latest"), p(F.openaiApiKey || ""), y(F.groqApiKey || ""), v(F.mistralApiKey || ""), M(null);
@@ -32758,7 +32758,7 @@ async function fie({
32758
32758
  providerOptions: f,
32759
32759
  abortSignal: l,
32760
32760
  headers: F
32761
- }), He = {
32761
+ }), Ve = {
32762
32762
  id: (J = (re = Ce.response) == null ? void 0 : re.id) != null ? J : E(),
32763
32763
  timestamp: (de = (xe = Ce.response) == null ? void 0 : xe.timestamp) != null ? de : S(),
32764
32764
  modelId: (ye = (he = Ce.response) == null ? void 0 : he.modelId) != null ? ye : $e.modelId,
@@ -32779,9 +32779,9 @@ async function fie({
32779
32779
  return Oe == null ? void 0 : JSON.stringify(Oe);
32780
32780
  }
32781
32781
  },
32782
- "ai.response.id": He.id,
32783
- "ai.response.model": He.modelId,
32784
- "ai.response.timestamp": He.timestamp.toISOString(),
32782
+ "ai.response.id": Ve.id,
32783
+ "ai.response.model": Ve.modelId,
32784
+ "ai.response.timestamp": Ve.timestamp.toISOString(),
32785
32785
  "ai.response.providerMetadata": JSON.stringify(
32786
32786
  Ce.providerMetadata
32787
32787
  ),
@@ -32790,13 +32790,13 @@ async function fie({
32790
32790
  "ai.usage.completionTokens": Ce.usage.outputTokens,
32791
32791
  // standardized gen-ai llm span attributes:
32792
32792
  "gen_ai.response.finish_reasons": [Ce.finishReason],
32793
- "gen_ai.response.id": He.id,
32794
- "gen_ai.response.model": He.modelId,
32793
+ "gen_ai.response.id": Ve.id,
32794
+ "gen_ai.response.model": Ve.modelId,
32795
32795
  "gen_ai.usage.input_tokens": Ce.usage.inputTokens,
32796
32796
  "gen_ai.usage.output_tokens": Ce.usage.outputTokens
32797
32797
  }
32798
32798
  })
32799
- ), { ...Ce, response: He };
32799
+ ), { ...Ce, response: Ve };
32800
32800
  }
32801
32801
  });
32802
32802
  }
@@ -42313,7 +42313,7 @@ const sle = () => {
42313
42313
  }
42314
42314
  return {};
42315
42315
  }, [e, t] = ce(i());
42316
- return Ve(() => {
42316
+ return He(() => {
42317
42317
  const n = () => t(i());
42318
42318
  return window.addEventListener("ai-config-changed", n), () => window.removeEventListener("ai-config-changed", n);
42319
42319
  }, []), new ile({
@@ -42627,7 +42627,7 @@ const bP = new lle(), vP = {
42627
42627
  )
42628
42628
  }));
42629
42629
  };
42630
- Ve(() => {
42630
+ He(() => {
42631
42631
  localStorage.setItem("questionnaire-ai-history", JSON.stringify(e));
42632
42632
  }, [e]);
42633
42633
  const r = (p) => e.history.filter((m) => m.questionId === p).sort((m, y) => y.timestamp - m.timestamp), a = (p) => e.history.filter((m) => m.type === p).sort((m, y) => y.timestamp - m.timestamp), l = () => {
@@ -42868,7 +42868,7 @@ ${pe.text}`).join(`
42868
42868
  ), [w, v] = ce(null), [x, A] = ce(
42869
42869
  null
42870
42870
  );
42871
- Ve(() => {
42871
+ He(() => {
42872
42872
  try {
42873
42873
  localStorage.setItem(
42874
42874
  "questionnaire_ai_excluded_items",
@@ -42877,7 +42877,7 @@ ${pe.text}`).join(`
42877
42877
  } catch (N) {
42878
42878
  console.error("Failed to save excluded items:", N);
42879
42879
  }
42880
- }, [c]), Ve(() => {
42880
+ }, [c]), He(() => {
42881
42881
  const N = localStorage.getItem(d2);
42882
42882
  if (N)
42883
42883
  try {
@@ -42885,12 +42885,12 @@ ${pe.text}`).join(`
42885
42885
  } catch (X) {
42886
42886
  console.error("Error loading AI context preferences:", X), y(u2());
42887
42887
  }
42888
- }, []), Ve(() => {
42888
+ }, []), He(() => {
42889
42889
  localStorage.setItem(
42890
42890
  d2,
42891
42891
  JSON.stringify(m)
42892
42892
  );
42893
- }, [m]), Ve(() => {
42893
+ }, [m]), He(() => {
42894
42894
  const N = localStorage.getItem("questionnaire_ai_excluded_items");
42895
42895
  if (!N && !d && n.history.length > 0) {
42896
42896
  const fe = n.history.filter(
@@ -62420,7 +62420,7 @@ const CT = ({
62420
62420
  const y = vn(null), w = vn(null), { addToHistory: v, updateHistoryMetadata: x, state: A } = c0(), E = vn(/* @__PURE__ */ new Map()), [S, C] = ce({}), [T, P] = ce(!1), [M, D] = ce(0), [O, j] = ce(null), [F, H] = ce(null), [G, z] = ce(0), [L, q] = ce(""), ee = on((U) => {
62421
62421
  q(U), setTimeout(() => q(""), 100);
62422
62422
  }, []);
62423
- Ve(() => {
62423
+ He(() => {
62424
62424
  if (i.length > 0) {
62425
62425
  const U = A.history.filter(
62426
62426
  (Q) => Q.questionId === l && Q.type === "suggestion"
@@ -62452,9 +62452,9 @@ const CT = ({
62452
62452
  Array.from(E.current.entries())
62453
62453
  );
62454
62454
  }
62455
- }, [i, l, A.history]), Ve(() => {
62455
+ }, [i, l, A.history]), He(() => {
62456
62456
  i.length > 0 && C({});
62457
- }, [i]), Ve(() => {
62457
+ }, [i]), He(() => {
62458
62458
  if (s) {
62459
62459
  z(0);
62460
62460
  const U = setInterval(() => {
@@ -62463,7 +62463,7 @@ const CT = ({
62463
62463
  return () => clearInterval(U);
62464
62464
  } else
62465
62465
  z(100);
62466
- }, [s]), Ve(() => {
62466
+ }, [s]), He(() => {
62467
62467
  if (!p) {
62468
62468
  j(null);
62469
62469
  return;
@@ -62479,9 +62479,9 @@ const CT = ({
62479
62479
  })(), () => {
62480
62480
  U = !0;
62481
62481
  };
62482
- }, [p]), Ve(() => () => {
62482
+ }, [p]), He(() => () => {
62483
62483
  f && f({});
62484
- }, []), Ve(() => {
62484
+ }, []), He(() => {
62485
62485
  if (!s && i.length > 0 && !r) {
62486
62486
  P(!0);
62487
62487
  const U = i.length !== 1 ? "s" : "";
@@ -62491,18 +62491,18 @@ const CT = ({
62491
62491
  const Q = setTimeout(() => P(!1), 3e3);
62492
62492
  return () => clearTimeout(Q);
62493
62493
  }
62494
- }, [s, i.length, r, ee]), Ve(() => {
62494
+ }, [s, i.length, r, ee]), He(() => {
62495
62495
  s && ee("Generating suggestions, please wait...");
62496
- }, [s, ee]), Ve(() => {
62496
+ }, [s, ee]), He(() => {
62497
62497
  r && ee(`Error: ${r}`);
62498
- }, [r, ee]), Ve(() => {
62498
+ }, [r, ee]), He(() => {
62499
62499
  const U = (Q) => {
62500
62500
  y.current && !y.current.contains(Q.target) && !u && d && d();
62501
62501
  };
62502
62502
  return document.addEventListener("mousedown", U), () => {
62503
62503
  document.removeEventListener("mousedown", U);
62504
62504
  };
62505
- }, [d, u]), Ve(() => {
62505
+ }, [d, u]), He(() => {
62506
62506
  const U = (Q) => {
62507
62507
  var N;
62508
62508
  if (Q.key === "Escape") {
@@ -62532,14 +62532,14 @@ const CT = ({
62532
62532
  i,
62533
62533
  s,
62534
62534
  M
62535
- ]), Ve(() => {
62535
+ ]), He(() => {
62536
62536
  if (!s && i.length > 0 && y.current) {
62537
62537
  const U = y.current.querySelector(
62538
62538
  '[role="article"]'
62539
62539
  );
62540
62540
  U && U.focus();
62541
62541
  }
62542
- }, [s, i.length]), Ve(() => {
62542
+ }, [s, i.length]), He(() => {
62543
62543
  if (y.current && i.length > 0) {
62544
62544
  const Q = y.current.querySelectorAll('[role="article"]')[M];
62545
62545
  Q && Q.focus();
@@ -64363,7 +64363,7 @@ const CT = ({
64363
64363
  }, K = (R) => {
64364
64364
  l && l(R);
64365
64365
  };
64366
- return Ve(() => {
64366
+ return He(() => {
64367
64367
  i.required && (!Array.isArray(e) || e.length === 0) && t([""]);
64368
64368
  }, [i.required, i.id]), /* @__PURE__ */ k(vm, { level: s, ref: h, children: /* @__PURE__ */ V(
64369
64369
  st,
@@ -64524,7 +64524,7 @@ const CT = ({
64524
64524
  currentEntryIndex: v
64525
64525
  }) => {
64526
64526
  const x = Array.isArray(e) ? e : [], A = i.desc ?? i.description ?? "", [E, S] = ce({});
64527
- Ve(() => {
64527
+ He(() => {
64528
64528
  if (i.required && (!Array.isArray(e) || e.length === 0)) {
64529
64529
  const T = i.item_fields ? i.item_fields.reduce((P, M) => (P[M.id] = M.type === "multi_select" ? [] : "", P), {}) : {};
64530
64530
  t([T]);
@@ -65142,7 +65142,7 @@ const CT = ({
65142
65142
  n(!1);
65143
65143
  }
65144
65144
  }, []);
65145
- return Ve(() => {
65145
+ return He(() => {
65146
65146
  s();
65147
65147
  }, [s]), /* @__PURE__ */ V(lm, { children: [
65148
65148
  /* @__PURE__ */ k(
@@ -65589,7 +65589,7 @@ const CT = ({
65589
65589
  isValidating: a
65590
65590
  }) => {
65591
65591
  const [l, c] = ce("replace"), u = vn(null), d = vn(null);
65592
- Ve(() => {
65592
+ He(() => {
65593
65593
  if (i && !r && !a && s && u.current) {
65594
65594
  const w = setTimeout(() => {
65595
65595
  var v;
@@ -66266,7 +66266,7 @@ const j2 = "template_answers_v1_", Kue = (i, e = 500) => {
66266
66266
  },
66267
66267
  []
66268
66268
  );
66269
- Ve(() => {
66269
+ He(() => {
66270
66270
  if (!i) return;
66271
66271
  const ne = j2 + (i.template_id ?? i.template ?? "default");
66272
66272
  Kue((re) => {
@@ -66275,7 +66275,7 @@ const j2 = "template_answers_v1_", Kue = (i, e = 500) => {
66275
66275
  } catch {
66276
66276
  }
66277
66277
  }, 700)({ answers: e });
66278
- }, [e, i]), Ve(() => {
66278
+ }, [e, i]), He(() => {
66279
66279
  if (!i) return;
66280
66280
  const ne = j2 + (i.template_id ?? i.template ?? "default");
66281
66281
  try {
@@ -66465,8 +66465,8 @@ const j2 = "template_answers_v1_", Kue = (i, e = 500) => {
66465
66465
  } catch (be) {
66466
66466
  let Ce = "Invalid JSON file: Could not parse the file.";
66467
66467
  if (be instanceof SyntaxError) {
66468
- const He = be, Oe = He.message.match(/position (\d+)/i);
66469
- Oe ? Ce += ` Syntax error at position ${Oe[1]}.` : Ce += ` ${He.message}`;
66468
+ const Ve = be, Oe = Ve.message.match(/position (\d+)/i);
66469
+ Oe ? Ce += ` Syntax error at position ${Oe[1]}.` : Ce += ` ${Ve.message}`;
66470
66470
  }
66471
66471
  Ce += " Please check the file format and ensure it contains valid JSON.", D(Ce), j(!1), E(!0);
66472
66472
  return;
@@ -66495,9 +66495,9 @@ const j2 = "template_answers_v1_", Kue = (i, e = 500) => {
66495
66495
  }
66496
66496
  if (he.type === "repeat_group") {
66497
66497
  let be = 0, Ce = 0;
66498
- const He = Array.isArray(ye) ? ye : [];
66499
- return He.length > 0 && Array.isArray(he.item_fields) && he.item_fields.forEach((Oe) => {
66500
- Oe != null && Oe.required ? He.forEach((Ct) => {
66498
+ const Ve = Array.isArray(ye) ? ye : [];
66499
+ return Ve.length > 0 && Array.isArray(he.item_fields) && he.item_fields.forEach((Oe) => {
66500
+ Oe != null && Oe.required ? Ve.forEach((Ct) => {
66501
66501
  if (Oe.type === "group" || Oe.type === "repeat_group" || Oe.type === "repeat_text") {
66502
66502
  const { t: zn, a: co } = re(Oe, Ct == null ? void 0 : Ct[Oe.id]);
66503
66503
  be += zn, Ce += co;
@@ -66506,7 +66506,7 @@ const j2 = "template_answers_v1_", Kue = (i, e = 500) => {
66506
66506
  const zn = Ct == null ? void 0 : Ct[Oe.id];
66507
66507
  se(zn) || (Ce += 1);
66508
66508
  }
66509
- }) : (Oe.type === "group" || Oe.type === "repeat_group") && He.forEach((Ct) => {
66509
+ }) : (Oe.type === "group" || Oe.type === "repeat_group") && Ve.forEach((Ct) => {
66510
66510
  const { t: zn, a: co } = re(Oe, Ct == null ? void 0 : Ct[Oe.id]);
66511
66511
  be += zn, Ce += co;
66512
66512
  });
@@ -66514,11 +66514,11 @@ const j2 = "template_answers_v1_", Kue = (i, e = 500) => {
66514
66514
  }
66515
66515
  if (he.type === "group") {
66516
66516
  const be = he.item_fields ?? he.subquestions ?? [];
66517
- let Ce = 0, He = 0;
66517
+ let Ce = 0, Ve = 0;
66518
66518
  return be.forEach((Oe) => {
66519
66519
  const Ct = ye ? ye[Oe.id] : void 0, { t: zn, a: co } = re(Oe, Ct);
66520
- Ce += zn, He += co;
66521
- }), { t: Ce, a: He };
66520
+ Ce += zn, Ve += co;
66521
+ }), { t: Ce, a: Ve };
66522
66522
  }
66523
66523
  return he.required ? { t: 1, a: se(ye) ? 0 : 1 } : { t: 0, a: 0 };
66524
66524
  }, J = Cm(ne);
@@ -66534,8 +66534,8 @@ const j2 = "template_answers_v1_", Kue = (i, e = 500) => {
66534
66534
  );
66535
66535
  xe = ye ? 1 : 0, ye && he.length > 0 && (de = 1), he.length > 0 && he.forEach((je) => {
66536
66536
  (ne.questions || []).forEach((be) => {
66537
- const Ce = je == null ? void 0 : je[be.id], { t: He, a: Oe } = re(be, Ce);
66538
- xe += He, de += Oe;
66537
+ const Ce = je == null ? void 0 : je[be.id], { t: Ve, a: Oe } = re(be, Ce);
66538
+ xe += Ve, de += Oe;
66539
66539
  });
66540
66540
  });
66541
66541
  }
@@ -66555,18 +66555,18 @@ const j2 = "template_answers_v1_", Kue = (i, e = 500) => {
66555
66555
  if (de.type === "repeat_group") {
66556
66556
  let je = 0, be = 0;
66557
66557
  const Ce = Array.isArray(he) ? he : [];
66558
- return Ce.length > 0 && Array.isArray(de.item_fields) && de.item_fields.forEach((He) => {
66559
- He != null && He.required ? Ce.forEach((Oe) => {
66560
- if (He.type === "group" || He.type === "repeat_group" || He.type === "repeat_text") {
66561
- const { t: Ct, a: zn } = se(He, Oe == null ? void 0 : Oe[He.id]);
66558
+ return Ce.length > 0 && Array.isArray(de.item_fields) && de.item_fields.forEach((Ve) => {
66559
+ Ve != null && Ve.required ? Ce.forEach((Oe) => {
66560
+ if (Ve.type === "group" || Ve.type === "repeat_group" || Ve.type === "repeat_text") {
66561
+ const { t: Ct, a: zn } = se(Ve, Oe == null ? void 0 : Oe[Ve.id]);
66562
66562
  je += Ct, be += zn;
66563
66563
  } else {
66564
66564
  je += 1;
66565
- const Ct = Oe == null ? void 0 : Oe[He.id];
66565
+ const Ct = Oe == null ? void 0 : Oe[Ve.id];
66566
66566
  ne(Ct) && (be += 1);
66567
66567
  }
66568
- }) : (He.type === "group" || He.type === "repeat_group") && Ce.forEach((Oe) => {
66569
- const { t: Ct, a: zn } = se(He, Oe == null ? void 0 : Oe[He.id]);
66568
+ }) : (Ve.type === "group" || Ve.type === "repeat_group") && Ce.forEach((Oe) => {
66569
+ const { t: Ct, a: zn } = se(Ve, Oe == null ? void 0 : Oe[Ve.id]);
66570
66570
  je += Ct, be += zn;
66571
66571
  });
66572
66572
  }), { t: je, a: be };
@@ -66574,8 +66574,8 @@ const j2 = "template_answers_v1_", Kue = (i, e = 500) => {
66574
66574
  if (de.type === "group") {
66575
66575
  const je = de.item_fields ?? de.subquestions ?? [];
66576
66576
  let be = 0, Ce = 0;
66577
- return je.forEach((He) => {
66578
- const Oe = he ? he[He.id] : void 0, { t: Ct, a: zn } = se(He, Oe);
66577
+ return je.forEach((Ve) => {
66578
+ const Oe = he ? he[Ve.id] : void 0, { t: Ct, a: zn } = se(Ve, Oe);
66579
66579
  be += Ct, Ce += zn;
66580
66580
  }), { t: be, a: Ce };
66581
66581
  }
@@ -66587,16 +66587,16 @@ const j2 = "template_answers_v1_", Kue = (i, e = 500) => {
66587
66587
  let he = 0, ye = 0;
66588
66588
  if (!Cm(de))
66589
66589
  (de.questions || []).forEach((be) => {
66590
- const Ce = e[be.id], { t: He, a: Oe } = se(be, Ce);
66591
- he += He, ye += Oe;
66590
+ const Ce = e[be.id], { t: Ve, a: Oe } = se(be, Ce);
66591
+ he += Ve, ye += Oe;
66592
66592
  });
66593
66593
  else {
66594
66594
  const be = Array.isArray(e[de.id]) ? e[de.id] : [];
66595
66595
  (de.questions || []).some(
66596
- (He) => He.required
66597
- ) && (he += 1, be.length > 0 && (ye += 1)), be.length > 0 && be.forEach((He) => {
66596
+ (Ve) => Ve.required
66597
+ ) && (he += 1, be.length > 0 && (ye += 1)), be.length > 0 && be.forEach((Ve) => {
66598
66598
  (de.questions || []).forEach((Oe) => {
66599
- const Ct = He == null ? void 0 : He[Oe.id], { t: zn, a: co } = se(Oe, Ct);
66599
+ const Ct = Ve == null ? void 0 : Ve[Oe.id], { t: zn, a: co } = se(Oe, Ct);
66600
66600
  he += zn, ye += co;
66601
66601
  });
66602
66602
  });
@@ -66620,14 +66620,14 @@ const j2 = "template_answers_v1_", Kue = (i, e = 500) => {
66620
66620
  }), ye;
66621
66621
  if (J.type === "group")
66622
66622
  return (J.item_fields ?? J.subquestions ?? []).forEach((Ce) => {
66623
- const He = xe ? xe[Ce.id] : void 0, Oe = J.label || J.title, Ct = Oe ? `${de} → ${Oe}` : de;
66623
+ const Ve = xe ? xe[Ce.id] : void 0, Oe = J.label || J.title, Ct = Oe ? `${de} → ${Oe}` : de;
66624
66624
  ye.push(
66625
- ...re(Ce, He, Ct, `${he}-${J.id}-g`)
66625
+ ...re(Ce, Ve, Ct, `${he}-${J.id}-g`)
66626
66626
  );
66627
66627
  }), ye;
66628
66628
  if (J.type === "repeat_group") {
66629
66629
  const be = Array.isArray(xe) ? xe : [];
66630
- return be.length === 0 || be.forEach((Ce, He) => {
66630
+ return be.length === 0 || be.forEach((Ce, Ve) => {
66631
66631
  (J.item_fields || []).forEach((Oe) => {
66632
66632
  if (Oe) {
66633
66633
  if (Oe.type === "group" || Oe.type === "repeat_group" || Oe.type === "repeat_text") {
@@ -66636,8 +66636,8 @@ const j2 = "template_answers_v1_", Kue = (i, e = 500) => {
66636
66636
  ...re(
66637
66637
  Oe,
66638
66638
  Ct,
66639
- `${de} → ${zn} #${He + 1}`,
66640
- `${he}-${J.id}-item-${He}`
66639
+ `${de} → ${zn} #${Ve + 1}`,
66640
+ `${he}-${J.id}-item-${Ve}`
66641
66641
  )
66642
66642
  );
66643
66643
  } else if (Oe.required) {
@@ -66645,8 +66645,8 @@ const j2 = "template_answers_v1_", Kue = (i, e = 500) => {
66645
66645
  if (se(Ct)) {
66646
66646
  const zn = J.label || J.title || "Group", co = Oe.label || Oe.title || "Untitled";
66647
66647
  ye.push({
66648
- id: `${he}-${J.id}-item-${He}-f-${Oe.id}`,
66649
- label: `${de} → ${zn} #${He + 1} → ${co}`
66648
+ id: `${he}-${J.id}-item-${Ve}-f-${Oe.id}`,
66649
+ label: `${de} → ${zn} #${Ve + 1} → ${co}`
66650
66650
  });
66651
66651
  }
66652
66652
  }
@@ -66715,11 +66715,11 @@ const j2 = "template_answers_v1_", Kue = (i, e = 500) => {
66715
66715
  }
66716
66716
  }
66717
66717
  re.type === "group" ? (re.item_fields ?? re.subquestions ?? []).forEach((Ce) => {
66718
- const He = J ? J[Ce.id] : void 0, Oe = re.label || re.title, Ct = Oe ? he ? `${he} → ${Oe}` : Oe : he;
66719
- se(Ce, He, xe, de, Ct);
66720
- }) : re.type === "repeat_group" && (Array.isArray(J) ? J : []).forEach((Ce, He) => {
66718
+ const Ve = J ? J[Ce.id] : void 0, Oe = re.label || re.title, Ct = Oe ? he ? `${he} → ${Oe}` : Oe : he;
66719
+ se(Ce, Ve, xe, de, Ct);
66720
+ }) : re.type === "repeat_group" && (Array.isArray(J) ? J : []).forEach((Ce, Ve) => {
66721
66721
  (re.item_fields || []).forEach((Oe) => {
66722
- const Ct = Ce == null ? void 0 : Ce[Oe.id], zn = re.label || re.title || "Group", co = he ? `${he} → ${zn} #${He + 1}` : `${zn} #${He + 1}`;
66722
+ const Ct = Ce == null ? void 0 : Ce[Oe.id], zn = re.label || re.title || "Group", co = he ? `${he} → ${zn} #${Ve + 1}` : `${zn} #${Ve + 1}`;
66723
66723
  se(
66724
66724
  Oe,
66725
66725
  Ct,
@@ -66780,10 +66780,10 @@ const j2 = "template_answers_v1_", Kue = (i, e = 500) => {
66780
66780
  else if (re.type === "repeat_group")
66781
66781
  (Array.isArray(J) ? J : []).forEach((je, be) => {
66782
66782
  (re.item_fields || []).forEach((Ce) => {
66783
- const He = je == null ? void 0 : je[Ce.id];
66783
+ const Ve = je == null ? void 0 : je[Ce.id];
66784
66784
  se(
66785
66785
  Ce,
66786
- He,
66786
+ Ve,
66787
66787
  `${xe}[${be}].${Ce.id}`,
66788
66788
  `${de}${re.label} #${be + 1} → `
66789
66789
  );
@@ -67078,11 +67078,13 @@ const Wpe = ({
67078
67078
  ), [M, D] = ce(null), [O, j] = ce(
67079
67079
  null
67080
67080
  ), [F, H] = ce({}), G = q2(A) ? A : null, z = e || kue, L = t || fD;
67081
- Ve(() => {
67081
+ He(() => {
67082
67082
  A && !q2(A) && (E(null), C(null));
67083
- }, [A]), Ve(() => {
67083
+ }, [A]), He(() => {
67084
67084
  a && a(p);
67085
- }, [p, a]), Ve(() => {
67085
+ }, [p, a]), He(() => {
67086
+ l && m((K) => JSON.stringify(K) !== JSON.stringify(l) ? l : K);
67087
+ }, [l]), He(() => {
67086
67088
  const K = () => {
67087
67089
  if (s === "split" && !d) {
67088
67090
  if (f.current)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orkg/scidquest",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "description": "SciD-QuESt: From Scientific Documents to Knowledge - Questionnaire-Based Extraction and Structuring of Knowledge in the Open Research Knowledge Graph with LLMs and Human Validation",