html-crush 6.0.7 → 6.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2010-2022 Roy Revelt and other contributors
3
+ Copyright (c) 2010-2023 Roy Revelt and other contributors
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining
6
6
  a copy of this software and associated documentation files (the
package/README.md CHANGED
@@ -65,6 +65,6 @@ To report bugs or request features or assistance, [raise an issue](https://githu
65
65
 
66
66
  MIT License.
67
67
 
68
- Copyright © 2010-2022 Roy Revelt and other contributors.
68
+ Copyright © 2010-2023 Roy Revelt and other contributors.
69
69
 
70
70
  <p align="center"><img src="https://codsen.com/images/png-codsen-ok.png" width="98" alt="ok" align="center"> <img src="https://codsen.com/images/png-codsen-1.png" width="148" alt="codsen" align="center"> <img src="https://codsen.com/images/png-codsen-star-small.png" width="32" alt="star" align="center"></p>
@@ -1,24 +1,32 @@
1
1
  /**
2
2
  * @name html-crush
3
3
  * @fileoverview Minify email templates
4
- * @version 6.0.7
4
+ * @version 6.0.9
5
5
  * @author Roy Revelt, Codsen Ltd
6
6
  * @license MIT
7
7
  * {@link https://codsen.com/os/html-crush/}
8
8
  */
9
9
 
10
- import{rApply as ne}from"ranges-apply";import{Ranges as le}from"ranges-push";import{matchLeft as oe,matchRight as F,matchRightIncl as X}from"string-match-left-right";import{expander as _}from"string-range-expander";import{left as G,right as a}from"string-left-right";var Y="6.0.7";var ge=Y,$=new le({limitToBeAddedWhitespace:!0}),te={lineLengthLimit:500,removeIndentations:!0,removeLineBreaks:!1,removeHTMLComments:!1,removeCSSComments:!0,reportProgressFunc:null,reportProgressFuncFrom:0,reportProgressFuncTo:100,breakToTheLeftOf:["</td","<html","</html","<head","</head","<meta","<link","<table","<script","</script","<!DOCTYPE","<style","</style","<title","<body","@media","</body","<!--[if","<!--<![endif","<![endif]"],mindTheInlineTags:["a","abbr","acronym","audio","b","bdi","bdo","big","br","button","canvas","cite","code","data","datalist","del","dfn","em","embed","i","iframe","img","input","ins","kbd","label","map","mark","meter","noscript","object","output","picture","progress","q","ruby","s","samp","script","select","slot","small","span","strong","sub","sup","svg","template","textarea","time","u","tt","var","video","wbr"]};function y(n){return typeof n=="string"}function A(n){return typeof n=="string"&&n.toUpperCase()!==n.toLowerCase()}function ce(n,E){let x=Date.now();if(!y(n))throw n===void 0?new Error("html-crush: [THROW_ID_01] the first input argument is completely missing! It should be given as string."):new Error(`html-crush: [THROW_ID_02] the first input argument must be string! It was given as "${typeof n}", equal to:
11
- ${JSON.stringify(n,null,4)}`);if(E&&typeof E!="object")throw new Error(`html-crush: [THROW_ID_03] the second input argument, options object, should be a plain object but it was given as type ${typeof E}, equal to ${JSON.stringify(E,null,4)}`);if(E&&Array.isArray(E.breakToTheLeftOf)&&E.breakToTheLeftOf.length){for(let e=0,w=E.breakToTheLeftOf.length;e<w;e++)if(!y(E.breakToTheLeftOf[e]))throw new TypeError(`html-crush: [THROW_ID_05] the resolvedOpts.breakToTheLeftOf array contains non-string elements! For example, element at index ${e} is of a type "${typeof E.breakToTheLeftOf[e]}" and is equal to:
12
- ${JSON.stringify(E.breakToTheLeftOf[e],null,4)}`)}let l={...te,...E};typeof l.removeHTMLComments=="boolean"&&(l.removeHTMLComments=l.removeHTMLComments?1:0);let v="";Array.isArray(l.breakToTheLeftOf)&&l.breakToTheLeftOf.length&&(v=[...new Set(l.breakToTheLeftOf.map(e=>e[0]))].join(""));let L={removeHTMLComments:!1,removeCSSComments:!1},p=null,i=null,S=!1,m=0,H=0,g=!1,O=!1,c=null,f=null,V=null,U=null,u,t=null,s=null,r=null,T=null,D=null,M=null,P=">};",I="<",K="!",q=">",z="<",W="{},:;<>~+",k=W,J=W,C=!0,h=n.length,Q=Math.floor(h/2),B=.01,j;l.reportProgressFunc&&(j=Math.floor(l.reportProgressFuncTo-(l.reportProgressFuncTo-l.reportProgressFuncFrom)*B-l.reportProgressFuncFrom));let d,R=0,b=`
10
+ import{rApply as le}from"ranges-apply";import{Ranges as oe}from"ranges-push";import{matchLeft as te,matchRight as F,matchRightIncl as q}from"string-match-left-right";import{expander as B}from"string-range-expander";import{left as _,right as m}from"string-left-right";function O(n){return p(n)&&n.length===1&&n.toUpperCase()!==n.toLowerCase()}function Y(n){if(n==null||typeof n!="object")return!1;let b=Object.getPrototypeOf(n);return b!==null&&b!==Object.prototype&&Object.getPrototypeOf(b)!==null?!1:!(Symbol.iterator in n)&&!(Symbol.toStringTag in n)}function p(n){return typeof n=="string"}var K="6.0.9";var he=K,$=new oe({limitToBeAddedWhitespace:!0}),ie={lineLengthLimit:500,removeIndentations:!0,removeLineBreaks:!1,removeHTMLComments:!1,removeCSSComments:!0,reportProgressFunc:null,reportProgressFuncFrom:0,reportProgressFuncTo:100,breakToTheLeftOf:["</td","<html","</html","<head","</head","<meta","<link","<table","<script","</script","<!DOCTYPE","<style","</style","<title","<body","@media","</body","<!--[if","<!--<![endif","<![endif]"],mindTheInlineTags:["a","abbr","acronym","audio","b","bdi","bdo","big","br","button","canvas","cite","code","data","datalist","del","dfn","em","embed","i","iframe","img","input","ins","kbd","label","map","mark","meter","noscript","object","output","picture","progress","q","ruby","s","samp","script","select","slot","small","span","strong","sub","sup","svg","template","textarea","time","u","tt","var","video","wbr"]};function fe(n,b){let x=Date.now();if(!p(n))throw n===void 0?new Error("html-crush: [THROW_ID_01] the first input argument is completely missing! It should be given as string."):new Error(`html-crush: [THROW_ID_02] the first input argument must be string! It was given as "${typeof n}", equal to:
11
+ ${JSON.stringify(n,null,4)}`);if(b&&!Y(b))throw new Error(`html-crush: [THROW_ID_03] the second input argument, options object, should be a plain object but it was given as type ${typeof b}, equal to ${JSON.stringify(b,null,4)}`);if(b&&Array.isArray(b.breakToTheLeftOf)&&b.breakToTheLeftOf.length){for(let e=0,w=b.breakToTheLeftOf.length;e<w;e++)if(!p(b.breakToTheLeftOf[e]))throw new TypeError(`html-crush: [THROW_ID_05] the resolvedOpts.breakToTheLeftOf array contains non-string elements! For example, element at index ${e} is of a type "${typeof b.breakToTheLeftOf[e]}" and is equal to:
12
+ ${JSON.stringify(b.breakToTheLeftOf[e],null,4)}`)}let l={...ie,...b};typeof l.removeHTMLComments=="boolean"&&(l.removeHTMLComments=l.removeHTMLComments?1:0);let v="";Array.isArray(l.breakToTheLeftOf)&&l.breakToTheLeftOf.length&&(v=[...new Set(l.breakToTheLeftOf.map(e=>e[0]))].join(""));let C={removeHTMLComments:!1,removeCSSComments:!1},S=null,i=null,D=!1,r=0,H=0,c=!1,V=!1,g=null,E=null,A=null,R=null,u,t=null,s=null,a=null,d=null,L=null,M=null,P=">};",I="<",Q="!",X=">",z="<",G="{},:;<>~+",U=G,J=G,y=!0,f=n.length,Z=Math.floor(f/2),W=.01,j;l.reportProgressFunc&&(j=Math.floor(l.reportProgressFuncTo-(l.reportProgressFuncTo-l.reportProgressFuncFrom)*W-l.reportProgressFuncFrom));let T,k=0,h=`
13
13
  `;if(n.includes(`\r
14
- `)?b=`\r
15
- `:n.includes("\r")&&(b="\r"),h){for(let e=0;e<h;e++){if(l.reportProgressFunc&&(h>1e3&&h<2e3?e===Q&&l.reportProgressFunc(Math.floor((l.reportProgressFuncTo-l.reportProgressFuncFrom)/2)):h>=2e3&&(d=l.reportProgressFuncFrom+Math.floor(e/h*(j||1)),d!==R&&(R=d,l.reportProgressFunc(d)))),H++,!u&&g&&n[e]==="}"&&n[e-1]==="}"&&(m+1>=l.lineLengthLimit?($.push(e,e,b),m=0):(t=e,s=e,r=" ")),u&&typeof u=="number"&&e>=u&&(u=void 0),U!==null&&n.startsWith("</script",e)&&!A(n[e+8])){if((l.removeIndentations||l.removeLineBreaks)&&e>0&&n[~-e]&&!n[~-e].trim()){for(let o=e;o--;)if(n[o]===`
16
- `||n[o]==="\r"||n[o].trim()){o+1<e&&$.push(o+1,e);break}}U=null,u=!1,e+=8;continue}if(!u&&!g&&n.startsWith("<script",e)&&!A(n[e+7])){U=e,u=!0;let o="";(l.removeLineBreaks||l.removeIndentations)&&i!==null&&(i>0&&(o=b),$.push(i,e,o)),i=null,p=null}if(D!==null&&T===null&&!/\w/.test(n[e])){T=n.slice(D,e);let o=a(n,~-e);typeof o=="number"&&n[o]===">"&&!n[e].trim()&&a(n,e)?$.push(e,a(n,e)):o&&n[o]==="/"&&n[a(n,o)]===">"&&(!n[e].trim()&&a(n,e)&&$.push(e,a(n,e)),n[o+1]!==">"&&a(n,o+1)&&$.push(o+1,a(n,o+1)))}if(!u&&!g&&!c&&n[~-e]==="<"&&D===null&&(/\w/.test(n[e])?D=e:n[a(n,~-e)]==="/"&&/\w/.test(n[a(n,a(n,~-e))]||"")&&(D=a(n,a(n,~-e)))),!u&&(g||c)&&f!==null&&n[e]==="*"&&n[e+1]==="/"&&([t,s]=_({str:n,from:f,to:e+2,ifLeftSideIncludesThisThenCropTightly:k||"",ifRightSideIncludesThisThenCropTightly:J||""}),f=null,t!=null?$.push(t,s):(m+=1,e+=1),u=e+2),!u&&(g||c)&&f===null&&n[e]==="/"&&n[e+1]==="*"&&(L.removeCSSComments||(L.removeCSSComments=!0),l.removeCSSComments&&(f=e)),O&&n.startsWith("![endif",e+1)&&(O=!1),!u&&!g&&!c&&V!==null){let o;n.startsWith("-->",e)?o=3:n[e]===">"&&n[e-1]==="]"&&(o=1),o&&([t,s]=_({str:n,from:V,to:e+o}),V=null,t!=null?l.lineLengthLimit&&H-(s-t)>=l.lineLengthLimit?($.push(t,s,b),H=-o):($.push(t,s),H-=s-t):(m+=o-1,e+=o-1),u=e+o)}if(!u&&!g&&!c&&(n.startsWith("<!--",e)||l.removeHTMLComments===2&&n.startsWith("<![endif",e))&&V===null&&(n.startsWith("[if",e+4)?(O||(O=!0),l.removeHTMLComments===2&&(V=e)):l.removeHTMLComments&&(!O||l.removeHTMLComments===2)&&(V=e),L.removeHTMLComments||(L.removeHTMLComments=!0)),!u&&g&&f===null&&n.startsWith("</style",e)&&!A(n[e+7])?g=!1:!u&&!g&&f===null&&n.startsWith("<style",e)&&!A(n[e+6])&&(g=!0,(l.removeLineBreaks||l.removeIndentations)&&l.breakToTheLeftOf.includes("<style")&&n.startsWith(' type="text/css">',e+6)&&n[e+24]&&$.push(e+23,e+23,b)),!u&&!c&&`"'`.includes(n[e])&&n.endsWith("style=",e)&&(c=e),!u&&!n[e].trim())i===null&&(i=e);else if(!u&&!((g||c)&&f!==null)){if(i!==null){if(l.removeLineBreaks&&(m+=1),C)C=!1,(l.removeIndentations||l.removeLineBreaks)&&$.push(0,e);else if(l.removeIndentations&&!l.removeLineBreaks&&(!S&&p!==null&&e>p?$.push(p+1,e):i+1<e&&(n.endsWith("]>",i)||n.endsWith("-->",i)||n.startsWith("<![",e)||n.startsWith("<!--<![",e)?$.push(i,e):n[i]===" "?$.push(i+1,e):n[~-e]===" "?$.push(i,~-e):$.push(i,e," "))),l.removeLineBreaks||c){if(v.includes(n[e])&&X(n,e,l.breakToTheLeftOf)){!(`\r
14
+ `)?h=`\r
15
+ `:n.includes("\r")&&(h="\r"),f){for(let e=0;e<f;e++){if(l.reportProgressFunc&&(f>1e3&&f<2e3?e===Z&&l.reportProgressFunc(Math.floor((l.reportProgressFuncTo-l.reportProgressFuncFrom)/2)):f>=2e3&&(T=l.reportProgressFuncFrom+Math.floor(e/f*(j||1)),T!==k&&(k=T,l.reportProgressFunc(T)))),H++,!u&&c&&n[e]==="}"&&n[e-1]==="}"&&(r+1>=l.lineLengthLimit?($.push(e,e,h),r=0):(t=e,s=e,a=" ")),u&&typeof u=="number"&&e>=u&&(u=void 0),R!==null&&n.startsWith("</script",e)&&!O(n[e+8])){if((l.removeIndentations||l.removeLineBreaks)&&e>0&&n[~-e]&&!n[~-e].trim()){for(let o=e;o--;)if(n[o]===`
16
+ `||n[o]==="\r"||n[o].trim()){o+1<e&&$.push(o+1,e);break}}R=null,u=!1,e+=8;continue}if(!u&&!c&&n.startsWith("<script",e)&&!O(n[e+7])){R=e,u=!0;let o="";(l.removeLineBreaks||l.removeIndentations)&&i!==null&&(i>0&&(o=h),$.push(i,e,o)),i=null,S=null}if(L!==null&&d===null&&!/\w/.test(n[e])){d=n.slice(L,e);let o=m(n,~-e);typeof o=="number"&&n[o]===">"&&!n[e].trim()&&m(n,e)?$.push(e,m(n,e)):o&&n[o]==="/"&&n[m(n,o)]===">"&&(!n[e].trim()&&m(n,e)&&$.push(e,m(n,e)),n[o+1]!==">"&&m(n,o+1)&&$.push(o+1,m(n,o+1)))}if(!u&&!c&&!g&&n[~-e]==="<"&&L===null&&(/\w/.test(n[e])?L=e:n[m(n,~-e)]==="/"&&/\w/.test(n[m(n,m(n,~-e))]||"")&&(L=m(n,m(n,~-e)))),!u&&(c||g)&&E!==null&&n[e]==="*"&&n[e+1]==="/"&&([t,s]=B({str:n,from:E,to:e+2,ifLeftSideIncludesThisThenCropTightly:U||"",ifRightSideIncludesThisThenCropTightly:J||""}),E=null,t!=null?$.push(t,s):(r+=1,e+=1),u=e+2),!u&&(c||g)&&E===null&&n[e]==="/"&&n[e+1]==="*"&&(C.removeCSSComments||(C.removeCSSComments=!0),l.removeCSSComments&&(E=e)),V&&n.startsWith("![endif",e+1)&&(V=!1),!u&&!c&&!g&&A!==null){let o;n.startsWith("-->",e)?o=3:n[e]===">"&&n[e-1]==="]"&&(o=1),o&&([t,s]=B({str:n,from:A,to:e+o}),A=null,t!=null?l.lineLengthLimit&&H-(s-t)>=l.lineLengthLimit?($.push(t,s,h),H=-o):($.push(t,s),H-=s-t):(r+=o-1,e+=o-1),u=e+o)}if(!u&&!c&&!g&&(n.startsWith("<!--",e)||l.removeHTMLComments===2&&n.startsWith("<![endif",e))&&A===null&&(n.startsWith("[if",e+4)?(V||(V=!0),l.removeHTMLComments===2&&(A=e)):l.removeHTMLComments&&(!V||l.removeHTMLComments===2)&&(A=e),C.removeHTMLComments||(C.removeHTMLComments=!0)),!u&&c&&E===null&&n.startsWith("</style",e)&&!O(n[e+7])?c=!1:!u&&!c&&E===null&&n.startsWith("<style",e)&&!O(n[e+6])&&(c=!0,(l.removeLineBreaks||l.removeIndentations)&&l.breakToTheLeftOf.includes("<style")&&n.startsWith(' type="text/css">',e+6)&&n[e+24]&&$.push(e+23,e+23,h)),!u&&!g&&`"'`.includes(n[e])&&n.endsWith("style=",e)&&(g=e),!u&&!n[e].trim())i===null&&(i=e);else if(!u&&!((c||g)&&E!==null)){if(i!==null){if(l.removeLineBreaks&&(r+=1),y)y=!1,(l.removeIndentations||l.removeLineBreaks)&&$.push(0,e);else if(l.removeIndentations&&!l.removeLineBreaks&&(!D&&S!==null&&e>S?$.push(S+1,e):i+1<e&&(n.endsWith("]>",i)||n.endsWith("-->",i)||n.startsWith("<![",e)||n.startsWith("<!--<![",e)?$.push(i,e):n[i]===" "?$.push(i+1,e):n[~-e]===" "?$.push(i,~-e):$.push(i,e," "))),l.removeLineBreaks||g){if(v.includes(n[e])&&q(n,e,l.breakToTheLeftOf)){!(`\r
17
17
  `.includes(n[~-e])&&i===~-e)&&!(n[~-e]===`
18
- `&&n[e-2]==="\r"&&i===e-2)&&$.push(i,e,b),t=null,s=null,r=null,i=null,m=1;continue}let o=" ";n[e]==="<"&&F(n,e,l.mindTheInlineTags,{cb:N=>!N||!/\w/.test(N)})||(n[~-i]&&q.includes(n[~-i])&&z.includes(n[e])||(g||c)&&f===null&&(k.includes(n[~-i])||J.includes(n[e]))||n.startsWith("!important",e)&&!O||c&&(n[~-i]==="'"||n[~-i]==='"')||n[~-i]==="}"&&n.startsWith("</style",e)||n[e]===">"&&(`'"`.includes(n[G(n,e)])||n[a(n,e)]==="<")||n[e]==="/"&&n[a(n,e)]===">")&&(o="",n[e]==="/"&&n[e+1]===">"&&a(n,e)&&a(n,e)>e+1&&($.push(e+1,a(n,e)),m-=a(n,e)-e+1)),g&&n[e]==="}"&&i&&n[i-1]==="}"&&(o=" "),o?.length&&(m+=1),l.lineLengthLimit?m>=l.lineLengthLimit||!n[e+1]||n[e]===">"||n[e]==="/"&&n[e+1]===">"?((m>l.lineLengthLimit||m===l.lineLengthLimit&&n[e+1]&&n[e+1].trim()&&!P.includes(n[e])&&!I.includes(n[e+1]))&&(o=b,m=1),(m>l.lineLengthLimit||!(o===" "&&e===i+1))&&($.push(i,e,o),p=null),t=null,s=null,r=null):(t===null||i<t)&&(t=i,s=e,r=o):e===i+1&&o===" "||$.push(i,e,o)}i=null,S||(S=!0)}else C&&(C=!1),l.removeLineBreaks&&(m+=1);S||(S=!0)}if(!u&&!C&&e!==0&&l.removeLineBreaks&&(l.lineLengthLimit||v)&&!n.startsWith("</a",e)){if(v&&X(n,e,l.breakToTheLeftOf)&&n.slice(0,e).trim()&&(!n.startsWith("<![endif]",e)||!oe(n,e,"<!--"))){$.push(e,e,b),t=null,s=null,r=null,m=1;continue}else if(l.lineLengthLimit&&m<=l.lineLengthLimit){if(!n[e+1]||I.includes(n[e])&&!K.includes(n[e])||P.includes(n[e])||!n[e].trim()){if(t!==null&&s!==null&&(t!==s||r?.length)){let o=r;n[e].trim()&&n[e+1]&&n[e+1].trim()&&m+(r?r.length:0)>l.lineLengthLimit&&(o=b),(m+(o?o.length:0)>l.lineLengthLimit||!(o===" "&&s===t+1&&n[t]===" "))&&(n[~-t]==="}"&&n[s]==="{"||($.push(t,s,o),p=null))}n[e].trim()&&(I.includes(n[e])||n[~-e]&&P.includes(n[~-e]))&&y(M)&&(!T||!l.mindTheInlineTags.includes(T))&&!(n[e]==="<"&&F(n,e,l.mindTheInlineTags,{cb:o=>!o||!/\w/.test(o)}))&&!(n[e]==="<"&&F(n,e,l.mindTheInlineTags,{trimCharsBeforeMatching:"/",cb:o=>!o||!/\w/.test(o)}))?(t=e,s=e,r=null):f===null&&t!==null&&(c||!l.mindTheInlineTags||!Array.isArray(l.mindTheInlineTags)||Array.isArray(l.mindTheInlineTags.length)&&!l.mindTheInlineTags.length||!y(T)||Array.isArray(l.mindTheInlineTags)&&l.mindTheInlineTags.length&&y(T)&&!l.mindTheInlineTags.includes(T))&&!(n[e]==="<"&&F(n,e,l.mindTheInlineTags,{trimCharsBeforeMatching:"/",cb:o=>!o||!/\w/.test(o)}))&&(t=null,s=null,r=null)}}else if(l.lineLengthLimit)if(I.includes(n[e])&&!(n[e]==="<"&&F(n,e,l.mindTheInlineTags,{trimCharsBeforeMatching:"/",cb:o=>!o||!/\w/.test(o)})))if(t!==null&&s!==null&&(t!==s||r?.length)){let o=r?.length?r.length:0;m-(s-t-o)-1>l.lineLengthLimit||($.push(t,s,r),m-(s-t-o)-1===l.lineLengthLimit&&($.push(e,e,b),m=0),t=null,s=null,r=null)}else $.push(e,e,b),m=0;else n[e+1]&&P.includes(n[e])&&y(T)&&Array.isArray(l.mindTheInlineTags)&&l.mindTheInlineTags.length&&!l.mindTheInlineTags.includes(T)?t!==null&&s!==null&&(t!==s||r?.length)||($.push(e+1,e+1,b),m=0):n[e].trim()&&(n[e+1]||t!==null&&s!==null&&(t!==s||r?.length)&&$.push(t,s,b))}if(!u&&!C&&l.removeLineBreaks&&l.lineLengthLimit&&m>=l.lineLengthLimit&&t!==null&&s!==null&&!P.includes(n[e])&&!I.includes(n[e])&&!"/".includes(n[e])&&!(m===l.lineLengthLimit&&n[e+1]&&!n[e+1].trim())){let o=b;n[e+1]&&!n[e+1].trim()&&m===l.lineLengthLimit&&(o=r),o===b&&!n[~-t].trim()&&G(n,t)&&(t=G(n,t)+1),$.push(t,s,o),m=e-s,n[e].length&&(m+=1),t=null,s=null,r=null}if((!u&&n[e]===`
18
+ `&&n[e-2]==="\r"&&i===e-2)&&$.push(i,e,h),t=null,s=null,a=null,i=null,r=1;continue}let o=" ";n[e]==="<"&&F(n,e,l.mindTheInlineTags,{cb:N=>!N||!/\w/.test(N)})||(n[~-i]&&X.includes(n[~-i])&&z.includes(n[e])||(c||g)&&E===null&&(U.includes(n[~-i])||J.includes(n[e]))||n.startsWith("!important",e)&&!V||g&&(n[~-i]==="'"||n[~-i]==='"')||n[~-i]==="}"&&n.startsWith("</style",e)||n[e]===">"&&(`'"`.includes(n[_(n,e)])||n[m(n,e)]==="<")||n[e]==="/"&&n[m(n,e)]===">")&&(o="",n[e]==="/"&&n[e+1]===">"&&m(n,e)&&m(n,e)>e+1&&($.push(e+1,m(n,e)),r-=m(n,e)-e+1)),c&&n[e]==="}"&&i&&n[i-1]==="}"&&(o=" "),o?.length&&(r+=1),l.lineLengthLimit?r>=l.lineLengthLimit||!n[e+1]||n[e]===">"||n[e]==="/"&&n[e+1]===">"?((r>l.lineLengthLimit||r===l.lineLengthLimit&&n[e+1]&&n[e+1].trim()&&!P.includes(n[e])&&!I.includes(n[e+1]))&&(o=h,r=1),(r>l.lineLengthLimit||!(o===" "&&e===i+1))&&($.push(i,e,o),S=null),t=null,s=null,a=null):(t===null||i<t)&&(t=i,s=e,a=o):e===i+1&&o===" "||$.push(i,e,o)}i=null,D||(D=!0)}else y&&(y=!1),l.removeLineBreaks&&(r+=1);D||(D=!0)}if(!u&&!y&&e!==0&&l.removeLineBreaks&&(l.lineLengthLimit||v)&&!n.startsWith("</a",e)){if(v&&q(n,e,l.breakToTheLeftOf)&&n.slice(0,e).trim()&&(!n.startsWith("<![endif]",e)||!te(n,e,"<!--"))){$.push(e,e,h),t=null,s=null,a=null,r=1;continue}else if(l.lineLengthLimit&&r<=l.lineLengthLimit){if(!n[e+1]||I.includes(n[e])&&!Q.includes(n[e])||P.includes(n[e])||!n[e].trim()){if(t!==null&&s!==null&&(t!==s||a?.length)){let o=a;n[e].trim()&&n[e+1]&&n[e+1].trim()&&r+(a?a.length:0)>l.lineLengthLimit&&(o=h),(r+(o?o.length:0)>l.lineLengthLimit||!(o===" "&&s===t+1&&n[t]===" "))&&(n[~-t]==="}"&&n[s]==="{"||($.push(t,s,o),S=null))}n[e].trim()&&(I.includes(n[e])||n[~-e]&&P.includes(n[~-e]))&&p(M)&&(!d||!l.mindTheInlineTags.includes(d))&&!(n[e]==="<"&&F(n,e,l.mindTheInlineTags,{cb:o=>!o||!/\w/.test(o)}))&&!(n[e]==="<"&&F(n,e,l.mindTheInlineTags,{trimCharsBeforeMatching:"/",cb:o=>!o||!/\w/.test(o)}))?(t=e,s=e,a=null):E===null&&t!==null&&(g||!l.mindTheInlineTags||!Array.isArray(l.mindTheInlineTags)||Array.isArray(l.mindTheInlineTags.length)&&!l.mindTheInlineTags.length||!p(d)||Array.isArray(l.mindTheInlineTags)&&l.mindTheInlineTags.length&&p(d)&&!l.mindTheInlineTags.includes(d))&&!(n[e]==="<"&&F(n,e,l.mindTheInlineTags,{trimCharsBeforeMatching:"/",cb:o=>!o||!/\w/.test(o)}))&&(t=null,s=null,a=null)}}else if(l.lineLengthLimit)if(I.includes(n[e])&&!(n[e]==="<"&&F(n,e,l.mindTheInlineTags,{trimCharsBeforeMatching:"/",cb:o=>!o||!/\w/.test(o)})))if(t!==null&&s!==null&&(t!==s||a?.length)){let o=a?.length?a.length:0;r-(s-t-o)-1>l.lineLengthLimit||($.push(t,s,a),r-(s-t-o)-1===l.lineLengthLimit&&($.push(e,e,h),r=0),t=null,s=null,a=null)}else $.push(e,e,h),r=0;else n[e+1]&&P.includes(n[e])&&p(d)&&Array.isArray(l.mindTheInlineTags)&&l.mindTheInlineTags.length&&!l.mindTheInlineTags.includes(d)?t!==null&&s!==null&&(t!==s||a?.length)||($.push(e+1,e+1,h),r=0):n[e].trim()&&(n[e+1]||t!==null&&s!==null&&(t!==s||a?.length)&&$.push(t,s,h))}if(!u&&!y&&l.removeLineBreaks&&l.lineLengthLimit&&r>=l.lineLengthLimit&&t!==null&&s!==null&&!P.includes(n[e])&&!I.includes(n[e])&&!"/".includes(n[e])&&!(r===l.lineLengthLimit&&n[e+1]&&!n[e+1].trim())){let o=h;n[e+1]&&!n[e+1].trim()&&r===l.lineLengthLimit&&(o=a),o===h&&!n[~-t].trim()&&_(n,t)&&(t=_(n,t)+1),$.push(t,s,o),r=e-s,n[e].length&&(r+=1),t=null,s=null,a=null}if((!u&&n[e]===`
19
19
  `||n[e]==="\r"&&(!n[e+1]||n[e+1]&&n[e+1]!==`
20
- `))&&(p=e,S&&(S=!1),!l.removeLineBreaks&&i!==null&&i<e&&n[e+1]&&n[e+1]!=="\r"&&n[e+1]!==`
21
- `&&$.push(i,e)),n[e+1]||(g&&f!==null?$.push(..._({str:n,from:f,to:e,ifLeftSideIncludesThisThenCropTightly:k||"",ifRightSideIncludesThisThenCropTightly:J||""})):i&&n[e]!==`
20
+ `))&&(S=e,D&&(D=!1),!l.removeLineBreaks&&i!==null&&i<e&&n[e+1]&&n[e+1]!=="\r"&&n[e+1]!==`
21
+ `&&$.push(i,e)),n[e+1]||(c&&E!==null?$.push(...B({str:n,from:E,to:e,ifLeftSideIncludesThisThenCropTightly:U||"",ifRightSideIncludesThisThenCropTightly:J||""})):i&&n[e]!==`
22
22
  `&&n[e]!=="\r"?$.push(i,e+1):i&&(n[e]==="\r"&&n[e+1]===`
23
23
  `||n[e]===`
24
- `&&n[e-1]!=="\r")&&$.push(i,e)),!u&&c&&c<e&&n[c]===n[e]&&(c=null),!u&&!g&&n.startsWith("<pre",e)&&!A(n[e+4])){let o=n.indexOf("</pre",e+5);o>0&&(u=o)}if(!u&&!g&&n.startsWith("<code",e)&&!A(n[e+5])){let o=n.indexOf("</code",e+5);o>0&&(u=o)}if(!u&&n.startsWith("<![CDATA[",e)){let o=n.indexOf("]]>",e+9);o>0&&(u=o)}!u&&!g&&!c&&D!==null&&n[e]===">"&&(n[a(n,e)]==="<"&&(M=T),D=null,T=null),n[e]==="<"&&M!==null&&(M=null),g&&n[e]==="{"&&n[e+1]==="{"&&n.indexOf("}}")!==-1&&(u=n.indexOf("}}")+2);let w=!0}if($.current()){let e=$.current();$.wipe();let w=l.reportProgressFuncTo-(l.reportProgressFuncTo-l.reportProgressFuncFrom)*B,o=ne(n,e,Z=>{l.reportProgressFunc&&h>=2e3&&(d=Math.floor(w+(l.reportProgressFuncTo-w)*(Z/100)),d!==R&&(R=d,l.reportProgressFunc(d)))}),N=o.length;return{log:{timeTakenInMilliseconds:Date.now()-x,originalLength:h,cleanedLength:N,bytesSaved:Math.max(h-N,0),percentageReducedOfOriginal:h?Math.round(Math.max(h-N,0)*100/h):0},ranges:e,applicableOpts:L,result:o}}}return{log:{timeTakenInMilliseconds:Date.now()-x,originalLength:h,cleanedLength:h,bytesSaved:0,percentageReducedOfOriginal:0},applicableOpts:L,ranges:null,result:n}}export{ce as crush,te as defaults,ge as version};
24
+ `&&n[e-1]!=="\r")&&$.push(i,e)),!u&&g&&g<e&&n[g]===n[e]&&(g=null),!u&&!c&&n.startsWith("<pre",e)&&!O(n[e+4])){let o=n.indexOf("</pre",e+5);o>0&&(u=o)}if(!u&&!c&&n.startsWith("<code",e)&&!O(n[e+5])){let o=n.indexOf("</code",e+5);o>0&&(u=o)}if(!u&&n.startsWith("<![CDATA[",e)){let o=n.indexOf("]]>",e+9);o>0&&(u=o)}!u&&!c&&!g&&L!==null&&n[e]===">"&&(n[m(n,e)]==="<"&&(M=d),L=null,d=null),n[e]==="<"&&M!==null&&(M=null),c&&n[e]==="{"&&n[e+1]==="{"&&n.indexOf("}}")!==-1&&(u=n.indexOf("}}")+2);let w=!0}if($.current()){let e=$.current();$.wipe();let w=l.reportProgressFuncTo-(l.reportProgressFuncTo-l.reportProgressFuncFrom)*W,o=le(n,e,ee=>{l.reportProgressFunc&&f>=2e3&&(T=Math.floor(w+(l.reportProgressFuncTo-w)*(ee/100)),T!==k&&(k=T,l.reportProgressFunc(T)))}),N=o.length;return{log:{timeTakenInMilliseconds:Date.now()-x,originalLength:f,cleanedLength:N,bytesSaved:Math.max(f-N,0),percentageReducedOfOriginal:f?Math.round(Math.max(f-N,0)*100/f):0},ranges:e,applicableOpts:C,result:o}}}return{log:{timeTakenInMilliseconds:Date.now()-x,originalLength:f,cleanedLength:f,bytesSaved:0,percentageReducedOfOriginal:0},applicableOpts:C,ranges:null,result:n}}export{fe as crush,ie as defaults,he as version};
25
+ /**
26
+ * @name codsen-utils
27
+ * @fileoverview Various utility functions
28
+ * @version 1.3.0
29
+ * @author Roy Revelt, Codsen Ltd
30
+ * @license MIT
31
+ * {@link https://codsen.com/os/codsen-utils/}
32
+ */
@@ -1,48 +1,48 @@
1
1
  /**
2
2
  * @name html-crush
3
3
  * @fileoverview Minify email templates
4
- * @version 6.0.7
4
+ * @version 6.0.9
5
5
  * @author Roy Revelt, Codsen Ltd
6
6
  * @license MIT
7
7
  * {@link https://codsen.com/os/html-crush/}
8
8
  */
9
9
 
10
- "use strict";var htmlCrush=(()=>{var zt=Object.create;var ee=Object.defineProperty;var Zt=Object.getOwnPropertyDescriptor;var en=Object.getOwnPropertyNames,ke=Object.getOwnPropertySymbols,tn=Object.getPrototypeOf,je=Object.prototype.hasOwnProperty,nn=Object.prototype.propertyIsEnumerable;var ye=(e,t,r)=>t in e?ee(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,S=(e,t)=>{for(var r in t||(t={}))je.call(t,r)&&ye(e,r,t[r]);if(ke)for(var r of ke(t))nn.call(t,r)&&ye(e,r,t[r]);return e};var rn=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),on=(e,t)=>{for(var r in t)ee(e,r,{get:t[r],enumerable:!0})},Ue=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of en(t))!je.call(e,a)&&a!==r&&ee(e,a,{get:()=>t[a],enumerable:!(n=Zt(t,a))||n.enumerable});return e};var sn=(e,t,r)=>(r=e!=null?zt(tn(e)):{},Ue(t||!e||!e.__esModule?ee(r,"default",{value:e,enumerable:!0}):r,e)),ln=e=>Ue(ee({},"__esModule",{value:!0}),e);var Ee=(e,t,r)=>(ye(e,typeof t!="symbol"?t+"":t,r),r);var jt=rn((ne,j)=>{var pn=200,ht="__lodash_hash_undefined__",$t=9007199254740991,Re="[object Arguments]",dn="[object Array]",pt="[object Boolean]",dt="[object Date]",bn="[object Error]",Ve="[object Function]",bt="[object GeneratorFunction]",ue="[object Map]",Tt="[object Number]",Me="[object Object]",rt="[object Promise]",yt="[object RegExp]",ge="[object Set]",Et="[object String]",St="[object Symbol]",De="[object WeakMap]",Ot="[object ArrayBuffer]",ce="[object DataView]",wt="[object Float32Array]",Lt="[object Float64Array]",At="[object Int8Array]",Dt="[object Int16Array]",Ct="[object Int32Array]",It="[object Uint8Array]",vt="[object Uint8ClampedArray]",Nt="[object Uint16Array]",_t="[object Uint32Array]",Tn=/[\\^$.*+?()[\]{}|]/g,yn=/\w*$/,En=/^\[object .+?Constructor\]$/,Sn=/^(?:0|[1-9]\d*)$/,O={};O[Re]=O[dn]=O[Ot]=O[ce]=O[pt]=O[dt]=O[wt]=O[Lt]=O[At]=O[Dt]=O[Ct]=O[ue]=O[Tt]=O[Me]=O[yt]=O[ge]=O[Et]=O[St]=O[It]=O[vt]=O[Nt]=O[_t]=!0;O[bn]=O[Ve]=O[De]=!1;var On=typeof global=="object"&&global&&global.Object===Object&&global,wn=typeof self=="object"&&self&&self.Object===Object&&self,N=On||wn||Function("return this")(),Rt=typeof ne=="object"&&ne&&!ne.nodeType&&ne,it=Rt&&typeof j=="object"&&j&&!j.nodeType&&j,Ln=it&&it.exports===Rt;function An(e,t){return e.set(t[0],t[1]),e}function Dn(e,t){return e.add(t),e}function Cn(e,t){for(var r=-1,n=e?e.length:0;++r<n&&t(e[r],r,e)!==!1;);return e}function In(e,t){for(var r=-1,n=t.length,a=e.length;++r<n;)e[a+r]=t[r];return e}function Vt(e,t,r,n){var a=-1,o=e?e.length:0;for(n&&o&&(r=e[++a]);++a<o;)r=t(r,e[a],a,e);return r}function vn(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}function Nn(e,t){return e==null?void 0:e[t]}function Mt(e){var t=!1;if(e!=null&&typeof e.toString!="function")try{t=!!(e+"")}catch(r){}return t}function ot(e){var t=-1,r=Array(e.size);return e.forEach(function(n,a){r[++t]=[a,n]}),r}function Pe(e,t){return function(r){return e(t(r))}}function st(e){var t=-1,r=Array(e.size);return e.forEach(function(n){r[++t]=n}),r}var _n=Array.prototype,Rn=Function.prototype,fe=Object.prototype,Ae=N["__core-js_shared__"],lt=function(){var e=/[^.]+$/.exec(Ae&&Ae.keys&&Ae.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),Pt=Rn.toString,x=fe.hasOwnProperty,me=fe.toString,Vn=RegExp("^"+Pt.call(x).replace(Tn,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),at=Ln?N.Buffer:void 0,ut=N.Symbol,gt=N.Uint8Array,Mn=Pe(Object.getPrototypeOf,Object),Pn=Object.create,xn=fe.propertyIsEnumerable,Fn=_n.splice,ct=Object.getOwnPropertySymbols,Hn=at?at.isBuffer:void 0,Wn=Pe(Object.keys,Object),Ce=q(N,"DataView"),re=q(N,"Map"),Ie=q(N,"Promise"),ve=q(N,"Set"),Ne=q(N,"WeakMap"),ie=q(Object,"create"),Jn=W(Ce),Bn=W(re),kn=W(Ie),jn=W(ve),Un=W(Ne),ft=ut?ut.prototype:void 0,mt=ft?ft.valueOf:void 0;function H(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 Gn(){this.__data__=ie?ie(null):{}}function qn(e){return this.has(e)&&delete this.__data__[e]}function Kn(e){var t=this.__data__;if(ie){var r=t[e];return r===ht?void 0:r}return x.call(t,e)?t[e]:void 0}function Yn(e){var t=this.__data__;return ie?t[e]!==void 0:x.call(t,e)}function Qn(e,t){var r=this.__data__;return r[e]=ie&&t===void 0?ht:t,this}H.prototype.clear=Gn;H.prototype.delete=qn;H.prototype.get=Kn;H.prototype.has=Yn;H.prototype.set=Qn;function _(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 Xn(){this.__data__=[]}function zn(e){var t=this.__data__,r=he(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():Fn.call(t,r,1),!0}function Zn(e){var t=this.__data__,r=he(t,e);return r<0?void 0:t[r][1]}function er(e){return he(this.__data__,e)>-1}function tr(e,t){var r=this.__data__,n=he(r,e);return n<0?r.push([e,t]):r[n][1]=t,this}_.prototype.clear=Xn;_.prototype.delete=zn;_.prototype.get=Zn;_.prototype.has=er;_.prototype.set=tr;function U(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 nr(){this.__data__={hash:new H,map:new(re||_),string:new H}}function rr(e){return $e(this,e).delete(e)}function ir(e){return $e(this,e).get(e)}function or(e){return $e(this,e).has(e)}function sr(e,t){return $e(this,e).set(e,t),this}U.prototype.clear=nr;U.prototype.delete=rr;U.prototype.get=ir;U.prototype.has=or;U.prototype.set=sr;function G(e){this.__data__=new _(e)}function lr(){this.__data__=new _}function ar(e){return this.__data__.delete(e)}function ur(e){return this.__data__.get(e)}function gr(e){return this.__data__.has(e)}function cr(e,t){var r=this.__data__;if(r instanceof _){var n=r.__data__;if(!re||n.length<pn-1)return n.push([e,t]),this;r=this.__data__=new U(n)}return r.set(e,t),this}G.prototype.clear=lr;G.prototype.delete=ar;G.prototype.get=ur;G.prototype.has=gr;G.prototype.set=cr;function fr(e,t){var r=Fe(e)||Pr(e)?vn(e.length,String):[],n=r.length,a=!!n;for(var o in e)(t||x.call(e,o))&&!(a&&(o=="length"||_r(o,n)))&&r.push(o);return r}function xt(e,t,r){var n=e[t];(!(x.call(e,t)&&Jt(n,r))||r===void 0&&!(t in e))&&(e[t]=r)}function he(e,t){for(var r=e.length;r--;)if(Jt(e[r][0],t))return r;return-1}function mr(e,t){return e&&Ft(t,He(t),e)}function _e(e,t,r,n,a,o,u){var l;if(n&&(l=o?n(e,a,o,u):n(e)),l!==void 0)return l;if(!pe(e))return e;var c=Fe(e);if(c){if(l=Ir(e),!t)return Ar(e,l)}else{var s=F(e),d=s==Ve||s==bt;if(Fr(e))return Tr(e,t);if(s==Me||s==Re||d&&!o){if(Mt(e))return o?e:{};if(l=vr(d?{}:e),!t)return Dr(e,mr(l,e))}else{if(!O[s])return o?e:{};l=Nr(e,s,_e,t)}}u||(u=new G);var p=u.get(e);if(p)return p;if(u.set(e,l),!c)var T=r?Cr(e):He(e);return Cn(T||e,function(f,m){T&&(m=f,f=e[m]),xt(l,m,_e(f,t,r,n,m,e,u))}),l}function hr(e){return pe(e)?Pn(e):{}}function $r(e,t,r){var n=t(e);return Fe(e)?n:In(n,r(e))}function pr(e){return me.call(e)}function dr(e){if(!pe(e)||Vr(e))return!1;var t=kt(e)||Mt(e)?Vn:En;return t.test(W(e))}function br(e){if(!Wt(e))return Wn(e);var t=[];for(var r in Object(e))x.call(e,r)&&r!="constructor"&&t.push(r);return t}function Tr(e,t){if(t)return e.slice();var r=new e.constructor(e.length);return e.copy(r),r}function xe(e){var t=new e.constructor(e.byteLength);return new gt(t).set(new gt(e)),t}function yr(e,t){var r=t?xe(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}function Er(e,t,r){var n=t?r(ot(e),!0):ot(e);return Vt(n,An,new e.constructor)}function Sr(e){var t=new e.constructor(e.source,yn.exec(e));return t.lastIndex=e.lastIndex,t}function Or(e,t,r){var n=t?r(st(e),!0):st(e);return Vt(n,Dn,new e.constructor)}function wr(e){return mt?Object(mt.call(e)):{}}function Lr(e,t){var r=t?xe(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}function Ar(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}function Ft(e,t,r,n){r||(r={});for(var a=-1,o=t.length;++a<o;){var u=t[a],l=n?n(r[u],e[u],u,r,e):void 0;xt(r,u,l===void 0?e[u]:l)}return r}function Dr(e,t){return Ft(e,Ht(e),t)}function Cr(e){return $r(e,He,Ht)}function $e(e,t){var r=e.__data__;return Rr(t)?r[typeof t=="string"?"string":"hash"]:r.map}function q(e,t){var r=Nn(e,t);return dr(r)?r:void 0}var Ht=ct?Pe(ct,Object):Jr,F=pr;(Ce&&F(new Ce(new ArrayBuffer(1)))!=ce||re&&F(new re)!=ue||Ie&&F(Ie.resolve())!=rt||ve&&F(new ve)!=ge||Ne&&F(new Ne)!=De)&&(F=function(e){var t=me.call(e),r=t==Me?e.constructor:void 0,n=r?W(r):void 0;if(n)switch(n){case Jn:return ce;case Bn:return ue;case kn:return rt;case jn:return ge;case Un:return De}return t});function Ir(e){var t=e.length,r=e.constructor(t);return t&&typeof e[0]=="string"&&x.call(e,"index")&&(r.index=e.index,r.input=e.input),r}function vr(e){return typeof e.constructor=="function"&&!Wt(e)?hr(Mn(e)):{}}function Nr(e,t,r,n){var a=e.constructor;switch(t){case Ot:return xe(e);case pt:case dt:return new a(+e);case ce:return yr(e,n);case wt:case Lt:case At:case Dt:case Ct:case It:case vt:case Nt:case _t:return Lr(e,n);case ue:return Er(e,n,r);case Tt:case Et:return new a(e);case yt:return Sr(e);case ge:return Or(e,n,r);case St:return wr(e)}}function _r(e,t){return t=t==null?$t:t,!!t&&(typeof e=="number"||Sn.test(e))&&e>-1&&e%1==0&&e<t}function Rr(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function Vr(e){return!!lt&&lt in e}function Wt(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||fe;return e===r}function W(e){if(e!=null){try{return Pt.call(e)}catch(t){}try{return e+""}catch(t){}}return""}function Mr(e){return _e(e,!0,!0)}function Jt(e,t){return e===t||e!==e&&t!==t}function Pr(e){return xr(e)&&x.call(e,"callee")&&(!xn.call(e,"callee")||me.call(e)==Re)}var Fe=Array.isArray;function Bt(e){return e!=null&&Hr(e.length)&&!kt(e)}function xr(e){return Wr(e)&&Bt(e)}var Fr=Hn||Br;function kt(e){var t=pe(e)?me.call(e):"";return t==Ve||t==bt}function Hr(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=$t}function pe(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function Wr(e){return!!e&&typeof e=="object"}function He(e){return Bt(e)?fr(e):br(e)}function Jr(){return[]}function Br(){return!1}j.exports=Mr});var Yr={};on(Yr,{crush:()=>Kr,defaults:()=>Gt,version:()=>qr});var an={strictlyTwoElementsInRangeArrays:!1,progressFn:null};function Se(e,t){if(!Array.isArray(e)||!e.length)return e;let r=S(S({},an),t),n,a;if(r.strictlyTwoElementsInRangeArrays&&!e.every((l,c)=>!Array.isArray(l)||l.length!==2?(n=c,a=l.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 ${a} elements!`);if(!e.every((l,c)=>!Array.isArray(l)||!Number.isInteger(l[0])||l[0]<0||!Number.isInteger(l[1])||l[1]<0?(n=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, ${n}th range (${JSON.stringify(e[n],null,4)}) does not consist of only natural numbers!`);let o=e.length**2,u=0;return Array.from(e).sort((l,c)=>(r.progressFn&&(u+=1,r.progressFn(Math.floor(u*100/o))),l[0]===c[0]?l[1]<c[1]?-1:l[1]>c[1]?1:0:l[0]<c[0]?-1:1))}var Ge={mergeType:1,progressFn:null,joinRangesThatTouchEdges:!0};function qe(e,t){function r(s){return!!s&&typeof s=="object"&&!Array.isArray(s)}if(!Array.isArray(e)||!e.length)return null;let n;if(t)if(r(t)){if(n=S(S({},Ge),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:
11
- ${JSON.stringify(t,null,4)} (type ${typeof t})`);else n=S({},Ge);let a=e.filter(s=>Array.isArray(s)).map(s=>[...s]).filter(s=>s[2]!==void 0||s[0]!==s[1]),o,u,l;n.progressFn?o=Se(a,{progressFn:s=>{l=Math.floor(s/5),l!==u&&(u=l,n.progressFn(l))}}):o=Se(a);let c=o.length-1;for(let s=c;s>0;s--)n.progressFn&&(l=Math.floor((1-s/c)*78)+21,l!==u&&l>u&&(u=l,n.progressFn(l))),(o[s][0]<=o[s-1][0]||!n.joinRangesThatTouchEdges&&o[s][0]<o[s-1][1]||n.joinRangesThatTouchEdges&&o[s][0]<=o[s-1][1])&&(o[s-1][0]=Math.min(o[s][0],o[s-1][0]),o[s-1][1]=Math.max(o[s][1],o[s-1][1]),o[s][2]!==void 0&&(o[s-1][0]>=o[s][0]||o[s-1][1]<=o[s][1])&&o[s-1][2]!==null&&(o[s][2]===null&&o[s-1][2]!==null?o[s-1][2]=null:o[s-1][2]!=null?+n.mergeType==2&&o[s-1][0]===o[s][0]?o[s-1][2]=o[s][2]:o[s-1][2]+=o[s][2]:o[s-1][2]=o[s][2]),o.splice(s,1),s=o.length);return o.length?o:null}var un=!0,Oe="Invariant failed";function Ke(e,t){if(!e){if(un)throw new Error(Oe);var r=typeof t=="function"?t():t,n=r?"".concat(Oe,": ").concat(r):Oe;throw new Error(n)}}function Ye(e,t,r){let n=0,a=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 o;Array.isArray(t)&&Number.isInteger(t[0])&&Number.isInteger(t[1])?o=[Array.from(t)]:o=Array.from(t);let u=o.length,l=0;o.filter(d=>d).forEach((d,p)=>{if(r&&(n=Math.floor(l/u*10),n!==a&&(a=n,r(n))),!Array.isArray(d))throw new TypeError(`ranges-apply: [THROW_ID_05] ranges array, second input arg., has ${p}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 ${p}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)}.`);o[p][0]=+o[p][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 ${p}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)}.`);o[p][1]=+o[p][1]}l+=1});let c=qe(o,{progressFn:d=>{r&&(n=10+Math.floor(d/10),n!==a&&(a=n,r(n)))}});Ke(c);let s=c.length;if(s>0){let d=e.slice(c[s-1][1]);e=c.reduce((p,T,f,m)=>{r&&(n=20+Math.floor(f/s*80),n!==a&&(a=n,r(n)));let w=f===0?0:m[f-1][1],L=m[f][0];return`${p}${e.slice(w,L)}${m[f][2]||""}`},""),e+=d}return e}function se(e,t=1){let r="\xA0";function n(o){return Array.from(o).reverse().join("")}function a(o,u,l){let c=l?`
10
+ "use strict";var htmlCrush=(()=>{var Zt=Object.create;var ne=Object.defineProperty;var en=Object.getOwnPropertyDescriptor;var tn=Object.getOwnPropertyNames,je=Object.getOwnPropertySymbols,nn=Object.getPrototypeOf,ke=Object.prototype.hasOwnProperty,rn=Object.prototype.propertyIsEnumerable;var ye=(e,t,r)=>t in e?ne(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,S=(e,t)=>{for(var r in t||(t={}))ke.call(t,r)&&ye(e,r,t[r]);if(je)for(var r of je(t))rn.call(t,r)&&ye(e,r,t[r]);return e};var on=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),sn=(e,t)=>{for(var r in t)ne(e,r,{get:t[r],enumerable:!0})},Ue=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of tn(t))!ke.call(e,a)&&a!==r&&ne(e,a,{get:()=>t[a],enumerable:!(n=en(t,a))||n.enumerable});return e};var ln=(e,t,r)=>(r=e!=null?Zt(nn(e)):{},Ue(t||!e||!e.__esModule?ne(r,"default",{value:e,enumerable:!0}):r,e)),an=e=>Ue(ne({},"__esModule",{value:!0}),e);var Ee=(e,t,r)=>(ye(e,typeof t!="symbol"?t+"":t,r),r);var Ut=on((re,K)=>{var bn=200,$t="__lodash_hash_undefined__",pt=9007199254740991,Re="[object Arguments]",Tn="[object Array]",dt="[object Boolean]",bt="[object Date]",yn="[object Error]",Ve="[object Function]",Tt="[object GeneratorFunction]",ue="[object Map]",yt="[object Number]",Me="[object Object]",it="[object Promise]",Et="[object RegExp]",ge="[object Set]",St="[object String]",Ot="[object Symbol]",Ae="[object WeakMap]",wt="[object ArrayBuffer]",ce="[object DataView]",Lt="[object Float32Array]",Dt="[object Float64Array]",At="[object Int8Array]",Ct="[object Int16Array]",It="[object Int32Array]",vt="[object Uint8Array]",Nt="[object Uint8ClampedArray]",_t="[object Uint16Array]",Rt="[object Uint32Array]",En=/[\\^$.*+?()[\]{}|]/g,Sn=/\w*$/,On=/^\[object .+?Constructor\]$/,wn=/^(?:0|[1-9]\d*)$/,O={};O[Re]=O[Tn]=O[wt]=O[ce]=O[dt]=O[bt]=O[Lt]=O[Dt]=O[At]=O[Ct]=O[It]=O[ue]=O[yt]=O[Me]=O[Et]=O[ge]=O[St]=O[Ot]=O[vt]=O[Nt]=O[_t]=O[Rt]=!0;O[yn]=O[Ve]=O[Ae]=!1;var Ln=typeof global=="object"&&global&&global.Object===Object&&global,Dn=typeof self=="object"&&self&&self.Object===Object&&self,V=Ln||Dn||Function("return this")(),Vt=typeof re=="object"&&re&&!re.nodeType&&re,ot=Vt&&typeof K=="object"&&K&&!K.nodeType&&K,An=ot&&ot.exports===Vt;function Cn(e,t){return e.set(t[0],t[1]),e}function In(e,t){return e.add(t),e}function vn(e,t){for(var r=-1,n=e?e.length:0;++r<n&&t(e[r],r,e)!==!1;);return e}function Nn(e,t){for(var r=-1,n=t.length,a=e.length;++r<n;)e[a+r]=t[r];return e}function Mt(e,t,r,n){var a=-1,o=e?e.length:0;for(n&&o&&(r=e[++a]);++a<o;)r=t(r,e[a],a,e);return r}function _n(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}function Rn(e,t){return e==null?void 0:e[t]}function Pt(e){var t=!1;if(e!=null&&typeof e.toString!="function")try{t=!!(e+"")}catch(r){}return t}function st(e){var t=-1,r=Array(e.size);return e.forEach(function(n,a){r[++t]=[a,n]}),r}function Pe(e,t){return function(r){return e(t(r))}}function lt(e){var t=-1,r=Array(e.size);return e.forEach(function(n){r[++t]=n}),r}var Vn=Array.prototype,Mn=Function.prototype,me=Object.prototype,De=V["__core-js_shared__"],at=function(){var e=/[^.]+$/.exec(De&&De.keys&&De.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),xt=Mn.toString,F=me.hasOwnProperty,fe=me.toString,Pn=RegExp("^"+xt.call(F).replace(En,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ut=An?V.Buffer:void 0,gt=V.Symbol,ct=V.Uint8Array,xn=Pe(Object.getPrototypeOf,Object),Fn=Object.create,Hn=me.propertyIsEnumerable,Wn=Vn.splice,mt=Object.getOwnPropertySymbols,Bn=ut?ut.isBuffer:void 0,Jn=Pe(Object.keys,Object),Ce=X(V,"DataView"),ie=X(V,"Map"),Ie=X(V,"Promise"),ve=X(V,"Set"),Ne=X(V,"WeakMap"),oe=X(Object,"create"),jn=j(Ce),kn=j(ie),Un=j(Ie),Gn=j(ve),qn=j(Ne),ft=gt?gt.prototype:void 0,ht=ft?ft.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 Kn(){this.__data__=oe?oe(null):{}}function Yn(e){return this.has(e)&&delete this.__data__[e]}function Qn(e){var t=this.__data__;if(oe){var r=t[e];return r===$t?void 0:r}return F.call(t,e)?t[e]:void 0}function Xn(e){var t=this.__data__;return oe?t[e]!==void 0:F.call(t,e)}function zn(e,t){var r=this.__data__;return r[e]=oe&&t===void 0?$t:t,this}J.prototype.clear=Kn;J.prototype.delete=Yn;J.prototype.get=Qn;J.prototype.has=Xn;J.prototype.set=zn;function M(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 Zn(){this.__data__=[]}function er(e){var t=this.__data__,r=he(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():Wn.call(t,r,1),!0}function tr(e){var t=this.__data__,r=he(t,e);return r<0?void 0:t[r][1]}function nr(e){return he(this.__data__,e)>-1}function rr(e,t){var r=this.__data__,n=he(r,e);return n<0?r.push([e,t]):r[n][1]=t,this}M.prototype.clear=Zn;M.prototype.delete=er;M.prototype.get=tr;M.prototype.has=nr;M.prototype.set=rr;function Y(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 ir(){this.__data__={hash:new J,map:new(ie||M),string:new J}}function or(e){return $e(this,e).delete(e)}function sr(e){return $e(this,e).get(e)}function lr(e){return $e(this,e).has(e)}function ar(e,t){return $e(this,e).set(e,t),this}Y.prototype.clear=ir;Y.prototype.delete=or;Y.prototype.get=sr;Y.prototype.has=lr;Y.prototype.set=ar;function Q(e){this.__data__=new M(e)}function ur(){this.__data__=new M}function gr(e){return this.__data__.delete(e)}function cr(e){return this.__data__.get(e)}function mr(e){return this.__data__.has(e)}function fr(e,t){var r=this.__data__;if(r instanceof M){var n=r.__data__;if(!ie||n.length<bn-1)return n.push([e,t]),this;r=this.__data__=new Y(n)}return r.set(e,t),this}Q.prototype.clear=ur;Q.prototype.delete=gr;Q.prototype.get=cr;Q.prototype.has=mr;Q.prototype.set=fr;function hr(e,t){var r=Fe(e)||Fr(e)?_n(e.length,String):[],n=r.length,a=!!n;for(var o in e)(t||F.call(e,o))&&!(a&&(o=="length"||Vr(o,n)))&&r.push(o);return r}function Ft(e,t,r){var n=e[t];(!(F.call(e,t)&&Jt(n,r))||r===void 0&&!(t in e))&&(e[t]=r)}function he(e,t){for(var r=e.length;r--;)if(Jt(e[r][0],t))return r;return-1}function $r(e,t){return e&&Ht(t,He(t),e)}function _e(e,t,r,n,a,o,u){var l;if(n&&(l=o?n(e,a,o,u):n(e)),l!==void 0)return l;if(!pe(e))return e;var g=Fe(e);if(g){if(l=Nr(e),!t)return Cr(e,l)}else{var s=B(e),d=s==Ve||s==Tt;if(Wr(e))return Er(e,t);if(s==Me||s==Re||d&&!o){if(Pt(e))return o?e:{};if(l=_r(d?{}:e),!t)return Ir(e,$r(l,e))}else{if(!O[s])return o?e:{};l=Rr(e,s,_e,t)}}u||(u=new Q);var p=u.get(e);if(p)return p;if(u.set(e,l),!g)var T=r?vr(e):He(e);return vn(T||e,function(m,f){T&&(f=m,m=e[f]),Ft(l,f,_e(m,t,r,n,f,e,u))}),l}function pr(e){return pe(e)?Fn(e):{}}function dr(e,t,r){var n=t(e);return Fe(e)?n:Nn(n,r(e))}function br(e){return fe.call(e)}function Tr(e){if(!pe(e)||Pr(e))return!1;var t=kt(e)||Pt(e)?Pn:On;return t.test(j(e))}function yr(e){if(!Bt(e))return Jn(e);var t=[];for(var r in Object(e))F.call(e,r)&&r!="constructor"&&t.push(r);return t}function Er(e,t){if(t)return e.slice();var r=new e.constructor(e.length);return e.copy(r),r}function xe(e){var t=new e.constructor(e.byteLength);return new ct(t).set(new ct(e)),t}function Sr(e,t){var r=t?xe(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}function Or(e,t,r){var n=t?r(st(e),!0):st(e);return Mt(n,Cn,new e.constructor)}function wr(e){var t=new e.constructor(e.source,Sn.exec(e));return t.lastIndex=e.lastIndex,t}function Lr(e,t,r){var n=t?r(lt(e),!0):lt(e);return Mt(n,In,new e.constructor)}function Dr(e){return ht?Object(ht.call(e)):{}}function Ar(e,t){var r=t?xe(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}function Cr(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}function Ht(e,t,r,n){r||(r={});for(var a=-1,o=t.length;++a<o;){var u=t[a],l=n?n(r[u],e[u],u,r,e):void 0;Ft(r,u,l===void 0?e[u]:l)}return r}function Ir(e,t){return Ht(e,Wt(e),t)}function vr(e){return dr(e,He,Wt)}function $e(e,t){var r=e.__data__;return Mr(t)?r[typeof t=="string"?"string":"hash"]:r.map}function X(e,t){var r=Rn(e,t);return Tr(r)?r:void 0}var Wt=mt?Pe(mt,Object):jr,B=br;(Ce&&B(new Ce(new ArrayBuffer(1)))!=ce||ie&&B(new ie)!=ue||Ie&&B(Ie.resolve())!=it||ve&&B(new ve)!=ge||Ne&&B(new Ne)!=Ae)&&(B=function(e){var t=fe.call(e),r=t==Me?e.constructor:void 0,n=r?j(r):void 0;if(n)switch(n){case jn:return ce;case kn:return ue;case Un:return it;case Gn:return ge;case qn:return Ae}return t});function Nr(e){var t=e.length,r=e.constructor(t);return t&&typeof e[0]=="string"&&F.call(e,"index")&&(r.index=e.index,r.input=e.input),r}function _r(e){return typeof e.constructor=="function"&&!Bt(e)?pr(xn(e)):{}}function Rr(e,t,r,n){var a=e.constructor;switch(t){case wt:return xe(e);case dt:case bt:return new a(+e);case ce:return Sr(e,n);case Lt:case Dt:case At:case Ct:case It:case vt:case Nt:case _t:case Rt:return Ar(e,n);case ue:return Or(e,n,r);case yt:case St:return new a(e);case Et:return wr(e);case ge:return Lr(e,n,r);case Ot:return Dr(e)}}function Vr(e,t){return t=t==null?pt:t,!!t&&(typeof e=="number"||wn.test(e))&&e>-1&&e%1==0&&e<t}function Mr(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function Pr(e){return!!at&&at in e}function Bt(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||me;return e===r}function j(e){if(e!=null){try{return xt.call(e)}catch(t){}try{return e+""}catch(t){}}return""}function xr(e){return _e(e,!0,!0)}function Jt(e,t){return e===t||e!==e&&t!==t}function Fr(e){return Hr(e)&&F.call(e,"callee")&&(!Hn.call(e,"callee")||fe.call(e)==Re)}var Fe=Array.isArray;function jt(e){return e!=null&&Br(e.length)&&!kt(e)}function Hr(e){return Jr(e)&&jt(e)}var Wr=Bn||kr;function kt(e){var t=pe(e)?fe.call(e):"";return t==Ve||t==Tt}function Br(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=pt}function pe(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function Jr(e){return!!e&&typeof e=="object"}function He(e){return jt(e)?hr(e):yr(e)}function jr(){return[]}function kr(){return!1}K.exports=xr});var Xr={};sn(Xr,{crush:()=>Qr,defaults:()=>qt,version:()=>Yr});var un={strictlyTwoElementsInRangeArrays:!1,progressFn:null};function Se(e,t){if(!Array.isArray(e)||!e.length)return e;let r=S(S({},un),t),n,a;if(r.strictlyTwoElementsInRangeArrays&&!e.every((l,g)=>!Array.isArray(l)||l.length!==2?(n=g,a=l.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 ${a} elements!`);if(!e.every((l,g)=>!Array.isArray(l)||!Number.isInteger(l[0])||l[0]<0||!Number.isInteger(l[1])||l[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 o=e.length**2,u=0;return Array.from(e).sort((l,g)=>(r.progressFn&&(u+=1,r.progressFn(Math.floor(u*100/o))),l[0]===g[0]?l[1]<g[1]?-1:l[1]>g[1]?1:0:l[0]<g[0]?-1:1))}var Ge={mergeType:1,progressFn:null,joinRangesThatTouchEdges:!0};function qe(e,t){function r(s){return!!s&&typeof s=="object"&&!Array.isArray(s)}if(!Array.isArray(e)||!e.length)return null;let n;if(t)if(r(t)){if(n=S(S({},Ge),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:
11
+ ${JSON.stringify(t,null,4)} (type ${typeof t})`);else n=S({},Ge);let a=e.filter(s=>Array.isArray(s)).map(s=>[...s]).filter(s=>s[2]!==void 0||s[0]!==s[1]),o,u,l;n.progressFn?o=Se(a,{progressFn:s=>{l=Math.floor(s/5),l!==u&&(u=l,n.progressFn(l))}}):o=Se(a);let g=o.length-1;for(let s=g;s>0;s--)n.progressFn&&(l=Math.floor((1-s/g)*78)+21,l!==u&&l>u&&(u=l,n.progressFn(l))),(o[s][0]<=o[s-1][0]||!n.joinRangesThatTouchEdges&&o[s][0]<o[s-1][1]||n.joinRangesThatTouchEdges&&o[s][0]<=o[s-1][1])&&(o[s-1][0]=Math.min(o[s][0],o[s-1][0]),o[s-1][1]=Math.max(o[s][1],o[s-1][1]),o[s][2]!==void 0&&(o[s-1][0]>=o[s][0]||o[s-1][1]<=o[s][1])&&o[s-1][2]!==null&&(o[s][2]===null&&o[s-1][2]!==null?o[s-1][2]=null:o[s-1][2]!=null?+n.mergeType==2&&o[s-1][0]===o[s][0]?o[s-1][2]=o[s][2]:o[s-1][2]+=o[s][2]:o[s-1][2]=o[s][2]),o.splice(s,1),s=o.length);return o.length?o:null}var gn=!0,Oe="Invariant failed";function Ke(e,t){if(!e){if(gn)throw new Error(Oe);var r=typeof t=="function"?t():t,n=r?"".concat(Oe,": ").concat(r):Oe;throw new Error(n)}}function Ye(e,t,r){let n=0,a=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 o;Array.isArray(t)&&Number.isInteger(t[0])&&Number.isInteger(t[1])?o=[Array.from(t)]:o=Array.from(t);let u=o.length,l=0;o.filter(d=>d).forEach((d,p)=>{if(r&&(n=Math.floor(l/u*10),n!==a&&(a=n,r(n))),!Array.isArray(d))throw new TypeError(`ranges-apply: [THROW_ID_05] ranges array, second input arg., has ${p}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 ${p}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)}.`);o[p][0]=+o[p][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 ${p}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)}.`);o[p][1]=+o[p][1]}l+=1});let g=qe(o,{progressFn:d=>{r&&(n=10+Math.floor(d/10),n!==a&&(a=n,r(n)))}});Ke(g);let s=g.length;if(s>0){let d=e.slice(g[s-1][1]);e=g.reduce((p,T,m,f)=>{r&&(n=20+Math.floor(m/s*80),n!==a&&(a=n,r(n)));let w=m===0?0:f[m-1][1],L=f[m][0];return`${p}${e.slice(w,L)}${f[m][2]||""}`},""),e+=d}return e}function le(e,t=1){let r="\xA0";function n(o){return Array.from(o).reverse().join("")}function a(o,u,l){let g=l?`
12
12
  `:"\r",s=l?"\r":`
13
- `;if(!o)return o;let d=0,p=0,T="";for(let f=0,m=o.length;f<m;f++)(o[f]===c||o[f]===s&&o[f-1]!==c)&&p++,`\r
14
- `.includes(o[f])||o[f]===r?(d=0,o[f]===r?T+=o[f]:o[f]===c?p<=u&&(T+=o[f],o[f+1]===s&&(T+=o[f+1],f++)):o[f]===s&&(o==null?void 0:o[f-1])!==c&&p<=u&&(T+=o[f])):(d++,!o[f+1]&&!p&&(T+=" "));return T}if(typeof e=="string"&&e.length){let o=1;typeof+t=="number"&&Number.isInteger(+t)&&+t>=0&&(o=+t);let u="",l="";if(!e.trim())u=e;else if(!e[0].trim()){for(let c=0,s=e.length;c<s;c++)if(e[c].trim()){u=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()){l=e.slice(c+1);break}}return`${a(u,o,!1)}${e.trim()}${n(a(n(l),o,!0))}`}return e}var gn={strictlyTwoElementsInRangeArrays:!1,progressFn:null};function Qe(e,t){if(!Array.isArray(e)||!e.length)return e;let r=S(S({},gn),t),n,a;if(r.strictlyTwoElementsInRangeArrays&&!e.every((l,c)=>!Array.isArray(l)||l.length!==2?(n=c,a=l.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 ${a} elements!`);if(!e.every((l,c)=>!Array.isArray(l)||!Number.isInteger(l[0])||l[0]<0||!Number.isInteger(l[1])||l[1]<0?(n=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, ${n}th range (${JSON.stringify(e[n],null,4)}) does not consist of only natural numbers!`);let o=e.length**2,u=0;return Array.from(e).sort((l,c)=>(r.progressFn&&(u+=1,r.progressFn(Math.floor(u*100/o))),l[0]===c[0]?l[1]<c[1]?-1:l[1]>c[1]?1:0:l[0]<c[0]?-1:1))}var Xe={mergeType:1,progressFn:null,joinRangesThatTouchEdges:!0};function cn(e,t){function r(s){return!!s&&typeof s=="object"&&!Array.isArray(s)}if(!Array.isArray(e)||!e.length)return null;let n;if(t)if(r(t)){if(n=S(S({},Xe),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:
15
- ${JSON.stringify(t,null,4)} (type ${typeof t})`);else n=S({},Xe);let a=e.filter(s=>Array.isArray(s)).map(s=>[...s]).filter(s=>s[2]!==void 0||s[0]!==s[1]),o,u,l;n.progressFn?o=Qe(a,{progressFn:s=>{l=Math.floor(s/5),l!==u&&(u=l,n.progressFn(l))}}):o=Qe(a);let c=o.length-1;for(let s=c;s>0;s--)n.progressFn&&(l=Math.floor((1-s/c)*78)+21,l!==u&&l>u&&(u=l,n.progressFn(l))),(o[s][0]<=o[s-1][0]||!n.joinRangesThatTouchEdges&&o[s][0]<o[s-1][1]||n.joinRangesThatTouchEdges&&o[s][0]<=o[s-1][1])&&(o[s-1][0]=Math.min(o[s][0],o[s-1][0]),o[s-1][1]=Math.max(o[s][1],o[s-1][1]),o[s][2]!==void 0&&(o[s-1][0]>=o[s][0]||o[s-1][1]<=o[s][1])&&o[s-1][2]!==null&&(o[s][2]===null&&o[s-1][2]!==null?o[s-1][2]=null:o[s-1][2]!=null?+n.mergeType==2&&o[s-1][0]===o[s][0]?o[s-1][2]=o[s][2]:o[s-1][2]+=o[s][2]:o[s-1][2]=o[s][2]),o.splice(s,1),s=o.length);return o.length?o:null}function M(e){return e!=null}function P(e){return Number.isInteger(e)&&e>=0}function te(e){return typeof e=="string"}var fn={limitToBeAddedWhitespace:!1,limitLinebreaksCount:1,mergeType:1},ze=class{constructor(e){Ee(this,"ranges");Ee(this,"opts");let t=S(S({},fn),e);if(t.mergeType&&t.mergeType!==1&&t.mergeType!==2)if(te(t.mergeType)&&t.mergeType.trim()==="1")t.mergeType=1;else if(te(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 o;if(e==null&&t==null)return;if(M(e)&&!M(t)){if(Array.isArray(e)){if(e.length){if(e.some(u=>Array.isArray(u))){e.forEach(u=>{Array.isArray(u)&&this.add(...u)});return}e.length&&P(+e[0])&&P(+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(!M(e)&&M(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,a=+t;if(P(r)&&(r=String(r)),P(n)&&P(a)){if(M(r)&&!te(r)&&!P(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:
16
- ${JSON.stringify(r,null,4)}`);if(M(this.ranges)&&Array.isArray(this.last())&&n===this.last()[1]){if(this.last()[1]=a,this.last()[2],this.last()[2]!==null&&M(r)){let u=this.last()[2]&&this.last()[2].length&&(!((o=this.opts)!=null&&o.mergeType)||this.opts.mergeType===1)?`${this.last()[2]}${r}`:r;this.opts.limitToBeAddedWhitespace&&(u=se(u,this.opts.limitLinebreaksCount)),te(u)&&!u.length||(this.last()[2]=u)}}else{this.ranges||(this.ranges=[]);let u=r!==void 0&&!(te(r)&&!r.length)?[n,a,r&&this.opts.limitToBeAddedWhitespace?se(r,this.opts.limitLinebreaksCount):r]:[n,a];this.ranges.push(u)}}else throw P(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 a}" equal to: ${JSON.stringify(a,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=cn(this.ranges,{mergeType:this.opts.mergeType}),this.ranges&&this.opts.limitToBeAddedWhitespace?this.ranges.map(e=>M(e[2])?[e[0],e[1],se(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])&&P(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}};function Ze(e){return typeof e!="string"?e:e.length?[e]:[]}function et(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function le(e){return typeof e=="string"}var tt={cb:void 0,i:!1,trimBeforeMatching:!1,trimCharsBeforeMatching:[],maxMismatches:0,firstMustMatch:!1,lastMustMatch:!1,hungry:!1},mn=e=>e+1;function hn(e,t,r,n,a=!1,o=mn){let u=typeof r=="function"?r():r;if(+t<0&&a&&u==="EOL")return u;let l=S(S({},tt),n);if(t>=e.length&&!a)return!1;let c=a?1:r.length,s=0,d=!1,p=!1,T=!1,f=l.maxMismatches,m=t,w=!1,L=!1,b=!1;function h(){return s===1&&f<l.maxMismatches-1}for(;e[m];){let $=o(m);if(l.trimBeforeMatching&&e[m].trim()===""){if(!e[$]&&a&&r==="EOL")return!0;m=o(m);continue}if(l&&!l.i&&l.trimCharsBeforeMatching&&l.trimCharsBeforeMatching.includes(e[m])||l!=null&&l.i&&l.trimCharsBeforeMatching&&l.trimCharsBeforeMatching.map(D=>D.toLowerCase()).includes(e[m].toLowerCase())){if(a&&r==="EOL"&&!e[$])return!0;m=o(m);continue}let y=$>m?r[r.length-c]:r[c-1];if(!l.i&&e[m]===y||l.i&&e[m].toLowerCase()===y.toLowerCase()){if(w||(w=!0),T||(T=!0),c===r.length){if(L=!0,f!==l.maxMismatches)return!1}else c===1&&(b=!0);if(c-=1,s++,h())return!1;if(!c)return s!==r.length||f===l.maxMismatches||!d?m:!1}else if(!d&&!s&&(d=!0),l.maxMismatches&&f&&m){f-=1;for(let D=0;D<=f;D++){let I=$>m?r[r.length-c+1+D]:r[c-2-D],R=e[o(m)];if(I&&(!l.i&&e[m]===I||l.i&&e[m].toLowerCase()===I.toLowerCase())&&(!l.firstMustMatch||c!==r.length)){if(s++,h())return!1;c-=2,w=!0;break}else if(R&&I&&(!l.i&&R===I||l.i&&R.toLowerCase()===I.toLowerCase())&&(!l.firstMustMatch||c!==r.length)){if(!s&&!l.hungry)return!1;c-=1,w=!0;break}else if(I===void 0&&f>=0&&w&&(!l.firstMustMatch||L)&&(!l.lastMustMatch||b))return m}w||(p=m)}else return m===0&&c===1&&!l.lastMustMatch&&T?0:!1;if(p!==!1&&p!==m&&(p=!1),c<1)return m;m=o(m)}if(c>0)return a&&u==="EOL"?!0:l&&l.maxMismatches>=c&&T?p||0:!1}function we(e,t,r,n,a){var d,p;if(et(a)&&Object.prototype.hasOwnProperty.call(a,"trimBeforeMatching")&&a&&typeof a.trimBeforeMatching!="boolean")throw new Error(`string-match-left-right/${e}(): [THROW_ID_09] opts.trimBeforeMatching should be boolean!${Array.isArray(a.trimBeforeMatching)?" Did you mean to use opts.trimCharsBeforeMatching?":""}`);let o=S(S({},tt),a);if(typeof o.trimCharsBeforeMatching=="string"&&(o.trimCharsBeforeMatching=Ze(o.trimCharsBeforeMatching)),o.trimCharsBeforeMatching=o.trimCharsBeforeMatching.map(T=>le(T)?T:String(T)),!le(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:
17
- ${JSON.stringify(r,null,4)}`);let u,l;if(le(n))u=[n];else if(Array.isArray(n))u=n;else if(!n)u=n;else if(typeof n=="function")u=[],u.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:
18
- ${JSON.stringify(n,null,4)}`);if(a&&!et(a))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 a}", and equal to:
19
- ${JSON.stringify(a,null,4)}`);let c=0,s="";if(o!=null&&o.trimCharsBeforeMatching&&o.trimCharsBeforeMatching.some((T,f)=>T.length>1?(c=f,s=T,!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, ${s.length} (equals to ${s}). Please split it into separate characters and put into array as separate elements.`);if(!u||!Array.isArray(u)||Array.isArray(u)&&!u.length||Array.isArray(u)&&u.length===1&&le(u[0])&&!u[0].trim()){if(typeof o.cb=="function"){let f,m=r;if((e==="matchLeftIncl"||e==="matchRight")&&(m+=1),e[5]==="L")for(let h=m;h--;){let $=t[h];if((!o.trimBeforeMatching||o.trimBeforeMatching&&$!==void 0&&$.trim())&&(!((d=o.trimCharsBeforeMatching)!=null&&d.length)||$!==void 0&&!o.trimCharsBeforeMatching.includes($))){f=h;break}}else if(e.startsWith("matchRight"))for(let h=m;h<t.length;h++){let $=t[h];if((!o.trimBeforeMatching||o.trimBeforeMatching&&$.trim())&&(!((p=o.trimCharsBeforeMatching)!=null&&p.length)||!o.trimCharsBeforeMatching.includes($))){f=h;break}}if(f===void 0)return!1;let w=t[f],L=f+1,b="";return L&&L>0&&(b=t.slice(0,L)),e[5]==="L"||f&&f>0&&(b=t.slice(f)),o.cb(w,b,f)}let T="";throw a||(T=" 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!${T}`)}for(let T=0,f=u.length;T<f;T++){l=typeof u[T]=="function";let m=u[T],w,L,b="",h=r;e==="matchRight"?h+=1:e==="matchLeft"&&(h-=1);let $=hn(t,h,m,o,l,y=>e[5]==="L"?y-1:y+1);if($&&l&&typeof m=="function"&&m()==="EOL")return m()&&(!o.cb||o.cb(w,b,L))?m():!1;if(Number.isInteger($)&&(L=e.startsWith("matchLeft")?$-1:$+1,e[5]==="L"?b=t.slice(0,$):b=t.slice(L)),L<0&&(L=void 0),t[L]&&(w=t[L]),Number.isInteger($)&&(!o.cb||o.cb(w,b,L)))return m}return!1}function nt(e,t,r,n){return we("matchLeft",e,t,r,n)}function Le(e,t,r,n){return we("matchRightIncl",e,t,r,n)}function k(e,t,r,n){return we("matchRight",e,t,r,n)}var $n={str:"",from:0,to:0,ifLeftSideIncludesThisThenCropTightly:"",ifLeftSideIncludesThisCropItToo:"",ifRightSideIncludesThisThenCropTightly:"",ifRightSideIncludesThisCropItToo:"",extendToOneSide:!1,wipeAllWhitespaceOnLeft:!1,wipeAllWhitespaceOnRight:!1,addSingleSpaceToPreventAccidentalConcatenation:!1};function ae(e){var c;let t=/^[0-9a-zA-Z]+$/;function r(s){return!s||typeof s!="string"?!1:!s.trim()}function n(s){return typeof s=="string"}if(!e||typeof e!="object"||Array.isArray(e)){let s;throw e===void 0?s="but it is missing completely.":e===null?s="but it was given as null.":s=`but it was given as ${typeof e}, equal to:
20
- ${JSON.stringify(e,null,4)}.`,new Error(`string-range-expander: [THROW_ID_01] Input must be a plain object ${s}`)}else if(typeof e=="object"&&e!==null&&!Array.isArray(e)&&!Object.keys(e).length)throw new Error("string-range-expander: [THROW_ID_02] Input must be a plain object but it was given as a plain object without any keys.");if(typeof e.from!="number")throw new Error(`string-range-expander: [THROW_ID_03] The input's "from" value resolvedOpts.from, is not a number! Currently it's given as ${typeof e.from}, equal to ${JSON.stringify(e.from,null,0)}`);if(typeof e.to!="number")throw new Error(`string-range-expander: [THROW_ID_04] The input's "to" value resolvedOpts.to, is not a number! Currently it's given as ${typeof e.to}, equal to ${JSON.stringify(e.to,null,0)}`);if(e!=null&&e.str&&!e.str[e.from]&&e.from!==e.to)throw new Error(`string-range-expander: [THROW_ID_05] The given input string resolvedOpts.str ("${e.str}") must contain the character at index "from" ("${e.from}")`);if(e!=null&&e.str&&!e.str[e.to-1])throw new Error(`string-range-expander: [THROW_ID_06] The given input string, resolvedOpts.str ("${e.str}") must contain the character at index before "to" ("${e.to-1}")`);if(e.from>e.to)throw new Error(`string-range-expander: [THROW_ID_07] The given "from" index, "${e.from}" is greater than "to" index, "${e.to}". That's wrong!`);if(n(e.extendToOneSide)&&e.extendToOneSide!=="left"&&e.extendToOneSide!=="right"||!n(e.extendToOneSide)&&e.extendToOneSide!==void 0&&e.extendToOneSide!==!1)throw new Error(`string-range-expander: [THROW_ID_08] The resolvedOpts.extendToOneSide value is not recognisable! It's set to: "${e.extendToOneSide}" (${typeof e.extendToOneSide}). It has to be either Boolean "false" or strings "left" or "right"`);let a=S(S({},$n),e);if(Array.isArray(a.ifLeftSideIncludesThisThenCropTightly)){let s,d;if(a.ifLeftSideIncludesThisThenCropTightly.every((p,T)=>n(p)?!0:(s=T,d=p,!1)))a.ifLeftSideIncludesThisThenCropTightly=a.ifLeftSideIncludesThisThenCropTightly.join("");else throw new Error(`string-range-expander: [THROW_ID_09] The resolvedOpts.ifLeftSideIncludesThisThenCropTightly was set to an array:
21
- ${JSON.stringify(a.ifLeftSideIncludesThisThenCropTightly,null,4)}. Now, that array contains not only string elements. For example, an element at index ${s} is of a type ${typeof d} (equal to ${JSON.stringify(d,null,0)}).`)}let o=a.str,u=a.from,l=a.to;if(a.extendToOneSide!=="right"&&(r(o[u-1])&&(r(o[u-2])||a.ifLeftSideIncludesThisCropItToo.includes(o[u-2]))||o[u-1]&&a.ifLeftSideIncludesThisCropItToo.includes(o[u-1])||a.wipeAllWhitespaceOnLeft&&r(o[u-1]))){for(let s=u;s--;)if(!a.ifLeftSideIncludesThisCropItToo.includes(o[s])){if(o[s].trim()){a.wipeAllWhitespaceOnLeft||a.ifLeftSideIncludesThisCropItToo.includes(o[s+1])?u=s+1:u=s+2;break}else if(s===0){a.wipeAllWhitespaceOnLeft?u=0:u=1;break}}}if(a.extendToOneSide!=="left"&&(r(o[l])&&(a.wipeAllWhitespaceOnRight||r(o[l+1]))||a.ifRightSideIncludesThisCropItToo.includes(o[l]))){for(let s=l,d=o.length;s<d;s++)if(!a.ifRightSideIncludesThisCropItToo.includes(o[s])&&((c=o[s])!=null&&c.trim())){a.wipeAllWhitespaceOnRight||a.ifRightSideIncludesThisCropItToo.includes(o[s-1])?l=s:l=s-1;break}}return(a.extendToOneSide!=="right"&&n(a.ifLeftSideIncludesThisThenCropTightly)&&a.ifLeftSideIncludesThisThenCropTightly&&(o[u-2]&&a.ifLeftSideIncludesThisThenCropTightly.includes(o[u-2])||o[u-1]&&a.ifLeftSideIncludesThisThenCropTightly.includes(o[u-1]))||a.extendToOneSide!=="left"&&n(a.ifRightSideIncludesThisThenCropTightly)&&a.ifRightSideIncludesThisThenCropTightly&&(o[l+1]&&a.ifRightSideIncludesThisThenCropTightly.includes(o[l+1])||o[l]&&a.ifRightSideIncludesThisThenCropTightly.includes(o[l])))&&(a.extendToOneSide!=="right"&&r(o[u-1])&&!a.wipeAllWhitespaceOnLeft&&(u-=1),a.extendToOneSide!=="left"&&r(o[l])&&!a.wipeAllWhitespaceOnRight&&(l+=1)),a.addSingleSpaceToPreventAccidentalConcatenation&&o[u-1]&&o[u-1].trim()&&o[l]&&o[l].trim()&&(!a.ifLeftSideIncludesThisThenCropTightly&&!a.ifRightSideIncludesThisThenCropTightly||!((!a.ifLeftSideIncludesThisThenCropTightly||a.ifLeftSideIncludesThisThenCropTightly.includes(o[u-1]))&&(!a.ifRightSideIncludesThisThenCropTightly||o[l]&&a.ifRightSideIncludesThisThenCropTightly.includes(o[l]))))&&(t.test(o[u-1])||t.test(o[l]))?[u,l," "]:[u,l]}var kr=sn(jt(),1);var K="\xA0";function jr({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&&`
22
- \r`.includes(e[t+1])||n&&e[t+1]===K))return t+1;if(e[t+2]&&(e[t+2].trim()||r&&`
23
- \r`.includes(e[t+2])||n&&e[t+2]===K))return t+2;for(let a=t+1,o=e.length;a<o;a++)if(e[a].trim()||r&&`
24
- \r`.includes(e[a])||n&&e[a]===K)return a;return null}function A(e,t=0){return jr({str:e,idx:t,stopAtNewlines:!1,stopAtRawNbsp:!1})}function Ur({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&&`
25
- \r`.includes(e[~-t])||n&&e[~-t]===K))return~-t;if(e[t-2]&&(e[t-2].trim()||r&&`
26
- \r`.includes(e[t-2])||n&&e[t-2]===K))return t-2;for(let a=t;a--;)if(e[a]&&(e[a].trim()||r&&`
27
- \r`.includes(e[a])||n&&e[a]===K))return a;return null}function de(e,t=0){return Ur({str:e,idx:t,stopAtNewlines:!1,stopAtRawNbsp:!1})}var Ut="6.0.7";var qr=Ut,E=new ze({limitToBeAddedWhitespace:!0}),Gt={lineLengthLimit:500,removeIndentations:!0,removeLineBreaks:!1,removeHTMLComments:!1,removeCSSComments:!0,reportProgressFunc:null,reportProgressFuncFrom:0,reportProgressFuncTo:100,breakToTheLeftOf:["</td","<html","</html","<head","</head","<meta","<link","<table","<script","<\/script","<!DOCTYPE","<style","</style","<title","<body","@media","</body","<!--[if","<!--<![endif","<![endif]"],mindTheInlineTags:["a","abbr","acronym","audio","b","bdi","bdo","big","br","button","canvas","cite","code","data","datalist","del","dfn","em","embed","i","iframe","img","input","ins","kbd","label","map","mark","meter","noscript","object","output","picture","progress","q","ruby","s","samp","script","select","slot","small","span","strong","sub","sup","svg","template","textarea","time","u","tt","var","video","wbr"]};function Y(e){return typeof e=="string"}function Q(e){return typeof e=="string"&&e.toUpperCase()!==e.toLowerCase()}function Kr(e,t){let r=Date.now();if(!Y(e))throw e===void 0?new Error("html-crush: [THROW_ID_01] the first input argument is completely missing! It should be given as string."):new Error(`html-crush: [THROW_ID_02] the first input argument must be string! It was given as "${typeof e}", equal to:
28
- ${JSON.stringify(e,null,4)}`);if(t&&typeof t!="object")throw new Error(`html-crush: [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)}`);if(t&&Array.isArray(t.breakToTheLeftOf)&&t.breakToTheLeftOf.length){for(let i=0,Z=t.breakToTheLeftOf.length;i<Z;i++)if(!Y(t.breakToTheLeftOf[i]))throw new TypeError(`html-crush: [THROW_ID_05] the resolvedOpts.breakToTheLeftOf array contains non-string elements! For example, element at index ${i} is of a type "${typeof t.breakToTheLeftOf[i]}" and is equal to:
29
- ${JSON.stringify(t.breakToTheLeftOf[i],null,4)}`)}let n=S(S({},Gt),t);typeof n.removeHTMLComments=="boolean"&&(n.removeHTMLComments=n.removeHTMLComments?1:0);let a="";Array.isArray(n.breakToTheLeftOf)&&n.breakToTheLeftOf.length&&(a=[...new Set(n.breakToTheLeftOf.map(i=>i[0]))].join(""));let o={removeHTMLComments:!1,removeCSSComments:!1},u=null,l=null,c=!1,s=0,d=0,p=!1,T=!1,f=null,m=null,w=null,L=null,b,h=null,$=null,y=null,D=null,I=null,R=null,X=">};",z="<",qt="!",Kt=">",Yt="<",We="{},:;<>~+",be=We,Te=We,J=!0,v=e.length,Qt=Math.floor(v/2),Je=.01,Be;n.reportProgressFunc&&(Be=Math.floor(n.reportProgressFuncTo-(n.reportProgressFuncTo-n.reportProgressFuncFrom)*Je-n.reportProgressFuncFrom));let V,oe=0,C=`
13
+ `;if(!o)return o;let d=0,p=0,T="";for(let m=0,f=o.length;m<f;m++)(o[m]===g||o[m]===s&&o[m-1]!==g)&&p++,`\r
14
+ `.includes(o[m])||o[m]===r?(d=0,o[m]===r?T+=o[m]:o[m]===g?p<=u&&(T+=o[m],o[m+1]===s&&(T+=o[m+1],m++)):o[m]===s&&(o==null?void 0:o[m-1])!==g&&p<=u&&(T+=o[m])):(d++,!o[m+1]&&!p&&(T+=" "));return T}if(typeof e=="string"&&e.length){let o=1;typeof+t=="number"&&Number.isInteger(+t)&&+t>=0&&(o=+t);let u="",l="";if(!e.trim())u=e;else if(!e[0].trim()){for(let g=0,s=e.length;g<s;g++)if(e[g].trim()){u=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()){l=e.slice(g+1);break}}return`${a(u,o,!1)}${e.trim()}${n(a(n(l),o,!0))}`}return e}function H(e){return D(e)&&e.length===1&&e.toUpperCase()!==e.toLowerCase()}function W(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 D(e){return typeof e=="string"}function _(e){return Number.isSafeInteger(e)&&e>=0}function R(e){return e!=null}function Qe(e,t){return W(e)&&D(t)&&Object.prototype.hasOwnProperty.call(e,t)}var cn={strictlyTwoElementsInRangeArrays:!1,progressFn:null};function Xe(e,t){if(!Array.isArray(e)||!e.length)return e;let r=S(S({},cn),t),n,a;if(r.strictlyTwoElementsInRangeArrays&&!e.every((l,g)=>!Array.isArray(l)||l.length!==2?(n=g,a=l.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 ${a} elements!`);if(!e.every((l,g)=>!Array.isArray(l)||!Number.isInteger(l[0])||l[0]<0||!Number.isInteger(l[1])||l[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 o=e.length**2,u=0;return Array.from(e).sort((l,g)=>(r.progressFn&&(u+=1,r.progressFn(Math.floor(u*100/o))),l[0]===g[0]?l[1]<g[1]?-1:l[1]>g[1]?1:0:l[0]<g[0]?-1:1))}var ze={mergeType:1,progressFn:null,joinRangesThatTouchEdges:!0};function mn(e,t){function r(s){return!!s&&typeof s=="object"&&!Array.isArray(s)}if(!Array.isArray(e)||!e.length)return null;let n;if(t)if(r(t)){if(n=S(S({},ze),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:
15
+ ${JSON.stringify(t,null,4)} (type ${typeof t})`);else n=S({},ze);let a=e.filter(s=>Array.isArray(s)).map(s=>[...s]).filter(s=>s[2]!==void 0||s[0]!==s[1]),o,u,l;n.progressFn?o=Xe(a,{progressFn:s=>{l=Math.floor(s/5),l!==u&&(u=l,n.progressFn(l))}}):o=Xe(a);let g=o.length-1;for(let s=g;s>0;s--)n.progressFn&&(l=Math.floor((1-s/g)*78)+21,l!==u&&l>u&&(u=l,n.progressFn(l))),(o[s][0]<=o[s-1][0]||!n.joinRangesThatTouchEdges&&o[s][0]<o[s-1][1]||n.joinRangesThatTouchEdges&&o[s][0]<=o[s-1][1])&&(o[s-1][0]=Math.min(o[s][0],o[s-1][0]),o[s-1][1]=Math.max(o[s][1],o[s-1][1]),o[s][2]!==void 0&&(o[s-1][0]>=o[s][0]||o[s-1][1]<=o[s][1])&&o[s-1][2]!==null&&(o[s][2]===null&&o[s-1][2]!==null?o[s-1][2]=null:o[s-1][2]!=null?+n.mergeType==2&&o[s-1][0]===o[s][0]?o[s-1][2]=o[s][2]:o[s-1][2]+=o[s][2]:o[s-1][2]=o[s][2]),o.splice(s,1),s=o.length);return o.length?o:null}var fn={limitToBeAddedWhitespace:!1,limitLinebreaksCount:1,mergeType:1},Ze=class{constructor(e){Ee(this,"ranges");Ee(this,"opts");let t=S(S({},fn),e);if(t.mergeType&&t.mergeType!==1&&t.mergeType!==2)if(D(t.mergeType)&&t.mergeType.trim()==="1")t.mergeType=1;else if(D(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 o;if(e==null&&t==null)return;if(R(e)&&!R(t)){if(Array.isArray(e)){if(e.length){if(e.some(u=>Array.isArray(u))){e.forEach(u=>{Array.isArray(u)&&this.add(...u)});return}e.length&&_(+e[0])&&_(+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 n=+e,a=+t;if(_(r)&&(r=String(r)),_(n)&&_(a)){if(R(r)&&!D(r)&&!_(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:
16
+ ${JSON.stringify(r,null,4)}`);if(R(this.ranges)&&Array.isArray(this.last())&&n===this.last()[1]){if(this.last()[1]=a,this.last()[2],this.last()[2]!==null&&R(r)){let u=this.last()[2]&&this.last()[2].length&&(!((o=this.opts)!=null&&o.mergeType)||this.opts.mergeType===1)?`${this.last()[2]}${r}`:r;this.opts.limitToBeAddedWhitespace&&(u=le(u,this.opts.limitLinebreaksCount)),D(u)&&!u.length||(this.last()[2]=u)}}else{this.ranges||(this.ranges=[]);let u=r!==void 0&&!(D(r)&&!r.length)?[n,a,r&&this.opts.limitToBeAddedWhitespace?le(r,this.opts.limitLinebreaksCount):r]:[n,a];this.ranges.push(u)}}else throw _(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 a}" equal to: ${JSON.stringify(a,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=mn(this.ranges,{mergeType:this.opts.mergeType}),this.ranges&&this.opts.limitToBeAddedWhitespace?this.ranges.map(e=>R(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])&&_(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}};function et(e){return typeof e!="string"?e:e.length?[e]:[]}var tt={cb:void 0,i:!1,trimBeforeMatching:!1,trimCharsBeforeMatching:[],maxMismatches:0,firstMustMatch:!1,lastMustMatch:!1,hungry:!1},hn=e=>e+1;function $n(e,t,r,n,a=!1,o=hn){let u=typeof r=="function"?r():r;if(+t<0&&a&&u==="EOL")return u;let l=S(S({},tt),n);if(t>=e.length&&!a)return!1;let g=a?1:r.length,s=0,d=!1,p=!1,T=!1,m=l.maxMismatches,f=t,w=!1,L=!1,b=!1;function h(){return s===1&&m<l.maxMismatches-1}for(;e[f];){let $=o(f);if(l.trimBeforeMatching&&e[f].trim()===""){if(!e[$]&&a&&r==="EOL")return!0;f=o(f);continue}if(l&&!l.i&&l.trimCharsBeforeMatching&&l.trimCharsBeforeMatching.includes(e[f])||l!=null&&l.i&&l.trimCharsBeforeMatching&&l.trimCharsBeforeMatching.map(C=>C.toLowerCase()).includes(e[f].toLowerCase())){if(a&&r==="EOL"&&!e[$])return!0;f=o(f);continue}let y=$>f?r[r.length-g]:r[g-1];if(!l.i&&e[f]===y||l.i&&e[f].toLowerCase()===y.toLowerCase()){if(w||(w=!0),T||(T=!0),g===r.length){if(L=!0,m!==l.maxMismatches)return!1}else g===1&&(b=!0);if(g-=1,s++,h())return!1;if(!g)return s!==r.length||m===l.maxMismatches||!d?f:!1}else if(!d&&!s&&(d=!0),l.maxMismatches&&m&&f){m-=1;for(let C=0;C<=m;C++){let v=$>f?r[r.length-g+1+C]:r[g-2-C],P=e[o(f)];if(v&&(!l.i&&e[f]===v||l.i&&e[f].toLowerCase()===v.toLowerCase())&&(!l.firstMustMatch||g!==r.length)){if(s++,h())return!1;g-=2,w=!0;break}else if(P&&v&&(!l.i&&P===v||l.i&&P.toLowerCase()===v.toLowerCase())&&(!l.firstMustMatch||g!==r.length)){if(!s&&!l.hungry)return!1;g-=1,w=!0;break}else if(v===void 0&&m>=0&&w&&(!l.firstMustMatch||L)&&(!l.lastMustMatch||b))return f}w||(p=f)}else return f===0&&g===1&&!l.lastMustMatch&&T?0:!1;if(p!==!1&&p!==f&&(p=!1),g<1)return f;f=o(f)}if(g>0)return a&&u==="EOL"?!0:l&&l.maxMismatches>=g&&T?p||0:!1}function we(e,t,r,n,a){var d,p;if(W(a)&&Qe(a,"trimBeforeMatching")&&a&&typeof a.trimBeforeMatching!="boolean")throw new Error(`string-match-left-right/${e}(): [THROW_ID_09] opts.trimBeforeMatching should be boolean!${Array.isArray(a.trimBeforeMatching)?" Did you mean to use opts.trimCharsBeforeMatching?":""}`);let o=S(S({},tt),a);if(typeof o.trimCharsBeforeMatching=="string"&&(o.trimCharsBeforeMatching=et(o.trimCharsBeforeMatching)),o.trimCharsBeforeMatching=o.trimCharsBeforeMatching.map(T=>D(T)?T:String(T)),!D(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:
17
+ ${JSON.stringify(r,null,4)}`);let u,l;if(D(n))u=[n];else if(Array.isArray(n))u=n;else if(!n)u=n;else if(typeof n=="function")u=[],u.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:
18
+ ${JSON.stringify(n,null,4)}`);if(a&&!W(a))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 a}", and equal to:
19
+ ${JSON.stringify(a,null,4)}`);let g=0,s="";if(o!=null&&o.trimCharsBeforeMatching&&o.trimCharsBeforeMatching.some((T,m)=>T.length>1?(g=m,s=T,!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, ${s.length} (equals to ${s}). Please split it into separate characters and put into array as separate elements.`);if(!u||!Array.isArray(u)||Array.isArray(u)&&!u.length||Array.isArray(u)&&u.length===1&&D(u[0])&&!u[0].trim()){if(typeof o.cb=="function"){let m,f=r;if((e==="matchLeftIncl"||e==="matchRight")&&(f+=1),e[5]==="L")for(let h=f;h--;){let $=t[h];if((!o.trimBeforeMatching||o.trimBeforeMatching&&$!==void 0&&$.trim())&&(!((d=o.trimCharsBeforeMatching)!=null&&d.length)||$!==void 0&&!o.trimCharsBeforeMatching.includes($))){m=h;break}}else if(e.startsWith("matchRight"))for(let h=f;h<t.length;h++){let $=t[h];if((!o.trimBeforeMatching||o.trimBeforeMatching&&$.trim())&&(!((p=o.trimCharsBeforeMatching)!=null&&p.length)||!o.trimCharsBeforeMatching.includes($))){m=h;break}}if(m===void 0)return!1;let w=t[m],L=m+1,b="";return L&&L>0&&(b=t.slice(0,L)),e[5]==="L"||m&&m>0&&(b=t.slice(m)),o.cb(w,b,m)}let T="";throw a||(T=" 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!${T}`)}for(let T=0,m=u.length;T<m;T++){l=typeof u[T]=="function";let f=u[T],w,L,b="",h=r;e==="matchRight"?h+=1:e==="matchLeft"&&(h-=1);let $=$n(t,h,f,o,l,y=>e[5]==="L"?y-1:y+1);if($&&l&&typeof f=="function"&&f()==="EOL")return f()&&(!o.cb||o.cb(w,b,L))?f():!1;if(Number.isInteger($)&&(L=e.startsWith("matchLeft")?$-1:$+1,e[5]==="L"?b=t.slice(0,$):b=t.slice(L)),L<0&&(L=void 0),t[L]&&(w=t[L]),Number.isInteger($)&&(!o.cb||o.cb(w,b,L)))return f}return!1}function nt(e,t,r,n){return we("matchLeft",e,t,r,n)}function Le(e,t,r,n){return we("matchRightIncl",e,t,r,n)}function G(e,t,r,n){return we("matchRight",e,t,r,n)}function pn(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 q(e){return typeof e=="string"}function rt(e){return Number.isSafeInteger(e)&&e>=0}var dn={str:"",from:0,to:0,ifLeftSideIncludesThisThenCropTightly:"",ifLeftSideIncludesThisCropItToo:"",ifRightSideIncludesThisThenCropTightly:"",ifRightSideIncludesThisCropItToo:"",extendToOneSide:!1,wipeAllWhitespaceOnLeft:!1,wipeAllWhitespaceOnRight:!1,addSingleSpaceToPreventAccidentalConcatenation:!1};function ae(e){var l;let t=/^[0-9a-zA-Z]+$/;function r(g){return q(g)&&!g.trim()}if(pn(e)){if(!Object.keys(e).length)throw new Error("string-range-expander: [THROW_ID_02] Input must be a plain object but it was given as a plain object without any keys.")}else{let g;throw e===void 0?g="but it is missing completely.":e===null?g="but it was given as null.":g=`but it was given as ${typeof e}, equal to:
20
+ ${JSON.stringify(e,null,4)}.`,new Error(`string-range-expander: [THROW_ID_01] Input must be a plain object ${g}`)}if(!rt(e.from))throw new Error(`string-range-expander: [THROW_ID_03] The input's "from" value resolvedOpts.from, is not a number! Currently it's given as ${typeof e.from}, equal to ${JSON.stringify(e.from,null,0)}`);if(!rt(e.to))throw new Error(`string-range-expander: [THROW_ID_04] The input's "to" value resolvedOpts.to, is not a number! Currently it's given as ${typeof e.to}, equal to ${JSON.stringify(e.to,null,0)}`);if(e!=null&&e.str&&!e.str[e.from]&&e.from!==e.to)throw new Error(`string-range-expander: [THROW_ID_05] The given input string resolvedOpts.str ("${e.str}") must contain the character at index "from" ("${e.from}")`);if(e!=null&&e.str&&!e.str[e.to-1])throw new Error(`string-range-expander: [THROW_ID_06] The given input string, resolvedOpts.str ("${e.str}") must contain the character at index before "to" ("${e.to-1}")`);if(e.from>e.to)throw new Error(`string-range-expander: [THROW_ID_07] The given "from" index, "${e.from}" is greater than "to" index, "${e.to}". That's wrong!`);if(e.extendToOneSide===null||q(e.extendToOneSide)&&e.extendToOneSide!=="left"&&e.extendToOneSide!=="right"||!q(e.extendToOneSide)&&e.extendToOneSide!==void 0&&e.extendToOneSide)throw new Error(`string-range-expander: [THROW_ID_08] The resolvedOpts.extendToOneSide value is not recognisable! It's set to: "${e.extendToOneSide}" (${typeof e.extendToOneSide}). It has to be either Boolean "false" or strings "left" or "right"`);let n=S(S({},dn),e);if(Array.isArray(n.ifLeftSideIncludesThisThenCropTightly)){let g,s;if(n.ifLeftSideIncludesThisThenCropTightly.every((d,p)=>q(d)?!0:(g=p,s=d,!1)))n.ifLeftSideIncludesThisThenCropTightly=n.ifLeftSideIncludesThisThenCropTightly.join("");else throw new Error(`string-range-expander: [THROW_ID_09] The resolvedOpts.ifLeftSideIncludesThisThenCropTightly was set to an array:
21
+ ${JSON.stringify(n.ifLeftSideIncludesThisThenCropTightly,null,4)}. Now, that array contains not only string elements. For example, an element at index ${g} is of a type ${typeof s} (equal to ${JSON.stringify(s,null,0)}).`)}let a=n.str,o=n.from,u=n.to;if(n.extendToOneSide!=="right"&&(r(a[o-1])&&(r(a[o-2])||n.ifLeftSideIncludesThisCropItToo.includes(a[o-2]))||a[o-1]&&n.ifLeftSideIncludesThisCropItToo.includes(a[o-1])||n.wipeAllWhitespaceOnLeft&&r(a[o-1]))){for(let g=o;g--;)if(!n.ifLeftSideIncludesThisCropItToo.includes(a[g])){if(a[g].trim()){n.wipeAllWhitespaceOnLeft||n.ifLeftSideIncludesThisCropItToo.includes(a[g+1])?o=g+1:o=g+2;break}else if(g===0){n.wipeAllWhitespaceOnLeft?o=0:o=1;break}}}if(n.extendToOneSide!=="left"&&(r(a[u])&&(n.wipeAllWhitespaceOnRight||r(a[u+1]))||n.ifRightSideIncludesThisCropItToo.includes(a[u]))){for(let g=u,s=a.length;g<s;g++)if(!n.ifRightSideIncludesThisCropItToo.includes(a[g])&&((l=a[g])!=null&&l.trim())){n.wipeAllWhitespaceOnRight||n.ifRightSideIncludesThisCropItToo.includes(a[g-1])?u=g:u=g-1;break}}return(n.extendToOneSide!=="right"&&q(n.ifLeftSideIncludesThisThenCropTightly)&&n.ifLeftSideIncludesThisThenCropTightly&&(a[o-2]&&n.ifLeftSideIncludesThisThenCropTightly.includes(a[o-2])||a[o-1]&&n.ifLeftSideIncludesThisThenCropTightly.includes(a[o-1]))||n.extendToOneSide!=="left"&&q(n.ifRightSideIncludesThisThenCropTightly)&&n.ifRightSideIncludesThisThenCropTightly&&(a[u+1]&&n.ifRightSideIncludesThisThenCropTightly.includes(a[u+1])||a[u]&&n.ifRightSideIncludesThisThenCropTightly.includes(a[u])))&&(n.extendToOneSide!=="right"&&r(a[o-1])&&!n.wipeAllWhitespaceOnLeft&&(o-=1),n.extendToOneSide!=="left"&&r(a[u])&&!n.wipeAllWhitespaceOnRight&&(u+=1)),n.addSingleSpaceToPreventAccidentalConcatenation&&a[o-1]&&a[o-1].trim()&&a[u]&&a[u].trim()&&(!n.ifLeftSideIncludesThisThenCropTightly&&!n.ifRightSideIncludesThisThenCropTightly||!((!n.ifLeftSideIncludesThisThenCropTightly||n.ifLeftSideIncludesThisThenCropTightly.includes(a[o-1]))&&(!n.ifRightSideIncludesThisThenCropTightly||a[u]&&n.ifRightSideIncludesThisThenCropTightly.includes(a[u]))))&&(t.test(a[o-1])||t.test(a[u]))?[o,u," "]:[o,u]}var Ur=ln(Ut(),1);var z="\xA0";function Gr({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&&`
22
+ \r`.includes(e[t+1])||n&&e[t+1]===z))return t+1;if(e[t+2]&&(e[t+2].trim()||r&&`
23
+ \r`.includes(e[t+2])||n&&e[t+2]===z))return t+2;for(let a=t+1,o=e.length;a<o;a++)if(e[a].trim()||r&&`
24
+ \r`.includes(e[a])||n&&e[a]===z)return a;return null}function A(e,t=0){return Gr({str:e,idx:t,stopAtNewlines:!1,stopAtRawNbsp:!1})}function qr({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&&`
25
+ \r`.includes(e[~-t])||n&&e[~-t]===z))return~-t;if(e[t-2]&&(e[t-2].trim()||r&&`
26
+ \r`.includes(e[t-2])||n&&e[t-2]===z))return t-2;for(let a=t;a--;)if(e[a]&&(e[a].trim()||r&&`
27
+ \r`.includes(e[a])||n&&e[a]===z))return a;return null}function de(e,t=0){return qr({str:e,idx:t,stopAtNewlines:!1,stopAtRawNbsp:!1})}var Gt="6.0.9";var Yr=Gt,E=new Ze({limitToBeAddedWhitespace:!0}),qt={lineLengthLimit:500,removeIndentations:!0,removeLineBreaks:!1,removeHTMLComments:!1,removeCSSComments:!0,reportProgressFunc:null,reportProgressFuncFrom:0,reportProgressFuncTo:100,breakToTheLeftOf:["</td","<html","</html","<head","</head","<meta","<link","<table","<script","<\/script","<!DOCTYPE","<style","</style","<title","<body","@media","</body","<!--[if","<!--<![endif","<![endif]"],mindTheInlineTags:["a","abbr","acronym","audio","b","bdi","bdo","big","br","button","canvas","cite","code","data","datalist","del","dfn","em","embed","i","iframe","img","input","ins","kbd","label","map","mark","meter","noscript","object","output","picture","progress","q","ruby","s","samp","script","select","slot","small","span","strong","sub","sup","svg","template","textarea","time","u","tt","var","video","wbr"]};function Qr(e,t){let r=Date.now();if(!D(e))throw e===void 0?new Error("html-crush: [THROW_ID_01] the first input argument is completely missing! It should be given as string."):new Error(`html-crush: [THROW_ID_02] the first input argument must be string! It was given as "${typeof e}", equal to:
28
+ ${JSON.stringify(e,null,4)}`);if(t&&!W(t))throw new Error(`html-crush: [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)}`);if(t&&Array.isArray(t.breakToTheLeftOf)&&t.breakToTheLeftOf.length){for(let i=0,te=t.breakToTheLeftOf.length;i<te;i++)if(!D(t.breakToTheLeftOf[i]))throw new TypeError(`html-crush: [THROW_ID_05] the resolvedOpts.breakToTheLeftOf array contains non-string elements! For example, element at index ${i} is of a type "${typeof t.breakToTheLeftOf[i]}" and is equal to:
29
+ ${JSON.stringify(t.breakToTheLeftOf[i],null,4)}`)}let n=S(S({},qt),t);typeof n.removeHTMLComments=="boolean"&&(n.removeHTMLComments=n.removeHTMLComments?1:0);let a="";Array.isArray(n.breakToTheLeftOf)&&n.breakToTheLeftOf.length&&(a=[...new Set(n.breakToTheLeftOf.map(i=>i[0]))].join(""));let o={removeHTMLComments:!1,removeCSSComments:!1},u=null,l=null,g=!1,s=0,d=0,p=!1,T=!1,m=null,f=null,w=null,L=null,b,h=null,$=null,y=null,C=null,v=null,P=null,Z=">};",ee="<",Kt="!",Yt=">",Qt="<",We="{},:;<>~+",be=We,Te=We,k=!0,N=e.length,Xt=Math.floor(N/2),Be=.01,Je;n.reportProgressFunc&&(Je=Math.floor(n.reportProgressFuncTo-(n.reportProgressFuncTo-n.reportProgressFuncFrom)*Be-n.reportProgressFuncFrom));let x,se=0,I=`
30
30
  `;if(e.includes(`\r
31
- `)?C=`\r
32
- `:e.includes("\r")&&(C="\r"),v){for(let i=0;i<v;i++){if(n.reportProgressFunc&&(v>1e3&&v<2e3?i===Qt&&n.reportProgressFunc(Math.floor((n.reportProgressFuncTo-n.reportProgressFuncFrom)/2)):v>=2e3&&(V=n.reportProgressFuncFrom+Math.floor(i/v*(Be||1)),V!==oe&&(oe=V,n.reportProgressFunc(V)))),d++,!b&&p&&e[i]==="}"&&e[i-1]==="}"&&(s+1>=n.lineLengthLimit?(E.push(i,i,C),s=0):(h=i,$=i,y=" ")),b&&typeof b=="number"&&i>=b&&(b=void 0),L!==null&&e.startsWith("<\/script",i)&&!Q(e[i+8])){if((n.removeIndentations||n.removeLineBreaks)&&i>0&&e[~-i]&&!e[~-i].trim()){for(let g=i;g--;)if(e[g]===`
33
- `||e[g]==="\r"||e[g].trim()){g+1<i&&E.push(g+1,i);break}}L=null,b=!1,i+=8;continue}if(!b&&!p&&e.startsWith("<script",i)&&!Q(e[i+7])){L=i,b=!0;let g="";(n.removeLineBreaks||n.removeIndentations)&&l!==null&&(l>0&&(g=C),E.push(l,i,g)),l=null,u=null}if(I!==null&&D===null&&!/\w/.test(e[i])){D=e.slice(I,i);let g=A(e,~-i);typeof g=="number"&&e[g]===">"&&!e[i].trim()&&A(e,i)?E.push(i,A(e,i)):g&&e[g]==="/"&&e[A(e,g)]===">"&&(!e[i].trim()&&A(e,i)&&E.push(i,A(e,i)),e[g+1]!==">"&&A(e,g+1)&&E.push(g+1,A(e,g+1)))}if(!b&&!p&&!f&&e[~-i]==="<"&&I===null&&(/\w/.test(e[i])?I=i:e[A(e,~-i)]==="/"&&/\w/.test(e[A(e,A(e,~-i))]||"")&&(I=A(e,A(e,~-i)))),!b&&(p||f)&&m!==null&&e[i]==="*"&&e[i+1]==="/"&&([h,$]=ae({str:e,from:m,to:i+2,ifLeftSideIncludesThisThenCropTightly:be||"",ifRightSideIncludesThisThenCropTightly:Te||""}),m=null,h!=null?E.push(h,$):(s+=1,i+=1),b=i+2),!b&&(p||f)&&m===null&&e[i]==="/"&&e[i+1]==="*"&&(o.removeCSSComments||(o.removeCSSComments=!0),n.removeCSSComments&&(m=i)),T&&e.startsWith("![endif",i+1)&&(T=!1),!b&&!p&&!f&&w!==null){let g;e.startsWith("-->",i)?g=3:e[i]===">"&&e[i-1]==="]"&&(g=1),g&&([h,$]=ae({str:e,from:w,to:i+g}),w=null,h!=null?n.lineLengthLimit&&d-($-h)>=n.lineLengthLimit?(E.push(h,$,C),d=-g):(E.push(h,$),d-=$-h):(s+=g-1,i+=g-1),b=i+g)}if(!b&&!p&&!f&&(e.startsWith("<!--",i)||n.removeHTMLComments===2&&e.startsWith("<![endif",i))&&w===null&&(e.startsWith("[if",i+4)?(T||(T=!0),n.removeHTMLComments===2&&(w=i)):n.removeHTMLComments&&(!T||n.removeHTMLComments===2)&&(w=i),o.removeHTMLComments||(o.removeHTMLComments=!0)),!b&&p&&m===null&&e.startsWith("</style",i)&&!Q(e[i+7])?p=!1:!b&&!p&&m===null&&e.startsWith("<style",i)&&!Q(e[i+6])&&(p=!0,(n.removeLineBreaks||n.removeIndentations)&&n.breakToTheLeftOf.includes("<style")&&e.startsWith(' type="text/css">',i+6)&&e[i+24]&&E.push(i+23,i+23,C)),!b&&!f&&`"'`.includes(e[i])&&e.endsWith("style=",i)&&(f=i),!b&&!e[i].trim())l===null&&(l=i);else if(!b&&!((p||f)&&m!==null)){if(l!==null){if(n.removeLineBreaks&&(s+=1),J)J=!1,(n.removeIndentations||n.removeLineBreaks)&&E.push(0,i);else if(n.removeIndentations&&!n.removeLineBreaks&&(!c&&u!==null&&i>u?E.push(u+1,i):l+1<i&&(e.endsWith("]>",l)||e.endsWith("-->",l)||e.startsWith("<![",i)||e.startsWith("<!--<![",i)?E.push(l,i):e[l]===" "?E.push(l+1,i):e[~-i]===" "?E.push(l,~-i):E.push(l,i," "))),n.removeLineBreaks||f){if(a.includes(e[i])&&Le(e,i,n.breakToTheLeftOf)){!(`\r
31
+ `)?I=`\r
32
+ `:e.includes("\r")&&(I="\r"),N){for(let i=0;i<N;i++){if(n.reportProgressFunc&&(N>1e3&&N<2e3?i===Xt&&n.reportProgressFunc(Math.floor((n.reportProgressFuncTo-n.reportProgressFuncFrom)/2)):N>=2e3&&(x=n.reportProgressFuncFrom+Math.floor(i/N*(Je||1)),x!==se&&(se=x,n.reportProgressFunc(x)))),d++,!b&&p&&e[i]==="}"&&e[i-1]==="}"&&(s+1>=n.lineLengthLimit?(E.push(i,i,I),s=0):(h=i,$=i,y=" ")),b&&typeof b=="number"&&i>=b&&(b=void 0),L!==null&&e.startsWith("<\/script",i)&&!H(e[i+8])){if((n.removeIndentations||n.removeLineBreaks)&&i>0&&e[~-i]&&!e[~-i].trim()){for(let c=i;c--;)if(e[c]===`
33
+ `||e[c]==="\r"||e[c].trim()){c+1<i&&E.push(c+1,i);break}}L=null,b=!1,i+=8;continue}if(!b&&!p&&e.startsWith("<script",i)&&!H(e[i+7])){L=i,b=!0;let c="";(n.removeLineBreaks||n.removeIndentations)&&l!==null&&(l>0&&(c=I),E.push(l,i,c)),l=null,u=null}if(v!==null&&C===null&&!/\w/.test(e[i])){C=e.slice(v,i);let c=A(e,~-i);typeof c=="number"&&e[c]===">"&&!e[i].trim()&&A(e,i)?E.push(i,A(e,i)):c&&e[c]==="/"&&e[A(e,c)]===">"&&(!e[i].trim()&&A(e,i)&&E.push(i,A(e,i)),e[c+1]!==">"&&A(e,c+1)&&E.push(c+1,A(e,c+1)))}if(!b&&!p&&!m&&e[~-i]==="<"&&v===null&&(/\w/.test(e[i])?v=i:e[A(e,~-i)]==="/"&&/\w/.test(e[A(e,A(e,~-i))]||"")&&(v=A(e,A(e,~-i)))),!b&&(p||m)&&f!==null&&e[i]==="*"&&e[i+1]==="/"&&([h,$]=ae({str:e,from:f,to:i+2,ifLeftSideIncludesThisThenCropTightly:be||"",ifRightSideIncludesThisThenCropTightly:Te||""}),f=null,h!=null?E.push(h,$):(s+=1,i+=1),b=i+2),!b&&(p||m)&&f===null&&e[i]==="/"&&e[i+1]==="*"&&(o.removeCSSComments||(o.removeCSSComments=!0),n.removeCSSComments&&(f=i)),T&&e.startsWith("![endif",i+1)&&(T=!1),!b&&!p&&!m&&w!==null){let c;e.startsWith("-->",i)?c=3:e[i]===">"&&e[i-1]==="]"&&(c=1),c&&([h,$]=ae({str:e,from:w,to:i+c}),w=null,h!=null?n.lineLengthLimit&&d-($-h)>=n.lineLengthLimit?(E.push(h,$,I),d=-c):(E.push(h,$),d-=$-h):(s+=c-1,i+=c-1),b=i+c)}if(!b&&!p&&!m&&(e.startsWith("<!--",i)||n.removeHTMLComments===2&&e.startsWith("<![endif",i))&&w===null&&(e.startsWith("[if",i+4)?(T||(T=!0),n.removeHTMLComments===2&&(w=i)):n.removeHTMLComments&&(!T||n.removeHTMLComments===2)&&(w=i),o.removeHTMLComments||(o.removeHTMLComments=!0)),!b&&p&&f===null&&e.startsWith("</style",i)&&!H(e[i+7])?p=!1:!b&&!p&&f===null&&e.startsWith("<style",i)&&!H(e[i+6])&&(p=!0,(n.removeLineBreaks||n.removeIndentations)&&n.breakToTheLeftOf.includes("<style")&&e.startsWith(' type="text/css">',i+6)&&e[i+24]&&E.push(i+23,i+23,I)),!b&&!m&&`"'`.includes(e[i])&&e.endsWith("style=",i)&&(m=i),!b&&!e[i].trim())l===null&&(l=i);else if(!b&&!((p||m)&&f!==null)){if(l!==null){if(n.removeLineBreaks&&(s+=1),k)k=!1,(n.removeIndentations||n.removeLineBreaks)&&E.push(0,i);else if(n.removeIndentations&&!n.removeLineBreaks&&(!g&&u!==null&&i>u?E.push(u+1,i):l+1<i&&(e.endsWith("]>",l)||e.endsWith("-->",l)||e.startsWith("<![",i)||e.startsWith("<!--<![",i)?E.push(l,i):e[l]===" "?E.push(l+1,i):e[~-i]===" "?E.push(l,~-i):E.push(l,i," "))),n.removeLineBreaks||m){if(a.includes(e[i])&&Le(e,i,n.breakToTheLeftOf)){!(`\r
34
34
  `.includes(e[~-i])&&l===~-i)&&!(e[~-i]===`
35
- `&&e[i-2]==="\r"&&l===i-2)&&E.push(l,i,C),h=null,$=null,y=null,l=null,s=1;continue}let g=" ";e[i]==="<"&&k(e,i,n.mindTheInlineTags,{cb:B=>!B||!/\w/.test(B)})||(e[~-l]&&Kt.includes(e[~-l])&&Yt.includes(e[i])||(p||f)&&m===null&&(be.includes(e[~-l])||Te.includes(e[i]))||e.startsWith("!important",i)&&!T||f&&(e[~-l]==="'"||e[~-l]==='"')||e[~-l]==="}"&&e.startsWith("</style",i)||e[i]===">"&&(`'"`.includes(e[de(e,i)])||e[A(e,i)]==="<")||e[i]==="/"&&e[A(e,i)]===">")&&(g="",e[i]==="/"&&e[i+1]===">"&&A(e,i)&&A(e,i)>i+1&&(E.push(i+1,A(e,i)),s-=A(e,i)-i+1)),p&&e[i]==="}"&&l&&e[l-1]==="}"&&(g=" "),g!=null&&g.length&&(s+=1),n.lineLengthLimit?s>=n.lineLengthLimit||!e[i+1]||e[i]===">"||e[i]==="/"&&e[i+1]===">"?((s>n.lineLengthLimit||s===n.lineLengthLimit&&e[i+1]&&e[i+1].trim()&&!X.includes(e[i])&&!z.includes(e[i+1]))&&(g=C,s=1),(s>n.lineLengthLimit||!(g===" "&&i===l+1))&&(E.push(l,i,g),u=null),h=null,$=null,y=null):(h===null||l<h)&&(h=l,$=i,y=g):i===l+1&&g===" "||E.push(l,i,g)}l=null,c||(c=!0)}else J&&(J=!1),n.removeLineBreaks&&(s+=1);c||(c=!0)}if(!b&&!J&&i!==0&&n.removeLineBreaks&&(n.lineLengthLimit||a)&&!e.startsWith("</a",i)){if(a&&Le(e,i,n.breakToTheLeftOf)&&e.slice(0,i).trim()&&(!e.startsWith("<![endif]",i)||!nt(e,i,"<!--"))){E.push(i,i,C),h=null,$=null,y=null,s=1;continue}else if(n.lineLengthLimit&&s<=n.lineLengthLimit){if(!e[i+1]||z.includes(e[i])&&!qt.includes(e[i])||X.includes(e[i])||!e[i].trim()){if(h!==null&&$!==null&&(h!==$||y!=null&&y.length)){let g=y;e[i].trim()&&e[i+1]&&e[i+1].trim()&&s+(y?y.length:0)>n.lineLengthLimit&&(g=C),(s+(g?g.length:0)>n.lineLengthLimit||!(g===" "&&$===h+1&&e[h]===" "))&&(e[~-h]==="}"&&e[$]==="{"||(E.push(h,$,g),u=null))}e[i].trim()&&(z.includes(e[i])||e[~-i]&&X.includes(e[~-i]))&&Y(R)&&(!D||!n.mindTheInlineTags.includes(D))&&!(e[i]==="<"&&k(e,i,n.mindTheInlineTags,{cb:g=>!g||!/\w/.test(g)}))&&!(e[i]==="<"&&k(e,i,n.mindTheInlineTags,{trimCharsBeforeMatching:"/",cb:g=>!g||!/\w/.test(g)}))?(h=i,$=i,y=null):m===null&&h!==null&&(f||!n.mindTheInlineTags||!Array.isArray(n.mindTheInlineTags)||Array.isArray(n.mindTheInlineTags.length)&&!n.mindTheInlineTags.length||!Y(D)||Array.isArray(n.mindTheInlineTags)&&n.mindTheInlineTags.length&&Y(D)&&!n.mindTheInlineTags.includes(D))&&!(e[i]==="<"&&k(e,i,n.mindTheInlineTags,{trimCharsBeforeMatching:"/",cb:g=>!g||!/\w/.test(g)}))&&(h=null,$=null,y=null)}}else if(n.lineLengthLimit)if(z.includes(e[i])&&!(e[i]==="<"&&k(e,i,n.mindTheInlineTags,{trimCharsBeforeMatching:"/",cb:g=>!g||!/\w/.test(g)})))if(h!==null&&$!==null&&(h!==$||y!=null&&y.length)){let g=y!=null&&y.length?y.length:0;s-($-h-g)-1>n.lineLengthLimit||(E.push(h,$,y),s-($-h-g)-1===n.lineLengthLimit&&(E.push(i,i,C),s=0),h=null,$=null,y=null)}else E.push(i,i,C),s=0;else e[i+1]&&X.includes(e[i])&&Y(D)&&Array.isArray(n.mindTheInlineTags)&&n.mindTheInlineTags.length&&!n.mindTheInlineTags.includes(D)?h!==null&&$!==null&&(h!==$||y!=null&&y.length)||(E.push(i+1,i+1,C),s=0):e[i].trim()&&(e[i+1]||h!==null&&$!==null&&(h!==$||y!=null&&y.length)&&E.push(h,$,C))}if(!b&&!J&&n.removeLineBreaks&&n.lineLengthLimit&&s>=n.lineLengthLimit&&h!==null&&$!==null&&!X.includes(e[i])&&!z.includes(e[i])&&!"/".includes(e[i])&&!(s===n.lineLengthLimit&&e[i+1]&&!e[i+1].trim())){let g=C;e[i+1]&&!e[i+1].trim()&&s===n.lineLengthLimit&&(g=y),g===C&&!e[~-h].trim()&&de(e,h)&&(h=de(e,h)+1),E.push(h,$,g),s=i-$,e[i].length&&(s+=1),h=null,$=null,y=null}if((!b&&e[i]===`
35
+ `&&e[i-2]==="\r"&&l===i-2)&&E.push(l,i,I),h=null,$=null,y=null,l=null,s=1;continue}let c=" ";e[i]==="<"&&G(e,i,n.mindTheInlineTags,{cb:U=>!U||!/\w/.test(U)})||(e[~-l]&&Yt.includes(e[~-l])&&Qt.includes(e[i])||(p||m)&&f===null&&(be.includes(e[~-l])||Te.includes(e[i]))||e.startsWith("!important",i)&&!T||m&&(e[~-l]==="'"||e[~-l]==='"')||e[~-l]==="}"&&e.startsWith("</style",i)||e[i]===">"&&(`'"`.includes(e[de(e,i)])||e[A(e,i)]==="<")||e[i]==="/"&&e[A(e,i)]===">")&&(c="",e[i]==="/"&&e[i+1]===">"&&A(e,i)&&A(e,i)>i+1&&(E.push(i+1,A(e,i)),s-=A(e,i)-i+1)),p&&e[i]==="}"&&l&&e[l-1]==="}"&&(c=" "),c!=null&&c.length&&(s+=1),n.lineLengthLimit?s>=n.lineLengthLimit||!e[i+1]||e[i]===">"||e[i]==="/"&&e[i+1]===">"?((s>n.lineLengthLimit||s===n.lineLengthLimit&&e[i+1]&&e[i+1].trim()&&!Z.includes(e[i])&&!ee.includes(e[i+1]))&&(c=I,s=1),(s>n.lineLengthLimit||!(c===" "&&i===l+1))&&(E.push(l,i,c),u=null),h=null,$=null,y=null):(h===null||l<h)&&(h=l,$=i,y=c):i===l+1&&c===" "||E.push(l,i,c)}l=null,g||(g=!0)}else k&&(k=!1),n.removeLineBreaks&&(s+=1);g||(g=!0)}if(!b&&!k&&i!==0&&n.removeLineBreaks&&(n.lineLengthLimit||a)&&!e.startsWith("</a",i)){if(a&&Le(e,i,n.breakToTheLeftOf)&&e.slice(0,i).trim()&&(!e.startsWith("<![endif]",i)||!nt(e,i,"<!--"))){E.push(i,i,I),h=null,$=null,y=null,s=1;continue}else if(n.lineLengthLimit&&s<=n.lineLengthLimit){if(!e[i+1]||ee.includes(e[i])&&!Kt.includes(e[i])||Z.includes(e[i])||!e[i].trim()){if(h!==null&&$!==null&&(h!==$||y!=null&&y.length)){let c=y;e[i].trim()&&e[i+1]&&e[i+1].trim()&&s+(y?y.length:0)>n.lineLengthLimit&&(c=I),(s+(c?c.length:0)>n.lineLengthLimit||!(c===" "&&$===h+1&&e[h]===" "))&&(e[~-h]==="}"&&e[$]==="{"||(E.push(h,$,c),u=null))}e[i].trim()&&(ee.includes(e[i])||e[~-i]&&Z.includes(e[~-i]))&&D(P)&&(!C||!n.mindTheInlineTags.includes(C))&&!(e[i]==="<"&&G(e,i,n.mindTheInlineTags,{cb:c=>!c||!/\w/.test(c)}))&&!(e[i]==="<"&&G(e,i,n.mindTheInlineTags,{trimCharsBeforeMatching:"/",cb:c=>!c||!/\w/.test(c)}))?(h=i,$=i,y=null):f===null&&h!==null&&(m||!n.mindTheInlineTags||!Array.isArray(n.mindTheInlineTags)||Array.isArray(n.mindTheInlineTags.length)&&!n.mindTheInlineTags.length||!D(C)||Array.isArray(n.mindTheInlineTags)&&n.mindTheInlineTags.length&&D(C)&&!n.mindTheInlineTags.includes(C))&&!(e[i]==="<"&&G(e,i,n.mindTheInlineTags,{trimCharsBeforeMatching:"/",cb:c=>!c||!/\w/.test(c)}))&&(h=null,$=null,y=null)}}else if(n.lineLengthLimit)if(ee.includes(e[i])&&!(e[i]==="<"&&G(e,i,n.mindTheInlineTags,{trimCharsBeforeMatching:"/",cb:c=>!c||!/\w/.test(c)})))if(h!==null&&$!==null&&(h!==$||y!=null&&y.length)){let c=y!=null&&y.length?y.length:0;s-($-h-c)-1>n.lineLengthLimit||(E.push(h,$,y),s-($-h-c)-1===n.lineLengthLimit&&(E.push(i,i,I),s=0),h=null,$=null,y=null)}else E.push(i,i,I),s=0;else e[i+1]&&Z.includes(e[i])&&D(C)&&Array.isArray(n.mindTheInlineTags)&&n.mindTheInlineTags.length&&!n.mindTheInlineTags.includes(C)?h!==null&&$!==null&&(h!==$||y!=null&&y.length)||(E.push(i+1,i+1,I),s=0):e[i].trim()&&(e[i+1]||h!==null&&$!==null&&(h!==$||y!=null&&y.length)&&E.push(h,$,I))}if(!b&&!k&&n.removeLineBreaks&&n.lineLengthLimit&&s>=n.lineLengthLimit&&h!==null&&$!==null&&!Z.includes(e[i])&&!ee.includes(e[i])&&!"/".includes(e[i])&&!(s===n.lineLengthLimit&&e[i+1]&&!e[i+1].trim())){let c=I;e[i+1]&&!e[i+1].trim()&&s===n.lineLengthLimit&&(c=y),c===I&&!e[~-h].trim()&&de(e,h)&&(h=de(e,h)+1),E.push(h,$,c),s=i-$,e[i].length&&(s+=1),h=null,$=null,y=null}if((!b&&e[i]===`
36
36
  `||e[i]==="\r"&&(!e[i+1]||e[i+1]&&e[i+1]!==`
37
- `))&&(u=i,c&&(c=!1),!n.removeLineBreaks&&l!==null&&l<i&&e[i+1]&&e[i+1]!=="\r"&&e[i+1]!==`
38
- `&&E.push(l,i)),e[i+1]||(p&&m!==null?E.push(...ae({str:e,from:m,to:i,ifLeftSideIncludesThisThenCropTightly:be||"",ifRightSideIncludesThisThenCropTightly:Te||""})):l&&e[i]!==`
37
+ `))&&(u=i,g&&(g=!1),!n.removeLineBreaks&&l!==null&&l<i&&e[i+1]&&e[i+1]!=="\r"&&e[i+1]!==`
38
+ `&&E.push(l,i)),e[i+1]||(p&&f!==null?E.push(...ae({str:e,from:f,to:i,ifLeftSideIncludesThisThenCropTightly:be||"",ifRightSideIncludesThisThenCropTightly:Te||""})):l&&e[i]!==`
39
39
  `&&e[i]!=="\r"?E.push(l,i+1):l&&(e[i]==="\r"&&e[i+1]===`
40
40
  `||e[i]===`
41
- `&&e[i-1]!=="\r")&&E.push(l,i)),!b&&f&&f<i&&e[f]===e[i]&&(f=null),!b&&!p&&e.startsWith("<pre",i)&&!Q(e[i+4])){let g=e.indexOf("</pre",i+5);g>0&&(b=g)}if(!b&&!p&&e.startsWith("<code",i)&&!Q(e[i+5])){let g=e.indexOf("</code",i+5);g>0&&(b=g)}if(!b&&e.startsWith("<![CDATA[",i)){let g=e.indexOf("]]>",i+9);g>0&&(b=g)}!b&&!p&&!f&&I!==null&&e[i]===">"&&(e[A(e,i)]==="<"&&(R=D),I=null,D=null),e[i]==="<"&&R!==null&&(R=null),p&&e[i]==="{"&&e[i+1]==="{"&&e.indexOf("}}")!==-1&&(b=e.indexOf("}}")+2);let Z=!0}if(E.current()){let i=E.current();E.wipe();let Z=n.reportProgressFuncTo-(n.reportProgressFuncTo-n.reportProgressFuncFrom)*Je,g=Ye(e,i,Xt=>{n.reportProgressFunc&&v>=2e3&&(V=Math.floor(Z+(n.reportProgressFuncTo-Z)*(Xt/100)),V!==oe&&(oe=V,n.reportProgressFunc(V)))}),B=g.length;return{log:{timeTakenInMilliseconds:Date.now()-r,originalLength:v,cleanedLength:B,bytesSaved:Math.max(v-B,0),percentageReducedOfOriginal:v?Math.round(Math.max(v-B,0)*100/v):0},ranges:i,applicableOpts:o,result:g}}}return{log:{timeTakenInMilliseconds:Date.now()-r,originalLength:v,cleanedLength:v,bytesSaved:0,percentageReducedOfOriginal:0},applicableOpts:o,ranges:null,result:e}}return ln(Yr);})();
41
+ `&&e[i-1]!=="\r")&&E.push(l,i)),!b&&m&&m<i&&e[m]===e[i]&&(m=null),!b&&!p&&e.startsWith("<pre",i)&&!H(e[i+4])){let c=e.indexOf("</pre",i+5);c>0&&(b=c)}if(!b&&!p&&e.startsWith("<code",i)&&!H(e[i+5])){let c=e.indexOf("</code",i+5);c>0&&(b=c)}if(!b&&e.startsWith("<![CDATA[",i)){let c=e.indexOf("]]>",i+9);c>0&&(b=c)}!b&&!p&&!m&&v!==null&&e[i]===">"&&(e[A(e,i)]==="<"&&(P=C),v=null,C=null),e[i]==="<"&&P!==null&&(P=null),p&&e[i]==="{"&&e[i+1]==="{"&&e.indexOf("}}")!==-1&&(b=e.indexOf("}}")+2);let te=!0}if(E.current()){let i=E.current();E.wipe();let te=n.reportProgressFuncTo-(n.reportProgressFuncTo-n.reportProgressFuncFrom)*Be,c=Ye(e,i,zt=>{n.reportProgressFunc&&N>=2e3&&(x=Math.floor(te+(n.reportProgressFuncTo-te)*(zt/100)),x!==se&&(se=x,n.reportProgressFunc(x)))}),U=c.length;return{log:{timeTakenInMilliseconds:Date.now()-r,originalLength:N,cleanedLength:U,bytesSaved:Math.max(N-U,0),percentageReducedOfOriginal:N?Math.round(Math.max(N-U,0)*100/N):0},ranges:i,applicableOpts:o,result:c}}}return{log:{timeTakenInMilliseconds:Date.now()-r,originalLength:N,cleanedLength:N,bytesSaved:0,percentageReducedOfOriginal:0},applicableOpts:o,ranges:null,result:e}}return an(Xr);})();
42
42
  /**
43
43
  * @name ranges-sort
44
44
  * @fileoverview Sort string index ranges
45
- * @version 6.0.4
45
+ * @version 6.0.6
46
46
  * @author Roy Revelt, Codsen Ltd
47
47
  * @license MIT
48
48
  * {@link https://codsen.com/os/ranges-sort/}
@@ -50,7 +50,7 @@ ${JSON.stringify(t.breakToTheLeftOf[i],null,4)}`)}let n=S(S({},Gt),t);typeof n.r
50
50
  /**
51
51
  * @name ranges-merge
52
52
  * @fileoverview Merge and sort string index ranges
53
- * @version 9.0.4
53
+ * @version 9.0.6
54
54
  * @author Roy Revelt, Codsen Ltd
55
55
  * @license MIT
56
56
  * {@link https://codsen.com/os/ranges-merge/}
@@ -58,7 +58,7 @@ ${JSON.stringify(t.breakToTheLeftOf[i],null,4)}`)}let n=S(S({},Gt),t);typeof n.r
58
58
  /**
59
59
  * @name ranges-apply
60
60
  * @fileoverview Take an array of string index ranges, delete/replace the string according to them
61
- * @version 7.0.4
61
+ * @version 7.0.6
62
62
  * @author Roy Revelt, Codsen Ltd
63
63
  * @license MIT
64
64
  * {@link https://codsen.com/os/ranges-apply/}
@@ -66,15 +66,23 @@ ${JSON.stringify(t.breakToTheLeftOf[i],null,4)}`)}let n=S(S({},Gt),t);typeof n.r
66
66
  /**
67
67
  * @name string-collapse-leading-whitespace
68
68
  * @fileoverview Collapse the leading and trailing whitespace of a string
69
- * @version 7.0.3
69
+ * @version 7.0.4
70
70
  * @author Roy Revelt, Codsen Ltd
71
71
  * @license MIT
72
72
  * {@link https://codsen.com/os/string-collapse-leading-whitespace/}
73
73
  */
74
+ /**
75
+ * @name codsen-utils
76
+ * @fileoverview Various utility functions
77
+ * @version 1.3.0
78
+ * @author Roy Revelt, Codsen Ltd
79
+ * @license MIT
80
+ * {@link https://codsen.com/os/codsen-utils/}
81
+ */
74
82
  /**
75
83
  * @name ranges-push
76
84
  * @fileoverview Gather string index ranges
77
- * @version 7.0.4
85
+ * @version 7.0.6
78
86
  * @author Roy Revelt, Codsen Ltd
79
87
  * @license MIT
80
88
  * {@link https://codsen.com/os/ranges-push/}
@@ -82,7 +90,7 @@ ${JSON.stringify(t.breakToTheLeftOf[i],null,4)}`)}let n=S(S({},Gt),t);typeof n.r
82
90
  /**
83
91
  * @name arrayiffy-if-string
84
92
  * @fileoverview Put non-empty strings into arrays, turn empty-ones into empty arrays. Bypass everything else.
85
- * @version 5.0.3
93
+ * @version 5.0.4
86
94
  * @author Roy Revelt, Codsen Ltd
87
95
  * @license MIT
88
96
  * {@link https://codsen.com/os/arrayiffy-if-string/}
@@ -90,7 +98,7 @@ ${JSON.stringify(t.breakToTheLeftOf[i],null,4)}`)}let n=S(S({},Gt),t);typeof n.r
90
98
  /**
91
99
  * @name string-match-left-right
92
100
  * @fileoverview Match substrings on the left or right of a given index, ignoring whitespace
93
- * @version 9.0.7
101
+ * @version 9.0.9
94
102
  * @author Roy Revelt, Codsen Ltd
95
103
  * @license MIT
96
104
  * {@link https://codsen.com/os/string-match-left-right/}
@@ -98,23 +106,15 @@ ${JSON.stringify(t.breakToTheLeftOf[i],null,4)}`)}let n=S(S({},Gt),t);typeof n.r
98
106
  /**
99
107
  * @name string-range-expander
100
108
  * @fileoverview Expands string index ranges within whitespace boundaries until letters are met
101
- * @version 4.0.4
109
+ * @version 4.0.6
102
110
  * @author Roy Revelt, Codsen Ltd
103
111
  * @license MIT
104
112
  * {@link https://codsen.com/os/string-range-expander/}
105
113
  */
106
- /**
107
- * @name codsen-utils
108
- * @fileoverview Various utility functions
109
- * @version 1.2.0
110
- * @author Roy Revelt, Codsen Ltd
111
- * @license MIT
112
- * {@link https://codsen.com/os/codsen-utils/}
113
- */
114
114
  /**
115
115
  * @name string-left-right
116
116
  * @fileoverview Looks up the first non-whitespace character to the left/right of a given index
117
- * @version 6.0.7
117
+ * @version 6.0.9
118
118
  * @author Roy Revelt, Codsen Ltd
119
119
  * @license MIT
120
120
  * {@link https://codsen.com/os/string-left-right/}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "html-crush",
3
- "version": "6.0.7",
3
+ "version": "6.0.9",
4
4
  "description": "Minify email templates",
5
5
  "keywords": [
6
6
  "breaks",
@@ -80,11 +80,11 @@
80
80
  }
81
81
  },
82
82
  "dependencies": {
83
- "ranges-apply": "^7.0.4",
84
- "ranges-push": "^7.0.4",
85
- "string-left-right": "^6.0.7",
86
- "string-match-left-right": "^9.0.7",
87
- "string-range-expander": "^4.0.4",
88
- "test-mixer": "^4.1.4"
83
+ "ranges-apply": "^7.0.6",
84
+ "ranges-push": "^7.0.6",
85
+ "string-left-right": "^6.0.9",
86
+ "string-match-left-right": "^9.0.9",
87
+ "string-range-expander": "^4.0.6",
88
+ "test-mixer": "^4.1.6"
89
89
  }
90
90
  }