string-remove-widows 3.0.11 → 3.0.12

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.
@@ -1,13 +1,13 @@
1
1
  /**
2
2
  * @name string-remove-widows
3
3
  * @fileoverview Helps to prevent widow words in a text
4
- * @version 3.0.11
4
+ * @version 3.0.12
5
5
  * @author Roy Revelt, Codsen Ltd
6
6
  * @license MIT
7
7
  * {@link https://codsen.com/os/string-remove-widows/}
8
8
  */
9
9
 
10
- import{matchRightIncl as ee}from"string-match-left-right";import{left as N,right as D}from"string-left-right";import{Ranges as te}from"ranges-push";import{rApply as K}from"ranges-apply";var M="3.0.11";var h="\xA0",E="&nbsp;",S="\\00A0",w="\\u00A0",O="\u2013",J="&ndash;",U="\\2013",x="\\u2013",k="\u2014",I="&mdash;",B="\\2014",_="\\u2014",v=[{heads:"{{",tails:"}}"},{heads:["{% if","{%- if"],tails:["{% endif","{%- endif"]},{heads:["{% for","{%- for"],tails:["{% endfor","{%- endfor"]},{heads:["{%","{%-"],tails:["%}","-%}"]},{heads:"{#",tails:"#}"}],q=[{heads:"{{",tails:"}}"}],P=[{heads:["<%","<%=","<%-"],tails:["%>","=%>","-%>"]}],G=["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 $e=M,ne={removeWidowPreventionMeasures:!1,convertEntities:!0,targetLanguage:"html",UKPostcodes:!1,hyphens:!0,minWordCount:4,minCharCount:5,ignore:[],reportProgressFunc:null,reportProgressFuncFrom:0,reportProgressFuncTo:100,tagRanges:[]};function ce(t,f){let Z=Date.now();if(typeof t!="string")throw t===void 0?new Error("string-remove-widows: [THROW_ID_01] the first input argument is completely missing! It should be given as string."):new Error(`string-remove-widows: [THROW_ID_02] the first input argument must be string! It was given as "${typeof t}", equal to:
10
+ import{matchRightIncl as ee}from"string-match-left-right";import{left as N,right as D}from"string-left-right";import{Ranges as te}from"ranges-push";import{rApply as K}from"ranges-apply";var M="3.0.12";var h="\xA0",E="&nbsp;",S="\\00A0",w="\\u00A0",O="\u2013",J="&ndash;",U="\\2013",x="\\u2013",k="\u2014",I="&mdash;",B="\\2014",_="\\u2014",v=[{heads:"{{",tails:"}}"},{heads:["{% if","{%- if"],tails:["{% endif","{%- endif"]},{heads:["{% for","{%- for"],tails:["{% endfor","{%- endfor"]},{heads:["{%","{%-"],tails:["%}","-%}"]},{heads:"{#",tails:"#}"}],q=[{heads:"{{",tails:"}}"}],P=[{heads:["<%","<%=","<%-"],tails:["%>","=%>","-%>"]}],G=["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 $e=M,ne={removeWidowPreventionMeasures:!1,convertEntities:!0,targetLanguage:"html",UKPostcodes:!1,hyphens:!0,minWordCount:4,minCharCount:5,ignore:[],reportProgressFunc:null,reportProgressFuncFrom:0,reportProgressFuncTo:100,tagRanges:[]};function ce(t,f){let Z=Date.now();if(typeof t!="string")throw t===void 0?new Error("string-remove-widows: [THROW_ID_01] the first input argument is completely missing! It should be given as string."):new Error(`string-remove-widows: [THROW_ID_02] the first input argument must be string! It was given as "${typeof t}", equal to:
11
11
  ${JSON.stringify(t,null,4)}`);if(f&&typeof f!="object")throw new Error(`string-remove-widows: [THROW_ID_03] the second input argument, options object, should be a plain object but it was given as type ${typeof f}, equal to ${JSON.stringify(f,null,4)}`);let b=Array.isArray,L=t.length,a=new te({mergeType:2}),Y=["."],z=/[A-Z]{1,2}[0-9][0-9A-Z]?$/,Q=/^[0-9][A-Z]{2}/,V=.06,$,A=0,g=0,W=0,y,T,d,c,r,u,s,p,n={...ne,...f},m={removeWidows:!1,convertEntities:!1};if(!n.ignore||!b(n.ignore)&&typeof n.ignore!="string")n.ignore=[];else if(typeof n.ignore=="string"&&(n.ignore=[n.ignore]),n.ignore.includes("all"))n.ignore=n.ignore.concat(v.concat(P));else if(n.ignore.some(e=>typeof e=="string")){let e=[];n.ignore=n.ignore.filter(i=>typeof i=="string"&&i.length?(["nunjucks","jinja","liquid"].includes(i.trim().toLowerCase())?e=e.concat(v):["hugo"].includes(i.trim().toLowerCase())?e=e.concat(q):["hexo"].includes(i.trim().toLowerCase())&&(e=e.concat(P)),!1):typeof i=="object"),e.length&&(n.ignore=n.ignore.concat(e))}let H;n.reportProgressFunc&&(H=Math.floor(n.reportProgressFuncTo-(n.reportProgressFuncTo-n.reportProgressFuncFrom)*V-n.reportProgressFuncFrom));function C(e,i){let o=h;n.removeWidowPreventionMeasures?o=" ":n.convertEntities&&(o=E,typeof n.targetLanguage=="string"&&(n.targetLanguage.trim().toLowerCase()==="css"?o=S:n.targetLanguage.trim().toLowerCase()==="js"&&(o=w))),t.slice(e,i)!==o&&a.push(e,i,o)}function F(){g=0,W=0,y=void 0,T=void 0,d=void 0,c=void 0,r=void 0,u=void 0}F();for(let e=0;e<=L;e++){if(!s&&b(n.ignore)&&n.ignore.length&&n.ignore.some((o,l)=>{if(b(o.heads)&&o.heads.some(R=>t.startsWith(R,e))||typeof o.heads=="string"&&t.startsWith(o.heads,e))return g+=1,s=n.ignore[l].tails,!0}),!s&&p&&p===e&&(g+=1,p=void 0),typeof n.reportProgressFunc=="function"&&($=n.reportProgressFuncFrom+Math.floor(e/L*(H||1)),$!==A&&(A=$,n.reportProgressFunc($))),!s&&e&&t[e]&&t[e].trim()&&(!t[e-1]||t[e-1]&&!t[e-1].trim())&&(c=e),!s&&t[e]&&t[e].trim()&&(W+=1),!s&&n.hyphens&&(`-${k}${O}`.includes(t[e])||t.startsWith(J,e)||t.startsWith(U,e)||t.startsWith(x,e)||t.startsWith(I,e)||t.startsWith(B,e)||t.startsWith(_,e))&&t[e+1]&&(!t[e+1].trim()||t[e]==="&")&&t[e-1]&&!t[e-1].trim()&&t[N(t,e)]&&(C(N(t,e)+1,e),m.removeWidows=!0),!s&&(t.startsWith("&nbsp;",e)||t.startsWith("&#160;",e))&&(r=e,u=e+6,t[e+6]&&t[e+6].trim()&&(p=e+6),n.convertEntities?(n.targetLanguage==="css"||n.targetLanguage==="js")&&(a.push(e,e+6,n.targetLanguage==="css"?S:w),m.convertEntities=!0):(a.push(e,e+6,h),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,u=e+5,t[e+5]&&t[e+5].trim()&&(p=e+5),n.convertEntities?(n.targetLanguage==="html"||n.targetLanguage==="js")&&(a.push(e,e+5,n.targetLanguage==="html"?E:w),m.convertEntities=!0):(a.push(e,e+5,h),m.convertEntities=!0)),!s&&t[e]==="\\"&&t[e+1]&&t[e+1].toLowerCase()==="u"&&t[e+2]==="0"&&t[e+3]==="0"&&t[e+4]&&t[e+4].toUpperCase()==="A"&&t[e+5]==="0"&&(r=e,u=e+6,t[e+6]&&t[e+6].trim()&&(p=e+6),n.convertEntities?(n.targetLanguage==="html"||n.targetLanguage==="css")&&a.push(e,e+6,n.targetLanguage==="html"?E:S):a.push(e,e+6,h)),!s&&t[e]===h&&(r=e,u=e+1,n.convertEntities&&a.push(e,e+1,n.targetLanguage==="css"?S:n.targetLanguage==="js"?w:E)),!s&&t[e]&&t[e].trim()&&(!t[e-1]||!t[e-1].trim())&&(g+=1),!s&&(!t[e]||`\r
12
12
  `.includes(t[e])||(t[e]===`
13
13
  `||t[e]==="\r"||t[e]==="\r"&&t[e+1]===`
@@ -1,13 +1,13 @@
1
1
  /**
2
2
  * @name string-remove-widows
3
3
  * @fileoverview Helps to prevent widow words in a text
4
- * @version 3.0.11
4
+ * @version 3.0.12
5
5
  * @author Roy Revelt, Codsen Ltd
6
6
  * @license MIT
7
7
  * {@link https://codsen.com/os/string-remove-widows/}
8
8
  */
9
9
 
10
- var stringRemoveWidows=(()=>{var rr=Object.create;var k=Object.defineProperty;var nr=Object.getOwnPropertyDescriptor;var or=Object.getOwnPropertyNames,xe=Object.getOwnPropertySymbols,sr=Object.getPrototypeOf,Le=Object.prototype.hasOwnProperty,ir=Object.prototype.propertyIsEnumerable;var ge=(e,t,r)=>t in e?k(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,T=(e,t)=>{for(var r in t||(t={}))Le.call(t,r)&&ge(e,r,t[r]);if(xe)for(var r of xe(t))ir.call(t,r)&&ge(e,r,t[r]);return e};var He=e=>k(e,"__esModule",{value:!0});var Ve=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),ar=(e,t)=>{for(var r in t)k(e,r,{get:t[r],enumerable:!0})},Fe=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let u of or(t))!Le.call(e,u)&&(r||u!=="default")&&k(e,u,{get:()=>t[u],enumerable:!(o=nr(t,u))||o.enumerable});return e},Pe=(e,t)=>Fe(He(k(e!=null?rr(sr(e)):{},"default",!t&&e&&e.__esModule?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e),ur=(e=>(t,r)=>e&&e.get(t)||(r=Fe(He({}),t,1),e&&e.set(t,r),r))(typeof WeakMap!="undefined"?new WeakMap:0);var fe=(e,t,r)=>(ge(e,typeof t!="symbol"?t+"":t,r),r);var Ze=Ve((mo,Ke)=>{var fr="[object Object]";function hr(e){var t=!1;if(e!=null&&typeof e.toString!="function")try{t=!!(e+"")}catch(r){}return t}function dr(e,t){return function(r){return e(t(r))}}var mr=Function.prototype,qe=Object.prototype,Ge=mr.toString,pr=qe.hasOwnProperty,$r=Ge.call(Object),br=qe.toString,yr=dr(Object.getPrototypeOf,Object);function wr(e){return!!e&&typeof e=="object"}function Er(e){if(!wr(e)||br.call(e)!=fr||hr(e))return!1;var t=yr(e);if(t===null)return!0;var r=pr.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r instanceof r&&Ge.call(r)==$r}Ke.exports=Er});var Lt=Ve((K,P)=>{var Tr=200,Ye="__lodash_hash_undefined__",Xe=9007199254740991,he="[object Arguments]",Ar="[object Array]",ze="[object Boolean]",Qe="[object Date]",vr="[object Error]",de="[object Function]",et="[object GeneratorFunction]",te="[object Map]",tt="[object Number]",me="[object Object]",rt="[object Promise]",nt="[object RegExp]",re="[object Set]",ot="[object String]",st="[object Symbol]",pe="[object WeakMap]",it="[object ArrayBuffer]",ne="[object DataView]",at="[object Float32Array]",ut="[object Float64Array]",lt="[object Int8Array]",ct="[object Int16Array]",gt="[object Int32Array]",ft="[object Uint8Array]",ht="[object Uint8ClampedArray]",dt="[object Uint16Array]",mt="[object Uint32Array]",Sr=/[\\^$.*+?()[\]{}|]/g,_r=/\w*$/,Nr=/^\[object .+?Constructor\]$/,Cr=/^(?:0|[1-9]\d*)$/,w={};w[he]=w[Ar]=w[it]=w[ne]=w[ze]=w[Qe]=w[at]=w[ut]=w[lt]=w[ct]=w[gt]=w[te]=w[tt]=w[me]=w[nt]=w[re]=w[ot]=w[st]=w[ft]=w[ht]=w[dt]=w[mt]=!0;w[vr]=w[de]=w[pe]=!1;var Or=typeof global=="object"&&global&&global.Object===Object&&global,Wr=typeof self=="object"&&self&&self.Object===Object&&self,W=Or||Wr||Function("return this")(),pt=typeof K=="object"&&K&&!K.nodeType&&K,$t=pt&&typeof P=="object"&&P&&!P.nodeType&&P,Dr=$t&&$t.exports===pt;function Rr(e,t){return e.set(t[0],t[1]),e}function Ir(e,t){return e.add(t),e}function Mr(e,t){for(var r=-1,o=e?e.length:0;++r<o&&t(e[r],r,e)!==!1;);return e}function jr(e,t){for(var r=-1,o=t.length,u=e.length;++r<o;)e[u+r]=t[r];return e}function bt(e,t,r,o){var u=-1,n=e?e.length:0;for(o&&n&&(r=e[++u]);++u<n;)r=t(r,e[u],u,e);return r}function xr(e,t){for(var r=-1,o=Array(e);++r<e;)o[r]=t(r);return o}function Lr(e,t){return e==null?void 0:e[t]}function yt(e){var t=!1;if(e!=null&&typeof e.toString!="function")try{t=!!(e+"")}catch(r){}return t}function wt(e){var t=-1,r=Array(e.size);return e.forEach(function(o,u){r[++t]=[u,o]}),r}function $e(e,t){return function(r){return e(t(r))}}function Et(e){var t=-1,r=Array(e.size);return e.forEach(function(o){r[++t]=o}),r}var Hr=Array.prototype,Vr=Function.prototype,oe=Object.prototype,be=W["__core-js_shared__"],Tt=function(){var e=/[^.]+$/.exec(be&&be.keys&&be.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),At=Vr.toString,R=oe.hasOwnProperty,se=oe.toString,Fr=RegExp("^"+At.call(R).replace(Sr,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),vt=Dr?W.Buffer:void 0,St=W.Symbol,_t=W.Uint8Array,Pr=$e(Object.getPrototypeOf,Object),Jr=Object.create,Br=oe.propertyIsEnumerable,Ur=Hr.splice,Nt=Object.getOwnPropertySymbols,kr=vt?vt.isBuffer:void 0,qr=$e(Object.keys,Object),ye=F(W,"DataView"),q=F(W,"Map"),we=F(W,"Promise"),Ee=F(W,"Set"),Te=F(W,"WeakMap"),G=F(Object,"create"),Gr=L(ye),Kr=L(q),Zr=L(we),Yr=L(Ee),Xr=L(Te),Ct=St?St.prototype:void 0,Ot=Ct?Ct.valueOf:void 0;function j(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var o=e[t];this.set(o[0],o[1])}}function zr(){this.__data__=G?G(null):{}}function Qr(e){return this.has(e)&&delete this.__data__[e]}function en(e){var t=this.__data__;if(G){var r=t[e];return r===Ye?void 0:r}return R.call(t,e)?t[e]:void 0}function tn(e){var t=this.__data__;return G?t[e]!==void 0:R.call(t,e)}function rn(e,t){var r=this.__data__;return r[e]=G&&t===void 0?Ye:t,this}j.prototype.clear=zr;j.prototype.delete=Qr;j.prototype.get=en;j.prototype.has=tn;j.prototype.set=rn;function D(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var o=e[t];this.set(o[0],o[1])}}function nn(){this.__data__=[]}function on(e){var t=this.__data__,r=ie(t,e);if(r<0)return!1;var o=t.length-1;return r==o?t.pop():Ur.call(t,r,1),!0}function sn(e){var t=this.__data__,r=ie(t,e);return r<0?void 0:t[r][1]}function an(e){return ie(this.__data__,e)>-1}function un(e,t){var r=this.__data__,o=ie(r,e);return o<0?r.push([e,t]):r[o][1]=t,this}D.prototype.clear=nn;D.prototype.delete=on;D.prototype.get=sn;D.prototype.has=an;D.prototype.set=un;function H(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var o=e[t];this.set(o[0],o[1])}}function ln(){this.__data__={hash:new j,map:new(q||D),string:new j}}function cn(e){return ae(this,e).delete(e)}function gn(e){return ae(this,e).get(e)}function fn(e){return ae(this,e).has(e)}function hn(e,t){return ae(this,e).set(e,t),this}H.prototype.clear=ln;H.prototype.delete=cn;H.prototype.get=gn;H.prototype.has=fn;H.prototype.set=hn;function V(e){this.__data__=new D(e)}function dn(){this.__data__=new D}function mn(e){return this.__data__.delete(e)}function pn(e){return this.__data__.get(e)}function $n(e){return this.__data__.has(e)}function bn(e,t){var r=this.__data__;if(r instanceof D){var o=r.__data__;if(!q||o.length<Tr-1)return o.push([e,t]),this;r=this.__data__=new H(o)}return r.set(e,t),this}V.prototype.clear=dn;V.prototype.delete=mn;V.prototype.get=pn;V.prototype.has=$n;V.prototype.set=bn;function yn(e,t){var r=Se(e)||Bn(e)?xr(e.length,String):[],o=r.length,u=!!o;for(var n in e)(t||R.call(e,n))&&!(u&&(n=="length"||Vn(n,o)))&&r.push(n);return r}function Wt(e,t,r){var o=e[t];(!(R.call(e,t)&&Mt(o,r))||r===void 0&&!(t in e))&&(e[t]=r)}function ie(e,t){for(var r=e.length;r--;)if(Mt(e[r][0],t))return r;return-1}function wn(e,t){return e&&Dt(t,_e(t),e)}function Ae(e,t,r,o,u,n,g){var a;if(o&&(a=n?o(e,u,n,g):o(e)),a!==void 0)return a;if(!ue(e))return e;var c=Se(e);if(c){if(a=xn(e),!t)return In(e,a)}else{var i=x(e),f=i==de||i==et;if(kn(e))return _n(e,t);if(i==me||i==he||f&&!n){if(yt(e))return n?e:{};if(a=Ln(f?{}:e),!t)return Mn(e,wn(a,e))}else{if(!w[i])return n?e:{};a=Hn(e,i,Ae,t)}}g||(g=new V);var m=g.get(e);if(m)return m;if(g.set(e,a),!c)var p=r?jn(e):_e(e);return Mr(p||e,function(d,h){p&&(h=d,d=e[h]),Wt(a,h,Ae(d,t,r,o,h,e,g))}),a}function En(e){return ue(e)?Jr(e):{}}function Tn(e,t,r){var o=t(e);return Se(e)?o:jr(o,r(e))}function An(e){return se.call(e)}function vn(e){if(!ue(e)||Pn(e))return!1;var t=xt(e)||yt(e)?Fr:Nr;return t.test(L(e))}function Sn(e){if(!It(e))return qr(e);var t=[];for(var r in Object(e))R.call(e,r)&&r!="constructor"&&t.push(r);return t}function _n(e,t){if(t)return e.slice();var r=new e.constructor(e.length);return e.copy(r),r}function ve(e){var t=new e.constructor(e.byteLength);return new _t(t).set(new _t(e)),t}function Nn(e,t){var r=t?ve(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}function Cn(e,t,r){var o=t?r(wt(e),!0):wt(e);return bt(o,Rr,new e.constructor)}function On(e){var t=new e.constructor(e.source,_r.exec(e));return t.lastIndex=e.lastIndex,t}function Wn(e,t,r){var o=t?r(Et(e),!0):Et(e);return bt(o,Ir,new e.constructor)}function Dn(e){return Ot?Object(Ot.call(e)):{}}function Rn(e,t){var r=t?ve(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}function In(e,t){var r=-1,o=e.length;for(t||(t=Array(o));++r<o;)t[r]=e[r];return t}function Dt(e,t,r,o){r||(r={});for(var u=-1,n=t.length;++u<n;){var g=t[u],a=o?o(r[g],e[g],g,r,e):void 0;Wt(r,g,a===void 0?e[g]:a)}return r}function Mn(e,t){return Dt(e,Rt(e),t)}function jn(e){return Tn(e,_e,Rt)}function ae(e,t){var r=e.__data__;return Fn(t)?r[typeof t=="string"?"string":"hash"]:r.map}function F(e,t){var r=Lr(e,t);return vn(r)?r:void 0}var Rt=Nt?$e(Nt,Object):Kn,x=An;(ye&&x(new ye(new ArrayBuffer(1)))!=ne||q&&x(new q)!=te||we&&x(we.resolve())!=rt||Ee&&x(new Ee)!=re||Te&&x(new Te)!=pe)&&(x=function(e){var t=se.call(e),r=t==me?e.constructor:void 0,o=r?L(r):void 0;if(o)switch(o){case Gr:return ne;case Kr:return te;case Zr:return rt;case Yr:return re;case Xr:return pe}return t});function xn(e){var t=e.length,r=e.constructor(t);return t&&typeof e[0]=="string"&&R.call(e,"index")&&(r.index=e.index,r.input=e.input),r}function Ln(e){return typeof e.constructor=="function"&&!It(e)?En(Pr(e)):{}}function Hn(e,t,r,o){var u=e.constructor;switch(t){case it:return ve(e);case ze:case Qe:return new u(+e);case ne:return Nn(e,o);case at:case ut:case lt:case ct:case gt:case ft:case ht:case dt:case mt:return Rn(e,o);case te:return Cn(e,o,r);case tt:case ot:return new u(e);case nt:return On(e);case re:return Wn(e,o,r);case st:return Dn(e)}}function Vn(e,t){return t=t==null?Xe:t,!!t&&(typeof e=="number"||Cr.test(e))&&e>-1&&e%1==0&&e<t}function Fn(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function Pn(e){return!!Tt&&Tt in e}function It(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||oe;return e===r}function L(e){if(e!=null){try{return At.call(e)}catch(t){}try{return e+""}catch(t){}}return""}function Jn(e){return Ae(e,!0,!0)}function Mt(e,t){return e===t||e!==e&&t!==t}function Bn(e){return Un(e)&&R.call(e,"callee")&&(!Br.call(e,"callee")||se.call(e)==he)}var Se=Array.isArray;function jt(e){return e!=null&&qn(e.length)&&!xt(e)}function Un(e){return Gn(e)&&jt(e)}var kn=kr||Zn;function xt(e){var t=ue(e)?se.call(e):"";return t==de||t==et}function qn(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=Xe}function ue(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function Gn(e){return!!e&&typeof e=="object"}function _e(e){return jt(e)?yn(e):Sn(e)}function Kn(){return[]}function Zn(){return!1}P.exports=Jn});var uo={};ar(uo,{defaults:()=>tr,removeWidows:()=>ao,version:()=>io});function Je(e){return typeof e=="string"?e.length?[e]:[]:e}function Be(e){return e&&typeof e=="object"&&!Array.isArray(e)}function ee(e){return typeof e=="string"}var Ue={cb:void 0,i:!1,trimBeforeMatching:!1,trimCharsBeforeMatching:[],maxMismatches:0,firstMustMatch:!1,lastMustMatch:!1,hungry:!1},lr=e=>e+1;function cr(e,t,r,o,u=!1,n=lr){let g=typeof r=="function"?r():r;if(+t<0&&u&&g==="EOL")return g;let a=T(T({},Ue),o);if(t>=e.length&&!u)return!1;let c=u?1:r.length,i=0,f=!1,m=!1,p=!1,d=a.maxMismatches,h=t,A=!1,b=!1,y=!1;function v(){return i===1&&d<a.maxMismatches-1}for(;e[h];){let S=n(h);if(a.trimBeforeMatching&&e[h].trim()===""){if(!e[S]&&u&&r==="EOL")return!0;h=n(h);continue}if(a&&!a.i&&a.trimCharsBeforeMatching&&a.trimCharsBeforeMatching.includes(e[h])||(a==null?void 0:a.i)&&a.trimCharsBeforeMatching&&a.trimCharsBeforeMatching.map(_=>_.toLowerCase()).includes(e[h].toLowerCase())){if(u&&r==="EOL"&&!e[S])return!0;h=n(h);continue}let E=S>h?r[r.length-c]:r[c-1];if(!a.i&&e[h]===E||a.i&&e[h].toLowerCase()===E.toLowerCase()){if(A||(A=!0),p||(p=!0),c===r.length){if(b=!0,d!==a.maxMismatches)return!1}else c===1&&(y=!0);if(c-=1,i++,v())return!1;if(!c)return i!==r.length||d===a.maxMismatches||!f?h:!1}else if(!f&&!i&&(f=!0),a.maxMismatches&&d&&h){d-=1;for(let _=0;_<=d;_++){let l=S>h?r[r.length-c+1+_]:r[c-2-_],C=e[n(h)];if(l&&(!a.i&&e[h]===l||a.i&&e[h].toLowerCase()===l.toLowerCase())&&(!a.firstMustMatch||c!==r.length)){if(i++,v())return!1;c-=2,A=!0;break}else if(C&&l&&(!a.i&&C===l||a.i&&C.toLowerCase()===l.toLowerCase())&&(!a.firstMustMatch||c!==r.length)){if(!i&&!a.hungry)return!1;c-=1,A=!0;break}else if(l===void 0&&d>=0&&A&&(!a.firstMustMatch||b)&&(!a.lastMustMatch||y))return h}A||(m=h)}else return h===0&&c===1&&!a.lastMustMatch&&p?0:!1;if(m!==!1&&m!==h&&(m=!1),c<1)return h;h=n(h)}if(c>0)return u&&g==="EOL"?!0:a&&a.maxMismatches>=c&&p?m||0:!1}function gr(e,t,r,o,u){if(Be(u)&&Object.prototype.hasOwnProperty.call(u,"trimBeforeMatching")&&typeof u.trimBeforeMatching!="boolean")throw new Error(`string-match-left-right/${e}(): [THROW_ID_09] opts.trimBeforeMatching should be boolean!${Array.isArray(u.trimBeforeMatching)?" Did you mean to use opts.trimCharsBeforeMatching?":""}`);let n=T(T({},Ue),u);if(typeof n.trimCharsBeforeMatching=="string"&&(n.trimCharsBeforeMatching=Je(n.trimCharsBeforeMatching)),n.trimCharsBeforeMatching=n.trimCharsBeforeMatching.map(f=>ee(f)?f:String(f)),!ee(t)||!t.length)return!1;if(!Number.isInteger(r)||r<0)throw new Error(`string-match-left-right/${e}(): [THROW_ID_03] the second argument should be a natural number. Currently it's of a type: ${typeof r}, equal to:
10
+ var stringRemoveWidows=(()=>{var rr=Object.create;var k=Object.defineProperty;var nr=Object.getOwnPropertyDescriptor;var or=Object.getOwnPropertyNames,xe=Object.getOwnPropertySymbols,sr=Object.getPrototypeOf,Le=Object.prototype.hasOwnProperty,ir=Object.prototype.propertyIsEnumerable;var ge=(e,t,r)=>t in e?k(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,T=(e,t)=>{for(var r in t||(t={}))Le.call(t,r)&&ge(e,r,t[r]);if(xe)for(var r of xe(t))ir.call(t,r)&&ge(e,r,t[r]);return e};var He=e=>k(e,"__esModule",{value:!0});var Ve=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),ar=(e,t)=>{for(var r in t)k(e,r,{get:t[r],enumerable:!0})},Fe=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let u of or(t))!Le.call(e,u)&&(r||u!=="default")&&k(e,u,{get:()=>t[u],enumerable:!(o=nr(t,u))||o.enumerable});return e},Pe=(e,t)=>Fe(He(k(e!=null?rr(sr(e)):{},"default",!t&&e&&e.__esModule?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e),ur=(e=>(t,r)=>e&&e.get(t)||(r=Fe(He({}),t,1),e&&e.set(t,r),r))(typeof WeakMap!="undefined"?new WeakMap:0);var fe=(e,t,r)=>(ge(e,typeof t!="symbol"?t+"":t,r),r);var Ze=Ve((mo,Ke)=>{var fr="[object Object]";function hr(e){var t=!1;if(e!=null&&typeof e.toString!="function")try{t=!!(e+"")}catch(r){}return t}function dr(e,t){return function(r){return e(t(r))}}var mr=Function.prototype,qe=Object.prototype,Ge=mr.toString,pr=qe.hasOwnProperty,$r=Ge.call(Object),br=qe.toString,yr=dr(Object.getPrototypeOf,Object);function wr(e){return!!e&&typeof e=="object"}function Er(e){if(!wr(e)||br.call(e)!=fr||hr(e))return!1;var t=yr(e);if(t===null)return!0;var r=pr.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r instanceof r&&Ge.call(r)==$r}Ke.exports=Er});var Lt=Ve((K,P)=>{var Tr=200,Ye="__lodash_hash_undefined__",Xe=9007199254740991,he="[object Arguments]",Ar="[object Array]",ze="[object Boolean]",Qe="[object Date]",vr="[object Error]",de="[object Function]",et="[object GeneratorFunction]",te="[object Map]",tt="[object Number]",me="[object Object]",rt="[object Promise]",nt="[object RegExp]",re="[object Set]",ot="[object String]",st="[object Symbol]",pe="[object WeakMap]",it="[object ArrayBuffer]",ne="[object DataView]",at="[object Float32Array]",ut="[object Float64Array]",lt="[object Int8Array]",ct="[object Int16Array]",gt="[object Int32Array]",ft="[object Uint8Array]",ht="[object Uint8ClampedArray]",dt="[object Uint16Array]",mt="[object Uint32Array]",Sr=/[\\^$.*+?()[\]{}|]/g,_r=/\w*$/,Nr=/^\[object .+?Constructor\]$/,Cr=/^(?:0|[1-9]\d*)$/,w={};w[he]=w[Ar]=w[it]=w[ne]=w[ze]=w[Qe]=w[at]=w[ut]=w[lt]=w[ct]=w[gt]=w[te]=w[tt]=w[me]=w[nt]=w[re]=w[ot]=w[st]=w[ft]=w[ht]=w[dt]=w[mt]=!0;w[vr]=w[de]=w[pe]=!1;var Or=typeof global=="object"&&global&&global.Object===Object&&global,Dr=typeof self=="object"&&self&&self.Object===Object&&self,D=Or||Dr||Function("return this")(),pt=typeof K=="object"&&K&&!K.nodeType&&K,$t=pt&&typeof P=="object"&&P&&!P.nodeType&&P,Wr=$t&&$t.exports===pt;function Rr(e,t){return e.set(t[0],t[1]),e}function Ir(e,t){return e.add(t),e}function Mr(e,t){for(var r=-1,o=e?e.length:0;++r<o&&t(e[r],r,e)!==!1;);return e}function jr(e,t){for(var r=-1,o=t.length,u=e.length;++r<o;)e[u+r]=t[r];return e}function bt(e,t,r,o){var u=-1,n=e?e.length:0;for(o&&n&&(r=e[++u]);++u<n;)r=t(r,e[u],u,e);return r}function xr(e,t){for(var r=-1,o=Array(e);++r<e;)o[r]=t(r);return o}function Lr(e,t){return e==null?void 0:e[t]}function yt(e){var t=!1;if(e!=null&&typeof e.toString!="function")try{t=!!(e+"")}catch(r){}return t}function wt(e){var t=-1,r=Array(e.size);return e.forEach(function(o,u){r[++t]=[u,o]}),r}function $e(e,t){return function(r){return e(t(r))}}function Et(e){var t=-1,r=Array(e.size);return e.forEach(function(o){r[++t]=o}),r}var Hr=Array.prototype,Vr=Function.prototype,oe=Object.prototype,be=D["__core-js_shared__"],Tt=function(){var e=/[^.]+$/.exec(be&&be.keys&&be.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),At=Vr.toString,R=oe.hasOwnProperty,se=oe.toString,Fr=RegExp("^"+At.call(R).replace(Sr,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),vt=Wr?D.Buffer:void 0,St=D.Symbol,_t=D.Uint8Array,Pr=$e(Object.getPrototypeOf,Object),Jr=Object.create,Br=oe.propertyIsEnumerable,Ur=Hr.splice,Nt=Object.getOwnPropertySymbols,kr=vt?vt.isBuffer:void 0,qr=$e(Object.keys,Object),ye=F(D,"DataView"),q=F(D,"Map"),we=F(D,"Promise"),Ee=F(D,"Set"),Te=F(D,"WeakMap"),G=F(Object,"create"),Gr=L(ye),Kr=L(q),Zr=L(we),Yr=L(Ee),Xr=L(Te),Ct=St?St.prototype:void 0,Ot=Ct?Ct.valueOf:void 0;function j(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var o=e[t];this.set(o[0],o[1])}}function zr(){this.__data__=G?G(null):{}}function Qr(e){return this.has(e)&&delete this.__data__[e]}function en(e){var t=this.__data__;if(G){var r=t[e];return r===Ye?void 0:r}return R.call(t,e)?t[e]:void 0}function tn(e){var t=this.__data__;return G?t[e]!==void 0:R.call(t,e)}function rn(e,t){var r=this.__data__;return r[e]=G&&t===void 0?Ye:t,this}j.prototype.clear=zr;j.prototype.delete=Qr;j.prototype.get=en;j.prototype.has=tn;j.prototype.set=rn;function W(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var o=e[t];this.set(o[0],o[1])}}function nn(){this.__data__=[]}function on(e){var t=this.__data__,r=ie(t,e);if(r<0)return!1;var o=t.length-1;return r==o?t.pop():Ur.call(t,r,1),!0}function sn(e){var t=this.__data__,r=ie(t,e);return r<0?void 0:t[r][1]}function an(e){return ie(this.__data__,e)>-1}function un(e,t){var r=this.__data__,o=ie(r,e);return o<0?r.push([e,t]):r[o][1]=t,this}W.prototype.clear=nn;W.prototype.delete=on;W.prototype.get=sn;W.prototype.has=an;W.prototype.set=un;function H(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var o=e[t];this.set(o[0],o[1])}}function ln(){this.__data__={hash:new j,map:new(q||W),string:new j}}function cn(e){return ae(this,e).delete(e)}function gn(e){return ae(this,e).get(e)}function fn(e){return ae(this,e).has(e)}function hn(e,t){return ae(this,e).set(e,t),this}H.prototype.clear=ln;H.prototype.delete=cn;H.prototype.get=gn;H.prototype.has=fn;H.prototype.set=hn;function V(e){this.__data__=new W(e)}function dn(){this.__data__=new W}function mn(e){return this.__data__.delete(e)}function pn(e){return this.__data__.get(e)}function $n(e){return this.__data__.has(e)}function bn(e,t){var r=this.__data__;if(r instanceof W){var o=r.__data__;if(!q||o.length<Tr-1)return o.push([e,t]),this;r=this.__data__=new H(o)}return r.set(e,t),this}V.prototype.clear=dn;V.prototype.delete=mn;V.prototype.get=pn;V.prototype.has=$n;V.prototype.set=bn;function yn(e,t){var r=Se(e)||Bn(e)?xr(e.length,String):[],o=r.length,u=!!o;for(var n in e)(t||R.call(e,n))&&!(u&&(n=="length"||Vn(n,o)))&&r.push(n);return r}function Dt(e,t,r){var o=e[t];(!(R.call(e,t)&&Mt(o,r))||r===void 0&&!(t in e))&&(e[t]=r)}function ie(e,t){for(var r=e.length;r--;)if(Mt(e[r][0],t))return r;return-1}function wn(e,t){return e&&Wt(t,_e(t),e)}function Ae(e,t,r,o,u,n,g){var a;if(o&&(a=n?o(e,u,n,g):o(e)),a!==void 0)return a;if(!ue(e))return e;var c=Se(e);if(c){if(a=xn(e),!t)return In(e,a)}else{var i=x(e),f=i==de||i==et;if(kn(e))return _n(e,t);if(i==me||i==he||f&&!n){if(yt(e))return n?e:{};if(a=Ln(f?{}:e),!t)return Mn(e,wn(a,e))}else{if(!w[i])return n?e:{};a=Hn(e,i,Ae,t)}}g||(g=new V);var m=g.get(e);if(m)return m;if(g.set(e,a),!c)var p=r?jn(e):_e(e);return Mr(p||e,function(d,h){p&&(h=d,d=e[h]),Dt(a,h,Ae(d,t,r,o,h,e,g))}),a}function En(e){return ue(e)?Jr(e):{}}function Tn(e,t,r){var o=t(e);return Se(e)?o:jr(o,r(e))}function An(e){return se.call(e)}function vn(e){if(!ue(e)||Pn(e))return!1;var t=xt(e)||yt(e)?Fr:Nr;return t.test(L(e))}function Sn(e){if(!It(e))return qr(e);var t=[];for(var r in Object(e))R.call(e,r)&&r!="constructor"&&t.push(r);return t}function _n(e,t){if(t)return e.slice();var r=new e.constructor(e.length);return e.copy(r),r}function ve(e){var t=new e.constructor(e.byteLength);return new _t(t).set(new _t(e)),t}function Nn(e,t){var r=t?ve(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}function Cn(e,t,r){var o=t?r(wt(e),!0):wt(e);return bt(o,Rr,new e.constructor)}function On(e){var t=new e.constructor(e.source,_r.exec(e));return t.lastIndex=e.lastIndex,t}function Dn(e,t,r){var o=t?r(Et(e),!0):Et(e);return bt(o,Ir,new e.constructor)}function Wn(e){return Ot?Object(Ot.call(e)):{}}function Rn(e,t){var r=t?ve(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}function In(e,t){var r=-1,o=e.length;for(t||(t=Array(o));++r<o;)t[r]=e[r];return t}function Wt(e,t,r,o){r||(r={});for(var u=-1,n=t.length;++u<n;){var g=t[u],a=o?o(r[g],e[g],g,r,e):void 0;Dt(r,g,a===void 0?e[g]:a)}return r}function Mn(e,t){return Wt(e,Rt(e),t)}function jn(e){return Tn(e,_e,Rt)}function ae(e,t){var r=e.__data__;return Fn(t)?r[typeof t=="string"?"string":"hash"]:r.map}function F(e,t){var r=Lr(e,t);return vn(r)?r:void 0}var Rt=Nt?$e(Nt,Object):Kn,x=An;(ye&&x(new ye(new ArrayBuffer(1)))!=ne||q&&x(new q)!=te||we&&x(we.resolve())!=rt||Ee&&x(new Ee)!=re||Te&&x(new Te)!=pe)&&(x=function(e){var t=se.call(e),r=t==me?e.constructor:void 0,o=r?L(r):void 0;if(o)switch(o){case Gr:return ne;case Kr:return te;case Zr:return rt;case Yr:return re;case Xr:return pe}return t});function xn(e){var t=e.length,r=e.constructor(t);return t&&typeof e[0]=="string"&&R.call(e,"index")&&(r.index=e.index,r.input=e.input),r}function Ln(e){return typeof e.constructor=="function"&&!It(e)?En(Pr(e)):{}}function Hn(e,t,r,o){var u=e.constructor;switch(t){case it:return ve(e);case ze:case Qe:return new u(+e);case ne:return Nn(e,o);case at:case ut:case lt:case ct:case gt:case ft:case ht:case dt:case mt:return Rn(e,o);case te:return Cn(e,o,r);case tt:case ot:return new u(e);case nt:return On(e);case re:return Dn(e,o,r);case st:return Wn(e)}}function Vn(e,t){return t=t==null?Xe:t,!!t&&(typeof e=="number"||Cr.test(e))&&e>-1&&e%1==0&&e<t}function Fn(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function Pn(e){return!!Tt&&Tt in e}function It(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||oe;return e===r}function L(e){if(e!=null){try{return At.call(e)}catch(t){}try{return e+""}catch(t){}}return""}function Jn(e){return Ae(e,!0,!0)}function Mt(e,t){return e===t||e!==e&&t!==t}function Bn(e){return Un(e)&&R.call(e,"callee")&&(!Br.call(e,"callee")||se.call(e)==he)}var Se=Array.isArray;function jt(e){return e!=null&&qn(e.length)&&!xt(e)}function Un(e){return Gn(e)&&jt(e)}var kn=kr||Zn;function xt(e){var t=ue(e)?se.call(e):"";return t==de||t==et}function qn(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=Xe}function ue(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function Gn(e){return!!e&&typeof e=="object"}function _e(e){return jt(e)?yn(e):Sn(e)}function Kn(){return[]}function Zn(){return!1}P.exports=Jn});var uo={};ar(uo,{defaults:()=>tr,removeWidows:()=>ao,version:()=>io});function Je(e){return typeof e=="string"?e.length?[e]:[]:e}function Be(e){return e&&typeof e=="object"&&!Array.isArray(e)}function ee(e){return typeof e=="string"}var Ue={cb:void 0,i:!1,trimBeforeMatching:!1,trimCharsBeforeMatching:[],maxMismatches:0,firstMustMatch:!1,lastMustMatch:!1,hungry:!1},lr=e=>e+1;function cr(e,t,r,o,u=!1,n=lr){let g=typeof r=="function"?r():r;if(+t<0&&u&&g==="EOL")return g;let a=T(T({},Ue),o);if(t>=e.length&&!u)return!1;let c=u?1:r.length,i=0,f=!1,m=!1,p=!1,d=a.maxMismatches,h=t,A=!1,b=!1,y=!1;function v(){return i===1&&d<a.maxMismatches-1}for(;e[h];){let S=n(h);if(a.trimBeforeMatching&&e[h].trim()===""){if(!e[S]&&u&&r==="EOL")return!0;h=n(h);continue}if(a&&!a.i&&a.trimCharsBeforeMatching&&a.trimCharsBeforeMatching.includes(e[h])||(a==null?void 0:a.i)&&a.trimCharsBeforeMatching&&a.trimCharsBeforeMatching.map(_=>_.toLowerCase()).includes(e[h].toLowerCase())){if(u&&r==="EOL"&&!e[S])return!0;h=n(h);continue}let E=S>h?r[r.length-c]:r[c-1];if(!a.i&&e[h]===E||a.i&&e[h].toLowerCase()===E.toLowerCase()){if(A||(A=!0),p||(p=!0),c===r.length){if(b=!0,d!==a.maxMismatches)return!1}else c===1&&(y=!0);if(c-=1,i++,v())return!1;if(!c)return i!==r.length||d===a.maxMismatches||!f?h:!1}else if(!f&&!i&&(f=!0),a.maxMismatches&&d&&h){d-=1;for(let _=0;_<=d;_++){let l=S>h?r[r.length-c+1+_]:r[c-2-_],C=e[n(h)];if(l&&(!a.i&&e[h]===l||a.i&&e[h].toLowerCase()===l.toLowerCase())&&(!a.firstMustMatch||c!==r.length)){if(i++,v())return!1;c-=2,A=!0;break}else if(C&&l&&(!a.i&&C===l||a.i&&C.toLowerCase()===l.toLowerCase())&&(!a.firstMustMatch||c!==r.length)){if(!i&&!a.hungry)return!1;c-=1,A=!0;break}else if(l===void 0&&d>=0&&A&&(!a.firstMustMatch||b)&&(!a.lastMustMatch||y))return h}A||(m=h)}else return h===0&&c===1&&!a.lastMustMatch&&p?0:!1;if(m!==!1&&m!==h&&(m=!1),c<1)return h;h=n(h)}if(c>0)return u&&g==="EOL"?!0:a&&a.maxMismatches>=c&&p?m||0:!1}function gr(e,t,r,o,u){if(Be(u)&&Object.prototype.hasOwnProperty.call(u,"trimBeforeMatching")&&typeof u.trimBeforeMatching!="boolean")throw new Error(`string-match-left-right/${e}(): [THROW_ID_09] opts.trimBeforeMatching should be boolean!${Array.isArray(u.trimBeforeMatching)?" Did you mean to use opts.trimCharsBeforeMatching?":""}`);let n=T(T({},Ue),u);if(typeof n.trimCharsBeforeMatching=="string"&&(n.trimCharsBeforeMatching=Je(n.trimCharsBeforeMatching)),n.trimCharsBeforeMatching=n.trimCharsBeforeMatching.map(f=>ee(f)?f:String(f)),!ee(t)||!t.length)return!1;if(!Number.isInteger(r)||r<0)throw new Error(`string-match-left-right/${e}(): [THROW_ID_03] the second argument should be a natural number. Currently it's of a type: ${typeof r}, equal to:
11
11
  ${JSON.stringify(r,null,4)}`);let g,a;if(ee(o))g=[o];else if(Array.isArray(o))g=o;else if(!o)g=o;else if(typeof o=="function")g=[],g.push(o);else throw new Error(`string-match-left-right/${e}(): [THROW_ID_05] the third argument, whatToMatch, is neither string nor array of strings! It's ${typeof o}, equal to:
12
12
  ${JSON.stringify(o,null,4)}`);if(u&&!Be(u))throw new Error(`string-match-left-right/${e}(): [THROW_ID_06] the fourth argument, options object, should be a plain object. Currently it's of a type "${typeof u}", and equal to:
13
13
  ${JSON.stringify(u,null,4)}`);let c=0,i="";if((n==null?void 0:n.trimCharsBeforeMatching)&&n.trimCharsBeforeMatching.some((f,m)=>f.length>1?(c=m,i=f,!0):!1))throw new Error(`string-match-left-right/${e}(): [THROW_ID_07] the fourth argument, options object contains trimCharsBeforeMatching. It was meant to list the single characters but one of the entries at index ${c} is longer than 1 character, ${i.length} (equals to ${i}). Please split it into separate characters and put into array as separate elements.`);if(!g||!Array.isArray(g)||Array.isArray(g)&&!g.length||Array.isArray(g)&&g.length===1&&ee(g[0])&&!g[0].trim()){if(typeof n.cb=="function"){let m,p=r;if((e==="matchLeftIncl"||e==="matchRight")&&(p+=1),e[5]==="L")for(let b=p;b--;){let y=t[b];if((!n.trimBeforeMatching||n.trimBeforeMatching&&y!==void 0&&y.trim())&&(!n.trimCharsBeforeMatching||!n.trimCharsBeforeMatching.length||y!==void 0&&!n.trimCharsBeforeMatching.includes(y))){m=b;break}}else if(e.startsWith("matchRight"))for(let b=p;b<t.length;b++){let y=t[b];if((!n.trimBeforeMatching||n.trimBeforeMatching&&y.trim())&&(!n.trimCharsBeforeMatching||!n.trimCharsBeforeMatching.length||!n.trimCharsBeforeMatching.includes(y))){m=b;break}}if(m===void 0)return!1;let d=t[m],h=m+1,A="";return h&&h>0&&(A=t.slice(0,h)),e[5]==="L"||m&&m>0&&(A=t.slice(m)),n.cb(d,A,m)}let f="";throw u||(f=" More so, the whole options object, the fourth input argument, is missing!"),new Error(`string-match-left-right/${e}(): [THROW_ID_08] 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!${f}`)}for(let f=0,m=g.length;f<m;f++){a=typeof g[f]=="function";let p=g[f],d,h,A="",b=r;e==="matchRight"?b+=1:e==="matchLeft"&&(b-=1);let y=cr(t,b,p,n,a,v=>e[5]==="L"?v-1:v+1);if(y&&a&&typeof p=="function"&&p()==="EOL")return p()&&(n.cb?n.cb(d,A,h):!0)?p():!1;if(Number.isInteger(y)&&(h=e.startsWith("matchLeft")?y-1:y+1,e[5]==="L"?A=t.slice(0,y):A=t.slice(h)),h<0&&(h=void 0),t[h]&&(d=t[h]),Number.isInteger(y)&&(n.cb?n.cb(d,A,h):!0))return p}return!1}function ke(e,t,r,o){return gr("matchRightIncl",e,t,r,o)}var Yn=Pe(Ze(),1),Xn=Pe(Lt(),1);var J="\xA0";function zn({str:e,idx:t=0,stopAtNewlines:r=!1,stopAtRawNbsp:o=!1}){if(typeof e!="string"||!e.length||((!t||typeof t!="number")&&(t=0),!e[t+1]))return null;if(e[t+1]&&(e[t+1].trim()||r&&`
@@ -22,8 +22,8 @@ ${JSON.stringify(u,null,4)}`);let c=0,i="";if((n==null?void 0:n.trimCharsBeforeM
22
22
  `.includes(n[d])||n[d]===r?(f=0,n[d]===r?p+=n[d]:n[d]===c?m<=g&&(p+=n[d],n[d+1]===i&&(p+=n[d+1],d++)):n[d]===i&&(!n[d-1]||n[d-1]!==c)&&m<=g&&(p+=n[d])):(f++,!n[d+1]&&!m&&(p+=" "));return p}if(typeof e=="string"&&e.length){let n=1;typeof+t=="number"&&Number.isInteger(+t)&&+t>=0&&(n=+t);let g="",a="";if(!e.trim())g=e;else if(!e[0].trim()){for(let c=0,i=e.length;c<i;c++)if(e[c].trim()){g=e.slice(0,c);break}}if(e.trim()&&(e.slice(-1).trim()===""||e.slice(-1)===r)){for(let c=e.length;c--;)if(e[c].trim()){a=e.slice(c+1);break}}return`${u(g,n,!1)}${e.trim()}${o(u(o(a),n,!0))}`}return e}var eo={strictlyTwoElementsInRangeArrays:!1,progressFn:null};function Ht(e,t){if(!Array.isArray(e)||!e.length)return e;let r=T(T({},eo),t),o,u;if(r.strictlyTwoElementsInRangeArrays&&!e.every((a,c)=>!Array.isArray(a)||a.length!==2?(o=c,u=a.length,!1):!0))throw new TypeError(`ranges-sort: [THROW_ID_03] The first argument should be an array and must consist of arrays which are natural number indexes representing TWO string index ranges. However, ${o}th range (${JSON.stringify(e[o],null,4)}) has not two but ${u} elements!`);if(!e.every((a,c)=>!Array.isArray(a)||!Number.isInteger(a[0])||a[0]<0||!Number.isInteger(a[1])||a[1]<0?(o=c,!1):!0))throw new TypeError(`ranges-sort: [THROW_ID_04] The first argument should be an array and must consist of arrays which are natural number indexes representing string index ranges. However, ${o}th range (${JSON.stringify(e[o],null,4)}) does not consist of only natural numbers!`);let n=e.length**2,g=0;return Array.from(e).sort((a,c)=>(r.progressFn&&(g+=1,r.progressFn(Math.floor(g*100/n))),a[0]===c[0]?a[1]<c[1]?-1:a[1]>c[1]?1:0:a[0]<c[0]?-1:1))}var Vt={mergeType:1,progressFn:null,joinRangesThatTouchEdges:!0};function to(e,t){function r(i){return i&&typeof i=="object"&&!Array.isArray(i)}if(!Array.isArray(e)||!e.length)return null;let o;if(t)if(r(t)){if(o=T(T({},Vt),t),o.progressFn&&r(o.progressFn)&&!Object.keys(o.progressFn).length)o.progressFn=null;else if(o.progressFn&&typeof o.progressFn!="function")throw new Error(`ranges-merge: [THROW_ID_01] opts.progressFn must be a function! It was given of a type: "${typeof o.progressFn}", equal to ${JSON.stringify(o.progressFn,null,4)}`);if(![1,2,"1","2"].includes(o.mergeType))throw new Error(`ranges-merge: [THROW_ID_02] opts.mergeType was customised to a wrong thing! It was given of a type: "${typeof o.mergeType}", equal to ${JSON.stringify(o.mergeType,null,4)}`);if(typeof o.joinRangesThatTouchEdges!="boolean")throw new Error(`ranges-merge: [THROW_ID_04] opts.joinRangesThatTouchEdges was customised to a wrong thing! It was given of a type: "${typeof o.joinRangesThatTouchEdges}", equal to ${JSON.stringify(o.joinRangesThatTouchEdges,null,4)}`)}else throw new Error(`emlint: [THROW_ID_03] the second input argument must be a plain object. It was given as:
23
23
  ${JSON.stringify(t,null,4)} (type ${typeof t})`);else o=T({},Vt);let u=e.filter(i=>Array.isArray(i)).map(i=>[...i]).filter(i=>i[2]!==void 0||i[0]!==i[1]),n,g,a;o.progressFn?n=Ht(u,{progressFn:i=>{a=Math.floor(i/5),a!==g&&(g=a,o.progressFn(a))}}):n=Ht(u);let c=n.length-1;for(let i=c;i>0;i--)o.progressFn&&(a=Math.floor((1-i/c)*78)+21,a!==g&&a>g&&(g=a,o.progressFn(a))),(n[i][0]<=n[i-1][0]||!o.joinRangesThatTouchEdges&&n[i][0]<n[i-1][1]||o.joinRangesThatTouchEdges&&n[i][0]<=n[i-1][1])&&(n[i-1][0]=Math.min(n[i][0],n[i-1][0]),n[i-1][1]=Math.max(n[i][1],n[i-1][1]),n[i][2]!==void 0&&(n[i-1][0]>=n[i][0]||n[i-1][1]<=n[i][1])&&n[i-1][2]!==null&&(n[i][2]===null&&n[i-1][2]!==null?n[i-1][2]=null:n[i-1][2]!=null?+o.mergeType==2&&n[i-1][0]===n[i][0]?n[i-1][2]=n[i][2]:n[i-1][2]+=n[i][2]:n[i-1][2]=n[i][2]),n.splice(i,1),i=n.length);return n.length?n:null}function I(e){return e!=null}function M(e){return Number.isInteger(e)&&e>=0}function Y(e){return typeof e=="string"}var ro={limitToBeAddedWhitespace:!1,limitLinebreaksCount:1,mergeType:1},Ft=class{constructor(e){fe(this,"ranges");fe(this,"opts");let t=T(T({},ro),e);if(t.mergeType&&t.mergeType!==1&&t.mergeType!==2)if(Y(t.mergeType)&&t.mergeType.trim()==="1")t.mergeType=1;else if(Y(t.mergeType)&&t.mergeType.trim()==="2")t.mergeType=2;else throw new Error(`ranges-push: [THROW_ID_02] opts.mergeType was customised to a wrong thing! It was given of a type: "${typeof t.mergeType}", equal to ${JSON.stringify(t.mergeType,null,4)}`);this.opts=t,this.ranges=[]}add(e,t,r){if(e==null&&t==null)return;if(I(e)&&!I(t)){if(Array.isArray(e)){if(e.length){if(e.some(n=>Array.isArray(n))){e.forEach(n=>{Array.isArray(n)&&this.add(...n)});return}e.length&&M(+e[0])&&M(+e[1])&&this.add(...e)}return}throw new TypeError(`ranges-push/Ranges/add(): [THROW_ID_12] the first input argument, "from" is set (${JSON.stringify(e,null,0)}) but second-one, "to" is not (${JSON.stringify(t,null,0)})`)}else if(!I(e)&&I(t))throw new TypeError(`ranges-push/Ranges/add(): [THROW_ID_13] the second input argument, "to" is set (${JSON.stringify(t,null,0)}) but first-one, "from" is not (${JSON.stringify(e,null,0)})`);let o=+e,u=+t;if(M(r)&&(r=String(r)),M(o)&&M(u)){if(I(r)&&!Y(r)&&!M(r))throw new TypeError(`ranges-push/Ranges/add(): [THROW_ID_08] The third argument, the value to add, was given not as string but ${typeof r}, equal to:
24
24
  ${JSON.stringify(r,null,4)}`);if(I(this.ranges)&&Array.isArray(this.last())&&o===this.last()[1]){if(this.last()[1]=u,this.last()[2],this.last()[2]!==null&&I(r)){let n=this.last()[2]&&this.last()[2].length>0&&(!this.opts||!this.opts.mergeType||this.opts.mergeType===1)?`${this.last()[2]}${r}`:r;this.opts.limitToBeAddedWhitespace&&(n=le(n,this.opts.limitLinebreaksCount)),Y(n)&&!n.length||(this.last()[2]=n)}}else{this.ranges||(this.ranges=[]);let n=r!==void 0&&!(Y(r)&&!r.length)?[o,u,r&&this.opts.limitToBeAddedWhitespace?le(r,this.opts.limitLinebreaksCount):r]:[o,u];this.ranges.push(n)}}else throw M(o)&&o>=0?new TypeError(`ranges-push/Ranges/add(): [THROW_ID_10] "to" value, the second input argument, must be a natural number or zero! Currently it's of a type "${typeof u}" equal to: ${JSON.stringify(u,null,4)}`):new TypeError(`ranges-push/Ranges/add(): [THROW_ID_09] "from" value, the first input argument, must be a natural number or zero! Currently it's of a type "${typeof o}" equal to: ${JSON.stringify(o,null,4)}`)}push(e,t,r){this.add(e,t,r)}current(){return Array.isArray(this.ranges)&&this.ranges.length?(this.ranges=to(this.ranges,{mergeType:this.opts.mergeType}),this.ranges&&this.opts.limitToBeAddedWhitespace?this.ranges.map(e=>I(e[2])?[e[0],e[1],le(e[2],this.opts.limitLinebreaksCount)]:e):this.ranges):null}wipe(){this.ranges=[]}replace(e){if(Array.isArray(e)&&e.length)if(Array.isArray(e[0])&&M(e[0][0]))this.ranges=Array.from(e);else throw new Error(`ranges-push/Ranges/replace(): [THROW_ID_11] Single range was given but we expected array of arrays! The first element, ${JSON.stringify(e[0],null,4)} should be an array and its first element should be an integer, a string index.`);else this.ranges=[]}last(){return Array.isArray(this.ranges)&&this.ranges.length?this.ranges[this.ranges.length-1]:null}};var no={strictlyTwoElementsInRangeArrays:!1,progressFn:null};function Ne(e,t){if(!Array.isArray(e)||!e.length)return e;let r=T(T({},no),t),o,u;if(r.strictlyTwoElementsInRangeArrays&&!e.every((a,c)=>!Array.isArray(a)||a.length!==2?(o=c,u=a.length,!1):!0))throw new TypeError(`ranges-sort: [THROW_ID_03] The first argument should be an array and must consist of arrays which are natural number indexes representing TWO string index ranges. However, ${o}th range (${JSON.stringify(e[o],null,4)}) has not two but ${u} elements!`);if(!e.every((a,c)=>!Array.isArray(a)||!Number.isInteger(a[0])||a[0]<0||!Number.isInteger(a[1])||a[1]<0?(o=c,!1):!0))throw new TypeError(`ranges-sort: [THROW_ID_04] The first argument should be an array and must consist of arrays which are natural number indexes representing string index ranges. However, ${o}th range (${JSON.stringify(e[o],null,4)}) does not consist of only natural numbers!`);let n=e.length**2,g=0;return Array.from(e).sort((a,c)=>(r.progressFn&&(g+=1,r.progressFn(Math.floor(g*100/n))),a[0]===c[0]?a[1]<c[1]?-1:a[1]>c[1]?1:0:a[0]<c[0]?-1:1))}var Pt={mergeType:1,progressFn:null,joinRangesThatTouchEdges:!0};function Jt(e,t){function r(i){return i&&typeof i=="object"&&!Array.isArray(i)}if(!Array.isArray(e)||!e.length)return null;let o;if(t)if(r(t)){if(o=T(T({},Pt),t),o.progressFn&&r(o.progressFn)&&!Object.keys(o.progressFn).length)o.progressFn=null;else if(o.progressFn&&typeof o.progressFn!="function")throw new Error(`ranges-merge: [THROW_ID_01] opts.progressFn must be a function! It was given of a type: "${typeof o.progressFn}", equal to ${JSON.stringify(o.progressFn,null,4)}`);if(![1,2,"1","2"].includes(o.mergeType))throw new Error(`ranges-merge: [THROW_ID_02] opts.mergeType was customised to a wrong thing! It was given of a type: "${typeof o.mergeType}", equal to ${JSON.stringify(o.mergeType,null,4)}`);if(typeof o.joinRangesThatTouchEdges!="boolean")throw new Error(`ranges-merge: [THROW_ID_04] opts.joinRangesThatTouchEdges was customised to a wrong thing! It was given of a type: "${typeof o.joinRangesThatTouchEdges}", equal to ${JSON.stringify(o.joinRangesThatTouchEdges,null,4)}`)}else throw new Error(`emlint: [THROW_ID_03] the second input argument must be a plain object. It was given as:
25
- ${JSON.stringify(t,null,4)} (type ${typeof t})`);else o=T({},Pt);let u=e.filter(i=>Array.isArray(i)).map(i=>[...i]).filter(i=>i[2]!==void 0||i[0]!==i[1]),n,g,a;o.progressFn?n=Ne(u,{progressFn:i=>{a=Math.floor(i/5),a!==g&&(g=a,o.progressFn(a))}}):n=Ne(u);let c=n.length-1;for(let i=c;i>0;i--)o.progressFn&&(a=Math.floor((1-i/c)*78)+21,a!==g&&a>g&&(g=a,o.progressFn(a))),(n[i][0]<=n[i-1][0]||!o.joinRangesThatTouchEdges&&n[i][0]<n[i-1][1]||o.joinRangesThatTouchEdges&&n[i][0]<=n[i-1][1])&&(n[i-1][0]=Math.min(n[i][0],n[i-1][0]),n[i-1][1]=Math.max(n[i][1],n[i-1][1]),n[i][2]!==void 0&&(n[i-1][0]>=n[i][0]||n[i-1][1]<=n[i][1])&&n[i-1][2]!==null&&(n[i][2]===null&&n[i-1][2]!==null?n[i-1][2]=null:n[i-1][2]!=null?+o.mergeType==2&&n[i-1][0]===n[i][0]?n[i-1][2]=n[i][2]:n[i-1][2]+=n[i][2]:n[i-1][2]=n[i][2]),n.splice(i,1),i=n.length);return n.length?n:null}var oo=!0,Ce="Invariant failed";function Bt(e,t){if(!e){if(oo)throw new Error(Ce);var r=typeof t=="function"?t():t,o=r?Ce+": "+r:Ce;throw new Error(o)}}function Oe(e,t,r){let o=0,u=0;if(arguments.length===0)throw new Error("ranges-apply: [THROW_ID_01] inputs missing!");if(typeof e!="string")throw new TypeError(`ranges-apply: [THROW_ID_02] first input argument must be a string! Currently it's: ${typeof e}, equal to: ${JSON.stringify(e,null,4)}`);if(t&&!Array.isArray(t))throw new TypeError(`ranges-apply: [THROW_ID_03] second input argument must be an array (or null)! Currently it's: ${typeof t}, equal to: ${JSON.stringify(t,null,4)}`);if(r&&typeof r!="function")throw new TypeError(`ranges-apply: [THROW_ID_04] the third input argument must be a function (or falsey)! Currently it's: ${typeof r}, equal to: ${JSON.stringify(r,null,4)}`);if(!t||!t.filter(f=>f).length)return e;let n;Array.isArray(t)&&Number.isInteger(t[0])&&Number.isInteger(t[1])?n=[Array.from(t)]:n=Array.from(t);let g=n.length,a=0;n.filter(f=>f).forEach((f,m)=>{if(r&&(o=Math.floor(a/g*10),o!==u&&(u=o,r(o))),!Array.isArray(f))throw new TypeError(`ranges-apply: [THROW_ID_05] ranges array, second input arg., has ${m}th element not an array: ${JSON.stringify(f,null,4)}, which is ${typeof f}`);if(!Number.isInteger(f[0])){if(!Number.isInteger(+f[0])||+f[0]<0)throw new TypeError(`ranges-apply: [THROW_ID_06] ranges array, second input arg. has ${m}th element, array ${JSON.stringify(f,null,0)}. Its first element is not an integer, string index, but ${typeof f[0]}, equal to: ${JSON.stringify(f[0],null,4)}.`);n[m][0]=+n[m][0]}if(!Number.isInteger(f[1])){if(!Number.isInteger(+f[1])||+f[1]<0)throw new TypeError(`ranges-apply: [THROW_ID_07] ranges array, second input arg. has ${m}th element, array ${JSON.stringify(f,null,0)}. Its second element is not an integer, string index, but ${typeof f[1]}, equal to: ${JSON.stringify(f[1],null,4)}.`);n[m][1]=+n[m][1]}a+=1});let c=Jt(n,{progressFn:f=>{r&&(o=10+Math.floor(f/10),o!==u&&(u=o,r(o)))}});Bt(c);let i=c.length;if(i>0){let f=e.slice(c[i-1][1]);e=c.reduce((m,p,d,h)=>{r&&(o=20+Math.floor(d/i*80),o!==u&&(u=o,r(o)));let A=d===0?0:h[d-1][1],b=h[d][0];return`${m}${e.slice(A,b)}${h[d][2]||""}`},""),e+=f}return e}var Ut="3.0.11";var U="\xA0",X="&nbsp;",z="\\00A0",Q="\\u00A0",kt="\u2013",qt="&ndash;",Gt="\\2013",Kt="\\u2013",Zt="\u2014",Yt="&mdash;",Xt="\\2014",zt="\\u2014",We=[{heads:"{{",tails:"}}"},{heads:["{% if","{%- if"],tails:["{% endif","{%- endif"]},{heads:["{% for","{%- for"],tails:["{% endfor","{%- endfor"]},{heads:["{%","{%-"],tails:["%}","-%}"]},{heads:"{#",tails:"#}"}],Qt=[{heads:"{{",tails:"}}"}],De=[{heads:["<%","<%=","<%-"],tails:["%>","=%>","-%>"]}],er=["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 io=Ut,tr={removeWidowPreventionMeasures:!1,convertEntities:!0,targetLanguage:"html",UKPostcodes:!1,hyphens:!0,minWordCount:4,minCharCount:5,ignore:[],reportProgressFunc:null,reportProgressFuncFrom:0,reportProgressFuncTo:100,tagRanges:[]};function ao(e,t){var lo;let r=Date.now();if(typeof e!="string")throw e===void 0?new Error("string-remove-widows: [THROW_ID_01] the first input argument is completely missing! It should be given as string."):new Error(`string-remove-widows: [THROW_ID_02] the first input argument must be string! It was given as "${typeof e}", equal to:
26
- ${JSON.stringify(e,null,4)}`);if(t&&typeof t!="object")throw new Error(`string-remove-widows: [THROW_ID_03] the second input argument, options object, should be a plain object but it was given as type ${typeof t}, equal to ${JSON.stringify(t,null,4)}`);let o=Array.isArray,u=e.length,n=new Ft({mergeType:2}),g=["."],a=/[A-Z]{1,2}[0-9][0-9A-Z]?$/,c=/^[0-9][A-Z]{2}/,i=.06,f,m=0,p=0,d=0,h,A,b,y,v,S,E,_,l=T(T({},tr),t),C={removeWidows:!1,convertEntities:!1};if(!l.ignore||!o(l.ignore)&&typeof l.ignore!="string")l.ignore=[];else if(typeof l.ignore=="string"&&(l.ignore=[l.ignore]),l.ignore.includes("all"))l.ignore=l.ignore.concat(We.concat(De));else if(l.ignore.some(s=>typeof s=="string")){let s=[];l.ignore=l.ignore.filter(N=>typeof N=="string"&&N.length?(["nunjucks","jinja","liquid"].includes(N.trim().toLowerCase())?s=s.concat(We):["hugo"].includes(N.trim().toLowerCase())?s=s.concat(Qt):["hexo"].includes(N.trim().toLowerCase())&&(s=s.concat(De)),!1):typeof N=="object"),s.length&&(l.ignore=l.ignore.concat(s))}let Re;l.reportProgressFunc&&(Re=Math.floor(l.reportProgressFuncTo-(l.reportProgressFuncTo-l.reportProgressFuncFrom)*i-l.reportProgressFuncFrom));function ce(s,N){let $=U;l.removeWidowPreventionMeasures?$=" ":l.convertEntities&&($=X,typeof l.targetLanguage=="string"&&(l.targetLanguage.trim().toLowerCase()==="css"?$=z:l.targetLanguage.trim().toLowerCase()==="js"&&($=Q))),e.slice(s,N)!==$&&n.push(s,N,$)}function Ie(){p=0,d=0,h=void 0,A=void 0,b=void 0,y=void 0,v=void 0,S=void 0}Ie();for(let s=0;s<=u;s++){if(!E&&o(l.ignore)&&l.ignore.length&&l.ignore.some(($,O)=>{if(o($.heads)&&$.heads.some(Me=>e.startsWith(Me,s))||typeof $.heads=="string"&&e.startsWith($.heads,s))return p+=1,E=l.ignore[O].tails,!0}),!E&&_&&_===s&&(p+=1,_=void 0),typeof l.reportProgressFunc=="function"&&(f=l.reportProgressFuncFrom+Math.floor(s/u*(Re||1)),f!==m&&(m=f,l.reportProgressFunc(f))),!E&&s&&e[s]&&e[s].trim()&&(!e[s-1]||e[s-1]&&!e[s-1].trim())&&(y=s),!E&&e[s]&&e[s].trim()&&(d+=1),!E&&l.hyphens&&(`-${Zt}${kt}`.includes(e[s])||e.startsWith(qt,s)||e.startsWith(Gt,s)||e.startsWith(Kt,s)||e.startsWith(Yt,s)||e.startsWith(Xt,s)||e.startsWith(zt,s))&&e[s+1]&&(!e[s+1].trim()||e[s]==="&")&&e[s-1]&&!e[s-1].trim()&&e[Z(e,s)]&&(ce(Z(e,s)+1,s),C.removeWidows=!0),!E&&(e.startsWith("&nbsp;",s)||e.startsWith("&#160;",s))&&(v=s,S=s+6,e[s+6]&&e[s+6].trim()&&(_=s+6),l.convertEntities?(l.targetLanguage==="css"||l.targetLanguage==="js")&&(n.push(s,s+6,l.targetLanguage==="css"?z:Q),C.convertEntities=!0):(n.push(s,s+6,U),C.convertEntities=!0)),!E&&e[s+4]&&e[s]==="\\"&&e[s+1]==="0"&&e[s+2]==="0"&&e[s+3].toUpperCase()==="A"&&e[s+4]==="0"&&(v=s,S=s+5,e[s+5]&&e[s+5].trim()&&(_=s+5),l.convertEntities?(l.targetLanguage==="html"||l.targetLanguage==="js")&&(n.push(s,s+5,l.targetLanguage==="html"?X:Q),C.convertEntities=!0):(n.push(s,s+5,U),C.convertEntities=!0)),!E&&e[s]==="\\"&&e[s+1]&&e[s+1].toLowerCase()==="u"&&e[s+2]==="0"&&e[s+3]==="0"&&e[s+4]&&e[s+4].toUpperCase()==="A"&&e[s+5]==="0"&&(v=s,S=s+6,e[s+6]&&e[s+6].trim()&&(_=s+6),l.convertEntities?(l.targetLanguage==="html"||l.targetLanguage==="css")&&n.push(s,s+6,l.targetLanguage==="html"?X:z):n.push(s,s+6,U)),!E&&e[s]===U&&(v=s,S=s+1,l.convertEntities&&n.push(s,s+1,l.targetLanguage==="css"?z:l.targetLanguage==="js"?Q:X)),!E&&e[s]&&e[s].trim()&&(!e[s-1]||!e[s-1].trim())&&(p+=1),!E&&(!e[s]||`\r
25
+ ${JSON.stringify(t,null,4)} (type ${typeof t})`);else o=T({},Pt);let u=e.filter(i=>Array.isArray(i)).map(i=>[...i]).filter(i=>i[2]!==void 0||i[0]!==i[1]),n,g,a;o.progressFn?n=Ne(u,{progressFn:i=>{a=Math.floor(i/5),a!==g&&(g=a,o.progressFn(a))}}):n=Ne(u);let c=n.length-1;for(let i=c;i>0;i--)o.progressFn&&(a=Math.floor((1-i/c)*78)+21,a!==g&&a>g&&(g=a,o.progressFn(a))),(n[i][0]<=n[i-1][0]||!o.joinRangesThatTouchEdges&&n[i][0]<n[i-1][1]||o.joinRangesThatTouchEdges&&n[i][0]<=n[i-1][1])&&(n[i-1][0]=Math.min(n[i][0],n[i-1][0]),n[i-1][1]=Math.max(n[i][1],n[i-1][1]),n[i][2]!==void 0&&(n[i-1][0]>=n[i][0]||n[i-1][1]<=n[i][1])&&n[i-1][2]!==null&&(n[i][2]===null&&n[i-1][2]!==null?n[i-1][2]=null:n[i-1][2]!=null?+o.mergeType==2&&n[i-1][0]===n[i][0]?n[i-1][2]=n[i][2]:n[i-1][2]+=n[i][2]:n[i-1][2]=n[i][2]),n.splice(i,1),i=n.length);return n.length?n:null}var oo=!0,Ce="Invariant failed";function Bt(e,t){if(!e){if(oo)throw new Error(Ce);var r=typeof t=="function"?t():t,o=r?Ce+": "+r:Ce;throw new Error(o)}}function Oe(e,t,r){let o=0,u=0;if(arguments.length===0)throw new Error("ranges-apply: [THROW_ID_01] inputs missing!");if(typeof e!="string")throw new TypeError(`ranges-apply: [THROW_ID_02] first input argument must be a string! Currently it's: ${typeof e}, equal to: ${JSON.stringify(e,null,4)}`);if(t&&!Array.isArray(t))throw new TypeError(`ranges-apply: [THROW_ID_03] second input argument must be an array (or null)! Currently it's: ${typeof t}, equal to: ${JSON.stringify(t,null,4)}`);if(r&&typeof r!="function")throw new TypeError(`ranges-apply: [THROW_ID_04] the third input argument must be a function (or falsey)! Currently it's: ${typeof r}, equal to: ${JSON.stringify(r,null,4)}`);if(!t||!t.filter(f=>f).length)return e;let n;Array.isArray(t)&&Number.isInteger(t[0])&&Number.isInteger(t[1])?n=[Array.from(t)]:n=Array.from(t);let g=n.length,a=0;n.filter(f=>f).forEach((f,m)=>{if(r&&(o=Math.floor(a/g*10),o!==u&&(u=o,r(o))),!Array.isArray(f))throw new TypeError(`ranges-apply: [THROW_ID_05] ranges array, second input arg., has ${m}th element not an array: ${JSON.stringify(f,null,4)}, which is ${typeof f}`);if(!Number.isInteger(f[0])){if(!Number.isInteger(+f[0])||+f[0]<0)throw new TypeError(`ranges-apply: [THROW_ID_06] ranges array, second input arg. has ${m}th element, array ${JSON.stringify(f,null,0)}. Its first element is not an integer, string index, but ${typeof f[0]}, equal to: ${JSON.stringify(f[0],null,4)}.`);n[m][0]=+n[m][0]}if(!Number.isInteger(f[1])){if(!Number.isInteger(+f[1])||+f[1]<0)throw new TypeError(`ranges-apply: [THROW_ID_07] ranges array, second input arg. has ${m}th element, array ${JSON.stringify(f,null,0)}. Its second element is not an integer, string index, but ${typeof f[1]}, equal to: ${JSON.stringify(f[1],null,4)}.`);n[m][1]=+n[m][1]}a+=1});let c=Jt(n,{progressFn:f=>{r&&(o=10+Math.floor(f/10),o!==u&&(u=o,r(o)))}});Bt(c);let i=c.length;if(i>0){let f=e.slice(c[i-1][1]);e=c.reduce((m,p,d,h)=>{r&&(o=20+Math.floor(d/i*80),o!==u&&(u=o,r(o)));let A=d===0?0:h[d-1][1],b=h[d][0];return`${m}${e.slice(A,b)}${h[d][2]||""}`},""),e+=f}return e}var Ut="3.0.12";var U="\xA0",X="&nbsp;",z="\\00A0",Q="\\u00A0",kt="\u2013",qt="&ndash;",Gt="\\2013",Kt="\\u2013",Zt="\u2014",Yt="&mdash;",Xt="\\2014",zt="\\u2014",De=[{heads:"{{",tails:"}}"},{heads:["{% if","{%- if"],tails:["{% endif","{%- endif"]},{heads:["{% for","{%- for"],tails:["{% endfor","{%- endfor"]},{heads:["{%","{%-"],tails:["%}","-%}"]},{heads:"{#",tails:"#}"}],Qt=[{heads:"{{",tails:"}}"}],We=[{heads:["<%","<%=","<%-"],tails:["%>","=%>","-%>"]}],er=["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 io=Ut,tr={removeWidowPreventionMeasures:!1,convertEntities:!0,targetLanguage:"html",UKPostcodes:!1,hyphens:!0,minWordCount:4,minCharCount:5,ignore:[],reportProgressFunc:null,reportProgressFuncFrom:0,reportProgressFuncTo:100,tagRanges:[]};function ao(e,t){var lo;let r=Date.now();if(typeof e!="string")throw e===void 0?new Error("string-remove-widows: [THROW_ID_01] the first input argument is completely missing! It should be given as string."):new Error(`string-remove-widows: [THROW_ID_02] the first input argument must be string! It was given as "${typeof e}", equal to:
26
+ ${JSON.stringify(e,null,4)}`);if(t&&typeof t!="object")throw new Error(`string-remove-widows: [THROW_ID_03] the second input argument, options object, should be a plain object but it was given as type ${typeof t}, equal to ${JSON.stringify(t,null,4)}`);let o=Array.isArray,u=e.length,n=new Ft({mergeType:2}),g=["."],a=/[A-Z]{1,2}[0-9][0-9A-Z]?$/,c=/^[0-9][A-Z]{2}/,i=.06,f,m=0,p=0,d=0,h,A,b,y,v,S,E,_,l=T(T({},tr),t),C={removeWidows:!1,convertEntities:!1};if(!l.ignore||!o(l.ignore)&&typeof l.ignore!="string")l.ignore=[];else if(typeof l.ignore=="string"&&(l.ignore=[l.ignore]),l.ignore.includes("all"))l.ignore=l.ignore.concat(De.concat(We));else if(l.ignore.some(s=>typeof s=="string")){let s=[];l.ignore=l.ignore.filter(N=>typeof N=="string"&&N.length?(["nunjucks","jinja","liquid"].includes(N.trim().toLowerCase())?s=s.concat(De):["hugo"].includes(N.trim().toLowerCase())?s=s.concat(Qt):["hexo"].includes(N.trim().toLowerCase())&&(s=s.concat(We)),!1):typeof N=="object"),s.length&&(l.ignore=l.ignore.concat(s))}let Re;l.reportProgressFunc&&(Re=Math.floor(l.reportProgressFuncTo-(l.reportProgressFuncTo-l.reportProgressFuncFrom)*i-l.reportProgressFuncFrom));function ce(s,N){let $=U;l.removeWidowPreventionMeasures?$=" ":l.convertEntities&&($=X,typeof l.targetLanguage=="string"&&(l.targetLanguage.trim().toLowerCase()==="css"?$=z:l.targetLanguage.trim().toLowerCase()==="js"&&($=Q))),e.slice(s,N)!==$&&n.push(s,N,$)}function Ie(){p=0,d=0,h=void 0,A=void 0,b=void 0,y=void 0,v=void 0,S=void 0}Ie();for(let s=0;s<=u;s++){if(!E&&o(l.ignore)&&l.ignore.length&&l.ignore.some(($,O)=>{if(o($.heads)&&$.heads.some(Me=>e.startsWith(Me,s))||typeof $.heads=="string"&&e.startsWith($.heads,s))return p+=1,E=l.ignore[O].tails,!0}),!E&&_&&_===s&&(p+=1,_=void 0),typeof l.reportProgressFunc=="function"&&(f=l.reportProgressFuncFrom+Math.floor(s/u*(Re||1)),f!==m&&(m=f,l.reportProgressFunc(f))),!E&&s&&e[s]&&e[s].trim()&&(!e[s-1]||e[s-1]&&!e[s-1].trim())&&(y=s),!E&&e[s]&&e[s].trim()&&(d+=1),!E&&l.hyphens&&(`-${Zt}${kt}`.includes(e[s])||e.startsWith(qt,s)||e.startsWith(Gt,s)||e.startsWith(Kt,s)||e.startsWith(Yt,s)||e.startsWith(Xt,s)||e.startsWith(zt,s))&&e[s+1]&&(!e[s+1].trim()||e[s]==="&")&&e[s-1]&&!e[s-1].trim()&&e[Z(e,s)]&&(ce(Z(e,s)+1,s),C.removeWidows=!0),!E&&(e.startsWith("&nbsp;",s)||e.startsWith("&#160;",s))&&(v=s,S=s+6,e[s+6]&&e[s+6].trim()&&(_=s+6),l.convertEntities?(l.targetLanguage==="css"||l.targetLanguage==="js")&&(n.push(s,s+6,l.targetLanguage==="css"?z:Q),C.convertEntities=!0):(n.push(s,s+6,U),C.convertEntities=!0)),!E&&e[s+4]&&e[s]==="\\"&&e[s+1]==="0"&&e[s+2]==="0"&&e[s+3].toUpperCase()==="A"&&e[s+4]==="0"&&(v=s,S=s+5,e[s+5]&&e[s+5].trim()&&(_=s+5),l.convertEntities?(l.targetLanguage==="html"||l.targetLanguage==="js")&&(n.push(s,s+5,l.targetLanguage==="html"?X:Q),C.convertEntities=!0):(n.push(s,s+5,U),C.convertEntities=!0)),!E&&e[s]==="\\"&&e[s+1]&&e[s+1].toLowerCase()==="u"&&e[s+2]==="0"&&e[s+3]==="0"&&e[s+4]&&e[s+4].toUpperCase()==="A"&&e[s+5]==="0"&&(v=s,S=s+6,e[s+6]&&e[s+6].trim()&&(_=s+6),l.convertEntities?(l.targetLanguage==="html"||l.targetLanguage==="css")&&n.push(s,s+6,l.targetLanguage==="html"?X:z):n.push(s,s+6,U)),!E&&e[s]===U&&(v=s,S=s+1,l.convertEntities&&n.push(s,s+1,l.targetLanguage==="css"?z:l.targetLanguage==="js"?Q:X)),!E&&e[s]&&e[s].trim()&&(!e[s-1]||!e[s-1].trim())&&(p+=1),!E&&(!e[s]||`\r
27
27
  `.includes(e[s])||(e[s]===`
28
28
  `||e[s]==="\r"||e[s]==="\r"&&e[s+1]===`
29
29
  `)&&Z(e,s)&&g.includes(e[Z(e,s)]))){if((!l.minWordCount||p>=l.minWordCount)&&(!l.minCharCount||d>=l.minCharCount)){let $,O;b!==void 0&&y!==void 0&&v!==void 0&&S!==void 0?b>v?($=b,O=y):($=v,O=S):b!==void 0&&y!==void 0?($=b,O=y):v!==void 0&&S!==void 0&&($=v,O=S),!($&&O)&&h&&A&&($=h,O=A),$&&O&&(ce($,O),C.removeWidows=!0)}Ie()}l.UKPostcodes&&e[s]&&!e[s].trim()&&e[s-1]&&e[s-1].trim()&&a.test(e.slice(0,s))&&e[B(e,s)]&&c.test(e.slice(B(e,s)))&&(ce(s,B(e,s)),C.removeWidows=!0),!E&&e[s]&&!e[s].trim()&&e[s-1]&&e[s-1].trim()&&(b===void 0||e[b-1]&&e[b-1].trim())&&!"/>".includes(e[B(e,s)])&&!e.slice(0,s).trim().endsWith("br")&&!e.slice(0,s).trim().endsWith("hr")&&!(e.slice(0,s).endsWith("<")&&er.some($=>e.startsWith($,B(e,s))))&&(h=b,A=y,b=s,y=void 0,(v!==void 0||S!==void 0)&&(v=void 0,S=void 0));let N;E&&(typeof E=="string"&&(!E.length||e.startsWith(E,s))?E=void 0:o(E)&&(!E.length||E.some($=>{if(e.startsWith($,s))return N=$,!0}))&&(E=void 0,s+=N.length,o(l.ignore)&&l.ignore.length&&e[s+1]&&l.ignore.some($=>ke(e,s,$.tails,{trimBeforeMatching:!0,cb:(O,Me,je)=>(je&&(s=je-1,e[s+1]&&e[s+1].trim()&&(p+=1)),!0)})))),e[s]&&`\r
@@ -31,7 +31,7 @@ ${JSON.stringify(e,null,4)}`);if(t&&typeof t!="object")throw new Error(`string-r
31
31
  /**
32
32
  * @name arrayiffy-if-string
33
33
  * @fileoverview Put non-empty strings into arrays, turn empty-ones into empty arrays. Bypass everything else.
34
- * @version 4.0.11
34
+ * @version 4.0.12
35
35
  * @author Roy Revelt, Codsen Ltd
36
36
  * @license MIT
37
37
  * {@link https://codsen.com/os/arrayiffy-if-string/}
@@ -39,7 +39,7 @@ ${JSON.stringify(e,null,4)}`);if(t&&typeof t!="object")throw new Error(`string-r
39
39
  /**
40
40
  * @name ranges-apply
41
41
  * @fileoverview Take an array of string index ranges, delete/replace the string according to them
42
- * @version 6.0.11
42
+ * @version 6.0.12
43
43
  * @author Roy Revelt, Codsen Ltd
44
44
  * @license MIT
45
45
  * {@link https://codsen.com/os/ranges-apply/}
@@ -47,7 +47,7 @@ ${JSON.stringify(e,null,4)}`);if(t&&typeof t!="object")throw new Error(`string-r
47
47
  /**
48
48
  * @name ranges-merge
49
49
  * @fileoverview Merge and sort string index ranges
50
- * @version 8.0.11
50
+ * @version 8.0.12
51
51
  * @author Roy Revelt, Codsen Ltd
52
52
  * @license MIT
53
53
  * {@link https://codsen.com/os/ranges-merge/}
@@ -55,7 +55,7 @@ ${JSON.stringify(e,null,4)}`);if(t&&typeof t!="object")throw new Error(`string-r
55
55
  /**
56
56
  * @name ranges-push
57
57
  * @fileoverview Gather string index ranges
58
- * @version 6.0.11
58
+ * @version 6.0.12
59
59
  * @author Roy Revelt, Codsen Ltd
60
60
  * @license MIT
61
61
  * {@link https://codsen.com/os/ranges-push/}
@@ -63,7 +63,7 @@ ${JSON.stringify(e,null,4)}`);if(t&&typeof t!="object")throw new Error(`string-r
63
63
  /**
64
64
  * @name ranges-sort
65
65
  * @fileoverview Sort string index ranges
66
- * @version 5.0.11
66
+ * @version 5.0.12
67
67
  * @author Roy Revelt, Codsen Ltd
68
68
  * @license MIT
69
69
  * {@link https://codsen.com/os/ranges-sort/}
@@ -71,7 +71,7 @@ ${JSON.stringify(e,null,4)}`);if(t&&typeof t!="object")throw new Error(`string-r
71
71
  /**
72
72
  * @name string-collapse-leading-whitespace
73
73
  * @fileoverview Collapse the leading and trailing whitespace of a string
74
- * @version 6.0.11
74
+ * @version 6.0.12
75
75
  * @author Roy Revelt, Codsen Ltd
76
76
  * @license MIT
77
77
  * {@link https://codsen.com/os/string-collapse-leading-whitespace/}
@@ -79,7 +79,7 @@ ${JSON.stringify(e,null,4)}`);if(t&&typeof t!="object")throw new Error(`string-r
79
79
  /**
80
80
  * @name string-left-right
81
81
  * @fileoverview Looks up the first non-whitespace character to the left/right of a given index
82
- * @version 5.0.11
82
+ * @version 5.0.12
83
83
  * @author Roy Revelt, Codsen Ltd
84
84
  * @license MIT
85
85
  * {@link https://codsen.com/os/string-left-right/}
@@ -87,7 +87,7 @@ ${JSON.stringify(e,null,4)}`);if(t&&typeof t!="object")throw new Error(`string-r
87
87
  /**
88
88
  * @name string-match-left-right
89
89
  * @fileoverview Match substrings on the left or right of a given index, ignoring whitespace
90
- * @version 8.0.11
90
+ * @version 8.0.12
91
91
  * @author Roy Revelt, Codsen Ltd
92
92
  * @license MIT
93
93
  * {@link https://codsen.com/os/string-match-left-right/}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "string-remove-widows",
3
- "version": "3.0.11",
3
+ "version": "3.0.12",
4
4
  "description": "Helps to prevent widow words in a text",
5
5
  "keywords": [
6
6
  "against",
@@ -40,9 +40,10 @@
40
40
  "scripts": {
41
41
  "build": "node '../../ops/scripts/esbuild.js' && yarn run dts",
42
42
  "dev": "DEV=true node '../../ops/scripts/esbuild.js' && yarn run dts",
43
+ "devtest": "c8 yarn run unit && yarn run examples && yarn run lint",
43
44
  "dts": "rollup -c && yarn run prettier 'types/index.d.ts' --write",
44
45
  "examples": "node '../../ops/scripts/run-examples.js'",
45
- "lect": "node '../../ops/lect/lect.js'",
46
+ "lect": "node '../../ops/lect/lect.js' && yarn run prettier 'README.md' '.all-contributorsrc' 'rollup.config.js' --write",
46
47
  "letspublish": "yarn publish || :",
47
48
  "lint": "eslint . --fix",
48
49
  "perf": "node perf/check.js",
@@ -50,7 +51,7 @@
50
51
  "prettier": "prettier",
51
52
  "prettier:format": "prettier --write '**/*.{ts,tsx,md}' --no-error-on-unmatched-pattern",
52
53
  "pretest": "yarn run lect && yarn run build",
53
- "test": "c8 yarn run unit && yarn run examples && yarn run lint",
54
+ "test": "yarn run devtest",
54
55
  "unit": "uvu test"
55
56
  },
56
57
  "engines": {
@@ -71,12 +72,12 @@
71
72
  }
72
73
  },
73
74
  "dependencies": {
74
- "ranges-apply": "^6.0.11",
75
- "ranges-push": "^6.0.11",
76
- "string-left-right": "^5.0.11",
77
- "string-match-left-right": "^8.0.11"
75
+ "ranges-apply": "^6.0.12",
76
+ "ranges-push": "^6.0.12",
77
+ "string-left-right": "^5.0.12",
78
+ "string-match-left-right": "^8.0.12"
78
79
  },
79
80
  "devDependencies": {
80
- "string-strip-html": "^9.1.5"
81
+ "string-strip-html": "^9.1.6"
81
82
  }
82
83
  }