string-remove-widows 4.2.3 → 4.2.4
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/README.md
CHANGED
|
@@ -21,6 +21,8 @@
|
|
|
21
21
|
<img src="https://img.shields.io/badge/licence-MIT-brightgreen.svg?style=flat-square" alt="MIT Licence">
|
|
22
22
|
</p>
|
|
23
23
|
|
|
24
|
+
**No 3rd party dependencies.** All dependencies and devDependencies, checked recursively, are Codsen packages.
|
|
25
|
+
|
|
24
26
|
## Install
|
|
25
27
|
|
|
26
28
|
This package is [pure ESM](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c). If you're not ready yet, install an older version of this program, 2.1.0 (`npm i string-remove-widows@2.1.0`).
|
|
@@ -47,7 +49,7 @@ assert.equal(res, "Some text with many words on one line.");
|
|
|
47
49
|
|
|
48
50
|
## Documentation
|
|
49
51
|
|
|
50
|
-
Please [visit codsen.com](https://codsen.com/os/string-remove-widows/) for a full description of the API.
|
|
52
|
+
Please [visit codsen.com](https://codsen.com/os/string-remove-widows/) for a full description of the API. For **Changelog**, see [raw md on GitHub](https://github.com/codsen/codsen/blob/main/packages/string-remove-widows/CHANGELOG.md) or [the website](https://codsen.com/os/string-remove-widows/changelog).
|
|
51
53
|
|
|
52
54
|
## Contributing
|
|
53
55
|
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @name string-remove-widows
|
|
3
3
|
* @fileoverview Helps to prevent widow words in a text
|
|
4
|
-
* @version 4.2.
|
|
4
|
+
* @version 4.2.4
|
|
5
5
|
* @author Roy Revelt
|
|
6
6
|
* @license MIT
|
|
7
7
|
* {@link https://codsen.com/os/string-remove-widows/}
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import{formatDiagnosticValue as F,isLetter as Ue,isPlainObject as Ne,rawMDash as Fe,rawNbsp as Q,rawNDash as Se}from"codsen-utils";import{rApply as Je}from"ranges-apply";import{Ranges as Ke}from"ranges-push";import{left as le,right as Be}from"string-left-right";var ye="4.2.
|
|
10
|
+
import{formatDiagnosticValue as F,isLetter as Ue,isPlainObject as Ne,rawMDash as Fe,rawNbsp as Q,rawNDash as Se}from"codsen-utils";import{rApply as Je}from"ranges-apply";import{Ranges as Ke}from"ranges-push";import{left as le,right as Be}from"string-left-right";var ye="4.2.4";var L=" ",ie="\\0000A0",de="\\u00A0",ve="–";var Ee="\\u2013",We="—";var ke="\\u2014",ae=[{heads:"{{",tails:"}}"},{heads:["{% if","{%- if"],tails:["{% endif","{%- endif"]},{heads:["{% for","{%- for"],tails:["{% endfor","{%- endfor"]},{heads:["{%","{%-"],tails:["%}","-%}"]},{heads:"{#",tails:"#}"}],Pe=[{heads:"{{",tails:"}}"}],ue=[{heads:["<%","<%=","<%-"],tails:["%>","=%>","-%>"]}],Te=["abbr","address","area","article","aside","audio","base","bdi","bdo","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","doctype","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","math","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","param","picture","pre","progress","rb","rp","rt","rtc","ruby","samp","script","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","ul","var","video","wbr","xml"];var pn=ye,je=4,Me=5,y={removeWidowPreventionMeasures:!1,convertEntities:!0,targetLanguage:"html",UKPostcodes:!1,hyphens:!0,minWordCount:je,minCharCount:Me,ignore:[],reportProgressFunc:null,reportProgressFuncFrom:0,reportProgressFuncTo:100,tagRanges:[]},hn=Object.freeze({...y,ignore:Object.freeze([]),tagRanges:Object.freeze([])}),ze=[ve,Ee,We,ke],qe=/[&\\\u00a0\u2013\u2014\r\n<>/0-9-]/;function Ge(e,t){let o=0,i=0,r,s,f;for(let m=0;m<e.length;m+=1)if(e[m].trim())i+=1,e[m-1]?.trim()||(o+=1),r!==void 0&&(s=r,f=m,r=void 0);else if(e[m-1]?.trim()&&!(e[m-1]?.toLowerCase()==="r"&&(e[m-2]?.toLowerCase()==="b"||e[m-2]?.toLowerCase()==="h"))){let E=m+1;for(;E<e.length&&!e[E].trim();)E+=1;E<e.length&&(r=m)}let a=!1,p=null,v=e;return s!==void 0&&f!==void 0&&o>=je&&i>=Me&&(a=!0,p=[[s,f,L]],v=`${e.slice(0,s)}${L}${e.slice(f)}`),{res:v,ranges:p,log:{timeTakenInMilliseconds:Date.now()-t},whatWasDone:{removeWidows:a,convertEntities:!1},applicableOpts:{removeWidows:a,convertEntities:a}}}function bn(e,t){let o=Date.now();if(typeof e!="string")throw e===void 0?new Error("string-remove-widows/removeWidows(): [THROW_ID_01] the first input argument is completely missing! It should be given as string."):new Error(`string-remove-widows/removeWidows(): [THROW_ID_02] the first input argument must be string! It was given as "${typeof e}", equal to:
|
|
11
11
|
${F(e,4)}`);if(t!==void 0&&!Ne(t))throw new Error(`string-remove-widows/removeWidows(): [THROW_ID_03] the second input argument, options object, should be a plain object but it was given as type ${typeof t}, equal to ${F(t,4)}`);if(t===void 0&&!qe.test(e))return Ge(e,o);let i=Array.isArray,r=e.length,s=new Ke({mergeType:2}),f=["."],a=.06,p,v,m=0,E=0,P,c,g,D,C,W,k,S=!1,b,J=0,R,I,j,V,u=sn(e,t),ge={removeWidows:!1,convertEntities:!1},H={removeWidows:!1,convertEntities:!1},X=new Map,K=new Set;function pe(n,l){return`${n}:${l}`}function O(n,l){if(!u.tagRanges.length||n>=l)return!1;let $=0,A=u.tagRanges.length;for(;$<A;){let N=Math.floor(($+A)/2);u.tagRanges[N][1]<=n?$=N+1:A=N}return!!(u.tagRanges[$]&&u.tagRanges[$][0]<l)}function B(n,l){return e.startsWith(n,l)&&!O(l,l+n.length)}let ee=u.reportProgressFuncFrom+Math.floor((u.reportProgressFuncTo-u.reportProgressFuncFrom)*(1-a));function ne(n){if(!u.reportProgressFunc)return;let l=Math.max(u.reportProgressFuncFrom,Math.min(u.reportProgressFuncTo,Math.floor(n)));(v===void 0||l>v)&&(v=l,u.reportProgressFunc(l))}function te(n,l){if(O(n,l))return!1;let $=Q;u.removeWidowPreventionMeasures?$=" ":u.convertEntities&&($=L,u.targetLanguage==="css"?$=ie:u.targetLanguage==="js"&&($=de));let A=pe(n,l),N=_(e,n)===l;return H.removeWidows=!0,N&&(u.removeWidowPreventionMeasures?K.delete(A):K.add(A)),e.slice(n,l)!==$?(s.push(n,l,$),X.set(A,N&&$!==" "?"convertEntities":"removeWidows"),!0):!1}function he(){m=0,E=0,P=void 0,c=void 0,g=void 0,D=void 0,C=void 0,W=void 0,k=void 0,S=!1}he(),ne(u.reportProgressFuncFrom);for(let n=0;n<=r;n++){for(u.reportProgressFunc&&(p=u.reportProgressFuncFrom+Math.floor((r===0?1:Math.min(n,r)/r)*(ee-u.reportProgressFuncFrom)),ne(p));u.tagRanges[J]&&u.tagRanges[J][1]<=n;)J+=1;let l=u.tagRanges[J];if(l&&n>=l[0]&&n<l[1]){let d=R===l[0]||I===l[0]||j!==l[0]&&V!==l[0]&&!e[l[0]-1]?.trim();C!==void 0&&n===l[0]&&e[l[1]]?.trim()&&(P=g,c=D,g=C,D=n),C=void 0,R!==void 0&&R<l[1]&&(R=void 0),j!==void 0&&j<l[1]&&(j=void 0),I!==void 0&&I<l[1]&&(I=void 0),V!==void 0&&V<l[1]&&(V=void 0),e[l[1]]?.trim()&&d&&(I=l[1]),n=l[1]-1;continue}let $=I===n;$&&(I=void 0);let A=V===n;A&&(V=void 0);let N=j===n;N&&(j=void 0),!b&&i(u.ignore)&&u.ignore.length&&u.ignore.some((d,h)=>i(d.heads)&&d.heads.some(Y=>B(Y,n))||typeof d.heads=="string"&&B(d.heads,n)?(C=void 0,m+=1,b=u.ignore[h].tails,!0):!1);let oe=!1;!b&&R!==void 0&&R===n&&(m+=1,k!==void 0&&(S=!0),R=void 0,oe=!0),!b&&n&&e[n]?.trim()&&!e[n-1]?.trim()&&C!==void 0&&(P=g,c=D,g=C,D=n,C=void 0);let re=!b&&(e[n]===Q||e[n]==="&"||e[n]==="\\")?_(e,n):void 0,w=re!==void 0&&!O(n,re)?re:void 0;if(w!==void 0){W=n,k=w,S=!1;let d=pe(n,w);K.add(d);let h=u.convertEntities?u.targetLanguage==="css"?`${ie}${fe(e[w])?" ":""}`:u.targetLanguage==="js"?de:L:Q;e.slice(n,w)!==h&&(s.push(n,w,h),X.set(d,"convertEntities")),e[w]&&!`\r
|
|
12
12
|
`.includes(e[w])&&!e[w].trim()&&(j=w),w-n>1&&e[w]?.trim()&&_(e,w)===void 0&&(R=w),n=w-1;continue}!b&&e[n]?.trim()&&(E+=1);let se=!b&&(e[n]==="-"||e[n]===Fe||e[n]===Se||e[n]==="&"||e[n]==="\\")?Ze(e,n):void 0,T=se!==void 0&&!O(n,se)?se:void 0;if(T!==void 0){let d=le(e,n);!oe&&($||!e[n-1]?.trim())&&(m+=1,k!==void 0&&(S=!0));let h=W!==void 0&&k===n&&_(e,W)===n,Y=h&&W!==void 0?W:d===null?n:d+1,Le=d!==null&&!e.slice(d+1,n).split("").some(we=>we==="\r"||we===`
|
|
13
13
|
`),$e=T<r&&Le&&!e[T]?.trim()&&(h||!!e[n-1]&&!e[n-1].trim()&&d!==null)&&!O(Y,n);$e&&(H.removeWidows=!0),u.hyphens&&$e&&te(Y,n),e[n]==="\\"&&fe(e[T-1])&&(e[T]&&!`\r
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @name string-remove-widows
|
|
3
3
|
* @fileoverview Helps to prevent widow words in a text
|
|
4
|
-
* @version 4.2.
|
|
4
|
+
* @version 4.2.4
|
|
5
5
|
* @author Roy Revelt
|
|
6
6
|
* @license MIT
|
|
7
7
|
* {@link https://codsen.com/os/string-remove-widows/}
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
"use strict";var stringRemoveWidows=(()=>{var ae=Object.defineProperty,Vt=Object.defineProperties,Bt=Object.getOwnPropertyDescriptor,Ut=Object.getOwnPropertyDescriptors,zt=Object.getOwnPropertyNames,it=Object.getOwnPropertySymbols;var st=Object.prototype.hasOwnProperty,qt=Object.prototype.propertyIsEnumerable;var $e=(e,t,n)=>t in e?ae(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,z=(e,t)=>{for(var n in t||(t={}))st.call(t,n)&&$e(e,n,t[n]);if(it)for(var n of it(t))qt.call(t,n)&&$e(e,n,t[n]);return e},at=(e,t)=>Vt(e,Ut(t));var Jt=(e,t)=>{for(var n in t)ae(e,n,{get:t[n],enumerable:!0})},Kt=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of zt(t))!st.call(e,i)&&i!==n&&ae(e,i,{get:()=>t[i],enumerable:!(r=Bt(t,i))||r.enumerable});return e};var Gt=e=>Kt(ae({},"__esModule",{value:!0}),e);var Q=(e,t,n)=>$e(e,typeof t!="symbol"?t+"":t,n);var On={};Jt(On,{defaults:()=>cn,removeWidows:()=>mn,version:()=>dn});function Qt(){let e=[],t=0,n=!1;return{append(r){return n?!1:t+r.length>1999?(e.push("\u2026"),t+=1,n=!0,!1):(e.push(r),t+=r.length,!0)},result(){return e.join("")},stopped(){return n}}}function Zt(e){return"\\u".concat(e.toString(16).padStart(4,"0"))}function le(e,t){if(e.append('"')){for(let n=0;n<t.length&&!e.stopped();n+=1){let r=t.charCodeAt(n);r===34?e.append('\\"'):r===92?e.append("\\\\"):r===8?e.append("\\b"):r===9?e.append("\\t"):r===10?e.append("\\n"):r===12?e.append("\\f"):r===13?e.append("\\r"):r<32||r===8232||r===8233||r>=55296&&r<=57343?e.append(Zt(r)):e.append(t[n])}e.append('"')}}function Yt(e){return e.get&&e.set?"[Getter/Setter]":e.get?"[Getter]":e.set?"[Setter]":"[Accessor]"}function ut(e,t){e.append("Symbol(");let n=String(t);n.length>8&&le(e,n.slice(7,-1)),e.append(")")}function lt(e,t){typeof t=="symbol"?ut(e,t):le(e,String(t))}function g(e,t=0){let n=Qt(),r=t===4?4:0,i=new WeakSet,o=0;function l(_){r&&n.append(" ".repeat(_*r))}function a(_,c){_&&n.append(","),r&&(n.append("\n"),l(c+1))}function u(_,c,w){r&&c&&(n.append("\n"),l(w)),n.append(_)}function f(_,c){Object.prototype.hasOwnProperty.call(_,"value")?y(_.value,c):n.append(Yt(_))}function d(_,c){let w;try{w=Reflect.getOwnPropertyDescriptor(_,"length")}catch(W){n.append("[Uninspectable]");return}let p=w==null?void 0:w.value;if(!Number.isSafeInteger(p)||p<0){n.append("[Uninspectable]");return}n.append("[");let A=!1;for(let W=0;W<p&&!n.stopped();W+=1){if(a(A,c),A=!0,o>=50){n.append("[MaxEntries]");break}o+=1;let E;try{E=Reflect.getOwnPropertyDescriptor(_,String(W))}catch(T){n.append("[Uninspectable]");continue}E!=null&&E.enumerable?f(E,c+1):n.append("[Empty]")}u("]",A,c)}function h(_,c){let w;try{w=Reflect.ownKeys(_)}catch(A){n.append("[Uninspectable]");return}n.append("{");let p=!1;for(let A of w){if(n.stopped())break;if(o>=50){a(p,c),p=!0,le(n,"\u2026"),n.append(r?": ":":"),n.append("[MaxEntries]");break}o+=1;let W;try{W=Reflect.getOwnPropertyDescriptor(_,A)}catch(E){a(p,c),p=!0,lt(n,A),n.append(r?": ":":"),n.append("[Uninspectable]");continue}W!=null&&W.enumerable&&(a(p,c),p=!0,lt(n,A),n.append(r?": ":":"),f(W,c+1))}u("}",p,c)}function m(_,c){if(i.has(_)){n.append("[Circular]");return}if(c>=5){n.append("[MaxDepth]");return}let w;try{w=Array.isArray(_)}catch(p){n.append("[Uninspectable]");return}i.add(_);try{w?d(_,c):h(_,c)}finally{i.delete(_)}}function y(_,c){_===null?n.append("null"):typeof _=="string"?le(n,_):typeof _=="number"?n.append(Object.is(_,-0)?"-0":String(_)):typeof _=="boolean"?n.append(_?"true":"false"):typeof _>"u"?n.append("undefined"):typeof _=="bigint"?n.append("".concat(_,"n")):typeof _=="symbol"?ut(n,_):typeof _=="function"?n.append("[Function]"):m(_,c)}try{return y(e,0),n.result()}catch(_){return"[Uninspectable]"}}var Xt=["_16_0_a_0_4_0_5_m_1_u_1_cp_4_b_e_4_7_0_1_0_3l_4_1_1_2_3_1_0_6_0_1_2_1_0_1_j_1_2a_1_3u_8_4l_1_11_2_0_","6_14_1z_q_4_3_19_16_z_1_1_2q_1_0_f_1_7_1_a_2_2_0_g_0_1_t_t_2g_b_0_o_w_9_1_4_0_5_l_4_0_9_0_3_0_n_o_7_","a_5_n_1_6_g_15_1m_1h_3_0_i_0_7_9_f_f_4_7_2_1_2_l_1_6_1_0_3_3_3_0_g_0_d_1_1_2_e_1_a_0_8_5_4_1_2_l_1_6","_1_1_1_1_1_1_v_3_1_0_j_2_g_8_1_2_1_l_1_6_1_1_1_4_3_0_i_0_f_1_n_0_b_7_2_1_2_l_1_6_1_1_1_4_3_0_u_1_1_2","_f_0_h_0_1_5_3_2_1_3_3_1_1_0_1_1_3_1_3_2_3_b_m_0_1g_7_1_2_1_m_1_f_3_0_q_2_1_1_2_1_u_0_4_7_1_2_1_m_1_","9_1_4_3_0_u_2_1_1_f_1_h_8_1_2_1_14_2_0_g_0_5_2_8_2_o_5_5_h_3_n_1_8_1_0_2_6_1m_1b_1_1_c_6_1m_1_1_0_1_","4_1_n_1_0_1_9_1_1_9_0_2_4_1_0_l_3_w_0_1r_7_1_z_r_4_37_16_k_0_g_5_4_3_3_0_3_1_7_2_4_c_c_0_h_11_1_0_5_","0_2_16_1_98_1_3_2_6_1_0_1_3_2_14_1_3_2_w_1_3_2_6_1_0_1_3_2_e_1_1k_1_3_2_1u_11_f_g_2d_2_5_3_h7_2_g_1_","p_5_22_6_7_7_h_d_i_e_h_e_c_1_2_f_1f_z_0_4_0_1v_2g_7_4_2_x_1_0_5_1x_a_u_1d_t_2_4_b_17_4_p_1i_m_9_1g_2","a_0_2l_1a_h_7_1i_t_d_1_a_17_q_z_15_2_a_z_2_a_5_16_2_2_15_3_1_5_1_1_3_0_5_5b_1s_7p_2_5_2_11_2_5_2_7_1","_0_1_0_1_0_1_u_2_1g_1_6_1_0_3_2_1_6_3_3_2_5_4_c_5_2_1_6_38_0_d_0_g_c_2t_0_4_0_2_9_1_0_3_4_6_0_1_0_1_","0_1_3_1_a_2_3_5_4_4_0_1g_1_22j_6c_6_3_3_1_c_11_1_0_5_0_2_1j_7_0_g_m_9_6_1_6_1_6_1_6_1_6_1_6_1_6_1_6_","28_0_d1_1_16_4_5_1_4_2d_6_2_1_2h_1_3_5_16_1_2l_h_v_1c_f_e8_533_1s_h3g_1v_19_2_7g_3_f_a_1_k_1a_g_u_2_","1x_1d_8_2_2u_2_29_k_g_1_2_1_3_1_m_t_1f_e_1d_1q_5_3_0_1_1_b_r_a_m_p_s_7_1a_s_0_g_4_1_9_a_4_1_14_n_2_1","_7_k_m_3_0_3_1d_1_0_3_1_2_4_2_0_1_0_o_2_2_a_7_2_c_5_2_5_2_5_9_6_1_6_1_16_1_d_6_36_t_8mb_c_m_4_1c_6is","_a5_2_2x_12_6_c_4_5_0_1_9_1_c_1_4_1_0_1_1_1_1_1_2z_x_a2_i_1r_2_1h_14_b_38_4_1_3q_10_p_6_p_b_2g_3_5_2","_5_2_5_2_2_z_b_1_p_1_i_1_1_1_e_2_d_y_3e_at_s_3_1c_1b_v_d_j_1_7_6_11_a_t_2_z_4_7_1c_4d_i_z_4_z_4_13_8","_1f_c_a_1_e_1_6_1_1_1_a_1_e_1_6_1_1_3_1f_c_8m_9_l_a_7_o_5_1_15_1_8_1x_5_2_0_1_17_1_1_3_0_2_m_a_m_9_u","_1t_i_1_1_a_l_a_p_6_p_12_1j_6_1_1s_0_f_3_1_2_1_s_16_s_3_s_z_7_1_r_r_1h_a_l_a_i_d_h_32_20_1j_1e_d_1e_","d_z_12_r_9_m_6y_15_6_1_g_5_1k_s_a_0_8_l_16_h_1a_k_r_m_c_1g_1l_1_2_0_d_18_w_o_q_z_t_0_2_0_8_y_3_0_c_1","b_e_3_l_0_1_0_z_h_1_o_j_1_1r_6_1_0_1_3_1_e_1_9_7_1a_12_7_2_1_2_l_1_6_1_1_1_4_3_0_i_0_c_4_u_9_1_0_2_0","_1_11_1_0_p_0_1_0_18_1g_i_3_k_2_u_1b_k_1_1_0_54_1a_15_3_10_1b_k_0_1n_16_d_0_1z_q_11_6_55_17_38_1r_v_","7_2_0_2_7_1_1_1_n_f_0_1_0_2m_7_2_12_g_0_1_0_s_0_a_13_7_0_l_0_b_19_j_0_i_20_5j_w_v_8_1_10_h_0_1d_t_34","_6_1_1_1_11_l_0_p_5_1_1_1_v_e_0_n_17_78_i_f_0_1_c_1_x_3g_0_27_pl_6e_5f_218_2o_f_tr_h_5_p_32y_5_g6_5a","1_t_1cy_fs_7_u_h_26_h_t_i_1b_g_3_v_k_5_i_c0_18_5v_1r_w_o_2_o_18_22_5_0_1u_c_1s_1_1_0_e_1_c_5p1_15_v_","2p_36_6pp_3_1_6_1_1_1_82_f_0_t_2_2_0_e_3_8_az_1s4_2y_5_c_3_8_7_9_4me_2c_1_1y_1_1_2_0_2_1_2_3_1_b_1_0","_1_6_1_1s_1_3_2_7_1_6_1_r_1_3_1_4_1_0_3_6_1_9f_2_o_1_o_1_u_1_o_1_u_1_o_1_u_1_o_1_u_1_o_1_7_1f8_u_6_5","_79_1p_42_18_a_6_g_0_8x_t_i_17_dg_r_6c_t_2_0_5r_u_1_2_1_1_1_6_2_4_9_1_68_6_1_3_1_1_1_e_1_5g_1n_1v_7_","0_xg_3_1_q_1_1_1_0_2_0_1_9_1_3_1_0_1_0_6_0_4_0_1_0_1_0_1_2_1_1_1_0_2_0_1_0_1_0_1_0_1_0_1_1_1_0_2_3_1","_6_1_3_1_3_1_0_1_9_1_g_5_2_1_4_1_g_3es_wyn_w_3dp_2_4gd_2_5rk_f_h9_1wi_f1_15u_3t6_5_6jt"].join(""),ve=Xt.slice(1).split("_"),Ae=[],_t=127;for(let e=0;e<ve.length;e+=2){let t=_t+1+Number.parseInt(ve[e],36),n=t+Number.parseInt(ve[e+1],36);Ae.push([t,n]),_t=n}function en(e){if(Number.isNaN(e)||e<128||e>1114111)return!1;let t=0,n=Ae.length-1;for(;t<=n;){let r=t+n>>1,i=Ae[r];if(e<i[0])n=r-1;else if(e>i[1])t=r+1;else return!0}return!1}var Te="\u2013",Ee="\u2014",Z="\xA0";var jn=new Set([..."\u060B$\u20BC\u17DB\xA5\u20A1\u20B1\xA3\u20AC\xA2\u20B9\uFDFC\u20AA\u20A9\u20AD\u20A8\u20AE\u20A6\u20BD\u20AB\u0E3F\u20A9\u20BA\u20B4","$U","$b","B/.","BZ$","Br","Bs","C$","CHF","Ft","Gs","J$","KM","K\u010D","L","MT","NT$","P","Q","R","R$","RD$","RM","Rp","S","S/.","TT$","Z$","kn","kr","lei","z\u0142","\u0192","\u0414\u0438\u043D.","\u0434\u0435\u043D","\u043B\u0432","\u062F.\u0625","Lek"]);var pt=Function.prototype.toString,tn=pt.call(Object);var In=Map.prototype.entries,Pn=Set.prototype.values;var ft,xn=(ft=Object.getOwnPropertyDescriptor(ArrayBuffer.prototype,"byteLength"))==null?void 0:ft.get,dt,Sn=(dt=Object.getOwnPropertyDescriptor(RegExp.prototype,"flags"))==null?void 0:dt.get,ct,Nn=(ct=Object.getOwnPropertyDescriptor(RegExp.prototype,"global"))==null?void 0:ct.get,gt,Mn=(gt=Object.getOwnPropertyDescriptor(RegExp.prototype,"source"))==null?void 0:gt.get,Fn=RegExp.prototype.test;function nn(e){if(e.length===1){let t=e.charCodeAt(0);return t<55296||t>57343?t:-1}if(e.length===2){let t=e.charCodeAt(0),n=e.charCodeAt(1);if(t>=55296&&t<=56319&&n>=56320&&n<=57343)return(t-55296)*1024+n-56320+65536}return-1}function ht(e){if(!x(e)||e.length===0||e.length>2)return!1;let t=e.charCodeAt(0);return e.length===1&&t<128?t>64&&t<91||t>96&&t<123:en(nn(e))}function I(e){var r;if(e==null||typeof e!="object")return!1;let t=Object.getPrototypeOf(e);if(t===null||t===Object.prototype)return!0;let n=Object.getOwnPropertyDescriptor(t,"constructor");return!n||!("value"in n)||typeof n.value!="function"?!1:((r=Object.getOwnPropertyDescriptor(n.value,"prototype"))==null?void 0:r.value)===t&&pt.call(n.value)===tn}function x(e){return typeof e=="string"}function We(e){return Number.isFinite(e)}function q(e){return Number.isSafeInteger(e)&&e>=0}var Hn=Date.prototype.getTime;function ue(e){return e!=null}var mt={strictlyTwoElementsInRangeArrays:!1,progressFn:null};function rn(e,t){let n,r=0;for(;r<e.length;){let i=r+1;for(;i<e.length&&e[r][0]===e[i][0]&&e[r][1]===e[i][1];)i+=1;if(i-r>1){n||(n=new Map(t.map((a,u)=>[a,u])));let o=n,l=e.slice(r,i).sort((a,u)=>o.get(a)-o.get(u));e.splice(r,l.length,...l)}r=i}return e}function J(e,t){var a;if(!Array.isArray(e)||!e.length)return e;let n=t===void 0?!0:I(t);if(t!==void 0&&n&&(t==null?void 0:t.strictlyTwoElementsInRangeArrays)===!0)for(let u=0;u<e.length;u+=1){let f=e[u];if(!Array.isArray(f)||f.length!==2)throw new TypeError("ranges-sort/rSort(): [THROW_ID_01] The first argument should be an array and must consist of arrays which are natural number indexes representing TWO string index ranges. However, range at index ".concat(u," (").concat(g(f,4),") is ").concat(Array.isArray(f)?"an array with ".concat(f.length," elements"):"not an array","!"));if(!Number.isInteger(f[0])||f[0]<0||!Number.isInteger(f[1])||f[1]<0)throw new TypeError("ranges-sort/rSort(): [THROW_ID_02] The first argument should be an array and must consist of arrays which are natural number indexes representing string index ranges. However, range at index ".concat(u," (").concat(g(f,4),") does not consist of only natural numbers!"))}else for(let u=0;u<e.length;u+=1){let f=e[u];if(!Array.isArray(f)||!Number.isInteger(f[0])||f[0]<0||!Number.isInteger(f[1])||f[1]<0)throw new TypeError("ranges-sort/rSort(): [THROW_ID_02] The first argument should be an array and must consist of arrays which are natural number indexes representing string index ranges. However, range at index ".concat(u," (").concat(g(f,4),") does not consist of only natural numbers!"))}if(t!==void 0&&!n)throw new TypeError("ranges-sort/rSort(): [THROW_ID_03] The second argument must be a plain options object; received ".concat(g(t,4)," (type ").concat(typeof t,")!"));let r=mt.progressFn;if(t!==void 0){let u=t.strictlyTwoElementsInRangeArrays;if(u!==void 0&&typeof u!="boolean")throw new TypeError("ranges-sort/rSort(): [THROW_ID_04] opts.strictlyTwoElementsInRangeArrays must be a boolean; received ".concat(g(u,4)," (type ").concat(typeof u,")!"));if(r=(a=t.progressFn)!=null?a:mt.progressFn,r!==!1&&r!==null&&typeof r!="function")throw new TypeError("ranges-sort/rSort(): [THROW_ID_05] opts.progressFn must be a function, false, null, or undefined; received ".concat(g(r,4)," (type ").concat(typeof r,")!"))}let i,o;if(r){let u=e.length**2,f=0,d;o=h=>{h!==d&&(d=h,r(h))},i=Array.from(e).sort((h,m)=>(f+=1,o==null||o(Math.min(99,Math.floor(f*100/u))),h[0]===m[0]?h[1]<m[1]?-1:h[1]>m[1]?1:0:h[0]<m[0]?-1:1))}else i=Array.from(e).sort((u,f)=>u[0]===f[0]?u[1]<f[1]?-1:u[1]>f[1]?1:0:u[0]<f[0]?-1:1);let l=i.length>10?rn(i,e):i;return o==null||o(100),l}var on={mergeType:1,progressFn:null,joinRangesThatTouchEdges:!0};function Ce(e,t){if(!Array.isArray(e)||!e.length)return null;if(t!==void 0&&!I(t))throw new TypeError("ranges-merge/rMerge(): [THROW_ID_01] the second input argument must be a plain object. It was given as:\n".concat(g(t,4)," (type ").concat(typeof t,")"));let n=z(z({},on),t);if(n.progressFn&&I(n.progressFn)&&!Object.keys(n.progressFn).length)n.progressFn=null;else if(n.progressFn&&typeof n.progressFn!="function")throw new TypeError('ranges-merge/rMerge(): [THROW_ID_02] opts.progressFn must be a function! It was given of a type: "'.concat(typeof n.progressFn,'", equal to ').concat(g(n.progressFn,4)));if(n.mergeType!==1&&n.mergeType!==2&&n.mergeType!=="1"&&n.mergeType!=="2")throw new TypeError('ranges-merge/rMerge(): [THROW_ID_03] opts.mergeType was customised to a wrong thing! It was given of a type: "'.concat(typeof n.mergeType,'", equal to ').concat(g(n.mergeType,4)));if(typeof n.joinRangesThatTouchEdges!="boolean")throw new TypeError('ranges-merge/rMerge(): [THROW_ID_04] opts.joinRangesThatTouchEdges was customised to a wrong thing! It was given of a type: "'.concat(typeof n.joinRangesThatTouchEdges,'", equal to ').concat(g(n.joinRangesThatTouchEdges,4)));let r=n.progressFn,i=n.joinRangesThatTouchEdges,o=[];for(let y of e)Array.isArray(y)&&(y[2]!==void 0||y[0]!==y[1])&&o.push([...y]);let l,a,u;r?l=J(o,{progressFn:y=>{u=Math.floor(y/5),u!==a&&(a=u,r(u))}}):l=J(o);let f=l.length-1,d=n.mergeType===2||n.mergeType==="2",h=l.length;for(let y=f;y>=0;y--){let _=l[y];for(r&&y<f&&(u=Math.floor((1-(y+1)/f)*78)+21,u!==a&&u>a&&(a=u,r(u)));h<l.length;){let c=l[h],w=c[0]===_[0];if(!w&&(i?c[0]>_[1]:c[0]>=_[1]))break;let p=c[1]>=_[1];p&&(_[1]=c[1]),c[2]===null?_[2]=null:c[2]!==void 0&&(w||p)&&_[2]!==null&&(_[2]!=null?d&&w?_[2]=c[2]:_[2]+=c[2]:_[2]=c[2]),h+=1}h-=1,l[h]=_}let m=l.length-h;for(let y=0;y<m;y++)l[y]=l[h+y];return l.length=m,r&&a!==99&&r(99),l.length?l:null}function _e(e){if(typeof e=="number")return Number.isInteger(e)&&e>=0;if(typeof e!="string"||!e.trim())return!1;let t=Number(e);return Number.isInteger(t)&&t>=0}function yt(e,t,n){let r=0,i=0;if(e===void 0&&t===void 0&&n===void 0)throw new Error("ranges-apply/rApply(): [THROW_ID_01] inputs missing!");if(typeof e!="string")throw new TypeError("ranges-apply/rApply(): [THROW_ID_02] first input argument must be a string! Currently it's: ".concat(typeof e,", equal to: ").concat(g(e,4)));if(t!=null&&!Array.isArray(t))throw new TypeError("ranges-apply/rApply(): [THROW_ID_03] second input argument must be an array (or null)! Currently it's: ".concat(typeof t,", equal to: ").concat(g(t,4)));if(n!=null&&n!==!1&&n!==0&&n!==""&&typeof n!="function")throw new TypeError("ranges-apply/rApply(): [THROW_ID_04] the third input argument must be a function, false, null, undefined, 0, or an empty string! Currently it's: ".concat(typeof n,", equal to: ").concat(g(n,4)));if(t==null||!t.length||t.every(d=>d==null))return n&&n(100),e;let o;Array.isArray(t)&&!Array.isArray(t[0])&&_e(t[0])&&_e(t[1])?o=[Array.from(t)]:o=Array.from(t);let l=o.length,a=0;o.forEach((d,h)=>{if(d){if(n&&(r=Math.floor(a/l*10),r!==i&&(i=r,n(r))),!Array.isArray(d))throw new TypeError("ranges-apply/rApply(): [THROW_ID_05] ranges array, second input arg., has ".concat(h,"th element not an array: ").concat(g(d,4),", which is ").concat(typeof d));if(!_e(d[0]))throw new TypeError("ranges-apply/rApply(): [THROW_ID_06] ranges array, second input arg. has ".concat(h,"th element, array ").concat(g(d),". Its first element is not a non-negative integer or string index, but ").concat(typeof d[0],", equal to: ").concat(g(d[0],4),"."));if(typeof d[0]=="string"&&(o[h]=[...d],o[h][0]=Number(d[0])),!_e(d[1]))throw new TypeError("ranges-apply/rApply(): [THROW_ID_07] ranges array, second input arg. has ".concat(h,"th element, array ").concat(g(d),". Its second element is not a non-negative integer or string index, but ").concat(typeof d[1],", equal to: ").concat(g(d[1],4),"."));if(typeof d[1]=="string"&&(o[h]===d&&(o[h]=[...d]),o[h][1]=Number(d[1])),o[h][0]>o[h][1])throw new RangeError("ranges-apply/rApply(): [THROW_ID_08] ranges array, second input arg. has ".concat(h,"th element, array ").concat(g(d),". Its first index (").concat(o[h][0],") must not be greater than its second index (").concat(o[h][1],")."));a+=1}});let u=n?Ce(o,{progressFn:d=>{r=10+Math.floor(d/10),r!==i&&(i=r,n(r))}}):Ce(o),f=(u==null?void 0:u.length)||0;if(u&&f>0){let d=e.slice(u[f-1][1]);e=u.reduce((h,m,y,_)=>{var p;n&&(r=20+Math.floor(y/f*80),r!==i&&(i=r,n(r)));let c=y===0?0:_[y-1][1],w=_[y][0];return"".concat(h).concat(e.slice(c,w)).concat((p=_[y][2])!=null?p:"")},""),e+=d}return n&&i!==100&&n(100),e}function fe(e,t=1){let n="\xA0";function r(o){return o.length<2?o:Array.from(o).reverse().join("")}function i(o,l,a){let u=a?"\n":"\r",f=a?"\r":"\n";if(!o)return o;let d=0,h="";for(let m=0,y=o.length;m<y;m++)(o[m]===u||o[m]===f&&o[m-1]!==u)&&d++,"\r\n".includes(o[m])||o[m]===n?o[m]===n?h+=o[m]:o[m]===u?d<=l&&(h+=o[m],o[m+1]===f&&(h+=o[m+1],m++)):o[m]===f&&(o==null?void 0:o[m-1])!==u&&d<=l&&(h+=o[m]):!o[m+1]&&!d&&(h+=" ");return h}if(typeof e=="string"&&e.length){let o=e.trim();if(o.length===e.length)return e;let l=1;typeof t=="number"&&Number.isInteger(t)&&t>=0&&(l=t);let a="",u="";if(!o)a=e;else if(!e[0].trim()){for(let d=0,h=e.length;d<h;d++)if(e[d].trim()){a=e.slice(0,d);break}}let f=e[e.length-1];if(o&&(f.trim()===""||f===n)){for(let d=e.length;d--;)if(e[d].trim()){u=e.slice(d+1);break}}return"".concat(i(a,l,!1)).concat(o).concat(r(i(r(u),l,!0)))}return e}var Oe={mergeType:1,progressFn:null,joinRangesThatTouchEdges:!0};function bt(e,t,n){return t===void 0||e===null?e:t===null?null:e===void 0||n?t:e+t}function sn(e,t){var _,c,w;function n(p){return!!p&&typeof p=="object"&&!Array.isArray(p)}if(!Array.isArray(e)||!e.length)return null;if(t&&!n(t))throw new TypeError("ranges-push/rMerge(): [THROW_ID_07] the second input argument must be a plain object. It was given as:\n".concat(g(t,4)," (type ").concat(typeof t,")"));let r=(_=t==null?void 0:t.progressFn)!=null?_:Oe.progressFn,i=(c=t==null?void 0:t.mergeType)!=null?c:Oe.mergeType,o=(w=t==null?void 0:t.joinRangesThatTouchEdges)!=null?w:Oe.joinRangesThatTouchEdges;if(r&&n(r)&&!Object.keys(r).length)r=null;else if(r&&typeof r!="function")throw new TypeError('ranges-push/rMerge(): [THROW_ID_08] resolvedOpts.progressFn must be a function! It was given of a type: "'.concat(typeof r,'", equal to ').concat(g(r,4)));if(i!==1&&i!==2&&i!=="1"&&i!=="2")throw new TypeError('ranges-push/rMerge(): [THROW_ID_09] resolvedOpts.mergeType was customised to a wrong thing! It was given of a type: "'.concat(typeof i,'", equal to ').concat(g(i,4)));if(typeof o!="boolean")throw new TypeError('ranges-push/rMerge(): [THROW_ID_10] resolvedOpts.joinRangesThatTouchEdges was customised to a wrong thing! It was given of a type: "'.concat(typeof o,'", equal to ').concat(g(o,4)));let l=[];for(let p of e)Array.isArray(p)&&(p[2]!==void 0||p[0]!==p[1])&&l.push([...p]);let a,u,f;r?a=J(l,{progressFn:p=>{f=Math.floor(p/5),f!==u&&(u=f,r==null||r(f))}}):a=J(l);let d=a.length-1,h=+i==2,m=a.length;for(let p=d;p>=0;p--){let A=a[p];for(r&&p<d&&(f=Math.floor((1-(p+1)/d)*78)+21,f!==u&&f>u&&(u=f,r(f)));m<a.length;){let W=a[m],E=W[0]===A[0];if(!E&&(o?W[0]>A[1]:W[0]>=A[1]))break;let T=W[1]>=A[1];T&&(A[1]=W[1]),W[2]===null?A[2]=null:W[2]!==void 0&&(E||T)&&(A[2]=bt(A[2],W[2],h&&E)),m+=1}m-=1,a[m]=A}let y=a.length-m;for(let p=0;p<y;p++)a[p]=a[m+p];return a.length=y,a.length?a:null}var de=Object.freeze({limitToBeAddedWhitespace:!1,limitLinebreaksCount:1,mergeType:1});function F(e){if(q(e))return e;if(typeof e=="string"&&/^\d+$/.test(e)){let t=Number(e);return q(t)?t:null}return null}function wt(e){if(!Array.isArray(e))return"a ranges batch must contain only range arrays; received ".concat(g(e,4));if(e.length>3)return"a range must contain at most three values; received ".concat(g(e,4));let[t,n,r]=e;if(t==null&&n==null)return;if(t!=null&&n==null)return"the first index is set (".concat(g(t),") but the second index is not (").concat(g(n),")");if(t==null&&n!=null)return"the second index is set (".concat(g(n),") but the first index is not (").concat(g(t),")");let i=F(t),o=F(n);if(i===null)return"the first index must be a natural number, zero, or a digit-only numeric string; received ".concat(g(t,4)," (type ").concat(typeof t,")");if(o===null)return"the second index must be a natural number, zero, or a digit-only numeric string; received ".concat(g(n,4)," (type ").concat(typeof n,")");if(ue(r)&&!x(r)&&!We(r))return"the third value must be a string, number, null, or undefined; received ".concat(g(r,4)," (type ").concat(typeof r,")");if(i>o)return"the first index (".concat(i,") must not be greater than the second index (").concat(o,")")}function an(e){if(e.length>3)return{error:"expected at most three arguments but received ".concat(e.length),ranges:[]};if(e.length<=1&&Array.isArray(e[0])){let n=e[0];if(!n.length)return{ranges:[]};e=Array.isArray(n[0])?n:[n]}else e=[e];let t=[];for(let n of e){let r=wt(n);if(r)return{error:r,ranges:[]};let[i,o,l]=n;if(i==null&&o==null)continue;let a=F(i),u=F(o);t.push(l!==void 0&&!(x(l)&&!l.length)?[a,u,l]:[a,u])}return{ranges:t}}function ln(e){return e[2]===void 0&&e[0]===e[1]}function un(e){let t=-1;for(let n=0,r=e.length;n<r;n++){let i=e[n];if(Array.isArray(i)){if(i[0]<t)return!1;t=i[0]}}return!0}var $t=class{constructor(e){Q(this,"ranges");Q(this,"opts");Q(this,"currentCache",null);if(e!=null&&!I(e))throw new TypeError("ranges-push/Ranges/constructor(): [THROW_ID_01] The options argument must be a plain object. It was given as ".concat(g(e,4)," (type ").concat(typeof e,")."));if(e===void 0){this.opts=de,this.ranges=[];return}let t=e,n=t.limitToBeAddedWhitespace===void 0?de.limitToBeAddedWhitespace:t.limitToBeAddedWhitespace,r=t.limitLinebreaksCount===void 0?de.limitLinebreaksCount:t.limitLinebreaksCount,i=t.mergeType===void 0?de.mergeType:t.mergeType,o=i==="1"?1:i==="2"?2:i,l;if(typeof n!="boolean"?l="opts.limitToBeAddedWhitespace must be a boolean; received ".concat(g(n,4)," (type ").concat(typeof n,")"):q(r)?o!==1&&o!==2&&(l='opts.mergeType must be 1, 2, "1", or "2"; received '.concat(g(i,4)," (type ").concat(typeof i,")")):l="opts.limitLinebreaksCount must be a natural number or zero; received ".concat(g(r,4)," (type ").concat(typeof r,")"),l)throw new TypeError("ranges-push/Ranges/constructor(): [THROW_ID_02] ".concat(l,"."));let a=Object.freeze({limitToBeAddedWhitespace:n,limitLinebreaksCount:r,mergeType:o});this.opts=a,this.ranges=[]}rangeListsMatch(e,t){if(!Array.isArray(e))return t===null;if(!Array.isArray(t)||e.length!==t[0])return!1;let n=1;for(let r=0,i=e.length;r<i;r++){let o=e[r];if(!Array.isArray(o)){if(t[n++]!==-1||o!==t[n++])return!1;continue}if(o.length!==t[n++])return!1;for(let l=0;l<o.length;l++)if(o[l]!==t[n++])return!1}return n===t.length}snapshotRanges(e){if(!Array.isArray(e))return null;let t=new Array(1+e.length*4);t[0]=e.length;let n=1;for(let r=0,i=e.length;r<i;r++){let o=e[r];if(Array.isArray(o)){t[n++]=o.length;for(let l=0;l<o.length;l++)t[n++]=o[l]}else t[n++]=-1,t[n++]=o}return t.length=n,t}currentStateMatchesSnapshot(){let e=this.currentCache;return e!==null&&this.rangeListsMatch(this.ranges,e.rangesSnapshot)&&this.rangeListsMatch(e.result,e.resultSnapshot)}recordCurrentSnapshot(e){let t=this.snapshotRanges(this.ranges);this.currentCache={rangesSnapshot:t,result:e,resultSnapshot:e===this.ranges?t:this.snapshotRanges(e)}}invalidateCurrentCache(){this.currentCache=null}addValidated(e,t,n){this.invalidateCurrentCache();let r=this.last();if(ue(this.ranges)&&Array.isArray(r)&&e===r[1]){if(r[1]=t,n!==void 0&&!(x(n)&&!n.length)){let o=bt(r[2],n,this.opts.mergeType===2&&r[0]===e);this.opts.limitToBeAddedWhitespace&&typeof o=="string"&&(o=fe(o,this.opts.limitLinebreaksCount)),x(o)&&!o.length||(r[2]=o)}return}this.ranges||(this.ranges=[]);let i=n!==void 0?[e,t,typeof n=="string"&&this.opts.limitToBeAddedWhitespace?fe(n,this.opts.limitLinebreaksCount):n]:[e,t];this.ranges.push(i)}add(e,t,n){let r=arguments.length,i;if(r>3)i="expected at most three arguments but received ".concat(r);else if(r===1&&Array.isArray(e)){let o=Array.isArray(e[0])?e:[e];for(let l=0,a=o.length;l<a&&(i=wt(o[l]),!i);l++);if(!i)for(let l=0,a=o.length;l<a;l++){let[u,f,d]=o[l];u==null&&f==null||this.addValidated(F(u),F(f),x(d)&&!d.length?void 0:d)}}else{if(e==null&&t==null)return;if(e!=null&&t==null)i="the first index is set (".concat(g(e),") but the second index is not (").concat(g(t),")");else if(e==null&&t!=null)i="the second index is set (".concat(g(t),") but the first index is not (").concat(g(e),")");else{let o=F(e),l=F(t);o===null?i="the first index must be a natural number, zero, or a digit-only numeric string; received ".concat(g(e,4)," (type ").concat(typeof e,")"):l===null?i="the second index must be a natural number, zero, or a digit-only numeric string; received ".concat(g(t,4)," (type ").concat(typeof t,")"):ue(n)&&!x(n)&&!We(n)?i="the third value must be a string, number, null, or undefined; received ".concat(g(n,4)," (type ").concat(typeof n,")"):o>l?i="the first index (".concat(o,") must not be greater than the second index (").concat(l,")"):this.addValidated(o,l,x(n)&&!n.length?void 0:n)}}if(i)throw new TypeError("ranges-push/Ranges/add(): [THROW_ID_03] ".concat(i,"."))}push(e,t,n){this.add.apply(this,arguments)}current(){var e,t;if(this.currentStateMatchesSnapshot())return(t=(e=this.currentCache)==null?void 0:e.result)!=null?t:null;if(Array.isArray(this.ranges)&&this.ranges.length){this.ranges=sn(this.ranges,this.opts.mergeType===1?void 0:{mergeType:2});let n=this.ranges;return n&&this.opts.limitToBeAddedWhitespace&&(n=n.map(r=>typeof r[2]=="string"?[r[0],r[1],fe(r[2],this.opts.limitLinebreaksCount)]:r)),this.recordCurrentSnapshot(n),n}return this.recordCurrentSnapshot(null),null}firstCovers(e){if(!q(e))throw new TypeError("ranges-push/Ranges/firstCovers(): [THROW_ID_04] the input argument must be a natural number or zero! It was given as ".concat(g(e,4)," (type ").concat(typeof e,")"));if(!Array.isArray(this.ranges)||!this.ranges.length)return!1;let t=un(this.ranges)?this.ranges:this.ranges.filter(r=>Array.isArray(r)).slice().sort((r,i)=>r[0]-i[0]||r[1]-i[1]),n=null;for(let r=0,i=t.length;r<i;r++){let o=t[r];if(!(!Array.isArray(o)||ln(o))){if(n===null){if(o[0]!==0)return!1;n=o[1]}else{if(o[0]>n)break;o[1]>n&&(n=o[1])}if(n>=e)return!0}}return n!==null&&n>=e}wipe(){this.ranges=[],this.invalidateCurrentCache()}replace(e){if(Array.isArray(e)&&e.length)if(Array.isArray(e[0])){let t=an([e]);if(t.error)throw new TypeError("ranges-push/Ranges/replace(): [THROW_ID_06] ".concat(t.error,"."));this.ranges=t.ranges,this.invalidateCurrentCache()}else throw new Error("ranges-push/Ranges/replace(): [THROW_ID_05] Single range was given but we expected array of arrays! The first element, ".concat(g(e[0],4)," should be an array."));else this.ranges=[],this.invalidateCurrentCache()}last(){return Array.isArray(this.ranges)&&this.ranges.length?this.ranges[this.ranges.length-1]:null}};function K(e){return e===32||e>=9&&e<=13||e===160||e===5760||e>=8192&&e<=8202||e===8232||e===8233||e===8239||e===8287||e===12288||e===65279}function _n(e,t){return t==null?0:typeof t!="number"||!Number.isInteger(t)||t<0?null:t>e?e:t}function vt(e,t=0){if(typeof e!="string"||!e.length)return null;(!t||typeof t!="number")&&(t=0);let n=e[t+1];if(!n)return null;if(!K(n.charCodeAt(0)))return t+1;if(n=e[t+2],n&&!K(n.charCodeAt(0)))return t+2;for(let r=t+3,i=e.length;r<i;r++)if(!K(e.charCodeAt(r)))return r;return null}function ce(e,t=0){if(typeof e!="string"||!e.length)return null;let n=_n(e.length,t);if(n===null||n<1)return null;let r=n-1;if(!K(e.charCodeAt(r)))return r;if(r-=1,r<0)return null;if(!K(e.charCodeAt(r)))return r;for(r-=1;r>=0;r--)if(!K(e.charCodeAt(r)))return r;return null}var At="4.2.3";var G=" ",ke="\\0000A0",Re="\\u00A0",Tt="–";var Et="\\u2013",Wt="—";var Ct="\\u2014",De=[{heads:"{{",tails:"}}"},{heads:["{% if","{%- if"],tails:["{% endif","{%- endif"]},{heads:["{% for","{%- for"],tails:["{% endfor","{%- endfor"]},{heads:["{%","{%-"],tails:["%}","-%}"]},{heads:"{#",tails:"#}"}],Ot=[{heads:"{{",tails:"}}"}],je=[{heads:["<%","<%=","<%-"],tails:["%>","=%>","-%>"]}],kt=["abbr","address","area","article","aside","audio","base","bdi","bdo","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","doctype","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","math","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","param","picture","pre","progress","rb","rp","rt","rtc","ruby","samp","script","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","ul","var","video","wbr","xml"];var dn=At,xt=4,St=5,D={removeWidowPreventionMeasures:!1,convertEntities:!0,targetLanguage:"html",UKPostcodes:!1,hyphens:!0,minWordCount:xt,minCharCount:St,ignore:[],reportProgressFunc:null,reportProgressFuncFrom:0,reportProgressFuncTo:100,tagRanges:[]},cn=Object.freeze(at(z({},D),{ignore:Object.freeze([]),tagRanges:Object.freeze([])})),gn=[Tt,Et,Wt,Ct],pn=/[&\\\u00a0\u2013\u2014\r\n<>/0-9-]/;function hn(e,t){var d,h,m,y,_;let n=0,r=0,i,o,l;for(let c=0;c<e.length;c+=1)if(e[c].trim())r+=1,(d=e[c-1])!=null&&d.trim()||(n+=1),i!==void 0&&(o=i,l=c,i=void 0);else if((h=e[c-1])!=null&&h.trim()&&!(((m=e[c-1])==null?void 0:m.toLowerCase())==="r"&&(((y=e[c-2])==null?void 0:y.toLowerCase())==="b"||((_=e[c-2])==null?void 0:_.toLowerCase())==="h"))){let w=c+1;for(;w<e.length&&!e[w].trim();)w+=1;w<e.length&&(i=c)}let a=!1,u=null,f=e;return o!==void 0&&l!==void 0&&n>=xt&&r>=St&&(a=!0,u=[[o,l,G]],f="".concat(e.slice(0,o)).concat(G).concat(e.slice(l))),{res:f,ranges:u,log:{timeTakenInMilliseconds:Date.now()-t},whatWasDone:{removeWidows:a,convertEntities:!1},applicableOpts:{removeWidows:a,convertEntities:a}}}function mn(e,t){var He,Le,Ve,Be,Ue,ze,qe,Je,Ke,Ge,Qe,Ze,Ye,Xe,et,tt,nt;let n=Date.now();if(typeof e!="string")throw e===void 0?new Error("string-remove-widows/removeWidows(): [THROW_ID_01] the first input argument is completely missing! It should be given as string."):new Error('string-remove-widows/removeWidows(): [THROW_ID_02] the first input argument must be string! It was given as "'.concat(typeof e,'", equal to:\n').concat(g(e,4)));if(t!==void 0&&!I(t))throw new Error("string-remove-widows/removeWidows(): [THROW_ID_03] the second input argument, options object, should be a plain object but it was given as type ".concat(typeof t,", equal to ").concat(g(t,4)));if(t===void 0&&!pn.test(e))return hn(e,n);let r=Array.isArray,i=e.length,o=new $t({mergeType:2}),l=["."],a=.06,u,f,d=0,h=0,m,y,_,c,w,p,A,W=!1,E,T=0,C,L,M,V,$=Cn(e,t),Se={removeWidows:!1,convertEntities:!1},B={removeWidows:!1,convertEntities:!1},ge=new Map,ee=new Set;function Ne(s,v){return"".concat(s,":").concat(v)}function S(s,v){if(!$.tagRanges.length||s>=v)return!1;let k=0,P=$.tagRanges.length;for(;k<P;){let N=Math.floor((k+P)/2);$.tagRanges[N][1]<=s?k=N+1:P=N}return!!($.tagRanges[k]&&$.tagRanges[k][0]<v)}function te(s,v){return e.startsWith(s,v)&&!S(v,v+s.length)}let pe=$.reportProgressFuncFrom+Math.floor(($.reportProgressFuncTo-$.reportProgressFuncFrom)*(1-a));function he(s){if(!$.reportProgressFunc)return;let v=Math.max($.reportProgressFuncFrom,Math.min($.reportProgressFuncTo,Math.floor(s)));(f===void 0||v>f)&&(f=v,$.reportProgressFunc(v))}function me(s,v){if(S(s,v))return!1;let k=Z;$.removeWidowPreventionMeasures?k=" ":$.convertEntities&&(k=G,$.targetLanguage==="css"?k=ke:$.targetLanguage==="js"&&(k=Re));let P=Ne(s,v),N=Y(e,s)===v;return B.removeWidows=!0,N&&($.removeWidowPreventionMeasures?ee.delete(P):ee.add(P)),e.slice(s,v)!==k?(o.push(s,v,k),ge.set(P,N&&k!==" "?"convertEntities":"removeWidows"),!0):!1}function Me(){d=0,h=0,m=void 0,y=void 0,_=void 0,c=void 0,w=void 0,p=void 0,A=void 0,W=!1}Me(),he($.reportProgressFuncFrom);for(let s=0;s<=i;s++){for($.reportProgressFunc&&(u=$.reportProgressFuncFrom+Math.floor((i===0?1:Math.min(s,i)/i)*(pe-$.reportProgressFuncFrom)),he(u));$.tagRanges[T]&&$.tagRanges[T][1]<=s;)T+=1;let v=$.tagRanges[T];if(v&&s>=v[0]&&s<v[1]){let b=C===v[0]||L===v[0]||M!==v[0]&&V!==v[0]&&!((He=e[v[0]-1])!=null&&He.trim());w!==void 0&&s===v[0]&&((Le=e[v[1]])!=null&&Le.trim())&&(m=_,y=c,_=w,c=s),w=void 0,C!==void 0&&C<v[1]&&(C=void 0),M!==void 0&&M<v[1]&&(M=void 0),L!==void 0&&L<v[1]&&(L=void 0),V!==void 0&&V<v[1]&&(V=void 0),(Ve=e[v[1]])!=null&&Ve.trim()&&b&&(L=v[1]),s=v[1]-1;continue}let k=L===s;k&&(L=void 0);let P=V===s;P&&(V=void 0);let N=M===s;N&&(M=void 0),!E&&r($.ignore)&&$.ignore.length&&$.ignore.some((b,O)=>r(b.heads)&&b.heads.some(se=>te(se,s))||typeof b.heads=="string"&&te(b.heads,s)?(w=void 0,d+=1,E=$.ignore[O].tails,!0):!1);let ye=!1;!E&&C!==void 0&&C===s&&(d+=1,A!==void 0&&(W=!0),C=void 0,ye=!0),!E&&s&&((Be=e[s])!=null&&Be.trim())&&!((Ue=e[s-1])!=null&&Ue.trim())&&w!==void 0&&(m=_,y=c,_=w,c=s,w=void 0);let be=!E&&(e[s]===Z||e[s]==="&"||e[s]==="\\")?Y(e,s):void 0,R=be!==void 0&&!S(s,be)?be:void 0;if(R!==void 0){p=s,A=R,W=!1;let b=Ne(s,R);ee.add(b);let O=$.convertEntities?$.targetLanguage==="css"?"".concat(ke).concat(Pe(e[R])?" ":""):$.targetLanguage==="js"?Re:G:Z;e.slice(s,R)!==O&&(o.push(s,R,O),ge.set(b,"convertEntities")),e[R]&&!"\r\n".includes(e[R])&&!e[R].trim()&&(M=R),R-s>1&&((ze=e[R])!=null&&ze.trim())&&Y(e,R)===void 0&&(C=R),s=R-1;continue}!E&&((qe=e[s])!=null&&qe.trim())&&(h+=1);let we=!E&&(e[s]==="-"||e[s]===Ee||e[s]===Te||e[s]==="&"||e[s]==="\\")?yn(e,s):void 0,j=we!==void 0&&!S(s,we)?we:void 0;if(j!==void 0){let b=ce(e,s);!ye&&(k||!((Je=e[s-1])!=null&&Je.trim()))&&(d+=1,A!==void 0&&(W=!0));let O=p!==void 0&&A===s&&Y(e,p)===s,se=O&&p!==void 0?p:b===null?s:b+1,Lt=b!==null&&!e.slice(b+1,s).split("").some(ot=>ot==="\r"||ot==="\n"),rt=j<i&&Lt&&!((Ke=e[j])!=null&&Ke.trim())&&(O||!!e[s-1]&&!e[s-1].trim()&&b!==null)&&!S(se,s);rt&&(B.removeWidows=!0),$.hyphens&&rt&&me(se,s),e[s]==="\\"&&Pe(e[j-1])&&(e[j]&&!"\r\n".includes(e[j])&&!e[j].trim()?M=j:(Ge=e[j])!=null&&Ge.trim()&&(V=j)),s=j-1;continue}if(!E&&!ye&&((Qe=e[s])!=null&&Qe.trim())&&(k||!P&&!((Ze=e[s-1])!=null&&Ze.trim()))&&(d+=1,A!==void 0&&(W=!0)),!E&&(!e[s]||"\r\n".includes(e[s])||(e[s]==="\n"||e[s]==="\r"||e[s]==="\r"&&e[s+1]==="\n")&&ce(e,s)&&l.includes(e[ce(e,s)]))){let b,O;_!==void 0&&c!==void 0&&p!==void 0&&A!==void 0&&W?_>p?(b=_,O=c):(b=p,O=A):_!==void 0&&c!==void 0?(b=_,O=c):p!==void 0&&A!==void 0&&W&&(b=p,O=A),(b===void 0||O===void 0)&&m!==void 0&&y!==void 0&&(b=m,O=y),b!==void 0&&O!==void 0&&(!$.minWordCount||d>=$.minWordCount)&&(!$.minCharCount||h>=$.minCharCount)&&(S(b,O)||(B.removeWidows=!0,me(b,O))),Me()}let ne=e.charCodeAt(s-1),re=!E&&e[s]&&!e[s].trim()&&!"\r\n".includes(e[s])&&((Ye=e[s-1])!=null&&Ye.trim())&&(ne>=48&&ne<=57||ne>=65&&ne<=90)?vn(e,s):void 0;re!==void 0&&!S(re.tokenStart,re.tokenEnd)&&(B.removeWidows=!0,$.UKPostcodes&&me(s,re.whitespaceEnd));let oe=!E&&e[s]&&!"\r\n".includes(e[s])&&!e[s].trim()&&(N||((Xe=e[s-1])==null?void 0:Xe.trim()))&&w===void 0,ie=oe?vt(e,s):null,Ft=oe&&((et=e[s-1])==null?void 0:et.toLowerCase())==="r"&&["b","h"].includes((tt=e[s-2])==null?void 0:tt.toLowerCase()),Ht=oe&&e[s-1]==="<"&&ie!==null&&kt.some(b=>e.startsWith(b,ie));oe&&ie!==null&&!"/>".includes(e[ie])&&!Ft&&!Ht&&(w=s,(p!==void 0||A!==void 0)&&(p=void 0,A=void 0,W=!1));let U;if(E&&(typeof E=="string"&&te(E,s)?U=E:Array.isArray(E)&&E.some(b=>te(b,s)?(U=b,!0):!1),U!==void 0)){let b=s+U.length;if(U.startsWith("{% end")||U.startsWith("{%- end")){for(;b<i&&!e[b].trim();)b+=1;e.startsWith("-%}",b)?b+=3:e.startsWith("%}",b)&&(b+=2)}if(!S(s,b)){E=void 0;let O=Y(e,b);(nt=e[b])!=null&&nt.trim()&&(O===void 0||S(b,O))&&(C=b),s=b-1}}e[s]&&"\r\n".includes(e[s])&&(d=0,h=0)}let Fe=o.current(),Mt=yt(e,Fe,$.reportProgressFunc?s=>{u=pe+Math.floor(s/100*($.reportProgressFuncTo-pe)),he(u)}:void 0);for(let s of ge.values())Se[s]=!0;return B.convertEntities=B.removeWidows&&!$.removeWidowPreventionMeasures||ee.size>0,{res:Mt,ranges:Fe,log:{timeTakenInMilliseconds:Date.now()-n},whatWasDone:Se,applicableOpts:B}}function Rt(e){return e!==void 0&&/[0-9a-f]/i.test(e)}function Pe(e){return e!==void 0&&" \n\f\r ".includes(e)}function xe(e,t,n,r){if(e[t]!=="\\"||!Rt(e[t+1]))return;let i=t+1;for(;i<e.length&&i-t<=6&&Rt(e[i]);)i+=1;if(Number.parseInt(e.slice(t+1,i),16)===n)return r&&Pe(e[i])?e[i]==="\r"&&e[i+1]==="\n"?i+2:i+1:i}function Y(e,t){var r,i;let n=e[t];if(n===Z)return t+1;if(n==="&"&&(e.startsWith(G,t)||e.startsWith(" ",t)))return t+6;if(n==="\\")return((r=e[t+1])==null?void 0:r.toLowerCase())==="u"&&e[t+2]==="0"&&e[t+3]==="0"&&((i=e[t+4])==null?void 0:i.toLowerCase())==="a"&&e[t+5]==="0"?t+6:xe(e,t,160,!0)}function yn(e,t){var r;let n=e[t];if(n==="-"||n===Ee||n===Te)return t+1;if(n==="&"||n==="\\"){for(let i of gn)if(e.startsWith(i,t))return t+i.length;if(n==="\\")return(r=xe(e,t,8211,!0))!=null?r:xe(e,t,8212,!0)}}function Dt(e){if(e===void 0)return!1;let t=e.charCodeAt(0);return t>=48&&t<=57||t>=65&&t<=90||t===95||t>=97&&t<=122}var Ie=[1632,1641,1776,1785,1984,1993,2406,2415,2534,2543,2662,2671,2790,2799,2918,2927,3046,3055,3174,3183,3302,3311,3430,3439,3558,3567,3664,3673,3792,3801,3872,3881,4160,4169,4240,4249,6112,6121,6160,6169,6470,6479,6608,6617,6784,6793,6800,6809,6992,7001,7088,7097,7232,7241,7248,7257,42528,42537,43216,43225,43264,43273,43472,43481,43504,43513,43600,43609,44016,44025,65296,65305,66720,66729,68912,68921,68928,68937,69734,69743,69872,69881,69942,69951,70096,70105,70384,70393,70736,70745,70864,70873,71248,71257,71360,71369,71376,71395,71472,71481,71904,71913,72016,72025,72688,72697,72784,72793,73040,73049,73120,73129,73184,73193,73552,73561,90416,90425,92768,92777,92864,92873,93008,93017,93552,93561,118e3,118009,120782,120831,123200,123209,123632,123641,124144,124153,124401,124410,125264,125273,130032,130041];function bn(e,t){let n=e.codePointAt(t);return n===void 0?void 0:String.fromCodePoint(n)}function wn(e,t){if(t<=0)return;let n=e.charCodeAt(t-1);return n>=56320&&n<=57343&&t>1?e.slice(t-2,t):e[t-1]}function $n(e){if(e===void 0)return!1;let t=e.codePointAt(0),n=0,r=Ie.length/2-1;for(;n<=r;){let i=n+r>>1,o=Ie[i*2],l=Ie[i*2+1];if(t<o)r=i-1;else if(t>l)n=i+1;else return!0}return!1}function jt(e){return e!==void 0&&(e==="_"||ht(e)||$n(e))}function vn(e,t){var a;if(!e[t]||"\r\n".includes(e[t])||e[t].trim()||!((a=e[t-1])!=null&&a.trim()))return;let n=e.charCodeAt(t-1);if(!(n>=48&&n<=57||n>=65&&n<=90))return;let r=t;for(;e[r]&&!e[r].trim()&&!"\r\n".includes(e[r]);)r+=1;if(!e[r])return;let i=e.charCodeAt(r);if(i<48||i>57)return;let o=t-1;for(;o>=0&&Dt(e[o]);)o-=1;o+=1;let l=r;for(;l<e.length&&Dt(e[l]);)l+=1;if(!(jt(wn(e,o))||jt(bn(e,l))))return/^[A-Z]{1,2}[0-9][0-9A-Z]?$/.test(e.slice(o,t))&&/^[0-9][A-Z]{2}$/.test(e.slice(r,l))?{whitespaceEnd:r,tokenStart:o,tokenEnd:l}:void 0}var An=["removeWidowPreventionMeasures","convertEntities","targetLanguage","UKPostcodes","hyphens","minWordCount","minCharCount","ignore","reportProgressFunc","reportProgressFuncFrom","reportProgressFuncTo","tagRanges"];function X(e){return{heads:typeof e.heads=="string"?e.heads:[...e.heads],tails:typeof e.tails=="string"?e.tails:[...e.tails]}}function H(e,t){return Object.getOwnPropertyDescriptor(e,t)!==void 0}function Nt(e,t){var n;return((n=Object.getOwnPropertyDescriptor(e,t))==null?void 0:n.enumerable)===!0}function Tn(e){for(let t in e)if(!H(e,t))return t}function It(e){if(typeof e=="string")return e.length>0?e:void 0;if(!Array.isArray(e)||e.length===0)return;let t=[];for(let n=0;n<e.length;n+=1){if(!H(e,n))return;let r=e[n];if(typeof r!="string"||r.length===0)return;t.push(r)}return t}function Pt(e,t){let n=t.trim().toLowerCase();if(!["all","hexo","hugo","jinja","liquid","nunjucks"].includes(n))return'option "ignore" contains an unsupported preset '.concat(JSON.stringify(t),".");n==="all"?e.push(...De.map(X),...je.map(X)):["nunjucks","jinja","liquid"].includes(n)?e.push(...De.map(X)):n==="hugo"?e.push(...Ot.map(X)):e.push(...je.map(X))}function En(e){let t=[];if(typeof e=="string"){let n=Pt(t,e);return n?{ok:!1,kind:"preset",detail:n}:{ok:!0,value:t}}if(!Array.isArray(e))return{ok:!1,kind:"shape",detail:'option "ignore" must be a supported preset or an array of presets and { heads, tails } marker objects, but it was '.concat(g(e,4),".")};for(let n=0;n<e.length;n+=1){if(!H(e,n))return{ok:!1,kind:"shape",detail:'option "ignore" cannot contain sparse entries.'};let r=e[n];if(typeof r=="string"){let u=Pt(t,r);if(u)return{ok:!1,kind:"preset",detail:u};continue}if(!I(r)||Tn(r)!==void 0||Object.getOwnPropertySymbols(r).some(u=>Nt(r,u)))return{ok:!1,kind:"shape",detail:'option "ignore" contains a malformed marker object.'};let i=Object.keys(r);if(i.length!==2||!i.includes("heads")||!i.includes("tails"))return{ok:!1,kind:"shape",detail:'every custom ignore marker must contain only own "heads" and "tails" keys.'};let o=r,l=It(o.heads),a=It(o.tails);if(l===void 0||a===void 0)return{ok:!1,kind:"shape",detail:"custom ignore marker heads and tails must be non-empty strings or dense arrays of non-empty strings."};t.push({heads:l,tails:a})}return{ok:!0,value:t}}function Wn(e,t){if(e===null)return{ok:!0,value:[]};if(!Array.isArray(e))return{ok:!1,kind:"container",detail:'option "tagRanges" must be null or an array of half-open ranges, but it was '.concat(g(e,4),".")};let n=[];for(let i=0;i<e.length;i+=1){if(!H(e,i))return{ok:!1,kind:"range",detail:'option "tagRanges" cannot contain sparse entries.'};let o=e[i];if(!Array.isArray(o)||o.length!==2&&o.length!==3||!H(o,0)||!H(o,1)||o.length===3&&!H(o,2))return{ok:!1,kind:"range",detail:'every "tagRanges" member must be a dense two- or three-item range.'};let l=o[0],a=o[1],u=o.length===3?o[2]:void 0;if(!Number.isInteger(l)||!Number.isInteger(a)||l<0||l>=a||o.length===3&&u!==null&&u!==void 0&&typeof u!="string")return{ok:!1,kind:"range",detail:'every "tagRanges" member must be a non-negative half-open range with integer from/to values and from below to.'};l<t&&n.push([l,Math.min(a,t)])}n.sort((i,o)=>i[0]===o[0]?i[1]-o[1]:i[0]-o[0]);let r=[];for(let i of n){let o=r[r.length-1];o&&i[0]<=o[1]?o[1]=Math.max(o[1],i[1]):r.push(i)}return{ok:!0,value:r}}function Cn(e,t){var y,_,c,w,p,A,W,E;if(t===void 0)return D;let n=t!=null?t:{},r=Object.keys(n),i;for(let T in n)if(!H(n,T)){i=T;break}let o=r.find(T=>!An.includes(T)),l=Object.getOwnPropertySymbols(n).find(T=>Nt(n,T));if(o!==void 0||i!==void 0||l!==void 0){let T=(y=o!=null?o:i)!=null?y:String(l);throw new TypeError("string-remove-widows/removeWidows(): [THROW_ID_04] every option must be an own, known string key; received ".concat(JSON.stringify(T),"."))}let a=Object.create(null);for(let T of r)a[T]=n[T];for(let T of["removeWidowPreventionMeasures","convertEntities","UKPostcodes","hyphens"])if(T in a&&typeof a[T]!="boolean")throw new TypeError("string-remove-widows/removeWidows(): [THROW_ID_05] option ".concat(JSON.stringify(T)," must be Boolean, but it was ").concat(g(a[T],4),"."));if("targetLanguage"in a&&!["html","css","js"].includes(a.targetLanguage))throw new TypeError('string-remove-widows/removeWidows(): [THROW_ID_06] option "targetLanguage" must be exactly "html", "css", or "js", but it was '.concat(g(a.targetLanguage,4),"."));for(let T of["minWordCount","minCharCount"]){let C=a[T];if(T in a&&C!==!1&&C!==null&&(typeof C!="number"||!Number.isFinite(C)||C<0))throw new TypeError("string-remove-widows/removeWidows(): [THROW_ID_07] option ".concat(JSON.stringify(T)," must be a finite non-negative number, false, or null, but it was ").concat(g(C,4),"."))}let u=En("ignore"in a?a.ignore:D.ignore);if(!u.ok)throw u.kind==="shape"?new TypeError("string-remove-widows/removeWidows(): [THROW_ID_08] ".concat(u.detail)):new TypeError("string-remove-widows/removeWidows(): [THROW_ID_09] ".concat(u.detail));let f="reportProgressFunc"in a?a.reportProgressFunc:D.reportProgressFunc;if(f!==!1&&f!==null&&typeof f!="function")throw new TypeError('string-remove-widows/removeWidows(): [THROW_ID_10] option "reportProgressFunc" must be a function, false, or null, but it was '.concat(g(f,4),"."));for(let T of["reportProgressFuncFrom","reportProgressFuncTo"]){let C=T in a?a[T]:D[T];if(typeof C!="number"||!Number.isInteger(C)||C<0||C>100)throw new TypeError("string-remove-widows/removeWidows(): [THROW_ID_11] option ".concat(JSON.stringify(T)," must be an integer from 0 through 100, but it was ").concat(g(C,4),"."))}let d=(_=a.reportProgressFuncFrom)!=null?_:D.reportProgressFuncFrom,h=(c=a.reportProgressFuncTo)!=null?c:D.reportProgressFuncTo;if(d>h)throw new RangeError('string-remove-widows/removeWidows(): [THROW_ID_12] option "reportProgressFuncFrom" ('.concat(d,') must not exceed "reportProgressFuncTo" (').concat(h,")."));let m=Wn("tagRanges"in a?a.tagRanges:[],e.length);if(!m.ok)throw m.kind==="container"?new TypeError("string-remove-widows/removeWidows(): [THROW_ID_13] ".concat(m.detail)):new TypeError("string-remove-widows/removeWidows(): [THROW_ID_14] ".concat(m.detail));return{removeWidowPreventionMeasures:(w=a.removeWidowPreventionMeasures)!=null?w:D.removeWidowPreventionMeasures,convertEntities:(p=a.convertEntities)!=null?p:D.convertEntities,targetLanguage:(A=a.targetLanguage)!=null?A:D.targetLanguage,UKPostcodes:(W=a.UKPostcodes)!=null?W:D.UKPostcodes,hyphens:(E=a.hyphens)!=null?E:D.hyphens,minWordCount:"minWordCount"in a?a.minWordCount:D.minWordCount,minCharCount:"minCharCount"in a?a.minCharCount:D.minCharCount,ignore:u.value,reportProgressFunc:typeof f=="function"?f:null,reportProgressFuncFrom:d,reportProgressFuncTo:h,tagRanges:m.value}}return Gt(On);})();
|
|
10
|
+
"use strict";var stringRemoveWidows=(()=>{var ae=Object.defineProperty,Bt=Object.defineProperties,zt=Object.getOwnPropertyDescriptor,Ut=Object.getOwnPropertyDescriptors,qt=Object.getOwnPropertyNames,it=Object.getOwnPropertySymbols;var st=Object.prototype.hasOwnProperty,Jt=Object.prototype.propertyIsEnumerable;var $e=(e,t,n)=>t in e?ae(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,U=(e,t)=>{for(var n in t||(t={}))st.call(t,n)&&$e(e,n,t[n]);if(it)for(var n of it(t))Jt.call(t,n)&&$e(e,n,t[n]);return e},at=(e,t)=>Bt(e,Ut(t));var Kt=(e,t)=>{for(var n in t)ae(e,n,{get:t[n],enumerable:!0})},Gt=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of qt(t))!st.call(e,i)&&i!==n&&ae(e,i,{get:()=>t[i],enumerable:!(r=zt(t,i))||r.enumerable});return e};var Qt=e=>Gt(ae({},"__esModule",{value:!0}),e);var G=(e,t,n)=>$e(e,typeof t!="symbol"?t+"":t,n);var On={};Kt(On,{defaults:()=>gn,removeWidows:()=>yn,version:()=>cn});function Zt(){let e=[],t=0,n=!1;return{append(r){return n?!1:t+r.length>1999?(e.push("\u2026"),t+=1,n=!0,!1):(e.push(r),t+=r.length,!0)},result(){return e.join("")},stopped(){return n}}}function Yt(e){return"\\u".concat(e.toString(16).padStart(4,"0"))}function le(e,t){if(e.append('"')){for(let n=0;n<t.length&&!e.stopped();n+=1){let r=t.charCodeAt(n);r===34?e.append('\\"'):r===92?e.append("\\\\"):r===8?e.append("\\b"):r===9?e.append("\\t"):r===10?e.append("\\n"):r===12?e.append("\\f"):r===13?e.append("\\r"):r<32||r===8232||r===8233||r>=55296&&r<=57343?e.append(Yt(r)):e.append(t[n])}e.append('"')}}function Xt(e){return e.get&&e.set?"[Getter/Setter]":e.get?"[Getter]":e.set?"[Setter]":"[Accessor]"}function ut(e,t){e.append("Symbol(");let n=String(t);n.length>8&&le(e,n.slice(7,-1)),e.append(")")}function lt(e,t){typeof t=="symbol"?ut(e,t):le(e,String(t))}function g(e,t=0){let n=Zt(),r=t===4?4:0,i=new WeakSet,o=0;function l(_){r&&n.append(" ".repeat(_*r))}function a(_,c){_&&n.append(","),r&&(n.append("\n"),l(c+1))}function u(_,c,w){r&&c&&(n.append("\n"),l(w)),n.append(_)}function f(_,c){Object.prototype.hasOwnProperty.call(_,"value")?y(_.value,c):n.append(Xt(_))}function d(_,c){let w;try{w=Reflect.getOwnPropertyDescriptor(_,"length")}catch(C){n.append("[Uninspectable]");return}let p=w==null?void 0:w.value;if(!Number.isSafeInteger(p)||p<0){n.append("[Uninspectable]");return}n.append("[");let A=!1;for(let C=0;C<p&&!n.stopped();C+=1){if(a(A,c),A=!0,o>=50){n.append("[MaxEntries]");break}o+=1;let W;try{W=Reflect.getOwnPropertyDescriptor(_,String(C))}catch(T){n.append("[Uninspectable]");continue}W!=null&&W.enumerable?f(W,c+1):n.append("[Empty]")}u("]",A,c)}function h(_,c){let w;try{w=Reflect.ownKeys(_)}catch(A){n.append("[Uninspectable]");return}n.append("{");let p=!1;for(let A of w){if(n.stopped())break;if(o>=50){a(p,c),p=!0,le(n,"\u2026"),n.append(r?": ":":"),n.append("[MaxEntries]");break}o+=1;let C;try{C=Reflect.getOwnPropertyDescriptor(_,A)}catch(W){a(p,c),p=!0,lt(n,A),n.append(r?": ":":"),n.append("[Uninspectable]");continue}C!=null&&C.enumerable&&(a(p,c),p=!0,lt(n,A),n.append(r?": ":":"),f(C,c+1))}u("}",p,c)}function m(_,c){if(i.has(_)){n.append("[Circular]");return}if(c>=5){n.append("[MaxDepth]");return}let w;try{w=Array.isArray(_)}catch(p){n.append("[Uninspectable]");return}i.add(_);try{w?d(_,c):h(_,c)}finally{i.delete(_)}}function y(_,c){_===null?n.append("null"):typeof _=="string"?le(n,_):typeof _=="number"?n.append(Object.is(_,-0)?"-0":String(_)):typeof _=="boolean"?n.append(_?"true":"false"):typeof _>"u"?n.append("undefined"):typeof _=="bigint"?n.append("".concat(_,"n")):typeof _=="symbol"?ut(n,_):typeof _=="function"?n.append("[Function]"):m(_,c)}try{return y(e,0),n.result()}catch(_){return"[Uninspectable]"}}var en=["_16_0_a_0_4_0_5_m_1_u_1_cp_4_b_e_4_7_0_1_0_3l_4_1_1_2_3_1_0_6_0_1_2_1_0_1_j_1_2a_1_3u_8_4l_1_11_2_0_","6_14_1z_q_4_3_19_16_z_1_1_2q_1_0_f_1_7_1_a_2_2_0_g_0_1_t_t_2g_b_0_o_w_9_1_4_0_5_l_4_0_9_0_3_0_n_o_7_","a_5_n_1_6_g_15_1m_1h_3_0_i_0_7_9_f_f_4_7_2_1_2_l_1_6_1_0_3_3_3_0_g_0_d_1_1_2_e_1_a_0_8_5_4_1_2_l_1_6","_1_1_1_1_1_1_v_3_1_0_j_2_g_8_1_2_1_l_1_6_1_1_1_4_3_0_i_0_f_1_n_0_b_7_2_1_2_l_1_6_1_1_1_4_3_0_u_1_1_2","_f_0_h_0_1_5_3_2_1_3_3_1_1_0_1_1_3_1_3_2_3_b_m_0_1g_7_1_2_1_m_1_f_3_0_q_2_1_1_2_1_u_0_4_7_1_2_1_m_1_","9_1_4_3_0_u_2_1_1_f_1_h_8_1_2_1_14_2_0_g_0_5_2_8_2_o_5_5_h_3_n_1_8_1_0_2_6_1m_1b_1_1_c_6_1m_1_1_0_1_","4_1_n_1_0_1_9_1_1_9_0_2_4_1_0_l_3_w_0_1r_7_1_z_r_4_37_16_k_0_g_5_4_3_3_0_3_1_7_2_4_c_c_0_h_11_1_0_5_","0_2_16_1_98_1_3_2_6_1_0_1_3_2_14_1_3_2_w_1_3_2_6_1_0_1_3_2_e_1_1k_1_3_2_1u_11_f_g_2d_2_5_3_h7_2_g_1_","p_5_22_6_7_7_h_d_i_e_h_e_c_1_2_f_1f_z_0_4_0_1v_2g_7_4_2_x_1_0_5_1x_a_u_1d_t_2_4_b_17_4_p_1i_m_9_1g_2","a_0_2l_1a_h_7_1i_t_d_1_a_17_q_z_15_2_a_z_2_a_5_16_2_2_15_3_1_5_1_1_3_0_5_5b_1s_7p_2_5_2_11_2_5_2_7_1","_0_1_0_1_0_1_u_2_1g_1_6_1_0_3_2_1_6_3_3_2_5_4_c_5_2_1_6_38_0_d_0_g_c_2t_0_4_0_2_9_1_0_3_4_6_0_1_0_1_","0_1_3_1_a_2_3_5_4_4_0_1g_1_22j_6c_6_3_3_1_c_11_1_0_5_0_2_1j_7_0_g_m_9_6_1_6_1_6_1_6_1_6_1_6_1_6_1_6_","28_0_d1_1_16_4_5_1_4_2d_6_2_1_2h_1_3_5_16_1_2l_h_v_1c_f_e8_533_1s_h3g_1v_19_2_7g_3_f_a_1_k_1a_g_u_2_","1x_1d_8_2_2u_2_29_k_g_1_2_1_3_1_m_t_1f_e_1d_1q_5_3_0_1_1_b_r_a_m_p_s_7_1a_s_0_g_4_1_9_a_4_1_14_n_2_1","_7_k_m_3_0_3_1d_1_0_3_1_2_4_2_0_1_0_o_2_2_a_7_2_c_5_2_5_2_5_9_6_1_6_1_16_1_d_6_36_t_8mb_c_m_4_1c_6is","_a5_2_2x_12_6_c_4_5_0_1_9_1_c_1_4_1_0_1_1_1_1_1_2z_x_a2_i_1r_2_1h_14_b_38_4_1_3q_10_p_6_p_b_2g_3_5_2","_5_2_5_2_2_z_b_1_p_1_i_1_1_1_e_2_d_y_3e_at_s_3_1c_1b_v_d_j_1_7_6_11_a_t_2_z_4_7_1c_4d_i_z_4_z_4_13_8","_1f_c_a_1_e_1_6_1_1_1_a_1_e_1_6_1_1_3_1f_c_8m_9_l_a_7_o_5_1_15_1_8_1x_5_2_0_1_17_1_1_3_0_2_m_a_m_9_u","_1t_i_1_1_a_l_a_p_6_p_12_1j_6_1_1s_0_f_3_1_2_1_s_16_s_3_s_z_7_1_r_r_1h_a_l_a_i_d_h_32_20_1j_1e_d_1e_","d_z_12_r_9_m_6y_15_6_1_g_5_1k_s_a_0_8_l_16_h_1a_k_r_m_c_1g_1l_1_2_0_d_18_w_o_q_z_t_0_2_0_8_y_3_0_c_1","b_e_3_l_0_1_0_z_h_1_o_j_1_1r_6_1_0_1_3_1_e_1_9_7_1a_12_7_2_1_2_l_1_6_1_1_1_4_3_0_i_0_c_4_u_9_1_0_2_0","_1_11_1_0_p_0_1_0_18_1g_i_3_k_2_u_1b_k_1_1_0_54_1a_15_3_10_1b_k_0_1n_16_d_0_1z_q_11_6_55_17_38_1r_v_","7_2_0_2_7_1_1_1_n_f_0_1_0_2m_7_2_12_g_0_1_0_s_0_a_13_7_0_l_0_b_19_j_0_i_20_5j_w_v_8_1_10_h_0_1d_t_34","_6_1_1_1_11_l_0_p_5_1_1_1_v_e_0_n_17_78_i_f_0_1_c_1_x_3g_0_27_pl_6e_5f_218_2o_f_tr_h_5_p_32y_5_g6_5a","1_t_1cy_fs_7_u_h_26_h_t_i_1b_g_3_v_k_5_i_c0_18_5v_1r_w_o_2_o_18_22_5_0_1u_c_1s_1_1_0_e_1_c_5p1_15_v_","2p_36_6pp_3_1_6_1_1_1_82_f_0_t_2_2_0_e_3_8_az_1s4_2y_5_c_3_8_7_9_4me_2c_1_1y_1_1_2_0_2_1_2_3_1_b_1_0","_1_6_1_1s_1_3_2_7_1_6_1_r_1_3_1_4_1_0_3_6_1_9f_2_o_1_o_1_u_1_o_1_u_1_o_1_u_1_o_1_u_1_o_1_7_1f8_u_6_5","_79_1p_42_18_a_6_g_0_8x_t_i_17_dg_r_6c_t_2_0_5r_u_1_2_1_1_1_6_2_4_9_1_68_6_1_3_1_1_1_e_1_5g_1n_1v_7_","0_xg_3_1_q_1_1_1_0_2_0_1_9_1_3_1_0_1_0_6_0_4_0_1_0_1_0_1_2_1_1_1_0_2_0_1_0_1_0_1_0_1_0_1_1_1_0_2_3_1","_6_1_3_1_3_1_0_1_9_1_g_5_2_1_4_1_g_3es_wyn_w_3dp_2_4gd_2_5rk_f_h9_1wi_f1_15u_3t6_5_6jt"].join(""),ve=en.slice(1).split("_"),Ae=[],_t=127;for(let e=0;e<ve.length;e+=2){let t=_t+1+Number.parseInt(ve[e],36),n=t+Number.parseInt(ve[e+1],36);Ae.push([t,n]),_t=n}function tn(e){if(Number.isNaN(e)||e<128||e>1114111)return!1;let t=0,n=Ae.length-1;for(;t<=n;){let r=t+n>>1,i=Ae[r];if(e<i[0])n=r-1;else if(e>i[1])t=r+1;else return!0}return!1}var Te="\u2013",We="\u2014",Q="\xA0";var xn=new Set([..."\u060B$\u20BC\u17DB\xA5\u20A1\u20B1\xA3\u20AC\xA2\u20B9\uFDFC\u20AA\u20A9\u20AD\u20A8\u20AE\u20A6\u20BD\u20AB\u0E3F\u20A9\u20BA\u20B4","$U","$b","B/.","BZ$","Br","Bs","C$","CHF","Ft","Gs","J$","KM","K\u010D","L","MT","NT$","P","Q","R","R$","RD$","RM","Rp","S","S/.","TT$","Z$","kn","kr","lei","z\u0142","\u0192","\u0414\u0438\u043D.","\u0434\u0435\u043D","\u043B\u0432","\u062F.\u0625","Lek"]);var pt=Function.prototype.toString,nn=pt.call(Object);var Pn=Map.prototype.entries,In=Set.prototype.values;var ft,Sn=(ft=Object.getOwnPropertyDescriptor(ArrayBuffer.prototype,"byteLength"))==null?void 0:ft.get,dt,Nn=(dt=Object.getOwnPropertyDescriptor(RegExp.prototype,"flags"))==null?void 0:dt.get,ct,Mn=(ct=Object.getOwnPropertyDescriptor(RegExp.prototype,"global"))==null?void 0:ct.get,gt,Fn=(gt=Object.getOwnPropertyDescriptor(RegExp.prototype,"source"))==null?void 0:gt.get,Hn=RegExp.prototype.test;function rn(e){if(e.length===1){let t=e.charCodeAt(0);return t<55296||t>57343?t:-1}if(e.length===2){let t=e.charCodeAt(0),n=e.charCodeAt(1);if(t>=55296&&t<=56319&&n>=56320&&n<=57343)return(t-55296)*1024+n-56320+65536}return-1}function ht(e){if(!N(e)||e.length===0||e.length>2)return!1;let t=e.charCodeAt(0);return e.length===1&&t<128?t>64&&t<91||t>96&&t<123:tn(rn(e))}function x(e){var r;if(e==null||typeof e!="object")return!1;let t=Object.getPrototypeOf(e);if(t===null||t===Object.prototype)return!0;let n=Object.getOwnPropertyDescriptor(t,"constructor");return!n||!("value"in n)||typeof n.value!="function"?!1:((r=Object.getOwnPropertyDescriptor(n.value,"prototype"))==null?void 0:r.value)===t&&pt.call(n.value)===nn}function N(e){return typeof e=="string"}function Ce(e){return Number.isFinite(e)}function Z(e){return Number.isSafeInteger(e)&&e>=0}var Ln=Date.prototype.getTime;function ue(e){return e!=null}var mt={strictlyTwoElementsInRangeArrays:!1,progressFn:null};function on(e,t){let n,r=0;for(;r<e.length;){let i=r+1;for(;i<e.length&&e[r][0]===e[i][0]&&e[r][1]===e[i][1];)i+=1;if(i-r>1){n||(n=new Map(t.map((a,u)=>[a,u])));let o=n,l=e.slice(r,i).sort((a,u)=>o.get(a)-o.get(u));e.splice(r,l.length,...l)}r=i}return e}function q(e,t){var a;if(!Array.isArray(e)||!e.length)return e;let n=t===void 0?!0:x(t);if(t!==void 0&&n&&(t==null?void 0:t.strictlyTwoElementsInRangeArrays)===!0)for(let u=0;u<e.length;u+=1){let f=e[u];if(!Array.isArray(f)||f.length!==2)throw new TypeError("ranges-sort/rSort(): [THROW_ID_01] The first argument should be an array and must consist of arrays which are natural number indexes representing TWO string index ranges. However, range at index ".concat(u," (").concat(g(f,4),") is ").concat(Array.isArray(f)?"an array with ".concat(f.length," elements"):"not an array","!"));if(!Number.isInteger(f[0])||f[0]<0||!Number.isInteger(f[1])||f[1]<0)throw new TypeError("ranges-sort/rSort(): [THROW_ID_02] The first argument should be an array and must consist of arrays which are natural number indexes representing string index ranges. However, range at index ".concat(u," (").concat(g(f,4),") does not consist of only natural numbers!"))}else for(let u=0;u<e.length;u+=1){let f=e[u];if(!Array.isArray(f)||!Number.isInteger(f[0])||f[0]<0||!Number.isInteger(f[1])||f[1]<0)throw new TypeError("ranges-sort/rSort(): [THROW_ID_02] The first argument should be an array and must consist of arrays which are natural number indexes representing string index ranges. However, range at index ".concat(u," (").concat(g(f,4),") does not consist of only natural numbers!"))}if(t!==void 0&&!n)throw new TypeError("ranges-sort/rSort(): [THROW_ID_03] The second argument must be a plain options object; received ".concat(g(t,4)," (type ").concat(typeof t,")!"));let r=mt.progressFn;if(t!==void 0){let u=t.strictlyTwoElementsInRangeArrays;if(u!==void 0&&typeof u!="boolean")throw new TypeError("ranges-sort/rSort(): [THROW_ID_04] opts.strictlyTwoElementsInRangeArrays must be a boolean; received ".concat(g(u,4)," (type ").concat(typeof u,")!"));if(r=(a=t.progressFn)!=null?a:mt.progressFn,r!==!1&&r!==null&&typeof r!="function")throw new TypeError("ranges-sort/rSort(): [THROW_ID_05] opts.progressFn must be a function, false, null, or undefined; received ".concat(g(r,4)," (type ").concat(typeof r,")!"))}let i,o;if(r){let u=e.length**2,f=0,d;o=h=>{h!==d&&(d=h,r(h))},i=Array.from(e).sort((h,m)=>(f+=1,o==null||o(Math.min(99,Math.floor(f*100/u))),h[0]===m[0]?h[1]<m[1]?-1:h[1]>m[1]?1:0:h[0]<m[0]?-1:1))}else i=Array.from(e).sort((u,f)=>u[0]===f[0]?u[1]<f[1]?-1:u[1]>f[1]?1:0:u[0]<f[0]?-1:1);let l=i.length>10?on(i,e):i;return o==null||o(100),l}var sn={mergeType:1,progressFn:null,joinRangesThatTouchEdges:!0};function Ee(e,t){if(!Array.isArray(e)||!e.length)return null;if(t!==void 0&&!x(t))throw new TypeError("ranges-merge/rMerge(): [THROW_ID_01] the second input argument must be a plain object. It was given as:\n".concat(g(t,4)," (type ").concat(typeof t,")"));let n=U(U({},sn),t);if(n.progressFn&&x(n.progressFn)&&!Object.keys(n.progressFn).length)n.progressFn=null;else if(n.progressFn&&typeof n.progressFn!="function")throw new TypeError('ranges-merge/rMerge(): [THROW_ID_02] opts.progressFn must be a function! It was given of a type: "'.concat(typeof n.progressFn,'", equal to ').concat(g(n.progressFn,4)));if(n.mergeType!==1&&n.mergeType!==2&&n.mergeType!=="1"&&n.mergeType!=="2")throw new TypeError('ranges-merge/rMerge(): [THROW_ID_03] opts.mergeType was customised to a wrong thing! It was given of a type: "'.concat(typeof n.mergeType,'", equal to ').concat(g(n.mergeType,4)));if(typeof n.joinRangesThatTouchEdges!="boolean")throw new TypeError('ranges-merge/rMerge(): [THROW_ID_04] opts.joinRangesThatTouchEdges was customised to a wrong thing! It was given of a type: "'.concat(typeof n.joinRangesThatTouchEdges,'", equal to ').concat(g(n.joinRangesThatTouchEdges,4)));let r=n.progressFn,i=n.joinRangesThatTouchEdges,o=[];for(let y of e)Array.isArray(y)&&(y[2]!==void 0||y[0]!==y[1])&&o.push([...y]);let l,a,u;r?l=q(o,{progressFn:y=>{u=Math.floor(y/5),u!==a&&(a=u,r(u))}}):l=q(o);let f=l.length-1,d=n.mergeType===2||n.mergeType==="2",h=l.length;for(let y=f;y>=0;y--){let _=l[y];for(r&&y<f&&(u=Math.floor((1-(y+1)/f)*78)+21,u!==a&&u>a&&(a=u,r(u)));h<l.length;){let c=l[h],w=c[0]===_[0];if(!w&&(i?c[0]>_[1]:c[0]>=_[1]))break;let p=c[1]>=_[1];p&&(_[1]=c[1]),c[2]===null?_[2]=null:c[2]!==void 0&&(w||p)&&_[2]!==null&&(_[2]!=null?d&&w?_[2]=c[2]:_[2]+=c[2]:_[2]=c[2]),h+=1}h-=1,l[h]=_}let m=l.length-h;for(let y=0;y<m;y++)l[y]=l[h+y];return l.length=m,r&&a!==99&&r(99),l.length?l:null}function _e(e){if(typeof e=="number")return Number.isInteger(e)&&e>=0;if(typeof e!="string"||!e.trim())return!1;let t=Number(e);return Number.isInteger(t)&&t>=0}function yt(e,t,n){let r=0,i=0;if(e===void 0&&t===void 0&&n===void 0)throw new Error("ranges-apply/rApply(): [THROW_ID_01] inputs missing!");if(typeof e!="string")throw new TypeError("ranges-apply/rApply(): [THROW_ID_02] first input argument must be a string! Currently it's: ".concat(typeof e,", equal to: ").concat(g(e,4)));if(t!=null&&!Array.isArray(t))throw new TypeError("ranges-apply/rApply(): [THROW_ID_03] second input argument must be an array (or null)! Currently it's: ".concat(typeof t,", equal to: ").concat(g(t,4)));if(n!=null&&n!==!1&&n!==0&&n!==""&&typeof n!="function")throw new TypeError("ranges-apply/rApply(): [THROW_ID_04] the third input argument must be a function, false, null, undefined, 0, or an empty string! Currently it's: ".concat(typeof n,", equal to: ").concat(g(n,4)));if(t==null||!t.length||t.every(d=>d==null))return n&&n(100),e;let o;Array.isArray(t)&&!Array.isArray(t[0])&&_e(t[0])&&_e(t[1])?o=[Array.from(t)]:o=Array.from(t);let l=o.length,a=0;o.forEach((d,h)=>{if(d){if(n&&(r=Math.floor(a/l*10),r!==i&&(i=r,n(r))),!Array.isArray(d))throw new TypeError("ranges-apply/rApply(): [THROW_ID_05] ranges array, second input arg., has ".concat(h,"th element not an array: ").concat(g(d,4),", which is ").concat(typeof d));if(!_e(d[0]))throw new TypeError("ranges-apply/rApply(): [THROW_ID_06] ranges array, second input arg. has ".concat(h,"th element, array ").concat(g(d),". Its first element is not a non-negative integer or string index, but ").concat(typeof d[0],", equal to: ").concat(g(d[0],4),"."));if(typeof d[0]=="string"&&(o[h]=[...d],o[h][0]=Number(d[0])),!_e(d[1]))throw new TypeError("ranges-apply/rApply(): [THROW_ID_07] ranges array, second input arg. has ".concat(h,"th element, array ").concat(g(d),". Its second element is not a non-negative integer or string index, but ").concat(typeof d[1],", equal to: ").concat(g(d[1],4),"."));if(typeof d[1]=="string"&&(o[h]===d&&(o[h]=[...d]),o[h][1]=Number(d[1])),o[h][0]>o[h][1])throw new RangeError("ranges-apply/rApply(): [THROW_ID_08] ranges array, second input arg. has ".concat(h,"th element, array ").concat(g(d),". Its first index (").concat(o[h][0],") must not be greater than its second index (").concat(o[h][1],")."));a+=1}});let u=n?Ee(o,{progressFn:d=>{r=10+Math.floor(d/10),r!==i&&(i=r,n(r))}}):Ee(o),f=(u==null?void 0:u.length)||0;if(u&&f>0){let d=e.slice(u[f-1][1]);e=u.reduce((h,m,y,_)=>{var p;n&&(r=20+Math.floor(y/f*80),r!==i&&(i=r,n(r)));let c=y===0?0:_[y-1][1],w=_[y][0];return"".concat(h).concat(e.slice(c,w)).concat((p=_[y][2])!=null?p:"")},""),e+=d}return n&&i!==100&&n(100),e}function fe(e,t=1){let n="\xA0";function r(o){return o.length<2?o:Array.from(o).reverse().join("")}function i(o,l,a){let u=a?"\n":"\r",f=a?"\r":"\n";if(!o)return o;let d=0,h="";for(let m=0,y=o.length;m<y;m++)(o[m]===u||o[m]===f&&o[m-1]!==u)&&d++,"\r\n".includes(o[m])||o[m]===n?o[m]===n?h+=o[m]:o[m]===u?d<=l&&(h+=o[m],o[m+1]===f&&(h+=o[m+1],m++)):o[m]===f&&(o==null?void 0:o[m-1])!==u&&d<=l&&(h+=o[m]):!o[m+1]&&!d&&(h+=" ");return h}if(typeof e=="string"&&e.length){let o=e.trim();if(o.length===e.length)return e;let l=1;typeof t=="number"&&Number.isInteger(t)&&t>=0&&(l=t);let a="",u="";if(!o)a=e;else if(!e[0].trim()){for(let d=0,h=e.length;d<h;d++)if(e[d].trim()){a=e.slice(0,d);break}}let f=e[e.length-1];if(o&&(f.trim()===""||f===n)){for(let d=e.length;d--;)if(e[d].trim()){u=e.slice(d+1);break}}return"".concat(i(a,l,!1)).concat(o).concat(r(i(r(u),l,!0)))}return e}var ke={mergeType:1,progressFn:null,joinRangesThatTouchEdges:!0};function bt(e,t,n){return t===void 0||e===null?e:t===null?null:e===void 0||n?t:e+t}function an(e,t){var _,c,w;function n(p){return!!p&&typeof p=="object"&&!Array.isArray(p)}if(!Array.isArray(e)||!e.length)return null;if(t&&!n(t))throw new TypeError("ranges-push/rMerge(): [THROW_ID_07] the second input argument must be a plain object. It was given as:\n".concat(g(t,4)," (type ").concat(typeof t,")"));let r=(_=t==null?void 0:t.progressFn)!=null?_:ke.progressFn,i=(c=t==null?void 0:t.mergeType)!=null?c:ke.mergeType,o=(w=t==null?void 0:t.joinRangesThatTouchEdges)!=null?w:ke.joinRangesThatTouchEdges;if(r&&n(r)&&!Object.keys(r).length)r=null;else if(r&&typeof r!="function")throw new TypeError('ranges-push/rMerge(): [THROW_ID_08] resolvedOpts.progressFn must be a function! It was given of a type: "'.concat(typeof r,'", equal to ').concat(g(r,4)));if(i!==1&&i!==2&&i!=="1"&&i!=="2")throw new TypeError('ranges-push/rMerge(): [THROW_ID_09] resolvedOpts.mergeType was customised to a wrong thing! It was given of a type: "'.concat(typeof i,'", equal to ').concat(g(i,4)));if(typeof o!="boolean")throw new TypeError('ranges-push/rMerge(): [THROW_ID_10] resolvedOpts.joinRangesThatTouchEdges was customised to a wrong thing! It was given of a type: "'.concat(typeof o,'", equal to ').concat(g(o,4)));let l=[];for(let p of e)Array.isArray(p)&&(p[2]!==void 0||p[0]!==p[1])&&l.push([...p]);let a,u,f;r?a=q(l,{progressFn:p=>{f=Math.floor(p/5),f!==u&&(u=f,r==null||r(f))}}):a=q(l);let d=a.length-1,h=+i==2,m=a.length;for(let p=d;p>=0;p--){let A=a[p];for(r&&p<d&&(f=Math.floor((1-(p+1)/d)*78)+21,f!==u&&f>u&&(u=f,r(f)));m<a.length;){let C=a[m],W=C[0]===A[0];if(!W&&(o?C[0]>A[1]:C[0]>=A[1]))break;let T=C[1]>=A[1];T&&(A[1]=C[1]),C[2]===null?A[2]=null:C[2]!==void 0&&(W||T)&&(A[2]=bt(A[2],C[2],h&&W)),m+=1}m-=1,a[m]=A}let y=a.length-m;for(let p=0;p<y;p++)a[p]=a[m+p];return a.length=y,a.length?a:null}var de=Object.freeze({limitToBeAddedWhitespace:!1,limitLinebreaksCount:1,mergeType:1});function F(e){if(Z(e))return e;if(typeof e=="string"&&/^\d+$/.test(e)){let t=Number(e);return Z(t)?t:null}return null}function wt(e){if(!Array.isArray(e))return"a ranges batch must contain only range arrays; received ".concat(g(e,4));if(e.length>3)return"a range must contain at most three values; received ".concat(g(e,4));let[t,n,r]=e;if(t==null&&n==null)return;if(t!=null&&n==null)return"the first index is set (".concat(g(t),") but the second index is not (").concat(g(n),")");if(t==null&&n!=null)return"the second index is set (".concat(g(n),") but the first index is not (").concat(g(t),")");let i=F(t),o=F(n);if(i===null)return"the first index must be a natural number, zero, or a digit-only numeric string; received ".concat(g(t,4)," (type ").concat(typeof t,")");if(o===null)return"the second index must be a natural number, zero, or a digit-only numeric string; received ".concat(g(n,4)," (type ").concat(typeof n,")");if(ue(r)&&!N(r)&&!Ce(r))return"the third value must be a string, number, null, or undefined; received ".concat(g(r,4)," (type ").concat(typeof r,")");if(i>o)return"the first index (".concat(i,") must not be greater than the second index (").concat(o,")")}function ln(e){if(e.length>3)return{error:"expected at most three arguments but received ".concat(e.length),ranges:[]};if(e.length<=1&&Array.isArray(e[0])){let n=e[0];if(!n.length)return{ranges:[]};e=Array.isArray(n[0])?n:[n]}else e=[e];let t=[];for(let n of e){let r=wt(n);if(r)return{error:r,ranges:[]};let[i,o,l]=n;if(i==null&&o==null)continue;let a=F(i),u=F(o);t.push(l!==void 0&&!(N(l)&&!l.length)?[a,u,l]:[a,u])}return{ranges:t}}function un(e){return e[2]===void 0&&e[0]===e[1]}function _n(e){let t=-1;for(let n=0,r=e.length;n<r;n++){let i=e[n];if(Array.isArray(i)){if(i[0]<t)return!1;t=i[0]}}return!0}var $t=class{constructor(e){G(this,"ranges");G(this,"opts");G(this,"currentCache",null);if(e!=null&&!x(e))throw new TypeError("ranges-push/Ranges/constructor(): [THROW_ID_01] The options argument must be a plain object. It was given as ".concat(g(e,4)," (type ").concat(typeof e,")."));if(e===void 0){this.opts=de,this.ranges=[];return}let t=e,n=t.limitToBeAddedWhitespace===void 0?de.limitToBeAddedWhitespace:t.limitToBeAddedWhitespace,r=t.limitLinebreaksCount===void 0?de.limitLinebreaksCount:t.limitLinebreaksCount,i=t.mergeType===void 0?de.mergeType:t.mergeType,o=i==="1"?1:i==="2"?2:i,l;if(typeof n!="boolean"?l="opts.limitToBeAddedWhitespace must be a boolean; received ".concat(g(n,4)," (type ").concat(typeof n,")"):Z(r)?o!==1&&o!==2&&(l='opts.mergeType must be 1, 2, "1", or "2"; received '.concat(g(i,4)," (type ").concat(typeof i,")")):l="opts.limitLinebreaksCount must be a natural number or zero; received ".concat(g(r,4)," (type ").concat(typeof r,")"),l)throw new TypeError("ranges-push/Ranges/constructor(): [THROW_ID_02] ".concat(l,"."));let a=Object.freeze({limitToBeAddedWhitespace:n,limitLinebreaksCount:r,mergeType:o});this.opts=a,this.ranges=[]}rangeListsMatch(e,t){if(!Array.isArray(e))return t===null;if(!Array.isArray(t)||e.length!==t[0])return!1;let n=1;for(let r=0,i=e.length;r<i;r++){let o=e[r];if(!Array.isArray(o)){if(t[n++]!==-1||o!==t[n++])return!1;continue}if(o.length!==t[n++])return!1;for(let l=0;l<o.length;l++)if(o[l]!==t[n++])return!1}return n===t.length}snapshotRanges(e){if(!Array.isArray(e))return null;let t=new Array(1+e.length*4);t[0]=e.length;let n=1;for(let r=0,i=e.length;r<i;r++){let o=e[r];if(Array.isArray(o)){t[n++]=o.length;for(let l=0;l<o.length;l++)t[n++]=o[l]}else t[n++]=-1,t[n++]=o}return t.length=n,t}currentStateMatchesSnapshot(){let e=this.currentCache;return e!==null&&this.rangeListsMatch(this.ranges,e.rangesSnapshot)&&this.rangeListsMatch(e.result,e.resultSnapshot)}recordCurrentSnapshot(e){let t=this.snapshotRanges(this.ranges);this.currentCache={rangesSnapshot:t,result:e,resultSnapshot:e===this.ranges?t:this.snapshotRanges(e)}}invalidateCurrentCache(){this.currentCache=null}addValidated(e,t,n){this.invalidateCurrentCache();let r=this.last();if(ue(this.ranges)&&Array.isArray(r)&&e===r[1]){if(r[1]=t,n!==void 0&&!(N(n)&&!n.length)){let o=bt(r[2],n,this.opts.mergeType===2&&r[0]===e);this.opts.limitToBeAddedWhitespace&&typeof o=="string"&&(o=fe(o,this.opts.limitLinebreaksCount)),N(o)&&!o.length||(r[2]=o)}return}this.ranges||(this.ranges=[]);let i=n!==void 0?[e,t,typeof n=="string"&&this.opts.limitToBeAddedWhitespace?fe(n,this.opts.limitLinebreaksCount):n]:[e,t];this.ranges.push(i)}add(e,t,n){let r=arguments.length,i;if(r>3)i="expected at most three arguments but received ".concat(r);else if(r===1&&Array.isArray(e)){let o=Array.isArray(e[0])?e:[e];for(let l=0,a=o.length;l<a&&(i=wt(o[l]),!i);l++);if(!i)for(let l=0,a=o.length;l<a;l++){let[u,f,d]=o[l];u==null&&f==null||this.addValidated(F(u),F(f),N(d)&&!d.length?void 0:d)}}else{if(e==null&&t==null)return;if(e!=null&&t==null)i="the first index is set (".concat(g(e),") but the second index is not (").concat(g(t),")");else if(e==null&&t!=null)i="the second index is set (".concat(g(t),") but the first index is not (").concat(g(e),")");else{let o=F(e),l=F(t);o===null?i="the first index must be a natural number, zero, or a digit-only numeric string; received ".concat(g(e,4)," (type ").concat(typeof e,")"):l===null?i="the second index must be a natural number, zero, or a digit-only numeric string; received ".concat(g(t,4)," (type ").concat(typeof t,")"):ue(n)&&!N(n)&&!Ce(n)?i="the third value must be a string, number, null, or undefined; received ".concat(g(n,4)," (type ").concat(typeof n,")"):o>l?i="the first index (".concat(o,") must not be greater than the second index (").concat(l,")"):this.addValidated(o,l,N(n)&&!n.length?void 0:n)}}if(i)throw new TypeError("ranges-push/Ranges/add(): [THROW_ID_03] ".concat(i,"."))}push(e,t,n){this.add.apply(this,arguments)}current(){var e,t;if(this.currentStateMatchesSnapshot())return(t=(e=this.currentCache)==null?void 0:e.result)!=null?t:null;if(Array.isArray(this.ranges)&&this.ranges.length){this.ranges=an(this.ranges,this.opts.mergeType===1?void 0:{mergeType:2});let n=this.ranges;return n&&this.opts.limitToBeAddedWhitespace&&(n=n.map(r=>typeof r[2]=="string"?[r[0],r[1],fe(r[2],this.opts.limitLinebreaksCount)]:r)),this.recordCurrentSnapshot(n),n}return this.recordCurrentSnapshot(null),null}firstCovers(e){if(!Z(e))throw new TypeError("ranges-push/Ranges/firstCovers(): [THROW_ID_04] the input argument must be a natural number or zero! It was given as ".concat(g(e,4)," (type ").concat(typeof e,")"));if(!Array.isArray(this.ranges)||!this.ranges.length)return!1;let t=_n(this.ranges)?this.ranges:this.ranges.filter(r=>Array.isArray(r)).slice().sort((r,i)=>r[0]-i[0]||r[1]-i[1]),n=null;for(let r=0,i=t.length;r<i;r++){let o=t[r];if(!(!Array.isArray(o)||un(o))){if(n===null){if(o[0]!==0)return!1;n=o[1]}else{if(o[0]>n)break;o[1]>n&&(n=o[1])}if(n>=e)return!0}}return n!==null&&n>=e}wipe(){this.ranges=[],this.invalidateCurrentCache()}replace(e){if(Array.isArray(e)&&e.length)if(Array.isArray(e[0])){let t=ln([e]);if(t.error)throw new TypeError("ranges-push/Ranges/replace(): [THROW_ID_06] ".concat(t.error,"."));this.ranges=t.ranges,this.invalidateCurrentCache()}else throw new Error("ranges-push/Ranges/replace(): [THROW_ID_05] Single range was given but we expected array of arrays! The first element, ".concat(g(e[0],4)," should be an array."));else this.ranges=[],this.invalidateCurrentCache()}last(){return Array.isArray(this.ranges)&&this.ranges.length?this.ranges[this.ranges.length-1]:null}};function J(e){return e===32||e>=9&&e<=13||e===160||e===5760||e>=8192&&e<=8202||e===8232||e===8233||e===8239||e===8287||e===12288||e===65279}function vt(e,t){return t==null?0:typeof t!="number"||!Number.isInteger(t)||t<0?null:t>e?e:t}function fn(e,t){return t===-1?-1:vt(e,t)}function At(e,t=0){if(typeof e!="string"||!e.length)return null;let n=fn(e.length,t);if(n===null||n+1>=e.length)return null;let r=n+1;if(!J(e.charCodeAt(r)))return r;if(r+=1,r>=e.length)return null;if(!J(e.charCodeAt(r)))return r;for(r+=1;r<e.length;r++)if(!J(e.charCodeAt(r)))return r;return null}function ce(e,t=0){if(typeof e!="string"||!e.length)return null;let n=vt(e.length,t);if(n===null||n<1)return null;let r=n-1;if(!J(e.charCodeAt(r)))return r;if(r-=1,r<0)return null;if(!J(e.charCodeAt(r)))return r;for(r-=1;r>=0;r--)if(!J(e.charCodeAt(r)))return r;return null}var Tt="4.2.4";var K=" ",Oe="\\0000A0",Re="\\u00A0",Wt="–";var Ct="\\u2013",Et="—";var kt="\\u2014",De=[{heads:"{{",tails:"}}"},{heads:["{% if","{%- if"],tails:["{% endif","{%- endif"]},{heads:["{% for","{%- for"],tails:["{% endfor","{%- endfor"]},{heads:["{%","{%-"],tails:["%}","-%}"]},{heads:"{#",tails:"#}"}],Ot=[{heads:"{{",tails:"}}"}],je=[{heads:["<%","<%=","<%-"],tails:["%>","=%>","-%>"]}],Rt=["abbr","address","area","article","aside","audio","base","bdi","bdo","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","doctype","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","math","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","param","picture","pre","progress","rb","rp","rt","rtc","ruby","samp","script","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","ul","var","video","wbr","xml"];var cn=Tt,St=4,Nt=5,D={removeWidowPreventionMeasures:!1,convertEntities:!0,targetLanguage:"html",UKPostcodes:!1,hyphens:!0,minWordCount:St,minCharCount:Nt,ignore:[],reportProgressFunc:null,reportProgressFuncFrom:0,reportProgressFuncTo:100,tagRanges:[]},gn=Object.freeze(at(U({},D),{ignore:Object.freeze([]),tagRanges:Object.freeze([])})),pn=[Wt,Ct,Et,kt],hn=/[&\\\u00a0\u2013\u2014\r\n<>/0-9-]/;function mn(e,t){var d,h,m,y,_;let n=0,r=0,i,o,l;for(let c=0;c<e.length;c+=1)if(e[c].trim())r+=1,(d=e[c-1])!=null&&d.trim()||(n+=1),i!==void 0&&(o=i,l=c,i=void 0);else if((h=e[c-1])!=null&&h.trim()&&!(((m=e[c-1])==null?void 0:m.toLowerCase())==="r"&&(((y=e[c-2])==null?void 0:y.toLowerCase())==="b"||((_=e[c-2])==null?void 0:_.toLowerCase())==="h"))){let w=c+1;for(;w<e.length&&!e[w].trim();)w+=1;w<e.length&&(i=c)}let a=!1,u=null,f=e;return o!==void 0&&l!==void 0&&n>=St&&r>=Nt&&(a=!0,u=[[o,l,K]],f="".concat(e.slice(0,o)).concat(K).concat(e.slice(l))),{res:f,ranges:u,log:{timeTakenInMilliseconds:Date.now()-t},whatWasDone:{removeWidows:a,convertEntities:!1},applicableOpts:{removeWidows:a,convertEntities:a}}}function yn(e,t){var He,Le,Ve,Be,ze,Ue,qe,Je,Ke,Ge,Qe,Ze,Ye,Xe,et,tt,nt;let n=Date.now();if(typeof e!="string")throw e===void 0?new Error("string-remove-widows/removeWidows(): [THROW_ID_01] the first input argument is completely missing! It should be given as string."):new Error('string-remove-widows/removeWidows(): [THROW_ID_02] the first input argument must be string! It was given as "'.concat(typeof e,'", equal to:\n').concat(g(e,4)));if(t!==void 0&&!x(t))throw new Error("string-remove-widows/removeWidows(): [THROW_ID_03] the second input argument, options object, should be a plain object but it was given as type ".concat(typeof t,", equal to ").concat(g(t,4)));if(t===void 0&&!hn.test(e))return mn(e,n);let r=Array.isArray,i=e.length,o=new $t({mergeType:2}),l=["."],a=.06,u,f,d=0,h=0,m,y,_,c,w,p,A,C=!1,W,T=0,E,L,M,V,$=kn(e,t),Se={removeWidows:!1,convertEntities:!1},B={removeWidows:!1,convertEntities:!1},ge=new Map,ee=new Set;function Ne(s,v){return"".concat(s,":").concat(v)}function I(s,v){if(!$.tagRanges.length||s>=v)return!1;let O=0,P=$.tagRanges.length;for(;O<P;){let S=Math.floor((O+P)/2);$.tagRanges[S][1]<=s?O=S+1:P=S}return!!($.tagRanges[O]&&$.tagRanges[O][0]<v)}function te(s,v){return e.startsWith(s,v)&&!I(v,v+s.length)}let pe=$.reportProgressFuncFrom+Math.floor(($.reportProgressFuncTo-$.reportProgressFuncFrom)*(1-a));function he(s){if(!$.reportProgressFunc)return;let v=Math.max($.reportProgressFuncFrom,Math.min($.reportProgressFuncTo,Math.floor(s)));(f===void 0||v>f)&&(f=v,$.reportProgressFunc(v))}function me(s,v){if(I(s,v))return!1;let O=Q;$.removeWidowPreventionMeasures?O=" ":$.convertEntities&&(O=K,$.targetLanguage==="css"?O=Oe:$.targetLanguage==="js"&&(O=Re));let P=Ne(s,v),S=Y(e,s)===v;return B.removeWidows=!0,S&&($.removeWidowPreventionMeasures?ee.delete(P):ee.add(P)),e.slice(s,v)!==O?(o.push(s,v,O),ge.set(P,S&&O!==" "?"convertEntities":"removeWidows"),!0):!1}function Me(){d=0,h=0,m=void 0,y=void 0,_=void 0,c=void 0,w=void 0,p=void 0,A=void 0,C=!1}Me(),he($.reportProgressFuncFrom);for(let s=0;s<=i;s++){for($.reportProgressFunc&&(u=$.reportProgressFuncFrom+Math.floor((i===0?1:Math.min(s,i)/i)*(pe-$.reportProgressFuncFrom)),he(u));$.tagRanges[T]&&$.tagRanges[T][1]<=s;)T+=1;let v=$.tagRanges[T];if(v&&s>=v[0]&&s<v[1]){let b=E===v[0]||L===v[0]||M!==v[0]&&V!==v[0]&&!((He=e[v[0]-1])!=null&&He.trim());w!==void 0&&s===v[0]&&((Le=e[v[1]])!=null&&Le.trim())&&(m=_,y=c,_=w,c=s),w=void 0,E!==void 0&&E<v[1]&&(E=void 0),M!==void 0&&M<v[1]&&(M=void 0),L!==void 0&&L<v[1]&&(L=void 0),V!==void 0&&V<v[1]&&(V=void 0),(Ve=e[v[1]])!=null&&Ve.trim()&&b&&(L=v[1]),s=v[1]-1;continue}let O=L===s;O&&(L=void 0);let P=V===s;P&&(V=void 0);let S=M===s;S&&(M=void 0),!W&&r($.ignore)&&$.ignore.length&&$.ignore.some((b,k)=>r(b.heads)&&b.heads.some(se=>te(se,s))||typeof b.heads=="string"&&te(b.heads,s)?(w=void 0,d+=1,W=$.ignore[k].tails,!0):!1);let ye=!1;!W&&E!==void 0&&E===s&&(d+=1,A!==void 0&&(C=!0),E=void 0,ye=!0),!W&&s&&((Be=e[s])!=null&&Be.trim())&&!((ze=e[s-1])!=null&&ze.trim())&&w!==void 0&&(m=_,y=c,_=w,c=s,w=void 0);let be=!W&&(e[s]===Q||e[s]==="&"||e[s]==="\\")?Y(e,s):void 0,R=be!==void 0&&!I(s,be)?be:void 0;if(R!==void 0){p=s,A=R,C=!1;let b=Ne(s,R);ee.add(b);let k=$.convertEntities?$.targetLanguage==="css"?"".concat(Oe).concat(Pe(e[R])?" ":""):$.targetLanguage==="js"?Re:K:Q;e.slice(s,R)!==k&&(o.push(s,R,k),ge.set(b,"convertEntities")),e[R]&&!"\r\n".includes(e[R])&&!e[R].trim()&&(M=R),R-s>1&&((Ue=e[R])!=null&&Ue.trim())&&Y(e,R)===void 0&&(E=R),s=R-1;continue}!W&&((qe=e[s])!=null&&qe.trim())&&(h+=1);let we=!W&&(e[s]==="-"||e[s]===We||e[s]===Te||e[s]==="&"||e[s]==="\\")?bn(e,s):void 0,j=we!==void 0&&!I(s,we)?we:void 0;if(j!==void 0){let b=ce(e,s);!ye&&(O||!((Je=e[s-1])!=null&&Je.trim()))&&(d+=1,A!==void 0&&(C=!0));let k=p!==void 0&&A===s&&Y(e,p)===s,se=k&&p!==void 0?p:b===null?s:b+1,Vt=b!==null&&!e.slice(b+1,s).split("").some(ot=>ot==="\r"||ot==="\n"),rt=j<i&&Vt&&!((Ke=e[j])!=null&&Ke.trim())&&(k||!!e[s-1]&&!e[s-1].trim()&&b!==null)&&!I(se,s);rt&&(B.removeWidows=!0),$.hyphens&&rt&&me(se,s),e[s]==="\\"&&Pe(e[j-1])&&(e[j]&&!"\r\n".includes(e[j])&&!e[j].trim()?M=j:(Ge=e[j])!=null&&Ge.trim()&&(V=j)),s=j-1;continue}if(!W&&!ye&&((Qe=e[s])!=null&&Qe.trim())&&(O||!P&&!((Ze=e[s-1])!=null&&Ze.trim()))&&(d+=1,A!==void 0&&(C=!0)),!W&&(!e[s]||"\r\n".includes(e[s])||(e[s]==="\n"||e[s]==="\r"||e[s]==="\r"&&e[s+1]==="\n")&&ce(e,s)&&l.includes(e[ce(e,s)]))){let b,k;_!==void 0&&c!==void 0&&p!==void 0&&A!==void 0&&C?_>p?(b=_,k=c):(b=p,k=A):_!==void 0&&c!==void 0?(b=_,k=c):p!==void 0&&A!==void 0&&C&&(b=p,k=A),(b===void 0||k===void 0)&&m!==void 0&&y!==void 0&&(b=m,k=y),b!==void 0&&k!==void 0&&(!$.minWordCount||d>=$.minWordCount)&&(!$.minCharCount||h>=$.minCharCount)&&(I(b,k)||(B.removeWidows=!0,me(b,k))),Me()}let ne=e.charCodeAt(s-1),re=!W&&e[s]&&!e[s].trim()&&!"\r\n".includes(e[s])&&((Ye=e[s-1])!=null&&Ye.trim())&&(ne>=48&&ne<=57||ne>=65&&ne<=90)?An(e,s):void 0;re!==void 0&&!I(re.tokenStart,re.tokenEnd)&&(B.removeWidows=!0,$.UKPostcodes&&me(s,re.whitespaceEnd));let oe=!W&&e[s]&&!"\r\n".includes(e[s])&&!e[s].trim()&&(S||((Xe=e[s-1])==null?void 0:Xe.trim()))&&w===void 0,ie=oe?At(e,s):null,Ht=oe&&((et=e[s-1])==null?void 0:et.toLowerCase())==="r"&&["b","h"].includes((tt=e[s-2])==null?void 0:tt.toLowerCase()),Lt=oe&&e[s-1]==="<"&&ie!==null&&Rt.some(b=>e.startsWith(b,ie));oe&&ie!==null&&!"/>".includes(e[ie])&&!Ht&&!Lt&&(w=s,(p!==void 0||A!==void 0)&&(p=void 0,A=void 0,C=!1));let z;if(W&&(typeof W=="string"&&te(W,s)?z=W:Array.isArray(W)&&W.some(b=>te(b,s)?(z=b,!0):!1),z!==void 0)){let b=s+z.length;if(z.startsWith("{% end")||z.startsWith("{%- end")){for(;b<i&&!e[b].trim();)b+=1;e.startsWith("-%}",b)?b+=3:e.startsWith("%}",b)&&(b+=2)}if(!I(s,b)){W=void 0;let k=Y(e,b);(nt=e[b])!=null&&nt.trim()&&(k===void 0||I(b,k))&&(E=b),s=b-1}}e[s]&&"\r\n".includes(e[s])&&(d=0,h=0)}let Fe=o.current(),Ft=yt(e,Fe,$.reportProgressFunc?s=>{u=pe+Math.floor(s/100*($.reportProgressFuncTo-pe)),he(u)}:void 0);for(let s of ge.values())Se[s]=!0;return B.convertEntities=B.removeWidows&&!$.removeWidowPreventionMeasures||ee.size>0,{res:Ft,ranges:Fe,log:{timeTakenInMilliseconds:Date.now()-n},whatWasDone:Se,applicableOpts:B}}function Dt(e){return e!==void 0&&/[0-9a-f]/i.test(e)}function Pe(e){return e!==void 0&&" \n\f\r ".includes(e)}function Ie(e,t,n,r){if(e[t]!=="\\"||!Dt(e[t+1]))return;let i=t+1;for(;i<e.length&&i-t<=6&&Dt(e[i]);)i+=1;if(Number.parseInt(e.slice(t+1,i),16)===n)return r&&Pe(e[i])?e[i]==="\r"&&e[i+1]==="\n"?i+2:i+1:i}function Y(e,t){var r,i;let n=e[t];if(n===Q)return t+1;if(n==="&"&&(e.startsWith(K,t)||e.startsWith(" ",t)))return t+6;if(n==="\\")return((r=e[t+1])==null?void 0:r.toLowerCase())==="u"&&e[t+2]==="0"&&e[t+3]==="0"&&((i=e[t+4])==null?void 0:i.toLowerCase())==="a"&&e[t+5]==="0"?t+6:Ie(e,t,160,!0)}function bn(e,t){var r;let n=e[t];if(n==="-"||n===We||n===Te)return t+1;if(n==="&"||n==="\\"){for(let i of pn)if(e.startsWith(i,t))return t+i.length;if(n==="\\")return(r=Ie(e,t,8211,!0))!=null?r:Ie(e,t,8212,!0)}}function jt(e){if(e===void 0)return!1;let t=e.charCodeAt(0);return t>=48&&t<=57||t>=65&&t<=90||t===95||t>=97&&t<=122}var xe=[1632,1641,1776,1785,1984,1993,2406,2415,2534,2543,2662,2671,2790,2799,2918,2927,3046,3055,3174,3183,3302,3311,3430,3439,3558,3567,3664,3673,3792,3801,3872,3881,4160,4169,4240,4249,6112,6121,6160,6169,6470,6479,6608,6617,6784,6793,6800,6809,6992,7001,7088,7097,7232,7241,7248,7257,42528,42537,43216,43225,43264,43273,43472,43481,43504,43513,43600,43609,44016,44025,65296,65305,66720,66729,68912,68921,68928,68937,69734,69743,69872,69881,69942,69951,70096,70105,70384,70393,70736,70745,70864,70873,71248,71257,71360,71369,71376,71395,71472,71481,71904,71913,72016,72025,72688,72697,72784,72793,73040,73049,73120,73129,73184,73193,73552,73561,90416,90425,92768,92777,92864,92873,93008,93017,93552,93561,118e3,118009,120782,120831,123200,123209,123632,123641,124144,124153,124401,124410,125264,125273,130032,130041];function wn(e,t){let n=e.codePointAt(t);return n===void 0?void 0:String.fromCodePoint(n)}function $n(e,t){if(t<=0)return;let n=e.charCodeAt(t-1);return n>=56320&&n<=57343&&t>1?e.slice(t-2,t):e[t-1]}function vn(e){if(e===void 0)return!1;let t=e.codePointAt(0),n=0,r=xe.length/2-1;for(;n<=r;){let i=n+r>>1,o=xe[i*2],l=xe[i*2+1];if(t<o)r=i-1;else if(t>l)n=i+1;else return!0}return!1}function xt(e){return e!==void 0&&(e==="_"||ht(e)||vn(e))}function An(e,t){var a;if(!e[t]||"\r\n".includes(e[t])||e[t].trim()||!((a=e[t-1])!=null&&a.trim()))return;let n=e.charCodeAt(t-1);if(!(n>=48&&n<=57||n>=65&&n<=90))return;let r=t;for(;e[r]&&!e[r].trim()&&!"\r\n".includes(e[r]);)r+=1;if(!e[r])return;let i=e.charCodeAt(r);if(i<48||i>57)return;let o=t-1;for(;o>=0&&jt(e[o]);)o-=1;o+=1;let l=r;for(;l<e.length&&jt(e[l]);)l+=1;if(!(xt($n(e,o))||xt(wn(e,l))))return/^[A-Z]{1,2}[0-9][0-9A-Z]?$/.test(e.slice(o,t))&&/^[0-9][A-Z]{2}$/.test(e.slice(r,l))?{whitespaceEnd:r,tokenStart:o,tokenEnd:l}:void 0}var Tn=["removeWidowPreventionMeasures","convertEntities","targetLanguage","UKPostcodes","hyphens","minWordCount","minCharCount","ignore","reportProgressFunc","reportProgressFuncFrom","reportProgressFuncTo","tagRanges"];function X(e){return{heads:typeof e.heads=="string"?e.heads:[...e.heads],tails:typeof e.tails=="string"?e.tails:[...e.tails]}}function H(e,t){return Object.getOwnPropertyDescriptor(e,t)!==void 0}function Mt(e,t){var n;return((n=Object.getOwnPropertyDescriptor(e,t))==null?void 0:n.enumerable)===!0}function Wn(e){for(let t in e)if(!H(e,t))return t}function Pt(e){if(typeof e=="string")return e.length>0?e:void 0;if(!Array.isArray(e)||e.length===0)return;let t=[];for(let n=0;n<e.length;n+=1){if(!H(e,n))return;let r=e[n];if(typeof r!="string"||r.length===0)return;t.push(r)}return t}function It(e,t){let n=t.trim().toLowerCase();if(!["all","hexo","hugo","jinja","liquid","nunjucks"].includes(n))return'option "ignore" contains an unsupported preset '.concat(JSON.stringify(t),".");n==="all"?e.push(...De.map(X),...je.map(X)):["nunjucks","jinja","liquid"].includes(n)?e.push(...De.map(X)):n==="hugo"?e.push(...Ot.map(X)):e.push(...je.map(X))}function Cn(e){let t=[];if(typeof e=="string"){let n=It(t,e);return n?{ok:!1,kind:"preset",detail:n}:{ok:!0,value:t}}if(!Array.isArray(e))return{ok:!1,kind:"shape",detail:'option "ignore" must be a supported preset or an array of presets and { heads, tails } marker objects, but it was '.concat(g(e,4),".")};for(let n=0;n<e.length;n+=1){if(!H(e,n))return{ok:!1,kind:"shape",detail:'option "ignore" cannot contain sparse entries.'};let r=e[n];if(typeof r=="string"){let u=It(t,r);if(u)return{ok:!1,kind:"preset",detail:u};continue}if(!x(r)||Wn(r)!==void 0||Object.getOwnPropertySymbols(r).some(u=>Mt(r,u)))return{ok:!1,kind:"shape",detail:'option "ignore" contains a malformed marker object.'};let i=Object.keys(r);if(i.length!==2||!i.includes("heads")||!i.includes("tails"))return{ok:!1,kind:"shape",detail:'every custom ignore marker must contain only own "heads" and "tails" keys.'};let o=r,l=Pt(o.heads),a=Pt(o.tails);if(l===void 0||a===void 0)return{ok:!1,kind:"shape",detail:"custom ignore marker heads and tails must be non-empty strings or dense arrays of non-empty strings."};t.push({heads:l,tails:a})}return{ok:!0,value:t}}function En(e,t){if(e===null)return{ok:!0,value:[]};if(!Array.isArray(e))return{ok:!1,kind:"container",detail:'option "tagRanges" must be null or an array of half-open ranges, but it was '.concat(g(e,4),".")};let n=[];for(let i=0;i<e.length;i+=1){if(!H(e,i))return{ok:!1,kind:"range",detail:'option "tagRanges" cannot contain sparse entries.'};let o=e[i];if(!Array.isArray(o)||o.length!==2&&o.length!==3||!H(o,0)||!H(o,1)||o.length===3&&!H(o,2))return{ok:!1,kind:"range",detail:'every "tagRanges" member must be a dense two- or three-item range.'};let l=o[0],a=o[1],u=o.length===3?o[2]:void 0;if(!Number.isInteger(l)||!Number.isInteger(a)||l<0||l>=a||o.length===3&&u!==null&&u!==void 0&&typeof u!="string")return{ok:!1,kind:"range",detail:'every "tagRanges" member must be a non-negative half-open range with integer from/to values and from below to.'};l<t&&n.push([l,Math.min(a,t)])}n.sort((i,o)=>i[0]===o[0]?i[1]-o[1]:i[0]-o[0]);let r=[];for(let i of n){let o=r[r.length-1];o&&i[0]<=o[1]?o[1]=Math.max(o[1],i[1]):r.push(i)}return{ok:!0,value:r}}function kn(e,t){var y,_,c,w,p,A,C,W;if(t===void 0)return D;let n=t!=null?t:{},r=Object.keys(n),i;for(let T in n)if(!H(n,T)){i=T;break}let o=r.find(T=>!Tn.includes(T)),l=Object.getOwnPropertySymbols(n).find(T=>Mt(n,T));if(o!==void 0||i!==void 0||l!==void 0){let T=(y=o!=null?o:i)!=null?y:String(l);throw new TypeError("string-remove-widows/removeWidows(): [THROW_ID_04] every option must be an own, known string key; received ".concat(JSON.stringify(T),"."))}let a=Object.create(null);for(let T of r)a[T]=n[T];for(let T of["removeWidowPreventionMeasures","convertEntities","UKPostcodes","hyphens"])if(T in a&&typeof a[T]!="boolean")throw new TypeError("string-remove-widows/removeWidows(): [THROW_ID_05] option ".concat(JSON.stringify(T)," must be Boolean, but it was ").concat(g(a[T],4),"."));if("targetLanguage"in a&&!["html","css","js"].includes(a.targetLanguage))throw new TypeError('string-remove-widows/removeWidows(): [THROW_ID_06] option "targetLanguage" must be exactly "html", "css", or "js", but it was '.concat(g(a.targetLanguage,4),"."));for(let T of["minWordCount","minCharCount"]){let E=a[T];if(T in a&&E!==!1&&E!==null&&(typeof E!="number"||!Number.isFinite(E)||E<0))throw new TypeError("string-remove-widows/removeWidows(): [THROW_ID_07] option ".concat(JSON.stringify(T)," must be a finite non-negative number, false, or null, but it was ").concat(g(E,4),"."))}let u=Cn("ignore"in a?a.ignore:D.ignore);if(!u.ok)throw u.kind==="shape"?new TypeError("string-remove-widows/removeWidows(): [THROW_ID_08] ".concat(u.detail)):new TypeError("string-remove-widows/removeWidows(): [THROW_ID_09] ".concat(u.detail));let f="reportProgressFunc"in a?a.reportProgressFunc:D.reportProgressFunc;if(f!==!1&&f!==null&&typeof f!="function")throw new TypeError('string-remove-widows/removeWidows(): [THROW_ID_10] option "reportProgressFunc" must be a function, false, or null, but it was '.concat(g(f,4),"."));for(let T of["reportProgressFuncFrom","reportProgressFuncTo"]){let E=T in a?a[T]:D[T];if(typeof E!="number"||!Number.isInteger(E)||E<0||E>100)throw new TypeError("string-remove-widows/removeWidows(): [THROW_ID_11] option ".concat(JSON.stringify(T)," must be an integer from 0 through 100, but it was ").concat(g(E,4),"."))}let d=(_=a.reportProgressFuncFrom)!=null?_:D.reportProgressFuncFrom,h=(c=a.reportProgressFuncTo)!=null?c:D.reportProgressFuncTo;if(d>h)throw new RangeError('string-remove-widows/removeWidows(): [THROW_ID_12] option "reportProgressFuncFrom" ('.concat(d,') must not exceed "reportProgressFuncTo" (').concat(h,")."));let m=En("tagRanges"in a?a.tagRanges:[],e.length);if(!m.ok)throw m.kind==="container"?new TypeError("string-remove-widows/removeWidows(): [THROW_ID_13] ".concat(m.detail)):new TypeError("string-remove-widows/removeWidows(): [THROW_ID_14] ".concat(m.detail));return{removeWidowPreventionMeasures:(w=a.removeWidowPreventionMeasures)!=null?w:D.removeWidowPreventionMeasures,convertEntities:(p=a.convertEntities)!=null?p:D.convertEntities,targetLanguage:(A=a.targetLanguage)!=null?A:D.targetLanguage,UKPostcodes:(C=a.UKPostcodes)!=null?C:D.UKPostcodes,hyphens:(W=a.hyphens)!=null?W:D.hyphens,minWordCount:"minWordCount"in a?a.minWordCount:D.minWordCount,minCharCount:"minCharCount"in a?a.minCharCount:D.minCharCount,ignore:u.value,reportProgressFunc:typeof f=="function"?f:null,reportProgressFuncFrom:d,reportProgressFuncTo:h,tagRanges:m.value}}return Qt(On);})();
|
|
11
11
|
/**
|
|
12
12
|
* @name codsen-format-diagnostic-value
|
|
13
13
|
* @fileoverview Safely format untrusted JavaScript values for diagnostics
|
|
14
|
-
* @version 1.1.
|
|
14
|
+
* @version 1.1.1
|
|
15
15
|
* @author Roy Revelt
|
|
16
16
|
* @license MIT
|
|
17
17
|
* {@link https://codsen.com/os/codsen-format-diagnostic-value/}
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
/**
|
|
20
20
|
* @name codsen-utils
|
|
21
21
|
* @fileoverview Various utility functions
|
|
22
|
-
* @version 1.10.
|
|
22
|
+
* @version 1.10.1
|
|
23
23
|
* @author Roy Revelt
|
|
24
24
|
* @license MIT
|
|
25
25
|
* {@link https://codsen.com/os/codsen-utils/}
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
/**
|
|
28
28
|
* @name ranges-sort
|
|
29
29
|
* @fileoverview Sort string index ranges
|
|
30
|
-
* @version 6.2.
|
|
30
|
+
* @version 6.2.3
|
|
31
31
|
* @author Roy Revelt
|
|
32
32
|
* @license MIT
|
|
33
33
|
* {@link https://codsen.com/os/ranges-sort/}
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
/**
|
|
36
36
|
* @name ranges-merge
|
|
37
37
|
* @fileoverview Merge and sort string index ranges
|
|
38
|
-
* @version 9.2.
|
|
38
|
+
* @version 9.2.4
|
|
39
39
|
* @author Roy Revelt
|
|
40
40
|
* @license MIT
|
|
41
41
|
* {@link https://codsen.com/os/ranges-merge/}
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
/**
|
|
44
44
|
* @name ranges-apply
|
|
45
45
|
* @fileoverview Take an array of string index ranges, delete/replace the string according to them
|
|
46
|
-
* @version 7.2.
|
|
46
|
+
* @version 7.2.4
|
|
47
47
|
* @author Roy Revelt
|
|
48
48
|
* @license MIT
|
|
49
49
|
* {@link https://codsen.com/os/ranges-apply/}
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
/**
|
|
52
52
|
* @name string-collapse-leading-whitespace
|
|
53
53
|
* @fileoverview Collapse the leading and trailing whitespace of a string
|
|
54
|
-
* @version 7.3.
|
|
54
|
+
* @version 7.3.1
|
|
55
55
|
* @author Roy Revelt
|
|
56
56
|
* @license MIT
|
|
57
57
|
* {@link https://codsen.com/os/string-collapse-leading-whitespace/}
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
/**
|
|
60
60
|
* @name ranges-push
|
|
61
61
|
* @fileoverview Gather string index ranges
|
|
62
|
-
* @version 7.3.
|
|
62
|
+
* @version 7.3.1
|
|
63
63
|
* @author Roy Revelt
|
|
64
64
|
* @license MIT
|
|
65
65
|
* {@link https://codsen.com/os/ranges-push/}
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
/**
|
|
68
68
|
* @name string-left-right
|
|
69
69
|
* @fileoverview Looks up the first non-whitespace character to the left/right of a given index
|
|
70
|
-
* @version 6.2.
|
|
70
|
+
* @version 6.2.3
|
|
71
71
|
* @author Roy Revelt
|
|
72
72
|
* @license MIT
|
|
73
73
|
* {@link https://codsen.com/os/string-left-right/}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "string-remove-widows",
|
|
3
|
-
"version": "4.2.
|
|
3
|
+
"version": "4.2.4",
|
|
4
4
|
"description": "Helps to prevent widow words in a text",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"against",
|
|
@@ -71,13 +71,13 @@
|
|
|
71
71
|
}
|
|
72
72
|
},
|
|
73
73
|
"dependencies": {
|
|
74
|
-
"codsen-utils": "^1.10.
|
|
75
|
-
"ranges-apply": "^7.2.
|
|
76
|
-
"ranges-push": "^7.3.
|
|
77
|
-
"string-left-right": "^6.2.
|
|
74
|
+
"codsen-utils": "^1.10.1",
|
|
75
|
+
"ranges-apply": "^7.2.4",
|
|
76
|
+
"ranges-push": "^7.3.1",
|
|
77
|
+
"string-left-right": "^6.2.3"
|
|
78
78
|
},
|
|
79
79
|
"devDependencies": {
|
|
80
|
-
"string-strip-html": "^13.7.
|
|
80
|
+
"string-strip-html": "^13.7.1"
|
|
81
81
|
},
|
|
82
82
|
"engines": {
|
|
83
83
|
"node": ">=18.20.8"
|