html-crush 5.0.10 → 5.0.13

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-2021 Roy Revelt and other contributors
3
+ Copyright (c) 2010-2022 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
@@ -26,14 +26,12 @@
26
26
 
27
27
  ## Install
28
28
 
29
- This package is ESM only: Node 12+ is needed to use it and it must be imported instead of required:
29
+ The latest version is **ESM only**: Node 12+ is needed to use it and it must be `import`ed instead of `require`d. If your project is not on ESM yet and you want to use `require`, use an older version of this program, `4.2.0`.
30
30
 
31
31
  ```bash
32
32
  npm i html-crush
33
33
  ```
34
34
 
35
- If you need a legacy version which works with `require`, use version 4.2.0
36
-
37
35
  ## Quick Take
38
36
 
39
37
  ```js
@@ -69,8 +67,6 @@ To report bugs or request features or assistance, [raise an issue](https://githu
69
67
 
70
68
  MIT License
71
69
 
72
- Copyright (c) 2010-2021 Roy Revelt and other contributors
73
-
70
+ Copyright (c) 2010-2022 Roy Revelt and other contributors
74
71
 
75
72
  <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">
76
-
@@ -1,24 +1,24 @@
1
1
  /**
2
2
  * @name html-crush
3
3
  * @fileoverview Minifies HTML/CSS: valid or broken, pure or mixed with other languages
4
- * @version 5.0.10
4
+ * @version 5.0.13
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="5.0.10";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 W=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 opts.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 H="";Array.isArray(l.breakToTheLeftOf)&&l.breakToTheLeftOf.length&&(H=[...new Set(l.breakToTheLeftOf.map(e=>e[0]))].join(""));let D={removeHTMLComments:!1,removeCSSComments:!1},S=null,i=null,p=!1,m=0,M=0,g=!1,V=!1,c=null,f=null,C=null,U=null,s,t=null,u=null,r=null,T=null,L=null,v=null,P=">};",I="<",K="!",q=">",z="<",B="{},:;<>~+",k=B,J=B,O=!0,h=n.length,Q=Math.floor(h/2),x=.01,j;l.reportProgressFunc&&(j=Math.floor(l.reportProgressFuncTo-(l.reportProgressFuncTo-l.reportProgressFuncFrom)*x-l.reportProgressFuncFrom));let d,R=0,b=`
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="5.0.13";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 N(n){return typeof n=="string"}function A(n){return typeof n=="string"&&n.toUpperCase()!==n.toLowerCase()}function ce(n,E){let W=Date.now();if(!N(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(!N(E.breakToTheLeftOf[e]))throw new TypeError(`html-crush: [THROW_ID_05] the opts.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 H="";Array.isArray(l.breakToTheLeftOf)&&l.breakToTheLeftOf.length&&(H=[...new Set(l.breakToTheLeftOf.map(e=>e[0]))].join(""));let L={removeHTMLComments:!1,removeCSSComments:!1},p=null,i=null,S=!1,m=0,M=0,g=!1,V=!1,c=null,f=null,C=null,U=null,s,t=null,u=null,r=null,T=null,D=null,v=null,P=">};",I="<",K="!",q=">",z="<",B="{},:;<>~+",k=B,J=B,O=!0,h=n.length,Q=Math.floor(h/2),x=.01,j;l.reportProgressFunc&&(j=Math.floor(l.reportProgressFuncTo-(l.reportProgressFuncTo-l.reportProgressFuncFrom)*x-l.reportProgressFuncFrom));let d,R=0,b=`
13
13
  `;if(n.includes(`\r
14
14
  `)?b=`\r
15
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)))),M++,!s&&g&&n[e]==="}"&&n[e-1]==="}"&&(m+1>=l.lineLengthLimit?($.push(e,e,b),m=0):(t=e,u=e,r=" ")),s&&typeof s=="number"&&e>=s&&(s=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,s=!1,e+=8;continue}if(!s&&!g&&n.startsWith("<script",e)&&!A(n[e+7])){U=e,s=!0;let o="";(l.removeLineBreaks||l.removeIndentations)&&i!==null&&(i>0&&(o=b),$.push(i,e,o)),i=null,S=null}if(L!==null&&T===null&&!/\w/.test(n[e])){T=n.slice(L,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(!s&&!g&&!c&&n[~-e]==="<"&&L===null&&(/\w/.test(n[e])?L=e:n[a(n,~-e)]==="/"&&/\w/.test(n[a(n,a(n,~-e))]||"")&&(L=a(n,a(n,~-e)))),!s&&(g||c)&&f!==null&&n[e]==="*"&&n[e+1]==="/"&&([t,u]=_({str:n,from:f,to:e+2,ifLeftSideIncludesThisThenCropTightly:k||"",ifRightSideIncludesThisThenCropTightly:J||""}),f=null,t!=null?$.push(t,u):(m+=1,e+=1),s=e+2),!s&&(g||c)&&f===null&&n[e]==="/"&&n[e+1]==="*"&&(D.removeCSSComments||(D.removeCSSComments=!0),l.removeCSSComments&&(f=e)),V&&n.startsWith("![endif",e+1)&&(V=!1),!s&&!g&&!c&&C!==null){let o;n.startsWith("-->",e)?o=3:n[e]===">"&&n[e-1]==="]"&&(o=1),o&&([t,u]=_({str:n,from:C,to:e+o}),C=null,t!=null?l.lineLengthLimit&&M-(u-t)>=l.lineLengthLimit?($.push(t,u,b),M=-o):($.push(t,u),M-=u-t):(m+=o-1,e+=o-1),s=e+o)}if(!s&&!g&&!c&&(n.startsWith("<!--",e)||l.removeHTMLComments===2&&n.startsWith("<![endif",e))&&C===null&&(n.startsWith("[if",e+4)?(V||(V=!0),l.removeHTMLComments===2&&(C=e)):l.removeHTMLComments&&(!V||l.removeHTMLComments===2)&&(C=e),D.removeHTMLComments||(D.removeHTMLComments=!0)),!s&&g&&f===null&&n.startsWith("</style",e)&&!A(n[e+7])?g=!1:!s&&!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)),!s&&!c&&`"'`.includes(n[e])&&n.endsWith("style=",e)&&(c=e),!s&&!n[e].trim())i===null&&(i=e);else if(!s&&!((g||c)&&f!==null)){if(i!==null){if(l.removeLineBreaks&&(m+=1),O)O=!1,(l.removeIndentations||l.removeLineBreaks)&&$.push(0,e);else if(l.removeIndentations&&!l.removeLineBreaks&&(!p&&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||c){if(H.includes(n[e])&&X(n,e,l.breakToTheLeftOf)){!(`\r
16
+ `||n[o]==="\r"||n[o].trim()){o+1<e&&$.push(o+1,e);break}}U=null,s=!1,e+=8;continue}if(!s&&!g&&n.startsWith("<script",e)&&!A(n[e+7])){U=e,s=!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(!s&&!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)))),!s&&(g||c)&&f!==null&&n[e]==="*"&&n[e+1]==="/"&&([t,u]=_({str:n,from:f,to:e+2,ifLeftSideIncludesThisThenCropTightly:k||"",ifRightSideIncludesThisThenCropTightly:J||""}),f=null,t!=null?$.push(t,u):(m+=1,e+=1),s=e+2),!s&&(g||c)&&f===null&&n[e]==="/"&&n[e+1]==="*"&&(L.removeCSSComments||(L.removeCSSComments=!0),l.removeCSSComments&&(f=e)),V&&n.startsWith("![endif",e+1)&&(V=!1),!s&&!g&&!c&&C!==null){let o;n.startsWith("-->",e)?o=3:n[e]===">"&&n[e-1]==="]"&&(o=1),o&&([t,u]=_({str:n,from:C,to:e+o}),C=null,t!=null?l.lineLengthLimit&&M-(u-t)>=l.lineLengthLimit?($.push(t,u,b),M=-o):($.push(t,u),M-=u-t):(m+=o-1,e+=o-1),s=e+o)}if(!s&&!g&&!c&&(n.startsWith("<!--",e)||l.removeHTMLComments===2&&n.startsWith("<![endif",e))&&C===null&&(n.startsWith("[if",e+4)?(V||(V=!0),l.removeHTMLComments===2&&(C=e)):l.removeHTMLComments&&(!V||l.removeHTMLComments===2)&&(C=e),L.removeHTMLComments||(L.removeHTMLComments=!0)),!s&&g&&f===null&&n.startsWith("</style",e)&&!A(n[e+7])?g=!1:!s&&!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)),!s&&!c&&`"'`.includes(n[e])&&n.endsWith("style=",e)&&(c=e),!s&&!n[e].trim())i===null&&(i=e);else if(!s&&!((g||c)&&f!==null)){if(i!==null){if(l.removeLineBreaks&&(m+=1),O)O=!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(H.includes(n[e])&&X(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,u=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)&&!V||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),S=null),t=null,u=null,r=null):(t===null||i<t)&&(t=i,u=e,r=o):e===i+1&&o===" "||$.push(i,e,o)}i=null,p||(p=!0)}else O&&(O=!1),l.removeLineBreaks&&(m+=1);p||(p=!0)}if(!s&&!O&&e!==0&&l.removeLineBreaks&&(l.lineLengthLimit||H)&&!n.startsWith("</a",e)){if(H&&X(n,e,l.breakToTheLeftOf)&&n.slice(0,e).trim()&&(!n.startsWith("<![endif]",e)||!oe(n,e,"<!--"))){$.push(e,e,b),t=null,u=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&&u!==null&&(t!==u||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===" "&&u===t+1&&n[t]===" "))&&(n[~-t]==="}"&&n[u]==="{"||($.push(t,u,o),S=null))}n[e].trim()&&(I.includes(n[e])||n[~-e]&&P.includes(n[~-e]))&&y(v)&&(!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,u=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,u=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&&u!==null&&(t!==u||r?.length)){let o=r?.length?r.length:0;m-(u-t-o)-1>l.lineLengthLimit||($.push(t,u,r),m-(u-t-o)-1===l.lineLengthLimit&&($.push(e,e,b),m=0),t=null,u=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&&u!==null&&(t!==u||r?.length)||($.push(e+1,e+1,b),m=0):n[e].trim()&&(n[e+1]||t!==null&&u!==null&&(t!==u||r?.length)&&$.push(t,u,b))}if(!s&&!O&&l.removeLineBreaks&&l.lineLengthLimit&&m>=l.lineLengthLimit&&t!==null&&u!==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,u,o),m=e-u,n[e].length&&(m+=1),t=null,u=null,r=null}if((!s&&n[e]===`
18
+ `&&n[e-2]==="\r"&&i===e-2)&&$.push(i,e,b),t=null,u=null,r=null,i=null,m=1;continue}let o=" ";n[e]==="<"&&F(n,e,l.mindTheInlineTags,{cb:y=>!y||!/\w/.test(y)})||(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)&&!V||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,u=null,r=null):(t===null||i<t)&&(t=i,u=e,r=o):e===i+1&&o===" "||$.push(i,e,o)}i=null,S||(S=!0)}else O&&(O=!1),l.removeLineBreaks&&(m+=1);S||(S=!0)}if(!s&&!O&&e!==0&&l.removeLineBreaks&&(l.lineLengthLimit||H)&&!n.startsWith("</a",e)){if(H&&X(n,e,l.breakToTheLeftOf)&&n.slice(0,e).trim()&&(!n.startsWith("<![endif]",e)||!oe(n,e,"<!--"))){$.push(e,e,b),t=null,u=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&&u!==null&&(t!==u||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===" "&&u===t+1&&n[t]===" "))&&(n[~-t]==="}"&&n[u]==="{"||($.push(t,u,o),p=null))}n[e].trim()&&(I.includes(n[e])||n[~-e]&&P.includes(n[~-e]))&&N(v)&&(!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,u=e,r=null):f===null&&t!==null&&(c||!l.mindTheInlineTags||!Array.isArray(l.mindTheInlineTags)||Array.isArray(l.mindTheInlineTags.length)&&!l.mindTheInlineTags.length||!N(T)||Array.isArray(l.mindTheInlineTags)&&l.mindTheInlineTags.length&&N(T)&&!l.mindTheInlineTags.includes(T))&&!(n[e]==="<"&&F(n,e,l.mindTheInlineTags,{trimCharsBeforeMatching:"/",cb:o=>!o||!/\w/.test(o)}))&&(t=null,u=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&&u!==null&&(t!==u||r?.length)){let o=r?.length?r.length:0;m-(u-t-o)-1>l.lineLengthLimit||($.push(t,u,r),m-(u-t-o)-1===l.lineLengthLimit&&($.push(e,e,b),m=0),t=null,u=null,r=null)}else $.push(e,e,b),m=0;else n[e+1]&&P.includes(n[e])&&N(T)&&Array.isArray(l.mindTheInlineTags)&&l.mindTheInlineTags.length&&!l.mindTheInlineTags.includes(T)?t!==null&&u!==null&&(t!==u||r?.length)||($.push(e+1,e+1,b),m=0):n[e].trim()&&(n[e+1]||t!==null&&u!==null&&(t!==u||r?.length)&&$.push(t,u,b))}if(!s&&!O&&l.removeLineBreaks&&l.lineLengthLimit&&m>=l.lineLengthLimit&&t!==null&&u!==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,u,o),m=e-u,n[e].length&&(m+=1),t=null,u=null,r=null}if((!s&&n[e]===`
19
19
  `||n[e]==="\r"&&(!n[e+1]||n[e+1]&&n[e+1]!==`
20
- `))&&(S=e,p&&(p=!1),!l.removeLineBreaks&&i!==null&&i<e&&n[e+1]&&n[e+1]!=="\r"&&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
21
  `&&$.push(i,e)),n[e+1]||(g&&f!==null?$.push(..._({str:n,from:f,to:e,ifLeftSideIncludesThisThenCropTightly:k||"",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)),!s&&c&&c<e&&n[c]===n[e]&&(c=null),!s&&!g&&n.startsWith("<pre",e)&&!A(n[e+4])){let o=n.indexOf("</pre",e+5);o>0&&(s=o)}if(!s&&!g&&n.startsWith("<code",e)&&!A(n[e+5])){let o=n.indexOf("</code",e+5);o>0&&(s=o)}if(!s&&n.startsWith("<![CDATA[",e)){let o=n.indexOf("]]>",e+9);o>0&&(s=o)}!s&&!g&&!c&&L!==null&&n[e]===">"&&(n[a(n,e)]==="<"&&(v=T),L=null,T=null),n[e]==="<"&&v!==null&&(v=null),g&&n[e]==="{"&&n[e+1]==="{"&&n.indexOf("}}")!==-1&&(s=n.indexOf("}}")+2);let w=!0}if($.current()){let e=$.current();$.wipe();let w=l.reportProgressFuncTo-(l.reportProgressFuncTo-l.reportProgressFuncFrom)*x,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()-W,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:D,result:o}}}return{log:{timeTakenInMilliseconds:Date.now()-W,originalLength:h,cleanedLength:h,bytesSaved:0,percentageReducedOfOriginal:0},applicableOpts:D,ranges:null,result:n}}export{ce as crush,te as defaults,ge as version};
24
+ `&&n[e-1]!=="\r")&&$.push(i,e)),!s&&c&&c<e&&n[c]===n[e]&&(c=null),!s&&!g&&n.startsWith("<pre",e)&&!A(n[e+4])){let o=n.indexOf("</pre",e+5);o>0&&(s=o)}if(!s&&!g&&n.startsWith("<code",e)&&!A(n[e+5])){let o=n.indexOf("</code",e+5);o>0&&(s=o)}if(!s&&n.startsWith("<![CDATA[",e)){let o=n.indexOf("]]>",e+9);o>0&&(s=o)}!s&&!g&&!c&&D!==null&&n[e]===">"&&(n[a(n,e)]==="<"&&(v=T),D=null,T=null),n[e]==="<"&&v!==null&&(v=null),g&&n[e]==="{"&&n[e+1]==="{"&&n.indexOf("}}")!==-1&&(s=n.indexOf("}}")+2);let w=!0}if($.current()){let e=$.current();$.wipe();let w=l.reportProgressFuncTo-(l.reportProgressFuncTo-l.reportProgressFuncFrom)*x,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)))}),y=o.length;return{log:{timeTakenInMilliseconds:Date.now()-W,originalLength:h,cleanedLength:y,bytesSaved:Math.max(h-y,0),percentageReducedOfOriginal:h?Math.round(Math.max(h-y,0)*100/h):0},ranges:e,applicableOpts:L,result:o}}}return{log:{timeTakenInMilliseconds:Date.now()-W,originalLength:h,cleanedLength:h,bytesSaved:0,percentageReducedOfOriginal:0},applicableOpts:L,ranges:null,result:n}}export{ce as crush,te as defaults,ge as version};
@@ -1,48 +1,48 @@
1
1
  /**
2
2
  * @name html-crush
3
3
  * @fileoverview Minifies HTML/CSS: valid or broken, pure or mixed with other languages
4
- * @version 5.0.10
4
+ * @version 5.0.13
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
- var htmlCrush=(()=>{var ln=Object.create;var ee=Object.defineProperty;var sn=Object.getOwnPropertyDescriptor;var an=Object.getOwnPropertyNames,ke=Object.getOwnPropertySymbols,un=Object.getPrototypeOf,Be=Object.prototype.hasOwnProperty,gn=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={}))Be.call(t,r)&&ye(e,r,t[r]);if(ke)for(var r of ke(t))gn.call(t,r)&&ye(e,r,t[r]);return e};var Ue=e=>ee(e,"__esModule",{value:!0});var Ge=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),cn=(e,t)=>{for(var r in t)ee(e,r,{get:t[r],enumerable:!0})},qe=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of an(t))!Be.call(e,a)&&(r||a!=="default")&&ee(e,a,{get:()=>t[a],enumerable:!(n=sn(t,a))||n.enumerable});return e},Ke=(e,t)=>qe(Ue(ee(e!=null?ln(un(e)):{},"default",!t&&e&&e.__esModule?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e),fn=(e=>(t,r)=>e&&e.get(t)||(r=qe(Ue({}),t,1),e&&e.set(t,r),r))(typeof WeakMap!="undefined"?new WeakMap:0);var Ee=(e,t,r)=>(ye(e,typeof t!="symbol"?t+"":t,r),r);var ut=Ge((Ci,at)=>{var En="[object Object]";function Sn(e){var t=!1;if(e!=null&&typeof e.toString!="function")try{t=!!(e+"")}catch(r){}return t}function wn(e,t){return function(r){return e(t(r))}}var On=Function.prototype,lt=Object.prototype,st=On.toString,Ln=lt.hasOwnProperty,Dn=st.call(Object),An=lt.toString,Cn=wn(Object.getPrototypeOf,Object);function In(e){return!!e&&typeof e=="object"}function _n(e){if(!In(e)||An.call(e)!=En||Sn(e))return!1;var t=Cn(e);if(t===null)return!0;var r=Ln.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r instanceof r&&st.call(r)==Dn}at.exports=_n});var zt=Ge((ie,q)=>{var Nn=200,gt="__lodash_hash_undefined__",ct=9007199254740991,De="[object Arguments]",vn="[object Array]",ft="[object Boolean]",mt="[object Date]",Vn="[object Error]",Ae="[object Function]",ht="[object GeneratorFunction]",ue="[object Map]",$t="[object Number]",Ce="[object Object]",pt="[object Promise]",bt="[object RegExp]",ge="[object Set]",dt="[object String]",Tt="[object Symbol]",Ie="[object WeakMap]",yt="[object ArrayBuffer]",ce="[object DataView]",Et="[object Float32Array]",St="[object Float64Array]",wt="[object Int8Array]",Ot="[object Int16Array]",Lt="[object Int32Array]",Dt="[object Uint8Array]",At="[object Uint8ClampedArray]",Ct="[object Uint16Array]",It="[object Uint32Array]",Rn=/[\\^$.*+?()[\]{}|]/g,Mn=/\w*$/,Pn=/^\[object .+?Constructor\]$/,Hn=/^(?:0|[1-9]\d*)$/,w={};w[De]=w[vn]=w[yt]=w[ce]=w[ft]=w[mt]=w[Et]=w[St]=w[wt]=w[Ot]=w[Lt]=w[ue]=w[$t]=w[Ce]=w[bt]=w[ge]=w[dt]=w[Tt]=w[Dt]=w[At]=w[Ct]=w[It]=!0;w[Vn]=w[Ae]=w[Ie]=!1;var Fn=typeof global=="object"&&global&&global.Object===Object&&global,xn=typeof self=="object"&&self&&self.Object===Object&&self,N=Fn||xn||Function("return this")(),_t=typeof ie=="object"&&ie&&!ie.nodeType&&ie,Nt=_t&&typeof q=="object"&&q&&!q.nodeType&&q,Wn=Nt&&Nt.exports===_t;function Jn(e,t){return e.set(t[0],t[1]),e}function jn(e,t){return e.add(t),e}function kn(e,t){for(var r=-1,n=e?e.length:0;++r<n&&t(e[r],r,e)!==!1;);return e}function Bn(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 Un(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}function Gn(e,t){return e==null?void 0:e[t]}function Vt(e){var t=!1;if(e!=null&&typeof e.toString!="function")try{t=!!(e+"")}catch(r){}return t}function Rt(e){var t=-1,r=Array(e.size);return e.forEach(function(n,a){r[++t]=[a,n]}),r}function _e(e,t){return function(r){return e(t(r))}}function Mt(e){var t=-1,r=Array(e.size);return e.forEach(function(n){r[++t]=n}),r}var qn=Array.prototype,Kn=Function.prototype,fe=Object.prototype,Ne=N["__core-js_shared__"],Pt=function(){var e=/[^.]+$/.exec(Ne&&Ne.keys&&Ne.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),Ht=Kn.toString,H=fe.hasOwnProperty,me=fe.toString,Yn=RegExp("^"+Ht.call(H).replace(Rn,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ft=Wn?N.Buffer:void 0,xt=N.Symbol,Wt=N.Uint8Array,Xn=_e(Object.getPrototypeOf,Object),zn=Object.create,Zn=fe.propertyIsEnumerable,Qn=qn.splice,Jt=Object.getOwnPropertySymbols,er=Ft?Ft.isBuffer:void 0,tr=_e(Object.keys,Object),ve=G(N,"DataView"),ne=G(N,"Map"),Ve=G(N,"Promise"),Re=G(N,"Set"),Me=G(N,"WeakMap"),re=G(Object,"create"),nr=W(ve),rr=W(ne),ir=W(Ve),or=W(Re),lr=W(Me),jt=xt?xt.prototype:void 0,kt=jt?jt.valueOf:void 0;function F(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 sr(){this.__data__=re?re(null):{}}function ar(e){return this.has(e)&&delete this.__data__[e]}function ur(e){var t=this.__data__;if(re){var r=t[e];return r===gt?void 0:r}return H.call(t,e)?t[e]:void 0}function gr(e){var t=this.__data__;return re?t[e]!==void 0:H.call(t,e)}function cr(e,t){var r=this.__data__;return r[e]=re&&t===void 0?gt:t,this}F.prototype.clear=sr;F.prototype.delete=ar;F.prototype.get=ur;F.prototype.has=gr;F.prototype.set=cr;function v(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function fr(){this.__data__=[]}function mr(e){var t=this.__data__,r=he(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():Qn.call(t,r,1),!0}function hr(e){var t=this.__data__,r=he(t,e);return r<0?void 0:t[r][1]}function $r(e){return he(this.__data__,e)>-1}function pr(e,t){var r=this.__data__,n=he(r,e);return n<0?r.push([e,t]):r[n][1]=t,this}v.prototype.clear=fr;v.prototype.delete=mr;v.prototype.get=hr;v.prototype.has=$r;v.prototype.set=pr;function B(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function br(){this.__data__={hash:new F,map:new(ne||v),string:new F}}function dr(e){return $e(this,e).delete(e)}function Tr(e){return $e(this,e).get(e)}function yr(e){return $e(this,e).has(e)}function Er(e,t){return $e(this,e).set(e,t),this}B.prototype.clear=br;B.prototype.delete=dr;B.prototype.get=Tr;B.prototype.has=yr;B.prototype.set=Er;function U(e){this.__data__=new v(e)}function Sr(){this.__data__=new v}function wr(e){return this.__data__.delete(e)}function Or(e){return this.__data__.get(e)}function Lr(e){return this.__data__.has(e)}function Dr(e,t){var r=this.__data__;if(r instanceof v){var n=r.__data__;if(!ne||n.length<Nn-1)return n.push([e,t]),this;r=this.__data__=new B(n)}return r.set(e,t),this}U.prototype.clear=Sr;U.prototype.delete=wr;U.prototype.get=Or;U.prototype.has=Lr;U.prototype.set=Dr;function Ar(e,t){var r=Fe(e)||zr(e)?Un(e.length,String):[],n=r.length,a=!!n;for(var o in e)(t||H.call(e,o))&&!(a&&(o=="length"||qr(o,n)))&&r.push(o);return r}function Bt(e,t,r){var n=e[t];(!(H.call(e,t)&&Kt(n,r))||r===void 0&&!(t in e))&&(e[t]=r)}function he(e,t){for(var r=e.length;r--;)if(Kt(e[r][0],t))return r;return-1}function Cr(e,t){return e&&Ut(t,xe(t),e)}function Pe(e,t,r,n,a,o,u){var s;if(n&&(s=o?n(e,a,o,u):n(e)),s!==void 0)return s;if(!pe(e))return e;var c=Fe(e);if(c){if(s=Br(e),!t)return Jr(e,s)}else{var l=x(e),$=l==Ae||l==ht;if(Qr(e))return Rr(e,t);if(l==Ce||l==De||$&&!o){if(Vt(e))return o?e:{};if(s=Ur($?{}:e),!t)return jr(e,Cr(s,e))}else{if(!w[l])return o?e:{};s=Gr(e,l,Pe,t)}}u||(u=new U);var h=u.get(e);if(h)return h;if(u.set(e,s),!c)var T=r?kr(e):xe(e);return kn(T||e,function(m,f){T&&(f=m,m=e[f]),Bt(s,f,Pe(m,t,r,n,f,e,u))}),s}function Ir(e){return pe(e)?zn(e):{}}function _r(e,t,r){var n=t(e);return Fe(e)?n:Bn(n,r(e))}function Nr(e){return me.call(e)}function vr(e){if(!pe(e)||Yr(e))return!1;var t=Xt(e)||Vt(e)?Yn:Pn;return t.test(W(e))}function Vr(e){if(!qt(e))return tr(e);var t=[];for(var r in Object(e))H.call(e,r)&&r!="constructor"&&t.push(r);return t}function Rr(e,t){if(t)return e.slice();var r=new e.constructor(e.length);return e.copy(r),r}function He(e){var t=new e.constructor(e.byteLength);return new Wt(t).set(new Wt(e)),t}function Mr(e,t){var r=t?He(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}function Pr(e,t,r){var n=t?r(Rt(e),!0):Rt(e);return vt(n,Jn,new e.constructor)}function Hr(e){var t=new e.constructor(e.source,Mn.exec(e));return t.lastIndex=e.lastIndex,t}function Fr(e,t,r){var n=t?r(Mt(e),!0):Mt(e);return vt(n,jn,new e.constructor)}function xr(e){return kt?Object(kt.call(e)):{}}function Wr(e,t){var r=t?He(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}function Jr(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}function Ut(e,t,r,n){r||(r={});for(var a=-1,o=t.length;++a<o;){var u=t[a],s=n?n(r[u],e[u],u,r,e):void 0;Bt(r,u,s===void 0?e[u]:s)}return r}function jr(e,t){return Ut(e,Gt(e),t)}function kr(e){return _r(e,xe,Gt)}function $e(e,t){var r=e.__data__;return Kr(t)?r[typeof t=="string"?"string":"hash"]:r.map}function G(e,t){var r=Gn(e,t);return vr(r)?r:void 0}var Gt=Jt?_e(Jt,Object):ni,x=Nr;(ve&&x(new ve(new ArrayBuffer(1)))!=ce||ne&&x(new ne)!=ue||Ve&&x(Ve.resolve())!=pt||Re&&x(new Re)!=ge||Me&&x(new Me)!=Ie)&&(x=function(e){var t=me.call(e),r=t==Ce?e.constructor:void 0,n=r?W(r):void 0;if(n)switch(n){case nr:return ce;case rr:return ue;case ir:return pt;case or:return ge;case lr:return Ie}return t});function Br(e){var t=e.length,r=e.constructor(t);return t&&typeof e[0]=="string"&&H.call(e,"index")&&(r.index=e.index,r.input=e.input),r}function Ur(e){return typeof e.constructor=="function"&&!qt(e)?Ir(Xn(e)):{}}function Gr(e,t,r,n){var a=e.constructor;switch(t){case yt:return He(e);case ft:case mt:return new a(+e);case ce:return Mr(e,n);case Et:case St:case wt:case Ot:case Lt:case Dt:case At:case Ct:case It:return Wr(e,n);case ue:return Pr(e,n,r);case $t:case dt:return new a(e);case bt:return Hr(e);case ge:return Fr(e,n,r);case Tt:return xr(e)}}function qr(e,t){return t=t==null?ct:t,!!t&&(typeof e=="number"||Hn.test(e))&&e>-1&&e%1==0&&e<t}function Kr(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function Yr(e){return!!Pt&&Pt in e}function qt(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||fe;return e===r}function W(e){if(e!=null){try{return Ht.call(e)}catch(t){}try{return e+""}catch(t){}}return""}function Xr(e){return Pe(e,!0,!0)}function Kt(e,t){return e===t||e!==e&&t!==t}function zr(e){return Zr(e)&&H.call(e,"callee")&&(!Zn.call(e,"callee")||me.call(e)==De)}var Fe=Array.isArray;function Yt(e){return e!=null&&ei(e.length)&&!Xt(e)}function Zr(e){return ti(e)&&Yt(e)}var Qr=er||ri;function Xt(e){var t=pe(e)?me.call(e):"";return t==Ae||t==ht}function ei(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=ct}function pe(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function ti(e){return!!e&&typeof e=="object"}function xe(e){return Yt(e)?Ar(e):Vr(e)}function ni(){return[]}function ri(){return!1}q.exports=Xr});var ci={};cn(ci,{crush:()=>gi,defaults:()=>Qt,version:()=>ui});var mn={strictlyTwoElementsInRangeArrays:!1,progressFn:null};function Se(e,t){if(!Array.isArray(e)||!e.length)return e;let r=S(S({},mn),t),n,a;if(r.strictlyTwoElementsInRangeArrays&&!e.every((s,c)=>!Array.isArray(s)||s.length!==2?(n=c,a=s.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((s,c)=>!Array.isArray(s)||!Number.isInteger(s[0])||s[0]<0||!Number.isInteger(s[1])||s[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((s,c)=>(r.progressFn&&(u+=1,r.progressFn(Math.floor(u*100/o))),s[0]===c[0]?s[1]<c[1]?-1:s[1]>c[1]?1:0:s[0]<c[0]?-1:1))}var Ye={mergeType:1,progressFn:null,joinRangesThatTouchEdges:!0};function Xe(e,t){function r(l){return l&&typeof l=="object"&&!Array.isArray(l)}if(!Array.isArray(e)||!e.length)return null;let n;if(t)if(r(t)){if(n=S(S({},Ye),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({},Ye);let a=e.filter(l=>Array.isArray(l)).map(l=>[...l]).filter(l=>l[2]!==void 0||l[0]!==l[1]),o,u,s;n.progressFn?o=Se(a,{progressFn:l=>{s=Math.floor(l/5),s!==u&&(u=s,n.progressFn(s))}}):o=Se(a);let c=o.length-1;for(let l=c;l>0;l--)n.progressFn&&(s=Math.floor((1-l/c)*78)+21,s!==u&&s>u&&(u=s,n.progressFn(s))),(o[l][0]<=o[l-1][0]||!n.joinRangesThatTouchEdges&&o[l][0]<o[l-1][1]||n.joinRangesThatTouchEdges&&o[l][0]<=o[l-1][1])&&(o[l-1][0]=Math.min(o[l][0],o[l-1][0]),o[l-1][1]=Math.max(o[l][1],o[l-1][1]),o[l][2]!==void 0&&(o[l-1][0]>=o[l][0]||o[l-1][1]<=o[l][1])&&o[l-1][2]!==null&&(o[l][2]===null&&o[l-1][2]!==null?o[l-1][2]=null:o[l-1][2]!=null?+n.mergeType==2&&o[l-1][0]===o[l][0]?o[l-1][2]=o[l][2]:o[l-1][2]+=o[l][2]:o[l-1][2]=o[l][2]),o.splice(l,1),l=o.length);return o.length?o:null}var hn=!0,we="Invariant failed";function ze(e,t){if(!e){if(hn)throw new Error(we);var r=typeof t=="function"?t():t,n=r?we+": "+r:we;throw new Error(n)}}function Ze(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($=>$).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,s=0;o.filter($=>$).forEach(($,h)=>{if(r&&(n=Math.floor(s/u*10),n!==a&&(a=n,r(n))),!Array.isArray($))throw new TypeError(`ranges-apply: [THROW_ID_05] ranges array, second input arg., has ${h}th element not an array: ${JSON.stringify($,null,4)}, which is ${typeof $}`);if(!Number.isInteger($[0])){if(!Number.isInteger(+$[0])||+$[0]<0)throw new TypeError(`ranges-apply: [THROW_ID_06] ranges array, second input arg. has ${h}th element, array ${JSON.stringify($,null,0)}. Its first element is not an integer, string index, but ${typeof $[0]}, equal to: ${JSON.stringify($[0],null,4)}.`);o[h][0]=+o[h][0]}if(!Number.isInteger($[1])){if(!Number.isInteger(+$[1])||+$[1]<0)throw new TypeError(`ranges-apply: [THROW_ID_07] ranges array, second input arg. has ${h}th element, array ${JSON.stringify($,null,0)}. Its second element is not an integer, string index, but ${typeof $[1]}, equal to: ${JSON.stringify($[1],null,4)}.`);o[h][1]=+o[h][1]}s+=1});let c=Xe(o,{progressFn:$=>{r&&(n=10+Math.floor($/10),n!==a&&(a=n,r(n)))}});ze(c);let l=c.length;if(l>0){let $=e.slice(c[l-1][1]);e=c.reduce((h,T,m,f)=>{r&&(n=20+Math.floor(m/l*80),n!==a&&(a=n,r(n)));let O=m===0?0:f[m-1][1],L=f[m][0];return`${h}${e.slice(O,L)}${f[m][2]||""}`},""),e+=$}return e}function le(e,t=1){let r="\xA0";function n(o){return Array.from(o).reverse().join("")}function a(o,u,s){let c=s?`
12
- `:"\r",l=s?"\r":`
13
- `;if(!o)return o;let $=0,h=0,T="";for(let m=0,f=o.length;m<f;m++)(o[m]===c||o[m]===l&&o[m-1]!==c)&&h++,`\r
14
- `.includes(o[m])||o[m]===r?($=0,o[m]===r?T+=o[m]:o[m]===c?h<=u&&(T+=o[m],o[m+1]===l&&(T+=o[m+1],m++)):o[m]===l&&(!o[m-1]||o[m-1]!==c)&&h<=u&&(T+=o[m])):($++,!o[m+1]&&!h&&(T+=" "));return T}if(typeof e=="string"&&e.length){let o=1;typeof+t=="number"&&Number.isInteger(+t)&&+t>=0&&(o=+t);let u="",s="";if(!e.trim())u=e;else if(!e[0].trim()){for(let c=0,l=e.length;c<l;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()){s=e.slice(c+1);break}}return`${a(u,o,!1)}${e.trim()}${n(a(n(s),o,!0))}`}return e}var $n={strictlyTwoElementsInRangeArrays:!1,progressFn:null};function Qe(e,t){if(!Array.isArray(e)||!e.length)return e;let r=S(S({},$n),t),n,a;if(r.strictlyTwoElementsInRangeArrays&&!e.every((s,c)=>!Array.isArray(s)||s.length!==2?(n=c,a=s.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((s,c)=>!Array.isArray(s)||!Number.isInteger(s[0])||s[0]<0||!Number.isInteger(s[1])||s[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((s,c)=>(r.progressFn&&(u+=1,r.progressFn(Math.floor(u*100/o))),s[0]===c[0]?s[1]<c[1]?-1:s[1]>c[1]?1:0:s[0]<c[0]?-1:1))}var et={mergeType:1,progressFn:null,joinRangesThatTouchEdges:!0};function pn(e,t){function r(l){return l&&typeof l=="object"&&!Array.isArray(l)}if(!Array.isArray(e)||!e.length)return null;let n;if(t)if(r(t)){if(n=S(S({},et),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:
15
- ${JSON.stringify(t,null,4)} (type ${typeof t})`);else n=S({},et);let a=e.filter(l=>Array.isArray(l)).map(l=>[...l]).filter(l=>l[2]!==void 0||l[0]!==l[1]),o,u,s;n.progressFn?o=Qe(a,{progressFn:l=>{s=Math.floor(l/5),s!==u&&(u=s,n.progressFn(s))}}):o=Qe(a);let c=o.length-1;for(let l=c;l>0;l--)n.progressFn&&(s=Math.floor((1-l/c)*78)+21,s!==u&&s>u&&(u=s,n.progressFn(s))),(o[l][0]<=o[l-1][0]||!n.joinRangesThatTouchEdges&&o[l][0]<o[l-1][1]||n.joinRangesThatTouchEdges&&o[l][0]<=o[l-1][1])&&(o[l-1][0]=Math.min(o[l][0],o[l-1][0]),o[l-1][1]=Math.max(o[l][1],o[l-1][1]),o[l][2]!==void 0&&(o[l-1][0]>=o[l][0]||o[l-1][1]<=o[l][1])&&o[l-1][2]!==null&&(o[l][2]===null&&o[l-1][2]!==null?o[l-1][2]=null:o[l-1][2]!=null?+n.mergeType==2&&o[l-1][0]===o[l][0]?o[l-1][2]=o[l][2]:o[l-1][2]+=o[l][2]:o[l-1][2]=o[l][2]),o.splice(l,1),l=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 bn={limitToBeAddedWhitespace:!1,limitLinebreaksCount:1,mergeType:1},tt=class{constructor(e){Ee(this,"ranges");Ee(this,"opts");let t=S(S({},bn),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){if(e==null&&t==null)return;if(M(e)&&!M(t)){if(Array.isArray(e)){if(e.length){if(e.some(o=>Array.isArray(o))){e.forEach(o=>{Array.isArray(o)&&this.add(...o)});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 o=this.last()[2]&&this.last()[2].length>0&&(!this.opts||!this.opts.mergeType||this.opts.mergeType===1)?`${this.last()[2]}${r}`:r;this.opts.limitToBeAddedWhitespace&&(o=le(o,this.opts.limitLinebreaksCount)),te(o)&&!o.length||(this.last()[2]=o)}}else{this.ranges||(this.ranges=[]);let o=r!==void 0&&!(te(r)&&!r.length)?[n,a,r&&this.opts.limitToBeAddedWhitespace?le(r,this.opts.limitLinebreaksCount):r]:[n,a];this.ranges.push(o)}}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=pn(this.ranges,{mergeType:this.opts.mergeType}),this.ranges&&this.opts.limitToBeAddedWhitespace?this.ranges.map(e=>M(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])&&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 nt(e){return typeof e=="string"?e.length?[e]:[]:e}function rt(e){return e&&typeof e=="object"&&!Array.isArray(e)}function se(e){return typeof e=="string"}var it={cb:void 0,i:!1,trimBeforeMatching:!1,trimCharsBeforeMatching:[],maxMismatches:0,firstMustMatch:!1,lastMustMatch:!1,hungry:!1},dn=e=>e+1;function Tn(e,t,r,n,a=!1,o=dn){let u=typeof r=="function"?r():r;if(+t<0&&a&&u==="EOL")return u;let s=S(S({},it),n);if(t>=e.length&&!a)return!1;let c=a?1:r.length,l=0,$=!1,h=!1,T=!1,m=s.maxMismatches,f=t,O=!1,L=!1,p=!1;function b(){return l===1&&m<s.maxMismatches-1}for(;e[f];){let d=o(f);if(s.trimBeforeMatching&&e[f].trim()===""){if(!e[d]&&a&&r==="EOL")return!0;f=o(f);continue}if(s&&!s.i&&s.trimCharsBeforeMatching&&s.trimCharsBeforeMatching.includes(e[f])||(s==null?void 0:s.i)&&s.trimCharsBeforeMatching&&s.trimCharsBeforeMatching.map(A=>A.toLowerCase()).includes(e[f].toLowerCase())){if(a&&r==="EOL"&&!e[d])return!0;f=o(f);continue}let E=d>f?r[r.length-c]:r[c-1];if(!s.i&&e[f]===E||s.i&&e[f].toLowerCase()===E.toLowerCase()){if(O||(O=!0),T||(T=!0),c===r.length){if(L=!0,m!==s.maxMismatches)return!1}else c===1&&(p=!0);if(c-=1,l++,b())return!1;if(!c)return l!==r.length||m===s.maxMismatches||!$?f:!1}else if(!$&&!l&&($=!0),s.maxMismatches&&m&&f){m-=1;for(let A=0;A<=m;A++){let I=d>f?r[r.length-c+1+A]:r[c-2-A],V=e[o(f)];if(I&&(!s.i&&e[f]===I||s.i&&e[f].toLowerCase()===I.toLowerCase())&&(!s.firstMustMatch||c!==r.length)){if(l++,b())return!1;c-=2,O=!0;break}else if(V&&I&&(!s.i&&V===I||s.i&&V.toLowerCase()===I.toLowerCase())&&(!s.firstMustMatch||c!==r.length)){if(!l&&!s.hungry)return!1;c-=1,O=!0;break}else if(I===void 0&&m>=0&&O&&(!s.firstMustMatch||L)&&(!s.lastMustMatch||p))return f}O||(h=f)}else return f===0&&c===1&&!s.lastMustMatch&&T?0:!1;if(h!==!1&&h!==f&&(h=!1),c<1)return f;f=o(f)}if(c>0)return a&&u==="EOL"?!0:s&&s.maxMismatches>=c&&T?h||0:!1}function Oe(e,t,r,n,a){if(rt(a)&&Object.prototype.hasOwnProperty.call(a,"trimBeforeMatching")&&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({},it),a);if(typeof o.trimCharsBeforeMatching=="string"&&(o.trimCharsBeforeMatching=nt(o.trimCharsBeforeMatching)),o.trimCharsBeforeMatching=o.trimCharsBeforeMatching.map($=>se($)?$:String($)),!se(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,s;if(se(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&&!rt(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,l="";if((o==null?void 0:o.trimCharsBeforeMatching)&&o.trimCharsBeforeMatching.some(($,h)=>$.length>1?(c=h,l=$,!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, ${l.length} (equals to ${l}). 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&&se(u[0])&&!u[0].trim()){if(typeof o.cb=="function"){let h,T=r;if((e==="matchLeftIncl"||e==="matchRight")&&(T+=1),e[5]==="L")for(let L=T;L--;){let p=t[L];if((!o.trimBeforeMatching||o.trimBeforeMatching&&p!==void 0&&p.trim())&&(!o.trimCharsBeforeMatching||!o.trimCharsBeforeMatching.length||p!==void 0&&!o.trimCharsBeforeMatching.includes(p))){h=L;break}}else if(e.startsWith("matchRight"))for(let L=T;L<t.length;L++){let p=t[L];if((!o.trimBeforeMatching||o.trimBeforeMatching&&p.trim())&&(!o.trimCharsBeforeMatching||!o.trimCharsBeforeMatching.length||!o.trimCharsBeforeMatching.includes(p))){h=L;break}}if(h===void 0)return!1;let m=t[h],f=h+1,O="";return f&&f>0&&(O=t.slice(0,f)),e[5]==="L"||h&&h>0&&(O=t.slice(h)),o.cb(m,O,h)}let $="";throw a||($=" 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!${$}`)}for(let $=0,h=u.length;$<h;$++){s=typeof u[$]=="function";let T=u[$],m,f,O="",L=r;e==="matchRight"?L+=1:e==="matchLeft"&&(L-=1);let p=Tn(t,L,T,o,s,b=>e[5]==="L"?b-1:b+1);if(p&&s&&typeof T=="function"&&T()==="EOL")return T()&&(o.cb?o.cb(m,O,f):!0)?T():!1;if(Number.isInteger(p)&&(f=e.startsWith("matchLeft")?p-1:p+1,e[5]==="L"?O=t.slice(0,p):O=t.slice(f)),f<0&&(f=void 0),t[f]&&(m=t[f]),Number.isInteger(p)&&(o.cb?o.cb(m,O,f):!0))return T}return!1}function ot(e,t,r,n){return Oe("matchLeft",e,t,r,n)}function Le(e,t,r,n){return Oe("matchRightIncl",e,t,r,n)}function k(e,t,r,n){return Oe("matchRight",e,t,r,n)}var yn={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(l){return!l||typeof l!="string"?!1:!l.trim()}function n(l){return typeof l=="string"}if(!e||typeof e!="object"||Array.isArray(e)){let l;throw e===void 0?l="but it is missing completely.":e===null?l="but it was given as null.":l=`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 ${l}`)}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 opts.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 opts.to, is not a number! Currently it's given as ${typeof e.to}, equal to ${JSON.stringify(e.to,null,0)}`);if((e==null?void 0:e.str)&&!e.str[e.from]&&e.from!==e.to)throw new Error(`string-range-expander: [THROW_ID_05] The given input string opts.str ("${e.str}") must contain the character at index "from" ("${e.from}")`);if((e==null?void 0:e.str)&&!e.str[e.to-1])throw new Error(`string-range-expander: [THROW_ID_06] The given input string, opts.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 opts.extendToOneSide value is not recogniseable! 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({},yn),e);if(Array.isArray(a.ifLeftSideIncludesThisThenCropTightly)){let l,$;if(a.ifLeftSideIncludesThisThenCropTightly.every((h,T)=>n(h)?!0:(l=T,$=h,!1)))a.ifLeftSideIncludesThisThenCropTightly=a.ifLeftSideIncludesThisThenCropTightly.join("");else throw new Error(`string-range-expander: [THROW_ID_09] The opts.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 ${l} is of a type ${typeof $} (equal to ${JSON.stringify($,null,0)}).`)}let o=a.str,u=a.from,s=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 l=u;l--;)if(!a.ifLeftSideIncludesThisCropItToo.includes(o[l])){if(o[l].trim()){a.wipeAllWhitespaceOnLeft||a.ifLeftSideIncludesThisCropItToo.includes(o[l+1])?u=l+1:u=l+2;break}else if(l===0){a.wipeAllWhitespaceOnLeft?u=0:u=1;break}}}if(a.extendToOneSide!=="left"&&(r(o[s])&&(a.wipeAllWhitespaceOnRight||r(o[s+1]))||a.ifRightSideIncludesThisCropItToo.includes(o[s]))){for(let l=s,$=o.length;l<$;l++)if(!a.ifRightSideIncludesThisCropItToo.includes(o[l])&&((c=o[l])==null?void 0:c.trim())){a.wipeAllWhitespaceOnRight||a.ifRightSideIncludesThisCropItToo.includes(o[l-1])?s=l:s=l-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[s+1]&&a.ifRightSideIncludesThisThenCropTightly.includes(o[s+1])||o[s]&&a.ifRightSideIncludesThisThenCropTightly.includes(o[s])))&&(a.extendToOneSide!=="right"&&r(o[u-1])&&!a.wipeAllWhitespaceOnLeft&&(u-=1),a.extendToOneSide!=="left"&&r(o[s])&&!a.wipeAllWhitespaceOnRight&&(s+=1)),a.addSingleSpaceToPreventAccidentalConcatenation&&o[u-1]&&o[u-1].trim()&&o[s]&&o[s].trim()&&(!a.ifLeftSideIncludesThisThenCropTightly&&!a.ifRightSideIncludesThisThenCropTightly||!((!a.ifLeftSideIncludesThisThenCropTightly||a.ifLeftSideIncludesThisThenCropTightly.includes(o[u-1]))&&(!a.ifRightSideIncludesThisThenCropTightly||o[s]&&a.ifRightSideIncludesThisThenCropTightly.includes(o[s]))))&&(t.test(o[u-1])||t.test(o[s]))?[u,s," "]:[u,s]}var ii=Ke(ut(),1),oi=Ke(zt(),1);var K="\xA0";function li({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&&`
10
+ var htmlCrush=(()=>{var on=Object.create;var ee=Object.defineProperty;var sn=Object.getOwnPropertyDescriptor;var ln=Object.getOwnPropertyNames,ke=Object.getOwnPropertySymbols,an=Object.getPrototypeOf,Be=Object.prototype.hasOwnProperty,un=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={}))Be.call(t,r)&&ye(e,r,t[r]);if(ke)for(var r of ke(t))un.call(t,r)&&ye(e,r,t[r]);return e};var Ue=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),gn=(e,t)=>{for(var r in t)ee(e,r,{get:t[r],enumerable:!0})},Ge=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of ln(t))!Be.call(e,a)&&a!==r&&ee(e,a,{get:()=>t[a],enumerable:!(n=sn(t,a))||n.enumerable});return e};var qe=(e,t,r)=>(r=e!=null?on(an(e)):{},Ge(t||!e||!e.__esModule?ee(r,"default",{value:e,enumerable:!0}):r,e)),cn=e=>Ge(ee({},"__esModule",{value:!0}),e);var Ee=(e,t,r)=>(ye(e,typeof t!="symbol"?t+"":t,r),r);var at=Ue((Ai,lt)=>{var yn="[object Object]";function En(e){var t=!1;if(e!=null&&typeof e.toString!="function")try{t=!!(e+"")}catch(r){}return t}function Sn(e,t){return function(r){return e(t(r))}}var wn=Function.prototype,ot=Object.prototype,st=wn.toString,On=ot.hasOwnProperty,Ln=st.call(Object),Dn=ot.toString,An=Sn(Object.getPrototypeOf,Object);function Cn(e){return!!e&&typeof e=="object"}function In(e){if(!Cn(e)||Dn.call(e)!=yn||En(e))return!1;var t=An(e);if(t===null)return!0;var r=On.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r instanceof r&&st.call(r)==Ln}lt.exports=In});var Xt=Ue((ne,B)=>{var _n=200,yt="__lodash_hash_undefined__",Et=9007199254740991,Ve="[object Arguments]",Nn="[object Array]",St="[object Boolean]",wt="[object Date]",vn="[object Error]",Re="[object Function]",Ot="[object GeneratorFunction]",ue="[object Map]",Lt="[object Number]",Me="[object Object]",ut="[object Promise]",Dt="[object RegExp]",ge="[object Set]",At="[object String]",Ct="[object Symbol]",Ae="[object WeakMap]",It="[object ArrayBuffer]",ce="[object DataView]",_t="[object Float32Array]",Nt="[object Float64Array]",vt="[object Int8Array]",Vt="[object Int16Array]",Rt="[object Int32Array]",Mt="[object Uint8Array]",Pt="[object Uint8ClampedArray]",Ht="[object Uint16Array]",Ft="[object Uint32Array]",Vn=/[\\^$.*+?()[\]{}|]/g,Rn=/\w*$/,Mn=/^\[object .+?Constructor\]$/,Pn=/^(?:0|[1-9]\d*)$/,w={};w[Ve]=w[Nn]=w[It]=w[ce]=w[St]=w[wt]=w[_t]=w[Nt]=w[vt]=w[Vt]=w[Rt]=w[ue]=w[Lt]=w[Me]=w[Dt]=w[ge]=w[At]=w[Ct]=w[Mt]=w[Pt]=w[Ht]=w[Ft]=!0;w[vn]=w[Re]=w[Ae]=!1;var Hn=typeof global=="object"&&global&&global.Object===Object&&global,Fn=typeof self=="object"&&self&&self.Object===Object&&self,N=Hn||Fn||Function("return this")(),xt=typeof ne=="object"&&ne&&!ne.nodeType&&ne,gt=xt&&typeof B=="object"&&B&&!B.nodeType&&B,xn=gt&&gt.exports===xt;function Wn(e,t){return e.set(t[0],t[1]),e}function jn(e,t){return e.add(t),e}function Jn(e,t){for(var r=-1,n=e?e.length:0;++r<n&&t(e[r],r,e)!==!1;);return e}function kn(e,t){for(var r=-1,n=t.length,a=e.length;++r<n;)e[a+r]=t[r];return e}function Wt(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 Bn(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}function Un(e,t){return e==null?void 0:e[t]}function jt(e){var t=!1;if(e!=null&&typeof e.toString!="function")try{t=!!(e+"")}catch(r){}return t}function ct(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 ft(e){var t=-1,r=Array(e.size);return e.forEach(function(n){r[++t]=n}),r}var Gn=Array.prototype,qn=Function.prototype,fe=Object.prototype,De=N["__core-js_shared__"],mt=function(){var e=/[^.]+$/.exec(De&&De.keys&&De.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),Jt=qn.toString,H=fe.hasOwnProperty,me=fe.toString,Kn=RegExp("^"+Jt.call(H).replace(Vn,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ht=xn?N.Buffer:void 0,$t=N.Symbol,pt=N.Uint8Array,Yn=Pe(Object.getPrototypeOf,Object),Xn=Object.create,zn=fe.propertyIsEnumerable,Zn=Gn.splice,bt=Object.getOwnPropertySymbols,Qn=ht?ht.isBuffer:void 0,er=Pe(Object.keys,Object),Ce=q(N,"DataView"),re=q(N,"Map"),Ie=q(N,"Promise"),_e=q(N,"Set"),Ne=q(N,"WeakMap"),ie=q(Object,"create"),tr=W(Ce),nr=W(re),rr=W(Ie),ir=W(_e),or=W(Ne),dt=$t?$t.prototype:void 0,Tt=dt?dt.valueOf:void 0;function x(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 sr(){this.__data__=ie?ie(null):{}}function lr(e){return this.has(e)&&delete this.__data__[e]}function ar(e){var t=this.__data__;if(ie){var r=t[e];return r===yt?void 0:r}return H.call(t,e)?t[e]:void 0}function ur(e){var t=this.__data__;return ie?t[e]!==void 0:H.call(t,e)}function gr(e,t){var r=this.__data__;return r[e]=ie&&t===void 0?yt:t,this}x.prototype.clear=sr;x.prototype.delete=lr;x.prototype.get=ar;x.prototype.has=ur;x.prototype.set=gr;function v(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function cr(){this.__data__=[]}function fr(e){var t=this.__data__,r=he(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():Zn.call(t,r,1),!0}function mr(e){var t=this.__data__,r=he(t,e);return r<0?void 0:t[r][1]}function hr(e){return he(this.__data__,e)>-1}function $r(e,t){var r=this.__data__,n=he(r,e);return n<0?r.push([e,t]):r[n][1]=t,this}v.prototype.clear=cr;v.prototype.delete=fr;v.prototype.get=mr;v.prototype.has=hr;v.prototype.set=$r;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 pr(){this.__data__={hash:new x,map:new(re||v),string:new x}}function br(e){return $e(this,e).delete(e)}function dr(e){return $e(this,e).get(e)}function Tr(e){return $e(this,e).has(e)}function yr(e,t){return $e(this,e).set(e,t),this}U.prototype.clear=pr;U.prototype.delete=br;U.prototype.get=dr;U.prototype.has=Tr;U.prototype.set=yr;function G(e){this.__data__=new v(e)}function Er(){this.__data__=new v}function Sr(e){return this.__data__.delete(e)}function wr(e){return this.__data__.get(e)}function Or(e){return this.__data__.has(e)}function Lr(e,t){var r=this.__data__;if(r instanceof v){var n=r.__data__;if(!re||n.length<_n-1)return n.push([e,t]),this;r=this.__data__=new U(n)}return r.set(e,t),this}G.prototype.clear=Er;G.prototype.delete=Sr;G.prototype.get=wr;G.prototype.has=Or;G.prototype.set=Lr;function Dr(e,t){var r=Fe(e)||Xr(e)?Bn(e.length,String):[],n=r.length,a=!!n;for(var o in e)(t||H.call(e,o))&&!(a&&(o=="length"||Gr(o,n)))&&r.push(o);return r}function kt(e,t,r){var n=e[t];(!(H.call(e,t)&&qt(n,r))||r===void 0&&!(t in e))&&(e[t]=r)}function he(e,t){for(var r=e.length;r--;)if(qt(e[r][0],t))return r;return-1}function Ar(e,t){return e&&Bt(t,xe(t),e)}function ve(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=kr(e),!t)return Wr(e,l)}else{var s=F(e),$=s==Re||s==Ot;if(Zr(e))return Vr(e,t);if(s==Me||s==Ve||$&&!o){if(jt(e))return o?e:{};if(l=Br($?{}:e),!t)return jr(e,Ar(l,e))}else{if(!w[s])return o?e:{};l=Ur(e,s,ve,t)}}u||(u=new G);var h=u.get(e);if(h)return h;if(u.set(e,l),!c)var T=r?Jr(e):xe(e);return Jn(T||e,function(m,f){T&&(f=m,m=e[f]),kt(l,f,ve(m,t,r,n,f,e,u))}),l}function Cr(e){return pe(e)?Xn(e):{}}function Ir(e,t,r){var n=t(e);return Fe(e)?n:kn(n,r(e))}function _r(e){return me.call(e)}function Nr(e){if(!pe(e)||Kr(e))return!1;var t=Yt(e)||jt(e)?Kn:Mn;return t.test(W(e))}function vr(e){if(!Gt(e))return er(e);var t=[];for(var r in Object(e))H.call(e,r)&&r!="constructor"&&t.push(r);return t}function Vr(e,t){if(t)return e.slice();var r=new e.constructor(e.length);return e.copy(r),r}function He(e){var t=new e.constructor(e.byteLength);return new pt(t).set(new pt(e)),t}function Rr(e,t){var r=t?He(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}function Mr(e,t,r){var n=t?r(ct(e),!0):ct(e);return Wt(n,Wn,new e.constructor)}function Pr(e){var t=new e.constructor(e.source,Rn.exec(e));return t.lastIndex=e.lastIndex,t}function Hr(e,t,r){var n=t?r(ft(e),!0):ft(e);return Wt(n,jn,new e.constructor)}function Fr(e){return Tt?Object(Tt.call(e)):{}}function xr(e,t){var r=t?He(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}function Wr(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}function Bt(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;kt(r,u,l===void 0?e[u]:l)}return r}function jr(e,t){return Bt(e,Ut(e),t)}function Jr(e){return Ir(e,xe,Ut)}function $e(e,t){var r=e.__data__;return qr(t)?r[typeof t=="string"?"string":"hash"]:r.map}function q(e,t){var r=Un(e,t);return Nr(r)?r:void 0}var Ut=bt?Pe(bt,Object):ti,F=_r;(Ce&&F(new Ce(new ArrayBuffer(1)))!=ce||re&&F(new re)!=ue||Ie&&F(Ie.resolve())!=ut||_e&&F(new _e)!=ge||Ne&&F(new Ne)!=Ae)&&(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 tr:return ce;case nr:return ue;case rr:return ut;case ir:return ge;case or:return Ae}return t});function kr(e){var t=e.length,r=e.constructor(t);return t&&typeof e[0]=="string"&&H.call(e,"index")&&(r.index=e.index,r.input=e.input),r}function Br(e){return typeof e.constructor=="function"&&!Gt(e)?Cr(Yn(e)):{}}function Ur(e,t,r,n){var a=e.constructor;switch(t){case It:return He(e);case St:case wt:return new a(+e);case ce:return Rr(e,n);case _t:case Nt:case vt:case Vt:case Rt:case Mt:case Pt:case Ht:case Ft:return xr(e,n);case ue:return Mr(e,n,r);case Lt:case At:return new a(e);case Dt:return Pr(e);case ge:return Hr(e,n,r);case Ct:return Fr(e)}}function Gr(e,t){return t=t==null?Et:t,!!t&&(typeof e=="number"||Pn.test(e))&&e>-1&&e%1==0&&e<t}function qr(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function Kr(e){return!!mt&&mt in e}function Gt(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||fe;return e===r}function W(e){if(e!=null){try{return Jt.call(e)}catch(t){}try{return e+""}catch(t){}}return""}function Yr(e){return ve(e,!0,!0)}function qt(e,t){return e===t||e!==e&&t!==t}function Xr(e){return zr(e)&&H.call(e,"callee")&&(!zn.call(e,"callee")||me.call(e)==Ve)}var Fe=Array.isArray;function Kt(e){return e!=null&&Qr(e.length)&&!Yt(e)}function zr(e){return ei(e)&&Kt(e)}var Zr=Qn||ni;function Yt(e){var t=pe(e)?me.call(e):"";return t==Re||t==Ot}function Qr(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=Et}function pe(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function ei(e){return!!e&&typeof e=="object"}function xe(e){return Kt(e)?Dr(e):vr(e)}function ti(){return[]}function ni(){return!1}B.exports=Yr});var gi={};gn(gi,{crush:()=>ui,defaults:()=>Zt,version:()=>ai});var fn={strictlyTwoElementsInRangeArrays:!1,progressFn:null};function Se(e,t){if(!Array.isArray(e)||!e.length)return e;let r=S(S({},fn),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 Ke={mergeType:1,progressFn:null,joinRangesThatTouchEdges:!0};function Ye(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({},Ke),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({},Ke);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 mn=!0,we="Invariant failed";function Xe(e,t){if(!e){if(mn)throw new Error(we);var r=typeof t=="function"?t():t,n=r?we+": "+r:we;throw new Error(n)}}function ze(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($=>$).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($=>$).forEach(($,h)=>{if(r&&(n=Math.floor(l/u*10),n!==a&&(a=n,r(n))),!Array.isArray($))throw new TypeError(`ranges-apply: [THROW_ID_05] ranges array, second input arg., has ${h}th element not an array: ${JSON.stringify($,null,4)}, which is ${typeof $}`);if(!Number.isInteger($[0])){if(!Number.isInteger(+$[0])||+$[0]<0)throw new TypeError(`ranges-apply: [THROW_ID_06] ranges array, second input arg. has ${h}th element, array ${JSON.stringify($,null,0)}. Its first element is not an integer, string index, but ${typeof $[0]}, equal to: ${JSON.stringify($[0],null,4)}.`);o[h][0]=+o[h][0]}if(!Number.isInteger($[1])){if(!Number.isInteger(+$[1])||+$[1]<0)throw new TypeError(`ranges-apply: [THROW_ID_07] ranges array, second input arg. has ${h}th element, array ${JSON.stringify($,null,0)}. Its second element is not an integer, string index, but ${typeof $[1]}, equal to: ${JSON.stringify($[1],null,4)}.`);o[h][1]=+o[h][1]}l+=1});let c=Ye(o,{progressFn:$=>{r&&(n=10+Math.floor($/10),n!==a&&(a=n,r(n)))}});Xe(c);let s=c.length;if(s>0){let $=e.slice(c[s-1][1]);e=c.reduce((h,T,m,f)=>{r&&(n=20+Math.floor(m/s*80),n!==a&&(a=n,r(n)));let O=m===0?0:f[m-1][1],L=f[m][0];return`${h}${e.slice(O,L)}${f[m][2]||""}`},""),e+=$}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?`
12
+ `:"\r",s=l?"\r":`
13
+ `;if(!o)return o;let $=0,h=0,T="";for(let m=0,f=o.length;m<f;m++)(o[m]===c||o[m]===s&&o[m-1]!==c)&&h++,`\r
14
+ `.includes(o[m])||o[m]===r?($=0,o[m]===r?T+=o[m]:o[m]===c?h<=u&&(T+=o[m],o[m+1]===s&&(T+=o[m+1],m++)):o[m]===s&&(!o[m-1]||o[m-1]!==c)&&h<=u&&(T+=o[m])):($++,!o[m+1]&&!h&&(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 hn={strictlyTwoElementsInRangeArrays:!1,progressFn:null};function Ze(e,t){if(!Array.isArray(e)||!e.length)return e;let r=S(S({},hn),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 Qe={mergeType:1,progressFn:null,joinRangesThatTouchEdges:!0};function $n(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({},Qe),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:
15
+ ${JSON.stringify(t,null,4)} (type ${typeof t})`);else n=S({},Qe);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=Ze(a,{progressFn:s=>{l=Math.floor(s/5),l!==u&&(u=l,n.progressFn(l))}}):o=Ze(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 pn={limitToBeAddedWhitespace:!1,limitLinebreaksCount:1,mergeType:1},et=class{constructor(e){Ee(this,"ranges");Ee(this,"opts");let t=S(S({},pn),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){if(e==null&&t==null)return;if(M(e)&&!M(t)){if(Array.isArray(e)){if(e.length){if(e.some(o=>Array.isArray(o))){e.forEach(o=>{Array.isArray(o)&&this.add(...o)});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 o=this.last()[2]&&this.last()[2].length>0&&(!this.opts||!this.opts.mergeType||this.opts.mergeType===1)?`${this.last()[2]}${r}`:r;this.opts.limitToBeAddedWhitespace&&(o=se(o,this.opts.limitLinebreaksCount)),te(o)&&!o.length||(this.last()[2]=o)}}else{this.ranges||(this.ranges=[]);let o=r!==void 0&&!(te(r)&&!r.length)?[n,a,r&&this.opts.limitToBeAddedWhitespace?se(r,this.opts.limitLinebreaksCount):r]:[n,a];this.ranges.push(o)}}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=$n(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 tt(e){return typeof e=="string"?e.length?[e]:[]:e}function nt(e){return e&&typeof e=="object"&&!Array.isArray(e)}function le(e){return typeof e=="string"}var rt={cb:void 0,i:!1,trimBeforeMatching:!1,trimCharsBeforeMatching:[],maxMismatches:0,firstMustMatch:!1,lastMustMatch:!1,hungry:!1},bn=e=>e+1;function dn(e,t,r,n,a=!1,o=bn){let u=typeof r=="function"?r():r;if(+t<0&&a&&u==="EOL")return u;let l=S(S({},rt),n);if(t>=e.length&&!a)return!1;let c=a?1:r.length,s=0,$=!1,h=!1,T=!1,m=l.maxMismatches,f=t,O=!1,L=!1,p=!1;function b(){return s===1&&m<l.maxMismatches-1}for(;e[f];){let d=o(f);if(l.trimBeforeMatching&&e[f].trim()===""){if(!e[d]&&a&&r==="EOL")return!0;f=o(f);continue}if(l&&!l.i&&l.trimCharsBeforeMatching&&l.trimCharsBeforeMatching.includes(e[f])||(l==null?void 0:l.i)&&l.trimCharsBeforeMatching&&l.trimCharsBeforeMatching.map(A=>A.toLowerCase()).includes(e[f].toLowerCase())){if(a&&r==="EOL"&&!e[d])return!0;f=o(f);continue}let E=d>f?r[r.length-c]:r[c-1];if(!l.i&&e[f]===E||l.i&&e[f].toLowerCase()===E.toLowerCase()){if(O||(O=!0),T||(T=!0),c===r.length){if(L=!0,m!==l.maxMismatches)return!1}else c===1&&(p=!0);if(c-=1,s++,b())return!1;if(!c)return s!==r.length||m===l.maxMismatches||!$?f:!1}else if(!$&&!s&&($=!0),l.maxMismatches&&m&&f){m-=1;for(let A=0;A<=m;A++){let I=d>f?r[r.length-c+1+A]:r[c-2-A],V=e[o(f)];if(I&&(!l.i&&e[f]===I||l.i&&e[f].toLowerCase()===I.toLowerCase())&&(!l.firstMustMatch||c!==r.length)){if(s++,b())return!1;c-=2,O=!0;break}else if(V&&I&&(!l.i&&V===I||l.i&&V.toLowerCase()===I.toLowerCase())&&(!l.firstMustMatch||c!==r.length)){if(!s&&!l.hungry)return!1;c-=1,O=!0;break}else if(I===void 0&&m>=0&&O&&(!l.firstMustMatch||L)&&(!l.lastMustMatch||p))return f}O||(h=f)}else return f===0&&c===1&&!l.lastMustMatch&&T?0:!1;if(h!==!1&&h!==f&&(h=!1),c<1)return f;f=o(f)}if(c>0)return a&&u==="EOL"?!0:l&&l.maxMismatches>=c&&T?h||0:!1}function Oe(e,t,r,n,a){if(nt(a)&&Object.prototype.hasOwnProperty.call(a,"trimBeforeMatching")&&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({},rt),a);if(typeof o.trimCharsBeforeMatching=="string"&&(o.trimCharsBeforeMatching=tt(o.trimCharsBeforeMatching)),o.trimCharsBeforeMatching=o.trimCharsBeforeMatching.map($=>le($)?$:String($)),!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&&!nt(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?void 0:o.trimCharsBeforeMatching)&&o.trimCharsBeforeMatching.some(($,h)=>$.length>1?(c=h,s=$,!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 h,T=r;if((e==="matchLeftIncl"||e==="matchRight")&&(T+=1),e[5]==="L")for(let L=T;L--;){let p=t[L];if((!o.trimBeforeMatching||o.trimBeforeMatching&&p!==void 0&&p.trim())&&(!o.trimCharsBeforeMatching||!o.trimCharsBeforeMatching.length||p!==void 0&&!o.trimCharsBeforeMatching.includes(p))){h=L;break}}else if(e.startsWith("matchRight"))for(let L=T;L<t.length;L++){let p=t[L];if((!o.trimBeforeMatching||o.trimBeforeMatching&&p.trim())&&(!o.trimCharsBeforeMatching||!o.trimCharsBeforeMatching.length||!o.trimCharsBeforeMatching.includes(p))){h=L;break}}if(h===void 0)return!1;let m=t[h],f=h+1,O="";return f&&f>0&&(O=t.slice(0,f)),e[5]==="L"||h&&h>0&&(O=t.slice(h)),o.cb(m,O,h)}let $="";throw a||($=" 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!${$}`)}for(let $=0,h=u.length;$<h;$++){l=typeof u[$]=="function";let T=u[$],m,f,O="",L=r;e==="matchRight"?L+=1:e==="matchLeft"&&(L-=1);let p=dn(t,L,T,o,l,b=>e[5]==="L"?b-1:b+1);if(p&&l&&typeof T=="function"&&T()==="EOL")return T()&&(o.cb?o.cb(m,O,f):!0)?T():!1;if(Number.isInteger(p)&&(f=e.startsWith("matchLeft")?p-1:p+1,e[5]==="L"?O=t.slice(0,p):O=t.slice(f)),f<0&&(f=void 0),t[f]&&(m=t[f]),Number.isInteger(p)&&(o.cb?o.cb(m,O,f):!0))return T}return!1}function it(e,t,r,n){return Oe("matchLeft",e,t,r,n)}function Le(e,t,r,n){return Oe("matchRightIncl",e,t,r,n)}function k(e,t,r,n){return Oe("matchRight",e,t,r,n)}var Tn={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 opts.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 opts.to, is not a number! Currently it's given as ${typeof e.to}, equal to ${JSON.stringify(e.to,null,0)}`);if((e==null?void 0:e.str)&&!e.str[e.from]&&e.from!==e.to)throw new Error(`string-range-expander: [THROW_ID_05] The given input string opts.str ("${e.str}") must contain the character at index "from" ("${e.from}")`);if((e==null?void 0:e.str)&&!e.str[e.to-1])throw new Error(`string-range-expander: [THROW_ID_06] The given input string, opts.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 opts.extendToOneSide value is not recogniseable! 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({},Tn),e);if(Array.isArray(a.ifLeftSideIncludesThisThenCropTightly)){let s,$;if(a.ifLeftSideIncludesThisThenCropTightly.every((h,T)=>n(h)?!0:(s=T,$=h,!1)))a.ifLeftSideIncludesThisThenCropTightly=a.ifLeftSideIncludesThisThenCropTightly.join("");else throw new Error(`string-range-expander: [THROW_ID_09] The opts.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 $} (equal to ${JSON.stringify($,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,$=o.length;s<$;s++)if(!a.ifRightSideIncludesThisCropItToo.includes(o[s])&&((c=o[s])==null?void 0: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 ri=qe(at(),1),ii=qe(Xt(),1);var K="\xA0";function oi({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
22
  \r`.includes(e[t+1])||n&&e[t+1]===K))return t+1;if(e[t+2]&&(e[t+2].trim()||r&&`
23
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 D(e,t=0){return li({str:e,idx:t,stopAtNewlines:!1,stopAtRawNbsp:!1})}function si({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&&`
24
+ \r`.includes(e[a])||n&&e[a]===K)return a;return null}function D(e,t=0){return oi({str:e,idx:t,stopAtNewlines:!1,stopAtRawNbsp:!1})}function si({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
25
  \r`.includes(e[~-t])||n&&e[~-t]===K))return~-t;if(e[t-2]&&(e[t-2].trim()||r&&`
26
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 be(e,t=0){return si({str:e,idx:t,stopAtNewlines:!1,stopAtRawNbsp:!1})}var Zt="5.0.10";var ui=Zt,y=new tt({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 Y(e){return typeof e=="string"}function X(e){return typeof e=="string"&&e.toUpperCase()!==e.toLowerCase()}function gi(e,t){var fi;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:
27
+ \r`.includes(e[a])||n&&e[a]===K))return a;return null}function be(e,t=0){return si({str:e,idx:t,stopAtNewlines:!1,stopAtRawNbsp:!1})}var zt="5.0.13";var ai=zt,y=new et({limitToBeAddedWhitespace:!0}),Zt={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 X(e){return typeof e=="string"&&e.toUpperCase()!==e.toLowerCase()}function ui(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
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,Q=t.breakToTheLeftOf.length;i<Q;i++)if(!Y(t.breakToTheLeftOf[i]))throw new TypeError(`html-crush: [THROW_ID_05] the opts.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,s=null,c=!1,l=0,$=0,h=!1,T=!1,m=null,f=null,O=null,L=null,p,b=null,d=null,E=null,A=null,I=null,V=null,z=">};",Z="<",en="!",tn=">",nn="<",We="{},:;<>~+",de=We,Te=We,J=!0,_=e.length,rn=Math.floor(_/2),Je=.01,je;n.reportProgressFunc&&(je=Math.floor(n.reportProgressFuncTo-(n.reportProgressFuncTo-n.reportProgressFuncFrom)*Je-n.reportProgressFuncFrom));let R,oe=0,C=`
29
+ ${JSON.stringify(t.breakToTheLeftOf[i],null,4)}`)}let n=S(S({},Zt),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,$=0,h=!1,T=!1,m=null,f=null,O=null,L=null,p,b=null,d=null,E=null,A=null,I=null,V=null,z=">};",Z="<",Qt="!",en=">",tn="<",We="{},:;<>~+",de=We,Te=We,j=!0,_=e.length,nn=Math.floor(_/2),je=.01,Je;n.reportProgressFunc&&(Je=Math.floor(n.reportProgressFuncTo-(n.reportProgressFuncTo-n.reportProgressFuncFrom)*je-n.reportProgressFuncFrom));let R,oe=0,C=`
30
30
  `;if(e.includes(`\r
31
31
  `)?C=`\r
32
- `:e.includes("\r")&&(C="\r"),_){for(let i=0;i<_;i++){if(n.reportProgressFunc&&(_>1e3&&_<2e3?i===rn&&n.reportProgressFunc(Math.floor((n.reportProgressFuncTo-n.reportProgressFuncFrom)/2)):_>=2e3&&(R=n.reportProgressFuncFrom+Math.floor(i/_*(je||1)),R!==oe&&(oe=R,n.reportProgressFunc(R)))),$++,!p&&h&&e[i]==="}"&&e[i-1]==="}"&&(l+1>=n.lineLengthLimit?(y.push(i,i,C),l=0):(b=i,d=i,E=" ")),p&&typeof p=="number"&&i>=p&&(p=void 0),L!==null&&e.startsWith("<\/script",i)&&!X(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&&y.push(g+1,i);break}}L=null,p=!1,i+=8;continue}if(!p&&!h&&e.startsWith("<script",i)&&!X(e[i+7])){L=i,p=!0;let g="";(n.removeLineBreaks||n.removeIndentations)&&s!==null&&(s>0&&(g=C),y.push(s,i,g)),s=null,u=null}if(I!==null&&A===null&&!/\w/.test(e[i])){A=e.slice(I,i);let g=D(e,~-i);typeof g=="number"&&e[g]===">"&&!e[i].trim()&&D(e,i)?y.push(i,D(e,i)):g&&e[g]==="/"&&e[D(e,g)]===">"&&(!e[i].trim()&&D(e,i)&&y.push(i,D(e,i)),e[g+1]!==">"&&D(e,g+1)&&y.push(g+1,D(e,g+1)))}if(!p&&!h&&!m&&e[~-i]==="<"&&I===null&&(/\w/.test(e[i])?I=i:e[D(e,~-i)]==="/"&&/\w/.test(e[D(e,D(e,~-i))]||"")&&(I=D(e,D(e,~-i)))),!p&&(h||m)&&f!==null&&e[i]==="*"&&e[i+1]==="/"&&([b,d]=ae({str:e,from:f,to:i+2,ifLeftSideIncludesThisThenCropTightly:de||"",ifRightSideIncludesThisThenCropTightly:Te||""}),f=null,b!=null?y.push(b,d):(l+=1,i+=1),p=i+2),!p&&(h||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),!p&&!h&&!m&&O!==null){let g;e.startsWith("-->",i)?g=3:e[i]===">"&&e[i-1]==="]"&&(g=1),g&&([b,d]=ae({str:e,from:O,to:i+g}),O=null,b!=null?n.lineLengthLimit&&$-(d-b)>=n.lineLengthLimit?(y.push(b,d,C),$=-g):(y.push(b,d),$-=d-b):(l+=g-1,i+=g-1),p=i+g)}if(!p&&!h&&!m&&(e.startsWith("<!--",i)||n.removeHTMLComments===2&&e.startsWith("<![endif",i))&&O===null&&(e.startsWith("[if",i+4)?(T||(T=!0),n.removeHTMLComments===2&&(O=i)):n.removeHTMLComments&&(!T||n.removeHTMLComments===2)&&(O=i),o.removeHTMLComments||(o.removeHTMLComments=!0)),!p&&h&&f===null&&e.startsWith("</style",i)&&!X(e[i+7])?h=!1:!p&&!h&&f===null&&e.startsWith("<style",i)&&!X(e[i+6])&&(h=!0,(n.removeLineBreaks||n.removeIndentations)&&n.breakToTheLeftOf.includes("<style")&&e.startsWith(' type="text/css">',i+6)&&e[i+24]&&y.push(i+23,i+23,C)),!p&&!m&&`"'`.includes(e[i])&&e.endsWith("style=",i)&&(m=i),!p&&!e[i].trim())s===null&&(s=i);else if(!p&&!((h||m)&&f!==null)){if(s!==null){if(n.removeLineBreaks&&(l+=1),J)J=!1,(n.removeIndentations||n.removeLineBreaks)&&y.push(0,i);else if(n.removeIndentations&&!n.removeLineBreaks&&(!c&&u!==null&&i>u?y.push(u+1,i):s+1<i&&(e.endsWith("]>",s)||e.endsWith("-->",s)||e.startsWith("<![",i)||e.startsWith("<!--<![",i)?y.push(s,i):e[s]===" "?y.push(s+1,i):e[~-i]===" "?y.push(s,~-i):y.push(s,i," "))),n.removeLineBreaks||m){if(a.includes(e[i])&&Le(e,i,n.breakToTheLeftOf)){!(`\r
34
- `.includes(e[~-i])&&s===~-i)&&!(e[~-i]===`
35
- `&&e[i-2]==="\r"&&s===i-2)&&y.push(s,i,C),b=null,d=null,E=null,s=null,l=1;continue}let g=" ";e[i]==="<"&&k(e,i,n.mindTheInlineTags,{cb:j=>!j||!/\w/.test(j)})||(e[~-s]&&tn.includes(e[~-s])&&nn.includes(e[i])||(h||m)&&f===null&&(de.includes(e[~-s])||Te.includes(e[i]))||e.startsWith("!important",i)&&!T||m&&(e[~-s]==="'"||e[~-s]==='"')||e[~-s]==="}"&&e.startsWith("</style",i)||e[i]===">"&&(`'"`.includes(e[be(e,i)])||e[D(e,i)]==="<")||e[i]==="/"&&e[D(e,i)]===">")&&(g="",e[i]==="/"&&e[i+1]===">"&&D(e,i)&&D(e,i)>i+1&&(y.push(i+1,D(e,i)),l-=D(e,i)-i+1)),h&&e[i]==="}"&&s&&e[s-1]==="}"&&(g=" "),(g==null?void 0:g.length)&&(l+=1),n.lineLengthLimit?l>=n.lineLengthLimit||!e[i+1]||e[i]===">"||e[i]==="/"&&e[i+1]===">"?((l>n.lineLengthLimit||l===n.lineLengthLimit&&e[i+1]&&e[i+1].trim()&&!z.includes(e[i])&&!Z.includes(e[i+1]))&&(g=C,l=1),(l>n.lineLengthLimit||!(g===" "&&i===s+1))&&(y.push(s,i,g),u=null),b=null,d=null,E=null):(b===null||s<b)&&(b=s,d=i,E=g):i===s+1&&g===" "||y.push(s,i,g)}s=null,c||(c=!0)}else J&&(J=!1),n.removeLineBreaks&&(l+=1);c||(c=!0)}if(!p&&!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)||!ot(e,i,"<!--"))){y.push(i,i,C),b=null,d=null,E=null,l=1;continue}else if(n.lineLengthLimit&&l<=n.lineLengthLimit){if(!e[i+1]||Z.includes(e[i])&&!en.includes(e[i])||z.includes(e[i])||!e[i].trim()){if(b!==null&&d!==null&&(b!==d||(E==null?void 0:E.length))){let g=E;e[i].trim()&&e[i+1]&&e[i+1].trim()&&l+(E?E.length:0)>n.lineLengthLimit&&(g=C),(l+(g?g.length:0)>n.lineLengthLimit||!(g===" "&&d===b+1&&e[b]===" "))&&(e[~-b]==="}"&&e[d]==="{"||(y.push(b,d,g),u=null))}e[i].trim()&&(Z.includes(e[i])||e[~-i]&&z.includes(e[~-i]))&&Y(V)&&(!A||!n.mindTheInlineTags.includes(A))&&!(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)}))?(b=i,d=i,E=null):f===null&&b!==null&&(m||!n.mindTheInlineTags||!Array.isArray(n.mindTheInlineTags)||Array.isArray(n.mindTheInlineTags.length)&&!n.mindTheInlineTags.length||!Y(A)||Array.isArray(n.mindTheInlineTags)&&n.mindTheInlineTags.length&&Y(A)&&!n.mindTheInlineTags.includes(A))&&!(e[i]==="<"&&k(e,i,n.mindTheInlineTags,{trimCharsBeforeMatching:"/",cb:g=>!g||!/\w/.test(g)}))&&(b=null,d=null,E=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(b!==null&&d!==null&&(b!==d||(E==null?void 0:E.length))){let g=(E==null?void 0:E.length)?E.length:0;l-(d-b-g)-1>n.lineLengthLimit||(y.push(b,d,E),l-(d-b-g)-1===n.lineLengthLimit&&(y.push(i,i,C),l=0),b=null,d=null,E=null)}else y.push(i,i,C),l=0;else e[i+1]&&z.includes(e[i])&&Y(A)&&Array.isArray(n.mindTheInlineTags)&&n.mindTheInlineTags.length&&!n.mindTheInlineTags.includes(A)?b!==null&&d!==null&&(b!==d||(E==null?void 0:E.length))||(y.push(i+1,i+1,C),l=0):e[i].trim()&&(e[i+1]||b!==null&&d!==null&&(b!==d||(E==null?void 0:E.length))&&y.push(b,d,C))}if(!p&&!J&&n.removeLineBreaks&&n.lineLengthLimit&&l>=n.lineLengthLimit&&b!==null&&d!==null&&!z.includes(e[i])&&!Z.includes(e[i])&&!"/".includes(e[i])&&!(l===n.lineLengthLimit&&e[i+1]&&!e[i+1].trim())){let g=C;e[i+1]&&!e[i+1].trim()&&l===n.lineLengthLimit&&(g=E),g===C&&!e[~-b].trim()&&be(e,b)&&(b=be(e,b)+1),y.push(b,d,g),l=i-d,e[i].length&&(l+=1),b=null,d=null,E=null}if((!p&&e[i]===`
32
+ `:e.includes("\r")&&(C="\r"),_){for(let i=0;i<_;i++){if(n.reportProgressFunc&&(_>1e3&&_<2e3?i===nn&&n.reportProgressFunc(Math.floor((n.reportProgressFuncTo-n.reportProgressFuncFrom)/2)):_>=2e3&&(R=n.reportProgressFuncFrom+Math.floor(i/_*(Je||1)),R!==oe&&(oe=R,n.reportProgressFunc(R)))),$++,!p&&h&&e[i]==="}"&&e[i-1]==="}"&&(s+1>=n.lineLengthLimit?(y.push(i,i,C),s=0):(b=i,d=i,E=" ")),p&&typeof p=="number"&&i>=p&&(p=void 0),L!==null&&e.startsWith("<\/script",i)&&!X(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&&y.push(g+1,i);break}}L=null,p=!1,i+=8;continue}if(!p&&!h&&e.startsWith("<script",i)&&!X(e[i+7])){L=i,p=!0;let g="";(n.removeLineBreaks||n.removeIndentations)&&l!==null&&(l>0&&(g=C),y.push(l,i,g)),l=null,u=null}if(I!==null&&A===null&&!/\w/.test(e[i])){A=e.slice(I,i);let g=D(e,~-i);typeof g=="number"&&e[g]===">"&&!e[i].trim()&&D(e,i)?y.push(i,D(e,i)):g&&e[g]==="/"&&e[D(e,g)]===">"&&(!e[i].trim()&&D(e,i)&&y.push(i,D(e,i)),e[g+1]!==">"&&D(e,g+1)&&y.push(g+1,D(e,g+1)))}if(!p&&!h&&!m&&e[~-i]==="<"&&I===null&&(/\w/.test(e[i])?I=i:e[D(e,~-i)]==="/"&&/\w/.test(e[D(e,D(e,~-i))]||"")&&(I=D(e,D(e,~-i)))),!p&&(h||m)&&f!==null&&e[i]==="*"&&e[i+1]==="/"&&([b,d]=ae({str:e,from:f,to:i+2,ifLeftSideIncludesThisThenCropTightly:de||"",ifRightSideIncludesThisThenCropTightly:Te||""}),f=null,b!=null?y.push(b,d):(s+=1,i+=1),p=i+2),!p&&(h||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),!p&&!h&&!m&&O!==null){let g;e.startsWith("-->",i)?g=3:e[i]===">"&&e[i-1]==="]"&&(g=1),g&&([b,d]=ae({str:e,from:O,to:i+g}),O=null,b!=null?n.lineLengthLimit&&$-(d-b)>=n.lineLengthLimit?(y.push(b,d,C),$=-g):(y.push(b,d),$-=d-b):(s+=g-1,i+=g-1),p=i+g)}if(!p&&!h&&!m&&(e.startsWith("<!--",i)||n.removeHTMLComments===2&&e.startsWith("<![endif",i))&&O===null&&(e.startsWith("[if",i+4)?(T||(T=!0),n.removeHTMLComments===2&&(O=i)):n.removeHTMLComments&&(!T||n.removeHTMLComments===2)&&(O=i),o.removeHTMLComments||(o.removeHTMLComments=!0)),!p&&h&&f===null&&e.startsWith("</style",i)&&!X(e[i+7])?h=!1:!p&&!h&&f===null&&e.startsWith("<style",i)&&!X(e[i+6])&&(h=!0,(n.removeLineBreaks||n.removeIndentations)&&n.breakToTheLeftOf.includes("<style")&&e.startsWith(' type="text/css">',i+6)&&e[i+24]&&y.push(i+23,i+23,C)),!p&&!m&&`"'`.includes(e[i])&&e.endsWith("style=",i)&&(m=i),!p&&!e[i].trim())l===null&&(l=i);else if(!p&&!((h||m)&&f!==null)){if(l!==null){if(n.removeLineBreaks&&(s+=1),j)j=!1,(n.removeIndentations||n.removeLineBreaks)&&y.push(0,i);else if(n.removeIndentations&&!n.removeLineBreaks&&(!c&&u!==null&&i>u?y.push(u+1,i):l+1<i&&(e.endsWith("]>",l)||e.endsWith("-->",l)||e.startsWith("<![",i)||e.startsWith("<!--<![",i)?y.push(l,i):e[l]===" "?y.push(l+1,i):e[~-i]===" "?y.push(l,~-i):y.push(l,i," "))),n.removeLineBreaks||m){if(a.includes(e[i])&&Le(e,i,n.breakToTheLeftOf)){!(`\r
34
+ `.includes(e[~-i])&&l===~-i)&&!(e[~-i]===`
35
+ `&&e[i-2]==="\r"&&l===i-2)&&y.push(l,i,C),b=null,d=null,E=null,l=null,s=1;continue}let g=" ";e[i]==="<"&&k(e,i,n.mindTheInlineTags,{cb:J=>!J||!/\w/.test(J)})||(e[~-l]&&en.includes(e[~-l])&&tn.includes(e[i])||(h||m)&&f===null&&(de.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[be(e,i)])||e[D(e,i)]==="<")||e[i]==="/"&&e[D(e,i)]===">")&&(g="",e[i]==="/"&&e[i+1]===">"&&D(e,i)&&D(e,i)>i+1&&(y.push(i+1,D(e,i)),s-=D(e,i)-i+1)),h&&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()&&!z.includes(e[i])&&!Z.includes(e[i+1]))&&(g=C,s=1),(s>n.lineLengthLimit||!(g===" "&&i===l+1))&&(y.push(l,i,g),u=null),b=null,d=null,E=null):(b===null||l<b)&&(b=l,d=i,E=g):i===l+1&&g===" "||y.push(l,i,g)}l=null,c||(c=!0)}else j&&(j=!1),n.removeLineBreaks&&(s+=1);c||(c=!0)}if(!p&&!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)||!it(e,i,"<!--"))){y.push(i,i,C),b=null,d=null,E=null,s=1;continue}else if(n.lineLengthLimit&&s<=n.lineLengthLimit){if(!e[i+1]||Z.includes(e[i])&&!Qt.includes(e[i])||z.includes(e[i])||!e[i].trim()){if(b!==null&&d!==null&&(b!==d||(E==null?void 0:E.length))){let g=E;e[i].trim()&&e[i+1]&&e[i+1].trim()&&s+(E?E.length:0)>n.lineLengthLimit&&(g=C),(s+(g?g.length:0)>n.lineLengthLimit||!(g===" "&&d===b+1&&e[b]===" "))&&(e[~-b]==="}"&&e[d]==="{"||(y.push(b,d,g),u=null))}e[i].trim()&&(Z.includes(e[i])||e[~-i]&&z.includes(e[~-i]))&&Y(V)&&(!A||!n.mindTheInlineTags.includes(A))&&!(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)}))?(b=i,d=i,E=null):f===null&&b!==null&&(m||!n.mindTheInlineTags||!Array.isArray(n.mindTheInlineTags)||Array.isArray(n.mindTheInlineTags.length)&&!n.mindTheInlineTags.length||!Y(A)||Array.isArray(n.mindTheInlineTags)&&n.mindTheInlineTags.length&&Y(A)&&!n.mindTheInlineTags.includes(A))&&!(e[i]==="<"&&k(e,i,n.mindTheInlineTags,{trimCharsBeforeMatching:"/",cb:g=>!g||!/\w/.test(g)}))&&(b=null,d=null,E=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(b!==null&&d!==null&&(b!==d||(E==null?void 0:E.length))){let g=E!=null&&E.length?E.length:0;s-(d-b-g)-1>n.lineLengthLimit||(y.push(b,d,E),s-(d-b-g)-1===n.lineLengthLimit&&(y.push(i,i,C),s=0),b=null,d=null,E=null)}else y.push(i,i,C),s=0;else e[i+1]&&z.includes(e[i])&&Y(A)&&Array.isArray(n.mindTheInlineTags)&&n.mindTheInlineTags.length&&!n.mindTheInlineTags.includes(A)?b!==null&&d!==null&&(b!==d||(E==null?void 0:E.length))||(y.push(i+1,i+1,C),s=0):e[i].trim()&&(e[i+1]||b!==null&&d!==null&&(b!==d||(E==null?void 0:E.length))&&y.push(b,d,C))}if(!p&&!j&&n.removeLineBreaks&&n.lineLengthLimit&&s>=n.lineLengthLimit&&b!==null&&d!==null&&!z.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=E),g===C&&!e[~-b].trim()&&be(e,b)&&(b=be(e,b)+1),y.push(b,d,g),s=i-d,e[i].length&&(s+=1),b=null,d=null,E=null}if((!p&&e[i]===`
36
36
  `||e[i]==="\r"&&(!e[i+1]||e[i+1]&&e[i+1]!==`
37
- `))&&(u=i,c&&(c=!1),!n.removeLineBreaks&&s!==null&&s<i&&e[i+1]&&e[i+1]!=="\r"&&e[i+1]!==`
38
- `&&y.push(s,i)),e[i+1]||(h&&f!==null?y.push(...ae({str:e,from:f,to:i,ifLeftSideIncludesThisThenCropTightly:de||"",ifRightSideIncludesThisThenCropTightly:Te||""})):s&&e[i]!==`
39
- `&&e[i]!=="\r"?y.push(s,i+1):s&&(e[i]==="\r"&&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
+ `&&y.push(l,i)),e[i+1]||(h&&f!==null?y.push(...ae({str:e,from:f,to:i,ifLeftSideIncludesThisThenCropTightly:de||"",ifRightSideIncludesThisThenCropTightly:Te||""})):l&&e[i]!==`
39
+ `&&e[i]!=="\r"?y.push(l,i+1):l&&(e[i]==="\r"&&e[i+1]===`
40
40
  `||e[i]===`
41
- `&&e[i-1]!=="\r")&&y.push(s,i)),!p&&m&&m<i&&e[m]===e[i]&&(m=null),!p&&!h&&e.startsWith("<pre",i)&&!X(e[i+4])){let g=e.indexOf("</pre",i+5);g>0&&(p=g)}if(!p&&!h&&e.startsWith("<code",i)&&!X(e[i+5])){let g=e.indexOf("</code",i+5);g>0&&(p=g)}if(!p&&e.startsWith("<![CDATA[",i)){let g=e.indexOf("]]>",i+9);g>0&&(p=g)}!p&&!h&&!m&&I!==null&&e[i]===">"&&(e[D(e,i)]==="<"&&(V=A),I=null,A=null),e[i]==="<"&&V!==null&&(V=null),h&&e[i]==="{"&&e[i+1]==="{"&&e.indexOf("}}")!==-1&&(p=e.indexOf("}}")+2);let Q=!0}if(y.current()){let i=y.current();y.wipe();let Q=n.reportProgressFuncTo-(n.reportProgressFuncTo-n.reportProgressFuncFrom)*Je,g=Ze(e,i,on=>{n.reportProgressFunc&&_>=2e3&&(R=Math.floor(Q+(n.reportProgressFuncTo-Q)*(on/100)),R!==oe&&(oe=R,n.reportProgressFunc(R)))}),j=g.length;return{log:{timeTakenInMilliseconds:Date.now()-r,originalLength:_,cleanedLength:j,bytesSaved:Math.max(_-j,0),percentageReducedOfOriginal:_?Math.round(Math.max(_-j,0)*100/_):0},ranges:i,applicableOpts:o,result:g}}}return{log:{timeTakenInMilliseconds:Date.now()-r,originalLength:_,cleanedLength:_,bytesSaved:0,percentageReducedOfOriginal:0},applicableOpts:o,ranges:null,result:e}}return fn(ci);})();
41
+ `&&e[i-1]!=="\r")&&y.push(l,i)),!p&&m&&m<i&&e[m]===e[i]&&(m=null),!p&&!h&&e.startsWith("<pre",i)&&!X(e[i+4])){let g=e.indexOf("</pre",i+5);g>0&&(p=g)}if(!p&&!h&&e.startsWith("<code",i)&&!X(e[i+5])){let g=e.indexOf("</code",i+5);g>0&&(p=g)}if(!p&&e.startsWith("<![CDATA[",i)){let g=e.indexOf("]]>",i+9);g>0&&(p=g)}!p&&!h&&!m&&I!==null&&e[i]===">"&&(e[D(e,i)]==="<"&&(V=A),I=null,A=null),e[i]==="<"&&V!==null&&(V=null),h&&e[i]==="{"&&e[i+1]==="{"&&e.indexOf("}}")!==-1&&(p=e.indexOf("}}")+2);let Q=!0}if(y.current()){let i=y.current();y.wipe();let Q=n.reportProgressFuncTo-(n.reportProgressFuncTo-n.reportProgressFuncFrom)*je,g=ze(e,i,rn=>{n.reportProgressFunc&&_>=2e3&&(R=Math.floor(Q+(n.reportProgressFuncTo-Q)*(rn/100)),R!==oe&&(oe=R,n.reportProgressFunc(R)))}),J=g.length;return{log:{timeTakenInMilliseconds:Date.now()-r,originalLength:_,cleanedLength:J,bytesSaved:Math.max(_-J,0),percentageReducedOfOriginal:_?Math.round(Math.max(_-J,0)*100/_):0},ranges:i,applicableOpts:o,result:g}}}return{log:{timeTakenInMilliseconds:Date.now()-r,originalLength:_,cleanedLength:_,bytesSaved:0,percentageReducedOfOriginal:0},applicableOpts:o,ranges:null,result:e}}return cn(gi);})();
42
42
  /**
43
43
  * @name arrayiffy-if-string
44
44
  * @fileoverview Put non-empty strings into arrays, turn empty-ones into empty arrays. Bypass everything else.
45
- * @version 4.0.10
45
+ * @version 4.0.12
46
46
  * @author Roy Revelt, Codsen Ltd
47
47
  * @license MIT
48
48
  * {@link https://codsen.com/os/arrayiffy-if-string/}
@@ -50,7 +50,7 @@ ${JSON.stringify(t.breakToTheLeftOf[i],null,4)}`)}let n=S(S({},Qt),t);typeof n.r
50
50
  /**
51
51
  * @name ranges-apply
52
52
  * @fileoverview Take an array of string index ranges, delete/replace the string according to them
53
- * @version 6.0.10
53
+ * @version 6.0.12
54
54
  * @author Roy Revelt, Codsen Ltd
55
55
  * @license MIT
56
56
  * {@link https://codsen.com/os/ranges-apply/}
@@ -58,7 +58,7 @@ ${JSON.stringify(t.breakToTheLeftOf[i],null,4)}`)}let n=S(S({},Qt),t);typeof n.r
58
58
  /**
59
59
  * @name ranges-merge
60
60
  * @fileoverview Merge and sort string index ranges
61
- * @version 8.0.10
61
+ * @version 8.0.12
62
62
  * @author Roy Revelt, Codsen Ltd
63
63
  * @license MIT
64
64
  * {@link https://codsen.com/os/ranges-merge/}
@@ -66,7 +66,7 @@ ${JSON.stringify(t.breakToTheLeftOf[i],null,4)}`)}let n=S(S({},Qt),t);typeof n.r
66
66
  /**
67
67
  * @name ranges-push
68
68
  * @fileoverview Gather string index ranges
69
- * @version 6.0.10
69
+ * @version 6.0.12
70
70
  * @author Roy Revelt, Codsen Ltd
71
71
  * @license MIT
72
72
  * {@link https://codsen.com/os/ranges-push/}
@@ -74,7 +74,7 @@ ${JSON.stringify(t.breakToTheLeftOf[i],null,4)}`)}let n=S(S({},Qt),t);typeof n.r
74
74
  /**
75
75
  * @name ranges-sort
76
76
  * @fileoverview Sort string index ranges
77
- * @version 5.0.10
77
+ * @version 5.0.12
78
78
  * @author Roy Revelt, Codsen Ltd
79
79
  * @license MIT
80
80
  * {@link https://codsen.com/os/ranges-sort/}
@@ -82,7 +82,7 @@ ${JSON.stringify(t.breakToTheLeftOf[i],null,4)}`)}let n=S(S({},Qt),t);typeof n.r
82
82
  /**
83
83
  * @name string-collapse-leading-whitespace
84
84
  * @fileoverview Collapse the leading and trailing whitespace of a string
85
- * @version 6.0.10
85
+ * @version 6.0.12
86
86
  * @author Roy Revelt, Codsen Ltd
87
87
  * @license MIT
88
88
  * {@link https://codsen.com/os/string-collapse-leading-whitespace/}
@@ -90,7 +90,7 @@ ${JSON.stringify(t.breakToTheLeftOf[i],null,4)}`)}let n=S(S({},Qt),t);typeof n.r
90
90
  /**
91
91
  * @name string-left-right
92
92
  * @fileoverview Looks up the first non-whitespace character to the left/right of a given index
93
- * @version 5.0.10
93
+ * @version 5.0.12
94
94
  * @author Roy Revelt, Codsen Ltd
95
95
  * @license MIT
96
96
  * {@link https://codsen.com/os/string-left-right/}
@@ -98,7 +98,7 @@ ${JSON.stringify(t.breakToTheLeftOf[i],null,4)}`)}let n=S(S({},Qt),t);typeof n.r
98
98
  /**
99
99
  * @name string-match-left-right
100
100
  * @fileoverview Match substrings on the left or right of a given index, ignoring whitespace
101
- * @version 8.0.10
101
+ * @version 8.1.0
102
102
  * @author Roy Revelt, Codsen Ltd
103
103
  * @license MIT
104
104
  * {@link https://codsen.com/os/string-match-left-right/}
@@ -106,7 +106,7 @@ ${JSON.stringify(t.breakToTheLeftOf[i],null,4)}`)}let n=S(S({},Qt),t);typeof n.r
106
106
  /**
107
107
  * @name string-range-expander
108
108
  * @fileoverview Expands string index ranges within whitespace boundaries until letters are met
109
- * @version 3.0.10
109
+ * @version 3.0.12
110
110
  * @author Roy Revelt, Codsen Ltd
111
111
  * @license MIT
112
112
  * {@link https://codsen.com/os/string-range-expander/}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "html-crush",
3
- "version": "5.0.10",
3
+ "version": "5.0.13",
4
4
  "description": "Minifies HTML/CSS: valid or broken, pure or mixed with other languages",
5
5
  "keywords": [
6
6
  "breaks",
@@ -45,15 +45,18 @@
45
45
  "scripts": {
46
46
  "build": "node '../../ops/scripts/esbuild.js' && yarn run dts",
47
47
  "dev": "DEV=true node '../../ops/scripts/esbuild.js' && yarn run dts",
48
- "dts": "rollup -c",
48
+ "devtest": "c8 yarn run unit && yarn run examples && yarn run lint",
49
+ "dts": "rollup -c && yarn run prettier 'types/index.d.ts' --write",
49
50
  "examples": "node '../../ops/scripts/run-examples.js'",
50
- "lect": "node '../../ops/lect/lect.js'",
51
+ "lect": "node '../../ops/lect/lect.js' && yarn run prettier 'README.md' '.all-contributorsrc' 'rollup.config.js' --write",
51
52
  "letspublish": "yarn publish || :",
52
53
  "lint": "eslint . --fix",
53
54
  "perf": "node perf/check.js",
54
55
  "prepare": "echo 'ready'",
56
+ "prettier": "prettier",
57
+ "prettier:format": "prettier --write '**/*.{ts,tsx,md}' --no-error-on-unmatched-pattern",
55
58
  "pretest": "yarn run lect && yarn run build",
56
- "test": "c8 yarn run unit && yarn run examples && yarn run lint",
59
+ "test": "yarn run devtest",
57
60
  "unit": "uvu test"
58
61
  },
59
62
  "engines": {
@@ -74,11 +77,11 @@
74
77
  }
75
78
  },
76
79
  "dependencies": {
77
- "ranges-apply": "^6.0.10",
78
- "ranges-push": "^6.0.10",
79
- "string-left-right": "^5.0.10",
80
- "string-match-left-right": "^8.0.10",
81
- "string-range-expander": "^3.0.10",
82
- "test-mixer": "^3.0.10"
80
+ "ranges-apply": "^6.0.12",
81
+ "ranges-push": "^6.0.12",
82
+ "string-left-right": "^5.0.12",
83
+ "string-match-left-right": "^8.1.0",
84
+ "string-range-expander": "^3.0.12",
85
+ "test-mixer": "^3.0.12"
83
86
  }
84
87
  }
package/types/index.d.ts CHANGED
@@ -1,34 +1,36 @@
1
- declare type Range = [from: number, to: number] | [from: number, to: number, whatToInsert: string | null | undefined];
1
+ declare type Range =
2
+ | [from: number, to: number]
3
+ | [from: number, to: number, whatToInsert: string | null | undefined];
2
4
  declare type Ranges = Range[] | null;
3
5
 
4
6
  declare const version: string;
5
7
  interface Opts {
6
- lineLengthLimit: number;
7
- removeIndentations: boolean;
8
- removeLineBreaks: boolean;
9
- removeHTMLComments: boolean | 0 | 1 | 2;
10
- removeCSSComments: boolean;
11
- reportProgressFunc: null | ((percDone: number) => void);
12
- reportProgressFuncFrom: number;
13
- reportProgressFuncTo: number;
14
- breakToTheLeftOf: string[];
15
- mindTheInlineTags: string[];
8
+ lineLengthLimit: number;
9
+ removeIndentations: boolean;
10
+ removeLineBreaks: boolean;
11
+ removeHTMLComments: boolean | 0 | 1 | 2;
12
+ removeCSSComments: boolean;
13
+ reportProgressFunc: null | ((percDone: number) => void);
14
+ reportProgressFuncFrom: number;
15
+ reportProgressFuncTo: number;
16
+ breakToTheLeftOf: string[];
17
+ mindTheInlineTags: string[];
16
18
  }
17
19
  declare const defaults: Opts;
18
20
  interface Res {
19
- log: {
20
- timeTakenInMilliseconds: number;
21
- originalLength: number;
22
- cleanedLength: number;
23
- bytesSaved: number;
24
- percentageReducedOfOriginal: number;
25
- };
26
- applicableOpts: {
27
- removeHTMLComments: boolean;
28
- removeCSSComments: boolean;
29
- };
30
- ranges: Ranges;
31
- result: string;
21
+ log: {
22
+ timeTakenInMilliseconds: number;
23
+ originalLength: number;
24
+ cleanedLength: number;
25
+ bytesSaved: number;
26
+ percentageReducedOfOriginal: number;
27
+ };
28
+ applicableOpts: {
29
+ removeHTMLComments: boolean;
30
+ removeCSSComments: boolean;
31
+ };
32
+ ranges: Ranges;
33
+ result: string;
32
34
  }
33
35
  /**
34
36
  * Minifies HTML/CSS: valid or broken, pure or mixed with other languages