From e6988d2f9e97e598960c91f094b6dd7f91523e21 Mon Sep 17 00:00:00 2001 From: tophf Date: Sat, 21 Nov 2020 20:35:23 +0300 Subject: [PATCH] update usercss-meta, #1108 --- package-lock.json | 36 ++++++++++++++----------- package.json | 2 +- vendor/usercss-meta/README.md | 2 +- vendor/usercss-meta/usercss-meta.min.js | 2 +- 4 files changed, 24 insertions(+), 18 deletions(-) diff --git a/package-lock.json b/package-lock.json index 56ba6f31..b0cb5b12 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,7 +17,7 @@ "semver-bundle": "^0.1.1", "stylelint-bundle": "^8.0.0", "stylus-lang-bundle": "github:openstyles/stylus-lang-bundle#v0.54.7", - "usercss-meta": "^0.9.0", + "usercss-meta": "^0.10.0", "webext-launch-web-auth-flow": "^0.1.0" }, "devDependencies": { @@ -6535,9 +6535,12 @@ "dev": true }, "node_modules/semver-regex": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/semver-regex/-/semver-regex-2.0.0.tgz", - "integrity": "sha512-mUdIBBvdn0PLOeP3TEkMH7HHeUP3GjsXCwKarjv/kGmUFOYg1VqEemKhoQpWMu6X2I8kHeuVdGibLGkVK+/5Qw==" + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/semver-regex/-/semver-regex-3.1.1.tgz", + "integrity": "sha512-3dPcmFqxblWB/cppQ2qXWqlp9b6GLgAS032+Ec5E0waDVHTkwYIL+7BFI9UqEe0tkoHle2f3pBgvT/Xl95+Dig==", + "engines": { + "node": ">=8" + } }, "node_modules/set-blocking": { "version": "2.0.0", @@ -7753,11 +7756,14 @@ } }, "node_modules/usercss-meta": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/usercss-meta/-/usercss-meta-0.9.0.tgz", - "integrity": "sha512-S6AuhI11jc2xh6DIx3xR+4EU5/YiV0lLIvDhJgE5BTJTkcBEXrScJUIKVvzApGRou3lSLV0Qi4fVbSsN9BR6Ig==", + "version": "0.10.0", + "resolved": "https://registry.npmjs.org/usercss-meta/-/usercss-meta-0.10.0.tgz", + "integrity": "sha512-+56W8M5PFtmtTmPLMVPb0kggeHs1wWWRy+5MnRHpGqEjIt7yAeWCHQ8E+lnFD2V5fDEN1EOxEyQ/zxwcrch1HA==", "dependencies": { - "semver-regex": "^2.0.0" + "semver-regex": "^3.1.1" + }, + "engines": { + "node": ">=8.3" } }, "node_modules/util-deprecate": { @@ -14768,9 +14774,9 @@ } }, "semver-regex": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/semver-regex/-/semver-regex-2.0.0.tgz", - "integrity": "sha512-mUdIBBvdn0PLOeP3TEkMH7HHeUP3GjsXCwKarjv/kGmUFOYg1VqEemKhoQpWMu6X2I8kHeuVdGibLGkVK+/5Qw==" + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/semver-regex/-/semver-regex-3.1.1.tgz", + "integrity": "sha512-3dPcmFqxblWB/cppQ2qXWqlp9b6GLgAS032+Ec5E0waDVHTkwYIL+7BFI9UqEe0tkoHle2f3pBgvT/Xl95+Dig==" }, "set-blocking": { "version": "2.0.0", @@ -16022,11 +16028,11 @@ } }, "usercss-meta": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/usercss-meta/-/usercss-meta-0.9.0.tgz", - "integrity": "sha512-S6AuhI11jc2xh6DIx3xR+4EU5/YiV0lLIvDhJgE5BTJTkcBEXrScJUIKVvzApGRou3lSLV0Qi4fVbSsN9BR6Ig==", + "version": "0.10.0", + "resolved": "https://registry.npmjs.org/usercss-meta/-/usercss-meta-0.10.0.tgz", + "integrity": "sha512-+56W8M5PFtmtTmPLMVPb0kggeHs1wWWRy+5MnRHpGqEjIt7yAeWCHQ8E+lnFD2V5fDEN1EOxEyQ/zxwcrch1HA==", "requires": { - "semver-regex": "^2.0.0" + "semver-regex": "^3.1.1" } }, "util-deprecate": { diff --git a/package.json b/package.json index 1dbe3d1c..5ec75445 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "semver-bundle": "^0.1.1", "stylelint-bundle": "^8.0.0", "stylus-lang-bundle": "github:openstyles/stylus-lang-bundle#v0.54.7", - "usercss-meta": "^0.9.0", + "usercss-meta": "^0.10.0", "webext-launch-web-auth-flow": "^0.1.0" }, "devDependencies": { diff --git a/vendor/usercss-meta/README.md b/vendor/usercss-meta/README.md index c8625d32..0e7962e4 100644 --- a/vendor/usercss-meta/README.md +++ b/vendor/usercss-meta/README.md @@ -1,4 +1,4 @@ -## usercss-meta v0.9.0 +## usercss-meta v0.10.0 Following files are copied from npm (node_modules): diff --git a/vendor/usercss-meta/usercss-meta.min.js b/vendor/usercss-meta/usercss-meta.min.js index bed5f666..9c5033ba 100644 --- a/vendor/usercss-meta/usercss-meta.min.js +++ b/vendor/usercss-meta/usercss-meta.min.js @@ -1,2 +1,2 @@ -var usercssMeta=function(e){"use strict";class n extends Error{constructor(e){super(e.message),delete e.message,this.name="ParseError",Object.assign(this,e)}}class t extends n{constructor(e,n){super({code:"missingChar",args:e,message:`Missing character: ${e.map(e=>`'${e}'`).join(", ")}`,index:n})}}class a extends n{constructor(e){super({code:"EOF",message:"Unexpected end of file",index:e})}}const s=/<<e[1]===n?n:JSON.parse(`"${e}"`))}function g(e){l.lastIndex=e.lastIndex,l.exec(e.text),e.lastIndex=l.lastIndex}function m(e){r.lastIndex=e.lastIndex,e.lastIndex+=r.exec(e.text)[0].length}function y(e){if(e.lastIndex>=e.text.length)throw new a(e.lastIndex);e.index=e.lastIndex,e.value=e.text[e.lastIndex],e.lastIndex++,m(e)}function h(e){const t=e.lastIndex;u.lastIndex=t;const a=u.exec(e.text);if(!a)throw new n({code:"invalidWord",message:"Invalid word",index:t});e.index=t,e.value=a[1],e.lastIndex+=a[0].length}function w(e){const a=e.lastIndex;try{!function e(a){const{text:s}=a;if("{"===s[a.lastIndex]){const n={};for(a.lastIndex++,m(a);"}"!==s[a.lastIndex];){O(a);const l=a.value;if(":"!==s[a.lastIndex])throw new t([":"],a.lastIndex);if(a.lastIndex++,m(a),e(a),n[l]=a.value,","===s[a.lastIndex])a.lastIndex++,m(a);else if("}"!==s[a.lastIndex])throw new t([",","}"],a.lastIndex)}a.lastIndex++,m(a),a.value=n}else if("["===s[a.lastIndex]){const n=[];for(a.lastIndex++,m(a);"]"!==s[a.lastIndex];)if(e(a),n.push(a.value),","===s[a.lastIndex])a.lastIndex++,m(a);else if("]"!==s[a.lastIndex])throw new t([",","]"],a.lastIndex);a.lastIndex++,m(a),a.value=n}else if('"'===s[a.lastIndex]||"'"===s[a.lastIndex]||"`"===s[a.lastIndex])O(a);else if(/[-\d.]/.test(s[a.lastIndex]))S(a);else{if(h(a),!(a.value in p))throw new n({code:"unknownJSONLiteral",args:[a.value],message:`Unknown literal '${a.value}'`,index:a.index});a.value=p[a.value]}}(e)}catch(e){throw e.message=`Invalid JSON: ${e.message}`,e}e.index=a}function I(e){const t=e.lastIndex;s.lastIndex=t;const a=s.exec(e.text);if(!a)throw new n({code:"missingEOT",message:"Missing EOT",index:t});e.index=t,e.lastIndex+=a[0].length,e.value=f(a[1].trim()),m(e)}function b(e){x.lastIndex=e.lastIndex;const n=x.exec(e.text);e.index=e.lastIndex,e.lastIndex=x.lastIndex,e.value=n[0].trim().replace(/\s+/g,"-")}function O(e,t=!1){const a=e.lastIndex,s="`"===e.text[a]?d:c;s.lastIndex=a;const l=s.exec(e.text);if(!l)throw new n({code:"invalidString",message:"Invalid string",index:a});e.index=a,e.lastIndex+=l[0].length,e.value=v(l[1]),t?function(e){o.lastIndex=e.lastIndex,e.lastIndex+=o.exec(e.text)[0].length}(e):m(e)}function S(e){const t=e.lastIndex;i.lastIndex=t;const a=i.exec(e.text);if(!a)throw new n({code:"invalidNumber",message:"Invalid number",index:t});e.index=t,e.value=Number(a[0].trim()),e.lastIndex+=a[0].length}function k(e){l.lastIndex=e.lastIndex;const t=l.exec(e.text)[0].trim();if(!t)throw new n({code:"missingValue",message:"Missing value",index:l.lastIndex});e.index=e.lastIndex,e.value=v(t),e.lastIndex=l.lastIndex}var $={eatLine:g,eatWhitespace:m,parseChar:y,parseEOT:I,parseJSON:w,parseNumber:S,parseString:O,parseStringToEnd:k,parseStringUnquoted:b,parseWord:h,unquote:v};const R=self.URL,E=new Set(["em","ex","cap","ch","ic","rem","lh","rlh","vw","vh","vi","vb","vmin","vmax","cm","mm","Q","in","pt","pc","px","deg","grad","rad","turn","s","ms","Hz","kHz","dpi","dpcm","dppx","%"]),j={name:k,version:k,namespace:k,author:k,description:k,homepageURL:k,supportURL:k,updateURL:k,license:k,preprocessor:k},U={version:function(e){const t=e.value.match(/\bv?(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)(?:-[\da-z-]+(?:\.[\da-z-]+)*)?(?:\+[\da-z-]+(?:\.[\da-z-]+)*)?\b/gi);if(!t||t[0]!==e.value)throw new n({code:"invalidVersion",args:[e.value],message:`Invalid version: ${e.value}`,index:e.valueIndex});var a;e.value="v"===(a=e.value)[0]||"="===a[0]?a.slice(1):a},homepageURL:z,supportURL:z,updateURL:z},N={text:k,color:k,checkbox:y,select:L,dropdown:{advanced:V},image:{var:L,advanced:V},number:J,range:J},M={checkbox:function(e){if("1"!==e.value&&"0"!==e.value)throw new n({code:"invalidCheckboxDefault",message:"value must be 0 or 1",index:e.valueIndex})},number:K,range:K},T=["name","namespace","version"],D=["default","min","max","step"];function J(e){w(e);const t={min:null,max:null,step:null,units:null};if("number"==typeof e.value)t.default=e.value;else{if(!Array.isArray(e.value))throw new n({code:"invalidRange",message:"the default value must be an array or a number",index:e.valueIndex,args:[e.type]});{let a=0;for(const s of e.value)if("string"==typeof s){if(null!=t.units)throw new n({code:"invalidRangeMultipleUnits",message:"units is alredy defined",args:[e.type],index:e.valueIndex});t.units=s}else{if("number"!=typeof s&&null!==s)throw new n({code:"invalidRangeValue",message:"value must be number, string, or null",args:[e.type],index:e.valueIndex});if(a>=D.length)throw new n({code:"invalidRangeTooManyValues",message:"the array contains too many values",args:[e.type],index:e.valueIndex});t[D[a++]]=s}}}e.value=t.default,Object.assign(e.varResult,t)}function L(e){if(w(e),"object"!=typeof e.value||!e.value)throw new n({code:"invalidSelect",message:"The value must be an array or object"});const t=Array.isArray(e.value)?e.value.map(e=>A(e)):Object.keys(e.value).map(n=>A(n,e.value[n]));if(new Set(t.map(e=>e.name)).sizee.isDefault);if(a.length>1)throw new n({code:"invalidSelectMultipleDefaults",message:"multiple default values"});t.forEach(e=>{delete e.isDefault}),e.varResult.options=t,e.value=(a.length>0?a[0]:t[0]).name}function V(e){const a=e.lastIndex;if("{"!==e.text[e.lastIndex])throw new t(["{"],a);const s=[];for(e.lastIndex++;"}"!==e.text[e.lastIndex];){const n={};b(e),n.name=e.value,O(e),n.label=e.value,"dropdown"===e.type?I(e):O(e),n.value=e.value,s.push(n)}if(e.lastIndex++,m(e),0===s.length)throw new n({code:"invalidSelectEmptyOptions",message:"Option list is empty",index:a});"dropdown"===e.type&&(e.varResult.type="select",e.type="select"),e.varResult.options=s,e.value=s[0].name}function A(e,t){if("string"!=typeof e||t&&"string"!=typeof t)throw new n({code:"invalidSelectValue",message:"Values in the object/array must be strings"});let a,s=!1;e.endsWith("*")&&(s=!0,e=e.slice(0,-1));const l=e.match(/^(\w+):(.*)/);if(l&&([,a,e]=l),a||(a=e),!e)throw new n({code:"invalidSelectLabel",message:"Option label is empty"});return null==t&&(t=a),{name:a,label:e,value:t,isDefault:s}}function _(e,n){if(n)try{e()}catch(e){n.push(e)}else e()}function z(e){let t;try{t=new R(e.value)}catch(n){throw n.args=[e.value],n.index=e.valueIndex,n}if(!/^https?:/.test(t.protocol))throw new n({code:"invalidURLProtocol",args:[t.protocol],message:`Invalid protocol: ${t.protocol}`,index:e.valueIndex})}function K(e){const t=e.value;if("number"!=typeof t)throw new n({code:"invalidRangeDefault",message:`the default value of @var ${e.type} must be a number`,index:e.valueIndex,args:[e.type]});const a=e.varResult;if(null!=a.min&&ta.max)throw new n({code:"invalidRangeMax",message:"the value is larger than the maximum",index:e.valueIndex,args:[e.type]});if(null!=a.step&&[t,a.min,a.max].some(e=>null!=e&&!function(e,n){const t=n.toString().split(".")[1],a=t?Math.pow(10,t.length):1;return e*a%(n*a)==0}(e,a.step)))throw new n({code:"invalidRangeStep",message:"the value is not a multiple of the step",index:e.valueIndex,args:[e.type]});if(a.units&&!E.has(a.units))throw new n({code:"invalidRangeUnits",message:`Invalid CSS unit: ${a.units}`,index:e.valueIndex,args:[e.type,a.units]})}function P({unknownKey:e="ignore",mandatoryKeys:t=T,parseKey:a,parseVar:s,validateKey:l,validateVar:i,allowErrors:r=!1}={}){if(!["ignore","assign","throw"].includes(e))throw new TypeError("unknownKey must be 'ignore', 'assign', or 'throw'");const o=Object.assign({__proto__:null},j,a),u=Object.assign({},N,s),d=Object.assign({},U,l),c=Object.assign({},M,i);return{parse:function(e){if(e.includes("\r"))throw new TypeError("metadata includes invalid character: '\\r'");const a={},s=[],l=/@(\w+)[^\S\r\n]*/gm,i={index:0,lastIndex:0,text:e,usercssData:a,warn:e=>s.push(e)};let o;for(;o=l.exec(e);)i.index=o.index,i.lastIndex=l.lastIndex,i.key=o[1],i.shouldIgnore=!1,_(()=>{try{"var"===i.key||"advanced"===i.key?p(i):f(i)}catch(e){throw void 0===e.index&&(e.index=i.index),e}"var"===i.key||"advanced"===i.key||i.shouldIgnore||(a[i.key]=i.value)},r&&s),l.lastIndex=i.lastIndex;return i.maybeUSO&&!a.preprocessor&&(a.preprocessor="uso"),_(()=>{const e=t.filter(e=>!Object.prototype.hasOwnProperty.call(a,e)||!a[e]);if(e.length>0)throw new n({code:"missingMandatory",args:e,message:`Missing metadata: ${e.map(e=>`@${e}`).join(", ")}`})},r&&s),{metadata:a,errors:s}},validateVar:function(e){x({key:"var",type:e.type,value:e.value,varResult:e})}};function x(e){const n="object"==typeof c[e.type]?c[e.type][e.key]:c[e.type];n&&n(e)}function p(e){const t={type:null,label:null,name:null,value:null,default:null,options:null};e.varResult=t,h(e),e.type=e.value,t.type=e.type;const a="object"==typeof u[e.type]?u[e.type][e.key]:u[e.type];if(!a)throw new n({code:"unknownVarType",message:`Unknown @${e.key} type: ${e.type}`,args:[e.key,e.type],index:e.index});h(e),t.name=e.value,O(e,!0),t.label=e.value,e.valueIndex=e.lastIndex,a(e),x(e),t.default=e.value,e.usercssData.vars||(e.usercssData.vars={}),e.usercssData.vars[t.name]=t,"advanced"===e.key&&(e.maybeUSO=!0)}function f(t){let a=o[t.key];if(!a){if("assign"!==e){if(g(t),"ignore"===e)return void(t.shouldIgnore=!0);throw new n({code:"unknownMeta",args:[t.key],message:`Unknown metadata: @${t.key}`,index:t.index})}a=k}t.valueIndex=t.lastIndex,a(t),d[t.key]&&d[t.key](t)}}function C({alignKeys:e=!1,space:n=2,format:t="stylus",stringifyKey:a={},stringifyVar:s={}}={}){return{stringify:function(l){let i;if("stylus"===t)i="var";else{if("xstyle"!==t)throw new TypeError("options.format must be 'stylus' or 'xstyle'");i="advanced"}const r=[];for(const e of Object.keys(l)){const o=l[e];if(Object.prototype.hasOwnProperty.call(a,e)){const n=a[e](o);Array.isArray(n)?r.push(...n.map(n=>[e,n])):r.push([e,n])}else if("vars"===e)for(const e of Object.values(o))r.push([i,W(e,t,s,n)]);else if(Array.isArray(o))for(const n of o)r.push([e,q(n)]);else r.push([e,q(o)])}const o=e?Math.max(...r.map(e=>e[0].length)):0;return`/* ==UserStyle==\n${u=r.map(([e,n])=>`@${e.padEnd(o)} ${n}`).join("\n"),u.replace(/\*\//g,"*\\/")}\n==/UserStyle== */`;var u}}}function W(e,n,t,a){return`${"xstyle"===n&&"select"===e.type?"dropdown":e.type} ${e.name} ${JSON.stringify(e.label)} ${function(){if(Object.prototype.hasOwnProperty.call(t,e.type))return t[e.type](e,n,a);if(e.options)return"stylus"===n?JSON.stringify(e.options.reduce((n,t)=>{const a=t.name===e.default?"*":"";return n[`${t.name}:${t.label}${a}`]=t.value,n},{}),null,a):function(e,n=!1,t=0){const a="string"==typeof t?t:" ".repeat(t);return`{\n${e.map(e=>`${a}${e.name} ${JSON.stringify(e.label)} ${function(e){return n?JSON.stringify(e):`<<`'${e}'`)).join(", ")}`,index:n})}}class a extends n{constructor(e){super({code:"EOF",message:"Unexpected end of file",index:e})}}const s=/<<e[1]===n?n:JSON.parse(`"${e}"`)))}function m(e){l.lastIndex=e.lastIndex,l.exec(e.text),e.lastIndex=l.lastIndex}function y(e){i.lastIndex=e.lastIndex,e.lastIndex+=i.exec(e.text)[0].length}function g(e){if(e.lastIndex>=e.text.length)throw new a(e.lastIndex);e.index=e.lastIndex,e.value=e.text[e.lastIndex],e.lastIndex++,y(e)}function h(e){const t=e.lastIndex;u.lastIndex=t;const a=u.exec(e.text);if(!a)throw new n({code:"invalidWord",message:"Invalid word",index:t});e.index=t,e.value=a[1],e.lastIndex+=a[0].length}function w(e){const n=e.lastIndex;try{S(e)}catch(e){throw e.message=`Invalid JSON: ${e.message}`,e}e.index=n}function I(e){const t=e.lastIndex;s.lastIndex=t;const a=s.exec(e.text);if(!a)throw new n({code:"missingEOT",message:"Missing EOT",index:t});e.index=t,e.lastIndex+=a[0].length,e.value=f(a[1].trim()),y(e)}function b(e){x.lastIndex=e.lastIndex;const n=x.exec(e.text);e.index=e.lastIndex,e.lastIndex=x.lastIndex,e.value=n[0].trim().replace(/\s+/g,"-")}function O(e,t=!1){const a=e.lastIndex,s="`"===e.text[a]?d:c;s.lastIndex=a;const l=s.exec(e.text);if(!l)throw new n({code:"invalidString",message:"Invalid string",index:a});e.index=a,e.lastIndex+=l[0].length,e.value=v(l[1]),t?function(e){o.lastIndex=e.lastIndex,e.lastIndex+=o.exec(e.text)[0].length}(e):y(e)}function S(e){const{text:a}=e;if("{"===a[e.lastIndex]){const n={};for(e.lastIndex++,y(e);"}"!==a[e.lastIndex];){O(e);const s=e.value;if(":"!==a[e.lastIndex])throw new t([":"],e.lastIndex);if(e.lastIndex++,y(e),S(e),n[s]=e.value,","===a[e.lastIndex])e.lastIndex++,y(e);else if("}"!==a[e.lastIndex])throw new t([",","}"],e.lastIndex)}e.lastIndex++,y(e),e.value=n}else if("["===a[e.lastIndex]){const n=[];for(e.lastIndex++,y(e);"]"!==a[e.lastIndex];)if(S(e),n.push(e.value),","===a[e.lastIndex])e.lastIndex++,y(e);else if("]"!==a[e.lastIndex])throw new t([",","]"],e.lastIndex);e.lastIndex++,y(e),e.value=n}else if('"'===a[e.lastIndex]||"'"===a[e.lastIndex]||"`"===a[e.lastIndex])O(e);else if(/[-\d.]/.test(a[e.lastIndex]))$(e);else{if(h(e),!(e.value in p))throw new n({code:"unknownJSONLiteral",args:[e.value],message:`Unknown literal '${e.value}'`,index:e.index});e.value=p[e.value]}}function $(e){const t=e.lastIndex;r.lastIndex=t;const a=r.exec(e.text);if(!a)throw new n({code:"invalidNumber",message:"Invalid number",index:t});e.index=t,e.value=Number(a[0].trim()),e.lastIndex+=a[0].length}function k(e){l.lastIndex=e.lastIndex;const t=l.exec(e.text)[0].trim();if(!t)throw new n({code:"missingValue",message:"Missing value",index:l.lastIndex});e.index=e.lastIndex,e.value=v(t),e.lastIndex=l.lastIndex}var R={__proto__:null,eatLine:m,eatWhitespace:y,parseChar:g,parseEOT:I,parseJSON:w,parseNumber:$,parseString:O,parseStringToEnd:k,parseStringUnquoted:b,parseWord:h,unquote:v};const E=self.URL,U=new Set(["em","ex","cap","ch","ic","rem","lh","rlh","vw","vh","vi","vb","vmin","vmax","cm","mm","Q","in","pt","pc","px","deg","grad","rad","turn","s","ms","Hz","kHz","dpi","dpcm","dppx","%"]),j={name:k,version:k,namespace:k,author:k,description:k,homepageURL:k,supportURL:k,updateURL:k,license:k,preprocessor:k},M={version:function(e){if(!e.value.match(/(?<=^v?|\sv?)(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)(?:-(?:0|[1-9]\d*|[\da-z-]*[a-z-][\da-z-]*)(?:\.(?:0|[1-9]\d*|[\da-z-]*[a-z-][\da-z-]*))*)?(?:\+[\da-z-]+(?:\.[\da-z-]+)*)?(?=$|\s)/gi))throw new n({code:"invalidVersion",args:[e.value],message:`Invalid version: ${e.value}`,index:e.valueIndex});var t;e.value="v"===(t=e.value)[0]||"="===t[0]?t.slice(1):t},homepageURL:P,supportURL:P,updateURL:P},N={text:k,color:k,checkbox:g,select:J,dropdown:{advanced:L},image:{var:J,advanced:L},number:D,range:D},T={checkbox:function(e){if("1"!==e.value&&"0"!==e.value)throw new n({code:"invalidCheckboxDefault",message:"value must be 0 or 1",index:e.valueIndex})},number:K,range:K},_=["name","namespace","version"],z=["default","min","max","step"];function D(e){w(e);const t={min:null,max:null,step:null,units:null};if("number"==typeof e.value)t.default=e.value;else{if(!Array.isArray(e.value))throw new n({code:"invalidRange",message:"the default value must be an array or a number",index:e.valueIndex,args:[e.type]});{let a=0;for(const s of e.value)if("string"==typeof s){if(null!=t.units)throw new n({code:"invalidRangeMultipleUnits",message:"units is alredy defined",args:[e.type],index:e.valueIndex});t.units=s}else{if("number"!=typeof s&&null!==s)throw new n({code:"invalidRangeValue",message:"value must be number, string, or null",args:[e.type],index:e.valueIndex});if(a>=z.length)throw new n({code:"invalidRangeTooManyValues",message:"the array contains too many values",args:[e.type],index:e.valueIndex});t[z[a++]]=s}}}e.value=t.default,Object.assign(e.varResult,t)}function J(e){if(w(e),"object"!=typeof e.value||!e.value)throw new n({code:"invalidSelect",message:"The value must be an array or object"});const t=Array.isArray(e.value)?e.value.map((e=>V(e))):Object.keys(e.value).map((n=>V(n,e.value[n])));if(new Set(t.map((e=>e.name))).sizee.isDefault));if(a.length>1)throw new n({code:"invalidSelectMultipleDefaults",message:"multiple default values"});t.forEach((e=>{delete e.isDefault})),e.varResult.options=t,e.value=(a.length>0?a[0]:t[0]).name}function L(e){const a=e.lastIndex;if("{"!==e.text[e.lastIndex])throw new t(["{"],a);const s=[];for(e.lastIndex++;"}"!==e.text[e.lastIndex];){const n={};b(e),n.name=e.value,O(e),n.label=e.value,"dropdown"===e.type?I(e):O(e),n.value=e.value,s.push(n)}if(e.lastIndex++,y(e),0===s.length)throw new n({code:"invalidSelectEmptyOptions",message:"Option list is empty",index:a});"dropdown"===e.type&&(e.varResult.type="select",e.type="select"),e.varResult.options=s,e.value=s[0].name}function V(e,t){if("string"!=typeof e||t&&"string"!=typeof t)throw new n({code:"invalidSelectValue",message:"Values in the object/array must be strings"});let a,s=!1;e.endsWith("*")&&(s=!0,e=e.slice(0,-1));const l=e.match(/^(\w+):(.*)/);if(l&&([,a,e]=l),a||(a=e),!e)throw new n({code:"invalidSelectLabel",message:"Option label is empty"});return null==t&&(t=a),{name:a,label:e,value:t,isDefault:s}}function A(e,n){if(n)try{e()}catch(e){n.push(e)}else e()}function P(e){let t;try{t=new E(e.value)}catch(n){throw n.args=[e.value],n.index=e.valueIndex,n}if(!/^https?:/.test(t.protocol))throw new n({code:"invalidURLProtocol",args:[t.protocol],message:`Invalid protocol: ${t.protocol}`,index:e.valueIndex})}function K(e){const t=e.value;if("number"!=typeof t)throw new n({code:"invalidRangeDefault",message:`the default value of @var ${e.type} must be a number`,index:e.valueIndex,args:[e.type]});const a=e.varResult;if(null!=a.min&&ta.max)throw new n({code:"invalidRangeMax",message:"the value is larger than the maximum",index:e.valueIndex,args:[e.type]});if(null!=a.step&&[t,a.min,a.max].some((e=>null!=e&&!function(e,n){const t=Math.abs(e/n),a=Math.round(t);return Math.abs(t-a)<10**(`${a}`.length-16)}(e,a.step))))throw new n({code:"invalidRangeStep",message:"the value is not a multiple of the step",index:e.valueIndex,args:[e.type]});if(a.units&&!U.has(a.units))throw new n({code:"invalidRangeUnits",message:`Invalid CSS unit: ${a.units}`,index:e.valueIndex,args:[e.type,a.units]})}function C({unknownKey:e="ignore",mandatoryKeys:t=_,parseKey:a,parseVar:s,validateKey:l,validateVar:r,allowErrors:i=!1}={}){if(!["ignore","assign","throw"].includes(e))throw new TypeError("unknownKey must be 'ignore', 'assign', or 'throw'");const o={__proto__:null,...j,...a},u={...N,...s},d={...M,...l},c={...T,...r};return{parse:function(e){if(e.includes("\r"))throw new TypeError("metadata includes invalid character: '\\r'");const a={},s=[],l=/@([\w-]+)[^\S\r\n]*/gm,r={index:0,lastIndex:0,text:e,usercssData:a,warn:e=>s.push(e)};let o;for(;o=l.exec(e);)r.index=o.index,r.lastIndex=l.lastIndex,r.key=o[1],r.shouldIgnore=!1,A((()=>{try{"var"===r.key||"advanced"===r.key?p(r):f(r)}catch(e){throw void 0===e.index&&(e.index=r.index),e}"var"===r.key||"advanced"===r.key||r.shouldIgnore||(a[r.key]=r.value)}),i&&s),l.lastIndex=r.lastIndex;return r.maybeUSO&&!a.preprocessor&&(a.preprocessor="uso"),A((()=>{const e=t.filter((e=>!Object.prototype.hasOwnProperty.call(a,e)||!a[e]));if(e.length>0)throw new n({code:"missingMandatory",args:e,message:`Missing metadata: ${e.map((e=>`@${e}`)).join(", ")}`})}),i&&s),{metadata:a,errors:s}},validateVar:function(e){x({key:"var",type:e.type,value:e.value,varResult:e})}};function x(e){const n="object"==typeof c[e.type]?c[e.type][e.key]:c[e.type];n&&n(e)}function p(e){const t={type:null,label:null,name:null,value:null,default:null,options:null};e.varResult=t,h(e),e.type=e.value,t.type=e.type;const a="object"==typeof u[e.type]?u[e.type][e.key]:u[e.type];if(!a)throw new n({code:"unknownVarType",message:`Unknown @${e.key} type: ${e.type}`,args:[e.key,e.type],index:e.index});h(e),t.name=e.value,O(e,!0),t.label=e.value,e.valueIndex=e.lastIndex,a(e),x(e),t.default=e.value,e.usercssData.vars||(e.usercssData.vars={}),e.usercssData.vars[t.name]=t,"advanced"===e.key&&(e.maybeUSO=!0)}function f(t){let a=o[t.key];if(!a){if("assign"!==e){if(m(t),"ignore"===e)return void(t.shouldIgnore=!0);throw new n({code:"unknownMeta",args:[t.key],message:`Unknown metadata: @${t.key}`,index:t.index})}a=k}t.valueIndex=t.lastIndex,a(t),d[t.key]&&d[t.key](t)}}function W({alignKeys:e=!1,space:n=2,format:t="stylus",stringifyKey:a={},stringifyVar:s={}}={}){return{stringify:function(l){let r;if("stylus"===t)r="var";else{if("xstyle"!==t)throw new TypeError("options.format must be 'stylus' or 'xstyle'");r="advanced"}const i=[];for(const e of Object.keys(l)){const o=l[e];if(Object.prototype.hasOwnProperty.call(a,e)){const n=a[e](o);Array.isArray(n)?i.push(...n.map((n=>[e,n]))):i.push([e,n])}else if("vars"===e)for(const e of Object.values(o))i.push([r,q(e,t,s,n)]);else if(Array.isArray(o))for(const n of o)i.push([e,F(n)]);else i.push([e,F(o)])}const o=e?Math.max(...i.map((e=>e[0].length))):0;return`/* ==UserStyle==\n${u=i.map((([e,n])=>`@${e.padEnd(o)} ${n}`)).join("\n"),u.replace(/\*\//g,"*\\/")}\n==/UserStyle== */`;var u}}}function q(e,n,t,a){return`${"xstyle"===n&&"select"===e.type?"dropdown":e.type} ${e.name} ${JSON.stringify(e.label)} ${function(){if(Object.prototype.hasOwnProperty.call(t,e.type))return t[e.type](e,n,a);if(e.options)return"stylus"===n?JSON.stringify(e.options.reduce(((n,t)=>{const a=t.name===e.default?"*":"";return n[`${t.name}:${t.label}${a}`]=t.value,n}),{}),null,a):function(e,n=!1,t=0){const a="string"==typeof t?t:" ".repeat(t);return`{\n${e.map((e=>{return`${a}${e.name} ${JSON.stringify(e.label)} ${t=e.value,n?JSON.stringify(t):`<<