/*! * Tiny Inline CSS plugin * * Copyright (c) 2022 Ephox Corporation DBA Tiny Technologies, Inc. * Licensed under the Tiny commercial license. See https://www.tiny.cloud/legal/ * * Version: 1.0.0-22 */ !function(){"use strict";const t=t=>parseInt(t,10),e=(t,e)=>{const n=t-e;return 0===n?0:n>0?1:-1},n=(t,e,n)=>({major:t,minor:e,patch:n}),r=e=>{const r=/([0-9]+)\.([0-9]+)\.([0-9]+)(?:(\-.+)?)/.exec(e);return r?n(t(r[1]),t(r[2]),t(r[3])):n(0,0,0)},o=t=>e=>(t=>{const e=typeof t;return null===t?"null":"object"===e&&Array.isArray(t)?"array":"object"===e&&(n=r=t,(o=String).prototype.isPrototypeOf(n)||(null===(i=r.constructor)||void 0===i?void 0:i.name)===o.name)?"string":e;var n,r,o,i})(e)===t,i=t=>e=>typeof e===t,s=t=>e=>t===e,a=o("string"),l=o("object"),c=o("array"),u=s(null),h=i("boolean"),d=s(void 0),f=t=>!(t=>null==t)(t),p=i("function"),m=i("number"),g=()=>{},k=t=>()=>t;function y(t,...e){return(...n)=>{const r=e.concat(n);return t.apply(null,r)}}const v=k(!1),S=k(!0);class b{constructor(t,e){this.tag=t,this.value=e}static some(t){return new b(!0,t)}static none(){return b.singletonNone}fold(t,e){return this.tag?e(this.value):t()}isSome(){return this.tag}isNone(){return!this.tag}map(t){return this.tag?b.some(t(this.value)):b.none()}bind(t){return this.tag?t(this.value):b.none()}exists(t){return this.tag&&t(this.value)}forall(t){return!this.tag||t(this.value)}filter(t){return!this.tag||t(this.value)?this:b.none()}getOr(t){return this.tag?this.value:t}or(t){return this.tag?this:t}getOrThunk(t){return this.tag?this.value:t()}orThunk(t){return this.tag?this:t()}getOrDie(t){if(this.tag)return this.value;throw new Error(null!=t?t:"Called getOrDie on None")}static from(t){return f(t)?b.some(t):b.none()}getOrNull(){return this.tag?this.value:null}getOrUndefined(){return this.value}each(t){this.tag&&t(this.value)}toArray(){return this.tag?[this.value]:[]}toString(){return this.tag?`some(${this.value})`:"none()"}}b.singletonNone=new b(!1);const C=Array.prototype.slice,w=Array.prototype.indexOf,x=Array.prototype.push,A=(t,e)=>{return n=t,r=e,w.call(n,r)>-1;var n,r},L=(t,e)=>{const n=t.length,r=new Array(n);for(let o=0;o{for(let n=0,r=t.length;n{const n=[];for(let r=0,o=t.length;r(t=>{const e=[];for(let n=0,r=t.length;nC.call(t),P=t=>{if(null==t)throw new Error("Node cannot be null or undefined");return{dom:t}},I=(t,e)=>{const n=(e||document).createElement(t);return P(n)},N=P,M=(t,e)=>{const n=t.dom;if(1!==n.nodeType)return!1;{const t=n;if(void 0!==t.matches)return t.matches(e);if(void 0!==t.msMatchesSelector)return t.msMatchesSelector(e);if(void 0!==t.webkitMatchesSelector)return t.webkitMatchesSelector(e);if(void 0!==t.mozMatchesSelector)return t.mozMatchesSelector(e);throw new Error("Browser lacks native selectors")}},j="undefined"!=typeof window?window:Function("return this;")(),D=(t,e)=>((t,e)=>{let n=null!=e?e:j;for(let e=0;e{const e=D("ownerDocument.defaultView",t);return l(t)&&((t=>((t,e)=>{const n=((t,e)=>D(t,e))(t,e);if(null==n)throw new Error(t+" not available on this browser");return n})("HTMLElement",t))(e).prototype.isPrototypeOf(t)||/^HTML\w*Element$/.test(R(t).constructor.name))},U=t=>e=>(t=>t.dom.nodeType)(e)===t,$=U(1),z=U(9),V=U(11),F=t=>N(t.dom.ownerDocument),W=t=>z(t)?t:F(t),G=t=>L(t.dom.childNodes,N),q=(t,e)=>{t.dom.appendChild(e.dom)},H=t=>{const e=t.dom;null!==e.parentNode&&e.parentNode.removeChild(e)},J=(t,e)=>{const n=F(t).dom,r=N(n.createDocumentFragment()),o=((t,e)=>{const n=(e||document).createElement("div");return n.innerHTML=t,G(N(n))})(e,n);var i;i=r,E(o,(t=>{q(i,t)})),(t=>{t.dom.textContent="",E(G(t),(t=>{H(t)}))})(t),q(t,r)},Q=p(Element.prototype.attachShadow)&&p(Node.prototype.getRootNode),Y=k(Q),K=Q?t=>N(t.dom.getRootNode()):W,X=t=>{const e=t.dom.body;if(null==e)throw new Error("Body is not available yet");return N(e)},Z=(t,e)=>((t,n)=>{return(r=t.dom.childNodes,o=t=>(t=>M(t,e))(N(t)),((t,e,n)=>{for(let r=0,o=t.length;r{const n=tt(t);for(let r=0,o=n.length;r{((t,e,n)=>{if(!(a(n)||h(n)||m(n)))throw console.error("Invalid call to Attribute.set. Key ",e,":: Value ",n,":: Element ",t),new Error("Attribute value was not simple");t.setAttribute(e,n+"")})(t.dom,e,n)},rt=t=>void 0!==t.style&&p(t.style.getPropertyValue),ot=(t,e,n)=>{if(!a(n))throw console.error("Invalid call to CSS.set. Property ",e,":: Value ",n,":: Element ",t),new Error("CSS value must be a string: "+n);rt(t)&&t.style.setProperty(e,n)},it=(t,e)=>{const n=t.dom;et(e,((t,e)=>{ot(n,e,t)}))};var st=Object.create,at=Object.defineProperty,lt=Object.getOwnPropertyDescriptor,ct=Object.getOwnPropertyNames,ut=Object.getPrototypeOf,ht=Object.prototype.hasOwnProperty,dt=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),ft=(t,e)=>{for(var n in e)at(t,n,{get:e[n],enumerable:!0})},pt=dt((t=>{var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");t.encode=function(t){if(0<=t&&t{var e=pt();t.encode=function(t){var n,r,o="",i=(r=t)<0?1+(-r<<1):0+(r<<1);do{n=31&i,(i>>>=5)>0&&(n|=32),o+=e.encode(n)}while(i>0);return o},t.decode=function(t,n,r){var o,i,s=t.length,a=0,l=0;do{if(n>=s)throw new Error("Expected more digits in base 64 VLQ value.");if(-1===(i=e.decode(t.charCodeAt(n++))))throw new Error("Invalid base64 digit: "+t.charAt(n-1));o=!!(32&i),a+=(i&=31)<>1;return 1==(1&t)?-e:e}(a),r.rest=n}})),gt=dt((t=>{t.getArg=function(t,e,n){if(e in t)return t[e];if(3===arguments.length)return n;throw new Error('"'+e+'" is a required argument.')};var e=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/,n=/^data:.+\,.+$/;function r(t){var n=t.match(e);return n?{scheme:n[1],auth:n[2],host:n[3],port:n[4],path:n[5]}:null}function o(t){var e="";return t.scheme&&(e+=t.scheme+":"),e+="//",t.auth&&(e+=t.auth+"@"),t.host&&(e+=t.host),t.port&&(e+=":"+t.port),t.path&&(e+=t.path),e}t.urlParse=r,t.urlGenerate=o;var i,s,a=(i=function(e){var n=e,i=r(e);if(i){if(!i.path)return e;n=i.path}for(var s=t.isAbsolute(n),a=[],l=0,c=0;;){if(l=c,-1===(c=n.indexOf("/",l))){a.push(n.slice(l));break}for(a.push(n.slice(l,c));c=0;c--)"."===(u=a[c])?a.splice(c,1):".."===u?h++:h>0&&(""===u?(a.splice(c+1,h),h=0):(a.splice(c,2),h--));return""===(n=a.join("/"))&&(n=s?"/":"."),i?(i.path=n,o(i)):n},s=[],function(t){for(var e=0;e32&&s.pop(),r});function l(t,e){""===t&&(t="."),""===e&&(e=".");var i=r(e),s=r(t);if(s&&(t=s.path||"/"),i&&!i.scheme)return s&&(i.scheme=s.scheme),o(i);if(i||e.match(n))return e;if(s&&!s.host&&!s.path)return s.host=e,o(s);var l="/"===e.charAt(0)?e:a(t.replace(/\/+$/,"")+"/"+e);return s?(s.path=l,o(s)):l}t.normalize=a,t.join=l,t.isAbsolute=function(t){return"/"===t.charAt(0)||e.test(t)},t.relative=function(t,e){""===t&&(t="."),t=t.replace(/\/$/,"");for(var n=0;0!==e.indexOf(t+"/");){var r=t.lastIndexOf("/");if(r<0||(t=t.slice(0,r)).match(/^([^\/]+:\/)?\/*$/))return e;++n}return Array(n+1).join("../")+e.substr(t.length+1)};var c=!("__proto__"in Object.create(null));function u(t){return t}function h(t){if(!t)return!1;var e=t.length;if(e<9||95!==t.charCodeAt(e-1)||95!==t.charCodeAt(e-2)||111!==t.charCodeAt(e-3)||116!==t.charCodeAt(e-4)||111!==t.charCodeAt(e-5)||114!==t.charCodeAt(e-6)||112!==t.charCodeAt(e-7)||95!==t.charCodeAt(e-8)||95!==t.charCodeAt(e-9))return!1;for(var n=e-10;n>=0;n--)if(36!==t.charCodeAt(n))return!1;return!0}function d(t,e){return t===e?0:null===t?1:null===e?-1:t>e?1:-1}t.toSetString=c?u:function(t){return h(t)?"$"+t:t},t.fromSetString=c?u:function(t){return h(t)?t.slice(1):t},t.compareByOriginalPositions=function(t,e,n){var r=d(t.source,e.source);return 0!==r||0!=(r=t.originalLine-e.originalLine)||0!=(r=t.originalColumn-e.originalColumn)||n||0!=(r=t.generatedColumn-e.generatedColumn)||0!=(r=t.generatedLine-e.generatedLine)?r:d(t.name,e.name)},t.compareByOriginalPositionsNoSource=function(t,e,n){var r;return 0!=(r=t.originalLine-e.originalLine)||0!=(r=t.originalColumn-e.originalColumn)||n||0!=(r=t.generatedColumn-e.generatedColumn)||0!=(r=t.generatedLine-e.generatedLine)?r:d(t.name,e.name)},t.compareByGeneratedPositionsDeflated=function(t,e,n){var r=t.generatedLine-e.generatedLine;return 0!==r||0!=(r=t.generatedColumn-e.generatedColumn)||n||0!==(r=d(t.source,e.source))||0!=(r=t.originalLine-e.originalLine)||0!=(r=t.originalColumn-e.originalColumn)?r:d(t.name,e.name)},t.compareByGeneratedPositionsDeflatedNoLine=function(t,e,n){var r=t.generatedColumn-e.generatedColumn;return 0!==r||n||0!==(r=d(t.source,e.source))||0!=(r=t.originalLine-e.originalLine)||0!=(r=t.originalColumn-e.originalColumn)?r:d(t.name,e.name)},t.compareByGeneratedPositionsInflated=function(t,e){var n=t.generatedLine-e.generatedLine;return 0!==n||0!=(n=t.generatedColumn-e.generatedColumn)||0!==(n=d(t.source,e.source))||0!=(n=t.originalLine-e.originalLine)||0!=(n=t.originalColumn-e.originalColumn)?n:d(t.name,e.name)},t.parseSourceMapInput=function(t){return JSON.parse(t.replace(/^\)]}'[^\n]*\n/,""))},t.computeSourceURL=function(t,e,n){if(e=e||"",t&&("/"!==t[t.length-1]&&"/"!==e[0]&&(t+="/"),e=t+e),n){var i=r(n);if(!i)throw new Error("sourceMapURL could not be parsed");if(i.path){var s=i.path.lastIndexOf("/");s>=0&&(i.path=i.path.substring(0,s+1))}e=l(o(i),e)}return a(e)}})),kt=dt((t=>{var e=gt(),n=Object.prototype.hasOwnProperty,r=typeof Map<"u";function o(){this._array=[],this._set=r?new Map:Object.create(null)}o.fromArray=function(t,e){for(var n=new o,r=0,i=t.length;r=0)return o}else{var i=e.toSetString(t);if(n.call(this._set,i))return this._set[i]}throw new Error('"'+t+'" is not in the set.')},o.prototype.at=function(t){if(t>=0&&t{var e=gt();function n(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}n.prototype.unsortedForEach=function(t,e){this._array.forEach(t,e)},n.prototype.add=function(t){!function(t,n){var r=t.generatedLine,o=n.generatedLine,i=t.generatedColumn,s=n.generatedColumn;return o>r||o==r&&s>=i||e.compareByGeneratedPositionsInflated(t,n)<=0}(this._last,t)?(this._sorted=!1,this._array.push(t)):(this._last=t,this._array.push(t))},n.prototype.toArray=function(){return this._sorted||(this._array.sort(e.compareByGeneratedPositionsInflated),this._sorted=!0),this._array},t.MappingList=n})),vt=dt((t=>{var e=mt(),n=gt(),r=kt().ArraySet,o=yt().MappingList;function i(t){t||(t={}),this._file=n.getArg(t,"file",null),this._sourceRoot=n.getArg(t,"sourceRoot",null),this._skipValidation=n.getArg(t,"skipValidation",!1),this._sources=new r,this._names=new r,this._mappings=new o,this._sourcesContents=null}i.prototype._version=3,i.fromSourceMap=function(t){var e=t.sourceRoot,r=new i({file:t.file,sourceRoot:e});return t.eachMapping((function(t){var o={generated:{line:t.generatedLine,column:t.generatedColumn}};null!=t.source&&(o.source=t.source,null!=e&&(o.source=n.relative(e,o.source)),o.original={line:t.originalLine,column:t.originalColumn},null!=t.name&&(o.name=t.name)),r.addMapping(o)})),t.sources.forEach((function(o){var i=o;null!==e&&(i=n.relative(e,o)),r._sources.has(i)||r._sources.add(i);var s=t.sourceContentFor(o);null!=s&&r.setSourceContent(o,s)})),r},i.prototype.addMapping=function(t){var e=n.getArg(t,"generated"),r=n.getArg(t,"original",null),o=n.getArg(t,"source",null),i=n.getArg(t,"name",null);this._skipValidation||this._validateMapping(e,r,o,i),null!=o&&(o=String(o),this._sources.has(o)||this._sources.add(o)),null!=i&&(i=String(i),this._names.has(i)||this._names.add(i)),this._mappings.add({generatedLine:e.line,generatedColumn:e.column,originalLine:null!=r&&r.line,originalColumn:null!=r&&r.column,source:o,name:i})},i.prototype.setSourceContent=function(t,e){var r=t;null!=this._sourceRoot&&(r=n.relative(this._sourceRoot,r)),null!=e?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[n.toSetString(r)]=e):this._sourcesContents&&(delete this._sourcesContents[n.toSetString(r)],0===Object.keys(this._sourcesContents).length&&(this._sourcesContents=null))},i.prototype.applySourceMap=function(t,e,o){var i=e;if(null==e){if(null==t.file)throw new Error('SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map\'s "file" property. Both were omitted.');i=t.file}var s=this._sourceRoot;null!=s&&(i=n.relative(s,i));var a=new r,l=new r;this._mappings.unsortedForEach((function(e){if(e.source===i&&null!=e.originalLine){var r=t.originalPositionFor({line:e.originalLine,column:e.originalColumn});null!=r.source&&(e.source=r.source,null!=o&&(e.source=n.join(o,e.source)),null!=s&&(e.source=n.relative(s,e.source)),e.originalLine=r.line,e.originalColumn=r.column,null!=r.name&&(e.name=r.name))}var c=e.source;null!=c&&!a.has(c)&&a.add(c);var u=e.name;null!=u&&!l.has(u)&&l.add(u)}),this),this._sources=a,this._names=l,t.sources.forEach((function(e){var r=t.sourceContentFor(e);null!=r&&(null!=o&&(e=n.join(o,e)),null!=s&&(e=n.relative(s,e)),this.setSourceContent(e,r))}),this)},i.prototype._validateMapping=function(t,e,n,r){if(e&&"number"!=typeof e.line&&"number"!=typeof e.column)throw new Error("original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.");if(!(t&&"line"in t&&"column"in t&&t.line>0&&t.column>=0)||e||n||r){if(t&&"line"in t&&"column"in t&&e&&"line"in e&&"column"in e&&t.line>0&&t.column>=0&&e.line>0&&e.column>=0&&n)return;throw new Error("Invalid mapping: "+JSON.stringify({generated:t,source:n,original:e,name:r}))}},i.prototype._serializeMappings=function(){for(var t,r,o,i,s=0,a=1,l=0,c=0,u=0,h=0,d="",f=this._mappings.toArray(),p=0,m=f.length;p0){if(!n.compareByGeneratedPositionsInflated(r,f[p-1]))continue;t+=","}t+=e.encode(r.generatedColumn-s),s=r.generatedColumn,null!=r.source&&(i=this._sources.indexOf(r.source),t+=e.encode(i-h),h=i,t+=e.encode(r.originalLine-1-c),c=r.originalLine-1,t+=e.encode(r.originalColumn-l),l=r.originalColumn,null!=r.name&&(o=this._names.indexOf(r.name),t+=e.encode(o-u),u=o)),d+=t}return d},i.prototype._generateSourcesContent=function(t,e){return t.map((function(t){if(!this._sourcesContents)return null;null!=e&&(t=n.relative(e,t));var r=n.toSetString(t);return Object.prototype.hasOwnProperty.call(this._sourcesContents,r)?this._sourcesContents[r]:null}),this)},i.prototype.toJSON=function(){var t={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return null!=this._file&&(t.file=this._file),null!=this._sourceRoot&&(t.sourceRoot=this._sourceRoot),this._sourcesContents&&(t.sourcesContent=this._generateSourcesContent(t.sources,t.sourceRoot)),t},i.prototype.toString=function(){return JSON.stringify(this.toJSON())},t.SourceMapGenerator=i}));function St(t){return t>=48&&t<=57}function bt(t){return St(t)||t>=65&&t<=70||t>=97&&t<=102}function Ct(t){return t>=65&&t<=90}function wt(t){return function(t){return Ct(t)||function(t){return t>=97&&t<=122}(t)}(t)||function(t){return t>=128}(t)||95===t}function xt(t){return wt(t)||St(t)||45===t}function At(t){return t>=0&&t<=8||11===t||t>=14&&t<=31||127===t}function Lt(t){return 10===t||13===t||12===t}function Et(t){return Lt(t)||32===t||9===t}function Tt(t,e){return!(92!==t||Lt(e)||0===e)}function _t(t,e,n){return 45===t?wt(e)||45===e||Tt(e,n):!!wt(t)||92===t&&Tt(t,e)}function Ot(t,e,n){return 43===t||45===t?St(e)?2:46===e&&St(n)?3:0:46===t?St(e)?2:0:St(t)?1:0}function Pt(t){return 65279===t||65534===t?1:0}var It=new Array(128),Nt=130;for(let t=0;tt.length)return!1;for(let o=e;o=55296&&e<=57343||e>1114111)&&(e=65533),String.fromCodePoint(e)}var qt=["EOF-token","ident-token","function-token","at-keyword-token","hash-token","string-token","bad-string-token","url-token","bad-url-token","delim-token","number-token","percentage-token","dimension-token","whitespace-token","CDO-token","CDC-token","colon-token","semicolon-token","comma-token","[-token","]-token","(-token",")-token","{-token","}-token"];function Ht(t=null,e){return null===t||t.length0?Pt(e.charCodeAt(0)):0,o=Ht(t.lines,n),i=Ht(t.columns,n),s=t.startLine,a=t.startColumn;for(let t=r;t=t.length?void(c{if(e&&"object"==typeof e||"function"==typeof e)for(let n of ct(e))!ht.call(t,n)&&"default"!==n&&at(t,n,{get:()=>e[n],enumerable:!(r=lt(e,n))||r.enumerable});return t})((t=>at(t,"__esModule",{value:!0}))(at(null!=Zt?st(ut(Zt)):{},"default",{value:Zt,enumerable:!0})),Zt)),ee=new Set(["Atrule","Selector","Declaration"]),ne={};ft(ne,{safe:()=>le,spec:()=>ae});var re=(t,e)=>{if(9===t&&(t=e),"string"==typeof t){let e=t.charCodeAt(0);return e>127?32768:e<<8}return t},oe=[[1,1],[1,2],[1,7],[1,8],[1,"-"],[1,10],[1,11],[1,12],[1,15],[1,21],[3,1],[3,2],[3,7],[3,8],[3,"-"],[3,10],[3,11],[3,12],[3,15],[4,1],[4,2],[4,7],[4,8],[4,"-"],[4,10],[4,11],[4,12],[4,15],[12,1],[12,2],[12,7],[12,8],[12,"-"],[12,10],[12,11],[12,12],[12,15],["#",1],["#",2],["#",7],["#",8],["#","-"],["#",10],["#",11],["#",12],["#",15],["-",1],["-",2],["-",7],["-",8],["-","-"],["-",10],["-",11],["-",12],["-",15],[10,1],[10,2],[10,7],[10,8],[10,10],[10,11],[10,12],[10,"%"],[10,15],["@",1],["@",2],["@",7],["@",8],["@","-"],["@",15],[".",10],[".",11],[".",12],["+",10],["+",11],["+",12],["/","*"]],ie=oe.concat([[1,4],[12,4],[4,4],[3,21],[3,5],[3,16],[11,11],[11,12],[11,2],[11,"-"],[22,1],[22,2],[22,11],[22,12],[22,4],[22,"-"]]);function se(t){let e=new Set(t.map((([t,e])=>re(t)<<16|re(e))));return function(t,n,r){let o=re(n,r),i=r.charCodeAt(0);return(45===i&&1!==n&&2!==n&&15!==n||43===i?e.has(t<<16|i<<8):e.has(t<<16|o))&&this.emit(" ",13,!0),o}}var ae=se(oe),le=se(ie);function ce(t,e){if("function"!=typeof e)t.children.forEach(this.node,this);else{let n=null;t.children.forEach((t=>{null!==n&&e.call(this,n),this.node(t),n=t}))}}function ue(t){Xt(t,((e,n,r)=>{this.token(e,t.slice(n,r))}))}var he={};ft(he,{AnPlusB:()=>be,Atrule:()=>Ce,AtrulePrelude:()=>we,AttributeSelector:()=>Ee,Block:()=>Te,Brackets:()=>_e,CDC:()=>Oe,CDO:()=>Pe,ClassSelector:()=>Ne,Combinator:()=>je,Comment:()=>De,Declaration:()=>Re,DeclarationList:()=>Be,Dimension:()=>Ue,Function:()=>$e,Hash:()=>ze,IdSelector:()=>Ge,Identifier:()=>Fe,MediaFeature:()=>qe,MediaQuery:()=>He,MediaQueryList:()=>Je,Nth:()=>Ye,Number:()=>Ke,Operator:()=>Xe,Parentheses:()=>Ze,Percentage:()=>en,PseudoClassSelector:()=>rn,PseudoElementSelector:()=>sn,Ratio:()=>an,Raw:()=>un,Rule:()=>hn,Selector:()=>fn,SelectorList:()=>mn,String:()=>yn,StyleSheet:()=>vn,TypeSelector:()=>Cn,UnicodeRange:()=>wn,Url:()=>xn,Value:()=>An,WhiteSpace:()=>Ln});var de=43,fe=45,pe=110,me=!0;function ge(t,e){let n=this.tokenStart+t,r=this.charCodeAt(n);for((r===de||r===fe)&&(e&&this.error("Number sign is not allowed"),n++);n0&&this.skip(t),0===e&&(n=this.charCodeAt(this.tokenStart),n!==de&&n!==fe&&this.error("Number sign is expected")),ke.call(this,0!==e),e===fe?"-"+this.consume(10):this.consume(10)}function Se(){let t=this.tokenStart,e=null,n=null;if(10===this.tokenType)ke.call(this,!1),n=this.consume(10);else if(1===this.tokenType&&this.cmpChar(this.tokenStart,fe))switch(e="-1",ye.call(this,1,pe),this.tokenEnd-this.tokenStart){case 2:this.next(),n=ve.call(this);break;case 3:ye.call(this,2,fe),this.next(),this.skipSC(),ke.call(this,me),n="-"+this.consume(10);break;default:ye.call(this,2,fe),ge.call(this,3,me),this.next(),n=this.substrToCursor(t+2)}else if(1===this.tokenType||this.isDelim(de)&&1===this.lookupType(1)){let r=0;switch(e="1",this.isDelim(de)&&(r=1,this.next()),ye.call(this,0,pe),this.tokenEnd-this.tokenStart){case 1:this.next(),n=ve.call(this);break;case 2:ye.call(this,1,fe),this.next(),this.skipSC(),ke.call(this,me),n="-"+this.consume(10);break;default:ye.call(this,1,fe),ge.call(this,2,me),this.next(),n=this.substrToCursor(t+r+1)}}else if(12===this.tokenType){let r=this.charCodeAt(this.tokenStart),o=r===de||r===fe,i=this.tokenStart+o;for(;i{"Declaration"===t.type&&this.token(17,";")})),this.token(24,"}")}function _e(t){this.token(9,"["),this.children(t),this.token(9,"]")}function Oe(){this.token(15,"--\x3e")}function Pe(){this.token(14,"\x3c!--")}function Ie(){return this.eatDelim(46),{type:"ClassSelector",loc:this.getLocation(this.tokenStart-1,this.tokenEnd),name:this.consume(1)}}function Ne(t){this.token(9,"."),this.token(1,t.name)}function Me(){let t,e=this.tokenStart;switch(this.tokenType){case 13:t=" ";break;case 9:switch(this.charCodeAt(this.tokenStart)){case 62:case 43:case 126:this.next();break;case 47:this.next(),this.eatIdent("deep"),this.eatDelim(47);break;default:this.error("Combinator is expected")}t=this.substrToCursor(e)}return{type:"Combinator",loc:this.getLocation(e,this.tokenStart),name:t}}function je(t){this.tokenize(t.name)}function De(t){this.token(25,"/*"+t.value+"*/")}function Re(t){this.token(1,t.property),this.token(16,":"),this.node(t.value),t.important&&(this.token(9,"!"),this.token(1,!0===t.important?"important":t.important))}function Be(t){this.children(t,(t=>{"Declaration"===t.type&&this.token(17,";")}))}function Ue(t){this.token(12,t.value+t.unit)}function $e(t){this.token(2,t.name+"("),this.children(t),this.token(22,")")}function ze(t){this.token(4,"#"+t.value)}function Ve(){return{type:"Identifier",loc:this.getLocation(this.tokenStart,this.tokenEnd),name:this.consume(1)}}function Fe(t){this.token(1,t.name)}function We(){let t=this.tokenStart;return this.eat(4),{type:"IdSelector",loc:this.getLocation(t,this.tokenStart),name:this.substrToCursor(t+1)}}function Ge(t){this.token(9,"#"+t.name)}function qe(t){this.token(21,"("),this.token(1,t.name),null!==t.value&&(this.token(16,":"),this.node(t.value)),this.token(22,")")}function He(t){this.children(t)}function Je(t){this.children(t,(()=>this.token(18,",")))}function Qe(){this.skipSC();let t,e=this.tokenStart,n=e,r=null;return t=this.lookupValue(0,"odd")||this.lookupValue(0,"even")?this.Identifier():this.AnPlusB(),n=this.tokenStart,this.skipSC(),this.lookupValue(0,"of")&&(this.next(),r=this.SelectorList(),n=this.tokenStart),{type:"Nth",loc:this.getLocation(e,n),nth:t,selector:r}}function Ye(t){this.node(t.nth),null!==t.selector&&(this.token(1,"of"),this.node(t.selector))}function Ke(t){this.token(10,t.value)}function Xe(t){this.tokenize(t.value)}function Ze(t){this.token(21,"("),this.children(t),this.token(22,")")}function tn(){return{type:"Percentage",loc:this.getLocation(this.tokenStart,this.tokenEnd),value:this.consumeNumber(11)}}function en(t){this.token(11,t.value+"%")}function nn(){let t,e,n=this.tokenStart,r=null;return this.eat(16),2===this.tokenType?(t=this.consumeFunctionName(),e=t.toLowerCase(),hasOwnProperty.call(this.pseudo,e)?(this.skipSC(),r=this.pseudo[e].call(this),this.skipSC()):(r=this.createList(),r.push(this.Raw(this.tokenIndex,null,!1))),this.eat(22)):t=this.consume(1),{type:"PseudoClassSelector",loc:this.getLocation(n,this.tokenStart),name:t,children:r}}function rn(t){this.token(16,":"),null===t.children?this.token(1,t.name):(this.token(2,t.name+"("),this.children(t),this.token(22,")"))}function on(){let t,e,n=this.tokenStart,r=null;return this.eat(16),this.eat(16),2===this.tokenType?(t=this.consumeFunctionName(),e=t.toLowerCase(),hasOwnProperty.call(this.pseudo,e)?(this.skipSC(),r=this.pseudo[e].call(this),this.skipSC()):(r=this.createList(),r.push(this.Raw(this.tokenIndex,null,!1))),this.eat(22)):t=this.consume(1),{type:"PseudoElementSelector",loc:this.getLocation(n,this.tokenStart),name:t,children:r}}function sn(t){this.token(16,":"),this.token(16,":"),null===t.children?this.token(1,t.name):(this.token(2,t.name+"("),this.children(t),this.token(22,")"))}function an(t){this.token(10,t.left),this.token(9,"/"),this.token(10,t.right)}function ln(){return this.tokenIndex>0&&13===this.lookupType(-1)?this.tokenIndex>1?this.getTokenStart(this.tokenIndex-1):this.firstCharOffset:this.tokenStart}function cn(t,e,n){let r,o=this.getTokenStart(t);return this.skipUntilBalanced(t,e||this.consumeUntilBalanceEnd),r=n&&this.tokenStart>o?ln.call(this):this.tokenStart,{type:"Raw",loc:this.getLocation(o,r),value:this.substring(o,r)}}function un(t){this.tokenize(t.value)}function hn(t){this.node(t.prelude),this.node(t.block)}function dn(){let t=this.readSequence(this.scope.Selector);return null===this.getFirstListNode(t)&&this.error("Selector is expected"),{type:"Selector",loc:this.getLocationFromList(t),children:t}}function fn(t){this.children(t)}function pn(){let t=this.createList();for(;!this.eof&&(t.push(this.Selector()),18===this.tokenType);)this.next();return{type:"SelectorList",loc:this.getLocationFromList(t),children:t}}function mn(t){this.children(t,(()=>this.token(18,",")))}function gn(t){let e=t.length,n=t.charCodeAt(0),r=34===n||39===n?1:0,o=1===r&&e>1&&t.charCodeAt(e-1)===n?e-2:e-1,i="";for(let n=r;n<=o;n++){let r=t.charCodeAt(n);if(92===r){if(n===o){n!==e-1&&(i=t.substr(n+1));break}if(r=t.charCodeAt(++n),Tt(92,r)){let e=n-1,r=zt(t,e);n=r-1,i+=Gt(t.substring(e+1,r))}else 13===r&&10===t.charCodeAt(n+1)&&n++}else i+=t[n]}return i}function kn(){return{type:"String",loc:this.getLocation(this.tokenStart,this.tokenEnd),value:gn(this.consume(5))}}function yn(t){this.token(5,function(t,e){let n="",r=!1;for(let e=0;er};n&&("function"==typeof n.decorator&&(i=n.decorator(i)),n.sourceMap&&(i=function(t){let e=new te.SourceMapGenerator,n={line:1,column:0},r={line:0,column:0},o={line:1,column:0},i={generated:o},s=1,a=0,l=!1,c=t.node;t.node=function(t){if(t.loc&&t.loc.start&&ee.has(t.type)){let c=t.loc.start.line,u=t.loc.start.column-1;(r.line!==c||r.column!==u)&&(r.line=c,r.column=u,n.line=s,n.column=a,l&&(l=!1,(n.line!==o.line||n.column!==o.column)&&e.addMapping(i)),l=!0,e.addMapping({source:t.loc.source,original:r,generated:n}))}c.call(this,t),l&&ee.has(t.type)&&(o.line=s,o.column=a)};let u=t.emit;t.emit=function(t,e,n){for(let e=0;ei.node(t),children:ce,token:(t,e)=>i.token(t,e),tokenize:ue};return i.node(t),i.result()}}({node:he}),Tn=null,_n=class{static createItem(t){return{prev:null,next:null,data:t}}constructor(){this.head=null,this.tail=null,this.cursor=null}createItem(t){return _n.createItem(t)}allocateCursor(t,e){let n;return null!==Tn?(n=Tn,Tn=Tn.cursor,n.prev=t,n.next=e,n.cursor=this.cursor):n={prev:t,next:e,cursor:this.cursor},this.cursor=n,n}releaseCursor(){let{cursor:t}=this;this.cursor=t.cursor,t.prev=null,t.next=null,t.cursor=Tn,Tn=t}updateCursors(t,e,n,r){let{cursor:o}=this;for(;null!==o;)o.prev===t&&(o.prev=e),o.next===n&&(o.next=r),o=o.cursor}*[Symbol.iterator](){for(let t=this.head;null!==t;t=t.next)yield t.data}get size(){let t=0;for(let e=this.head;null!==e;e=e.next)t++;return t}get isEmpty(){return null===this.head}get first(){return this.head&&this.head.data}get last(){return this.tail&&this.tail.data}fromArray(t){let e=null;this.head=null;for(let n of t){let t=_n.createItem(n);null!==e?e.next=t:this.head=t,t.prev=e,e=t}return this.tail=e,this}toArray(){return[...this]}toJSON(){return[...this]}forEach(t,e=this){let n=this.allocateCursor(null,this.head);for(;null!==n.next;){let r=n.next;n.next=r.next,t.call(e,r.data,r,this)}this.releaseCursor()}forEachRight(t,e=this){let n=this.allocateCursor(this.tail,null);for(;null!==n.prev;){let r=n.prev;n.prev=r.prev,t.call(e,r.data,r,this)}this.releaseCursor()}reduce(t,e,n=this){let r,o=this.allocateCursor(null,this.head),i=e;for(;null!==o.next;)r=o.next,o.next=r.next,i=t.call(n,i,r.data,r,this);return this.releaseCursor(),i}reduceRight(t,e,n=this){let r,o=this.allocateCursor(this.tail,null),i=e;for(;null!==o.prev;)r=o.prev,o.prev=r.prev,i=t.call(n,i,r.data,r,this);return this.releaseCursor(),i}some(t,e=this){for(let n=this.head;null!==n;n=n.next)if(t.call(e,n.data,n,this))return!0;return!1}map(t,e=this){let n=new _n;for(let r=this.head;null!==r;r=r.next)n.appendData(t.call(e,r.data,r,this));return n}filter(t,e=this){let n=new _n;for(let r=this.head;null!==r;r=r.next)t.call(e,r.data,r,this)&&n.appendData(r.data);return n}nextUntil(t,e,n=this){if(null===t)return;let r=this.allocateCursor(null,t);for(;null!==r.next;){let t=r.next;if(r.next=t.next,e.call(n,t.data,t,this))break}this.releaseCursor()}prevUntil(t,e,n=this){if(null===t)return;let r=this.allocateCursor(t,null);for(;null!==r.prev;){let t=r.prev;if(r.prev=t.prev,e.call(n,t.data,t,this))break}this.releaseCursor()}clear(){this.head=null,this.tail=null}copy(){let t=new _n;for(let e of this)t.appendData(e);return t}prepend(t){return this.updateCursors(null,t,this.head,t),null!==this.head?(this.head.prev=t,t.next=this.head):this.tail=t,this.head=t,this}prependData(t){return this.prepend(_n.createItem(t))}append(t){return this.insert(t)}appendData(t){return this.insert(_n.createItem(t))}insert(t,e=null){if(null!==e)if(this.updateCursors(e.prev,t,e,t),null===e.prev){if(this.head!==e)throw new Error("before doesn't belong to list");this.head=t,e.prev=t,t.next=e,this.updateCursors(null,t)}else e.prev.next=t,t.prev=e.prev,e.prev=t,t.next=e;else this.updateCursors(this.tail,t,null,t),null!==this.tail?(this.tail.next=t,t.prev=this.tail):this.head=t,this.tail=t;return this}insertData(t,e){return this.insert(_n.createItem(t),e)}remove(t){if(this.updateCursors(t,t.prev,t,t.next),null!==t.prev)t.prev.next=t.next;else{if(this.head!==t)throw new Error("item doesn't belong to list");this.head=t.next}if(null!==t.next)t.next.prev=t.prev;else{if(this.tail!==t)throw new Error("item doesn't belong to list");this.tail=t.prev}return t.prev=null,t.next=null,t}push(t){this.insert(_n.createItem(t))}pop(){return null!==this.tail?this.remove(this.tail):null}unshift(t){this.prepend(_n.createItem(t))}shift(){return null!==this.head?this.remove(this.head):null}prependList(t){return this.insertList(t,this.head)}appendList(t){return this.insertList(t)}insertList(t,e){return null===t.head||(null!=e?(this.updateCursors(e.prev,t.tail,e,t.head),null!==e.prev?(e.prev.next=t.head,t.head.prev=e.prev):this.head=t.head,e.prev=t.tail,t.tail.next=e):(this.updateCursors(this.tail,t.tail,null,t.head),null!==this.tail?(this.tail.next=t.head,t.head.prev=this.tail):this.head=t.head,this.tail=t.tail),t.head=null,t.tail=null),this}replace(t,e){"head"in e?this.insertList(e,t):this.insert(e,t),this.remove(t)}},On=" ";function Pn({source:t,line:e,column:n},r){function o(t,e){return i.slice(t,e).map(((e,n)=>String(t+n+1).padStart(l)+" |"+e)).join("\n")}let i=t.split(/\r\n?|\n|\f/),s=Math.max(1,e-r)-1,a=Math.min(e+r,i.length+1),l=Math.max(4,String(a).length)+1,c=0;(n+=(On.length-1)*(i[e-1].substr(0,n-1).match(/\t/g)||[]).length)>100&&(c=n-60+3,n=58);for(let t=s;t<=a;t++)t>=0&&t0&&i[t].length>c?"\u2026":"")+i[t].substr(c,98)+(i[t].length>c+100-1?"\u2026":""));return[o(s,e),new Array(n+l+2).join("-")+"^",o(e,a)].filter(Boolean).join("\n")}function In(t,e,n,r,o){return Object.assign(function(t,e){let n=Object.create(SyntaxError.prototype),r=new Error;return Object.assign(n,{name:t,message:e,get stack(){return(r.stack||"").replace(/^(.+\n){1,3}/,`${t}: ${e}\n`)}})}("SyntaxError",t),{source:e,offset:n,line:r,column:o,sourceFragment:t=>Pn({source:e,line:r,column:o},isNaN(t)?0:t),get formattedMessage(){return`Parse error: ${t}\n`+Pn({source:e,line:r,column:o},2)}})}function Nn(t){let e=this.createList(),n=!1,r={recognizer:t};for(;!this.eof;){switch(this.tokenType){case 25:this.next();continue;case 13:n=!0,this.next();continue}let o=t.getNode.call(this,r);if(void 0===o)break;n&&(t.onWhiteSpace&&t.onWhiteSpace.call(this,o,e,r),n=!1),e.push(o)}return n&&t.onWhiteSpace&&t.onWhiteSpace.call(this,null,e,r),e}var Mn=()=>{};function jn(t){return function(){return this[t]()}}function Dn(t){let e=Object.create(null);for(let n in t){let r=t[n],o=r.parse||r;o&&(e[n]=o)}return e}var Rn={parse(){return this.createSingleNodeList(this.SelectorList())}},Bn={parse(){return this.createSingleNodeList(this.Identifier())}},Un={parse(){return this.createSingleNodeList(this.Nth())}},$n={dir:Bn,has:Rn,lang:Bn,matches:Rn,is:Rn,"-moz-any":Rn,"-webkit-any":Rn,where:Rn,not:Rn,"nth-child":Un,"nth-last-child":Un,"nth-last-of-type":Un,"nth-of-type":Un,slotted:{parse(){return this.createSingleNodeList(this.Selector())}}},zn={};ft(zn,{AnPlusB:()=>Se,AttributeSelector:()=>Le,ClassSelector:()=>Ie,Combinator:()=>Me,IdSelector:()=>We,Identifier:()=>Ve,Nth:()=>Qe,Percentage:()=>tn,PseudoClassSelector:()=>nn,PseudoElementSelector:()=>on,Raw:()=>cn,Selector:()=>dn,SelectorList:()=>pn,String:()=>kn,TypeSelector:()=>bn});var Vn=function(t){let e="",n="",r=!1,o=Mn,i=!1,s=new class{constructor(){this.lines=null,this.columns=null,this.computed=!1}setSource(t,e=0,n=1,r=1){this.source=t,this.startOffset=e,this.startLine=n,this.startColumn=r,this.computed=!1}getLocation(t,e){return this.computed||Jt(this),{source:e,offset:this.startOffset+t,line:this.lines[t],column:this.columns[t]}}getLocationRange(t,e,n){return this.computed||Jt(this),{source:n,start:{offset:this.startOffset+t,line:this.lines[t],column:this.columns[t]},end:{offset:this.startOffset+e,line:this.lines[e],column:this.columns[e]}}}},a=Object.assign(new class{constructor(t,e){this.setSource(t,e)}reset(){this.eof=!1,this.tokenIndex=-1,this.tokenType=0,this.tokenStart=this.firstCharOffset,this.tokenEnd=this.firstCharOffset}setSource(t="",e=(()=>{})){let n=(t=String(t||"")).length,r=Ht(this.offsetAndType,t.length+1),o=Ht(this.balance,t.length+1),i=0,s=0,a=0,l=-1;for(this.offsetAndType=null,this.balance=null,e(t,((t,e,c)=>{switch(t){default:o[i]=n;break;case s:{let t=a&Qt;for(a=o[t],s=a>>Yt,o[i]=t,o[t++]=i;t>Yt:0}lookupOffset(t){return(t+=this.tokenIndex)0?t>Yt,this.tokenEnd=e&Qt):(this.tokenIndex=this.tokenCount,this.next())}next(){let t=this.tokenIndex+1;t>Yt,this.tokenEnd=t&Qt):(this.eof=!0,this.tokenIndex=this.tokenCount,this.tokenType=0,this.tokenStart=this.tokenEnd=this.source.length)}skipSC(){for(;13===this.tokenType||25===this.tokenType;)this.next()}skipUntilBalanced(t,e){let n,r,o=t;t:for(;o0?this.offsetAndType[o-1]&Qt:this.firstCharOffset,e(this.source.charCodeAt(r))){case 1:break t;case 2:o++;break t;default:this.balance[n]===o&&(o=n)}this.skip(o-this.tokenIndex)}forEachToken(t){for(let e=0,n=this.firstCharOffset;e>Yt,r,i,e)}}dump(){let t=new Array(this.tokenCount);return this.forEachToken(((e,n,r,o)=>{t[o]={idx:o,type:qt[e],chunk:this.source.substring(n,r),balance:this.balance[o]}})),t}},function(t){let e={context:Object.create(null),scope:Object.assign(Object.create(null),t.scope),atrule:Dn(t.atrule),pseudo:Dn(t.pseudo),node:Dn(t.node)};for(let n in t.parseContext)switch(typeof t.parseContext[n]){case"function":e.context[n]=t.parseContext[n];break;case"string":e.context[n]=jn(t.parseContext[n])}return{config:e,...e,...e.node}}(t||{}),{parseAtrulePrelude:!0,parseRulePrelude:!0,parseValue:!0,parseCustomProperty:!1,readSequence:Nn,consumeUntilBalanceEnd:()=>0,consumeUntilLeftCurlyBracket:t=>123===t?1:0,consumeUntilLeftCurlyBracketOrSemicolon:t=>123===t||59===t?1:0,consumeUntilExclamationMarkOrSemicolon:t=>33===t||59===t?1:0,consumeUntilSemicolonIncluded:t=>59===t?2:0,createList:()=>new _n,createSingleNodeList:t=>(new _n).appendData(t),getFirstListNode:t=>t&&t.first,getLastListNode:t=>t&&t.last,parseWithFallback(t,e){let n=this.tokenIndex;try{return t.call(this)}catch(t){if(i)throw t;let r=e.call(this,n);return i=!0,o(t,r),i=!1,r}},lookupNonWSType(t){let e;do{if(e=this.lookupType(t++),13!==e)return e}while(0!==e);return 0},charCodeAt:t=>t>=0&&te.substring(t,n),substrToCursor(t){return this.source.substring(t,this.tokenStart)},cmpChar:(t,n)=>Rt(e,t,n),cmpStr:(t,n,r)=>Bt(e,t,n,r),consume(t){let e=this.tokenStart;return this.eat(t),this.substrToCursor(e)},consumeFunctionName(){let t=e.substring(this.tokenStart,this.tokenEnd-1);return this.eat(2),t},consumeNumber(t){let n=e.substring(this.tokenStart,Ft(e,this.tokenStart));return this.eat(t),n},eat(t){if(this.tokenType!==t){let e=qt[t].slice(0,-6).replace(/-/g," ").replace(/^./,(t=>t.toUpperCase())),n=`${/[[\](){}]/.test(e)?`"${e}"`:e} is expected`,r=this.tokenStart;switch(t){case 1:2===this.tokenType||7===this.tokenType?(r=this.tokenEnd-1,n="Identifier is expected but function found"):n="Identifier is expected";break;case 4:this.isDelim(35)&&(this.next(),r++,n="Name is expected");break;case 11:10===this.tokenType&&(r=this.tokenEnd,n="Percent sign is expected")}this.error(n,r)}this.next()},eatIdent(t){(1!==this.tokenType||!1===this.lookupValue(0,t))&&this.error(`Identifier "${t}" is expected`),this.next()},eatDelim(t){this.isDelim(t)||this.error(`Delim "${String.fromCharCode(t)}" is expected`),this.next()},getLocation:(t,e)=>r?s.getLocationRange(t,e,n):null,getLocationFromList(t){if(r){let e=this.getFirstListNode(t),r=this.getLastListNode(t);return s.getLocationRange(null!==e?e.loc.start.offset-s.startOffset:this.tokenStart,null!==r?r.loc.end.offset-s.startOffset:this.tokenStart,n)}return null},error(t,n){let r=typeof n<"u"&&n=0&&Et(t.charCodeAt(e));e--);return e+1}(e,e.length-1)):s.getLocation(this.tokenStart);throw new In(t||"Unexpected input",e,r.offset,r.line,r.column)}});return Object.assign((function(t,l){e=t,l=l||{},a.setSource(e,Xt),s.setSource(e,l.offset,l.line,l.column),n=l.filename||"",r=Boolean(l.positions),o="function"==typeof l.onParseError?l.onParseError:Mn,i=!1,a.parseAtrulePrelude=!("parseAtrulePrelude"in l)||Boolean(l.parseAtrulePrelude),a.parseRulePrelude=!("parseRulePrelude"in l)||Boolean(l.parseRulePrelude),a.parseValue=!("parseValue"in l)||Boolean(l.parseValue),a.parseCustomProperty="parseCustomProperty"in l&&Boolean(l.parseCustomProperty);let{context:c="default",onComment:u}=l;if(!(c in a.context))throw new Error("Unknown context `"+c+"`");"function"==typeof u&&a.forEachToken(((t,n,r)=>{if(25===t){let t=a.getLocation(n,r),o=Bt(e,r-2,r,"*/")?e.slice(n+2,r-2):e.slice(n+2,r);u(o,t)}}));let h=a.context[c].call(a,l);return a.eof||a.error(),h}),{SyntaxError:In,config:a.config})}({parseContext:{default:"SelectorList",selectorList:"SelectorList",selector:"Selector"},scope:{Selector:{onWhiteSpace:function(t,e){null!==e.last&&"Combinator"!==e.last.type&&null!==t&&"Combinator"!==t.type&&e.push({type:"Combinator",loc:null,name:" "})},getNode:function(){switch(this.tokenType){case 19:return this.AttributeSelector();case 4:return this.IdSelector();case 16:return 16===this.lookupType(1)?this.PseudoElementSelector():this.PseudoClassSelector();case 1:return this.TypeSelector();case 10:case 11:return this.Percentage();case 12:46===this.charCodeAt(this.tokenStart)&&this.error("Identifier is expected",this.tokenStart+1);break;case 9:switch(this.charCodeAt(this.tokenStart)){case 43:case 62:case 126:case 47:return this.Combinator();case 46:return this.ClassSelector();case 42:case 124:return this.TypeSelector();case 35:return this.IdSelector()}}}}},atrule:{},pseudo:$n,node:zn}),Fn=(t,e)=>t.a===e.a?t.b===e.b?t.c-e.c:t.b-e.b:t.a-e.a,Wn=(t,e)=>0===Fn(t,e),Gn=(t,e)=>Fn(t,e)>0,qn=(t,e)=>Fn(t,e)<0,Hn=(t,e="ASC")=>{let n=t.sort(Fn);return"DESC"===e?n.reverse():n},Jn=(...t)=>Hn(t,"ASC"),Qn=(...t)=>Hn(t,"DESC"),Yn=(...t)=>Qn(...t)[0],Kn=t=>{let e={a:0,b:0,c:0};return t.children.forEach((t=>{switch(t.type){case"IdSelector":e.a+=1;break;case"AttributeSelector":case"ClassSelector":e.b+=1;break;case"PseudoClassSelector":switch(t.name){case"where":break;case"is":case"matches":case"-webkit-any":case"-moz-any":case"any":case"not":case"has":let n=Yn(...Xn(t.children.first));e.a+=n.a,e.b+=n.b,e.c+=n.c;break;case"nth-child":case"nth-last-child":if(e.b+=1,t.children.first.selector){let n=Yn(...Xn(t.children.first.selector));e.a+=n.a,e.b+=n.b,e.c+=n.c}break;case"after":case"before":case"first-letter":case"first-line":e.c+=1;break;default:e.b+=1}break;case"PseudoElementSelector":e.c+=1;break;case"TypeSelector":let n=t.name;n.includes("|")&&(n=n.split("|")[1]),"*"!==n&&(e.c+=1)}})),new Zn(e,t)},Xn=t=>{if(!t)return[];let e=(t=>{if("string"==typeof t||t instanceof String)try{return Vn(t,{context:"selectorList"})}catch(t){throw new TypeError(`Could not convert passed in source to SelectorList: ${t.message}`)}if(t instanceof Object){if(t.type&&["Selector","SelectorList"].includes(t.type))return t;if(t.type&&"Raw"===t.type)try{return Vn(t.value,{context:"selectorList"})}catch(t){throw new TypeError(`Could not convert passed in source to SelectorList: ${t.message}`)}throw new TypeError("Passed in source is an Object but no AST / AST of the type Selector or SelectorList")}throw new TypeError("Passed in source is not a String nor an Object. I don't know what to do with it.")})(t);if("Selector"===e.type)return[Kn(t)];if("SelectorList"===e.type){let t=[];return e.children.forEach((e=>{let n=Kn(e);t.push(n)})),t}},Zn=class{constructor(t,e=null){this.value=t,this.selector=e}get a(){return this.value.a}set a(t){throw new Error("Manipulating the port of the specificity directly is not allowed. Instead, directly set a new value")}get b(){return this.value.b}set b(t){throw new Error("Manipulating the port of the specificity directly is not allowed. Instead, directly set a new value")}get c(){return this.value.c}set c(t){throw new Error("Manipulating the port of the specificity directly is not allowed. Instead, directly set a new value")}selectorString(){return"string"==typeof this.selector||this.selector instanceof String?this.selector:this.selector instanceof Object&&"Selector"===this.selector.type?En(this.selector):""}toObject(){return this.value}toArray(){return[this.value.a,this.value.b,this.value.c]}toString(){return`(${this.value.a},${this.value.b},${this.value.c})`}toJSON(){return{selector:this.selectorString(),asObject:this.toObject(),asArray:this.toArray(),asString:this.toString()}}isEqualTo(t){return Wn(this,t)}isGreaterThan(t){return Gn(this,t)}isLessThan(t){return qn(this,t)}static calculate(t){return Xn(t)}static compare(t,e){return Fn(t,e)}static equals(t,e){return Wn(t,e)}static lessThan(t,e){return qn(t,e)}static greaterThan(t,e){return Gn(t,e)}static min(...t){return((...t)=>Jn(...t)[0])(...t)}static max(...t){return Yn(...t)}static sortAsc(...t){return Jn(...t)}static sortDesc(...t){return Qn(...t)}};const tr=t=>_(t,(t=>"fulfilled"===t.status?t.value:[t])),er=t=>{const e=new Map,n=t=>{const n=e.get(t);if(f(n))return n;{const n=Zn.calculate(t)[0];return e.set(t,n),n}};return((t,e)=>{const r=C.call(t,0);return r.sort(((t,e)=>{const r=n(t.selector),o=n(e.selector);return Zn.compare(r,o)})),r})(t)},nr=t=>{const e=(t=>_(t,(t=>(t=>-1!==t.selector.indexOf(","))(t)?(t=>{const e=t.selector.split(/,(?![^(]*\))/g);return L(e,(e=>{const n=e.trim();return{...t,selector:n}}))})(t):[t])))(t);return er(e)},rr=t=>{const e={};return E(t,(n=>{const r=t.getPropertyValue(n);a(r)&&(e[n]=r)})),e},or=t=>({selector:t.selectorText,styles:rr(t.style)}),ir=(t,e)=>e(t).then((async t=>{const n=_(t,(t=>{if(t.type===window.CSSRule.IMPORT_RULE)return[ir(t.styleSheet,e)];if(t.type===window.CSSRule.STYLE_RULE){const e={status:"fulfilled",value:[or(t)]};return[Promise.resolve([e])]}return[]})),r=await Promise.allSettled(n);return tr(r)}),(t=>Promise.resolve([{status:"rejected",reason:t}]))),sr=(t,e)=>{var n,r;return((t,e)=>{const n={};var r;return((t,e,n,r)=>{et(t,((t,o)=>{(e(t,o)?n:r)(t,o)}))})(t,e,(r=n,(t,e)=>{r[e]=t}),g),n})((n=(t,e)=>({...t,...e.styles}),r={},E(e,((t,e)=>{r=n(r,t)})),r),((e,n)=>!A(t.dom.style,n)))},ar=(t,e)=>{const n=((t,e)=>I("style",W(t).dom))(t);nt(n,"media","max-width: 1px"),J(n,e);const r=(t=>(t=>V(t)&&f(t.dom.host))(t)?t:(t=>{const e=t.dom.head;if(null==e)throw new Error("Head is not available yet");return N(e)})(W(t)))(t);q(r,n);const o=b.from(n.dom.sheet).fold((()=>[]),(t=>O(t.cssRules)));return H(n),o};const lr=t=>_(t,(t=>"fulfilled"===t.status?t.value:[])),cr=nr,ur=t=>a(t)?{valid:!0,value:e=>-1!==e.indexOf(t)}:t instanceof RegExp?{valid:!0,value:e=>t.test(e)}:p(t)?{valid:!0,value:t}:{valid:!1,message:"Must be a string, regular expression, or a function"},hr=t=>e=>e.options.get(t),dr=hr("body_class"),fr=hr("body_id"),pr=hr("inlinecss_file_filter"),mr=hr("skin"),gr=hr("inlinecss_selector_filter"),kr=new Set(["margin","margin-left","margin-right","margin-top","margin-bottom","padding","padding-left","padding-right","padding-top","padding-bottom","border","border-width","border-style","border-color","background","background-attachment","background-clip","background-color","background-image","background-origin","background-position","background-repeat","background-size","float","position","left","right","top","bottom","z-index","display","transform","width","max-width","min-width","height","max-height","min-height","overflow","overflow-x","overflow-y","text-overflow","vertical-align","transition","transition-delay","transition-duration","transition-property","transition-timing-function","outline","outline-color","outline-style","outline-width"]),yr=t=>{const e=K(t),n=((t,e,n)=>T(((t,e)=>{const n=p(e)?e:v;let r=t.dom;const o=[];for(;null!==r.parentNode&&void 0!==r.parentNode;){const t=r.parentNode,e=N(t);if(o.push(e),!0===n(e))break;r=t}return o})(t,n),e))(t,(t=>M(t,"*")),(t=>{return n=e,t.dom===n.dom;var n}));return[t].concat(n)},vr=(t,e)=>{const n=(t=>{const e=C.call(t,0);return e.reverse(),e})(yr(t)),r={},o=cr(e);return E(n,(t=>{const e=T(o,(e=>M(t,e.selector))),n=((t,e)=>{const n={},r=L(e,(t=>t.styles)),o=(t=>{const e={},n=t.dom;if(rt(n))for(let t=0;t{et(t,((t,e)=>{var r;"background-color"!==e&&(r=e,kr.has(r))||(n[e]=t)}))})),n})(t,e);et(n,((t,e)=>{r[e]=t}))})),r},Sr=(t,e)=>{const n=G(t);E(n,(t=>{var n;$(n=t)&&B(n.dom)&&et(e,((e,n)=>{((t,e)=>{const n=((t,e)=>rt(t)?t.style.getPropertyValue(e):"")(t.dom,e);return b.from(n).filter((t=>t.length>0))})(t,n).isNone()&&((t,e,n)=>{const r=t.dom;ot(r,e,n)})(t,n,e)}))}))},br=(t,e)=>{(t=>void 0!==t.dom.classList)(t)?t.dom.classList.add(e):((t,e)=>{((t,e,n)=>{const r=((t,e)=>{const n=((t,e)=>{const n=t.dom.getAttribute("class");return null===n?void 0:n})(t);return void 0===n||""===n?[]:n.split(" ")})(t),o=r.concat([n]);nt(t,e,o.join(" "))})(t,"class",e)})(t,e)},Cr=t=>{const e=N((t=>{if(Y()&&f(t.target)){const e=N(t.target);if($(e)&&f(e.dom.shadowRoot)&&t.composed&&t.composedPath){const e=t.composedPath();if(e)return((t,e)=>0t.stopPropagation(),r=()=>t.preventDefault(),o=(i=r,s=n,(...t)=>i(s.apply(null,t)));var i,s;return((t,e,n,r,o,i,s)=>({target:t,x:e,y:n,stop:r,prevent:o,kill:i,raw:s}))(e,t.clientX,t.clientY,n,r,o,t)},wr=(t,e,n,r)=>{t.dom.removeEventListener(e,n,r)},xr=S,Ar=(t,e,n)=>((t,e,n,r)=>((t,e,n,r,o)=>{const i=((t,e)=>n=>{t(n)&&e(Cr(n))})(n,r);return t.dom.addEventListener(e,i,o),{unbind:y(wr,t,e,i,o)}})(t,e,n,r,!1))(t,e,xr,n),Lr=t=>{const e=O(t);return 0===e.length||((t,e)=>{for(let e=0,r=t.length;e!(t=>"CSSImportRule"===t.constructor.name)(t)||Lr(t.media),Tr=(t,e,n)=>{const r=K(t);return(async(t,e)=>{const n=(t=>{const e=t.dom.styleSheets;return Array.prototype.slice.call(e)})(t),r=L(n,(t=>ir(t,e))),o=await Promise.allSettled(r);return tr(o)})(r,(t=>((t,e,n)=>(!!u(t.href)||!e(t.href)&&(d(n)||n(t.href)))&&(u(t.media)||Lr(t.media)))(t,e,n)?((t,e)=>(t=>{try{return Promise.resolve(O(t.cssRules))}catch(t){return Promise.reject(t)}})(e).catch((n=>(async(t,e)=>u(e.href)?Promise.resolve([]):fetch(e.href).then((t=>t.ok?t.text():Promise.reject())).then((e=>ar(t,e))).catch((t=>[])))(t,e))))(r,t).then((t=>T(t,Er))):Promise.resolve([]))).then(lr)},_r=async t=>{const e=t.getContent(),n=(t=>{const e=mr(t),n=(t=>{const e=mr(t),n=t.options.get("skin_url");return!1===e?n:n?t.documentBaseURI.toAbsolute(n):t.editorManager.baseURL+"/skins/ui/"+e})(t);return!1!==e&&a(n)?[n+"/skin.min.css",n+"/skin.shadowdom.min.css"]:[]})(t),r=N(t.getBody()),o=await Tr(r,(t=>A(n,t)),pr(t)),i=(t=>{const e="mce-sandbox";return{play:(n,r)=>new Promise(((o,i)=>{var s;const a=I("div"),l=I("iframe");br(a,e),it(a,{visibility:"hidden"}),q(a,l),q(t,a);const c=t=>(...e)=>{H(a),t(...e)},u=null===(s=l.dom.contentWindow)||void 0===s?void 0:s.document;if(d(u))return void c(i)(new Error("sandbox iframe did not init correctly"));const h=Ar(l,"load",(()=>{h.unbind();const t=N(u),e=X(t);r(t,e).then(c(o),c(i))}));u.open(),u.write(n),u.close()})),playInline:(n,r)=>new Promise(((o,i)=>{const s=I("div");br(s,e),it(s,{position:"fixed",overflow:"hidden",zIndex:"1000",left:"0",right:"0",bottom:"0",top:"0",opacity:"0"});const a=I("div");it(a,{position:"absolute",left:"0",right:"0",top:"0",height:"auto",margin:"auto"}),J(a,n),q(s,a),q(t,s);const l=t=>(...e)=>{H(s),t(...e)};setTimeout((()=>{const e=F(t);r(e,a).then(l(o),l(i))}),50)}))}})(X(N(document))),s=((t,e)=>''+((t,e)=>{const n=t.dom.encode,r=fr(t),o=dr(t),i=t.getBody(),s=i.dir,a=s?' dir="'+n(s)+'"':"",l=t.inline?i.nodeName.toLowerCase():"body";return`<${l} ${t.inline?`class="mce-content-body"${a}`:`id="${n(r)}" class="mce-content-body ${n(o)}"${a}`}>`+e+``})(t,e)+"")(t,e);return i.play(s,((e,n)=>{const i=Z(n,".mce-content-body").getOr(n),s=((t,e)=>{var n;const r=null!==(n=gr(t))&&void 0!==n?n:S;return T(e,(t=>!(t=>((t,e,n=0,r)=>{const o=t.indexOf(e,n);return-1!==o&&(!!d(r)||o+e.length<=r)})(t.selector,"::"))(t)&&r(t.selector)))})(t,o);((t,e,n)=>{((t,e,n)=>{const r=[],o=document.createTreeWalker(t.dom,NodeFilter.SHOW_ELEMENT);for(;f(o.nextNode());){const t=N(o.currentNode),n=T(e,(e=>M(t,e.selector)));if(n.length>0){const e=sr(t,n);it(t,e),r.push(t)}}n&&E(r,(t=>{t.dom.removeAttribute("class")}))})(e,nr(t),n)})(s,i,!1);const a=vr(r,s);return Sr(i,a),Promise.resolve({html:(l=i,l.dom.innerHTML)});var l}))};tinymce.PluginManager.add("inlinecss",(t=>{if(!((t,n)=>!!t&&-1===((t,n)=>{const r=e(t.major,n.major);if(0!==r)return r;const o=e(t.minor,n.minor);if(0!==o)return o;const i=e(t.patch,n.patch);return 0!==i?i:0})((t=>r((t=>[t.majorVersion,t.minorVersion].join(".").split(".").slice(0,3).join("."))(t)))(t),r(n)))(tinymce,"6.3.0"))return(t=>{const e=t.options.register;e("inlinecss_file_filter",{processor:ur}),e("inlinecss_selector_filter",{processor:ur})})(t),(t=>({getContent:()=>((t=>{t.dispatch("InlineCSS")})(t),_r(t))}))(t);console.error("The inlinecss plugin requires at least version 6.3.0 of TinyMCE.")}))}();