string-remove-widows 4.2.2 → 4.2.4

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