@pie-element/extended-text-entry 16.0.2-next.20261007003844 → 16.0.2

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.
@@ -1,16 +1,16 @@
1
1
  import { i as e } from "./rolldown-runtime-CWhphoD1.js";
2
- import { H as t, L as n, O as r, S as i, Z as a, a as o, g as s, k as c, l, n as u, t as d, u as f, v as p, x as m, y as h } from "./dist-Dcix7OLC.js";
3
- import { t as g } from "./browser-CcvjX8VA.js";
4
- import _ from "react";
5
- import { jsx as v, jsxs as y } from "react/jsx-runtime";
2
+ import { A as t, O as n, Q as r, R as i, S as a, U as o, a as s, g as c, k as l, l as u, n as d, t as f, u as p, v as m, x as h, y as g } from "./dist-j1vyVp3g.js";
3
+ import { t as _ } from "./browser-CcvjX8VA.js";
4
+ import v from "react";
5
+ import { jsx as y, jsxs as b } from "react/jsx-runtime";
6
6
  //#region src/delivery/annotation/annotation-utils.ts
7
- var b = /* @__PURE__ */ e(a(), 1), x = /* @__PURE__ */ e(g(), 1), S = (e, t, n) => {
7
+ var x = /* @__PURE__ */ e(r(), 1), S = /* @__PURE__ */ e(_(), 1), C = (e, t, n) => {
8
8
  let r = n || [], i = r.reduce((e, t) => e + t.textContent.length, 0), a = !0;
9
9
  if (i > t) return !1;
10
- for (e &&= (e.nodeType === 3 && e.parentNode && !e.parentNode.hasAttribute("data-ann-id") && r.push(e), e.firstChild); e && a;) a = S(e, t, r), e = e.nextSibling;
10
+ for (e &&= (e.nodeType === 3 && e.parentNode && !e.parentNode.hasAttribute("data-ann-id") && r.push(e), e.firstChild); e && a;) a = C(e, t, r), e = e.nextSibling;
11
11
  return r;
12
- }, C = (e, t, n) => {
13
- let r = S(n, t), i = [], a = 0;
12
+ }, w = (e, t, n) => {
13
+ let r = C(n, t), i = [], a = 0;
14
14
  return r.forEach((n) => {
15
15
  let r = a + n.textContent.length;
16
16
  [e, t].forEach((e) => {
@@ -20,7 +20,7 @@ var b = /* @__PURE__ */ e(a(), 1), x = /* @__PURE__ */ e(g(), 1), S = (e, t, n)
20
20
  });
21
21
  }), a = r;
22
22
  }), i;
23
- }, w = (e) => {
23
+ }, T = (e) => {
24
24
  let { commonAncestorContainer: t, startContainer: n, endContainer: r, startOffset: i, endOffset: a } = e, o = [], s = !1, c = !1, l = "", u = (e) => {
25
25
  let { nodeValue: t, childNodes: d } = e;
26
26
  e === n && e === r ? (t && (l += t.substring(i, a)), s = c = !0) : e === n ? (t && (l += t.substring(i)), s = !0) : e === r ? (t && (l += t.substring(0, a)), c = !0) : e && e.nodeType === 3 && e.parentNode && !e.parentNode.hasAttribute("data-ann-id") && t && s && !c && (l += t, o.push(e)), d.forEach((e) => {
@@ -29,16 +29,16 @@ var b = /* @__PURE__ */ e(a(), 1), x = /* @__PURE__ */ e(g(), 1), S = (e, t, n)
29
29
  });
30
30
  };
31
31
  return u(t), [o, l];
32
- }, T = (e) => {
32
+ }, E = (e) => {
33
33
  let t = document.createElement("SPAN");
34
34
  return e.surroundContents(t), t;
35
- }, E = (e) => {
36
- if (e.startContainer === e.endContainer) return [T(e)];
37
- let [t] = w(e), n = document.createRange();
35
+ }, D = (e) => {
36
+ if (e.startContainer === e.endContainer) return [E(e)];
37
+ let [t] = T(e), n = document.createRange();
38
38
  n.selectNodeContents(e.startContainer), n.setStart(e.startContainer, e.startOffset);
39
- let r = T(n), i = document.createRange();
39
+ let r = E(n), i = document.createRange();
40
40
  i.selectNode(e.endContainer), i.setEnd(e.endContainer, e.endOffset);
41
- let a = T(i);
41
+ let a = E(i);
42
42
  return [
43
43
  r,
44
44
  ...t.map((e) => {
@@ -47,25 +47,25 @@ var b = /* @__PURE__ */ e(a(), 1), x = /* @__PURE__ */ e(g(), 1), S = (e, t, n)
47
47
  }),
48
48
  a
49
49
  ];
50
- }, D = (e, t) => {
50
+ }, O = (e, t) => {
51
51
  let n = document.createRange();
52
52
  n.setStart(t, 0), n.setEnd(e.startContainer, e.startOffset);
53
- let [, r] = w(n), [, i] = w(e), a = r.length;
53
+ let [, r] = T(n), [, i] = T(e), a = r.length;
54
54
  return {
55
55
  quote: i,
56
56
  start: a,
57
57
  end: a + i.length
58
58
  };
59
- }, O = (e, t) => {
59
+ }, k = (e, t) => {
60
60
  (e || []).forEach((e) => {
61
61
  let t = e.parentNode, n = e.childNodes, r = n.length;
62
62
  if (r > 0) for (let i = 0; i < r; i++) t.insertBefore(n[0], e);
63
63
  else t.insertBefore(document.createTextNode(e.textContent), e);
64
64
  t.removeChild(e);
65
65
  }), t.normalize();
66
- }, k = () => {
66
+ }, A = () => {
67
67
  document.getSelection ? (document.getSelection().removeAllRanges(), document.getSelection().addRange(document.createRange())) : window.getSelection ? window.getSelection().removeAllRanges ? (window.getSelection().removeAllRanges(), window.getSelection().addRange(document.createRange())) : window.getSelection().empty && window.getSelection().empty() : document.selection && document.selection.empty();
68
- }, A = (e) => e.length >= 20 || e.search(/\n|\r|\r\n/) !== -1, j = (e) => Array.from(document.querySelectorAll(`[data-id='${e}']`)), M = (e) => document.querySelector(`[data-ann-id='${e}']`), N = t(i)(({ annotationType: e }) => ({ "& .MuiPaper-root": {
68
+ }, j = (e) => e.length >= 20 || e.search(/\n|\r|\r\n/) !== -1, M = (e) => Array.from(document.querySelectorAll(`[data-id='${e}']`)), N = (e) => document.querySelector(`[data-ann-id='${e}']`), P = o(a)(({ annotationType: e }) => ({ "& .MuiPaper-root": {
69
69
  overflowX: "unset",
70
70
  overflowY: "unset",
71
71
  marginLeft: "16px",
@@ -79,19 +79,19 @@ var b = /* @__PURE__ */ e(a(), 1), x = /* @__PURE__ */ e(g(), 1), S = (e, t, n)
79
79
  width: 0,
80
80
  pointerEvents: "none",
81
81
  borderWidth: "7px",
82
- borderRightColor: c.border()
82
+ borderRightColor: t.border()
83
83
  },
84
84
  ...e === "negative" && { "&::before": { borderRightColor: "rgb(255, 204, 238) !important" } },
85
85
  ...e === "positive" && { "&::before": { borderRightColor: "rgb(153, 255, 153) !important" } }
86
- } })), P = t("div")(({ theme: e, annotationType: t }) => ({
86
+ } })), ee = o("div")(({ theme: e, annotationType: n }) => ({
87
87
  width: "200px",
88
88
  overflow: "hidden",
89
89
  borderRadius: "4px",
90
- backgroundColor: c.v("pie")("background", c.defaults.WHITE),
91
- color: c.v("pie")("text", e.palette.text.primary),
92
- border: `4px solid ${c.border()}`,
90
+ backgroundColor: t.v("pie")("background", t.defaults.WHITE),
91
+ color: t.v("pie")("text", e.palette.text.primary),
92
+ border: `4px solid ${t.border()}`,
93
93
  "& .MuiInputBase-root": { color: "inherit" },
94
- ...(t === "negative" || t === "positive") && {
94
+ ...(n === "negative" || n === "positive") && {
95
95
  position: "relative",
96
96
  boxShadow: "0 0 0 1px #757575",
97
97
  "&::after": {
@@ -102,52 +102,52 @@ var b = /* @__PURE__ */ e(a(), 1), x = /* @__PURE__ */ e(g(), 1), S = (e, t, n)
102
102
  pointerEvents: "none"
103
103
  }
104
104
  },
105
- ...t === "negative" && { borderColor: "rgb(255, 204, 238) !important" },
106
- ...t === "positive" && { borderColor: "rgb(153, 255, 153) !important" }
107
- })), F = t("div")(() => ({
105
+ ...n === "negative" && { borderColor: "rgb(255, 204, 238) !important" },
106
+ ...n === "positive" && { borderColor: "rgb(153, 255, 153) !important" }
107
+ })), F = o("div")(() => ({
108
108
  display: "flex",
109
109
  flexWrap: "wrap",
110
- borderTop: `2px solid ${c.border()}`
111
- })), I = t("div")(({ theme: e, variant: t, annotationType: n }) => ({
110
+ borderTop: `2px solid ${t.border()}`
111
+ })), I = o("div")(({ theme: e, variant: n, annotationType: r }) => ({
112
112
  flexGrow: 1,
113
113
  width: "28%",
114
114
  textAlign: "center",
115
115
  padding: "4px",
116
116
  cursor: "pointer",
117
- "&:not(:nth-child(3n))": { borderRight: `1px solid ${c.border()}` },
118
- "&:hover": { backgroundColor: c.backgroundDark() },
119
- ...t === "positive" && {
117
+ "&:not(:nth-child(3n))": { borderRight: `1px solid ${t.border()}` },
118
+ "&:hover": { backgroundColor: t.backgroundDark() },
119
+ ...n === "positive" && {
120
120
  backgroundColor: "rgb(153, 255, 153) !important",
121
121
  color: e.palette.text.primary,
122
122
  "&:hover": { filter: "brightness(85%)" }
123
123
  },
124
- ...t === "negative" && {
124
+ ...n === "negative" && {
125
125
  backgroundColor: "rgb(255, 204, 238) !important",
126
126
  color: e.palette.text.primary,
127
127
  "&:hover": { filter: "brightness(85%)" }
128
128
  },
129
- ...t === "typeChange" && n === "negative" && { "&:hover": {
129
+ ...n === "typeChange" && r === "negative" && { "&:hover": {
130
130
  backgroundColor: "rgb(153, 255, 153) !important",
131
131
  color: e.palette.text.primary
132
132
  } },
133
- ...t === "typeChange" && n === "positive" && { "&:hover": {
133
+ ...n === "typeChange" && r === "positive" && { "&:hover": {
134
134
  backgroundColor: "rgb(255, 204, 238) !important",
135
135
  color: e.palette.text.primary
136
136
  } }
137
- })), ee = class extends _.Component {
137
+ })), te = class extends v.Component {
138
138
  static propTypes = {
139
- anchorEl: b.default.object,
140
- open: b.default.bool,
141
- offset: b.default.number,
142
- value: b.default.string,
143
- type: b.default.string,
144
- onClose: b.default.func,
145
- onDelete: b.default.func,
146
- onSave: b.default.func,
147
- onTypeChange: b.default.func
139
+ anchorEl: x.default.object,
140
+ open: x.default.bool,
141
+ offset: x.default.number,
142
+ value: x.default.string,
143
+ type: x.default.string,
144
+ onClose: x.default.func,
145
+ onDelete: x.default.func,
146
+ onSave: x.default.func,
147
+ onTypeChange: x.default.func
148
148
  };
149
149
  constructor(e) {
150
- super(e), this.state = { value: e.value }, this.editorId = m("annotation-editor");
150
+ super(e), this.state = { value: e.value }, this.editorId = h("annotation-editor");
151
151
  }
152
152
  UNSAFE_componentWillReceiveProps(e) {
153
153
  let { value: t } = e, { value: n } = this.props;
@@ -164,7 +164,7 @@ var b = /* @__PURE__ */ e(a(), 1), x = /* @__PURE__ */ e(g(), 1), S = (e, t, n)
164
164
  };
165
165
  render() {
166
166
  let { anchorEl: e, offset: t, onDelete: n, open: r, type: i } = this.props, { value: a } = this.state;
167
- return /* @__PURE__ */ v(N, {
167
+ return /* @__PURE__ */ y(P, {
168
168
  anchorEl: e,
169
169
  elevation: 2,
170
170
  open: r,
@@ -186,9 +186,9 @@ var b = /* @__PURE__ */ e(a(), 1), x = /* @__PURE__ */ e(g(), 1), S = (e, t, n)
186
186
  vertical: "top",
187
187
  horizontal: "left"
188
188
  },
189
- children: /* @__PURE__ */ y(P, {
189
+ children: /* @__PURE__ */ b(ee, {
190
190
  annotationType: i,
191
- children: [/* @__PURE__ */ v(o, {
191
+ children: [/* @__PURE__ */ y(s, {
192
192
  id: this.editorId,
193
193
  style: {
194
194
  padding: "2px 5px",
@@ -201,18 +201,18 @@ var b = /* @__PURE__ */ e(a(), 1), x = /* @__PURE__ */ e(g(), 1), S = (e, t, n)
201
201
  value: a,
202
202
  onChange: this.onValueChange,
203
203
  InputProps: { disableUnderline: !0 }
204
- }), /* @__PURE__ */ y(F, { children: [
205
- /* @__PURE__ */ v(I, {
204
+ }), /* @__PURE__ */ b(F, { children: [
205
+ /* @__PURE__ */ y(I, {
206
206
  onClick: n,
207
207
  children: "Delete"
208
208
  }),
209
- /* @__PURE__ */ v(I, {
209
+ /* @__PURE__ */ y(I, {
210
210
  variant: "typeChange",
211
211
  annotationType: i,
212
212
  onClick: this.handleTypeChange,
213
213
  children: i === "negative" ? "Green" : "Pink"
214
214
  }),
215
- /* @__PURE__ */ v(I, {
215
+ /* @__PURE__ */ y(I, {
216
216
  onClick: this.handleSave,
217
217
  children: "Save"
218
218
  })
@@ -220,7 +220,7 @@ var b = /* @__PURE__ */ e(a(), 1), x = /* @__PURE__ */ e(g(), 1), S = (e, t, n)
220
220
  })
221
221
  });
222
222
  }
223
- }, L = t(i)({ "& .MuiPaper-root": {
223
+ }, ne = o(a)({ "& .MuiPaper-root": {
224
224
  overflowX: "unset",
225
225
  overflowY: "unset",
226
226
  marginTop: "-16px",
@@ -233,56 +233,56 @@ var b = /* @__PURE__ */ e(a(), 1), x = /* @__PURE__ */ e(g(), 1), S = (e, t, n)
233
233
  width: 0,
234
234
  pointerEvents: "none",
235
235
  borderWidth: "7px",
236
- borderTopColor: c.borderDark()
236
+ borderTopColor: t.borderDark()
237
237
  }
238
- } }), R = t("div")(({ theme: e }) => ({
238
+ } }), re = o("div")(({ theme: e }) => ({
239
239
  width: "300px",
240
240
  overflow: "hidden",
241
241
  borderRadius: "4px",
242
- backgroundColor: c.v("pie")("background", c.defaults.WHITE),
243
- color: c.v("pie")("text", e.palette.text.primary),
244
- border: `2px solid ${c.borderDark()}`
245
- })), te = t("div")({
242
+ backgroundColor: t.v("pie")("background", t.defaults.WHITE),
243
+ color: t.v("pie")("text", e.palette.text.primary),
244
+ border: `2px solid ${t.borderDark()}`
245
+ })), ie = o("div")({
246
246
  display: "flex",
247
247
  flexWrap: "wrap"
248
- }), ne = t("div")(() => ({
248
+ }), ae = o("div")(() => ({
249
249
  display: "flex",
250
250
  flexWrap: "wrap",
251
- borderTop: `2px solid ${c.border()}`
252
- })), z = t("div")(({ theme: e, variant: t }) => ({
251
+ borderTop: `2px solid ${t.border()}`
252
+ })), L = o("div")(({ theme: e, variant: n }) => ({
253
253
  width: "22%",
254
254
  textAlign: "center",
255
255
  padding: "4px",
256
256
  cursor: "pointer",
257
- borderBottom: `1px solid ${c.border()}`,
258
- "&:not(:nth-child(4n))": { borderRight: `1px solid ${c.border()}` },
257
+ borderBottom: `1px solid ${t.border()}`,
258
+ "&:not(:nth-child(4n))": { borderRight: `1px solid ${t.border()}` },
259
259
  "&:nth-child(4n)": { flexGrow: 1 },
260
- "&:hover": { backgroundColor: c.backgroundDark() },
261
- ...t === "positive" && {
260
+ "&:hover": { backgroundColor: t.backgroundDark() },
261
+ ...n === "positive" && {
262
262
  backgroundColor: "rgb(153, 255, 153) !important",
263
263
  color: e.palette.text.primary,
264
264
  "&:hover": { filter: "brightness(85%)" }
265
265
  },
266
- ...t === "negative" && {
266
+ ...n === "negative" && {
267
267
  backgroundColor: "rgb(255, 204, 238) !important",
268
268
  color: e.palette.text.primary,
269
269
  "&:hover": { filter: "brightness(85%)" }
270
270
  }
271
- })), re = class extends _.Component {
271
+ })), R = class extends v.Component {
272
272
  static propTypes = {
273
- anchorEl: b.default.object,
274
- open: b.default.bool,
275
- annotations: b.default.array,
276
- isNewAnnotation: b.default.bool,
277
- onClose: b.default.func,
278
- onDelete: b.default.func,
279
- onEdit: b.default.func,
280
- onWrite: b.default.func,
281
- onAnnotate: b.default.func
273
+ anchorEl: x.default.object,
274
+ open: x.default.bool,
275
+ annotations: x.default.array,
276
+ isNewAnnotation: x.default.bool,
277
+ onClose: x.default.func,
278
+ onDelete: x.default.func,
279
+ onEdit: x.default.func,
280
+ onWrite: x.default.func,
281
+ onAnnotate: x.default.func
282
282
  };
283
283
  render() {
284
284
  let { anchorEl: e, annotations: t, isNewAnnotation: n, onAnnotate: r, onClose: i, onEdit: a, onDelete: o, onWrite: s, open: c } = this.props;
285
- return /* @__PURE__ */ v(L, {
285
+ return /* @__PURE__ */ y(ne, {
286
286
  anchorEl: e,
287
287
  open: c,
288
288
  onClose: i,
@@ -299,35 +299,35 @@ var b = /* @__PURE__ */ e(a(), 1), x = /* @__PURE__ */ e(g(), 1), S = (e, t, n)
299
299
  vertical: "bottom",
300
300
  horizontal: "center"
301
301
  },
302
- children: /* @__PURE__ */ y(R, { children: [/* @__PURE__ */ v(te, { children: t.map((e, t) => /* @__PURE__ */ v(z, {
302
+ children: /* @__PURE__ */ b(re, { children: [/* @__PURE__ */ y(ie, { children: t.map((e, t) => /* @__PURE__ */ y(L, {
303
303
  variant: e.type,
304
304
  onClick: () => r(e),
305
305
  children: e.label
306
- }, `annotation-${t}`)) }), /* @__PURE__ */ y(ne, { children: [
307
- /* @__PURE__ */ v(z, {
306
+ }, `annotation-${t}`)) }), /* @__PURE__ */ b(ae, { children: [
307
+ /* @__PURE__ */ y(L, {
308
308
  onClick: i,
309
309
  children: "Cancel"
310
310
  }),
311
- /* @__PURE__ */ v(z, { style: { pointerEvents: "none" } }),
312
- n ? /* @__PURE__ */ y(_.Fragment, { children: [/* @__PURE__ */ v(z, {
311
+ /* @__PURE__ */ y(L, { style: { pointerEvents: "none" } }),
312
+ n ? /* @__PURE__ */ b(v.Fragment, { children: [/* @__PURE__ */ y(L, {
313
313
  variant: "positive",
314
314
  onClick: () => s("positive"),
315
315
  children: "Write"
316
- }), /* @__PURE__ */ v(z, {
316
+ }), /* @__PURE__ */ y(L, {
317
317
  variant: "negative",
318
318
  onClick: () => s("negative"),
319
319
  children: "Write"
320
- })] }) : /* @__PURE__ */ y(_.Fragment, { children: [/* @__PURE__ */ v(z, {
320
+ })] }) : /* @__PURE__ */ b(v.Fragment, { children: [/* @__PURE__ */ y(L, {
321
321
  onClick: o,
322
322
  children: "Delete"
323
- }), /* @__PURE__ */ v(z, {
323
+ }), /* @__PURE__ */ y(L, {
324
324
  onClick: a,
325
325
  children: "Edit"
326
326
  })] })
327
327
  ] })] })
328
328
  });
329
329
  }
330
- }, { translator: ie } = h, B = t("div")({
330
+ }, { translator: z } = g, B = o("div")({
331
331
  padding: "10px 120px 10px 16px",
332
332
  backgroundColor: "rgba(0, 0, 0, 0.06)",
333
333
  border: "1px solid #ccc",
@@ -343,11 +343,11 @@ var b = /* @__PURE__ */ e(a(), 1), x = /* @__PURE__ */ e(g(), 1), S = (e, t, n)
343
343
  "-moz-user-select": "none",
344
344
  "-ms-user-select": "none"
345
345
  }
346
- }), V = t("div")({ width: "230px" }), H = t("div")({
346
+ }), V = o("div")({ width: "230px" }), H = o("div")({
347
347
  position: "relative",
348
348
  overflowX: "hidden",
349
349
  display: "flex"
350
- }), U = t(d)(({ theme: e }) => ({
350
+ }), U = o(f)(({ theme: e }) => ({
351
351
  paddingTop: e.spacing(2),
352
352
  marginBottom: e.spacing(2),
353
353
  marginTop: e.spacing(2),
@@ -357,22 +357,22 @@ if (!document.getElementById("annotation-editor-styles")) {
357
357
  let e = document.createElement("style");
358
358
  e.id = "annotation-editor-styles", e.textContent = W, document.head.appendChild(e);
359
359
  }
360
- var G = class extends _.Component {
360
+ var G = class extends v.Component {
361
361
  static propTypes = {
362
- text: b.default.string,
363
- comment: b.default.string,
364
- annotations: b.default.array,
365
- predefinedAnnotations: b.default.array,
366
- onChange: b.default.func.isRequired,
367
- onCommentChange: b.default.func.isRequired,
368
- width: b.default.number,
369
- height: b.default.number,
370
- maxHeight: b.default.string,
371
- disabled: b.default.bool,
372
- disabledMath: b.default.bool,
373
- customKeys: b.default.array,
374
- keypadMode: b.default.string,
375
- language: b.default.string
362
+ text: x.default.string,
363
+ comment: x.default.string,
364
+ annotations: x.default.array,
365
+ predefinedAnnotations: x.default.array,
366
+ onChange: x.default.func.isRequired,
367
+ onCommentChange: x.default.func.isRequired,
368
+ width: x.default.number,
369
+ height: x.default.number,
370
+ maxHeight: x.default.string,
371
+ disabled: x.default.bool,
372
+ disabledMath: x.default.bool,
373
+ customKeys: x.default.array,
374
+ keypadMode: x.default.string,
375
+ language: x.default.string
376
376
  };
377
377
  constructor(e) {
378
378
  super(e), this.state = {
@@ -389,11 +389,11 @@ var G = class extends _.Component {
389
389
  componentDidMount() {
390
390
  let { annotations: e, text: t } = this.props;
391
391
  t && e.forEach((e) => {
392
- let [t, n] = C(e.start, e.end, this.textRef);
392
+ let [t, n] = w(e.start, e.end, this.textRef);
393
393
  if (t && n) {
394
394
  let r = document.createRange();
395
395
  r.setStart(t.node, t.offset), r.setEnd(n.node, n.offset);
396
- let i = E(r);
396
+ let i = D(r);
397
397
  this.createDOMAnnotation(i, e);
398
398
  }
399
399
  }), this.textRef && (this.adjustAnnotationsPosition(), this.textRef.addEventListener("scroll", this.adjustAnnotationsPosition));
@@ -402,7 +402,7 @@ var G = class extends _.Component {
402
402
  if (this.textRef && this.labelsRef) {
403
403
  let e = this.textRef.offsetLeft + this.textRef.offsetWidth + 8;
404
404
  Array.from(this.labelsRef.children).forEach((t) => {
405
- let n = j(t.dataset.annId), r = (n[0].offsetTop ? n[0].offsetTop : n[0].offsetParent.offsetTop) - this.textRef.scrollTop - 6;
405
+ let n = M(t.dataset.annId), r = (n[0].offsetTop ? n[0].offsetTop : n[0].offsetParent.offsetTop) - this.textRef.scrollTop - 6;
406
406
  t.style.top = `${r}px`, t.style.left = `${e}px`;
407
407
  });
408
408
  }
@@ -410,7 +410,7 @@ var G = class extends _.Component {
410
410
  handleClick = (e) => {
411
411
  let { annotations: t } = this.props, { selectionDetails: n } = this.state;
412
412
  if (n) return;
413
- let { id: r, annId: i } = e.target.dataset, a = r || i, o = j(a), s = M(a), c = t.findIndex((e) => e.id === a), l = s.hasAttribute("data-freeform");
413
+ let { id: r, annId: i } = e.target.dataset, a = r || i, o = M(a), s = N(a), c = t.findIndex((e) => e.id === a), l = s.hasAttribute("data-freeform");
414
414
  l && (s.style.zIndex = "10"), this.setState({
415
415
  anchorEl: o[0],
416
416
  openedMenu: !!r || !!i && !l,
@@ -423,20 +423,20 @@ var G = class extends _.Component {
423
423
  });
424
424
  };
425
425
  handleHover = (e) => {
426
- let { id: t, annId: n } = e.target.dataset, r = t || n, i = j(r), a = M(r), o = a.hasAttribute("data-freeform");
426
+ let { id: t, annId: n } = e.target.dataset, r = t || n, i = M(r), a = N(r), o = a.hasAttribute("data-freeform");
427
427
  i.forEach((e) => {
428
428
  e.style.zIndex = "20", e.classList.contains("positive") ? e.style.backgroundColor = "rgb(51, 255, 51, 0.7)" : e.classList.contains("negative") && (e.style.backgroundColor = "rgba(255, 102, 204, 0.55)");
429
429
  }), o ? (a.style.zIndex = "20", a.classList.contains("positive") ? (a.style.backgroundColor = "rgb(128, 255, 128)", a.style.setProperty("--before-border-color", "rgb(153, 255, 153)")) : a.classList.contains("negative") && (a.style.backgroundColor = "rgb(255, 179, 230)", a.style.setProperty("--before-border-color", "rgb(255, 179, 230)"))) : (a.style.zIndex = "20", a.classList.contains("positive") ? a.style.color = "rgb(0, 77, 0)" : a.classList.contains("negative") && (a.style.color = "rgb(153, 0, 102)"));
430
430
  };
431
431
  handleCancelHover = (e) => {
432
- let { id: t, annId: n } = e.target.dataset, r = t || n, i = j(r), a = M(r), o = a.hasAttribute("data-freeform");
432
+ let { id: t, annId: n } = e.target.dataset, r = t || n, i = M(r), a = N(r), o = a.hasAttribute("data-freeform");
433
433
  i.forEach((e) => {
434
434
  e.style.zIndex = "", e.classList.contains("positive") ? e.style.backgroundColor = "rgb(51, 255, 51, 0.5)" : e.classList.contains("negative") && (e.style.backgroundColor = "rgba(255, 102, 204, 0.4)");
435
435
  }), o ? (a.style.zIndex = "", a.classList.contains("positive") ? (a.style.backgroundColor = "rgb(153, 255, 153)", a.style.removeProperty("--before-border-color")) : a.classList.contains("negative") && (a.style.backgroundColor = "rgb(255, 204, 238)", a.style.removeProperty("--before-border-color"))) : (a.style.zIndex = "", a.classList.contains("positive") ? a.style.color = "rgb(0, 128, 0)" : a.classList.contains("negative") && (a.style.color = "rgb(204, 0, 136)"));
436
436
  };
437
437
  handleClose = (e) => {
438
438
  let { selectedElems: t, labelElem: n } = this.state;
439
- t.length && !t[0].hasAttribute("data-id") && O(t, this.textRef), n && (n.style.zIndex = ""), this.setState({
439
+ t.length && !t[0].hasAttribute("data-id") && k(t, this.textRef), n && (n.style.zIndex = ""), this.setState({
440
440
  anchorEl: null,
441
441
  openedMenu: !1,
442
442
  openedEditor: !1,
@@ -445,18 +445,18 @@ var G = class extends _.Component {
445
445
  selectionDetails: null,
446
446
  annotationIndex: null,
447
447
  annotation: null
448
- }), k();
448
+ }), A();
449
449
  };
450
450
  handleSelection = (e) => {
451
451
  let t = window.getSelection();
452
452
  if (e.detail > 2) {
453
- k();
453
+ A();
454
454
  return;
455
455
  }
456
456
  if (t && t.rangeCount > 0) {
457
457
  let e = t.getRangeAt(0), n = e.toString(), r = this.textRef.contains(e.commonAncestorContainer);
458
458
  if (!t.isCollapsed && n !== "" && r) {
459
- let t = D(e, this.textRef), n = E(e);
459
+ let t = O(e, this.textRef), n = D(e);
460
460
  this.setState({
461
461
  anchorEl: n[0],
462
462
  openedMenu: !0,
@@ -468,7 +468,7 @@ var G = class extends _.Component {
468
468
  };
469
469
  deleteAnnotation = () => {
470
470
  let { annotations: e, onChange: t } = this.props, { selectedElems: n, labelElem: r, annotationIndex: i, annotation: a } = this.state;
471
- (A(a.label) ? this.labelsRef : n[0]).removeChild(r), O(n, this.textRef), e.splice(i, 1), t(e), this.handleClose();
471
+ (j(a.label) ? this.labelsRef : n[0]).removeChild(r), k(n, this.textRef), e.splice(i, 1), t(e), this.handleClose();
472
472
  };
473
473
  createDOMAnnotation = (e, t) => {
474
474
  let { disabled: n } = this.props, { id: r, label: i, type: a } = t;
@@ -476,7 +476,7 @@ var G = class extends _.Component {
476
476
  e.dataset.id = r, e.className = `annotation ${a}`, e.style.position = "relative", e.style.cursor = "pointer", a === "positive" ? e.style.backgroundColor = "rgb(51, 255, 51, 0.5)" : a === "negative" && (e.style.backgroundColor = "rgba(255, 102, 204, 0.4)"), e.onclick = !n && this.handleClick, e.onmouseover = this.handleHover, e.onmouseout = this.handleCancelHover;
477
477
  });
478
478
  let o = e && e[0] || {}, s = document.createElement("SPAN");
479
- if (s.dataset.annId = r, s.innerHTML = i, s.onclick = !n && this.handleClick, s.onmouseover = this.handleHover, s.onmouseout = this.handleCancelHover, A(i)) {
479
+ if (s.dataset.annId = r, s.innerHTML = l(i), s.onclick = !n && this.handleClick, s.onmouseover = this.handleHover, s.onmouseout = this.handleCancelHover, j(i)) {
480
480
  let e = (o.offsetTop ? o.offsetTop : o.offsetParent.offsetTop) - this.textRef.scrollTop, t = this.textRef.offsetLeft + this.textRef.offsetWidth + 8;
481
481
  s.dataset.freeform = !0, s.className = `sideAnnotation ${a}`, s.style.position = "absolute", s.style.padding = "4px", s.style.borderRadius = "4px", s.style.marginLeft = "8px", s.style.width = "180px", s.style.whiteSpace = "pre-wrap", s.style.wordBreak = "break-word", s.style.border = "2px solid #ffffff", s.style.fontSize = "14px", s.style.fontStyle = "normal", s.style.fontWeight = "normal", s.style.top = `${e}px`, s.style.left = `${t}px`, a === "negative" ? s.style.backgroundColor = "rgb(255, 204, 238)" : a === "positive" && (s.style.backgroundColor = "rgb(153, 255, 153)"), s.style.setProperty("--before-border-width", "7px"), s.style.setProperty("--before-top", "5px"), s.style.setProperty("--before-right", "100%"), a === "negative" ? s.style.setProperty("--before-border-color", "rgb(255, 204, 238)") : a === "positive" && s.style.setProperty("--before-border-color", "rgb(153, 255, 153)"), this.labelsRef.appendChild(s);
482
482
  } else s.className = `annotationLabel ${a}`, s.style.backgroundColor = "rgb(242, 242, 242)", s.style.padding = "2px", s.style.position = "absolute", s.style.userSelect = "none", s.style.whiteSpace = "nowrap", s.style.top = "-10px", s.style.left = "-2px", s.style.fontSize = "12px", s.style.fontStyle = "normal", s.style.fontWeight = "normal", s.style.lineHeight = "6px", s.style.webkitUserSelect = "none", s.style.mozUserSelect = "none", s.style.msUserSelect = "none", a === "positive" ? s.style.color = "rgb(0, 128, 0)" : a === "negative" && (s.style.color = "rgb(204, 0, 136)"), o.appendChild(s);
@@ -516,7 +516,7 @@ var G = class extends _.Component {
516
516
  });
517
517
  };
518
518
  addAnnotation = (e) => {
519
- let { annotations: t, onChange: n } = this.props, r = this.createNewAnnotation("", e), i = M(r.id);
519
+ let { annotations: t, onChange: n } = this.props, r = this.createNewAnnotation("", e), i = N(r.id);
520
520
  t.push(r), this.setState({
521
521
  openedMenu: !1,
522
522
  openedEditor: !0,
@@ -527,9 +527,9 @@ var G = class extends _.Component {
527
527
  };
528
528
  updateLabel = (e, t, n) => {
529
529
  let { selectedElems: r, labelElem: i } = this.state, { label: a, type: o } = t;
530
- A(a) && A(e) || !A(a) && !A(e) ? (i.innerHTML = a, n && (i.classList.remove(n), i.classList.add(o), r.forEach((e) => {
530
+ j(a) && j(e) || !j(a) && !j(e) ? (i.innerHTML = l(a), n && (i.classList.remove(n), i.classList.add(o), r.forEach((e) => {
531
531
  e.classList.remove(n), e.classList.add(o);
532
- }))) : A(a) && !A(e) ? (r[0].removeChild(i), this.createDOMAnnotation(r, t)) : !A(a) && A(e) && (this.labelsRef.removeChild(i), this.createDOMAnnotation(r, t));
532
+ }))) : j(a) && !j(e) ? (r[0].removeChild(i), this.createDOMAnnotation(r, t)) : !j(a) && j(e) && (this.labelsRef.removeChild(i), this.createDOMAnnotation(r, t));
533
533
  };
534
534
  changeAnnotationType = (e) => {
535
535
  let { annotations: t, onChange: n } = this.props, { annotationIndex: r, selectedElems: i } = this.state, { type: a, label: o } = t[r], s = a === "positive" ? "negative" : "positive", c = {
@@ -552,28 +552,28 @@ var G = class extends _.Component {
552
552
  this.textRef.removeEventListener("scroll", this.adjustAnnotationsPosition);
553
553
  }
554
554
  render() {
555
- let { comment: e, customKeys: t, disabled: n, disabledMath: r, keypadMode: i, height: a, language: o, width: s, maxHeight: c, onCommentChange: l, predefinedAnnotations: d, text: f } = this.props, { anchorEl: p, annotation: m, openedMenu: h, openedEditor: g, selectionDetails: _ } = this.state, b = p && (p.offsetTop ? p.offsetTop : p.offsetParent.offsetTop), x = this.textRef && b ? b - this.textRef.scrollTop - 8 : 0, S = ie.t("extendedTextEntry.comment", { lng: o });
556
- return /* @__PURE__ */ y("div", { children: [
557
- /* @__PURE__ */ y(H, { children: [/* @__PURE__ */ v(B, {
555
+ let { comment: e, customKeys: t, disabled: n, disabledMath: r, keypadMode: i, height: a, language: o, width: s, maxHeight: c, onCommentChange: u, predefinedAnnotations: f, text: p } = this.props, { anchorEl: m, annotation: h, openedMenu: g, openedEditor: _, selectionDetails: v } = this.state, x = m && (m.offsetTop ? m.offsetTop : m.offsetParent.offsetTop), S = this.textRef && x ? x - this.textRef.scrollTop - 8 : 0, C = z.t("extendedTextEntry.comment", { lng: o });
556
+ return /* @__PURE__ */ b("div", { children: [
557
+ /* @__PURE__ */ b(H, { children: [/* @__PURE__ */ y(B, {
558
558
  style: {
559
559
  width: s - 34,
560
560
  minHeight: a,
561
561
  maxHeight: c
562
562
  },
563
563
  ref: (e) => this.textRef = e,
564
- onMouseDown: n ? () => {} : k,
564
+ onMouseDown: n ? () => {} : A,
565
565
  onMouseUp: n ? () => {} : this.handleSelection,
566
- dangerouslySetInnerHTML: { __html: f }
567
- }), /* @__PURE__ */ v(V, { ref: (e) => this.labelsRef = e })] }),
568
- /* @__PURE__ */ v(U, {
569
- label: S,
570
- children: /* @__PURE__ */ v(u, {
566
+ dangerouslySetInnerHTML: { __html: l(p) }
567
+ }), /* @__PURE__ */ y(V, { ref: (e) => this.labelsRef = e })] }),
568
+ /* @__PURE__ */ y(U, {
569
+ label: C,
570
+ children: /* @__PURE__ */ y(d, {
571
571
  className: "prompt",
572
572
  markup: e || "",
573
- onChange: l,
573
+ onChange: u,
574
574
  width: s && (s + 104).toString(),
575
575
  disabled: n,
576
- ariaLabel: S,
576
+ ariaLabel: C,
577
577
  language: o,
578
578
  pluginProps: {
579
579
  math: {
@@ -589,23 +589,23 @@ var G = class extends _.Component {
589
589
  }
590
590
  })
591
591
  }),
592
- /* @__PURE__ */ v(re, {
593
- anchorEl: p,
594
- open: h && !n,
595
- annotations: d,
596
- isNewAnnotation: !!_,
592
+ /* @__PURE__ */ y(R, {
593
+ anchorEl: m,
594
+ open: g && !n,
595
+ annotations: f,
596
+ isNewAnnotation: !!v,
597
597
  onClose: this.handleClose,
598
598
  onDelete: this.deleteAnnotation,
599
599
  onEdit: this.editAnnotation,
600
600
  onWrite: this.addAnnotation,
601
601
  onAnnotate: this.handleMenuClick
602
602
  }),
603
- /* @__PURE__ */ v(ee, {
603
+ /* @__PURE__ */ y(te, {
604
604
  anchorEl: this.textRef,
605
- open: g && !n,
606
- offset: x,
607
- value: m && m.label || "",
608
- type: m && m.type,
605
+ open: _ && !n,
606
+ offset: S,
607
+ value: h && h.label || "",
608
+ type: h && h.type,
609
609
  onClose: this.handleClose,
610
610
  onDelete: this.deleteAnnotation,
611
611
  onSave: this.updateAnnotation,
@@ -622,68 +622,68 @@ function K(e) {
622
622
  function q(e, t) {
623
623
  return !e || K(e) ? e : K(e.default) ? e.default : t && K(e[t]) ? e[t] : t && K(e[t]?.default) ? e[t].default : e;
624
624
  }
625
- var J = q(s, "UiLayout") || q(Q.UiLayout, "UiLayout"), Y = q(f, "PreviewPrompt") || q(Q.PreviewPrompt, "PreviewPrompt"), ae = q(p, "Collapsible") || q(Q.Collapsible, "Collapsible"), oe = q(r, "Feedback") || q(Q.Feedback, "Feedback"), X = l, Z = X.default, Q = Z && typeof Z == "object" ? Z : X, { translator: $ } = h, se = (0, x.default)("@pie-ui:extended-text-entry"), ce = t(J)({
626
- backgroundColor: c.background(),
627
- color: c.text()
628
- }), le = t(n)(({ theme: e }) => ({
625
+ var oe = q(c, "UiLayout") || q(Z.UiLayout, "UiLayout"), J = q(p, "PreviewPrompt") || q(Z.PreviewPrompt, "PreviewPrompt"), se = q(m, "Collapsible") || q(Z.Collapsible, "Collapsible"), ce = q(n, "Feedback") || q(Z.Feedback, "Feedback"), Y = u, X = Y.default, Z = X && typeof X == "object" ? X : Y, { translator: Q } = g, le = (0, S.default)("@pie-ui:extended-text-entry"), $ = o(oe)({
626
+ backgroundColor: t.background(),
627
+ color: t.text()
628
+ }), ue = o(i)(({ theme: e }) => ({
629
629
  width: "100%",
630
- color: c.text(),
630
+ color: t.text(),
631
631
  marginBottom: e.spacing(2),
632
632
  fontSize: "inherit",
633
633
  display: "block"
634
- })), ue = t("div")(({ theme: e }) => ({ marginBottom: e.spacing(2) })), de = t(u)(({ theme: e }) => ({
634
+ })), de = o("div")(({ theme: e }) => ({ marginBottom: e.spacing(2) })), fe = o(d)(({ theme: e }) => ({
635
635
  marginBottom: e.spacing(2),
636
636
  borderRadius: "4px"
637
- })), fe = t("h2")({
637
+ })), pe = o("h2")({
638
638
  position: "absolute",
639
639
  left: "-10000px",
640
640
  top: "auto",
641
641
  width: "1px",
642
642
  height: "1px",
643
643
  overflow: "hidden"
644
- }), pe = class extends _.Component {
644
+ }), me = class extends v.Component {
645
645
  static propTypes = {
646
- onValueChange: b.default.func.isRequired,
647
- onAnnotationsChange: b.default.func.isRequired,
648
- onCommentChange: b.default.func.isRequired,
649
- model: b.default.object,
650
- session: b.default.shape({
651
- value: b.default.string,
652
- annotations: b.default.array,
653
- comment: b.default.string
646
+ onValueChange: x.default.func.isRequired,
647
+ onAnnotationsChange: x.default.func.isRequired,
648
+ onCommentChange: x.default.func.isRequired,
649
+ model: x.default.object,
650
+ session: x.default.shape({
651
+ value: x.default.string,
652
+ annotations: x.default.array,
653
+ comment: x.default.string
654
654
  }).isRequired
655
655
  };
656
656
  promptId = `ete-prompt-${Math.random().toString(36).slice(2, 10)}`;
657
657
  render() {
658
- let { model: e, session: t, onAnnotationsChange: n, onCommentChange: r, onValueChange: i } = this.props, { animationsDisabled: a, annotatorMode: o, customKeys: s, dimensions: c, disabled: l, disabledAnnotator: u, equationEditor: d, extraCSSRules: f, feedback: p, mathInput: m, pasteFormattingDisabled: h, playersToolbarPosition: g, predefinedAnnotations: _, prompt: b, spanishInput: x, specialInput: S, spellCheckEnabled: C, teacherInstructions: w } = e, { annotations: T, comment: E, value: D } = t, { width: O, height: k } = c || {}, A = "40vh", j = { position: g === "top" ? "top" : "bottom" };
659
- se("[render] disabled? ", l);
660
- let M = /* @__PURE__ */ v(Y, {
658
+ let { model: e, session: t, onAnnotationsChange: n, onCommentChange: r, onValueChange: i } = this.props, { animationsDisabled: a, annotatorMode: o, customKeys: s, dimensions: c, disabled: l, disabledAnnotator: u, equationEditor: d, extraCSSRules: f, feedback: p, mathInput: m, pasteFormattingDisabled: h, playersToolbarPosition: g, predefinedAnnotations: _, prompt: v, spanishInput: x, specialInput: S, spellCheckEnabled: C, teacherInstructions: w } = e, { annotations: T, comment: E, value: D } = t, { width: O, height: k } = c || {}, A = "40vh", j = { position: g === "top" ? "top" : "bottom" };
659
+ le("[render] disabled? ", l);
660
+ let M = /* @__PURE__ */ y(J, {
661
661
  defaultClassName: "teacher-instructions",
662
662
  prompt: w
663
663
  }), N = [];
664
- return x && N.push({ language: "spanish" }), S && N.push({ language: "special" }), /* @__PURE__ */ y(ce, {
664
+ return x && N.push({ language: "spanish" }), S && N.push({ language: "special" }), /* @__PURE__ */ b($, {
665
665
  extraCSSRules: f,
666
666
  ref: (e) => {
667
667
  this.containerRef = e;
668
668
  },
669
669
  children: [
670
- /* @__PURE__ */ v(fe, { children: $.t("extendedTextEntry.constructedResponseQuestion", { lng: e.language }) }),
671
- w && /* @__PURE__ */ v(ue, { children: a ? M : /* @__PURE__ */ v(ae, {
670
+ /* @__PURE__ */ y(pe, { children: Q.t("extendedTextEntry.constructedResponseQuestion", { lng: e.language }) }),
671
+ w && /* @__PURE__ */ y(de, { children: a ? M : /* @__PURE__ */ y(se, {
672
672
  labels: {
673
- hidden: $.t("common:showTeacherInstructions", { lng: e.language }),
674
- visible: $.t("common:hideTeacherInstructions", { lng: e.language })
673
+ hidden: Q.t("common:showTeacherInstructions", { lng: e.language }),
674
+ visible: Q.t("common:hideTeacherInstructions", { lng: e.language })
675
675
  },
676
676
  children: M
677
677
  }) }),
678
- b && /* @__PURE__ */ v(le, {
678
+ v && /* @__PURE__ */ y(ue, {
679
679
  component: "span",
680
680
  id: this.promptId,
681
- children: /* @__PURE__ */ v(Y, {
681
+ children: /* @__PURE__ */ y(J, {
682
682
  defaultClassName: "prompt",
683
683
  prompt: e.prompt
684
684
  })
685
685
  }),
686
- o ? /* @__PURE__ */ v(G, {
686
+ o ? /* @__PURE__ */ y(G, {
687
687
  text: D || "",
688
688
  annotations: T || [],
689
689
  comment: E || "",
@@ -698,7 +698,7 @@ var J = q(s, "UiLayout") || q(Q.UiLayout, "UiLayout"), Y = q(f, "PreviewPrompt")
698
698
  customKeys: s,
699
699
  keypadMode: d,
700
700
  language: e.language
701
- }) : /* @__PURE__ */ v(de, {
701
+ }) : /* @__PURE__ */ y(fe, {
702
702
  className: "response-area-editor",
703
703
  onChange: i,
704
704
  markup: D || "",
@@ -730,11 +730,11 @@ var J = q(s, "UiLayout") || q(Q.UiLayout, "UiLayout"), Y = q(f, "PreviewPrompt")
730
730
  pasteFormatting: { disabled: h === !0 }
731
731
  },
732
732
  languageCharactersProps: N,
733
- ariaLabelledBy: b ? this.promptId : void 0,
734
- ariaLabel: $.t("extendedTextEntry.response", { lng: e.language }),
733
+ ariaLabelledBy: v ? this.promptId : void 0,
734
+ ariaLabel: Q.t("extendedTextEntry.response", { lng: e.language }),
735
735
  language: e.language
736
736
  }),
737
- p && /* @__PURE__ */ v(oe, {
737
+ p && /* @__PURE__ */ y(ce, {
738
738
  correctness: "correct",
739
739
  feedback: p
740
740
  })
@@ -743,6 +743,6 @@ var J = q(s, "UiLayout") || q(Q.UiLayout, "UiLayout"), Y = q(f, "PreviewPrompt")
743
743
  }
744
744
  };
745
745
  //#endregion
746
- export { pe as t };
746
+ export { me as t };
747
747
 
748
- //# sourceMappingURL=main-D5PwTUlN.js.map
748
+ //# sourceMappingURL=main-BRPP6Mvf.js.map