UNPKG

email-comb

Version:

Remove unused CSS from email templates

10 lines (9 loc) 69 kB
/** * @name email-comb * @fileoverview Remove unused CSS from email templates * @version 7.1.0 * @author Roy Revelt * @license MIT * {@link https://codsen.com/os/email-comb/} */ "use strict";var emailComb=(()=>{var on=Object.create,Vt=Object.freeze,Ne=Object.defineProperty;var sn=Object.getOwnPropertyDescriptor;var an=Object.getOwnPropertyNames,Lt=Object.getOwnPropertySymbols,un=Object.getPrototypeOf,Wt=Object.prototype.hasOwnProperty,cn=Object.prototype.propertyIsEnumerable;var gt=(e,l,u)=>l in e?Ne(e,l,{enumerable:!0,configurable:!0,writable:!0,value:u}):e[l]=u,V=(e,l)=>{for(var u in l||(l={}))Wt.call(l,u)&&gt(e,u,l[u]);if(Lt)for(var u of Lt(l))cn.call(l,u)&&gt(e,u,l[u]);return e};var gn=(e,l)=>()=>(l||e((l={exports:{}}).exports,l),l.exports),fn=(e,l)=>{for(var u in l)Ne(e,u,{get:l[u],enumerable:!0})},xt=(e,l,u,t)=>{if(l&&typeof l=="object"||typeof l=="function")for(let c of an(l))!Wt.call(e,c)&&c!==u&&Ne(e,c,{get:()=>l[c],enumerable:!(t=sn(l,c))||t.enumerable});return e};var Ht=(e,l,u)=>(u=e!=null?on(un(e)):{},xt(l||!e||!e.__esModule?Ne(u,"default",{value:e,enumerable:!0}):u,e)),hn=e=>xt(Ne({},"__esModule",{value:!0}),e);var ft=(e,l,u)=>gt(e,typeof l!="symbol"?l+"":l,u);var et=(e,l)=>Vt(Ne(e,"raw",{value:Vt(l||e.slice())}));var ht=gn((Wn,Mt)=>{"use strict";Mt.exports=mn;function Ve(e){return e instanceof Buffer?Buffer.from(e):new e.constructor(e.buffer.slice(),e.byteOffset,e.length)}function mn(e){if(e=e||{},e.circles)return dn(e);let l=new Map;if(l.set(Date,a=>new Date(a)),l.set(Map,(a,r)=>new Map(t(Array.from(a),r))),l.set(Set,(a,r)=>new Set(t(Array.from(a),r))),e.constructorHandlers)for(let a of e.constructorHandlers)l.set(a[0],a[1]);let u=null;return e.proto?o:c;function t(a,r){let g=Object.keys(a),s=new Array(g.length);for(let f=0;f<g.length;f++){let $=g[f],A=a[$];typeof A!="object"||A===null?s[$]=A:A.constructor!==Object&&(u=l.get(A.constructor))?s[$]=u(A,r):ArrayBuffer.isView(A)?s[$]=Ve(A):s[$]=r(A)}return s}function c(a){if(typeof a!="object"||a===null)return a;if(Array.isArray(a))return t(a,c);if(a.constructor!==Object&&(u=l.get(a.constructor)))return u(a,c);let r={};for(let g in a){if(Object.hasOwnProperty.call(a,g)===!1)continue;let s=a[g];typeof s!="object"||s===null?r[g]=s:s.constructor!==Object&&(u=l.get(s.constructor))?r[g]=u(s,c):ArrayBuffer.isView(s)?r[g]=Ve(s):r[g]=c(s)}return r}function o(a){if(typeof a!="object"||a===null)return a;if(Array.isArray(a))return t(a,o);if(a.constructor!==Object&&(u=l.get(a.constructor)))return u(a,o);let r={};for(let g in a){let s=a[g];typeof s!="object"||s===null?r[g]=s:s.constructor!==Object&&(u=l.get(s.constructor))?r[g]=u(s,o):ArrayBuffer.isView(s)?r[g]=Ve(s):r[g]=o(s)}return r}}function dn(e){let l=[],u=[],t=new Map;if(t.set(Date,g=>new Date(g)),t.set(Map,(g,s)=>new Map(o(Array.from(g),s))),t.set(Set,(g,s)=>new Set(o(Array.from(g),s))),e.constructorHandlers)for(let g of e.constructorHandlers)t.set(g[0],g[1]);let c=null;return e.proto?r:a;function o(g,s){let f=Object.keys(g),$=new Array(f.length);for(let A=0;A<f.length;A++){let y=f[A],p=g[y];if(typeof p!="object"||p===null)$[y]=p;else if(p.constructor!==Object&&(c=t.get(p.constructor)))$[y]=c(p,s);else if(ArrayBuffer.isView(p))$[y]=Ve(p);else{let N=l.indexOf(p);N!==-1?$[y]=u[N]:$[y]=s(p)}}return $}function a(g){if(typeof g!="object"||g===null)return g;if(Array.isArray(g))return o(g,a);if(g.constructor!==Object&&(c=t.get(g.constructor)))return c(g,a);let s={};l.push(g),u.push(s);for(let f in g){if(Object.hasOwnProperty.call(g,f)===!1)continue;let $=g[f];if(typeof $!="object"||$===null)s[f]=$;else if($.constructor!==Object&&(c=t.get($.constructor)))s[f]=c($,a);else if(ArrayBuffer.isView($))s[f]=Ve($);else{let A=l.indexOf($);A!==-1?s[f]=u[A]:s[f]=a($)}}return l.pop(),u.pop(),s}function r(g){if(typeof g!="object"||g===null)return g;if(Array.isArray(g))return o(g,r);if(g.constructor!==Object&&(c=t.get(g.constructor)))return c(g,r);let s={};l.push(g),u.push(s);for(let f in g){let $=g[f];if(typeof $!="object"||$===null)s[f]=$;else if($.constructor!==Object&&(c=t.get($.constructor)))s[f]=c($,r);else if(ArrayBuffer.isView($))s[f]=Ve($);else{let A=l.indexOf($);A!==-1?s[f]=u[A]:s[f]=r($)}}return l.pop(),u.pop(),s}}});var Nn={};fn(Nn,{comb:()=>Rn,defaults:()=>rn,version:()=>vn});function kt(e){return typeof e!="string"?e:e.length?[e]:[]}var Ft=Ht(ht(),1);var xn=(0,Ft.default)();function we(e){return W(e)&&e.length===1&&e.toUpperCase()!==e.toLowerCase()}function Ue(e){return!!(e&&W(e)&&(e.charCodeAt(0)>64&&e.charCodeAt(0)<91||e.charCodeAt(0)>96&&e.charCodeAt(0)<123))}function ae(e){if(e==null||typeof e!="object")return!1;let l=Object.getPrototypeOf(e);return l!==null&&l!==Object.prototype&&Object.getPrototypeOf(l)!==null?!1:!(Symbol.iterator in e)&&!(Symbol.toStringTag in e)}function W(e){return typeof e=="string"}function Pt(e){return Number.isFinite(e)}function ce(e){return Number.isSafeInteger(e)&&e>=0}function je(e=[],l=[]){return!e||!Array.isArray(e)||!e.length?[]:!l||!Array.isArray(l)||!l.length?e:e.filter(u=>!l.includes(u))}function Ee(e){return e!=null}function Ce(e){return[...new Set(e)]}function Bt(e){if(!(typeof e!="string"||!e)){if(e.includes("\r\n"))return"\r\n";if(e.includes("\n"))return"\n";if(e.includes("\r"))return"\r"}}function Le(e,l){return ae(e)&&W(l)&&l in e}function qe(e,l){return e.localeCompare(l)}function mt(e=[],l=[]){return!e||!l?[]:Array.from(new Set(Array.from(e).filter(u=>new Set(l).has(u))))}var _t={cb:void 0,i:!1,trimBeforeMatching:!1,trimCharsBeforeMatching:[],maxMismatches:0,firstMustMatch:!1,lastMustMatch:!1,hungry:!1},$n=e=>e+1;function pn(e,l,u,t,c=!1,o=$n){var I;let a=typeof u=="function"?u():u;if(+l<0&&c&&a==="EOL")return a;let r=V(V({},_t),t);if(l>=e.length&&!c)return!1;let g=c?1:u.length,s=0,f=!1,$=!1,A=!1,y=r.maxMismatches,p=l,N=!1,H=!1,T=!1;function b(){return s===1&&y<r.maxMismatches-1}for(;e[p];){let D=o(p);if(r.trimBeforeMatching&&e[p].trim()===""){if(!e[D]&&c&&u==="EOL")return!0;p=o(p);continue}if(r&&!r.i&&((I=r==null?void 0:r.trimCharsBeforeMatching)!=null&&I.includes(e[p]))||r!=null&&r.i&&r.trimCharsBeforeMatching&&r.trimCharsBeforeMatching.map(_=>_.toLowerCase()).includes(e[p].toLowerCase())){if(c&&u==="EOL"&&!e[D])return!0;p=o(p);continue}let B=D>p?u[u.length-g]:u[g-1];if(!r.i&&e[p]===B||r.i&&e[p].toLowerCase()===B.toLowerCase()){if(N||(N=!0),A||(A=!0),g===u.length){if(H=!0,y!==r.maxMismatches)return!1}else g===1&&(T=!0);if(g-=1,s++,b())return!1;if(!g)return s!==u.length||y===r.maxMismatches||!f?p:!1}else if(!f&&!s&&(f=!0),r.maxMismatches&&y&&p){y-=1;for(let _=0;_<=y;_++){let J=D>p?u[u.length-g+1+_]:u[g-2-_],oe=e[o(p)];if(J&&(!r.i&&e[p]===J||r.i&&e[p].toLowerCase()===J.toLowerCase())&&(!r.firstMustMatch||g!==u.length)){if(s++,b())return!1;g-=2,N=!0;break}else if(oe&&J&&(!r.i&&oe===J||r.i&&oe.toLowerCase()===J.toLowerCase())&&(!r.firstMustMatch||g!==u.length)){if(!s&&!r.hungry)return!1;g-=1,N=!0;break}else if(J===void 0&&y>=0&&N&&(!r.firstMustMatch||H)&&(!r.lastMustMatch||T))return p}N||($=p)}else return p===0&&g===1&&!r.lastMustMatch&&A?0:!1;if($!==!1&&$!==p&&($=!1),g<1)return p;p=o(p)}if(g>0)return c&&a==="EOL"?!0:r&&r.maxMismatches>=g&&A?$||0:!1}function dt(e,l,u,t,c){var f,$,A;if(ae(c)&&Le(c,"trimBeforeMatching")&&c&&typeof c.trimBeforeMatching!="boolean")throw new Error("string-match-left-right/".concat(e,"(): [THROW_ID_09] opts.trimBeforeMatching should be boolean!").concat(Array.isArray(c.trimBeforeMatching)?" Did you mean to use opts.trimCharsBeforeMatching?":""));let o=V(V({},_t),c);if(typeof o.trimCharsBeforeMatching=="string"&&(o.trimCharsBeforeMatching=kt(o.trimCharsBeforeMatching)),o.trimCharsBeforeMatching=o.trimCharsBeforeMatching.map(y=>W(y)?y:String(y)),!W(l)||!l.length)return!1;if(!Number.isInteger(u)||u<0)throw new Error("string-match-left-right/".concat(e,"(): [THROW_ID_03] the second argument should be a natural number. Currently it's of a type: ").concat(typeof u,", equal to:\n").concat(JSON.stringify(u,null,4)));let a,r;if(W(t))a=[t];else if(Array.isArray(t))a=t;else if(!t)a=t;else if(typeof t=="function")a=[],a.push(t);else throw new Error("string-match-left-right/".concat(e,"(): [THROW_ID_05] the third argument, whatToMatch, is neither string nor array of strings! It's ").concat(typeof t,", equal to:\n").concat(JSON.stringify(t,null,4)));if(c&&!ae(c))throw new Error("string-match-left-right/".concat(e,"(): [THROW_ID_06] the fourth argument, options object, should be a plain object. Currently it's of a type \"").concat(typeof c,'", and equal to:\n').concat(JSON.stringify(c,null,4)));let g=0,s="";if((f=o==null?void 0:o.trimCharsBeforeMatching)!=null&&f.some((y,p)=>y.length>1?(g=p,s=y,!0):!1))throw new Error("string-match-left-right/".concat(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 ").concat(g," is longer than 1 character, ").concat(s.length," (equals to ").concat(s,"). Please split it into separate characters and put into array as separate elements."));if(!a||!Array.isArray(a)||Array.isArray(a)&&!a.length||Array.isArray(a)&&a.length===1&&W(a[0])&&!a[0].trim()){if(typeof o.cb=="function"){let p,N=u;if((e==="matchLeftIncl"||e==="matchRight")&&(N+=1),e[5]==="L")for(let I=N;I--;){let D=l[I];if((!o.trimBeforeMatching||o.trimBeforeMatching&&(D!=null&&D.trim()))&&(!(($=o.trimCharsBeforeMatching)!=null&&$.length)||D!==void 0&&!o.trimCharsBeforeMatching.includes(D))){p=I;break}}else if(e.startsWith("matchRight"))for(let I=N;I<l.length;I++){let D=l[I];if((!o.trimBeforeMatching||o.trimBeforeMatching&&D.trim())&&(!((A=o.trimCharsBeforeMatching)!=null&&A.length)||!o.trimCharsBeforeMatching.includes(D))){p=I;break}}if(p===void 0)return!1;let H=l[p],T=p+1,b="";return T&&T>0&&(b=l.slice(0,T)),e[5]==="L"||p&&p>0&&(b=l.slice(p)),o.cb(H,b,p)}let y="";throw c||(y=" More so, the whole options object, the fourth input argument, is missing!"),new Error("string-match-left-right/".concat(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!').concat(y))}for(let y=0,p=a.length;y<p;y++){r=typeof a[y]=="function";let N=a[y],H,T,b="",I=u;e==="matchRight"?I+=1:e==="matchLeft"&&(I-=1);let D=pn(l,I,N,o,r,B=>e[5]==="L"?B-1:B+1);if(D&&r&&typeof N=="function"&&N()==="EOL")return N()&&(!o.cb||o.cb(H,b,T))?N():!1;if(Number.isInteger(D)&&(T=e.startsWith("matchLeft")?D-1:D+1,e[5]==="L"?b=l.slice(0,D):b=l.slice(T)),T<0&&(T=void 0),l[T]&&(H=l[T]),Number.isInteger(D)&&(!o.cb||o.cb(H,b,T)))return N}return!1}function pe(e,l,u,t){return dt("matchLeft",e,l,u,t)}function le(e,l,u,t){return dt("matchRightIncl",e,l,u,t)}function Z(e,l,u,t){return dt("matchRight",e,l,u,t)}function Jt(){return/<!(--)?\[if[^\]]*]>[<>!-\s]*<!\[endif\]\1>/gi}var Ut=Ht(ht(),1);var Jn=(0,Ut.default)();var We="\xA0";function bn({str:e,idx:l=0,stopAtNewlines:u=!1,stopAtRawNbsp:t=!1}){if(typeof e!="string"||!e.length||((!l||typeof l!="number")&&(l=0),!e[l+1]))return null;if(e[l+1]&&(e[l+1].trim()||u&&"\n\r".includes(e[l+1])||t&&e[l+1]===We))return l+1;if(e[l+2]&&(e[l+2].trim()||u&&"\n\r".includes(e[l+2])||t&&e[l+2]===We))return l+2;for(let c=l+1,o=e.length;c<o;c++)if(e[c].trim()||u&&"\n\r".includes(e[c])||t&&e[c]===We)return c;return null}function w(e,l=0){return bn({str:e,idx:l,stopAtNewlines:!1,stopAtRawNbsp:!1})}function yn({str:e,idx:l,stopAtNewlines:u,stopAtRawNbsp:t}){if(typeof e!="string"||!e.length||((!l||typeof l!="number")&&(l=0),l<1))return null;if(e[~-l]&&(e[~-l].trim()||u&&"\n\r".includes(e[~-l])||t&&e[~-l]===We))return~-l;if(e[l-2]&&(e[l-2].trim()||u&&"\n\r".includes(e[l-2])||t&&e[l-2]===We))return l-2;for(let c=l;c--;)if(e[c]&&(e[c].trim()||u&&"\n\r".includes(e[c])||t&&e[c]===We))return c;return null}function ge(e,l=0){return yn({str:e,idx:l,stopAtNewlines:!1,stopAtRawNbsp:!1})}function xe(e){var a;if(typeof e!="string")throw new TypeError("string-extract-class-names: [THROW_ID_01] first str should be string, not ".concat(typeof e,", currently equal to ").concat(JSON.stringify(e,null,4)));let l=".# ~\\!@$%^&*()+=,/';:\"?><[]{}|`",u;function t(r){return typeof r=="string"&&!!r.length&&(r.charCodeAt(0)>64&&r.charCodeAt(0)<91||r.charCodeAt(0)>96&&r.charCodeAt(0)<123)}let c=null,o={res:[],ranges:[]};for(let r=0,g=e.length;r<=g;r++){c!==null&&r>=c&&(!((a=e[r])!=null&&a.trim())||l.includes(e[r]))&&(r>c+1&&(o.ranges.push([c,r]),o.res.push("".concat(u||"").concat(e.slice(c,r))),u&&(u=void 0)),c=null),e[r]&&c===null&&(e[r]==="."||e[r]==="#")&&(c=r);let s=w(e,r+4);e.startsWith("class",r)&&typeof ge(e,r)=="number"&&e[ge(e,r)]==="["&&typeof s=="number"&&e[s]==="="&&(w(e,s)&&t(e[w(e,s)])?c=w(e,s):"'\"".includes(e[w(e,s)])&&t(e[w(e,w(e,s))])&&(c=w(e,w(e,s))),u=".");let f=w(e,r+1);e.startsWith("id",r)&&e[ge(e,r)]==="["&&f!==null&&e[f]==="="&&(t(e[w(e,f)])?c=w(e,f):"'\"".includes(e[w(e,f)])&&t(e[w(e,w(e,f))])&&(c=w(e,w(e,f))),u="#")}return o.ranges.length||(o.ranges=null),o}function $t(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}var pt=new Map,jt=(e,l)=>{if(!Array.isArray(e))switch(typeof e){case"string":{e=[e];break}case"undefined":{e=[];break}default:throw new TypeError("Expected '".concat(l,"' to be a string or an array, but got a type of '").concat(typeof e,"'"))}return e.filter(u=>{if(typeof u!="string"){if(u===void 0)return!1;throw new TypeError("Expected '".concat(l,"' to be an array of strings, but found a type of '").concat(typeof u,"' in the array"))}return!0})},qt,Kt,zt,Tn=(e,l)=>{l=V({caseSensitive:!1},l);let u="s"+(l.caseSensitive?"":"i"),t=e+"|"+u;if(pt.has(t))return pt.get(t);let c=e[0]==="!";c&&(e=e.slice(1)),e=e.replaceAll(String.raw(qt||(qt=et(["*"],["\\*"]))),"__ESCAPED_STAR__").replaceAll("\\\\","__ESCAPED_BACKSLASH__").replaceAll(/\\(.)/g,"$1"),e=$t(e).replaceAll(String.raw(Kt||(Kt=et(["*"],["\\*"]))),".*"),e=e.replaceAll("__ESCAPED_STAR__",String.raw(zt||(zt=et(["*"],["\\*"])))).replaceAll("__ESCAPED_BACKSLASH__","\\\\");let o=new RegExp("^".concat(e,"$"),u);return o.negated=c,pt.set(t,o),o},Gt=(e,l,u,t)=>{if(e=jt(e,"inputs"),l=jt(l,"patterns"),l.length===0)return[];l=l.map(g=>Tn(g,u));let c=l.filter(g=>g.negated),o=l.filter(g=>!g.negated),{allPatterns:a}=u||{},r=[];if(a&&t&&c.length>1&&o.length===0){for(let g of e)for(let s of c)if(s.test(g))return[];return e.slice(0,1)}for(let g of e){let s=!1;for(let f of c)if(f.test(g)){s=!0;break}if(!s){if(o.length===0)r.push(g);else if(a){let f=Array.from({length:o.length},()=>!1);for(let[$,A]of o.entries())A.test(g)&&(f[$]=!0);f.every(Boolean)&&r.push(g)}else{let f=!1;for(let $ of o)if($.test(g)){f=!0;break}f&&r.push(g)}if(t&&r.length>0)break}}return r};function He(e,l,u){return Gt(e,l,u,!1)}function tt(e,l,u){return Gt(e,l,u,!0).length>0}var Sn={caseSensitive:!0};function Ke(e,l,u){if(!e.length)return[];if(!e.length||!l.length)return Array.from(e);let t=typeof l=="string"?[l]:Array.from(l),c=V(V({},Sn),u);return Array.from(e).filter(o=>!t.some(a=>tt(o,a,{caseSensitive:c.caseSensitive})))}var En={str:"",from:0,to:0,ifLeftSideIncludesThisThenCropTightly:"",ifLeftSideIncludesThisCropItToo:"",ifRightSideIncludesThisThenCropTightly:"",ifRightSideIncludesThisCropItToo:"",extendToOneSide:!1,wipeAllWhitespaceOnLeft:!1,wipeAllWhitespaceOnRight:!1,addSingleSpaceToPreventAccidentalConcatenation:!1};function z(e){var r,g;let l=/^[0-9a-zA-Z]+$/;function u(s){return W(s)&&!s.trim()}if(ae(e)){if(!Object.keys(e).length)throw new Error('string-range-expander: [THROW_ID_02] Input must be a plain object but it\'s been given as a plain object without any keys. However, "from" and "to" settings are obligatory!')}else{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 ".concat(typeof e,", equal to:\n").concat(JSON.stringify(e,null,4),"."),new Error("string-range-expander: [THROW_ID_01] Input must be a plain object ".concat(s))}if(!ce(e.from))throw new Error("string-range-expander: [THROW_ID_03] The input's \"from\" value resolvedOpts.from, is not a number! It's been given as ".concat(typeof e.from,", equal to ").concat(JSON.stringify(e.from,null,0)));if(!ce(e.to))throw new Error("string-range-expander: [THROW_ID_04] The input's \"to\" value resolvedOpts.to, is not a number! It's been given as ".concat(typeof e.to,", equal to ").concat(JSON.stringify(e.to,null,0)));if(e!=null&&e.str&&!e.str[e.from]&&e.from!==e.to)throw new Error('string-range-expander: [THROW_ID_05] The given input string resolvedOpts.str ("'.concat(e.str,'") must contain the character at index "from" ("').concat(e.from,'")'));if(e!=null&&e.str&&!e.str[e.to-1])throw new Error('string-range-expander: [THROW_ID_06] The given input string, resolvedOpts.str ("'.concat(e.str,'") must contain the character at index before "to" ("').concat(e.to-1,'")'));if(e.from>e.to)throw new Error('string-range-expander: [THROW_ID_07] The given "from" index, "'.concat(e.from,'" is greater than "to" index, "').concat(e.to,"\". That's wrong!"));if(e.extendToOneSide===null||W(e.extendToOneSide)&&e.extendToOneSide!=="left"&&e.extendToOneSide!=="right"||!W(e.extendToOneSide)&&e.extendToOneSide!==void 0&&e.extendToOneSide)throw new Error('string-range-expander: [THROW_ID_08] The options value "extendToOneSide" is not recognisable! It\'s set to: "'.concat(e.extendToOneSide,'" (').concat(typeof e.extendToOneSide,'). It has to be either Boolean "false" or one of strings: "left" or "right"'));if(e!=null&&e.ifLeftSideIncludesThisThenCropTightly&&!W(e.ifLeftSideIncludesThisThenCropTightly))throw new Error('string-range-expander: [THROW_ID_09] The option "ifLeftSideIncludesThisThenCropTightly", is not a string! It\'s been given as '.concat(typeof e.ifLeftSideIncludesThisThenCropTightly,", equal to ").concat(JSON.stringify(e.ifLeftSideIncludesThisThenCropTightly,null,0)));if(e!=null&&e.ifLeftSideIncludesThisCropItToo&&!W(e.ifLeftSideIncludesThisCropItToo))throw new Error('string-range-expander: [THROW_ID_10] The option "ifLeftSideIncludesThisCropItToo", is not a string! It\'s been given as '.concat(typeof e.ifLeftSideIncludesThisCropItToo,", equal to ").concat(JSON.stringify(e.ifLeftSideIncludesThisCropItToo,null,0)));if(e!=null&&e.ifRightSideIncludesThisThenCropTightly&&!W(e.ifRightSideIncludesThisThenCropTightly))throw new Error('string-range-expander: [THROW_ID_11] The option "ifRightSideIncludesThisThenCropTightly", is not a string! It\'s been given as '.concat(typeof e.ifRightSideIncludesThisThenCropTightly,", equal to ").concat(JSON.stringify(e.ifRightSideIncludesThisThenCropTightly,null,0)));if(e!=null&&e.ifRightSideIncludesThisCropItToo&&!W(e.ifRightSideIncludesThisCropItToo))throw new Error('string-range-expander: [THROW_ID_12] The option "ifRightSideIncludesThisCropItToo", is not a string! It\'s been given as '.concat(typeof e.ifRightSideIncludesThisCropItToo,", equal to ").concat(JSON.stringify(e.ifRightSideIncludesThisCropItToo,null,0)));let t=V(V({},En),e),c=t.str,o=t.from,a=t.to;if(t.extendToOneSide!=="right"&&(u(c[o-1])&&(u(c[o-2])||t.ifLeftSideIncludesThisCropItToo.includes(c[o-2]))||c[o-1]&&t.ifLeftSideIncludesThisCropItToo.includes(c[o-1])||t.wipeAllWhitespaceOnLeft&&u(c[o-1]))){for(let s=o;s--;)if(!t.ifLeftSideIncludesThisCropItToo.includes(c[s])){if(c[s].trim()){t.wipeAllWhitespaceOnLeft||t.ifLeftSideIncludesThisCropItToo.includes(c[s+1])?o=s+1:o=s+2;break}else if(s===0){t.wipeAllWhitespaceOnLeft?o=0:o=1;break}}}if(t.extendToOneSide!=="left"&&(u(c[a])&&(t.wipeAllWhitespaceOnRight||u(c[a+1]))||t.ifRightSideIncludesThisCropItToo.includes(c[a]))){for(let s=a,f=c.length;s<f;s++)if(!t.ifRightSideIncludesThisCropItToo.includes(c[s])){if(c[s].trim()){t.wipeAllWhitespaceOnRight||t.ifRightSideIncludesThisCropItToo.includes(c[s-1])?a=s:a=s-1;break}else if(s===c.length-1){t.wipeAllWhitespaceOnRight?a=c.length:a=c.length-1;break}}}return(t.extendToOneSide!=="right"&&W(t.ifLeftSideIncludesThisThenCropTightly)&&t.ifLeftSideIncludesThisThenCropTightly&&(c[o-2]&&t.ifLeftSideIncludesThisThenCropTightly.includes(c[o-2])||c[o-1]&&t.ifLeftSideIncludesThisThenCropTightly.includes(c[o-1]))||t.extendToOneSide!=="left"&&W(t.ifRightSideIncludesThisThenCropTightly)&&t.ifRightSideIncludesThisThenCropTightly&&(c[a+1]&&t.ifRightSideIncludesThisThenCropTightly.includes(c[a+1])||c[a]&&t.ifRightSideIncludesThisThenCropTightly.includes(c[a])))&&(t.extendToOneSide!=="right"&&u(c[o-1])&&!t.wipeAllWhitespaceOnLeft&&(o-=1),t.extendToOneSide!=="left"&&u(c[a])&&!t.wipeAllWhitespaceOnRight&&(a+=1)),t.addSingleSpaceToPreventAccidentalConcatenation&&((r=c[o-1])!=null&&r.trim())&&((g=c[a])!=null&&g.trim())&&(!t.ifLeftSideIncludesThisThenCropTightly&&!t.ifRightSideIncludesThisThenCropTightly||!((!t.ifLeftSideIncludesThisThenCropTightly||t.ifLeftSideIncludesThisThenCropTightly.includes(c[o-1]))&&(!t.ifRightSideIncludesThisThenCropTightly||c[a]&&t.ifRightSideIncludesThisThenCropTightly.includes(c[a]))))&&(l.test(c[o-1])||l.test(c[a]))?[o,a," "]:[o,a]}function nt(e,l=0){return e.codePointAt(l)||0}function Qt(e){let l="abcdefghijklmnopqrstuvwxyz",u="abcdefghijklmnopqrstuvwxyz0123456789",t={a:!1,b:!1,c:!1,d:!1,e:!1,f:!1,g:!1,h:!1,i:!1,j:!1,k:!1,l:!1,m:!1,n:!1,o:!1,p:!1,q:!1,r:!1,s:!1,t:!1,u:!1,v:!1,w:!1,x:!1,y:!1,z:!1},c={a:!1,b:!1,c:!1,d:!1,e:!1,f:!1,g:!1,h:!1,i:!1,j:!1,k:!1,l:!1,m:!1,n:!1,o:!1,p:!1,q:!1,r:!1,s:!1,t:!1,u:!1,v:!1,w:!1,x:!1,y:!1,z:!1},o={a:!1,b:!1,c:!1,d:!1,e:!1,f:!1,g:!1,h:!1,i:!1,j:!1,k:!1,l:!1,m:!1,n:!1,o:!1,p:!1,q:!1,r:!1,s:!1,t:!1,u:!1,v:!1,w:!1,x:!1,y:!1,z:!1},a=[];if(!Array.isArray(e)||!e.length)return e;for(let r=0,g=e.length;r<g;r++){if(e.indexOf(e[r])<r){a.push(a[e.indexOf(e[r])]);continue}let s=".#".includes(e[r][0])?e[r][0]:"",f=Array.from(e[r]).reduce((A,y)=>A+nt(y),0);if(".#".includes(e[r][0])&&e[r].length<4||!".#".includes(e[r][0])&&e[r].length<3){let A=e[r];if(!a.includes(A)){a.push(A),A.startsWith(".")&&A.length===2&&t[A.slice(1)]===!1?t[A.slice(1)]=!0:A.startsWith("#")&&A.length===2&&c[A.slice(1)]===!1?c[A.slice(1)]=!0:!A.startsWith(".")&&!A.startsWith("#")&&A.length===1&&o[A]===!1&&(o[A]=!0);continue}}let $="".concat(s).concat(l[f%l.length]).concat(u[f%u.length]);if(a.includes($)){let A=$,y=0,p=Array.from(e[r]).reduce((H,T)=>H<200?H+nt(T):(H+nt(T))%u.length,0),N=Array.from(e[r]).map(H=>nt(H)).reduce((H,T)=>{let b=H+T;do b=String(b).split("").reduce((I,D)=>I+Number.parseInt(D,10),0);while(b>=10);return b},0);for(;a.includes(A);)y+=1,A+=u[p*N*y%u.length];$=A}a.push($),$.startsWith(".")&&$.length===2&&t[$.slice(1)]===!1?t[$.slice(1)]=!0:$.startsWith("#")&&$.length===2&&c[$.slice(1)]===!1?c[$.slice(1)]=!0:!$.startsWith(".")&&!$.startsWith("#")&&$.length===1&&o[$]===!1&&(o[$]=!0)}for(let r=0,g=a.length;r<g;r++)a[r].startsWith(".")?t[a[r].slice(1,2)]===!1?(t[a[r].slice(1,2)]=a[r],a[r]=a[r].slice(0,2)):t[a[r].slice(1,2)]===a[r]&&(a[r]=a[r].slice(0,2)):a[r].startsWith("#")?c[a[r].slice(1,2)]===!1?(c[a[r].slice(1,2)]=a[r],a[r]=a[r].slice(0,2)):c[a[r].slice(1,2)]===a[r]&&(a[r]=a[r].slice(0,2)):!a[r].startsWith(".")&&!a[r].startsWith("#")&&(o[a[r].slice(0,1)]?o[a[r].slice(0,1)]===a[r]&&(a[r]=a[r].slice(0,1)):(o[a[r].slice(0,1)]=a[r],a[r]=a[r].slice(0,1)));return a}var Cn={strictlyTwoElementsInRangeArrays:!1,progressFn:null};function ke(e,l){if(!Array.isArray(e)||!e.length)return e;let u=V(V({},Cn),l),t,c;if(u.strictlyTwoElementsInRangeArrays&&!e.every((r,g)=>!Array.isArray(r)||r.length!==2?(t=g,c=r.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, ".concat(t,"th range (").concat(JSON.stringify(e[t],null,4),") has not two but ").concat(c," elements!"));if(!e.every((r,g)=>!Array.isArray(r)||!Number.isInteger(r[0])||r[0]<0||!Number.isInteger(r[1])||r[1]<0?(t=g,!1):!0))throw new TypeError("ranges-sort: [THROW_ID_04] The first argument should be an array and must consist of arrays which are natural number indexes representing string index ranges. However, ".concat(t,"th range (").concat(JSON.stringify(e[t],null,4),") does not consist of only natural numbers!"));let o=e.length**2,a=0;return Array.from(e).sort((r,g)=>(u.progressFn&&(a+=1,u.progressFn(Math.floor(a*100/o))),r[0]===g[0]?r[1]<g[1]?-1:r[1]>g[1]?1:0:r[0]<g[0]?-1:1))}var Yt={mergeType:1,progressFn:null,joinRangesThatTouchEdges:!0};function Zt(e,l){function u(s){return!!s&&typeof s=="object"&&!Array.isArray(s)}if(!Array.isArray(e)||!e.length)return null;let t;if(l)if(u(l)){if(t=V(V({},Yt),l),t.progressFn&&u(t.progressFn)&&!Object.keys(t.progressFn).length)t.progressFn=null;else if(t.progressFn&&typeof t.progressFn!="function")throw new Error('ranges-merge: [THROW_ID_01] opts.progressFn must be a function! It was given of a type: "'.concat(typeof t.progressFn,'", equal to ').concat(JSON.stringify(t.progressFn,null,4)));if(![1,2,"1","2"].includes(t.mergeType))throw new Error('ranges-merge: [THROW_ID_02] opts.mergeType was customised to a wrong thing! It was given of a type: "'.concat(typeof t.mergeType,'", equal to ').concat(JSON.stringify(t.mergeType,null,4)));if(typeof t.joinRangesThatTouchEdges!="boolean")throw new Error('ranges-merge: [THROW_ID_04] opts.joinRangesThatTouchEdges was customised to a wrong thing! It was given of a type: "'.concat(typeof t.joinRangesThatTouchEdges,'", equal to ').concat(JSON.stringify(t.joinRangesThatTouchEdges,null,4)))}else throw new Error("emlint: [THROW_ID_03] the second input argument must be a plain object. It was given as:\n".concat(JSON.stringify(l,null,4)," (type ").concat(typeof l,")"));else t=V({},Yt);let c=e.filter(s=>Array.isArray(s)).map(s=>[...s]).filter(s=>s[2]!==void 0||s[0]!==s[1]),o,a,r;t.progressFn?o=ke(c,{progressFn:s=>{r=Math.floor(s/5),r!==a&&(a=r,t.progressFn(r))}}):o=ke(c);let g=o.length-1;for(let s=g;s>0;s--)t.progressFn&&(r=Math.floor((1-s/g)*78)+21,r!==a&&r>a&&(a=r,t.progressFn(r))),(o[s][0]<=o[s-1][0]||!t.joinRangesThatTouchEdges&&o[s][0]<o[s-1][1]||t.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?+t.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 Dn=!0,bt="Invariant failed";function Xt(e,l){if(!e){if(Dn)throw new Error(bt);var u=typeof l=="function"?l():l,t=u?"".concat(bt,": ").concat(u):bt;throw new Error(t)}}function lt(e,l,u){let t=0,c=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: ".concat(typeof e,", equal to: ").concat(JSON.stringify(e,null,4)));if(l&&!Array.isArray(l))throw new TypeError("ranges-apply: [THROW_ID_03] second input argument must be an array (or null)! Currently it's: ".concat(typeof l,", equal to: ").concat(JSON.stringify(l,null,4)));if(u&&typeof u!="function")throw new TypeError("ranges-apply: [THROW_ID_04] the third input argument must be a function (or falsey)! Currently it's: ".concat(typeof u,", equal to: ").concat(JSON.stringify(u,null,4)));if(!(l!=null&&l.filter(f=>f).length))return e;let o;Array.isArray(l)&&Number.isInteger(l[0])&&Number.isInteger(l[1])?o=[Array.from(l)]:o=Array.from(l);let a=o.length,r=0;o.filter(f=>f).forEach((f,$)=>{if(u&&(t=Math.floor(r/a*10),t!==c&&(c=t,u(t))),!Array.isArray(f))throw new TypeError("ranges-apply: [THROW_ID_05] ranges array, second input arg., has ".concat($,"th element not an array: ").concat(JSON.stringify(f,null,4),", which is ").concat(typeof f));if(!Number.isInteger(f[0])){if(!Number.isInteger(+f[0])||+f[0]<0)throw new TypeError("ranges-apply: [THROW_ID_06] ranges array, second input arg. has ".concat($,"th element, array ").concat(JSON.stringify(f,null,0),". Its first element is not an integer, string index, but ").concat(typeof f[0],", equal to: ").concat(JSON.stringify(f[0],null,4),"."));o[$][0]=+o[$][0]}if(!Number.isInteger(f[1])){if(!Number.isInteger(+f[1])||+f[1]<0)throw new TypeError("ranges-apply: [THROW_ID_07] ranges array, second input arg. has ".concat($,"th element, array ").concat(JSON.stringify(f,null,0),". Its second element is not an integer, string index, but ").concat(typeof f[1],", equal to: ").concat(JSON.stringify(f[1],null,4),"."));o[$][1]=+o[$][1]}r+=1});let g=Zt(o,{progressFn:f=>{u&&(t=10+Math.floor(f/10),t!==c&&(c=t,u(t)))}});Xt(g);let s=g.length;if(s>0){let f=e.slice(g[s-1][1]);e=g.reduce(($,A,y,p)=>{u&&(t=20+Math.floor(y/s*80),t!==c&&(c=t,u(t)));let N=y===0?0:p[y-1][1],H=p[y][0];return"".concat($).concat(e.slice(N,H)).concat(p[y][2]||"")},""),e+=f}return e}function rt(e,l=1){let u="\xA0";function t(o){return Array.from(o).reverse().join("")}function c(o,a,r){let g=r?"\n":"\r",s=r?"\r":"\n";if(!o)return o;let f=0,$=0,A="";for(let y=0,p=o.length;y<p;y++)(o[y]===g||o[y]===s&&o[y-1]!==g)&&$++,"\r\n".includes(o[y])||o[y]===u?(f=0,o[y]===u?A+=o[y]:o[y]===g?$<=a&&(A+=o[y],o[y+1]===s&&(A+=o[y+1],y++)):o[y]===s&&(o==null?void 0:o[y-1])!==g&&$<=a&&(A+=o[y])):(f++,!o[y+1]&&!$&&(A+=" "));return A}if(typeof e=="string"&&e.length){let o=1;typeof+l=="number"&&Number.isInteger(+l)&&+l>=0&&(o=+l);let a="",r="";if(!e.trim())a=e;else if(!e[0].trim()){for(let g=0,s=e.length;g<s;g++)if(e[g].trim()){a=e.slice(0,g);break}}if(e.trim()&&(e.slice(-1).trim()===""||e.slice(-1)===u)){for(let g=e.length;g--;)if(e[g].trim()){r=e.slice(g+1);break}}return"".concat(c(a,o,!1)).concat(e.trim()).concat(t(c(t(r),o,!0)))}return e}var en={mergeType:1,progressFn:null,joinRangesThatTouchEdges:!0};function An(e,l){var s;function u(f){return!!f&&typeof f=="object"&&!Array.isArray(f)}if(!Array.isArray(e)||!e.length)return null;let t;if(l)if(u(l)){if(t=V(V({},en),l),t.progressFn&&u(t.progressFn)&&!Object.keys(t.progressFn).length)t.progressFn=null;else if(t.progressFn&&typeof t.progressFn!="function")throw new Error('ranges-merge: [THROW_ID_01] resolvedOpts.progressFn must be a function! It was given of a type: "'.concat(typeof t.progressFn,'", equal to ').concat(JSON.stringify(t.progressFn,null,4)));if(![1,2,"1","2"].includes(t.mergeType))throw new Error('ranges-merge: [THROW_ID_02] resolvedOpts.mergeType was customised to a wrong thing! It was given of a type: "'.concat(typeof t.mergeType,'", equal to ').concat(JSON.stringify(t.mergeType,null,4)));if(typeof t.joinRangesThatTouchEdges!="boolean")throw new Error('ranges-merge: [THROW_ID_04] resolvedOpts.joinRangesThatTouchEdges was customised to a wrong thing! It was given of a type: "'.concat(typeof t.joinRangesThatTouchEdges,'", equal to ').concat(JSON.stringify(t.joinRangesThatTouchEdges,null,4)))}else throw new Error("ranges-merge: [THROW_ID_03] the second input argument must be a plain object. It was given as:\n".concat(JSON.stringify(l,null,4)," (type ").concat(typeof l,")"));else t=V({},en);let c=e.filter(f=>Array.isArray(f)).map(f=>[...f]).filter(f=>f[2]!==void 0||f[0]!==f[1]),o,a,r;t.progressFn?o=ke(c,{progressFn:f=>{r=Math.floor(f/5),r!==a&&(a=r,t.progressFn!=null&&t.progressFn(r))}}):o=ke(c);let g=o.length-1;for(let f=g;f>0;f--)t.progressFn&&(r=Math.floor((1-f/g)*78)+21,r!==a&&r>a&&(a=r,t.progressFn(r))),(o[f][0]<=o[f-1][0]||!t.joinRangesThatTouchEdges&&o[f][0]<o[f-1][1]||t.joinRangesThatTouchEdges&&o[f][0]<=o[f-1][1])&&(o[f-1][0]=Math.min(o[f][0],o[f-1][0]),o[f-1][1]=Math.max(o[f][1],o[f-1][1]),o[f][2]!==void 0&&(o[f-1][0]>=o[f][0]||o[f-1][1]<=o[f][1])&&o[f-1][2]!==null&&(o[f][2]===null&&o[f-1][2]!==null?o[f-1][2]=null:o[f-1][2]!=null?+((s=t||{})==null?void 0:s.mergeType)==2&&o[f-1][0]===o[f][0]?o[f-1][2]=o[f][2]:o[f-1][2]+=o[f][2]:o[f-1][2]=o[f][2]),o.splice(f,1),f=o.length);return o.length?o:null}var On={limitToBeAddedWhitespace:!1,limitLinebreaksCount:1,mergeType:1},Me=class{constructor(e){ft(this,"ranges");ft(this,"opts");let l=V(V({},On),e);if(l.mergeType&&l.mergeType!==1&&l.mergeType!==2)if(W(l.mergeType)&&l.mergeType.trim()==="1")l.mergeType=1;else if(W(l.mergeType)&&l.mergeType.trim()==="2")l.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: "'.concat(typeof l.mergeType,'", equal to ').concat(JSON.stringify(l.mergeType,null,4)));this.opts=l,this.ranges=[]}add(e,l,u){var o;if(e==null&&l==null)return;if(Ee(e)&&!Ee(l)){if(Array.isArray(e)){if(e.length){if(e.some(a=>Array.isArray(a))){e.forEach(a=>{Array.isArray(a)&&this.add(...a)});return}e.length&&ce(+e[0])&&ce(+e[1])&&this.add(...e)}return}throw new TypeError('ranges-push/Ranges/add(): [THROW_ID_12] the first input argument, "from" is set ('.concat(JSON.stringify(e,null,0),') but second-one, "to" is not (').concat(JSON.stringify(l,null,0),")"))}else if(!Ee(e)&&Ee(l))throw new TypeError('ranges-push/Ranges/add(): [THROW_ID_13] the second input argument, "to" is set ('.concat(JSON.stringify(l,null,0),') but first-one, "from" is not (').concat(JSON.stringify(e,null,0),")"));let t=+e,c=+l;if(ce(t)&&ce(c)){if(Ee(u)&&!W(u)&&!Pt(u))throw new TypeError("ranges-push/Ranges/add(): [THROW_ID_08] The third argument, the value to add, was given not as string but ".concat(typeof u,", equal to:\n").concat(JSON.stringify(u,null,4)));if(Ee(this.ranges)&&Array.isArray(this.last())&&t===this.last()[1]){if(this.last()[1]=c,this.last()[2],this.last()[2]!==null&&Ee(u)){let a=this.last()[2]&&this.last()[2].length&&(!((o=this.opts)!=null&&o.mergeType)||this.opts.mergeType===1)?"".concat(this.last()[2]).concat(u):u;this.opts.limitToBeAddedWhitespace&&(a=rt(a,this.opts.limitLinebreaksCount)),W(a)&&!a.length||(this.last()[2]=a)}}else{this.ranges||(this.ranges=[]);let a=u!==void 0&&!(W(u)&&!u.length)?[t,c,u&&this.opts.limitToBeAddedWhitespace?rt(u,this.opts.limitLinebreaksCount):u]:[t,c];this.ranges.push(a)}}else throw ce(t)&&t>=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 "'.concat(typeof c,'" equal to: ').concat(JSON.stringify(c,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 "'.concat(typeof t,'" equal to: ').concat(JSON.stringify(t,null,4)))}push(e,l,u){this.add(e,l,u)}current(){return Array.isArray(this.ranges)&&this.ranges.length?(this.ranges=An(this.ranges,{mergeType:this.opts.mergeType}),this.ranges&&this.opts.limitToBeAddedWhitespace?this.ranges.map(e=>Ee(e[2])?[e[0],e[1],rt(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])&&ce(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, ".concat(JSON.stringify(e[0],null,4)," should be an array and its first element should be an integer, a string index."));else this.ranges=[]}last(){return Array.isArray(this.ranges)&&this.ranges.length?this.ranges[this.ranges.length-1]:null}};var L=new Me({limitToBeAddedWhitespace:!0}),In={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 tn(e,l){var Te,ee;let u=Date.now();if(!W(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 "'.concat(typeof e,'", equal to:\n').concat(JSON.stringify(e,null,4)));if(l&&!ae(l))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 ".concat(typeof l,", equal to ").concat(JSON.stringify(l,null,4)));if(l&&Array.isArray(l.breakToTheLeftOf)&&l.breakToTheLeftOf.length){for(let i=0,Oe=l.breakToTheLeftOf.length;i<Oe;i++)if(!W(l.breakToTheLeftOf[i]))throw new TypeError("html-crush: [THROW_ID_05] the resolvedOpts.breakToTheLeftOf array contains non-string elements! For example, element at index ".concat(i,' is of a type "').concat(typeof l.breakToTheLeftOf[i],'" and is equal to:\n').concat(JSON.stringify(l.breakToTheLeftOf[i],null,4)))}let t=V(V({},In),l);typeof t.removeHTMLComments=="boolean"&&(t.removeHTMLComments=t.removeHTMLComments?1:0);let c="";Array.isArray(t.breakToTheLeftOf)&&t.breakToTheLeftOf.length&&(c=[...new Set(t.breakToTheLeftOf.map(i=>i[0]))].join(""));let o={removeHTMLComments:!1,removeCSSComments:!1},a=null,r=null,g=!1,s=0,f=0,$=!1,A=!1,y=null,p=null,N=null,H=null,T,b=null,I=null,D=null,B=null,_=null,J=null,oe=">};",ue="<",ze="!",Ge=">",ve="<",fe="{},:;<>~+",be=fe,Q=fe,Y=!0,M=e.length,X=Math.floor(M/2),he=.01,ye;t.reportProgressFunc&&(ye=Math.floor(t.reportProgressFuncTo-(t.reportProgressFuncTo-t.reportProgressFuncFrom)*he-t.reportProgressFuncFrom));let j,re=0,k="\n";if(e.includes("\r\n")?k="\r\n":e.includes("\r")&&(k="\r"),M){for(let i=0;i<M;i++){if(t.reportProgressFunc&&(M>1e3&&M<2e3?i===X&&t.reportProgressFunc(Math.floor((t.reportProgressFuncTo-t.reportProgressFuncFrom)/2)):M>=2e3&&(j=t.reportProgressFuncFrom+Math.floor(i/M*(ye||1)),j!==re&&(re=j,t.reportProgressFunc(j)))),f++,!T&&$&&e[i]==="}"&&e[i-1]==="}"&&(s+1>=t.lineLengthLimit?(L.push(i,i,k),s=0):(b=i,I=i,D=" ")),T&&typeof T=="number"&&i>=T&&(T=void 0),H!==null&&e.startsWith("<\/script",i)&&!we(e[i+8])){if((t.removeIndentations||t.removeLineBreaks)&&i>0&&e[~-i]&&!e[~-i].trim()){for(let S=i;S--;)if(e[S]==="\n"||e[S]==="\r"||e[S].trim()){S+1<i&&L.push(S+1,i);break}}H=null,T=!1,i+=8;continue}if(!T&&!$&&e.startsWith("<script",i)&&!we(e[i+7])){H=i,T=!0;let S="";(t.removeLineBreaks||t.removeIndentations)&&r!==null&&(r>0&&(S=k),L.push(r,i,S)),r=null,a=null}if(_!==null&&B===null&&!/\w/.test(e[i])){B=e.slice(_,i);let S=w(e,~-i);typeof S=="number"&&e[S]===">"&&!e[i].trim()&&w(e,i)?L.push(i,w(e,i)):S&&e[S]==="/"&&e[w(e,S)]===">"&&(!e[i].trim()&&w(e,i)&&L.push(i,w(e,i)),e[S+1]!==">"&&w(e,S+1)&&L.push(S+1,w(e,S+1)))}if(!T&&!$&&!y&&e[~-i]==="<"&&_===null&&(/\w/.test(e[i])?_=i:e[w(e,~-i)]==="/"&&/\w/.test(e[w(e,w(e,~-i))]||"")&&(_=w(e,w(e,~-i)))),!T&&($||y)&&p!==null&&e[i]==="*"&&e[i+1]==="/"&&([b,I]=z({str:e,from:p,to:i+2,ifLeftSideIncludesThisThenCropTightly:be||"",ifRightSideIncludesThisThenCropTightly:Q||""}),p=null,b!=null?L.push(b,I):(s+=1,i+=1),T=i+2),!T&&($||y)&&p===null&&e[i]==="/"&&e[i+1]==="*"&&(o.removeCSSComments||(o.removeCSSComments=!0),t.removeCSSComments&&(p=i)),A&&e.startsWith("![endif",i+1)&&(A=!1),!T&&!$&&!y&&N!==null){let S;e.startsWith("-->",i)?S=3:e[i]===">"&&e[i-1]==="]"&&(S=1),S&&([b,I]=z({str:e,from:N,to:i+S}),N=null,b!=null?t.lineLengthLimit&&f-(I-b)>=t.lineLengthLimit?(L.push(b,I,k),f=-S):(L.push(b,I),f-=I-b):(s+=S-1,i+=S-1),T=i+S)}if(!T&&!$&&!y&&(e.startsWith("<!--",i)||t.removeHTMLComments===2&&e.startsWith("<![endif",i))&&N===null&&(e.startsWith("[if",i+4)?(A||(A=!0),t.removeHTMLComments===2&&(N=i)):t.removeHTMLComments&&(!A||t.removeHTMLComments===2)&&(N=i),o.removeHTMLComments||(o.removeHTMLComments=!0)),!T&&$&&p===null&&e.startsWith("</style",i)&&!we(e[i+7])?$=!1:!T&&!$&&p===null&&e.startsWith("<style",i)&&!we(e[i+6])&&($=!0,(t.removeLineBreaks||t.removeIndentations)&&t.breakToTheLeftOf.includes("<style")&&e.startsWith(' type="text/css">',i+6)&&e[i+24]&&L.push(i+23,i+23,k)),!T&&!y&&"\"'".includes(e[i])&&e.endsWith("style=",i)&&(y=i),!T&&!e[i].trim())r===null&&(r=i);else if(!T&&!(($||y)&&p!==null)){if(r!==null){if(t.removeLineBreaks&&(s+=1),Y)Y=!1,(t.removeIndentations||t.removeLineBreaks)&&L.push(0,i);else if(t.removeIndentations&&!t.removeLineBreaks&&(!g&&a!==null&&i>a?L.push(a+1,i):r+1<i&&(e.endsWith("]>",r)||e.endsWith("-->",r)||e.startsWith("<![",i)||e.startsWith("<!--<![",i)?L.push(r,i):e[r]===" "?L.push(r+1,i):e[~-i]===" "?L.push(r,~-i):L.push(r,i," "))),t.removeLineBreaks||y){if(c.includes(e[i])&&le(e,i,t.breakToTheLeftOf)){!("\r\n".includes(e[~-i])&&r===~-i)&&!(e[~-i]==="\n"&&e[i-2]==="\r"&&r===i-2)&&L.push(r,i,k),b=null,I=null,D=null,r=null,s=1;continue}let S=" ";e[i]==="<"&&Z(e,i,t.mindTheInlineTags,{cb:me=>!me||!/\w/.test(me)})||(e[~-r]&&Ge.includes(e[~-r])&&ve.includes(e[i])||($||y)&&p===null&&(be.includes(e[~-r])||Q.includes(e[i]))||e.startsWith("!important",i)&&!A||y&&(e[~-r]==="'"||e[~-r]==='"')||e[~-r]==="}"&&e.startsWith("</style",i)||e[i]===">"&&("'\"".includes(e[ge(e,i)])||e[w(e,i)]==="<")||e[i]==="/"&&e[w(e,i)]===">")&&(S="",e[i]==="/"&&e[i+1]===">"&&w(e,i)&&w(e,i)>i+1&&(L.push(i+1,w(e,i)),s-=w(e,i)-i+1)),$&&e[i]==="}"&&r&&e[r-1]==="}"&&(S=" "),S!=null&&S.length&&(s+=1),t.lineLengthLimit?s>=t.lineLengthLimit||!e[i+1]||e[i]===">"||e[i]==="/"&&e[i+1]===">"?((s>t.lineLengthLimit||s===t.lineLengthLimit&&((Te=e[i+1])!=null&&Te.trim())&&!oe.includes(e[i])&&!ue.includes(e[i+1]))&&(S=k,s=1),(s>t.lineLengthLimit||!(S===" "&&i===r+1))&&(L.push(r,i,S),a=null),b=null,I=null,D=null):(b===null||r<b)&&(b=r,I=i,D=S):i===r+1&&S===" "||L.push(r,i,S)}r=null,g||(g=!0)}else Y&&(Y=!1),t.removeLineBreaks&&(s+=1);g||(g=!0)}if(!T&&!Y&&i!==0&&t.removeLineBreaks&&(t.lineLengthLimit||c)&&!e.startsWith("</a",i)){if(c&&le(e,i,t.breakToTheLeftOf)&&e.slice(0,i).trim()&&(!e.startsWith("<![endif]",i)||!pe(e,i,"<!--"))){L.push(i,i,k),b=null,I=null,D=null,s=1;continue}else if(t.lineLengthLimit&&s<=t.lineLengthLimit){if(!e[i+1]||ue.includes(e[i])&&!ze.includes(e[i])||oe.includes(e[i])||!e[i].trim()){if(b!==null&&I!==null&&(b!==I||D!=null&&D.length)){let S=D;e[i].trim()&&((ee=e[i+1])!=null&&ee.trim())&&s+(D?D.length:0)>t.lineLengthLimit&&(S=k),(s+(S?S.length:0)>t.lineLengthLimit||!(S===" "&&I===b+1&&e[b]===" "))&&(e[~-b]==="}"&&e[I]==="{"||(L.push(b,I,S),a=null))}e[i].trim()&&(ue.includes(e[i])||e[~-i]&&oe.includes(e[~-i]))&&W(J)&&(!B||!t.mindTheInlineTags.includes(B))&&!(e[i]==="<"&&Z(e,i,t.mindTheInlineTags,{cb:S=>!S||!/\w/.test(S)}))&&!(e[i]==="<"&&Z(e,i,t.mindTheInlineTags,{trimCharsBeforeMatching:"/",cb:S=>!S||!/\w/.test(S)}))?(b=i,I=i,D=null):p===null&&b!==null&&(y||!t.mindTheInlineTags||!Array.isArray(t.mindTheInlineTags)||Array.isArray(t.mindTheInlineTags.length)&&!t.mindTheInlineTags.length||!W(B)||Array.isArray(t.mindTheInlineTags)&&t.mindTheInlineTags.length&&W(B)&&!t.mindTheInlineTags.includes(B))&&!(e[i]==="<"&&Z(e,i,t.mindTheInlineTags,{trimCharsBeforeMatching:"/",cb:S=>!S||!/\w/.test(S)}))&&(b=null,I=null,D=null)}}else if(t.lineLengthLimit)if(ue.includes(e[i])&&!(e[i]==="<"&&Z(e,i,t.mindTheInlineTags,{trimCharsBeforeMatching:"/",cb:S=>!S||!/\w/.test(S)})))if(b!==null&&I!==null&&(b!==I||D!=null&&D.length)){let S=D!=null&&D.length?D.length:0;s-(I-b-S)-1>t.lineLengthLimit||(L.push(b,I,D),s-(I-b-S)-1===t.lineLengthLimit&&(L.push(i,i,k),s=0),b=null,I=null,D=null)}else L.push(i,i,k),s=0;else e[i+1]&&oe.includes(e[i])&&W(B)&&Array.isArray(t.mindTheInlineTags)&&t.mindTheInlineTags.length&&!t.mindTheInlineTags.includes(B)?b!==null&&I!==null&&(b!==I||D!=null&&D.length)||(L.push(i+1,i+1,k),s=0):e[i].trim()&&(e[i+1]||b!==null&&I!==null&&(b!==I||D!=null&&D.length)&&L.push(b,I,k))}if(!T&&!Y&&t.removeLineBreaks&&t.lineLengthLimit&&s>=t.lineLengthLimit&&b!==null&&I!==null&&!oe.includes(e[i])&&!ue.includes(e[i])&&!"/".includes(e[i])&&!(s===t.lineLengthLimit&&e[i+1]&&!e[i+1].trim())){let S=k;e[i+1]&&!e[i+1].trim()&&s===t.lineLengthLimit&&(S=D),S===k&&!e[~-b].trim()&&ge(e,b)&&(b=ge(e,b)+1),L.push(b,I,S),s=i-I,e[i].length&&(s+=1),b=null,I=null,D=null}if((!T&&e[i]==="\n"||e[i]==="\r"&&(!e[i+1]||e[i+1]&&e[i+1]!=="\n"))&&(a=i,g&&(g=!1),!t.removeLineBreaks&&r!==null&&r<i&&e[i+1]&&e[i+1]!=="\r"&&e[i+1]!=="\n"&&L.push(r,i)),e[i+1]||($&&p!==null?L.push([...z({str:e,from:p,to:i,ifLeftSideIncludesThisThenCropTightly:be||"",ifRightSideIncludesThisThenCropTightly:Q||""})]):r&&e[i]!=="\n"&&e[i]!=="\r"?L.push(r,i+1):r&&(e[i]==="\r"&&e[i+1]==="\n"||e[i]==="\n"&&e[i-1]!=="\r")&&L.push(r,i)),!T&&y&&y<i&&e[y]===e[i]&&(y=null),!T&&!$&&e.startsWith("<pre",i)&&!we(e[i+4])){let S=e.indexOf("</pre",i+5);S>0&&(T=S)}if(!T&&!$&&e.startsWith("<code",i)&&!we(e[i+5])){let S=e.indexOf("</code",i+5);S>0&&(T=S)}if(!T&&e.startsWith("<![CDATA[",i)){let S=e.indexOf("]]>",i+9);S>0&&(T=S)}!T&&!$&&!y&&_!==null&&e[i]===">"&&(e[w(e,i)]==="<"&&(J=B),_=null,B=null),e[i]==="<"&&J!==null&&(J=null),$&&e[i]==="{"&&e[i+1]==="{"&&e.indexOf("}}")!==-1&&(T=e.indexOf("}}")+2);let Oe=!0}if(L.current()){let i=L.current();L.wipe();let Oe=t.reportProgressFuncTo-(t.reportProgressFuncTo-t.reportProgressFuncFrom)*he,S=lt(e,i,it=>{t.reportProgressFunc&&M>=2e3&&(j=Math.floor(Oe+(t.reportProgressFuncTo-Oe)*(it/100)),j!==re&&(re=j,t.reportProgressFunc(j)))}),me=S.length;return{log:{timeTakenInMilliseconds:Date.now()-u,originalLength:M,cleanedLength:me,bytesSaved:Math.max(M-me,0),percentageReducedOfOriginal:M?Math.round(Math.max(M-me,0)*100/M):0},ranges:i,applicableOpts:o,result:S}}}return{log:{timeTakenInMilliseconds:Date.now()-u,originalLength:M,cleanedLength:M,bytesSaved:0,percentageReducedOfOriginal:0},applicableOpts:o,ranges:null,result:e}}var nn="7.1.0";var ln=/[\n]?\s*<style[^>]*>\s*<\/style\s*>/g,yt=/[\n]?\s*@(media|supports|document)[^{]*{\s*}/g,Tt=/@media[^{@}]+{(?=\s*<\/style>)/g;var vn=nn,rn={whitelist:[],backend:[],uglify:!1,removeHTMLComments:!0,removeCSSComments:!0,doNotRemoveHTMLCommentsWhoseOpeningTagContains:["[if","[endif"],htmlCrushOpts:{removeLineBreaks:!1,removeIndentations:!1,removeHTMLComments:!1,removeCSSComments:!1,lineLengthLimit:500},reportProgressFunc:null,reportProgressFuncFrom:0,reportProgressFuncTo:100};function Rn(e,l){var Dt,At,Ot,It,wt,vt,Rt,Nt;let u=Date.now(),t=new Me({limitToBeAddedWhitespace:!0}),c=new Me,o=new Me;function a(O){return/[-_A-Za-z0-9]/.test(O)}function r(O={}){return V({valuesStart:null,valueStart:null,nameStart:null,quoteless:!1},O)}let g,s,f,$=[],A=[],y=[],p,N,H,T,b,I={},D=0,B,_,J,oe=null,ue=[],ze=0,Ge=0,ve=0,fe,be,Q,Y,M=!1,X,he,ye,j=null,re=!1,k,Te=null,ee=0,i=0,Oe=".# ~\\!@$%^&*()+=,/';:\"?><[]{}|` \n",S=["media","supports","document"],me=["font-feature-values","counter-style","namespace","font-face","keyframes","viewport","charset","import","page"],it=["{","(","<",'"',"'","@",";"];if(typeof e!="string")throw new TypeError("email-comb: [THROW_ID_01] Input must be string! Currently it's ".concat(typeof e));let Ie=e.length;if(l&&!ae(l))throw new TypeError("email-comb: [THROW_ID_02] Options, second input argument, must be a plain object! Currently it's ".concat(typeof l,", equal to: ").concat(JSON.stringify(l,null,4)));let d=V(V({},rn),l);if(typeof d.doNotRemoveHTMLCommentsWhoseOpeningTagContains=="string"&&(d.doNotRemoveHTMLCommentsWhoseOpeningTagContains=[d.doNotRemoveHTMLCommentsWhoseOpeningTagContains].filter(O=>O.trim())),typeof d.whitelist=="string")d.whitelist=[d.whitelist];else if(!Array.isArray(d.whitelist))throw new TypeError("email-comb: [THROW_ID_03] resolvedOpts.whitelist should be an array, but it was customised to a wrong thing, ".concat(JSON.stringify(d.whitelist,null,4)));if(d.whitelist.length&&!d.whitelist.every(O=>typeof O=="string"))throw new TypeError("email-comb: [THROW_ID_04] resolvedOpts.whitelist array should contain only string-type elements. Currently we\ve got:\n".concat(JSON.stringify(d.whitelist,null,4)));if(!Array.isArray(d.backend))throw new TypeError("email-comb: [THROW_ID_05] resolvedOpts.backend should be an array, but it was customised to a wrong thing, ".concat(JSON.stringify(d.backend,null,4)));if(d.backend.length&&d.backend.some(O=>!ae(O)))throw new TypeError("email-comb: [THROW_ID_06] resolvedOpts.backend array should contain only plain objects but it contains something else:\n".concat(JSON.stringify(d.backend,null,4)));if(d.backend.length&&!d.backend.every(O=>Le(O,"heads")&&Le(O,"tails")))throw new TypeError('email-comb: [THROW_ID_07] every object within resolvedOpts.backend should contain keys "heads" and "tails" but currently it\'s not the case. Whole "resolvedOpts.backend" value array is currently equal to:\n'.concat(JSON.stringify(d.backend,null,4)));if(typeof d.uglify!="boolean")if(d.uglify===1||d.uglify===0)d.uglify=!!d.uglify;else throw new TypeError("email-comb: [THROW_ID_08] resolvedOpts.uglify should be a Boolean. Currently it's set to: ".concat(JSON.stringify(d.uglify,null,4),"}"));if(d.reportProgressFunc&&typeof d.reportProgressFunc!="function")throw new TypeError("email-comb: [THROW_ID_09] resolvedOpts.reportProgressFunc should be a function but it was given as :\n".concat(JSON.stringify(d.reportProgressFunc,null,4)," (").concat(typeof d.reportProgressFunc,")"));let U=null,te=null;Array.isArray(d.backend)&&d.backend.length&&(U=d.backend.map(O=>O.heads),te=d.backend.map(O=>O.tails));let St=d.whitelist.filter(O=>!O.startsWith("#")&&!O.startsWith(".")),Qe="";e.length&&["\n","\r"].includes(e[~-e.length])&&(Qe=Bt(e)||""),e=e.trim().replace(/\r?\n\s+\r?\n/g,""),Qe&&(e+=Qe);let F=e.length,Et=.06,ot=1;d.reportProgressFunc&&(ot=Math.floor((d.reportProgressFuncTo-(d.reportProgressFuncTo-d.reportProgressFuncFrom)*Et-d.reportProgressFuncFrom)/2));let st=0;(!e.length||!"\r\n".includes(e[e.length-1]))&&(st=1);let x,q,Ct=[],Se=[],Fe=[],Pe=[],at={},P,K,De,v,Be=[],se=0,ie,de,ut=[],Ae=[],Re=[],_e,Ye,ct;for(let O=1;O<=2;O++){B=!1,_=!1,Y=null,M=!1,k=!0,ye=!0,T=r(),fe=!0,re=!1,X=null,b=r(),N=null,j=null,De=null,K=!1,v=nu