@storyteller-platform/epub 0.4.10 → 0.5.0

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.
@@ -0,0 +1,555 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var upgrade_exports = {};
20
+ __export(upgrade_exports, {
21
+ buildNavDocument: () => buildNavDocument,
22
+ buildTocOl: () => buildTocOl,
23
+ chooseNavHref: () => chooseNavHref,
24
+ collectManifestProperties: () => collectManifestProperties,
25
+ extractGuideLandmarks: () => extractGuideLandmarks,
26
+ fixFontMimeTypes: () => fixFontMimeTypes,
27
+ removeGuide: () => removeGuide,
28
+ removeInvalidDcAttrs: () => removeInvalidDcAttrs,
29
+ removeNcx: () => removeNcx,
30
+ removeSpineTocRef: () => removeSpineTocRef,
31
+ setLastModified: () => setLastModified,
32
+ setPackageVersion: () => setPackageVersion,
33
+ upgradeAuthors: () => upgradeAuthors,
34
+ upgradeCover: () => upgradeCover,
35
+ upgradeDate: () => upgradeDate,
36
+ upgradeIdentifiers: () => upgradeIdentifiers,
37
+ upgradeLanguages: () => upgradeLanguages,
38
+ upgradeMeta: () => upgradeMeta,
39
+ upgradePackageMetadata: () => upgradePackageMetadata,
40
+ upgradeTitle: () => upgradeTitle
41
+ });
42
+ module.exports = __toCommonJS(upgrade_exports);
43
+ var import_nanoid = require("nanoid");
44
+ var import_index = require("./index.cjs");
45
+ const GUIDE_TO_EPUBTYPE = {
46
+ acknowledgements: "acknowledgments",
47
+ "other.afterword": "afterword",
48
+ "other.appendix": "appendix",
49
+ "other.backmatter": "backmatter",
50
+ bibliography: "bibliography",
51
+ text: "bodymatter",
52
+ "other.chapter": "chapter",
53
+ colophon: "colophon",
54
+ "other.conclusion": "conclusion",
55
+ "other.contributors": "contributors",
56
+ "copyright-page": "copyright-page",
57
+ cover: "cover",
58
+ dedication: "dedication",
59
+ "other.division": "division",
60
+ epigraph: "epigraph",
61
+ "other.epilogue": "epilogue",
62
+ "other.errata": "errata",
63
+ "other.footnotes": "footnotes",
64
+ foreword: "foreword",
65
+ "other.frontmatter": "frontmatter",
66
+ glossary: "glossary",
67
+ "other.halftitlepage": "halftitlepage",
68
+ "other.imprint": "imprint",
69
+ "other.imprimatur": "imprimatur",
70
+ index: "index",
71
+ "other.introduction": "introduction",
72
+ "other.landmarks": "landmarks",
73
+ "other.loa": "loa",
74
+ loi: "loi",
75
+ lot: "lot",
76
+ "other.lov": "lov",
77
+ notes: "",
78
+ "other.notice": "notice",
79
+ "other.other-credits": "other-credits",
80
+ "other.part": "part",
81
+ "other.preamble": "preamble",
82
+ preface: "preface",
83
+ "other.prologue": "prologue",
84
+ "other.rearnotes": "rearnotes",
85
+ "other.subchapter": "subchapter",
86
+ "title-page": "titlepage",
87
+ toc: "toc",
88
+ "other.volume": "volume",
89
+ "other.warning": "warning"
90
+ };
91
+ const XHTML_MEDIA_TYPES = /* @__PURE__ */ new Set([
92
+ "application/xhtml+xml",
93
+ "application/vnd.adobe-page-template+xml",
94
+ "text/html"
95
+ ]);
96
+ const OEB_FONTS = /* @__PURE__ */ new Set([
97
+ "application/vnd.ms-opentype",
98
+ "application/x-font-ttf",
99
+ "application/x-font-otf",
100
+ "application/x-font-truetype",
101
+ "application/font-sfnt",
102
+ "application/font-woff",
103
+ "application/font-woff2",
104
+ "font/woff",
105
+ "font/woff2",
106
+ "font/otf",
107
+ "font/ttf",
108
+ "font/sfnt"
109
+ ]);
110
+ const FONT_MIME_BY_EXT = {
111
+ ".ttf": "application/font-sfnt",
112
+ ".otf": "application/font-sfnt",
113
+ ".woff": "application/font-woff",
114
+ ".woff2": "font/woff2"
115
+ };
116
+ function getMetadataElement(pkg) {
117
+ return import_index.Epub.findXmlChildByName("metadata", import_index.Epub.getXmlChildren(pkg));
118
+ }
119
+ function getManifestElement(pkg) {
120
+ return import_index.Epub.findXmlChildByName("manifest", import_index.Epub.getXmlChildren(pkg));
121
+ }
122
+ function getSpineElement(pkg) {
123
+ return import_index.Epub.findXmlChildByName("spine", import_index.Epub.getXmlChildren(pkg));
124
+ }
125
+ function ensureId(element) {
126
+ var _a;
127
+ const existing = (_a = element[":@"]) == null ? void 0 : _a["@_id"];
128
+ if (existing) return existing;
129
+ const id = `id-${(0, import_nanoid.nanoid)(8)}`;
130
+ element[":@"] ??= {};
131
+ element[":@"]["@_id"] = id;
132
+ return id;
133
+ }
134
+ function findAllByName(name, xml) {
135
+ return xml.filter(
136
+ (node) => !import_index.Epub.isXmlTextNode(node) && name in node
137
+ );
138
+ }
139
+ function hasElementDeep(xml, name) {
140
+ for (const node of xml) {
141
+ if (import_index.Epub.isXmlTextNode(node)) continue;
142
+ if (import_index.Epub.getXmlElementName(node) === name) return true;
143
+ if (hasElementDeep(import_index.Epub.getXmlChildren(node), name)) return true;
144
+ }
145
+ return false;
146
+ }
147
+ function textContentOf(element) {
148
+ return import_index.Epub.getXhtmlTextContent(import_index.Epub.getXmlChildren(element)).trim();
149
+ }
150
+ function removeFromArray(array, item) {
151
+ const idx = array.indexOf(item);
152
+ if (idx !== -1) array.splice(idx, 1);
153
+ }
154
+ function upgradeIdentifiers(pkg) {
155
+ const metadata = getMetadataElement(pkg);
156
+ if (!metadata) return;
157
+ for (const ident of findAllByName("dc:identifier", metadata.metadata)) {
158
+ const attrs = ident[":@"] ?? {};
159
+ let val = textContentOf(ident);
160
+ let scheme = attrs["@_opf:scheme"];
161
+ if (val.toLowerCase().startsWith("urn:")) {
162
+ const rest = val.slice(4);
163
+ const colonIdx = rest.indexOf(":");
164
+ if (colonIdx > 0) {
165
+ scheme = rest.slice(0, colonIdx);
166
+ val = rest.slice(colonIdx + 1);
167
+ }
168
+ }
169
+ if (scheme && val && !scheme.toLowerCase().startsWith("uri")) {
170
+ val = `${scheme}:${val}`;
171
+ }
172
+ const id = attrs["@_id"];
173
+ ident[":@"] = id ? { "@_id": id } : {};
174
+ import_index.Epub.replaceXmlChildren(ident, [import_index.Epub.createXmlTextNode(val)]);
175
+ }
176
+ }
177
+ function upgradeTitle(pkg) {
178
+ const metadata = getMetadataElement(pkg);
179
+ if (!metadata) return;
180
+ const titles = findAllByName("dc:title", metadata.metadata);
181
+ let firstTitle = null;
182
+ for (const title of titles) {
183
+ const text = textContentOf(title);
184
+ if (!text) {
185
+ removeFromArray(metadata.metadata, title);
186
+ continue;
187
+ }
188
+ firstTitle ??= title;
189
+ }
190
+ if (!firstTitle) return;
191
+ const titleId = ensureId(firstTitle);
192
+ metadata.metadata.push(
193
+ import_index.Epub.createXmlElement(
194
+ "meta",
195
+ { refines: `#${titleId}`, property: "title-type" },
196
+ [import_index.Epub.createXmlTextNode("main")]
197
+ )
198
+ );
199
+ }
200
+ function upgradeLanguages(pkg) {
201
+ var _a;
202
+ const metadata = getMetadataElement(pkg);
203
+ if (!metadata) return;
204
+ const langs = findAllByName("dc:language", metadata.metadata);
205
+ if (langs.length > 0) {
206
+ for (const lang of langs) {
207
+ const id = (_a = lang[":@"]) == null ? void 0 : _a["@_id"];
208
+ lang[":@"] = id ? { "@_id": id } : {};
209
+ }
210
+ return;
211
+ }
212
+ metadata.metadata.push(
213
+ import_index.Epub.createXmlElement("dc:language", {}, [import_index.Epub.createXmlTextNode("und")])
214
+ );
215
+ }
216
+ function upgradeAuthors(pkg) {
217
+ const metadata = getMetadataElement(pkg);
218
+ if (!metadata) return;
219
+ for (const which of ["dc:creator", "dc:contributor"]) {
220
+ for (const elem of findAllByName(which, metadata.metadata)) {
221
+ const attrs = elem[":@"] ?? {};
222
+ const role = attrs["@_opf:role"];
223
+ const sort = attrs["@_opf:file-as"];
224
+ const elemId = role || sort ? ensureId(elem) : attrs["@_id"];
225
+ elem[":@"] = elemId ? { "@_id": elemId } : {};
226
+ if (role) {
227
+ metadata.metadata.push(
228
+ import_index.Epub.createXmlElement(
229
+ "meta",
230
+ {
231
+ refines: `#${elemId}`,
232
+ property: "role",
233
+ scheme: "marc:relators"
234
+ },
235
+ [import_index.Epub.createXmlTextNode(role)]
236
+ )
237
+ );
238
+ }
239
+ if (sort) {
240
+ metadata.metadata.push(
241
+ import_index.Epub.createXmlElement(
242
+ "meta",
243
+ { refines: `#${elemId}`, property: "file-as" },
244
+ [import_index.Epub.createXmlTextNode(sort)]
245
+ )
246
+ );
247
+ }
248
+ }
249
+ }
250
+ }
251
+ function upgradeDate(pkg) {
252
+ var _a;
253
+ const metadata = getMetadataElement(pkg);
254
+ if (!metadata) return;
255
+ const dates = findAllByName("dc:date", metadata.metadata);
256
+ let kept = false;
257
+ for (const date of dates) {
258
+ const text = textContentOf(date);
259
+ if (!text || kept) {
260
+ removeFromArray(metadata.metadata, date);
261
+ continue;
262
+ }
263
+ kept = true;
264
+ const id = (_a = date[":@"]) == null ? void 0 : _a["@_id"];
265
+ date[":@"] = id ? { "@_id": id } : {};
266
+ }
267
+ }
268
+ function upgradeMeta(pkg) {
269
+ const metadata = getMetadataElement(pkg);
270
+ if (!metadata) return;
271
+ for (const meta of findAllByName("meta", metadata.metadata)) {
272
+ const attrs = meta[":@"] ?? {};
273
+ const name = attrs["@_name"] ?? "";
274
+ const content = attrs["@_content"] ?? "";
275
+ let prop = null;
276
+ let value = content;
277
+ const cleanName = name.startsWith("rendition:") ? name.slice("rendition:".length) : name;
278
+ if (["orientation", "layout", "spread"].includes(cleanName)) {
279
+ prop = `rendition:${cleanName}`;
280
+ } else if (name === "fixed-layout") {
281
+ prop = "rendition:layout";
282
+ value = content.toLowerCase() === "true" ? "pre-paginated" : "reflowable";
283
+ } else if (name === "orientation-lock") {
284
+ prop = "rendition:orientation";
285
+ const map = {
286
+ portrait: "portrait",
287
+ landscape: "landscape"
288
+ };
289
+ value = map[content.toLowerCase()] ?? "auto";
290
+ }
291
+ if (!prop) continue;
292
+ delete attrs["@_name"];
293
+ delete attrs["@_content"];
294
+ attrs["@_property"] = prop;
295
+ import_index.Epub.replaceXmlChildren(meta, [import_index.Epub.createXmlTextNode(value)]);
296
+ }
297
+ }
298
+ function upgradeCover(pkg) {
299
+ const metadata = getMetadataElement(pkg);
300
+ const manifest = getManifestElement(pkg);
301
+ if (!metadata || !manifest) return;
302
+ for (const meta of findAllByName("meta", metadata.metadata)) {
303
+ const attrs = meta[":@"];
304
+ const isCoverMeta = (attrs == null ? void 0 : attrs["@_name"]) === "cover" && attrs["@_content"];
305
+ if (!isCoverMeta) continue;
306
+ const itemId = attrs["@_content"];
307
+ for (const item of findAllByName("item", manifest.manifest)) {
308
+ const itemAttrs = item[":@"];
309
+ if (!itemAttrs || itemAttrs["@_id"] !== itemId) continue;
310
+ const mediaType = (itemAttrs["@_media-type"] ?? "").toLowerCase();
311
+ const isImage = mediaType && !mediaType.includes("xml") && !mediaType.includes("html");
312
+ if (!isImage) continue;
313
+ const existing = (itemAttrs["@_properties"] ?? "").split(" ").filter(Boolean);
314
+ const props = new Set(existing);
315
+ props.add("cover-image");
316
+ itemAttrs["@_properties"] = [...props].sort().join(" ");
317
+ }
318
+ }
319
+ }
320
+ function removeInvalidDcAttrs(pkg) {
321
+ const metadata = getMetadataElement(pkg);
322
+ if (!metadata) return;
323
+ for (const node of metadata.metadata) {
324
+ if (import_index.Epub.isXmlTextNode(node)) continue;
325
+ const name = import_index.Epub.getXmlElementName(node);
326
+ if (!name.startsWith("dc:")) continue;
327
+ const attrs = node[":@"];
328
+ if (!attrs) continue;
329
+ const id = attrs["@_id"];
330
+ node[":@"] = id ? { "@_id": id } : {};
331
+ }
332
+ }
333
+ function setLastModified(pkg) {
334
+ var _a;
335
+ const metadata = getMetadataElement(pkg);
336
+ if (!metadata) return;
337
+ for (let i = metadata.metadata.length - 1; i >= 0; i--) {
338
+ const node = metadata.metadata[i];
339
+ if (!node || import_index.Epub.isXmlTextNode(node)) continue;
340
+ if (((_a = node[":@"]) == null ? void 0 : _a["@_property"]) === "dcterms:modified") {
341
+ metadata.metadata.splice(i, 1);
342
+ }
343
+ }
344
+ const now = (/* @__PURE__ */ new Date()).toISOString().replace(/\.\d+/, "");
345
+ metadata.metadata.push(
346
+ import_index.Epub.createXmlElement("meta", { property: "dcterms:modified" }, [
347
+ import_index.Epub.createXmlTextNode(now)
348
+ ])
349
+ );
350
+ }
351
+ function upgradePackageMetadata(pkg) {
352
+ upgradeIdentifiers(pkg);
353
+ upgradeTitle(pkg);
354
+ upgradeLanguages(pkg);
355
+ upgradeAuthors(pkg);
356
+ upgradeDate(pkg);
357
+ upgradeMeta(pkg);
358
+ upgradeCover(pkg);
359
+ removeInvalidDcAttrs(pkg);
360
+ setLastModified(pkg);
361
+ }
362
+ function extractGuideLandmarks(pkg) {
363
+ const guide = import_index.Epub.findXmlChildByName("guide", import_index.Epub.getXmlChildren(pkg));
364
+ if (!guide) return [];
365
+ const landmarks = [];
366
+ for (const node of import_index.Epub.getXmlChildren(guide)) {
367
+ if (import_index.Epub.isXmlTextNode(node)) continue;
368
+ if (!("reference" in node)) continue;
369
+ const attrs = node[":@"] ?? {};
370
+ const href = attrs["@_href"] ?? "";
371
+ const title = attrs["@_title"] ?? "";
372
+ const guideType = (attrs["@_type"] ?? "").toLowerCase();
373
+ const epubType = GUIDE_TO_EPUBTYPE[guideType];
374
+ if (epubType === void 0 || !href) continue;
375
+ landmarks.push({ href, title, type: epubType });
376
+ }
377
+ return landmarks;
378
+ }
379
+ function removeGuide(pkg) {
380
+ const children = import_index.Epub.getXmlChildren(pkg);
381
+ const guide = import_index.Epub.findXmlChildByName("guide", children);
382
+ if (guide) {
383
+ removeFromArray(children, guide);
384
+ }
385
+ }
386
+ function removeSpineTocRef(pkg) {
387
+ const spine = getSpineElement(pkg);
388
+ if (!(spine == null ? void 0 : spine[":@"])) return;
389
+ delete spine[":@"]["@_toc"];
390
+ }
391
+ async function collectManifestProperties(epub) {
392
+ var _a;
393
+ const manifest = await epub.getManifest();
394
+ for (const item of Object.values(manifest)) {
395
+ const mediaType = ((_a = item.mediaType) == null ? void 0 : _a.toLowerCase()) ?? "";
396
+ if (!XHTML_MEDIA_TYPES.has(mediaType)) continue;
397
+ let xml;
398
+ try {
399
+ xml = await epub.readXhtmlItemContents(item.id);
400
+ } catch {
401
+ continue;
402
+ }
403
+ const props = new Set(item.properties ?? []);
404
+ const before = props.size;
405
+ if (hasElementDeep(xml, "svg")) props.add("svg");
406
+ if (hasElementDeep(xml, "script")) props.add("scripted");
407
+ if (hasElementDeep(xml, "math")) props.add("mathml");
408
+ if (hasElementDeep(xml, "epub:switch")) props.add("switch");
409
+ if (props.size === before) continue;
410
+ await epub.updateManifestItem(item.id, {
411
+ ...item,
412
+ properties: [...props].sort()
413
+ });
414
+ }
415
+ }
416
+ function fixFontMimeTypes(pkg) {
417
+ var _a, _b;
418
+ const manifest = getManifestElement(pkg);
419
+ if (!manifest) return;
420
+ for (const item of findAllByName("item", manifest.manifest)) {
421
+ const mt = (((_a = item[":@"]) == null ? void 0 : _a["@_media-type"]) ?? "").toLowerCase();
422
+ if (!OEB_FONTS.has(mt)) continue;
423
+ const href = ((_b = item[":@"]) == null ? void 0 : _b["@_href"]) ?? "";
424
+ const dotIdx = href.lastIndexOf(".");
425
+ if (dotIdx === -1) continue;
426
+ const ext = href.slice(dotIdx).toLowerCase();
427
+ const corrected = FONT_MIME_BY_EXT[ext];
428
+ if (corrected && corrected !== mt) {
429
+ item[":@"] ??= {};
430
+ item[":@"]["@_media-type"] = corrected;
431
+ }
432
+ }
433
+ }
434
+ function buildTocOl(entries) {
435
+ const children = entries.map((entry) => {
436
+ const label = entry.title.replace(/\s+/g, " ").trim();
437
+ const liChildren = [];
438
+ if (entry.href) {
439
+ liChildren.push(
440
+ import_index.Epub.createXmlElement("a", { href: entry.href }, [
441
+ import_index.Epub.createXmlTextNode(label)
442
+ ])
443
+ );
444
+ } else {
445
+ liChildren.push(
446
+ import_index.Epub.createXmlElement("span", {}, [import_index.Epub.createXmlTextNode(label)])
447
+ );
448
+ }
449
+ if (entry.children && entry.children.length > 0) {
450
+ liChildren.push(buildTocOl(entry.children));
451
+ }
452
+ return import_index.Epub.createXmlElement("li", {}, liChildren);
453
+ });
454
+ return import_index.Epub.createXmlElement("ol", {}, children);
455
+ }
456
+ async function buildNavDocument(epub, tocEntries, landmarks) {
457
+ var _a;
458
+ let tocOl;
459
+ if (tocEntries.length > 0) {
460
+ tocOl = buildTocOl(tocEntries);
461
+ } else {
462
+ const spineItems = await epub.getSpineItems();
463
+ const firstHref = ((_a = spineItems[0]) == null ? void 0 : _a.href) ?? "#";
464
+ tocOl = import_index.Epub.createXmlElement("ol", {}, [
465
+ import_index.Epub.createXmlElement("li", {}, [
466
+ import_index.Epub.createXmlElement("a", { href: firstHref }, [
467
+ import_index.Epub.createXmlTextNode("Start")
468
+ ])
469
+ ])
470
+ ]);
471
+ }
472
+ const tocNav = import_index.Epub.createXmlElement("nav", { "epub:type": "toc" }, [
473
+ import_index.Epub.createXmlElement("h1", {}, [
474
+ import_index.Epub.createXmlTextNode("Table of Contents")
475
+ ]),
476
+ tocOl
477
+ ]);
478
+ const body = [tocNav];
479
+ const validLandmarks = landmarks.filter((lm) => lm.type);
480
+ if (validLandmarks.length > 0) {
481
+ const lmOl = import_index.Epub.createXmlElement(
482
+ "ol",
483
+ {},
484
+ validLandmarks.map(
485
+ (lm) => import_index.Epub.createXmlElement("li", {}, [
486
+ import_index.Epub.createXmlElement("a", { "epub:type": lm.type, href: lm.href }, [
487
+ import_index.Epub.createXmlTextNode(lm.title || lm.type)
488
+ ])
489
+ ])
490
+ )
491
+ );
492
+ body.push(
493
+ import_index.Epub.createXmlElement("nav", { "epub:type": "landmarks", hidden: "" }, [
494
+ lmOl
495
+ ])
496
+ );
497
+ }
498
+ const head = [
499
+ import_index.Epub.createXmlElement("title", {}, [import_index.Epub.createXmlTextNode("Navigation")])
500
+ ];
501
+ const navDoc = await epub.createXhtmlDocument(body, head);
502
+ return import_index.Epub.xhtmlBuilder.build(navDoc);
503
+ }
504
+ function setPackageVersion(pkg, version) {
505
+ pkg[":@"] ??= {};
506
+ pkg[":@"]["@_version"] = version;
507
+ }
508
+ async function chooseNavHref(epub) {
509
+ const manifest = await epub.getManifest();
510
+ const existingHrefs = new Set(
511
+ Object.values(manifest).map((item) => item.href)
512
+ );
513
+ let candidate = "nav.xhtml";
514
+ let i = 1;
515
+ while (existingHrefs.has(candidate)) {
516
+ candidate = `nav${i}.xhtml`;
517
+ i++;
518
+ }
519
+ return candidate;
520
+ }
521
+ async function removeNcx(epub) {
522
+ const manifest = await epub.getManifest();
523
+ const ncxItem = Object.values(manifest).find(
524
+ (item) => {
525
+ var _a;
526
+ return ((_a = item.mediaType) == null ? void 0 : _a.toLowerCase()) === "application/x-dtbncx+xml";
527
+ }
528
+ );
529
+ if (ncxItem) {
530
+ await epub.removeManifestItem(ncxItem.id);
531
+ }
532
+ }
533
+ // Annotate the CommonJS export names for ESM import in node:
534
+ 0 && (module.exports = {
535
+ buildNavDocument,
536
+ buildTocOl,
537
+ chooseNavHref,
538
+ collectManifestProperties,
539
+ extractGuideLandmarks,
540
+ fixFontMimeTypes,
541
+ removeGuide,
542
+ removeInvalidDcAttrs,
543
+ removeNcx,
544
+ removeSpineTocRef,
545
+ setLastModified,
546
+ setPackageVersion,
547
+ upgradeAuthors,
548
+ upgradeCover,
549
+ upgradeDate,
550
+ upgradeIdentifiers,
551
+ upgradeLanguages,
552
+ upgradeMeta,
553
+ upgradePackageMetadata,
554
+ upgradeTitle
555
+ });