UNPKG

email-comb

Version:

Remove unused CSS from email templates

53 lines (52 loc) 67.4 kB
/** * @name email-comb * @fileoverview Remove unused CSS from email templates * @version 7.0.26 * @author Roy Revelt, Codsen Ltd * @license MIT * {@link https://codsen.com/os/email-comb/} */ "use strict";var emailComb=(()=>{var Xt=Object.create;var _e=Object.defineProperty;var en=Object.getOwnPropertyDescriptor;var tn=Object.getOwnPropertyNames,Nt=Object.getOwnPropertySymbols,nn=Object.getPrototypeOf,Vt=Object.prototype.hasOwnProperty,ln=Object.prototype.propertyIsEnumerable;var ct=(e,l,u)=>l in e?_e(e,l,{enumerable:!0,configurable:!0,writable:!0,value:u}):e[l]=u,V=(e,l)=>{for(var u in l||(l={}))Vt.call(l,u)&&ct(e,u,l[u]);if(Nt)for(var u of Nt(l))ln.call(l,u)&&ct(e,u,l[u]);return e};var rn=(e,l)=>()=>(l||e((l={exports:{}}).exports,l),l.exports),on=(e,l)=>{for(var u in l)_e(e,u,{get:l[u],enumerable:!0})},Lt=(e,l,u,t)=>{if(l&&typeof l=="object"||typeof l=="function")for(let c of tn(l))!Vt.call(e,c)&&c!==u&&_e(e,c,{get:()=>l[c],enumerable:!(t=en(l,c))||t.enumerable});return e};var Wt=(e,l,u)=>(u=e!=null?Xt(nn(e)):{},Lt(l||!e||!e.__esModule?_e(u,"default",{value:e,enumerable:!0}):u,e)),sn=e=>Lt(_e({},"__esModule",{value:!0}),e);var gt=(e,l,u)=>ct(e,typeof l!="symbol"?l+"":l,u);var ft=rn((wn,Ht)=>{"use strict";Ht.exports=an;function Ne(e){return e instanceof Buffer?Buffer.from(e):new e.constructor(e.buffer.slice(),e.byteOffset,e.length)}function an(e){if(e=e||{},e.circles)return un(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],O=a[$];typeof O!="object"||O===null?s[$]=O:O.constructor!==Object&&(u=l.get(O.constructor))?s[$]=u(O,r):ArrayBuffer.isView(O)?s[$]=Ne(O):s[$]=r(O)}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]=Ne(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]=Ne(s):r[g]=o(s)}return r}}function un(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 O=0;O<f.length;O++){let y=f[O],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]=Ne(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]=Ne($);else{let O=l.indexOf($);O!==-1?s[f]=u[O]: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]=Ne($);else{let O=l.indexOf($);O!==-1?s[f]=u[O]:s[f]=r($)}}return l.pop(),u.pop(),s}}});var On={};on(On,{comb:()=>Cn,defaults:()=>Zt,version:()=>Dn});function xt(e){return typeof e!="string"?e:e.length?[e]:[]}var kt=Wt(ft(),1);var vn=(0,kt.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 ue(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 oe(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 De(e){return[...new Set(e)]}function Mt(e){if(!(typeof e!="string"||!e)){if(e.includes(`\r `))return`\r `;if(e.includes(` `))return` `;if(e.includes("\r"))return"\r"}}function Ve(e,l){return ue(e)&&W(l)&&l in e}function qe(e,l){return e.localeCompare(l)}function ht(e=[],l=[]){return!e||!l?[]:Array.from(new Set(Array.from(e).filter(u=>new Set(l).has(u))))}var Ft={cb:void 0,i:!1,trimBeforeMatching:!1,trimCharsBeforeMatching:[],maxMismatches:0,firstMustMatch:!1,lastMustMatch:!1,hungry:!1},cn=e=>e+1;function gn(e,l,u,t,c=!1,o=cn){var I;let a=typeof u=="function"?u():u;if(+l<0&&c&&a==="EOL")return a;let r=V(V({},Ft),t);if(l>=e.length&&!c)return!1;let g=c?1:u.length,s=0,f=!1,$=!1,O=!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 C=o(p);if(r.trimBeforeMatching&&e[p].trim()===""){if(!e[C]&&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(J=>J.toLowerCase()).includes(e[p].toLowerCase())){if(c&&u==="EOL"&&!e[C])return!0;p=o(p);continue}let B=C>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),O||(O=!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 J=0;J<=y;J++){let _=C>p?u[u.length-g+1+J]:u[g-2-J],se=e[o(p)];if(_&&(!r.i&&e[p]===_||r.i&&e[p].toLowerCase()===_.toLowerCase())&&(!r.firstMustMatch||g!==u.length)){if(s++,b())return!1;g-=2,N=!0;break}else if(se&&_&&(!r.i&&se===_||r.i&&se.toLowerCase()===_.toLowerCase())&&(!r.firstMustMatch||g!==u.length)){if(!s&&!r.hungry)return!1;g-=1,N=!0;break}else if(_===void 0&&y>=0&&N&&(!r.firstMustMatch||H)&&(!r.lastMustMatch||T))return p}N||($=p)}else return p===0&&g===1&&!r.lastMustMatch&&O?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&&O?$||0:!1}function mt(e,l,u,t,c){var f,$,O;if(ue(c)&&Ve(c,"trimBeforeMatching")&&c&&typeof c.trimBeforeMatching!="boolean")throw new Error(`string-match-left-right/${e}(): [THROW_ID_09] opts.trimBeforeMatching should be boolean!${Array.isArray(c.trimBeforeMatching)?" Did you mean to use opts.trimCharsBeforeMatching?":""}`);let o=V(V({},Ft),c);if(typeof o.trimCharsBeforeMatching=="string"&&(o.trimCharsBeforeMatching=xt(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/${e}(): [THROW_ID_03] the second argument should be a natural number. Currently it's of a type: ${typeof u}, equal to: ${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/${e}(): [THROW_ID_05] the third argument, whatToMatch, is neither string nor array of strings! It's ${typeof t}, equal to: ${JSON.stringify(t,null,4)}`);if(c&&!ue(c))throw new Error(`string-match-left-right/${e}(): [THROW_ID_06] the fourth argument, options object, should be a plain object. Currently it's of a type "${typeof c}", and equal to: ${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/${e}(): [THROW_ID_07] the fourth argument, options object contains trimCharsBeforeMatching. It was meant to list the single characters but one of the entries at index ${g} is longer than 1 character, ${s.length} (equals to ${s}). Please split it into separate characters and put into array as separate elements.`);if(!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 C=l[I];if((!o.trimBeforeMatching||o.trimBeforeMatching&&(C!=null&&C.trim()))&&(!(($=o.trimCharsBeforeMatching)!=null&&$.length)||C!==void 0&&!o.trimCharsBeforeMatching.includes(C))){p=I;break}}else if(e.startsWith("matchRight"))for(let I=N;I<l.length;I++){let C=l[I];if((!o.trimBeforeMatching||o.trimBeforeMatching&&C.trim())&&(!((O=o.trimCharsBeforeMatching)!=null&&O.length)||!o.trimCharsBeforeMatching.includes(C))){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/${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!${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 C=gn(l,I,N,o,r,B=>e[5]==="L"?B-1:B+1);if(C&&r&&typeof N=="function"&&N()==="EOL")return N()&&(!o.cb||o.cb(H,b,T))?N():!1;if(Number.isInteger(C)&&(T=e.startsWith("matchLeft")?C-1:C+1,e[5]==="L"?b=l.slice(0,C):b=l.slice(T)),T<0&&(T=void 0),l[T]&&(H=l[T]),Number.isInteger(C)&&(!o.cb||o.cb(H,b,T)))return N}return!1}function pe(e,l,u,t){return mt("matchLeft",e,l,u,t)}function le(e,l,u,t){return mt("matchRightIncl",e,l,u,t)}function Z(e,l,u,t){return mt("matchRight",e,l,u,t)}function Pt(){return/<!(--)?\[if[^\]]*]>[<>!-\s]*<!\[endif\]\1>/gi}var Bt=Wt(ft(),1);var kn=(0,Bt.default)();var Le="\xA0";function fn({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&&` \r`.includes(e[l+1])||t&&e[l+1]===Le))return l+1;if(e[l+2]&&(e[l+2].trim()||u&&` \r`.includes(e[l+2])||t&&e[l+2]===Le))return l+2;for(let c=l+1,o=e.length;c<o;c++)if(e[c].trim()||u&&` \r`.includes(e[c])||t&&e[c]===Le)return c;return null}function w(e,l=0){return fn({str:e,idx:l,stopAtNewlines:!1,stopAtRawNbsp:!1})}function hn({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&&` \r`.includes(e[~-l])||t&&e[~-l]===Le))return~-l;if(e[l-2]&&(e[l-2].trim()||u&&` \r`.includes(e[l-2])||t&&e[l-2]===Le))return l-2;for(let c=l;c--;)if(e[c]&&(e[c].trim()||u&&` \r`.includes(e[c])||t&&e[c]===Le))return c;return null}function ge(e,l=0){return hn({str:e,idx:l,stopAtNewlines:!1,stopAtRawNbsp:!1})}function We(e){var a;if(typeof e!="string")throw new TypeError(`string-extract-class-names: [THROW_ID_01] first str should be string, not ${typeof e}, currently equal to ${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(`${u||""}${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 dt(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}var $t=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 '${l}' to be a string or an array, but got a type of '${typeof e}'`)}return e.filter(u=>{if(typeof u!="string"){if(typeof u>"u")return!1;throw new TypeError(`Expected '${l}' to be an array of strings, but found a type of '${typeof u}' in the array`)}return!0})},mn=(e,l)=>{l=V({caseSensitive:!1},l);let u=e+JSON.stringify(l);if($t.has(u))return $t.get(u);let t=e[0]==="!";t&&(e=e.slice(1)),e=dt(e).replace(/\\\*/g,"[\\s\\S]*");let c=new RegExp(`^${e}$`,l.caseSensitive?"":"i");return c.negated=t,$t.set(u,c),c},_t=(e,l,u,t)=>{if(e=Jt(e,"inputs"),l=Jt(l,"patterns"),l.length===0)return[];l=l.map(a=>mn(a,u));let{allPatterns:c}=u||{},o=[];for(let a of e){let r,g=[...l].fill(!1);for(let[s,f]of l.entries())if(f.test(a)&&(g[s]=!0,r=!f.negated,!r))break;if(!(r===!1||r===void 0&&l.some(s=>!s.negated)||c&&g.some((s,f)=>!s&&!l[f].negated))&&(o.push(a),t))break}return o};function xe(e,l,u){return _t(e,l,u,!1)}function et(e,l,u){return _t(e,l,u,!0).length>0}var dn={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({},dn),u);return Array.from(e).filter(o=>!t.some(a=>et(o,a,{caseSensitive:c.caseSensitive})))}var $n={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(ue(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 ${typeof e}, equal to: ${JSON.stringify(e,null,4)}.`,new Error(`string-range-expander: [THROW_ID_01] Input must be a plain object ${s}`)}if(!oe(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 ${typeof e.from}, equal to ${JSON.stringify(e.from,null,0)}`);if(!oe(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 ${typeof e.to}, equal to ${JSON.stringify(e.to,null,0)}`);if(e!=null&&e.str&&!e.str[e.from]&&e.from!==e.to)throw new Error(`string-range-expander: [THROW_ID_05] The given input string resolvedOpts.str ("${e.str}") must contain the character at index "from" ("${e.from}")`);if(e!=null&&e.str&&!e.str[e.to-1])throw new Error(`string-range-expander: [THROW_ID_06] The given input string, resolvedOpts.str ("${e.str}") must contain the character at index before "to" ("${e.to-1}")`);if(e.from>e.to)throw new Error(`string-range-expander: [THROW_ID_07] The given "from" index, "${e.from}" is greater than "to" index, "${e.to}". That's wrong!`);if(e.extendToOneSide===null||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: "${e.extendToOneSide}" (${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 ${typeof e.ifLeftSideIncludesThisThenCropTightly}, equal to ${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 ${typeof e.ifLeftSideIncludesThisCropItToo}, equal to ${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 ${typeof e.ifRightSideIncludesThisThenCropTightly}, equal to ${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 ${typeof e.ifRightSideIncludesThisCropItToo}, equal to ${JSON.stringify(e.ifRightSideIncludesThisCropItToo,null,0)}`);let t=V(V({},$n),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 tt(e,l=0){return e.codePointAt(l)||0}function Ut(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((O,y)=>O+tt(y),0);if(".#".includes(e[r][0])&&e[r].length<4||!".#".includes(e[r][0])&&e[r].length<3){let O=e[r];if(!a.includes(O)){a.push(O),O.startsWith(".")&&O.length===2&&t[O.slice(1)]===!1?t[O.slice(1)]=!0:O.startsWith("#")&&O.length===2&&c[O.slice(1)]===!1?c[O.slice(1)]=!0:!O.startsWith(".")&&!O.startsWith("#")&&O.length===1&&o[O]===!1&&(o[O]=!0);continue}}let $=`${s}${l[f%l.length]}${u[f%u.length]}`;if(a.includes($)){let O=$,y=0,p=Array.from(e[r]).reduce((H,T)=>H<200?H+tt(T):(H+tt(T))%u.length,0),N=Array.from(e[r]).map(H=>tt(H)).reduce((H,T)=>{let b=H+T;do b=String(b).split("").reduce((I,C)=>I+Number.parseInt(C,10),0);while(b>=10);return b},0);for(;a.includes(O);)y+=1,O+=u[p*N*y%u.length];$=O}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 pn={strictlyTwoElementsInRangeArrays:!1,progressFn:null};function He(e,l){if(!Array.isArray(e)||!e.length)return e;let u=V(V({},pn),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, ${t}th range (${JSON.stringify(e[t],null,4)}) has not two but ${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, ${t}th range (${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 jt={mergeType:1,progressFn:null,joinRangesThatTouchEdges:!0};function qt(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({},jt),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: "${typeof t.progressFn}", equal to ${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: "${typeof t.mergeType}", equal to ${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: "${typeof t.joinRangesThatTouchEdges}", equal to ${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: ${JSON.stringify(l,null,4)} (type ${typeof l})`);else t=V({},jt);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=He(c,{progressFn:s=>{r=Math.floor(s/5),r!==a&&(a=r,t.progressFn(r))}}):o=He(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 bn=!0,pt="Invariant failed";function Kt(e,l){if(!e){if(bn)throw new Error(pt);var u=typeof l=="function"?l():l,t=u?"".concat(pt,": ").concat(u):pt;throw new Error(t)}}function nt(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: ${typeof e}, equal to: ${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: ${typeof l}, equal to: ${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: ${typeof u}, equal to: ${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 ${$}th element not an array: ${JSON.stringify(f,null,4)}, which is ${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 ${$}th element, array ${JSON.stringify(f,null,0)}. Its first element is not an integer, string index, but ${typeof f[0]}, equal to: ${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 ${$}th element, array ${JSON.stringify(f,null,0)}. Its second element is not an integer, string index, but ${typeof f[1]}, equal to: ${JSON.stringify(f[1],null,4)}.`);o[$][1]=+o[$][1]}r+=1});let g=qt(o,{progressFn:f=>{u&&(t=10+Math.floor(f/10),t!==c&&(c=t,u(t)))}});Kt(g);let s=g.length;if(s>0){let f=e.slice(g[s-1][1]);e=g.reduce(($,O,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`${$}${e.slice(N,H)}${p[y][2]||""}`},""),e+=f}return e}function lt(e,l=1){let u="\xA0";function t(o){return Array.from(o).reverse().join("")}function c(o,a,r){let g=r?` `:"\r",s=r?"\r":` `;if(!o)return o;let f=0,$=0,O="";for(let y=0,p=o.length;y<p;y++)(o[y]===g||o[y]===s&&o[y-1]!==g)&&$++,`\r `.includes(o[y])||o[y]===u?(f=0,o[y]===u?O+=o[y]:o[y]===g?$<=a&&(O+=o[y],o[y+1]===s&&(O+=o[y+1],y++)):o[y]===s&&(o==null?void 0:o[y-1])!==g&&$<=a&&(O+=o[y])):(f++,!o[y+1]&&!$&&(O+=" "));return O}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`${c(a,o,!1)}${e.trim()}${t(c(t(r),o,!0))}`}return e}var zt={mergeType:1,progressFn:null,joinRangesThatTouchEdges:!0};function yn(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({},zt),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: "${typeof t.progressFn}", equal to ${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: "${typeof t.mergeType}", equal to ${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: "${typeof t.joinRangesThatTouchEdges}", equal to ${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: ${JSON.stringify(l,null,4)} (type ${typeof l})`);else t=V({},zt);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=He(c,{progressFn:f=>{r=Math.floor(f/5),r!==a&&(a=r,t.progressFn!=null&&t.progressFn(r))}}):o=He(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 Tn={limitToBeAddedWhitespace:!1,limitLinebreaksCount:1,mergeType:1},ke=class{constructor(e){gt(this,"ranges");gt(this,"opts");let l=V(V({},Tn),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: "${typeof l.mergeType}", equal to ${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&&oe(+e[0])&&oe(+e[1])&&this.add(...e)}return}throw new TypeError(`ranges-push/Ranges/add(): [THROW_ID_12] the first input argument, "from" is set (${JSON.stringify(e,null,0)}) but second-one, "to" is not (${JSON.stringify(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 (${JSON.stringify(l,null,0)}) but first-one, "from" is not (${JSON.stringify(e,null,0)})`);let t=+e,c=+l;if(oe(u)&&(u=String(u)),oe(t)&&oe(c)){if(Ee(u)&&!W(u)&&!oe(u))throw new TypeError(`ranges-push/Ranges/add(): [THROW_ID_08] The third argument, the value to add, was given not as string but ${typeof u}, equal to: ${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)?`${this.last()[2]}${u}`:u;this.opts.limitToBeAddedWhitespace&&(a=lt(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?lt(u,this.opts.limitLinebreaksCount):u]:[t,c];this.ranges.push(a)}}else throw oe(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 "${typeof c}" equal to: ${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 "${typeof t}" equal to: ${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=yn(this.ranges,{mergeType:this.opts.mergeType}),this.ranges&&this.opts.limitToBeAddedWhitespace?this.ranges.map(e=>Ee(e[2])?[e[0],e[1],lt(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])&&oe(e[0][0]))this.ranges=Array.from(e);else throw new Error(`ranges-push/Ranges/replace(): [THROW_ID_11] Single range was given but we expected array of arrays! The first element, ${JSON.stringify(e[0],null,4)} should be an array and its first element should be an integer, a string index.`);else this.ranges=[]}last(){return Array.isArray(this.ranges)&&this.ranges.length?this.ranges[this.ranges.length-1]:null}};var L=new ke({limitToBeAddedWhitespace:!0}),Sn={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 Gt(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 "${typeof e}", equal to: ${JSON.stringify(e,null,4)}`);if(l&&!ue(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 ${typeof l}, equal to ${JSON.stringify(l,null,4)}`);if(l&&Array.isArray(l.breakToTheLeftOf)&&l.breakToTheLeftOf.length){for(let i=0,Ae=l.breakToTheLeftOf.length;i<Ae;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 ${i} is of a type "${typeof l.breakToTheLeftOf[i]}" and is equal to: ${JSON.stringify(l.breakToTheLeftOf[i],null,4)}`)}let t=V(V({},Sn),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,O=!1,y=null,p=null,N=null,H=null,T,b=null,I=null,C=null,B=null,J=null,_=null,se=">};",ce="<",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=` `;if(e.includes(`\r `)?k=`\r `: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,C=" ")),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]===` `||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(J!==null&&B===null&&!/\w/.test(e[i])){B=e.slice(J,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]==="<"&&J===null&&(/\w/.test(e[i])?J=i:e[w(e,~-i)]==="/"&&/\w/.test(e[w(e,w(e,~-i))]||"")&&(J=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)),O&&e.startsWith("![endif",i+1)&&(O=!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)?(O||(O=!0),t.removeHTMLComments===2&&(N=i)):t.removeHTMLComments&&(!O||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 `.includes(e[~-i])&&r===~-i)&&!(e[~-i]===` `&&e[i-2]==="\r"&&r===i-2)&&L.push(r,i,k),b=null,I=null,C=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)&&!O||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())&&!se.includes(e[i])&&!ce.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,C=null):(b===null||r<b)&&(b=r,I=i,C=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,C=null,s=1;continue}else if(t.lineLengthLimit&&s<=t.lineLengthLimit){if(!e[i+1]||ce.includes(e[i])&&!ze.includes(e[i])||se.includes(e[i])||!e[i].trim()){if(b!==null&&I!==null&&(b!==I||C!=null&&C.length)){let S=C;e[i].trim()&&((ee=e[i+1])!=null&&ee.trim())&&s+(C?C.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()&&(ce.includes(e[i])||e[~-i]&&se.includes(e[~-i]))&&W(_)&&(!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,C=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,C=null)}}else if(t.lineLengthLimit)if(ce.includes(e[i])&&!(e[i]==="<"&&Z(e,i,t.mindTheInlineTags,{trimCharsBeforeMatching:"/",cb:S=>!S||!/\w/.test(S)})))if(b!==null&&I!==null&&(b!==I||C!=null&&C.length)){let S=C!=null&&C.length?C.length:0;s-(I-b-S)-1>t.lineLengthLimit||(L.push(b,I,C),s-(I-b-S)-1===t.lineLengthLimit&&(L.push(i,i,k),s=0),b=null,I=null,C=null)}else L.push(i,i,k),s=0;else e[i+1]&&se.includes(e[i])&&W(B)&&Array.isArray(t.mindTheInlineTags)&&t.mindTheInlineTags.length&&!t.mindTheInlineTags.includes(B)?b!==null&&I!==null&&(b!==I||C!=null&&C.length)||(L.push(i+1,i+1,k),s=0):e[i].trim()&&(e[i+1]||b!==null&&I!==null&&(b!==I||C!=null&&C.length)&&L.push(b,I,k))}if(!T&&!Y&&t.removeLineBreaks&&t.lineLengthLimit&&s>=t.lineLengthLimit&&b!==null&&I!==null&&!se.includes(e[i])&&!ce.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=C),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,C=null}if((!T&&e[i]===` `||e[i]==="\r"&&(!e[i+1]||e[i+1]&&e[i+1]!==` `))&&(a=i,g&&(g=!1),!t.removeLineBreaks&&r!==null&&r<i&&e[i+1]&&e[i+1]!=="\r"&&e[i+1]!==` `&&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]!==` `&&e[i]!=="\r"?L.push(r,i+1):r&&(e[i]==="\r"&&e[i+1]===` `||e[i]===` `&&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&&J!==null&&e[i]===">"&&(e[w(e,i)]==="<"&&(_=B),J=null,B=null),e[i]==="<"&&_!==null&&(_=null),$&&e[i]==="{"&&e[i+1]==="{"&&e.indexOf("}}")!==-1&&(T=e.indexOf("}}")+2);let Ae=!0}if(L.current()){let i=L.current();L.wipe();let Ae=t.reportProgressFuncTo-(t.reportProgressFuncTo-t.reportProgressFuncFrom)*he,S=nt(e,i,rt=>{t.reportProgressFunc&&M>=2e3&&(j=Math.floor(Ae+(t.reportProgressFuncTo-Ae)*(rt/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 Qt="7.0.26";var Yt=/[\n]?\s*<style[^>]*>\s*<\/style\s*>/g,bt=/[\n]?\s*@(media|supports|document)[^{]*{\s*}/g,yt=/@media[^{@}]+{(?=\s*<\/style>)/g;var Dn=Qt,Zt={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 Cn(e,l){var Dt,Ct,Ot,At,It,wt,vt,Rt;let u=Date.now(),t=new ke({limitToBeAddedWhitespace:!0}),c=new ke,o=new ke;function a(A){return/[-_A-Za-z0-9]/.test(A)}function r(A={}){return V({valuesStart:null,valueStart:null,nameStart:null,quoteless:!1},A)}let g,s,f,$=[],O=[],y=[],p,N,H,T,b,I={},C=0,B,J,_,se=null,ce=[],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,Ae=`.# ~\\!@$%^&*()+=,/';:"?><[]{}|\` `,S=["media","supports","document"],me=["font-feature-values","counter-style","namespace","font-face","keyframes","viewport","charset","import","page"],rt=["{","(","<",'"',"'","@",";"];if(typeof e!="string")throw new TypeError(`email-comb: [THROW_ID_01] Input must be string! Currently it's ${typeof e}`);let Ie=e.length;if(l&&!ue(l))throw new TypeError(`email-comb: [THROW_ID_02] Options, second input argument, must be a plain object! Currently it's ${typeof l}, equal to: ${JSON.stringify(l,null,4)}`);let d=V(V({},Zt),l);if(typeof d.doNotRemoveHTMLCommentsWhoseOpeningTagContains=="string"&&(d.doNotRemoveHTMLCommentsWhoseOpeningTagContains=[d.doNotRemoveHTMLCommentsWhoseOpeningTagContains].filter(A=>A.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, ${JSON.stringify(d.whitelist,null,4)}`);if(d.whitelist.length&&!d.whitelist.every(A=>typeof A=="string"))throw new TypeError(`email-comb: [THROW_ID_04] resolvedOpts.whitelist array should contain only string-type elements. Currently we\ve got: ${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, ${JSON.stringify(d.backend,null,4)}`);if(d.backend.length&&d.backend.some(A=>!ue(A)))throw new TypeError(`email-comb: [THROW_ID_06] resolvedOpts.backend array should contain only plain objects but it contains something else: ${JSON.stringify(d.backend,null,4)}`);if(d.backend.length&&!d.backend.every(A=>Ve(A,"heads")&&Ve(A,"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: ${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: ${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 : ${JSON.stringify(d.reportProgressFunc,null,4)} (${typeof d.reportProgressFunc})`);let U=null,te=null;Array.isArray(d.backend)&&d.backend.length&&(U=d.backend.map(A=>A.heads),te=d.backend.map(A=>A.tails));let Tt=d.whitelist.filter(A=>!A.startsWith("#")&&!A.startsWith(".")),Qe="";e.length&&[` `,"\r"].includes(e[~-e.length])&&(Qe=Mt(e)||""),e=e.trim().replace(/\r?\n\s+\r?\n/g,""),Qe&&(e+=Qe);let F=e.length,St=.06,it=1;d.reportProgressFunc&&(it=Math.floor((d.reportProgressFuncTo-(d.reportProgressFuncTo-d.reportProgressFuncFrom)*St-d.reportProgressFuncFrom)/2));let ot=0;(!e.length||!`\r `.includes(e[e.length-1]))&&(ot=1);let x,q,Et=[],Se=[],Me=[],Fe=[],st={},P,K,Ce,v,Pe=[],ae=0,ie,de,at=[],Oe=[],Re=[],Be,Ye,ut;for(let A=1;A<=2;A++){B=!1,J=!1,Y=null,M=!1,k=!0,ye=!0,T=r(),fe=!0,re=!1,X=null,b=r(),N=null,j=null,Ce=null,K=!1,v=null,_=!1,Q=null,ie=!1,de=null,p=null,q=null,g=null,H=null,Be=null,s=null,x=!1,C+=F;e:for(let n=0;n<F;n++){d.reportProgressFunc&&(F>1e3&&F<2e3?A===1&&n===0&&d.reportProgressFunc(Math.floor((d.reportProgressFuncTo-d.reportProgressFuncFrom)/2)):F>=2e3&&(P=d.reportProgressFuncFrom+Math.floor(n/F*it)+(A===1?0:it),P!==ae&&(ae=P,d.reportProgressFunc(P))));let R=e[n];if(!K&&(s===null&&g!==null&&n>=g||g!==null&&s!==null&&g>s&&g<n)?(K=!0,ie=!1,de=null):!ie&&H!==null&&(g===null||g<n)&&(s===null||s<n)&&(ie=!0,K=!1),ie&&p===null&&de!==null&&n>de&&e[n]===e[de]&&(de=null),ie&&p===null&&de===null&&e.startsWith("style=",n)&&(e[n+6]==="'"||e[n+6]==='"')&&(de=n+6),!x&&(e[n]==='"'||e[n]==="'")){if(Ce)if(e[n]==='"'&&e[w(e,n)]==="'"&&e[w(e,w(e,n))]==='"'||e[n]==="'"&&e[w(e,n)]==='"'&&e[w(e,w(e,n))]==="'"){n=w(e,w(e,n));continue}else Ce===e[n]&&(Ce=null);else{let h=ge(e,n);typeof h=="number"&&(K&&["(",","].includes(e[h])||ie&&!K&&["(",",",":","="].includes(e[h]))&&(Ce=e[n])}ie&&typeof f=="number"&&f<n&&(f=null)}if(x){if(q===null||typeof q!="string"||typeof q=="string"&&!q)x=!1;else if(q&&le(e,n,q)){if(p!==null){if(A===1&&d.removeCSSComments){let h=pe(e,p,[`\r `,` `,"\r"]),E=p;typeof h=="string"&&h.length&&(E-=h.length),e[E-1]&&a(e[E-1])&&e[n+q.length]&&a(e[n+q.length])?(t.push(E,n+q.length,";"),i+=n+q.length-E):(t.push(E,n+q.length),i+=n+q.length-E)}p=null}n=n+q.length-1,q=null,x=!1;continue}}if(!x&&e[n]==="<"&&e[n+1]==="s"&&e[n+2]==="t"&&e[n+3]==="y"&&e[n+4]==="l"&&e[n+5]==="e"){J=!0,K||(K=!0);for(let h=n;h<F;h++)if(C+=1,e[h]===">"){g=h+1,Q=h+1;break}}if(!x&&K&&e[n]==="<"&&e[n+1]==="/"&&e[n+2]==="s"&&e[n+3]==="t"&&e[n+4]==="y"&&e[n+5]==="l"&&e[n+6]==="e"&&(s=n-1,Q=null,J=!1,K&&(K=!1)),A===1&&