html-minifier-next 2.1.8 → 3.0.0

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/README.md CHANGED
@@ -131,25 +131,25 @@ How does HTML Minifier Next compare to other solutions, like [minimize](https://
131
131
 
132
132
  | Site | Original Size (KB) | HTML Minifier Next | minimize | html­compressor.com | htmlnano | minify-html |
133
133
  | --- | --- | --- | --- | --- | --- | --- |
134
- | [A List Apart](https://alistapart.com/) | 63 | **54** | 58 | 57 | 55 | 56 |
135
- | [Amazon](https://www.amazon.com/) | 5 | **3** | **3** | **3** | **3** | n/a |
136
- | [Apple](https://www.apple.com/) | 212 | **171** | 198 | 195 | 189 | 194 |
137
- | [BBC](https://www.bbc.co.uk/) | 742 | **683** | 736 | n/a | 698 | 699 |
138
- | [CSS-Tricks](https://css-tricks.com/) | 11 | **6** | 11 | 10 | 7 | n/a |
139
- | [ECMAScript](https://tc39.es/ecma262/) | 7205 | **6315** | 6585 | n/a | 6532 | 6538 |
140
- | [EFF](https://www.eff.org/) | 60 | **51** | 55 | 55 | 54 | 53 |
141
- | [FAZ](https://www.faz.net/aktuell/) | 1847 | 1728 | 1764 | n/a | **1630** | n/a |
142
- | [Frontend Dogma](https://frontenddogma.com/) | 117 | **112** | 126 | 117 | 124 | 117 |
143
- | [Google](https://www.google.com/) | 18 | **16** | 17 | 17 | **16** | n/a |
144
- | [Ground News](https://ground.news/) | 1509 | **1287** | 1495 | n/a | 1386 | n/a |
145
- | [HTML](https://html.spec.whatwg.org/multipage/) | 149 | **146** | 155 | 148 | 153 | 148 |
146
- | [Leanpub](https://leanpub.com/) | 1361 | **1143** | 1355 | n/a | 1150 | n/a |
147
- | [Mastodon](https://mastodon.social/explore) | 35 | **25** | 33 | 33 | 30 | 33 |
134
+ | [A List Apart](https://alistapart.com/) | 62 | **53** | 58 | 56 | 54 | 55 |
135
+ | [Amazon](https://www.amazon.com/) | 715 | **642** | 701 | n/a | n/a | n/a |
136
+ | [Apple](https://www.apple.com/) | 184 | **143** | 170 | 167 | 161 | 166 |
137
+ | [BBC](https://www.bbc.co.uk/) | 618 | **568** | 613 | n/a | 580 | 582 |
138
+ | [CSS-Tricks](https://css-tricks.com/) | 161 | **121** | 148 | 145 | 126 | 144 |
139
+ | [ECMAScript](https://tc39.es/ecma262/) | 7233 | **6338** | 6610 | n/a | 6557 | 6563 |
140
+ | [EFF](https://www.eff.org/) | 57 | **48** | 51 | 51 | 51 | 49 |
141
+ | [FAZ](https://www.faz.net/aktuell/) | 1876 | 1753 | 1790 | n/a | **1652** | n/a |
142
+ | [Frontend Dogma](https://frontenddogma.com/) | 119 | **114** | 128 | 118 | 125 | 119 |
143
+ | [Google](https://www.google.com/) | 18 | **17** | 18 | 18 | **17** | n/a |
144
+ | [Ground News](https://ground.news/) | 1840 | **1591** | 1827 | n/a | 1689 | n/a |
145
+ | [HTML](https://html.spec.whatwg.org/multipage/) | 149 | **147** | 155 | 148 | 153 | 149 |
146
+ | [Leanpub](https://leanpub.com/) | 1567 | **1292** | 1561 | n/a | 1299 | n/a |
147
+ | [Mastodon](https://mastodon.social/explore) | 35 | **26** | 34 | 34 | 30 | 33 |
148
148
  | [MDN](https://developer.mozilla.org/en-US/) | 104 | **62** | 67 | 68 | 64 | n/a |
149
- | [Middle East Eye](https://www.middleeasteye.net/) | 221 | **194** | 201 | 202 | 201 | 199 |
150
- | [SitePoint](https://www.sitepoint.com/) | 469 | **338** | 466 | n/a | 408 | 449 |
151
- | [United Nations](https://www.un.org/en/) | 153 | **116** | 132 | 125 | 123 | 127 |
152
- | [W3C](https://www.w3.org/) | 49 | **35** | 40 | 38 | 37 | 38 |
149
+ | [Middle East Eye](https://www.middleeasteye.net/) | 224 | **197** | 204 | 204 | 204 | 201 |
150
+ | [SitePoint](https://www.sitepoint.com/) | 476 | **345** | 473 | n/a | 415 | 456 |
151
+ | [United Nations](https://www.un.org/en/) | 151 | **114** | 130 | 123 | 121 | 124 |
152
+ | [W3C](https://www.w3.org/) | 50 | **36** | 41 | 39 | 39 | 39 |
153
153
 
154
154
  ## Options quick reference
155
155
 
@@ -191,7 +191,7 @@ Most of the options are disabled by default.
191
191
  | `removeEmptyAttributes` | [Remove all attributes with whitespace-only values](http://perfectionkills.com/experimenting-with-html-minifier#remove_empty_or_blank_attributes) | `false` (could be `true`, `Function(attrName, tag)`) |
192
192
  | `removeEmptyElements` | [Remove all elements with empty contents](http://perfectionkills.com/experimenting-with-html-minifier#remove_empty_elements) | `false` |
193
193
  | `removeOptionalTags` | [Remove optional tags](http://perfectionkills.com/experimenting-with-html-minifier#remove_optional_tags) | `false` |
194
- | `removeRedundantAttributes` | [Remove attributes when value matches default.](http://perfectionkills.com/experimenting-with-html-minifier#remove_redundant_attributes) | `false` |
194
+ | `removeRedundantAttributes` | [Remove attributes when value matches default](https://meiert.com/blog/optional-html/#toc-attribute-values) | `false` |
195
195
  | `removeScriptTypeAttributes` | Remove `type="text/javascript"` from `script` elements; other `type` attribute values are left intact | `false` |
196
196
  | `removeStyleLinkTypeAttributes`| Remove `type="text/css"` from `style` and `link` elements; other `type` attribute values are left intact | `false` |
197
197
  | `removeTagWhitespace` | Remove space between attributes whenever possible; **note that this will result in invalid HTML** | `false` |
@@ -647,34 +647,58 @@ function attributesInclude(attributes, attribute) {
647
647
  return false;
648
648
  }
649
649
 
650
- function isAttributeRedundant(tag, attrName, attrValue, attrs) {
651
- attrValue = attrValue ? trimWhitespace(attrValue.toLowerCase()) : '';
652
-
653
- return (
654
- (tag === 'script' &&
655
- attrName === 'language' &&
656
- attrValue === 'javascript') ||
650
+ // Default attribute values (could apply to any element)
651
+ const generalDefaults = {
652
+ autocorrect: 'on',
653
+ fetchpriority: 'auto',
654
+ loading: 'eager',
655
+ popovertargetaction: 'toggle'
656
+ };
657
657
 
658
- (tag === 'form' &&
659
- attrName === 'method' &&
660
- attrValue === 'get') ||
658
+ // Tag-specific default attribute values
659
+ const tagDefaults = {
660
+ area: { shape: 'rect' },
661
+ button: { type: 'submit' },
662
+ form: {
663
+ enctype: 'application/x-www-form-urlencoded',
664
+ method: 'get'
665
+ },
666
+ html: { dir: 'ltr' },
667
+ img: { decoding: 'auto' },
668
+ input: {
669
+ colorspace: 'limited-srgb',
670
+ type: 'text'
671
+ },
672
+ marquee: {
673
+ behavior: 'scroll',
674
+ direction: 'left'
675
+ },
676
+ style: { media: 'all' },
677
+ textarea: { wrap: 'soft' },
678
+ track: { kind: 'subtitles' }
679
+ };
661
680
 
662
- (tag === 'input' &&
663
- attrName === 'type' &&
664
- attrValue === 'text') ||
681
+ function isAttributeRedundant(tag, attrName, attrValue, attrs) {
682
+ attrValue = attrValue ? trimWhitespace(attrValue.toLowerCase()) : '';
665
683
 
666
- (tag === 'script' &&
667
- attrName === 'charset' &&
668
- !attributesInclude(attrs, 'src')) ||
684
+ // Legacy attributes
685
+ if (tag === 'script' && attrName === 'language' && attrValue === 'javascript') {
686
+ return true;
687
+ }
688
+ if (tag === 'script' && attrName === 'charset' && !attributesInclude(attrs, 'src')) {
689
+ return true;
690
+ }
691
+ if (tag === 'a' && attrName === 'name' && attributesInclude(attrs, 'id')) {
692
+ return true;
693
+ }
669
694
 
670
- (tag === 'a' &&
671
- attrName === 'name' &&
672
- attributesInclude(attrs, 'id')) ||
695
+ // Check general defaults
696
+ if (generalDefaults[attrName] === attrValue) {
697
+ return true;
698
+ }
673
699
 
674
- (tag === 'area' &&
675
- attrName === 'shape' &&
676
- attrValue === 'rect')
677
- );
700
+ // Check tag-specific defaults
701
+ return tagDefaults[tag]?.[attrName] === attrValue;
678
702
  }
679
703
 
680
704
  // https://mathiasbynens.be/demo/javascript-mime-type
@@ -60837,34 +60837,58 @@ function attributesInclude(attributes, attribute) {
60837
60837
  return false;
60838
60838
  }
60839
60839
 
60840
- function isAttributeRedundant(tag, attrName, attrValue, attrs) {
60841
- attrValue = attrValue ? trimWhitespace(attrValue.toLowerCase()) : '';
60842
-
60843
- return (
60844
- (tag === 'script' &&
60845
- attrName === 'language' &&
60846
- attrValue === 'javascript') ||
60840
+ // Default attribute values (could apply to any element)
60841
+ const generalDefaults = {
60842
+ autocorrect: 'on',
60843
+ fetchpriority: 'auto',
60844
+ loading: 'eager',
60845
+ popovertargetaction: 'toggle'
60846
+ };
60847
60847
 
60848
- (tag === 'form' &&
60849
- attrName === 'method' &&
60850
- attrValue === 'get') ||
60848
+ // Tag-specific default attribute values
60849
+ const tagDefaults = {
60850
+ area: { shape: 'rect' },
60851
+ button: { type: 'submit' },
60852
+ form: {
60853
+ enctype: 'application/x-www-form-urlencoded',
60854
+ method: 'get'
60855
+ },
60856
+ html: { dir: 'ltr' },
60857
+ img: { decoding: 'auto' },
60858
+ input: {
60859
+ colorspace: 'limited-srgb',
60860
+ type: 'text'
60861
+ },
60862
+ marquee: {
60863
+ behavior: 'scroll',
60864
+ direction: 'left'
60865
+ },
60866
+ style: { media: 'all' },
60867
+ textarea: { wrap: 'soft' },
60868
+ track: { kind: 'subtitles' }
60869
+ };
60851
60870
 
60852
- (tag === 'input' &&
60853
- attrName === 'type' &&
60854
- attrValue === 'text') ||
60871
+ function isAttributeRedundant(tag, attrName, attrValue, attrs) {
60872
+ attrValue = attrValue ? trimWhitespace(attrValue.toLowerCase()) : '';
60855
60873
 
60856
- (tag === 'script' &&
60857
- attrName === 'charset' &&
60858
- !attributesInclude(attrs, 'src')) ||
60874
+ // Legacy attributes
60875
+ if (tag === 'script' && attrName === 'language' && attrValue === 'javascript') {
60876
+ return true;
60877
+ }
60878
+ if (tag === 'script' && attrName === 'charset' && !attributesInclude(attrs, 'src')) {
60879
+ return true;
60880
+ }
60881
+ if (tag === 'a' && attrName === 'name' && attributesInclude(attrs, 'id')) {
60882
+ return true;
60883
+ }
60859
60884
 
60860
- (tag === 'a' &&
60861
- attrName === 'name' &&
60862
- attributesInclude(attrs, 'id')) ||
60885
+ // Check general defaults
60886
+ if (generalDefaults[attrName] === attrValue) {
60887
+ return true;
60888
+ }
60863
60889
 
60864
- (tag === 'area' &&
60865
- attrName === 'shape' &&
60866
- attrValue === 'rect')
60867
- );
60890
+ // Check tag-specific defaults
60891
+ return tagDefaults[tag]?.[attrName] === attrValue;
60868
60892
  }
60869
60893
 
60870
60894
  // https://mathiasbynens.be/demo/javascript-mime-type
@@ -60843,34 +60843,58 @@
60843
60843
  return false;
60844
60844
  }
60845
60845
 
60846
- function isAttributeRedundant(tag, attrName, attrValue, attrs) {
60847
- attrValue = attrValue ? trimWhitespace(attrValue.toLowerCase()) : '';
60848
-
60849
- return (
60850
- (tag === 'script' &&
60851
- attrName === 'language' &&
60852
- attrValue === 'javascript') ||
60846
+ // Default attribute values (could apply to any element)
60847
+ const generalDefaults = {
60848
+ autocorrect: 'on',
60849
+ fetchpriority: 'auto',
60850
+ loading: 'eager',
60851
+ popovertargetaction: 'toggle'
60852
+ };
60853
60853
 
60854
- (tag === 'form' &&
60855
- attrName === 'method' &&
60856
- attrValue === 'get') ||
60854
+ // Tag-specific default attribute values
60855
+ const tagDefaults = {
60856
+ area: { shape: 'rect' },
60857
+ button: { type: 'submit' },
60858
+ form: {
60859
+ enctype: 'application/x-www-form-urlencoded',
60860
+ method: 'get'
60861
+ },
60862
+ html: { dir: 'ltr' },
60863
+ img: { decoding: 'auto' },
60864
+ input: {
60865
+ colorspace: 'limited-srgb',
60866
+ type: 'text'
60867
+ },
60868
+ marquee: {
60869
+ behavior: 'scroll',
60870
+ direction: 'left'
60871
+ },
60872
+ style: { media: 'all' },
60873
+ textarea: { wrap: 'soft' },
60874
+ track: { kind: 'subtitles' }
60875
+ };
60857
60876
 
60858
- (tag === 'input' &&
60859
- attrName === 'type' &&
60860
- attrValue === 'text') ||
60877
+ function isAttributeRedundant(tag, attrName, attrValue, attrs) {
60878
+ attrValue = attrValue ? trimWhitespace(attrValue.toLowerCase()) : '';
60861
60879
 
60862
- (tag === 'script' &&
60863
- attrName === 'charset' &&
60864
- !attributesInclude(attrs, 'src')) ||
60880
+ // Legacy attributes
60881
+ if (tag === 'script' && attrName === 'language' && attrValue === 'javascript') {
60882
+ return true;
60883
+ }
60884
+ if (tag === 'script' && attrName === 'charset' && !attributesInclude(attrs, 'src')) {
60885
+ return true;
60886
+ }
60887
+ if (tag === 'a' && attrName === 'name' && attributesInclude(attrs, 'id')) {
60888
+ return true;
60889
+ }
60865
60890
 
60866
- (tag === 'a' &&
60867
- attrName === 'name' &&
60868
- attributesInclude(attrs, 'id')) ||
60891
+ // Check general defaults
60892
+ if (generalDefaults[attrName] === attrValue) {
60893
+ return true;
60894
+ }
60869
60895
 
60870
- (tag === 'area' &&
60871
- attrName === 'shape' &&
60872
- attrValue === 'rect')
60873
- );
60896
+ // Check tag-specific defaults
60897
+ return tagDefaults[tag]?.[attrName] === attrValue;
60874
60898
  }
60875
60899
 
60876
60900
  // https://mathiasbynens.be/demo/javascript-mime-type
@@ -6,4 +6,4 @@ var ps=2147483647,ds=/[^\x20-\x7E]/,hs=/[\x2E\u3002\uFF0E\uFF61]/g,As={overflow:
6
6
  * Modified by Juriy “kangax” Zaytsev
7
7
  * Original code by Erik Arvidsson, Mozilla Public License
8
8
  * http://erik.eae.net/simplehtmlparser/simplehtmlparser.js
9
- */class AE extends Set{has(e){return super.has(e.toLowerCase())}}const mE=/([^\s"'<>/=]+)/,gE=[/=/],_E=[/"([^"]*)"+/.source,/'([^']*)'+/.source,/([^ \t\n\f\r"'`=<>]+)/.source],EE=function(){const e="A-Za-z\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u0131\\u0134-\\u013E\\u0141-\\u0148\\u014A-\\u017E\\u0180-\\u01C3\\u01CD-\\u01F0\\u01F4\\u01F5\\u01FA-\\u0217\\u0250-\\u02A8\\u02BB-\\u02C1\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03CE\\u03D0-\\u03D6\\u03DA\\u03DC\\u03DE\\u03E0\\u03E2-\\u03F3\\u0401-\\u040C\\u040E-\\u044F\\u0451-\\u045C\\u045E-\\u0481\\u0490-\\u04C4\\u04C7\\u04C8\\u04CB\\u04CC\\u04D0-\\u04EB\\u04EE-\\u04F5\\u04F8\\u04F9\\u0531-\\u0556\\u0559\\u0561-\\u0586\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0621-\\u063A\\u0641-\\u064A\\u0671-\\u06B7\\u06BA-\\u06BE\\u06C0-\\u06CE\\u06D0-\\u06D3\\u06D5\\u06E5\\u06E6\\u0905-\\u0939\\u093D\\u0958-\\u0961\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8B\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AE0\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B36-\\u0B39\\u0B3D\\u0B5C\\u0B5D\\u0B5F-\\u0B61\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB5\\u0BB7-\\u0BB9\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C33\\u0C35-\\u0C39\\u0C60\\u0C61\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CDE\\u0CE0\\u0CE1\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D28\\u0D2A-\\u0D39\\u0D60\\u0D61\\u0E01-\\u0E2E\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E45\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD\\u0EAE\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0F40-\\u0F47\\u0F49-\\u0F69\\u10A0-\\u10C5\\u10D0-\\u10F6\\u1100\\u1102\\u1103\\u1105-\\u1107\\u1109\\u110B\\u110C\\u110E-\\u1112\\u113C\\u113E\\u1140\\u114C\\u114E\\u1150\\u1154\\u1155\\u1159\\u115F-\\u1161\\u1163\\u1165\\u1167\\u1169\\u116D\\u116E\\u1172\\u1173\\u1175\\u119E\\u11A8\\u11AB\\u11AE\\u11AF\\u11B7\\u11B8\\u11BA\\u11BC-\\u11C2\\u11EB\\u11F0\\u11F9\\u1E00-\\u1E9B\\u1EA0-\\u1EF9\\u1F00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2126\\u212A\\u212B\\u212E\\u2180-\\u2182\\u3007\\u3021-\\u3029\\u3041-\\u3094\\u30A1-\\u30FA\\u3105-\\u312C\\u4E00-\\u9FA5\\uAC00-\\uD7A3",t="["+e+"_]["+e+"0-9\\u0660-\\u0669\\u06F0-\\u06F9\\u0966-\\u096F\\u09E6-\\u09EF\\u0A66-\\u0A6F\\u0AE6-\\u0AEF\\u0B66-\\u0B6F\\u0BE7-\\u0BEF\\u0C66-\\u0C6F\\u0CE6-\\u0CEF\\u0D66-\\u0D6F\\u0E50-\\u0E59\\u0ED0-\\u0ED9\\u0F20-\\u0F29\\.\\-_\\u0300-\\u0345\\u0360\\u0361\\u0483-\\u0486\\u0591-\\u05A1\\u05A3-\\u05B9\\u05BB-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u064B-\\u0652\\u0670\\u06D6-\\u06E4\\u06E7\\u06E8\\u06EA-\\u06ED\\u0901-\\u0903\\u093C\\u093E-\\u094D\\u0951-\\u0954\\u0962\\u0963\\u0981-\\u0983\\u09BC\\u09BE-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CD\\u09D7\\u09E2\\u09E3\\u0A02\\u0A3C\\u0A3E-\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A70\\u0A71\\u0A81-\\u0A83\\u0ABC\\u0ABE-\\u0AC5\\u0AC7-\\u0AC9\\u0ACB-\\u0ACD\\u0B01-\\u0B03\\u0B3C\\u0B3E-\\u0B43\\u0B47\\u0B48\\u0B4B-\\u0B4D\\u0B56\\u0B57\\u0B82\\u0B83\\u0BBE-\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCD\\u0BD7\\u0C01-\\u0C03\\u0C3E-\\u0C44\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C82\\u0C83\\u0CBE-\\u0CC4\\u0CC6-\\u0CC8\\u0CCA-\\u0CCD\\u0CD5\\u0CD6\\u0D02\\u0D03\\u0D3E-\\u0D43\\u0D46-\\u0D48\\u0D4A-\\u0D4D\\u0D57\\u0E31\\u0E34-\\u0E3A\\u0E47-\\u0E4E\\u0EB1\\u0EB4-\\u0EB9\\u0EBB\\u0EBC\\u0EC8-\\u0ECD\\u0F18\\u0F19\\u0F35\\u0F37\\u0F39\\u0F3E\\u0F3F\\u0F71-\\u0F84\\u0F86-\\u0F8B\\u0F90-\\u0F95\\u0F97\\u0F99-\\u0FAD\\u0FB1-\\u0FB7\\u0FB9\\u20D0-\\u20DC\\u20E1\\u302A-\\u302F\\u3099\\u309A\\xB7\\u02D0\\u02D1\\u0387\\u0640\\u0E46\\u0EC6\\u3005\\u3031-\\u3035\\u309D\\u309E\\u30FC-\\u30FE]*";return"((?:"+t+"\\:)?"+t+")"}(),vE=new RegExp("^<"+EE),bE=/^\s*(\/?)>/,yE=new RegExp("^<\\/"+EE+"[^>]*>"),SE=/^<!DOCTYPE\s?[^>]+>/i;let CE=!1;"x".replace(/x(.)?/g,function(e,t){CE=""===t});const DE=new AE(["area","base","basefont","br","col","embed","frame","hr","img","input","isindex","keygen","link","meta","param","source","track","wbr"]),wE=new AE(["a","abbr","acronym","applet","b","basefont","bdo","big","br","button","cite","code","del","dfn","em","font","i","iframe","img","input","ins","kbd","label","map","noscript","object","q","s","samp","script","select","small","span","strike","strong","sub","sup","svg","textarea","tt","u","var"]),RE=new AE(["colgroup","dd","dt","li","option","p","td","tfoot","th","thead","tr","source"]),TE=new AE(["checked","compact","declare","defer","disabled","ismap","multiple","nohref","noresize","noshade","nowrap","readonly","selected"]),OE=new AE(["script","style"]),IE=new AE(["address","article","aside","base","blockquote","body","caption","col","colgroup","dd","details","dialog","div","dl","dt","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","legend","li","menuitem","meta","ol","optgroup","option","param","rp","rt","source","style","summary","tbody","td","tfoot","th","thead","title","tr","track","ul"]),kE={};function FE(e){let t=mE.source+"(?:\\s*("+function(e){return gE.concat(e.customAttrAssign||[]).map(function(e){return"(?:"+e.source+")"}).join("|")}(e)+")[ \\t\\n\\f\\r]*(?:"+_E.join("|")+"))?";if(e.customAttrSurround){const n=[];for(let r=e.customAttrSurround.length-1;r>=0;r--)n[r]="(?:("+e.customAttrSurround[r][0].source+")\\s*"+t+"\\s*("+e.customAttrSurround[r][1].source+"))";n.push("(?:"+t+")"),t="(?:"+n.join("|")+")"}return new RegExp("^\\s*"+t)}class xE{constructor(e,t){this.html=e,this.handler=t}async parse(){let e=this.html;const t=this.handler,n=[];let r;const i=FE(t);let o,a,s;for(;e;){if(o=e,r&&OE.has(r)){const n=r.toLowerCase(),i=kE[n]||(kE[n]=new RegExp("([\\s\\S]*?)</"+n+"[^>]*>","i"));e=await hE(e,i,async(e,r)=>("script"!==n&&"style"!==n&&"noscript"!==n&&(r=r.replace(/<!--([\s\S]*?)-->/g,"$1").replace(/<!\[CDATA\[([\s\S]*?)]]>/g,"$1")),t.chars&&await t.chars(r),"")),await p("</"+n+">",n)}else{let n,r=e.indexOf("<");if(0===r){if(/^<!--/.test(e)){const n=e.indexOf("--\x3e");if(n>=0){t.comment&&await t.comment(e.substring(4,n)),e=e.substring(n+3),a="";continue}}if(/^<!\[/.test(e)){const n=e.indexOf("]>");if(n>=0){t.comment&&await t.comment(e.substring(2,n+1),!0),e=e.substring(n+2),a="";continue}}const n=e.match(SE);if(n){t.doctype&&t.doctype(n[0]),e=e.substring(n[0].length),a="";continue}const i=e.match(yE);if(i){e=e.substring(i[0].length),await hE(i[0],yE,p),a="/"+i[1].toLowerCase();continue}const o=u(e);if(o){e=o.rest,await l(o),a=o.tagName.toLowerCase();continue}t.continueOnParseError&&(r=e.indexOf("<",1))}r>=0?(n=e.substring(0,r),e=e.substring(r)):(n=e,e="");let i=u(e);i?s=i.tagName:(i=e.match(yE),s=i?"/"+i[1]:""),t.chars&&await t.chars(n,a,s),a=""}if(e===o)throw new Error("Parse Error: "+e)}function u(e){const t=e.match(vE);if(t){const n={tagName:t[1],attrs:[]};let r,o;for(e=e.slice(t[0].length);!(r=e.match(bE))&&(o=e.match(i));)e=e.slice(o[0].length),n.attrs.push(o);if(r)return n.unarySlash=r[1],n.rest=e.slice(r[0].length),n}}async function c(e){const i=function(e){let t;const r=e.toLowerCase();for(t=n.length-1;t>=0;t--){const e=n[t].tag.toLowerCase();if(e===r)return t;if("table"===e)break}return-1}(e);return i>=0&&(await async function(e){for(let r=n.length-1;r>=e;r--)t.end&&await t.end(n[r].tag,n[r].attrs,!0);n.length=e,r=e&&n[e-1].tag}(i),!0)}async function l(e){const i=e.tagName;let o=e.unarySlash;if(t.html5&&("p"===r&&IE.has(i)?await p("",r):"tbody"===i?await c("thead"):"tfoot"===i?await c("tbody")||await c("thead"):"thead"===i&&(await c("tbody")||await c("tfoot")),"col"===i&&f("colgroup")<0&&(r="colgroup",n.push({tag:r,attrs:[]}),t.start&&await t.start(r,[],!1,""))),!t.html5&&!wE.has(i))for(;r&&wE.has(r);)await p("",r);RE.has(i)&&r===i&&await p("",i),"dt"!==i&&"dd"!==i||"dt"!==r&&"dd"!==r||await p("",r);const a=DE.has(i)||"html"===i&&"head"===r||!!o,s=e.attrs.map(function(e){let n,r,i,o,a,s;function u(t){return a=e[t],r=e[t+1],void 0!==r?'"':(r=e[t+2],void 0!==r?"'":(r=e[t+3],void 0===r&&TE.has(n)&&(r=n),""))}CE&&-1===e[0].indexOf('""')&&(""===e[3]&&delete e[3],""===e[4]&&delete e[4],""===e[5]&&delete e[5]);let c=1;if(t.customAttrSurround)for(let r=0,a=t.customAttrSurround.length;r<a;r++,c+=7)if(n=e[c+1],n){s=u(c+2),i=e[c],o=e[c+6];break}return!n&&(n=e[c])&&(s=u(c+1)),{name:n,value:r,customAssign:a||"=",customOpen:i||"",customClose:o||"",quote:s||""}});a||(n.push({tag:i,attrs:s}),r=i,o=""),t.start&&await t.start(i,s,a,o)}function f(e){let t;const r=e.toLowerCase();for(t=n.length-1;t>=0&&n[t].tag.toLowerCase()!==r;t--);return t}async function p(e,i){let o;if(o=i?f(i):0,o>=0){for(let r=n.length-1;r>=o;r--)t.end&&t.end(n[r].tag,n[r].attrs,r>o||!e);n.length=o,r=o&&n[o-1].tag}else"br"===i.toLowerCase()?t.start&&await t.start(i,[],!0,""):"p"===i.toLowerCase()&&(t.start&&await t.start(i,[],!1,"",!0),t.end&&t.end(i,[]))}t.partialMarkup||await p()}}class BE{sort(e,t=0){for(let n=0,r=this.keys.length;n<r;n++){const r=this.keys[n],i=r.slice(1);let o=e.indexOf(i,t);if(-1!==o){do{o!==t&&(e.splice(o,1),e.splice(t,0,i)),t++}while(-1!==(o=e.indexOf(i,t)));return this[r].sort(e,t)}}return e}}class ME{add(e){e.forEach(t=>{const n="$"+t;this[n]||(this[n]=[],this[n].processed=0),this[n].push(e)})}createSorter(){const e=new BE;return e.keys=Object.keys(this).sort((e,t)=>{const n=this[e].length,r=this[t].length;return n<r?1:n>r||e<t?-1:e>t?1:0}).filter(t=>{if(this[t].processed<this[t].length){const n=t.slice(1),r=new ME;return this[t].forEach(e=>{let t;for(;-1!==(t=e.indexOf(n));)e.splice(t,1);e.forEach(e=>{this["$"+e].processed++}),r.add(e.slice(0))}),e[t]=r.createSorter(),!0}return!1}),e}}const NE=e=>e&&e.replace(/^[ \n\r\t\f]+/,"").replace(/[ \n\r\t\f]+$/,"");function LE(e){return e&&e.replace(/[ \n\r\t\f\xA0]+/g,function(e){return"\t"===e?"\t":e.replace(/(^|\xA0+)[^\xA0]+/g,"$1 ")})}function PE(e,t,n,r,i){let o="",a="";return t.preserveLineBreaks&&(e=e.replace(/^[ \n\r\t\f]*?[\n\r][ \n\r\t\f]*/,function(){return o="\n",""}).replace(/[ \n\r\t\f]*?[\n\r][ \n\r\t\f]*$/,function(){return a="\n",""})),n&&(e=e.replace(/^[ \n\r\t\f\xA0]+/,function(e){const n=!o&&t.conservativeCollapse;return n&&"\t"===e?"\t":e.replace(/^[^\xA0]+/,"").replace(/(\xA0+)[^\xA0]+/g,"$1 ")||(n?" ":"")})),r&&(e=e.replace(/[ \n\r\t\f\xA0]+$/,function(e){const n=!a&&t.conservativeCollapse;return n&&"\t"===e?"\t":e.replace(/[^\xA0]+(\xA0+)/g," $1").replace(/[^\xA0]+$/,"")||(n?" ":"")})),i&&(e=LE(e)),o+e+a}const UE=["a","abbr","acronym","b","bdi","bdo","big","button","cite","code","del","dfn","em","font","i","img","input","ins","kbd","label","mark","math","meter","nobr","object","output","progress","q","rb","rp","rt","rtc","ruby","s","samp","select","small","span","strike","strong","sub","sup","svg","textarea","time","tt","u","var","wbr"],VE=new Set(["a","abbr","acronym","b","big","del","em","font","i","ins","kbd","mark","nobr","s","samp","small","span","strike","strong","sub","sup","time","tt","u","var"]),KE=new Set(["comment","img","input","wbr"]);function GE(e,t,n,r,i,o){let a=t&&!KE.has(t);a&&!r.collapseInlineTagWhitespace&&(a="/"===t.charAt(0)?!i.has(t.slice(1)):!o.has(t));let s=n&&!KE.has(n);return s&&!r.collapseInlineTagWhitespace&&(s="/"===n.charAt(0)?!o.has(n.slice(1)):!i.has(n)),PE(e,r,a,s,t&&n)}function HE(e,t){for(let n=e.length;n--;)if(e[n].name.toLowerCase()===t)return!0;return!1}const WE=new Set(["text/javascript","text/ecmascript","text/jscript","application/javascript","application/x-javascript","application/ecmascript","module"]),zE=new Set(["module"]);function YE(e=""){return""===(e=NE(e.split(/;/,2)[0]).toLowerCase())||WE.has(e)}function XE(e=""){return""===(e=NE(e).toLowerCase())||"text/css"===e}function QE(e,t){if("style"!==e)return!1;for(let e=0,n=t.length;e<n;e++){if("type"===t[e].name.toLowerCase())return XE(t[e].value)}return!0}const jE=new Set(["allowfullscreen","async","autofocus","autoplay","checked","compact","controls","declare","default","defaultchecked","defaultmuted","defaultselected","defer","disabled","enabled","formnovalidate","hidden","indeterminate","inert","ismap","itemscope","loop","multiple","muted","nohref","noresize","noshade","novalidate","nowrap","open","pauseonexit","readonly","required","reversed","scoped","seamless","selected","sortable","truespeed","typemustmatch","visible"]),qE=new Set(["true","false"]);function ZE(e,t,n){if("link"!==e)return!1;const r=String(n).toLowerCase();for(let e=0;e<t.length;e++)if("rel"===t[e].name.toLowerCase()){if(String(t[e].value).toLowerCase().split(/\s+/).includes(r))return!0}return!1}const JE=new Set(["img","source"]);async function $E(e,t,n,r,i,o){if(function(e,t){const n=t.customEventAttributes;if(n){for(let t=n.length;t--;)if(n[t].test(e))return!0;return!1}return/^on[a-z]{3,}$/.test(e)}(t,r))return n=NE(n).replace(/^javascript:\s*/i,""),r.minifyJS(n,!0);if("class"===t)return n=NE(n),n=r.sortClassName?r.sortClassName(n):LE(n);if(function(e,t){return/^(?:a|area|link|base)$/.test(t)&&"href"===e||"img"===t&&/^(?:src|longdesc|usemap)$/.test(e)||"object"===t&&/^(?:classid|codebase|data|usemap)$/.test(e)||"q"===t&&"cite"===e||"blockquote"===t&&"cite"===e||("ins"===t||"del"===t)&&"cite"===e||"form"===t&&"action"===e||"input"===t&&("src"===e||"usemap"===e)||"head"===t&&"profile"===e||"script"===t&&("src"===e||"for"===e)}(t,e)){if(n=NE(n),ZE(e,i,"canonical"))return n;try{const e=await r.minifyURLs(n);return"string"==typeof e?e:n}catch(e){return r.log&&r.log(e),n}}else{if(function(e,t){return/^(?:a|area|object|button)$/.test(t)&&"tabindex"===e||"input"===t&&("maxlength"===e||"tabindex"===e)||"select"===t&&("size"===e||"tabindex"===e)||"textarea"===t&&/^(?:rows|cols|tabindex)$/.test(e)||"colgroup"===t&&"span"===e||"col"===t&&"span"===e||("th"===t||"td"===t)&&("rowspan"===e||"colspan"===e)}(t,e))return NE(n);if("style"===t)return(n=NE(n))&&(/;$/.test(n)&&!/&#?[0-9a-zA-Z]+;$/.test(n)&&(n=n.replace(/\s*;$/,";")),n=await r.minifyCSS(n,"inline")),n;if(function(e,t){return"srcset"===e&&JE.has(t)}(t,e))n=(await Promise.all(NE(n).split(/\s+,\s*|\s*,\s+/).map(async function(e){let t=e,n="";const i=e.match(/\s+([1-9][0-9]*w|[0-9]+(?:\.[0-9]+)?x)$/);if(i){t=t.slice(0,-i[0].length);const e=+i[1].slice(0,-1),r=i[1].slice(-1);1===e&&"x"===r||(n=" "+e+r)}try{const e=await r.minifyURLs(t);return("string"==typeof e?e:t)+n}catch(e){return r.log&&r.log(e),t+n}}))).join(", ");else if(function(e,t){if("meta"!==e)return!1;for(let e=0,n=t.length;e<n;e++)if("name"===t[e].name&&"viewport"===t[e].value)return!0}(e,i)&&"content"===t)n=n.replace(/\s+/g,"").replace(/[0-9]+\.[0-9]+/g,function(e){return(+e).toString()});else{if(function(e,t){if("meta"!==e)return!1;for(let e=0,n=t.length;e<n;e++)if("http-equiv"===t[e].name.toLowerCase()&&"content-security-policy"===t[e].value.toLowerCase())return!0}(e,i)&&"content"===t.toLowerCase())return LE(n);if(r.customAttrCollapse&&r.customAttrCollapse.test(t))n=NE(n.replace(/ ?[\n\r]+ ?/g,"").replace(/\s{2,}/g,r.conservativeCollapse?" ":""));else if("script"===e&&"type"===t)n=NE(n.replace(/\s*;\s*/g,";"));else{if(function(e,t,n){return"media"===n&&(ZE(e,t,"stylesheet")||QE(e,t))}(e,i,t))return n=NE(n),r.minifyCSS(n,"media");if("iframe"===e&&"srcdoc"===t)return function(e){return Boolean(e.collapseWhitespace||e.removeComments||e.removeOptionalTags||e.minifyJS!==Dv||e.minifyCSS!==wv||e.minifyURLs!==Dv)}(r)?o(n,r,!0):n}}}return n}function ev(e){return"/* clean-css ignore:start */"+e+"/* clean-css ignore:end */"}function tv(e,t){switch(t){case"inline":return"*{"+e+"}";case"media":return"@media "+e+"{a{top:0}}";default:return e}}const nv=new Set(["html","head","body","colgroup","tbody"]),rv=new Set(["html","head","body","li","dt","dd","p","rb","rt","rtc","rp","optgroup","option","colgroup","caption","thead","tbody","tfoot","tr","td","th"]),iv=new Set(["meta","link","script","style","template","noscript"]),ov=new Set(["dt","dd"]),av=new Set(["address","article","aside","blockquote","details","dialog","div","dl","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","main","menu","nav","ol","p","pre","search","section","table","ul"]),sv=new Set(["a","audio","del","ins","map","noscript","video"]),uv=new Set(["rb","rt","rtc","rp"]),cv=new Set(["rb","rtc"]),lv=new Set(["option","optgroup"]),fv=new Set(["tbody","tfoot"]),pv=new Set(["thead","tbody","tfoot"]),dv=new Set(["td","th"]),hv=new Set(["html","head","body"]),Av=new Set(["html","body"]),mv=new Set(["head","colgroup","caption"]),gv=new Set(["dt","thead"]),_v=new Set(["a","abbr","acronym","address","applet","area","article","aside","audio","b","base","basefont","bdi","bdo","bgsound","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","command","content","data","datalist","dd","del","details","dfn","dialog","dir","div","dl","dt","element","em","embed","fieldset","figcaption","figure","font","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","image","img","input","ins","isindex","kbd","keygen","label","legend","li","link","listing","main","map","mark","marquee","menu","menuitem","meta","meter","multicol","nav","nobr","noembed","noframes","noscript","object","ol","optgroup","option","output","p","param","picture","plaintext","pre","progress","q","rb","rp","rt","rtc","ruby","s","samp","script","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","tt","u","ul","var","video","wbr","xmp"]);const Ev=new RegExp("^(?:class|id|style|title|lang|dir|on(?:focus|blur|change|click|dblclick|mouse(?:down|up|over|move|out)|key(?:press|down|up)))$");function vv(e,t){for(let n=t.length-1;n>=0;n--)if(t[n].name===e)return!0;return!1}function bv(e){return!/^(?:script|style|pre|textarea)$/.test(e)}function yv(e){return!/^(?:pre|textarea)$/.test(e)}async function Sv(e,t,n,r){const i=r.name(e.name);let o=e.value;if(r.decodeEntities&&o&&(o=Jl(o,Ql.Strict)),!(r.removeRedundantAttributes&&function(e,t,n,r){return n=n?NE(n.toLowerCase()):"","script"===e&&"language"===t&&"javascript"===n||"form"===e&&"method"===t&&"get"===n||"input"===e&&"type"===t&&"text"===n||"script"===e&&"charset"===t&&!HE(r,"src")||"a"===e&&"name"===t&&HE(r,"id")||"area"===e&&"shape"===t&&"rect"===n}(n,i,o,t)||r.removeScriptTypeAttributes&&"script"===n&&"type"===i&&YE(o)&&!function(e=""){return e=NE(e.split(/;/,2)[0]).toLowerCase(),zE.has(e)}(o)||r.removeStyleLinkTypeAttributes&&("style"===n||"link"===n)&&"type"===i&&XE(o)||(o&&(o=await $E(n,i,o,r,t,Iv)),r.removeEmptyAttributes&&function(e,t,n,r){return!(n&&!/^\s*$/.test(n))&&("function"==typeof r.removeEmptyAttributes?r.removeEmptyAttributes(t,e):"input"===e&&"value"===t||Ev.test(t))}(n,i,o,r))))return r.decodeEntities&&o&&(o=o.replace(/&(#?[0-9a-zA-Z]+;)/g,"&amp;$1")),{attr:e,name:i,value:o}}function Cv(e,t,n,r,i){const o=e.name;let a=e.value;const s=e.attr;let u,c,l=s.quote;if(void 0===a||n.removeAttributeQuotes&&!~a.indexOf(i)&&/^[^ \t\n\f\r"'`=<>]+$/.test(a))c=!r||t||/\/$/.test(a)?a+" ":a;else{if(!n.preventAttributesEscaping){if(void 0===n.quoteCharacter){l=(a.match(/'/g)||[]).length<(a.match(/"/g)||[]).length?"'":'"'}else l="'"===n.quoteCharacter?"'":'"';a='"'===l?a.replace(/"/g,"&#34;"):a.replace(/'/g,"&#39;")}c=l+a+l,r||n.removeTagWhitespace||(c+=" ")}return void 0===a||n.collapseBooleanAttributes&&function(e,t){return jE.has(e)||"draggable"===e&&!qE.has(t)}(o.toLowerCase(),a.toLowerCase())?(u=o,r||(u+=" ")):u=o+s.customAssign+c,s.customOpen+u+s.customClose}function Dv(e){return e}function wv(e){return Promise.resolve(e)}const Rv=e=>{const t={name:function(e){return e.toLowerCase()},canCollapseWhitespace:bv,canTrimWhitespace:yv,html5:!0,ignoreCustomComments:[/^!/,/^\s*#/],ignoreCustomFragments:[/<%[\s\S]*?%>/,/<\?[\s\S]*?\?>/],includeAutoGeneratedTags:!0,log:Dv,minifyCSS:wv,minifyJS:Dv,minifyURLs:Dv};return Object.keys(e).forEach(function(n){const r=e[n];if("caseSensitive"===n)r&&(t.name=Dv);else if("log"===n)"function"==typeof r&&(t.log=r);else if("minifyCSS"===n&&"function"!=typeof r){if(!r)return;const e="object"==typeof r?r:{};t.minifyCSS=async function(n,r){const i=tv(n=await hE(n,/(url\s*\(\s*)(?:"([^"]*)"|'([^']*)'|([^\s)]+))(\s*\))/gi,async function(e,n,r,i,o,a){const s=null!=r?'"':null!=i?"'":"",u=r??i??o??"";try{const e=await t.minifyURLs(u);return n+s+("string"==typeof e?e:u)+s+a}catch(n){return t.log&&t.log(n),e}}),r);return new Promise(o=>{new Ll(e).minify(i,(e,i)=>{i.errors.length>0&&(i.errors.forEach(t.log),o(n));const a=function(e,t){let n;switch(t){case"inline":n=e.match(/^\*\{([\s\S]*)\}$/);break;case"media":n=e.match(/^@media ([\s\S]*?)\s*{[\s\S]*}$/)}return n?n[1]:e}(i.styles,r);o(a)})})}}else if("minifyJS"===n&&"function"!=typeof r){if(!r)return;const e="object"==typeof r?r:{};e.parse={...e.parse,bare_returns:!1},t.minifyJS=async function(n,r){const i=n.match(/^\s*<!--.*/),o=i?n.slice(i[0].length).replace(/\n\s*-->\s*$/,""):n;e.parse.bare_returns=r;try{const t=await async function(e,t){const n=dE(e,t);let r,i;do{i=n.next(await r),r=i.value}while(!i.done);return i.value}(o,e);return t.code.replace(/;$/,"")}catch(e){return t.log(e),n}}}else if("minifyURLs"===n&&"function"!=typeof r){if(!r)return;let e=r;"string"==typeof r?e={site:r}:"object"!=typeof r&&(e={}),t.minifyURLs=function(n){try{return Hf.relate(n,e)}catch(e){return t.log(e),n}}}else t[n]=r}),t};function Tv(e){let t;do{t=Math.random().toString(36).replace(/^0\.[0-9]*/,"")}while(~e.indexOf(t));return t}const Ov=new Set(["script","style"]);async function Iv(e,t,n){if(t.maxInputLength&&e.length>t.maxInputLength)throw new Error(`Input length (${e.length}) exceeds maximum allowed length (${t.maxInputLength})`);t.collapseWhitespace&&(e=PE(e,t,!0,!0));const r=[];let i,o,a="",s="",u=[];const c=[],l=[];let f="",p="";const d=[],h=[];let A,m,g;const _=t.inlineCustomElements??[],E=(Array.isArray(_)?_:Array.from(_)).map(e=>t.name(e)),v=new Set([...VE,...E]),b=new Set([...UE,...E]);e=e.replace(/<!-- htmlmin:ignore -->([\s\S]*?)<!-- htmlmin:ignore -->/g,function(n,r){if(!A){A=Tv(e);const n=new RegExp("^"+A+"([0-9]+)$");t.ignoreCustomComments?t.ignoreCustomComments=t.ignoreCustomComments.slice():t.ignoreCustomComments=[],t.ignoreCustomComments.push(n)}const i="\x3c!--"+A+d.length+"--\x3e";return d.push(r),i});const y=t.ignoreCustomFragments.map(function(e){return e.source});if(y.length){for(let e=0;e<y.length;e++)if(/[*+]/.test(y[e])){t.log("Warning: Custom fragment contains unlimited quantifiers (* or +) which may cause ReDoS vulnerability");break}const n=t.customFragmentQuantifierLimit||200,r=`\\s{0,${n}}`,i=new RegExp(r+"(?:"+y.join("|")+"){1,"+n+"}"+r,"g");e=e.replace(i,function(n){var r;m||(m=Tv(e),g=new RegExp("(\\s*)"+m+"([0-9]+)"+m+"(\\s*)","g"),t.minifyCSS&&(t.minifyCSS=(r=t.minifyCSS,function(e,t){e=e.replace(g,function(e,t,n){const r=h[+n];return r[1]+m+n+m+r[2]});const n=[];return(new Ll).minify(tv(e,t)).warnings.forEach(function(t){const r=g.exec(t);if(r){const t=m+r[2]+m;e=e.replace(t,ev(t)),n.push(t)}}),r(e,t).then(e=>(n.forEach(function(t){e=e.replace(ev(t),t)}),e))})),t.minifyJS&&(t.minifyJS=function(e){return function(t,n){return e(t.replace(g,function(e,t,n){const r=h[+n];return r[1]+m+n+m+r[2]}),n)}}(t.minifyJS)));const i=m+h.length+m;return h.push(/^(\s*)[\s\S]*?(\s*)$/.exec(n)),"\t"+i+"\t"})}function S(e,n){return t.canTrimWhitespace(e,n,yv)}function C(){let e=r.length-1;for(;e>0&&!/^<[^/!]/.test(r[e]);)e--;r.length=Math.max(0,e)}function D(){let e=r.length-1;for(;e>0&&!/^<\//.test(r[e]);)e--;r.length=Math.max(0,e)}function w(e,n){for(let i=null;e>=0&&S(i);e--){const o=r[e],a=o.match(/^<\/([\w:-]+)>$/);if(a)i=a[1];else if(/>$/.test(o)||(r[e]=GE(o,null,n,t,b,v)))break}}function R(e){let t=r.length-1;if(r.length>1){const e=r[r.length-1];/^(?:<!|$)/.test(e)&&-1===e.indexOf(A)&&t--}w(t,e)}(t.sortAttributes&&"function"!=typeof t.sortAttributes||t.sortClassName&&"function"!=typeof t.sortClassName)&&await async function(e,t,n,r){const i=t.sortAttributes&&Object.create(null),o=t.sortClassName&&new ME;function a(e){return e.map(function(e){return t.name(e.name)})}function s(e,t){return!t||-1===e.indexOf(t)}function u(e){return s(e,n)&&s(e,r)}const c=t.log;if(t.log=Dv,t.sortAttributes=!1,t.sortClassName=!1,await async function e(n){let r,s;const c=new xE(n,{start:function(e,n){i&&(i[e]||(i[e]=new ME),i[e].add(a(n).filter(u)));for(let i=0,a=n.length;i<a;i++){const a=n[i];o&&a.value&&"class"===t.name(a.name)?o.add(NE(a.value).split(/[ \t\n\f\r]+/).filter(u)):t.processScripts&&"type"===a.name.toLowerCase()&&(r=e,s=a.value)}},end:function(){r=""},chars:async function(n){t.processScripts&&Ov.has(r)&&t.processScripts.indexOf(s)>-1&&await e(n)}});await c.parse()}(await Iv(e,t)),t.log=c,i){const e=Object.create(null);for(const t in i)e[t]=i[t].createSorter();t.sortAttributes=function(t,n){const r=e[t];if(r){const e=Object.create(null),t=a(n);t.forEach(function(t,r){(e[t]||(e[t]=[])).push(n[r])}),r.sort(t).forEach(function(t,r){n[r]=e[t].shift()})}}}if(o){const e=o.createSorter();t.sortClassName=function(t){return e.sort(t.split(/[ \n\f\r]+/)).join(" ")}}}(e,t,A,m);const T=new xE(e,{partialMarkup:n,continueOnParseError:t.continueOnParseError,customAttrAssign:t.customAttrAssign,customAttrSurround:t.customAttrSurround,html5:t.html5,start:async function(e,n,d,h,A){"svg"===e.toLowerCase()&&((t=Object.create(t)).caseSensitive=!0,t.keepClosingSlash=!0,t.name=Dv),e=t.name(e),s=e,i=e,v.has(e)||(a=""),o=!1,u=n;let g=t.removeOptionalTags;if(g){const t=_v.has(e);t&&function(e,t){switch(e){case"html":case"head":return!0;case"body":return!iv.has(t);case"colgroup":return"col"===t;case"tbody":return"tr"===t}return!1}(f,e)&&C(),f="",t&&function(e,t){switch(e){case"html":case"head":case"body":case"colgroup":case"caption":return!0;case"li":case"optgroup":case"tr":return t===e;case"dt":case"dd":return ov.has(t);case"p":return av.has(t);case"rb":case"rt":case"rp":return uv.has(t);case"rtc":return cv.has(t);case"option":return lv.has(t);case"thead":case"tbody":return fv.has(t);case"tfoot":return"tbody"===t;case"td":case"th":return dv.has(t)}return!1}(p,e)&&(D(),g=!function(e,t){switch(t){case"colgroup":return"colgroup"===e;case"tbody":return pv.has(e)}return!1}(p,e)),p=""}t.collapseWhitespace&&(c.length||R(e),d||(S(e,n)&&!c.length||c.push(e),function(e,n){return t.canCollapseWhitespace(e,n,bv)}(e,n)&&!l.length||l.push(e)));const _="<"+e,E=h&&t.keepClosingSlash;r.push(_),t.sortAttributes&&t.sortAttributes(e,n);const b=[];for(let r=n.length,i=!0;--r>=0;){const o=await Sv(n[r],n,e,t);o&&(b.unshift(Cv(o,E,t,i,m)),i=!1)}b.length>0?(r.push(" "),r.push.apply(r,b)):g&&nv.has(e)&&(f=e),r.push(r.pop()+(E?"/":"")+">"),A&&!t.includeAutoGeneratedTags&&(C(),f="")},end:function(e,n,u){"svg"===e.toLowerCase()&&(t=Object.getPrototypeOf(t)),e=t.name(e),t.collapseWhitespace&&(c.length?e===c[c.length-1]&&c.pop():R("/"+e),l.length&&e===l[l.length-1]&&l.pop());let d=!1;e===s&&(s="",d=!o),t.removeOptionalTags&&(d&&hv.has(f)&&C(),f="",!_v.has(e)||!p||gv.has(p)||"p"===p&&sv.has(e)||D(),p=rv.has(e)?e:""),t.removeEmptyElements&&d&&function(e,t){switch(e){case"textarea":return!1;case"audio":case"script":case"video":if(vv("src",t))return!1;break;case"iframe":if(vv("src",t)||vv("srcdoc",t))return!1;break;case"object":if(vv("data",t))return!1;break;case"applet":if(vv("code",t))return!1}return!0}(e,n)?(C(),f="",p=""):(u&&!t.includeAutoGeneratedTags?p="":r.push("</"+e+">"),i="/"+e,b.has(e)?d&&(a+="|"):a="")},chars:async function(e,n,d){if(n=""===n?"comment":n,d=""===d?"comment":d,t.decodeEntities&&e&&!Ov.has(s)&&(e=function(e,t=Ql.Legacy){return Jl(e,t)}(e)),t.collapseWhitespace){if(!c.length){if("comment"===n){const o=r[r.length-1];if(-1===o.indexOf(A)&&(o||(n=i),r.length>1&&(!o||!t.conservativeCollapse&&/ $/.test(a)))){const t=r.length-2;r[t]=r[t].replace(/\s+$/,function(t){return e=t+e,""})}}if(n)if("/nobr"===n||"wbr"===n){if(/^\s/.test(e)){let e=r.length-1;for(;e>0&&0!==r[e].lastIndexOf("<"+n);)e--;w(e-1,"br")}}else v.has("/"===n.charAt(0)?n.slice(1):n)&&(e=PE(e,t,/(?:^|\s)$/.test(a)));!(e=n||d?GE(e,n,d,t,b,v):PE(e,t,!0,!0))&&/\s$/.test(a)&&n&&"/"===n.charAt(0)&&w(r.length-1,d)}l.length||"html"===d||n&&d||(e=PE(e,t,!1,!1,!0))}t.processScripts&&Ov.has(s)&&(e=await async function(e,t,n){for(let r=0,i=n.length;r<i;r++)if("type"===n[r].name.toLowerCase()&&t.processScripts.indexOf(n[r].value)>-1)return await Iv(e,t);return e}(e,t,u)),function(e,t){if("script"!==e)return!1;for(let e=0,n=t.length;e<n;e++)if("type"===t[e].name.toLowerCase())return YE(t[e].value);return!0}(s,u)&&(e=await t.minifyJS(e)),QE(s,u)&&(e=await t.minifyCSS(e)),t.removeOptionalTags&&e&&(("html"===f||"body"===f&&!/^\s/.test(e))&&C(),f="",(Av.has(p)||mv.has(p)&&!/^\s/.test(e))&&D(),/^\s+$/.test(e)&&t.collapseWhitespace&&!t.conservativeCollapse||(p="")),i=/^\s*$/.test(e)?n:"comment",t.decodeEntities&&e&&!Ov.has(s)&&(e=e.replace(/&((?:Iacute|aacute|uacute|plusmn|Otilde|otilde|agrave|Agrave|Yacute|yacute|Oslash|oslash|atilde|Atilde|brvbar|ccedil|Ccedil|Ograve|curren|divide|eacute|Eacute|ograve|Oacute|egrave|Egrave|Ugrave|frac12|frac14|frac34|ugrave|oacute|iacute|Ntilde|ntilde|Uacute|middot|igrave|Igrave|iquest|Aacute|cedil|laquo|micro|iexcl|Icirc|icirc|acirc|Ucirc|Ecirc|ocirc|Ocirc|ecirc|ucirc|Aring|aring|AElig|aelig|acute|pound|raquo|Acirc|times|THORN|szlig|thorn|COPY|auml|ordf|ordm|Uuml|macr|uuml|Auml|ouml|Ouml|para|nbsp|euml|quot|QUOT|Euml|yuml|cent|sect|copy|sup1|sup2|sup3|iuml|Iuml|ETH|shy|reg|not|yen|amp|AMP|REG|uml|eth|deg|gt|GT|LT|lt)(?!;)|(?:#?[0-9a-zA-Z]+;))/g,"&amp$1").replace(/</g,"&lt;")),g&&t.collapseWhitespace&&c.length&&(e=e.replace(g,function(e,t,n){return h[+n][0]})),a+=e,e&&(o=!0),r.push(e)},comment:async function(e,n){const i=n?"<!":"\x3c!--",o=n?">":"--\x3e";e=function(e){return/^\[if\s[^\]]+]|\[endif]$/.test(e)}(e)?i+await async function(e,t){return t.processConditionalComments?await hE(e,/^(\[if\s[^\]]+]>)([\s\S]*?)(<!\[endif])$/,async function(e,n,r,i){return n+await Iv(r,t,!0)+i}):e}(e,t)+o:t.removeComments?function(e,t){for(let n=0,r=t.ignoreCustomComments.length;n<r;n++)if(t.ignoreCustomComments[n].test(e))return!0;return!1}(e,t)?"\x3c!--"+e+"--\x3e":"":i+e+o,t.removeOptionalTags&&e&&(f="",p=""),r.push(e)},doctype:function(e){r.push(t.useShortDoctype?"<!doctype"+(t.removeTagWhitespace?"":" ")+"html>":LE(e))}});return await T.parse(),t.removeOptionalTags&&(hv.has(f)&&C(),p&&!gv.has(p)&&D()),t.collapseWhitespace&&R("br"),function(e,t,n,r){let i;const o=t.maxLineLength,a=t.noNewlinesBeforeTagClose;if(o){let t="";const s=[];for(;e.length;){const i=t.length,u=e[0].indexOf("\n"),c=Boolean(e[0].match(yE)),l=a&&c;u<0?t+=r(n(e.shift())):(t+=r(n(e[0].slice(0,u))),e[0]=e[0].slice(u+1)),i>0&&t.length>o&&!l?(s.push(t.slice(0,i)),t=t.slice(i)):u>=0&&(s.push(t),t="")}t&&s.push(t),i=s.join("\n")}else i=r(n(e.join("")));return t.collapseWhitespace?PE(i,t,!0,!0):i}(r,t,g?function(e){return e.replace(g,function(e,n,r,i){let o=h[+r][0];return t.collapseWhitespace?("\t"!==n&&(o=n+o),"\t"!==i&&(o+=i),PE(o,{preserveLineBreaks:t.preserveLineBreaks,conservativeCollapse:!t.trimCustomFragments},/^[ \n\r\t\f]/.test(o),/[ \n\r\t\f]$/.test(o))):o})}:Dv,A?function(e){return e.replace(new RegExp("\x3c!--"+A+"([0-9]+)--\x3e","g"),function(e,t){return d[+t]})}:Dv)}const kv=async function(e,t){const n=Date.now();t=Rv(t||{});const r=await Iv(e,t);return t.log("minified in: "+(Date.now()-n)+"ms"),r};var Fv={minify:kv};e.default=Fv,e.minify=kv,Object.defineProperty(e,"__esModule",{value:!0})});
9
+ */class AE extends Set{has(e){return super.has(e.toLowerCase())}}const mE=/([^\s"'<>/=]+)/,gE=[/=/],_E=[/"([^"]*)"+/.source,/'([^']*)'+/.source,/([^ \t\n\f\r"'`=<>]+)/.source],EE=function(){const e="A-Za-z\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u0131\\u0134-\\u013E\\u0141-\\u0148\\u014A-\\u017E\\u0180-\\u01C3\\u01CD-\\u01F0\\u01F4\\u01F5\\u01FA-\\u0217\\u0250-\\u02A8\\u02BB-\\u02C1\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03CE\\u03D0-\\u03D6\\u03DA\\u03DC\\u03DE\\u03E0\\u03E2-\\u03F3\\u0401-\\u040C\\u040E-\\u044F\\u0451-\\u045C\\u045E-\\u0481\\u0490-\\u04C4\\u04C7\\u04C8\\u04CB\\u04CC\\u04D0-\\u04EB\\u04EE-\\u04F5\\u04F8\\u04F9\\u0531-\\u0556\\u0559\\u0561-\\u0586\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0621-\\u063A\\u0641-\\u064A\\u0671-\\u06B7\\u06BA-\\u06BE\\u06C0-\\u06CE\\u06D0-\\u06D3\\u06D5\\u06E5\\u06E6\\u0905-\\u0939\\u093D\\u0958-\\u0961\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8B\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AE0\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B36-\\u0B39\\u0B3D\\u0B5C\\u0B5D\\u0B5F-\\u0B61\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB5\\u0BB7-\\u0BB9\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C33\\u0C35-\\u0C39\\u0C60\\u0C61\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CDE\\u0CE0\\u0CE1\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D28\\u0D2A-\\u0D39\\u0D60\\u0D61\\u0E01-\\u0E2E\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E45\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD\\u0EAE\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0F40-\\u0F47\\u0F49-\\u0F69\\u10A0-\\u10C5\\u10D0-\\u10F6\\u1100\\u1102\\u1103\\u1105-\\u1107\\u1109\\u110B\\u110C\\u110E-\\u1112\\u113C\\u113E\\u1140\\u114C\\u114E\\u1150\\u1154\\u1155\\u1159\\u115F-\\u1161\\u1163\\u1165\\u1167\\u1169\\u116D\\u116E\\u1172\\u1173\\u1175\\u119E\\u11A8\\u11AB\\u11AE\\u11AF\\u11B7\\u11B8\\u11BA\\u11BC-\\u11C2\\u11EB\\u11F0\\u11F9\\u1E00-\\u1E9B\\u1EA0-\\u1EF9\\u1F00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2126\\u212A\\u212B\\u212E\\u2180-\\u2182\\u3007\\u3021-\\u3029\\u3041-\\u3094\\u30A1-\\u30FA\\u3105-\\u312C\\u4E00-\\u9FA5\\uAC00-\\uD7A3",t="["+e+"_]["+e+"0-9\\u0660-\\u0669\\u06F0-\\u06F9\\u0966-\\u096F\\u09E6-\\u09EF\\u0A66-\\u0A6F\\u0AE6-\\u0AEF\\u0B66-\\u0B6F\\u0BE7-\\u0BEF\\u0C66-\\u0C6F\\u0CE6-\\u0CEF\\u0D66-\\u0D6F\\u0E50-\\u0E59\\u0ED0-\\u0ED9\\u0F20-\\u0F29\\.\\-_\\u0300-\\u0345\\u0360\\u0361\\u0483-\\u0486\\u0591-\\u05A1\\u05A3-\\u05B9\\u05BB-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u064B-\\u0652\\u0670\\u06D6-\\u06E4\\u06E7\\u06E8\\u06EA-\\u06ED\\u0901-\\u0903\\u093C\\u093E-\\u094D\\u0951-\\u0954\\u0962\\u0963\\u0981-\\u0983\\u09BC\\u09BE-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CD\\u09D7\\u09E2\\u09E3\\u0A02\\u0A3C\\u0A3E-\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A70\\u0A71\\u0A81-\\u0A83\\u0ABC\\u0ABE-\\u0AC5\\u0AC7-\\u0AC9\\u0ACB-\\u0ACD\\u0B01-\\u0B03\\u0B3C\\u0B3E-\\u0B43\\u0B47\\u0B48\\u0B4B-\\u0B4D\\u0B56\\u0B57\\u0B82\\u0B83\\u0BBE-\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCD\\u0BD7\\u0C01-\\u0C03\\u0C3E-\\u0C44\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C82\\u0C83\\u0CBE-\\u0CC4\\u0CC6-\\u0CC8\\u0CCA-\\u0CCD\\u0CD5\\u0CD6\\u0D02\\u0D03\\u0D3E-\\u0D43\\u0D46-\\u0D48\\u0D4A-\\u0D4D\\u0D57\\u0E31\\u0E34-\\u0E3A\\u0E47-\\u0E4E\\u0EB1\\u0EB4-\\u0EB9\\u0EBB\\u0EBC\\u0EC8-\\u0ECD\\u0F18\\u0F19\\u0F35\\u0F37\\u0F39\\u0F3E\\u0F3F\\u0F71-\\u0F84\\u0F86-\\u0F8B\\u0F90-\\u0F95\\u0F97\\u0F99-\\u0FAD\\u0FB1-\\u0FB7\\u0FB9\\u20D0-\\u20DC\\u20E1\\u302A-\\u302F\\u3099\\u309A\\xB7\\u02D0\\u02D1\\u0387\\u0640\\u0E46\\u0EC6\\u3005\\u3031-\\u3035\\u309D\\u309E\\u30FC-\\u30FE]*";return"((?:"+t+"\\:)?"+t+")"}(),vE=new RegExp("^<"+EE),bE=/^\s*(\/?)>/,yE=new RegExp("^<\\/"+EE+"[^>]*>"),SE=/^<!DOCTYPE\s?[^>]+>/i;let CE=!1;"x".replace(/x(.)?/g,function(e,t){CE=""===t});const DE=new AE(["area","base","basefont","br","col","embed","frame","hr","img","input","isindex","keygen","link","meta","param","source","track","wbr"]),wE=new AE(["a","abbr","acronym","applet","b","basefont","bdo","big","br","button","cite","code","del","dfn","em","font","i","iframe","img","input","ins","kbd","label","map","noscript","object","q","s","samp","script","select","small","span","strike","strong","sub","sup","svg","textarea","tt","u","var"]),RE=new AE(["colgroup","dd","dt","li","option","p","td","tfoot","th","thead","tr","source"]),TE=new AE(["checked","compact","declare","defer","disabled","ismap","multiple","nohref","noresize","noshade","nowrap","readonly","selected"]),OE=new AE(["script","style"]),IE=new AE(["address","article","aside","base","blockquote","body","caption","col","colgroup","dd","details","dialog","div","dl","dt","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","legend","li","menuitem","meta","ol","optgroup","option","param","rp","rt","source","style","summary","tbody","td","tfoot","th","thead","title","tr","track","ul"]),kE={};function FE(e){let t=mE.source+"(?:\\s*("+function(e){return gE.concat(e.customAttrAssign||[]).map(function(e){return"(?:"+e.source+")"}).join("|")}(e)+")[ \\t\\n\\f\\r]*(?:"+_E.join("|")+"))?";if(e.customAttrSurround){const n=[];for(let r=e.customAttrSurround.length-1;r>=0;r--)n[r]="(?:("+e.customAttrSurround[r][0].source+")\\s*"+t+"\\s*("+e.customAttrSurround[r][1].source+"))";n.push("(?:"+t+")"),t="(?:"+n.join("|")+")"}return new RegExp("^\\s*"+t)}class xE{constructor(e,t){this.html=e,this.handler=t}async parse(){let e=this.html;const t=this.handler,n=[];let r;const i=FE(t);let o,a,s;for(;e;){if(o=e,r&&OE.has(r)){const n=r.toLowerCase(),i=kE[n]||(kE[n]=new RegExp("([\\s\\S]*?)</"+n+"[^>]*>","i"));e=await hE(e,i,async(e,r)=>("script"!==n&&"style"!==n&&"noscript"!==n&&(r=r.replace(/<!--([\s\S]*?)-->/g,"$1").replace(/<!\[CDATA\[([\s\S]*?)]]>/g,"$1")),t.chars&&await t.chars(r),"")),await p("</"+n+">",n)}else{let n,r=e.indexOf("<");if(0===r){if(/^<!--/.test(e)){const n=e.indexOf("--\x3e");if(n>=0){t.comment&&await t.comment(e.substring(4,n)),e=e.substring(n+3),a="";continue}}if(/^<!\[/.test(e)){const n=e.indexOf("]>");if(n>=0){t.comment&&await t.comment(e.substring(2,n+1),!0),e=e.substring(n+2),a="";continue}}const n=e.match(SE);if(n){t.doctype&&t.doctype(n[0]),e=e.substring(n[0].length),a="";continue}const i=e.match(yE);if(i){e=e.substring(i[0].length),await hE(i[0],yE,p),a="/"+i[1].toLowerCase();continue}const o=u(e);if(o){e=o.rest,await l(o),a=o.tagName.toLowerCase();continue}t.continueOnParseError&&(r=e.indexOf("<",1))}r>=0?(n=e.substring(0,r),e=e.substring(r)):(n=e,e="");let i=u(e);i?s=i.tagName:(i=e.match(yE),s=i?"/"+i[1]:""),t.chars&&await t.chars(n,a,s),a=""}if(e===o)throw new Error("Parse Error: "+e)}function u(e){const t=e.match(vE);if(t){const n={tagName:t[1],attrs:[]};let r,o;for(e=e.slice(t[0].length);!(r=e.match(bE))&&(o=e.match(i));)e=e.slice(o[0].length),n.attrs.push(o);if(r)return n.unarySlash=r[1],n.rest=e.slice(r[0].length),n}}async function c(e){const i=function(e){let t;const r=e.toLowerCase();for(t=n.length-1;t>=0;t--){const e=n[t].tag.toLowerCase();if(e===r)return t;if("table"===e)break}return-1}(e);return i>=0&&(await async function(e){for(let r=n.length-1;r>=e;r--)t.end&&await t.end(n[r].tag,n[r].attrs,!0);n.length=e,r=e&&n[e-1].tag}(i),!0)}async function l(e){const i=e.tagName;let o=e.unarySlash;if(t.html5&&("p"===r&&IE.has(i)?await p("",r):"tbody"===i?await c("thead"):"tfoot"===i?await c("tbody")||await c("thead"):"thead"===i&&(await c("tbody")||await c("tfoot")),"col"===i&&f("colgroup")<0&&(r="colgroup",n.push({tag:r,attrs:[]}),t.start&&await t.start(r,[],!1,""))),!t.html5&&!wE.has(i))for(;r&&wE.has(r);)await p("",r);RE.has(i)&&r===i&&await p("",i),"dt"!==i&&"dd"!==i||"dt"!==r&&"dd"!==r||await p("",r);const a=DE.has(i)||"html"===i&&"head"===r||!!o,s=e.attrs.map(function(e){let n,r,i,o,a,s;function u(t){return a=e[t],r=e[t+1],void 0!==r?'"':(r=e[t+2],void 0!==r?"'":(r=e[t+3],void 0===r&&TE.has(n)&&(r=n),""))}CE&&-1===e[0].indexOf('""')&&(""===e[3]&&delete e[3],""===e[4]&&delete e[4],""===e[5]&&delete e[5]);let c=1;if(t.customAttrSurround)for(let r=0,a=t.customAttrSurround.length;r<a;r++,c+=7)if(n=e[c+1],n){s=u(c+2),i=e[c],o=e[c+6];break}return!n&&(n=e[c])&&(s=u(c+1)),{name:n,value:r,customAssign:a||"=",customOpen:i||"",customClose:o||"",quote:s||""}});a||(n.push({tag:i,attrs:s}),r=i,o=""),t.start&&await t.start(i,s,a,o)}function f(e){let t;const r=e.toLowerCase();for(t=n.length-1;t>=0&&n[t].tag.toLowerCase()!==r;t--);return t}async function p(e,i){let o;if(o=i?f(i):0,o>=0){for(let r=n.length-1;r>=o;r--)t.end&&t.end(n[r].tag,n[r].attrs,r>o||!e);n.length=o,r=o&&n[o-1].tag}else"br"===i.toLowerCase()?t.start&&await t.start(i,[],!0,""):"p"===i.toLowerCase()&&(t.start&&await t.start(i,[],!1,"",!0),t.end&&t.end(i,[]))}t.partialMarkup||await p()}}class BE{sort(e,t=0){for(let n=0,r=this.keys.length;n<r;n++){const r=this.keys[n],i=r.slice(1);let o=e.indexOf(i,t);if(-1!==o){do{o!==t&&(e.splice(o,1),e.splice(t,0,i)),t++}while(-1!==(o=e.indexOf(i,t)));return this[r].sort(e,t)}}return e}}class ME{add(e){e.forEach(t=>{const n="$"+t;this[n]||(this[n]=[],this[n].processed=0),this[n].push(e)})}createSorter(){const e=new BE;return e.keys=Object.keys(this).sort((e,t)=>{const n=this[e].length,r=this[t].length;return n<r?1:n>r||e<t?-1:e>t?1:0}).filter(t=>{if(this[t].processed<this[t].length){const n=t.slice(1),r=new ME;return this[t].forEach(e=>{let t;for(;-1!==(t=e.indexOf(n));)e.splice(t,1);e.forEach(e=>{this["$"+e].processed++}),r.add(e.slice(0))}),e[t]=r.createSorter(),!0}return!1}),e}}const NE=e=>e&&e.replace(/^[ \n\r\t\f]+/,"").replace(/[ \n\r\t\f]+$/,"");function LE(e){return e&&e.replace(/[ \n\r\t\f\xA0]+/g,function(e){return"\t"===e?"\t":e.replace(/(^|\xA0+)[^\xA0]+/g,"$1 ")})}function PE(e,t,n,r,i){let o="",a="";return t.preserveLineBreaks&&(e=e.replace(/^[ \n\r\t\f]*?[\n\r][ \n\r\t\f]*/,function(){return o="\n",""}).replace(/[ \n\r\t\f]*?[\n\r][ \n\r\t\f]*$/,function(){return a="\n",""})),n&&(e=e.replace(/^[ \n\r\t\f\xA0]+/,function(e){const n=!o&&t.conservativeCollapse;return n&&"\t"===e?"\t":e.replace(/^[^\xA0]+/,"").replace(/(\xA0+)[^\xA0]+/g,"$1 ")||(n?" ":"")})),r&&(e=e.replace(/[ \n\r\t\f\xA0]+$/,function(e){const n=!a&&t.conservativeCollapse;return n&&"\t"===e?"\t":e.replace(/[^\xA0]+(\xA0+)/g," $1").replace(/[^\xA0]+$/,"")||(n?" ":"")})),i&&(e=LE(e)),o+e+a}const UE=["a","abbr","acronym","b","bdi","bdo","big","button","cite","code","del","dfn","em","font","i","img","input","ins","kbd","label","mark","math","meter","nobr","object","output","progress","q","rb","rp","rt","rtc","ruby","s","samp","select","small","span","strike","strong","sub","sup","svg","textarea","time","tt","u","var","wbr"],VE=new Set(["a","abbr","acronym","b","big","del","em","font","i","ins","kbd","mark","nobr","s","samp","small","span","strike","strong","sub","sup","time","tt","u","var"]),KE=new Set(["comment","img","input","wbr"]);function GE(e,t,n,r,i,o){let a=t&&!KE.has(t);a&&!r.collapseInlineTagWhitespace&&(a="/"===t.charAt(0)?!i.has(t.slice(1)):!o.has(t));let s=n&&!KE.has(n);return s&&!r.collapseInlineTagWhitespace&&(s="/"===n.charAt(0)?!o.has(n.slice(1)):!i.has(n)),PE(e,r,a,s,t&&n)}function HE(e,t){for(let n=e.length;n--;)if(e[n].name.toLowerCase()===t)return!0;return!1}const WE={autocorrect:"on",fetchpriority:"auto",loading:"eager",popovertargetaction:"toggle"},zE={area:{shape:"rect"},button:{type:"submit"},form:{enctype:"application/x-www-form-urlencoded",method:"get"},html:{dir:"ltr"},img:{decoding:"auto"},input:{colorspace:"limited-srgb",type:"text"},marquee:{behavior:"scroll",direction:"left"},style:{media:"all"},textarea:{wrap:"soft"},track:{kind:"subtitles"}};const YE=new Set(["text/javascript","text/ecmascript","text/jscript","application/javascript","application/x-javascript","application/ecmascript","module"]),XE=new Set(["module"]);function QE(e=""){return""===(e=NE(e.split(/;/,2)[0]).toLowerCase())||YE.has(e)}function jE(e=""){return""===(e=NE(e).toLowerCase())||"text/css"===e}function qE(e,t){if("style"!==e)return!1;for(let e=0,n=t.length;e<n;e++){if("type"===t[e].name.toLowerCase())return jE(t[e].value)}return!0}const ZE=new Set(["allowfullscreen","async","autofocus","autoplay","checked","compact","controls","declare","default","defaultchecked","defaultmuted","defaultselected","defer","disabled","enabled","formnovalidate","hidden","indeterminate","inert","ismap","itemscope","loop","multiple","muted","nohref","noresize","noshade","novalidate","nowrap","open","pauseonexit","readonly","required","reversed","scoped","seamless","selected","sortable","truespeed","typemustmatch","visible"]),JE=new Set(["true","false"]);function $E(e,t,n){if("link"!==e)return!1;const r=String(n).toLowerCase();for(let e=0;e<t.length;e++)if("rel"===t[e].name.toLowerCase()){if(String(t[e].value).toLowerCase().split(/\s+/).includes(r))return!0}return!1}const ev=new Set(["img","source"]);async function tv(e,t,n,r,i,o){if(function(e,t){const n=t.customEventAttributes;if(n){for(let t=n.length;t--;)if(n[t].test(e))return!0;return!1}return/^on[a-z]{3,}$/.test(e)}(t,r))return n=NE(n).replace(/^javascript:\s*/i,""),r.minifyJS(n,!0);if("class"===t)return n=NE(n),n=r.sortClassName?r.sortClassName(n):LE(n);if(function(e,t){return/^(?:a|area|link|base)$/.test(t)&&"href"===e||"img"===t&&/^(?:src|longdesc|usemap)$/.test(e)||"object"===t&&/^(?:classid|codebase|data|usemap)$/.test(e)||"q"===t&&"cite"===e||"blockquote"===t&&"cite"===e||("ins"===t||"del"===t)&&"cite"===e||"form"===t&&"action"===e||"input"===t&&("src"===e||"usemap"===e)||"head"===t&&"profile"===e||"script"===t&&("src"===e||"for"===e)}(t,e)){if(n=NE(n),$E(e,i,"canonical"))return n;try{const e=await r.minifyURLs(n);return"string"==typeof e?e:n}catch(e){return r.log&&r.log(e),n}}else{if(function(e,t){return/^(?:a|area|object|button)$/.test(t)&&"tabindex"===e||"input"===t&&("maxlength"===e||"tabindex"===e)||"select"===t&&("size"===e||"tabindex"===e)||"textarea"===t&&/^(?:rows|cols|tabindex)$/.test(e)||"colgroup"===t&&"span"===e||"col"===t&&"span"===e||("th"===t||"td"===t)&&("rowspan"===e||"colspan"===e)}(t,e))return NE(n);if("style"===t)return(n=NE(n))&&(/;$/.test(n)&&!/&#?[0-9a-zA-Z]+;$/.test(n)&&(n=n.replace(/\s*;$/,";")),n=await r.minifyCSS(n,"inline")),n;if(function(e,t){return"srcset"===e&&ev.has(t)}(t,e))n=(await Promise.all(NE(n).split(/\s+,\s*|\s*,\s+/).map(async function(e){let t=e,n="";const i=e.match(/\s+([1-9][0-9]*w|[0-9]+(?:\.[0-9]+)?x)$/);if(i){t=t.slice(0,-i[0].length);const e=+i[1].slice(0,-1),r=i[1].slice(-1);1===e&&"x"===r||(n=" "+e+r)}try{const e=await r.minifyURLs(t);return("string"==typeof e?e:t)+n}catch(e){return r.log&&r.log(e),t+n}}))).join(", ");else if(function(e,t){if("meta"!==e)return!1;for(let e=0,n=t.length;e<n;e++)if("name"===t[e].name&&"viewport"===t[e].value)return!0}(e,i)&&"content"===t)n=n.replace(/\s+/g,"").replace(/[0-9]+\.[0-9]+/g,function(e){return(+e).toString()});else{if(function(e,t){if("meta"!==e)return!1;for(let e=0,n=t.length;e<n;e++)if("http-equiv"===t[e].name.toLowerCase()&&"content-security-policy"===t[e].value.toLowerCase())return!0}(e,i)&&"content"===t.toLowerCase())return LE(n);if(r.customAttrCollapse&&r.customAttrCollapse.test(t))n=NE(n.replace(/ ?[\n\r]+ ?/g,"").replace(/\s{2,}/g,r.conservativeCollapse?" ":""));else if("script"===e&&"type"===t)n=NE(n.replace(/\s*;\s*/g,";"));else{if(function(e,t,n){return"media"===n&&($E(e,t,"stylesheet")||qE(e,t))}(e,i,t))return n=NE(n),r.minifyCSS(n,"media");if("iframe"===e&&"srcdoc"===t)return function(e){return Boolean(e.collapseWhitespace||e.removeComments||e.removeOptionalTags||e.minifyJS!==Rv||e.minifyCSS!==Tv||e.minifyURLs!==Rv)}(r)?o(n,r,!0):n}}}return n}function nv(e){return"/* clean-css ignore:start */"+e+"/* clean-css ignore:end */"}function rv(e,t){switch(t){case"inline":return"*{"+e+"}";case"media":return"@media "+e+"{a{top:0}}";default:return e}}const iv=new Set(["html","head","body","colgroup","tbody"]),ov=new Set(["html","head","body","li","dt","dd","p","rb","rt","rtc","rp","optgroup","option","colgroup","caption","thead","tbody","tfoot","tr","td","th"]),av=new Set(["meta","link","script","style","template","noscript"]),sv=new Set(["dt","dd"]),uv=new Set(["address","article","aside","blockquote","details","dialog","div","dl","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","main","menu","nav","ol","p","pre","search","section","table","ul"]),cv=new Set(["a","audio","del","ins","map","noscript","video"]),lv=new Set(["rb","rt","rtc","rp"]),fv=new Set(["rb","rtc"]),pv=new Set(["option","optgroup"]),dv=new Set(["tbody","tfoot"]),hv=new Set(["thead","tbody","tfoot"]),Av=new Set(["td","th"]),mv=new Set(["html","head","body"]),gv=new Set(["html","body"]),_v=new Set(["head","colgroup","caption"]),Ev=new Set(["dt","thead"]),vv=new Set(["a","abbr","acronym","address","applet","area","article","aside","audio","b","base","basefont","bdi","bdo","bgsound","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","command","content","data","datalist","dd","del","details","dfn","dialog","dir","div","dl","dt","element","em","embed","fieldset","figcaption","figure","font","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","image","img","input","ins","isindex","kbd","keygen","label","legend","li","link","listing","main","map","mark","marquee","menu","menuitem","meta","meter","multicol","nav","nobr","noembed","noframes","noscript","object","ol","optgroup","option","output","p","param","picture","plaintext","pre","progress","q","rb","rp","rt","rtc","ruby","s","samp","script","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","tt","u","ul","var","video","wbr","xmp"]);const bv=new RegExp("^(?:class|id|style|title|lang|dir|on(?:focus|blur|change|click|dblclick|mouse(?:down|up|over|move|out)|key(?:press|down|up)))$");function yv(e,t){for(let n=t.length-1;n>=0;n--)if(t[n].name===e)return!0;return!1}function Sv(e){return!/^(?:script|style|pre|textarea)$/.test(e)}function Cv(e){return!/^(?:pre|textarea)$/.test(e)}async function Dv(e,t,n,r){const i=r.name(e.name);let o=e.value;if(r.decodeEntities&&o&&(o=Jl(o,Ql.Strict)),!(r.removeRedundantAttributes&&function(e,t,n,r){return n=n?NE(n.toLowerCase()):"","script"===e&&"language"===t&&"javascript"===n||"script"===e&&"charset"===t&&!HE(r,"src")||!("a"!==e||"name"!==t||!HE(r,"id"))||WE[t]===n||zE[e]?.[t]===n}(n,i,o,t)||r.removeScriptTypeAttributes&&"script"===n&&"type"===i&&QE(o)&&!function(e=""){return e=NE(e.split(/;/,2)[0]).toLowerCase(),XE.has(e)}(o)||r.removeStyleLinkTypeAttributes&&("style"===n||"link"===n)&&"type"===i&&jE(o)||(o&&(o=await tv(n,i,o,r,t,Fv)),r.removeEmptyAttributes&&function(e,t,n,r){return!(n&&!/^\s*$/.test(n))&&("function"==typeof r.removeEmptyAttributes?r.removeEmptyAttributes(t,e):"input"===e&&"value"===t||bv.test(t))}(n,i,o,r))))return r.decodeEntities&&o&&(o=o.replace(/&(#?[0-9a-zA-Z]+;)/g,"&amp;$1")),{attr:e,name:i,value:o}}function wv(e,t,n,r,i){const o=e.name;let a=e.value;const s=e.attr;let u,c,l=s.quote;if(void 0===a||n.removeAttributeQuotes&&!~a.indexOf(i)&&/^[^ \t\n\f\r"'`=<>]+$/.test(a))c=!r||t||/\/$/.test(a)?a+" ":a;else{if(!n.preventAttributesEscaping){if(void 0===n.quoteCharacter){l=(a.match(/'/g)||[]).length<(a.match(/"/g)||[]).length?"'":'"'}else l="'"===n.quoteCharacter?"'":'"';a='"'===l?a.replace(/"/g,"&#34;"):a.replace(/'/g,"&#39;")}c=l+a+l,r||n.removeTagWhitespace||(c+=" ")}return void 0===a||n.collapseBooleanAttributes&&function(e,t){return ZE.has(e)||"draggable"===e&&!JE.has(t)}(o.toLowerCase(),a.toLowerCase())?(u=o,r||(u+=" ")):u=o+s.customAssign+c,s.customOpen+u+s.customClose}function Rv(e){return e}function Tv(e){return Promise.resolve(e)}const Ov=e=>{const t={name:function(e){return e.toLowerCase()},canCollapseWhitespace:Sv,canTrimWhitespace:Cv,html5:!0,ignoreCustomComments:[/^!/,/^\s*#/],ignoreCustomFragments:[/<%[\s\S]*?%>/,/<\?[\s\S]*?\?>/],includeAutoGeneratedTags:!0,log:Rv,minifyCSS:Tv,minifyJS:Rv,minifyURLs:Rv};return Object.keys(e).forEach(function(n){const r=e[n];if("caseSensitive"===n)r&&(t.name=Rv);else if("log"===n)"function"==typeof r&&(t.log=r);else if("minifyCSS"===n&&"function"!=typeof r){if(!r)return;const e="object"==typeof r?r:{};t.minifyCSS=async function(n,r){const i=rv(n=await hE(n,/(url\s*\(\s*)(?:"([^"]*)"|'([^']*)'|([^\s)]+))(\s*\))/gi,async function(e,n,r,i,o,a){const s=null!=r?'"':null!=i?"'":"",u=r??i??o??"";try{const e=await t.minifyURLs(u);return n+s+("string"==typeof e?e:u)+s+a}catch(n){return t.log&&t.log(n),e}}),r);return new Promise(o=>{new Ll(e).minify(i,(e,i)=>{i.errors.length>0&&(i.errors.forEach(t.log),o(n));const a=function(e,t){let n;switch(t){case"inline":n=e.match(/^\*\{([\s\S]*)\}$/);break;case"media":n=e.match(/^@media ([\s\S]*?)\s*{[\s\S]*}$/)}return n?n[1]:e}(i.styles,r);o(a)})})}}else if("minifyJS"===n&&"function"!=typeof r){if(!r)return;const e="object"==typeof r?r:{};e.parse={...e.parse,bare_returns:!1},t.minifyJS=async function(n,r){const i=n.match(/^\s*<!--.*/),o=i?n.slice(i[0].length).replace(/\n\s*-->\s*$/,""):n;e.parse.bare_returns=r;try{const t=await async function(e,t){const n=dE(e,t);let r,i;do{i=n.next(await r),r=i.value}while(!i.done);return i.value}(o,e);return t.code.replace(/;$/,"")}catch(e){return t.log(e),n}}}else if("minifyURLs"===n&&"function"!=typeof r){if(!r)return;let e=r;"string"==typeof r?e={site:r}:"object"!=typeof r&&(e={}),t.minifyURLs=function(n){try{return Hf.relate(n,e)}catch(e){return t.log(e),n}}}else t[n]=r}),t};function Iv(e){let t;do{t=Math.random().toString(36).replace(/^0\.[0-9]*/,"")}while(~e.indexOf(t));return t}const kv=new Set(["script","style"]);async function Fv(e,t,n){if(t.maxInputLength&&e.length>t.maxInputLength)throw new Error(`Input length (${e.length}) exceeds maximum allowed length (${t.maxInputLength})`);t.collapseWhitespace&&(e=PE(e,t,!0,!0));const r=[];let i,o,a="",s="",u=[];const c=[],l=[];let f="",p="";const d=[],h=[];let A,m,g;const _=t.inlineCustomElements??[],E=(Array.isArray(_)?_:Array.from(_)).map(e=>t.name(e)),v=new Set([...VE,...E]),b=new Set([...UE,...E]);e=e.replace(/<!-- htmlmin:ignore -->([\s\S]*?)<!-- htmlmin:ignore -->/g,function(n,r){if(!A){A=Iv(e);const n=new RegExp("^"+A+"([0-9]+)$");t.ignoreCustomComments?t.ignoreCustomComments=t.ignoreCustomComments.slice():t.ignoreCustomComments=[],t.ignoreCustomComments.push(n)}const i="\x3c!--"+A+d.length+"--\x3e";return d.push(r),i});const y=t.ignoreCustomFragments.map(function(e){return e.source});if(y.length){for(let e=0;e<y.length;e++)if(/[*+]/.test(y[e])){t.log("Warning: Custom fragment contains unlimited quantifiers (* or +) which may cause ReDoS vulnerability");break}const n=t.customFragmentQuantifierLimit||200,r=`\\s{0,${n}}`,i=new RegExp(r+"(?:"+y.join("|")+"){1,"+n+"}"+r,"g");e=e.replace(i,function(n){var r;m||(m=Iv(e),g=new RegExp("(\\s*)"+m+"([0-9]+)"+m+"(\\s*)","g"),t.minifyCSS&&(t.minifyCSS=(r=t.minifyCSS,function(e,t){e=e.replace(g,function(e,t,n){const r=h[+n];return r[1]+m+n+m+r[2]});const n=[];return(new Ll).minify(rv(e,t)).warnings.forEach(function(t){const r=g.exec(t);if(r){const t=m+r[2]+m;e=e.replace(t,nv(t)),n.push(t)}}),r(e,t).then(e=>(n.forEach(function(t){e=e.replace(nv(t),t)}),e))})),t.minifyJS&&(t.minifyJS=function(e){return function(t,n){return e(t.replace(g,function(e,t,n){const r=h[+n];return r[1]+m+n+m+r[2]}),n)}}(t.minifyJS)));const i=m+h.length+m;return h.push(/^(\s*)[\s\S]*?(\s*)$/.exec(n)),"\t"+i+"\t"})}function S(e,n){return t.canTrimWhitespace(e,n,Cv)}function C(){let e=r.length-1;for(;e>0&&!/^<[^/!]/.test(r[e]);)e--;r.length=Math.max(0,e)}function D(){let e=r.length-1;for(;e>0&&!/^<\//.test(r[e]);)e--;r.length=Math.max(0,e)}function w(e,n){for(let i=null;e>=0&&S(i);e--){const o=r[e],a=o.match(/^<\/([\w:-]+)>$/);if(a)i=a[1];else if(/>$/.test(o)||(r[e]=GE(o,null,n,t,b,v)))break}}function R(e){let t=r.length-1;if(r.length>1){const e=r[r.length-1];/^(?:<!|$)/.test(e)&&-1===e.indexOf(A)&&t--}w(t,e)}(t.sortAttributes&&"function"!=typeof t.sortAttributes||t.sortClassName&&"function"!=typeof t.sortClassName)&&await async function(e,t,n,r){const i=t.sortAttributes&&Object.create(null),o=t.sortClassName&&new ME;function a(e){return e.map(function(e){return t.name(e.name)})}function s(e,t){return!t||-1===e.indexOf(t)}function u(e){return s(e,n)&&s(e,r)}const c=t.log;if(t.log=Rv,t.sortAttributes=!1,t.sortClassName=!1,await async function e(n){let r,s;const c=new xE(n,{start:function(e,n){i&&(i[e]||(i[e]=new ME),i[e].add(a(n).filter(u)));for(let i=0,a=n.length;i<a;i++){const a=n[i];o&&a.value&&"class"===t.name(a.name)?o.add(NE(a.value).split(/[ \t\n\f\r]+/).filter(u)):t.processScripts&&"type"===a.name.toLowerCase()&&(r=e,s=a.value)}},end:function(){r=""},chars:async function(n){t.processScripts&&kv.has(r)&&t.processScripts.indexOf(s)>-1&&await e(n)}});await c.parse()}(await Fv(e,t)),t.log=c,i){const e=Object.create(null);for(const t in i)e[t]=i[t].createSorter();t.sortAttributes=function(t,n){const r=e[t];if(r){const e=Object.create(null),t=a(n);t.forEach(function(t,r){(e[t]||(e[t]=[])).push(n[r])}),r.sort(t).forEach(function(t,r){n[r]=e[t].shift()})}}}if(o){const e=o.createSorter();t.sortClassName=function(t){return e.sort(t.split(/[ \n\f\r]+/)).join(" ")}}}(e,t,A,m);const T=new xE(e,{partialMarkup:n,continueOnParseError:t.continueOnParseError,customAttrAssign:t.customAttrAssign,customAttrSurround:t.customAttrSurround,html5:t.html5,start:async function(e,n,d,h,A){"svg"===e.toLowerCase()&&((t=Object.create(t)).caseSensitive=!0,t.keepClosingSlash=!0,t.name=Rv),e=t.name(e),s=e,i=e,v.has(e)||(a=""),o=!1,u=n;let g=t.removeOptionalTags;if(g){const t=vv.has(e);t&&function(e,t){switch(e){case"html":case"head":return!0;case"body":return!av.has(t);case"colgroup":return"col"===t;case"tbody":return"tr"===t}return!1}(f,e)&&C(),f="",t&&function(e,t){switch(e){case"html":case"head":case"body":case"colgroup":case"caption":return!0;case"li":case"optgroup":case"tr":return t===e;case"dt":case"dd":return sv.has(t);case"p":return uv.has(t);case"rb":case"rt":case"rp":return lv.has(t);case"rtc":return fv.has(t);case"option":return pv.has(t);case"thead":case"tbody":return dv.has(t);case"tfoot":return"tbody"===t;case"td":case"th":return Av.has(t)}return!1}(p,e)&&(D(),g=!function(e,t){switch(t){case"colgroup":return"colgroup"===e;case"tbody":return hv.has(e)}return!1}(p,e)),p=""}t.collapseWhitespace&&(c.length||R(e),d||(S(e,n)&&!c.length||c.push(e),function(e,n){return t.canCollapseWhitespace(e,n,Sv)}(e,n)&&!l.length||l.push(e)));const _="<"+e,E=h&&t.keepClosingSlash;r.push(_),t.sortAttributes&&t.sortAttributes(e,n);const b=[];for(let r=n.length,i=!0;--r>=0;){const o=await Dv(n[r],n,e,t);o&&(b.unshift(wv(o,E,t,i,m)),i=!1)}b.length>0?(r.push(" "),r.push.apply(r,b)):g&&iv.has(e)&&(f=e),r.push(r.pop()+(E?"/":"")+">"),A&&!t.includeAutoGeneratedTags&&(C(),f="")},end:function(e,n,u){"svg"===e.toLowerCase()&&(t=Object.getPrototypeOf(t)),e=t.name(e),t.collapseWhitespace&&(c.length?e===c[c.length-1]&&c.pop():R("/"+e),l.length&&e===l[l.length-1]&&l.pop());let d=!1;e===s&&(s="",d=!o),t.removeOptionalTags&&(d&&mv.has(f)&&C(),f="",!vv.has(e)||!p||Ev.has(p)||"p"===p&&cv.has(e)||D(),p=ov.has(e)?e:""),t.removeEmptyElements&&d&&function(e,t){switch(e){case"textarea":return!1;case"audio":case"script":case"video":if(yv("src",t))return!1;break;case"iframe":if(yv("src",t)||yv("srcdoc",t))return!1;break;case"object":if(yv("data",t))return!1;break;case"applet":if(yv("code",t))return!1}return!0}(e,n)?(C(),f="",p=""):(u&&!t.includeAutoGeneratedTags?p="":r.push("</"+e+">"),i="/"+e,b.has(e)?d&&(a+="|"):a="")},chars:async function(e,n,d){if(n=""===n?"comment":n,d=""===d?"comment":d,t.decodeEntities&&e&&!kv.has(s)&&(e=function(e,t=Ql.Legacy){return Jl(e,t)}(e)),t.collapseWhitespace){if(!c.length){if("comment"===n){const o=r[r.length-1];if(-1===o.indexOf(A)&&(o||(n=i),r.length>1&&(!o||!t.conservativeCollapse&&/ $/.test(a)))){const t=r.length-2;r[t]=r[t].replace(/\s+$/,function(t){return e=t+e,""})}}if(n)if("/nobr"===n||"wbr"===n){if(/^\s/.test(e)){let e=r.length-1;for(;e>0&&0!==r[e].lastIndexOf("<"+n);)e--;w(e-1,"br")}}else v.has("/"===n.charAt(0)?n.slice(1):n)&&(e=PE(e,t,/(?:^|\s)$/.test(a)));!(e=n||d?GE(e,n,d,t,b,v):PE(e,t,!0,!0))&&/\s$/.test(a)&&n&&"/"===n.charAt(0)&&w(r.length-1,d)}l.length||"html"===d||n&&d||(e=PE(e,t,!1,!1,!0))}t.processScripts&&kv.has(s)&&(e=await async function(e,t,n){for(let r=0,i=n.length;r<i;r++)if("type"===n[r].name.toLowerCase()&&t.processScripts.indexOf(n[r].value)>-1)return await Fv(e,t);return e}(e,t,u)),function(e,t){if("script"!==e)return!1;for(let e=0,n=t.length;e<n;e++)if("type"===t[e].name.toLowerCase())return QE(t[e].value);return!0}(s,u)&&(e=await t.minifyJS(e)),qE(s,u)&&(e=await t.minifyCSS(e)),t.removeOptionalTags&&e&&(("html"===f||"body"===f&&!/^\s/.test(e))&&C(),f="",(gv.has(p)||_v.has(p)&&!/^\s/.test(e))&&D(),/^\s+$/.test(e)&&t.collapseWhitespace&&!t.conservativeCollapse||(p="")),i=/^\s*$/.test(e)?n:"comment",t.decodeEntities&&e&&!kv.has(s)&&(e=e.replace(/&((?:Iacute|aacute|uacute|plusmn|Otilde|otilde|agrave|Agrave|Yacute|yacute|Oslash|oslash|atilde|Atilde|brvbar|ccedil|Ccedil|Ograve|curren|divide|eacute|Eacute|ograve|Oacute|egrave|Egrave|Ugrave|frac12|frac14|frac34|ugrave|oacute|iacute|Ntilde|ntilde|Uacute|middot|igrave|Igrave|iquest|Aacute|cedil|laquo|micro|iexcl|Icirc|icirc|acirc|Ucirc|Ecirc|ocirc|Ocirc|ecirc|ucirc|Aring|aring|AElig|aelig|acute|pound|raquo|Acirc|times|THORN|szlig|thorn|COPY|auml|ordf|ordm|Uuml|macr|uuml|Auml|ouml|Ouml|para|nbsp|euml|quot|QUOT|Euml|yuml|cent|sect|copy|sup1|sup2|sup3|iuml|Iuml|ETH|shy|reg|not|yen|amp|AMP|REG|uml|eth|deg|gt|GT|LT|lt)(?!;)|(?:#?[0-9a-zA-Z]+;))/g,"&amp$1").replace(/</g,"&lt;")),g&&t.collapseWhitespace&&c.length&&(e=e.replace(g,function(e,t,n){return h[+n][0]})),a+=e,e&&(o=!0),r.push(e)},comment:async function(e,n){const i=n?"<!":"\x3c!--",o=n?">":"--\x3e";e=function(e){return/^\[if\s[^\]]+]|\[endif]$/.test(e)}(e)?i+await async function(e,t){return t.processConditionalComments?await hE(e,/^(\[if\s[^\]]+]>)([\s\S]*?)(<!\[endif])$/,async function(e,n,r,i){return n+await Fv(r,t,!0)+i}):e}(e,t)+o:t.removeComments?function(e,t){for(let n=0,r=t.ignoreCustomComments.length;n<r;n++)if(t.ignoreCustomComments[n].test(e))return!0;return!1}(e,t)?"\x3c!--"+e+"--\x3e":"":i+e+o,t.removeOptionalTags&&e&&(f="",p=""),r.push(e)},doctype:function(e){r.push(t.useShortDoctype?"<!doctype"+(t.removeTagWhitespace?"":" ")+"html>":LE(e))}});return await T.parse(),t.removeOptionalTags&&(mv.has(f)&&C(),p&&!Ev.has(p)&&D()),t.collapseWhitespace&&R("br"),function(e,t,n,r){let i;const o=t.maxLineLength,a=t.noNewlinesBeforeTagClose;if(o){let t="";const s=[];for(;e.length;){const i=t.length,u=e[0].indexOf("\n"),c=Boolean(e[0].match(yE)),l=a&&c;u<0?t+=r(n(e.shift())):(t+=r(n(e[0].slice(0,u))),e[0]=e[0].slice(u+1)),i>0&&t.length>o&&!l?(s.push(t.slice(0,i)),t=t.slice(i)):u>=0&&(s.push(t),t="")}t&&s.push(t),i=s.join("\n")}else i=r(n(e.join("")));return t.collapseWhitespace?PE(i,t,!0,!0):i}(r,t,g?function(e){return e.replace(g,function(e,n,r,i){let o=h[+r][0];return t.collapseWhitespace?("\t"!==n&&(o=n+o),"\t"!==i&&(o+=i),PE(o,{preserveLineBreaks:t.preserveLineBreaks,conservativeCollapse:!t.trimCustomFragments},/^[ \n\r\t\f]/.test(o),/[ \n\r\t\f]$/.test(o))):o})}:Rv,A?function(e){return e.replace(new RegExp("\x3c!--"+A+"([0-9]+)--\x3e","g"),function(e,t){return d[+t]})}:Rv)}const xv=async function(e,t){const n=Date.now();t=Ov(t||{});const r=await Fv(e,t);return t.log("minified in: "+(Date.now()-n)+"ms"),r};var Bv={minify:xv};e.default=Bv,e.minify=xv,Object.defineProperty(e,"__esModule",{value:!0})});
package/package.json CHANGED
@@ -78,5 +78,5 @@
78
78
  "test:watch": "node --test --watch tests/*.spec.js"
79
79
  },
80
80
  "type": "module",
81
- "version": "2.1.8"
81
+ "version": "3.0.0"
82
82
  }
@@ -117,34 +117,58 @@ function attributesInclude(attributes, attribute) {
117
117
  return false;
118
118
  }
119
119
 
120
- function isAttributeRedundant(tag, attrName, attrValue, attrs) {
121
- attrValue = attrValue ? trimWhitespace(attrValue.toLowerCase()) : '';
122
-
123
- return (
124
- (tag === 'script' &&
125
- attrName === 'language' &&
126
- attrValue === 'javascript') ||
120
+ // Default attribute values (could apply to any element)
121
+ const generalDefaults = {
122
+ autocorrect: 'on',
123
+ fetchpriority: 'auto',
124
+ loading: 'eager',
125
+ popovertargetaction: 'toggle'
126
+ };
127
127
 
128
- (tag === 'form' &&
129
- attrName === 'method' &&
130
- attrValue === 'get') ||
128
+ // Tag-specific default attribute values
129
+ const tagDefaults = {
130
+ area: { shape: 'rect' },
131
+ button: { type: 'submit' },
132
+ form: {
133
+ enctype: 'application/x-www-form-urlencoded',
134
+ method: 'get'
135
+ },
136
+ html: { dir: 'ltr' },
137
+ img: { decoding: 'auto' },
138
+ input: {
139
+ colorspace: 'limited-srgb',
140
+ type: 'text'
141
+ },
142
+ marquee: {
143
+ behavior: 'scroll',
144
+ direction: 'left'
145
+ },
146
+ style: { media: 'all' },
147
+ textarea: { wrap: 'soft' },
148
+ track: { kind: 'subtitles' }
149
+ };
131
150
 
132
- (tag === 'input' &&
133
- attrName === 'type' &&
134
- attrValue === 'text') ||
151
+ function isAttributeRedundant(tag, attrName, attrValue, attrs) {
152
+ attrValue = attrValue ? trimWhitespace(attrValue.toLowerCase()) : '';
135
153
 
136
- (tag === 'script' &&
137
- attrName === 'charset' &&
138
- !attributesInclude(attrs, 'src')) ||
154
+ // Legacy attributes
155
+ if (tag === 'script' && attrName === 'language' && attrValue === 'javascript') {
156
+ return true;
157
+ }
158
+ if (tag === 'script' && attrName === 'charset' && !attributesInclude(attrs, 'src')) {
159
+ return true;
160
+ }
161
+ if (tag === 'a' && attrName === 'name' && attributesInclude(attrs, 'id')) {
162
+ return true;
163
+ }
139
164
 
140
- (tag === 'a' &&
141
- attrName === 'name' &&
142
- attributesInclude(attrs, 'id')) ||
165
+ // Check general defaults
166
+ if (generalDefaults[attrName] === attrValue) {
167
+ return true;
168
+ }
143
169
 
144
- (tag === 'area' &&
145
- attrName === 'shape' &&
146
- attrValue === 'rect')
147
- );
170
+ // Check tag-specific defaults
171
+ return tagDefaults[tag]?.[attrName] === attrValue;
148
172
  }
149
173
 
150
174
  // https://mathiasbynens.be/demo/javascript-mime-type