string-remove-widows 4.2.1 → 4.2.3

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/CHANGELOG.md CHANGED
@@ -3,13 +3,27 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## 4.2.3 (2026-09-01)
7
+
8
+ ### Bug Fixes
9
+
10
+ - align adjacent range value merging ([a812fd7](https://github.com/codsen/codsen/commit/a812fd7c5569a08a20b460519cf191bb32f0d011))
11
+ - align range input and output types ([1a13db6](https://github.com/codsen/codsen/commit/1a13db665fe2f9e77c6b5fd509980c87e5a57baf))
12
+ - **string-remove-widows:** preserve text and API contracts ([3bba0cf](https://github.com/codsen/codsen/commit/3bba0cffdbcc140f76bec09fa124e230f43fe07d))
13
+
14
+ ## 4.2.2 (2026-08-22)
15
+
16
+ ### Performance Improvements
17
+
18
+ - optimise package hot paths and JSON editing ([f3112bd](https://github.com/codsen/codsen/commit/f3112bd7fc0d7c9bc09312d3744c950691d72ca5))
19
+
6
20
  ## 4.2.0 (2026-08-19)
7
21
 
8
22
  ### Bug Fixes
9
23
 
10
24
  - make validation diagnostics safe ([7b01074](https://github.com/codsen/codsen/commit/7b0107476f12734aeb8e82852ba980b187280110))
11
25
  - require a plain options object ([99991b2](https://github.com/codsen/codsen/commit/99991b2833d83c55a787aabd3365c25c63f6fb40))
12
- - resolve review findings REV-004 through REV-007 ([b60e9ee](https://github.com/codsen/codsen/commit/b60e9eeb499af94685cfb87b4970fe025be1fc10))
26
+ - resolve various review findings ([b60e9ee](https://github.com/codsen/codsen/commit/b60e9eeb499af94685cfb87b4970fe025be1fc10))
13
27
  - retire direct publish aliases ([f98e31e](https://github.com/codsen/codsen/commit/f98e31eb89bc185471225664e610b55f34fbf648))
14
28
 
15
29
  ### Features
@@ -1,15 +1,24 @@
1
1
  /**
2
2
  * @name string-remove-widows
3
3
  * @fileoverview Helps to prevent widow words in a text
4
- * @version 4.2.1
4
+ * @version 4.2.3
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 q,isPlainObject as X,rawMDash as ee,rawNbsp as w,rawNDash as te}from"codsen-utils";import{rApply as G}from"ranges-apply";import{Ranges as oe}from"ranges-push";import{left as N,right as D}from"string-left-right";import{matchRightIncl as ne}from"string-match-left-right";var F="4.2.1";var f="&nbsp;",E="\\00A0",S="\\u00A0",R="&ndash;",M="\\2013",k="\\u2013",U="&mdash;",J="\\2014",I="\\u2014",C=[{heads:"{{",tails:"}}"},{heads:["{% if","{%- if"],tails:["{% endif","{%- endif"]},{heads:["{% for","{%- for"],tails:["{% endfor","{%- endfor"]},{heads:["{%","{%-"],tails:["%}","-%}"]},{heads:"{#",tails:"#}"}],B=[{heads:"{{",tails:"}}"}],P=[{heads:["<%","<%=","<%-"],tails:["%>","=%>","-%>"]}],_=["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 ge=F,se={removeWidowPreventionMeasures:!1,convertEntities:!0,targetLanguage:"html",UKPostcodes:!1,hyphens:!0,minWordCount:4,minCharCount:5,ignore:[],reportProgressFunc:null,reportProgressFuncFrom:0,reportProgressFuncTo:100,tagRanges:[]};function be(t,h){let K=Date.now();if(typeof t!="string")throw t===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 t}", equal to:
11
- ${q(t,4)}`);if(h&&!X(h))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 h}, equal to ${q(h,4)}`);let b=Array.isArray,L=t.length,a=new oe({mergeType:2}),Z=["."],Y=/[A-Z]{1,2}[0-9][0-9A-Z]?$/,z=/^[0-9][A-Z]{2}/,v=.06,$,W=0,g=0,A=0,y,T,l,c,r,d,s,p,o={...se,...h},m={removeWidows:!1,convertEntities:!1};if(!o.ignore||!b(o.ignore)&&typeof o.ignore!="string")o.ignore=[];else if(typeof o.ignore=="string"&&(o.ignore=[o.ignore]),o.ignore.includes("all"))o.ignore=o.ignore.concat(C.concat(P));else if(o.ignore.some(e=>typeof e=="string")){let e=[];o.ignore=o.ignore.filter(i=>typeof i=="string"&&i.length?(["nunjucks","jinja","liquid"].includes(i.trim().toLowerCase())?e=e.concat(C):["hugo"].includes(i.trim().toLowerCase())?e=e.concat(B):["hexo"].includes(i.trim().toLowerCase())&&(e=e.concat(P)),!1):typeof i=="object"),e.length&&(o.ignore=o.ignore.concat(e))}let x;o.reportProgressFunc&&(x=Math.floor(o.reportProgressFuncTo-(o.reportProgressFuncTo-o.reportProgressFuncFrom)*v-o.reportProgressFuncFrom));function V(e,i){let n=w;o.removeWidowPreventionMeasures?n=" ":o.convertEntities&&(n=f,typeof o.targetLanguage=="string"&&(o.targetLanguage.trim().toLowerCase()==="css"?n=E:o.targetLanguage.trim().toLowerCase()==="js"&&(n=S))),t.slice(e,i)!==n&&a.push(e,i,n)}function O(){g=0,A=0,y=void 0,T=void 0,l=void 0,c=void 0,r=void 0,d=void 0}O();for(let e=0;e<=L;e++){if(!s&&b(o.ignore)&&o.ignore.length&&o.ignore.some((n,u)=>b(n.heads)&&n.heads.some(j=>t.startsWith(j,e))||typeof n.heads=="string"&&t.startsWith(n.heads,e)?(g+=1,s=o.ignore[u].tails,!0):!1),!s&&p&&p===e&&(g+=1,p=void 0),typeof o.reportProgressFunc=="function"&&($=o.reportProgressFuncFrom+Math.floor(e/L*(x||1)),$!==W&&(W=$,o.reportProgressFunc($))),!s&&e&&t[e]?.trim()&&(!t[e-1]||t[e-1]&&!t[e-1].trim())&&(c=e),!s&&t[e]?.trim()&&(A+=1),!s&&o.hyphens&&(`-${ee}${te}`.includes(t[e])||t.startsWith(R,e)||t.startsWith(M,e)||t.startsWith(k,e)||t.startsWith(U,e)||t.startsWith(J,e)||t.startsWith(I,e))&&t[e+1]&&(!t[e+1].trim()||t[e]==="&")&&t[e-1]&&!t[e-1].trim()&&t[N(t,e)]&&(V(N(t,e)+1,e),m.removeWidows=!0),!s&&(t.startsWith("&nbsp;",e)||t.startsWith("&#160;",e))&&(r=e,d=e+6,t[e+6]?.trim()&&(p=e+6),o.convertEntities?(o.targetLanguage==="css"||o.targetLanguage==="js")&&(a.push(e,e+6,o.targetLanguage==="css"?E:S),m.convertEntities=!0):(a.push(e,e+6,w),m.convertEntities=!0)),!s&&t[e+4]&&t[e]==="\\"&&t[e+1]==="0"&&t[e+2]==="0"&&t[e+3].toUpperCase()==="A"&&t[e+4]==="0"&&(r=e,d=e+5,t[e+5]?.trim()&&(p=e+5),o.convertEntities?(o.targetLanguage==="html"||o.targetLanguage==="js")&&(a.push(e,e+5,o.targetLanguage==="html"?f:S),m.convertEntities=!0):(a.push(e,e+5,w),m.convertEntities=!0)),!s&&t[e]==="\\"&&t[e+1]?.toLowerCase()==="u"&&t[e+2]==="0"&&t[e+3]==="0"&&t[e+4]?.toUpperCase()==="A"&&t[e+5]==="0"&&(r=e,d=e+6,t[e+6]?.trim()&&(p=e+6),o.convertEntities?(o.targetLanguage==="html"||o.targetLanguage==="css")&&a.push(e,e+6,o.targetLanguage==="html"?f:E):a.push(e,e+6,w)),!s&&t[e]===w&&(r=e,d=e+1,o.convertEntities&&a.push(e,e+1,o.targetLanguage==="css"?E:o.targetLanguage==="js"?S:f)),!s&&t[e]?.trim()&&!t[e-1]?.trim()&&(g+=1),!s&&(!t[e]||`\r
12
- `.includes(t[e])||(t[e]===`
13
- `||t[e]==="\r"||t[e]==="\r"&&t[e+1]===`
14
- `)&&N(t,e)&&Z.includes(t[N(t,e)]))){if((!o.minWordCount||g>=o.minWordCount)&&(!o.minCharCount||A>=o.minCharCount)){let n,u;l!==void 0&&c!==void 0&&r!==void 0&&d!==void 0?l>r?(n=l,u=c):(n=r,u=d):l!==void 0&&c!==void 0?(n=l,u=c):r!==void 0&&d!==void 0&&(n=r,u=d),!(n&&u)&&y&&T&&(n=y,u=T),n&&u&&(V(n,u),m.removeWidows=!0)}O()}o.UKPostcodes&&t[e]&&!t[e].trim()&&t[e-1]?.trim()&&Y.test(t.slice(0,e))&&t[D(t,e)]&&z.test(t.slice(D(t,e)))&&(V(e,D(t,e)),m.removeWidows=!0),!s&&t[e]&&!t[e].trim()&&t[e-1]?.trim()&&(l===void 0||t[l-1]?.trim())&&!"/>".includes(t[D(t,e)])&&!t.slice(0,e).trim().endsWith("br")&&!t.slice(0,e).trim().endsWith("hr")&&!(t.slice(0,e).endsWith("<")&&_.some(n=>t.startsWith(n,D(t,e))))&&(y=l,T=c,l=e,c=void 0,(r!==void 0||d!==void 0)&&(r=void 0,d=void 0));let i;s&&(typeof s=="string"&&(!s.length||t.startsWith(s,e))?s=void 0:b(s)&&(!s.length||s.some(n=>t.startsWith(n,e)?(i=n,!0):!1))&&(s=void 0,e+=i.length,b(o.ignore)&&o.ignore.length&&t[e+1]&&o.ignore.some(n=>ne(t,e,n.tails,{trimBeforeMatching:!0,cb:(u,j,H)=>(H&&(e=H-1,t[e+1]?.trim()&&(g+=1)),!0)})))),t[e]&&`\r
15
- `.includes(t[e])&&(g=0,A=0),b(o.tagRanges)&&o.tagRanges.length&&o.tagRanges.some(n=>e>=n[0]&&e<=n[1]&&n[1]-1>e?(e=n[1]-1,!0):!1)}return G(t,a.current()).split("").forEach((e,i)=>{}),{res:G(t,a.current(),o.reportProgressFunc?e=>{$=Math.floor((o.reportProgressFuncTo-o.reportProgressFuncFrom)*(1-v)+e/100*(o.reportProgressFuncTo-o.reportProgressFuncFrom)*v),$!==W&&(W=$,o.reportProgressFunc($))}:void 0),ranges:a.current(),log:{timeTakenInMilliseconds:Date.now()-K},whatWasDone:m}}export{se as defaults,be as removeWidows,ge as version};
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.3";var L="&nbsp;",ie="\\0000A0",de="\\u00A0",ve="&ndash;";var Ee="\\u2013",We="&mdash;";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
+ ${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
+ `.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
+ `),$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
14
+ `.includes(e[T])&&!e[T].trim()?j=T:e[T]?.trim()&&(V=T)),n=T-1;continue}if(!b&&!oe&&e[n]?.trim()&&($||!A&&!e[n-1]?.trim())&&(m+=1,k!==void 0&&(S=!0)),!b&&(!e[n]||`\r
15
+ `.includes(e[n])||(e[n]===`
16
+ `||e[n]==="\r"||e[n]==="\r"&&e[n+1]===`
17
+ `)&&le(e,n)&&f.includes(e[le(e,n)]))){let d,h;g!==void 0&&D!==void 0&&W!==void 0&&k!==void 0&&S?g>W?(d=g,h=D):(d=W,h=k):g!==void 0&&D!==void 0?(d=g,h=D):W!==void 0&&k!==void 0&&S&&(d=W,h=k),(d===void 0||h===void 0)&&P!==void 0&&c!==void 0&&(d=P,h=c),d!==void 0&&h!==void 0&&(!u.minWordCount||m>=u.minWordCount)&&(!u.minCharCount||E>=u.minCharCount)&&(O(d,h)||(H.removeWidows=!0,te(d,h))),he()}let z=e.charCodeAt(n-1),q=!b&&e[n]&&!e[n].trim()&&!`\r
18
+ `.includes(e[n])&&e[n-1]?.trim()&&(z>=48&&z<=57||z>=65&&z<=90)?en(e,n):void 0;q!==void 0&&!O(q.tokenStart,q.tokenEnd)&&(H.removeWidows=!0,u.UKPostcodes&&te(n,q.whitespaceEnd));let G=!b&&e[n]&&!`\r
19
+ `.includes(e[n])&&!e[n].trim()&&(N||e[n-1]?.trim())&&C===void 0,Z=G?Be(e,n):null,He=G&&e[n-1]?.toLowerCase()==="r"&&["b","h"].includes(e[n-2]?.toLowerCase()),xe=G&&e[n-1]==="<"&&Z!==null&&Te.some(d=>e.startsWith(d,Z));G&&Z!==null&&!"/>".includes(e[Z])&&!He&&!xe&&(C=n,(W!==void 0||k!==void 0)&&(W=void 0,k=void 0,S=!1));let x;if(b&&(typeof b=="string"&&B(b,n)?x=b:Array.isArray(b)&&b.some(d=>B(d,n)?(x=d,!0):!1),x!==void 0)){let d=n+x.length;if(x.startsWith("{% end")||x.startsWith("{%- end")){for(;d<r&&!e[d].trim();)d+=1;e.startsWith("-%}",d)?d+=3:e.startsWith("%}",d)&&(d+=2)}if(!O(n,d)){b=void 0;let h=_(e,d);e[d]?.trim()&&(h===void 0||O(d,h))&&(R=d),n=d-1}}e[n]&&`\r
20
+ `.includes(e[n])&&(m=0,E=0)}let be=s.current(),Ve=Je(e,be,u.reportProgressFunc?n=>{p=ee+Math.floor(n/100*(u.reportProgressFuncTo-ee)),ne(p)}:void 0);for(let n of X.values())ge[n]=!0;return H.convertEntities=H.removeWidows&&!u.removeWidowPreventionMeasures||K.size>0,{res:Ve,ranges:be,log:{timeTakenInMilliseconds:Date.now()-o},whatWasDone:ge,applicableOpts:H}}function Ce(e){return e!==void 0&&/[0-9a-f]/i.test(e)}function fe(e){return e!==void 0&&`
21
+ \f\r `.includes(e)}function me(e,t,o,i){if(e[t]!=="\\"||!Ce(e[t+1]))return;let r=t+1;for(;r<e.length&&r-t<=6&&Ce(e[r]);)r+=1;if(Number.parseInt(e.slice(t+1,r),16)===o)return i&&fe(e[r])?e[r]==="\r"&&e[r+1]===`
22
+ `?r+2:r+1:r}function _(e,t){let o=e[t];if(o===Q)return t+1;if(o==="&"&&(e.startsWith(L,t)||e.startsWith("&#160;",t)))return t+6;if(o==="\\")return e[t+1]?.toLowerCase()==="u"&&e[t+2]==="0"&&e[t+3]==="0"&&e[t+4]?.toLowerCase()==="a"&&e[t+5]==="0"?t+6:me(e,t,160,!0)}function Ze(e,t){let o=e[t];if(o==="-"||o===Fe||o===Se)return t+1;if(o==="&"||o==="\\"){for(let i of ze)if(e.startsWith(i,t))return t+i.length;if(o==="\\")return me(e,t,8211,!0)??me(e,t,8212,!0)}}function Ae(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 ce=[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 Ye(e,t){let o=e.codePointAt(t);return o===void 0?void 0:String.fromCodePoint(o)}function Qe(e,t){if(t<=0)return;let o=e.charCodeAt(t-1);return o>=56320&&o<=57343&&t>1?e.slice(t-2,t):e[t-1]}function Xe(e){if(e===void 0)return!1;let t=e.codePointAt(0),o=0,i=ce.length/2-1;for(;o<=i;){let r=o+i>>1,s=ce[r*2],f=ce[r*2+1];if(t<s)i=r-1;else if(t>f)o=r+1;else return!0}return!1}function De(e){return e!==void 0&&(e==="_"||Ue(e)||Xe(e))}function en(e,t){if(!e[t]||`\r
23
+ `.includes(e[t])||e[t].trim()||!e[t-1]?.trim())return;let o=e.charCodeAt(t-1);if(!(o>=48&&o<=57||o>=65&&o<=90))return;let i=t;for(;e[i]&&!e[i].trim()&&!`\r
24
+ `.includes(e[i]);)i+=1;if(!e[i])return;let r=e.charCodeAt(i);if(r<48||r>57)return;let s=t-1;for(;s>=0&&Ae(e[s]);)s-=1;s+=1;let f=i;for(;f<e.length&&Ae(e[f]);)f+=1;if(!(De(Qe(e,s))||De(Ye(e,f))))return/^[A-Z]{1,2}[0-9][0-9A-Z]?$/.test(e.slice(s,t))&&/^[0-9][A-Z]{2}$/.test(e.slice(i,f))?{whitespaceEnd:i,tokenStart:s,tokenEnd:f}:void 0}var nn=["removeWidowPreventionMeasures","convertEntities","targetLanguage","UKPostcodes","hyphens","minWordCount","minCharCount","ignore","reportProgressFunc","reportProgressFuncFrom","reportProgressFuncTo","tagRanges"];function U(e){return{heads:typeof e.heads=="string"?e.heads:[...e.heads],tails:typeof e.tails=="string"?e.tails:[...e.tails]}}function M(e,t){return Object.getOwnPropertyDescriptor(e,t)!==void 0}function Ie(e,t){return Object.getOwnPropertyDescriptor(e,t)?.enumerable===!0}function tn(e){for(let t in e)if(!M(e,t))return t}function Re(e){if(typeof e=="string")return e.length>0?e:void 0;if(!Array.isArray(e)||e.length===0)return;let t=[];for(let o=0;o<e.length;o+=1){if(!M(e,o))return;let i=e[o];if(typeof i!="string"||i.length===0)return;t.push(i)}return t}function Oe(e,t){let o=t.trim().toLowerCase();if(!["all","hexo","hugo","jinja","liquid","nunjucks"].includes(o))return`option "ignore" contains an unsupported preset ${JSON.stringify(t)}.`;o==="all"?e.push(...ae.map(U),...ue.map(U)):["nunjucks","jinja","liquid"].includes(o)?e.push(...ae.map(U)):o==="hugo"?e.push(...Pe.map(U)):e.push(...ue.map(U))}function on(e){let t=[];if(typeof e=="string"){let o=Oe(t,e);return o?{ok:!1,kind:"preset",detail:o}:{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 ${F(e,4)}.`};for(let o=0;o<e.length;o+=1){if(!M(e,o))return{ok:!1,kind:"shape",detail:'option "ignore" cannot contain sparse entries.'};let i=e[o];if(typeof i=="string"){let p=Oe(t,i);if(p)return{ok:!1,kind:"preset",detail:p};continue}if(!Ne(i)||tn(i)!==void 0||Object.getOwnPropertySymbols(i).some(p=>Ie(i,p)))return{ok:!1,kind:"shape",detail:'option "ignore" contains a malformed marker object.'};let r=Object.keys(i);if(r.length!==2||!r.includes("heads")||!r.includes("tails"))return{ok:!1,kind:"shape",detail:'every custom ignore marker must contain only own "heads" and "tails" keys.'};let s=i,f=Re(s.heads),a=Re(s.tails);if(f===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:f,tails:a})}return{ok:!0,value:t}}function rn(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 ${F(e,4)}.`};let o=[];for(let r=0;r<e.length;r+=1){if(!M(e,r))return{ok:!1,kind:"range",detail:'option "tagRanges" cannot contain sparse entries.'};let s=e[r];if(!Array.isArray(s)||s.length!==2&&s.length!==3||!M(s,0)||!M(s,1)||s.length===3&&!M(s,2))return{ok:!1,kind:"range",detail:'every "tagRanges" member must be a dense two- or three-item range.'};let f=s[0],a=s[1],p=s.length===3?s[2]:void 0;if(!Number.isInteger(f)||!Number.isInteger(a)||f<0||f>=a||s.length===3&&p!==null&&p!==void 0&&typeof p!="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.'};f<t&&o.push([f,Math.min(a,t)])}o.sort((r,s)=>r[0]===s[0]?r[1]-s[1]:r[0]-s[0]);let i=[];for(let r of o){let s=i[i.length-1];s&&r[0]<=s[1]?s[1]=Math.max(s[1],r[1]):i.push(r)}return{ok:!0,value:i}}function sn(e,t){if(t===void 0)return y;let o=t??{},i=Object.keys(o),r;for(let c in o)if(!M(o,c)){r=c;break}let s=i.find(c=>!nn.includes(c)),f=Object.getOwnPropertySymbols(o).find(c=>Ie(o,c));if(s!==void 0||r!==void 0||f!==void 0){let c=s??r??String(f);throw new TypeError(`string-remove-widows/removeWidows(): [THROW_ID_04] every option must be an own, known string key; received ${JSON.stringify(c)}.`)}let a=Object.create(null);for(let c of i)a[c]=o[c];for(let c of["removeWidowPreventionMeasures","convertEntities","UKPostcodes","hyphens"])if(c in a&&typeof a[c]!="boolean")throw new TypeError(`string-remove-widows/removeWidows(): [THROW_ID_05] option ${JSON.stringify(c)} must be Boolean, but it was ${F(a[c],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 ${F(a.targetLanguage,4)}.`);for(let c of["minWordCount","minCharCount"]){let g=a[c];if(c in a&&g!==!1&&g!==null&&(typeof g!="number"||!Number.isFinite(g)||g<0))throw new TypeError(`string-remove-widows/removeWidows(): [THROW_ID_07] option ${JSON.stringify(c)} must be a finite non-negative number, false, or null, but it was ${F(g,4)}.`)}let p=on("ignore"in a?a.ignore:y.ignore);if(!p.ok)throw p.kind==="shape"?new TypeError(`string-remove-widows/removeWidows(): [THROW_ID_08] ${p.detail}`):new TypeError(`string-remove-widows/removeWidows(): [THROW_ID_09] ${p.detail}`);let v="reportProgressFunc"in a?a.reportProgressFunc:y.reportProgressFunc;if(v!==!1&&v!==null&&typeof v!="function")throw new TypeError(`string-remove-widows/removeWidows(): [THROW_ID_10] option "reportProgressFunc" must be a function, false, or null, but it was ${F(v,4)}.`);for(let c of["reportProgressFuncFrom","reportProgressFuncTo"]){let g=c in a?a[c]:y[c];if(typeof g!="number"||!Number.isInteger(g)||g<0||g>100)throw new TypeError(`string-remove-widows/removeWidows(): [THROW_ID_11] option ${JSON.stringify(c)} must be an integer from 0 through 100, but it was ${F(g,4)}.`)}let m=a.reportProgressFuncFrom??y.reportProgressFuncFrom,E=a.reportProgressFuncTo??y.reportProgressFuncTo;if(m>E)throw new RangeError(`string-remove-widows/removeWidows(): [THROW_ID_12] option "reportProgressFuncFrom" (${m}) must not exceed "reportProgressFuncTo" (${E}).`);let P=rn("tagRanges"in a?a.tagRanges:[],e.length);if(!P.ok)throw P.kind==="container"?new TypeError(`string-remove-widows/removeWidows(): [THROW_ID_13] ${P.detail}`):new TypeError(`string-remove-widows/removeWidows(): [THROW_ID_14] ${P.detail}`);return{removeWidowPreventionMeasures:a.removeWidowPreventionMeasures??y.removeWidowPreventionMeasures,convertEntities:a.convertEntities??y.convertEntities,targetLanguage:a.targetLanguage??y.targetLanguage,UKPostcodes:a.UKPostcodes??y.UKPostcodes,hyphens:a.hyphens??y.hyphens,minWordCount:"minWordCount"in a?a.minWordCount:y.minWordCount,minCharCount:"minCharCount"in a?a.minCharCount:y.minCharCount,ignore:p.value,reportProgressFunc:typeof v=="function"?v:null,reportProgressFuncFrom:m,reportProgressFuncTo:E,tagRanges:P.value}}export{hn as defaults,bn as removeWidows,pn as version};
@@ -1,17 +1,25 @@
1
1
  /**
2
2
  * @name string-remove-widows
3
3
  * @fileoverview Helps to prevent widow words in a text
4
- * @version 4.2.1
4
+ * @version 4.2.3
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 U=Object.defineProperty;var Fe=Object.getOwnPropertyDescriptor;var ke=Object.getOwnPropertyNames,me=Object.getOwnPropertySymbols;var $e=Object.prototype.hasOwnProperty,He=Object.prototype.propertyIsEnumerable;var K=(e,t,n)=>t in e?U(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,W=(e,t)=>{for(var n in t||(t={}))$e.call(t,n)&&K(e,n,t[n]);if(me)for(var n of me(t))He.call(t,n)&&K(e,n,t[n]);return e};var Pe=(e,t)=>{for(var n in t)U(e,n,{get:t[n],enumerable:!0})},Be=(e,t,n,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let u of ke(t))!$e.call(e,u)&&u!==n&&U(e,u,{get:()=>t[u],enumerable:!(s=Fe(t,u))||s.enumerable});return e};var Ue=e=>Be(U({},"__esModule",{value:!0}),e);var F=(e,t,n)=>K(e,typeof t!="symbol"?t+"":t,n);var ut={};Pe(ut,{defaults:()=>_e,removeWidows:()=>lt,version:()=>at});function qe(){let e=[],t=0,n=!1;return{append(s){return n?!1:t+s.length>1999?(e.push("\u2026"),t+=1,n=!0,!1):(e.push(s),t+=s.length,!0)},result(){return e.join("")},stopped(){return n}}}function Je(e){return"\\u".concat(e.toString(16).padStart(4,"0"))}function q(e,t){if(e.append('"')){for(let n=0;n<t.length&&!e.stopped();n+=1){let s=t.charCodeAt(n);s===34?e.append('\\"'):s===92?e.append("\\\\"):s===8?e.append("\\b"):s===9?e.append("\\t"):s===10?e.append("\\n"):s===12?e.append("\\f"):s===13?e.append("\\r"):s<32||s===8232||s===8233||s>=55296&&s<=57343?e.append(Je(s)):e.append(t[n])}e.append('"')}}function Ge(e){return e.get&&e.set?"[Getter/Setter]":e.get?"[Getter]":e.set?"[Setter]":"[Accessor]"}function ye(e,t){e.append("Symbol(");let n=String(t);n.length>8&&q(e,n.slice(7,-1)),e.append(")")}function be(e,t){typeof t=="symbol"?ye(e,t):q(e,String(t))}function $(e,t=0){let n=qe(),s=t===4?4:0,u=new WeakSet,r=0;function g(a){s&&n.append(" ".repeat(a*s))}function l(a,p){a&&n.append(","),s&&(n.append("\n"),g(p+1))}function c(a,p,w){s&&p&&(n.append("\n"),g(w)),n.append(a)}function i(a,p){Object.prototype.hasOwnProperty.call(a,"value")?h(a.value,p):n.append(Ge(a))}function m(a,p){let w;try{w=Reflect.getOwnPropertyDescriptor(a,"length")}catch(b){n.append("[Uninspectable]");return}let y=w==null?void 0:w.value;if(!Number.isSafeInteger(y)||y<0){n.append("[Uninspectable]");return}n.append("[");let A=!1;for(let b=0;b<y&&!n.stopped();b+=1){if(l(A,p),A=!0,r>=50){n.append("[MaxEntries]");break}r+=1;let d;try{d=Reflect.getOwnPropertyDescriptor(a,String(b))}catch(S){n.append("[Uninspectable]");continue}d!=null&&d.enumerable?i(d,p+1):n.append("[Empty]")}c("]",A,p)}function v(a,p){let w;try{w=Reflect.ownKeys(a)}catch(A){n.append("[Uninspectable]");return}n.append("{");let y=!1;for(let A of w){if(n.stopped())break;if(r>=50){l(y,p),y=!0,q(n,"\u2026"),n.append(s?": ":":"),n.append("[MaxEntries]");break}r+=1;let b;try{b=Reflect.getOwnPropertyDescriptor(a,A)}catch(d){l(y,p),y=!0,be(n,A),n.append(s?": ":":"),n.append("[Uninspectable]");continue}b!=null&&b.enumerable&&(l(y,p),y=!0,be(n,A),n.append(s?": ":":"),i(b,p+1))}c("}",y,p)}function T(a,p){if(u.has(a)){n.append("[Circular]");return}if(p>=5){n.append("[MaxDepth]");return}let w;try{w=Array.isArray(a)}catch(y){n.append("[Uninspectable]");return}u.add(a);try{w?m(a,p):v(a,p)}finally{u.delete(a)}}function h(a,p){a===null?n.append("null"):typeof a=="string"?q(n,a):typeof a=="number"?n.append(Object.is(a,-0)?"-0":String(a)):typeof a=="boolean"?n.append(a?"true":"false"):typeof a>"u"?n.append("undefined"):typeof a=="bigint"?n.append("".concat(a,"n")):typeof a=="symbol"?ye(n,a):typeof a=="function"?n.append("[Function]"):T(a,p)}try{return h(e,0),n.result()}catch(a){return"[Uninspectable]"}}var we="\u2013",Ae="\u2014",L="\xA0";var gt=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"]),ze=Object.prototype.hasOwnProperty;function N(e){if(e==null||typeof e!="object")return!1;let t=Object.getPrototypeOf(e);return t!==null&&t!==Object.prototype&&Object.getPrototypeOf(t)!==null?!1:!(Symbol.iterator in e)&&!(Symbol.toStringTag in e)}function R(e){return typeof e=="string"}function Ee(e){return Number.isFinite(e)}function M(e){return Number.isSafeInteger(e)&&e>=0}function I(e){return e!=null}function ve(e,t){return N(e)&&R(t)&&ze.call(e,t)}var Ke={strictlyTwoElementsInRangeArrays:!1,progressFn:null};function V(e,t){if(!Array.isArray(e)||!e.length)return e;let n=W(W({},Ke),t),s,u;if(n.strictlyTwoElementsInRangeArrays&&!e.every((l,c)=>!Array.isArray(l)||l.length!==2?(s=c,u=l.length,!1):!0))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, ".concat(s,"th range (").concat($(e[s],4),") has not two but ").concat(u," elements!"));if(!e.every((l,c)=>!Array.isArray(l)||!Number.isInteger(l[0])||l[0]<0||!Number.isInteger(l[1])||l[1]<0?(s=c,!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, ".concat(s,"th range (").concat($(e[s],4),") does not consist of only natural numbers!"));let r=e.length**2,g=0;return Array.from(e).sort((l,c)=>(n.progressFn&&(g+=1,n.progressFn(Math.floor(g*100/r))),l[0]===c[0]?l[1]<c[1]?-1:l[1]>c[1]?1:0:l[0]<c[0]?-1:1))}var Qe={mergeType:1,progressFn:null,joinRangesThatTouchEdges:!0};function Q(e,t){function n(i){return!!i&&typeof i=="object"&&!Array.isArray(i)}if(!Array.isArray(e)||!e.length)return null;if(t&&!n(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($(t,4)," (type ").concat(typeof t,")"));let s=W(W({},Qe),t);if(s.progressFn&&n(s.progressFn)&&!Object.keys(s.progressFn).length)s.progressFn=null;else if(s.progressFn&&typeof s.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 s.progressFn,'", equal to ').concat($(s.progressFn,4)));if(![1,2,"1","2"].includes(s.mergeType))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 s.mergeType,'", equal to ').concat($(s.mergeType,4)));if(typeof s.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 s.joinRangesThatTouchEdges,'", equal to ').concat($(s.joinRangesThatTouchEdges,4)));let u=e.filter(i=>Array.isArray(i)).map(i=>[...i]).filter(i=>i[2]!==void 0||i[0]!==i[1]),r,g,l;s.progressFn?r=V(u,{progressFn:i=>{l=Math.floor(i/5),l!==g&&(g=l,s.progressFn(l))}}):r=V(u);let c=r.length-1;for(let i=c;i>0;i--)s.progressFn&&(l=Math.floor((1-i/c)*78)+21,l!==g&&l>g&&(g=l,s.progressFn(l))),(r[i][0]<=r[i-1][0]||!s.joinRangesThatTouchEdges&&r[i][0]<r[i-1][1]||s.joinRangesThatTouchEdges&&r[i][0]<=r[i-1][1])&&(r[i-1][0]=Math.min(r[i][0],r[i-1][0]),r[i-1][1]=Math.max(r[i][1],r[i-1][1]),r[i][2]!==void 0&&(r[i-1][0]>=r[i][0]||r[i-1][1]<=r[i][1])&&r[i-1][2]!==null&&(r[i][2]===null&&r[i-1][2]!==null?r[i-1][2]=null:r[i-1][2]!=null?+s.mergeType==2&&r[i-1][0]===r[i][0]?r[i-1][2]=r[i][2]:r[i-1][2]+=r[i][2]:r[i-1][2]=r[i][2]),r.splice(i,1),i=r.length);return r.length?r:null}function J(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 Z(e,t,n){let s=0,u=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($(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($(t,4)));if(n&&typeof n!="function")throw new TypeError("ranges-apply/rApply(): [THROW_ID_04] the third input argument must be a function (or falsy)! Currently it's: ".concat(typeof n,", equal to: ").concat($(n,4)));if(!(t!=null&&t.some(Boolean)))return e;let r;Array.isArray(t)&&!Array.isArray(t[0])&&J(t[0])&&J(t[1])?r=[Array.from(t)]:r=Array.from(t);let g=r.length,l=0;r.forEach((m,v)=>{if(m){if(n&&(s=Math.floor(l/g*10),s!==u&&(u=s,n(s))),!Array.isArray(m))throw new TypeError("ranges-apply/rApply(): [THROW_ID_05] ranges array, second input arg., has ".concat(v,"th element not an array: ").concat($(m,4),", which is ").concat(typeof m));if(!J(m[0]))throw new TypeError("ranges-apply/rApply(): [THROW_ID_06] ranges array, second input arg. has ".concat(v,"th element, array ").concat($(m),". Its first element is not a non-negative integer or string index, but ").concat(typeof m[0],", equal to: ").concat($(m[0],4),"."));if(typeof m[0]=="string"&&(r[v]=[...m],r[v][0]=Number(m[0])),!J(m[1]))throw new TypeError("ranges-apply/rApply(): [THROW_ID_07] ranges array, second input arg. has ".concat(v,"th element, array ").concat($(m),". Its second element is not a non-negative integer or string index, but ").concat(typeof m[1],", equal to: ").concat($(m[1],4),"."));typeof m[1]=="string"&&(r[v]===m&&(r[v]=[...m]),r[v][1]=Number(m[1])),l+=1}});let c=n?Q(r,{progressFn:m=>{s=10+Math.floor(m/10),s!==u&&(u=s,n(s))}}):Q(r),i=(c==null?void 0:c.length)||0;if(c&&i>0){let m=e.slice(c[i-1][1]);e=c.reduce((v,T,h,a)=>{n&&(s=20+Math.floor(h/i*80),s!==u&&(u=s,n(s)));let p=h===0?0:a[h-1][1],w=a[h][0];return"".concat(v).concat(e.slice(p,w)).concat(a[h][2]||"")},""),e+=m}return e}function G(e,t=1){let n="\xA0";function s(r){return Array.from(r).reverse().join("")}function u(r,g,l){let c=l?"\n":"\r",i=l?"\r":"\n";if(!r)return r;let m=0,v=0,T="";for(let h=0,a=r.length;h<a;h++)(r[h]===c||r[h]===i&&r[h-1]!==c)&&v++,"\r\n".includes(r[h])||r[h]===n?(m=0,r[h]===n?T+=r[h]:r[h]===c?v<=g&&(T+=r[h],r[h+1]===i&&(T+=r[h+1],h++)):r[h]===i&&(r==null?void 0:r[h-1])!==c&&v<=g&&(T+=r[h])):(m++,!r[h+1]&&!v&&(T+=" "));return T}if(typeof e=="string"&&e.length){let r=1;typeof+t=="number"&&Number.isInteger(+t)&&+t>=0&&(r=+t);let g="",l="";if(!e.trim())g=e;else if(!e[0].trim()){for(let c=0,i=e.length;c<i;c++)if(e[c].trim()){g=e.slice(0,c);break}}if(e.trim()&&(e.slice(-1).trim()===""||e.slice(-1)===n)){for(let c=e.length;c--;)if(e[c].trim()){l=e.slice(c+1);break}}return"".concat(u(g,r,!1)).concat(e.trim()).concat(s(u(s(l),r,!0)))}return e}var Ze={mergeType:1,progressFn:null,joinRangesThatTouchEdges:!0};function Ye(e,t){function n(i){return!!i&&typeof i=="object"&&!Array.isArray(i)}if(!Array.isArray(e)||!e.length)return null;if(t&&!n(t))throw new TypeError("ranges-push/rMerge(): [THROW_ID_10] the second input argument must be a plain object. It was given as:\n".concat($(t,4)," (type ").concat(typeof t,")"));let s=W(W({},Ze),t);if(s.progressFn&&n(s.progressFn)&&!Object.keys(s.progressFn).length)s.progressFn=null;else if(s.progressFn&&typeof s.progressFn!="function")throw new TypeError('ranges-push/rMerge(): [THROW_ID_11] resolvedOpts.progressFn must be a function! It was given of a type: "'.concat(typeof s.progressFn,'", equal to ').concat($(s.progressFn,4)));if(![1,2,"1","2"].includes(s.mergeType))throw new TypeError('ranges-push/rMerge(): [THROW_ID_12] resolvedOpts.mergeType was customised to a wrong thing! It was given of a type: "'.concat(typeof s.mergeType,'", equal to ').concat($(s.mergeType,4)));if(typeof s.joinRangesThatTouchEdges!="boolean")throw new TypeError('ranges-push/rMerge(): [THROW_ID_13] resolvedOpts.joinRangesThatTouchEdges was customised to a wrong thing! It was given of a type: "'.concat(typeof s.joinRangesThatTouchEdges,'", equal to ').concat($(s.joinRangesThatTouchEdges,4)));let u=e.filter(i=>Array.isArray(i)).map(i=>[...i]).filter(i=>i[2]!==void 0||i[0]!==i[1]),r,g,l;s.progressFn?r=V(u,{progressFn:i=>{l=Math.floor(i/5),l!==g&&(g=l,s.progressFn!=null&&s.progressFn(l))}}):r=V(u);let c=r.length-1;for(let i=c;i>0;i--)s.progressFn&&(l=Math.floor((1-i/c)*78)+21,l!==g&&l>g&&(g=l,s.progressFn(l))),(r[i][0]<=r[i-1][0]||!s.joinRangesThatTouchEdges&&r[i][0]<r[i-1][1]||s.joinRangesThatTouchEdges&&r[i][0]<=r[i-1][1])&&(r[i-1][0]=Math.min(r[i][0],r[i-1][0]),r[i-1][1]=Math.max(r[i][1],r[i-1][1]),r[i][2]!==void 0&&(r[i-1][0]>=r[i][0]||r[i-1][1]<=r[i][1])&&r[i-1][2]!==null&&(r[i][2]===null&&r[i-1][2]!==null?r[i-1][2]=null:r[i-1][2]!=null?+s.mergeType==2&&r[i-1][0]===r[i][0]?r[i-1][2]=r[i][2]:r[i-1][2]+=r[i][2]:r[i-1][2]=r[i][2]),r.splice(i,1),i=r.length);return r.length?r:null}var Xe={limitToBeAddedWhitespace:!1,limitLinebreaksCount:1,mergeType:1};function Te(e){return e[2]===void 0&&e[0]===e[1]}function et(e){let t=-1;for(let n=0,s=e.length;n<s;n++){let u=e[n];if(Array.isArray(u)){if(u[0]<t)return!1;t=u[0]}}return!0}var We=class{constructor(e){F(this,"ranges");F(this,"opts");F(this,"sorted");if(e!=null&&!N(e))throw new TypeError("ranges-push/Ranges/constructor(): [THROW_ID_01] The options argument must be a plain object. It was given as ".concat($(e,4)," (type ").concat(typeof e,")."));let t=W(W({},Xe),e);if(t.mergeType&&t.mergeType!==1&&t.mergeType!==2)if(R(t.mergeType)&&t.mergeType.trim()==="1")t.mergeType=1;else if(R(t.mergeType)&&t.mergeType.trim()==="2")t.mergeType=2;else throw new Error('ranges-push/Ranges/constructor(): [THROW_ID_02] opts.mergeType was customised to a wrong thing! It was given of a type: "'.concat(typeof t.mergeType,'", equal to ').concat($(t.mergeType,4)));this.opts=t,this.ranges=[],this.sorted=!0}add(e,t,n){var r;if(e==null&&t==null)return;if(I(e)&&!I(t)){if(Array.isArray(e)){if(e.length){if(e.some(g=>Array.isArray(g))){e.forEach(g=>{Array.isArray(g)&&this.add(...g)});return}e.length&&M(+e[0])&&M(+e[1])&&this.add(...e)}return}throw new TypeError('ranges-push/Ranges/add(): [THROW_ID_03] the first input argument, "from" is set ('.concat($(e),') but second-one, "to" is not (').concat($(t),")"))}else if(!I(e)&&I(t))throw new TypeError('ranges-push/Ranges/add(): [THROW_ID_04] the second input argument, "to" is set ('.concat($(t),') but first-one, "from" is not (').concat($(e),")"));let s=+e,u=+t;if(M(s)&&M(u)){if(I(n)&&!R(n)&&!Ee(n))throw new TypeError("ranges-push/Ranges/add(): [THROW_ID_05] The third argument, the value to add, was given not as string but ".concat(typeof n,", equal to:\n").concat($(n,4)));if(I(this.ranges)&&Array.isArray(this.last())&&s===this.last()[1]){if(this.last()[1]=u,this.last()[2],this.last()[2]!==null&&I(n)){let g=this.last()[2]&&this.last()[2].length&&(!((r=this.opts)!=null&&r.mergeType)||this.opts.mergeType===1)?"".concat(this.last()[2]).concat(n):n;this.opts.limitToBeAddedWhitespace&&(g=G(g,this.opts.limitLinebreaksCount)),R(g)&&!g.length||(this.last()[2]=g)}}else{this.ranges||(this.ranges=[]);let g=this.last();g&&s<g[0]&&(this.sorted=!1);let l=n!==void 0&&!(R(n)&&!n.length)?[s,u,n&&this.opts.limitToBeAddedWhitespace?G(n,this.opts.limitLinebreaksCount):n]:[s,u];this.ranges.push(l)}}else throw M(s)?new TypeError('ranges-push/Ranges/add(): [THROW_ID_07] "to" value, the second input argument, must be a natural number or zero! Currently it\'s of a type "'.concat(typeof t,'" equal to: ').concat($(t,4))):new TypeError('ranges-push/Ranges/add(): [THROW_ID_06] "from" value, the first input argument, must be a natural number or zero! Currently it\'s of a type "'.concat(typeof e,'" equal to: ').concat($(e,4)))}push(e,t,n){this.add(e,t,n)}current(){return Array.isArray(this.ranges)&&this.ranges.length?(this.ranges=Ye(this.ranges,{mergeType:this.opts.mergeType}),this.sorted=!0,this.ranges&&this.opts.limitToBeAddedWhitespace?this.ranges.map(e=>I(e[2])?[e[0],e[1],G(e[2],this.opts.limitLinebreaksCount)]:e):this.ranges):null}firstCovers(e){if(!M(e))throw new TypeError("ranges-push/Ranges/firstCovers(): [THROW_ID_08] the input argument must be a natural number or zero! It was given as ".concat($(e,4)," (type ").concat(typeof e,")"));if(!Array.isArray(this.ranges)||!this.ranges.length)return!1;let t=null;if(this.sorted){for(let s=0,u=this.ranges.length;s<u;s++){let r=this.ranges[s];if(!(!Array.isArray(r)||Te(r))){if(t===null){if(r[0]!==0)return!1;t=r[1]}else{if(r[0]>t)break;r[1]>t&&(t=r[1])}if(t>=e)return!0}}return t!==null&&t>=e}let n=!0;for(;n;){n=!1;for(let s=0,u=this.ranges.length;s<u;s++){let r=this.ranges[s];if(!(!Array.isArray(r)||Te(r))){if(r[0]<0)return!1;(t===null?r[0]===0:r[0]<=t&&r[1]>t)&&(t=r[1],n=!0)}}}return t!==null&&t>=e}wipe(){this.ranges=[],this.sorted=!0}replace(e){if(Array.isArray(e)&&e.length)if(Array.isArray(e[0])&&M(e[0][0]))this.ranges=Array.from(e),this.sorted=et(this.ranges);else throw new Error("ranges-push/Ranges/replace(): [THROW_ID_09] Single range was given but we expected array of arrays! The first element, ".concat($(e[0],4)," should be an array and its first element should be an integer, a string index."));else this.ranges=[],this.sorted=!0}last(){return Array.isArray(this.ranges)&&this.ranges.length?this.ranges[this.ranges.length-1]:null}};var j="\xA0";function tt({str:e,idx:t=0,stopAtNewlines:n=!1,stopAtRawNbsp:s=!1}){if(typeof e!="string"||!e.length||((!t||typeof t!="number")&&(t=0),!e[t+1]))return null;if(e[t+1]&&(e[t+1].trim()||n&&"\n\r".includes(e[t+1])||s&&e[t+1]===j))return t+1;if(e[t+2]&&(e[t+2].trim()||n&&"\n\r".includes(e[t+2])||s&&e[t+2]===j))return t+2;for(let u=t+1,r=e.length;u<r;u++)if(e[u].trim()||n&&"\n\r".includes(e[u])||s&&e[u]===j)return u;return null}function _(e,t=0){return tt({str:e,idx:t,stopAtNewlines:!1,stopAtRawNbsp:!1})}function rt({str:e,idx:t,stopAtNewlines:n,stopAtRawNbsp:s}){if(typeof e!="string"||!e.length||((!t||typeof t!="number")&&(t=0),t<1))return null;if(e[~-t]&&(e[~-t].trim()||n&&"\n\r".includes(e[~-t])||s&&e[~-t]===j))return~-t;if(e[t-2]&&(e[t-2].trim()||n&&"\n\r".includes(e[t-2])||s&&e[t-2]===j))return t-2;for(let u=t;u--;)if(e[u]&&(e[u].trim()||n&&"\n\r".includes(e[u])||s&&e[u]===j))return u;return null}function k(e,t=0){return rt({str:e,idx:t,stopAtNewlines:!1,stopAtRawNbsp:!1})}function De(e){return typeof e!="string"?e:e.length?[e]:[]}var Se={cb:void 0,i:!1,trimBeforeMatching:!1,trimCharsBeforeMatching:[],maxMismatches:0,firstMustMatch:!1,lastMustMatch:!1,hungry:!1},nt=e=>e+1;function st(e,t,n,s,u=!1,r=nt){var b;let g=typeof n=="function"?n():n;if(+t<0&&u&&g==="EOL")return g;let l=W(W({},Se),s);if(t>=e.length&&!u)return!1;let c=u?1:n.length,i=0,m=!1,v=!1,T=!1,h=l.maxMismatches,a=t,p=!1,w=!1,y=!1;function A(){return i===1&&h<l.maxMismatches-1}for(;e[a];){let d=r(a);if(l.trimBeforeMatching&&e[a].trim()===""){if(!e[d]&&u&&n==="EOL")return!0;a=r(a);continue}if(l&&!l.i&&((b=l==null?void 0:l.trimCharsBeforeMatching)!=null&&b.includes(e[a]))||l!=null&&l.i&&l.trimCharsBeforeMatching&&l.trimCharsBeforeMatching.map(f=>f.toLowerCase()).includes(e[a].toLowerCase())){if(u&&n==="EOL"&&!e[d])return!0;a=r(a);continue}let S=d>a?n[n.length-c]:n[c-1];if(!l.i&&e[a]===S||l.i&&S!==void 0&&e[a].toLowerCase()===S.toLowerCase()){if(p||(p=!0),T||(T=!0),c===n.length){if(w=!0,h!==l.maxMismatches)return!1}else c===1&&(y=!0);if(c-=1,i++,A())return!1;if(!c)return i!==n.length||h===l.maxMismatches||!m?a:!1}else if(!m&&!i&&(m=!0),l.maxMismatches&&h&&a){h-=1;for(let f=0;f<=h;f++){let D=d>a?n[n.length-c+1+f]:n[c-2-f],x=e[r(a)];if(D&&(!l.i&&e[a]===D||l.i&&e[a].toLowerCase()===D.toLowerCase())&&(!l.firstMustMatch||c!==n.length)){if(i++,A())return!1;c-=2,p=!0;break}else if(x&&D&&(!l.i&&x===D||l.i&&x.toLowerCase()===D.toLowerCase())&&(!l.firstMustMatch||c!==n.length)){if(!i&&!l.hungry)return!1;c-=1,p=!0;break}else if(D===void 0&&h>=0&&p&&(!l.firstMustMatch||w)&&(!l.lastMustMatch||y))return a}p||(v=a)}else return a===0&&c===1&&!l.lastMustMatch&&T?0:!1;if(v!==!1&&v!==a&&(v=!1),c<1)return a;a=r(a)}if(c>0)return u&&g==="EOL"?!0:l&&l.maxMismatches>=c&&T?v||0:!1}function ot(e,t,n,s,u){var m,v,T;if(N(u)&&ve(u,"trimBeforeMatching")&&u&&typeof u.trimBeforeMatching!="boolean")throw new Error("string-match-left-right/".concat(e,"(): [THROW_ID_01] opts.trimBeforeMatching should be boolean!").concat(Array.isArray(u.trimBeforeMatching)?" Did you mean to use opts.trimCharsBeforeMatching?":""));let r=W(W({},Se),u);if(typeof r.trimCharsBeforeMatching=="string"&&(r.trimCharsBeforeMatching=De(r.trimCharsBeforeMatching)),r.trimCharsBeforeMatching=r.trimCharsBeforeMatching.map(h=>R(h)?h:String(h)),!R(t)||!t.length)return!1;if(!Number.isInteger(n)||n<0)throw new Error("string-match-left-right/".concat(e,"(): [THROW_ID_02] the second argument should be a natural number. Currently it's of a type: ").concat(typeof n,", equal to:\n").concat($(n,4)));let g,l;if(R(s))g=[s];else if(Array.isArray(s))g=s;else if(!s)g=s;else if(typeof s=="function")g=[],g.push(s);else throw new Error("string-match-left-right/".concat(e,"(): [THROW_ID_03] the third argument, whatToMatch, is neither string nor array of strings! It's ").concat(typeof s,", equal to:\n").concat($(s,4)));if(u&&!N(u))throw new Error("string-match-left-right/".concat(e,"(): [THROW_ID_04] the fourth argument, options object, should be a plain object. Currently it's of a type \"").concat(typeof u,'", and equal to:\n').concat($(u,4)));let c=0,i="";if((m=r==null?void 0:r.trimCharsBeforeMatching)!=null&&m.some((h,a)=>h.length>1?(c=a,i=h,!0):!1))throw new Error("string-match-left-right/".concat(e,"(): [THROW_ID_05] the fourth argument, options object contains trimCharsBeforeMatching. It was meant to list the single characters but one of the entries at index ").concat(c," is longer than 1 character, ").concat(i.length," (equals to ").concat(i,"). Please split it into separate characters and put into array as separate elements."));if(!g||!Array.isArray(g)||Array.isArray(g)&&!g.length||Array.isArray(g)&&g.length===1&&R(g[0])&&!g[0].trim()){if(typeof r.cb=="function"){let a,p=n;if((e==="matchLeftIncl"||e==="matchRight")&&(p+=1),e[5]==="L")for(let b=p;b--;){let d=t[b];if((!r.trimBeforeMatching||r.trimBeforeMatching&&(d!=null&&d.trim()))&&(!((v=r.trimCharsBeforeMatching)!=null&&v.length)||d!==void 0&&!r.trimCharsBeforeMatching.includes(d))){a=b;break}}else if(e.startsWith("matchRight"))for(let b=p;b<t.length;b++){let d=t[b];if((!r.trimBeforeMatching||r.trimBeforeMatching&&d.trim())&&(!((T=r.trimCharsBeforeMatching)!=null&&T.length)||!r.trimCharsBeforeMatching.includes(d))){a=b;break}}if(a===void 0)return!1;let w=t[a],y=a+1,A="";return y&&y>0&&(A=t.slice(0,y)),e[5]==="L"||a&&a>0&&(A=t.slice(a)),r.cb(w,A,a)}let h="";throw u||(h=" More so, the whole options object, the fourth input argument, is missing!"),new Error("string-match-left-right/".concat(e,'(): [THROW_ID_06] the third argument, "whatToMatch", was given as an empty string. This means, you intend to match purely by a callback. The callback was not set though, the opts key "cb" is not set!').concat(h))}for(let h=0,a=g.length;h<a;h++){l=typeof g[h]=="function";let p=g[h],w,y,A="",b=n;e==="matchRight"?b+=1:e==="matchLeft"&&(b-=1);let d=st(t,b,p,r,l,S=>e[5]==="L"?S-1:S+1);if(d&&l&&typeof p=="function"&&p()==="EOL")return p()&&(!r.cb||r.cb(w,A,y))?p():!1;if(Number.isInteger(d)&&(y=e.startsWith("matchLeft")?d-1:d+1,e[5]==="L"?A=t.slice(0,d):A=t.slice(y)),y<0&&(y=void 0),t[y]&&(w=t[y]),Number.isInteger(d)&&(!r.cb||r.cb(w,A,y)))return p}return!1}function Ce(e,t,n,s){return ot("matchRightIncl",e,t,n,s)}var Re="4.2.1";var H="&nbsp;",P="\\00A0",B="\\u00A0",Oe="&ndash;",Ne="\\2013",Me="\\u2013",Ie="&mdash;",xe="\\2014",Le="\\u2014",Y=[{heads:"{{",tails:"}}"},{heads:["{% if","{%- if"],tails:["{% endif","{%- endif"]},{heads:["{% for","{%- for"],tails:["{% endfor","{%- endfor"]},{heads:["{%","{%-"],tails:["%}","-%}"]},{heads:"{#",tails:"#}"}],Ve=[{heads:"{{",tails:"}}"}],X=[{heads:["<%","<%=","<%-"],tails:["%>","=%>","-%>"]}],je=["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 at=Re,_e={removeWidowPreventionMeasures:!1,convertEntities:!0,targetLanguage:"html",UKPostcodes:!1,hyphens:!0,minWordCount:4,minCharCount:5,ignore:[],reportProgressFunc:null,reportProgressFuncFrom:0,reportProgressFuncTo:100,tagRanges:[]};function lt(e,t){var te,re,ne,se,oe,ie,ae,le,ue,fe,ge,ce;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($(e,4)));if(t&&!N(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($(t,4)));let s=Array.isArray,u=e.length,r=new We({mergeType:2}),g=["."],l=/[A-Z]{1,2}[0-9][0-9A-Z]?$/,c=/^[0-9][A-Z]{2}/,i=.06,m,v=0,T=0,h=0,a,p,w,y,A,b,d,S,f=W(W({},_e),t),D={removeWidows:!1,convertEntities:!1};if(!f.ignore||!s(f.ignore)&&typeof f.ignore!="string")f.ignore=[];else if(typeof f.ignore=="string"&&(f.ignore=[f.ignore]),f.ignore.includes("all"))f.ignore=f.ignore.concat(Y.concat(X));else if(f.ignore.some(o=>typeof o=="string")){let o=[];f.ignore=f.ignore.filter(C=>typeof C=="string"&&C.length?(["nunjucks","jinja","liquid"].includes(C.trim().toLowerCase())?o=o.concat(Y):["hugo"].includes(C.trim().toLowerCase())?o=o.concat(Ve):["hexo"].includes(C.trim().toLowerCase())&&(o=o.concat(X)),!1):typeof C=="object"),o.length&&(f.ignore=f.ignore.concat(o))}let x;f.reportProgressFunc&&(x=Math.floor(f.reportProgressFuncTo-(f.reportProgressFuncTo-f.reportProgressFuncFrom)*i-f.reportProgressFuncFrom));function z(o,C){let E=L;f.removeWidowPreventionMeasures?E=" ":f.convertEntities&&(E=H,typeof f.targetLanguage=="string"&&(f.targetLanguage.trim().toLowerCase()==="css"?E=P:f.targetLanguage.trim().toLowerCase()==="js"&&(E=B))),e.slice(o,C)!==E&&r.push(o,C,E)}function ee(){T=0,h=0,a=void 0,p=void 0,w=void 0,y=void 0,A=void 0,b=void 0}ee();for(let o=0;o<=u;o++){if(!d&&s(f.ignore)&&f.ignore.length&&f.ignore.some((E,O)=>s(E.heads)&&E.heads.some(he=>e.startsWith(he,o))||typeof E.heads=="string"&&e.startsWith(E.heads,o)?(T+=1,d=f.ignore[O].tails,!0):!1),!d&&S&&S===o&&(T+=1,S=void 0),typeof f.reportProgressFunc=="function"&&(m=f.reportProgressFuncFrom+Math.floor(o/u*(x||1)),m!==v&&(v=m,f.reportProgressFunc(m))),!d&&o&&((te=e[o])!=null&&te.trim())&&(!e[o-1]||e[o-1]&&!e[o-1].trim())&&(y=o),!d&&((re=e[o])!=null&&re.trim())&&(h+=1),!d&&f.hyphens&&("-".concat(Ae).concat(we).includes(e[o])||e.startsWith(Oe,o)||e.startsWith(Ne,o)||e.startsWith(Me,o)||e.startsWith(Ie,o)||e.startsWith(xe,o)||e.startsWith(Le,o))&&e[o+1]&&(!e[o+1].trim()||e[o]==="&")&&e[o-1]&&!e[o-1].trim()&&e[k(e,o)]&&(z(k(e,o)+1,o),D.removeWidows=!0),!d&&(e.startsWith("&nbsp;",o)||e.startsWith("&#160;",o))&&(A=o,b=o+6,(ne=e[o+6])!=null&&ne.trim()&&(S=o+6),f.convertEntities?(f.targetLanguage==="css"||f.targetLanguage==="js")&&(r.push(o,o+6,f.targetLanguage==="css"?P:B),D.convertEntities=!0):(r.push(o,o+6,L),D.convertEntities=!0)),!d&&e[o+4]&&e[o]==="\\"&&e[o+1]==="0"&&e[o+2]==="0"&&e[o+3].toUpperCase()==="A"&&e[o+4]==="0"&&(A=o,b=o+5,(se=e[o+5])!=null&&se.trim()&&(S=o+5),f.convertEntities?(f.targetLanguage==="html"||f.targetLanguage==="js")&&(r.push(o,o+5,f.targetLanguage==="html"?H:B),D.convertEntities=!0):(r.push(o,o+5,L),D.convertEntities=!0)),!d&&e[o]==="\\"&&((oe=e[o+1])==null?void 0:oe.toLowerCase())==="u"&&e[o+2]==="0"&&e[o+3]==="0"&&((ie=e[o+4])==null?void 0:ie.toUpperCase())==="A"&&e[o+5]==="0"&&(A=o,b=o+6,(ae=e[o+6])!=null&&ae.trim()&&(S=o+6),f.convertEntities?(f.targetLanguage==="html"||f.targetLanguage==="css")&&r.push(o,o+6,f.targetLanguage==="html"?H:P):r.push(o,o+6,L)),!d&&e[o]===L&&(A=o,b=o+1,f.convertEntities&&r.push(o,o+1,f.targetLanguage==="css"?P:f.targetLanguage==="js"?B:H)),!d&&((le=e[o])!=null&&le.trim())&&!((ue=e[o-1])!=null&&ue.trim())&&(T+=1),!d&&(!e[o]||"\r\n".includes(e[o])||(e[o]==="\n"||e[o]==="\r"||e[o]==="\r"&&e[o+1]==="\n")&&k(e,o)&&g.includes(e[k(e,o)]))){if((!f.minWordCount||T>=f.minWordCount)&&(!f.minCharCount||h>=f.minCharCount)){let E,O;w!==void 0&&y!==void 0&&A!==void 0&&b!==void 0?w>A?(E=w,O=y):(E=A,O=b):w!==void 0&&y!==void 0?(E=w,O=y):A!==void 0&&b!==void 0&&(E=A,O=b),!(E&&O)&&a&&p&&(E=a,O=p),E&&O&&(z(E,O),D.removeWidows=!0)}ee()}f.UKPostcodes&&e[o]&&!e[o].trim()&&((fe=e[o-1])!=null&&fe.trim())&&l.test(e.slice(0,o))&&e[_(e,o)]&&c.test(e.slice(_(e,o)))&&(z(o,_(e,o)),D.removeWidows=!0),!d&&e[o]&&!e[o].trim()&&((ge=e[o-1])!=null&&ge.trim())&&(w===void 0||(ce=e[w-1])!=null&&ce.trim())&&!"/>".includes(e[_(e,o)])&&!e.slice(0,o).trim().endsWith("br")&&!e.slice(0,o).trim().endsWith("hr")&&!(e.slice(0,o).endsWith("<")&&je.some(E=>e.startsWith(E,_(e,o))))&&(a=w,p=y,w=o,y=void 0,(A!==void 0||b!==void 0)&&(A=void 0,b=void 0));let C;d&&(typeof d=="string"&&(!d.length||e.startsWith(d,o))?d=void 0:s(d)&&(!d.length||d.some(E=>e.startsWith(E,o)?(C=E,!0):!1))&&(d=void 0,o+=C.length,s(f.ignore)&&f.ignore.length&&e[o+1]&&f.ignore.some(E=>Ce(e,o,E.tails,{trimBeforeMatching:!0,cb:(O,he,de)=>{var pe;return de&&(o=de-1,(pe=e[o+1])!=null&&pe.trim()&&(T+=1)),!0}})))),e[o]&&"\r\n".includes(e[o])&&(T=0,h=0),s(f.tagRanges)&&f.tagRanges.length&&f.tagRanges.some(E=>o>=E[0]&&o<=E[1]&&E[1]-1>o?(o=E[1]-1,!0):!1)}return Z(e,r.current()).split("").forEach((o,C)=>{}),{res:Z(e,r.current(),f.reportProgressFunc?o=>{m=Math.floor((f.reportProgressFuncTo-f.reportProgressFuncFrom)*(1-i)+o/100*(f.reportProgressFuncTo-f.reportProgressFuncFrom)*i),m!==v&&(v=m,f.reportProgressFunc(m))}:void 0),ranges:r.current(),log:{timeTakenInMilliseconds:Date.now()-n},whatWasDone:D}}return Ue(ut);})();
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="&nbsp;",ke="\\0000A0",Re="\\u00A0",Tt="&ndash;";var Et="\\u2013",Wt="&mdash;";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("&#160;",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);})();
11
+ /**
12
+ * @name codsen-format-diagnostic-value
13
+ * @fileoverview Safely format untrusted JavaScript values for diagnostics
14
+ * @version 1.1.0
15
+ * @author Roy Revelt
16
+ * @license MIT
17
+ * {@link https://codsen.com/os/codsen-format-diagnostic-value/}
18
+ */
11
19
  /**
12
20
  * @name codsen-utils
13
21
  * @fileoverview Various utility functions
14
- * @version 1.8.0
22
+ * @version 1.10.0
15
23
  * @author Roy Revelt
16
24
  * @license MIT
17
25
  * {@link https://codsen.com/os/codsen-utils/}
@@ -19,7 +27,7 @@
19
27
  /**
20
28
  * @name ranges-sort
21
29
  * @fileoverview Sort string index ranges
22
- * @version 6.2.0
30
+ * @version 6.2.2
23
31
  * @author Roy Revelt
24
32
  * @license MIT
25
33
  * {@link https://codsen.com/os/ranges-sort/}
@@ -27,7 +35,7 @@
27
35
  /**
28
36
  * @name ranges-merge
29
37
  * @fileoverview Merge and sort string index ranges
30
- * @version 9.2.1
38
+ * @version 9.2.3
31
39
  * @author Roy Revelt
32
40
  * @license MIT
33
41
  * {@link https://codsen.com/os/ranges-merge/}
@@ -35,7 +43,7 @@
35
43
  /**
36
44
  * @name ranges-apply
37
45
  * @fileoverview Take an array of string index ranges, delete/replace the string according to them
38
- * @version 7.2.1
46
+ * @version 7.2.3
39
47
  * @author Roy Revelt
40
48
  * @license MIT
41
49
  * {@link https://codsen.com/os/ranges-apply/}
@@ -43,7 +51,7 @@
43
51
  /**
44
52
  * @name string-collapse-leading-whitespace
45
53
  * @fileoverview Collapse the leading and trailing whitespace of a string
46
- * @version 7.2.0
54
+ * @version 7.3.0
47
55
  * @author Roy Revelt
48
56
  * @license MIT
49
57
  * {@link https://codsen.com/os/string-collapse-leading-whitespace/}
@@ -51,7 +59,7 @@
51
59
  /**
52
60
  * @name ranges-push
53
61
  * @fileoverview Gather string index ranges
54
- * @version 7.2.0
62
+ * @version 7.3.0
55
63
  * @author Roy Revelt
56
64
  * @license MIT
57
65
  * {@link https://codsen.com/os/ranges-push/}
@@ -59,24 +67,8 @@
59
67
  /**
60
68
  * @name string-left-right
61
69
  * @fileoverview Looks up the first non-whitespace character to the left/right of a given index
62
- * @version 6.2.0
70
+ * @version 6.2.2
63
71
  * @author Roy Revelt
64
72
  * @license MIT
65
73
  * {@link https://codsen.com/os/string-left-right/}
66
74
  */
67
- /**
68
- * @name arrayiffy-if-string
69
- * @fileoverview Put non-empty strings into arrays, turn empty-ones into empty arrays. Bypass everything else.
70
- * @version 5.2.1
71
- * @author Roy Revelt
72
- * @license MIT
73
- * {@link https://codsen.com/os/arrayiffy-if-string/}
74
- */
75
- /**
76
- * @name string-match-left-right
77
- * @fileoverview Match substrings on the left or right of a given index, ignoring whitespace
78
- * @version 9.2.1
79
- * @author Roy Revelt
80
- * @license MIT
81
- * {@link https://codsen.com/os/string-match-left-right/}
82
- */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "string-remove-widows",
3
- "version": "4.2.1",
3
+ "version": "4.2.3",
4
4
  "description": "Helps to prevent widow words in a text",
5
5
  "keywords": [
6
6
  "against",
@@ -71,14 +71,13 @@
71
71
  }
72
72
  },
73
73
  "dependencies": {
74
- "codsen-utils": "^1.8.0",
75
- "ranges-apply": "^7.2.1",
76
- "ranges-push": "^7.2.0",
77
- "string-left-right": "^6.2.0",
78
- "string-match-left-right": "^9.2.1"
74
+ "codsen-utils": "^1.10.0",
75
+ "ranges-apply": "^7.2.3",
76
+ "ranges-push": "^7.3.0",
77
+ "string-left-right": "^6.2.2"
79
78
  },
80
79
  "devDependencies": {
81
- "string-strip-html": "^13.6.1"
80
+ "string-strip-html": "^13.7.0"
82
81
  },
83
82
  "engines": {
84
83
  "node": ">=18.20.8"
package/types/index.d.ts CHANGED
@@ -8,24 +8,44 @@ interface Obj {
8
8
  [key: string]: any;
9
9
  }
10
10
  interface HeadsAndTailsObj {
11
- heads: string | string[];
12
- tails: string | string[];
11
+ readonly heads: string | readonly string[];
12
+ readonly tails: string | readonly string[];
13
13
  }
14
+ type CountThreshold = number | false | null;
15
+ type IgnorePreset = "all" | "hexo" | "hugo" | "jinja" | "liquid" | "nunjucks";
16
+ type IgnoreEntry = HeadsAndTailsObj | IgnorePreset;
17
+ type TagRange =
18
+ | readonly [from: number, to: number]
19
+ | readonly [
20
+ from: number,
21
+ to: number,
22
+ whatToInsert: string | null | undefined,
23
+ ];
14
24
  interface Opts {
15
25
  removeWidowPreventionMeasures: boolean;
16
26
  convertEntities: boolean;
17
27
  targetLanguage: "html" | "css" | "js";
18
28
  UKPostcodes: boolean;
19
29
  hyphens: boolean;
20
- minWordCount: number;
21
- minCharCount: number;
22
- ignore: HeadsAndTailsObj[] | string | string[];
23
- reportProgressFunc: null | ((percDone: number) => void);
30
+ minWordCount: CountThreshold;
31
+ minCharCount: CountThreshold;
32
+ ignore: IgnorePreset | readonly IgnoreEntry[];
33
+ /** Receives finite, strictly increasing integer percentages within the inclusive configured bounds. */
34
+ reportProgressFunc: false | null | ((percDone: number) => void);
35
+ /** Inclusive progress lower bound; an integer from 0 through 100. */
24
36
  reportProgressFuncFrom: number;
37
+ /** Inclusive progress upper bound; an integer from 0 through 100. */
25
38
  reportProgressFuncTo: number;
26
- tagRanges: Range[] | null;
39
+ /** Opaque half-open ranges. Overlong ends are clipped; an optional third range value is ignored. */
40
+ tagRanges: readonly TagRange[] | null;
27
41
  }
28
- declare const defaults: Opts;
42
+ type PublicDefaults = Readonly<
43
+ Omit<Opts, "ignore" | "tagRanges"> & {
44
+ ignore: readonly IgnoreEntry[];
45
+ tagRanges: readonly TagRange[];
46
+ }
47
+ >;
48
+ declare const defaults: PublicDefaults;
29
49
  interface Res {
30
50
  res: string;
31
51
  ranges: Ranges;
@@ -33,12 +53,27 @@ interface Res {
33
53
  log: {
34
54
  timeTakenInMilliseconds: number;
35
55
  };
56
+ /** Operations that changed the final output. */
36
57
  whatWasDone: {
37
58
  removeWidows: boolean;
38
59
  convertEntities: boolean;
39
60
  };
61
+ /** Options which could affect this input, independently of their current setting. */
62
+ applicableOpts: {
63
+ removeWidows: boolean;
64
+ convertEntities: boolean;
65
+ };
40
66
  }
41
67
  declare function removeWidows(str: string, opts?: Partial<Opts>): Res;
42
68
 
43
69
  export { defaults, removeWidows, version };
44
- export type { HeadsAndTailsObj, Obj, Opts, Res };
70
+ export type {
71
+ CountThreshold,
72
+ HeadsAndTailsObj,
73
+ IgnoreEntry,
74
+ IgnorePreset,
75
+ Obj,
76
+ Opts,
77
+ Res,
78
+ TagRange,
79
+ };