@faith-tools/bible-sdk 0.0.0-stage → 0.7.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/LICENSE.md +21 -0
- package/README.md +584 -2
- package/dist/bible-sdk.js +261 -0
- package/dist/data/effect.js +66 -0
- package/dist/data.js +16 -0
- package/dist/index.js +946 -0
- package/dist/providers/api-bible.js +221 -0
- package/dist/providers/fetch-bible.js +254 -0
- package/dist/providers/helloao.js +1 -0
- package/dist/providers/youversion.js +1 -0
- package/dist/providers-Ci0Bdu9f.js +431 -0
- package/dist/runtime-CVlBLU4v.js +229 -0
- package/dist/scripture-inline.js +261 -0
- package/dist/types/card.d.ts +20 -0
- package/dist/types/data-effect.d.ts +206 -0
- package/dist/types/data-helpers.d.ts +21 -0
- package/dist/types/data-types.d.ts +125 -0
- package/dist/types/data.d.ts +102 -0
- package/dist/types/dom-runtime.d.ts +5 -0
- package/dist/types/find.d.ts +12 -0
- package/dist/types/index.d.ts +31 -0
- package/dist/types/passage-input.d.ts +57 -0
- package/dist/types/providers/api-bible.d.ts +37 -0
- package/dist/types/providers/fetch-bible.d.ts +14 -0
- package/dist/types/providers/helloao.d.ts +1 -0
- package/dist/types/providers/youversion.d.ts +1 -0
- package/dist/types/providers.d.ts +62 -0
- package/dist/types/runtime.d.ts +18 -0
- package/dist/types/scan.d.ts +8 -0
- package/dist/types/scripture-passage.d.ts +61 -0
- package/dist/types/version-input.d.ts +64 -0
- package/package.json +84 -3
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import { a as e, d as t, l as n, r, s as i, u as a, v as o } from "../runtime-CVlBLU4v.js";
|
|
2
|
+
import { Clock as s, Effect as c, Schema as l } from "effect";
|
|
3
|
+
// src/providers/api-bible.ts
|
|
4
|
+
var u = {
|
|
5
|
+
contentType: "json",
|
|
6
|
+
includeTitles: !0,
|
|
7
|
+
includeNotes: !1,
|
|
8
|
+
includeChapterNumbers: !1,
|
|
9
|
+
includeVerseNumbers: !1
|
|
10
|
+
}, d = "https://api.bible/", f = "https://api.bible/terms-and-conditions", p = "14 days", m = 12096e5, h = l.optional(l.NullOr(l.String)), g = l.Struct({
|
|
11
|
+
id: l.NonEmptyString,
|
|
12
|
+
name: l.String,
|
|
13
|
+
nameLocal: h,
|
|
14
|
+
abbreviation: l.String,
|
|
15
|
+
abbreviationLocal: h,
|
|
16
|
+
language: l.Struct({
|
|
17
|
+
id: e,
|
|
18
|
+
name: l.String,
|
|
19
|
+
scriptDirection: h
|
|
20
|
+
}),
|
|
21
|
+
copyright: h,
|
|
22
|
+
info: h
|
|
23
|
+
}), _ = l.Struct({
|
|
24
|
+
style: l.optional(l.String),
|
|
25
|
+
verseId: l.optional(l.String)
|
|
26
|
+
}), v = l.suspend(() => l.Union([l.Struct({
|
|
27
|
+
type: l.Literal("text"),
|
|
28
|
+
text: l.String,
|
|
29
|
+
attrs: l.optional(_)
|
|
30
|
+
}), l.Struct({
|
|
31
|
+
type: l.Literal("tag"),
|
|
32
|
+
name: l.String,
|
|
33
|
+
attrs: l.optional(_),
|
|
34
|
+
items: l.Array(v)
|
|
35
|
+
})])), y = l.Struct({
|
|
36
|
+
data: l.Struct({
|
|
37
|
+
id: l.NonEmptyString,
|
|
38
|
+
bibleId: l.NonEmptyString,
|
|
39
|
+
reference: l.NonEmptyString,
|
|
40
|
+
copyright: l.NonEmptyString,
|
|
41
|
+
content: l.Array(v)
|
|
42
|
+
}),
|
|
43
|
+
meta: l.Struct({ fumsToken: l.NonEmptyString })
|
|
44
|
+
}), b = (e) => ({
|
|
45
|
+
id: e.id,
|
|
46
|
+
title: e.nameLocal || e.name,
|
|
47
|
+
abbreviation: e.abbreviationLocal || e.abbreviation,
|
|
48
|
+
language: new Intl.Locale(e.language.id).language,
|
|
49
|
+
languageName: e.language.name
|
|
50
|
+
}), x = () => new o({
|
|
51
|
+
code: "invalid_response",
|
|
52
|
+
message: "API.Bible returned incomplete or inconsistent passage data."
|
|
53
|
+
}), S = (e) => (t) => l.decodeUnknownEffect(e)(t).pipe(c.mapError(x)), C = (e) => {
|
|
54
|
+
let t = l.decodeUnknownOption(l.Struct({ statusCode: l.Number }))(e), n = l.decodeUnknownOption(l.Struct({ name: l.String }))(e), r = t._tag === "Some" ? t.value.statusCode : 0, i = n._tag === "Some" && n.value.name === "ValidationError" ? "invalid_response" : r === 401 || r === 403 ? "authentication" : r === 429 ? "rate_limit" : r >= 400 && r < 500 ? "unavailable" : "network";
|
|
55
|
+
return new o({
|
|
56
|
+
code: i,
|
|
57
|
+
message: `API.Bible request failed (${i}).`
|
|
58
|
+
});
|
|
59
|
+
}, w = (e, t) => r(e, async (e) => {
|
|
60
|
+
try {
|
|
61
|
+
return await t(e);
|
|
62
|
+
} catch (e) {
|
|
63
|
+
throw C(e);
|
|
64
|
+
}
|
|
65
|
+
}), T = (e) => e.replace(/^([A-Z0-9]{3}\.[1-9]\d*\.)([1-9]\d*)-\1([1-9]\d*)$/, "$1$2-$3");
|
|
66
|
+
function E(e) {
|
|
67
|
+
let t = /* @__PURE__ */ new Set(), n = (e) => {
|
|
68
|
+
if (e.type === "text") return e.attrs?.verseId && t.add(e.attrs.verseId), e.text;
|
|
69
|
+
let r = e.attrs?.style ?? "";
|
|
70
|
+
if (e.name === "note" || e.name === "verse" || e.name === "chapter" || /^(?:s\d*|sp|qa|ms\d*|mr|r|sr|mt\d*|mte\d*|cl|cp|cd|v|c|f\w*|x\w*)$/.test(r)) return "";
|
|
71
|
+
let i = e.items.map(n).join("");
|
|
72
|
+
return e.name === "para" ? i + (/^q[rmc]?\d*$/.test(r) ? "\n" : "\n\n") : i;
|
|
73
|
+
};
|
|
74
|
+
return {
|
|
75
|
+
text: e.map(n).join("").replace(/[ \t]+\n/g, "\n").replace(/\n{3,}/g, "\n\n").trim(),
|
|
76
|
+
verseIds: t
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
function D({ client: e, defaultVersionId: r }) {
|
|
80
|
+
if (typeof window < "u") throw new o({
|
|
81
|
+
code: "unsupported",
|
|
82
|
+
message: "API.Bible requires a server-side client. Never expose its private key in a browser."
|
|
83
|
+
});
|
|
84
|
+
let h = a(p), _ = (t) => h.get(t, () => c.gen(function* () {
|
|
85
|
+
let n = yield* s.currentTimeMillis, { data: r } = yield* w("apiBible.version", (n) => e.bibles.get(t, n)).pipe(c.flatMap(S(l.Struct({ data: g }))));
|
|
86
|
+
return r.id !== t || !r.copyright?.trim() ? yield* x() : {
|
|
87
|
+
data: r,
|
|
88
|
+
expiresAt: n + m
|
|
89
|
+
};
|
|
90
|
+
}));
|
|
91
|
+
return {
|
|
92
|
+
id: "api-bible",
|
|
93
|
+
defaultVersionId: r,
|
|
94
|
+
cacheTimeToLive: p,
|
|
95
|
+
clearCache: h.clear,
|
|
96
|
+
listVersions: c.fn("apiBible.listVersions")(function* () {
|
|
97
|
+
let { data: t } = yield* w("apiBible.versions", (t) => e.bibles.list({ includeFullDetails: !0 }, t)).pipe(c.flatMap(S(l.Struct({ data: l.Array(g) }))));
|
|
98
|
+
return t.map(b);
|
|
99
|
+
}),
|
|
100
|
+
listBooks: c.fn("apiBible.listBooks")(function* (t) {
|
|
101
|
+
let { data: n } = yield* w("apiBible.books", (n) => e.books.list(t, void 0, n)).pipe(c.flatMap(S(l.Struct({ data: l.Array(l.Struct({
|
|
102
|
+
id: l.NonEmptyString,
|
|
103
|
+
name: l.String
|
|
104
|
+
})) }))));
|
|
105
|
+
return n.map((e) => ({
|
|
106
|
+
id: e.id,
|
|
107
|
+
title: e.name
|
|
108
|
+
}));
|
|
109
|
+
}),
|
|
110
|
+
listChapters: c.fn("apiBible.listChapters")(function* (t, r) {
|
|
111
|
+
yield* i(r);
|
|
112
|
+
let { data: a } = yield* w("apiBible.chapters", (n) => e.chapters.list(t, r, n)).pipe(c.flatMap(S(l.Struct({ data: l.Array(l.Struct({
|
|
113
|
+
id: l.String,
|
|
114
|
+
number: l.String
|
|
115
|
+
})) })))), o = [];
|
|
116
|
+
for (let e of a) {
|
|
117
|
+
if (e.number === "intro") continue;
|
|
118
|
+
let t = yield* n(e.id).pipe(c.mapError(x));
|
|
119
|
+
if (t.book !== r || t.first !== void 0 || String(t.chapter) !== e.number) return yield* x();
|
|
120
|
+
o.push({
|
|
121
|
+
passageId: e.id,
|
|
122
|
+
number: t.chapter
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
return o;
|
|
126
|
+
}),
|
|
127
|
+
getPassageData: c.fn("apiBible.getPassageData")(function* (r, i) {
|
|
128
|
+
let { book: a, chapter: s, first: l, last: p } = yield* n(i), { data: m, expiresAt: h } = yield* _(r), g = `${a}.${s}${l === void 0 ? "" : `.${l}${p === l ? "" : `-${a}.${s}.${p}`}`}`, { data: v, meta: C } = yield* w("apiBible.passage", (t) => l === void 0 ? e.chapters.get(r, g, u, t) : e.passages.get(r, g, u, t)).pipe(c.flatMap(S(y)));
|
|
129
|
+
if (v.bibleId !== r || T(v.id) !== T(g)) return yield* x();
|
|
130
|
+
let { text: D, verseIds: O } = E(v.content), k = [];
|
|
131
|
+
for (let e of O) {
|
|
132
|
+
let t = yield* n(T(e)).pipe(c.mapError(x));
|
|
133
|
+
if (t.book !== a || t.chapter !== s || t.first === void 0 || l !== void 0 && (t.first < l || t.last > p)) return yield* x();
|
|
134
|
+
k.push({
|
|
135
|
+
first: t.first,
|
|
136
|
+
last: t.last
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
let A = (e) => k.some((t) => t.first <= e && t.last >= e);
|
|
140
|
+
return !k.length || l !== void 0 && (!A(l) || !A(p)) ? yield* new o({
|
|
141
|
+
code: "unavailable",
|
|
142
|
+
message: "API.Bible did not return the requested coverage; passages may be limited to 200 verses."
|
|
143
|
+
}) : {
|
|
144
|
+
provider: "api-bible",
|
|
145
|
+
source: {
|
|
146
|
+
url: d,
|
|
147
|
+
versionId: r
|
|
148
|
+
},
|
|
149
|
+
requestedPassageId: i,
|
|
150
|
+
passageId: T(v.id),
|
|
151
|
+
reference: v.reference,
|
|
152
|
+
text: D,
|
|
153
|
+
version: {
|
|
154
|
+
...b(m),
|
|
155
|
+
sourceLanguage: m.language.id
|
|
156
|
+
},
|
|
157
|
+
attribution: {
|
|
158
|
+
text: `${v.copyright} · ${b(m).abbreviation} · Source: API.Bible`,
|
|
159
|
+
urls: [d, f]
|
|
160
|
+
},
|
|
161
|
+
publisher: {
|
|
162
|
+
copyrightHtml: m.copyright,
|
|
163
|
+
infoHtml: m.info ?? ""
|
|
164
|
+
},
|
|
165
|
+
reporting: {
|
|
166
|
+
kind: "api-bible-fums",
|
|
167
|
+
token: C.fumsToken
|
|
168
|
+
},
|
|
169
|
+
cache: { expiresAt: h },
|
|
170
|
+
licenses: [{ url: f }],
|
|
171
|
+
numbering: "unknown",
|
|
172
|
+
display: {
|
|
173
|
+
format: "text",
|
|
174
|
+
whitespace: "pre-wrap",
|
|
175
|
+
attributionPlacement: "after-passage",
|
|
176
|
+
direction: m.language.scriptDirection === "rtl" ? "rtl" : m.language.scriptDirection === "ltr" ? "ltr" : void 0,
|
|
177
|
+
language: b(m).language
|
|
178
|
+
},
|
|
179
|
+
instructions: [
|
|
180
|
+
...t(),
|
|
181
|
+
{
|
|
182
|
+
code: "api-bible-fums",
|
|
183
|
+
level: "required",
|
|
184
|
+
appliesTo: "all",
|
|
185
|
+
text: "For web displays, report reporting.token for each actual view, including cache hits. Fetching or prefetching is not a view. The host owns anonymous device/session identifiers and reporting; native-only exemptions do not cover web views.",
|
|
186
|
+
urls: ["https://care.api.bible/article/417-understanding-fums"]
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
code: "api-bible-publisher",
|
|
190
|
+
level: "required",
|
|
191
|
+
appliesTo: "all",
|
|
192
|
+
text: "Preserve publisher copyrightHtml and infoHtml on a linked copyright/about page and identify the translation in context. These fields are untrusted upstream HTML: sanitize before rendering, never insert them directly. Keep the visible API.Bible source link.",
|
|
193
|
+
urls: [f]
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
code: "api-bible-cache",
|
|
197
|
+
level: "required",
|
|
198
|
+
appliesTo: "all",
|
|
199
|
+
text: "cache.expiresAt is an epoch-millisecond refresh deadline, not permission for offline storage. Refresh downstream caches by that deadline. Never retain metadata or content over 30 days without refresh. Honor removal/revocation requests immediately or within their specified shorter deadline.",
|
|
200
|
+
urls: ["https://care.api.bible/article/401-caching-content", f]
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
code: "api-bible-usage",
|
|
204
|
+
level: "required",
|
|
205
|
+
appliesTo: "all",
|
|
206
|
+
text: "Each application needs its own private server key and applicable plan and translation licenses. The host must satisfy DRM, print/device/territory limits, content integrity, account agreements, and removal duties. A working key or this adapter does not establish compliance. Starter is noncommercial even for public-domain text.",
|
|
207
|
+
urls: [f]
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
code: "api-bible-ai",
|
|
211
|
+
level: "required",
|
|
212
|
+
appliesTo: "all",
|
|
213
|
+
text: "Do not send copyrighted or Creative Commons Scripture to an LLM as prompt context or training data without the required permissions. Public-domain runtime prompts are permitted; confirm training and audio/export permissions separately.",
|
|
214
|
+
urls: ["https://care.api.bible/article/405-express-licensing-faqs", f]
|
|
215
|
+
}
|
|
216
|
+
]
|
|
217
|
+
};
|
|
218
|
+
})
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
export { D as createApiBibleProvider };
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
import { a as e, d as t, f as n, i as r, l as i, n as a, o, r as s, s as c, u as l, v as u } from "../runtime-CVlBLU4v.js";
|
|
2
|
+
import { Effect as d, Schema as f } from "effect";
|
|
3
|
+
import { FetchClient as p } from "@gracious.tech/fetch-client";
|
|
4
|
+
import m from "sanitize-html";
|
|
5
|
+
// src/providers/fetch-bible.ts
|
|
6
|
+
var h = {
|
|
7
|
+
containerAttributes: { class: "fetch-bible fb-plain scripture-bible no-notes no-chapters" },
|
|
8
|
+
stylesheets: [{
|
|
9
|
+
kind: "bible",
|
|
10
|
+
href: "https://cdn.jsdelivr.net/npm/@gracious.tech/fetch-client@2.6.0/dist/client.css"
|
|
11
|
+
}]
|
|
12
|
+
}, g = (e) => d.try({
|
|
13
|
+
try: e,
|
|
14
|
+
catch: (e) => new u({
|
|
15
|
+
code: "invalid_response",
|
|
16
|
+
message: "fetch.bible returned invalid resource data.",
|
|
17
|
+
cause: e
|
|
18
|
+
})
|
|
19
|
+
}), _ = f.Union([f.String, f.Struct({
|
|
20
|
+
type: f.Literals(["heading", "note"]),
|
|
21
|
+
contents: f.String
|
|
22
|
+
})]), v = a(f.Array(f.Struct({
|
|
23
|
+
chapter: f.Int,
|
|
24
|
+
verse: f.Int,
|
|
25
|
+
content: f.Array(_)
|
|
26
|
+
})));
|
|
27
|
+
function y(_) {
|
|
28
|
+
let y = {
|
|
29
|
+
usage: { ..._.usage },
|
|
30
|
+
remember_fetches: !1
|
|
31
|
+
}, b = new p(y), x = l(), S = (e) => ({
|
|
32
|
+
id: e.id,
|
|
33
|
+
title: e.name_local || e.name_english,
|
|
34
|
+
abbreviation: e.name_local_abbrev || e.name_english_abbrev || e.id,
|
|
35
|
+
language: new Intl.Locale(e.language).language
|
|
36
|
+
}), C = d.fn("fetchBible.catalog")(function* () {
|
|
37
|
+
return yield* x.get("catalog", () => d.gen(function* () {
|
|
38
|
+
let t = yield* s("fetchBible.collection", () => b.fetch_collection()), n = yield* g(() => t.bibles.get_resources()).pipe(d.tap(a(f.Array(f.Struct({ language: e })))));
|
|
39
|
+
return {
|
|
40
|
+
collection: t,
|
|
41
|
+
resources: new Map(n.map((e) => [e.id, e]))
|
|
42
|
+
};
|
|
43
|
+
}));
|
|
44
|
+
}), w = d.fnUntraced(function* (e, t) {
|
|
45
|
+
let { collection: n, resources: r } = yield* C(), i = r.get(e);
|
|
46
|
+
return i ? t && !n.bibles.has_book(e, t) ? yield* new u({
|
|
47
|
+
code: "unavailable",
|
|
48
|
+
message: "Book is not available in this version."
|
|
49
|
+
}) : {
|
|
50
|
+
collection: n,
|
|
51
|
+
item: i
|
|
52
|
+
} : yield* new u({
|
|
53
|
+
code: "unavailable",
|
|
54
|
+
message: "Version is unavailable for this usage configuration."
|
|
55
|
+
});
|
|
56
|
+
}), T = d.fn("fetchBible.textBook")(function* (e, t) {
|
|
57
|
+
let { collection: n, item: r } = yield* w(e, t);
|
|
58
|
+
return {
|
|
59
|
+
collection: n,
|
|
60
|
+
item: r,
|
|
61
|
+
contents: yield* x.get(JSON.stringify([
|
|
62
|
+
e,
|
|
63
|
+
t,
|
|
64
|
+
"txt"
|
|
65
|
+
]), () => s("fetchBible.textBook", () => n.bibles.fetch_book(e, t, "txt")).pipe(d.tap((e) => g(() => e.get_list()).pipe(d.flatMap(v)))))
|
|
66
|
+
};
|
|
67
|
+
}), E = (e, t) => d.gen(function* () {
|
|
68
|
+
let { collection: n } = yield* w(e, t);
|
|
69
|
+
return yield* x.get(JSON.stringify([
|
|
70
|
+
e,
|
|
71
|
+
t,
|
|
72
|
+
"html"
|
|
73
|
+
]), () => s("fetchBible.htmlBook", () => n.bibles.fetch_book(e, t, "html")).pipe(d.tap((e) => g(() => e.get_list()).pipe(d.flatMap(a(f.Array(f.Struct({ content: f.String }))))))));
|
|
74
|
+
}), D = (e) => x.get(JSON.stringify([e, "books"]), () => d.gen(function* () {
|
|
75
|
+
let { collection: t } = yield* w(e);
|
|
76
|
+
return yield* s("fetchBible.extras", () => t.bibles.fetch_translation_extras(e)), yield* g(() => t.bibles.get_books(e));
|
|
77
|
+
})), O = {
|
|
78
|
+
id: "fetch-bible",
|
|
79
|
+
defaultVersionId: "eng_bsb",
|
|
80
|
+
clearCache: x.clear.pipe(d.andThen(d.sync(() => {
|
|
81
|
+
b = new p(y);
|
|
82
|
+
}))),
|
|
83
|
+
listVersions: d.fn("fetchBible.listVersions")(function* () {
|
|
84
|
+
let { collection: e, resources: t } = yield* C();
|
|
85
|
+
return [...t.values()].map((t) => ({
|
|
86
|
+
...S(t),
|
|
87
|
+
languageName: e.bibles.get_language(t.language)?.name_english
|
|
88
|
+
}));
|
|
89
|
+
}),
|
|
90
|
+
listBooks: d.fn("fetchBible.listBooks")(function* (e) {
|
|
91
|
+
return (yield* D(e)).filter((e) => e.available).map((e) => ({
|
|
92
|
+
id: e.id.toUpperCase(),
|
|
93
|
+
title: e.name_local || e.name_english
|
|
94
|
+
}));
|
|
95
|
+
}),
|
|
96
|
+
listChapters: d.fn("fetchBible.listChapters")(function* (e, t) {
|
|
97
|
+
let n = yield* c(t), { contents: r } = yield* T(e, n.toLowerCase());
|
|
98
|
+
return [...new Set(r.get_list().map((e) => e.chapter))].map((e) => ({
|
|
99
|
+
number: e,
|
|
100
|
+
passageId: `${t}.${e}`
|
|
101
|
+
}));
|
|
102
|
+
}),
|
|
103
|
+
getPassageData: d.fn("fetchBible.getPassageData")(function* (e, r) {
|
|
104
|
+
let { book: a, chapter: o, first: s, last: c } = yield* i(r), l = a.toLowerCase(), { collection: d, item: f, contents: p } = yield* T(e, l), g = p.get_list(o, 1, o).map((e) => e.verse);
|
|
105
|
+
yield* n(g, s, c);
|
|
106
|
+
let _ = p.get_passage(o, s ?? 1, o, c ?? g.at(-1), {
|
|
107
|
+
attribute: !1,
|
|
108
|
+
headings: !1,
|
|
109
|
+
notes: !1,
|
|
110
|
+
verse_nums: !1
|
|
111
|
+
});
|
|
112
|
+
if (a === "PSA" && (s === void 0 || s === 1)) {
|
|
113
|
+
let t = yield* E(e, l), n = [];
|
|
114
|
+
m(t.get_verse(o, 1, { attribute: !1 }), {
|
|
115
|
+
allowedTags: m.defaults.allowedTags,
|
|
116
|
+
allowedAttributes: { "*": ["class"] },
|
|
117
|
+
exclusiveFilter: (e) => {
|
|
118
|
+
let t = e.attribs.class?.split(/\s+/) ?? [];
|
|
119
|
+
return t.includes("fb-d") ? (n.push(e.text.trim()), !0) : e.tag === "sup" || t.includes("fb-note");
|
|
120
|
+
}
|
|
121
|
+
}), n.length && (_ = `${n.join("\n")}\n\n${_}`);
|
|
122
|
+
}
|
|
123
|
+
let v = p.get_attribution(f.licenses[0]).trim();
|
|
124
|
+
if (!v) return yield* new u({
|
|
125
|
+
code: "unavailable",
|
|
126
|
+
message: "This Bible version has no display attribution."
|
|
127
|
+
});
|
|
128
|
+
let y = d.bibles.get_book_url(e, l, "txt"), b = (yield* D(e)).find((e) => e.id === l).name, x = [{
|
|
129
|
+
versions: [
|
|
130
|
+
"eng_bstj",
|
|
131
|
+
"eng_bstjb",
|
|
132
|
+
"grc_lxx"
|
|
133
|
+
],
|
|
134
|
+
book: "EXO",
|
|
135
|
+
firstChapter: 35,
|
|
136
|
+
firstVerse: 1,
|
|
137
|
+
lastChapter: 40,
|
|
138
|
+
lastVerse: 38
|
|
139
|
+
}, {
|
|
140
|
+
versions: [
|
|
141
|
+
"eng_bst",
|
|
142
|
+
"eng_bstb",
|
|
143
|
+
"eng_bstj",
|
|
144
|
+
"eng_bstjb",
|
|
145
|
+
"grc_bre",
|
|
146
|
+
"grc_lxx"
|
|
147
|
+
],
|
|
148
|
+
book: "JER",
|
|
149
|
+
firstChapter: 25,
|
|
150
|
+
firstVerse: 14,
|
|
151
|
+
lastChapter: 52,
|
|
152
|
+
lastVerse: 34
|
|
153
|
+
}].filter((t) => t.versions.includes(e)).map((e) => ({
|
|
154
|
+
kind: "source-trimming",
|
|
155
|
+
startPassageId: `${e.book}.${e.firstChapter}.${e.firstVerse}`,
|
|
156
|
+
endPassageId: `${e.book}.${e.lastChapter}.${e.lastVerse}`,
|
|
157
|
+
appliesToRequest: a === e.book && o >= e.firstChapter && o <= e.lastChapter && (o !== e.firstChapter || c === void 0 || c >= e.firstVerse) && (o !== e.lastChapter || s === void 0 || s <= e.lastVerse)
|
|
158
|
+
}));
|
|
159
|
+
return {
|
|
160
|
+
provider: "fetch-bible",
|
|
161
|
+
source: {
|
|
162
|
+
url: y,
|
|
163
|
+
versionId: f.id
|
|
164
|
+
},
|
|
165
|
+
requestedPassageId: r,
|
|
166
|
+
passageId: r,
|
|
167
|
+
reference: `${b} ${o}${s === void 0 ? "" : `:${s}${c === s ? "" : `-${c}`}`}`,
|
|
168
|
+
text: _.trim(),
|
|
169
|
+
version: {
|
|
170
|
+
...S(f),
|
|
171
|
+
sourceLanguage: f.language
|
|
172
|
+
},
|
|
173
|
+
attribution: {
|
|
174
|
+
text: `${v} · Source: fetch.bible`,
|
|
175
|
+
urls: [
|
|
176
|
+
f.attribution_url,
|
|
177
|
+
...f.licenses.map((e) => e.url),
|
|
178
|
+
"https://fetch.bible/"
|
|
179
|
+
].filter(Boolean)
|
|
180
|
+
},
|
|
181
|
+
licenses: f.licenses.map((e) => ({
|
|
182
|
+
name: e.name,
|
|
183
|
+
url: e.url,
|
|
184
|
+
restrictions: { ...e.restrictions }
|
|
185
|
+
})),
|
|
186
|
+
numbering: "kjv",
|
|
187
|
+
sourceLimitations: x,
|
|
188
|
+
display: {
|
|
189
|
+
format: "text",
|
|
190
|
+
whitespace: "pre-wrap",
|
|
191
|
+
attributionPlacement: "after-passage",
|
|
192
|
+
direction: f.direction,
|
|
193
|
+
language: S(f).language,
|
|
194
|
+
nativeHtml: h
|
|
195
|
+
},
|
|
196
|
+
instructions: [
|
|
197
|
+
...t(),
|
|
198
|
+
{
|
|
199
|
+
code: "fetch-bible-normalization",
|
|
200
|
+
level: "notice",
|
|
201
|
+
appliesTo: "all",
|
|
202
|
+
text: "The official collection uses KJV-normalized numbering, retains empty verse slots, and contains only the Protestant 66-book canon. sourceLimitations identifies documented trimmed ranges for this edition and whether the request overlaps them, not why an individual verse is empty. This is not an exhaustive lossless-source guarantee.",
|
|
203
|
+
urls: ["https://fetch.bible/content/", "https://fetch.bible/access/"]
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
code: "fetch-bible-license",
|
|
207
|
+
level: "required",
|
|
208
|
+
appliesTo: "all",
|
|
209
|
+
text: "Usage filtering does not verify legal permission. Check the returned licenses and restrictions for the selected translation, including commercial, derivative, attribution, and share-alike conditions.",
|
|
210
|
+
urls: ["https://fetch.bible/legal/terms/"]
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
code: "fetch-bible-native-html",
|
|
214
|
+
level: "required",
|
|
215
|
+
appliesTo: "html",
|
|
216
|
+
text: "If you request native HTML through the display provider, apply its returned .fetch-bible container class and client stylesheet. The stylesheet separates notes from Scripture. Do not append inline attribution when displaying the separate attribution field.",
|
|
217
|
+
urls: ["https://fetch.bible/access/client/"]
|
|
218
|
+
}
|
|
219
|
+
]
|
|
220
|
+
};
|
|
221
|
+
}),
|
|
222
|
+
getPassageDisplay: d.fn("fetchBible.getPassageDisplay")(function* (e, t) {
|
|
223
|
+
let n = yield* O.getPassageData(e, t), { book: r, chapter: a, first: s, last: c } = yield* i(t), l = yield* E(e, r.toLowerCase()), u = s === void 0 ? l.get_chapter(a, { attribute: !1 }) : l.get_passage(a, s, a, c, { attribute: !1 });
|
|
224
|
+
return {
|
|
225
|
+
html: m(u, {
|
|
226
|
+
allowedTags: m.defaults.allowedTags,
|
|
227
|
+
allowedAttributes: {
|
|
228
|
+
"*": [
|
|
229
|
+
"class",
|
|
230
|
+
"data-c",
|
|
231
|
+
"data-v",
|
|
232
|
+
"dir",
|
|
233
|
+
"lang"
|
|
234
|
+
],
|
|
235
|
+
a: ["href"]
|
|
236
|
+
},
|
|
237
|
+
allowedSchemes: ["http", "https"],
|
|
238
|
+
exclusiveFilter: (e) => e.attribs.class?.split(/\s+/).includes("fb-note") || !1
|
|
239
|
+
}),
|
|
240
|
+
version: n.version,
|
|
241
|
+
attribution: n.attribution.text,
|
|
242
|
+
attributionHtml: `${o(n.attribution.text.replace(" · Source: fetch.bible", ""), n.licenses[0]?.url || "")} · Source: ${o("fetch.bible", "https://fetch.bible/")}`,
|
|
243
|
+
direction: n.display.direction,
|
|
244
|
+
containerAttributes: {
|
|
245
|
+
...h.containerAttributes,
|
|
246
|
+
lang: n.display.language || ""
|
|
247
|
+
},
|
|
248
|
+
stylesheets: h.stylesheets
|
|
249
|
+
};
|
|
250
|
+
})
|
|
251
|
+
};
|
|
252
|
+
return r(O);
|
|
253
|
+
}
|
|
254
|
+
export { y as createFetchBibleProvider };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { t as createHelloAOProvider, i as helloaoProvider } from "../providers-Ci0Bdu9f.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { n as createYouVersionProvider } from "../providers-Ci0Bdu9f.js";
|