pdfjs-viewer-element 0.0.2 → 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.mjs +630 -0
- package/dist/index.umd.js +44 -0
- package/package.json +8 -5
- package/types/index.d.ts +1 -0
- package/types/index.ts +1 -0
- package/types/pdfjs-viewer-element.d.ts +12 -0
- package/dist/pdfjs-viewer-element.js +0 -39
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,630 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2019 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
+
*/
|
|
6
|
+
const N = window, V = N.ShadowRoot && (N.ShadyCSS === void 0 || N.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, W = Symbol(), K = /* @__PURE__ */ new WeakMap();
|
|
7
|
+
class nt {
|
|
8
|
+
constructor(t, e, i) {
|
|
9
|
+
if (this._$cssResult$ = !0, i !== W)
|
|
10
|
+
throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
|
|
11
|
+
this.cssText = t, this.t = e;
|
|
12
|
+
}
|
|
13
|
+
get styleSheet() {
|
|
14
|
+
let t = this.o;
|
|
15
|
+
const e = this.t;
|
|
16
|
+
if (V && t === void 0) {
|
|
17
|
+
const i = e !== void 0 && e.length === 1;
|
|
18
|
+
i && (t = K.get(e)), t === void 0 && ((this.o = t = new CSSStyleSheet()).replaceSync(this.cssText), i && K.set(e, t));
|
|
19
|
+
}
|
|
20
|
+
return t;
|
|
21
|
+
}
|
|
22
|
+
toString() {
|
|
23
|
+
return this.cssText;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
const dt = (n) => new nt(typeof n == "string" ? n : n + "", void 0, W), ct = (n, ...t) => {
|
|
27
|
+
const e = n.length === 1 ? n[0] : t.reduce((i, s, o) => i + ((r) => {
|
|
28
|
+
if (r._$cssResult$ === !0)
|
|
29
|
+
return r.cssText;
|
|
30
|
+
if (typeof r == "number")
|
|
31
|
+
return r;
|
|
32
|
+
throw Error("Value passed to 'css' function must be a 'css' function result: " + r + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.");
|
|
33
|
+
})(s) + n[o + 1], n[0]);
|
|
34
|
+
return new nt(e, n, W);
|
|
35
|
+
}, ut = (n, t) => {
|
|
36
|
+
V ? n.adoptedStyleSheets = t.map((e) => e instanceof CSSStyleSheet ? e : e.styleSheet) : t.forEach((e) => {
|
|
37
|
+
const i = document.createElement("style"), s = N.litNonce;
|
|
38
|
+
s !== void 0 && i.setAttribute("nonce", s), i.textContent = e.cssText, n.appendChild(i);
|
|
39
|
+
});
|
|
40
|
+
}, Z = V ? (n) => n : (n) => n instanceof CSSStyleSheet ? ((t) => {
|
|
41
|
+
let e = "";
|
|
42
|
+
for (const i of t.cssRules)
|
|
43
|
+
e += i.cssText;
|
|
44
|
+
return dt(e);
|
|
45
|
+
})(n) : n;
|
|
46
|
+
/**
|
|
47
|
+
* @license
|
|
48
|
+
* Copyright 2017 Google LLC
|
|
49
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
50
|
+
*/
|
|
51
|
+
var k;
|
|
52
|
+
const T = window, J = T.trustedTypes, pt = J ? J.emptyScript : "", F = T.reactiveElementPolyfillSupport, I = { toAttribute(n, t) {
|
|
53
|
+
switch (t) {
|
|
54
|
+
case Boolean:
|
|
55
|
+
n = n ? pt : null;
|
|
56
|
+
break;
|
|
57
|
+
case Object:
|
|
58
|
+
case Array:
|
|
59
|
+
n = n == null ? n : JSON.stringify(n);
|
|
60
|
+
}
|
|
61
|
+
return n;
|
|
62
|
+
}, fromAttribute(n, t) {
|
|
63
|
+
let e = n;
|
|
64
|
+
switch (t) {
|
|
65
|
+
case Boolean:
|
|
66
|
+
e = n !== null;
|
|
67
|
+
break;
|
|
68
|
+
case Number:
|
|
69
|
+
e = n === null ? null : Number(n);
|
|
70
|
+
break;
|
|
71
|
+
case Object:
|
|
72
|
+
case Array:
|
|
73
|
+
try {
|
|
74
|
+
e = JSON.parse(n);
|
|
75
|
+
} catch {
|
|
76
|
+
e = null;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return e;
|
|
80
|
+
} }, rt = (n, t) => t !== n && (t == t || n == n), L = { attribute: !0, type: String, converter: I, reflect: !1, hasChanged: rt };
|
|
81
|
+
class f extends HTMLElement {
|
|
82
|
+
constructor() {
|
|
83
|
+
super(), this._$Ei = /* @__PURE__ */ new Map(), this.isUpdatePending = !1, this.hasUpdated = !1, this._$El = null, this.u();
|
|
84
|
+
}
|
|
85
|
+
static addInitializer(t) {
|
|
86
|
+
var e;
|
|
87
|
+
(e = this.h) !== null && e !== void 0 || (this.h = []), this.h.push(t);
|
|
88
|
+
}
|
|
89
|
+
static get observedAttributes() {
|
|
90
|
+
this.finalize();
|
|
91
|
+
const t = [];
|
|
92
|
+
return this.elementProperties.forEach((e, i) => {
|
|
93
|
+
const s = this._$Ep(i, e);
|
|
94
|
+
s !== void 0 && (this._$Ev.set(s, i), t.push(s));
|
|
95
|
+
}), t;
|
|
96
|
+
}
|
|
97
|
+
static createProperty(t, e = L) {
|
|
98
|
+
if (e.state && (e.attribute = !1), this.finalize(), this.elementProperties.set(t, e), !e.noAccessor && !this.prototype.hasOwnProperty(t)) {
|
|
99
|
+
const i = typeof t == "symbol" ? Symbol() : "__" + t, s = this.getPropertyDescriptor(t, i, e);
|
|
100
|
+
s !== void 0 && Object.defineProperty(this.prototype, t, s);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
static getPropertyDescriptor(t, e, i) {
|
|
104
|
+
return { get() {
|
|
105
|
+
return this[e];
|
|
106
|
+
}, set(s) {
|
|
107
|
+
const o = this[t];
|
|
108
|
+
this[e] = s, this.requestUpdate(t, o, i);
|
|
109
|
+
}, configurable: !0, enumerable: !0 };
|
|
110
|
+
}
|
|
111
|
+
static getPropertyOptions(t) {
|
|
112
|
+
return this.elementProperties.get(t) || L;
|
|
113
|
+
}
|
|
114
|
+
static finalize() {
|
|
115
|
+
if (this.hasOwnProperty("finalized"))
|
|
116
|
+
return !1;
|
|
117
|
+
this.finalized = !0;
|
|
118
|
+
const t = Object.getPrototypeOf(this);
|
|
119
|
+
if (t.finalize(), this.elementProperties = new Map(t.elementProperties), this._$Ev = /* @__PURE__ */ new Map(), this.hasOwnProperty("properties")) {
|
|
120
|
+
const e = this.properties, i = [...Object.getOwnPropertyNames(e), ...Object.getOwnPropertySymbols(e)];
|
|
121
|
+
for (const s of i)
|
|
122
|
+
this.createProperty(s, e[s]);
|
|
123
|
+
}
|
|
124
|
+
return this.elementStyles = this.finalizeStyles(this.styles), !0;
|
|
125
|
+
}
|
|
126
|
+
static finalizeStyles(t) {
|
|
127
|
+
const e = [];
|
|
128
|
+
if (Array.isArray(t)) {
|
|
129
|
+
const i = new Set(t.flat(1 / 0).reverse());
|
|
130
|
+
for (const s of i)
|
|
131
|
+
e.unshift(Z(s));
|
|
132
|
+
} else
|
|
133
|
+
t !== void 0 && e.push(Z(t));
|
|
134
|
+
return e;
|
|
135
|
+
}
|
|
136
|
+
static _$Ep(t, e) {
|
|
137
|
+
const i = e.attribute;
|
|
138
|
+
return i === !1 ? void 0 : typeof i == "string" ? i : typeof t == "string" ? t.toLowerCase() : void 0;
|
|
139
|
+
}
|
|
140
|
+
u() {
|
|
141
|
+
var t;
|
|
142
|
+
this._$E_ = new Promise((e) => this.enableUpdating = e), this._$AL = /* @__PURE__ */ new Map(), this._$Eg(), this.requestUpdate(), (t = this.constructor.h) === null || t === void 0 || t.forEach((e) => e(this));
|
|
143
|
+
}
|
|
144
|
+
addController(t) {
|
|
145
|
+
var e, i;
|
|
146
|
+
((e = this._$ES) !== null && e !== void 0 ? e : this._$ES = []).push(t), this.renderRoot !== void 0 && this.isConnected && ((i = t.hostConnected) === null || i === void 0 || i.call(t));
|
|
147
|
+
}
|
|
148
|
+
removeController(t) {
|
|
149
|
+
var e;
|
|
150
|
+
(e = this._$ES) === null || e === void 0 || e.splice(this._$ES.indexOf(t) >>> 0, 1);
|
|
151
|
+
}
|
|
152
|
+
_$Eg() {
|
|
153
|
+
this.constructor.elementProperties.forEach((t, e) => {
|
|
154
|
+
this.hasOwnProperty(e) && (this._$Ei.set(e, this[e]), delete this[e]);
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
createRenderRoot() {
|
|
158
|
+
var t;
|
|
159
|
+
const e = (t = this.shadowRoot) !== null && t !== void 0 ? t : this.attachShadow(this.constructor.shadowRootOptions);
|
|
160
|
+
return ut(e, this.constructor.elementStyles), e;
|
|
161
|
+
}
|
|
162
|
+
connectedCallback() {
|
|
163
|
+
var t;
|
|
164
|
+
this.renderRoot === void 0 && (this.renderRoot = this.createRenderRoot()), this.enableUpdating(!0), (t = this._$ES) === null || t === void 0 || t.forEach((e) => {
|
|
165
|
+
var i;
|
|
166
|
+
return (i = e.hostConnected) === null || i === void 0 ? void 0 : i.call(e);
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
enableUpdating(t) {
|
|
170
|
+
}
|
|
171
|
+
disconnectedCallback() {
|
|
172
|
+
var t;
|
|
173
|
+
(t = this._$ES) === null || t === void 0 || t.forEach((e) => {
|
|
174
|
+
var i;
|
|
175
|
+
return (i = e.hostDisconnected) === null || i === void 0 ? void 0 : i.call(e);
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
attributeChangedCallback(t, e, i) {
|
|
179
|
+
this._$AK(t, i);
|
|
180
|
+
}
|
|
181
|
+
_$EO(t, e, i = L) {
|
|
182
|
+
var s;
|
|
183
|
+
const o = this.constructor._$Ep(t, i);
|
|
184
|
+
if (o !== void 0 && i.reflect === !0) {
|
|
185
|
+
const r = (((s = i.converter) === null || s === void 0 ? void 0 : s.toAttribute) !== void 0 ? i.converter : I).toAttribute(e, i.type);
|
|
186
|
+
this._$El = t, r == null ? this.removeAttribute(o) : this.setAttribute(o, r), this._$El = null;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
_$AK(t, e) {
|
|
190
|
+
var i;
|
|
191
|
+
const s = this.constructor, o = s._$Ev.get(t);
|
|
192
|
+
if (o !== void 0 && this._$El !== o) {
|
|
193
|
+
const r = s.getPropertyOptions(o), d = typeof r.converter == "function" ? { fromAttribute: r.converter } : ((i = r.converter) === null || i === void 0 ? void 0 : i.fromAttribute) !== void 0 ? r.converter : I;
|
|
194
|
+
this._$El = o, this[o] = d.fromAttribute(e, r.type), this._$El = null;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
requestUpdate(t, e, i) {
|
|
198
|
+
let s = !0;
|
|
199
|
+
t !== void 0 && (((i = i || this.constructor.getPropertyOptions(t)).hasChanged || rt)(this[t], e) ? (this._$AL.has(t) || this._$AL.set(t, e), i.reflect === !0 && this._$El !== t && (this._$EC === void 0 && (this._$EC = /* @__PURE__ */ new Map()), this._$EC.set(t, i))) : s = !1), !this.isUpdatePending && s && (this._$E_ = this._$Ej());
|
|
200
|
+
}
|
|
201
|
+
async _$Ej() {
|
|
202
|
+
this.isUpdatePending = !0;
|
|
203
|
+
try {
|
|
204
|
+
await this._$E_;
|
|
205
|
+
} catch (e) {
|
|
206
|
+
Promise.reject(e);
|
|
207
|
+
}
|
|
208
|
+
const t = this.scheduleUpdate();
|
|
209
|
+
return t != null && await t, !this.isUpdatePending;
|
|
210
|
+
}
|
|
211
|
+
scheduleUpdate() {
|
|
212
|
+
return this.performUpdate();
|
|
213
|
+
}
|
|
214
|
+
performUpdate() {
|
|
215
|
+
var t;
|
|
216
|
+
if (!this.isUpdatePending)
|
|
217
|
+
return;
|
|
218
|
+
this.hasUpdated, this._$Ei && (this._$Ei.forEach((s, o) => this[o] = s), this._$Ei = void 0);
|
|
219
|
+
let e = !1;
|
|
220
|
+
const i = this._$AL;
|
|
221
|
+
try {
|
|
222
|
+
e = this.shouldUpdate(i), e ? (this.willUpdate(i), (t = this._$ES) === null || t === void 0 || t.forEach((s) => {
|
|
223
|
+
var o;
|
|
224
|
+
return (o = s.hostUpdate) === null || o === void 0 ? void 0 : o.call(s);
|
|
225
|
+
}), this.update(i)) : this._$Ek();
|
|
226
|
+
} catch (s) {
|
|
227
|
+
throw e = !1, this._$Ek(), s;
|
|
228
|
+
}
|
|
229
|
+
e && this._$AE(i);
|
|
230
|
+
}
|
|
231
|
+
willUpdate(t) {
|
|
232
|
+
}
|
|
233
|
+
_$AE(t) {
|
|
234
|
+
var e;
|
|
235
|
+
(e = this._$ES) === null || e === void 0 || e.forEach((i) => {
|
|
236
|
+
var s;
|
|
237
|
+
return (s = i.hostUpdated) === null || s === void 0 ? void 0 : s.call(i);
|
|
238
|
+
}), this.hasUpdated || (this.hasUpdated = !0, this.firstUpdated(t)), this.updated(t);
|
|
239
|
+
}
|
|
240
|
+
_$Ek() {
|
|
241
|
+
this._$AL = /* @__PURE__ */ new Map(), this.isUpdatePending = !1;
|
|
242
|
+
}
|
|
243
|
+
get updateComplete() {
|
|
244
|
+
return this.getUpdateComplete();
|
|
245
|
+
}
|
|
246
|
+
getUpdateComplete() {
|
|
247
|
+
return this._$E_;
|
|
248
|
+
}
|
|
249
|
+
shouldUpdate(t) {
|
|
250
|
+
return !0;
|
|
251
|
+
}
|
|
252
|
+
update(t) {
|
|
253
|
+
this._$EC !== void 0 && (this._$EC.forEach((e, i) => this._$EO(i, this[i], e)), this._$EC = void 0), this._$Ek();
|
|
254
|
+
}
|
|
255
|
+
updated(t) {
|
|
256
|
+
}
|
|
257
|
+
firstUpdated(t) {
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
f.finalized = !0, f.elementProperties = /* @__PURE__ */ new Map(), f.elementStyles = [], f.shadowRootOptions = { mode: "open" }, F == null || F({ ReactiveElement: f }), ((k = T.reactiveElementVersions) !== null && k !== void 0 ? k : T.reactiveElementVersions = []).push("1.4.0");
|
|
261
|
+
/**
|
|
262
|
+
* @license
|
|
263
|
+
* Copyright 2017 Google LLC
|
|
264
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
265
|
+
*/
|
|
266
|
+
var z;
|
|
267
|
+
const R = window, m = R.trustedTypes, G = m ? m.createPolicy("lit-html", { createHTML: (n) => n }) : void 0, v = `lit$${(Math.random() + "").slice(9)}$`, ot = "?" + v, $t = `<${ot}>`, y = document, w = (n = "") => y.createComment(n), C = (n) => n === null || typeof n != "object" && typeof n != "function", lt = Array.isArray, vt = (n) => lt(n) || typeof (n == null ? void 0 : n[Symbol.iterator]) == "function", S = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, Q = /-->/g, X = />/g, _ = RegExp(`>|[
|
|
268
|
+
\f\r](?:([^\\s"'>=/]+)([
|
|
269
|
+
\f\r]*=[
|
|
270
|
+
\f\r]*(?:[^
|
|
271
|
+
\f\r"'\`<>=]|("|')|))|$)`, "g"), Y = /'/g, tt = /"/g, ht = /^(?:script|style|textarea|title)$/i, _t = (n) => (t, ...e) => ({ _$litType$: n, strings: t, values: e }), ft = _t(1), g = Symbol.for("lit-noChange"), u = Symbol.for("lit-nothing"), et = /* @__PURE__ */ new WeakMap(), At = (n, t, e) => {
|
|
272
|
+
var i, s;
|
|
273
|
+
const o = (i = e == null ? void 0 : e.renderBefore) !== null && i !== void 0 ? i : t;
|
|
274
|
+
let r = o._$litPart$;
|
|
275
|
+
if (r === void 0) {
|
|
276
|
+
const d = (s = e == null ? void 0 : e.renderBefore) !== null && s !== void 0 ? s : null;
|
|
277
|
+
o._$litPart$ = r = new U(t.insertBefore(w(), d), d, void 0, e != null ? e : {});
|
|
278
|
+
}
|
|
279
|
+
return r._$AI(n), r;
|
|
280
|
+
}, A = y.createTreeWalker(y, 129, null, !1), mt = (n, t) => {
|
|
281
|
+
const e = n.length - 1, i = [];
|
|
282
|
+
let s, o = t === 2 ? "<svg>" : "", r = S;
|
|
283
|
+
for (let l = 0; l < e; l++) {
|
|
284
|
+
const h = n[l];
|
|
285
|
+
let $, a, c = -1, p = 0;
|
|
286
|
+
for (; p < h.length && (r.lastIndex = p, a = r.exec(h), a !== null); )
|
|
287
|
+
p = r.lastIndex, r === S ? a[1] === "!--" ? r = Q : a[1] !== void 0 ? r = X : a[2] !== void 0 ? (ht.test(a[2]) && (s = RegExp("</" + a[2], "g")), r = _) : a[3] !== void 0 && (r = _) : r === _ ? a[0] === ">" ? (r = s != null ? s : S, c = -1) : a[1] === void 0 ? c = -2 : (c = r.lastIndex - a[2].length, $ = a[1], r = a[3] === void 0 ? _ : a[3] === '"' ? tt : Y) : r === tt || r === Y ? r = _ : r === Q || r === X ? r = S : (r = _, s = void 0);
|
|
288
|
+
const H = r === _ && n[l + 1].startsWith("/>") ? " " : "";
|
|
289
|
+
o += r === S ? h + $t : c >= 0 ? (i.push($), h.slice(0, c) + "$lit$" + h.slice(c) + v + H) : h + v + (c === -2 ? (i.push(void 0), l) : H);
|
|
290
|
+
}
|
|
291
|
+
const d = o + (n[e] || "<?>") + (t === 2 ? "</svg>" : "");
|
|
292
|
+
if (!Array.isArray(n) || !n.hasOwnProperty("raw"))
|
|
293
|
+
throw Error("invalid template strings array");
|
|
294
|
+
return [G !== void 0 ? G.createHTML(d) : d, i];
|
|
295
|
+
};
|
|
296
|
+
class P {
|
|
297
|
+
constructor({ strings: t, _$litType$: e }, i) {
|
|
298
|
+
let s;
|
|
299
|
+
this.parts = [];
|
|
300
|
+
let o = 0, r = 0;
|
|
301
|
+
const d = t.length - 1, l = this.parts, [h, $] = mt(t, e);
|
|
302
|
+
if (this.el = P.createElement(h, i), A.currentNode = this.el.content, e === 2) {
|
|
303
|
+
const a = this.el.content, c = a.firstChild;
|
|
304
|
+
c.remove(), a.append(...c.childNodes);
|
|
305
|
+
}
|
|
306
|
+
for (; (s = A.nextNode()) !== null && l.length < d; ) {
|
|
307
|
+
if (s.nodeType === 1) {
|
|
308
|
+
if (s.hasAttributes()) {
|
|
309
|
+
const a = [];
|
|
310
|
+
for (const c of s.getAttributeNames())
|
|
311
|
+
if (c.endsWith("$lit$") || c.startsWith(v)) {
|
|
312
|
+
const p = $[r++];
|
|
313
|
+
if (a.push(c), p !== void 0) {
|
|
314
|
+
const H = s.getAttribute(p.toLowerCase() + "$lit$").split(v), O = /([.?@])?(.*)/.exec(p);
|
|
315
|
+
l.push({ type: 1, index: o, name: O[2], strings: H, ctor: O[1] === "." ? gt : O[1] === "?" ? St : O[1] === "@" ? bt : M });
|
|
316
|
+
} else
|
|
317
|
+
l.push({ type: 6, index: o });
|
|
318
|
+
}
|
|
319
|
+
for (const c of a)
|
|
320
|
+
s.removeAttribute(c);
|
|
321
|
+
}
|
|
322
|
+
if (ht.test(s.tagName)) {
|
|
323
|
+
const a = s.textContent.split(v), c = a.length - 1;
|
|
324
|
+
if (c > 0) {
|
|
325
|
+
s.textContent = m ? m.emptyScript : "";
|
|
326
|
+
for (let p = 0; p < c; p++)
|
|
327
|
+
s.append(a[p], w()), A.nextNode(), l.push({ type: 2, index: ++o });
|
|
328
|
+
s.append(a[c], w());
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
} else if (s.nodeType === 8)
|
|
332
|
+
if (s.data === ot)
|
|
333
|
+
l.push({ type: 2, index: o });
|
|
334
|
+
else {
|
|
335
|
+
let a = -1;
|
|
336
|
+
for (; (a = s.data.indexOf(v, a + 1)) !== -1; )
|
|
337
|
+
l.push({ type: 7, index: o }), a += v.length - 1;
|
|
338
|
+
}
|
|
339
|
+
o++;
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
static createElement(t, e) {
|
|
343
|
+
const i = y.createElement("template");
|
|
344
|
+
return i.innerHTML = t, i;
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
function E(n, t, e = n, i) {
|
|
348
|
+
var s, o, r, d;
|
|
349
|
+
if (t === g)
|
|
350
|
+
return t;
|
|
351
|
+
let l = i !== void 0 ? (s = e._$Cl) === null || s === void 0 ? void 0 : s[i] : e._$Cu;
|
|
352
|
+
const h = C(t) ? void 0 : t._$litDirective$;
|
|
353
|
+
return (l == null ? void 0 : l.constructor) !== h && ((o = l == null ? void 0 : l._$AO) === null || o === void 0 || o.call(l, !1), h === void 0 ? l = void 0 : (l = new h(n), l._$AT(n, e, i)), i !== void 0 ? ((r = (d = e)._$Cl) !== null && r !== void 0 ? r : d._$Cl = [])[i] = l : e._$Cu = l), l !== void 0 && (t = E(n, l._$AS(n, t.values), l, i)), t;
|
|
354
|
+
}
|
|
355
|
+
class yt {
|
|
356
|
+
constructor(t, e) {
|
|
357
|
+
this.v = [], this._$AN = void 0, this._$AD = t, this._$AM = e;
|
|
358
|
+
}
|
|
359
|
+
get parentNode() {
|
|
360
|
+
return this._$AM.parentNode;
|
|
361
|
+
}
|
|
362
|
+
get _$AU() {
|
|
363
|
+
return this._$AM._$AU;
|
|
364
|
+
}
|
|
365
|
+
p(t) {
|
|
366
|
+
var e;
|
|
367
|
+
const { el: { content: i }, parts: s } = this._$AD, o = ((e = t == null ? void 0 : t.creationScope) !== null && e !== void 0 ? e : y).importNode(i, !0);
|
|
368
|
+
A.currentNode = o;
|
|
369
|
+
let r = A.nextNode(), d = 0, l = 0, h = s[0];
|
|
370
|
+
for (; h !== void 0; ) {
|
|
371
|
+
if (d === h.index) {
|
|
372
|
+
let $;
|
|
373
|
+
h.type === 2 ? $ = new U(r, r.nextSibling, this, t) : h.type === 1 ? $ = new h.ctor(r, h.name, h.strings, this, t) : h.type === 6 && ($ = new wt(r, this, t)), this.v.push($), h = s[++l];
|
|
374
|
+
}
|
|
375
|
+
d !== (h == null ? void 0 : h.index) && (r = A.nextNode(), d++);
|
|
376
|
+
}
|
|
377
|
+
return o;
|
|
378
|
+
}
|
|
379
|
+
m(t) {
|
|
380
|
+
let e = 0;
|
|
381
|
+
for (const i of this.v)
|
|
382
|
+
i !== void 0 && (i.strings !== void 0 ? (i._$AI(t, i, e), e += i.strings.length - 2) : i._$AI(t[e])), e++;
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
class U {
|
|
386
|
+
constructor(t, e, i, s) {
|
|
387
|
+
var o;
|
|
388
|
+
this.type = 2, this._$AH = u, this._$AN = void 0, this._$AA = t, this._$AB = e, this._$AM = i, this.options = s, this._$C_ = (o = s == null ? void 0 : s.isConnected) === null || o === void 0 || o;
|
|
389
|
+
}
|
|
390
|
+
get _$AU() {
|
|
391
|
+
var t, e;
|
|
392
|
+
return (e = (t = this._$AM) === null || t === void 0 ? void 0 : t._$AU) !== null && e !== void 0 ? e : this._$C_;
|
|
393
|
+
}
|
|
394
|
+
get parentNode() {
|
|
395
|
+
let t = this._$AA.parentNode;
|
|
396
|
+
const e = this._$AM;
|
|
397
|
+
return e !== void 0 && t.nodeType === 11 && (t = e.parentNode), t;
|
|
398
|
+
}
|
|
399
|
+
get startNode() {
|
|
400
|
+
return this._$AA;
|
|
401
|
+
}
|
|
402
|
+
get endNode() {
|
|
403
|
+
return this._$AB;
|
|
404
|
+
}
|
|
405
|
+
_$AI(t, e = this) {
|
|
406
|
+
t = E(this, t, e), C(t) ? t === u || t == null || t === "" ? (this._$AH !== u && this._$AR(), this._$AH = u) : t !== this._$AH && t !== g && this.$(t) : t._$litType$ !== void 0 ? this.T(t) : t.nodeType !== void 0 ? this.k(t) : vt(t) ? this.O(t) : this.$(t);
|
|
407
|
+
}
|
|
408
|
+
S(t, e = this._$AB) {
|
|
409
|
+
return this._$AA.parentNode.insertBefore(t, e);
|
|
410
|
+
}
|
|
411
|
+
k(t) {
|
|
412
|
+
this._$AH !== t && (this._$AR(), this._$AH = this.S(t));
|
|
413
|
+
}
|
|
414
|
+
$(t) {
|
|
415
|
+
this._$AH !== u && C(this._$AH) ? this._$AA.nextSibling.data = t : this.k(y.createTextNode(t)), this._$AH = t;
|
|
416
|
+
}
|
|
417
|
+
T(t) {
|
|
418
|
+
var e;
|
|
419
|
+
const { values: i, _$litType$: s } = t, o = typeof s == "number" ? this._$AC(t) : (s.el === void 0 && (s.el = P.createElement(s.h, this.options)), s);
|
|
420
|
+
if (((e = this._$AH) === null || e === void 0 ? void 0 : e._$AD) === o)
|
|
421
|
+
this._$AH.m(i);
|
|
422
|
+
else {
|
|
423
|
+
const r = new yt(o, this), d = r.p(this.options);
|
|
424
|
+
r.m(i), this.k(d), this._$AH = r;
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
_$AC(t) {
|
|
428
|
+
let e = et.get(t.strings);
|
|
429
|
+
return e === void 0 && et.set(t.strings, e = new P(t)), e;
|
|
430
|
+
}
|
|
431
|
+
O(t) {
|
|
432
|
+
lt(this._$AH) || (this._$AH = [], this._$AR());
|
|
433
|
+
const e = this._$AH;
|
|
434
|
+
let i, s = 0;
|
|
435
|
+
for (const o of t)
|
|
436
|
+
s === e.length ? e.push(i = new U(this.S(w()), this.S(w()), this, this.options)) : i = e[s], i._$AI(o), s++;
|
|
437
|
+
s < e.length && (this._$AR(i && i._$AB.nextSibling, s), e.length = s);
|
|
438
|
+
}
|
|
439
|
+
_$AR(t = this._$AA.nextSibling, e) {
|
|
440
|
+
var i;
|
|
441
|
+
for ((i = this._$AP) === null || i === void 0 || i.call(this, !1, !0, e); t && t !== this._$AB; ) {
|
|
442
|
+
const s = t.nextSibling;
|
|
443
|
+
t.remove(), t = s;
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
setConnected(t) {
|
|
447
|
+
var e;
|
|
448
|
+
this._$AM === void 0 && (this._$C_ = t, (e = this._$AP) === null || e === void 0 || e.call(this, t));
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
class M {
|
|
452
|
+
constructor(t, e, i, s, o) {
|
|
453
|
+
this.type = 1, this._$AH = u, this._$AN = void 0, this.element = t, this.name = e, this._$AM = s, this.options = o, i.length > 2 || i[0] !== "" || i[1] !== "" ? (this._$AH = Array(i.length - 1).fill(new String()), this.strings = i) : this._$AH = u;
|
|
454
|
+
}
|
|
455
|
+
get tagName() {
|
|
456
|
+
return this.element.tagName;
|
|
457
|
+
}
|
|
458
|
+
get _$AU() {
|
|
459
|
+
return this._$AM._$AU;
|
|
460
|
+
}
|
|
461
|
+
_$AI(t, e = this, i, s) {
|
|
462
|
+
const o = this.strings;
|
|
463
|
+
let r = !1;
|
|
464
|
+
if (o === void 0)
|
|
465
|
+
t = E(this, t, e, 0), r = !C(t) || t !== this._$AH && t !== g, r && (this._$AH = t);
|
|
466
|
+
else {
|
|
467
|
+
const d = t;
|
|
468
|
+
let l, h;
|
|
469
|
+
for (t = o[0], l = 0; l < o.length - 1; l++)
|
|
470
|
+
h = E(this, d[i + l], e, l), h === g && (h = this._$AH[l]), r || (r = !C(h) || h !== this._$AH[l]), h === u ? t = u : t !== u && (t += (h != null ? h : "") + o[l + 1]), this._$AH[l] = h;
|
|
471
|
+
}
|
|
472
|
+
r && !s && this.P(t);
|
|
473
|
+
}
|
|
474
|
+
P(t) {
|
|
475
|
+
t === u ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t != null ? t : "");
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
class gt extends M {
|
|
479
|
+
constructor() {
|
|
480
|
+
super(...arguments), this.type = 3;
|
|
481
|
+
}
|
|
482
|
+
P(t) {
|
|
483
|
+
this.element[this.name] = t === u ? void 0 : t;
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
const Et = m ? m.emptyScript : "";
|
|
487
|
+
class St extends M {
|
|
488
|
+
constructor() {
|
|
489
|
+
super(...arguments), this.type = 4;
|
|
490
|
+
}
|
|
491
|
+
P(t) {
|
|
492
|
+
t && t !== u ? this.element.setAttribute(this.name, Et) : this.element.removeAttribute(this.name);
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
class bt extends M {
|
|
496
|
+
constructor(t, e, i, s, o) {
|
|
497
|
+
super(t, e, i, s, o), this.type = 5;
|
|
498
|
+
}
|
|
499
|
+
_$AI(t, e = this) {
|
|
500
|
+
var i;
|
|
501
|
+
if ((t = (i = E(this, t, e, 0)) !== null && i !== void 0 ? i : u) === g)
|
|
502
|
+
return;
|
|
503
|
+
const s = this._$AH, o = t === u && s !== u || t.capture !== s.capture || t.once !== s.once || t.passive !== s.passive, r = t !== u && (s === u || o);
|
|
504
|
+
o && this.element.removeEventListener(this.name, this, s), r && this.element.addEventListener(this.name, this, t), this._$AH = t;
|
|
505
|
+
}
|
|
506
|
+
handleEvent(t) {
|
|
507
|
+
var e, i;
|
|
508
|
+
typeof this._$AH == "function" ? this._$AH.call((i = (e = this.options) === null || e === void 0 ? void 0 : e.host) !== null && i !== void 0 ? i : this.element, t) : this._$AH.handleEvent(t);
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
class wt {
|
|
512
|
+
constructor(t, e, i) {
|
|
513
|
+
this.element = t, this.type = 6, this._$AN = void 0, this._$AM = e, this.options = i;
|
|
514
|
+
}
|
|
515
|
+
get _$AU() {
|
|
516
|
+
return this._$AM._$AU;
|
|
517
|
+
}
|
|
518
|
+
_$AI(t) {
|
|
519
|
+
E(this, t);
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
const it = R.litHtmlPolyfillSupport;
|
|
523
|
+
it == null || it(P, U), ((z = R.litHtmlVersions) !== null && z !== void 0 ? z : R.litHtmlVersions = []).push("2.3.0");
|
|
524
|
+
/**
|
|
525
|
+
* @license
|
|
526
|
+
* Copyright 2017 Google LLC
|
|
527
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
528
|
+
*/
|
|
529
|
+
var j, D;
|
|
530
|
+
class b extends f {
|
|
531
|
+
constructor() {
|
|
532
|
+
super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0;
|
|
533
|
+
}
|
|
534
|
+
createRenderRoot() {
|
|
535
|
+
var t, e;
|
|
536
|
+
const i = super.createRenderRoot();
|
|
537
|
+
return (t = (e = this.renderOptions).renderBefore) !== null && t !== void 0 || (e.renderBefore = i.firstChild), i;
|
|
538
|
+
}
|
|
539
|
+
update(t) {
|
|
540
|
+
const e = this.render();
|
|
541
|
+
this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(t), this._$Do = At(e, this.renderRoot, this.renderOptions);
|
|
542
|
+
}
|
|
543
|
+
connectedCallback() {
|
|
544
|
+
var t;
|
|
545
|
+
super.connectedCallback(), (t = this._$Do) === null || t === void 0 || t.setConnected(!0);
|
|
546
|
+
}
|
|
547
|
+
disconnectedCallback() {
|
|
548
|
+
var t;
|
|
549
|
+
super.disconnectedCallback(), (t = this._$Do) === null || t === void 0 || t.setConnected(!1);
|
|
550
|
+
}
|
|
551
|
+
render() {
|
|
552
|
+
return g;
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
b.finalized = !0, b._$litElement$ = !0, (j = globalThis.litElementHydrateSupport) === null || j === void 0 || j.call(globalThis, { LitElement: b });
|
|
556
|
+
const st = globalThis.litElementPolyfillSupport;
|
|
557
|
+
st == null || st({ LitElement: b });
|
|
558
|
+
((D = globalThis.litElementVersions) !== null && D !== void 0 ? D : globalThis.litElementVersions = []).push("3.2.2");
|
|
559
|
+
/**
|
|
560
|
+
* @license
|
|
561
|
+
* Copyright 2017 Google LLC
|
|
562
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
563
|
+
*/
|
|
564
|
+
const Ct = (n) => (t) => typeof t == "function" ? ((e, i) => (customElements.define(e, i), i))(n, t) : ((e, i) => {
|
|
565
|
+
const { kind: s, elements: o } = i;
|
|
566
|
+
return { kind: s, elements: o, finisher(r) {
|
|
567
|
+
customElements.define(e, r);
|
|
568
|
+
} };
|
|
569
|
+
})(n, t);
|
|
570
|
+
/**
|
|
571
|
+
* @license
|
|
572
|
+
* Copyright 2017 Google LLC
|
|
573
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
574
|
+
*/
|
|
575
|
+
const Pt = (n, t) => t.kind === "method" && t.descriptor && !("value" in t.descriptor) ? { ...t, finisher(e) {
|
|
576
|
+
e.createProperty(t.key, n);
|
|
577
|
+
} } : { kind: "field", key: Symbol(), placement: "own", descriptor: {}, originalKey: t.key, initializer() {
|
|
578
|
+
typeof t.initializer == "function" && (this[t.key] = t.initializer.call(this));
|
|
579
|
+
}, finisher(e) {
|
|
580
|
+
e.createProperty(t.key, n);
|
|
581
|
+
} };
|
|
582
|
+
function at(n) {
|
|
583
|
+
return (t, e) => e !== void 0 ? ((i, s, o) => {
|
|
584
|
+
s.constructor.createProperty(o, i);
|
|
585
|
+
})(n, t, e) : Pt(n, t);
|
|
586
|
+
}
|
|
587
|
+
/**
|
|
588
|
+
* @license
|
|
589
|
+
* Copyright 2021 Google LLC
|
|
590
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
591
|
+
*/
|
|
592
|
+
var B;
|
|
593
|
+
((B = window.HTMLSlotElement) === null || B === void 0 ? void 0 : B.prototype.assignedElements) != null;
|
|
594
|
+
var xt = Object.defineProperty, Ut = Object.getOwnPropertyDescriptor, q = (n, t, e, i) => {
|
|
595
|
+
for (var s = i > 1 ? void 0 : i ? Ut(t, e) : t, o = n.length - 1, r; o >= 0; o--)
|
|
596
|
+
(r = n[o]) && (s = (i ? r(t, e, s) : r(s)) || s);
|
|
597
|
+
return i && s && xt(t, e, s), s;
|
|
598
|
+
};
|
|
599
|
+
let x = class extends b {
|
|
600
|
+
constructor() {
|
|
601
|
+
super(...arguments), this.src = "", this.height = "600px";
|
|
602
|
+
}
|
|
603
|
+
render() {
|
|
604
|
+
return ft`
|
|
605
|
+
<iframe
|
|
606
|
+
frameborder="0"
|
|
607
|
+
width="100%"
|
|
608
|
+
style="height: ${this.height}"
|
|
609
|
+
src="/pdfjs-2.15.349-dist/web/viewer.html?file=${this.src}"
|
|
610
|
+
>
|
|
611
|
+
`;
|
|
612
|
+
}
|
|
613
|
+
};
|
|
614
|
+
x.styles = ct`
|
|
615
|
+
:host {
|
|
616
|
+
width: 100%
|
|
617
|
+
}
|
|
618
|
+
`;
|
|
619
|
+
q([
|
|
620
|
+
at()
|
|
621
|
+
], x.prototype, "src", 2);
|
|
622
|
+
q([
|
|
623
|
+
at()
|
|
624
|
+
], x.prototype, "height", 2);
|
|
625
|
+
x = q([
|
|
626
|
+
Ct("pdfjs-viewer-element")
|
|
627
|
+
], x);
|
|
628
|
+
export {
|
|
629
|
+
x as PdfjsViewerElement
|
|
630
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
(function(p,_){typeof exports=="object"&&typeof module<"u"?_(exports):typeof define=="function"&&define.amd?define(["exports"],_):(p=typeof globalThis<"u"?globalThis:p||self,_(p.PdfjsViewerElement={}))})(this,function(p){"use strict";/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2019 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
+
*/const _=window,k=_.ShadowRoot&&(_.ShadyCSS===void 0||_.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,j=Symbol(),K=new WeakMap;class Z{constructor(t,e,i){if(this._$cssResult$=!0,i!==j)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(k&&t===void 0){const i=e!==void 0&&e.length===1;i&&(t=K.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&K.set(e,t))}return t}toString(){return this.cssText}}const dt=n=>new Z(typeof n=="string"?n:n+"",void 0,j),ct=(n,...t)=>{const e=n.length===1?n[0]:t.reduce((i,s,o)=>i+(r=>{if(r._$cssResult$===!0)return r.cssText;if(typeof r=="number")return r;throw Error("Value passed to 'css' function must be a 'css' function result: "+r+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+n[o+1],n[0]);return new Z(e,n,j)},ut=(n,t)=>{k?n.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet):t.forEach(e=>{const i=document.createElement("style"),s=_.litNonce;s!==void 0&&i.setAttribute("nonce",s),i.textContent=e.cssText,n.appendChild(i)})},J=k?n=>n:n=>n instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return dt(e)})(n):n;/**
|
|
6
|
+
* @license
|
|
7
|
+
* Copyright 2017 Google LLC
|
|
8
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
9
|
+
*/var L;const O=window,F=O.trustedTypes,pt=F?F.emptyScript:"",G=O.reactiveElementPolyfillSupport,z={toAttribute(n,t){switch(t){case Boolean:n=n?pt:null;break;case Object:case Array:n=n==null?n:JSON.stringify(n)}return n},fromAttribute(n,t){let e=n;switch(t){case Boolean:e=n!==null;break;case Number:e=n===null?null:Number(n);break;case Object:case Array:try{e=JSON.parse(n)}catch{e=null}}return e}},Q=(n,t)=>t!==n&&(t==t||n==n),D={attribute:!0,type:String,converter:z,reflect:!1,hasChanged:Q};class A extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this.u()}static addInitializer(t){var e;(e=this.h)!==null&&e!==void 0||(this.h=[]),this.h.push(t)}static get observedAttributes(){this.finalize();const t=[];return this.elementProperties.forEach((e,i)=>{const s=this._$Ep(i,e);s!==void 0&&(this._$Ev.set(s,i),t.push(s))}),t}static createProperty(t,e=D){if(e.state&&(e.attribute=!1),this.finalize(),this.elementProperties.set(t,e),!e.noAccessor&&!this.prototype.hasOwnProperty(t)){const i=typeof t=="symbol"?Symbol():"__"+t,s=this.getPropertyDescriptor(t,i,e);s!==void 0&&Object.defineProperty(this.prototype,t,s)}}static getPropertyDescriptor(t,e,i){return{get(){return this[e]},set(s){const o=this[t];this[e]=s,this.requestUpdate(t,o,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||D}static finalize(){if(this.hasOwnProperty("finalized"))return!1;this.finalized=!0;const t=Object.getPrototypeOf(this);if(t.finalize(),this.elementProperties=new Map(t.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const e=this.properties,i=[...Object.getOwnPropertyNames(e),...Object.getOwnPropertySymbols(e)];for(const s of i)this.createProperty(s,e[s])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const s of i)e.unshift(J(s))}else t!==void 0&&e.push(J(t));return e}static _$Ep(t,e){const i=e.attribute;return i===!1?void 0:typeof i=="string"?i:typeof t=="string"?t.toLowerCase():void 0}u(){var t;this._$E_=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$Eg(),this.requestUpdate(),(t=this.constructor.h)===null||t===void 0||t.forEach(e=>e(this))}addController(t){var e,i;((e=this._$ES)!==null&&e!==void 0?e:this._$ES=[]).push(t),this.renderRoot!==void 0&&this.isConnected&&((i=t.hostConnected)===null||i===void 0||i.call(t))}removeController(t){var e;(e=this._$ES)===null||e===void 0||e.splice(this._$ES.indexOf(t)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach((t,e)=>{this.hasOwnProperty(e)&&(this._$Ei.set(e,this[e]),delete this[e])})}createRenderRoot(){var t;const e=(t=this.shadowRoot)!==null&&t!==void 0?t:this.attachShadow(this.constructor.shadowRootOptions);return ut(e,this.constructor.elementStyles),e}connectedCallback(){var t;this.renderRoot===void 0&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(t=this._$ES)===null||t===void 0||t.forEach(e=>{var i;return(i=e.hostConnected)===null||i===void 0?void 0:i.call(e)})}enableUpdating(t){}disconnectedCallback(){var t;(t=this._$ES)===null||t===void 0||t.forEach(e=>{var i;return(i=e.hostDisconnected)===null||i===void 0?void 0:i.call(e)})}attributeChangedCallback(t,e,i){this._$AK(t,i)}_$EO(t,e,i=D){var s;const o=this.constructor._$Ep(t,i);if(o!==void 0&&i.reflect===!0){const r=(((s=i.converter)===null||s===void 0?void 0:s.toAttribute)!==void 0?i.converter:z).toAttribute(e,i.type);this._$El=t,r==null?this.removeAttribute(o):this.setAttribute(o,r),this._$El=null}}_$AK(t,e){var i;const s=this.constructor,o=s._$Ev.get(t);if(o!==void 0&&this._$El!==o){const r=s.getPropertyOptions(o),d=typeof r.converter=="function"?{fromAttribute:r.converter}:((i=r.converter)===null||i===void 0?void 0:i.fromAttribute)!==void 0?r.converter:z;this._$El=o,this[o]=d.fromAttribute(e,r.type),this._$El=null}}requestUpdate(t,e,i){let s=!0;t!==void 0&&(((i=i||this.constructor.getPropertyOptions(t)).hasChanged||Q)(this[t],e)?(this._$AL.has(t)||this._$AL.set(t,e),i.reflect===!0&&this._$El!==t&&(this._$EC===void 0&&(this._$EC=new Map),this._$EC.set(t,i))):s=!1),!this.isUpdatePending&&s&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(e){Promise.reject(e)}const t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var t;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach((s,o)=>this[o]=s),this._$Ei=void 0);let e=!1;const i=this._$AL;try{e=this.shouldUpdate(i),e?(this.willUpdate(i),(t=this._$ES)===null||t===void 0||t.forEach(s=>{var o;return(o=s.hostUpdate)===null||o===void 0?void 0:o.call(s)}),this.update(i)):this._$Ek()}catch(s){throw e=!1,this._$Ek(),s}e&&this._$AE(i)}willUpdate(t){}_$AE(t){var e;(e=this._$ES)===null||e===void 0||e.forEach(i=>{var s;return(s=i.hostUpdated)===null||s===void 0?void 0:s.call(i)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(t){return!0}update(t){this._$EC!==void 0&&(this._$EC.forEach((e,i)=>this._$EO(i,this[i],e)),this._$EC=void 0),this._$Ek()}updated(t){}firstUpdated(t){}}A.finalized=!0,A.elementProperties=new Map,A.elementStyles=[],A.shadowRootOptions={mode:"open"},G==null||G({ReactiveElement:A}),((L=O.reactiveElementVersions)!==null&&L!==void 0?L:O.reactiveElementVersions=[]).push("1.4.0");/**
|
|
10
|
+
* @license
|
|
11
|
+
* Copyright 2017 Google LLC
|
|
12
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
13
|
+
*/var V;const T=window,y=T.trustedTypes,X=y?y.createPolicy("lit-html",{createHTML:n=>n}):void 0,f=`lit$${(Math.random()+"").slice(9)}$`,Y="?"+f,$t=`<${Y}>`,g=document,w=(n="")=>g.createComment(n),C=n=>n===null||typeof n!="object"&&typeof n!="function",tt=Array.isArray,vt=n=>tt(n)||typeof(n==null?void 0:n[Symbol.iterator])=="function",P=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,et=/-->/g,it=/>/g,m=RegExp(`>|[
|
|
14
|
+
\f\r](?:([^\\s"'>=/]+)([
|
|
15
|
+
\f\r]*=[
|
|
16
|
+
\f\r]*(?:[^
|
|
17
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),st=/'/g,nt=/"/g,rt=/^(?:script|style|textarea|title)$/i,_t=n=>(t,...e)=>({_$litType$:n,strings:t,values:e}),ft=_t(1),E=Symbol.for("lit-noChange"),u=Symbol.for("lit-nothing"),ot=new WeakMap,mt=(n,t,e)=>{var i,s;const o=(i=e==null?void 0:e.renderBefore)!==null&&i!==void 0?i:t;let r=o._$litPart$;if(r===void 0){const d=(s=e==null?void 0:e.renderBefore)!==null&&s!==void 0?s:null;o._$litPart$=r=new U(t.insertBefore(w(),d),d,void 0,e!=null?e:{})}return r._$AI(n),r},S=g.createTreeWalker(g,129,null,!1),At=(n,t)=>{const e=n.length-1,i=[];let s,o=t===2?"<svg>":"",r=P;for(let l=0;l<e;l++){const h=n[l];let v,a,c=-1,$=0;for(;$<h.length&&(r.lastIndex=$,a=r.exec(h),a!==null);)$=r.lastIndex,r===P?a[1]==="!--"?r=et:a[1]!==void 0?r=it:a[2]!==void 0?(rt.test(a[2])&&(s=RegExp("</"+a[2],"g")),r=m):a[3]!==void 0&&(r=m):r===m?a[0]===">"?(r=s!=null?s:P,c=-1):a[1]===void 0?c=-2:(c=r.lastIndex-a[2].length,v=a[1],r=a[3]===void 0?m:a[3]==='"'?nt:st):r===nt||r===st?r=m:r===et||r===it?r=P:(r=m,s=void 0);const M=r===m&&n[l+1].startsWith("/>")?" ":"";o+=r===P?h+$t:c>=0?(i.push(v),h.slice(0,c)+"$lit$"+h.slice(c)+f+M):h+f+(c===-2?(i.push(void 0),l):M)}const d=o+(n[e]||"<?>")+(t===2?"</svg>":"");if(!Array.isArray(n)||!n.hasOwnProperty("raw"))throw Error("invalid template strings array");return[X!==void 0?X.createHTML(d):d,i]};class x{constructor({strings:t,_$litType$:e},i){let s;this.parts=[];let o=0,r=0;const d=t.length-1,l=this.parts,[h,v]=At(t,e);if(this.el=x.createElement(h,i),S.currentNode=this.el.content,e===2){const a=this.el.content,c=a.firstChild;c.remove(),a.append(...c.childNodes)}for(;(s=S.nextNode())!==null&&l.length<d;){if(s.nodeType===1){if(s.hasAttributes()){const a=[];for(const c of s.getAttributeNames())if(c.endsWith("$lit$")||c.startsWith(f)){const $=v[r++];if(a.push(c),$!==void 0){const M=s.getAttribute($.toLowerCase()+"$lit$").split(f),R=/([.?@])?(.*)/.exec($);l.push({type:1,index:o,name:R[2],strings:M,ctor:R[1]==="."?gt:R[1]==="?"?St:R[1]==="@"?bt:N})}else l.push({type:6,index:o})}for(const c of a)s.removeAttribute(c)}if(rt.test(s.tagName)){const a=s.textContent.split(f),c=a.length-1;if(c>0){s.textContent=y?y.emptyScript:"";for(let $=0;$<c;$++)s.append(a[$],w()),S.nextNode(),l.push({type:2,index:++o});s.append(a[c],w())}}}else if(s.nodeType===8)if(s.data===Y)l.push({type:2,index:o});else{let a=-1;for(;(a=s.data.indexOf(f,a+1))!==-1;)l.push({type:7,index:o}),a+=f.length-1}o++}}static createElement(t,e){const i=g.createElement("template");return i.innerHTML=t,i}}function b(n,t,e=n,i){var s,o,r,d;if(t===E)return t;let l=i!==void 0?(s=e._$Cl)===null||s===void 0?void 0:s[i]:e._$Cu;const h=C(t)?void 0:t._$litDirective$;return(l==null?void 0:l.constructor)!==h&&((o=l==null?void 0:l._$AO)===null||o===void 0||o.call(l,!1),h===void 0?l=void 0:(l=new h(n),l._$AT(n,e,i)),i!==void 0?((r=(d=e)._$Cl)!==null&&r!==void 0?r:d._$Cl=[])[i]=l:e._$Cu=l),l!==void 0&&(t=b(n,l._$AS(n,t.values),l,i)),t}class yt{constructor(t,e){this.v=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}p(t){var e;const{el:{content:i},parts:s}=this._$AD,o=((e=t==null?void 0:t.creationScope)!==null&&e!==void 0?e:g).importNode(i,!0);S.currentNode=o;let r=S.nextNode(),d=0,l=0,h=s[0];for(;h!==void 0;){if(d===h.index){let v;h.type===2?v=new U(r,r.nextSibling,this,t):h.type===1?v=new h.ctor(r,h.name,h.strings,this,t):h.type===6&&(v=new wt(r,this,t)),this.v.push(v),h=s[++l]}d!==(h==null?void 0:h.index)&&(r=S.nextNode(),d++)}return o}m(t){let e=0;for(const i of this.v)i!==void 0&&(i.strings!==void 0?(i._$AI(t,i,e),e+=i.strings.length-2):i._$AI(t[e])),e++}}class U{constructor(t,e,i,s){var o;this.type=2,this._$AH=u,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=i,this.options=s,this._$C_=(o=s==null?void 0:s.isConnected)===null||o===void 0||o}get _$AU(){var t,e;return(e=(t=this._$AM)===null||t===void 0?void 0:t._$AU)!==null&&e!==void 0?e:this._$C_}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return e!==void 0&&t.nodeType===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=b(this,t,e),C(t)?t===u||t==null||t===""?(this._$AH!==u&&this._$AR(),this._$AH=u):t!==this._$AH&&t!==E&&this.$(t):t._$litType$!==void 0?this.T(t):t.nodeType!==void 0?this.k(t):vt(t)?this.O(t):this.$(t)}S(t,e=this._$AB){return this._$AA.parentNode.insertBefore(t,e)}k(t){this._$AH!==t&&(this._$AR(),this._$AH=this.S(t))}$(t){this._$AH!==u&&C(this._$AH)?this._$AA.nextSibling.data=t:this.k(g.createTextNode(t)),this._$AH=t}T(t){var e;const{values:i,_$litType$:s}=t,o=typeof s=="number"?this._$AC(t):(s.el===void 0&&(s.el=x.createElement(s.h,this.options)),s);if(((e=this._$AH)===null||e===void 0?void 0:e._$AD)===o)this._$AH.m(i);else{const r=new yt(o,this),d=r.p(this.options);r.m(i),this.k(d),this._$AH=r}}_$AC(t){let e=ot.get(t.strings);return e===void 0&&ot.set(t.strings,e=new x(t)),e}O(t){tt(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let i,s=0;for(const o of t)s===e.length?e.push(i=new U(this.S(w()),this.S(w()),this,this.options)):i=e[s],i._$AI(o),s++;s<e.length&&(this._$AR(i&&i._$AB.nextSibling,s),e.length=s)}_$AR(t=this._$AA.nextSibling,e){var i;for((i=this._$AP)===null||i===void 0||i.call(this,!1,!0,e);t&&t!==this._$AB;){const s=t.nextSibling;t.remove(),t=s}}setConnected(t){var e;this._$AM===void 0&&(this._$C_=t,(e=this._$AP)===null||e===void 0||e.call(this,t))}}class N{constructor(t,e,i,s,o){this.type=1,this._$AH=u,this._$AN=void 0,this.element=t,this.name=e,this._$AM=s,this.options=o,i.length>2||i[0]!==""||i[1]!==""?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=u}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,e=this,i,s){const o=this.strings;let r=!1;if(o===void 0)t=b(this,t,e,0),r=!C(t)||t!==this._$AH&&t!==E,r&&(this._$AH=t);else{const d=t;let l,h;for(t=o[0],l=0;l<o.length-1;l++)h=b(this,d[i+l],e,l),h===E&&(h=this._$AH[l]),r||(r=!C(h)||h!==this._$AH[l]),h===u?t=u:t!==u&&(t+=(h!=null?h:"")+o[l+1]),this._$AH[l]=h}r&&!s&&this.P(t)}P(t){t===u?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t!=null?t:"")}}class gt extends N{constructor(){super(...arguments),this.type=3}P(t){this.element[this.name]=t===u?void 0:t}}const Et=y?y.emptyScript:"";class St extends N{constructor(){super(...arguments),this.type=4}P(t){t&&t!==u?this.element.setAttribute(this.name,Et):this.element.removeAttribute(this.name)}}class bt extends N{constructor(t,e,i,s,o){super(t,e,i,s,o),this.type=5}_$AI(t,e=this){var i;if((t=(i=b(this,t,e,0))!==null&&i!==void 0?i:u)===E)return;const s=this._$AH,o=t===u&&s!==u||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,r=t!==u&&(s===u||o);o&&this.element.removeEventListener(this.name,this,s),r&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e,i;typeof this._$AH=="function"?this._$AH.call((i=(e=this.options)===null||e===void 0?void 0:e.host)!==null&&i!==void 0?i:this.element,t):this._$AH.handleEvent(t)}}class wt{constructor(t,e,i){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(t){b(this,t)}}const lt=T.litHtmlPolyfillSupport;lt==null||lt(x,U),((V=T.litHtmlVersions)!==null&&V!==void 0?V:T.litHtmlVersions=[]).push("2.3.0");/**
|
|
18
|
+
* @license
|
|
19
|
+
* Copyright 2017 Google LLC
|
|
20
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
21
|
+
*/var B,I;class H extends A{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t,e;const i=super.createRenderRoot();return(t=(e=this.renderOptions).renderBefore)!==null&&t!==void 0||(e.renderBefore=i.firstChild),i}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=mt(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),(t=this._$Do)===null||t===void 0||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this._$Do)===null||t===void 0||t.setConnected(!1)}render(){return E}}H.finalized=!0,H._$litElement$=!0,(B=globalThis.litElementHydrateSupport)===null||B===void 0||B.call(globalThis,{LitElement:H});const ht=globalThis.litElementPolyfillSupport;ht==null||ht({LitElement:H}),((I=globalThis.litElementVersions)!==null&&I!==void 0?I:globalThis.litElementVersions=[]).push("3.2.2");/**
|
|
22
|
+
* @license
|
|
23
|
+
* Copyright 2017 Google LLC
|
|
24
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
25
|
+
*/const Ct=n=>t=>typeof t=="function"?((e,i)=>(customElements.define(e,i),i))(n,t):((e,i)=>{const{kind:s,elements:o}=i;return{kind:s,elements:o,finisher(r){customElements.define(e,r)}}})(n,t);/**
|
|
26
|
+
* @license
|
|
27
|
+
* Copyright 2017 Google LLC
|
|
28
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
29
|
+
*/const Pt=(n,t)=>t.kind==="method"&&t.descriptor&&!("value"in t.descriptor)?{...t,finisher(e){e.createProperty(t.key,n)}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:t.key,initializer(){typeof t.initializer=="function"&&(this[t.key]=t.initializer.call(this))},finisher(e){e.createProperty(t.key,n)}};function at(n){return(t,e)=>e!==void 0?((i,s,o)=>{s.constructor.createProperty(o,i)})(n,t,e):Pt(n,t)}/**
|
|
30
|
+
* @license
|
|
31
|
+
* Copyright 2021 Google LLC
|
|
32
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
33
|
+
*/var W;((W=window.HTMLSlotElement)===null||W===void 0?void 0:W.prototype.assignedElements)!=null;var xt=Object.defineProperty,Ut=Object.getOwnPropertyDescriptor,q=(n,t,e,i)=>{for(var s=i>1?void 0:i?Ut(t,e):t,o=n.length-1,r;o>=0;o--)(r=n[o])&&(s=(i?r(t,e,s):r(s))||s);return i&&s&&xt(t,e,s),s};p.PdfjsViewerElement=class extends H{constructor(){super(...arguments),this.src="",this.height="600px"}render(){return ft`
|
|
34
|
+
<iframe
|
|
35
|
+
frameborder="0"
|
|
36
|
+
width="100%"
|
|
37
|
+
style="height: ${this.height}"
|
|
38
|
+
src="/pdfjs-2.15.349-dist/web/viewer.html?file=${this.src}"
|
|
39
|
+
>
|
|
40
|
+
`}},p.PdfjsViewerElement.styles=ct`
|
|
41
|
+
:host {
|
|
42
|
+
width: 100%
|
|
43
|
+
}
|
|
44
|
+
`,q([at()],p.PdfjsViewerElement.prototype,"src",2),q([at()],p.PdfjsViewerElement.prototype,"height",2),p.PdfjsViewerElement=q([Ct("pdfjs-viewer-element")],p.PdfjsViewerElement),Object.defineProperties(p,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/package.json
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pdfjs-viewer-element",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"
|
|
5
|
-
"main": "dist/
|
|
3
|
+
"version": "0.0.5",
|
|
4
|
+
"license": "UNLICENSED",
|
|
5
|
+
"main": "dist/index.mjs",
|
|
6
6
|
"exports": {
|
|
7
|
-
".": "./dist/
|
|
7
|
+
".": "./dist/index.mjs"
|
|
8
8
|
},
|
|
9
|
+
"types": "types/index.d.ts",
|
|
9
10
|
"files": [
|
|
10
|
-
"dist"
|
|
11
|
+
"dist",
|
|
12
|
+
"types"
|
|
11
13
|
],
|
|
12
14
|
"scripts": {
|
|
13
15
|
"dev": "vite",
|
|
@@ -15,6 +17,7 @@
|
|
|
15
17
|
},
|
|
16
18
|
"dependencies": {},
|
|
17
19
|
"devDependencies": {
|
|
20
|
+
"@types/node": "^18.7.1",
|
|
18
21
|
"lit": "^2.3.0",
|
|
19
22
|
"typescript": "^4.6.4",
|
|
20
23
|
"vite": "^3.0.6"
|
package/types/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './pdfjs-viewer-element';
|
package/types/index.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './pdfjs-viewer-element.d'
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
export declare class PdfjsViewerElement extends LitElement {
|
|
3
|
+
src: string;
|
|
4
|
+
height: string;
|
|
5
|
+
static styles: import("lit").CSSResult;
|
|
6
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
7
|
+
}
|
|
8
|
+
declare global {
|
|
9
|
+
interface HTMLElementTagNameMap {
|
|
10
|
+
'pdfjs-viewer-element': PdfjsViewerElement;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { css as f, LitElement as c, html as n } from "lit";
|
|
2
|
-
import { property as m, customElement as v } from "lit/decorators.js";
|
|
3
|
-
var w = Object.defineProperty, d = Object.getOwnPropertyDescriptor, o = (l, r, i, s) => {
|
|
4
|
-
for (var e = s > 1 ? void 0 : s ? d(r, i) : r, h = l.length - 1, p; h >= 0; h--)
|
|
5
|
-
(p = l[h]) && (e = (s ? p(r, i, e) : p(e)) || e);
|
|
6
|
-
return s && e && w(r, i, e), e;
|
|
7
|
-
};
|
|
8
|
-
let t = class extends c {
|
|
9
|
-
constructor() {
|
|
10
|
-
super(...arguments), this.src = "", this.height = "600px";
|
|
11
|
-
}
|
|
12
|
-
render() {
|
|
13
|
-
return n`
|
|
14
|
-
<iframe
|
|
15
|
-
frameborder="0"
|
|
16
|
-
width="100%"
|
|
17
|
-
style="height: ${this.height}"
|
|
18
|
-
src="/pdfjs-2.15.349-dist/web/viewer.html?file=${this.src}"
|
|
19
|
-
>
|
|
20
|
-
`;
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
t.styles = f`
|
|
24
|
-
:host {
|
|
25
|
-
width: 100%
|
|
26
|
-
}
|
|
27
|
-
`;
|
|
28
|
-
o([
|
|
29
|
-
m()
|
|
30
|
-
], t.prototype, "src", 2);
|
|
31
|
-
o([
|
|
32
|
-
m()
|
|
33
|
-
], t.prototype, "height", 2);
|
|
34
|
-
t = o([
|
|
35
|
-
v("pdfjs-viewer-element")
|
|
36
|
-
], t);
|
|
37
|
-
export {
|
|
38
|
-
t as PdfjsViewerElement
|
|
39
|
-
};
|