@docling/docling-components 0.0.4 → 0.0.5
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.
- package/dist/index.es.js +996 -0
- package/dist/index.js +15 -15
- package/dist/index.umd.js +140 -0
- package/package.json +2 -2
package/dist/index.es.js
ADDED
|
@@ -0,0 +1,996 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2019 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
+
*/
|
|
6
|
+
const z = globalThis, Q = z.ShadowRoot && (z.ShadyCSS === void 0 || z.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, X = Symbol(), et = /* @__PURE__ */ new WeakMap();
|
|
7
|
+
let dt = class {
|
|
8
|
+
constructor(t, e, s) {
|
|
9
|
+
if (this._$cssResult$ = !0, s !== X) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
|
|
10
|
+
this.cssText = t, this.t = e;
|
|
11
|
+
}
|
|
12
|
+
get styleSheet() {
|
|
13
|
+
let t = this.o;
|
|
14
|
+
const e = this.t;
|
|
15
|
+
if (Q && t === void 0) {
|
|
16
|
+
const s = e !== void 0 && e.length === 1;
|
|
17
|
+
s && (t = et.get(e)), t === void 0 && ((this.o = t = new CSSStyleSheet()).replaceSync(this.cssText), s && et.set(e, t));
|
|
18
|
+
}
|
|
19
|
+
return t;
|
|
20
|
+
}
|
|
21
|
+
toString() {
|
|
22
|
+
return this.cssText;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
const _t = (r) => new dt(typeof r == "string" ? r : r + "", void 0, X), ut = (r, ...t) => {
|
|
26
|
+
const e = r.length === 1 ? r[0] : t.reduce((s, i, o) => s + ((n) => {
|
|
27
|
+
if (n._$cssResult$ === !0) return n.cssText;
|
|
28
|
+
if (typeof n == "number") return n;
|
|
29
|
+
throw Error("Value passed to 'css' function must be a 'css' function result: " + n + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.");
|
|
30
|
+
})(i) + r[o + 1], r[0]);
|
|
31
|
+
return new dt(e, r, X);
|
|
32
|
+
}, yt = (r, t) => {
|
|
33
|
+
if (Q) r.adoptedStyleSheets = t.map((e) => e instanceof CSSStyleSheet ? e : e.styleSheet);
|
|
34
|
+
else for (const e of t) {
|
|
35
|
+
const s = document.createElement("style"), i = z.litNonce;
|
|
36
|
+
i !== void 0 && s.setAttribute("nonce", i), s.textContent = e.cssText, r.appendChild(s);
|
|
37
|
+
}
|
|
38
|
+
}, st = Q ? (r) => r : (r) => r instanceof CSSStyleSheet ? ((t) => {
|
|
39
|
+
let e = "";
|
|
40
|
+
for (const s of t.cssRules) e += s.cssText;
|
|
41
|
+
return _t(e);
|
|
42
|
+
})(r) : r;
|
|
43
|
+
/**
|
|
44
|
+
* @license
|
|
45
|
+
* Copyright 2017 Google LLC
|
|
46
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
47
|
+
*/
|
|
48
|
+
const { is: vt, defineProperty: At, getOwnPropertyDescriptor: bt, getOwnPropertyNames: wt, getOwnPropertySymbols: Et, getPrototypeOf: St } = Object, w = globalThis, it = w.trustedTypes, Pt = it ? it.emptyScript : "", F = w.reactiveElementPolyfillSupport, H = (r, t) => r, L = { toAttribute(r, t) {
|
|
49
|
+
switch (t) {
|
|
50
|
+
case Boolean:
|
|
51
|
+
r = r ? Pt : null;
|
|
52
|
+
break;
|
|
53
|
+
case Object:
|
|
54
|
+
case Array:
|
|
55
|
+
r = r == null ? r : JSON.stringify(r);
|
|
56
|
+
}
|
|
57
|
+
return r;
|
|
58
|
+
}, fromAttribute(r, t) {
|
|
59
|
+
let e = r;
|
|
60
|
+
switch (t) {
|
|
61
|
+
case Boolean:
|
|
62
|
+
e = r !== null;
|
|
63
|
+
break;
|
|
64
|
+
case Number:
|
|
65
|
+
e = r === null ? null : Number(r);
|
|
66
|
+
break;
|
|
67
|
+
case Object:
|
|
68
|
+
case Array:
|
|
69
|
+
try {
|
|
70
|
+
e = JSON.parse(r);
|
|
71
|
+
} catch {
|
|
72
|
+
e = null;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return e;
|
|
76
|
+
} }, B = (r, t) => !vt(r, t), rt = { attribute: !0, type: String, converter: L, reflect: !1, hasChanged: B };
|
|
77
|
+
Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")), w.litPropertyMetadata ?? (w.litPropertyMetadata = /* @__PURE__ */ new WeakMap());
|
|
78
|
+
class C extends HTMLElement {
|
|
79
|
+
static addInitializer(t) {
|
|
80
|
+
this._$Ei(), (this.l ?? (this.l = [])).push(t);
|
|
81
|
+
}
|
|
82
|
+
static get observedAttributes() {
|
|
83
|
+
return this.finalize(), this._$Eh && [...this._$Eh.keys()];
|
|
84
|
+
}
|
|
85
|
+
static createProperty(t, e = rt) {
|
|
86
|
+
if (e.state && (e.attribute = !1), this._$Ei(), this.elementProperties.set(t, e), !e.noAccessor) {
|
|
87
|
+
const s = Symbol(), i = this.getPropertyDescriptor(t, s, e);
|
|
88
|
+
i !== void 0 && At(this.prototype, t, i);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
static getPropertyDescriptor(t, e, s) {
|
|
92
|
+
const { get: i, set: o } = bt(this.prototype, t) ?? { get() {
|
|
93
|
+
return this[e];
|
|
94
|
+
}, set(n) {
|
|
95
|
+
this[e] = n;
|
|
96
|
+
} };
|
|
97
|
+
return { get() {
|
|
98
|
+
return i == null ? void 0 : i.call(this);
|
|
99
|
+
}, set(n) {
|
|
100
|
+
const c = i == null ? void 0 : i.call(this);
|
|
101
|
+
o.call(this, n), this.requestUpdate(t, c, s);
|
|
102
|
+
}, configurable: !0, enumerable: !0 };
|
|
103
|
+
}
|
|
104
|
+
static getPropertyOptions(t) {
|
|
105
|
+
return this.elementProperties.get(t) ?? rt;
|
|
106
|
+
}
|
|
107
|
+
static _$Ei() {
|
|
108
|
+
if (this.hasOwnProperty(H("elementProperties"))) return;
|
|
109
|
+
const t = St(this);
|
|
110
|
+
t.finalize(), t.l !== void 0 && (this.l = [...t.l]), this.elementProperties = new Map(t.elementProperties);
|
|
111
|
+
}
|
|
112
|
+
static finalize() {
|
|
113
|
+
if (this.hasOwnProperty(H("finalized"))) return;
|
|
114
|
+
if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(H("properties"))) {
|
|
115
|
+
const e = this.properties, s = [...wt(e), ...Et(e)];
|
|
116
|
+
for (const i of s) this.createProperty(i, e[i]);
|
|
117
|
+
}
|
|
118
|
+
const t = this[Symbol.metadata];
|
|
119
|
+
if (t !== null) {
|
|
120
|
+
const e = litPropertyMetadata.get(t);
|
|
121
|
+
if (e !== void 0) for (const [s, i] of e) this.elementProperties.set(s, i);
|
|
122
|
+
}
|
|
123
|
+
this._$Eh = /* @__PURE__ */ new Map();
|
|
124
|
+
for (const [e, s] of this.elementProperties) {
|
|
125
|
+
const i = this._$Eu(e, s);
|
|
126
|
+
i !== void 0 && this._$Eh.set(i, e);
|
|
127
|
+
}
|
|
128
|
+
this.elementStyles = this.finalizeStyles(this.styles);
|
|
129
|
+
}
|
|
130
|
+
static finalizeStyles(t) {
|
|
131
|
+
const e = [];
|
|
132
|
+
if (Array.isArray(t)) {
|
|
133
|
+
const s = new Set(t.flat(1 / 0).reverse());
|
|
134
|
+
for (const i of s) e.unshift(st(i));
|
|
135
|
+
} else t !== void 0 && e.push(st(t));
|
|
136
|
+
return e;
|
|
137
|
+
}
|
|
138
|
+
static _$Eu(t, e) {
|
|
139
|
+
const s = e.attribute;
|
|
140
|
+
return s === !1 ? void 0 : typeof s == "string" ? s : typeof t == "string" ? t.toLowerCase() : void 0;
|
|
141
|
+
}
|
|
142
|
+
constructor() {
|
|
143
|
+
super(), this._$Ep = void 0, this.isUpdatePending = !1, this.hasUpdated = !1, this._$Em = null, this._$Ev();
|
|
144
|
+
}
|
|
145
|
+
_$Ev() {
|
|
146
|
+
var t;
|
|
147
|
+
this._$ES = new Promise((e) => this.enableUpdating = e), this._$AL = /* @__PURE__ */ new Map(), this._$E_(), this.requestUpdate(), (t = this.constructor.l) == null || t.forEach((e) => e(this));
|
|
148
|
+
}
|
|
149
|
+
addController(t) {
|
|
150
|
+
var e;
|
|
151
|
+
(this._$EO ?? (this._$EO = /* @__PURE__ */ new Set())).add(t), this.renderRoot !== void 0 && this.isConnected && ((e = t.hostConnected) == null || e.call(t));
|
|
152
|
+
}
|
|
153
|
+
removeController(t) {
|
|
154
|
+
var e;
|
|
155
|
+
(e = this._$EO) == null || e.delete(t);
|
|
156
|
+
}
|
|
157
|
+
_$E_() {
|
|
158
|
+
const t = /* @__PURE__ */ new Map(), e = this.constructor.elementProperties;
|
|
159
|
+
for (const s of e.keys()) this.hasOwnProperty(s) && (t.set(s, this[s]), delete this[s]);
|
|
160
|
+
t.size > 0 && (this._$Ep = t);
|
|
161
|
+
}
|
|
162
|
+
createRenderRoot() {
|
|
163
|
+
const t = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
|
|
164
|
+
return yt(t, this.constructor.elementStyles), t;
|
|
165
|
+
}
|
|
166
|
+
connectedCallback() {
|
|
167
|
+
var t;
|
|
168
|
+
this.renderRoot ?? (this.renderRoot = this.createRenderRoot()), this.enableUpdating(!0), (t = this._$EO) == null || t.forEach((e) => {
|
|
169
|
+
var s;
|
|
170
|
+
return (s = e.hostConnected) == null ? void 0 : s.call(e);
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
enableUpdating(t) {
|
|
174
|
+
}
|
|
175
|
+
disconnectedCallback() {
|
|
176
|
+
var t;
|
|
177
|
+
(t = this._$EO) == null || t.forEach((e) => {
|
|
178
|
+
var s;
|
|
179
|
+
return (s = e.hostDisconnected) == null ? void 0 : s.call(e);
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
attributeChangedCallback(t, e, s) {
|
|
183
|
+
this._$AK(t, s);
|
|
184
|
+
}
|
|
185
|
+
_$EC(t, e) {
|
|
186
|
+
var o;
|
|
187
|
+
const s = this.constructor.elementProperties.get(t), i = this.constructor._$Eu(t, s);
|
|
188
|
+
if (i !== void 0 && s.reflect === !0) {
|
|
189
|
+
const n = (((o = s.converter) == null ? void 0 : o.toAttribute) !== void 0 ? s.converter : L).toAttribute(e, s.type);
|
|
190
|
+
this._$Em = t, n == null ? this.removeAttribute(i) : this.setAttribute(i, n), this._$Em = null;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
_$AK(t, e) {
|
|
194
|
+
var o;
|
|
195
|
+
const s = this.constructor, i = s._$Eh.get(t);
|
|
196
|
+
if (i !== void 0 && this._$Em !== i) {
|
|
197
|
+
const n = s.getPropertyOptions(i), c = typeof n.converter == "function" ? { fromAttribute: n.converter } : ((o = n.converter) == null ? void 0 : o.fromAttribute) !== void 0 ? n.converter : L;
|
|
198
|
+
this._$Em = i, this[i] = c.fromAttribute(e, n.type), this._$Em = null;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
requestUpdate(t, e, s) {
|
|
202
|
+
if (t !== void 0) {
|
|
203
|
+
if (s ?? (s = this.constructor.getPropertyOptions(t)), !(s.hasChanged ?? B)(this[t], e)) return;
|
|
204
|
+
this.P(t, e, s);
|
|
205
|
+
}
|
|
206
|
+
this.isUpdatePending === !1 && (this._$ES = this._$ET());
|
|
207
|
+
}
|
|
208
|
+
P(t, e, s) {
|
|
209
|
+
this._$AL.has(t) || this._$AL.set(t, e), s.reflect === !0 && this._$Em !== t && (this._$Ej ?? (this._$Ej = /* @__PURE__ */ new Set())).add(t);
|
|
210
|
+
}
|
|
211
|
+
async _$ET() {
|
|
212
|
+
this.isUpdatePending = !0;
|
|
213
|
+
try {
|
|
214
|
+
await this._$ES;
|
|
215
|
+
} catch (e) {
|
|
216
|
+
Promise.reject(e);
|
|
217
|
+
}
|
|
218
|
+
const t = this.scheduleUpdate();
|
|
219
|
+
return t != null && await t, !this.isUpdatePending;
|
|
220
|
+
}
|
|
221
|
+
scheduleUpdate() {
|
|
222
|
+
return this.performUpdate();
|
|
223
|
+
}
|
|
224
|
+
performUpdate() {
|
|
225
|
+
var s;
|
|
226
|
+
if (!this.isUpdatePending) return;
|
|
227
|
+
if (!this.hasUpdated) {
|
|
228
|
+
if (this.renderRoot ?? (this.renderRoot = this.createRenderRoot()), this._$Ep) {
|
|
229
|
+
for (const [o, n] of this._$Ep) this[o] = n;
|
|
230
|
+
this._$Ep = void 0;
|
|
231
|
+
}
|
|
232
|
+
const i = this.constructor.elementProperties;
|
|
233
|
+
if (i.size > 0) for (const [o, n] of i) n.wrapped !== !0 || this._$AL.has(o) || this[o] === void 0 || this.P(o, this[o], n);
|
|
234
|
+
}
|
|
235
|
+
let t = !1;
|
|
236
|
+
const e = this._$AL;
|
|
237
|
+
try {
|
|
238
|
+
t = this.shouldUpdate(e), t ? (this.willUpdate(e), (s = this._$EO) == null || s.forEach((i) => {
|
|
239
|
+
var o;
|
|
240
|
+
return (o = i.hostUpdate) == null ? void 0 : o.call(i);
|
|
241
|
+
}), this.update(e)) : this._$EU();
|
|
242
|
+
} catch (i) {
|
|
243
|
+
throw t = !1, this._$EU(), i;
|
|
244
|
+
}
|
|
245
|
+
t && this._$AE(e);
|
|
246
|
+
}
|
|
247
|
+
willUpdate(t) {
|
|
248
|
+
}
|
|
249
|
+
_$AE(t) {
|
|
250
|
+
var e;
|
|
251
|
+
(e = this._$EO) == null || e.forEach((s) => {
|
|
252
|
+
var i;
|
|
253
|
+
return (i = s.hostUpdated) == null ? void 0 : i.call(s);
|
|
254
|
+
}), this.hasUpdated || (this.hasUpdated = !0, this.firstUpdated(t)), this.updated(t);
|
|
255
|
+
}
|
|
256
|
+
_$EU() {
|
|
257
|
+
this._$AL = /* @__PURE__ */ new Map(), this.isUpdatePending = !1;
|
|
258
|
+
}
|
|
259
|
+
get updateComplete() {
|
|
260
|
+
return this.getUpdateComplete();
|
|
261
|
+
}
|
|
262
|
+
getUpdateComplete() {
|
|
263
|
+
return this._$ES;
|
|
264
|
+
}
|
|
265
|
+
shouldUpdate(t) {
|
|
266
|
+
return !0;
|
|
267
|
+
}
|
|
268
|
+
update(t) {
|
|
269
|
+
this._$Ej && (this._$Ej = this._$Ej.forEach((e) => this._$EC(e, this[e]))), this._$EU();
|
|
270
|
+
}
|
|
271
|
+
updated(t) {
|
|
272
|
+
}
|
|
273
|
+
firstUpdated(t) {
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
C.elementStyles = [], C.shadowRootOptions = { mode: "open" }, C[H("elementProperties")] = /* @__PURE__ */ new Map(), C[H("finalized")] = /* @__PURE__ */ new Map(), F == null || F({ ReactiveElement: C }), (w.reactiveElementVersions ?? (w.reactiveElementVersions = [])).push("2.0.4");
|
|
277
|
+
/**
|
|
278
|
+
* @license
|
|
279
|
+
* Copyright 2017 Google LLC
|
|
280
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
281
|
+
*/
|
|
282
|
+
const N = globalThis, q = N.trustedTypes, ot = q ? q.createPolicy("lit-html", { createHTML: (r) => r }) : void 0, ft = "$lit$", b = `lit$${Math.random().toFixed(9).slice(2)}$`, $t = "?" + b, xt = `<${$t}>`, P = document, k = () => P.createComment(""), M = (r) => r === null || typeof r != "object" && typeof r != "function", Y = Array.isArray, Ct = (r) => Y(r) || typeof (r == null ? void 0 : r[Symbol.iterator]) == "function", J = `[
|
|
283
|
+
\f\r]`, I = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, nt = /-->/g, ht = />/g, E = RegExp(`>|${J}(?:([^\\s"'>=/]+)(${J}*=${J}*(?:[^
|
|
284
|
+
\f\r"'\`<>=]|("|')|))|$)`, "g"), at = /'/g, ct = /"/g, mt = /^(?:script|style|textarea|title)$/i, Ut = (r) => (t, ...e) => ({ _$litType$: r, strings: t, values: e }), A = Ut(1), U = Symbol.for("lit-noChange"), $ = Symbol.for("lit-nothing"), lt = /* @__PURE__ */ new WeakMap(), S = P.createTreeWalker(P, 129);
|
|
285
|
+
function gt(r, t) {
|
|
286
|
+
if (!Y(r) || !r.hasOwnProperty("raw")) throw Error("invalid template strings array");
|
|
287
|
+
return ot !== void 0 ? ot.createHTML(t) : t;
|
|
288
|
+
}
|
|
289
|
+
const Tt = (r, t) => {
|
|
290
|
+
const e = r.length - 1, s = [];
|
|
291
|
+
let i, o = t === 2 ? "<svg>" : t === 3 ? "<math>" : "", n = I;
|
|
292
|
+
for (let c = 0; c < e; c++) {
|
|
293
|
+
const a = r[c];
|
|
294
|
+
let p, d, h = -1, l = 0;
|
|
295
|
+
for (; l < a.length && (n.lastIndex = l, d = n.exec(a), d !== null); ) l = n.lastIndex, n === I ? d[1] === "!--" ? n = nt : d[1] !== void 0 ? n = ht : d[2] !== void 0 ? (mt.test(d[2]) && (i = RegExp("</" + d[2], "g")), n = E) : d[3] !== void 0 && (n = E) : n === E ? d[0] === ">" ? (n = i ?? I, h = -1) : d[1] === void 0 ? h = -2 : (h = n.lastIndex - d[2].length, p = d[1], n = d[3] === void 0 ? E : d[3] === '"' ? ct : at) : n === ct || n === at ? n = E : n === nt || n === ht ? n = I : (n = E, i = void 0);
|
|
296
|
+
const u = n === E && r[c + 1].startsWith("/>") ? " " : "";
|
|
297
|
+
o += n === I ? a + xt : h >= 0 ? (s.push(p), a.slice(0, h) + ft + a.slice(h) + b + u) : a + b + (h === -2 ? c : u);
|
|
298
|
+
}
|
|
299
|
+
return [gt(r, o + (r[e] || "<?>") + (t === 2 ? "</svg>" : t === 3 ? "</math>" : "")), s];
|
|
300
|
+
};
|
|
301
|
+
class D {
|
|
302
|
+
constructor({ strings: t, _$litType$: e }, s) {
|
|
303
|
+
let i;
|
|
304
|
+
this.parts = [];
|
|
305
|
+
let o = 0, n = 0;
|
|
306
|
+
const c = t.length - 1, a = this.parts, [p, d] = Tt(t, e);
|
|
307
|
+
if (this.el = D.createElement(p, s), S.currentNode = this.el.content, e === 2 || e === 3) {
|
|
308
|
+
const h = this.el.content.firstChild;
|
|
309
|
+
h.replaceWith(...h.childNodes);
|
|
310
|
+
}
|
|
311
|
+
for (; (i = S.nextNode()) !== null && a.length < c; ) {
|
|
312
|
+
if (i.nodeType === 1) {
|
|
313
|
+
if (i.hasAttributes()) for (const h of i.getAttributeNames()) if (h.endsWith(ft)) {
|
|
314
|
+
const l = d[n++], u = i.getAttribute(h).split(b), m = /([.?@])?(.*)/.exec(l);
|
|
315
|
+
a.push({ type: 1, index: o, name: m[2], strings: u, ctor: m[1] === "." ? It : m[1] === "?" ? Ht : m[1] === "@" ? Nt : W }), i.removeAttribute(h);
|
|
316
|
+
} else h.startsWith(b) && (a.push({ type: 6, index: o }), i.removeAttribute(h));
|
|
317
|
+
if (mt.test(i.tagName)) {
|
|
318
|
+
const h = i.textContent.split(b), l = h.length - 1;
|
|
319
|
+
if (l > 0) {
|
|
320
|
+
i.textContent = q ? q.emptyScript : "";
|
|
321
|
+
for (let u = 0; u < l; u++) i.append(h[u], k()), S.nextNode(), a.push({ type: 2, index: ++o });
|
|
322
|
+
i.append(h[l], k());
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
} else if (i.nodeType === 8) if (i.data === $t) a.push({ type: 2, index: o });
|
|
326
|
+
else {
|
|
327
|
+
let h = -1;
|
|
328
|
+
for (; (h = i.data.indexOf(b, h + 1)) !== -1; ) a.push({ type: 7, index: o }), h += b.length - 1;
|
|
329
|
+
}
|
|
330
|
+
o++;
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
static createElement(t, e) {
|
|
334
|
+
const s = P.createElement("template");
|
|
335
|
+
return s.innerHTML = t, s;
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
function T(r, t, e = r, s) {
|
|
339
|
+
var n, c;
|
|
340
|
+
if (t === U) return t;
|
|
341
|
+
let i = s !== void 0 ? (n = e._$Co) == null ? void 0 : n[s] : e._$Cl;
|
|
342
|
+
const o = M(t) ? void 0 : t._$litDirective$;
|
|
343
|
+
return (i == null ? void 0 : i.constructor) !== o && ((c = i == null ? void 0 : i._$AO) == null || c.call(i, !1), o === void 0 ? i = void 0 : (i = new o(r), i._$AT(r, e, s)), s !== void 0 ? (e._$Co ?? (e._$Co = []))[s] = i : e._$Cl = i), i !== void 0 && (t = T(r, i._$AS(r, t.values), i, s)), t;
|
|
344
|
+
}
|
|
345
|
+
class Ot {
|
|
346
|
+
constructor(t, e) {
|
|
347
|
+
this._$AV = [], this._$AN = void 0, this._$AD = t, this._$AM = e;
|
|
348
|
+
}
|
|
349
|
+
get parentNode() {
|
|
350
|
+
return this._$AM.parentNode;
|
|
351
|
+
}
|
|
352
|
+
get _$AU() {
|
|
353
|
+
return this._$AM._$AU;
|
|
354
|
+
}
|
|
355
|
+
u(t) {
|
|
356
|
+
const { el: { content: e }, parts: s } = this._$AD, i = ((t == null ? void 0 : t.creationScope) ?? P).importNode(e, !0);
|
|
357
|
+
S.currentNode = i;
|
|
358
|
+
let o = S.nextNode(), n = 0, c = 0, a = s[0];
|
|
359
|
+
for (; a !== void 0; ) {
|
|
360
|
+
if (n === a.index) {
|
|
361
|
+
let p;
|
|
362
|
+
a.type === 2 ? p = new j(o, o.nextSibling, this, t) : a.type === 1 ? p = new a.ctor(o, a.name, a.strings, this, t) : a.type === 6 && (p = new Rt(o, this, t)), this._$AV.push(p), a = s[++c];
|
|
363
|
+
}
|
|
364
|
+
n !== (a == null ? void 0 : a.index) && (o = S.nextNode(), n++);
|
|
365
|
+
}
|
|
366
|
+
return S.currentNode = P, i;
|
|
367
|
+
}
|
|
368
|
+
p(t) {
|
|
369
|
+
let e = 0;
|
|
370
|
+
for (const s of this._$AV) s !== void 0 && (s.strings !== void 0 ? (s._$AI(t, s, e), e += s.strings.length - 2) : s._$AI(t[e])), e++;
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
class j {
|
|
374
|
+
get _$AU() {
|
|
375
|
+
var t;
|
|
376
|
+
return ((t = this._$AM) == null ? void 0 : t._$AU) ?? this._$Cv;
|
|
377
|
+
}
|
|
378
|
+
constructor(t, e, s, i) {
|
|
379
|
+
this.type = 2, this._$AH = $, this._$AN = void 0, this._$AA = t, this._$AB = e, this._$AM = s, this.options = i, this._$Cv = (i == null ? void 0 : i.isConnected) ?? !0;
|
|
380
|
+
}
|
|
381
|
+
get parentNode() {
|
|
382
|
+
let t = this._$AA.parentNode;
|
|
383
|
+
const e = this._$AM;
|
|
384
|
+
return e !== void 0 && (t == null ? void 0 : t.nodeType) === 11 && (t = e.parentNode), t;
|
|
385
|
+
}
|
|
386
|
+
get startNode() {
|
|
387
|
+
return this._$AA;
|
|
388
|
+
}
|
|
389
|
+
get endNode() {
|
|
390
|
+
return this._$AB;
|
|
391
|
+
}
|
|
392
|
+
_$AI(t, e = this) {
|
|
393
|
+
t = T(this, t, e), M(t) ? t === $ || t == null || t === "" ? (this._$AH !== $ && this._$AR(), this._$AH = $) : t !== this._$AH && t !== U && this._(t) : t._$litType$ !== void 0 ? this.$(t) : t.nodeType !== void 0 ? this.T(t) : Ct(t) ? this.k(t) : this._(t);
|
|
394
|
+
}
|
|
395
|
+
O(t) {
|
|
396
|
+
return this._$AA.parentNode.insertBefore(t, this._$AB);
|
|
397
|
+
}
|
|
398
|
+
T(t) {
|
|
399
|
+
this._$AH !== t && (this._$AR(), this._$AH = this.O(t));
|
|
400
|
+
}
|
|
401
|
+
_(t) {
|
|
402
|
+
this._$AH !== $ && M(this._$AH) ? this._$AA.nextSibling.data = t : this.T(P.createTextNode(t)), this._$AH = t;
|
|
403
|
+
}
|
|
404
|
+
$(t) {
|
|
405
|
+
var o;
|
|
406
|
+
const { values: e, _$litType$: s } = t, i = typeof s == "number" ? this._$AC(t) : (s.el === void 0 && (s.el = D.createElement(gt(s.h, s.h[0]), this.options)), s);
|
|
407
|
+
if (((o = this._$AH) == null ? void 0 : o._$AD) === i) this._$AH.p(e);
|
|
408
|
+
else {
|
|
409
|
+
const n = new Ot(i, this), c = n.u(this.options);
|
|
410
|
+
n.p(e), this.T(c), this._$AH = n;
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
_$AC(t) {
|
|
414
|
+
let e = lt.get(t.strings);
|
|
415
|
+
return e === void 0 && lt.set(t.strings, e = new D(t)), e;
|
|
416
|
+
}
|
|
417
|
+
k(t) {
|
|
418
|
+
Y(this._$AH) || (this._$AH = [], this._$AR());
|
|
419
|
+
const e = this._$AH;
|
|
420
|
+
let s, i = 0;
|
|
421
|
+
for (const o of t) i === e.length ? e.push(s = new j(this.O(k()), this.O(k()), this, this.options)) : s = e[i], s._$AI(o), i++;
|
|
422
|
+
i < e.length && (this._$AR(s && s._$AB.nextSibling, i), e.length = i);
|
|
423
|
+
}
|
|
424
|
+
_$AR(t = this._$AA.nextSibling, e) {
|
|
425
|
+
var s;
|
|
426
|
+
for ((s = this._$AP) == null ? void 0 : s.call(this, !1, !0, e); t && t !== this._$AB; ) {
|
|
427
|
+
const i = t.nextSibling;
|
|
428
|
+
t.remove(), t = i;
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
setConnected(t) {
|
|
432
|
+
var e;
|
|
433
|
+
this._$AM === void 0 && (this._$Cv = t, (e = this._$AP) == null || e.call(this, t));
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
class W {
|
|
437
|
+
get tagName() {
|
|
438
|
+
return this.element.tagName;
|
|
439
|
+
}
|
|
440
|
+
get _$AU() {
|
|
441
|
+
return this._$AM._$AU;
|
|
442
|
+
}
|
|
443
|
+
constructor(t, e, s, i, o) {
|
|
444
|
+
this.type = 1, this._$AH = $, this._$AN = void 0, this.element = t, this.name = e, this._$AM = i, this.options = o, s.length > 2 || s[0] !== "" || s[1] !== "" ? (this._$AH = Array(s.length - 1).fill(new String()), this.strings = s) : this._$AH = $;
|
|
445
|
+
}
|
|
446
|
+
_$AI(t, e = this, s, i) {
|
|
447
|
+
const o = this.strings;
|
|
448
|
+
let n = !1;
|
|
449
|
+
if (o === void 0) t = T(this, t, e, 0), n = !M(t) || t !== this._$AH && t !== U, n && (this._$AH = t);
|
|
450
|
+
else {
|
|
451
|
+
const c = t;
|
|
452
|
+
let a, p;
|
|
453
|
+
for (t = o[0], a = 0; a < o.length - 1; a++) p = T(this, c[s + a], e, a), p === U && (p = this._$AH[a]), n || (n = !M(p) || p !== this._$AH[a]), p === $ ? t = $ : t !== $ && (t += (p ?? "") + o[a + 1]), this._$AH[a] = p;
|
|
454
|
+
}
|
|
455
|
+
n && !i && this.j(t);
|
|
456
|
+
}
|
|
457
|
+
j(t) {
|
|
458
|
+
t === $ ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t ?? "");
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
class It extends W {
|
|
462
|
+
constructor() {
|
|
463
|
+
super(...arguments), this.type = 3;
|
|
464
|
+
}
|
|
465
|
+
j(t) {
|
|
466
|
+
this.element[this.name] = t === $ ? void 0 : t;
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
class Ht extends W {
|
|
470
|
+
constructor() {
|
|
471
|
+
super(...arguments), this.type = 4;
|
|
472
|
+
}
|
|
473
|
+
j(t) {
|
|
474
|
+
this.element.toggleAttribute(this.name, !!t && t !== $);
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
class Nt extends W {
|
|
478
|
+
constructor(t, e, s, i, o) {
|
|
479
|
+
super(t, e, s, i, o), this.type = 5;
|
|
480
|
+
}
|
|
481
|
+
_$AI(t, e = this) {
|
|
482
|
+
if ((t = T(this, t, e, 0) ?? $) === U) return;
|
|
483
|
+
const s = this._$AH, i = t === $ && s !== $ || t.capture !== s.capture || t.once !== s.once || t.passive !== s.passive, o = t !== $ && (s === $ || i);
|
|
484
|
+
i && this.element.removeEventListener(this.name, this, s), o && this.element.addEventListener(this.name, this, t), this._$AH = t;
|
|
485
|
+
}
|
|
486
|
+
handleEvent(t) {
|
|
487
|
+
var e;
|
|
488
|
+
typeof this._$AH == "function" ? this._$AH.call(((e = this.options) == null ? void 0 : e.host) ?? this.element, t) : this._$AH.handleEvent(t);
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
class Rt {
|
|
492
|
+
constructor(t, e, s) {
|
|
493
|
+
this.element = t, this.type = 6, this._$AN = void 0, this._$AM = e, this.options = s;
|
|
494
|
+
}
|
|
495
|
+
get _$AU() {
|
|
496
|
+
return this._$AM._$AU;
|
|
497
|
+
}
|
|
498
|
+
_$AI(t) {
|
|
499
|
+
T(this, t);
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
const K = N.litHtmlPolyfillSupport;
|
|
503
|
+
K == null || K(D, j), (N.litHtmlVersions ?? (N.litHtmlVersions = [])).push("3.2.1");
|
|
504
|
+
const kt = (r, t, e) => {
|
|
505
|
+
const s = (e == null ? void 0 : e.renderBefore) ?? t;
|
|
506
|
+
let i = s._$litPart$;
|
|
507
|
+
if (i === void 0) {
|
|
508
|
+
const o = (e == null ? void 0 : e.renderBefore) ?? null;
|
|
509
|
+
s._$litPart$ = i = new j(t.insertBefore(k(), o), o, void 0, e ?? {});
|
|
510
|
+
}
|
|
511
|
+
return i._$AI(r), i;
|
|
512
|
+
};
|
|
513
|
+
/**
|
|
514
|
+
* @license
|
|
515
|
+
* Copyright 2017 Google LLC
|
|
516
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
517
|
+
*/
|
|
518
|
+
let R = class extends C {
|
|
519
|
+
constructor() {
|
|
520
|
+
super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0;
|
|
521
|
+
}
|
|
522
|
+
createRenderRoot() {
|
|
523
|
+
var e;
|
|
524
|
+
const t = super.createRenderRoot();
|
|
525
|
+
return (e = this.renderOptions).renderBefore ?? (e.renderBefore = t.firstChild), t;
|
|
526
|
+
}
|
|
527
|
+
update(t) {
|
|
528
|
+
const e = this.render();
|
|
529
|
+
this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(t), this._$Do = kt(e, this.renderRoot, this.renderOptions);
|
|
530
|
+
}
|
|
531
|
+
connectedCallback() {
|
|
532
|
+
var t;
|
|
533
|
+
super.connectedCallback(), (t = this._$Do) == null || t.setConnected(!0);
|
|
534
|
+
}
|
|
535
|
+
disconnectedCallback() {
|
|
536
|
+
var t;
|
|
537
|
+
super.disconnectedCallback(), (t = this._$Do) == null || t.setConnected(!1);
|
|
538
|
+
}
|
|
539
|
+
render() {
|
|
540
|
+
return U;
|
|
541
|
+
}
|
|
542
|
+
};
|
|
543
|
+
var pt;
|
|
544
|
+
R._$litElement$ = !0, R.finalized = !0, (pt = globalThis.litElementHydrateSupport) == null || pt.call(globalThis, { LitElement: R });
|
|
545
|
+
const Z = globalThis.litElementPolyfillSupport;
|
|
546
|
+
Z == null || Z({ LitElement: R });
|
|
547
|
+
(globalThis.litElementVersions ?? (globalThis.litElementVersions = [])).push("4.1.1");
|
|
548
|
+
/**
|
|
549
|
+
* @license
|
|
550
|
+
* Copyright 2017 Google LLC
|
|
551
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
552
|
+
*/
|
|
553
|
+
const Mt = (r) => (t, e) => {
|
|
554
|
+
e !== void 0 ? e.addInitializer(() => {
|
|
555
|
+
customElements.define(r, t);
|
|
556
|
+
}) : customElements.define(r, t);
|
|
557
|
+
};
|
|
558
|
+
/**
|
|
559
|
+
* @license
|
|
560
|
+
* Copyright 2017 Google LLC
|
|
561
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
562
|
+
*/
|
|
563
|
+
const Dt = { attribute: !0, type: String, converter: L, reflect: !1, hasChanged: B }, jt = (r = Dt, t, e) => {
|
|
564
|
+
const { kind: s, metadata: i } = e;
|
|
565
|
+
let o = globalThis.litPropertyMetadata.get(i);
|
|
566
|
+
if (o === void 0 && globalThis.litPropertyMetadata.set(i, o = /* @__PURE__ */ new Map()), o.set(e.name, r), s === "accessor") {
|
|
567
|
+
const { name: n } = e;
|
|
568
|
+
return { set(c) {
|
|
569
|
+
const a = t.get.call(this);
|
|
570
|
+
t.set.call(this, c), this.requestUpdate(n, a, r);
|
|
571
|
+
}, init(c) {
|
|
572
|
+
return c !== void 0 && this.P(n, void 0, r), c;
|
|
573
|
+
} };
|
|
574
|
+
}
|
|
575
|
+
if (s === "setter") {
|
|
576
|
+
const { name: n } = e;
|
|
577
|
+
return function(c) {
|
|
578
|
+
const a = this[n];
|
|
579
|
+
t.call(this, c), this.requestUpdate(n, a, r);
|
|
580
|
+
};
|
|
581
|
+
}
|
|
582
|
+
throw Error("Unsupported decorator location: " + s);
|
|
583
|
+
};
|
|
584
|
+
function v(r) {
|
|
585
|
+
return (t, e) => typeof e == "object" ? jt(r, t, e) : ((s, i, o) => {
|
|
586
|
+
const n = i.hasOwnProperty(o);
|
|
587
|
+
return i.constructor.createProperty(o, n ? { ...s, wrapped: !0 } : s), n ? Object.getOwnPropertyDescriptor(i, o) : void 0;
|
|
588
|
+
})(r, t, e);
|
|
589
|
+
}
|
|
590
|
+
/**
|
|
591
|
+
* @license
|
|
592
|
+
* Copyright 2017 Google LLC
|
|
593
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
594
|
+
*/
|
|
595
|
+
const zt = Symbol();
|
|
596
|
+
class Lt {
|
|
597
|
+
get taskComplete() {
|
|
598
|
+
return this.t || (this.i === 1 ? this.t = new Promise((t, e) => {
|
|
599
|
+
this.o = t, this.h = e;
|
|
600
|
+
}) : this.i === 3 ? this.t = Promise.reject(this.l) : this.t = Promise.resolve(this.u)), this.t;
|
|
601
|
+
}
|
|
602
|
+
constructor(t, e, s) {
|
|
603
|
+
var o;
|
|
604
|
+
this.p = 0, this.i = 0, (this._ = t).addController(this);
|
|
605
|
+
const i = typeof e == "object" ? e : { task: e, args: s };
|
|
606
|
+
this.v = i.task, this.j = i.args, this.m = i.argsEqual ?? qt, this.k = i.onComplete, this.A = i.onError, this.autoRun = i.autoRun ?? !0, "initialValue" in i && (this.u = i.initialValue, this.i = 2, this.O = (o = this.T) == null ? void 0 : o.call(this));
|
|
607
|
+
}
|
|
608
|
+
hostUpdate() {
|
|
609
|
+
this.autoRun === !0 && this.S();
|
|
610
|
+
}
|
|
611
|
+
hostUpdated() {
|
|
612
|
+
this.autoRun === "afterUpdate" && this.S();
|
|
613
|
+
}
|
|
614
|
+
T() {
|
|
615
|
+
if (this.j === void 0) return;
|
|
616
|
+
const t = this.j();
|
|
617
|
+
if (!Array.isArray(t)) throw Error("The args function must return an array");
|
|
618
|
+
return t;
|
|
619
|
+
}
|
|
620
|
+
async S() {
|
|
621
|
+
const t = this.T(), e = this.O;
|
|
622
|
+
this.O = t, t === e || t === void 0 || e !== void 0 && this.m(e, t) || await this.run(t);
|
|
623
|
+
}
|
|
624
|
+
async run(t) {
|
|
625
|
+
var n, c, a, p, d;
|
|
626
|
+
let e, s;
|
|
627
|
+
t ?? (t = this.T()), this.O = t, this.i === 1 ? (n = this.q) == null || n.abort() : (this.t = void 0, this.o = void 0, this.h = void 0), this.i = 1, this.autoRun === "afterUpdate" ? queueMicrotask(() => this._.requestUpdate()) : this._.requestUpdate();
|
|
628
|
+
const i = ++this.p;
|
|
629
|
+
this.q = new AbortController();
|
|
630
|
+
let o = !1;
|
|
631
|
+
try {
|
|
632
|
+
e = await this.v(t, { signal: this.q.signal });
|
|
633
|
+
} catch (h) {
|
|
634
|
+
o = !0, s = h;
|
|
635
|
+
}
|
|
636
|
+
if (this.p === i) {
|
|
637
|
+
if (e === zt) this.i = 0;
|
|
638
|
+
else {
|
|
639
|
+
if (o === !1) {
|
|
640
|
+
try {
|
|
641
|
+
(c = this.k) == null || c.call(this, e);
|
|
642
|
+
} catch {
|
|
643
|
+
}
|
|
644
|
+
this.i = 2, (a = this.o) == null || a.call(this, e);
|
|
645
|
+
} else {
|
|
646
|
+
try {
|
|
647
|
+
(p = this.A) == null || p.call(this, s);
|
|
648
|
+
} catch {
|
|
649
|
+
}
|
|
650
|
+
this.i = 3, (d = this.h) == null || d.call(this, s);
|
|
651
|
+
}
|
|
652
|
+
this.u = e, this.l = s;
|
|
653
|
+
}
|
|
654
|
+
this._.requestUpdate();
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
abort(t) {
|
|
658
|
+
var e;
|
|
659
|
+
this.i === 1 && ((e = this.q) == null || e.abort(t));
|
|
660
|
+
}
|
|
661
|
+
get value() {
|
|
662
|
+
return this.u;
|
|
663
|
+
}
|
|
664
|
+
get error() {
|
|
665
|
+
return this.l;
|
|
666
|
+
}
|
|
667
|
+
get status() {
|
|
668
|
+
return this.i;
|
|
669
|
+
}
|
|
670
|
+
render(t) {
|
|
671
|
+
var e, s, i, o;
|
|
672
|
+
switch (this.i) {
|
|
673
|
+
case 0:
|
|
674
|
+
return (e = t.initial) == null ? void 0 : e.call(t);
|
|
675
|
+
case 1:
|
|
676
|
+
return (s = t.pending) == null ? void 0 : s.call(t);
|
|
677
|
+
case 2:
|
|
678
|
+
return (i = t.complete) == null ? void 0 : i.call(t, this.value);
|
|
679
|
+
case 3:
|
|
680
|
+
return (o = t.error) == null ? void 0 : o.call(t, this.error);
|
|
681
|
+
default:
|
|
682
|
+
throw Error("Unexpected status: " + this.i);
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
const qt = (r, t) => r === t || r.length === t.length && r.every((e, s) => !B(e, t[s]));
|
|
687
|
+
function x(...r) {
|
|
688
|
+
return function(t) {
|
|
689
|
+
return y.DocItem(t) && r.includes(t.label);
|
|
690
|
+
};
|
|
691
|
+
}
|
|
692
|
+
var Bt = {
|
|
693
|
+
CodeItem: x("code"),
|
|
694
|
+
ListItem: x("list_item"),
|
|
695
|
+
PictureItem: x("picture"),
|
|
696
|
+
SectionHeaderItem: x("section_header"),
|
|
697
|
+
TableItem: x("document_index", "table"),
|
|
698
|
+
TextItem: x(
|
|
699
|
+
"caption",
|
|
700
|
+
"checkbox_selected",
|
|
701
|
+
"checkbox_unselected",
|
|
702
|
+
"footnote",
|
|
703
|
+
"page_footer",
|
|
704
|
+
"page_header",
|
|
705
|
+
"paragraph",
|
|
706
|
+
"reference",
|
|
707
|
+
"text"
|
|
708
|
+
)
|
|
709
|
+
}, y = {
|
|
710
|
+
Document(r) {
|
|
711
|
+
return "schema_name" in r && r.schema_name === "DoclingDocument";
|
|
712
|
+
},
|
|
713
|
+
NodeItem(r) {
|
|
714
|
+
return "self_ref" in r;
|
|
715
|
+
},
|
|
716
|
+
GroupItem(r) {
|
|
717
|
+
return y.NodeItem(r) && (r.self_ref.startsWith("#/groups/") || r.self_ref === "#/body");
|
|
718
|
+
},
|
|
719
|
+
DocItem(r) {
|
|
720
|
+
return y.NodeItem(r) && !y.GroupItem(r);
|
|
721
|
+
},
|
|
722
|
+
...Bt
|
|
723
|
+
};
|
|
724
|
+
function* Wt(r, t = {}) {
|
|
725
|
+
r && (yield* e(t.root ?? r.body));
|
|
726
|
+
function* e(s, i = 0) {
|
|
727
|
+
var o;
|
|
728
|
+
if ((!y.GroupItem(s) || t.withGroups) && (y.DocItem(s) ? (t.pageNo === void 0 || (o = s.prov) != null && o.some((n) => n.page_no === t.pageNo)) && (yield [s, i]) : yield [s, i]), !(y.PictureItem(s) && !t.traversePictures))
|
|
729
|
+
for (const n of s.children ?? []) {
|
|
730
|
+
const c = Vt(r, n);
|
|
731
|
+
y.NodeItem(c) && (yield* e(c, i + 1));
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
}
|
|
735
|
+
function Vt(r, t) {
|
|
736
|
+
return t.$ref.split("/").slice(1).reduce(
|
|
737
|
+
(s, i) => s[i],
|
|
738
|
+
r
|
|
739
|
+
);
|
|
740
|
+
}
|
|
741
|
+
function Gt(r) {
|
|
742
|
+
return Object.values((r == null ? void 0 : r.pages) ?? {}).sort(
|
|
743
|
+
(t, e) => t.page_no - e.page_no
|
|
744
|
+
);
|
|
745
|
+
}
|
|
746
|
+
async function Ft(r, t = {}) {
|
|
747
|
+
var a, p, d;
|
|
748
|
+
let e;
|
|
749
|
+
typeof r == "string" ? e = await (await fetch(r)).json() : typeof r == "object" && y.Document(r) && (e = r);
|
|
750
|
+
const s = Gt(e), i = Array.from(Wt(e)).map(
|
|
751
|
+
([h]) => h
|
|
752
|
+
);
|
|
753
|
+
let o = i;
|
|
754
|
+
const n = /* @__PURE__ */ new Set();
|
|
755
|
+
if (typeof t.items == "string") {
|
|
756
|
+
const h = new Set(
|
|
757
|
+
t.items.split(",").map((l) => l.trim()).filter((l) => l.length > 0)
|
|
758
|
+
);
|
|
759
|
+
if (h.size > 0) {
|
|
760
|
+
o = [];
|
|
761
|
+
for (const l of i) {
|
|
762
|
+
const u = l.self_ref.split("/"), m = [];
|
|
763
|
+
for (let f = 2; f < u.length + 1; f++)
|
|
764
|
+
m.push(u.slice(0, f).join("/"));
|
|
765
|
+
(a = l.prov) == null || a.forEach((f) => m.push(`#/pages/${f.page_no}`)), m.some((f) => h.has(f)) ? o.push(l) : (p = l.prov) == null || p.forEach((f) => n.add(f.page_no));
|
|
766
|
+
}
|
|
767
|
+
}
|
|
768
|
+
} else if (Array.isArray(t.items)) {
|
|
769
|
+
o = [];
|
|
770
|
+
const h = new Set(t.items);
|
|
771
|
+
for (const l of i)
|
|
772
|
+
h.has(l) ? o.push(l) : (d = l.prov) == null || d.forEach((u) => n.add(u.page_no));
|
|
773
|
+
}
|
|
774
|
+
const c = {};
|
|
775
|
+
for (const h of s)
|
|
776
|
+
c[h.page_no] = [];
|
|
777
|
+
for (const h of o)
|
|
778
|
+
for (const l of h.prov ?? [])
|
|
779
|
+
c[l.page_no].push(h);
|
|
780
|
+
return s.map((h) => ({
|
|
781
|
+
page: h,
|
|
782
|
+
items: c[h.page_no],
|
|
783
|
+
trimmed: n.has(h.page_no)
|
|
784
|
+
}));
|
|
785
|
+
}
|
|
786
|
+
function Jt({
|
|
787
|
+
page: r,
|
|
788
|
+
items: t = [],
|
|
789
|
+
pagenumbers: e,
|
|
790
|
+
backdrop: s,
|
|
791
|
+
// tooltip,
|
|
792
|
+
itemPart: i,
|
|
793
|
+
itemStyle: o,
|
|
794
|
+
onclickitem: n
|
|
795
|
+
}) {
|
|
796
|
+
if (r.image) {
|
|
797
|
+
const { size: a } = r, { width: p = 1, height: d = 1 } = a, h = n ? (l, u) => n(l, r, u) : void 0;
|
|
798
|
+
return A`
|
|
799
|
+
<div part="page" class="page" @onclick=${(l) => h == null ? void 0 : h(l)} role="tab">
|
|
800
|
+
<svg width=${r.image.size.width} viewBox="0 0 ${p} ${d}">
|
|
801
|
+
<!-- Suppressed backdrop image. -->
|
|
802
|
+
${s ? A`
|
|
803
|
+
<image
|
|
804
|
+
class="backdrop"
|
|
805
|
+
href=${r.image.uri}
|
|
806
|
+
width=${p}
|
|
807
|
+
height=${d}
|
|
808
|
+
/>
|
|
809
|
+
|
|
810
|
+
<clippath id="clip-page-${r.page_no}">
|
|
811
|
+
${t.map((l) => {
|
|
812
|
+
var m;
|
|
813
|
+
const u = (m = l.prov) == null ? void 0 : m.find((f) => f.page_no === r.page_no);
|
|
814
|
+
if (u) {
|
|
815
|
+
const { l: f, r: V, t: O, b: G } = u.bbox;
|
|
816
|
+
return A`<rect
|
|
817
|
+
x=${f}
|
|
818
|
+
y=${d - O}
|
|
819
|
+
width=${V - f}
|
|
820
|
+
height=${O - G}
|
|
821
|
+
/>`;
|
|
822
|
+
}
|
|
823
|
+
})}
|
|
824
|
+
</clippath>
|
|
825
|
+
` : ""}
|
|
826
|
+
|
|
827
|
+
<!-- Foreground image. -->
|
|
828
|
+
<image
|
|
829
|
+
id="image"
|
|
830
|
+
href=${r.image.uri}
|
|
831
|
+
clip-path="url(#clip-page-${r.page_no})"
|
|
832
|
+
width=${p}
|
|
833
|
+
height${d}
|
|
834
|
+
/>
|
|
835
|
+
|
|
836
|
+
${t.map((l) => {
|
|
837
|
+
var m;
|
|
838
|
+
const u = (m = l.prov) == null ? void 0 : m.find((f) => f.page_no === r.page_no);
|
|
839
|
+
if (u) {
|
|
840
|
+
const { l: f, r: V, t: O, b: G } = u.bbox;
|
|
841
|
+
return A`<rect
|
|
842
|
+
part=${"item" + (i ? " " + i(r, l) : "")}
|
|
843
|
+
style=${o == null ? void 0 : o(r, l)}
|
|
844
|
+
x=${f}
|
|
845
|
+
y=${d - O}
|
|
846
|
+
width=${V - f}
|
|
847
|
+
height=${O - G}
|
|
848
|
+
vector-effect="non-scaling-stroke"
|
|
849
|
+
@onclick=${(tt) => {
|
|
850
|
+
tt.stopPropagation(), h == null || h(tt, l);
|
|
851
|
+
}}
|
|
852
|
+
@onmouseenter={(e: MouseEvent) => {
|
|
853
|
+
const bounds = e.currentTarget.getBoundingClientRect();
|
|
854
|
+
|
|
855
|
+
// Sizes of surrounding areas: Top, right, bottom, left.
|
|
856
|
+
const areas = [
|
|
857
|
+
bounds.top * window.innerWidth,
|
|
858
|
+
(window.innerWidth - bounds.right) * window.innerHeight,
|
|
859
|
+
(window.innerHeight - bounds.bottom) * window.innerWidth,
|
|
860
|
+
bounds.left * window.innerHeight,
|
|
861
|
+
];
|
|
862
|
+
const maxArea = Math.max(...areas);
|
|
863
|
+
const quadrant = areas.findIndex(a => a === maxArea);
|
|
864
|
+
|
|
865
|
+
hovered = {
|
|
866
|
+
item,
|
|
867
|
+
bounds,
|
|
868
|
+
quadrant,
|
|
869
|
+
};
|
|
870
|
+
}}
|
|
871
|
+
/>`;
|
|
872
|
+
}
|
|
873
|
+
})}
|
|
874
|
+
</svg>
|
|
875
|
+
|
|
876
|
+
${e ? A`<header
|
|
877
|
+
part="page-number-top"
|
|
878
|
+
class="page-number-top"
|
|
879
|
+
title="Page ${r.page_no}"
|
|
880
|
+
>
|
|
881
|
+
${r.page_no}
|
|
882
|
+
</header>
|
|
883
|
+
|
|
884
|
+
<header
|
|
885
|
+
part="page-number-bottom"
|
|
886
|
+
class="page-number-bottom"
|
|
887
|
+
title="Page ${r.page_no}"
|
|
888
|
+
>
|
|
889
|
+
${r.page_no}
|
|
890
|
+
</header>` : ""}
|
|
891
|
+
|
|
892
|
+
<!-- Tooltip. -->
|
|
893
|
+
${c()}
|
|
894
|
+
</div>
|
|
895
|
+
`;
|
|
896
|
+
} else
|
|
897
|
+
return A`Invalid page image.`;
|
|
898
|
+
function c() {
|
|
899
|
+
return "";
|
|
900
|
+
}
|
|
901
|
+
}
|
|
902
|
+
const Kt = ut`
|
|
903
|
+
.page {
|
|
904
|
+
width: fit-content;
|
|
905
|
+
max-width: 100%;
|
|
906
|
+
|
|
907
|
+
display: flex;
|
|
908
|
+
flex-direction: column;
|
|
909
|
+
align-items: center;
|
|
910
|
+
gap: 2px;
|
|
911
|
+
|
|
912
|
+
color: black;
|
|
913
|
+
}
|
|
914
|
+
`;
|
|
915
|
+
var Zt = Object.defineProperty, Qt = Object.getOwnPropertyDescriptor, _ = (r, t, e, s) => {
|
|
916
|
+
for (var i = s > 1 ? void 0 : s ? Qt(t, e) : t, o = r.length - 1, n; o >= 0; o--)
|
|
917
|
+
(n = r[o]) && (i = (s ? n(t, e, i) : n(i)) || i);
|
|
918
|
+
return s && i && Zt(t, e, i), i;
|
|
919
|
+
};
|
|
920
|
+
let g = class extends R {
|
|
921
|
+
constructor() {
|
|
922
|
+
super(...arguments), this.src = "", this.trim = "pages", this._fetchTask = new Lt(this, {
|
|
923
|
+
task: async ([r, t]) => Ft(r, { items: t }),
|
|
924
|
+
args: () => [this.src, this.items]
|
|
925
|
+
});
|
|
926
|
+
}
|
|
927
|
+
render() {
|
|
928
|
+
return this._fetchTask.render({
|
|
929
|
+
pending: () => A`<p>...</p>`,
|
|
930
|
+
complete: (r) => A`
|
|
931
|
+
<div part="paged">
|
|
932
|
+
${r.filter((t) => !this.trim || t.items.length > 0).map(
|
|
933
|
+
({ page: t, items: e }) => Jt({
|
|
934
|
+
page: t,
|
|
935
|
+
items: e,
|
|
936
|
+
pagenumbers: this.pagenumbers !== void 0,
|
|
937
|
+
backdrop: this.backdrop !== void 0,
|
|
938
|
+
itemPart: this.itemPart,
|
|
939
|
+
itemStyle: this.itemStyle,
|
|
940
|
+
onclickitem: this.onclickitem
|
|
941
|
+
})
|
|
942
|
+
)}
|
|
943
|
+
</div>
|
|
944
|
+
`
|
|
945
|
+
});
|
|
946
|
+
}
|
|
947
|
+
};
|
|
948
|
+
g.styles = [
|
|
949
|
+
ut`
|
|
950
|
+
div {
|
|
951
|
+
width: fit-content;
|
|
952
|
+
max-width: 100%;
|
|
953
|
+
|
|
954
|
+
display: flex;
|
|
955
|
+
flex-direction: column;
|
|
956
|
+
align-items: center;
|
|
957
|
+
gap: 2px;
|
|
958
|
+
|
|
959
|
+
color: black;
|
|
960
|
+
}
|
|
961
|
+
`,
|
|
962
|
+
Kt
|
|
963
|
+
];
|
|
964
|
+
_([
|
|
965
|
+
v()
|
|
966
|
+
], g.prototype, "alt", 2);
|
|
967
|
+
_([
|
|
968
|
+
v()
|
|
969
|
+
], g.prototype, "backdrop", 2);
|
|
970
|
+
_([
|
|
971
|
+
v()
|
|
972
|
+
], g.prototype, "items", 2);
|
|
973
|
+
_([
|
|
974
|
+
v()
|
|
975
|
+
], g.prototype, "pagenumbers", 2);
|
|
976
|
+
_([
|
|
977
|
+
v()
|
|
978
|
+
], g.prototype, "src", 2);
|
|
979
|
+
_([
|
|
980
|
+
v()
|
|
981
|
+
], g.prototype, "trim", 2);
|
|
982
|
+
_([
|
|
983
|
+
v()
|
|
984
|
+
], g.prototype, "itemPart", 2);
|
|
985
|
+
_([
|
|
986
|
+
v()
|
|
987
|
+
], g.prototype, "itemStyle", 2);
|
|
988
|
+
_([
|
|
989
|
+
v()
|
|
990
|
+
], g.prototype, "onclickitem", 2);
|
|
991
|
+
g = _([
|
|
992
|
+
Mt("docling-img")
|
|
993
|
+
], g);
|
|
994
|
+
export {
|
|
995
|
+
g as ImgPages
|
|
996
|
+
};
|