Socket
Socket
Sign inDemoInstall

string-remove-widows

Package Overview
Dependencies
Maintainers
1
Versions
143
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

string-remove-widows - npm Package Compare versions

Comparing version 4.0.9 to 4.0.10

4

dist/string-remove-widows.esm.js
/**
* @name string-remove-widows
* @fileoverview Helps to prevent widow words in a text
* @version 4.0.9
* @version 4.0.10
* @author Roy Revelt, Codsen Ltd

@@ -10,3 +10,3 @@ * @license MIT

import{matchRightIncl as Q}from"string-match-left-right";import{left as T,right as D}from"string-left-right";import{Ranges as X}from"ranges-push";import{rApply as q}from"ranges-apply";import{rawNbsp as w,rawNDash as ee,rawMDash as te}from"codsen-utils";var R="4.0.9";var f="&nbsp;",E="\\00A0",S="\\u00A0",j="&ndash;",M="\\2013",J="\\u2013",U="&mdash;",k="\\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 ce=R,oe={removeWidowPreventionMeasures:!1,convertEntities:!0,targetLanguage:"html",UKPostcodes:!1,hyphens:!0,minWordCount:4,minCharCount:5,ignore:[],reportProgressFunc:null,reportProgressFuncFrom:0,reportProgressFuncTo:100,tagRanges:[]};function me(t,h){let G=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:
import{matchRightIncl as Q}from"string-match-left-right";import{left as T,right as D}from"string-left-right";import{Ranges as X}from"ranges-push";import{rApply as q}from"ranges-apply";import{rawNbsp as w,rawNDash as ee,rawMDash as te}from"codsen-utils";var R="4.0.10";var f="&nbsp;",E="\\00A0",S="\\u00A0",j="&ndash;",M="\\2013",J="\\u2013",U="&mdash;",k="\\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 ce=R,oe={removeWidowPreventionMeasures:!1,convertEntities:!0,targetLanguage:"html",UKPostcodes:!1,hyphens:!0,minWordCount:4,minCharCount:5,ignore:[],reportProgressFunc:null,reportProgressFuncFrom:0,reportProgressFuncTo:100,tagRanges:[]};function me(t,h){let G=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:
${JSON.stringify(t,null,4)}`);if(h&&typeof h!="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 h}, equal to ${JSON.stringify(h,null,4)}`);let b=Array.isArray,L=t.length,a=new X({mergeType:2}),K=["."],Z=/[A-Z]{1,2}[0-9][0-9A-Z]?$/,Y=/^[0-9][A-Z]{2}/,V=.06,$,A=0,g=0,W=0,y,N,d,c,r,l,s,p,o={...oe,...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,W=0,y=void 0,N=void 0,d=void 0,c=void 0,r=void 0,l=void 0}O();for(let e=0;e<=L;e++){if(!s&&b(o.ignore)&&o.ignore.length&&o.ignore.some((n,u)=>{if(b(n.heads)&&n.heads.some(H=>t.startsWith(H,e))||typeof n.heads=="string"&&t.startsWith(n.heads,e))return g+=1,s=o.ignore[u].tails,!0}),!s&&p&&p===e&&(g+=1,p=void 0),typeof o.reportProgressFunc=="function"&&($=o.reportProgressFuncFrom+Math.floor(e/L*(x||1)),$!==A&&(A=$,o.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&&o.hyphens&&(`-${te}${ee}`.includes(t[e])||t.startsWith(j,e)||t.startsWith(M,e)||t.startsWith(J,e)||t.startsWith(U,e)||t.startsWith(k,e)||t.startsWith(I,e))&&t[e+1]&&(!t[e+1].trim()||t[e]==="&")&&t[e-1]&&!t[e-1].trim()&&t[T(t,e)]&&(v(T(t,e)+1,e),m.removeWidows=!0),!s&&(t.startsWith("&nbsp;",e)||t.startsWith("&#160;",e))&&(r=e,l=e+6,t[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,l=e+5,t[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]&&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,l=e+6,t[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,l=e+1,o.convertEntities&&a.push(e,e+1,o.targetLanguage==="css"?E:o.targetLanguage==="js"?S:f)),!s&&t[e]&&t[e].trim()&&(!t[e-1]||!t[e-1].trim())&&(g+=1),!s&&(!t[e]||`\r

@@ -13,0 +13,0 @@ `.includes(t[e])||(t[e]===`

/**
* @name string-remove-widows
* @fileoverview Helps to prevent widow words in a text
* @version 4.0.9
* @version 4.0.10
* @author Roy Revelt, Codsen Ltd

@@ -10,27 +10,27 @@ * @license MIT

"use strict";var stringRemoveWidows=(()=>{var Qt=Object.create;var q=Object.defineProperty;var Zt=Object.getOwnPropertyDescriptor;var zt=Object.getOwnPropertyNames,Le=Object.getOwnPropertySymbols,Yt=Object.getPrototypeOf,je=Object.prototype.hasOwnProperty,Xt=Object.prototype.propertyIsEnumerable;var ge=(e,t,r)=>t in e?q(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,A=(e,t)=>{for(var r in t||(t={}))je.call(t,r)&&ge(e,r,t[r]);if(Le)for(var r of Le(t))Xt.call(t,r)&&ge(e,r,t[r]);return e};var er=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),tr=(e,t)=>{for(var r in t)q(e,r,{get:t[r],enumerable:!0})},Fe=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let u of zt(t))!je.call(e,u)&&u!==r&&q(e,u,{get:()=>t[u],enumerable:!(n=Zt(t,u))||n.enumerable});return e};var rr=(e,t,r)=>(r=e!=null?Qt(Yt(e)):{},Fe(t||!e||!e.__esModule?q(r,"default",{value:e,enumerable:!0}):r,e)),nr=e=>Fe(q({},"__esModule",{value:!0}),e);var fe=(e,t,r)=>(ge(e,typeof t!="symbol"?t+"":t,r),r);var xt=er((K,P)=>{var ar=200,rt="__lodash_hash_undefined__",nt=9007199254740991,we="[object Arguments]",ur="[object Array]",st="[object Boolean]",ot="[object Date]",lr="[object Error]",Ee="[object Function]",it="[object GeneratorFunction]",te="[object Map]",at="[object Number]",Te="[object Object]",Ue="[object Promise]",ut="[object RegExp]",re="[object Set]",lt="[object String]",ct="[object Symbol]",de="[object WeakMap]",gt="[object ArrayBuffer]",ne="[object DataView]",ft="[object Float32Array]",ht="[object Float64Array]",dt="[object Int8Array]",pt="[object Int16Array]",mt="[object Int32Array]",$t="[object Uint8Array]",bt="[object Uint8ClampedArray]",yt="[object Uint16Array]",wt="[object Uint32Array]",cr=/[\\^$.*+?()[\]{}|]/g,gr=/\w*$/,fr=/^\[object .+?Constructor\]$/,hr=/^(?:0|[1-9]\d*)$/,T={};T[we]=T[ur]=T[gt]=T[ne]=T[st]=T[ot]=T[ft]=T[ht]=T[dt]=T[pt]=T[mt]=T[te]=T[at]=T[Te]=T[ut]=T[re]=T[lt]=T[ct]=T[$t]=T[bt]=T[yt]=T[wt]=!0;T[lr]=T[Ee]=T[de]=!1;var dr=typeof global=="object"&&global&&global.Object===Object&&global,pr=typeof self=="object"&&self&&self.Object===Object&&self,R=dr||pr||Function("return this")(),Et=typeof K=="object"&&K&&!K.nodeType&&K,qe=Et&&typeof P=="object"&&P&&!P.nodeType&&P,mr=qe&&qe.exports===Et;function $r(e,t){return e.set(t[0],t[1]),e}function br(e,t){return e.add(t),e}function yr(e,t){for(var r=-1,n=e?e.length:0;++r<n&&t(e[r],r,e)!==!1;);return e}function wr(e,t){for(var r=-1,n=t.length,u=e.length;++r<n;)e[u+r]=t[r];return e}function Tt(e,t,r,n){var u=-1,s=e?e.length:0;for(n&&s&&(r=e[++u]);++u<s;)r=t(r,e[u],u,e);return r}function Er(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}function Tr(e,t){return e==null?void 0:e[t]}function At(e){var t=!1;if(e!=null&&typeof e.toString!="function")try{t=!!(e+"")}catch(r){}return t}function Ge(e){var t=-1,r=Array(e.size);return e.forEach(function(n,u){r[++t]=[u,n]}),r}function Ae(e,t){return function(r){return e(t(r))}}function Ke(e){var t=-1,r=Array(e.size);return e.forEach(function(n){r[++t]=n}),r}var Ar=Array.prototype,vr=Function.prototype,se=Object.prototype,he=R["__core-js_shared__"],Qe=function(){var e=/[^.]+$/.exec(he&&he.keys&&he.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),vt=vr.toString,M=se.hasOwnProperty,oe=se.toString,Sr=RegExp("^"+vt.call(M).replace(cr,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ze=mr?R.Buffer:void 0,ze=R.Symbol,Ye=R.Uint8Array,_r=Ae(Object.getPrototypeOf,Object),Cr=Object.create,Nr=se.propertyIsEnumerable,Or=Ar.splice,Xe=Object.getOwnPropertySymbols,Dr=Ze?Ze.isBuffer:void 0,Wr=Ae(Object.keys,Object),pe=J(R,"DataView"),Q=J(R,"Map"),me=J(R,"Promise"),$e=J(R,"Set"),be=J(R,"WeakMap"),Z=J(Object,"create"),xr=F(pe),Rr=F(Q),Ir=F(me),Mr=F($e),Lr=F(be),et=ze?ze.prototype:void 0,tt=et?et.valueOf:void 0;function j(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function jr(){this.__data__=Z?Z(null):{}}function Fr(e){return this.has(e)&&delete this.__data__[e]}function Hr(e){var t=this.__data__;if(Z){var r=t[e];return r===rt?void 0:r}return M.call(t,e)?t[e]:void 0}function Pr(e){var t=this.__data__;return Z?t[e]!==void 0:M.call(t,e)}function Vr(e,t){var r=this.__data__;return r[e]=Z&&t===void 0?rt:t,this}j.prototype.clear=jr;j.prototype.delete=Fr;j.prototype.get=Hr;j.prototype.has=Pr;j.prototype.set=Vr;function I(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function Br(){this.__data__=[]}function Jr(e){var t=this.__data__,r=ie(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():Or.call(t,r,1),!0}function kr(e){var t=this.__data__,r=ie(t,e);return r<0?void 0:t[r][1]}function Ur(e){return ie(this.__data__,e)>-1}function qr(e,t){var r=this.__data__,n=ie(r,e);return n<0?r.push([e,t]):r[n][1]=t,this}I.prototype.clear=Br;I.prototype.delete=Jr;I.prototype.get=kr;I.prototype.has=Ur;I.prototype.set=qr;function V(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function Gr(){this.__data__={hash:new j,map:new(Q||I),string:new j}}function Kr(e){return ae(this,e).delete(e)}function Qr(e){return ae(this,e).get(e)}function Zr(e){return ae(this,e).has(e)}function zr(e,t){return ae(this,e).set(e,t),this}V.prototype.clear=Gr;V.prototype.delete=Kr;V.prototype.get=Qr;V.prototype.has=Zr;V.prototype.set=zr;function B(e){this.__data__=new I(e)}function Yr(){this.__data__=new I}function Xr(e){return this.__data__.delete(e)}function en(e){return this.__data__.get(e)}function tn(e){return this.__data__.has(e)}function rn(e,t){var r=this.__data__;if(r instanceof I){var n=r.__data__;if(!Q||n.length<ar-1)return n.push([e,t]),this;r=this.__data__=new V(n)}return r.set(e,t),this}B.prototype.clear=Yr;B.prototype.delete=Xr;B.prototype.get=en;B.prototype.has=tn;B.prototype.set=rn;function nn(e,t){var r=Se(e)||Nn(e)?Er(e.length,String):[],n=r.length,u=!!n;for(var s in e)(t||M.call(e,s))&&!(u&&(s=="length"||vn(s,n)))&&r.push(s);return r}function St(e,t,r){var n=e[t];(!(M.call(e,t)&&Ot(n,r))||r===void 0&&!(t in e))&&(e[t]=r)}function ie(e,t){for(var r=e.length;r--;)if(Ot(e[r][0],t))return r;return-1}function sn(e,t){return e&&_t(t,_e(t),e)}function ye(e,t,r,n,u,s,l){var a;if(n&&(a=s?n(e,u,s,l):n(e)),a!==void 0)return a;if(!ue(e))return e;var g=Se(e);if(g){if(a=En(e),!t)return bn(e,a)}else{var i=L(e),d=i==Ee||i==it;if(Dn(e))return gn(e,t);if(i==Te||i==we||d&&!s){if(At(e))return s?e:{};if(a=Tn(d?{}:e),!t)return yn(e,sn(a,e))}else{if(!T[i])return s?e:{};a=An(e,i,ye,t)}}l||(l=new B);var $=l.get(e);if($)return $;if(l.set(e,a),!g)var p=r?wn(e):_e(e);return yr(p||e,function(f,h){p&&(h=f,f=e[h]),St(a,h,ye(f,t,r,n,h,e,l))}),a}function on(e){return ue(e)?Cr(e):{}}function an(e,t,r){var n=t(e);return Se(e)?n:wr(n,r(e))}function un(e){return oe.call(e)}function ln(e){if(!ue(e)||_n(e))return!1;var t=Wt(e)||At(e)?Sr:fr;return t.test(F(e))}function cn(e){if(!Nt(e))return Wr(e);var t=[];for(var r in Object(e))M.call(e,r)&&r!="constructor"&&t.push(r);return t}function gn(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 Ye(t).set(new Ye(e)),t}function fn(e,t){var r=t?ve(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}function hn(e,t,r){var n=t?r(Ge(e),!0):Ge(e);return Tt(n,$r,new e.constructor)}function dn(e){var t=new e.constructor(e.source,gr.exec(e));return t.lastIndex=e.lastIndex,t}function pn(e,t,r){var n=t?r(Ke(e),!0):Ke(e);return Tt(n,br,new e.constructor)}function mn(e){return tt?Object(tt.call(e)):{}}function $n(e,t){var r=t?ve(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}function bn(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}function _t(e,t,r,n){r||(r={});for(var u=-1,s=t.length;++u<s;){var l=t[u],a=n?n(r[l],e[l],l,r,e):void 0;St(r,l,a===void 0?e[l]:a)}return r}function yn(e,t){return _t(e,Ct(e),t)}function wn(e){return an(e,_e,Ct)}function ae(e,t){var r=e.__data__;return Sn(t)?r[typeof t=="string"?"string":"hash"]:r.map}function J(e,t){var r=Tr(e,t);return ln(r)?r:void 0}var Ct=Xe?Ae(Xe,Object):Rn,L=un;(pe&&L(new pe(new ArrayBuffer(1)))!=ne||Q&&L(new Q)!=te||me&&L(me.resolve())!=Ue||$e&&L(new $e)!=re||be&&L(new be)!=de)&&(L=function(e){var t=oe.call(e),r=t==Te?e.constructor:void 0,n=r?F(r):void 0;if(n)switch(n){case xr:return ne;case Rr:return te;case Ir:return Ue;case Mr:return re;case Lr:return de}return t});function En(e){var t=e.length,r=e.constructor(t);return t&&typeof e[0]=="string"&&M.call(e,"index")&&(r.index=e.index,r.input=e.input),r}function Tn(e){return typeof e.constructor=="function"&&!Nt(e)?on(_r(e)):{}}function An(e,t,r,n){var u=e.constructor;switch(t){case gt:return ve(e);case st:case ot:return new u(+e);case ne:return fn(e,n);case ft:case ht:case dt:case pt:case mt:case $t:case bt:case yt:case wt:return $n(e,n);case te:return hn(e,n,r);case at:case lt:return new u(e);case ut:return dn(e);case re:return pn(e,n,r);case ct:return mn(e)}}function vn(e,t){return t=t==null?nt:t,!!t&&(typeof e=="number"||hr.test(e))&&e>-1&&e%1==0&&e<t}function Sn(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function _n(e){return!!Qe&&Qe in e}function Nt(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||se;return e===r}function F(e){if(e!=null){try{return vt.call(e)}catch(t){}try{return e+""}catch(t){}}return""}function Cn(e){return ye(e,!0,!0)}function Ot(e,t){return e===t||e!==e&&t!==t}function Nn(e){return On(e)&&M.call(e,"callee")&&(!Nr.call(e,"callee")||oe.call(e)==we)}var Se=Array.isArray;function Dt(e){return e!=null&&Wn(e.length)&&!Wt(e)}function On(e){return xn(e)&&Dt(e)}var Dn=Dr||In;function Wt(e){var t=ue(e)?oe.call(e):"";return t==Ee||t==it}function Wn(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=nt}function ue(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function xn(e){return!!e&&typeof e=="object"}function _e(e){return Dt(e)?nn(e):cn(e)}function Rn(){return[]}function In(){return!1}P.exports=Cn});var qn={};tr(qn,{defaults:()=>Kt,removeWidows:()=>Un,version:()=>kn});function He(e){return typeof e!="string"?e:e.length?[e]:[]}var Pe="\u2013",Ve="\u2014",H="\xA0";function G(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 N(e){return typeof e=="string"}function W(e){return Number.isSafeInteger(e)&&e>=0}function x(e){return e!=null}function Be(e,t){return G(e)&&N(t)&&Object.prototype.hasOwnProperty.call(e,t)}var Je={cb:void 0,i:!1,trimBeforeMatching:!1,trimCharsBeforeMatching:[],maxMismatches:0,firstMustMatch:!1,lastMustMatch:!1,hungry:!1},sr=e=>e+1;function or(e,t,r,n,u=!1,s=sr){let l=typeof r=="function"?r():r;if(+t<0&&u&&l==="EOL")return l;let a=A(A({},Je),n);if(t>=e.length&&!u)return!1;let g=u?1:r.length,i=0,d=!1,$=!1,p=!1,f=a.maxMismatches,h=t,S=!1,y=!1,v=!1;function w(){return i===1&&f<a.maxMismatches-1}for(;e[h];){let b=s(h);if(a.trimBeforeMatching&&e[h].trim()===""){if(!e[b]&&u&&r==="EOL")return!0;h=s(h);continue}if(a&&!a.i&&a.trimCharsBeforeMatching&&a.trimCharsBeforeMatching.includes(e[h])||a!=null&&a.i&&a.trimCharsBeforeMatching&&a.trimCharsBeforeMatching.map(_=>_.toLowerCase()).includes(e[h].toLowerCase())){if(u&&r==="EOL"&&!e[b])return!0;h=s(h);continue}let E=b>h?r[r.length-g]:r[g-1];if(!a.i&&e[h]===E||a.i&&e[h].toLowerCase()===E.toLowerCase()){if(S||(S=!0),p||(p=!0),g===r.length){if(y=!0,f!==a.maxMismatches)return!1}else g===1&&(v=!0);if(g-=1,i++,w())return!1;if(!g)return i!==r.length||f===a.maxMismatches||!d?h:!1}else if(!d&&!i&&(d=!0),a.maxMismatches&&f&&h){f-=1;for(let _=0;_<=f;_++){let c=b>h?r[r.length-g+1+_]:r[g-2-_],O=e[s(h)];if(c&&(!a.i&&e[h]===c||a.i&&e[h].toLowerCase()===c.toLowerCase())&&(!a.firstMustMatch||g!==r.length)){if(i++,w())return!1;g-=2,S=!0;break}else if(O&&c&&(!a.i&&O===c||a.i&&O.toLowerCase()===c.toLowerCase())&&(!a.firstMustMatch||g!==r.length)){if(!i&&!a.hungry)return!1;g-=1,S=!0;break}else if(c===void 0&&f>=0&&S&&(!a.firstMustMatch||y)&&(!a.lastMustMatch||v))return h}S||($=h)}else return h===0&&g===1&&!a.lastMustMatch&&p?0:!1;if($!==!1&&$!==h&&($=!1),g<1)return h;h=s(h)}if(g>0)return u&&l==="EOL"?!0:a&&a.maxMismatches>=g&&p?$||0:!1}function ir(e,t,r,n,u){var d,$;if(G(u)&&Be(u,"trimBeforeMatching")&&u&&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 s=A(A({},Je),u);if(typeof s.trimCharsBeforeMatching=="string"&&(s.trimCharsBeforeMatching=He(s.trimCharsBeforeMatching)),s.trimCharsBeforeMatching=s.trimCharsBeforeMatching.map(p=>N(p)?p:String(p)),!N(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:
${JSON.stringify(r,null,4)}`);let l,a;if(N(n))l=[n];else if(Array.isArray(n))l=n;else if(!n)l=n;else if(typeof n=="function")l=[],l.push(n);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 n}, equal to:
${JSON.stringify(n,null,4)}`);if(u&&!G(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:
${JSON.stringify(u,null,4)}`);let g=0,i="";if(s!=null&&s.trimCharsBeforeMatching&&s.trimCharsBeforeMatching.some((p,f)=>p.length>1?(g=f,i=p,!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 ${g} is longer than 1 character, ${i.length} (equals to ${i}). Please split it into separate characters and put into array as separate elements.`);if(!l||!Array.isArray(l)||Array.isArray(l)&&!l.length||Array.isArray(l)&&l.length===1&&N(l[0])&&!l[0].trim()){if(typeof s.cb=="function"){let f,h=r;if((e==="matchLeftIncl"||e==="matchRight")&&(h+=1),e[5]==="L")for(let w=h;w--;){let b=t[w];if((!s.trimBeforeMatching||s.trimBeforeMatching&&b!==void 0&&b.trim())&&(!((d=s.trimCharsBeforeMatching)!=null&&d.length)||b!==void 0&&!s.trimCharsBeforeMatching.includes(b))){f=w;break}}else if(e.startsWith("matchRight"))for(let w=h;w<t.length;w++){let b=t[w];if((!s.trimBeforeMatching||s.trimBeforeMatching&&b.trim())&&(!(($=s.trimCharsBeforeMatching)!=null&&$.length)||!s.trimCharsBeforeMatching.includes(b))){f=w;break}}if(f===void 0)return!1;let S=t[f],y=f+1,v="";return y&&y>0&&(v=t.slice(0,y)),e[5]==="L"||f&&f>0&&(v=t.slice(f)),s.cb(S,v,f)}let p="";throw u||(p=" 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!${p}`)}for(let p=0,f=l.length;p<f;p++){a=typeof l[p]=="function";let h=l[p],S,y,v="",w=r;e==="matchRight"?w+=1:e==="matchLeft"&&(w-=1);let b=or(t,w,h,s,a,E=>e[5]==="L"?E-1:E+1);if(b&&a&&typeof h=="function"&&h()==="EOL")return h()&&(!s.cb||s.cb(S,v,y))?h():!1;if(Number.isInteger(b)&&(y=e.startsWith("matchLeft")?b-1:b+1,e[5]==="L"?v=t.slice(0,b):v=t.slice(y)),y<0&&(y=void 0),t[y]&&(S=t[y]),Number.isInteger(b)&&(!s.cb||s.cb(S,v,y)))return h}return!1}function ke(e,t,r,n){return ir("matchRightIncl",e,t,r,n)}var Mn=rr(xt(),1);var k="\xA0";function Ln({str:e,idx:t=0,stopAtNewlines:r=!1,stopAtRawNbsp:n=!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&&`
\r`.includes(e[t+1])||n&&e[t+1]===k))return t+1;if(e[t+2]&&(e[t+2].trim()||r&&`
\r`.includes(e[t+2])||n&&e[t+2]===k))return t+2;for(let u=t+1,s=e.length;u<s;u++)if(e[u].trim()||r&&`
\r`.includes(e[u])||n&&e[u]===k)return u;return null}function U(e,t=0){return Ln({str:e,idx:t,stopAtNewlines:!1,stopAtRawNbsp:!1})}function jn({str:e,idx:t,stopAtNewlines:r,stopAtRawNbsp:n}){if(typeof e!="string"||!e.length||((!t||typeof t!="number")&&(t=0),t<1))return null;if(e[~-t]&&(e[~-t].trim()||r&&`
\r`.includes(e[~-t])||n&&e[~-t]===k))return~-t;if(e[t-2]&&(e[t-2].trim()||r&&`
\r`.includes(e[t-2])||n&&e[t-2]===k))return t-2;for(let u=t;u--;)if(e[u]&&(e[u].trim()||r&&`
\r`.includes(e[u])||n&&e[u]===k))return u;return null}function z(e,t=0){return jn({str:e,idx:t,stopAtNewlines:!1,stopAtRawNbsp:!1})}function le(e,t=1){let r="\xA0";function n(s){return Array.from(s).reverse().join("")}function u(s,l,a){let g=a?`
"use strict";var stringRemoveWidows=(()=>{var Kt=Object.create;var G=Object.defineProperty;var Qt=Object.getOwnPropertyDescriptor;var Zt=Object.getOwnPropertyNames,Le=Object.getOwnPropertySymbols,zt=Object.getPrototypeOf,je=Object.prototype.hasOwnProperty,Yt=Object.prototype.propertyIsEnumerable;var fe=(e,t,r)=>t in e?G(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,T=(e,t)=>{for(var r in t||(t={}))je.call(t,r)&&fe(e,r,t[r]);if(Le)for(var r of Le(t))Yt.call(t,r)&&fe(e,r,t[r]);return e};var Xt=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),er=(e,t)=>{for(var r in t)G(e,r,{get:t[r],enumerable:!0})},Fe=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let u of Zt(t))!je.call(e,u)&&u!==r&&G(e,u,{get:()=>t[u],enumerable:!(o=Qt(t,u))||o.enumerable});return e};var tr=(e,t,r)=>(r=e!=null?Kt(zt(e)):{},Fe(t||!e||!e.__esModule?G(r,"default",{value:e,enumerable:!0}):r,e)),rr=e=>Fe(G({},"__esModule",{value:!0}),e);var de=(e,t,r)=>(fe(e,typeof t!="symbol"?t+"":t,r),r);var Rt=Xt((Q,P)=>{var ir=200,rt="__lodash_hash_undefined__",nt=9007199254740991,Ee="[object Arguments]",ar="[object Array]",ot="[object Boolean]",st="[object Date]",ur="[object Error]",Ae="[object Function]",it="[object GeneratorFunction]",re="[object Map]",at="[object Number]",Te="[object Object]",Ue="[object Promise]",ut="[object RegExp]",ne="[object Set]",lt="[object String]",ct="[object Symbol]",pe="[object WeakMap]",gt="[object ArrayBuffer]",oe="[object DataView]",ft="[object Float32Array]",dt="[object Float64Array]",ht="[object Int8Array]",pt="[object Int16Array]",mt="[object Int32Array]",$t="[object Uint8Array]",bt="[object Uint8ClampedArray]",yt="[object Uint16Array]",wt="[object Uint32Array]",lr=/[\\^$.*+?()[\]{}|]/g,cr=/\w*$/,gr=/^\[object .+?Constructor\]$/,fr=/^(?:0|[1-9]\d*)$/,A={};A[Ee]=A[ar]=A[gt]=A[oe]=A[ot]=A[st]=A[ft]=A[dt]=A[ht]=A[pt]=A[mt]=A[re]=A[at]=A[Te]=A[ut]=A[ne]=A[lt]=A[ct]=A[$t]=A[bt]=A[yt]=A[wt]=!0;A[ur]=A[Ae]=A[pe]=!1;var dr=typeof global=="object"&&global&&global.Object===Object&&global,hr=typeof self=="object"&&self&&self.Object===Object&&self,x=dr||hr||Function("return this")(),Et=typeof Q=="object"&&Q&&!Q.nodeType&&Q,qe=Et&&typeof P=="object"&&P&&!P.nodeType&&P,pr=qe&&qe.exports===Et;function mr(e,t){return e.set(t[0],t[1]),e}function $r(e,t){return e.add(t),e}function br(e,t){for(var r=-1,o=e?e.length:0;++r<o&&t(e[r],r,e)!==!1;);return e}function yr(e,t){for(var r=-1,o=t.length,u=e.length;++r<o;)e[u+r]=t[r];return e}function At(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 wr(e,t){for(var r=-1,o=Array(e);++r<e;)o[r]=t(r);return o}function Er(e,t){return e==null?void 0:e[t]}function Tt(e){var t=!1;if(e!=null&&typeof e.toString!="function")try{t=!!(e+"")}catch(r){}return t}function Ge(e){var t=-1,r=Array(e.size);return e.forEach(function(o,u){r[++t]=[u,o]}),r}function ve(e,t){return function(r){return e(t(r))}}function Ke(e){var t=-1,r=Array(e.size);return e.forEach(function(o){r[++t]=o}),r}var Ar=Array.prototype,Tr=Function.prototype,se=Object.prototype,he=x["__core-js_shared__"],Qe=function(){var e=/[^.]+$/.exec(he&&he.keys&&he.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),vt=Tr.toString,I=se.hasOwnProperty,ie=se.toString,vr=RegExp("^"+vt.call(I).replace(lr,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ze=pr?x.Buffer:void 0,ze=x.Symbol,Ye=x.Uint8Array,Sr=ve(Object.getPrototypeOf,Object),_r=Object.create,Cr=se.propertyIsEnumerable,Nr=Ar.splice,Xe=Object.getOwnPropertySymbols,Dr=Ze?Ze.isBuffer:void 0,Or=ve(Object.keys,Object),me=J(x,"DataView"),Z=J(x,"Map"),$e=J(x,"Promise"),be=J(x,"Set"),ye=J(x,"WeakMap"),z=J(Object,"create"),Wr=F(me),Rr=F(Z),xr=F($e),Mr=F(be),Ir=F(ye),et=ze?ze.prototype:void 0,tt=et?et.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 Lr(){this.__data__=z?z(null):{}}function jr(e){return this.has(e)&&delete this.__data__[e]}function Fr(e){var t=this.__data__;if(z){var r=t[e];return r===rt?void 0:r}return I.call(t,e)?t[e]:void 0}function Hr(e){var t=this.__data__;return z?t[e]!==void 0:I.call(t,e)}function Pr(e,t){var r=this.__data__;return r[e]=z&&t===void 0?rt:t,this}j.prototype.clear=Lr;j.prototype.delete=jr;j.prototype.get=Fr;j.prototype.has=Hr;j.prototype.set=Pr;function M(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 Vr(){this.__data__=[]}function Br(e){var t=this.__data__,r=ae(t,e);if(r<0)return!1;var o=t.length-1;return r==o?t.pop():Nr.call(t,r,1),!0}function Jr(e){var t=this.__data__,r=ae(t,e);return r<0?void 0:t[r][1]}function kr(e){return ae(this.__data__,e)>-1}function Ur(e,t){var r=this.__data__,o=ae(r,e);return o<0?r.push([e,t]):r[o][1]=t,this}M.prototype.clear=Vr;M.prototype.delete=Br;M.prototype.get=Jr;M.prototype.has=kr;M.prototype.set=Ur;function V(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 qr(){this.__data__={hash:new j,map:new(Z||M),string:new j}}function Gr(e){return ue(this,e).delete(e)}function Kr(e){return ue(this,e).get(e)}function Qr(e){return ue(this,e).has(e)}function Zr(e,t){return ue(this,e).set(e,t),this}V.prototype.clear=qr;V.prototype.delete=Gr;V.prototype.get=Kr;V.prototype.has=Qr;V.prototype.set=Zr;function B(e){this.__data__=new M(e)}function zr(){this.__data__=new M}function Yr(e){return this.__data__.delete(e)}function Xr(e){return this.__data__.get(e)}function en(e){return this.__data__.has(e)}function tn(e,t){var r=this.__data__;if(r instanceof M){var o=r.__data__;if(!Z||o.length<ir-1)return o.push([e,t]),this;r=this.__data__=new V(o)}return r.set(e,t),this}B.prototype.clear=zr;B.prototype.delete=Yr;B.prototype.get=Xr;B.prototype.has=en;B.prototype.set=tn;function rn(e,t){var r=_e(e)||Cn(e)?wr(e.length,String):[],o=r.length,u=!!o;for(var n in e)(t||I.call(e,n))&&!(u&&(n=="length"||Tn(n,o)))&&r.push(n);return r}function St(e,t,r){var o=e[t];(!(I.call(e,t)&&Dt(o,r))||r===void 0&&!(t in e))&&(e[t]=r)}function ae(e,t){for(var r=e.length;r--;)if(Dt(e[r][0],t))return r;return-1}function nn(e,t){return e&&_t(t,Ce(t),e)}function we(e,t,r,o,u,n,c){var a;if(o&&(a=n?o(e,u,n,c):o(e)),a!==void 0)return a;if(!le(e))return e;var g=_e(e);if(g){if(a=wn(e),!t)return $n(e,a)}else{var i=L(e),h=i==Ae||i==it;if(Dn(e))return cn(e,t);if(i==Te||i==Ee||h&&!n){if(Tt(e))return n?e:{};if(a=En(h?{}:e),!t)return bn(e,nn(a,e))}else{if(!A[i])return n?e:{};a=An(e,i,we,t)}}c||(c=new B);var $=c.get(e);if($)return $;if(c.set(e,a),!g)var p=r?yn(e):Ce(e);return br(p||e,function(f,d){p&&(d=f,f=e[d]),St(a,d,we(f,t,r,o,d,e,c))}),a}function on(e){return le(e)?_r(e):{}}function sn(e,t,r){var o=t(e);return _e(e)?o:yr(o,r(e))}function an(e){return ie.call(e)}function un(e){if(!le(e)||Sn(e))return!1;var t=Wt(e)||Tt(e)?vr:gr;return t.test(F(e))}function ln(e){if(!Nt(e))return Or(e);var t=[];for(var r in Object(e))I.call(e,r)&&r!="constructor"&&t.push(r);return t}function cn(e,t){if(t)return e.slice();var r=new e.constructor(e.length);return e.copy(r),r}function Se(e){var t=new e.constructor(e.byteLength);return new Ye(t).set(new Ye(e)),t}function gn(e,t){var r=t?Se(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}function fn(e,t,r){var o=t?r(Ge(e),!0):Ge(e);return At(o,mr,new e.constructor)}function dn(e){var t=new e.constructor(e.source,cr.exec(e));return t.lastIndex=e.lastIndex,t}function hn(e,t,r){var o=t?r(Ke(e),!0):Ke(e);return At(o,$r,new e.constructor)}function pn(e){return tt?Object(tt.call(e)):{}}function mn(e,t){var r=t?Se(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}function $n(e,t){var r=-1,o=e.length;for(t||(t=Array(o));++r<o;)t[r]=e[r];return t}function _t(e,t,r,o){r||(r={});for(var u=-1,n=t.length;++u<n;){var c=t[u],a=o?o(r[c],e[c],c,r,e):void 0;St(r,c,a===void 0?e[c]:a)}return r}function bn(e,t){return _t(e,Ct(e),t)}function yn(e){return sn(e,Ce,Ct)}function ue(e,t){var r=e.__data__;return vn(t)?r[typeof t=="string"?"string":"hash"]:r.map}function J(e,t){var r=Er(e,t);return un(r)?r:void 0}var Ct=Xe?ve(Xe,Object):Rn,L=an;(me&&L(new me(new ArrayBuffer(1)))!=oe||Z&&L(new Z)!=re||$e&&L($e.resolve())!=Ue||be&&L(new be)!=ne||ye&&L(new ye)!=pe)&&(L=function(e){var t=ie.call(e),r=t==Te?e.constructor:void 0,o=r?F(r):void 0;if(o)switch(o){case Wr:return oe;case Rr:return re;case xr:return Ue;case Mr:return ne;case Ir:return pe}return t});function wn(e){var t=e.length,r=e.constructor(t);return t&&typeof e[0]=="string"&&I.call(e,"index")&&(r.index=e.index,r.input=e.input),r}function En(e){return typeof e.constructor=="function"&&!Nt(e)?on(Sr(e)):{}}function An(e,t,r,o){var u=e.constructor;switch(t){case gt:return Se(e);case ot:case st:return new u(+e);case oe:return gn(e,o);case ft:case dt:case ht:case pt:case mt:case $t:case bt:case yt:case wt:return mn(e,o);case re:return fn(e,o,r);case at:case lt:return new u(e);case ut:return dn(e);case ne:return hn(e,o,r);case ct:return pn(e)}}function Tn(e,t){return t=t==null?nt:t,!!t&&(typeof e=="number"||fr.test(e))&&e>-1&&e%1==0&&e<t}function vn(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function Sn(e){return!!Qe&&Qe in e}function Nt(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||se;return e===r}function F(e){if(e!=null){try{return vt.call(e)}catch(t){}try{return e+""}catch(t){}}return""}function _n(e){return we(e,!0,!0)}function Dt(e,t){return e===t||e!==e&&t!==t}function Cn(e){return Nn(e)&&I.call(e,"callee")&&(!Cr.call(e,"callee")||ie.call(e)==Ee)}var _e=Array.isArray;function Ot(e){return e!=null&&On(e.length)&&!Wt(e)}function Nn(e){return Wn(e)&&Ot(e)}var Dn=Dr||xn;function Wt(e){var t=le(e)?ie.call(e):"";return t==Ae||t==it}function On(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=nt}function le(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function Wn(e){return!!e&&typeof e=="object"}function Ce(e){return Ot(e)?rn(e):ln(e)}function Rn(){return[]}function xn(){return!1}P.exports=_n});var kn={};er(kn,{defaults:()=>Gt,removeWidows:()=>Jn,version:()=>Bn});function He(e){return typeof e!="string"?e:e.length?[e]:[]}var Pe="\u2013",Ve="\u2014",H="\xA0";function K(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 N(e){return typeof e=="string"}function W(e){return Number.isSafeInteger(e)&&e>=0}function R(e){return e!=null}function Be(e,t){return K(e)&&N(t)&&Object.prototype.hasOwnProperty.call(e,t)}var Je={cb:void 0,i:!1,trimBeforeMatching:!1,trimCharsBeforeMatching:[],maxMismatches:0,firstMustMatch:!1,lastMustMatch:!1,hungry:!1},nr=e=>e+1;function or(e,t,r,o,u=!1,n=nr){let c=typeof r=="function"?r():r;if(+t<0&&u&&c==="EOL")return c;let a=T(T({},Je),o);if(t>=e.length&&!u)return!1;let g=u?1:r.length,i=0,h=!1,$=!1,p=!1,f=a.maxMismatches,d=t,S=!1,y=!1,v=!1;function w(){return i===1&&f<a.maxMismatches-1}for(;e[d];){let b=n(d);if(a.trimBeforeMatching&&e[d].trim()===""){if(!e[b]&&u&&r==="EOL")return!0;d=n(d);continue}if(a&&!a.i&&a.trimCharsBeforeMatching&&a.trimCharsBeforeMatching.includes(e[d])||a!=null&&a.i&&a.trimCharsBeforeMatching&&a.trimCharsBeforeMatching.map(_=>_.toLowerCase()).includes(e[d].toLowerCase())){if(u&&r==="EOL"&&!e[b])return!0;d=n(d);continue}let E=b>d?r[r.length-g]:r[g-1];if(!a.i&&e[d]===E||a.i&&e[d].toLowerCase()===E.toLowerCase()){if(S||(S=!0),p||(p=!0),g===r.length){if(y=!0,f!==a.maxMismatches)return!1}else g===1&&(v=!0);if(g-=1,i++,w())return!1;if(!g)return i!==r.length||f===a.maxMismatches||!h?d:!1}else if(!h&&!i&&(h=!0),a.maxMismatches&&f&&d){f-=1;for(let _=0;_<=f;_++){let l=b>d?r[r.length-g+1+_]:r[g-2-_],D=e[n(d)];if(l&&(!a.i&&e[d]===l||a.i&&e[d].toLowerCase()===l.toLowerCase())&&(!a.firstMustMatch||g!==r.length)){if(i++,w())return!1;g-=2,S=!0;break}else if(D&&l&&(!a.i&&D===l||a.i&&D.toLowerCase()===l.toLowerCase())&&(!a.firstMustMatch||g!==r.length)){if(!i&&!a.hungry)return!1;g-=1,S=!0;break}else if(l===void 0&&f>=0&&S&&(!a.firstMustMatch||y)&&(!a.lastMustMatch||v))return d}S||($=d)}else return d===0&&g===1&&!a.lastMustMatch&&p?0:!1;if($!==!1&&$!==d&&($=!1),g<1)return d;d=n(d)}if(g>0)return u&&c==="EOL"?!0:a&&a.maxMismatches>=g&&p?$||0:!1}function sr(e,t,r,o,u){var h,$;if(K(u)&&Be(u,"trimBeforeMatching")&&u&&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({},Je),u);if(typeof n.trimCharsBeforeMatching=="string"&&(n.trimCharsBeforeMatching=He(n.trimCharsBeforeMatching)),n.trimCharsBeforeMatching=n.trimCharsBeforeMatching.map(p=>N(p)?p:String(p)),!N(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:
${JSON.stringify(r,null,4)}`);let c,a;if(N(o))c=[o];else if(Array.isArray(o))c=o;else if(!o)c=o;else if(typeof o=="function")c=[],c.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:
${JSON.stringify(o,null,4)}`);if(u&&!K(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:
${JSON.stringify(u,null,4)}`);let g=0,i="";if(n!=null&&n.trimCharsBeforeMatching&&n.trimCharsBeforeMatching.some((p,f)=>p.length>1?(g=f,i=p,!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 ${g} is longer than 1 character, ${i.length} (equals to ${i}). 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&&N(c[0])&&!c[0].trim()){if(typeof n.cb=="function"){let f,d=r;if((e==="matchLeftIncl"||e==="matchRight")&&(d+=1),e[5]==="L")for(let w=d;w--;){let b=t[w];if((!n.trimBeforeMatching||n.trimBeforeMatching&&b!==void 0&&b.trim())&&(!((h=n.trimCharsBeforeMatching)!=null&&h.length)||b!==void 0&&!n.trimCharsBeforeMatching.includes(b))){f=w;break}}else if(e.startsWith("matchRight"))for(let w=d;w<t.length;w++){let b=t[w];if((!n.trimBeforeMatching||n.trimBeforeMatching&&b.trim())&&(!(($=n.trimCharsBeforeMatching)!=null&&$.length)||!n.trimCharsBeforeMatching.includes(b))){f=w;break}}if(f===void 0)return!1;let S=t[f],y=f+1,v="";return y&&y>0&&(v=t.slice(0,y)),e[5]==="L"||f&&f>0&&(v=t.slice(f)),n.cb(S,v,f)}let p="";throw u||(p=" 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!${p}`)}for(let p=0,f=c.length;p<f;p++){a=typeof c[p]=="function";let d=c[p],S,y,v="",w=r;e==="matchRight"?w+=1:e==="matchLeft"&&(w-=1);let b=or(t,w,d,n,a,E=>e[5]==="L"?E-1:E+1);if(b&&a&&typeof d=="function"&&d()==="EOL")return d()&&(!n.cb||n.cb(S,v,y))?d():!1;if(Number.isInteger(b)&&(y=e.startsWith("matchLeft")?b-1:b+1,e[5]==="L"?v=t.slice(0,b):v=t.slice(y)),y<0&&(y=void 0),t[y]&&(S=t[y]),Number.isInteger(b)&&(!n.cb||n.cb(S,v,y)))return d}return!1}function ke(e,t,r,o){return sr("matchRightIncl",e,t,r,o)}var Mn=tr(Rt(),1);var k="\xA0";function In({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&&`
\r`.includes(e[t+1])||o&&e[t+1]===k))return t+1;if(e[t+2]&&(e[t+2].trim()||r&&`
\r`.includes(e[t+2])||o&&e[t+2]===k))return t+2;for(let u=t+1,n=e.length;u<n;u++)if(e[u].trim()||r&&`
\r`.includes(e[u])||o&&e[u]===k)return u;return null}function U(e,t=0){return In({str:e,idx:t,stopAtNewlines:!1,stopAtRawNbsp:!1})}function Ln({str:e,idx:t,stopAtNewlines:r,stopAtRawNbsp:o}){if(typeof e!="string"||!e.length||((!t||typeof t!="number")&&(t=0),t<1))return null;if(e[~-t]&&(e[~-t].trim()||r&&`
\r`.includes(e[~-t])||o&&e[~-t]===k))return~-t;if(e[t-2]&&(e[t-2].trim()||r&&`
\r`.includes(e[t-2])||o&&e[t-2]===k))return t-2;for(let u=t;u--;)if(e[u]&&(e[u].trim()||r&&`
\r`.includes(e[u])||o&&e[u]===k))return u;return null}function Y(e,t=0){return Ln({str:e,idx:t,stopAtNewlines:!1,stopAtRawNbsp:!1})}function ce(e,t=1){let r="\xA0";function o(n){return Array.from(n).reverse().join("")}function u(n,c,a){let g=a?`
`:"\r",i=a?"\r":`
`;if(!s)return s;let d=0,$=0,p="";for(let f=0,h=s.length;f<h;f++)(s[f]===g||s[f]===i&&s[f-1]!==g)&&$++,`\r
`.includes(s[f])||s[f]===r?(d=0,s[f]===r?p+=s[f]:s[f]===g?$<=l&&(p+=s[f],s[f+1]===i&&(p+=s[f+1],f++)):s[f]===i&&(s==null?void 0:s[f-1])!==g&&$<=l&&(p+=s[f])):(d++,!s[f+1]&&!$&&(p+=" "));return p}if(typeof e=="string"&&e.length){let s=1;typeof+t=="number"&&Number.isInteger(+t)&&+t>=0&&(s=+t);let l="",a="";if(!e.trim())l=e;else if(!e[0].trim()){for(let g=0,i=e.length;g<i;g++)if(e[g].trim()){l=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`${u(l,s,!1)}${e.trim()}${n(u(n(a),s,!0))}`}return e}var Fn={strictlyTwoElementsInRangeArrays:!1,progressFn:null};function Rt(e,t){if(!Array.isArray(e)||!e.length)return e;let r=A(A({},Fn),t),n,u;if(r.strictlyTwoElementsInRangeArrays&&!e.every((a,g)=>!Array.isArray(a)||a.length!==2?(n=g,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, ${n}th range (${JSON.stringify(e[n],null,4)}) has not two but ${u} elements!`);if(!e.every((a,g)=>!Array.isArray(a)||!Number.isInteger(a[0])||a[0]<0||!Number.isInteger(a[1])||a[1]<0?(n=g,!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, ${n}th range (${JSON.stringify(e[n],null,4)}) does not consist of only natural numbers!`);let s=e.length**2,l=0;return Array.from(e).sort((a,g)=>(r.progressFn&&(l+=1,r.progressFn(Math.floor(l*100/s))),a[0]===g[0]?a[1]<g[1]?-1:a[1]>g[1]?1:0:a[0]<g[0]?-1:1))}var It={mergeType:1,progressFn:null,joinRangesThatTouchEdges:!0};function Hn(e,t){function r(i){return!!i&&typeof i=="object"&&!Array.isArray(i)}if(!Array.isArray(e)||!e.length)return null;let n;if(t)if(r(t)){if(n=A(A({},It),t),n.progressFn&&r(n.progressFn)&&!Object.keys(n.progressFn).length)n.progressFn=null;else if(n.progressFn&&typeof n.progressFn!="function")throw new Error(`ranges-merge: [THROW_ID_01] resolvedOpts.progressFn must be a function! It was given of a type: "${typeof n.progressFn}", equal to ${JSON.stringify(n.progressFn,null,4)}`);if(![1,2,"1","2"].includes(n.mergeType))throw new Error(`ranges-merge: [THROW_ID_02] resolvedOpts.mergeType was customised to a wrong thing! It was given of a type: "${typeof n.mergeType}", equal to ${JSON.stringify(n.mergeType,null,4)}`);if(typeof n.joinRangesThatTouchEdges!="boolean")throw new Error(`ranges-merge: [THROW_ID_04] resolvedOpts.joinRangesThatTouchEdges was customised to a wrong thing! It was given of a type: "${typeof n.joinRangesThatTouchEdges}", equal to ${JSON.stringify(n.joinRangesThatTouchEdges,null,4)}`)}else throw new Error(`emlint: [THROW_ID_03] the second input argument must be a plain object. It was given as:
${JSON.stringify(t,null,4)} (type ${typeof t})`);else n=A({},It);let u=e.filter(i=>Array.isArray(i)).map(i=>[...i]).filter(i=>i[2]!==void 0||i[0]!==i[1]),s,l,a;n.progressFn?s=Rt(u,{progressFn:i=>{a=Math.floor(i/5),a!==l&&(l=a,n.progressFn(a))}}):s=Rt(u);let g=s.length-1;for(let i=g;i>0;i--)n.progressFn&&(a=Math.floor((1-i/g)*78)+21,a!==l&&a>l&&(l=a,n.progressFn(a))),(s[i][0]<=s[i-1][0]||!n.joinRangesThatTouchEdges&&s[i][0]<s[i-1][1]||n.joinRangesThatTouchEdges&&s[i][0]<=s[i-1][1])&&(s[i-1][0]=Math.min(s[i][0],s[i-1][0]),s[i-1][1]=Math.max(s[i][1],s[i-1][1]),s[i][2]!==void 0&&(s[i-1][0]>=s[i][0]||s[i-1][1]<=s[i][1])&&s[i-1][2]!==null&&(s[i][2]===null&&s[i-1][2]!==null?s[i-1][2]=null:s[i-1][2]!=null?+n.mergeType==2&&s[i-1][0]===s[i][0]?s[i-1][2]=s[i][2]:s[i-1][2]+=s[i][2]:s[i-1][2]=s[i][2]),s.splice(i,1),i=s.length);return s.length?s:null}var Pn={limitToBeAddedWhitespace:!1,limitLinebreaksCount:1,mergeType:1},Mt=class{constructor(e){fe(this,"ranges");fe(this,"opts");let t=A(A({},Pn),e);if(t.mergeType&&t.mergeType!==1&&t.mergeType!==2)if(N(t.mergeType)&&t.mergeType.trim()==="1")t.mergeType=1;else if(N(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){var s;if(e==null&&t==null)return;if(x(e)&&!x(t)){if(Array.isArray(e)){if(e.length){if(e.some(l=>Array.isArray(l))){e.forEach(l=>{Array.isArray(l)&&this.add(...l)});return}e.length&&W(+e[0])&&W(+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(!x(e)&&x(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 n=+e,u=+t;if(W(r)&&(r=String(r)),W(n)&&W(u)){if(x(r)&&!N(r)&&!W(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:
${JSON.stringify(r,null,4)}`);if(x(this.ranges)&&Array.isArray(this.last())&&n===this.last()[1]){if(this.last()[1]=u,this.last()[2],this.last()[2]!==null&&x(r)){let l=this.last()[2]&&this.last()[2].length&&(!((s=this.opts)!=null&&s.mergeType)||this.opts.mergeType===1)?`${this.last()[2]}${r}`:r;this.opts.limitToBeAddedWhitespace&&(l=le(l,this.opts.limitLinebreaksCount)),N(l)&&!l.length||(this.last()[2]=l)}}else{this.ranges||(this.ranges=[]);let l=r!==void 0&&!(N(r)&&!r.length)?[n,u,r&&this.opts.limitToBeAddedWhitespace?le(r,this.opts.limitLinebreaksCount):r]:[n,u];this.ranges.push(l)}}else throw W(n)&&n>=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 n}" equal to: ${JSON.stringify(n,null,4)}`)}push(e,t,r){this.add(e,t,r)}current(){return Array.isArray(this.ranges)&&this.ranges.length?(this.ranges=Hn(this.ranges,{mergeType:this.opts.mergeType}),this.ranges&&this.opts.limitToBeAddedWhitespace?this.ranges.map(e=>x(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])&&W(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 Vn={strictlyTwoElementsInRangeArrays:!1,progressFn:null};function Ce(e,t){if(!Array.isArray(e)||!e.length)return e;let r=A(A({},Vn),t),n,u;if(r.strictlyTwoElementsInRangeArrays&&!e.every((a,g)=>!Array.isArray(a)||a.length!==2?(n=g,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, ${n}th range (${JSON.stringify(e[n],null,4)}) has not two but ${u} elements!`);if(!e.every((a,g)=>!Array.isArray(a)||!Number.isInteger(a[0])||a[0]<0||!Number.isInteger(a[1])||a[1]<0?(n=g,!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, ${n}th range (${JSON.stringify(e[n],null,4)}) does not consist of only natural numbers!`);let s=e.length**2,l=0;return Array.from(e).sort((a,g)=>(r.progressFn&&(l+=1,r.progressFn(Math.floor(l*100/s))),a[0]===g[0]?a[1]<g[1]?-1:a[1]>g[1]?1:0:a[0]<g[0]?-1:1))}var Lt={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 n;if(t)if(r(t)){if(n=A(A({},Lt),t),n.progressFn&&r(n.progressFn)&&!Object.keys(n.progressFn).length)n.progressFn=null;else if(n.progressFn&&typeof n.progressFn!="function")throw new Error(`ranges-merge: [THROW_ID_01] opts.progressFn must be a function! It was given of a type: "${typeof n.progressFn}", equal to ${JSON.stringify(n.progressFn,null,4)}`);if(![1,2,"1","2"].includes(n.mergeType))throw new Error(`ranges-merge: [THROW_ID_02] opts.mergeType was customised to a wrong thing! It was given of a type: "${typeof n.mergeType}", equal to ${JSON.stringify(n.mergeType,null,4)}`);if(typeof n.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 n.joinRangesThatTouchEdges}", equal to ${JSON.stringify(n.joinRangesThatTouchEdges,null,4)}`)}else throw new Error(`emlint: [THROW_ID_03] the second input argument must be a plain object. It was given as:
${JSON.stringify(t,null,4)} (type ${typeof t})`);else n=A({},Lt);let u=e.filter(i=>Array.isArray(i)).map(i=>[...i]).filter(i=>i[2]!==void 0||i[0]!==i[1]),s,l,a;n.progressFn?s=Ce(u,{progressFn:i=>{a=Math.floor(i/5),a!==l&&(l=a,n.progressFn(a))}}):s=Ce(u);let g=s.length-1;for(let i=g;i>0;i--)n.progressFn&&(a=Math.floor((1-i/g)*78)+21,a!==l&&a>l&&(l=a,n.progressFn(a))),(s[i][0]<=s[i-1][0]||!n.joinRangesThatTouchEdges&&s[i][0]<s[i-1][1]||n.joinRangesThatTouchEdges&&s[i][0]<=s[i-1][1])&&(s[i-1][0]=Math.min(s[i][0],s[i-1][0]),s[i-1][1]=Math.max(s[i][1],s[i-1][1]),s[i][2]!==void 0&&(s[i-1][0]>=s[i][0]||s[i-1][1]<=s[i][1])&&s[i-1][2]!==null&&(s[i][2]===null&&s[i-1][2]!==null?s[i-1][2]=null:s[i-1][2]!=null?+n.mergeType==2&&s[i-1][0]===s[i][0]?s[i-1][2]=s[i][2]:s[i-1][2]+=s[i][2]:s[i-1][2]=s[i][2]),s.splice(i,1),i=s.length);return s.length?s:null}var Bn=!0,Ne="Invariant failed";function Ft(e,t){if(!e){if(Bn)throw new Error(Ne);var r=typeof t=="function"?t():t,n=r?"".concat(Ne,": ").concat(r):Ne;throw new Error(n)}}function Oe(e,t,r){let n=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(d=>d).length)return e;let s;Array.isArray(t)&&Number.isInteger(t[0])&&Number.isInteger(t[1])?s=[Array.from(t)]:s=Array.from(t);let l=s.length,a=0;s.filter(d=>d).forEach((d,$)=>{if(r&&(n=Math.floor(a/l*10),n!==u&&(u=n,r(n))),!Array.isArray(d))throw new TypeError(`ranges-apply: [THROW_ID_05] ranges array, second input arg., has ${$}th element not an array: ${JSON.stringify(d,null,4)}, which is ${typeof d}`);if(!Number.isInteger(d[0])){if(!Number.isInteger(+d[0])||+d[0]<0)throw new TypeError(`ranges-apply: [THROW_ID_06] ranges array, second input arg. has ${$}th element, array ${JSON.stringify(d,null,0)}. Its first element is not an integer, string index, but ${typeof d[0]}, equal to: ${JSON.stringify(d[0],null,4)}.`);s[$][0]=+s[$][0]}if(!Number.isInteger(d[1])){if(!Number.isInteger(+d[1])||+d[1]<0)throw new TypeError(`ranges-apply: [THROW_ID_07] ranges array, second input arg. has ${$}th element, array ${JSON.stringify(d,null,0)}. Its second element is not an integer, string index, but ${typeof d[1]}, equal to: ${JSON.stringify(d[1],null,4)}.`);s[$][1]=+s[$][1]}a+=1});let g=jt(s,{progressFn:d=>{r&&(n=10+Math.floor(d/10),n!==u&&(u=n,r(n)))}});Ft(g);let i=g.length;if(i>0){let d=e.slice(g[i-1][1]);e=g.reduce(($,p,f,h)=>{r&&(n=20+Math.floor(f/i*80),n!==u&&(u=n,r(n)));let S=f===0?0:h[f-1][1],y=h[f][0];return`${$}${e.slice(S,y)}${h[f][2]||""}`},""),e+=d}return e}var Ht="4.0.9";var Y="&nbsp;",X="\\00A0",ee="\\u00A0",Pt="&ndash;",Vt="\\2013",Bt="\\u2013",Jt="&mdash;",kt="\\2014",Ut="\\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:["%>","=%>","-%>"]}],Gt=["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 kn=Ht,Kt={removeWidowPreventionMeasures:!1,convertEntities:!0,targetLanguage:"html",UKPostcodes:!1,hyphens:!0,minWordCount:4,minCharCount:5,ignore:[],reportProgressFunc:null,reportProgressFuncFrom:0,reportProgressFuncTo:100,tagRanges:[]};function Un(e,t){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:
${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 n=Array.isArray,u=e.length,s=new Mt({mergeType:2}),l=["."],a=/[A-Z]{1,2}[0-9][0-9A-Z]?$/,g=/^[0-9][A-Z]{2}/,i=.06,d,$=0,p=0,f=0,h,S,y,v,w,b,E,_,c=A(A({},Kt),t),O={removeWidows:!1,convertEntities:!1};if(!c.ignore||!n(c.ignore)&&typeof c.ignore!="string")c.ignore=[];else if(typeof c.ignore=="string"&&(c.ignore=[c.ignore]),c.ignore.includes("all"))c.ignore=c.ignore.concat(De.concat(We));else if(c.ignore.some(o=>typeof o=="string")){let o=[];c.ignore=c.ignore.filter(C=>typeof C=="string"&&C.length?(["nunjucks","jinja","liquid"].includes(C.trim().toLowerCase())?o=o.concat(De):["hugo"].includes(C.trim().toLowerCase())?o=o.concat(qt):["hexo"].includes(C.trim().toLowerCase())&&(o=o.concat(We)),!1):typeof C=="object"),o.length&&(c.ignore=c.ignore.concat(o))}let xe;c.reportProgressFunc&&(xe=Math.floor(c.reportProgressFuncTo-(c.reportProgressFuncTo-c.reportProgressFuncFrom)*i-c.reportProgressFuncFrom));function ce(o,C){let m=H;c.removeWidowPreventionMeasures?m=" ":c.convertEntities&&(m=Y,typeof c.targetLanguage=="string"&&(c.targetLanguage.trim().toLowerCase()==="css"?m=X:c.targetLanguage.trim().toLowerCase()==="js"&&(m=ee))),e.slice(o,C)!==m&&s.push(o,C,m)}function Re(){p=0,f=0,h=void 0,S=void 0,y=void 0,v=void 0,w=void 0,b=void 0}Re();for(let o=0;o<=u;o++){if(!E&&n(c.ignore)&&c.ignore.length&&c.ignore.some((m,D)=>{if(n(m.heads)&&m.heads.some(Ie=>e.startsWith(Ie,o))||typeof m.heads=="string"&&e.startsWith(m.heads,o))return p+=1,E=c.ignore[D].tails,!0}),!E&&_&&_===o&&(p+=1,_=void 0),typeof c.reportProgressFunc=="function"&&(d=c.reportProgressFuncFrom+Math.floor(o/u*(xe||1)),d!==$&&($=d,c.reportProgressFunc(d))),!E&&o&&e[o]&&e[o].trim()&&(!e[o-1]||e[o-1]&&!e[o-1].trim())&&(v=o),!E&&e[o]&&e[o].trim()&&(f+=1),!E&&c.hyphens&&(`-${Ve}${Pe}`.includes(e[o])||e.startsWith(Pt,o)||e.startsWith(Vt,o)||e.startsWith(Bt,o)||e.startsWith(Jt,o)||e.startsWith(kt,o)||e.startsWith(Ut,o))&&e[o+1]&&(!e[o+1].trim()||e[o]==="&")&&e[o-1]&&!e[o-1].trim()&&e[z(e,o)]&&(ce(z(e,o)+1,o),O.removeWidows=!0),!E&&(e.startsWith("&nbsp;",o)||e.startsWith("&#160;",o))&&(w=o,b=o+6,e[o+6]&&e[o+6].trim()&&(_=o+6),c.convertEntities?(c.targetLanguage==="css"||c.targetLanguage==="js")&&(s.push(o,o+6,c.targetLanguage==="css"?X:ee),O.convertEntities=!0):(s.push(o,o+6,H),O.convertEntities=!0)),!E&&e[o+4]&&e[o]==="\\"&&e[o+1]==="0"&&e[o+2]==="0"&&e[o+3].toUpperCase()==="A"&&e[o+4]==="0"&&(w=o,b=o+5,e[o+5]&&e[o+5].trim()&&(_=o+5),c.convertEntities?(c.targetLanguage==="html"||c.targetLanguage==="js")&&(s.push(o,o+5,c.targetLanguage==="html"?Y:ee),O.convertEntities=!0):(s.push(o,o+5,H),O.convertEntities=!0)),!E&&e[o]==="\\"&&e[o+1]&&e[o+1].toLowerCase()==="u"&&e[o+2]==="0"&&e[o+3]==="0"&&e[o+4]&&e[o+4].toUpperCase()==="A"&&e[o+5]==="0"&&(w=o,b=o+6,e[o+6]&&e[o+6].trim()&&(_=o+6),c.convertEntities?(c.targetLanguage==="html"||c.targetLanguage==="css")&&s.push(o,o+6,c.targetLanguage==="html"?Y:X):s.push(o,o+6,H)),!E&&e[o]===H&&(w=o,b=o+1,c.convertEntities&&s.push(o,o+1,c.targetLanguage==="css"?X:c.targetLanguage==="js"?ee:Y)),!E&&e[o]&&e[o].trim()&&(!e[o-1]||!e[o-1].trim())&&(p+=1),!E&&(!e[o]||`\r
`.includes(e[o])||(e[o]===`
`||e[o]==="\r"||e[o]==="\r"&&e[o+1]===`
`)&&z(e,o)&&l.includes(e[z(e,o)]))){if((!c.minWordCount||p>=c.minWordCount)&&(!c.minCharCount||f>=c.minCharCount)){let m,D;y!==void 0&&v!==void 0&&w!==void 0&&b!==void 0?y>w?(m=y,D=v):(m=w,D=b):y!==void 0&&v!==void 0?(m=y,D=v):w!==void 0&&b!==void 0&&(m=w,D=b),!(m&&D)&&h&&S&&(m=h,D=S),m&&D&&(ce(m,D),O.removeWidows=!0)}Re()}c.UKPostcodes&&e[o]&&!e[o].trim()&&e[o-1]&&e[o-1].trim()&&a.test(e.slice(0,o))&&e[U(e,o)]&&g.test(e.slice(U(e,o)))&&(ce(o,U(e,o)),O.removeWidows=!0),!E&&e[o]&&!e[o].trim()&&e[o-1]&&e[o-1].trim()&&(y===void 0||e[y-1]&&e[y-1].trim())&&!"/>".includes(e[U(e,o)])&&!e.slice(0,o).trim().endsWith("br")&&!e.slice(0,o).trim().endsWith("hr")&&!(e.slice(0,o).endsWith("<")&&Gt.some(m=>e.startsWith(m,U(e,o))))&&(h=y,S=v,y=o,v=void 0,(w!==void 0||b!==void 0)&&(w=void 0,b=void 0));let C;E&&(typeof E=="string"&&(!E.length||e.startsWith(E,o))?E=void 0:n(E)&&(!E.length||E.some(m=>{if(e.startsWith(m,o))return C=m,!0}))&&(E=void 0,o+=C.length,n(c.ignore)&&c.ignore.length&&e[o+1]&&c.ignore.some(m=>ke(e,o,m.tails,{trimBeforeMatching:!0,cb:(D,Ie,Me)=>(Me&&(o=Me-1,e[o+1]&&e[o+1].trim()&&(p+=1)),!0)})))),e[o]&&`\r
`.includes(e[o])&&(p=0,f=0),n(c.tagRanges)&&c.tagRanges.length&&c.tagRanges.some(m=>{if(o>=m[0]&&o<=m[1]&&m[1]-1>o)return o=m[1]-1,!0})}return Oe(e,s.current()).split("").forEach((o,C)=>{}),{res:Oe(e,s.current(),c.reportProgressFunc?o=>{d=Math.floor((c.reportProgressFuncTo-c.reportProgressFuncFrom)*(1-i)+o/100*(c.reportProgressFuncTo-c.reportProgressFuncFrom)*i),d!==$&&($=d,c.reportProgressFunc(d))}:void 0),ranges:s.current(),log:{timeTakenInMilliseconds:Date.now()-r},whatWasDone:O}}return nr(qn);})();
`;if(!n)return n;let h=0,$=0,p="";for(let f=0,d=n.length;f<d;f++)(n[f]===g||n[f]===i&&n[f-1]!==g)&&$++,`\r
`.includes(n[f])||n[f]===r?(h=0,n[f]===r?p+=n[f]:n[f]===g?$<=c&&(p+=n[f],n[f+1]===i&&(p+=n[f+1],f++)):n[f]===i&&(n==null?void 0:n[f-1])!==g&&$<=c&&(p+=n[f])):(h++,!n[f+1]&&!$&&(p+=" "));return p}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,i=e.length;g<i;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`${u(c,n,!1)}${e.trim()}${o(u(o(a),n,!0))}`}return e}var jn={strictlyTwoElementsInRangeArrays:!1,progressFn:null};function q(e,t){if(!Array.isArray(e)||!e.length)return e;let r=T(T({},jn),t),o,u;if(r.strictlyTwoElementsInRangeArrays&&!e.every((a,g)=>!Array.isArray(a)||a.length!==2?(o=g,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,g)=>!Array.isArray(a)||!Number.isInteger(a[0])||a[0]<0||!Number.isInteger(a[1])||a[1]<0?(o=g,!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,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 xt={mergeType:1,progressFn:null,joinRangesThatTouchEdges:!0};function Fn(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({},xt),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] resolvedOpts.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] resolvedOpts.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] resolvedOpts.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:
${JSON.stringify(t,null,4)} (type ${typeof t})`);else o=T({},xt);let u=e.filter(i=>Array.isArray(i)).map(i=>[...i]).filter(i=>i[2]!==void 0||i[0]!==i[1]),n,c,a;o.progressFn?n=q(u,{progressFn:i=>{a=Math.floor(i/5),a!==c&&(c=a,o.progressFn(a))}}):n=q(u);let g=n.length-1;for(let i=g;i>0;i--)o.progressFn&&(a=Math.floor((1-i/g)*78)+21,a!==c&&a>c&&(c=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 Hn={limitToBeAddedWhitespace:!1,limitLinebreaksCount:1,mergeType:1},Mt=class{constructor(e){de(this,"ranges");de(this,"opts");let t=T(T({},Hn),e);if(t.mergeType&&t.mergeType!==1&&t.mergeType!==2)if(N(t.mergeType)&&t.mergeType.trim()==="1")t.mergeType=1;else if(N(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){var n;if(e==null&&t==null)return;if(R(e)&&!R(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&&W(+e[0])&&W(+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(!R(e)&&R(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(W(r)&&(r=String(r)),W(o)&&W(u)){if(R(r)&&!N(r)&&!W(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:
${JSON.stringify(r,null,4)}`);if(R(this.ranges)&&Array.isArray(this.last())&&o===this.last()[1]){if(this.last()[1]=u,this.last()[2],this.last()[2]!==null&&R(r)){let c=this.last()[2]&&this.last()[2].length&&(!((n=this.opts)!=null&&n.mergeType)||this.opts.mergeType===1)?`${this.last()[2]}${r}`:r;this.opts.limitToBeAddedWhitespace&&(c=ce(c,this.opts.limitLinebreaksCount)),N(c)&&!c.length||(this.last()[2]=c)}}else{this.ranges||(this.ranges=[]);let c=r!==void 0&&!(N(r)&&!r.length)?[o,u,r&&this.opts.limitToBeAddedWhitespace?ce(r,this.opts.limitLinebreaksCount):r]:[o,u];this.ranges.push(c)}}else throw W(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=Fn(this.ranges,{mergeType:this.opts.mergeType}),this.ranges&&this.opts.limitToBeAddedWhitespace?this.ranges.map(e=>R(e[2])?[e[0],e[1],ce(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])&&W(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 It={mergeType:1,progressFn:null,joinRangesThatTouchEdges:!0};function Lt(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({},It),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:
${JSON.stringify(t,null,4)} (type ${typeof t})`);else o=T({},It);let u=e.filter(i=>Array.isArray(i)).map(i=>[...i]).filter(i=>i[2]!==void 0||i[0]!==i[1]),n,c,a;o.progressFn?n=q(u,{progressFn:i=>{a=Math.floor(i/5),a!==c&&(c=a,o.progressFn(a))}}):n=q(u);let g=n.length-1;for(let i=g;i>0;i--)o.progressFn&&(a=Math.floor((1-i/g)*78)+21,a!==c&&a>c&&(c=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 Pn=!0,Ne="Invariant failed";function jt(e,t){if(!e){if(Pn)throw new Error(Ne);var r=typeof t=="function"?t():t,o=r?"".concat(Ne,": ").concat(r):Ne;throw new Error(o)}}function De(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(h=>h).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 c=n.length,a=0;n.filter(h=>h).forEach((h,$)=>{if(r&&(o=Math.floor(a/c*10),o!==u&&(u=o,r(o))),!Array.isArray(h))throw new TypeError(`ranges-apply: [THROW_ID_05] ranges array, second input arg., has ${$}th element not an array: ${JSON.stringify(h,null,4)}, which is ${typeof h}`);if(!Number.isInteger(h[0])){if(!Number.isInteger(+h[0])||+h[0]<0)throw new TypeError(`ranges-apply: [THROW_ID_06] ranges array, second input arg. has ${$}th element, array ${JSON.stringify(h,null,0)}. Its first element is not an integer, string index, but ${typeof h[0]}, equal to: ${JSON.stringify(h[0],null,4)}.`);n[$][0]=+n[$][0]}if(!Number.isInteger(h[1])){if(!Number.isInteger(+h[1])||+h[1]<0)throw new TypeError(`ranges-apply: [THROW_ID_07] ranges array, second input arg. has ${$}th element, array ${JSON.stringify(h,null,0)}. Its second element is not an integer, string index, but ${typeof h[1]}, equal to: ${JSON.stringify(h[1],null,4)}.`);n[$][1]=+n[$][1]}a+=1});let g=Lt(n,{progressFn:h=>{r&&(o=10+Math.floor(h/10),o!==u&&(u=o,r(o)))}});jt(g);let i=g.length;if(i>0){let h=e.slice(g[i-1][1]);e=g.reduce(($,p,f,d)=>{r&&(o=20+Math.floor(f/i*80),o!==u&&(u=o,r(o)));let S=f===0?0:d[f-1][1],y=d[f][0];return`${$}${e.slice(S,y)}${d[f][2]||""}`},""),e+=h}return e}var Ft="4.0.10";var X="&nbsp;",ee="\\00A0",te="\\u00A0",Ht="&ndash;",Pt="\\2013",Vt="\\u2013",Bt="&mdash;",Jt="\\2014",kt="\\u2014",Oe=[{heads:"{{",tails:"}}"},{heads:["{% if","{%- if"],tails:["{% endif","{%- endif"]},{heads:["{% for","{%- for"],tails:["{% endfor","{%- endfor"]},{heads:["{%","{%-"],tails:["%}","-%}"]},{heads:"{#",tails:"#}"}],Ut=[{heads:"{{",tails:"}}"}],We=[{heads:["<%","<%=","<%-"],tails:["%>","=%>","-%>"]}],qt=["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 Bn=Ft,Gt={removeWidowPreventionMeasures:!1,convertEntities:!0,targetLanguage:"html",UKPostcodes:!1,hyphens:!0,minWordCount:4,minCharCount:5,ignore:[],reportProgressFunc:null,reportProgressFuncFrom:0,reportProgressFuncTo:100,tagRanges:[]};function Jn(e,t){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:
${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 Mt({mergeType:2}),c=["."],a=/[A-Z]{1,2}[0-9][0-9A-Z]?$/,g=/^[0-9][A-Z]{2}/,i=.06,h,$=0,p=0,f=0,d,S,y,v,w,b,E,_,l=T(T({},Gt),t),D={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(Oe.concat(We));else if(l.ignore.some(s=>typeof s=="string")){let s=[];l.ignore=l.ignore.filter(C=>typeof C=="string"&&C.length?(["nunjucks","jinja","liquid"].includes(C.trim().toLowerCase())?s=s.concat(Oe):["hugo"].includes(C.trim().toLowerCase())?s=s.concat(Ut):["hexo"].includes(C.trim().toLowerCase())&&(s=s.concat(We)),!1):typeof C=="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 ge(s,C){let m=H;l.removeWidowPreventionMeasures?m=" ":l.convertEntities&&(m=X,typeof l.targetLanguage=="string"&&(l.targetLanguage.trim().toLowerCase()==="css"?m=ee:l.targetLanguage.trim().toLowerCase()==="js"&&(m=te))),e.slice(s,C)!==m&&n.push(s,C,m)}function xe(){p=0,f=0,d=void 0,S=void 0,y=void 0,v=void 0,w=void 0,b=void 0}xe();for(let s=0;s<=u;s++){if(!E&&o(l.ignore)&&l.ignore.length&&l.ignore.some((m,O)=>{if(o(m.heads)&&m.heads.some(Me=>e.startsWith(Me,s))||typeof m.heads=="string"&&e.startsWith(m.heads,s))return p+=1,E=l.ignore[O].tails,!0}),!E&&_&&_===s&&(p+=1,_=void 0),typeof l.reportProgressFunc=="function"&&(h=l.reportProgressFuncFrom+Math.floor(s/u*(Re||1)),h!==$&&($=h,l.reportProgressFunc(h))),!E&&s&&e[s]&&e[s].trim()&&(!e[s-1]||e[s-1]&&!e[s-1].trim())&&(v=s),!E&&e[s]&&e[s].trim()&&(f+=1),!E&&l.hyphens&&(`-${Ve}${Pe}`.includes(e[s])||e.startsWith(Ht,s)||e.startsWith(Pt,s)||e.startsWith(Vt,s)||e.startsWith(Bt,s)||e.startsWith(Jt,s)||e.startsWith(kt,s))&&e[s+1]&&(!e[s+1].trim()||e[s]==="&")&&e[s-1]&&!e[s-1].trim()&&e[Y(e,s)]&&(ge(Y(e,s)+1,s),D.removeWidows=!0),!E&&(e.startsWith("&nbsp;",s)||e.startsWith("&#160;",s))&&(w=s,b=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"?ee:te),D.convertEntities=!0):(n.push(s,s+6,H),D.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"&&(w=s,b=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:te),D.convertEntities=!0):(n.push(s,s+5,H),D.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"&&(w=s,b=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:ee):n.push(s,s+6,H)),!E&&e[s]===H&&(w=s,b=s+1,l.convertEntities&&n.push(s,s+1,l.targetLanguage==="css"?ee:l.targetLanguage==="js"?te:X)),!E&&e[s]&&e[s].trim()&&(!e[s-1]||!e[s-1].trim())&&(p+=1),!E&&(!e[s]||`\r
`.includes(e[s])||(e[s]===`
`||e[s]==="\r"||e[s]==="\r"&&e[s+1]===`
`)&&Y(e,s)&&c.includes(e[Y(e,s)]))){if((!l.minWordCount||p>=l.minWordCount)&&(!l.minCharCount||f>=l.minCharCount)){let m,O;y!==void 0&&v!==void 0&&w!==void 0&&b!==void 0?y>w?(m=y,O=v):(m=w,O=b):y!==void 0&&v!==void 0?(m=y,O=v):w!==void 0&&b!==void 0&&(m=w,O=b),!(m&&O)&&d&&S&&(m=d,O=S),m&&O&&(ge(m,O),D.removeWidows=!0)}xe()}l.UKPostcodes&&e[s]&&!e[s].trim()&&e[s-1]&&e[s-1].trim()&&a.test(e.slice(0,s))&&e[U(e,s)]&&g.test(e.slice(U(e,s)))&&(ge(s,U(e,s)),D.removeWidows=!0),!E&&e[s]&&!e[s].trim()&&e[s-1]&&e[s-1].trim()&&(y===void 0||e[y-1]&&e[y-1].trim())&&!"/>".includes(e[U(e,s)])&&!e.slice(0,s).trim().endsWith("br")&&!e.slice(0,s).trim().endsWith("hr")&&!(e.slice(0,s).endsWith("<")&&qt.some(m=>e.startsWith(m,U(e,s))))&&(d=y,S=v,y=s,v=void 0,(w!==void 0||b!==void 0)&&(w=void 0,b=void 0));let C;E&&(typeof E=="string"&&(!E.length||e.startsWith(E,s))?E=void 0:o(E)&&(!E.length||E.some(m=>{if(e.startsWith(m,s))return C=m,!0}))&&(E=void 0,s+=C.length,o(l.ignore)&&l.ignore.length&&e[s+1]&&l.ignore.some(m=>ke(e,s,m.tails,{trimBeforeMatching:!0,cb:(O,Me,Ie)=>(Ie&&(s=Ie-1,e[s+1]&&e[s+1].trim()&&(p+=1)),!0)})))),e[s]&&`\r
`.includes(e[s])&&(p=0,f=0),o(l.tagRanges)&&l.tagRanges.length&&l.tagRanges.some(m=>{if(s>=m[0]&&s<=m[1]&&m[1]-1>s)return s=m[1]-1,!0})}return De(e,n.current()).split("").forEach((s,C)=>{}),{res:De(e,n.current(),l.reportProgressFunc?s=>{h=Math.floor((l.reportProgressFuncTo-l.reportProgressFuncFrom)*(1-i)+s/100*(l.reportProgressFuncTo-l.reportProgressFuncFrom)*i),h!==$&&($=h,l.reportProgressFunc(h))}:void 0),ranges:n.current(),log:{timeTakenInMilliseconds:Date.now()-r},whatWasDone:D}}return rr(kn);})();
/**
* @name arrayiffy-if-string
* @fileoverview Put non-empty strings into arrays, turn empty-ones into empty arrays. Bypass everything else.
* @version 5.0.4
* @version 5.0.5
* @author Roy Revelt, Codsen Ltd

@@ -43,3 +43,3 @@ * @license MIT

* @fileoverview Various utility functions
* @version 1.3.0
* @version 1.3.1
* @author Roy Revelt, Codsen Ltd

@@ -52,3 +52,3 @@ * @license MIT

* @fileoverview Match substrings on the left or right of a given index, ignoring whitespace
* @version 9.0.9
* @version 9.0.10
* @author Roy Revelt, Codsen Ltd

@@ -61,3 +61,3 @@ * @license MIT

* @fileoverview Looks up the first non-whitespace character to the left/right of a given index
* @version 6.0.9
* @version 6.0.10
* @author Roy Revelt, Codsen Ltd

@@ -70,3 +70,3 @@ * @license MIT

* @fileoverview Collapse the leading and trailing whitespace of a string
* @version 7.0.4
* @version 7.0.5
* @author Roy Revelt, Codsen Ltd

@@ -77,16 +77,16 @@ * @license MIT

/**
* @name ranges-push
* @fileoverview Gather string index ranges
* @version 7.0.6
* @name ranges-sort
* @fileoverview Sort string index ranges
* @version 6.0.7
* @author Roy Revelt, Codsen Ltd
* @license MIT
* {@link https://codsen.com/os/ranges-push/}
* {@link https://codsen.com/os/ranges-sort/}
*/
/**
* @name ranges-sort
* @fileoverview Sort string index ranges
* @version 6.0.6
* @name ranges-push
* @fileoverview Gather string index ranges
* @version 7.0.7
* @author Roy Revelt, Codsen Ltd
* @license MIT
* {@link https://codsen.com/os/ranges-sort/}
* {@link https://codsen.com/os/ranges-push/}
*/

@@ -96,3 +96,3 @@ /**

* @fileoverview Merge and sort string index ranges
* @version 9.0.6
* @version 9.0.7
* @author Roy Revelt, Codsen Ltd

@@ -105,3 +105,3 @@ * @license MIT

* @fileoverview Take an array of string index ranges, delete/replace the string according to them
* @version 7.0.6
* @version 7.0.7
* @author Roy Revelt, Codsen Ltd

@@ -108,0 +108,0 @@ * @license MIT

{
"name": "string-remove-widows",
"version": "4.0.9",
"version": "4.0.10",
"description": "Helps to prevent widow words in a text",

@@ -78,11 +78,11 @@ "keywords": [

"dependencies": {
"codsen-utils": "^1.3.0",
"ranges-apply": "^7.0.6",
"ranges-push": "^7.0.6",
"string-left-right": "^6.0.9",
"string-match-left-right": "^9.0.9"
"codsen-utils": "^1.3.1",
"ranges-apply": "^7.0.7",
"ranges-push": "^7.0.7",
"string-left-right": "^6.0.10",
"string-match-left-right": "^9.0.10"
},
"devDependencies": {
"string-strip-html": "^13.2.1"
"string-strip-html": "^13.2.2"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc