fix closing tag /mark

#9
by rsn86 - opened
src/backend/gradio_highlightedtextbox/templates/component/index.js CHANGED
@@ -1,7 +1,7 @@
1
  const {
2
  SvelteComponent: qn,
3
  append: re,
4
- attr: K,
5
  create_slot: kn,
6
  destroy_each: Sn,
7
  detach: fe,
@@ -40,20 +40,20 @@ function st(n) {
40
  ), s = Ne();
41
  for (let a = 0; a < r.length; a += 1)
42
  r[a].c();
43
- K(e, "class", "legend-separator svelte-vm3q5z"), V(e, "hide", !/*show_legend*/
44
  n[1] || !/*show_label*/
45
  n[0]), V(
46
  e,
47
  "has-info",
48
  /*info*/
49
  n[5] != null
50
- ), K(l, "class", "svelte-vm3q5z"), V(l, "hide", !/*show_legend_label*/
51
  n[2]), V(
52
  l,
53
  "has-info",
54
  /*info*/
55
  n[5] != null
56
- ), K(o, "class", "category-legend svelte-vm3q5z"), K(o, "data-testid", "highlighted-text:category-legend"), V(o, "hide", !/*show_legend*/
57
  n[1]);
58
  },
59
  m(a, f) {
@@ -115,7 +115,7 @@ function at(n) {
115
  ), o, l, i;
116
  return {
117
  c() {
118
- e = ge("div"), o = xe(t), l = Ne(), K(e, "class", "category-label svelte-vm3q5z"), K(e, "style", i = "background-color:" + /*color*/
119
  n[9].secondary), V(
120
  e,
121
  "has-info",
@@ -131,7 +131,7 @@ function at(n) {
131
  16 && t !== (t = /*category*/
132
  s[8] + "") && Qe(o, t), _ & /*_color_map*/
133
  16 && i !== (i = "background-color:" + /*color*/
134
- s[9].secondary) && K(e, "style", i), _ & /*info*/
135
  32 && V(
136
  e,
137
  "has-info",
@@ -151,7 +151,7 @@ function _t(n) {
151
  e = ge("div"), t = xe(
152
  /*info*/
153
  n[5]
154
- ), K(e, "class", "title-with-highlights-info svelte-vm3q5z");
155
  },
156
  m(o, l) {
157
  ce(o, e, l), re(e, t);
@@ -190,14 +190,14 @@ function Vn(n) {
190
  );
191
  return {
192
  c() {
193
- e = ge("div"), t = ge("span"), a && a.c(), o = Ne(), f && f.c(), i = Ne(), c && c.c(), s = yn(), K(t, "data-testid", "block-info"), K(t, "class", "svelte-vm3q5z"), V(t, "sr-only", !/*show_label*/
194
  n[0]), V(t, "hide", !/*show_label*/
195
  n[0]), V(
196
  t,
197
  "has-info",
198
  /*info*/
199
  n[5] != null
200
- ), K(e, "class", "title-container svelte-vm3q5z");
201
  },
202
  m(u, m) {
203
  ce(u, e, m), re(e, t), a && a.m(t, null), re(e, o), f && f.m(e, null), ce(u, i, m), c && c.m(u, m), ce(u, s, m), _ = !0;
@@ -1960,7 +1960,7 @@ function il(n) {
1960
  }
1961
  function sl(n, e, t) {
1962
  const o = typeof document < "u";
1963
- let { value: l = [] } = e, { value_is_output: i = !1 } = e, { label: s } = e, { legend_label: _ } = e, { info: r = void 0 } = e, { show_label: a = !0 } = e, { show_legend: f = !1 } = e, { show_legend_label: c = !1 } = e, { container: u = !0 } = e, { color_map: m = {} } = e, { show_copy_button: b = !1 } = e, { show_remove_tags_button: k = !1 } = e, { disabled: y } = e, L, w = "", d = "", q, M, g = {}, N = !1, E = "";
1964
  function Z() {
1965
  M = !m || Object.keys(m).length === 0 ? {} : m;
1966
  for (let p in M)
@@ -1974,39 +1974,39 @@ function sl(n, e, t) {
1974
  }
1975
  t(13, g = Io(M, o, q));
1976
  }
1977
- function X(p) {
1978
- l.length > 0 && p && (t(11, w = l.map(([j, T]) => j).join("")), t(12, d = l.map(([j, T]) => T !== null ? `<mark class="hl ${T}" style="background-color:${g[T].secondary}">${j}</mark>` : j).join("")), t(15, E = l.map(([j, T]) => T !== null ? `<${T}>${j}</${T}>` : j).join("")));
1979
  }
1980
  const A = tl();
1981
  xo(() => {
1982
  L && L.offsetHeight + L.scrollTop > L.scrollHeight - 100;
1983
  });
1984
  function ue() {
1985
- B(), G(), A("change", l), i || A("input", l);
1986
  }
1987
  el(() => {
1988
- Z(), X(i), t(19, i = !1);
1989
  });
1990
- function G() {
1991
- let p = [], j = "", T = null, z = !1, U = "", Q = d.replace(/&nbsp;|&amp;|&lt;|&gt;/g, function(D) {
1992
  return {
1993
  "&nbsp;": " ",
1994
  "&amp;": "&",
1995
  "&lt;": "<",
1996
  "&gt;": ">"
1997
- }[D];
1998
  });
1999
- for (let D = 0; D < Q.length; D++) {
2000
- let R = Q[D];
2001
- if (R === "<" && D + 5 <= Q.length && Q.slice(D + 1, D + 5) === "mark")
2002
- z = !0, j && p.push([j, T]), j = "", T = null;
2003
- else if (R === ">" && z) {
2004
- if (z = !1, U.slice(0, 4) === "mark") {
2005
- let I = /class="hl ([^"]+)"/.exec(U);
2006
- T = I ? I[1] : null;
2007
  }
2008
- U = "";
2009
- } else z ? U += R : j += R;
2010
  }
2011
  j && p.push([j, T]), t(18, l = p);
2012
  }
@@ -2018,13 +2018,13 @@ function sl(n, e, t) {
2018
  if (p.rangeCount > 0) {
2019
  var T = p.getRangeAt(0).commonAncestorContainer.parentElement;
2020
  if (T && T.tagName.toLowerCase() === "mark") {
2021
- const I = T.textContent;
2022
- var z = T.parentElement, U = document.createTextNode(I);
2023
- z.replaceChild(U, T), t(12, d = z.innerHTML);
2024
- var Q = document.createRange(), D = window.getSelection();
2025
- const je = j + Wo(z);
2026
- var R = Xo(z, je);
2027
- Q.setStart(R.node, R.offset), Q.setEnd(R.node, R.offset), D.removeAllRanges(), D.addRange(Q);
2028
  }
2029
  }
2030
  }
@@ -2061,7 +2061,7 @@ function sl(n, e, t) {
2061
  }
2062
  return n.$$set = (p) => {
2063
  "value" in p && t(18, l = p.value), "value_is_output" in p && t(19, i = p.value_is_output), "label" in p && t(0, s = p.label), "legend_label" in p && t(1, _ = p.legend_label), "info" in p && t(2, r = p.info), "show_label" in p && t(3, a = p.show_label), "show_legend" in p && t(4, f = p.show_legend), "show_legend_label" in p && t(5, c = p.show_legend_label), "container" in p && t(6, u = p.container), "color_map" in p && t(20, m = p.color_map), "show_copy_button" in p && t(7, b = p.show_copy_button), "show_remove_tags_button" in p && t(8, k = p.show_remove_tags_button), "disabled" in p && t(9, y = p.disabled);
2064
- }, Z(), X(!0), [
2065
  s,
2066
  _,
2067
  r,
@@ -2077,7 +2077,7 @@ function sl(n, e, t) {
2077
  d,
2078
  g,
2079
  N,
2080
- E,
2081
  ue,
2082
  ne,
2083
  l,
@@ -2585,7 +2585,7 @@ function Ce(n) {
2585
  }
2586
  const {
2587
  SvelteComponent: kl,
2588
- append: Y,
2589
  attr: S,
2590
  component_subscribe: Et,
2591
  detach: Sl,
@@ -2595,14 +2595,14 @@ const {
2595
  noop: Dt,
2596
  safe_not_equal: jl,
2597
  set_style: ze,
2598
- svg_element: J,
2599
  toggle_class: Rt
2600
  } = window.__gradio__svelte__internal, { onMount: Tl } = window.__gradio__svelte__internal;
2601
  function Fl(n) {
2602
  let e, t, o, l, i, s, _, r, a, f, c, u;
2603
  return {
2604
  c() {
2605
- e = yl("div"), t = J("svg"), o = J("g"), l = J("path"), i = J("path"), s = J("path"), _ = J("path"), r = J("g"), a = J("path"), f = J("path"), c = J("path"), u = J("path"), S(l, "d", "M255.926 0.754768L509.702 139.936V221.027L255.926 81.8465V0.754768Z"), S(l, "fill", "#FF7C00"), S(l, "fill-opacity", "0.4"), S(l, "class", "svelte-43sxxs"), S(i, "d", "M509.69 139.936L254.981 279.641V361.255L509.69 221.55V139.936Z"), S(i, "fill", "#FF7C00"), S(i, "class", "svelte-43sxxs"), S(s, "d", "M0.250138 139.937L254.981 279.641V361.255L0.250138 221.55V139.937Z"), S(s, "fill", "#FF7C00"), S(s, "fill-opacity", "0.4"), S(s, "class", "svelte-43sxxs"), S(_, "d", "M255.923 0.232622L0.236328 139.936V221.55L255.923 81.8469V0.232622Z"), S(_, "fill", "#FF7C00"), S(_, "class", "svelte-43sxxs"), ze(o, "transform", "translate(" + /*$top*/
2606
  n[1][0] + "px, " + /*$top*/
2607
  n[1][1] + "px)"), S(a, "d", "M255.926 141.5L509.702 280.681V361.773L255.926 222.592V141.5Z"), S(a, "fill", "#FF7C00"), S(a, "fill-opacity", "0.4"), S(a, "class", "svelte-43sxxs"), S(f, "d", "M509.69 280.679L254.981 420.384V501.998L509.69 362.293V280.679Z"), S(f, "fill", "#FF7C00"), S(f, "class", "svelte-43sxxs"), S(c, "d", "M0.250138 280.681L254.981 420.386V502L0.250138 362.295V280.681Z"), S(c, "fill", "#FF7C00"), S(c, "fill-opacity", "0.4"), S(c, "class", "svelte-43sxxs"), S(u, "d", "M255.923 140.977L0.236328 280.68V362.294L255.923 222.591V140.977Z"), S(u, "fill", "#FF7C00"), S(u, "class", "svelte-43sxxs"), ze(r, "transform", "translate(" + /*$bottom*/
2608
  n[2][0] + "px, " + /*$bottom*/
@@ -2614,7 +2614,7 @@ function Fl(n) {
2614
  );
2615
  },
2616
  m(m, b) {
2617
- Ml(m, e, b), Y(e, t), Y(t, o), Y(o, l), Y(o, i), Y(o, s), Y(o, _), Y(t, r), Y(r, a), Y(r, f), Y(r, c), Y(r, u);
2618
  },
2619
  p(m, [b]) {
2620
  b & /*$top*/
@@ -2650,15 +2650,15 @@ function Hl(n, e, t) {
2650
  function q(N) {
2651
  try {
2652
  g(y.next(N));
2653
- } catch (E) {
2654
- d(E);
2655
  }
2656
  }
2657
  function M(N) {
2658
  try {
2659
  g(y.throw(N));
2660
- } catch (E) {
2661
- d(E);
2662
  }
2663
  }
2664
  function g(N) {
@@ -2719,11 +2719,11 @@ const {
2719
  mount_component: Al,
2720
  noop: Ke,
2721
  safe_not_equal: Bl,
2722
- set_data: W,
2723
  set_style: _e,
2724
  space: te,
2725
  text: F,
2726
- toggle_class: P,
2727
  transition_in: Se,
2728
  transition_out: ye,
2729
  update_slot_base: Il
@@ -2761,7 +2761,7 @@ function Gl(n) {
2761
  p(r, a) {
2762
  (!i || a[0] & /*i18n*/
2763
  2) && t !== (t = /*i18n*/
2764
- r[1]("common.error") + "") && W(o, t), _ && _.p && (!i || a[0] & /*$$scope*/
2765
  268435456) && Il(
2766
  _,
2767
  s,
@@ -2834,12 +2834,12 @@ function Ul(n) {
2834
  n[5] && xt(n);
2835
  return {
2836
  c() {
2837
- f && f.c(), e = te(), t = le("div"), m && m.c(), o = te(), b && b.c(), l = te(), s && s.c(), _ = te(), w && w.c(), r = Le(), ee(t, "class", "progress-text svelte-1txqlrd"), P(
2838
  t,
2839
  "meta-text-center",
2840
  /*variant*/
2841
  n[8] === "center"
2842
- ), P(
2843
  t,
2844
  "meta-text",
2845
  /*variant*/
@@ -2855,13 +2855,13 @@ function Ul(n) {
2855
  d[18] && /*show_progress*/
2856
  d[6] === "full" ? f ? f.p(d, q) : (f = It(d), f.c(), f.m(e.parentNode, e)) : f && (f.d(1), f = null), u === (u = c(d)) && m ? m.p(d, q) : (m && m.d(1), m = u && u(d), m && (m.c(), m.m(t, o))), /*timer*/
2857
  d[5] ? b ? b.p(d, q) : (b = Xt(d), b.c(), b.m(t, null)) : b && (b.d(1), b = null), (!a || q[0] & /*variant*/
2858
- 256) && P(
2859
  t,
2860
  "meta-text-center",
2861
  /*variant*/
2862
  d[8] === "center"
2863
  ), (!a || q[0] & /*variant*/
2864
- 256) && P(
2865
  t,
2866
  "meta-text",
2867
  /*variant*/
@@ -2937,8 +2937,8 @@ function Jl(n) {
2937
  p(_, r) {
2938
  r[0] & /*queue_position*/
2939
  4 && t !== (t = /*queue_position*/
2940
- _[2] + 1 + "") && W(o, t), r[0] & /*queue_size*/
2941
- 8 && W(
2942
  i,
2943
  /*queue_size*/
2944
  _[3]
@@ -3011,7 +3011,7 @@ function Pt(n) {
3011
  p(f, c) {
3012
  r === (r = _(f)) && a ? a.p(f, c) : (a.d(1), a = r(f), a && (a.c(), a.m(e.parentNode, e))), c[0] & /*progress*/
3013
  128 && t !== (t = /*p*/
3014
- f[39].unit + "") && W(o, t);
3015
  },
3016
  d(f) {
3017
  f && ($(e), $(o), $(l), $(s)), a.d(f);
@@ -3035,7 +3035,7 @@ function Ql(n) {
3035
  128 && e !== (e = Ce(
3036
  /*p*/
3037
  o[39].index || 0
3038
- ) + "") && W(t, e);
3039
  },
3040
  d(o) {
3041
  o && $(t);
@@ -3062,11 +3062,11 @@ function xl(n) {
3062
  128 && e !== (e = Ce(
3063
  /*p*/
3064
  s[39].index || 0
3065
- ) + "") && W(t, e), _[0] & /*progress*/
3066
  128 && l !== (l = Ce(
3067
  /*p*/
3068
  s[39].length
3069
- ) + "") && W(i, l);
3070
  },
3071
  d(s) {
3072
  s && ($(t), $(o), $(i));
@@ -3112,14 +3112,14 @@ function Xt(n) {
3112
  },
3113
  p(i, s) {
3114
  s[0] & /*formatted_timer*/
3115
- 1048576 && W(
3116
  e,
3117
  /*formatted_timer*/
3118
  i[20]
3119
  ), s[0] & /*eta, formatted_eta*/
3120
  524289 && t !== (t = /*eta*/
3121
  i[0] ? `/${/*formatted_eta*/
3122
- i[19]}` : "") && W(o, t);
3123
  },
3124
  d(i) {
3125
  i && ($(e), $(o), $(l));
@@ -3294,7 +3294,7 @@ function Yt(n) {
3294
  p(o, l) {
3295
  l[0] & /*progress*/
3296
  128 && e !== (e = /*p*/
3297
- o[39].desc + "") && W(t, e);
3298
  },
3299
  d(o) {
3300
  o && $(t);
@@ -3334,7 +3334,7 @@ function Kt(n) {
3334
  (l[14][
3335
  /*i*/
3336
  l[41]
3337
- ] || 0)).toFixed(1) + "") && W(t, e);
3338
  },
3339
  d(l) {
3340
  l && ($(t), $(o));
@@ -3386,7 +3386,7 @@ function xt(n) {
3386
  },
3387
  p(o, l) {
3388
  l[0] & /*loading_text*/
3389
- 512 && W(
3390
  t,
3391
  /*loading_text*/
3392
  o[9]
@@ -3413,10 +3413,10 @@ function oi(n) {
3413
  c() {
3414
  e = le("div"), o && o.c(), ee(e, "class", l = "wrap " + /*variant*/
3415
  n[8] + " " + /*show_progress*/
3416
- n[6] + " svelte-1txqlrd"), P(e, "hide", !/*status*/
3417
  n[4] || /*status*/
3418
  n[4] === "complete" || /*show_progress*/
3419
- n[6] === "hidden"), P(
3420
  e,
3421
  "translucent",
3422
  /*variant*/
@@ -3425,12 +3425,12 @@ function oi(n) {
3425
  n[4] === "error") || /*translucent*/
3426
  n[11] || /*show_progress*/
3427
  n[6] === "minimal"
3428
- ), P(
3429
  e,
3430
  "generating",
3431
  /*status*/
3432
  n[4] === "generating"
3433
- ), P(
3434
  e,
3435
  "border",
3436
  /*border*/
@@ -3458,11 +3458,11 @@ function oi(n) {
3458
  320 && l !== (l = "wrap " + /*variant*/
3459
  a[8] + " " + /*show_progress*/
3460
  a[6] + " svelte-1txqlrd")) && ee(e, "class", l), (!i || f[0] & /*variant, show_progress, status, show_progress*/
3461
- 336) && P(e, "hide", !/*status*/
3462
  a[4] || /*status*/
3463
  a[4] === "complete" || /*show_progress*/
3464
  a[6] === "hidden"), (!i || f[0] & /*variant, show_progress, variant, status, translucent, show_progress*/
3465
- 2384) && P(
3466
  e,
3467
  "translucent",
3468
  /*variant*/
@@ -3472,13 +3472,13 @@ function oi(n) {
3472
  a[11] || /*show_progress*/
3473
  a[6] === "minimal"
3474
  ), (!i || f[0] & /*variant, show_progress, status*/
3475
- 336) && P(
3476
  e,
3477
  "generating",
3478
  /*status*/
3479
  a[4] === "generating"
3480
  ), (!i || f[0] & /*variant, show_progress, border*/
3481
- 4416) && P(
3482
  e,
3483
  "border",
3484
  /*border*/
@@ -3555,17 +3555,17 @@ function ii(n) {
3555
  function si(n, e, t) {
3556
  let o, { $$slots: l = {}, $$scope: i } = e;
3557
  this && this.__awaiter;
3558
- let { i18n: s } = e, { eta: _ = null } = e, { queue_position: r } = e, { queue_size: a } = e, { status: f } = e, { scroll_to_output: c = !1 } = e, { timer: u = !0 } = e, { show_progress: m = "full" } = e, { message: b = null } = e, { progress: k = null } = e, { variant: y = "default" } = e, { loading_text: L = "Loading..." } = e, { absolute: w = !0 } = e, { translucent: d = !1 } = e, { border: q = !1 } = e, { autoscroll: M } = e, g, N = !1, E = 0, Z = 0, X = null, A = null, ue = 0, G = null, ne, B = null, he = !0;
3559
  const Me = () => {
3560
- t(0, _ = t(26, X = t(19, be = null))), t(24, E = performance.now()), t(25, Z = 0), N = !0, ve();
3561
  };
3562
  function ve() {
3563
  requestAnimationFrame(() => {
3564
- t(25, Z = (performance.now() - E) / 1e3), N && ve();
3565
  });
3566
  }
3567
  function h() {
3568
- t(25, Z = 0), t(0, _ = t(26, X = t(19, be = null))), N && (N = !1);
3569
  }
3570
  Wl(() => {
3571
  N && h();
@@ -3573,7 +3573,7 @@ function si(n, e, t) {
3573
  let be = null;
3574
  function Be(v) {
3575
  Ot[v ? "unshift" : "push"](() => {
3576
- B = v, t(16, B), t(7, k), t(14, G), t(15, ne);
3577
  });
3578
  }
3579
  function Ie(v) {
@@ -3585,15 +3585,15 @@ function si(n, e, t) {
3585
  "i18n" in v && t(1, s = v.i18n), "eta" in v && t(0, _ = v.eta), "queue_position" in v && t(2, r = v.queue_position), "queue_size" in v && t(3, a = v.queue_size), "status" in v && t(4, f = v.status), "scroll_to_output" in v && t(21, c = v.scroll_to_output), "timer" in v && t(5, u = v.timer), "show_progress" in v && t(6, m = v.show_progress), "message" in v && t(22, b = v.message), "progress" in v && t(7, k = v.progress), "variant" in v && t(8, y = v.variant), "loading_text" in v && t(9, L = v.loading_text), "absolute" in v && t(10, w = v.absolute), "translucent" in v && t(11, d = v.translucent), "border" in v && t(12, q = v.border), "autoscroll" in v && t(23, M = v.autoscroll), "$$scope" in v && t(28, i = v.$$scope);
3586
  }, n.$$.update = () => {
3587
  n.$$.dirty[0] & /*eta, old_eta, timer_start, eta_from_start*/
3588
- 218103809 && (_ === null && t(0, _ = X), _ != null && X !== _ && (t(27, A = (performance.now() - E) / 1e3 + _), t(19, be = A.toFixed(1)), t(26, X = _))), n.$$.dirty[0] & /*eta_from_start, timer_diff*/
3589
  167772160 && t(17, ue = A === null || A <= 0 || !Z ? null : Math.min(Z / A, 1)), n.$$.dirty[0] & /*progress*/
3590
  128 && k != null && t(18, he = !1), n.$$.dirty[0] & /*progress, progress_level, progress_bar, last_progress_level*/
3591
- 114816 && (k != null ? t(14, G = k.map((v) => {
3592
  if (v.index != null && v.length != null)
3593
  return v.index / v.length;
3594
  if (v.progress != null)
3595
  return v.progress;
3596
- })) : t(14, G = null), G ? (t(15, ne = G[G.length - 1]), B && (ne === 0 ? t(16, B.style.transition = "0", B) : t(16, B.style.transition = "150ms", B))) : t(15, ne = void 0)), n.$$.dirty[0] & /*status*/
3597
  16 && (f === "pending" ? Me() : h()), n.$$.dirty[0] & /*el, scroll_to_output, status, autoscroll*/
3598
  10493968 && g && c && (f === "pending" || f === "complete") && ii(g, M), n.$$.dirty[0] & /*status, message*/
3599
  4194320, n.$$.dirty[0] & /*timer_diff*/
@@ -3613,7 +3613,7 @@ function si(n, e, t) {
3613
  d,
3614
  q,
3615
  g,
3616
- G,
3617
  ne,
3618
  B,
3619
  ue,
@@ -3623,9 +3623,9 @@ function si(n, e, t) {
3623
  c,
3624
  b,
3625
  M,
3626
- E,
3627
  Z,
3628
- X,
3629
  A,
3630
  i,
3631
  l,
@@ -4005,14 +4005,14 @@ function wi(n) {
4005
  }
4006
  function $i(n, e, t) {
4007
  let { gradio: o } = e, { label: l = "Highlighted Textbox" } = e, { legend_label: i = "Highlights:" } = e, { info: s = void 0 } = e, { elem_id: _ = "" } = e, { elem_classes: r = [] } = e, { visible: a = !0 } = e, { value: f } = e, { show_label: c } = e, { show_legend: u } = e, { show_legend_label: m } = e, { color_map: b = {} } = e, { container: k = !0 } = e, { scale: y = null } = e, { min_width: L = void 0 } = e, { show_copy_button: w = !1 } = e, { show_remove_tags_button: d = !1 } = e, { loading_status: q = void 0 } = e, { value_is_output: M = !1 } = e, { combine_adjacent: g = !1 } = e, { interactive: N = !0 } = e;
4008
- const E = !1, Z = !0;
4009
- function X(h) {
4010
  f = h, t(0, f), t(20, g);
4011
  }
4012
  function A(h) {
4013
  M = h, t(2, M);
4014
  }
4015
- const ue = () => o.dispatch("change"), G = () => o.dispatch("input"), ne = () => o.dispatch("submit"), B = () => o.dispatch("blur"), he = (h) => o.dispatch("select", h.detail), Me = () => o.dispatch("focus"), ve = function() {
4016
  console.log("test"), o.dispatch("clear");
4017
  };
4018
  return n.$$set = (h) => {
@@ -4043,12 +4043,12 @@ function $i(n, e, t) {
4043
  q,
4044
  N,
4045
  g,
4046
- E,
4047
  Z,
4048
- X,
4049
  A,
4050
  ue,
4051
- G,
4052
  ne,
4053
  B,
4054
  he,
 
1
  const {
2
  SvelteComponent: qn,
3
  append: re,
4
+ attr: Q,
5
  create_slot: kn,
6
  destroy_each: Sn,
7
  detach: fe,
 
40
  ), s = Ne();
41
  for (let a = 0; a < r.length; a += 1)
42
  r[a].c();
43
+ Q(e, "class", "legend-separator svelte-vm3q5z"), V(e, "hide", !/*show_legend*/
44
  n[1] || !/*show_label*/
45
  n[0]), V(
46
  e,
47
  "has-info",
48
  /*info*/
49
  n[5] != null
50
+ ), Q(l, "class", "svelte-vm3q5z"), V(l, "hide", !/*show_legend_label*/
51
  n[2]), V(
52
  l,
53
  "has-info",
54
  /*info*/
55
  n[5] != null
56
+ ), Q(o, "class", "category-legend svelte-vm3q5z"), Q(o, "data-testid", "highlighted-text:category-legend"), V(o, "hide", !/*show_legend*/
57
  n[1]);
58
  },
59
  m(a, f) {
 
115
  ), o, l, i;
116
  return {
117
  c() {
118
+ e = ge("div"), o = xe(t), l = Ne(), Q(e, "class", "category-label svelte-vm3q5z"), Q(e, "style", i = "background-color:" + /*color*/
119
  n[9].secondary), V(
120
  e,
121
  "has-info",
 
131
  16 && t !== (t = /*category*/
132
  s[8] + "") && Qe(o, t), _ & /*_color_map*/
133
  16 && i !== (i = "background-color:" + /*color*/
134
+ s[9].secondary) && Q(e, "style", i), _ & /*info*/
135
  32 && V(
136
  e,
137
  "has-info",
 
151
  e = ge("div"), t = xe(
152
  /*info*/
153
  n[5]
154
+ ), Q(e, "class", "title-with-highlights-info svelte-vm3q5z");
155
  },
156
  m(o, l) {
157
  ce(o, e, l), re(e, t);
 
190
  );
191
  return {
192
  c() {
193
+ e = ge("div"), t = ge("span"), a && a.c(), o = Ne(), f && f.c(), i = Ne(), c && c.c(), s = yn(), Q(t, "data-testid", "block-info"), Q(t, "class", "svelte-vm3q5z"), V(t, "sr-only", !/*show_label*/
194
  n[0]), V(t, "hide", !/*show_label*/
195
  n[0]), V(
196
  t,
197
  "has-info",
198
  /*info*/
199
  n[5] != null
200
+ ), Q(e, "class", "title-container svelte-vm3q5z");
201
  },
202
  m(u, m) {
203
  ce(u, e, m), re(e, t), a && a.m(t, null), re(e, o), f && f.m(e, null), ce(u, i, m), c && c.m(u, m), ce(u, s, m), _ = !0;
 
1960
  }
1961
  function sl(n, e, t) {
1962
  const o = typeof document < "u";
1963
+ let { value: l = [] } = e, { value_is_output: i = !1 } = e, { label: s } = e, { legend_label: _ } = e, { info: r = void 0 } = e, { show_label: a = !0 } = e, { show_legend: f = !1 } = e, { show_legend_label: c = !1 } = e, { container: u = !0 } = e, { color_map: m = {} } = e, { show_copy_button: b = !1 } = e, { show_remove_tags_button: k = !1 } = e, { disabled: y } = e, L, w = "", d = "", q, M, g = {}, N = !1, D = "";
1964
  function Z() {
1965
  M = !m || Object.keys(m).length === 0 ? {} : m;
1966
  for (let p in M)
 
1974
  }
1975
  t(13, g = Io(M, o, q));
1976
  }
1977
+ function G(p) {
1978
+ l.length > 0 && p && (t(11, w = l.map(([j, T]) => j).join("")), t(12, d = l.map(([j, T]) => T !== null ? `<mark class="hl ${T}" style="background-color:${g[T].secondary}">${j}</mark>` : j).join("")), t(15, D = l.map(([j, T]) => T !== null ? `<${T}>${j}</${T}>` : j).join("")));
1979
  }
1980
  const A = tl();
1981
  xo(() => {
1982
  L && L.offsetHeight + L.scrollTop > L.scrollHeight - 100;
1983
  });
1984
  function ue() {
1985
+ B(), U(), A("change", l), i || A("input", l);
1986
  }
1987
  el(() => {
1988
+ Z(), G(i), t(19, i = !1);
1989
  });
1990
+ function U() {
1991
+ let p = [], j = "", T = null, E = !1, Y = "", I = d.replace(/&nbsp;|&amp;|&lt;|&gt;/g, function(z) {
1992
  return {
1993
  "&nbsp;": " ",
1994
  "&amp;": "&",
1995
  "&lt;": "<",
1996
  "&gt;": ">"
1997
+ }[z];
1998
  });
1999
+ for (let z = 0; z < I.length; z++) {
2000
+ let R = I[z];
2001
+ if (R === "<" && (z + 5 <= I.length && I.slice(z + 1, z + 5) === "mark" || z + 6 <= I.length && I.slice(z + 1, z + 6) == "/mark"))
2002
+ E = !0, j && p.push([j, T]), j = "", T = null;
2003
+ else if (R === ">" && E) {
2004
+ if (E = !1, Y.slice(0, 4) === "mark") {
2005
+ let P = /class="hl ([^"]+)"/.exec(Y);
2006
+ T = P ? P[1] : null;
2007
  }
2008
+ Y = "";
2009
+ } else E ? Y += R : j += R;
2010
  }
2011
  j && p.push([j, T]), t(18, l = p);
2012
  }
 
2018
  if (p.rangeCount > 0) {
2019
  var T = p.getRangeAt(0).commonAncestorContainer.parentElement;
2020
  if (T && T.tagName.toLowerCase() === "mark") {
2021
+ const P = T.textContent;
2022
+ var E = T.parentElement, Y = document.createTextNode(P);
2023
+ E.replaceChild(Y, T), t(12, d = E.innerHTML);
2024
+ var I = document.createRange(), z = window.getSelection();
2025
+ const je = j + Wo(E);
2026
+ var R = Xo(E, je);
2027
+ I.setStart(R.node, R.offset), I.setEnd(R.node, R.offset), z.removeAllRanges(), z.addRange(I);
2028
  }
2029
  }
2030
  }
 
2061
  }
2062
  return n.$$set = (p) => {
2063
  "value" in p && t(18, l = p.value), "value_is_output" in p && t(19, i = p.value_is_output), "label" in p && t(0, s = p.label), "legend_label" in p && t(1, _ = p.legend_label), "info" in p && t(2, r = p.info), "show_label" in p && t(3, a = p.show_label), "show_legend" in p && t(4, f = p.show_legend), "show_legend_label" in p && t(5, c = p.show_legend_label), "container" in p && t(6, u = p.container), "color_map" in p && t(20, m = p.color_map), "show_copy_button" in p && t(7, b = p.show_copy_button), "show_remove_tags_button" in p && t(8, k = p.show_remove_tags_button), "disabled" in p && t(9, y = p.disabled);
2064
+ }, Z(), G(!0), [
2065
  s,
2066
  _,
2067
  r,
 
2077
  d,
2078
  g,
2079
  N,
2080
+ D,
2081
  ue,
2082
  ne,
2083
  l,
 
2585
  }
2586
  const {
2587
  SvelteComponent: kl,
2588
+ append: J,
2589
  attr: S,
2590
  component_subscribe: Et,
2591
  detach: Sl,
 
2595
  noop: Dt,
2596
  safe_not_equal: jl,
2597
  set_style: ze,
2598
+ svg_element: K,
2599
  toggle_class: Rt
2600
  } = window.__gradio__svelte__internal, { onMount: Tl } = window.__gradio__svelte__internal;
2601
  function Fl(n) {
2602
  let e, t, o, l, i, s, _, r, a, f, c, u;
2603
  return {
2604
  c() {
2605
+ e = yl("div"), t = K("svg"), o = K("g"), l = K("path"), i = K("path"), s = K("path"), _ = K("path"), r = K("g"), a = K("path"), f = K("path"), c = K("path"), u = K("path"), S(l, "d", "M255.926 0.754768L509.702 139.936V221.027L255.926 81.8465V0.754768Z"), S(l, "fill", "#FF7C00"), S(l, "fill-opacity", "0.4"), S(l, "class", "svelte-43sxxs"), S(i, "d", "M509.69 139.936L254.981 279.641V361.255L509.69 221.55V139.936Z"), S(i, "fill", "#FF7C00"), S(i, "class", "svelte-43sxxs"), S(s, "d", "M0.250138 139.937L254.981 279.641V361.255L0.250138 221.55V139.937Z"), S(s, "fill", "#FF7C00"), S(s, "fill-opacity", "0.4"), S(s, "class", "svelte-43sxxs"), S(_, "d", "M255.923 0.232622L0.236328 139.936V221.55L255.923 81.8469V0.232622Z"), S(_, "fill", "#FF7C00"), S(_, "class", "svelte-43sxxs"), ze(o, "transform", "translate(" + /*$top*/
2606
  n[1][0] + "px, " + /*$top*/
2607
  n[1][1] + "px)"), S(a, "d", "M255.926 141.5L509.702 280.681V361.773L255.926 222.592V141.5Z"), S(a, "fill", "#FF7C00"), S(a, "fill-opacity", "0.4"), S(a, "class", "svelte-43sxxs"), S(f, "d", "M509.69 280.679L254.981 420.384V501.998L509.69 362.293V280.679Z"), S(f, "fill", "#FF7C00"), S(f, "class", "svelte-43sxxs"), S(c, "d", "M0.250138 280.681L254.981 420.386V502L0.250138 362.295V280.681Z"), S(c, "fill", "#FF7C00"), S(c, "fill-opacity", "0.4"), S(c, "class", "svelte-43sxxs"), S(u, "d", "M255.923 140.977L0.236328 280.68V362.294L255.923 222.591V140.977Z"), S(u, "fill", "#FF7C00"), S(u, "class", "svelte-43sxxs"), ze(r, "transform", "translate(" + /*$bottom*/
2608
  n[2][0] + "px, " + /*$bottom*/
 
2614
  );
2615
  },
2616
  m(m, b) {
2617
+ Ml(m, e, b), J(e, t), J(t, o), J(o, l), J(o, i), J(o, s), J(o, _), J(t, r), J(r, a), J(r, f), J(r, c), J(r, u);
2618
  },
2619
  p(m, [b]) {
2620
  b & /*$top*/
 
2650
  function q(N) {
2651
  try {
2652
  g(y.next(N));
2653
+ } catch (D) {
2654
+ d(D);
2655
  }
2656
  }
2657
  function M(N) {
2658
  try {
2659
  g(y.throw(N));
2660
+ } catch (D) {
2661
+ d(D);
2662
  }
2663
  }
2664
  function g(N) {
 
2719
  mount_component: Al,
2720
  noop: Ke,
2721
  safe_not_equal: Bl,
2722
+ set_data: X,
2723
  set_style: _e,
2724
  space: te,
2725
  text: F,
2726
+ toggle_class: W,
2727
  transition_in: Se,
2728
  transition_out: ye,
2729
  update_slot_base: Il
 
2761
  p(r, a) {
2762
  (!i || a[0] & /*i18n*/
2763
  2) && t !== (t = /*i18n*/
2764
+ r[1]("common.error") + "") && X(o, t), _ && _.p && (!i || a[0] & /*$$scope*/
2765
  268435456) && Il(
2766
  _,
2767
  s,
 
2834
  n[5] && xt(n);
2835
  return {
2836
  c() {
2837
+ f && f.c(), e = te(), t = le("div"), m && m.c(), o = te(), b && b.c(), l = te(), s && s.c(), _ = te(), w && w.c(), r = Le(), ee(t, "class", "progress-text svelte-1txqlrd"), W(
2838
  t,
2839
  "meta-text-center",
2840
  /*variant*/
2841
  n[8] === "center"
2842
+ ), W(
2843
  t,
2844
  "meta-text",
2845
  /*variant*/
 
2855
  d[18] && /*show_progress*/
2856
  d[6] === "full" ? f ? f.p(d, q) : (f = It(d), f.c(), f.m(e.parentNode, e)) : f && (f.d(1), f = null), u === (u = c(d)) && m ? m.p(d, q) : (m && m.d(1), m = u && u(d), m && (m.c(), m.m(t, o))), /*timer*/
2857
  d[5] ? b ? b.p(d, q) : (b = Xt(d), b.c(), b.m(t, null)) : b && (b.d(1), b = null), (!a || q[0] & /*variant*/
2858
+ 256) && W(
2859
  t,
2860
  "meta-text-center",
2861
  /*variant*/
2862
  d[8] === "center"
2863
  ), (!a || q[0] & /*variant*/
2864
+ 256) && W(
2865
  t,
2866
  "meta-text",
2867
  /*variant*/
 
2937
  p(_, r) {
2938
  r[0] & /*queue_position*/
2939
  4 && t !== (t = /*queue_position*/
2940
+ _[2] + 1 + "") && X(o, t), r[0] & /*queue_size*/
2941
+ 8 && X(
2942
  i,
2943
  /*queue_size*/
2944
  _[3]
 
3011
  p(f, c) {
3012
  r === (r = _(f)) && a ? a.p(f, c) : (a.d(1), a = r(f), a && (a.c(), a.m(e.parentNode, e))), c[0] & /*progress*/
3013
  128 && t !== (t = /*p*/
3014
+ f[39].unit + "") && X(o, t);
3015
  },
3016
  d(f) {
3017
  f && ($(e), $(o), $(l), $(s)), a.d(f);
 
3035
  128 && e !== (e = Ce(
3036
  /*p*/
3037
  o[39].index || 0
3038
+ ) + "") && X(t, e);
3039
  },
3040
  d(o) {
3041
  o && $(t);
 
3062
  128 && e !== (e = Ce(
3063
  /*p*/
3064
  s[39].index || 0
3065
+ ) + "") && X(t, e), _[0] & /*progress*/
3066
  128 && l !== (l = Ce(
3067
  /*p*/
3068
  s[39].length
3069
+ ) + "") && X(i, l);
3070
  },
3071
  d(s) {
3072
  s && ($(t), $(o), $(i));
 
3112
  },
3113
  p(i, s) {
3114
  s[0] & /*formatted_timer*/
3115
+ 1048576 && X(
3116
  e,
3117
  /*formatted_timer*/
3118
  i[20]
3119
  ), s[0] & /*eta, formatted_eta*/
3120
  524289 && t !== (t = /*eta*/
3121
  i[0] ? `/${/*formatted_eta*/
3122
+ i[19]}` : "") && X(o, t);
3123
  },
3124
  d(i) {
3125
  i && ($(e), $(o), $(l));
 
3294
  p(o, l) {
3295
  l[0] & /*progress*/
3296
  128 && e !== (e = /*p*/
3297
+ o[39].desc + "") && X(t, e);
3298
  },
3299
  d(o) {
3300
  o && $(t);
 
3334
  (l[14][
3335
  /*i*/
3336
  l[41]
3337
+ ] || 0)).toFixed(1) + "") && X(t, e);
3338
  },
3339
  d(l) {
3340
  l && ($(t), $(o));
 
3386
  },
3387
  p(o, l) {
3388
  l[0] & /*loading_text*/
3389
+ 512 && X(
3390
  t,
3391
  /*loading_text*/
3392
  o[9]
 
3413
  c() {
3414
  e = le("div"), o && o.c(), ee(e, "class", l = "wrap " + /*variant*/
3415
  n[8] + " " + /*show_progress*/
3416
+ n[6] + " svelte-1txqlrd"), W(e, "hide", !/*status*/
3417
  n[4] || /*status*/
3418
  n[4] === "complete" || /*show_progress*/
3419
+ n[6] === "hidden"), W(
3420
  e,
3421
  "translucent",
3422
  /*variant*/
 
3425
  n[4] === "error") || /*translucent*/
3426
  n[11] || /*show_progress*/
3427
  n[6] === "minimal"
3428
+ ), W(
3429
  e,
3430
  "generating",
3431
  /*status*/
3432
  n[4] === "generating"
3433
+ ), W(
3434
  e,
3435
  "border",
3436
  /*border*/
 
3458
  320 && l !== (l = "wrap " + /*variant*/
3459
  a[8] + " " + /*show_progress*/
3460
  a[6] + " svelte-1txqlrd")) && ee(e, "class", l), (!i || f[0] & /*variant, show_progress, status, show_progress*/
3461
+ 336) && W(e, "hide", !/*status*/
3462
  a[4] || /*status*/
3463
  a[4] === "complete" || /*show_progress*/
3464
  a[6] === "hidden"), (!i || f[0] & /*variant, show_progress, variant, status, translucent, show_progress*/
3465
+ 2384) && W(
3466
  e,
3467
  "translucent",
3468
  /*variant*/
 
3472
  a[11] || /*show_progress*/
3473
  a[6] === "minimal"
3474
  ), (!i || f[0] & /*variant, show_progress, status*/
3475
+ 336) && W(
3476
  e,
3477
  "generating",
3478
  /*status*/
3479
  a[4] === "generating"
3480
  ), (!i || f[0] & /*variant, show_progress, border*/
3481
+ 4416) && W(
3482
  e,
3483
  "border",
3484
  /*border*/
 
3555
  function si(n, e, t) {
3556
  let o, { $$slots: l = {}, $$scope: i } = e;
3557
  this && this.__awaiter;
3558
+ let { i18n: s } = e, { eta: _ = null } = e, { queue_position: r } = e, { queue_size: a } = e, { status: f } = e, { scroll_to_output: c = !1 } = e, { timer: u = !0 } = e, { show_progress: m = "full" } = e, { message: b = null } = e, { progress: k = null } = e, { variant: y = "default" } = e, { loading_text: L = "Loading..." } = e, { absolute: w = !0 } = e, { translucent: d = !1 } = e, { border: q = !1 } = e, { autoscroll: M } = e, g, N = !1, D = 0, Z = 0, G = null, A = null, ue = 0, U = null, ne, B = null, he = !0;
3559
  const Me = () => {
3560
+ t(0, _ = t(26, G = t(19, be = null))), t(24, D = performance.now()), t(25, Z = 0), N = !0, ve();
3561
  };
3562
  function ve() {
3563
  requestAnimationFrame(() => {
3564
+ t(25, Z = (performance.now() - D) / 1e3), N && ve();
3565
  });
3566
  }
3567
  function h() {
3568
+ t(25, Z = 0), t(0, _ = t(26, G = t(19, be = null))), N && (N = !1);
3569
  }
3570
  Wl(() => {
3571
  N && h();
 
3573
  let be = null;
3574
  function Be(v) {
3575
  Ot[v ? "unshift" : "push"](() => {
3576
+ B = v, t(16, B), t(7, k), t(14, U), t(15, ne);
3577
  });
3578
  }
3579
  function Ie(v) {
 
3585
  "i18n" in v && t(1, s = v.i18n), "eta" in v && t(0, _ = v.eta), "queue_position" in v && t(2, r = v.queue_position), "queue_size" in v && t(3, a = v.queue_size), "status" in v && t(4, f = v.status), "scroll_to_output" in v && t(21, c = v.scroll_to_output), "timer" in v && t(5, u = v.timer), "show_progress" in v && t(6, m = v.show_progress), "message" in v && t(22, b = v.message), "progress" in v && t(7, k = v.progress), "variant" in v && t(8, y = v.variant), "loading_text" in v && t(9, L = v.loading_text), "absolute" in v && t(10, w = v.absolute), "translucent" in v && t(11, d = v.translucent), "border" in v && t(12, q = v.border), "autoscroll" in v && t(23, M = v.autoscroll), "$$scope" in v && t(28, i = v.$$scope);
3586
  }, n.$$.update = () => {
3587
  n.$$.dirty[0] & /*eta, old_eta, timer_start, eta_from_start*/
3588
+ 218103809 && (_ === null && t(0, _ = G), _ != null && G !== _ && (t(27, A = (performance.now() - D) / 1e3 + _), t(19, be = A.toFixed(1)), t(26, G = _))), n.$$.dirty[0] & /*eta_from_start, timer_diff*/
3589
  167772160 && t(17, ue = A === null || A <= 0 || !Z ? null : Math.min(Z / A, 1)), n.$$.dirty[0] & /*progress*/
3590
  128 && k != null && t(18, he = !1), n.$$.dirty[0] & /*progress, progress_level, progress_bar, last_progress_level*/
3591
+ 114816 && (k != null ? t(14, U = k.map((v) => {
3592
  if (v.index != null && v.length != null)
3593
  return v.index / v.length;
3594
  if (v.progress != null)
3595
  return v.progress;
3596
+ })) : t(14, U = null), U ? (t(15, ne = U[U.length - 1]), B && (ne === 0 ? t(16, B.style.transition = "0", B) : t(16, B.style.transition = "150ms", B))) : t(15, ne = void 0)), n.$$.dirty[0] & /*status*/
3597
  16 && (f === "pending" ? Me() : h()), n.$$.dirty[0] & /*el, scroll_to_output, status, autoscroll*/
3598
  10493968 && g && c && (f === "pending" || f === "complete") && ii(g, M), n.$$.dirty[0] & /*status, message*/
3599
  4194320, n.$$.dirty[0] & /*timer_diff*/
 
3613
  d,
3614
  q,
3615
  g,
3616
+ U,
3617
  ne,
3618
  B,
3619
  ue,
 
3623
  c,
3624
  b,
3625
  M,
3626
+ D,
3627
  Z,
3628
+ G,
3629
  A,
3630
  i,
3631
  l,
 
4005
  }
4006
  function $i(n, e, t) {
4007
  let { gradio: o } = e, { label: l = "Highlighted Textbox" } = e, { legend_label: i = "Highlights:" } = e, { info: s = void 0 } = e, { elem_id: _ = "" } = e, { elem_classes: r = [] } = e, { visible: a = !0 } = e, { value: f } = e, { show_label: c } = e, { show_legend: u } = e, { show_legend_label: m } = e, { color_map: b = {} } = e, { container: k = !0 } = e, { scale: y = null } = e, { min_width: L = void 0 } = e, { show_copy_button: w = !1 } = e, { show_remove_tags_button: d = !1 } = e, { loading_status: q = void 0 } = e, { value_is_output: M = !1 } = e, { combine_adjacent: g = !1 } = e, { interactive: N = !0 } = e;
4008
+ const D = !1, Z = !0;
4009
+ function G(h) {
4010
  f = h, t(0, f), t(20, g);
4011
  }
4012
  function A(h) {
4013
  M = h, t(2, M);
4014
  }
4015
+ const ue = () => o.dispatch("change"), U = () => o.dispatch("input"), ne = () => o.dispatch("submit"), B = () => o.dispatch("blur"), he = (h) => o.dispatch("select", h.detail), Me = () => o.dispatch("focus"), ve = function() {
4016
  console.log("test"), o.dispatch("clear");
4017
  };
4018
  return n.$$set = (h) => {
 
4043
  q,
4044
  N,
4045
  g,
4046
+ D,
4047
  Z,
4048
+ G,
4049
  A,
4050
  ue,
4051
+ U,
4052
  ne,
4053
  B,
4054
  he,
src/frontend/HighlightedTextbox.svelte CHANGED
@@ -119,7 +119,7 @@
119
  });
120
  for (let i = 0; i < clean_marked_text.length; i++) {
121
  let char = clean_marked_text[i];
122
- if (char === "<" && (i+5) <= clean_marked_text.length && clean_marked_text.slice(i+1,i+5) === "mark") {
123
  in_tag = true;
124
  if (text) {
125
  new_value.push([text, category]);
@@ -255,4 +255,4 @@
255
  :global(mark) {
256
  border-radius: 3px;
257
  }
258
- </style>
 
119
  });
120
  for (let i = 0; i < clean_marked_text.length; i++) {
121
  let char = clean_marked_text[i];
122
+ if (char === "<" && ((i+5 <= clean_marked_text.length && clean_marked_text.slice(i+1,i+5) === "mark") || (i+6 <= clean_marked_text.length && clean_marked_text.slice(i+1,i+6) == "/mark"))) {
123
  in_tag = true;
124
  if (text) {
125
  new_value.push([text, category]);
 
255
  :global(mark) {
256
  border-radius: 3px;
257
  }
258
+ </style>