@prose-reader/enhancer-search 1.275.0 → 1.277.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.
package/dist/index.js CHANGED
@@ -7,76 +7,92 @@ const h = () => {
7
7
  return window;
8
8
  };
9
9
  function $() {
10
- const o = h()?.__PROSE_READER_DEBUG;
11
- return o === true || o === "true";
10
+ const e = h()?.__PROSE_READER_DEBUG;
11
+ return e === true || e === "true";
12
12
  }
13
- const u = (o, n = $(), e) => ({
14
- namespace: (t, l) => u(`${o} [${t}]`, l, e),
15
- debug: n ? o ? Function.prototype.bind.call(
16
- console.debug,
17
- console,
18
- o,
19
- `%c${o}`,
20
- e?.color ? `color: ${e.color}` : void 0
21
- ) : Function.prototype.bind.call(
22
- console.debug,
23
- console,
24
- `%c${o}`,
25
- e?.color ? `color: ${e.color}` : void 0
26
- ) : () => {
27
- },
28
- info: n ? o ? Function.prototype.bind.call(
29
- console.info,
30
- console,
31
- `%c${o}`,
32
- e?.color ? `color: ${e.color}` : void 0
33
- ) : Function.prototype.bind.call(
34
- console.info,
35
- console,
36
- `%c${o}`,
37
- e?.color ? `color: ${e.color}` : void 0
38
- ) : () => {
39
- },
40
- log: n ? o ? Function.prototype.bind.call(
41
- console.log,
42
- console,
43
- `%c${o}`,
44
- e?.color ? `color: ${e.color}` : void 0
45
- ) : Function.prototype.bind.call(console.log, console) : () => {
46
- },
47
- warn: n ? o ? Function.prototype.bind.call(
48
- console.warn,
49
- console,
50
- `%c${o}`,
51
- e?.color ? `color: ${e.color}` : void 0
52
- ) : Function.prototype.bind.call(
53
- console.warn,
54
- console,
55
- `%c${o}`,
56
- e?.color ? `color: ${e.color}` : void 0
57
- ) : () => {
58
- },
59
- error: n ? o ? Function.prototype.bind.call(
60
- console.error,
61
- console,
62
- `%c${o}`,
63
- e?.color ? `color: ${e.color}` : void 0
64
- ) : Function.prototype.bind.call(
65
- console.error,
66
- console,
67
- `%c${o}`,
68
- e?.color ? `color: ${e.color}` : void 0
69
- ) : () => {
70
- }
71
- }), _ = {
72
- ...u(),
73
- namespace: (o, n, e) => u(`[${o}]`, n, e)
13
+ const s = (e, n = $(), t) => {
14
+ let r = n;
15
+ const l = t?.color ? `color: ${t.color}` : void 0, o = {
16
+ enable: (i) => {
17
+ u(i);
18
+ },
19
+ namespace: (i, p) => s(`${e} [${i}]`, p, t),
20
+ isEnabled: () => r,
21
+ debug: () => {
22
+ },
23
+ info: () => {
24
+ },
25
+ log: () => {
26
+ },
27
+ groupCollapsed: () => {
28
+ },
29
+ groupEnd: () => {
30
+ },
31
+ getGroupArgs: (i) => l ? [`%c${e ? `${e} ${i}` : i}`, l] : [e ? `${e} ${i}` : i],
32
+ warn: () => {
33
+ },
34
+ error: () => {
35
+ }
36
+ }, c = (i) => {
37
+ if (!i) {
38
+ o.debug = () => {
39
+ }, o.info = () => {
40
+ }, o.log = () => {
41
+ }, o.groupCollapsed = () => {
42
+ }, o.groupEnd = () => {
43
+ }, o.warn = () => {
44
+ }, o.error = () => {
45
+ };
46
+ return;
47
+ }
48
+ o.debug = e ? Function.prototype.bind.call(
49
+ console.debug,
50
+ console,
51
+ e,
52
+ `%c${e}`,
53
+ l
54
+ ) : Function.prototype.bind.call(
55
+ console.debug,
56
+ console,
57
+ `%c${e}`,
58
+ l
59
+ ), o.info = Function.prototype.bind.call(
60
+ console.info,
61
+ console,
62
+ `%c${e}`,
63
+ l
64
+ ), o.log = e ? Function.prototype.bind.call(
65
+ console.log,
66
+ console,
67
+ `%c${e}`,
68
+ l
69
+ ) : Function.prototype.bind.call(console.log, console), o.groupCollapsed = Function.prototype.bind.call(
70
+ console.groupCollapsed,
71
+ console
72
+ ), o.groupEnd = Function.prototype.bind.call(console.groupEnd, console), o.warn = Function.prototype.bind.call(
73
+ console.warn,
74
+ console,
75
+ `%c${e}`,
76
+ l
77
+ ), o.error = Function.prototype.bind.call(
78
+ console.error,
79
+ console,
80
+ `%c${e}`,
81
+ l
82
+ );
83
+ }, u = (i) => {
84
+ r !== i && (r = i, c(r));
85
+ };
86
+ return c(r), o;
87
+ }, F = {
88
+ ...s(),
89
+ namespace: (e, n, t) => s(`[${e}]`, n, t)
74
90
  };
75
91
 
76
92
  const name = "@prose-reader/enhancer-search";
77
93
 
78
94
  const IS_DEBUG_ENABLED = true;
79
- const report = _.namespace(name, IS_DEBUG_ENABLED);
95
+ const report = F.namespace(name, IS_DEBUG_ENABLED);
80
96
 
81
97
  const searchNodeContainingText = (node, text) => {
82
98
  const nodeList = node.childNodes;
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../shared/dist/index.js","../src/report.ts","../src/search.ts","../src/index.ts"],"sourcesContent":["const a = (o, n) => o === n ? !0 : o.length !== n.length ? !1 : o.every((e, t) => e === n[t]), f = (o) => o.split(/[#?]/)[0]?.split(\".\").pop()?.trim() || \"\";\nfunction s(o) {\n const n = [];\n if (o.length === 0)\n return \"\";\n if (typeof o[0] != \"string\")\n throw new TypeError(`Url must be a string. Received ${o[0]}`);\n o[0].match(/^[^/:]+:\\/*$/) && o.length > 1 && (o[0] = o.shift() + o[0]), o[0].match(/^file:\\/\\/\\//) ? o[0] = o[0].replace(/^([^/:]+):\\/*/, \"$1:///\") : o[0] = o[0].replace(/^([^/:]+):\\/*/, \"$1://\");\n for (let l = 0; l < o.length; l++) {\n let r = o[l];\n if (typeof r != \"string\")\n throw new TypeError(`Url must be a string. Received ${r}`);\n r !== \"\" && (l > 0 && (r = r.replace(/^[/]+/, \"\")), l < o.length - 1 ? r = r.replace(/[/]+$/, \"\") : r = r.replace(/[/]+$/, \"/\"), n.push(r));\n }\n let e = n.join(\"/\");\n e = e.replace(/\\/(\\?|&|#[^!])/g, \"$1\");\n const t = e.split(\"?\");\n return e = t.shift() + (t.length > 0 ? \"?\" : \"\") + t.join(\"&\"), e;\n}\nfunction E(...o) {\n const n = Array.from(Array.isArray(o[0]) ? o[0] : o);\n return s(n);\n}\nfunction y(o) {\n const n = o.split(\"/\");\n return n.pop(), n.join(\"/\");\n}\nconst p = (o) => {\n switch (f(o)) {\n case \"png\":\n return \"image/png\";\n case \"jpg\":\n return \"image/jpg\";\n case \"jpeg\":\n return \"image/jpeg\";\n case \"txt\":\n return \"text/plain\";\n case \"webp\":\n return \"image/webp\";\n case \"xhtml\":\n return \"application/xhtml+xml\";\n }\n}, w = ({\n mimeType: o,\n uri: n\n}) => (o ?? p(n ?? \"\"))?.startsWith(\"application/xhtml+xml\"), R = (o) => o.length ? o.indexOf(\";\") ? o.substring(0, o.indexOf(\";\")) : o : void 0, g = Object.prototype.hasOwnProperty, d = (o, n) => o === n ? o !== 0 || n !== 0 || 1 / o === 1 / n : !1, m = (o, n, e) => {\n if (o === n)\n return !0;\n if (typeof o != \"object\" || o === null || typeof n != \"object\" || n === null)\n return !1;\n const t = Object.keys(o), l = Object.keys(n);\n if (t.length !== l.length)\n return !1;\n const r = e && typeof e.customEqual == \"function\" ? e.customEqual : d;\n for (let c = 0; c < t.length; c++) {\n const i = t[c] || \"\";\n if (!g.call(n, i) || !r(o[i], n[i]))\n return !1;\n }\n return !0;\n}, v = (o, n) => o.reduce(\n (e, t) => {\n const l = n(t);\n return e[l] || (e[l] = []), e[l].push(t), e;\n },\n {}\n);\nfunction O(o, n) {\n const e = { ...o };\n for (const t in n)\n if (Object.hasOwn(n, t)) {\n const l = n[t];\n (l !== void 0 || !(t in o)) && (e[t] = l);\n }\n return e;\n}\nconst h = () => {\n if (!(typeof window > \"u\"))\n return window;\n};\nfunction $() {\n const o = h()?.__PROSE_READER_DEBUG;\n return o === !0 || o === \"true\";\n}\nconst u = (o, n = $(), e) => ({\n namespace: (t, l) => u(`${o} [${t}]`, l, e),\n debug: n ? o ? Function.prototype.bind.call(\n console.debug,\n console,\n o,\n `%c${o}`,\n e?.color ? `color: ${e.color}` : void 0\n ) : Function.prototype.bind.call(\n console.debug,\n console,\n `%c${o}`,\n e?.color ? `color: ${e.color}` : void 0\n ) : () => {\n },\n info: n ? o ? Function.prototype.bind.call(\n console.info,\n console,\n `%c${o}`,\n e?.color ? `color: ${e.color}` : void 0\n ) : Function.prototype.bind.call(\n console.info,\n console,\n `%c${o}`,\n e?.color ? `color: ${e.color}` : void 0\n ) : () => {\n },\n log: n ? o ? Function.prototype.bind.call(\n console.log,\n console,\n `%c${o}`,\n e?.color ? `color: ${e.color}` : void 0\n ) : Function.prototype.bind.call(console.log, console) : () => {\n },\n warn: n ? o ? Function.prototype.bind.call(\n console.warn,\n console,\n `%c${o}`,\n e?.color ? `color: ${e.color}` : void 0\n ) : Function.prototype.bind.call(\n console.warn,\n console,\n `%c${o}`,\n e?.color ? `color: ${e.color}` : void 0\n ) : () => {\n },\n error: n ? o ? Function.prototype.bind.call(\n console.error,\n console,\n `%c${o}`,\n e?.color ? `color: ${e.color}` : void 0\n ) : Function.prototype.bind.call(\n console.error,\n console,\n `%c${o}`,\n e?.color ? `color: ${e.color}` : void 0\n ) : () => {\n }\n}), _ = {\n ...u(),\n namespace: (o, n, e) => u(`[${o}]`, n, e)\n}, x = \"prose-reader-resource-error\";\nexport {\n x as PROSE_READER_RESOURCE_ERROR_INJECTED_META_NAME,\n _ as Report,\n a as arrayEqual,\n p as detectMimeTypeFromName,\n y as getParentPath,\n f as getUrlExtension,\n v as groupBy,\n d as is,\n m as isShallowEqual,\n w as isXmlBasedMimeType,\n R as parseContentType,\n O as shallowMergeIfDefined,\n E as urlJoin\n};\n//# sourceMappingURL=index.js.map\n","import { Report } from \"@prose-reader/shared\"\nimport { name } from \"../package.json\"\n\nconst IS_DEBUG_ENABLED = true\n\nexport const report = Report.namespace(name, IS_DEBUG_ENABLED)\n","import type { Reader, SpineItem } from \"@prose-reader/core\"\nimport { type Observable, of } from \"rxjs\"\nimport type { ResultItem } from \"./types\"\n\nexport type SearchResult = ResultItem[]\n\nconst searchNodeContainingText = (node: Node, text: string) => {\n const nodeList = node.childNodes\n\n if (node.nodeName === `head`) return []\n\n const rangeList: Range[] = []\n\n for (let i = 0; i < nodeList.length; i++) {\n const subNode = nodeList[i]\n\n if (!subNode) {\n continue\n }\n\n if (subNode?.hasChildNodes()) {\n rangeList.push(...searchNodeContainingText(subNode, text))\n }\n\n if (subNode.nodeType === 3) {\n const content = (subNode as Text).data.toLowerCase()\n if (content) {\n let match: RegExpExecArray | null = null\n const regexp = RegExp(`(${text})`, `gi`)\n\n // biome-ignore lint/suspicious/noAssignInExpressions: TODO\n while ((match = regexp.exec(content)) !== null) {\n if (match.index >= 0 && subNode.ownerDocument) {\n const range = subNode.ownerDocument.createRange()\n range.setStart(subNode, match.index)\n range.setEnd(subNode, match.index + text.length)\n\n rangeList.push(range)\n }\n }\n }\n }\n }\n\n return rangeList\n}\n\nexport const searchInDocument = (\n reader: Reader,\n item: SpineItem,\n doc: Document,\n text: string,\n): Observable<SearchResult> => {\n const ranges = searchNodeContainingText(doc, text)\n\n const newResults = ranges.map((range) => {\n const cfi = reader.cfi.generateCfiFromRange(range, item.item)\n\n return {\n cfi,\n } satisfies ResultItem\n })\n\n return of(newResults)\n}\n","import { deferIdle, type Reader } from \"@prose-reader/core\"\nimport { defer, forkJoin, of } from \"rxjs\"\nimport { catchError, finalize, map, switchMap } from \"rxjs/operators\"\nimport { report } from \"./report\"\nimport type { SearchResult } from \"./search\"\nimport { searchInDocument } from \"./search\"\nimport type { ResultItem, SearchEnhancerAPI } from \"./types\"\n\nexport type { SearchEnhancerAPI, ResultItem, SearchResult }\n\n/**\n * Contract of search enhancer.\n *\n * - At best a result match should be navigable. It means the search needs to\n * be done on a rendered document. This is because rendering can differ from the original\n * item resource. A resource can be something non digestible and very specific (.pdf). The search\n * enhancer is agnostic and can only search into documents.\n */\nexport const searchEnhancer =\n <InheritOptions, InheritOutput extends Reader>(\n next: (options: InheritOptions) => InheritOutput,\n ) =>\n (options: InheritOptions): InheritOutput & SearchEnhancerAPI => {\n const reader = next(options)\n\n const searchForItem = (index: number, text: string) => {\n const item = reader.spineItemsManager.get(index)\n\n if (!item) {\n return of([])\n }\n\n return deferIdle(() => reader.renderHeadless(index)).pipe(\n switchMap((result) => {\n const { doc, release } = result || {}\n\n if (!doc) return of([])\n\n return deferIdle(() =>\n searchInDocument(reader, item, doc, text),\n ).pipe(\n finalize(() => {\n release?.()\n }),\n catchError((e) => {\n report.error(e)\n\n return of([])\n }),\n )\n }),\n )\n }\n\n const search = (text: string) =>\n defer(() => {\n if (text === ``) {\n return of([])\n }\n\n const searches$ =\n reader.context.manifest?.spineItems.map((_, index) =>\n searchForItem(index, text),\n ) || []\n\n return forkJoin([...searches$, of([])])\n }).pipe(\n map((results) => {\n const flattenedResults = results.flat()\n\n report.debug(\"results\", flattenedResults)\n\n return flattenedResults\n }),\n )\n\n return {\n ...reader,\n __PROSE_READER_ENHANCER_SEARCH: true,\n search: {\n search,\n },\n }\n }\n"],"names":["Report"],"mappings":";;;;AA4EA,MAAM,CAAC,GAAG,MAAM;AAChB,EAAE,IAAI,EAAE,OAAO,MAAM,GAAG,GAAG,CAAC;AAC5B,IAAI,OAAO,MAAM;AACjB,CAAC;AACD,SAAS,CAAC,GAAG;AACb,EAAE,MAAM,CAAC,GAAG,CAAC,EAAE,EAAE,oBAAoB;AACrC,EAAE,OAAO,CAAC,KAAK,IAAE,IAAI,CAAC,KAAK,MAAM;AACjC;AACK,MAAC,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,MAAM;AAC9B,EAAE,SAAS,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;AAC7C,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI;AAC7C,IAAI,OAAO,CAAC,KAAK;AACjB,IAAI,OAAO;AACX,IAAI,CAAC;AACL,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC,CA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MAAA,MAAA,CAAO,KAAA,CAAM,WAAW,gBAAgB,CAAA;AAExC,MAAA,OAAO,gBAAA;AAAA,IACT,CAAC;AAAA,GACH;AAEF,EAAA,OAAO;AAAA,IACL,GAAG,MAAA;AAAA,IACH,8BAAA,EAAgC,IAAA;AAAA,IAChC,MAAA,EAAQ;AAAA,MACN;AAAA;AACF,GACF;AACF;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../shared/dist/index.js","../src/report.ts","../src/search.ts","../src/index.ts"],"sourcesContent":["const w = (e, n) => e === n ? !0 : e.length !== n.length ? !1 : e.every((t, r) => t === n[r]), f = (e) => e.split(/[#?]/)[0]?.split(\".\").pop()?.trim() || \"\";\nfunction g(e) {\n const n = [];\n if (e.length === 0)\n return \"\";\n if (typeof e[0] != \"string\")\n throw new TypeError(`Url must be a string. Received ${e[0]}`);\n e[0].match(/^[^/:]+:\\/*$/) && e.length > 1 && (e[0] = e.shift() + e[0]), e[0].match(/^file:\\/\\/\\//) ? e[0] = e[0].replace(/^([^/:]+):\\/*/, \"$1:///\") : e[0] = e[0].replace(/^([^/:]+):\\/*/, \"$1://\");\n for (let l = 0; l < e.length; l++) {\n let o = e[l];\n if (typeof o != \"string\")\n throw new TypeError(`Url must be a string. Received ${o}`);\n o !== \"\" && (l > 0 && (o = o.replace(/^[/]+/, \"\")), l < e.length - 1 ? o = o.replace(/[/]+$/, \"\") : o = o.replace(/[/]+$/, \"/\"), n.push(o));\n }\n let t = n.join(\"/\");\n t = t.replace(/\\/(\\?|&|#[^!])/g, \"$1\");\n const r = t.split(\"?\");\n return t = r.shift() + (r.length > 0 ? \"?\" : \"\") + r.join(\"&\"), t;\n}\nfunction y(...e) {\n const n = Array.from(Array.isArray(e[0]) ? e[0] : e);\n return g(n);\n}\nfunction b(e) {\n const n = e.split(\"/\");\n return n.pop(), n.join(\"/\");\n}\nconst d = (e) => {\n switch (f(e)) {\n case \"png\":\n return \"image/png\";\n case \"jpg\":\n return \"image/jpg\";\n case \"jpeg\":\n return \"image/jpeg\";\n case \"txt\":\n return \"text/plain\";\n case \"webp\":\n return \"image/webp\";\n case \"xhtml\":\n return \"application/xhtml+xml\";\n }\n}, m = ({\n mimeType: e,\n uri: n\n}) => (e ?? d(n ?? \"\"))?.startsWith(\"application/xhtml+xml\"), R = (e) => e.length ? e.indexOf(\";\") ? e.substring(0, e.indexOf(\";\")) : e : void 0, a = Object.prototype.hasOwnProperty, E = (e, n) => e === n ? e !== 0 || n !== 0 || 1 / e === 1 / n : !1, O = (e, n, t) => {\n if (e === n)\n return !0;\n if (typeof e != \"object\" || e === null || typeof n != \"object\" || n === null)\n return !1;\n const r = Object.keys(e), l = Object.keys(n);\n if (r.length !== l.length)\n return !1;\n const o = t && typeof t.customEqual == \"function\" ? t.customEqual : E;\n for (let c = 0; c < r.length; c++) {\n const u = r[c] || \"\";\n if (!a.call(n, u) || !o(e[u], n[u]))\n return !1;\n }\n return !0;\n}, _ = (e, n) => e.reduce(\n (t, r) => {\n const l = n(r);\n return t[l] || (t[l] = []), t[l].push(r), t;\n },\n {}\n);\nfunction x(e, n) {\n const t = { ...e };\n for (const r in n)\n if (Object.hasOwn(n, r)) {\n const l = n[r];\n (l !== void 0 || !(r in e)) && (t[r] = l);\n }\n return t;\n}\nconst h = () => {\n if (!(typeof window > \"u\"))\n return window;\n};\nfunction $() {\n const e = h()?.__PROSE_READER_DEBUG;\n return e === !0 || e === \"true\";\n}\nconst s = (e, n = $(), t) => {\n let r = n;\n const l = t?.color ? `color: ${t.color}` : void 0, o = {\n enable: (i) => {\n u(i);\n },\n namespace: (i, p) => s(`${e} [${i}]`, p, t),\n isEnabled: () => r,\n debug: () => {\n },\n info: () => {\n },\n log: () => {\n },\n groupCollapsed: () => {\n },\n groupEnd: () => {\n },\n getGroupArgs: (i) => l ? [`%c${e ? `${e} ${i}` : i}`, l] : [e ? `${e} ${i}` : i],\n warn: () => {\n },\n error: () => {\n }\n }, c = (i) => {\n if (!i) {\n o.debug = () => {\n }, o.info = () => {\n }, o.log = () => {\n }, o.groupCollapsed = () => {\n }, o.groupEnd = () => {\n }, o.warn = () => {\n }, o.error = () => {\n };\n return;\n }\n o.debug = e ? Function.prototype.bind.call(\n console.debug,\n console,\n e,\n `%c${e}`,\n l\n ) : Function.prototype.bind.call(\n console.debug,\n console,\n `%c${e}`,\n l\n ), o.info = Function.prototype.bind.call(\n console.info,\n console,\n `%c${e}`,\n l\n ), o.log = e ? Function.prototype.bind.call(\n console.log,\n console,\n `%c${e}`,\n l\n ) : Function.prototype.bind.call(console.log, console), o.groupCollapsed = Function.prototype.bind.call(\n console.groupCollapsed,\n console\n ), o.groupEnd = Function.prototype.bind.call(console.groupEnd, console), o.warn = Function.prototype.bind.call(\n console.warn,\n console,\n `%c${e}`,\n l\n ), o.error = Function.prototype.bind.call(\n console.error,\n console,\n `%c${e}`,\n l\n );\n }, u = (i) => {\n r !== i && (r = i, c(r));\n };\n return c(r), o;\n}, F = {\n ...s(),\n namespace: (e, n, t) => s(`[${e}]`, n, t)\n}, T = \"prose-reader-resource-error\";\nexport {\n T as PROSE_READER_RESOURCE_ERROR_INJECTED_META_NAME,\n F as Report,\n w as arrayEqual,\n d as detectMimeTypeFromName,\n b as getParentPath,\n f as getUrlExtension,\n _ as groupBy,\n E as is,\n O as isShallowEqual,\n m as isXmlBasedMimeType,\n R as parseContentType,\n x as shallowMergeIfDefined,\n y as urlJoin\n};\n//# sourceMappingURL=index.js.map\n","import { Report } from \"@prose-reader/shared\"\nimport { name } from \"../package.json\"\n\nconst IS_DEBUG_ENABLED = true\n\nexport const report = Report.namespace(name, IS_DEBUG_ENABLED)\n","import type { Reader, SpineItem } from \"@prose-reader/core\"\nimport { type Observable, of } from \"rxjs\"\nimport type { ResultItem } from \"./types\"\n\nexport type SearchResult = ResultItem[]\n\nconst searchNodeContainingText = (node: Node, text: string) => {\n const nodeList = node.childNodes\n\n if (node.nodeName === `head`) return []\n\n const rangeList: Range[] = []\n\n for (let i = 0; i < nodeList.length; i++) {\n const subNode = nodeList[i]\n\n if (!subNode) {\n continue\n }\n\n if (subNode?.hasChildNodes()) {\n rangeList.push(...searchNodeContainingText(subNode, text))\n }\n\n if (subNode.nodeType === 3) {\n const content = (subNode as Text).data.toLowerCase()\n if (content) {\n let match: RegExpExecArray | null = null\n const regexp = RegExp(`(${text})`, `gi`)\n\n // biome-ignore lint/suspicious/noAssignInExpressions: TODO\n while ((match = regexp.exec(content)) !== null) {\n if (match.index >= 0 && subNode.ownerDocument) {\n const range = subNode.ownerDocument.createRange()\n range.setStart(subNode, match.index)\n range.setEnd(subNode, match.index + text.length)\n\n rangeList.push(range)\n }\n }\n }\n }\n }\n\n return rangeList\n}\n\nexport const searchInDocument = (\n reader: Reader,\n item: SpineItem,\n doc: Document,\n text: string,\n): Observable<SearchResult> => {\n const ranges = searchNodeContainingText(doc, text)\n\n const newResults = ranges.map((range) => {\n const cfi = reader.cfi.generateCfiFromRange(range, item.item)\n\n return {\n cfi,\n } satisfies ResultItem\n })\n\n return of(newResults)\n}\n","import { deferIdle, type Reader } from \"@prose-reader/core\"\nimport { defer, forkJoin, of } from \"rxjs\"\nimport { catchError, finalize, map, switchMap } from \"rxjs/operators\"\nimport { report } from \"./report\"\nimport type { SearchResult } from \"./search\"\nimport { searchInDocument } from \"./search\"\nimport type { ResultItem, SearchEnhancerAPI } from \"./types\"\n\nexport type { SearchEnhancerAPI, ResultItem, SearchResult }\n\n/**\n * Contract of search enhancer.\n *\n * - At best a result match should be navigable. It means the search needs to\n * be done on a rendered document. This is because rendering can differ from the original\n * item resource. A resource can be something non digestible and very specific (.pdf). The search\n * enhancer is agnostic and can only search into documents.\n */\nexport const searchEnhancer =\n <InheritOptions, InheritOutput extends Reader>(\n next: (options: InheritOptions) => InheritOutput,\n ) =>\n (options: InheritOptions): InheritOutput & SearchEnhancerAPI => {\n const reader = next(options)\n\n const searchForItem = (index: number, text: string) => {\n const item = reader.spineItemsManager.get(index)\n\n if (!item) {\n return of([])\n }\n\n return deferIdle(() => reader.renderHeadless(index)).pipe(\n switchMap((result) => {\n const { doc, release } = result || {}\n\n if (!doc) return of([])\n\n return deferIdle(() =>\n searchInDocument(reader, item, doc, text),\n ).pipe(\n finalize(() => {\n release?.()\n }),\n catchError((e) => {\n report.error(e)\n\n return of([])\n }),\n )\n }),\n )\n }\n\n const search = (text: string) =>\n defer(() => {\n if (text === ``) {\n return of([])\n }\n\n const searches$ =\n reader.context.manifest?.spineItems.map((_, index) =>\n searchForItem(index, text),\n ) || []\n\n return forkJoin([...searches$, of([])])\n }).pipe(\n map((results) => {\n const flattenedResults = results.flat()\n\n report.debug(\"results\", flattenedResults)\n\n return flattenedResults\n }),\n )\n\n return {\n ...reader,\n __PROSE_READER_ENHANCER_SEARCH: true,\n search: {\n search,\n },\n }\n }\n"],"names":["Report"],"mappings":";;;;AA4EA,MAAM,CAAC,GAAG,MAAM;AAChB,EAAE,IAAI,EAAE,OAAO,MAAM,GAAG,GAAG,CAAC;AAC5B,IAAI,OAAO,MAAM;AACjB,CAAC;AACD,SAAS,CAAC,GAAG;AACb,EAAE,MAAM,CAAC,GAAG,CAAC,EAAE,EAAE,oBAAoB;AACrC,EAAE,OAAO,CAAC,KAAK,IAAE,IAAI,CAAC,KAAK,MAAM;AACjC;AACK,MAAC,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,KAAK;AAC7B,EAAE,IAAI,CAAC,GAAG,CAAC;AACX,EAAE,MAAM,CAAC,GAAG,CAAC,EAAE,KAAK,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,MAAM,EAAE,CAAC,GAAG;AACzD,IAAI,MAAM,EAAE,CAAC,CAAC,KAAK;AACnB,MAAM,CAAC,CAAC,CAAC,CAAC;AACV,IAAI,CAAC;AACL,IAAI,SAAS,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC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AAE,CAAA;AAAA,IACd;AAEA,IAAA,MAAM,SAAA,GACJ,MAAA,CAAO,OAAA,CAAQ,QAAA,EAAU,UAAA,CAAW,GAAA;AAAA,MAAI,CAAC,CAAA,EAAG,KAAA,KAC1C,aAAA,CAAc,OAAO,IAAI;AAAA,SACtB,EAAC;AAER,IAAA,OAAO,QAAA,CAAS,CAAC,GAAG,SAAA,EAAW,GAAG,EAAE,CAAC,CAAC,CAAA;AAAA,EACxC,CAAC,CAAA,CAAE,IAAA;AAAA,IACD,GAAA,CAAI,CAAC,OAAA,KAAY;AACf,MAAA,MAAM,gBAAA,GAAmB,QAAQ,IAAA,EAAK;AAEtC,MAAA,MAAA,CAAO,KAAA,CAAM,WAAW,gBAAgB,CAAA;AAExC,MAAA,OAAO,gBAAA;AAAA,IACT,CAAC;AAAA,GACH;AAEF,EAAA,OAAO;AAAA,IACL,GAAG,MAAA;AAAA,IACH,8BAAA,EAAgC,IAAA;AAAA,IAChC,MAAA,EAAQ;AAAA,MACN;AAAA;AACF,GACF;AACF;;;;"}
@@ -9,76 +9,92 @@
9
9
  return window;
10
10
  };
11
11
  function $() {
12
- const o = h()?.__PROSE_READER_DEBUG;
13
- return o === true || o === "true";
12
+ const e = h()?.__PROSE_READER_DEBUG;
13
+ return e === true || e === "true";
14
14
  }
15
- const u = (o, n = $(), e) => ({
16
- namespace: (t, l) => u(`${o} [${t}]`, l, e),
17
- debug: n ? o ? Function.prototype.bind.call(
18
- console.debug,
19
- console,
20
- o,
21
- `%c${o}`,
22
- e?.color ? `color: ${e.color}` : void 0
23
- ) : Function.prototype.bind.call(
24
- console.debug,
25
- console,
26
- `%c${o}`,
27
- e?.color ? `color: ${e.color}` : void 0
28
- ) : () => {
29
- },
30
- info: n ? o ? Function.prototype.bind.call(
31
- console.info,
32
- console,
33
- `%c${o}`,
34
- e?.color ? `color: ${e.color}` : void 0
35
- ) : Function.prototype.bind.call(
36
- console.info,
37
- console,
38
- `%c${o}`,
39
- e?.color ? `color: ${e.color}` : void 0
40
- ) : () => {
41
- },
42
- log: n ? o ? Function.prototype.bind.call(
43
- console.log,
44
- console,
45
- `%c${o}`,
46
- e?.color ? `color: ${e.color}` : void 0
47
- ) : Function.prototype.bind.call(console.log, console) : () => {
48
- },
49
- warn: n ? o ? Function.prototype.bind.call(
50
- console.warn,
51
- console,
52
- `%c${o}`,
53
- e?.color ? `color: ${e.color}` : void 0
54
- ) : Function.prototype.bind.call(
55
- console.warn,
56
- console,
57
- `%c${o}`,
58
- e?.color ? `color: ${e.color}` : void 0
59
- ) : () => {
60
- },
61
- error: n ? o ? Function.prototype.bind.call(
62
- console.error,
63
- console,
64
- `%c${o}`,
65
- e?.color ? `color: ${e.color}` : void 0
66
- ) : Function.prototype.bind.call(
67
- console.error,
68
- console,
69
- `%c${o}`,
70
- e?.color ? `color: ${e.color}` : void 0
71
- ) : () => {
72
- }
73
- }), _ = {
74
- ...u(),
75
- namespace: (o, n, e) => u(`[${o}]`, n, e)
15
+ const s = (e, n = $(), t) => {
16
+ let r = n;
17
+ const l = t?.color ? `color: ${t.color}` : void 0, o = {
18
+ enable: (i) => {
19
+ u(i);
20
+ },
21
+ namespace: (i, p) => s(`${e} [${i}]`, p, t),
22
+ isEnabled: () => r,
23
+ debug: () => {
24
+ },
25
+ info: () => {
26
+ },
27
+ log: () => {
28
+ },
29
+ groupCollapsed: () => {
30
+ },
31
+ groupEnd: () => {
32
+ },
33
+ getGroupArgs: (i) => l ? [`%c${e ? `${e} ${i}` : i}`, l] : [e ? `${e} ${i}` : i],
34
+ warn: () => {
35
+ },
36
+ error: () => {
37
+ }
38
+ }, c = (i) => {
39
+ if (!i) {
40
+ o.debug = () => {
41
+ }, o.info = () => {
42
+ }, o.log = () => {
43
+ }, o.groupCollapsed = () => {
44
+ }, o.groupEnd = () => {
45
+ }, o.warn = () => {
46
+ }, o.error = () => {
47
+ };
48
+ return;
49
+ }
50
+ o.debug = e ? Function.prototype.bind.call(
51
+ console.debug,
52
+ console,
53
+ e,
54
+ `%c${e}`,
55
+ l
56
+ ) : Function.prototype.bind.call(
57
+ console.debug,
58
+ console,
59
+ `%c${e}`,
60
+ l
61
+ ), o.info = Function.prototype.bind.call(
62
+ console.info,
63
+ console,
64
+ `%c${e}`,
65
+ l
66
+ ), o.log = e ? Function.prototype.bind.call(
67
+ console.log,
68
+ console,
69
+ `%c${e}`,
70
+ l
71
+ ) : Function.prototype.bind.call(console.log, console), o.groupCollapsed = Function.prototype.bind.call(
72
+ console.groupCollapsed,
73
+ console
74
+ ), o.groupEnd = Function.prototype.bind.call(console.groupEnd, console), o.warn = Function.prototype.bind.call(
75
+ console.warn,
76
+ console,
77
+ `%c${e}`,
78
+ l
79
+ ), o.error = Function.prototype.bind.call(
80
+ console.error,
81
+ console,
82
+ `%c${e}`,
83
+ l
84
+ );
85
+ }, u = (i) => {
86
+ r !== i && (r = i, c(r));
87
+ };
88
+ return c(r), o;
89
+ }, F = {
90
+ ...s(),
91
+ namespace: (e, n, t) => s(`[${e}]`, n, t)
76
92
  };
77
93
 
78
94
  const name = "@prose-reader/enhancer-search";
79
95
 
80
96
  const IS_DEBUG_ENABLED = true;
81
- const report = _.namespace(name, IS_DEBUG_ENABLED);
97
+ const report = F.namespace(name, IS_DEBUG_ENABLED);
82
98
 
83
99
  const searchNodeContainingText = (node, text) => {
84
100
  const nodeList = node.childNodes;
@@ -1 +1 @@
1
- {"version":3,"file":"index.umd.cjs","sources":["../../shared/dist/index.js","../src/report.ts","../src/search.ts","../src/index.ts"],"sourcesContent":["const a = (o, n) => o === n ? !0 : o.length !== n.length ? !1 : o.every((e, t) => e === n[t]), f = (o) => o.split(/[#?]/)[0]?.split(\".\").pop()?.trim() || \"\";\nfunction s(o) {\n const n = [];\n if (o.length === 0)\n return \"\";\n if (typeof o[0] != \"string\")\n throw new TypeError(`Url must be a string. Received ${o[0]}`);\n o[0].match(/^[^/:]+:\\/*$/) && o.length > 1 && (o[0] = o.shift() + o[0]), o[0].match(/^file:\\/\\/\\//) ? o[0] = o[0].replace(/^([^/:]+):\\/*/, \"$1:///\") : o[0] = o[0].replace(/^([^/:]+):\\/*/, \"$1://\");\n for (let l = 0; l < o.length; l++) {\n let r = o[l];\n if (typeof r != \"string\")\n throw new TypeError(`Url must be a string. Received ${r}`);\n r !== \"\" && (l > 0 && (r = r.replace(/^[/]+/, \"\")), l < o.length - 1 ? r = r.replace(/[/]+$/, \"\") : r = r.replace(/[/]+$/, \"/\"), n.push(r));\n }\n let e = n.join(\"/\");\n e = e.replace(/\\/(\\?|&|#[^!])/g, \"$1\");\n const t = e.split(\"?\");\n return e = t.shift() + (t.length > 0 ? \"?\" : \"\") + t.join(\"&\"), e;\n}\nfunction E(...o) {\n const n = Array.from(Array.isArray(o[0]) ? o[0] : o);\n return s(n);\n}\nfunction y(o) {\n const n = o.split(\"/\");\n return n.pop(), n.join(\"/\");\n}\nconst p = (o) => {\n switch (f(o)) {\n case \"png\":\n return \"image/png\";\n case \"jpg\":\n return \"image/jpg\";\n case \"jpeg\":\n return \"image/jpeg\";\n case \"txt\":\n return \"text/plain\";\n case \"webp\":\n return \"image/webp\";\n case \"xhtml\":\n return \"application/xhtml+xml\";\n }\n}, w = ({\n mimeType: o,\n uri: n\n}) => (o ?? p(n ?? \"\"))?.startsWith(\"application/xhtml+xml\"), R = (o) => o.length ? o.indexOf(\";\") ? o.substring(0, o.indexOf(\";\")) : o : void 0, g = Object.prototype.hasOwnProperty, d = (o, n) => o === n ? o !== 0 || n !== 0 || 1 / o === 1 / n : !1, m = (o, n, e) => {\n if (o === n)\n return !0;\n if (typeof o != \"object\" || o === null || typeof n != \"object\" || n === null)\n return !1;\n const t = Object.keys(o), l = Object.keys(n);\n if (t.length !== l.length)\n return !1;\n const r = e && typeof e.customEqual == \"function\" ? e.customEqual : d;\n for (let c = 0; c < t.length; c++) {\n const i = t[c] || \"\";\n if (!g.call(n, i) || !r(o[i], n[i]))\n return !1;\n }\n return !0;\n}, v = (o, n) => o.reduce(\n (e, t) => {\n const l = n(t);\n return e[l] || (e[l] = []), e[l].push(t), e;\n },\n {}\n);\nfunction O(o, n) {\n const e = { ...o };\n for (const t in n)\n if (Object.hasOwn(n, t)) {\n const l = n[t];\n (l !== void 0 || !(t in o)) && (e[t] = l);\n }\n return e;\n}\nconst h = () => {\n if (!(typeof window > \"u\"))\n return window;\n};\nfunction $() {\n const o = h()?.__PROSE_READER_DEBUG;\n return o === !0 || o === \"true\";\n}\nconst u = (o, n = $(), e) => ({\n namespace: (t, l) => u(`${o} [${t}]`, l, e),\n debug: n ? o ? Function.prototype.bind.call(\n console.debug,\n console,\n o,\n `%c${o}`,\n e?.color ? `color: ${e.color}` : void 0\n ) : Function.prototype.bind.call(\n console.debug,\n console,\n `%c${o}`,\n e?.color ? `color: ${e.color}` : void 0\n ) : () => {\n },\n info: n ? o ? Function.prototype.bind.call(\n console.info,\n console,\n `%c${o}`,\n e?.color ? `color: ${e.color}` : void 0\n ) : Function.prototype.bind.call(\n console.info,\n console,\n `%c${o}`,\n e?.color ? `color: ${e.color}` : void 0\n ) : () => {\n },\n log: n ? o ? Function.prototype.bind.call(\n console.log,\n console,\n `%c${o}`,\n e?.color ? `color: ${e.color}` : void 0\n ) : Function.prototype.bind.call(console.log, console) : () => {\n },\n warn: n ? o ? Function.prototype.bind.call(\n console.warn,\n console,\n `%c${o}`,\n e?.color ? `color: ${e.color}` : void 0\n ) : Function.prototype.bind.call(\n console.warn,\n console,\n `%c${o}`,\n e?.color ? `color: ${e.color}` : void 0\n ) : () => {\n },\n error: n ? o ? Function.prototype.bind.call(\n console.error,\n console,\n `%c${o}`,\n e?.color ? `color: ${e.color}` : void 0\n ) : Function.prototype.bind.call(\n console.error,\n console,\n `%c${o}`,\n e?.color ? `color: ${e.color}` : void 0\n ) : () => {\n }\n}), _ = {\n ...u(),\n namespace: (o, n, e) => u(`[${o}]`, n, e)\n}, x = \"prose-reader-resource-error\";\nexport {\n x as PROSE_READER_RESOURCE_ERROR_INJECTED_META_NAME,\n _ as Report,\n a as arrayEqual,\n p as detectMimeTypeFromName,\n y as getParentPath,\n f as getUrlExtension,\n v as groupBy,\n d as is,\n m as isShallowEqual,\n w as isXmlBasedMimeType,\n R as parseContentType,\n O as shallowMergeIfDefined,\n E as urlJoin\n};\n//# sourceMappingURL=index.js.map\n","import { Report } from \"@prose-reader/shared\"\nimport { name } from \"../package.json\"\n\nconst IS_DEBUG_ENABLED = true\n\nexport const report = Report.namespace(name, IS_DEBUG_ENABLED)\n","import type { Reader, SpineItem } from \"@prose-reader/core\"\nimport { type Observable, of } from \"rxjs\"\nimport type { ResultItem } from \"./types\"\n\nexport type SearchResult = ResultItem[]\n\nconst searchNodeContainingText = (node: Node, text: string) => {\n const nodeList = node.childNodes\n\n if (node.nodeName === `head`) return []\n\n const rangeList: Range[] = []\n\n for (let i = 0; i < nodeList.length; i++) {\n const subNode = nodeList[i]\n\n if (!subNode) {\n continue\n }\n\n if (subNode?.hasChildNodes()) {\n rangeList.push(...searchNodeContainingText(subNode, text))\n }\n\n if (subNode.nodeType === 3) {\n const content = (subNode as Text).data.toLowerCase()\n if (content) {\n let match: RegExpExecArray | null = null\n const regexp = RegExp(`(${text})`, `gi`)\n\n // biome-ignore lint/suspicious/noAssignInExpressions: TODO\n while ((match = regexp.exec(content)) !== null) {\n if (match.index >= 0 && subNode.ownerDocument) {\n const range = subNode.ownerDocument.createRange()\n range.setStart(subNode, match.index)\n range.setEnd(subNode, match.index + text.length)\n\n rangeList.push(range)\n }\n }\n }\n }\n }\n\n return rangeList\n}\n\nexport const searchInDocument = (\n reader: Reader,\n item: SpineItem,\n doc: Document,\n text: string,\n): Observable<SearchResult> => {\n const ranges = searchNodeContainingText(doc, text)\n\n const newResults = ranges.map((range) => {\n const cfi = reader.cfi.generateCfiFromRange(range, item.item)\n\n return {\n cfi,\n } satisfies ResultItem\n })\n\n return of(newResults)\n}\n","import { deferIdle, type Reader } from \"@prose-reader/core\"\nimport { defer, forkJoin, of } from \"rxjs\"\nimport { catchError, finalize, map, switchMap } from \"rxjs/operators\"\nimport { report } from \"./report\"\nimport type { SearchResult } from \"./search\"\nimport { searchInDocument } from \"./search\"\nimport type { ResultItem, SearchEnhancerAPI } from \"./types\"\n\nexport type { SearchEnhancerAPI, ResultItem, SearchResult }\n\n/**\n * Contract of search enhancer.\n *\n * - At best a result match should be navigable. It means the search needs to\n * be done on a rendered document. This is because rendering can differ from the original\n * item resource. A resource can be something non digestible and very specific (.pdf). The search\n * enhancer is agnostic and can only search into documents.\n */\nexport const searchEnhancer =\n <InheritOptions, InheritOutput extends Reader>(\n next: (options: InheritOptions) => InheritOutput,\n ) =>\n (options: InheritOptions): InheritOutput & SearchEnhancerAPI => {\n const reader = next(options)\n\n const searchForItem = (index: number, text: string) => {\n const item = reader.spineItemsManager.get(index)\n\n if (!item) {\n return of([])\n }\n\n return deferIdle(() => reader.renderHeadless(index)).pipe(\n switchMap((result) => {\n const { doc, release } = result || {}\n\n if (!doc) return of([])\n\n return deferIdle(() =>\n searchInDocument(reader, item, doc, text),\n ).pipe(\n finalize(() => {\n release?.()\n }),\n catchError((e) => {\n report.error(e)\n\n return of([])\n }),\n )\n }),\n )\n }\n\n const search = (text: string) =>\n defer(() => {\n if (text === ``) {\n return of([])\n }\n\n const searches$ =\n reader.context.manifest?.spineItems.map((_, index) =>\n searchForItem(index, text),\n ) || []\n\n return forkJoin([...searches$, of([])])\n }).pipe(\n map((results) => {\n const flattenedResults = results.flat()\n\n report.debug(\"results\", flattenedResults)\n\n return flattenedResults\n }),\n )\n\n return {\n ...reader,\n __PROSE_READER_ENHANCER_SEARCH: true,\n search: {\n search,\n },\n }\n }\n"],"names":["Report","of","deferIdle","switchMap","finalize","catchError","defer","forkJoin","map"],"mappings":";;;;;;EA4EA,MAAM,CAAC,GAAG,MAAM;EAChB,EAAE,IAAI,EAAE,OAAO,MAAM,GAAG,GAAG,CAAC;EAC5B,IAAI,OAAO,MAAM;EACjB,CAAC;EACD,SAAS,CAAC,GAAG;EACb,EAAE,MAAM,CAAC,GAAG,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AAA;EAEA,EAAA,MAAM,MAAA,GAAS,CAAC,IAAA,KACdK,UAAA,CAAM,MAAM;EACV,IAAA,IAAI,SAAS,CAAA,CAAA,EAAI;EACf,MAAA,OAAOL,OAAA,CAAG,EAAE,CAAA;EAAA,IACd;EAEA,IAAA,MAAM,SAAA,GACJ,MAAA,CAAO,OAAA,CAAQ,QAAA,EAAU,UAAA,CAAW,GAAA;EAAA,MAAI,CAAC,CAAA,EAAG,KAAA,KAC1C,aAAA,CAAc,OAAO,IAAI;EAAA,SACtB,EAAC;EAER,IAAA,OAAOM,aAAA,CAAS,CAAC,GAAG,SAAA,EAAWN,QAAG,EAAE,CAAC,CAAC,CAAA;EAAA,EACxC,CAAC,CAAA,CAAE,IAAA;EAAA,IACDO,aAAA,CAAI,CAAC,OAAA,KAAY;EACf,MAAA,MAAM,gBAAA,GAAmB,QAAQ,IAAA,EAAK;EAEtC,MAAA,MAAA,CAAO,KAAA,CAAM,WAAW,gBAAgB,CAAA;EAExC,MAAA,OAAO,gBAAA;EAAA,IACT,CAAC;EAAA,GACH;EAEF,EAAA,OAAO;EAAA,IACL,GAAG,MAAA;EAAA,IACH,8BAAA,EAAgC,IAAA;EAAA,IAChC,MAAA,EAAQ;EAAA,MACN;EAAA;EACF,GACF;EACF;;;;;;;;;;"}
1
+ {"version":3,"file":"index.umd.cjs","sources":["../../shared/dist/index.js","../src/report.ts","../src/search.ts","../src/index.ts"],"sourcesContent":["const w = (e, n) => e === n ? !0 : e.length !== n.length ? !1 : e.every((t, r) => t === n[r]), f = (e) => e.split(/[#?]/)[0]?.split(\".\").pop()?.trim() || \"\";\nfunction g(e) {\n const n = [];\n if (e.length === 0)\n return \"\";\n if (typeof e[0] != \"string\")\n throw new TypeError(`Url must be a string. Received ${e[0]}`);\n e[0].match(/^[^/:]+:\\/*$/) && e.length > 1 && (e[0] = e.shift() + e[0]), e[0].match(/^file:\\/\\/\\//) ? e[0] = e[0].replace(/^([^/:]+):\\/*/, \"$1:///\") : e[0] = e[0].replace(/^([^/:]+):\\/*/, \"$1://\");\n for (let l = 0; l < e.length; l++) {\n let o = e[l];\n if (typeof o != \"string\")\n throw new TypeError(`Url must be a string. Received ${o}`);\n o !== \"\" && (l > 0 && (o = o.replace(/^[/]+/, \"\")), l < e.length - 1 ? o = o.replace(/[/]+$/, \"\") : o = o.replace(/[/]+$/, \"/\"), n.push(o));\n }\n let t = n.join(\"/\");\n t = t.replace(/\\/(\\?|&|#[^!])/g, \"$1\");\n const r = t.split(\"?\");\n return t = r.shift() + (r.length > 0 ? \"?\" : \"\") + r.join(\"&\"), t;\n}\nfunction y(...e) {\n const n = Array.from(Array.isArray(e[0]) ? e[0] : e);\n return g(n);\n}\nfunction b(e) {\n const n = e.split(\"/\");\n return n.pop(), n.join(\"/\");\n}\nconst d = (e) => {\n switch (f(e)) {\n case \"png\":\n return \"image/png\";\n case \"jpg\":\n return \"image/jpg\";\n case \"jpeg\":\n return \"image/jpeg\";\n case \"txt\":\n return \"text/plain\";\n case \"webp\":\n return \"image/webp\";\n case \"xhtml\":\n return \"application/xhtml+xml\";\n }\n}, m = ({\n mimeType: e,\n uri: n\n}) => (e ?? d(n ?? \"\"))?.startsWith(\"application/xhtml+xml\"), R = (e) => e.length ? e.indexOf(\";\") ? e.substring(0, e.indexOf(\";\")) : e : void 0, a = Object.prototype.hasOwnProperty, E = (e, n) => e === n ? e !== 0 || n !== 0 || 1 / e === 1 / n : !1, O = (e, n, t) => {\n if (e === n)\n return !0;\n if (typeof e != \"object\" || e === null || typeof n != \"object\" || n === null)\n return !1;\n const r = Object.keys(e), l = Object.keys(n);\n if (r.length !== l.length)\n return !1;\n const o = t && typeof t.customEqual == \"function\" ? t.customEqual : E;\n for (let c = 0; c < r.length; c++) {\n const u = r[c] || \"\";\n if (!a.call(n, u) || !o(e[u], n[u]))\n return !1;\n }\n return !0;\n}, _ = (e, n) => e.reduce(\n (t, r) => {\n const l = n(r);\n return t[l] || (t[l] = []), t[l].push(r), t;\n },\n {}\n);\nfunction x(e, n) {\n const t = { ...e };\n for (const r in n)\n if (Object.hasOwn(n, r)) {\n const l = n[r];\n (l !== void 0 || !(r in e)) && (t[r] = l);\n }\n return t;\n}\nconst h = () => {\n if (!(typeof window > \"u\"))\n return window;\n};\nfunction $() {\n const e = h()?.__PROSE_READER_DEBUG;\n return e === !0 || e === \"true\";\n}\nconst s = (e, n = $(), t) => {\n let r = n;\n const l = t?.color ? `color: ${t.color}` : void 0, o = {\n enable: (i) => {\n u(i);\n },\n namespace: (i, p) => s(`${e} [${i}]`, p, t),\n isEnabled: () => r,\n debug: () => {\n },\n info: () => {\n },\n log: () => {\n },\n groupCollapsed: () => {\n },\n groupEnd: () => {\n },\n getGroupArgs: (i) => l ? [`%c${e ? `${e} ${i}` : i}`, l] : [e ? `${e} ${i}` : i],\n warn: () => {\n },\n error: () => {\n }\n }, c = (i) => {\n if (!i) {\n o.debug = () => {\n }, o.info = () => {\n }, o.log = () => {\n }, o.groupCollapsed = () => {\n }, o.groupEnd = () => {\n }, o.warn = () => {\n }, o.error = () => {\n };\n return;\n }\n o.debug = e ? Function.prototype.bind.call(\n console.debug,\n console,\n e,\n `%c${e}`,\n l\n ) : Function.prototype.bind.call(\n console.debug,\n console,\n `%c${e}`,\n l\n ), o.info = Function.prototype.bind.call(\n console.info,\n console,\n `%c${e}`,\n l\n ), o.log = e ? Function.prototype.bind.call(\n console.log,\n console,\n `%c${e}`,\n l\n ) : Function.prototype.bind.call(console.log, console), o.groupCollapsed = Function.prototype.bind.call(\n console.groupCollapsed,\n console\n ), o.groupEnd = Function.prototype.bind.call(console.groupEnd, console), o.warn = Function.prototype.bind.call(\n console.warn,\n console,\n `%c${e}`,\n l\n ), o.error = Function.prototype.bind.call(\n console.error,\n console,\n `%c${e}`,\n l\n );\n }, u = (i) => {\n r !== i && (r = i, c(r));\n };\n return c(r), o;\n}, F = {\n ...s(),\n namespace: (e, n, t) => s(`[${e}]`, n, t)\n}, T = \"prose-reader-resource-error\";\nexport {\n T as PROSE_READER_RESOURCE_ERROR_INJECTED_META_NAME,\n F as Report,\n w as arrayEqual,\n d as detectMimeTypeFromName,\n b as getParentPath,\n f as getUrlExtension,\n _ as groupBy,\n E as is,\n O as isShallowEqual,\n m as isXmlBasedMimeType,\n R as parseContentType,\n x as shallowMergeIfDefined,\n y as urlJoin\n};\n//# sourceMappingURL=index.js.map\n","import { Report } from \"@prose-reader/shared\"\nimport { name } from \"../package.json\"\n\nconst IS_DEBUG_ENABLED = true\n\nexport const report = Report.namespace(name, IS_DEBUG_ENABLED)\n","import type { Reader, SpineItem } from \"@prose-reader/core\"\nimport { type Observable, of } from \"rxjs\"\nimport type { ResultItem } from \"./types\"\n\nexport type SearchResult = ResultItem[]\n\nconst searchNodeContainingText = (node: Node, text: string) => {\n const nodeList = node.childNodes\n\n if (node.nodeName === `head`) return []\n\n const rangeList: Range[] = []\n\n for (let i = 0; i < nodeList.length; i++) {\n const subNode = nodeList[i]\n\n if (!subNode) {\n continue\n }\n\n if (subNode?.hasChildNodes()) {\n rangeList.push(...searchNodeContainingText(subNode, text))\n }\n\n if (subNode.nodeType === 3) {\n const content = (subNode as Text).data.toLowerCase()\n if (content) {\n let match: RegExpExecArray | null = null\n const regexp = RegExp(`(${text})`, `gi`)\n\n // biome-ignore lint/suspicious/noAssignInExpressions: TODO\n while ((match = regexp.exec(content)) !== null) {\n if (match.index >= 0 && subNode.ownerDocument) {\n const range = subNode.ownerDocument.createRange()\n range.setStart(subNode, match.index)\n range.setEnd(subNode, match.index + text.length)\n\n rangeList.push(range)\n }\n }\n }\n }\n }\n\n return rangeList\n}\n\nexport const searchInDocument = (\n reader: Reader,\n item: SpineItem,\n doc: Document,\n text: string,\n): Observable<SearchResult> => {\n const ranges = searchNodeContainingText(doc, text)\n\n const newResults = ranges.map((range) => {\n const cfi = reader.cfi.generateCfiFromRange(range, item.item)\n\n return {\n cfi,\n } satisfies ResultItem\n })\n\n return of(newResults)\n}\n","import { deferIdle, type Reader } from \"@prose-reader/core\"\nimport { defer, forkJoin, of } from \"rxjs\"\nimport { catchError, finalize, map, switchMap } from \"rxjs/operators\"\nimport { report } from \"./report\"\nimport type { SearchResult } from \"./search\"\nimport { searchInDocument } from \"./search\"\nimport type { ResultItem, SearchEnhancerAPI } from \"./types\"\n\nexport type { SearchEnhancerAPI, ResultItem, SearchResult }\n\n/**\n * Contract of search enhancer.\n *\n * - At best a result match should be navigable. It means the search needs to\n * be done on a rendered document. This is because rendering can differ from the original\n * item resource. A resource can be something non digestible and very specific (.pdf). The search\n * enhancer is agnostic and can only search into documents.\n */\nexport const searchEnhancer =\n <InheritOptions, InheritOutput extends Reader>(\n next: (options: InheritOptions) => InheritOutput,\n ) =>\n (options: InheritOptions): InheritOutput & SearchEnhancerAPI => {\n const reader = next(options)\n\n const searchForItem = (index: number, text: string) => {\n const item = reader.spineItemsManager.get(index)\n\n if (!item) {\n return of([])\n }\n\n return deferIdle(() => reader.renderHeadless(index)).pipe(\n switchMap((result) => {\n const { doc, release } = result || {}\n\n if (!doc) return of([])\n\n return deferIdle(() =>\n searchInDocument(reader, item, doc, text),\n ).pipe(\n finalize(() => {\n release?.()\n }),\n catchError((e) => {\n report.error(e)\n\n return of([])\n }),\n )\n }),\n )\n }\n\n const search = (text: string) =>\n defer(() => {\n if (text === ``) {\n return of([])\n }\n\n const searches$ =\n reader.context.manifest?.spineItems.map((_, index) =>\n searchForItem(index, text),\n ) || []\n\n return forkJoin([...searches$, of([])])\n }).pipe(\n map((results) => {\n const flattenedResults = results.flat()\n\n report.debug(\"results\", flattenedResults)\n\n return flattenedResults\n }),\n )\n\n return {\n ...reader,\n __PROSE_READER_ENHANCER_SEARCH: true,\n search: {\n search,\n },\n }\n }\n"],"names":["Report","of","deferIdle","switchMap","finalize","catchError","defer","forkJoin","map"],"mappings":";;;;;;EA4EA,MAAM,CAAC,GAAG,MAAM;EAChB,EAAE,IAAI,EAAE,OAAO,MAAM,GAAG,GAAG,CAAC;EAC5B,IAAI,OAAO,MAAM;EACjB,CAA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AAA,EAAQ;EAAA,MACN;EAAA;EACF,GACF;EACF;;;;;;;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prose-reader/enhancer-search",
3
- "version": "1.275.0",
3
+ "version": "1.277.0",
4
4
  "type": "module",
5
5
  "main": "./dist/index.umd.cjs",
6
6
  "module": "./dist/index.js",
@@ -20,10 +20,10 @@
20
20
  "test": "vitest run --coverage"
21
21
  },
22
22
  "dependencies": {
23
- "@prose-reader/core": "^1.275.0"
23
+ "@prose-reader/core": "^1.277.0"
24
24
  },
25
25
  "peerDependencies": {
26
26
  "rxjs": "*"
27
27
  },
28
- "gitHead": "f1f2246b951a8cf93d0aeb61ed1fb390d291282f"
28
+ "gitHead": "2a941001e0085bcf2360a54ef2441cbc10bf1744"
29
29
  }