UNPKG

bible-passage-reference-parser

Version:

Identifies and parses Bible references (like John 3:16) in over 40 languages.

2 lines 129 kB
if (typeof module === "undefined") { var module = {}; } "use strict";var ts=Object.defineProperty;var Ni=Object.getOwnPropertyDescriptor;var qi=Object.getOwnPropertyNames;var Ki=Object.prototype.hasOwnProperty;var Gi=(d,s)=>{for(var e in s)ts(d,e,{get:s[e],enumerable:!0})},Yi=(d,s,e,o)=>{if(s&&typeof s=="object"||typeof s=="function")for(let c of qi(s))!Ki.call(d,c)&&c!==e&&ts(d,c,{get:()=>s[c],enumerable:!(o=Ni(s,c))||o.enumerable});return d};var Hi=d=>Yi(ts({},"__esModule",{value:!0}),d);var Wi={};Gi(Wi,{bcv_parser:()=>as});module.exports=Hi(Wi);var pe=class{constructor(s,e){this.parent=s,this.grammar=e}replace_control_characters(s){return s.replace(this.parent.regexps.control," ")}replace_non_ascii_numbers(s){return this.parent.options.non_latin_digits_strategy==="replace"&&(s=s.replace(/[٠۰߀०০੦૦୦0౦೦൦๐໐༠၀႐០᠐᥆᧐᪀᪐᭐᮰᱀᱐꘠꣐꤀꧐꩐꯰0]/g,"0"),s=s.replace(/[١۱߁१১੧૧୧௧౧೧൧๑໑༡၁႑១᠑᥇᧑᪁᪑᭑᮱᱁᱑꘡꣑꤁꧑꩑꯱1]/g,"1"),s=s.replace(/[٢۲߂२২੨૨୨௨౨೨൨๒໒༢၂႒២᠒᥈᧒᪂᪒᭒᮲᱂᱒꘢꣒꤂꧒꩒꯲2]/g,"2"),s=s.replace(/[٣۳߃३৩੩૩୩௩౩೩൩๓໓༣၃႓៣᠓᥉᧓᪃᪓᭓᮳᱃᱓꘣꣓꤃꧓꩓꯳3]/g,"3"),s=s.replace(/[٤۴߄४৪੪૪୪௪౪೪൪๔໔༤၄႔៤᠔᥊᧔᪄᪔᭔᮴᱄᱔꘤꣔꤄꧔꩔꯴4]/g,"4"),s=s.replace(/[٥۵߅५৫੫૫୫௫౫೫൫๕໕༥၅႕៥᠕᥋᧕᪅᪕᭕᮵᱅᱕꘥꣕꤅꧕꩕꯵5]/g,"5"),s=s.replace(/[٦۶߆६৬੬૬୬௬౬೬൬๖໖༦၆႖៦᠖᥌᧖᪆᪖᭖᮶᱆᱖꘦꣖꤆꧖꩖꯶6]/g,"6"),s=s.replace(/[٧۷߇७৭੭૭୭௭౭೭൭๗໗༧၇႗៧᠗᥍᧗᪇᪗᭗᮷᱇᱗꘧꣗꤇꧗꩗꯷7]/g,"7"),s=s.replace(/[٨۸߈८৮੮૮୮௮౮೮൮๘໘༨၈႘៨᠘᥎᧘᪈᪘᭘᮸᱈᱘꘨꣘꤈꧘꩘꯸8]/g,"8"),s=s.replace(/[٩۹߉९৯੯૯୯௯౯೯൯๙໙༩၉႙៩᠙᥏᧙᪉᪙᭙᮹᱉᱙꘩꣙꤉꧙꩙꯹9]/g,"9")),s}match_books(s){let e=[];for(let o of this.parent.regexps.books){let c=!1;if(s=s.replace(o.regexp,function(f,p){c=!0,e.push({value:p,parsed:o.osis,type:"book"});let m=o.extra?`/${o.extra}`:"";return`${e.length-1}${m}`}),c&&/^[\s\x1f\d:.,;\-\u2013\u2014]+$/.test(s))break}for(let o of this.parent.regexps.translations)s=s.replace(o,function(c){return e.push({value:c,parsed:c.toLowerCase(),type:"translation"}),`${e.length-1}`});return[s,this.get_book_indices(e,s)]}get_book_indices(s,e){let o=0;for(let c of e.matchAll(/([\x1f\x1e])(\d+)(?:\/\d+)?\1/g)){let f=parseInt(c[2],10);s[f].start_index=c.index+o,o+=s[f].value.length-c[0].length}return s}match_passages(s){let e=[],o={};for(let c of s.matchAll(this.parent.regexps.escaped_passage)){let[f,p,m]=c,v=parseInt(m,10),x=p.length;c.index+=f.length-x,p=this.clean_end_match(s,c,p),p=p.replace(/[A-Z]+/g,Pe=>Pe.toLowerCase());let I=p.startsWith("")?0:p.split("")[0].length,E={value:this.grammar.parse(p,{punctuation_strategy:this.parent.options.punctuation_strategy}),type:"base",start_index:this.parent.passage.books[v].start_index-I,match:p},R=this.parent.passage.books[v].parsed;I===0&&this.parent.options.book_alone_strategy==="full"&&this.parent.options.book_range_strategy==="include"&&E.value[0].type==="b"&&Array.isArray(E.value)&&(E.value.length===1||E.value.length>1&&E.value[1].type==="translation_sequence")&&/^[234]/.test(R)&&this.create_book_range(s,E,v);let ae=[];[ae,o]=this.parent.passage.handle_obj(E,[],{}),e=e.concat(ae);let ge=this.adjust_regexp_end(ae,x,p.length);ge>0&&(this.parent.regexps.escaped_passage.lastIndex-=ge)}return[e,o]}clean_end_match(s,e,o){if(/\s[2-9]\d\d\s*$|\s\d{4,}\s*$/.test(o)&&(o=o.replace(/\s+\d+\s*$/,"")),!/[\d\x1f\x1e)]$/.test(o)){let c=o.split(this.parent.regexps.match_end_split),f=c.pop();c.length>0&&f!=null&&f.length>0&&(o=o.substring(0,o.length-f.length))}if(this.parent.options.captive_end_digits_strategy==="delete"){let c=e.index+o.length;s.length>c&&/^\w/.test(s.charAt(c))&&(o=o.replace(/[\s*]+\d+$/,"")),o=o.replace(/(\x1e[)\]]?)[\s*]*\d+$/,"$1")}return o}adjust_regexp_end(s,e,o){return s.length>0?e-s[s.length-1].indices[1]-1:e!==o?e-o:0}create_book_range(s,e,o){let c=[this.parent.regexps.first,this.parent.regexps.second,this.parent.regexps.third],f=parseInt(this.parent.passage.books[o].parsed[0].substring(0,1),10);for(let p=1;p<f;p++){let m=p===f-1?this.parent.regexps.range_and:this.parent.regexps.range_only,v=new RegExp(String.raw`${this.parent.regexps.pre_number_book.source}(${c[p-1].source}\s*${m.source}\s*)\x1f${o}\x1f`,"iu"),x=s.match(v);if(x)return this.add_book_range_object(e,x,p)}return!1}add_book_range_object(s,e,o){let c=e[1].length;if(s.value[0]={type:"b_range_pre",value:[{type:"b_pre",value:o.toString(),indices:[e.index,e.index+c]},s.value[0]],indices:[0,s.value[0].indices[1]+c]},this.add_offset_to_indices(s.value[0].value[1].indices,c),s.start_index-=c,s.match=e[1]+s.match,!Array.isArray(s.value))return s;for(let f=1;f<s.value.length;f++)s.value[f].value&&(s.value[f].value[0]?.indices&&this.add_offset_to_indices(s.value[f].value[0].indices,c),this.add_offset_to_indices(s.value[f].indices,c));return s}add_offset_to_indices(s,e){s[0]+=e,s[1]+=e}};var $e=class{constructor(s){this.consecutive_combination_strategy="combine";this.osis_compaction_strategy="b";this.book_sequence_strategy="ignore";this.invalid_sequence_strategy="ignore";this.sequence_combination_strategy="combine";this.punctuation_strategy="us";this.invalid_passage_strategy="ignore";this.non_latin_digits_strategy="ignore";this.passage_existence_strategy="bcv";this.book_alone_strategy="ignore";this.book_range_strategy="ignore";this.captive_end_digits_strategy="delete";this.ps151_strategy="c";this.zero_chapter_strategy="error";this.zero_verse_strategy="error";this.single_chapter_1_strategy="chapter";this.end_range_digits_strategy="verse";this.warn_level="none";this.#e="on";this.#s="none";this.parent=s}#e;get testaments(){return this.#e}set testaments(s){if(s===this.#e||s.length===0)return;let e=s.split(""),o="";if(e[0]==="o"&&(e.shift(),o+="o"),e.length>0&&e[0]==="n"&&(e.shift(),o+="n"),e.length>0&&e[0]==="a"&&(o+="a"),o.length>0&&o!==this.#e){let c=o.indexOf("a")>=0,f=this.#e.indexOf("a")>=0;this.#e=o,c!==f?this.set_apocrypha(c):this.parent.regexps_manager.filter_books(this.#e,this.case_sensitive)}}set_apocrypha(s){this.parent.regexps_manager.filter_books(this.#e,this.case_sensitive);for(let e of Object.keys(this.parent.translations.systems))this.parent.translations.systems[e].chapters??={},this.parent.translations.systems[e].chapters.Ps??=[...this.parent.translations.systems.current.chapters.Ps],s===!0?this.parent.translations.systems[e].chapters.Ps[150]=this.parent.translations.systems[e].chapters.Ps151?.[0]??this.parent.translations.systems.current.chapters.Ps151[0]:this.parent.translations.systems[e].chapters?.Ps.length===151&&this.parent.translations.systems[e].chapters.Ps.pop()}get versification_system(){return this.parent.translations.current_system}set versification_system(s){this.parent.translations.aliases[s]?.system&&(s=this.parent.translations.aliases[s].system),this.parent.translations.systems[s]||(this.warn_level==="warn"&&console.warn(`Unknown versification system ("${s}"). Using default instead.`),s="default"),!(!s||s===this.parent.translations.current_system)&&(this.parent.translations.current_system!=="default"&&(this.parent.translations.systems.current=structuredClone(this.parent.translations.systems.default)),this.parent.translations.current_system=s,s!=="default"&&(this.parent.translations.systems[s].order&&(this.parent.translations.systems.current.order={...this.parent.translations.systems[s].order}),this.parent.translations.systems[s].chapters&&(this.parent.translations.systems.current.chapters={...structuredClone(this.parent.translations.systems.default.chapters),...structuredClone(this.parent.translations.systems[s].chapters)})))}#s;get case_sensitive(){return this.#s}set case_sensitive(s){s===this.#s||s!=="none"&&s!=="books"||(this.#s=s,this.parent.regexps_manager.filter_books(this.testaments,s))}};var de=class{constructor(s,e){this.books=[];this.indices=[];this.options=s,this.translations=e}handle_array(s,e=[],o={}){for(let c of s)c!=null&&([e,o]=this.handle_obj(c,e,o));return[e,o]}handle_obj(s,e,o){return s.type&&typeof this[s.type]=="function"?this[s.type](s,e,o):[e,o]}b(s,e,o){s.start_context=structuredClone(o),s.passages=[];let c=[];for(let f of this.books[s.value].parsed){let p=this.validate_ref(s.start_context.translations,{b:f}),m={start:{b:f},end:{b:f},valid:p};s.passages.length===0&&p.valid?s.passages.push(m):c.push(m)}return this.normalize_passage_and_alternates(s,c),e.push(s),o={b:s.passages[0].start.b},s.start_context.translations&&(o.translations=structuredClone(s.start_context.translations)),[e,o]}b_pre(s,e,o){return[e,o]}b_range(s,e,o){return this.range(s,e,o)}b_range_pre(s,e,o){s.start_context=structuredClone(o),s.passages=[];let c=this.pluck("b",s.value),f;return[[f],o]=this.b(c,[],o),s.absolute_indices??=this.get_absolute_indices(s.indices),s.passages=[{start:{b:s.value[0].value+f.passages[0].start.b.substring(1),type:"b"},end:f.passages[0].end,valid:f.passages[0].valid}],s.start_context.translations&&(s.passages[0].translations=structuredClone(s.start_context.translations)),e.push(s),[e,o]}b_range_start(s,e,o){return this.range(s,e,o)}base(s,e,o){return this.indices=this.calculate_indices(s.match,s.start_index),this.handle_array(s.value,e,o)}bc(s,e,o){s.start_context=structuredClone(o),s.passages=[],this.reset_context(o,["b","c","v"]);let c=this.pluck("c",s.value).value,f=[];for(let p of this.books[this.pluck("b",s.value).value].parsed){let m="c",v=this.validate_ref(s.start_context.translations,{b:p,c}),x={start:{b:p},end:{b:p},valid:v};(v.messages?.start_chapter_not_exist_in_single_chapter_book||v.messages?.start_chapter_1)&&(x.valid=this.validate_ref(s.start_context.translations,{b:p,v:c}),v.messages?.start_chapter_not_exist_in_single_chapter_book&&(x.valid.messages.start_chapter_not_exist_in_single_chapter_book=1),x.start.c=1,x.end.c=1,m="v"),x.start[m]=c,[x.start.c,x.start.v]=this.fix_start_zeroes(x.valid,x.start.c,x.start.v),x.start.v==null&&delete x.start.v,x.end[m]=x.start[m],s.passages.length===0&&x.valid.valid?s.passages.push(x):f.push(x)}return this.normalize_passage_and_alternates(s,f),this.set_context_from_object(o,["b","c","v"],s.passages[0].start),e.push(s),[e,o]}bc_title(s,e,o){s.start_context=structuredClone(o);let c=this.pluck("bc",s.value),f;if([[f],o]=this.bc(c,[],o),f.passages[0].start.b.substring(0,2)!=="Ps"&&f.passages[0].alternates){for(let m of f.passages[0].alternates)if(m.start.b.substring(0,2)==="Ps"){f.passages[0]=structuredClone(m);break}}if(f.passages[0].start.b.substring(0,2)!=="Ps")return e.push(f),[e,o];this.books[this.pluck("b",f.value).value].parsed=["Ps"];let p=this.pluck("title",s.value);return p||(p=this.pluck("v",s.value)),s.value[1]={type:"v",original_type:"title",value:[{type:"integer",value:1,indices:p.indices}],indices:p.indices},s.type="bcv",this.bcv(s,e,s.start_context)}bcv(s,e,o){s.start_context=structuredClone(o),s.passages=[],this.reset_context(o,["b","c","v"]);let c=this.pluck("bc",s.value),f=this.pluck("c",c.value).value,p=this.pluck("v",s.value).value,m=[];for(let v of this.books[this.pluck("b",c.value).value].parsed){let x=this.validate_ref(s.start_context.translations,{b:v,c:f,v:p});[f,p]=this.fix_start_zeroes(x,f,p);let I={start:{b:v,c:f,v:p},end:{b:v,c:f,v:p},valid:x};s.passages.length===0&&x.valid?s.passages.push(I):m.push(I)}return this.normalize_passage_and_alternates(s,m),this.set_context_from_object(o,["b","c","v"],s.passages[0].start),e.push(s),[e,o]}bv(s,e,o){s.start_context=structuredClone(o);let[c,f]=s.value,p={indices:s.indices,value:[{type:"bc",value:[c,{type:"c",value:[{type:"integer",value:1}]}]},f]};return[[p],o]=this.bcv(p,[],o),s.passages=p.passages,s.absolute_indices??=this.get_absolute_indices(s.indices),e.push(s),[e,o]}c(s,e,o){s.start_context=structuredClone(o);let c=s.type==="integer"?s.value:this.pluck("integer",s.value).value,f=this.validate_ref(s.start_context.translations,{b:o.b,c});return!f.valid&&f.messages?.start_chapter_not_exist_in_single_chapter_book?this.v(s,e,o):([c]=this.fix_start_zeroes(f,c),s.passages=[{start:{b:o.b,c},end:{b:o.b,c},valid:f}],s.start_context.translations&&(s.passages[0].translations=s.start_context.translations),e.push(s),o.c=c,this.reset_context(o,["v"]),s.absolute_indices??=this.get_absolute_indices(s.indices),[e,o])}c_psalm(s,e,o){s.type="bc";let c=parseInt(this.books[s.value].value.match(/^\d+/)[0],10);return s.value=[{type:"b",value:s.value,indices:s.indices},{type:"c",value:[{type:"integer",value:c,indices:s.indices}],indices:s.indices}],this.bc(s,e,o)}c_title(s,e,o){if(s.start_context=structuredClone(o),o.b!=="Ps")return this.c(s.value[0],e,o);let c=this.pluck("title",s.value);return s.value[1]={type:"v",original_type:"title",value:[{type:"integer",value:1,indices:c.indices}],indices:c.indices},s.type="cv",this.cv(s,e,s.start_context)}cb_range(s,e,o){s.type="range";let[c,f,p]=s.value;return s.value=[{type:"bc",value:[c,f],indices:s.indices},p],p.indices[1]=s.indices[1],this.range(s,e,o)}context(s,e,o){return s.start_context=structuredClone(o),s.passages=[],o=Object.assign(o,this.books[s.value].context),e.push(s),[e,o]}cv(s,e,o){s.start_context=structuredClone(o);let c=this.pluck("c",s.value).value,f=this.pluck("v",s.value).value,p=this.validate_ref(s.start_context.translations,{b:o.b,c,v:f});return[c,f]=this.fix_start_zeroes(p,c,f),s.passages=[{start:{b:o.b,c,v:f},end:{b:o.b,c,v:f},valid:p}],s.start_context.translations&&(s.passages[0].translations=s.start_context.translations),s.absolute_indices??=this.get_absolute_indices(s.indices),o.c=c,o.v=f,e.push(s),[e,o]}cv_psalm(s,e,o){s.start_context=structuredClone(o),s.type="bcv";let[c,f]=s.value,[[p]]=this.c_psalm(c,[],s.start_context);return s.value=[p,f],this.bcv(s,e,o)}ff(s,e,o){s.start_context=structuredClone(o),s.value.push({type:"integer",indices:structuredClone(s.indices),value:999}),[[s],o]=this.range(s,[],s.start_context),s.value[0].indices=s.value[1].indices,s.value[0].absolute_indices=s.value[1].absolute_indices,s.value.pop();for(let c of["end_verse_not_exist","end_chapter_not_exist"])delete s.passages[0].valid.messages[c];return e.push(s),[e,o]}integer(s,e,o){return o.v==null?this.c(s,e,o):this.v(s,e,o)}integer_title(s,e,o){return s.start_context=structuredClone(o),o.b!=="Ps"?this.integer(s.value[0],e,o):(s.value[0]={type:"c",value:[s.value[0]],indices:structuredClone(s.value[0].indices)},s.value[1].type="v",s.value[1].original_type="title",s.value[1].value=[{type:"integer",value:1,indices:structuredClone(s.value[1].value.indices)}],s.type="cv",this.cv(s,e,s.start_context))}next_v(s,e,o){s.start_context=structuredClone(o);let c=this.pluck_last_recursively("integer",s.value)??{value:1};s.value.push({type:"integer",indices:s.indices,value:c.value+1});let f;[[f],o]=this.range(s,[],s.start_context),f.passages[0].valid.messages.end_verse_not_exist&&!f.passages[0].valid.messages.start_verse_not_exist&&!f.passages[0].valid.messages.start_chapter_not_exist&&o.c!=null&&(s.value.pop(),s.value.push({type:"cv",indices:s.indices,value:[{type:"c",value:[{type:"integer",value:o.c+1,indices:s.indices}],indices:s.indices},{type:"v",value:[{type:"integer",value:1,indices:s.indices}],indices:s.indices}]}),[[f],o]=this.range(s,[],s.start_context)),f.value[0].indices=f.value[1].indices,f.value[0].absolute_indices=f.value[1].absolute_indices,f.value.pop();for(let p of["end_verse_not_exist","end_chapter_not_exist"])delete s.passages[0].valid.messages[p];return e.push(f),[e,o]}sequence(s,e,o){s.start_context=structuredClone(o),s.passages=[];for(let c of s.value){let f;[[f],o]=this.handle_array(c,[],o);for(let p of f.passages)p.type??=f.type,p.absolute_indices??=f.absolute_indices,f.start_context.translations&&(p.translations=f.start_context.translations),p.enclosed_absolute_indices=f.type==="sequence_post_enclosed"?[...f.absolute_indices]:[-1,-1],s.passages.push(p)}return s.absolute_indices||(s.passages.length>0&&s.type==="sequence"?s.absolute_indices=[s.passages[0].absolute_indices[0],s.passages[s.passages.length-1].absolute_indices[1]]:s.absolute_indices=this.get_absolute_indices(s.indices)),e.push(s),[e,o]}sequence_post_enclosed(s,e,o){return this.sequence(s,e,o)}v(s,e,o){s.start_context=structuredClone(o);let c=s.type==="integer"?s.value:this.pluck("integer",s.value).value,f=o.c!=null?o.c:1,p=this.validate_ref(s.start_context.translations,{b:o.b,c:f,v:c}),[,m]=this.fix_start_zeroes(p,0,c);return s.passages=[{start:{b:o.b,c:f,v:m},end:{b:o.b,c:f,v:m},valid:p}],s.start_context.translations&&(s.passages[0].translations=structuredClone(s.start_context.translations)),s.absolute_indices??=this.get_absolute_indices(s.indices),e.push(s),o.v=m,[e,o]}range(s,e,o){s.start_context=structuredClone(o);let[c,f]=s.value;if([[c],o]=this.handle_obj(c,[],o),f.type==="v"&&this.options.end_range_digits_strategy==="verse"&&(c.type==="bc"&&!c.passages?.[0]?.valid?.messages?.start_chapter_not_exist_in_single_chapter_book||c.type==="c"))return s.value[0]=c,this.range_change_integer_end(s,e);[[f],o]=this.handle_obj(f,[],o),s.value=[c,f],s.indices=[c.indices[0],f.indices[1]],delete s.absolute_indices;let p={b:c.passages[0].start.b,c:c.passages[0].start.c,v:c.passages[0].start.v,type:c.type},m={b:f.passages[0].end.b,c:f.passages[0].end.c,v:f.passages[0].end.v,type:f.type};f.passages[0].valid.messages.start_chapter_is_zero&&(m.c=0),f.passages[0].valid.messages.start_verse_is_zero&&(m.v=0);let v=this.validate_ref(s.start_context.translations,p,m);if(v.valid){let[x,I]=this.range_handle_valid(v,s,c,p,f,m,e);if(x)return I}else return this.range_handle_invalid(v,s,c,p,f,m,e);return s.absolute_indices??=this.get_absolute_indices(s.indices),s.passages=[{start:p,end:m,valid:v}],s.start_context.translations&&(s.passages[0].translations=structuredClone(s.start_context.translations)),p.type==="b"?s.type=m.type==="b"?"b_range":"b_range_start":m.type==="b"&&(s.type="range_end_b"),e.push(s),[e,o]}range_change_end(s,e,o){let[c,f]=s.value;if(f.type==="integer")f.original_value=f.value,f.value=o;else if(f.type==="v"){let p=this.pluck("integer",f.value);p.original_value=p.value,p.value=o}else if(f.type==="cv"){let p=this.pluck("c",f.value);p.original_value=p.value,p.value=o}return this.handle_obj(s,e,s.start_context)}range_change_integer_end(s,e){let[o,c]=s.value;return s.original_type??=s.type,s.original_value??=[o,c],s.type=o.type==="integer"?"cv":o.type+"v",o.type==="integer"&&(s.value[0]={type:"c",value:[o],indices:o.indices}),c.type==="integer"&&(s.value[1]={type:"v",value:[c],indices:c.indices}),this.handle_obj(s,e,s.start_context)}range_check_new_end(s,e,o,c){let f=0,p;if(c.messages?.end_chapter_before_start)p="c";else if(c.messages?.end_verse_before_start)p="v";else return f;if(f=this.range_get_new_end_value(e,o,c,p),f>0){let m={b:o.b,c:o.c,v:o.v};m[p]=f,this.validate_ref(s,m).valid||(f=0)}return f}range_end_b(s,e,o){return this.range(s,e,o)}range_get_new_end_value(s,e,o,c){let f=0;return c==="c"&&o.messages?.end_chapter_is_zero||c==="v"&&o.messages?.end_verse_is_zero||(s[c]>=10&&e[c]<10&&s[c]-10*Math.floor(s[c]/10)<e[c]?f=e[c]+10*Math.floor(s[c]/10):s[c]>=100&&e[c]<100&&s[c]-100<e[c]&&(f=e[c]+100)),f}range_handle_invalid(s,e,o,c,f,p,m){if(s.valid===!1&&(s.messages?.end_chapter_before_start||s.messages?.end_verse_before_start)&&(f.type==="integer"||f.type==="v")||s.valid===!1&&s.messages?.end_chapter_before_start&&f.type==="cv"){let v=this.range_check_new_end(e.start_context.translations,c,p,s);if(v>0)return this.range_change_end(e,m,v)}if(this.options.end_range_digits_strategy==="verse"&&c.v==null&&(f.type==="integer"||f.type==="v")){let v=f.type==="v"?this.pluck("integer",f.value):f.value;if(this.validate_ref(e.start_context.translations,{b:c.b,c:c.c,v}).valid)return this.range_change_integer_end(e,m)}return e.original_type??=e.type,e.type="sequence",[e.original_value,e.value]=[[o,f],[[o],[f]]],this.sequence(e,m,structuredClone(e.start_context))}range_handle_valid(s,e,o,c,f,p,m){if(s.messages?.end_chapter_not_exist&&this.options.end_range_digits_strategy==="verse"&&!c.v&&(f.type==="integer"||f.type==="v")&&this.options.passage_existence_strategy.indexOf("v")>=0){let v=f.type==="v"?this.pluck("integer",f.value):f.value;if(this.validate_ref(e.start_context.translations,{b:c.b,c:c.c,v}).valid)return[!0,this.range_change_integer_end(e,m)]}return this.range_validate(s,c,p,e),[!1,null]}range_validate(s,e,o,c){s.messages?.end_chapter_not_exist||s.messages?.end_chapter_not_exist_in_single_chapter_book?(o.c=s.messages.end_chapter_not_exist??s.messages.end_chapter_not_exist_in_single_chapter_book,o.v!=null&&(o.v=this.validate_ref(c.start_context.translations,{b:o.b,c:o.c,v:999}).messages.end_verse_not_exist,delete s.messages.end_verse_is_zero)):s.messages?.end_verse_not_exist&&(o.v=s.messages.end_verse_not_exist),s.messages?.end_verse_is_zero&&this.options.zero_verse_strategy!=="allow"&&(o.v=s.messages.end_verse_is_zero),s.messages?.end_chapter_is_zero&&(o.c=s.messages.end_chapter_is_zero),[e.c,e.v]=this.fix_start_zeroes(s,e.c,e.v)}stop(s,e,o){return s.start_context={},e.push(s),[e,{}]}translation_sequence(s,e,o){s.start_context=structuredClone(o);let c=[];c.push({translation:this.books[s.value[0].value].parsed,system:"default",osis:""});for(let f of s.value[1]){let p=this.books[this.pluck("translation",f).value].parsed;p&&c.push({translation:p,system:"default",osis:""})}for(let f of c)this.translations.aliases[f.translation]?(f.system=this.translations.aliases[f.translation].system,f.osis=this.translations.aliases[f.translation].osis||f.translation.toUpperCase()):f.osis=f.translation.toUpperCase();return e.length>0&&(o=this.translation_sequence_apply(e,c)),s.absolute_indices=this.get_absolute_indices(s.indices),e.push(s),this.reset_context(o,["translations"]),[e,o]}translation_sequence_apply(s,e){let o=0;for(let f=s.length-1;f>=0;f--)if(s[f].original_type&&(s[f].type=s[f].original_type),s[f].original_value&&(s[f].value=s[f].original_value),s[f].type==="translation_sequence"||s[f].type==="stop"){o=f+1;break}let c;return o<s.length?(s[o].start_context.translations=e,[,c]=this.handle_array(s.slice(o),[],s[o].start_context)):c=structuredClone(s[s.length-1].start_context),c}word(s,e,o){return[e,o]}pluck(s,e){for(let o of e)if(o&&o.type&&o.type===s)return s==="c"||s==="v"?this.pluck("integer",o.value):o;return null}pluck_last_recursively(s,e){for(let o=e.length-1;o>=0;o--){let c=e[o];if(!c||!c.type)continue;if(c.type===s)return this.pluck(s,[c]);let f=this.pluck_last_recursively(s,c.value);if(f!=null)return f}return null}set_context_from_object(s,e,o){for(let c of e)o[c]!=null&&(s[c]=o[c])}reset_context(s,e){for(let o of e)delete s[o]}fix_start_zeroes(s,e,o=void 0){return s.messages?.start_chapter_is_zero&&this.options.zero_chapter_strategy==="upgrade"&&(e=s.messages.start_chapter_is_zero),s.messages?.start_verse_is_zero&&this.options.zero_verse_strategy==="upgrade"&&(o=s.messages.start_verse_is_zero),[e,o]}calculate_indices(s,e){let o="book",c=[],f=0;typeof e!="number"&&(e=parseInt(e,10));for(let p of s.split(/[\x1e\x1f]/)){o=o==="book"?"rest":"book";let m=p.length;if(m!==0)if(o==="book"){let v=parseInt(p.replace(/\/\d+$/,""),10),x=f+m;c.length>0&&c[c.length-1].index===e?c[c.length-1].end=x:c.push({start:f,end:x,index:e}),f+=m+2,e=this.books[v].start_index+this.books[v].value.length-f,c.push({start:x+1,end:x+1,index:e})}else{let v=f+m-1;c.length>0&&c[c.length-1].index===e?c[c.length-1].end=v:c.push({start:f,end:v,index:e}),f+=m}}return c}get_absolute_indices([s,e]){let o=null,c=null;for(let f of this.indices)if(o===null&&f.start<=s&&s<=f.end&&(o=s+f.index),f.start<=e&&e<=f.end){c=e+f.index+1;break}return[o,c]}normalize_passage_and_alternates(s,e){s.passages.length===0&&s.passages.push(e.shift()),e.length>0&&(s.passages[0].alternates=e),s.start_context.translations&&(s.passages[0].translations=s.start_context.translations),s.absolute_indices??=this.get_absolute_indices(s.indices)}validate_ref(s,e,o=null){(!s||s.length===0||!Array.isArray(s))&&(s=[{osis:"",translation:"current",system:"current"}]);let c=!1,f={};for(let p of s){if(!p.system){f.translation_invalid??=[],f.translation_invalid.push(p);continue}this.translations.aliases[p.system]||(p.system="current",f.translation_unknown??=[],f.translation_unknown.push(p));let[m]=this.validate_start_ref(p.system,e,f);o&&([m]=this.validate_end_ref(p.system,e,o,m,f)),m===!0&&(c=!0)}return{valid:c,messages:f}}validate_end_ref(s,e,o,c,f){let p=this.translations.systems[s]?.order?s:"current";return o.c===0&&(f.end_chapter_is_zero=1,this.options.zero_chapter_strategy==="error"?c=!1:o.c=1),o.v===0&&(f.end_verse_is_zero=1,this.options.zero_verse_strategy==="error"?c=!1:this.options.zero_verse_strategy==="upgrade"&&(o.v=1)),o.b&&this.translations.systems[p].order[o.b]?c=this.validate_known_end_book(s,p,e,o,c,f):(c=!1,f.end_book_not_exist=!0),[c,f]}validate_known_end_book(s,e,o,c,f,p){let m=this.translations.systems[s]?.chapters?.[c.b]||this.translations.systems.current.chapters[c.b];return c.c==null&&m.length===1&&(c.c=1),this.translations.systems[e].order[o.b]!=null&&this.translations.systems[e].order[o.b]>this.translations.systems[e].order[c.b]&&(this.options.passage_existence_strategy.indexOf("b")>=0&&(f=!1),p.end_book_before_start=!0),o.b===c.b&&c.c!=null&&(o.c??=1,o.c>c.c?(f=!1,p.end_chapter_before_start=!0):o.c===c.c&&c.v!=null&&(o.v??=1,o.v>c.v&&(f=!1,p.end_verse_before_start=!0))),c.c!=null&&m[c.c-1]==null&&(m.length===1?p.end_chapter_not_exist_in_single_chapter_book=1:c.c>0&&this.options.passage_existence_strategy.indexOf("c")>=0&&(p.end_chapter_not_exist=m.length)),c.v!=null&&(c.c??=m.length,c.v>m[c.c-1]&&this.options.passage_existence_strategy.indexOf("v")>=0&&(p.end_verse_not_exist=m[c.c-1])),f}validate_known_start_book(s,e,o){let c=!0;e.c??=1;let f=this.translations.systems[s]?.chapters?.[e.b]||this.translations.systems.current.chapters[e.b];if(e.c===0&&(o.start_chapter_is_zero=1,this.options.zero_chapter_strategy==="error"?c=!1:e.c=1),e.v===0&&(o.start_verse_is_zero=1,this.options.zero_verse_strategy==="error"?c=!1:this.options.zero_verse_strategy==="upgrade"&&(e.v=1)),e.c>0&&f[e.c-1]!=null)e.v!=null?e.v>f[e.c-1]&&this.options.passage_existence_strategy.indexOf("v")>=0&&(c=!1,o.start_verse_not_exist=f[e.c-1]):e.c===1&&this.options.single_chapter_1_strategy==="verse"&&f.length===1&&(o.start_chapter_1=1);else{let p=f.length;e.c!==1&&p===1?(c=!1,o.start_chapter_not_exist_in_single_chapter_book=1):e.c>0&&this.options.passage_existence_strategy.indexOf("c")>=0&&(c=!1,o.start_chapter_not_exist=p)}return c}validate_start_ref(s,e,o){let c=!0,f=this.translations.systems[s]?.order?s:"current";return e.b?this.translations.systems[f].order[e.b]?c=this.validate_known_start_book(s,e,o):(this.options.passage_existence_strategy.indexOf("b")>=0&&(c=!1),o.start_book_not_exist=!0):(c=!1,o.start_book_not_defined=!0),[c,o]}};var Ee=class{constructor(s){this.filtered_books_flags="";this.parent=s,this.filter_books("on","none")}filter_books(s,e){let o=s+"/"+e;o!==this.filtered_books_flags&&(this.filtered_books_flags=o,s==="ona"&&e==="none"&&(this.parent.regexps.books=this.parent.regexps.all_books),this.parent.regexps.books=this.parent.regexps.all_books.reduce((c,f)=>{let p;if(s!=="ona"&&s.indexOf(f.testament)===-1){if(f.testament.length===1||f.testament_books==null)return c;if(this.has_testament_overlap(s,f.testament)){let m=this.get_testament_overlap(s,f);if(m.length>0)p=structuredClone(f),p.osis=m;else return c}else return c}if(e==="books"){p??=structuredClone(f);let m=p.regexp.flags.replace("i","");p.regexp=new RegExp(f.regexp.source,m)}return c.push(p??f),c},[]))}has_testament_overlap(s,e){return new Set((s+e).split("")).size<s.length+e.length}get_testament_overlap(s,e){return e.osis.filter(c=>this.has_testament_overlap(s,e.testament_books[c]))}add_books(s){if(s==null||!Array.isArray(s.books))throw new Error("add_books: The argument to `add_books` should be an object with an array in `books`");let e=[],o=[];for(let c of s.books){if(c==null||!(c.regexp instanceof RegExp))throw new Error("add_books: The `regexp` property of each pattern should be a RegExp");let f=this.get_book_testaments(c),p=this.get_book_pattern_regexps(c,f),m=new RegExp(p.pre_regexp.source+p.regexp.source+p.post_regexp.source,"giu"),v=typeof c.insert_at=="string"?c.insert_at:"start",x={osis:c.osis,testament:f.testament,regexp:m};if(f.testament.length>1&&(x.testament_books=f.testament_books),v==="start")e.push(x);else if(v==="end")o.push(x);else{let I=!1;for(let[E,R]of this.parent.regexps.all_books.entries())if(R.osis.join(",")===v){this.parent.regexps.all_books.splice(E,0,x),I=!0;break}I===!1&&o.push(x)}}(e.length>0||o.length>0)&&(this.parent.regexps.all_books=[...e,...this.parent.regexps.all_books,...o]),this.filtered_books_flags="",this.filter_books(this.parent.options.testaments,this.parent.options.case_sensitive)}get_book_pattern_regexps(s,e){let o={pre_regexp:new RegExp(""),regexp:s.regexp,post_regexp:new RegExp("")};for(let c of["pre_regexp","post_regexp"])if(s[c]==null){let f=c==="pre_regexp"?"pre_book":"post_book";e.has_number_book&&f==="pre_book"&&(f="pre_number_book"),o[c]=this.parent.regexps[f]}else if(s[c]instanceof RegExp)o[c]=s[c];else throw new Error("add_books: The `"+c+"` property of each pattern should be a RegExp");return o}get_book_testaments(s){let e=s.osis;if(!Array.isArray(e))throw new Error("add_books: The `osis` property of each pattern should be an array");let o={testament_books:{},has_number_book:!1,testament:""},c=new Set;for(let f of e){if(typeof f!="string"||this.parent.translations.systems.default.order[f]==null)throw new Error("add_books: Unknown book in pattern: "+f);if(f in o.testament_books)throw new Error("add_books: Every provided book should be unique. Duplicate: "+f);let p="o";if(f==="Ps")o.testament_books[f]="oa",c.add("o"),c.add("a");else{let m=this.parent.translations.systems.default.order[f];m>=40&&(p=m<=66?"n":"a"),/^\d/.test(f)&&/\d/.test(s.regexp.source)&&(o.has_number_book=!0),o.testament_books[f]=p,c.add(p)}}if(c.size===1)o.testament=c.values().next().value;else for(let f of["o","n","a"])c.has(f)&&(o.testament+=f);return o}};var we=class{constructor(s){this.parent=s}translation_info(s="default"){(typeof s!="string"||!s)&&(s="default"),this.parent.translations.aliases[s]?.system&&(s=this.parent.translations.aliases[s].system),this.parent.translations.systems[s]==null&&(this.parent.options.warn_level==="warn"&&console.warn("Unknown translation `"+new_translation+"` in translation_info(). Using default instead."),s="default");let e=this.parent.options.versification_system;this.parent.options.versification_system=s;let o={alias:s,books:[],chapters:structuredClone(this.parent.translations.systems.current.chapters),order:structuredClone(this.parent.translations.systems.current.order),system:s};for(let[c,f]of Object.entries(o.order))o.books[f-1]=c;return s!==e&&(this.parent.options.versification_system=e),o}add_translations(s){if(s?.translations==null||!Array.isArray(s.translations)||s.translations.length===0)throw new Error("add_translations: A `translations array in the `translations` key should have at least one object");let e={},o=[];for(let c of s.translations){let f=this.normalize_sent_translation_data(c),p=c.text.toLowerCase();if(p==="default"||p==="current")throw new Error("add_translations: Can't redefine `"+p+"` as a translation. This built-in translation can't be redefined");let m=f.system;if(m!=="default"&&this.parent.translations.systems[f.system]==null)if(s.systems!=null&&s.systems[m]!=null)this.add_system(f.system,s.systems[m]);else{let v=Object.keys(this.parent.translations.systems);throw v=v.filter(x=>x!=="current"),new Error("add_translations: Unknown translation `system`: `"+m+"`. Valid `system`s are: `"+Object.keys(v).join("`, `")+"`. You may want to check that you included this system in `systems`")}else if(m==="current")throw new Error("add_translations: Can't use `"+m+"` as a versification system for a new translation");e[p]!=null||this.parent.translations.aliases[p]!=null?this.parent.options.warn_level==="warn"&&console.warn("add_translations: `"+c.text+"` already exists. You probably only want to do this if the old definition was wrong"):o.push(c.text),e[p]=f}o.length>0&&this.add_new_translations_regexp(o,s),this.parent.translations.aliases={...e,...this.parent.translations.aliases}}normalize_sent_translation_data(s){let e=s.text;if(e==null||typeof e!="string"||e.length===0)throw new Error('add_translations: Each translation object should contain a string `text` key with a value like "KJV"');if(e.match(/^\p{N}+$/u))throw new Error("add_translations: A translation.text (`"+e+"`) can't be all numbers because then it would conflict with chapter and verse references.");let o=typeof s.osis=="string"&&s.osis!==""?s.osis:s.text.toUpperCase(),c=typeof s.system=="string"&&s.system.length>0?s.system:"default";return{osis:o,system:c}}add_system(s,e){if(s==="default"||s==="current")throw new Error("add_translations: Can't use `"+s+"` as a versification system. This built-in system can't be redefined");if(e==null||e.books==null&&e.chapters==null)throw new Error("add_translations: The system object should contain `books` key, a `chapters` key or both");if(this.parent.translations.systems[s]!=null)return;let o={};if(e.books!=null){if(!Array.isArray(e.books)||e.books.length===0)throw new Error("add_translations: The `books` key in each `system` object should be an array with at least one string in it");o.books=this.make_system_books(e.books)}if(e.chapters!=null){if(typeof e.chapters!="object"||Object.keys(e.chapters).length===0)throw new Error("add_translations: The `chapters` key in the each `system` object should be an object with at least one key");this.validate_system_chapters(e.chapters),o.chapters=structuredClone(e.chapters)}this.parent.translations.systems[s]=o}make_system_books(s){let e=structuredClone(this.parent.translations.systems.default.order),o={},c=1;for(let p of s){if(typeof p!="string"||e[p]==null)throw new Error("add_translations: Got an unexpected OSIS value in `books` (also check for any duplicates): "+p);delete e[p],o[p]=c,c++}let f=Object.keys(e).sort((p,m)=>e[p]-e[m]);for(let p of f)o[p]=c,c++;return o}validate_system_chapters(s){let e=this.parent.translations.systems.default.order;for(let[o,c]of Object.entries(s)){if(e[o]==null)throw new Error("add_translations: Unexpected book: "+o);if(!Array.isArray(c)||c.length==0)throw new Error("add_translations: Each value in `chapters` should be an array with at least one entry containing the number of verses in each chapter. Check `"+o+"`");for(let f of c)if(!(typeof f=="number"&&f>=1&&f<=200))throw new Error("add_translations: Unexpected value in `chapters`: "+f+"`. It should be a number between 1 and 200")}}add_new_translations_regexp(s,e){s.length>1&&(s=s.sort((m,v)=>v.length-m.length));let o=e.insert_at==="end"?"end":"start",c=e?.pre_regexp instanceof RegExp?e?.pre_regexp:{source:""},f=e?.post_regexp instanceof RegExp?e?.post_regexp:/(?![\p{L}\p{N}])/u,p=new RegExp(c.source+"("+s.map(m=>m.replace(/([$\\.*+?()\[\]{}|^])/g,"\\$1")).join("|")+")"+f.source,"gi");o==="start"?this.parent.regexps.translations.unshift(p):this.parent.regexps.translations.push(p)}};var ns=class{constructor(){this.books=[];this.languages=["en"];this.translations=[/(?:N(?:RSVUE|ABRE|ASB|IV|[EL]T)|N(?:RSV|A[BS])|HCSB|(?:N(?:IR|KJ)|AS|E[RS]|KJ|RS)V|TNIV|AMP|CE[BV]|LXX|MSG|CSB)\b/gi];this.escaped_passage=/(?:^|[^\x1e\x1f\p{L}\p{N}])((?:(?:ch(?:apters?|a?pts?\.?|a?p?s?\.?)?\s*\d+\s*(?:[\u2013\u2014\-]|through|thru|to)\s*\d+\s*(?:from|of|in)(?:\s+the\s+book\s+of)?\s*)|(?:ch(?:apters?|a?pts?\.?|a?p?s?\.?)?\s*\d+\s*(?:from|of|in)(?:\s+the\s+book\s+of)?\s*)|(?:\d+(?:th|nd|st)\s*ch(?:apter|a?pt\.?|a?p?\.?)?\s*(?:from|of|in)(?:\s+the\s+book\s+of)?\s*))?\x1f(\d+)(?:\/\d+)?\x1f(?:\/\d+\x1f|[\d\s.:,;\x1e\x1f&\(\)()\[\]\\/"'\*=~\-–—]|title(?![a-z])|ff(?![a-z0-9])|f(?![a-z0-9])|see\s+also|chapters|chapter|through|compare|chapts|verses|chpts|chapt|chaps|verse|chap|thru|also|chp|chs|cha|and|see|ver|vss|ch|to|cf|vs|vv|v|[a-e](?!\w)|$)+)/giu;this.match_end_split=/\d\W*title|\d\W*(?:ff(?![a-z0-9])|f(?![a-z0-9]))(?:[\s*]*\.)?|\d[\s*]*[a-e](?!\w)|\x1e(?:[\s*]*[)\]\uff09])?|[\d\x1f]/gi;this.control=/[\x1e\x1f]/g;this.first=/(?:1st|1|I|First)\.?\s*/;this.second=/(?:2nd|2|II|Second)\.?\s*/;this.third=/(?:3rd|3|III|Third)\.?\s*/;this.range_and=/(?:[&\u2013\u2014-]|(?:and|compare|cf|see\s+also|also|see)|(?:through|thru|to))/;this.range_only=/(?:[\u2013\u2014-]|(?:through|thru|to))/;this.pre_book=/(?:^|(?<=[^\p{L}]))/gu;this.pre_number_book=/(?:^|(?<=[^\p{L}\p{N}])(?<!\d:(?=\d)))/gu;this.post_book=/(?:(?=[\d\s\.?:,;\x1e\x1f&\(\)()\[\]\/"’'\*=~\-–—])|$)/gu;this.all_books=[{osis:["Ps"],testament:"a",extra:"2",regexp:/\b(Ps151)(?=\.1\b)/g},{osis:["Gen"],testament:"o",regexp:/(?:^|(?<=[^\p{L}]))(G(?:en(?:n(?:(?:eis[eiu]|si)s|ees[eiu]s|i(?:[ei]s[eiu]s|s[eiu]s)|es[eiu]s)|(?:e(?:is[eiu]|su)|si)s|ees[eiu]s|i(?:[ei]s[eiu]s|s[eiu]s)|es[ei]s)|e(?:n(?:neis|es[ei]|eis)?)?|n))(?:(?=[\d\s.:,;\x1e\x1f&\(\)()\[\]\/"'\*=~\-–—])|$)/giu},{osis:["Exod"],testament:"o",regexp:/(?:^|(?<=[^\p{L}]))(Ex(?:o(?:d(?:[iu]s|[es])?)?|d)?)(?:(?=[\d\s.:,;\x1e\x1f&\(\)()\[\]\/"'\*=~\-–—])|$)/giu},{osis:["Bel"],testament:"a",regexp:/(?:^|(?<=[^\p{L}]))(Bel(?:\s*(?:and\s*(?:the\s*(?:S(?:erpent|nake)|Dragon)|S(?:erpent|nake)|Dragon)|&\s*(?:the\s*(?:S(?:erpent|nake)|Dragon)|S(?:erpent|nake)|Dragon)))?)(?:(?=[\d\s.:,;\x1e\x1f&\(\)()\[\]\/"'\*=~\-–—])|$)/giu},{osis:["Lev"],testament:"o",regexp:/(?:^|(?<=[^\p{L}]))(L(?:evit(?:[ei])?cus|evet(?:[ei])?cus|iv[ei]t(?:[ei])?cus|e(?:vi?)?|v))(?:(?=[\d\s.:,;\x1e\x1f&\(\)()\[\]\/"'\*=~\-–—])|$)/giu},{osis:["Num"],testament:"o",regexp:/(?:^|(?<=[^\p{L}]))(N(?:u(?:m(?:b(?:ers?)?)?)?|m))(?:(?=[\d\s.:,;\x1e\x1f&\(\)()\[\]\/"'\*=~\-–—])|$)/giu},{osis:["Sir"],testament:"a",regexp:/(?:^|(?<=[^\p{L}]))((?:The\s*Wisdom\s*of\s*Jesus(?:,\s*Son\s*of|\s*(?:Son\s*of|ben))\s*Sirach|Wisdom\s*of\s*Jesus(?:,\s*Son\s*of|\s*(?:Son\s*of|ben))\s*Sirach|Ecc(?:l[eu]siasticus|s)|Ben\s*Sira|Ecclus|Sirach|Sir))(?:(?=[\d\s.:,;\x1e\x1f&\(\)()\[\]\/"'\*=~\-–—])|$)/giu},{osis:["Wis"],testament:"a",regexp:/(?:^|(?<=[^\p{L}]))((?:The\s*Wis(?:d?om|d?)\s*of\s*Solomon|Wis(?:d(?:om)?\s*|\s*)of\s*Solomon|Wisom\s*of\s*Solomon|Wis(?:d(?:om)?)?))(?:(?=[\d\s.:,;\x1e\x1f&\(\)()\[\]\/"'\*=~\-–—])|$)/giu},{osis:["Lam"],testament:"o",regexp:/(?:^|(?<=[^\p{L}]))(L(?:am[ei]ntations|a(?:m(?:[ei]ntation)?)?|m))(?:(?=[\d\s.:,;\x1e\x1f&\(\)()\[\]\/"'\*=~\-–—])|$)/giu},{osis:["EpJer"],testament:"a",regexp:/(?:^|(?<=[^\p{L}]))((?:The\s*(?:(?:Ep(?:istle|\.)|Ep)\s*of\s*Jeremiah|Let(?:ter|\.?)\s*of\s*Jeremiah)|Ep(?:(?:(?:istle\s*of\s*Jeremiah|(?:istle\s*of\s*Jeremy|\s*?Jer))|\s*of\s*Jeremiah)|\.\s*of\s*Jeremiah)|Let(?:ter|\.?)\s*of\s*Jeremiah))(?:(?=[\d\s.:,;\x1e\x1f&\(\)()\[\]\/"'\*=~\-–—])|$)/giu},{osis:["Rev"],testament:"n",regexp:/(?:^|(?<=[^\p{L}]))(R(?:ev(?:e?|[ao])lations|e(?:v(?:elation|[ao]lation|lation|el)?)?|v))(?:(?=[\d\s.:,;\x1e\x1f&\(\)()\[\]\/"'\*=~\-–—])|$)/giu},{osis:["PrMan"],testament:"a",regexp:/(?:^|(?<=[^\p{L}]))((?:The\s*Pr(?:ayer(?:s\s*(?:of\s*)?Manasseh|\s*(?:of\s*)?Manasseh)|\s*(?:of\s*)?Manasseh)|Prayer(?:s\s*(?:of\s*)?Manasseh|\s*(?:of\s*)?Manasseh)|Pr\s*of\s*Manasseh|Pr\s*Manasseh|Pr\s*?Man))(?:(?=[\d\s.:,;\x1e\x1f&\(\)()\[\]\/"'\*=~\-–—])|$)/giu},{osis:["Deut"],testament:"o",regexp:/(?:^|(?<=[^\p{L}]))(D(?:eut[eo]rono?my|eet(?:[eo]rono?my|rono?my)|u(?:et[eo]rono?my|ut(?:[eo]rono?my|rono?my)|et(?:rono?my)?)|eutrono?my|eut?|t))(?:(?=[\d\s.:,;\x1e\x1f&\(\)()\[\]\/"'\*=~\-–—])|$)/giu},{osis:["Josh"],testament:"o",regexp:/(?:^|(?<=[^\p{L}]))(J(?:o(?:(?:ush?ua|sh?ua)|sh?)|sh))(?:(?=[\d\s.:,;\x1e\x1f&\(\)()\[\]\/"'\*=~\-–—])|$)/giu},{osis:["Judg"],testament:"o",regexp:/(?:^|(?<=[^\p{L}]))(J(?:udg(?:es)?|d?gs|d?g))(?:(?=[\d\s.:,;\x1e\x1f&\(\)()\[\]\/"'\*=~\-–—])|$)/giu},{osis:["Ruth"],testament:"o",regexp:/(?:^|(?<=[^\p{L}]))(R(?:u(?:th?)?|th?))(?:(?=[\d\s.:,;\x1e\x1f&\(\)()\[\]\/"'\*=~\-–—])|$)/giu},{osis:["1Esd"],testament:"a",regexp:/(?:^|(?<=[^\p{L}\p{N}])(?<!\d:(?=\d)))((?:First\s*Esd(?:r(?:as)?)?|(?:(?:1st|I)|1)\.\s*Esd(?:r(?:as)?)?|(?:(?:1st|I)|1)\s*Esd(?:r(?:as)?)?|1Esd))(?:(?=[\d\s.:,;\x1e\x1f&\(\)()\[\]\/"'\*=~\-–—])|$)/giu},{osis:["2Esd"],testament:"a",regexp:/(?:^|(?<=[^\p{L}\p{N}])(?<!\d:(?=\d)))((?:Second\s*Esd(?:r(?:as)?)?|(?:2(?:nd)?|II)\.\s*Esd(?:r(?:as)?)?|(?:2(?:nd)?|II)\s*Esd(?:r(?:as)?)?|2Esd))(?:(?=[\d\s.:,;\x1e\x1f&\(\)()\[\]\/"'\*=~\-–—])|$)/giu},{osis:["Isa"],testament:"o",regexp:/(?:^|(?<=[^\p{L}]))(I(?:s(?:ai[ai](?:[ai])?ha|aa(?:[ai](?:[ai])?ha|ha)|i(?:[ai](?:[ai](?:[ai])?ha|ha)|ha)|ai[ai](?:[ai])?h|aa(?:[ai](?:[ai])?h|h)|i[ai](?:[ai](?:[ai])?h|h)|(?:aish|ai?h)a|aish|ai?h|sah|ai?)?|a))(?:(?=[\d\s.:,;\x1e\x1f&\(\)()\[\]\/"'\*=~\-–—])|$)/giu},{osis:["2Sam"],testament:"o",regexp:/(?:^|(?<=[^\p{L}\p{N}])(?<!\d:(?=\d)))((?:Second\s*(?:Kingdoms|S(?:(?:amu[ae]l[ls]|ma)|(?:a(?:m(?:u[ae]l)?)?|m)))|(?:2(?:nd)?|II)\.\s*(?:Kingdoms|S(?:(?:amu[ae]l[ls]|ma)|(?:a(?:m(?:u[ae]l)?)?|m)))|(?:2nd|II)\s*(?:Kingdoms|S(?:(?:amu[ae]l[ls]|ma)|(?:a(?:m(?:u[ae]l)?)?|m)))|2(?:\s*Kingdoms|(?:(?:(?:\s*Samu[ae]l[ls]|Sam)|\s*Sma)|\s*S(?:(?:a(?:m(?:u[ae]l)?)?)?|m)))))(?:(?=[\d\s.:,;\x1e\x1f&\(\)()\[\]\/"'\*=~\-–—])|$)/giu},{osis:["1Sam"],testament:"o",regexp:/(?:^|(?<=[^\p{L}\p{N}])(?<!\d:(?=\d)))((?:First\s*(?:Kingdoms|S(?:(?:amu[ae]l[ls]|ma)|(?:a(?:m(?:u[ae]l)?)?|m)))|(?:(?:1st|I)|1)\.\s*(?:Kingdoms|S(?:(?:amu[ae]l[ls]|ma)|(?:a(?:m(?:u[ae]l)?)?|m)))|(?:1st|I)\s*(?:Kingdoms|S(?:(?:amu[ae]l[ls]|ma)|(?:a(?:m(?:u[ae]l)?)?|m)))|1\s*Kingdoms|1\s*Samu[ae]l[ls]|1\s*Sa(?:m(?:u[ae]l)?)?|Samu[ae]l[ls]|Samu[ae]l|1\s*Sma|1\s*Sm|1Sam|1\s*S))(?:(?=[\d\s.:,;\x1e\x1f&\(\)()\[\]\/"'\*=~\-–—])|$)/giu},{osis:["2Kgs"],testament:"o",regexp:/(?:^|(?<=[^\p{L}\p{N}])(?<!\d:(?=\d)))((?:Fourth\s*Kingdoms|(?:4(?:th)?\.|IV\.)\s*Kingdoms|Second\s*K(?:i?ng?s|(?:i?g|i?)s)|(?:4(?:th)?\s*|IV\s*)Kingdoms|Second\s*K(?:i?ng?|i?g|i)?|(?:2(?:nd)?|II)\.\s*K(?:i?ng?s|(?:i?g|i?)s)|(?:2(?:nd)?|II)\.\s*K(?:i?ng?|i?g|i)?|(?:2(?:nd)?|II)\s*K(?:i?ng?s|(?:i?g|i?)s)|(?:2(?:nd)?|II)\s*K(?:i?ng?|i?g|i)?|2Kgs))(?:(?=[\d\s.:,;\x1e\x1f&\(\)()\[\]\/"'\*=~\-–—])|$)/giu},{osis:["1Kgs"],testament:"o",regexp:/(?:^|(?<=[^\p{L}\p{N}])(?<!\d:(?=\d)))((?:Third\s*Kingdoms|(?:III\.|3(?:rd)?\.)\s*Kingdoms|(?:III\s*|3(?:rd)?\s*)Kingdoms|First\s*K(?:i?ng?s|(?:i?g)?s)|First\s*K(?:i?ng?|i?g|i)?|(?:1(?:st)?\.|I\.)\s*K(?:i?ng?s|(?:i?g)?s)|(?:1(?:st)?\.|I\.)\s*K(?:i?ng?|i?g|i)?|(?:1(?:st)?\s*|I\s*)K(?:i?ng?s|(?:i?g)?s)|(?:1(?:st)?\s*|I\s*)K(?:i?ng?|i?g|i)?|(?:K(?:(?:in)?|n)g|1Kg)s|Kin))(?:(?=[\d\s.:,;\x1e\x1f&\(\)()\[\]\/"'\*=~\-–—])|$)/giu},{osis:["2Chr"],testament:"o",regexp:/(?:^|(?<=[^\p{L}\p{N}])(?<!\d:(?=\d)))((?:Second\s*(?:Paralipomenon|C(?:(?:h?oron[io]cles|hr(?:(?:onicals|n)|onicles)|(?:hrono|ron[io])cles)|(?:h?oron[io]cle|hronicle|(?:hrono|ron[io])cle|hr(?:on?)?|ron)))|(?:2(?:nd)?|II)\.\s*(?:Paralipomenon|C(?:(?:h?oron[io]cles|hr(?:(?:onicals|n)|onicles)|(?:hrono|ron[io])cles)|(?:h?oron[io]cle|hronicle|(?:hrono|ron[io])cle|hr(?:on?)?|ron)))|(?:2nd|II)\s*(?:Paralipomenon|C(?:(?:h?oron[io]cles|hr(?:(?:onicals|n)|onicles)|(?:hrono|ron[io])cles)|(?:h?oron[io]cle|hronicle|(?:hrono|ron[io])cle|hr(?:on?)?|ron)))|2\s*Paralipomenon|2\s*Ch?oron[io]cles|2\s*Ch?oron[io]cle|2(?:(?:\s*Chr(?:onicals|n)|Chr)|\s*Chronicles)|2\s*C(?:hrono|ron[io])cles|2\s*C(?:hronicle|(?:h(?:r(?:on?)?)?|ron))|2\s*C(?:hrono|ron[io])cle))(?:(?=[\d\s.:,;\x1e\x1f&\(\)()\[\]\/"'\*=~\-–—])|$)/giu},{osis:["1Chr"],testament:"o",regexp:/(?:^|(?<=[^\p{L}\p{N}])(?<!\d:(?=\d)))((?:(?:First\s*|(?:(?:(?:1st|I)|1)\.\s*|(?:(?:1st|I)\s*|(?:1\s*)?)))Paralipomenon|First\s*C(?:h(?:(?:oronicles|r(?:onicals|n))|ronicles)|(?:ho?rono|ron[io])cles|oron[io]cles)|First\s*C(?:(?:ho?rono|ron[io])cle|hronicle|oron[io]cle|hr(?:on?)?|ron)|(?:(?:1st|I)|1)\.\s*C(?:h(?:(?:oronicles|r(?:onicals|n))|ronicles)|(?:ho?rono|ron[io])cles|oron[io]cles)|(?:(?:1st|I)|1)\.\s*C(?:(?:ho?rono|ron[io])cle|hronicle|oron[io]cle|hr(?:on?)?|ron)|(?:1st|I)\s*C(?:h(?:(?:oronicles|r(?:onicals|n))|ronicles)|(?:ho?rono|ron[io])cles|oron[io]cles)|(?:1st|I)\s*C(?:(?:ho?rono|ron[io])cle|hronicle|oron[io]cle|hr(?:on?)?|ron)|1\s*Choronicles|(?:(?:1\s*Cho|(?:1\s*)?Ch)rono|1\s*Cron[io])cles|(?:(?:1\s*Cho|(?:1\s*)?Ch)rono|1\s*Cron[io])cle|(?:1\s*)?Chronicals|(?:1\s*)?Chronicles|(?:1\s*Co|Ch?o)ron[io]cles|(?:1\s*)?Chronicle|(?:1\s*Co|Ch?o)ron[io]cle|Cron[io]cles|Cron[io]cle|1\s*C(?:h(?:r(?:on?)?)?|ron)|1(?:\s*Chrn|Chr)))(?:(?=[\d\s.:,;\x1e\x1f&\(\)()\[\]\/"'\*=~\-–—])|$)/giu},{osis:["Ezra"],testament:"o",regexp:/(?:^|(?<=[^\p{L}]))(E(?:zra?|sra))(?:(?=[\d\s.:,;\x1e\x1f&\(\)()\[\]\/"'\*=~\-–—])|$)/giu},{osis:["Neh"],testament:"o",regexp:/(?:^|(?<=[^\p{L}]))(Ne(?:h(?:[ei]m(?:a[ai](?:[ai])?h|i(?:a[ai]h|i(?:[ai])?h|a?h|a)|ah)|amiah|amia)?)?)(?:(?=[\d\s.:,;\x1e\x1f&\(\)()\[\]\/"'\*=~\-–—])|$)/giu},{osis:["GkEsth"],testament:"a",regexp:/(?:^|(?<=[^\p{L}]))((?:Esther\s*\(Greek\)|G(?:(?:r(?:eek\s*Esther|\s*Esth)|k\s*?Esth)|(?:r(?:eek\s*Esth?|\s*Est)|k\s*Est))))(?:(?=[\d\s.:,;\x1e\x1f&\(\)()\[\]\/"'\*=~\-–—])|$)/giu},{osis:["Esth"],testament:"o",regexp:/(?:^|(?<=[^\p{L}]))(Es(?:t(?:h?er|hr|h)?)?)(?:(?=[\d\s.:,;\x1e\x1f&\(\)()\[\]\/"'\*=~\-–—])|$)/giu},{osis:["Job"],testament:"o",regexp:/(?:^|(?<=[^\p{L}]))(Jo?b)(?:(?=[\d\s.:,;\x1e\x1f&\(\)()\[\]\/"'\*=~\-–—])|$)/giu},{osis:["Ps"],testament:"oa",testament_books:{Ps:"oa"},extra:"1",regexp:/\b((?:(?:(?:1[02-5]|[2-9])?(?:1\s*st|2\s*nd|3\s*rd))|1?1[123]\s*th|(?:150|1[0-4][04-9]|[1-9][04-9]|[4-9])\s*th)\s*Psalm)\b/gi},{osis:["Ps"],testament:"oa",testament_books:{Ps:"oa"},regexp:/(?:^|(?<=[^\p{L}]))((?:P(?:s(?:a(?:(?:lm[alm]|ml?m)|lam)|m(?:alm|l)|lam)|l(?:a(?:sm)?a|s(?:sss|a?m)))s?|P(?:s(?:a[al]l|lal)|a(?:ls|sl))ms?|P(?:(?:s(?:a(?:(?:lm?s|m(?:l[as]|s)|aa)|las)|m(?:als|m)|lm[ms]|sm)|la(?:sm?s|ms)|(?:s(?:a(?:ma|am)|lma)|l(?:ama|m))s|a(?:s(?:(?:ml|s)|m)s|(?:l[lm]|m[ls])s))|(?:s(?:a(?:lm?|ml?)?|ala|m(?:al?)?|l[am]|s)?|l(?:a(?:sm?|m)|s(?:ss?|a))))|Salms?))(?:(?=[\d\s.:,;\x1e\x1f&\(\)()\[\]\/"'\*=~\-–—])|$)/giu},{osis:["PrAzar"],testament:"a",regexp:/(?:^|(?<=[^\p{L}]))((?:The\s*Pr(?:ayer(?:s\s*of\s*Azariah?|\s*of\s*Azariah?)|\s*of\s*Azariah?)|Prayer(?:s\s*of\s*Azariah?|\s*of\s*Azariah?)|Pr\s*of\s*Azariah?|Pr(?:\s*Aza|Aza?)r|Azariah?))(?:(?=[\d\s.:,;\x1e\x1f&\(\)()\[\]\/"'\*=~\-–—])|$)/giu},{osis:["Prov"],testament:"o",regexp:/(?:^|(?<=[^\p{L}]))((?:P(?:rob|o)verbs|P(?:(?:(?:(?:r(?:(?:(?:over|v)|ver)|ever)bs|v)|r(?:overb|everb|verb|ov?|vb|v)?)|rovebs)|roberbs)|Porverbs|Oroverbs))(?:(?=[\d\s.:,;\x1e\x1f&\(\)()\[\]\/"'\*=~\-–—])|$)/giu},{osis:["Eccl"],testament:"o",regexp:/(?:^|(?<=[^\p{L}]))((?:Ec(?:(?:(?:(?:cles(?:i?aia|sai)s|cles(?:i(?:ai)?s|ai?s)|clesiias)t|(?:cles(?:i(?:asti|t)|ait)|clesias?t))es|clesiaas?tes|clessias?tes|les(?:(?:i(?:aia)?s|ias?)tes|sias?tes))|(?:clesiaste|c(?:l(?:es(?:iast)?)?)?|clesiate|l(?:esiaste)?)?)|Qo(?:h(?:eleth)?)?))(?:(?=[\d\s.:,;\x1e\x1f&\(\)()\[\]\/"'\*=~\-–—])|$)/giu},{osis:["SgThree"],testament:"a",regexp:/(?:^|(?<=[^\p{L}\p{N}])(?<!\d:(?=\d)))((?:The\s*Song\s*of\s*(?:the\s*(?:Three\s*(?:Holy\s*Children|Young\s*Men|(?:Youth|Jew)s)|3\s*(?:Holy\s*Children|Young\s*Men|(?:Youth|Jew)s))|Three\s*(?:Holy\s*Children|Young\s*Men|(?:Youth|Jew)s)|3\s*(?:Holy\s*Children|Young\s*Men|(?:Youth|Jew)s))|S(?:ong\s*of\s*(?:the\s*(?:Three\s*(?:Holy\s*Children|Young\s*Men|(?:Youth|Jew)s)|3\s*(?:Holy\s*Children|Young\s*Men|(?:Youth|Jew)s))|Three\s*(?:Holy\s*Children|Young\s*Men|(?:Youth|Jew)s)|3\s*(?:Holy\s*Children|Young\s*Men|(?:Youth|Jew)s))|(?:(?:\.\s*(?:of\s*(?:Th(?:ree(?:\.\s*(?:Ch|Y)|\s*(?:Ch|Y))|\.\s*(?:Ch|Y)|\s*(?:Ch|Y))|3(?:\.\s*(?:Ch|Y)|\s*(?:Ch|Y)))|Th(?:ree(?:\.\s*(?:Ch|Y)|\s*(?:Ch|Y))|\.\s*(?:Ch|Y)|\s*(?:Ch|Y))|3(?:\.\s*(?:Ch|Y)|\s*(?:Ch|Y)))|\s*(?:of\s*(?:Th(?:ree(?:\.\s*(?:Ch|Y)|\s*(?:Ch|Y))|\.\s*(?:Ch|Y)|\s*(?:Ch|Y))|3(?:\.\s*(?:Ch|Y)|\s*(?:Ch|Y)))|Th(?:ree(?:\.\s*(?:Ch|Y)|\s*(?:Ch|Y))|\.\s*(?:Ch|Y)|\s*(?:Ch|Y))|3(?:\.\s*(?:Ch|Y)|\s*(?:Ch|Y)))|ong\s*Three|(?:ng\s*|g)Three|g\s*Three)|g\s*Thr))))(?:(?=[\d\s.:,;\x1e\x1f&\(\)()\[\]\/"'\*=~\-–—])|$)/giu},{osis:["Song"],testament:"o",regexp:/(?:^|(?<=[^\p{L}]))((?:The\s*Song(?:s\s*of\s*S(?:o(?:lom[ao]ns?|ngs?)|alom[ao]ns?)|\s*of\s*S(?:o(?:lom[ao]ns?|ngs?)|alom[ao]ns?))|Songs?\s*of\s*S(?:o(?:lom[ao]ns?|ngs?)|alom[ao]ns?)|S(?:(?:\s*of\s*S|o[Sl]|S)|o(?:n(?:gs?)?)?)|Sn?gs?))(?:(?=[\d\s.:,;\x1e\x1f&\(\)()\[\]\/"'\*=~\-–—])|$)/giu},{osis:["Jer"],testament:"o",regexp:/(?:^|(?<=[^\p{L}]))(J(?:er(?:(?:em(?:aia|ii)|am[ai]i|im(?:i[ai]|a))h|em(?:(?:(?:ai?h|ie)|iah)|iha)|am(?:i(?:ah|ha)|ah)|imih|aiah|m[im]ah)|e(?:r(?:emia|emih|ami[ah]|e(?:mi)?)?)?|r))(?:(?=[\d\s.:,;\x1e\x1f&\(\)()\[\]\/"'\*=~\-–—])|$)/giu},{osis:["Ezek"],testament:"o",regexp:/(?:^|(?<=[^\p{L}]))(E(?:ze[ei]ki?el|zi(?:[ei]ki?el|ki?el)|x[ei](?:[ei]ki?el|ki?el)|zek(?:i[ae]|e)l|z(?:ek?|k)))(?:(?=[\d\s.:,;\x1e\x1f&\(\)()\[\]\/"'\*=~\-–—])|$)/giu},{osis:["Dan"],testament:"o",regexp:/(?:^|(?<=[^\p{L}]))(D(?:ani[ae]l|an?|[ln]))(?:(?=[\d\s.:,;\x1e\x1f&\(\)()\[\]\/"'\*=~\-–—])|$)/giu},{osis:["Hos"],testament:"o",regexp:/(?:^|(?<=[^\p{L}]))(H(?:osea|os?|s))(?:(?=[\d\s.:,;\x1e\x1f&\(\)()\[\]\/"'\*=~\-–—])|$)/giu},{osis:["Joel"],testament:"o",regexp:/(?:^|(?<=[^\p{L}]))(J(?:oel?|l))(?:(?=[\d\s.:,;\x1e\x1f&\(\)()\[\]\/"'\*=~\-–—])|$)/giu},{osis:["Amos"],testament:"o",regexp:/(?:^|(?<=[^\p{L}]))(Am(?:o?s|o)?)(?:(?=[\d\s.:,;\x1e\x1f&\(\)()\[\]\/"'\*=~\-–—])|$)/giu},{osis:["Obad"],testament:"o",regexp:/(?:^|(?<=[^\p{L}]))(Ob(?:adiah|a(?:d(?:ia)?)?|idah|d)?)(?:(?=[\d\s.:,;\x1e\x1f&\(\)()\[\]\/"'\*=~\-–—])|$)/giu},{osis:["Jonah"],testament:"o",regexp:/(?:^|(?<=[^\p{L}]))(J(?:on(?:ah)?|nh))(?:(?=[\d\s.:,;\x1e\x1f&\(\)()\[\]\/"'\*=~\-–—])|$)/giu},{osis:["Mic"],testament:"o",regexp:/(?:^|(?<=[^\p{L}]))(Mi(?:c(?:hah?|ah?)?)?)(?:(?=[\d\s.:,;\x1e\x1f&\(\)()\[\]\/"'\*=~\-–—])|$)/giu},{osis:["Nah"],testament:"o",regexp:/(?:^|(?<=[^\p{L}]))(Na(?:h(?:um?)?)?)(?:(?=[\d\s.:,;\x1e\x1f&\(\)()\[\]\/"'\*=~\-–—])|$)/giu},{osis:["Hab"],testament:"o",regexp:/(?:^|(?<=[^\p{L}]))(Hab(?:bak(?:k[au]kk?|[au]kk?)|ak(?:k[au]kk?|[au]kk?)|k)?)(?:(?=[\d\s.:,;\x1e\x1f&\(\)()\[\]\/"'\*=~\-–—])|$)/giu},{osis:["Zeph"],testament:"o",regexp:/(?:^|(?<=[^\p{L}]))(Z(?:ephanaiah?|ephaniah?|a(?:phaniah?|faniah?)|efaniah?|eph?|ph?))(?:(?=[\d\s.:,;\x1e\x1f&\(\)()\[\]\/"'\*=~\-–—])|$)/giu},{osis:["Hag"],testament:"o",regexp:/(?:^|(?<=[^\p{L}]))(H(?:ag(?:gia[hi]|g?ai|g)?|gg?))(?:(?=[\d\s.:,;\x1e\x1f&\(\)()\[\]\/"'\*=~\-–—])|$)/giu},{osis:["Zech"],testament:"o",regexp:/(?:^|(?<=[^\p{L}]))(Z(?:a(?:(?:ch[ae]r(?:(?:a[ai]|a)h|ii?h)|kariah)|ch?)|(