@ghentcdh/annotation-vue 0.0.1-alpha.22 → 0.0.1-alpha.23

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 (3) hide show
  1. package/index.js +3525 -0
  2. package/package.json +8 -8
  3. package/styles.css +0 -2
package/index.js ADDED
@@ -0,0 +1,3525 @@
1
+ import { i as e, n as t, r as n, t as r } from "./ControlWrapper-8o-deDw7-i1twuNp0.js";
2
+ import { t as i } from "./Markdown-DQZZDfN5-DI--37ZL.js";
3
+ import { z as a } from "zod";
4
+ import { contextBuilder as o, w3cAnnotation as s } from "@ghentcdh/w3c-utils";
5
+ import { JsonOperationsSchema as c, ResourceJsonShape as l, ViewConfigSchema as u, labelFromId as d, parseSchema as f } from "@ghentcdh/crouton-core";
6
+ import { AnnotationAdapter as p, Debugger as m, PlainTextAdapter as h, annotationSchema as g, createAnnotatedText as ee, createHighlightStyle as _, selectText as te } from "@ghentcdh/annotated-text";
7
+ import { CroutonForm as ne, FormMessage as re, resourceApi as ie } from "@ghentcdh/crouton-vue";
8
+ import { Fragment as v, computed as y, createBlock as b, createCommentVNode as x, createElementBlock as S, createElementVNode as C, createTextVNode as w, createVNode as T, defineAsyncComponent as ae, defineComponent as E, guardReactiveProps as oe, h as se, inject as ce, markRaw as le, mergeModels as ue, mergeProps as de, nextTick as fe, normalizeClass as D, normalizeProps as pe, normalizeStyle as O, onMounted as k, onUnmounted as me, openBlock as A, provide as he, reactive as ge, ref as j, renderList as M, renderSlot as N, resolveDynamicComponent as _e, shallowReactive as ve, toDisplayString as P, toRaw as ye, toRef as be, unref as F, useModel as xe, useSlots as Se, useTemplateRef as Ce, watch as I, withCtx as L, withModifiers as we } from "vue";
9
+ import { useRoute as Te, useRouter as Ee } from "vue-router";
10
+ //#region ../annotation-core/src/lib/types/source.model.ts
11
+ var De = ["text"], Oe = a.object({
12
+ text: a.string(),
13
+ textDirection: a.enum(["ltr", "rtl"]).default("ltr"),
14
+ processingLanguage: a.string().default("en"),
15
+ label: a.string().optional(),
16
+ offset: a.number().optional().default(0)
17
+ }), ke = a.object({
18
+ id: a.string(),
19
+ uri: a.string(),
20
+ type: a.enum(De),
21
+ content: Oe
22
+ }), Ae = (e) => {
23
+ let t = e.areas.map((e) => `"${e.join(" ")}"`).join(" "), n = e.areas[0]?.length ?? 1, r = {
24
+ gridTemplateAreas: t,
25
+ gridTemplateColumns: e.columns ?? Array(n).fill("minmax(0, 1fr)").join(" ")
26
+ };
27
+ return e.rows && (r.gridTemplateRows = e.rows), r;
28
+ }, je = (e, t) => e.panes.find((e) => e.sourceId === t)?.area, Me = {
29
+ baseUrl: "http://localhost:3333/",
30
+ crudController: "annotation/annotation",
31
+ app: "ghentcdh",
32
+ prefix: "ghentcdh",
33
+ isDev: !1,
34
+ cacheTTLms: 12e5
35
+ }, Ne = (e = {}) => {
36
+ let t = e.baseUrl ?? Me.baseUrl, n = t.endsWith("/") ? t : `${t}/`, r = e.isDev ?? !1, i = r ? 0 : 12e5;
37
+ return {
38
+ baseUrl: n,
39
+ contextUrl: `${n}ns/`,
40
+ app: e.app ?? Me.app,
41
+ prefix: e.prefix ?? Me.prefix,
42
+ crudController: e.crudController ?? Me.crudController,
43
+ isDev: r,
44
+ cacheTTLms: i
45
+ };
46
+ }, Pe = (e, t) => {
47
+ let { prefix: n, baseUrl: r, contextUrl: i } = Ne(t), a = Fe;
48
+ return o(n, r).setType(n, a).addPrefix(e, `${n}:${e}`).setContextUri(`${i}${e}.jsonld`);
49
+ }, Fe = "AnnotationMetadata", Ie = (e, t) => {
50
+ let n = t.views?.form, r = Pe(t.id, e);
51
+ return n && r.parseJsonSchema(n.json_schema), {
52
+ id: t.id,
53
+ styling: {
54
+ name: t.name,
55
+ id: t.id,
56
+ target: t.annotation.target,
57
+ color: t.annotation.color
58
+ },
59
+ hasContext: !!n,
60
+ prefix: Le(e, t),
61
+ uri: r.uri,
62
+ jsonLd: r.toJsonLdContext(),
63
+ safeParse: r.safeParse.bind(r),
64
+ toAnnotationBody: r.toAnnotationBody.bind(r)
65
+ };
66
+ }, Le = (e, t) => `${e.prefix}:${t.annotation.type}/`, Re = 1, ze = 1, Be = a.enum([
67
+ "gutter",
68
+ "underline",
69
+ "highlight"
70
+ ]), R = a.object({
71
+ color: a.string().optional(),
72
+ type: a.string().optional(),
73
+ icon: a.string().optional(),
74
+ isRoot: a.boolean().optional().default(!0),
75
+ allowedChildren: a.array(a.string()).optional().default([]),
76
+ allowedLinks: a.array(a.string()).optional().default([]),
77
+ target: Be.optional().default("highlight")
78
+ }), Ve = l.extend({
79
+ route: a.string().optional(),
80
+ tag: a.string().optional(),
81
+ operations: c.optional().default(c.parse({})),
82
+ id: a.string(),
83
+ annotation: R.optional().default(R.parse({}))
84
+ }).passthrough(), He = Ve.transform((e) => {
85
+ let t = d(e.name);
86
+ return {
87
+ schemaVersion: e.schemaVersion ?? 1,
88
+ title: t,
89
+ ...e
90
+ };
91
+ }), Ue = a.custom(), { id: We, name: Ge, title: Ke, operations: qe } = Ve.shape, Je = a.object({
92
+ id: We,
93
+ name: Ge,
94
+ title: Ke,
95
+ operations: qe,
96
+ annotation: R,
97
+ context: a.custom(() => !0).optional().nullish(),
98
+ schemas: a.record(a.string(), u.partial()).optional().nullish()
99
+ }), Ye = "annotation.style", Xe = a.object({
100
+ id: a.string(),
101
+ name: a.string(),
102
+ target: a.enum([
103
+ "gutter",
104
+ "underline",
105
+ "highlight"
106
+ ]).optional().default("underline"),
107
+ color: a.string().optional()
108
+ }), Ze = "AnnotationStyle", Qe = (e) => {
109
+ let { prefix: t, baseUrl: n, contextUrl: r } = Ne(e);
110
+ return o(t, n).setType(t, Ze).setContextUri(`${r}${Ze}.jsonld`).parseZodSchema(Xe);
111
+ }, $e = (e, t) => {
112
+ let n = {
113
+ ...t,
114
+ ...t.annotation
115
+ }, r = Qe(e).toAnnotationBodyUnsafe(n);
116
+ return r.success || (m.debug(Ye, "AnnotationStyleContextBuilder safe parse failed"), m.warn(r.error)), r;
117
+ }, et = a.object({
118
+ key: a.string(),
119
+ label: a.string(),
120
+ icon: a.string().optional()
121
+ }), tt = Je.extend({
122
+ style: a.custom().optional(),
123
+ allowedChildren: a.array(et).optional().default([]),
124
+ allowedLinks: a.array(et).optional().default([])
125
+ }).transform((e) => ({
126
+ ...e,
127
+ label: e.name,
128
+ canEdit: !!e.operations?.patch,
129
+ canDelete: !!e.operations?.delete,
130
+ canCreate: !!e.operations?.create,
131
+ resource: ie({
132
+ idField: "id",
133
+ ...e
134
+ }, {})
135
+ })), nt = a.union([a.string(), a.number()]), rt = a.object({
136
+ uri: a.string(),
137
+ start: a.number(),
138
+ end: a.number(),
139
+ exact: a.string().optional(),
140
+ prefix: a.string().optional(),
141
+ suffix: a.string().optional()
142
+ }), it = a.object({ uri: a.string() }), at = a.lazy(() => a.object({
143
+ id: nt,
144
+ label: a.string().optional(),
145
+ metadata: a.any(),
146
+ selectors: a.array(rt),
147
+ links: a.array(it).default([]),
148
+ parentId: nt.optional(),
149
+ definitionUri: a.string()
150
+ })).transform((e) => {
151
+ let t = (t) => e.selectors?.find((e) => e.uri === t), n = (t) => {
152
+ let n = e.selectors.findIndex((e) => e.uri === t.uri);
153
+ n >= 0 ? e.selectors.splice(n, 1, t) : e.selectors.push(t);
154
+ }, r = (t) => at.parse({
155
+ ...e,
156
+ ...t
157
+ });
158
+ return {
159
+ ...e,
160
+ definitionUri: e.definitionUri,
161
+ getSelector: t,
162
+ setSelector: n,
163
+ clone: r
164
+ };
165
+ }), ot = (e, t, n, r) => {
166
+ let i = n.fullFlatText ? te(n.fullFlatText, t.start, t.end, n.startOffset) : {}, a = rt.parse({
167
+ ...t,
168
+ uri: e,
169
+ ...i
170
+ }), o = r?.selectors?.filter((t) => t.uri !== e) ?? [];
171
+ return o.push(a), o;
172
+ }, st = (e, t, n, r) => at.parse({
173
+ ...r,
174
+ selectors: ot(e, t, {
175
+ fullFlatText: n.fullFlatText,
176
+ startOffset: n.startOffset
177
+ }, r)
178
+ }), ct = (e, t, n) => at.parse({
179
+ id: "NEW_ANNOTATION",
180
+ metadata: {},
181
+ definitionUri: t.definitionUri ?? "default",
182
+ label: "",
183
+ links: [],
184
+ selectors: ot(e, t, {
185
+ fullFlatText: n.fullFlatText,
186
+ startOffset: n.startOffset
187
+ })
188
+ }), lt = class extends p {
189
+ constructor(e) {
190
+ super(e), this.name = "AnnotationEditorAnnotationAdapter";
191
+ }
192
+ setParams(e) {
193
+ this.sourceUri = e.sourceModel?.uri ?? this.sourceUri, super.setParams(e);
194
+ }
195
+ _parse(e) {
196
+ let t = e?.selectors?.find((e) => e.uri === this.sourceUri);
197
+ return t ? g.parse({
198
+ id: e.id,
199
+ start: t.start,
200
+ end: t.end
201
+ }) : null;
202
+ }
203
+ format(e, t, n) {
204
+ if (!e) return null;
205
+ let r = this.getOriginalAnnotation(e.id);
206
+ if (!t && !n) return r;
207
+ if (!t && !e.id) throw Error("annotation id is required");
208
+ let i = t || !r ? ct(this.sourceUri, e, {
209
+ fullFlatText: this.textAdapter.fullFlatText,
210
+ startOffset: this.startOffset
211
+ }) : st(this.sourceUri, e, {
212
+ fullFlatText: this.textAdapter.fullFlatText,
213
+ startOffset: this.startOffset
214
+ }, r);
215
+ return this.addAnnotation(e.id, i, e), i;
216
+ }
217
+ updateSelector(e, t) {
218
+ let n = this.getOriginalAnnotation(e.id);
219
+ return n ? st(this.sourceUri, e, {
220
+ fullFlatText: this.textAdapter.fullFlatText,
221
+ startOffset: this.startOffset
222
+ }, n) : ct(this.sourceUri, e, {
223
+ fullFlatText: this.textAdapter.fullFlatText,
224
+ startOffset: this.startOffset
225
+ });
226
+ }
227
+ }, ut = class {
228
+ constructor() {
229
+ this.originalAnnotations = [];
230
+ }
231
+ transformMetadata(e, t) {
232
+ return e;
233
+ }
234
+ createLinks(e) {
235
+ let t = Object.fromEntries(e.map((e) => [e.id, e]));
236
+ for (let n of e) n.selectors.forEach((e) => {
237
+ t[e.uri] && (n.parentId = e.uri);
238
+ }), n.links.forEach((e) => {
239
+ let r = t[e.uri];
240
+ r && !r.links.some((e) => e.uri === n.id) && r.links.push(it.parse({ uri: n.id }));
241
+ });
242
+ return e;
243
+ }
244
+ }, dt = (e) => e.getBodiesByPurpose("styling").find((e) => e.type === "AnnotationStyle"), ft = (e) => e.getBodiesByType("AnnotationMetadata")?.[0] ?? null ?? null, pt = (e) => {
245
+ let t = {
246
+ ...(Array.isArray(e.selector) ? e.selector : e.selector ? [e.selector] : []).reduce((e, { type: t, ...n }) => ({
247
+ ...e,
248
+ ...n
249
+ }), {}),
250
+ uri: e.source
251
+ }, n = rt.safeParse(t);
252
+ return n.error ? null : n.data;
253
+ }, mt = class extends ut {
254
+ constructor(...e) {
255
+ super(...e), this.name = "W3cTransformAnnotationAdapter", this.defaultParams = {};
256
+ }
257
+ parse(e) {
258
+ let t = s(e), n = t.getSpecificResourceTargets(), r = [], i = [];
259
+ for (let e of n) if (!e.selector) i.push(it.parse({ uri: e.source }));
260
+ else {
261
+ let t = pt(e);
262
+ t && r.push(t);
263
+ }
264
+ let a = dt(t)?.id ?? "";
265
+ return at.parse({
266
+ id: e.id,
267
+ definitionUri: a,
268
+ metadata: ft(t),
269
+ selectors: r,
270
+ links: i
271
+ });
272
+ }
273
+ format(e, t) {
274
+ let n = s();
275
+ n.setId(String(e.id ?? "NEW_ONE")), n.setMotivation("tagging"), e.definitionUri && n.addBody({
276
+ type: Ze,
277
+ purpose: "styling",
278
+ id: e.definitionUri,
279
+ name: e.definitionUri
280
+ }), e.metadata && n.addBody({
281
+ type: Fe,
282
+ ...e.metadata
283
+ });
284
+ for (let t of e.selectors) {
285
+ let { uri: e, start: r, end: i, exact: a, prefix: o, suffix: s } = t;
286
+ n.updateTextPositionSelector({
287
+ start: r,
288
+ end: i
289
+ }, e), (a !== void 0 || o !== void 0 || s !== void 0) && n.updateTextQuoteSelector({
290
+ exact: a ?? "",
291
+ prefix: o,
292
+ suffix: s
293
+ }, e);
294
+ }
295
+ for (let t of e.links) n.addTarget({
296
+ type: "SpecificResource",
297
+ source: t.uri
298
+ });
299
+ return n.build();
300
+ }
301
+ }, ht = (e) => (t) => e[t.definitionUri]?.annotation?.target ?? "default", gt = (e, t) => (n) => {
302
+ let r = n.definitionUri ?? "default";
303
+ if (!e.includes(r)) {
304
+ m.debug("styleFn", `No style found for ${r}`);
305
+ let e = t[n.definitionUri];
306
+ return e?.annotation.color ? { default: _(e.annotation.color) } : "default";
307
+ }
308
+ return r;
309
+ }, _t = (e, t) => e ? e.reduce((e, n) => (e[n.id] = t ? n[t] : n, e), {}) : {}, vt = (e, t = {}, n) => {
310
+ let r = _t(Object.values(n), "style");
311
+ r.default ||= {
312
+ label: "Annotation",
313
+ isRoot: !0,
314
+ style: { default: _("#dd7777") },
315
+ allowedChildren: [],
316
+ allowedLinks: [],
317
+ views: {}
318
+ };
319
+ let i = Object.keys(r);
320
+ return (a, o) => {
321
+ let s = e?.() ?? h(), c = () => ({ renderFn: ht(n) }), l = () => ({ styleFn: gt(i, n) }), u = new lt({
322
+ sourceModel: o,
323
+ ...t
324
+ }), d = ee(a, {
325
+ annotationAdapter: u,
326
+ textAdapter: s
327
+ });
328
+ if (d.setRenderParams(c()).setStyleParams(l()).registerStyles(r), o) {
329
+ let { content: e } = o;
330
+ d.setText(e.text).setTextAdapterParams({ textDirection: e.textDirection });
331
+ }
332
+ return {
333
+ annotatedText: d,
334
+ textAdapter: s,
335
+ annotationAdapter: u
336
+ };
337
+ };
338
+ }, yt = class {
339
+ definitions = [];
340
+ groupedDefinitions = {};
341
+ constructor(e = []) {
342
+ e.length && this.setDefinitions(e);
343
+ }
344
+ setDefinitions(e) {
345
+ this.definitions = e, this.groupedDefinitions = this.definitions.reduce((e, t) => (e[t.id] = t, e), {});
346
+ }
347
+ findAll() {
348
+ return this.definitions;
349
+ }
350
+ findById(e) {
351
+ return this.groupedDefinitions[e];
352
+ }
353
+ findAllGrouped() {
354
+ return this.groupedDefinitions;
355
+ }
356
+ getAllContextBuilders() {
357
+ return this.definitions.map((e) => e.context);
358
+ }
359
+ getContextBuilder(e) {
360
+ return this.findById(e)?.context;
361
+ }
362
+ }, bt = (e) => {
363
+ try {
364
+ let t = He.safeParse(e);
365
+ if (!t.success) return console.error("Resource cannot be parsed:", t.error.message), null;
366
+ let n = f(e, {
367
+ baseUrl: "",
368
+ extensions: { annotation: R }
369
+ });
370
+ return {
371
+ ...t.data,
372
+ ...n ?? {}
373
+ };
374
+ } catch (e) {
375
+ return console.error(e), null;
376
+ }
377
+ }, xt = (e) => {
378
+ try {
379
+ let t = e, n = {
380
+ ...t,
381
+ annotation: {
382
+ color: "#c1d344",
383
+ ...t.annotation,
384
+ isRoot: !0
385
+ }
386
+ }, r = f(n, {
387
+ baseUrl: "",
388
+ extensions: { annotation: R }
389
+ });
390
+ return r ? {
391
+ success: !0,
392
+ data: r,
393
+ raw: e
394
+ } : {
395
+ success: !1,
396
+ error: "parseSchema returned null",
397
+ raw: e,
398
+ id: t.id,
399
+ name: t.name
400
+ };
401
+ } catch (t) {
402
+ let n = e;
403
+ return {
404
+ success: !1,
405
+ error: t instanceof Error ? t.message : String(t),
406
+ raw: e,
407
+ id: n?.id,
408
+ name: n?.name
409
+ };
410
+ }
411
+ }, St = (e) => "default" in e ? e.default : e, Ct = (e, t, n) => wt(Object.values(e).map(St)), wt = (e, t, n) => e.map(bt).filter((e) => !!e), Tt = async (e) => Promise.all(e.map((e) => fetch(e).then((e) => e.json()))), Et = Symbol("annotation-definitions"), Dt = null, Ot = () => Dt, kt = (e, t) => e ? e.reduce((e, n) => {
412
+ let r = t[n];
413
+ if (r) {
414
+ let t = r.annotation, n = {
415
+ key: r.id,
416
+ label: r.name
417
+ };
418
+ t.icon && (n.icon = t.icon), e.push(n);
419
+ }
420
+ return e;
421
+ }, []) : [], At = (e, t, n, r) => {
422
+ let i = e.annotation ?? {};
423
+ return {
424
+ ...tt.parse({
425
+ ...e,
426
+ allowedChildren: kt(i.allowedChildren, t),
427
+ allowedLinks: kt(i.allowedLinks, t),
428
+ style: {
429
+ default: n(i.color),
430
+ active: r(i.color)
431
+ }
432
+ }),
433
+ color: i.color,
434
+ target: i.target,
435
+ views: e.schemas ?? e.views,
436
+ _core: e
437
+ };
438
+ }, jt = (e, t, n, r) => e.map((e) => At(e, t, n, r)), Mt = (e) => e.reduce((e, t) => (e[t.id] = t, e), {}), Nt = (e) => {
439
+ let { config: t } = e, n = e.createHighlightStyle ?? _, r = e.activeHighlightStyle ?? n, i = le(new yt()), a = (e) => {
440
+ i.setDefinitions(e);
441
+ let t = i.findAllGrouped();
442
+ o.definitions = jt(e, t, n, r), o.definitionsMap = Mt(o.definitions);
443
+ }, o = ve({
444
+ configuration: t,
445
+ definitions: [],
446
+ definitionsMap: {},
447
+ loadErrors: [],
448
+ rawJsonMap: {},
449
+ loading: !1,
450
+ error: null,
451
+ service: i,
452
+ getDefinitionById(e) {
453
+ return o.definitionsMap[e];
454
+ },
455
+ loadFromDefinitions(e) {
456
+ a(e);
457
+ },
458
+ loadFromGlob(e) {
459
+ let t = Ct(e);
460
+ a(t);
461
+ },
462
+ loadFromConfigs(e) {
463
+ let t = wt(e);
464
+ a(t);
465
+ },
466
+ async loadFromUrls(e) {
467
+ o.loading = !0, o.error = null;
468
+ try {
469
+ let t = await Tt(e);
470
+ a(t);
471
+ } catch (e) {
472
+ console.error(e), o.error = e instanceof Error ? e : Error(String(e));
473
+ } finally {
474
+ o.loading = !1;
475
+ }
476
+ },
477
+ async loadFromResourceUris(e) {
478
+ o.loading = !0, o.error = null, o.loadErrors = [], o.rawJsonMap = {};
479
+ try {
480
+ let t = await Promise.all(e.map((e) => fetch(e).then((e) => e.json()).then((e) => xt(e)).catch((e) => ({
481
+ success: !1,
482
+ error: e instanceof Error ? e.message : String(e),
483
+ raw: null
484
+ })))), n = [], r = [], i = {};
485
+ for (let e of t) e.success ? (n.push(e.data), i[e.data.id] = e.raw) : r.push({
486
+ id: e.id,
487
+ name: e.name,
488
+ error: e.error,
489
+ raw: e.raw
490
+ });
491
+ o.loadErrors = r, o.rawJsonMap = i, a(n);
492
+ } catch (e) {
493
+ console.error(e), o.error = e instanceof Error ? e : Error(String(e));
494
+ } finally {
495
+ o.loading = !1;
496
+ }
497
+ },
498
+ async loadFromUrl(e, t) {
499
+ o.loading = !0, o.error = null;
500
+ try {
501
+ let n;
502
+ if (t) n = wt(await t(e));
503
+ else {
504
+ let t = await fetch(e);
505
+ if (!t.ok) throw Error(`Failed to fetch annotation definitions: ${t.status} ${t.statusText}`);
506
+ n = await Tt((await t.json()).annotations.map((e) => e.schemas));
507
+ }
508
+ a(n);
509
+ } catch (e) {
510
+ console.error(e), o.error = e instanceof Error ? e : Error(String(e));
511
+ } finally {
512
+ o.loading = !1;
513
+ }
514
+ }
515
+ });
516
+ return Dt = o, o;
517
+ }, Pt = (e) => {
518
+ let t = Nt(e);
519
+ return e.resourceFolder && t.loadFromGlob(e.resourceFolder), e.definitionsUrl && t.loadFromUrl(e.definitionsUrl, e.fetchFn), e.definitionsUrls && t.loadFromUrls(e.definitionsUrls), e.resourceUrls && t.loadFromResourceUris(e.resourceUrls), t;
520
+ }, Ft = (e) => {
521
+ let t = Pt(e);
522
+ return he(Et, t), t;
523
+ }, It = () => {
524
+ let e = ce(Et);
525
+ if (!e) throw Error("useAnnotationDefinitions() must be called inside a component that called provideAnnotationDefinitions()");
526
+ return e;
527
+ }, Lt = "annotation-editor/status", Rt = [{
528
+ path: "status",
529
+ name: Lt,
530
+ component: () => Promise.resolve().then(() => xn)
531
+ }], zt = { class: "max-w-6xl mx-auto p-6 space-y-6" }, Bt = { class: "flex items-center gap-2 flex-1" }, Vt = {
532
+ key: 0,
533
+ class: "rounded bg-base-200 px-2 py-0.5 text-xs font-mono text-base-content ml-2"
534
+ }, Ht = {
535
+ key: 1,
536
+ class: "rounded bg-error/10 text-error border border-error/40 px-2 py-0.5 text-xs ml-1"
537
+ }, Ut = {
538
+ key: 2,
539
+ class: "text-xs text-base-content/60 ml-1"
540
+ }, Wt = {
541
+ key: 0,
542
+ class: "rounded-lg border border-base-300 bg-base-200 p-6 text-center text-base-content/60 text-sm"
543
+ }, Gt = {
544
+ key: 0,
545
+ class: "rounded-lg border border-error/40 bg-error/5 p-4 text-sm text-error font-mono"
546
+ }, Kt = { key: 1 }, qt = { class: "space-y-3" }, Jt = { class: "flex items-center gap-2" }, Yt = { class: "text-sm font-medium text-error" }, Xt = {
547
+ key: 0,
548
+ class: "text-xs font-mono text-base-content/50"
549
+ }, Zt = { class: "text-xs font-mono text-error bg-error/10 rounded p-2 whitespace-pre-wrap" }, Qt = { key: 0 }, $t = { class: "mt-2 text-xs bg-base-200 rounded p-3 overflow-x-auto" }, en = { key: 2 }, tn = { class: "rounded-lg border border-base-300 divide-y divide-base-300 overflow-hidden" }, nn = ["onClick"], rn = { class: "flex-1 min-w-0" }, an = { class: "font-medium text-base-content text-sm" }, on = { class: "text-xs text-base-content/50 font-mono mt-0.5" }, sn = { class: "text-xs text-base-content/60 mt-1 space-x-2" }, cn = { key: 0 }, ln = { key: 1 }, un = { class: "flex gap-1 flex-wrap justify-end" }, dn = {
550
+ key: 0,
551
+ class: "text-xs px-2 py-0.5 rounded border text-success border-success/40 bg-success/10"
552
+ }, fn = {
553
+ key: 1,
554
+ class: "text-xs px-2 py-0.5 rounded border text-info border-info/40 bg-info/10"
555
+ }, pn = {
556
+ key: 2,
557
+ class: "text-xs px-2 py-0.5 rounded border text-error border-error/40 bg-error/10"
558
+ }, mn = { class: "text-xs text-base-content/40" }, hn = {
559
+ key: 0,
560
+ class: "border-t border-base-300 bg-base-100 p-4 space-y-4"
561
+ }, gn = { class: "grid grid-cols-1 md:grid-cols-3 gap-4" }, _n = { class: "text-xs bg-base-200 rounded p-3 overflow-x-auto max-h-96" }, vn = { class: "text-xs bg-base-200 rounded p-3 overflow-x-auto max-h-96" }, yn = {
562
+ key: 3,
563
+ class: "rounded-lg border border-base-300 bg-base-200 p-4 text-sm text-base-content/60"
564
+ }, bn = /*@__PURE__*/ E({
565
+ __name: "AnnotationDefinitionsStatusView",
566
+ setup(e) {
567
+ let t = j(0), n = j(/* @__PURE__ */ new Set()), r = y(() => (t.value, Ot())), i = y(() => r.value ? r.value.error ? "bg-error" : r.value.loadErrors.length || r.value.loading ? "bg-warning" : "bg-success" : "bg-base-300"), a = y(() => r.value ? r.value.error || r.value.loadErrors.length ? "border-error/40 bg-error/5" : r.value.loading ? "border-warning/40 bg-warning/5" : "border-success/40 bg-success/5" : "border-base-300 bg-base-200/50"), o = (e) => {
568
+ let t = new Set(n.value);
569
+ t.has(e) ? t.delete(e) : t.add(e), n.value = t;
570
+ }, s = (e) => {
571
+ let t = r.value?.rawJsonMap[e];
572
+ return t ? JSON.stringify(t, null, 2) : "(not available)";
573
+ }, c = (e) => {
574
+ let { resource: t, style: n, ...r } = e;
575
+ return JSON.stringify(r, null, 2);
576
+ }, l = () => {
577
+ t.value++;
578
+ };
579
+ return (e, t) => (A(), S("div", zt, [C("div", { class: D(["rounded-lg border p-4 flex flex-col sm:flex-row sm:items-center gap-3", a.value]) }, [C("div", Bt, [
580
+ C("span", { class: D(["inline-block w-3 h-3 rounded-full shrink-0", i.value]) }, null, 2),
581
+ t[0] ||= C("span", { class: "font-semibold text-base-content" }, "Annotation definitions", -1),
582
+ r.value ? (A(), S("span", Vt, P(r.value.definitions.length) + " loaded ", 1)) : x("", !0),
583
+ r.value?.loadErrors.length ? (A(), S("span", Ht, P(r.value.loadErrors.length) + " error" + P(r.value.loadErrors.length === 1 ? "" : "s"), 1)) : x("", !0),
584
+ r.value?.loading ? (A(), S("span", Ut, "Loading…")) : x("", !0)
585
+ ]), r.value ? (A(), S("button", {
586
+ key: 0,
587
+ class: "rounded border border-base-300 p-1 hover:bg-base-200 transition-colors",
588
+ title: "Refresh",
589
+ onClick: l
590
+ }, [...t[1] ||= [C("svg", {
591
+ class: "w-4 h-4",
592
+ fill: "none",
593
+ stroke: "currentColor",
594
+ viewBox: "0 0 24 24"
595
+ }, [C("path", {
596
+ "stroke-linecap": "round",
597
+ "stroke-linejoin": "round",
598
+ "stroke-width": "2",
599
+ d: "M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"
600
+ })], -1)]])) : x("", !0)], 2), r.value ? (A(), S(v, { key: 1 }, [
601
+ r.value.error ? (A(), S("div", Gt, P(r.value.error.message), 1)) : x("", !0),
602
+ r.value.loadErrors.length ? (A(), S("section", Kt, [t[3] ||= C("h2", { class: "text-lg font-semibold mb-2 text-error" }, " Failed to load ", -1), C("ul", qt, [(A(!0), S(v, null, M(r.value.loadErrors, (e, n) => (A(), S("li", {
603
+ key: n,
604
+ class: "rounded-lg border border-error/40 bg-error/5 p-4 space-y-2"
605
+ }, [
606
+ C("div", Jt, [C("span", Yt, P(e.name ?? e.id ?? "Unknown"), 1), e.id ? (A(), S("span", Xt, P(e.id), 1)) : x("", !0)]),
607
+ C("p", Zt, P(e.error), 1),
608
+ e.raw ? (A(), S("details", Qt, [t[2] ||= C("summary", { class: "text-xs text-base-content/60 cursor-pointer hover:text-base-content" }, " Raw JSON ", -1), C("pre", $t, P(JSON.stringify(e.raw, null, 2)), 1)])) : x("", !0)
609
+ ]))), 128))])])) : x("", !0),
610
+ r.value.definitions.length ? (A(), S("section", en, [t[8] ||= C("h2", { class: "text-lg font-semibold mb-2 text-base-content" }, " Definitions ", -1), C("ul", tn, [(A(!0), S(v, null, M(r.value.definitions, (e) => (A(), S("li", { key: e.id }, [C("button", {
611
+ class: "w-full flex items-start gap-3 p-3 text-left hover:bg-base-200 transition-colors",
612
+ onClick: (t) => o(e.id)
613
+ }, [
614
+ C("span", {
615
+ class: D(["inline-block w-3 h-3 rounded-full mt-1 shrink-0", e.annotation?.color ? "" : "bg-base-300"]),
616
+ style: O(e.annotation?.color ? { background: e.annotation.color } : {})
617
+ }, null, 6),
618
+ C("div", rn, [
619
+ C("div", an, P(e.name), 1),
620
+ C("div", on, P(e.id), 1),
621
+ C("div", sn, [
622
+ C("span", null, P(e.annotation.isRoot ? "Root" : "child"), 1),
623
+ e.allowedChildren.length ? (A(), S("span", cn, "↳ " + P(e.allowedChildren.length) + " children", 1)) : x("", !0),
624
+ e.allowedLinks.length ? (A(), S("span", ln, "↔ " + P(e.allowedLinks.length) + " links", 1)) : x("", !0)
625
+ ])
626
+ ]),
627
+ C("div", un, [
628
+ e.canCreate ? (A(), S("span", dn, "create")) : x("", !0),
629
+ e.canEdit ? (A(), S("span", fn, "edit")) : x("", !0),
630
+ e.canDelete ? (A(), S("span", pn, "delete")) : x("", !0),
631
+ C("span", mn, P(n.value.has(e.id) ? "▲" : "▼"), 1)
632
+ ])
633
+ ], 8, nn), n.value.has(e.id) ? (A(), S("div", hn, [C("div", gn, [
634
+ C("div", null, [t[4] ||= C("div", { class: "text-xs font-semibold text-base-content/60 uppercase tracking-wide mb-1" }, " Resource JSON (raw) ", -1), C("pre", _n, P(s(e.id)), 1)]),
635
+ C("div", null, [t[5] ||= C("div", { class: "text-xs font-semibold text-base-content/60 uppercase tracking-wide mb-1" }, " Compiled definition ", -1), C("pre", vn, P(c(e)), 1)]),
636
+ C("div", null, [
637
+ t[6] ||= C("div", { class: "font-bold mt-2" }, " Edit form ", -1),
638
+ T(F(ne), {
639
+ views: e.schemas,
640
+ data: {}
641
+ }, null, 8, ["views"]),
642
+ t[7] ||= C("div", { class: "font-bold mt-2" }, " Readonly form ", -1),
643
+ T(F(ne), {
644
+ views: e.schemas,
645
+ data: {},
646
+ readonly: !0
647
+ }, null, 8, ["views"])
648
+ ])
649
+ ])])) : x("", !0)]))), 128))])])) : x("", !0),
650
+ r.value.definitions.length === 0 && !r.value.loadErrors.length && !r.value.loading ? (A(), S("div", yn, " No definitions loaded. ")) : x("", !0)
651
+ ], 64)) : (A(), S("div", Wt, " No definitions loaded yet. Open a text in the editor first. "))]));
652
+ }
653
+ }), xn = /* @__PURE__ */ i({ default: () => Sn }), Sn = bn, Cn = (e) => {};
654
+ //#endregion
655
+ //#region ../../node_modules/.pnpm/@ghentcdh+ui@3.1.1_@playwright+test@1.63.0_@tiptap+pm@3.31.4_@tiptap+starter-kit@3.31.4_116ec0d791cbe8cbb9faefacd83bcfb3/node_modules/@ghentcdh/ui/index.mjs
656
+ function z(e) {
657
+ return E({ render() {
658
+ return se("svg", {
659
+ xmlns: "http://www.w3.org/2000/svg",
660
+ fill: "none",
661
+ viewBox: "0 0 24 24",
662
+ "stroke-width": "1.5",
663
+ stroke: "currentColor",
664
+ "aria-hidden": "true"
665
+ }, e.map((e) => se("path", {
666
+ "stroke-linecap": "round",
667
+ "stroke-linejoin": "round",
668
+ d: e
669
+ })));
670
+ } });
671
+ }
672
+ var wn = z(["M3.75 6.75h16.5M3.75 12h16.5m-16.5 5.25h16.5"]), Tn = z(["M3 4.5h14.25M3 9h9.75M3 13.5h9.75m4.5-4.5v12m0 0-3.75-3.75M17.25 21 21 17.25"]), En = z(["M3 4.5h14.25M3 9h9.75M3 13.5h5.25m5.25-.75L17.25 9m0 0L21 12.75M17.25 9v12"]), Dn = z(["m4.5 12.75 6 6 9-13.5"]), On = z(["m18.75 4.5-7.5 7.5 7.5 7.5m-6-15L5.25 12l7.5 7.5"]), kn = z(["m5.25 4.5 7.5 7.5-7.5 7.5m6-15 7.5 7.5-7.5 7.5"]), An = z(["m19.5 8.25-7.5 7.5-7.5-7.5"]), jn = z(["M15.75 19.5 8.25 12l7.5-7.5"]), Mn = z(["m8.25 4.5 7.5 7.5-7.5 7.5"]), Nn = z(["m4.5 15.75 7.5-7.5 7.5 7.5"]), Pn = z(["M19.5 14.25v-2.625a3.375 3.375 0 0 0-3.375-3.375h-1.5A1.125 1.125 0 0 1 13.5 7.125v-1.5a3.375 3.375 0 0 0-3.375-3.375H8.25m0 12.75h7.5m-7.5 3H12M10.5 2.25H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 0 0-9-9Z"]), Fn = z(["M2.036 12.322a1.012 1.012 0 0 1 0-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178Z", "M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"]), In = z(["M12 3c2.755 0 5.455.232 8.083.678.533.09.917.556.917 1.096v1.044a2.25 2.25 0 0 1-.659 1.591l-5.432 5.432a2.25 2.25 0 0 0-.659 1.591v2.927a2.25 2.25 0 0 1-1.244 2.013L9.75 21v-6.568a2.25 2.25 0 0 0-.659-1.591L3.659 7.409A2.25 2.25 0 0 1 3 5.818V4.774c0-.54.384-1.006.917-1.096A48.32 48.32 0 0 1 12 3Z"]), Ln = z(["m10.5 21 5.25-11.25L21 21m-9-3h7.5M3 5.621a48.474 48.474 0 0 1 6-.371m0 0c1.12 0 2.233.038 3.334.114M9 5.25V3m3.334 2.364C11.176 10.658 7.69 15.08 3 17.502m9.334-12.138c.896.061 1.785.147 2.666.257m-4.589 8.495a18.023 18.023 0 0 1-3.827-5.802"]), Rn = z(["M13.19 8.688a4.5 4.5 0 0 1 1.242 7.244l-4.5 4.5a4.5 4.5 0 0 1-6.364-6.364l1.757-1.757m13.35-.622 1.757-1.757a4.5 4.5 0 0 0-6.364-6.364l-4.5 4.5a4.5 4.5 0 0 0 1.242 7.244"]), zn = z(["m18.375 12.739-7.693 7.693a4.5 4.5 0 0 1-6.364-6.364l10.94-10.94A3 3 0 1 1 19.5 7.372L8.552 18.32m.009-.01-.01.01m5.699-9.941-7.81 7.81a1.5 1.5 0 0 0 2.112 2.13"]), Bn = z(["m16.862 4.487 1.687-1.688a1.875 1.875 0 1 1 2.652 2.652L10.582 16.07a4.5 4.5 0 0 1-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 0 1 1.13-1.897l8.932-8.931Zm0 0L19.5 7.125M18 14v4.75A2.25 2.25 0 0 1 15.75 21H5.25A2.25 2.25 0 0 1 3 18.75V8.25A2.25 2.25 0 0 1 5.25 6H10"]), Vn = z(["M12 9v6m3-3H9m12 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"]), Hn = z(["m14.74 9-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 0 1-2.244 2.077H8.084a2.25 2.25 0 0 1-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 0 0-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 0 1 3.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 0 0-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 0 0-7.5 0"]), Un = z(["M6 18 18 6M6 6l12 12"]), Wn = z(["M16.023 9.348h4.992v-.001M2.985 19.644v-4.992m0 0h4.992m-4.993 0 3.181 3.183a8.25 8.25 0 0 0 13.803-3.7M4.031 9.865a8.25 8.25 0 0 1 13.803-3.7l3.181 3.182m0-4.991v4.99"]), Gn = z(["M3 4a1 1 0 011-1h16a1 1 0 011 1v2a1 1 0 01-.293.707L13 13.414V19a1 1 0 01-.553.894l-4 2A1 1 0 017 21v-7.586L3.293 6.707A1 1 0 013 6V4z"]), B = /* @__PURE__ */ function(e) {
673
+ return e.Edit = "Edit", e.Delete = "Delete", e.BarsArrowDown = "BarsArrowDown", e.BarsArrowUp = "BarsArrowUp", e.Funnel = "Funnel", e.Close = "Close", e.Plus = "Plus", e.PaperClip = "PaperClip", e.Hamburger = "Hamburger", e.ChevronRight = "ChevronRight", e.ChevronLeft = "ChevronLeft", e.ChevronDown = "ChevronDown", e.ChevronUp = "ChevronUp", e.DblChevronLeft = "DblChevronLeft", e.DblChevronRight = "DblChevronRight", e.Language = "Language", e.Check = "Check", e.View = "View", e.Text = "Text", e.Link = "Link", e.Filter = "Filter", e.Sync = "Sync", e;
674
+ }({}), Kn = {
675
+ Edit: Bn,
676
+ Delete: Hn,
677
+ BarsArrowDown: Tn,
678
+ BarsArrowUp: En,
679
+ Funnel: In,
680
+ Close: Un,
681
+ Plus: Vn,
682
+ PaperClip: zn,
683
+ Hamburger: wn,
684
+ ChevronRight: Mn,
685
+ ChevronLeft: jn,
686
+ ChevronDown: An,
687
+ ChevronUp: Nn,
688
+ DblChevronLeft: On,
689
+ DblChevronRight: kn,
690
+ Language: Ln,
691
+ Check: Dn,
692
+ View: Fn,
693
+ Text: Pn,
694
+ Link: Rn,
695
+ Filter: Gn,
696
+ Sync: Wn
697
+ }, qn = /* @__PURE__ */ E({
698
+ __name: "icon",
699
+ props: {
700
+ icon: { type: [
701
+ String,
702
+ Object,
703
+ Function
704
+ ] },
705
+ size: { type: String }
706
+ },
707
+ setup(e) {
708
+ let t = e, n = y(() => t.icon ? typeof t.icon == "string" ? Kn[t.icon] : t.icon : null);
709
+ return (e, t) => n.value ? (A(), b(_e(n.value), {
710
+ key: 0,
711
+ "aria-hidden": "true",
712
+ class: D([{
713
+ "w-full h-full": !e.size,
714
+ "w-2 h-2": e.size === "xs",
715
+ "w-4 h-4": e.size === "sm",
716
+ "w-6 h-6": e.size === "lg",
717
+ "w-8 h-8": e.size === "xl"
718
+ }])
719
+ }, null, 8, ["class"])) : x("", !0);
720
+ }
721
+ }), Jn = {
722
+ modalTitle: {
723
+ type: String,
724
+ required: !0
725
+ },
726
+ buttonLabel: { type: String },
727
+ buttonSaveLabel: { type: String },
728
+ data: { default: void 0 },
729
+ open: {
730
+ type: Boolean,
731
+ default: !1
732
+ },
733
+ disableClose: {
734
+ type: Boolean,
735
+ default: !1
736
+ },
737
+ width: {
738
+ type: String,
739
+ default: "sm"
740
+ }
741
+ }, Yn = ["closeModal"], Xn = "a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex=\"-1\"])", Zn = (e) => Array.from(e.querySelectorAll(Xn)), Qn = ({ containerRef: e, isActive: t, onEscape: n, restoreFocus: r = !0 }) => {
742
+ let i = null, a = (t) => {
743
+ let r = e.value;
744
+ if (!r) return;
745
+ if (t.key === "Escape") {
746
+ n?.();
747
+ return;
748
+ }
749
+ if (t.key !== "Tab") return;
750
+ let i = Zn(r);
751
+ if (i.length === 0) return;
752
+ let a = i[0], o = i[i.length - 1];
753
+ t.shiftKey ? document.activeElement === a && (t.preventDefault(), o.focus()) : document.activeElement === o && (t.preventDefault(), a.focus());
754
+ }, o = () => {
755
+ let t = e.value;
756
+ if (!t) return;
757
+ i = document.activeElement, document.addEventListener("keydown", a);
758
+ let n = Zn(t);
759
+ n.length > 0 && n[0].focus();
760
+ }, s = () => {
761
+ document.removeEventListener("keydown", a), r && i && (i.focus(), i = null);
762
+ };
763
+ I(t, (e) => {
764
+ e ? o() : s();
765
+ }, { immediate: !0 }), me(() => {
766
+ s();
767
+ });
768
+ }, $n = {
769
+ xs: "max-w-xs w-[50VW]",
770
+ sm: "max-w-sm w-[50VW]",
771
+ lg: "max-w-2xl w-[80VW]",
772
+ xl: "max-w-[80VW] w-[80VW]"
773
+ }, er = {
774
+ xs: "btn-xs",
775
+ sm: "btn-sm",
776
+ lg: "btn-sm",
777
+ xl: "btn"
778
+ }, tr = { class: "flex justify-end gap-2 pt-2 mt-2 border-t border-gray-300 shrink-0" }, nr = /* @__PURE__ */ E({
779
+ __name: "modal",
780
+ props: Jn,
781
+ emits: Yn,
782
+ setup(e, { expose: t, emit: n }) {
783
+ let r = e, i = `modal_${crypto.randomUUID()}`, a = `${i}_title`, o = `${i}_content`, s = j(null), c = j(!1), l = n, u = () => {
784
+ s.value?.showModal(), c.value = !0;
785
+ }, d = () => {
786
+ s.value?.close(), c.value = !1, l("closeModal");
787
+ }, f = () => {
788
+ r.disableClose || d();
789
+ };
790
+ return Qn({
791
+ containerRef: s,
792
+ isActive: c,
793
+ onEscape: () => {
794
+ r.disableClose || d();
795
+ }
796
+ }), t({
797
+ closeModal: d,
798
+ openModal: u
799
+ }), I(() => r.open, () => {
800
+ r.open ? u() : d();
801
+ }), k(() => {
802
+ r.open && u();
803
+ }), (e, t) => (A(), S("dialog", {
804
+ ref_key: "dialogRef",
805
+ ref: s,
806
+ class: "modal",
807
+ role: "dialog",
808
+ "aria-modal": "true",
809
+ "aria-labelledby": a,
810
+ "aria-describedby": o,
811
+ onCancel: we(f, ["prevent"])
812
+ }, [C("div", { class: D(["modal-box bg-white min-h-0 max-h-[90vh] flex flex-col overflow-hidden", F($n)[e.width]]) }, [
813
+ e.disableClose ? x("", !0) : (A(), S("button", {
814
+ key: 0,
815
+ type: "button",
816
+ class: "btn btn-sm btn-circle btn-ghost absolute right-2 top-2",
817
+ "aria-label": "Close",
818
+ onClick: d
819
+ }, " ✕ ")),
820
+ e.$slots.title ? N(e.$slots, "title", { key: 1 }) : (A(), S("h3", {
821
+ key: 2,
822
+ id: a,
823
+ class: "font-bold shrink-0"
824
+ }, P(e.modalTitle), 1)),
825
+ C("div", {
826
+ id: o,
827
+ class: "pt-4 flex-1 min-h-0 flex flex-col"
828
+ }, [N(e.$slots, "content")]),
829
+ C("div", tr, [N(e.$slots, "actions")])
830
+ ], 2)], 544));
831
+ }
832
+ }), rr = /* @__PURE__ */ function(e) {
833
+ return e.button = "button", e.submit = "submit", e.reset = "reset", e;
834
+ }({}), ir = /* @__PURE__ */ function(e) {
835
+ return e.a = "a", e.button = "button", e;
836
+ }({}), ar = /* @__PURE__ */ function(e) {
837
+ return e.blank = "blank", e.primary = "primary", e.secondary = "secondary", e.error = "error", e.ghost = "ghost", e;
838
+ }({}), or = {
839
+ blank: "btn-ghost",
840
+ primary: "btn-primary",
841
+ secondary: "btn-soft btn-primary",
842
+ error: "btn-error",
843
+ ghost: "btn-ghost"
844
+ }, sr = {
845
+ href: { type: String },
846
+ disabled: {
847
+ type: Boolean,
848
+ default: !1
849
+ },
850
+ tooltip: { type: String },
851
+ as: {
852
+ type: String,
853
+ default: ir.button
854
+ },
855
+ icon: { type: [
856
+ String,
857
+ Object,
858
+ Function
859
+ ] },
860
+ type: {
861
+ type: String,
862
+ default: rr.button
863
+ },
864
+ outline: {
865
+ type: Boolean,
866
+ default: !1
867
+ },
868
+ color: {
869
+ type: String,
870
+ default: ar.primary
871
+ },
872
+ size: {
873
+ type: String,
874
+ default: "sm"
875
+ },
876
+ square: {
877
+ type: Boolean,
878
+ default: !1
879
+ },
880
+ noBorder: {
881
+ type: Boolean,
882
+ default: !1
883
+ }
884
+ }, cr = ["click"];
885
+ rr.button, ar.primary;
886
+ var lr = {
887
+ key: 1,
888
+ class: "whitespace-nowrap"
889
+ }, ur = /* @__PURE__ */ E({
890
+ __name: "btn",
891
+ props: sr,
892
+ emits: cr,
893
+ setup(e, { emit: t }) {
894
+ let n = e, r = t;
895
+ return (e, t) => (A(), b(_e(n.as), {
896
+ class: D([
897
+ "btn p-1 flex justify-center flex-nowrap",
898
+ F(or)[n.color],
899
+ F(er)[n.size],
900
+ {
901
+ "btn-outline": n.outline,
902
+ "btn-square": n.square,
903
+ tooltip: n.tooltip,
904
+ "border-0": n.noBorder
905
+ }
906
+ ]),
907
+ href: n.href,
908
+ type: n.type,
909
+ disabled: n.disabled,
910
+ "data-tip": n.tooltip,
911
+ onClick: t[0] ||= (e) => r("click")
912
+ }, {
913
+ default: L(() => [n.icon ? (A(), b(F(qn), {
914
+ key: 0,
915
+ icon: n.icon
916
+ }, null, 8, ["icon"])) : x("", !0), e.$slots.default ? (A(), S("span", lr, [N(e.$slots, "default")])) : x("", !0)]),
917
+ _: 3
918
+ }, 8, [
919
+ "class",
920
+ "href",
921
+ "type",
922
+ "disabled",
923
+ "data-tip"
924
+ ]));
925
+ }
926
+ }), dr = 5e3, fr = class e {
927
+ constructor() {
928
+ this.notifications = j([]), this.addNotification = (e, t = "info") => {
929
+ let n = {
930
+ id: crypto.randomUUID(),
931
+ duration: dr,
932
+ message: e,
933
+ type: t
934
+ };
935
+ this.notifications.value.push(n), this.removeNotificationAfterDuration(n);
936
+ }, this.removeNotificationAfterDuration = (e) => {
937
+ setTimeout(() => {
938
+ this.removeNotification(e.id);
939
+ }, e.duration);
940
+ }, this.removeNotification = (e) => {
941
+ this.notifications.value = this.notifications.value.filter((t) => t.id !== e);
942
+ };
943
+ }
944
+ static getInstance() {
945
+ return this.instance ||= new e(), this.instance;
946
+ }
947
+ static info(e) {
948
+ this.getInstance().addNotification(e, "info");
949
+ }
950
+ static success(e) {
951
+ this.getInstance().addNotification(e, "success");
952
+ }
953
+ static warning(e) {
954
+ this.getInstance().addNotification(e, "warning");
955
+ }
956
+ static error(e) {
957
+ this.getInstance().addNotification(e, "error");
958
+ }
959
+ static removeNotification(e) {
960
+ this.getInstance().removeNotification(e);
961
+ }
962
+ }, pr = [
963
+ "id",
964
+ "aria-label",
965
+ "value"
966
+ ], mr = /* @__PURE__ */ E({
967
+ __name: "MarkdownFallback",
968
+ props: /*@__PURE__*/ ue(n, {
969
+ modelValue: {},
970
+ modelModifiers: {}
971
+ }),
972
+ emits: /*@__PURE__*/ ue(t, ["update:modelValue"]),
973
+ setup(t, { emit: n }) {
974
+ let r = t, i = n, a = xe(t, "modelValue"), o = (e) => {
975
+ let t = e.target.value;
976
+ a.value = t, i("change", t);
977
+ };
978
+ return (t, n) => (A(), b(e, pe(oe(r)), {
979
+ default: L(() => [C("textarea", {
980
+ id: t.id,
981
+ "aria-label": t.id,
982
+ class: D([[t.minHeight, t.width], "textarea textarea-bordered w-full font-mono text-sm"]),
983
+ value: a.value ?? "",
984
+ onInput: o
985
+ }, null, 42, pr)]),
986
+ _: 1
987
+ }, 16));
988
+ }
989
+ }), hr = {
990
+ options: {
991
+ type: Array,
992
+ required: !1
993
+ },
994
+ isLoading: {
995
+ type: Boolean,
996
+ default: !1
997
+ },
998
+ query: {
999
+ type: String,
1000
+ default: void 0
1001
+ },
1002
+ isActive: {
1003
+ type: Function,
1004
+ default: (e) => !1
1005
+ },
1006
+ teleported: {
1007
+ type: Boolean,
1008
+ default: !1
1009
+ }
1010
+ }, gr = {
1011
+ ...r,
1012
+ options: {
1013
+ type: Array,
1014
+ required: !0
1015
+ },
1016
+ labelKey: {
1017
+ type: String,
1018
+ default: "label"
1019
+ },
1020
+ valueKey: {
1021
+ type: String,
1022
+ default: "value"
1023
+ },
1024
+ enableCreate: {
1025
+ type: Boolean,
1026
+ default: !1
1027
+ },
1028
+ clearable: {
1029
+ type: Boolean,
1030
+ default: !1
1031
+ },
1032
+ value: {
1033
+ type: null,
1034
+ default: void 0
1035
+ }
1036
+ };
1037
+ ({
1038
+ ...hr,
1039
+ ...gr
1040
+ }), {
1041
+ ...gr,
1042
+ ...hr
1043
+ }, { ...r }, { ...r }, { ...r }, { ...r }, ae({
1044
+ loader: () => import("./Markdown-DQZZDfN5-DI--37ZL.js"),
1045
+ errorComponent: mr,
1046
+ onError(e, t, n) {
1047
+ console.warn("[@ghentcdh/ui] Markdown editor could not load — install the TipTap peer dependencies (@tiptap/pm, @tiptap/starter-kit, @tiptap/vue-3, tiptap-markdown) to enable it. Falling back to a plain textarea.", e), n();
1048
+ }
1049
+ });
1050
+ var _r = {
1051
+ widthLeft: {
1052
+ type: Number,
1053
+ default: 200
1054
+ },
1055
+ widthRight: {
1056
+ type: Number,
1057
+ default: 200
1058
+ },
1059
+ initialLeftOpen: {
1060
+ type: Boolean,
1061
+ default: !0
1062
+ },
1063
+ initialRightOpen: {
1064
+ type: Boolean,
1065
+ default: !0
1066
+ },
1067
+ drawerColor: {
1068
+ type: String,
1069
+ default: "bg-base-200"
1070
+ }
1071
+ }, vr = { class: "flex h-full overflow-hidden gap-2" }, yr = {
1072
+ key: 0,
1073
+ id: "drawer-left",
1074
+ class: "min-h-0 relative flex-shrink-0 overflow-visible flex"
1075
+ }, br = ["aria-expanded", "aria-label"], xr = { class: "flex-1 overflow-y-auto bg-white" }, Sr = {
1076
+ key: 1,
1077
+ class: "min-h-0 relative flex-shrink-0 bg-white overflow-visible flex"
1078
+ }, Cr = ["aria-expanded", "aria-label"], wr = /* @__PURE__ */ E({
1079
+ __name: "drawer",
1080
+ props: _r,
1081
+ setup(e) {
1082
+ let t = e, n = Se(), r = y(() => !!n["left-drawer"]), i = y(() => !!n["right-drawer"]), a = j({
1083
+ left: t.initialLeftOpen,
1084
+ right: t.initialRightOpen
1085
+ }), o = (e) => {
1086
+ a.value[e] = !a.value[e];
1087
+ };
1088
+ return (e, t) => (A(), S("main", vr, [
1089
+ r.value ? (A(), S("aside", yr, [C("div", {
1090
+ id: "drawer-left-panel",
1091
+ style: O({ width: a.value.left ? e.widthLeft + "px" : "0px" }),
1092
+ class: D(["h-full overflow-hidden shadow-sm transition-[width] duration-300 ease-in-out", [e.drawerColor]])
1093
+ }, [C("div", {
1094
+ style: O({ width: e.widthLeft + "px" }),
1095
+ class: "h-full overflow-y-auto p-4"
1096
+ }, [N(e.$slots, "left-drawer")], 4)], 6), C("button", {
1097
+ "aria-expanded": a.value.left,
1098
+ "aria-controls": "drawer-left-panel",
1099
+ "aria-label": a.value.left ? "Collapse left panel" : "Expand left panel",
1100
+ class: "hover:bg-base-300 hover:text-base-content transition-colors cursor-pointer",
1101
+ onClick: t[0] ||= (e) => o("left")
1102
+ }, [T(F(qn), {
1103
+ size: "lg",
1104
+ icon: a.value.left ? F(B).ChevronLeft : F(B).ChevronRight
1105
+ }, null, 8, ["icon"])], 8, br)])) : x("", !0),
1106
+ C("div", xr, [N(e.$slots, "default")]),
1107
+ i.value ? (A(), S("aside", Sr, [C("button", {
1108
+ "aria-expanded": a.value.right,
1109
+ "aria-controls": "drawer-right-panel",
1110
+ "aria-label": a.value.right ? "Collapse right panel" : "Expand right panel",
1111
+ class: "hover:bg-base-300 hover:text-base-content transition-colors cursor-pointer",
1112
+ onClick: t[1] ||= (e) => o("right")
1113
+ }, [T(F(qn), {
1114
+ size: "lg",
1115
+ icon: a.value.right ? F(B).ChevronRight : F(B).ChevronLeft
1116
+ }, null, 8, ["icon"])], 8, Cr), C("div", {
1117
+ id: "drawer-right-panel",
1118
+ style: O({ width: a.value.right ? e.widthRight + "px" : "0px" }),
1119
+ class: D(["h-full overflow-hidden shadow-sm transition-[width] duration-300 ease-in-out", [e.drawerColor]])
1120
+ }, [C("div", {
1121
+ style: O({ width: e.widthRight + "px" }),
1122
+ class: "h-full overflow-y-auto p-4"
1123
+ }, [N(e.$slots, "right-drawer")], 4)], 6)])) : x("", !0)
1124
+ ]));
1125
+ }
1126
+ }), Tr = {
1127
+ key: 0,
1128
+ role: "status",
1129
+ "aria-live": "polite",
1130
+ class: "flex items-center justify-center h-20"
1131
+ }, Er = /* @__PURE__ */ E({
1132
+ __name: "loading",
1133
+ props: { loading: { type: Boolean } },
1134
+ setup(e) {
1135
+ return (t, n) => e.loading ? (A(), S("div", Tr, [...n[0] ||= [C("span", {
1136
+ "aria-hidden": "true",
1137
+ class: "loading loading-bars loading-md text-primary"
1138
+ }, null, -1), C("span", { class: "sr-only" }, "Loading...", -1)]])) : x("", !0);
1139
+ }
1140
+ }), Dr = {
1141
+ title: {
1142
+ type: String,
1143
+ required: !0
1144
+ },
1145
+ opened: {
1146
+ type: Boolean,
1147
+ default: !0
1148
+ },
1149
+ heightFull: {
1150
+ type: Boolean,
1151
+ default: !1
1152
+ },
1153
+ scrollable: {
1154
+ type: Boolean,
1155
+ default: !1
1156
+ },
1157
+ disabled: {
1158
+ type: Boolean,
1159
+ default: !1
1160
+ },
1161
+ actions: {
1162
+ type: Array,
1163
+ default: () => []
1164
+ }
1165
+ }, Or = ["checked", "aria-label"], kr = { class: "collapse-title text-gray-500 text-xs font-medium" }, Ar = { class: "flex items-center justify-between" }, jr = {
1166
+ key: 0,
1167
+ class: "list bg-base-100"
1168
+ }, Mr = {
1169
+ key: 1,
1170
+ class: "shrink-0 pt-2"
1171
+ }, Nr = /* @__PURE__ */ E({
1172
+ __name: "Collapse",
1173
+ props: Dr,
1174
+ setup(e) {
1175
+ let t = Se(), n = e, r = j(n.opened), i = j(n.opened || n.disabled);
1176
+ return (e, a) => (A(), S("div", { class: D(["collapse collapse-arrow bg-white border border-gray-300", [
1177
+ e.scrollable ? "flex-1 min-h-0 !grid-rows-[auto_1fr] overflow-hidden" : "",
1178
+ e.heightFull ? "h-full" : "",
1179
+ e.disabled ? "collapse-open" : "",
1180
+ i.value && !e.scrollable ? "overflow-visible" : ""
1181
+ ]]) }, [
1182
+ e.disabled ? x("", !0) : (A(), S("input", {
1183
+ key: 0,
1184
+ type: "checkbox",
1185
+ checked: r.value,
1186
+ tabindex: "-1",
1187
+ "aria-label": "Toggle " + e.title,
1188
+ onChange: a[0] ||= (e) => i.value = e.target.checked
1189
+ }, null, 40, Or)),
1190
+ C("div", kr, [C("div", Ar, [C("span", null, P(e.title), 1), n.actions.length > 0 ? (A(), S("div", {
1191
+ key: 0,
1192
+ class: "relative z-10 flex gap-1 overflow-y-auto",
1193
+ onClick: a[1] ||= we(() => {}, ["stop"])
1194
+ }, [(A(!0), S(v, null, M(n.actions, (e, t) => (A(), b(F(ur), {
1195
+ key: t,
1196
+ color: F(ar).blank,
1197
+ size: "xs",
1198
+ icon: e.icon,
1199
+ tooltip: e.tooltip,
1200
+ disabled: e.disabled,
1201
+ onClick: e.onClick
1202
+ }, {
1203
+ default: L(() => [w(P(e.label), 1)]),
1204
+ _: 2
1205
+ }, 1032, [
1206
+ "color",
1207
+ "icon",
1208
+ "tooltip",
1209
+ "disabled",
1210
+ "onClick"
1211
+ ]))), 128))])) : x("", !0)])]),
1212
+ C("div", { class: D(["collapse-content", [e.scrollable ? "!flex !flex-col min-h-0" : "", F(t).list ? "p-0" : ""]]) }, [
1213
+ C("div", { class: D(e.scrollable ? "flex-1 min-h-0 overflow-y-auto" : "") }, [N(e.$slots, "default")], 2),
1214
+ F(t).list ? (A(), S("ul", jr, [N(e.$slots, "list")])) : x("", !0),
1215
+ F(t).footer ? (A(), S("div", Mr, [N(e.$slots, "footer")])) : x("", !0)
1216
+ ], 2)
1217
+ ], 2));
1218
+ }
1219
+ }), Pr = { class: "text-gray-800" }, Fr = /* @__PURE__ */ E({
1220
+ __name: "alert",
1221
+ props: {
1222
+ message: {},
1223
+ type: {}
1224
+ },
1225
+ setup(e) {
1226
+ let t = {
1227
+ success: "alert-success",
1228
+ error: "alert-error",
1229
+ warning: "alert-warning",
1230
+ info: "alert-info"
1231
+ };
1232
+ return (n, r) => (A(), S("div", {
1233
+ role: "alert",
1234
+ class: D(`alert alert-soft ${t[e.type]} `)
1235
+ }, [C("span", Pr, P(e.message), 1), N(n.$slots, "default")], 2));
1236
+ }
1237
+ }), Ir = {
1238
+ title: {
1239
+ type: String,
1240
+ required: !0
1241
+ },
1242
+ items: {
1243
+ type: Array,
1244
+ required: !0
1245
+ },
1246
+ modelValue: {
1247
+ type: Array,
1248
+ default: () => []
1249
+ },
1250
+ labelKey: {
1251
+ type: String,
1252
+ default: "label"
1253
+ },
1254
+ valueKey: {
1255
+ type: String,
1256
+ default: "id"
1257
+ },
1258
+ colorKey: {
1259
+ type: String,
1260
+ default: void 0
1261
+ },
1262
+ countKey: {
1263
+ type: String,
1264
+ default: "count"
1265
+ },
1266
+ counts: {
1267
+ type: Object,
1268
+ default: void 0
1269
+ },
1270
+ opened: {
1271
+ type: Boolean,
1272
+ default: !0
1273
+ }
1274
+ }, Lr = ["update:modelValue"], Rr = (e, t, n, r) => {
1275
+ let i = y(() => e.value.map((e) => e[n.value]));
1276
+ return {
1277
+ isSelected: (e) => t.value.includes(e),
1278
+ selectedLabel: y(() => {
1279
+ let e = t.value.length;
1280
+ return e === 0 ? "None" : e === i.value.length ? "All" : `${e}`;
1281
+ }),
1282
+ selectAll: () => r("update:modelValue", [...i.value]),
1283
+ selectNone: () => r("update:modelValue", []),
1284
+ toggleItem: (e, n) => {
1285
+ n ? r("update:modelValue", [...t.value, e]) : r("update:modelValue", t.value.filter((t) => t !== e));
1286
+ }
1287
+ };
1288
+ }, zr = { class: "flex items-center justify-between mb-2" }, Br = { class: "text-xs text-base-content/50" }, Vr = { class: "flex gap-1" }, Hr = { class: "flex flex-col gap-1" }, Ur = ["checked", "onChange"], Wr = { class: "text-sm flex-1 select-none" }, Gr = {
1289
+ key: 1,
1290
+ class: "badge badge-sm badge-ghost"
1291
+ }, Kr = /* @__PURE__ */ E({
1292
+ __name: "filter",
1293
+ props: Ir,
1294
+ emits: Lr,
1295
+ setup(e, { emit: t }) {
1296
+ let n = e, r = t, i = y(() => n.items ?? []), { isSelected: a, selectedLabel: o, selectAll: s, selectNone: c, toggleItem: l } = Rr(i, be(n, "modelValue"), be(n, "valueKey"), r);
1297
+ return (e, t) => (A(), b(F(Nr), {
1298
+ title: e.title,
1299
+ opened: e.opened
1300
+ }, {
1301
+ default: L(() => [C("div", zr, [C("span", Br, P(F(o)) + " of " + P(i.value.length) + " items ", 1), C("div", Vr, [C("button", {
1302
+ class: "btn btn-ghost btn-xs",
1303
+ type: "button",
1304
+ tabindex: "-1",
1305
+ onClick: t[0] ||= (...e) => F(s) && F(s)(...e)
1306
+ }, " All "), C("button", {
1307
+ class: "btn btn-ghost btn-xs",
1308
+ type: "button",
1309
+ tabindex: "-1",
1310
+ onClick: t[1] ||= (...e) => F(c) && F(c)(...e)
1311
+ }, " None ")])]), C("div", Hr, [(A(!0), S(v, null, M(i.value, (t) => (A(), S("label", {
1312
+ key: t[e.valueKey],
1313
+ class: D(["flex items-center gap-3 px-2 py-1.5 rounded-lg cursor-pointer transition-colors hover:bg-base-200", { "bg-base-200/60": F(a)(t[e.valueKey]) }])
1314
+ }, [
1315
+ C("input", {
1316
+ type: "checkbox",
1317
+ class: "checkbox checkbox-sm",
1318
+ checked: F(a)(t[e.valueKey]),
1319
+ onChange: (n) => F(l)(t[e.valueKey], n.target.checked)
1320
+ }, null, 40, Ur),
1321
+ e.colorKey && t[e.colorKey] ? (A(), S("span", {
1322
+ key: 0,
1323
+ class: "w-3 h-3 rounded-full shrink-0 ring-1 ring-black/10",
1324
+ style: O({ backgroundColor: t[e.colorKey] })
1325
+ }, null, 4)) : x("", !0),
1326
+ C("span", Wr, P(t[e.labelKey]), 1),
1327
+ t[e.countKey] > 0 ? (A(), S("span", Gr, P(t[e.countKey]), 1)) : x("", !0)
1328
+ ], 2))), 128))])]),
1329
+ _: 1
1330
+ }, 8, ["title", "opened"]));
1331
+ }
1332
+ }), qr = {
1333
+ modalView: {
1334
+ type: Boolean,
1335
+ required: !1,
1336
+ default: !0
1337
+ },
1338
+ textAdapter: {
1339
+ type: Function,
1340
+ required: !1
1341
+ },
1342
+ annotationTransformer: {
1343
+ type: Object,
1344
+ required: !0,
1345
+ default: new mt()
1346
+ },
1347
+ sources: {
1348
+ type: Array,
1349
+ required: !0
1350
+ },
1351
+ annotations: {
1352
+ type: Array,
1353
+ required: !0
1354
+ },
1355
+ cols: {
1356
+ type: Number,
1357
+ required: !1,
1358
+ default: 2
1359
+ },
1360
+ layout: {
1361
+ type: Object,
1362
+ required: !1,
1363
+ default: void 0
1364
+ },
1365
+ annotationDefinitions: {
1366
+ type: Array,
1367
+ required: !0
1368
+ },
1369
+ selectedAnnotationId: {
1370
+ type: [String, Number],
1371
+ required: !1,
1372
+ default: void 0
1373
+ },
1374
+ selectedAnnotationAction: {
1375
+ type: String,
1376
+ required: !1,
1377
+ default: void 0
1378
+ },
1379
+ readonly: {
1380
+ type: Boolean,
1381
+ required: !1,
1382
+ default: !1
1383
+ }
1384
+ }, Jr = {
1385
+ "update:annotation": (e) => Promise,
1386
+ "delete:annotation": (e) => Promise,
1387
+ "create:annotation": (e) => Promise,
1388
+ "create:annotation:events": (e) => !0,
1389
+ "select:annotation": (e, t) => !0
1390
+ }, V = [];
1391
+ for (let e = 0; e < 256; ++e) V.push((e + 256).toString(16).slice(1));
1392
+ function Yr(e, t = 0) {
1393
+ return (V[e[t + 0]] + V[e[t + 1]] + V[e[t + 2]] + V[e[t + 3]] + "-" + V[e[t + 4]] + V[e[t + 5]] + "-" + V[e[t + 6]] + V[e[t + 7]] + "-" + V[e[t + 8]] + V[e[t + 9]] + "-" + V[e[t + 10]] + V[e[t + 11]] + V[e[t + 12]] + V[e[t + 13]] + V[e[t + 14]] + V[e[t + 15]]).toLowerCase();
1394
+ }
1395
+ //#endregion
1396
+ //#region ../../node_modules/.pnpm/uuid@14.0.2/node_modules/uuid/dist/rng.js
1397
+ var Xr = /* @__PURE__ */ new Uint8Array(16);
1398
+ function Zr() {
1399
+ return crypto.getRandomValues(Xr);
1400
+ }
1401
+ //#endregion
1402
+ //#region ../../node_modules/.pnpm/uuid@14.0.2/node_modules/uuid/dist/v4.js
1403
+ function Qr(e, t, n) {
1404
+ return !t && !e && crypto.randomUUID ? crypto.randomUUID() : $r(e, t, n);
1405
+ }
1406
+ function $r(e, t, n) {
1407
+ e ||= {};
1408
+ let r = e.random ?? e.rng?.() ?? Zr();
1409
+ if (r.length < 16) throw Error("Random bytes length must be >= 16");
1410
+ if (r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, t) {
1411
+ if (n ||= 0, n < 0 || n + 16 > t.length) throw RangeError(`UUID byte range ${n}:${n + 15} is out of buffer bounds`);
1412
+ for (let e = 0; e < 16; ++e) t[n + e] = r[e];
1413
+ return t;
1414
+ }
1415
+ return Yr(r);
1416
+ }
1417
+ //#endregion
1418
+ //#region ../annotation-editor/src/lib/components/SourceEdit.properties.ts
1419
+ var ei = { source: {
1420
+ type: Object,
1421
+ required: !0
1422
+ } }, ti = { actions: {
1423
+ type: Array,
1424
+ required: !0
1425
+ } }, ni = { class: "flex gap-1 py-1" }, ri = {
1426
+ key: 0,
1427
+ class: "dropdown"
1428
+ }, ii = ["data-tip"], ai = {
1429
+ tabindex: "0",
1430
+ class: "dropdown-content menu bg-base-100 rounded-box z-1 w-52 p-2 shadow-sm z-50"
1431
+ }, oi = ["onClick"], si = ["data-tip"], ci = ["disabled", "onClick"], li = /* @__PURE__ */ E({
1432
+ __name: "navbar",
1433
+ props: ti,
1434
+ setup(e) {
1435
+ let t = (e) => {
1436
+ e.disabled || e.action?.();
1437
+ }, n = (e) => {
1438
+ t(e), document.activeElement?.blur();
1439
+ };
1440
+ return (e, r) => (A(), S("div", ni, [(A(!0), S(v, null, M(e.actions, (e) => (A(), S(v, { key: e.label }, [e.children?.length ? (A(), S("div", ri, [C("div", {
1441
+ tabindex: "0",
1442
+ role: "button",
1443
+ class: D(["btn btn-sm btn-ghost tooltip tooltip-bottom", { "btn-disabled": e.disabled }]),
1444
+ "data-tip": e.label
1445
+ }, [T(F(qn), {
1446
+ icon: e.icon,
1447
+ size: "sm"
1448
+ }, null, 8, ["icon"])], 10, ii), C("ul", ai, [(A(!0), S(v, null, M(e.children, (t) => (A(), S("li", {
1449
+ key: t.label,
1450
+ class: D({ "btn-disabled": e.disabled })
1451
+ }, [C("a", { onClick: (e) => n(t) }, P(t.label), 9, oi)], 2))), 128))])])) : (A(), S("div", {
1452
+ key: 1,
1453
+ class: "tooltip tooltip-bottom",
1454
+ "data-tip": e.label
1455
+ }, [C("button", {
1456
+ class: D(["btn btn-sm btn-ghost", { "btn-disabled": e.disabled }]),
1457
+ disabled: e.disabled,
1458
+ onClick: (n) => t(e)
1459
+ }, [T(F(qn), {
1460
+ icon: e.icon,
1461
+ size: "sm"
1462
+ }, null, 8, ["icon"])], 10, ci)], 8, si))], 64))), 128))]));
1463
+ }
1464
+ }), ui = { disabled: {
1465
+ type: Boolean,
1466
+ required: !1,
1467
+ default: !1
1468
+ } }, di = { createAnnotation: (e) => !0 }, fi = (e, t, n, r) => {
1469
+ n.disableEdits || (n.disableEdits = !0, n.editorState = "create", t.modal.show("edit-annotation", {
1470
+ source: e.source,
1471
+ annotation: {
1472
+ definitionUri: e.definitionUri,
1473
+ parentAnnotation: e.parentAnnotation,
1474
+ selectors: []
1475
+ }
1476
+ }).then((e) => {
1477
+ n.show(), e?.annotation && r("create:annotation", e.annotation);
1478
+ }));
1479
+ }, pi = (e, t, n, r) => {
1480
+ if (n.disableEdits) return;
1481
+ n.disableEdits = !0, n.editorState = "edit", r("select:annotation", e.annotation, "edit");
1482
+ let i = e.definition.annotation.type === "link";
1483
+ t.modal.show(i ? "link-annotation" : "edit-annotation", {
1484
+ source: e.source,
1485
+ annotation: e.annotation,
1486
+ definitionUrl: e.definition.id
1487
+ }).then((e) => {
1488
+ n.show(), r("select:annotation", n.selectedAnnotation, "show"), e?.annotation && r("update:annotation", e.annotation);
1489
+ });
1490
+ }, mi = (e, t, n, r) => {
1491
+ let { annotation: i } = e, a = e.definition.resource;
1492
+ t.modal.show("confirm", {
1493
+ title: "Delete",
1494
+ message: "Are you sure to delete this annotation?"
1495
+ }).then((e) => {
1496
+ e?.confirmed && a.delete(i).then(() => {
1497
+ fr.success("Successfully deleted annotation"), n.selectedAnnotation?.id === i.id && (n.selectedAnnotation = null, n.editorState = null, n.disableEdits = !1, n.reset()), r("delete:annotation", i);
1498
+ }).catch((e) => {
1499
+ console.error("Something went wrong while deleting annotation"), console.error(e), fr.error("Something went wrong while deleting annotation");
1500
+ });
1501
+ });
1502
+ }, hi = (e, t, n) => {
1503
+ if (!n.selectedAnnotation) {
1504
+ console.warn("No annotation selected, linking not possible");
1505
+ return;
1506
+ }
1507
+ let r = `${e.link.label} of annotation in progress, select target annotation`;
1508
+ n.editorState = "link", n.disableEdits = !0, n.info = {
1509
+ message: r,
1510
+ short: e.link.label
1511
+ }, t.modal.getModal("link-annotation").state.startLink(e.link.key), t.modal.show("toast", {
1512
+ toastMessage: r,
1513
+ action: {
1514
+ label: "close",
1515
+ onClick: () => {
1516
+ n.show();
1517
+ }
1518
+ }
1519
+ });
1520
+ }, gi = (e, t, n, r) => {
1521
+ if (!n.selectedAnnotation) {
1522
+ console.warn("No annotation selected, linking not possible"), n.reset();
1523
+ return;
1524
+ }
1525
+ let i = e?.annotation;
1526
+ if (!i) {
1527
+ console.warn("No target annotation selected, linking not possible");
1528
+ return;
1529
+ }
1530
+ t.modal.close("toast", void 0);
1531
+ let a = n.selectedAnnotation;
1532
+ t.modal.show("link-annotation", {
1533
+ sourceAnnotation: a,
1534
+ targetAnnotation: i,
1535
+ annotation: {
1536
+ definitionUri: e.definitionUri,
1537
+ links: [{ uri: a.id }, { uri: i.id }]
1538
+ }
1539
+ }).then((e) => {
1540
+ n.show(), e.annotation && r("create:annotation", e.annotation);
1541
+ });
1542
+ }, _i = (e, t, n, r, i) => {
1543
+ if (n.editorState === "link") {
1544
+ gi(e, t, n, r);
1545
+ return;
1546
+ }
1547
+ if (!n.disableEdits) {
1548
+ if (!e || !e.annotation) {
1549
+ t.modal.close("info-card"), n.disableEdits = !1, n.editorState = null, r("select:annotation", null, null);
1550
+ return;
1551
+ }
1552
+ e.containerRef = i, t.modal.show("info-card", e), n.selectedAnnotation = e.annotation, n.editorState = "show", n.disableEdits = !1, r("select:annotation", e.annotation, "show");
1553
+ }
1554
+ }, vi = (e, t, n, r) => (i, a) => {
1555
+ switch (i) {
1556
+ case "select": return _i(a, e, t, n, r.value);
1557
+ case "edit": return pi(a, e, t, n);
1558
+ case "create": return fi(a, e, t, n);
1559
+ case "delete": return mi(a, e, t, n);
1560
+ case "link": return hi(a, e, t);
1561
+ default: console.warn(`Unknown annotation event: ${i}`);
1562
+ }
1563
+ }, yi = class {
1564
+ constructor() {
1565
+ this.data = j(null), this.isVisible = j(!1), this._resolve = null, this.show = this.show.bind(this), this.close = this.close.bind(this);
1566
+ }
1567
+ show(e) {
1568
+ return this._show(e);
1569
+ }
1570
+ _show(e) {
1571
+ return new Promise((t) => {
1572
+ this._resolve = t, this.data.value = e, this.isVisible.value = !0;
1573
+ });
1574
+ }
1575
+ close(e) {
1576
+ this.isVisible.value = !1, this._resolve?.(e), this._resolve = null;
1577
+ }
1578
+ }, bi = class extends yi {}, xi = () => new bi(), Si = {
1579
+ toastMessage: {
1580
+ type: String,
1581
+ required: !0
1582
+ },
1583
+ action: {
1584
+ type: Object,
1585
+ required: !1
1586
+ }
1587
+ }, Ci = { close: () => !0 }, wi = { class: "toast toast-center z-[3000]" }, Ti = {
1588
+ role: "alert",
1589
+ class: "alert border-primary bg-white"
1590
+ }, Ei = { class: "flex gap-2" }, Di = /* @__PURE__ */ E({
1591
+ __name: "Toast",
1592
+ props: Si,
1593
+ emits: Ci,
1594
+ setup(e, { emit: t }) {
1595
+ let n = e, r = t, i = () => {
1596
+ n.action?.onClick(), r("close");
1597
+ };
1598
+ return (e, t) => (A(), S("div", wi, [C("div", Ti, [C("span", null, P(e.toastMessage), 1), C("div", Ei, [e.action ? (A(), b(F(ur), {
1599
+ key: 0,
1600
+ color: F(ar).secondary,
1601
+ onClick: t[0] ||= (e) => i()
1602
+ }, {
1603
+ default: L(() => [w(P(e.action.label || "Close"), 1)]),
1604
+ _: 1
1605
+ }, 8, ["color"])) : x("", !0)])])]));
1606
+ }
1607
+ }), Oi = {
1608
+ position: {
1609
+ type: Object,
1610
+ required: !0
1611
+ },
1612
+ annotation: {
1613
+ type: Object,
1614
+ required: !0
1615
+ },
1616
+ source: {
1617
+ type: Object,
1618
+ required: !0
1619
+ }
1620
+ }, ki = { class: "flex flex-row items-center gap-2" }, Ai = { key: 0 }, ji = /* @__PURE__ */ E({
1621
+ __name: "Annotation-text",
1622
+ props: {
1623
+ annotation: {},
1624
+ maxCharacters: {},
1625
+ showSource: { type: Boolean }
1626
+ },
1627
+ setup(e) {
1628
+ let t = e, n = `annotation-text-${Qr()}`, r = `annotation-text-full-${Qr()}`, i = j(!1), a, o, { config: s, sources: c } = H(), l = y(() => {
1629
+ let e = Object.fromEntries(c.value.map((e) => [e.uri, e])), n = t.annotation.selectors.find((t) => e[t.uri]);
1630
+ return n ? {
1631
+ textPositionSelector: n,
1632
+ text: e[n.uri],
1633
+ end: t.maxCharacters ? Math.min(n.end, n.start + t.maxCharacters) : n.end
1634
+ } : (console.warn("Source not found for", t.annotation), null);
1635
+ });
1636
+ k(() => {
1637
+ let e = l.value;
1638
+ if (!e) {
1639
+ i.value = !1;
1640
+ return;
1641
+ }
1642
+ let { textPositionSelector: t, text: r, end: o } = e;
1643
+ i.value = t.end > o, a = s.createAnnotatedText(n, r).annotatedText.setTextAdapterParams({ limit: {
1644
+ start: t.start,
1645
+ end: o,
1646
+ ignoreLines: !0
1647
+ } });
1648
+ }), I(() => l.value, () => {
1649
+ p();
1650
+ let e = l.value;
1651
+ if (!e) {
1652
+ a?.destroy();
1653
+ return;
1654
+ }
1655
+ let { textPositionSelector: t, text: n, end: r } = e;
1656
+ i.value = t.end > r, a.setTextAdapterParams({ limit: {
1657
+ start: t.start,
1658
+ end: r,
1659
+ ignoreLines: !0
1660
+ } }).setText(n.content.text);
1661
+ });
1662
+ let u = j(null), d = (e) => {
1663
+ i.value && (u.value || (u.value = {
1664
+ x: e.clientX,
1665
+ y: e.clientY
1666
+ }, window.setTimeout(() => f(), 100)));
1667
+ }, f = () => {
1668
+ let { textPositionSelector: e, text: t } = l.value;
1669
+ o = s.createAnnotatedText(r, t).annotatedText.setTextAdapterParams({ limit: {
1670
+ start: e.start,
1671
+ end: e.end,
1672
+ ignoreLines: !0
1673
+ } });
1674
+ }, p = () => {
1675
+ o?.destroy(), u.value = null;
1676
+ };
1677
+ return me(() => {
1678
+ a?.destroy(), o?.destroy();
1679
+ }), (t, a) => (A(), S("div", {
1680
+ class: "relative",
1681
+ onMouseenter: d,
1682
+ onMouseleave: p
1683
+ }, [(A(), b(_e(e.showSource ? F(Nr) : "div"), pe(oe(e.showSource ? { title: l.value?.text.content.label ?? "-" } : {})), {
1684
+ default: L(() => [C("div", ki, [C("div", {
1685
+ id: n,
1686
+ class: "flex-1"
1687
+ }), i.value ? (A(), S("div", Ai, " ... ")) : x("", !0)])]),
1688
+ _: 1
1689
+ }, 16)), u.value ? (A(), S("div", {
1690
+ key: 0,
1691
+ id: r,
1692
+ class: "absolute left-0 top-full z-[100] border border-1 border-gray-200 shadow-sm bg-white p-2"
1693
+ })) : x("", !0)], 32));
1694
+ }
1695
+ }), Mi = { class: "border border-gray-300 table table-zebra table-sm" }, Ni = { class: "max-w-[300px]" }, Pi = /* @__PURE__ */ E({
1696
+ __name: "LinksDetail",
1697
+ props: { annotation: {} },
1698
+ setup(e) {
1699
+ let t = e, { editorState: n, sendAnnotationEvent: r, findAnnotation: i, getDefinition: a } = H(), o = y(() => t.annotation.links.map((e) => {
1700
+ let n = i(e.uri), r = n.links.find((e) => e.uri !== t.annotation.id)?.uri, o = i(r);
1701
+ return {
1702
+ id: n.id,
1703
+ definition: a(n.definitionUri),
1704
+ annotation: n,
1705
+ relation: o
1706
+ };
1707
+ })), s = (e) => n.readonly ? [] : [e.definition.canEdit ? {
1708
+ icon: B.Edit,
1709
+ label: "Edit",
1710
+ disabled: n.disableEdits,
1711
+ action: () => {
1712
+ r("edit", {
1713
+ annotation: e.annotation,
1714
+ definition: e.definition
1715
+ });
1716
+ }
1717
+ } : null, e.definition.canDelete ? {
1718
+ icon: B.Delete,
1719
+ label: "Delete",
1720
+ disabled: n.disableEdits,
1721
+ action: () => {
1722
+ r("delete", {
1723
+ annotation: e.annotation,
1724
+ definition: e.definition
1725
+ });
1726
+ }
1727
+ } : null].filter(Boolean);
1728
+ return (e, t) => (A(), S("table", Mi, [C("tbody", null, [(A(!0), S(v, null, M(o.value, (e) => (A(), S("tr", { key: e.annotation.id }, [
1729
+ C("th", null, P(e.definition.label), 1),
1730
+ C("td", Ni, [T(ji, {
1731
+ annotation: e.relation,
1732
+ "max-characters": 25
1733
+ }, null, 8, ["annotation"])]),
1734
+ C("td", null, [T(li, { actions: s(e) }, null, 8, ["actions"])])
1735
+ ]))), 128))])]));
1736
+ }
1737
+ }), Fi = /* @__PURE__ */ E({
1738
+ __name: "Metadata",
1739
+ props: {
1740
+ data: {},
1741
+ definition: {}
1742
+ },
1743
+ setup(e) {
1744
+ let t = e, n = y(() => t.definition?.schemas), r = y(() => n.value?.view?.ui?.elements?.length > 0);
1745
+ return (t, i) => r.value ? (A(), b(F(ne), {
1746
+ key: 0,
1747
+ id: "annotation-selection-modal",
1748
+ data: e.data,
1749
+ readonly: !0,
1750
+ views: n.value
1751
+ }, null, 8, ["data", "views"])) : x("", !0);
1752
+ }
1753
+ }), Ii = { class: "card-body p-2 overflow-y-auto" }, Li = { class: "flex items-center justify-between gap-2" }, Ri = /* @__PURE__ */ E({
1754
+ __name: "AnnotationInfoCard",
1755
+ props: Oi,
1756
+ setup(e) {
1757
+ let t = e, { editorState: n, sendAnnotationEvent: r, getDefinition: i } = H(), a = y(() => i(t.annotation.definitionUri)), o = y(() => a.value?.label), s = y(() => t.annotation?.metadata), c = j(), l = j(!0);
1758
+ I(() => t.annotation, () => {
1759
+ l.value = !0;
1760
+ }), k(() => document.addEventListener("click", d)), me(() => document.removeEventListener("click", d));
1761
+ let u = () => {
1762
+ l.value = !0;
1763
+ };
1764
+ function d(e) {
1765
+ if (!n.disableEdits) {
1766
+ if (l.value) {
1767
+ l.value = !1;
1768
+ return;
1769
+ }
1770
+ c.value && !c.value.contains(e.target) && f();
1771
+ }
1772
+ }
1773
+ let f = () => {
1774
+ r("select", null), n.reset();
1775
+ }, p = (e) => {
1776
+ u(), r("create", {
1777
+ definitionUri: e,
1778
+ source: t.source,
1779
+ parentAnnotation: t.annotation
1780
+ });
1781
+ }, m = (e) => {
1782
+ let t = e?.allowedChildren ?? [];
1783
+ if (t.length === 0) return null;
1784
+ if (t.length === 1) {
1785
+ let e = t[0];
1786
+ return {
1787
+ icon: B.Plus,
1788
+ disabled: n.disableEdits,
1789
+ label: `Add ${e.label}`,
1790
+ action: () => p(e.key)
1791
+ };
1792
+ }
1793
+ return {
1794
+ icon: B.Plus,
1795
+ label: "Add",
1796
+ disabled: n.disableEdits,
1797
+ children: t.map((e) => ({
1798
+ label: e.label,
1799
+ action: () => p(e.key)
1800
+ }))
1801
+ };
1802
+ }, h = (e) => e?.allowedLinks.map((t) => ({
1803
+ icon: t.icon ?? B.Link,
1804
+ label: `Add ${t.label}`,
1805
+ disabled: n.disableEdits,
1806
+ action: () => {
1807
+ r("link", {
1808
+ link: t,
1809
+ definition: e
1810
+ });
1811
+ }
1812
+ })), g = y(() => {
1813
+ let e = a.value;
1814
+ return e ? [
1815
+ m(e),
1816
+ e.canEdit ? {
1817
+ icon: B.Edit,
1818
+ label: "Edit",
1819
+ disabled: n.disableEdits,
1820
+ action: () => {
1821
+ u(), r("edit", {
1822
+ annotation: t.annotation,
1823
+ definition: a.value,
1824
+ source: t.source
1825
+ });
1826
+ }
1827
+ } : null,
1828
+ h(e),
1829
+ e.canDelete ? {
1830
+ icon: B.Delete,
1831
+ label: "Delete",
1832
+ disabled: n.disableEdits,
1833
+ action: () => {
1834
+ r("delete", {
1835
+ annotation: t.annotation,
1836
+ definition: a.value
1837
+ });
1838
+ }
1839
+ } : null
1840
+ ].filter((e) => !!e).flat() : [];
1841
+ });
1842
+ return (e, r) => (A(), S("div", {
1843
+ ref_key: "cardRef",
1844
+ ref: c,
1845
+ class: "card bg-base-100 shadow-xl absolute z-50",
1846
+ style: O({
1847
+ left: `${t.position.x}px`,
1848
+ top: `${t.position.y}px`,
1849
+ maxHeight: `calc(100vh - ${t.position.y}px - 16px)`,
1850
+ minHeight: "100px"
1851
+ })
1852
+ }, [C("div", Ii, [
1853
+ C("div", Li, [C("div", null, [r[0] ||= C("strong", null, "Type:", -1), w(" " + P(o.value), 1)])]),
1854
+ a.value ? (A(), b(Fi, {
1855
+ key: 0,
1856
+ data: s.value,
1857
+ definition: a.value
1858
+ }, null, 8, ["data", "definition"])) : x("", !0),
1859
+ T(Pi, { annotation: t.annotation }, null, 8, ["annotation"]),
1860
+ F(n).readonly ? x("", !0) : (A(), S(v, { key: 1 }, [F(n).info ? (A(), b(F(Fr), {
1861
+ key: 0,
1862
+ type: "info",
1863
+ message: "Action: " + F(n).info.short
1864
+ }, null, 8, ["message"])) : x("", !0), T(li, { actions: g.value }, null, 8, ["actions"])], 64))
1865
+ ])], 4));
1866
+ }
1867
+ }), zi = (e, t) => {
1868
+ let n = e.getBoundingClientRect();
1869
+ return {
1870
+ x: t.clientX - n.left + e.scrollLeft,
1871
+ y: t.clientY - n.top + e.scrollTop
1872
+ };
1873
+ }, Bi = (e, t) => {
1874
+ if (!e) return null;
1875
+ let n = document.querySelector(`g[data-annotation-uid="${t}"]:not([data-annotation-role="tag"])`);
1876
+ if (!n) return null;
1877
+ let r = n.getBoundingClientRect(), i = e.getBoundingClientRect();
1878
+ return {
1879
+ x: r.left - i.left + r.width / 2,
1880
+ y: r.top - i.top + r.height / 2
1881
+ };
1882
+ }, Vi = class extends yi {
1883
+ async show(e) {
1884
+ let t = e.position;
1885
+ if (!t) {
1886
+ let n = e.mouseEvent;
1887
+ if (!n) {
1888
+ console.warn("No position or mouse event provided");
1889
+ return;
1890
+ }
1891
+ t = zi(e.containerRef, n);
1892
+ }
1893
+ return super._show({
1894
+ annotation: e.annotation,
1895
+ source: e.source,
1896
+ position: t
1897
+ });
1898
+ }
1899
+ close(e) {
1900
+ return super.close(e);
1901
+ }
1902
+ }, Hi = () => new Vi(), Ui = {
1903
+ annotation: {
1904
+ type: Object,
1905
+ required: !1
1906
+ },
1907
+ source: {
1908
+ type: Object,
1909
+ required: !0
1910
+ }
1911
+ }, Wi = { close: (e) => !0 }, Gi = (e, t) => {
1912
+ let n = j({ status: "idle" }), r = t.resource, { editorState: i } = H(), a = async (t) => {
1913
+ let a = i.format(t, !e.id);
1914
+ return e.id ? r.save(e.id, a).then((e) => (n.value = { status: "saved" }, fr.success("Annotation saved successfully."), e)) : r.create(a).then((e) => (n.value = { status: "saved" }, fr.success("Annotation saved successfully."), e));
1915
+ };
1916
+ return {
1917
+ message: n,
1918
+ save: async (r, i) => {
1919
+ (e.id || t.canCreate) && (!e.id || t.canEdit) && a(r).then((e) => {
1920
+ i("close", { annotation: e });
1921
+ }).catch((e) => {
1922
+ console.error(e), n.value = { status: "error" };
1923
+ });
1924
+ }
1925
+ };
1926
+ }, Ki = (e, t) => {
1927
+ let { editorState: n } = H(), r = Gi(e, t), i = j(e.metadata ?? {}), a = j(!1);
1928
+ return {
1929
+ metadata: i,
1930
+ message: r.message,
1931
+ hasChanged: a,
1932
+ onChangeValue: ({ metadata: e, selector: t }) => {
1933
+ a.value = !0;
1934
+ let r = n.transformMetadata(e, t);
1935
+ return i.value = structuredClone(ye(r)), i.value;
1936
+ },
1937
+ save: r.save
1938
+ };
1939
+ }, qi = (e, t) => {
1940
+ let n = e.annotation?.getSelector?.(e.source.uri), { getDefinition: r } = H(), i = r(e.annotation.definitionUri), a = Ki(e.annotation, i);
1941
+ return {
1942
+ save: () => {
1943
+ let r = a.metadata.value;
1944
+ if (!n || !r) {
1945
+ a.message.value = {
1946
+ message: "Select annotation first",
1947
+ status: "error"
1948
+ };
1949
+ return;
1950
+ }
1951
+ a.message.value = { status: "saving" };
1952
+ let o = (e.annotation.id ? e.annotation : at.parse({
1953
+ id: "NEW_ANNOTATION",
1954
+ metadata: r,
1955
+ definitionUri: i.id,
1956
+ label: "",
1957
+ links: [],
1958
+ selectors: [n]
1959
+ })).clone({ metadata: r });
1960
+ return o.setSelector(n), a.save(o, t);
1961
+ },
1962
+ cancel: () => {
1963
+ t("close", null);
1964
+ },
1965
+ metadata: a.metadata,
1966
+ onChangeValue: ({ metadata: e }) => a.onChangeValue({
1967
+ metadata: e,
1968
+ selector: n
1969
+ }),
1970
+ message: a.message,
1971
+ updateSelector: (e) => (n = e, a.onChangeValue({
1972
+ metadata: a.metadata.value,
1973
+ selector: n
1974
+ })),
1975
+ definition: i
1976
+ };
1977
+ }, Ji = { class: "flex-grow before-scroll" }, Yi = /*#__PURE__*/ ((e, t) => {
1978
+ let n = e.__vccOpts || e;
1979
+ for (let [e, r] of t) n[e] = r;
1980
+ return n;
1981
+ })(/* @__PURE__ */ E({
1982
+ __name: "AnnotationEditModal",
1983
+ props: Ui,
1984
+ emits: Wi,
1985
+ setup(e, { emit: t }) {
1986
+ let n, r = e, { config: i, findAnnotation: a } = H(), { save: o, cancel: s, metadata: c, message: l, onChangeValue: u, updateSelector: d, definition: f } = qi(r, t), p = `edit-select-annotation-${Date.now()}--`, m = y(() => {
1987
+ let e = f.label, t = !r.annotation?.id;
1988
+ return {
1989
+ title: t ? `Create ${e}` : `Edit ${e}`,
1990
+ selectLabel: t ? `Select ${e} selection` : `Adjust ${e} selection`
1991
+ };
1992
+ }), h = (e) => u({ metadata: e }), g = () => {
1993
+ let { source: e, annotation: t } = r, n = {
1994
+ start: 0,
1995
+ end: e.content.text.length + 1
1996
+ };
1997
+ if (t.parentId) {
1998
+ let r = a(t.parentId).getSelector(e.uri);
1999
+ r && (n.start = r.start, n.end = r.end);
2000
+ }
2001
+ let i = {
2002
+ id: "NEW_ANNOTATION",
2003
+ metadata: c,
2004
+ selectors: [],
2005
+ ...t
2006
+ };
2007
+ return st(e.uri, n, {
2008
+ fullFlatText: r.source.content.text,
2009
+ startOffset: 0
2010
+ }, i);
2011
+ }, ee = () => {
2012
+ let e = g();
2013
+ n.annotatedText.setAnnotationAdapterParams({
2014
+ create: !1,
2015
+ edit: !0
2016
+ }).setAnnotations([e]), d(e.getSelector(r.source.uri));
2017
+ };
2018
+ return k(() => {
2019
+ if (!r.source) return;
2020
+ let e = r.annotation ? [r.annotation] : [];
2021
+ n = i.createAnnotatedText(p, r.source), n.annotatedText.setStyleParams({ styleFn: () => null }).setRenderParams({ renderFn: () => "highlight" }).setAnnotations(e).setAnnotationAdapterParams({
2022
+ edit: !0,
2023
+ create: !r.annotation?.id
2024
+ }).on("annotation-create--end", ({ mouseEvent: e, event: t, data: i }) => {
2025
+ d(i.annotation.getSelector(r.source.uri)), n.annotatedText.setAnnotationAdapterParams({
2026
+ create: !1,
2027
+ edit: !0
2028
+ });
2029
+ }).on("annotation-edit--end", ({ mouseEvent: e, event: t, data: n }) => {
2030
+ d(n.annotation.getSelector(r.source.uri));
2031
+ });
2032
+ let t = r.annotation.parent?.getSelector(r.source.uri);
2033
+ t && n.annotatedText.setTextAdapterParams({ limit: {
2034
+ ...t,
2035
+ ignoreLines: !0
2036
+ } });
2037
+ }), me(() => {
2038
+ n.annotatedText?.destroy();
2039
+ }), (e, t) => (A(), b(F(nr), {
2040
+ "modal-title": m.value.title,
2041
+ open: !0,
2042
+ "disable-close": !1,
2043
+ width: "xl",
2044
+ role: "dialog",
2045
+ onCloseModal: F(s)
2046
+ }, {
2047
+ content: L(() => [F(f) ? (A(), b(F(ne), {
2048
+ key: 0,
2049
+ layout: "rows",
2050
+ data: F(c),
2051
+ views: F(f).schemas,
2052
+ "format-before-save": h,
2053
+ "form-max-width": "w-max max-w-lg form-scroll min-w-[1/2]",
2054
+ "save-id": e.annotation?.id,
2055
+ onSave: F(o),
2056
+ onOnSaveSuccess: F(o),
2057
+ onCancel: F(s)
2058
+ }, {
2059
+ "content-before": L(() => [C("div", Ji, [T(F(Nr), {
2060
+ title: m.value.selectLabel,
2061
+ scrollable: !0
2062
+ }, {
2063
+ default: L(() => [C("div", { id: p }), T(F(ur), {
2064
+ outline: !0,
2065
+ class: "mt-2",
2066
+ onClick: ee
2067
+ }, {
2068
+ default: L(() => [...t[0] ||= [w(" Select all text ", -1)]]),
2069
+ _: 1
2070
+ })]),
2071
+ _: 1
2072
+ }, 8, ["title"])])]),
2073
+ "message-buttons": L(() => [T(F(re), pe(oe(F(l))), null, 16)]),
2074
+ _: 1
2075
+ }, 8, [
2076
+ "data",
2077
+ "views",
2078
+ "save-id",
2079
+ "onSave",
2080
+ "onOnSaveSuccess",
2081
+ "onCancel"
2082
+ ])) : x("", !0)]),
2083
+ _: 1
2084
+ }, 8, ["modal-title", "onCloseModal"]));
2085
+ }
2086
+ }), [["__scopeId", "data-v-a498c087"]]), Xi = class extends yi {}, Zi = () => new Xi(), Qi = class extends yi {
2087
+ constructor(...e) {
2088
+ super(...e), this._type = "";
2089
+ }
2090
+ startLink(e) {
2091
+ this._type = e;
2092
+ }
2093
+ show(e) {
2094
+ return super._show({
2095
+ ...e,
2096
+ definitionUri: this._type
2097
+ });
2098
+ }
2099
+ }, $i = () => new Qi(), ea = /* @__PURE__ */ E({
2100
+ __name: "ConfirmModal",
2101
+ props: {
2102
+ title: {
2103
+ type: String,
2104
+ required: !0
2105
+ },
2106
+ message: {
2107
+ type: String,
2108
+ required: !0
2109
+ },
2110
+ confirmLabel: {
2111
+ type: String,
2112
+ required: !1,
2113
+ default: "Ok"
2114
+ },
2115
+ cancelLabel: {
2116
+ type: String,
2117
+ required: !1,
2118
+ default: "Cancel"
2119
+ }
2120
+ },
2121
+ emits: { close: (e) => !0 },
2122
+ setup(e, { emit: t }) {
2123
+ let n = t, r = (e) => {
2124
+ n("close", { confirmed: e });
2125
+ };
2126
+ return (e, t) => (A(), b(F(nr), {
2127
+ "modal-title": e.title,
2128
+ open: !0,
2129
+ "disable-close": !0
2130
+ }, {
2131
+ content: L(() => [w(P(e.message), 1)]),
2132
+ actions: L(() => [T(F(ur), {
2133
+ color: "secondary",
2134
+ outline: !0,
2135
+ onClick: t[0] ||= (e) => r(!1)
2136
+ }, {
2137
+ default: L(() => [w(P(e.cancelLabel), 1)]),
2138
+ _: 1
2139
+ }), T(F(ur), { onClick: t[1] ||= (e) => r(!0) }, {
2140
+ default: L(() => [w(P(e.confirmLabel), 1)]),
2141
+ _: 1
2142
+ })]),
2143
+ _: 1
2144
+ }, 8, ["modal-title"]));
2145
+ }
2146
+ }), ta = class extends yi {}, na = () => new ta(), ra = {
2147
+ annotation: {
2148
+ type: Object,
2149
+ required: !0
2150
+ },
2151
+ definitionUri: {
2152
+ type: String,
2153
+ required: !0
2154
+ }
2155
+ }, ia = { close: (e) => !0 }, aa = (e, t) => {
2156
+ let { findAnnotation: n, getDefinition: r } = H(), i = r(e.definitionUri || e.annotation.definitionUri), a = {}, o = e.annotation.links.map((e) => n(e.uri)), s = Ki(e.annotation, i);
2157
+ return {
2158
+ save: () => {
2159
+ s.message.value = { status: "saving" };
2160
+ let n = (e.annotation.id ? e.annotation : at.parse({
2161
+ id: "NEW_ANNOTATION",
2162
+ metadata: a,
2163
+ definitionUri: i.id,
2164
+ label: "",
2165
+ links: e.annotation.links,
2166
+ selectors: []
2167
+ })).clone({ metadata: a });
2168
+ return s.save(n, t);
2169
+ },
2170
+ cancel: () => {
2171
+ t("close", null);
2172
+ },
2173
+ metadata: s.metadata,
2174
+ onChangeValue: ({ metadata: e }) => s.onChangeValue({ metadata: a }),
2175
+ message: s.message,
2176
+ annotations: o,
2177
+ definition: i
2178
+ };
2179
+ }, oa = { class: "flex-grow flex flex-col gap-2" }, sa = {
2180
+ "info-card": {
2181
+ component: Ri,
2182
+ useFn: Hi
2183
+ },
2184
+ confirm: {
2185
+ component: ea,
2186
+ useFn: na
2187
+ },
2188
+ "link-annotation": {
2189
+ component: /* @__PURE__ */ E({
2190
+ __name: "LinkAnnotationModal",
2191
+ props: ra,
2192
+ emits: ia,
2193
+ setup(e, { emit: t }) {
2194
+ let { save: n, cancel: r, onChangeValue: i, message: a, annotations: o, metadata: s, definition: c } = aa(e, t), l = (e) => i({ metadata: e }), u = y(() => ({ title: `Create ${c.label} link` }));
2195
+ return (e, t) => (A(), b(F(nr), {
2196
+ "modal-title": u.value.title,
2197
+ open: !0,
2198
+ "disable-close": !1,
2199
+ width: "lg",
2200
+ onCloseModal: F(r)
2201
+ }, {
2202
+ content: L(() => [T(F(ne), {
2203
+ layout: "rows",
2204
+ data: F(s),
2205
+ views: F(c).schemas,
2206
+ "format-before-save": l,
2207
+ "form-max-width": "w-max max-w-lg",
2208
+ onSave: F(n),
2209
+ onOnSaveSuccess: F(n),
2210
+ onCancel: F(r)
2211
+ }, {
2212
+ "content-before": L(() => [C("div", oa, [(A(!0), S(v, null, M(F(o), (e) => (A(), b(ji, {
2213
+ key: e.id,
2214
+ annotation: e,
2215
+ "show-source": !0
2216
+ }, null, 8, ["annotation"]))), 128))])]),
2217
+ "message-buttons": L(() => [T(F(re), pe(oe(F(a))), null, 16)]),
2218
+ _: 1
2219
+ }, 8, [
2220
+ "data",
2221
+ "views",
2222
+ "onSave",
2223
+ "onOnSaveSuccess",
2224
+ "onCancel"
2225
+ ])]),
2226
+ _: 1
2227
+ }, 8, ["modal-title", "onCloseModal"]));
2228
+ }
2229
+ }),
2230
+ useFn: $i
2231
+ },
2232
+ toast: {
2233
+ component: Di,
2234
+ useFn: xi
2235
+ },
2236
+ "edit-annotation": {
2237
+ component: Yi,
2238
+ useFn: Zi
2239
+ }
2240
+ }, ca = (e, t, n, r) => {
2241
+ let { config: i, editorState: a, emits: o, findAnnotationData: s } = r;
2242
+ if (!t) {
2243
+ a.selectedAnnotation && (i.modal.close("info-card"), a.selectedAnnotation = null, a.editorState = null);
2244
+ return;
2245
+ }
2246
+ let c = a.editorState ?? "show";
2247
+ if (a.selectedAnnotation?.id === t && c === (n ?? "show")) return;
2248
+ let l = s(t);
2249
+ if (!l) return;
2250
+ let { annotation: u, source: d } = l;
2251
+ return fe(() => {
2252
+ if (n === "edit") {
2253
+ let e = l.definition;
2254
+ if (!e) return;
2255
+ pi({
2256
+ source: d,
2257
+ annotation: u,
2258
+ definition: e
2259
+ }, i, a, o);
2260
+ } else {
2261
+ let n = Bi(e.value, t) ?? {
2262
+ x: window.innerWidth / 2,
2263
+ y: window.innerHeight / 2
2264
+ };
2265
+ i.modal.show("info-card", {
2266
+ annotation: u,
2267
+ source: d,
2268
+ position: n
2269
+ }), a.editorState = "show";
2270
+ }
2271
+ });
2272
+ }, la = (e = {}) => {
2273
+ let t = /* @__PURE__ */ new Map();
2274
+ Object.entries(e).forEach(([e, { component: n, useFn: r }]) => {
2275
+ let i = {
2276
+ key: e,
2277
+ component: n,
2278
+ state: ge(r())
2279
+ };
2280
+ t.set(e, i);
2281
+ });
2282
+ let n = (e, t) => i(e)?.state.show(t), r = (e, t) => i(e)?.state.close(t), i = (e) => t.get(e) || (console.warn(`Modal ${e} not found`), null), a = Array.from(t.values());
2283
+ return {
2284
+ modals: a,
2285
+ getModal: i,
2286
+ show: n,
2287
+ close: r,
2288
+ destroy: () => a.forEach((e) => e.state.close(null))
2289
+ };
2290
+ }, ua = Symbol("editor"), da = (e, t, n, { readonly: r } = { readonly: !1 }) => {
2291
+ let i = y(() => e.annotationDefinitions), a = y(() => _t(e.annotationDefinitions)), o = ve({
2292
+ modal: la(sa),
2293
+ createAnnotatedText: vt(e.textAdapter, e.annotationTransformer.defaultParams, a.value)
2294
+ }), s = y(() => e.sources ?? []), c = () => {
2295
+ if (!l.selectedAnnotation) {
2296
+ d();
2297
+ return;
2298
+ }
2299
+ l.editorState = l.selectedAnnotation ? "show" : null, l.disableEdits = !1;
2300
+ }, l = ge({
2301
+ editorState: null,
2302
+ selectedAnnotation: null,
2303
+ disableEdits: !1,
2304
+ info: null,
2305
+ readonly: r,
2306
+ show: () => c(),
2307
+ reset: () => d(),
2308
+ format: e.annotationTransformer?.format.bind(e.annotationTransformer) ?? (() => null),
2309
+ transformMetadata: e.annotationTransformer?.transformMetadata.bind(e.annotationTransformer) ?? ((e) => e)
2310
+ });
2311
+ I([
2312
+ () => e.textAdapter,
2313
+ () => e.annotationTransformer,
2314
+ () => a.value
2315
+ ], () => {
2316
+ o.createAnnotatedText = vt(e.textAdapter, e.annotationTransformer.defaultParams, a.value);
2317
+ });
2318
+ let u = {
2319
+ config: o,
2320
+ editorState: l,
2321
+ emits: t,
2322
+ findAnnotationData: (t) => {
2323
+ let n = (e.annotations ?? []).find((e) => e.id === t);
2324
+ if (!n) return null;
2325
+ let r = n.selectors?.[0]?.uri;
2326
+ return r ? {
2327
+ annotation: n,
2328
+ source: (e.sources ?? []).find((e) => e.uri === r),
2329
+ definition: p(n.definitionUri)
2330
+ } : { annotation: n };
2331
+ }
2332
+ };
2333
+ I([
2334
+ () => e.selectedAnnotationId,
2335
+ () => e.selectedAnnotationAction,
2336
+ () => e.annotations
2337
+ ], ([e, t]) => ca(n, e, t, u), { immediate: !0 });
2338
+ let d = () => {
2339
+ o.modal.destroy(), l.editorState = null, l.selectedAnnotation = null, l.disableEdits = !1, l.info = null;
2340
+ }, f = (t) => e.annotations?.find((e) => e.id === t) ?? null, p = (e) => {
2341
+ let t = a.value[e];
2342
+ return t || console.warn(`No definition found for ${e}`), t;
2343
+ };
2344
+ he(ua, {
2345
+ sources: s,
2346
+ config: o,
2347
+ editorState: l,
2348
+ sendAnnotationEvent: vi(o, l, t, n),
2349
+ annotations: y(() => e.annotations ?? []),
2350
+ getDefinition: p,
2351
+ allDefinitions: i,
2352
+ findAnnotation: f
2353
+ });
2354
+ }, H = () => {
2355
+ let e = ce(ua);
2356
+ if (!e) throw Error("useEditorState() must be called inside an EditorRoot");
2357
+ return e;
2358
+ }, fa = /* @__PURE__ */ E({
2359
+ __name: "SourceNavbar",
2360
+ props: ui,
2361
+ emits: di,
2362
+ setup(e, { emit: t }) {
2363
+ let n = e, r = t, { editorState: i, allDefinitions: a, getDefinition: o } = H(), s = y(() => {
2364
+ let e = a.value.filter((e) => e.annotation.isRoot).map((e) => ({
2365
+ key: e.id,
2366
+ label: e.label
2367
+ }));
2368
+ return [{
2369
+ icon: B.Plus,
2370
+ label: "Add",
2371
+ disabled: i.disableEdits,
2372
+ children: e.map((e) => ({
2373
+ action: () => {
2374
+ c(o(e.key));
2375
+ },
2376
+ label: e.label,
2377
+ disabled: n.disabled
2378
+ }))
2379
+ }];
2380
+ }), c = (e) => {
2381
+ r("createAnnotation", e);
2382
+ };
2383
+ return (e, t) => (A(), b(li, { actions: s.value }, null, 8, ["actions"]));
2384
+ }
2385
+ }), pa = { class: "overflow-y-auto flex-1 min-h-0" }, ma = ["dir"], ha = /* @__PURE__ */ E({
2386
+ __name: "SourceEdit",
2387
+ props: ei,
2388
+ setup(e) {
2389
+ let t = e, { config: n, sendAnnotationEvent: r, editorState: i, ...a } = H(), o = `text-content-${Qr()}`, s, c = j(null), l = null;
2390
+ I(() => n.createAnnotatedText, () => {
2391
+ s?.destroy(), fe(() => u());
2392
+ }), I(() => t.source, () => {
2393
+ s?.setText(t.source?.content.text ?? "");
2394
+ }), I(() => a.annotations.value, () => {
2395
+ s?.setAnnotations(a.annotations.value);
2396
+ }), I(() => i.selectedAnnotation, () => {
2397
+ s?.selectAnnotations(i.selectedAnnotation ? [i.selectedAnnotation.id] : []);
2398
+ }), k(() => {
2399
+ l = new IntersectionObserver(([e]) => {
2400
+ e.isIntersecting && (u(), l?.disconnect());
2401
+ }), c.value && l.observe(c.value);
2402
+ });
2403
+ let u = () => {
2404
+ s = n.createAnnotatedText(o, t.source).annotatedText, s.setTagLabelFn((e) => e.label).on("click", ({ mouseEvent: e, event: n, data: i }) => {
2405
+ r("select", {
2406
+ mouseEvent: e,
2407
+ annotation: i.annotation,
2408
+ source: t.source
2409
+ });
2410
+ }).setText(t.source?.content.text ?? "").setAnnotations(a.annotations.value ?? []);
2411
+ };
2412
+ me(() => {
2413
+ s?.destroy(), l && l.disconnect();
2414
+ });
2415
+ let d = (e) => {
2416
+ r("create", {
2417
+ definitionUri: e.id,
2418
+ source: t.source
2419
+ });
2420
+ };
2421
+ return (e, n) => (A(), S(v, null, [F(i).readonly ? x("", !0) : (A(), b(fa, de({ key: 0 }, t, { onCreateAnnotation: d }), null, 16)), C("div", pa, [C("div", {
2422
+ id: o,
2423
+ ref_key: "mainEl",
2424
+ ref: c,
2425
+ dir: e.source.content.textDirection
2426
+ }, null, 8, ma)])], 64));
2427
+ }
2428
+ }), ga = /* @__PURE__ */ E({
2429
+ __name: "AnnotationModal",
2430
+ props: { modalView: {
2431
+ type: Boolean,
2432
+ required: !1,
2433
+ default: !0
2434
+ } },
2435
+ setup(e) {
2436
+ let { config: t } = H();
2437
+ return me(() => {
2438
+ t.modal.destroy();
2439
+ }), (e, n) => (A(!0), S(v, null, M(F(t).modal.modals, ({ key: t, component: n, state: r }) => (A(), S(v, { key: t }, [r?.isVisible ? (A(), b(_e(n), de({
2440
+ key: 0,
2441
+ ref_for: !0
2442
+ }, r.data, {
2443
+ "modal-view": e.modalView,
2444
+ onClose: r.close
2445
+ }), null, 16, ["modal-view", "onClose"])) : x("", !0)], 64))), 128));
2446
+ }
2447
+ }), _a = /* @__PURE__ */ E({
2448
+ __name: "AnnotationEditor",
2449
+ props: qr,
2450
+ emits: Jr,
2451
+ setup(e, { emit: t }) {
2452
+ let n = e, r = t, i = Ce("containerRef");
2453
+ da(n, r, i);
2454
+ let a = y(() => n.layout ? Ae(n.layout) : { gridTemplateColumns: `repeat(${n.cols}, minmax(0, 1fr))` }), o = (e) => {
2455
+ if (!n.layout) return {};
2456
+ let t = je(n.layout, e.id);
2457
+ return t ? { gridArea: t } : {};
2458
+ };
2459
+ return k(() => {}), (e, t) => (A(), S("div", {
2460
+ ref_key: "containerRef",
2461
+ ref: i,
2462
+ "data-testid": "annotation-editor",
2463
+ class: "grid gap-2 py-2 relative",
2464
+ style: O(a.value)
2465
+ }, [(A(!0), S(v, null, M(e.sources, (t) => (A(), b(F(Nr), {
2466
+ key: t.uri,
2467
+ title: t.content.label ?? "",
2468
+ style: O(o(t))
2469
+ }, {
2470
+ default: L(() => [T(ha, {
2471
+ source: t,
2472
+ readonly: e.readonly
2473
+ }, null, 8, ["source", "readonly"])]),
2474
+ _: 2
2475
+ }, 1032, ["title", "style"]))), 128)), T(ga)], 4));
2476
+ }
2477
+ }), va = /* @__PURE__ */ E({
2478
+ __name: "AnnotationFilter",
2479
+ props: /*@__PURE__*/ ue({ count: {
2480
+ type: Object,
2481
+ default: void 0
2482
+ } }, {
2483
+ modelValue: {},
2484
+ modelModifiers: {}
2485
+ }),
2486
+ emits: ["update:modelValue"],
2487
+ setup(e) {
2488
+ let t = It(), n = xe(e, "modelValue"), r = e, i = y(() => t.definitions.map((e) => ({
2489
+ id: e.id,
2490
+ label: e.label,
2491
+ color: e.style?.default?.backgroundColor,
2492
+ count: r.count?.[e.id]?.length ?? 0
2493
+ })));
2494
+ return (e, t) => (A(), b(F(Kr), {
2495
+ modelValue: n.value,
2496
+ "onUpdate:modelValue": t[0] ||= (e) => n.value = e,
2497
+ title: "Annotation filter",
2498
+ items: i.value,
2499
+ "color-key": "color"
2500
+ }, null, 8, ["modelValue", "items"]));
2501
+ }
2502
+ }), ya = class {
2503
+ useAnnotationDefinitions;
2504
+ isSchema = !1;
2505
+ definitionsLoaded = j(!1);
2506
+ constructor() {
2507
+ let e = ce(Et, null);
2508
+ this.useAnnotationDefinitions = e ?? Ft({}), this.loadDefinitions();
2509
+ }
2510
+ async loadDefinitions() {
2511
+ let e = await this.loadResources();
2512
+ this.isSchema ? this.useAnnotationDefinitions.loadFromUrls(e).then(() => {
2513
+ fe(() => this.definitionsLoaded.value = !0);
2514
+ }) : this.useAnnotationDefinitions.loadFromResourceUris(e).then(() => {
2515
+ fe(() => this.definitionsLoaded.value = !0);
2516
+ });
2517
+ }
2518
+ getDefinitions() {
2519
+ return this.useAnnotationDefinitions.definitions;
2520
+ }
2521
+ }, ba = typeof global == "object" && global && global.Object === Object && global, xa = typeof self == "object" && self && self.Object === Object && self, U = ba || xa || Function("return this")(), W = U.Symbol, Sa = Object.prototype, Ca = Sa.hasOwnProperty, wa = Sa.toString, Ta = W ? W.toStringTag : void 0;
2522
+ function Ea(e) {
2523
+ var t = Ca.call(e, Ta), n = e[Ta];
2524
+ try {
2525
+ e[Ta] = void 0;
2526
+ var r = !0;
2527
+ } catch {}
2528
+ var i = wa.call(e);
2529
+ return r && (t ? e[Ta] = n : delete e[Ta]), i;
2530
+ }
2531
+ //#endregion
2532
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_objectToString.js
2533
+ var Da = Object.prototype.toString;
2534
+ function Oa(e) {
2535
+ return Da.call(e);
2536
+ }
2537
+ //#endregion
2538
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseGetTag.js
2539
+ var ka = "[object Null]", Aa = "[object Undefined]", ja = W ? W.toStringTag : void 0;
2540
+ function Ma(e) {
2541
+ return e == null ? e === void 0 ? Aa : ka : ja && ja in Object(e) ? Ea(e) : Oa(e);
2542
+ }
2543
+ //#endregion
2544
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isObjectLike.js
2545
+ function Na(e) {
2546
+ return typeof e == "object" && !!e;
2547
+ }
2548
+ //#endregion
2549
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isSymbol.js
2550
+ var Pa = "[object Symbol]";
2551
+ function Fa(e) {
2552
+ return typeof e == "symbol" || Na(e) && Ma(e) == Pa;
2553
+ }
2554
+ //#endregion
2555
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_arrayMap.js
2556
+ function Ia(e, t) {
2557
+ for (var n = -1, r = e == null ? 0 : e.length, i = Array(r); ++n < r;) i[n] = t(e[n], n, e);
2558
+ return i;
2559
+ }
2560
+ //#endregion
2561
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isArray.js
2562
+ var G = Array.isArray, La = 1 / 0, Ra = W ? W.prototype : void 0, za = Ra ? Ra.toString : void 0;
2563
+ function Ba(e) {
2564
+ if (typeof e == "string") return e;
2565
+ if (G(e)) return Ia(e, Ba) + "";
2566
+ if (Fa(e)) return za ? za.call(e) : "";
2567
+ var t = e + "";
2568
+ return t == "0" && 1 / e == -La ? "-0" : t;
2569
+ }
2570
+ //#endregion
2571
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isObject.js
2572
+ function Va(e) {
2573
+ var t = typeof e;
2574
+ return e != null && (t == "object" || t == "function");
2575
+ }
2576
+ //#endregion
2577
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/identity.js
2578
+ function Ha(e) {
2579
+ return e;
2580
+ }
2581
+ //#endregion
2582
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isFunction.js
2583
+ var Ua = "[object AsyncFunction]", Wa = "[object Function]", Ga = "[object GeneratorFunction]", Ka = "[object Proxy]";
2584
+ function qa(e) {
2585
+ if (!Va(e)) return !1;
2586
+ var t = Ma(e);
2587
+ return t == Wa || t == Ga || t == Ua || t == Ka;
2588
+ }
2589
+ //#endregion
2590
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_coreJsData.js
2591
+ var Ja = U["__core-js_shared__"], Ya = function() {
2592
+ var e = /[^.]+$/.exec(Ja && Ja.keys && Ja.keys.IE_PROTO || "");
2593
+ return e ? "Symbol(src)_1." + e : "";
2594
+ }();
2595
+ function Xa(e) {
2596
+ return !!Ya && Ya in e;
2597
+ }
2598
+ //#endregion
2599
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_toSource.js
2600
+ var Za = Function.prototype.toString;
2601
+ function K(e) {
2602
+ if (e != null) {
2603
+ try {
2604
+ return Za.call(e);
2605
+ } catch {}
2606
+ try {
2607
+ return e + "";
2608
+ } catch {}
2609
+ }
2610
+ return "";
2611
+ }
2612
+ //#endregion
2613
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseIsNative.js
2614
+ var Qa = /[\\^$.*+?()[\]{}|]/g, $a = /^\[object .+?Constructor\]$/, eo = Function.prototype, to = Object.prototype, no = eo.toString, ro = to.hasOwnProperty, io = RegExp("^" + no.call(ro).replace(Qa, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$");
2615
+ function ao(e) {
2616
+ return !Va(e) || Xa(e) ? !1 : (qa(e) ? io : $a).test(K(e));
2617
+ }
2618
+ //#endregion
2619
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_getValue.js
2620
+ function oo(e, t) {
2621
+ return e?.[t];
2622
+ }
2623
+ //#endregion
2624
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_getNative.js
2625
+ function q(e, t) {
2626
+ var n = oo(e, t);
2627
+ return ao(n) ? n : void 0;
2628
+ }
2629
+ //#endregion
2630
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_WeakMap.js
2631
+ var so = q(U, "WeakMap"), co = function() {
2632
+ try {
2633
+ var e = q(Object, "defineProperty");
2634
+ return e({}, "", {}), e;
2635
+ } catch {}
2636
+ }(), lo = 9007199254740991, uo = /^(?:0|[1-9]\d*)$/;
2637
+ function fo(e, t) {
2638
+ var n = typeof e;
2639
+ return t ??= lo, !!t && (n == "number" || n != "symbol" && uo.test(e)) && e > -1 && e % 1 == 0 && e < t;
2640
+ }
2641
+ //#endregion
2642
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseAssignValue.js
2643
+ function po(e, t, n) {
2644
+ t == "__proto__" && co ? co(e, t, {
2645
+ configurable: !0,
2646
+ enumerable: !0,
2647
+ value: n,
2648
+ writable: !0
2649
+ }) : e[t] = n;
2650
+ }
2651
+ //#endregion
2652
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/eq.js
2653
+ function mo(e, t) {
2654
+ return e === t || e !== e && t !== t;
2655
+ }
2656
+ //#endregion
2657
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isLength.js
2658
+ var ho = 9007199254740991;
2659
+ function go(e) {
2660
+ return typeof e == "number" && e > -1 && e % 1 == 0 && e <= ho;
2661
+ }
2662
+ //#endregion
2663
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isArrayLike.js
2664
+ function _o(e) {
2665
+ return e != null && go(e.length) && !qa(e);
2666
+ }
2667
+ //#endregion
2668
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_isPrototype.js
2669
+ var vo = Object.prototype;
2670
+ function yo(e) {
2671
+ var t = e && e.constructor;
2672
+ return e === (typeof t == "function" && t.prototype || vo);
2673
+ }
2674
+ //#endregion
2675
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseTimes.js
2676
+ function bo(e, t) {
2677
+ for (var n = -1, r = Array(e); ++n < e;) r[n] = t(n);
2678
+ return r;
2679
+ }
2680
+ //#endregion
2681
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseIsArguments.js
2682
+ var xo = "[object Arguments]";
2683
+ function So(e) {
2684
+ return Na(e) && Ma(e) == xo;
2685
+ }
2686
+ //#endregion
2687
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isArguments.js
2688
+ var Co = Object.prototype, wo = Co.hasOwnProperty, To = Co.propertyIsEnumerable, Eo = So(function() {
2689
+ return arguments;
2690
+ }()) ? So : function(e) {
2691
+ return Na(e) && wo.call(e, "callee") && !To.call(e, "callee");
2692
+ };
2693
+ //#endregion
2694
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/stubFalse.js
2695
+ function Do() {
2696
+ return !1;
2697
+ }
2698
+ //#endregion
2699
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isBuffer.js
2700
+ var Oo = typeof exports == "object" && exports && !exports.nodeType && exports, ko = Oo && typeof module == "object" && module && !module.nodeType && module, Ao = ko && ko.exports === Oo ? U.Buffer : void 0, jo = (Ao ? Ao.isBuffer : void 0) || Do, Mo = "[object Arguments]", No = "[object Array]", Po = "[object Boolean]", Fo = "[object Date]", Io = "[object Error]", Lo = "[object Function]", Ro = "[object Map]", zo = "[object Number]", Bo = "[object Object]", Vo = "[object RegExp]", Ho = "[object Set]", Uo = "[object String]", Wo = "[object WeakMap]", Go = "[object ArrayBuffer]", Ko = "[object DataView]", qo = "[object Float32Array]", Jo = "[object Float64Array]", Yo = "[object Int8Array]", Xo = "[object Int16Array]", Zo = "[object Int32Array]", Qo = "[object Uint8Array]", $o = "[object Uint8ClampedArray]", es = "[object Uint16Array]", ts = "[object Uint32Array]", J = {};
2701
+ J[qo] = J[Jo] = J[Yo] = J[Xo] = J[Zo] = J[Qo] = J[$o] = J[es] = J[ts] = !0, J[Mo] = J[No] = J[Go] = J[Po] = J[Ko] = J[Fo] = J[Io] = J[Lo] = J[Ro] = J[zo] = J[Bo] = J[Vo] = J[Ho] = J[Uo] = J[Wo] = !1;
2702
+ function ns(e) {
2703
+ return Na(e) && go(e.length) && !!J[Ma(e)];
2704
+ }
2705
+ //#endregion
2706
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseUnary.js
2707
+ function rs(e) {
2708
+ return function(t) {
2709
+ return e(t);
2710
+ };
2711
+ }
2712
+ //#endregion
2713
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_nodeUtil.js
2714
+ var is = typeof exports == "object" && exports && !exports.nodeType && exports, as = is && typeof module == "object" && module && !module.nodeType && module, os = as && as.exports === is && ba.process, ss = function() {
2715
+ try {
2716
+ return as && as.require && as.require("util").types || os && os.binding && os.binding("util");
2717
+ } catch {}
2718
+ }(), cs = ss && ss.isTypedArray, ls = cs ? rs(cs) : ns, us = Object.prototype.hasOwnProperty;
2719
+ function ds(e, t) {
2720
+ var n = G(e), r = !n && Eo(e), i = !n && !r && jo(e), a = !n && !r && !i && ls(e), o = n || r || i || a, s = o ? bo(e.length, String) : [], c = s.length;
2721
+ for (var l in e) (t || us.call(e, l)) && !(o && (l == "length" || i && (l == "offset" || l == "parent") || a && (l == "buffer" || l == "byteLength" || l == "byteOffset") || fo(l, c))) && s.push(l);
2722
+ return s;
2723
+ }
2724
+ //#endregion
2725
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_overArg.js
2726
+ function fs(e, t) {
2727
+ return function(n) {
2728
+ return e(t(n));
2729
+ };
2730
+ }
2731
+ //#endregion
2732
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_nativeKeys.js
2733
+ var ps = fs(Object.keys, Object), ms = Object.prototype.hasOwnProperty;
2734
+ function hs(e) {
2735
+ if (!yo(e)) return ps(e);
2736
+ var t = [];
2737
+ for (var n in Object(e)) ms.call(e, n) && n != "constructor" && t.push(n);
2738
+ return t;
2739
+ }
2740
+ //#endregion
2741
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/keys.js
2742
+ function gs(e) {
2743
+ return _o(e) ? ds(e) : hs(e);
2744
+ }
2745
+ //#endregion
2746
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_isKey.js
2747
+ var _s = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, vs = /^\w*$/;
2748
+ function ys(e, t) {
2749
+ if (G(e)) return !1;
2750
+ var n = typeof e;
2751
+ return n == "number" || n == "symbol" || n == "boolean" || e == null || Fa(e) ? !0 : vs.test(e) || !_s.test(e) || t != null && e in Object(t);
2752
+ }
2753
+ //#endregion
2754
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_nativeCreate.js
2755
+ var bs = q(Object, "create");
2756
+ //#endregion
2757
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_hashClear.js
2758
+ function xs() {
2759
+ this.__data__ = bs ? bs(null) : {}, this.size = 0;
2760
+ }
2761
+ //#endregion
2762
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_hashDelete.js
2763
+ function Ss(e) {
2764
+ var t = this.has(e) && delete this.__data__[e];
2765
+ return this.size -= +!!t, t;
2766
+ }
2767
+ //#endregion
2768
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_hashGet.js
2769
+ var Cs = "__lodash_hash_undefined__", ws = Object.prototype.hasOwnProperty;
2770
+ function Ts(e) {
2771
+ var t = this.__data__;
2772
+ if (bs) {
2773
+ var n = t[e];
2774
+ return n === Cs ? void 0 : n;
2775
+ }
2776
+ return ws.call(t, e) ? t[e] : void 0;
2777
+ }
2778
+ //#endregion
2779
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_hashHas.js
2780
+ var Es = Object.prototype.hasOwnProperty;
2781
+ function Ds(e) {
2782
+ var t = this.__data__;
2783
+ return bs ? t[e] !== void 0 : Es.call(t, e);
2784
+ }
2785
+ //#endregion
2786
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_hashSet.js
2787
+ var Os = "__lodash_hash_undefined__";
2788
+ function ks(e, t) {
2789
+ var n = this.__data__;
2790
+ return this.size += +!this.has(e), n[e] = bs && t === void 0 ? Os : t, this;
2791
+ }
2792
+ //#endregion
2793
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_Hash.js
2794
+ function Y(e) {
2795
+ var t = -1, n = e == null ? 0 : e.length;
2796
+ for (this.clear(); ++t < n;) {
2797
+ var r = e[t];
2798
+ this.set(r[0], r[1]);
2799
+ }
2800
+ }
2801
+ Y.prototype.clear = xs, Y.prototype.delete = Ss, Y.prototype.get = Ts, Y.prototype.has = Ds, Y.prototype.set = ks;
2802
+ //#endregion
2803
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_listCacheClear.js
2804
+ function As() {
2805
+ this.__data__ = [], this.size = 0;
2806
+ }
2807
+ //#endregion
2808
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_assocIndexOf.js
2809
+ function js(e, t) {
2810
+ for (var n = e.length; n--;) if (mo(e[n][0], t)) return n;
2811
+ return -1;
2812
+ }
2813
+ //#endregion
2814
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_listCacheDelete.js
2815
+ var Ms = Array.prototype.splice;
2816
+ function Ns(e) {
2817
+ var t = this.__data__, n = js(t, e);
2818
+ return n < 0 ? !1 : (n == t.length - 1 ? t.pop() : Ms.call(t, n, 1), --this.size, !0);
2819
+ }
2820
+ //#endregion
2821
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_listCacheGet.js
2822
+ function Ps(e) {
2823
+ var t = this.__data__, n = js(t, e);
2824
+ return n < 0 ? void 0 : t[n][1];
2825
+ }
2826
+ //#endregion
2827
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_listCacheHas.js
2828
+ function Fs(e) {
2829
+ return js(this.__data__, e) > -1;
2830
+ }
2831
+ //#endregion
2832
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_listCacheSet.js
2833
+ function Is(e, t) {
2834
+ var n = this.__data__, r = js(n, e);
2835
+ return r < 0 ? (++this.size, n.push([e, t])) : n[r][1] = t, this;
2836
+ }
2837
+ //#endregion
2838
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_ListCache.js
2839
+ function X(e) {
2840
+ var t = -1, n = e == null ? 0 : e.length;
2841
+ for (this.clear(); ++t < n;) {
2842
+ var r = e[t];
2843
+ this.set(r[0], r[1]);
2844
+ }
2845
+ }
2846
+ X.prototype.clear = As, X.prototype.delete = Ns, X.prototype.get = Ps, X.prototype.has = Fs, X.prototype.set = Is;
2847
+ //#endregion
2848
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_Map.js
2849
+ var Ls = q(U, "Map");
2850
+ //#endregion
2851
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheClear.js
2852
+ function Rs() {
2853
+ this.size = 0, this.__data__ = {
2854
+ hash: new Y(),
2855
+ map: new (Ls || X)(),
2856
+ string: new Y()
2857
+ };
2858
+ }
2859
+ //#endregion
2860
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_isKeyable.js
2861
+ function zs(e) {
2862
+ var t = typeof e;
2863
+ return t == "string" || t == "number" || t == "symbol" || t == "boolean" ? e !== "__proto__" : e === null;
2864
+ }
2865
+ //#endregion
2866
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_getMapData.js
2867
+ function Bs(e, t) {
2868
+ var n = e.__data__;
2869
+ return zs(t) ? n[typeof t == "string" ? "string" : "hash"] : n.map;
2870
+ }
2871
+ //#endregion
2872
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheDelete.js
2873
+ function Vs(e) {
2874
+ var t = Bs(this, e).delete(e);
2875
+ return this.size -= +!!t, t;
2876
+ }
2877
+ //#endregion
2878
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheGet.js
2879
+ function Hs(e) {
2880
+ return Bs(this, e).get(e);
2881
+ }
2882
+ //#endregion
2883
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheHas.js
2884
+ function Us(e) {
2885
+ return Bs(this, e).has(e);
2886
+ }
2887
+ //#endregion
2888
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheSet.js
2889
+ function Ws(e, t) {
2890
+ var n = Bs(this, e), r = n.size;
2891
+ return n.set(e, t), this.size += n.size == r ? 0 : 1, this;
2892
+ }
2893
+ //#endregion
2894
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_MapCache.js
2895
+ function Z(e) {
2896
+ var t = -1, n = e == null ? 0 : e.length;
2897
+ for (this.clear(); ++t < n;) {
2898
+ var r = e[t];
2899
+ this.set(r[0], r[1]);
2900
+ }
2901
+ }
2902
+ Z.prototype.clear = Rs, Z.prototype.delete = Vs, Z.prototype.get = Hs, Z.prototype.has = Us, Z.prototype.set = Ws;
2903
+ //#endregion
2904
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/memoize.js
2905
+ var Gs = "Expected a function";
2906
+ function Ks(e, t) {
2907
+ if (typeof e != "function" || t != null && typeof t != "function") throw TypeError(Gs);
2908
+ var n = function() {
2909
+ var r = arguments, i = t ? t.apply(this, r) : r[0], a = n.cache;
2910
+ if (a.has(i)) return a.get(i);
2911
+ var o = e.apply(this, r);
2912
+ return n.cache = a.set(i, o) || a, o;
2913
+ };
2914
+ return n.cache = new (Ks.Cache || Z)(), n;
2915
+ }
2916
+ Ks.Cache = Z;
2917
+ //#endregion
2918
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_memoizeCapped.js
2919
+ var qs = 500;
2920
+ function Js(e) {
2921
+ var t = Ks(e, function(e) {
2922
+ return n.size === qs && n.clear(), e;
2923
+ }), n = t.cache;
2924
+ return t;
2925
+ }
2926
+ //#endregion
2927
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_stringToPath.js
2928
+ var Ys = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, Xs = /\\(\\)?/g, Zs = Js(function(e) {
2929
+ var t = [];
2930
+ return e.charCodeAt(0) === 46 && t.push(""), e.replace(Ys, function(e, n, r, i) {
2931
+ t.push(r ? i.replace(Xs, "$1") : n || e);
2932
+ }), t;
2933
+ });
2934
+ //#endregion
2935
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/toString.js
2936
+ function Qs(e) {
2937
+ return e == null ? "" : Ba(e);
2938
+ }
2939
+ //#endregion
2940
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_castPath.js
2941
+ function $s(e, t) {
2942
+ return G(e) ? e : ys(e, t) ? [e] : Zs(Qs(e));
2943
+ }
2944
+ //#endregion
2945
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_toKey.js
2946
+ var ec = 1 / 0;
2947
+ function tc(e) {
2948
+ if (typeof e == "string" || Fa(e)) return e;
2949
+ var t = e + "";
2950
+ return t == "0" && 1 / e == -ec ? "-0" : t;
2951
+ }
2952
+ //#endregion
2953
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseGet.js
2954
+ function nc(e, t) {
2955
+ t = $s(t, e);
2956
+ for (var n = 0, r = t.length; e != null && n < r;) e = e[tc(t[n++])];
2957
+ return n && n == r ? e : void 0;
2958
+ }
2959
+ //#endregion
2960
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/get.js
2961
+ function rc(e, t, n) {
2962
+ var r = e == null ? void 0 : nc(e, t);
2963
+ return r === void 0 ? n : r;
2964
+ }
2965
+ //#endregion
2966
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_arrayPush.js
2967
+ function ic(e, t) {
2968
+ for (var n = -1, r = t.length, i = e.length; ++n < r;) e[i + n] = t[n];
2969
+ return e;
2970
+ }
2971
+ //#endregion
2972
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_stackClear.js
2973
+ function ac() {
2974
+ this.__data__ = new X(), this.size = 0;
2975
+ }
2976
+ //#endregion
2977
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_stackDelete.js
2978
+ function oc(e) {
2979
+ var t = this.__data__, n = t.delete(e);
2980
+ return this.size = t.size, n;
2981
+ }
2982
+ //#endregion
2983
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_stackGet.js
2984
+ function sc(e) {
2985
+ return this.__data__.get(e);
2986
+ }
2987
+ //#endregion
2988
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_stackHas.js
2989
+ function cc(e) {
2990
+ return this.__data__.has(e);
2991
+ }
2992
+ //#endregion
2993
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_stackSet.js
2994
+ var lc = 200;
2995
+ function uc(e, t) {
2996
+ var n = this.__data__;
2997
+ if (n instanceof X) {
2998
+ var r = n.__data__;
2999
+ if (!Ls || r.length < lc - 1) return r.push([e, t]), this.size = ++n.size, this;
3000
+ n = this.__data__ = new Z(r);
3001
+ }
3002
+ return n.set(e, t), this.size = n.size, this;
3003
+ }
3004
+ //#endregion
3005
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_Stack.js
3006
+ function Q(e) {
3007
+ var t = this.__data__ = new X(e);
3008
+ this.size = t.size;
3009
+ }
3010
+ Q.prototype.clear = ac, Q.prototype.delete = oc, Q.prototype.get = sc, Q.prototype.has = cc, Q.prototype.set = uc;
3011
+ //#endregion
3012
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_arrayFilter.js
3013
+ function dc(e, t) {
3014
+ for (var n = -1, r = e == null ? 0 : e.length, i = 0, a = []; ++n < r;) {
3015
+ var o = e[n];
3016
+ t(o, n, e) && (a[i++] = o);
3017
+ }
3018
+ return a;
3019
+ }
3020
+ //#endregion
3021
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/stubArray.js
3022
+ function fc() {
3023
+ return [];
3024
+ }
3025
+ //#endregion
3026
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_getSymbols.js
3027
+ var pc = Object.prototype.propertyIsEnumerable, mc = Object.getOwnPropertySymbols, hc = mc ? function(e) {
3028
+ return e == null ? [] : (e = Object(e), dc(mc(e), function(t) {
3029
+ return pc.call(e, t);
3030
+ }));
3031
+ } : fc;
3032
+ //#endregion
3033
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseGetAllKeys.js
3034
+ function gc(e, t, n) {
3035
+ var r = t(e);
3036
+ return G(e) ? r : ic(r, n(e));
3037
+ }
3038
+ //#endregion
3039
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_getAllKeys.js
3040
+ function _c(e) {
3041
+ return gc(e, gs, hc);
3042
+ }
3043
+ //#endregion
3044
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_DataView.js
3045
+ var vc = q(U, "DataView"), yc = q(U, "Promise"), bc = q(U, "Set"), xc = "[object Map]", Sc = "[object Object]", Cc = "[object Promise]", wc = "[object Set]", Tc = "[object WeakMap]", Ec = "[object DataView]", Dc = K(vc), Oc = K(Ls), kc = K(yc), Ac = K(bc), jc = K(so), $ = Ma;
3046
+ (vc && $(new vc(/* @__PURE__ */ new ArrayBuffer(1))) != Ec || Ls && $(new Ls()) != xc || yc && $(yc.resolve()) != Cc || bc && $(new bc()) != wc || so && $(new so()) != Tc) && ($ = function(e) {
3047
+ var t = Ma(e), n = t == Sc ? e.constructor : void 0, r = n ? K(n) : "";
3048
+ if (r) switch (r) {
3049
+ case Dc: return Ec;
3050
+ case Oc: return xc;
3051
+ case kc: return Cc;
3052
+ case Ac: return wc;
3053
+ case jc: return Tc;
3054
+ }
3055
+ return t;
3056
+ });
3057
+ var Mc = $, Nc = U.Uint8Array, Pc = "__lodash_hash_undefined__";
3058
+ function Fc(e) {
3059
+ return this.__data__.set(e, Pc), this;
3060
+ }
3061
+ //#endregion
3062
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_setCacheHas.js
3063
+ function Ic(e) {
3064
+ return this.__data__.has(e);
3065
+ }
3066
+ //#endregion
3067
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_SetCache.js
3068
+ function Lc(e) {
3069
+ var t = -1, n = e == null ? 0 : e.length;
3070
+ for (this.__data__ = new Z(); ++t < n;) this.add(e[t]);
3071
+ }
3072
+ Lc.prototype.add = Lc.prototype.push = Fc, Lc.prototype.has = Ic;
3073
+ //#endregion
3074
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_arraySome.js
3075
+ function Rc(e, t) {
3076
+ for (var n = -1, r = e == null ? 0 : e.length; ++n < r;) if (t(e[n], n, e)) return !0;
3077
+ return !1;
3078
+ }
3079
+ //#endregion
3080
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_cacheHas.js
3081
+ function zc(e, t) {
3082
+ return e.has(t);
3083
+ }
3084
+ //#endregion
3085
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_equalArrays.js
3086
+ var Bc = 1, Vc = 2;
3087
+ function Hc(e, t, n, r, i, a) {
3088
+ var o = n & Bc, s = e.length, c = t.length;
3089
+ if (s != c && !(o && c > s)) return !1;
3090
+ var l = a.get(e), u = a.get(t);
3091
+ if (l && u) return l == t && u == e;
3092
+ var d = -1, f = !0, p = n & Vc ? new Lc() : void 0;
3093
+ for (a.set(e, t), a.set(t, e); ++d < s;) {
3094
+ var m = e[d], h = t[d];
3095
+ if (r) var g = o ? r(h, m, d, t, e, a) : r(m, h, d, e, t, a);
3096
+ if (g !== void 0) {
3097
+ if (g) continue;
3098
+ f = !1;
3099
+ break;
3100
+ }
3101
+ if (p) {
3102
+ if (!Rc(t, function(e, t) {
3103
+ if (!zc(p, t) && (m === e || i(m, e, n, r, a))) return p.push(t);
3104
+ })) {
3105
+ f = !1;
3106
+ break;
3107
+ }
3108
+ } else if (!(m === h || i(m, h, n, r, a))) {
3109
+ f = !1;
3110
+ break;
3111
+ }
3112
+ }
3113
+ return a.delete(e), a.delete(t), f;
3114
+ }
3115
+ //#endregion
3116
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_mapToArray.js
3117
+ function Uc(e) {
3118
+ var t = -1, n = Array(e.size);
3119
+ return e.forEach(function(e, r) {
3120
+ n[++t] = [r, e];
3121
+ }), n;
3122
+ }
3123
+ //#endregion
3124
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_setToArray.js
3125
+ function Wc(e) {
3126
+ var t = -1, n = Array(e.size);
3127
+ return e.forEach(function(e) {
3128
+ n[++t] = e;
3129
+ }), n;
3130
+ }
3131
+ //#endregion
3132
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_equalByTag.js
3133
+ var Gc = 1, Kc = 2, qc = "[object Boolean]", Jc = "[object Date]", Yc = "[object Error]", Xc = "[object Map]", Zc = "[object Number]", Qc = "[object RegExp]", $c = "[object Set]", el = "[object String]", tl = "[object Symbol]", nl = "[object ArrayBuffer]", rl = "[object DataView]", il = W ? W.prototype : void 0, al = il ? il.valueOf : void 0;
3134
+ function ol(e, t, n, r, i, a, o) {
3135
+ switch (n) {
3136
+ case rl:
3137
+ if (e.byteLength != t.byteLength || e.byteOffset != t.byteOffset) return !1;
3138
+ e = e.buffer, t = t.buffer;
3139
+ case nl: return !(e.byteLength != t.byteLength || !a(new Nc(e), new Nc(t)));
3140
+ case qc:
3141
+ case Jc:
3142
+ case Zc: return mo(+e, +t);
3143
+ case Yc: return e.name == t.name && e.message == t.message;
3144
+ case Qc:
3145
+ case el: return e == t + "";
3146
+ case Xc: var s = Uc;
3147
+ case $c:
3148
+ var c = r & Gc;
3149
+ if (s ||= Wc, e.size != t.size && !c) return !1;
3150
+ var l = o.get(e);
3151
+ if (l) return l == t;
3152
+ r |= Kc, o.set(e, t);
3153
+ var u = Hc(s(e), s(t), r, i, a, o);
3154
+ return o.delete(e), u;
3155
+ case tl: if (al) return al.call(e) == al.call(t);
3156
+ }
3157
+ return !1;
3158
+ }
3159
+ //#endregion
3160
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_equalObjects.js
3161
+ var sl = 1, cl = Object.prototype.hasOwnProperty;
3162
+ function ll(e, t, n, r, i, a) {
3163
+ var o = n & sl, s = _c(e), c = s.length;
3164
+ if (c != _c(t).length && !o) return !1;
3165
+ for (var l = c; l--;) {
3166
+ var u = s[l];
3167
+ if (!(o ? u in t : cl.call(t, u))) return !1;
3168
+ }
3169
+ var d = a.get(e), f = a.get(t);
3170
+ if (d && f) return d == t && f == e;
3171
+ var p = !0;
3172
+ a.set(e, t), a.set(t, e);
3173
+ for (var m = o; ++l < c;) {
3174
+ u = s[l];
3175
+ var h = e[u], g = t[u];
3176
+ if (r) var ee = o ? r(g, h, u, t, e, a) : r(h, g, u, e, t, a);
3177
+ if (!(ee === void 0 ? h === g || i(h, g, n, r, a) : ee)) {
3178
+ p = !1;
3179
+ break;
3180
+ }
3181
+ m ||= u == "constructor";
3182
+ }
3183
+ if (p && !m) {
3184
+ var _ = e.constructor, te = t.constructor;
3185
+ _ != te && "constructor" in e && "constructor" in t && !(typeof _ == "function" && _ instanceof _ && typeof te == "function" && te instanceof te) && (p = !1);
3186
+ }
3187
+ return a.delete(e), a.delete(t), p;
3188
+ }
3189
+ //#endregion
3190
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseIsEqualDeep.js
3191
+ var ul = 1, dl = "[object Arguments]", fl = "[object Array]", pl = "[object Object]", ml = Object.prototype.hasOwnProperty;
3192
+ function hl(e, t, n, r, i, a) {
3193
+ var o = G(e), s = G(t), c = o ? fl : Mc(e), l = s ? fl : Mc(t);
3194
+ c = c == dl ? pl : c, l = l == dl ? pl : l;
3195
+ var u = c == pl, d = l == pl, f = c == l;
3196
+ if (f && jo(e)) {
3197
+ if (!jo(t)) return !1;
3198
+ o = !0, u = !1;
3199
+ }
3200
+ if (f && !u) return a ||= new Q(), o || ls(e) ? Hc(e, t, n, r, i, a) : ol(e, t, c, n, r, i, a);
3201
+ if (!(n & ul)) {
3202
+ var p = u && ml.call(e, "__wrapped__"), m = d && ml.call(t, "__wrapped__");
3203
+ if (p || m) {
3204
+ var h = p ? e.value() : e, g = m ? t.value() : t;
3205
+ return a ||= new Q(), i(h, g, n, r, a);
3206
+ }
3207
+ }
3208
+ return f ? (a ||= new Q(), ll(e, t, n, r, i, a)) : !1;
3209
+ }
3210
+ //#endregion
3211
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseIsEqual.js
3212
+ function gl(e, t, n, r, i) {
3213
+ return e === t ? !0 : e == null || t == null || !Na(e) && !Na(t) ? e !== e && t !== t : hl(e, t, n, r, gl, i);
3214
+ }
3215
+ //#endregion
3216
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseIsMatch.js
3217
+ var _l = 1, vl = 2;
3218
+ function yl(e, t, n, r) {
3219
+ var i = n.length, a = i, o = !r;
3220
+ if (e == null) return !a;
3221
+ for (e = Object(e); i--;) {
3222
+ var s = n[i];
3223
+ if (o && s[2] ? s[1] !== e[s[0]] : !(s[0] in e)) return !1;
3224
+ }
3225
+ for (; ++i < a;) {
3226
+ s = n[i];
3227
+ var c = s[0], l = e[c], u = s[1];
3228
+ if (o && s[2]) {
3229
+ if (l === void 0 && !(c in e)) return !1;
3230
+ } else {
3231
+ var d = new Q();
3232
+ if (r) var f = r(l, u, c, e, t, d);
3233
+ if (!(f === void 0 ? gl(u, l, _l | vl, r, d) : f)) return !1;
3234
+ }
3235
+ }
3236
+ return !0;
3237
+ }
3238
+ //#endregion
3239
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_isStrictComparable.js
3240
+ function bl(e) {
3241
+ return e === e && !Va(e);
3242
+ }
3243
+ //#endregion
3244
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_getMatchData.js
3245
+ function xl(e) {
3246
+ for (var t = gs(e), n = t.length; n--;) {
3247
+ var r = t[n], i = e[r];
3248
+ t[n] = [
3249
+ r,
3250
+ i,
3251
+ bl(i)
3252
+ ];
3253
+ }
3254
+ return t;
3255
+ }
3256
+ //#endregion
3257
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_matchesStrictComparable.js
3258
+ function Sl(e, t) {
3259
+ return function(n) {
3260
+ return n != null && n[e] === t && (t !== void 0 || e in Object(n));
3261
+ };
3262
+ }
3263
+ //#endregion
3264
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseMatches.js
3265
+ function Cl(e) {
3266
+ var t = xl(e);
3267
+ return t.length == 1 && t[0][2] ? Sl(t[0][0], t[0][1]) : function(n) {
3268
+ return n === e || yl(n, e, t);
3269
+ };
3270
+ }
3271
+ //#endregion
3272
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseHasIn.js
3273
+ function wl(e, t) {
3274
+ return e != null && t in Object(e);
3275
+ }
3276
+ //#endregion
3277
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_hasPath.js
3278
+ function Tl(e, t, n) {
3279
+ t = $s(t, e);
3280
+ for (var r = -1, i = t.length, a = !1; ++r < i;) {
3281
+ var o = tc(t[r]);
3282
+ if (!(a = e != null && n(e, o))) break;
3283
+ e = e[o];
3284
+ }
3285
+ return a || ++r != i ? a : (i = e == null ? 0 : e.length, !!i && go(i) && fo(o, i) && (G(e) || Eo(e)));
3286
+ }
3287
+ //#endregion
3288
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/hasIn.js
3289
+ function El(e, t) {
3290
+ return e != null && Tl(e, t, wl);
3291
+ }
3292
+ //#endregion
3293
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseMatchesProperty.js
3294
+ var Dl = 1, Ol = 2;
3295
+ function kl(e, t) {
3296
+ return ys(e) && bl(t) ? Sl(tc(e), t) : function(n) {
3297
+ var r = rc(n, e);
3298
+ return r === void 0 && r === t ? El(n, e) : gl(t, r, Dl | Ol);
3299
+ };
3300
+ }
3301
+ //#endregion
3302
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseProperty.js
3303
+ function Al(e) {
3304
+ return function(t) {
3305
+ return t?.[e];
3306
+ };
3307
+ }
3308
+ //#endregion
3309
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_basePropertyDeep.js
3310
+ function jl(e) {
3311
+ return function(t) {
3312
+ return nc(t, e);
3313
+ };
3314
+ }
3315
+ //#endregion
3316
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/property.js
3317
+ function Ml(e) {
3318
+ return ys(e) ? Al(tc(e)) : jl(e);
3319
+ }
3320
+ //#endregion
3321
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseIteratee.js
3322
+ function Nl(e) {
3323
+ return typeof e == "function" ? e : e == null ? Ha : typeof e == "object" ? G(e) ? kl(e[0], e[1]) : Cl(e) : Ml(e);
3324
+ }
3325
+ //#endregion
3326
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_arrayAggregator.js
3327
+ function Pl(e, t, n, r) {
3328
+ for (var i = -1, a = e == null ? 0 : e.length; ++i < a;) {
3329
+ var o = e[i];
3330
+ t(r, o, n(o), e);
3331
+ }
3332
+ return r;
3333
+ }
3334
+ //#endregion
3335
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_createBaseFor.js
3336
+ function Fl(e) {
3337
+ return function(t, n, r) {
3338
+ for (var i = -1, a = Object(t), o = r(t), s = o.length; s--;) {
3339
+ var c = o[e ? s : ++i];
3340
+ if (n(a[c], c, a) === !1) break;
3341
+ }
3342
+ return t;
3343
+ };
3344
+ }
3345
+ //#endregion
3346
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseFor.js
3347
+ var Il = Fl();
3348
+ //#endregion
3349
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseForOwn.js
3350
+ function Ll(e, t) {
3351
+ return e && Il(e, t, gs);
3352
+ }
3353
+ //#endregion
3354
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_createBaseEach.js
3355
+ function Rl(e, t) {
3356
+ return function(n, r) {
3357
+ if (n == null) return n;
3358
+ if (!_o(n)) return e(n, r);
3359
+ for (var i = n.length, a = t ? i : -1, o = Object(n); (t ? a-- : ++a < i) && r(o[a], a, o) !== !1;);
3360
+ return n;
3361
+ };
3362
+ }
3363
+ //#endregion
3364
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseEach.js
3365
+ var zl = Rl(Ll);
3366
+ //#endregion
3367
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseAggregator.js
3368
+ function Bl(e, t, n, r) {
3369
+ return zl(e, function(e, i, a) {
3370
+ t(r, e, n(e), a);
3371
+ }), r;
3372
+ }
3373
+ //#endregion
3374
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_createAggregator.js
3375
+ function Vl(e, t) {
3376
+ return function(n, r) {
3377
+ var i = G(n) ? Pl : Bl, a = t ? t() : {};
3378
+ return i(n, e, Nl(r, 2), a);
3379
+ };
3380
+ }
3381
+ //#endregion
3382
+ //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/groupBy.js
3383
+ var Hl = Object.prototype.hasOwnProperty, Ul = Vl(function(e, t, n) {
3384
+ Hl.call(e, n) ? e[n].push(t) : po(e, n, [t]);
3385
+ }), Wl = (e, t) => {
3386
+ let n = It(), r = j(null), i = j([]), a = j([]), o = j(!0), s = j(!0), c = y(() => n.definitions), l = 0, u = 0, d = () => {
3387
+ let t = r.value ?? [], n = ++l;
3388
+ o.value = !0, Promise.all(t.map((t) => e.loadSource(t))).then((e) => {
3389
+ n === l && (i.value = e);
3390
+ }).finally(() => {
3391
+ n === l && (o.value = !1);
3392
+ }), f();
3393
+ }, f = () => {
3394
+ let n = r.value ?? [], i = ++u;
3395
+ s.value = !0, Promise.all(n.map((t) => e.loadAnnotations(t))).then((e) => {
3396
+ if (i !== u) return;
3397
+ let n = e.flat().map((e) => t.parse(e)).filter(Boolean);
3398
+ a.value = t.createLinks(n);
3399
+ }).finally(() => {
3400
+ i === u && (s.value = !1);
3401
+ });
3402
+ }, p = (e) => {
3403
+ r.value = e, i.value = [], a.value = [], d(), f();
3404
+ };
3405
+ I(() => c.value, () => {
3406
+ f();
3407
+ });
3408
+ let m = y(() => Ul(a.value, (e) => e.definitionUri)), h = j([]), g = () => {
3409
+ f();
3410
+ }, ee = y(() => {
3411
+ if (h.value?.length === 0) return a.value.map((e) => e);
3412
+ let e = m.value;
3413
+ return h.value.flatMap((t) => e[t] ?? []).map((e) => e);
3414
+ }), _ = y(() => s.value || o.value);
3415
+ return ge({
3416
+ loading: _,
3417
+ annotations: a,
3418
+ filteredAnnotations: ee,
3419
+ sources: i,
3420
+ selectedAnnotationTypes: h,
3421
+ annotationsGroupedByPurpose: m,
3422
+ reload: g,
3423
+ setSourceUris: p
3424
+ });
3425
+ }, Gl = Symbol("TextState"), Kl = (e, t) => {
3426
+ let n = Wl(e, t);
3427
+ return he(Gl, n), n;
3428
+ }, ql = {
3429
+ loader: {
3430
+ type: Object,
3431
+ required: !0
3432
+ },
3433
+ textAdapter: {
3434
+ type: Function,
3435
+ required: !1
3436
+ },
3437
+ annotationTransformer: {
3438
+ type: Object,
3439
+ required: !1,
3440
+ default: new mt()
3441
+ },
3442
+ watchQueryParams: {
3443
+ type: Boolean,
3444
+ default: !0,
3445
+ required: !1
3446
+ },
3447
+ sourceUris: {
3448
+ type: Array,
3449
+ required: !0
3450
+ },
3451
+ readonly: {
3452
+ type: Boolean,
3453
+ default: !1,
3454
+ required: !1
3455
+ },
3456
+ layout: {
3457
+ type: Object,
3458
+ required: !1,
3459
+ default: void 0
3460
+ }
3461
+ }, Jl = { class: "gap-2 flex flex-col" }, Yl = /* @__PURE__ */ E({
3462
+ __name: "SmartEditor",
3463
+ props: ql,
3464
+ setup(e) {
3465
+ let t = e, n = j(void 0), r = j(void 0), i = Te(), a = Ee(), o = Kl(t.loader, t.annotationTransformer), s = It();
3466
+ k(() => {
3467
+ if (!t.watchQueryParams) return;
3468
+ let { action: e, annotationId: a } = i.query;
3469
+ a && (n.value = a), e && (r.value = e);
3470
+ }), I(() => t.sourceUris, () => {
3471
+ o.setSourceUris(t.sourceUris);
3472
+ }, { immediate: !0 });
3473
+ let c = (e, n) => {
3474
+ if (!t.watchQueryParams) return;
3475
+ let r = { ...i.query };
3476
+ e ? r.annotationId = e.id : delete r.annotationId, n ? r.action = n : delete r.action, a.replace({ query: r });
3477
+ };
3478
+ return (e, i) => (A(), b(F(wr), {
3479
+ class: "_h-full",
3480
+ "width-left": 300
3481
+ }, {
3482
+ "left-drawer": L(() => [C("div", Jl, [T(va, {
3483
+ modelValue: F(o).selectedAnnotationTypes,
3484
+ "onUpdate:modelValue": i[0] ||= (e) => F(o).selectedAnnotationTypes = e,
3485
+ count: F(o).annotationsGroupedByPurpose
3486
+ }, null, 8, ["modelValue", "count"]), N(e.$slots, "annotation-menu")])]),
3487
+ default: L(() => [T(F(Er), { loading: F(o).loading || !t.loader.definitionsLoaded.value }, null, 8, ["loading"]), t.loader.definitionsLoaded.value ? (A(), b(F(_a), {
3488
+ key: 0,
3489
+ readonly: e.readonly,
3490
+ configuration: F(s).configuration,
3491
+ sources: F(o).sources,
3492
+ annotations: F(o).filteredAnnotations,
3493
+ "annotation-definitions": F(s).definitions,
3494
+ "text-adapter": e.textAdapter,
3495
+ "annotation-transformer": e.annotationTransformer,
3496
+ "selected-annotation-id": n.value,
3497
+ "selected-annotation-action": r.value,
3498
+ cols: 1,
3499
+ "modal-view": !1,
3500
+ layout: e.layout,
3501
+ "onSelect:annotation": c,
3502
+ "onDelete:annotation": F(o).reload,
3503
+ "onUpdate:annotation": F(o).reload,
3504
+ "onCreate:annotation": F(o).reload
3505
+ }, null, 8, [
3506
+ "readonly",
3507
+ "configuration",
3508
+ "sources",
3509
+ "annotations",
3510
+ "annotation-definitions",
3511
+ "text-adapter",
3512
+ "annotation-transformer",
3513
+ "selected-annotation-id",
3514
+ "selected-annotation-action",
3515
+ "layout",
3516
+ "onDelete:annotation",
3517
+ "onUpdate:annotation",
3518
+ "onCreate:annotation"
3519
+ ])) : x("", !0)]),
3520
+ _: 3
3521
+ }));
3522
+ }
3523
+ });
3524
+ //#endregion
3525
+ export { Lt as ANNOTATION_STATUS, R as AnnotationConfigSchema, yt as AnnotationDefinitionService, Sn as AnnotationDefinitionsStatusView, _a as AnnotationEditor, ya as AnnotationEditorLoader, va as AnnotationFilter, He as AnnotationJsonResourceSchema, Ve as AnnotationJsonResourceShape, Fe as AnnotationMetadataType, Je as AnnotationResourceSchema, Rt as AnnotationStatusRoutes, Qe as AnnotationStyleContextBuilder, Ze as AnnotationStyleType, Re as BASELINE_RESOURCE_VERSION, ze as CURRENT_RESOURCE_VERSION, Yl as SmartAnnotationEditor, ql as SmartEditorProperties, ke as SourceModelSchema, Oe as SourceTextSchema, ut as TransformAnnotationAdapter, Ue as annotationColumnDefinition, Pe as baseContextBuilder, Ae as buildGridStyle, Le as buildPrefix, Cn as configureApi, Ie as createAnnotationContext, Nt as createAnnotationDefinitionsState, $e as createAnnotationStyleBodyUnsafe, je as getPaneArea, wt as loadAnnotationDefinitionsFromConfigs, Ct as loadAnnotationDefinitionsFromGlob, Tt as loadAnnotationDefinitionsFromUrls, Ot as peekAnnotationDefinitionsState, Ft as provideAnnotationDefinitions, Ne as resolveConfig, It as useAnnotationDefinitions };