From 53d130a1799f9c2cec9260e09ac8c040c1231785 Mon Sep 17 00:00:00 2001 From: Rob Garrison Date: Thu, 29 Nov 2018 20:11:39 -0600 Subject: [PATCH] Update vendors --- package.json | 6 +- vendor/codemirror/README.md | 2 +- vendor/codemirror/addon/hint/show-hint.js | 16 +++--- vendor/codemirror/keymap/vim.js | 5 ++ vendor/codemirror/lib/codemirror.js | 55 ++++++++++++++----- .../codemirror/mode/javascript/javascript.js | 1 + vendor/codemirror/theme/darcula.css | 51 +++++++++-------- vendor/usercss-meta/README.md | 4 +- vendor/usercss-meta/usercss-meta.min.js | 2 +- 9 files changed, 91 insertions(+), 51 deletions(-) diff --git a/package.json b/package.json index b6c2159a..b40a2341 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "author": "Stylus Team", "devDependencies": { "archiver": "^3.0.0", - "codemirror": "^5.41.0", + "codemirror": "^5.42.0", "dropbox": "^4.0.13", "endent": "^1.2.0", "eslint": "^5.9.0", @@ -19,8 +19,8 @@ "semver-bundle": "^0.1.1", "stylelint-bundle": "^8.0.0", "stylus-lang-bundle": "^0.54.5", - "updates": "^5.1.2", - "usercss-meta": "^0.8.4", + "updates": "^5.4.2", + "usercss-meta": "^0.9.0", "web-ext": "^2.9.2", "webext-tx-fix": "^0.3.1", "zipjs-browserify": "^1.0.1" diff --git a/vendor/codemirror/README.md b/vendor/codemirror/README.md index 93aa746c..d57ae9f9 100644 --- a/vendor/codemirror/README.md +++ b/vendor/codemirror/README.md @@ -1,3 +1,3 @@ -## CodeMirror v5.41.0 +## CodeMirror v5.42.0 Only files & folders that exist in the `vendor/codemirror` folder are copied from the `node_modules/codemirror` folder. Except all theme files are copied, in case new themes have been added. diff --git a/vendor/codemirror/addon/hint/show-hint.js b/vendor/codemirror/addon/hint/show-hint.js index 5f6664b3..28025775 100644 --- a/vendor/codemirror/addon/hint/show-hint.js +++ b/vendor/codemirror/addon/hint/show-hint.js @@ -198,20 +198,22 @@ this.data = data; this.picked = false; var widget = this, cm = completion.cm; + var ownerDocument = cm.getInputField().ownerDocument; + var parentWindow = ownerDocument.defaultView || ownerDocument.parentWindow; - var hints = this.hints = document.createElement("ul"); + var hints = this.hints = ownerDocument.createElement("ul"); var theme = completion.cm.options.theme; hints.className = "CodeMirror-hints " + theme; this.selectedHint = data.selectedHint || 0; var completions = data.list; for (var i = 0; i < completions.length; ++i) { - var elt = hints.appendChild(document.createElement("li")), cur = completions[i]; + var elt = hints.appendChild(ownerDocument.createElement("li")), cur = completions[i]; var className = HINT_ELEMENT_CLASS + (i != this.selectedHint ? "" : " " + ACTIVE_HINT_ELEMENT_CLASS); if (cur.className != null) className = cur.className + " " + className; elt.className = className; if (cur.render) cur.render(elt, data, cur); - else elt.appendChild(document.createTextNode(cur.displayText || getText(cur))); + else elt.appendChild(ownerDocument.createTextNode(cur.displayText || getText(cur))); elt.hintId = i; } @@ -220,9 +222,9 @@ hints.style.left = left + "px"; hints.style.top = top + "px"; // If we're at the edge of the screen, then we want the menu to appear on the left of the cursor. - var winW = window.innerWidth || Math.max(document.body.offsetWidth, document.documentElement.offsetWidth); - var winH = window.innerHeight || Math.max(document.body.offsetHeight, document.documentElement.offsetHeight); - (completion.options.container || document.body).appendChild(hints); + var winW = parentWindow.innerWidth || Math.max(ownerDocument.body.offsetWidth, ownerDocument.documentElement.offsetWidth); + var winH = parentWindow.innerHeight || Math.max(ownerDocument.body.offsetHeight, ownerDocument.documentElement.offsetHeight); + (completion.options.container || ownerDocument.body).appendChild(hints); var box = hints.getBoundingClientRect(), overlapY = box.bottom - winH; var scrolls = hints.scrollHeight > hints.clientHeight + 1 var startScroll = cm.getScrollInfo(); @@ -273,7 +275,7 @@ cm.on("scroll", this.onScroll = function() { var curScroll = cm.getScrollInfo(), editor = cm.getWrapperElement().getBoundingClientRect(); var newTop = top + startScroll.top - curScroll.top; - var point = newTop - (window.pageYOffset || (document.documentElement || document.body).scrollTop); + var point = newTop - (parentWindow.pageYOffset || (ownerDocument.documentElement || ownerDocument.body).scrollTop); if (!below) point += hints.offsetHeight; if (point <= editor.top || point >= editor.bottom) return completion.close(); hints.style.top = newTop + "px"; diff --git a/vendor/codemirror/keymap/vim.js b/vendor/codemirror/keymap/vim.js index a734026d..aed0957d 100644 --- a/vendor/codemirror/keymap/vim.js +++ b/vendor/codemirror/keymap/vim.js @@ -132,6 +132,7 @@ { keys: 'd', type: 'operator', operator: 'delete' }, { keys: 'y', type: 'operator', operator: 'yank' }, { keys: 'c', type: 'operator', operator: 'change' }, + { keys: '=', type: 'operator', operator: 'indentAuto' }, { keys: '>', type: 'operator', operator: 'indent', operatorArgs: { indentRight: true }}, { keys: '<', type: 'operator', operator: 'indent', operatorArgs: { indentRight: false }}, { keys: 'g~', type: 'operator', operator: 'changeCase' }, @@ -2188,6 +2189,10 @@ } return motions.moveToFirstNonWhiteSpaceCharacter(cm, ranges[0].anchor); }, + indentAuto: function(cm, _args, ranges) { + cm.execCommand("indentAuto"); + return motions.moveToFirstNonWhiteSpaceCharacter(cm, ranges[0].anchor); + }, changeCase: function(cm, args, ranges, oldAnchor, newHead) { var selections = cm.getSelections(); var swapped = []; diff --git a/vendor/codemirror/lib/codemirror.js b/vendor/codemirror/lib/codemirror.js index 93c0ead2..c5a9da5f 100644 --- a/vendor/codemirror/lib/codemirror.js +++ b/vendor/codemirror/lib/codemirror.js @@ -1878,7 +1878,7 @@ // Build up the DOM representation for a single token, and add it to // the line map. Takes care to render special characters separately. - function buildToken(builder, text, style, startStyle, endStyle, title, css) { + function buildToken(builder, text, style, startStyle, endStyle, css, attributes) { if (!text) { return } var displayText = builder.splitSpaces ? splitSpaces(text, builder.trailingSpace) : text; var special = builder.cm.state.specialChars, mustWrap = false; @@ -1934,7 +1934,10 @@ if (startStyle) { fullStyle += startStyle; } if (endStyle) { fullStyle += endStyle; } var token = elt("span", [content], fullStyle, css); - if (title) { token.title = title; } + if (attributes) { + for (var attr in attributes) { if (attributes.hasOwnProperty(attr) && attr != "style" && attr != "class") + { token.setAttribute(attr, attributes[attr]); } } + } return builder.content.appendChild(token) } builder.content.appendChild(content); @@ -1958,7 +1961,7 @@ // Work around nonsense dimensions being reported for stretches of // right-to-left text. function buildTokenBadBidi(inner, order) { - return function (builder, text, style, startStyle, endStyle, title, css) { + return function (builder, text, style, startStyle, endStyle, css, attributes) { style = style ? style + " cm-force-border" : "cm-force-border"; var start = builder.pos, end = start + text.length; for (;;) { @@ -1968,8 +1971,8 @@ part = order[i]; if (part.to > start && part.from <= start) { break } } - if (part.to >= end) { return inner(builder, text, style, startStyle, endStyle, title, css) } - inner(builder, text.slice(0, part.to - start), style, startStyle, null, title, css); + if (part.to >= end) { return inner(builder, text, style, startStyle, endStyle, css, attributes) } + inner(builder, text.slice(0, part.to - start), style, startStyle, null, css, attributes); startStyle = null; text = text.slice(part.to - start); start = part.to; @@ -2004,10 +2007,11 @@ } var len = allText.length, pos = 0, i = 1, text = "", style, css; - var nextChange = 0, spanStyle, spanEndStyle, spanStartStyle, title, collapsed; + var nextChange = 0, spanStyle, spanEndStyle, spanStartStyle, collapsed, attributes; for (;;) { if (nextChange == pos) { // Update current marker set - spanStyle = spanEndStyle = spanStartStyle = title = css = ""; + spanStyle = spanEndStyle = spanStartStyle = css = ""; + attributes = null; collapsed = null; nextChange = Infinity; var foundBookmarks = [], endStyles = (void 0); for (var j = 0; j < spans.length; ++j) { @@ -2023,7 +2027,13 @@ if (m.css) { css = (css ? css + ";" : "") + m.css; } if (m.startStyle && sp.from == pos) { spanStartStyle += " " + m.startStyle; } if (m.endStyle && sp.to == nextChange) { (endStyles || (endStyles = [])).push(m.endStyle, sp.to); } - if (m.title && !title) { title = m.title; } + // support for the old title property + // https://github.com/codemirror/CodeMirror/pull/5673 + if (m.title) { (attributes || (attributes = {})).title = m.title; } + if (m.attributes) { + for (var attr in m.attributes) + { (attributes || (attributes = {}))[attr] = m.attributes[attr]; } + } if (m.collapsed && (!collapsed || compareCollapsedMarkers(collapsed.marker, m) < 0)) { collapsed = sp; } } else if (sp.from > pos && nextChange > sp.from) { @@ -2051,7 +2061,7 @@ if (!collapsed) { var tokenText = end > upto ? text.slice(0, upto - pos) : text; builder.addToken(builder, tokenText, style ? style + spanStyle : spanStyle, - spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : "", title, css); + spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : "", css, attributes); } if (end >= upto) {text = text.slice(upto - pos); pos = upto; break} pos = end; @@ -3260,7 +3270,8 @@ var display = cm.display; var prevBottom = display.lineDiv.offsetTop; for (var i = 0; i < display.view.length; i++) { - var cur = display.view[i], height = (void 0); + var cur = display.view[i], wrapping = cm.options.lineWrapping; + var height = (void 0), width = 0; if (cur.hidden) { continue } if (ie && ie_version < 8) { var bot = cur.node.offsetTop + cur.node.offsetHeight; @@ -3269,6 +3280,10 @@ } else { var box = cur.node.getBoundingClientRect(); height = box.bottom - box.top; + // Check that lines don't extend past the right of the current + // editor width + if (!wrapping && cur.text.firstChild) + { width = cur.text.firstChild.getBoundingClientRect().right - box.left - 1; } } var diff = cur.line.height - height; if (height < 2) { height = textHeight(display); } @@ -3278,6 +3293,14 @@ if (cur.rest) { for (var j = 0; j < cur.rest.length; j++) { updateWidgetHeight(cur.rest[j]); } } } + if (width > cm.display.sizerWidth) { + var chWidth = Math.ceil(width / charWidth(cm.display)); + if (chWidth > cm.display.maxLineLength) { + cm.display.maxLineLength = chWidth; + cm.display.maxLine = cur.line; + cm.display.maxLineChanged = true; + } + } } } @@ -5944,7 +5967,8 @@ if (updateMaxLine) { cm.curOp.updateMaxLine = true; } if (marker.collapsed) { regChange(cm, from.line, to.line + 1); } - else if (marker.className || marker.title || marker.startStyle || marker.endStyle || marker.css) + else if (marker.className || marker.startStyle || marker.endStyle || marker.css || + marker.attributes || marker.title) { for (var i = from.line; i <= to.line; i++) { regLineChange(cm, i, "text"); } } if (marker.atomic) { reCheckSelection(cm.doc); } signalLater(cm, "markerAdded", cm, marker); @@ -6562,11 +6586,14 @@ function forEachCodeMirror(f) { if (!document.getElementsByClassName) { return } - var byClass = document.getElementsByClassName("CodeMirror"); + var byClass = document.getElementsByClassName("CodeMirror"), editors = []; for (var i = 0; i < byClass.length; i++) { var cm = byClass[i].CodeMirror; - if (cm) { f(cm); } + if (cm) { editors.push(cm); } } + if (editors.length) { editors[0].operation(function () { + for (var i = 0; i < editors.length; i++) { f(editors[i]); } + }); } } var globalsRegistered = false; @@ -9691,7 +9718,7 @@ addLegacyProps(CodeMirror); - CodeMirror.version = "5.41.0"; + CodeMirror.version = "5.42.0"; return CodeMirror; diff --git a/vendor/codemirror/mode/javascript/javascript.js b/vendor/codemirror/mode/javascript/javascript.js index b0a27ceb..42b4b191 100644 --- a/vendor/codemirror/mode/javascript/javascript.js +++ b/vendor/codemirror/mode/javascript/javascript.js @@ -655,6 +655,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) { if (type == "variable") cx.marked = "property"; if (type == "spread") return cont(pattern); if (type == "}") return pass(); + if (type == "[") return cont(expression, expect(']'), expect(':'), proppattern); return cont(expect(":"), pattern, maybeAssign); } function eltpattern() { diff --git a/vendor/codemirror/theme/darcula.css b/vendor/codemirror/theme/darcula.css index 66729e9d..d4a0b530 100644 --- a/vendor/codemirror/theme/darcula.css +++ b/vendor/codemirror/theme/darcula.css @@ -1,46 +1,51 @@ /** - Name: IntelliJ IDEA darcula theme + Name: IntelliJ IDEA darcula theme From IntelliJ IDEA by JetBrains */ +.cm-s-darcula { font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif;} +.cm-s-darcula.CodeMirror { background: #2B2B2B; color: #A9B7C6; } + .cm-s-darcula span.cm-meta { color: #BBB529; } .cm-s-darcula span.cm-number { color: #6897BB; } -.cm-s-darcula span.cm-keyword { line-height: 1em; font-weight: bold; color: #CC7832; } -.cm-s-darcula span.cm-def { color: #FFC66D; } +.cm-s-darcula span.cm-keyword { color: #CC7832; line-height: 1em; font-weight: bold; } +.cm-s-darcula span.cm-def { color: #A9B7C6; font-style: italic; } .cm-s-darcula span.cm-variable { color: #A9B7C6; } .cm-s-darcula span.cm-variable-2 { color: #A9B7C6; } -.cm-s-darcula span.cm-variable-3, .cm-s-darcula span.cm-type { color: #A9B7C6; } -.cm-s-darcula span.cm-property { color: #A9B7C6; } +.cm-s-darcula span.cm-variable-3 { color: #9876AA; } +.cm-s-darcula span.cm-type { color: #AABBCC; font-weight: bold; } +.cm-s-darcula span.cm-property { color: #FFC66D; } .cm-s-darcula span.cm-operator { color: #A9B7C6; } .cm-s-darcula span.cm-string { color: #6A8759; } .cm-s-darcula span.cm-string-2 { color: #6A8759; } -.cm-s-darcula span.cm-comment { color: #808080; } -.cm-s-darcula span.cm-link { color: #287BDE; } -.cm-s-darcula span.cm-atom { font-weight: bold; color: #CC7832; } +.cm-s-darcula span.cm-comment { color: #61A151; font-style: italic; } +.cm-s-darcula span.cm-link { color: #CC7832; } +.cm-s-darcula span.cm-atom { color: #CC7832; } .cm-s-darcula span.cm-error { color: #BC3F3C; } -.cm-s-darcula span.cm-tag { color: #CC7832; } -.cm-s-darcula span.cm-attribute { color: #6A8759; } +.cm-s-darcula span.cm-tag { color: #629755; font-weight: bold; font-style: italic; text-decoration: underline; } +.cm-s-darcula span.cm-attribute { color: #6897bb; } .cm-s-darcula span.cm-qualifier { color: #6A8759; } .cm-s-darcula span.cm-bracket { color: #A9B7C6; } -.cm-s-darcula.CodeMirror { background: #2B2B2B; color: #A9B7C6; } +.cm-s-darcula span.cm-builtin { color: #FF9E59; } +.cm-s-darcula span.cm-special { color: #FF9E59; } +.cm-s-darcula .CodeMirror-cursor { border-left: 1px solid #A9B7C6; } +.cm-s-darcula .CodeMirror-activeline-background { background: #323232; } +.cm-s-darcula .CodeMirror-gutters { background: #313335; border-right: 1px solid #313335; } +.cm-s-darcula .CodeMirror-guttermarker { color: #FFEE80; } +.cm-s-darcula .CodeMirror-guttermarker-subtle { color: #D0D0D0; } +.cm-s-darcula .CodeMirrir-linenumber { color: #606366; } +.cm-s-darcula .CodeMirror-matchingbracket { background-color: #3B514D; color: #FFEF28 !important; font-weight: bold; } -.cm-s-darcula .CodeMirror-cursor { border-left: 1px solid #dddddd; } -.cm-s-darcula .CodeMirror-activeline-background { background: #3A3A3A; } -.cm-s-darcula div.CodeMirror-selected { background: #085a9c; } -.cm-s-darcula .CodeMirror-gutters { background: rgb(72, 72, 72); border-right: 1px solid grey; color: #606366 } - -.cm-s-darcula span.cm-builtin { color: #A9B7C6; } -.cm-s-darcula { font-family: Consolas, Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace, serif;} -.cm-s-darcula .CodeMirror-matchingbracket { background-color: #3b514d; color: yellow !important; } +.cm-s-darcula div.CodeMirror-selected { background: #214283; } .CodeMirror-hints.darcula { font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; - color: #9c9e9e; - background-color: #3b3e3f !important; + color: #9C9E9E; + background-color: #3B3E3F !important; } .CodeMirror-hints.darcula .CodeMirror-hint-active { - background-color: #494d4e !important; - color: #9c9e9e !important; + background-color: #494D4E !important; + color: #9C9E9E !important; } diff --git a/vendor/usercss-meta/README.md b/vendor/usercss-meta/README.md index 4dde15c1..c3384a3d 100644 --- a/vendor/usercss-meta/README.md +++ b/vendor/usercss-meta/README.md @@ -1,5 +1,5 @@ -## usercss-meta v0.8.4 +## usercss-meta v0.9.0 usercss-meta installed via npm - source repo: -https://unpkg.com/usercss-meta@0.8.4/dist/usercss-meta.min.js +https://unpkg.com/usercss-meta@0.9.0/dist/usercss-meta.min.js diff --git a/vendor/usercss-meta/usercss-meta.min.js b/vendor/usercss-meta/usercss-meta.min.js index 54f804bc..bed5f666 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 m(e){l.lastIndex=e.lastIndex,l.exec(e.text),e.lastIndex=l.lastIndex}function y(e){r.lastIndex=e.lastIndex,e.lastIndex+=r.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 a=e.lastIndex;try{!function e(a){const{text:s}=a;if("{"===s[a.lastIndex]){const n={};for(a.lastIndex++,y(a);"}"!==s[a.lastIndex];){O(a);const l=a.value;if(":"!==s[a.lastIndex])throw new t([":"],a.lastIndex);if(a.lastIndex++,y(a),e(a),n[l]=a.value,","===s[a.lastIndex])a.lastIndex++,y(a);else if("}"!==s[a.lastIndex])throw new t([",","}"],a.lastIndex)}a.lastIndex++,y(a),a.value=n}else if("["===s[a.lastIndex]){const n=[];for(a.lastIndex++,y(a);"]"!==s[a.lastIndex];)if(e(a),n.push(a.value),","===s[a.lastIndex])a.lastIndex++,y(a);else if("]"!==s[a.lastIndex])throw new t([",","]"],a.lastIndex);a.lastIndex++,y(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()),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 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 n=l.exec(e.text);e.index=e.lastIndex,e.value=v(n[0].trim()),e.lastIndex=l.lastIndex}var $={eatLine:m,eatWhitespace:y,parseChar:g,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:g,select:L,dropdown:{advanced:V},image:{var:L,advanced:V},number:J,range:J},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},M=["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++,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 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=M,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({},T,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));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(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 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 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):`<<