From d091d2de28744de89167044a2857bfc35acf51b5 Mon Sep 17 00:00:00 2001 From: cp2004 <31997505+cp2004@users.noreply.github.com> Date: Thu, 31 Dec 2020 12:01:51 +0000 Subject: [PATCH 01/45] :bug: Improve firmware name splitting Marlin includes the build time in it's firmware name, until now the expression split it on the colon, and failed to do it properly. Example format that now works: ``` FIRMWARE_NAME:Marlin 2.0.7.2 (Nov 27 2020 14:30:11) ``` --- src/octoprint/util/comm.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/octoprint/util/comm.py b/src/octoprint/util/comm.py index 00a2e6f13..2045c7e94 100644 --- a/src/octoprint/util/comm.py +++ b/src/octoprint/util/comm.py @@ -182,7 +182,7 @@ Groups will be as follows: * ``value``: reported position value """ -regex_firmware_splitter = re.compile(r"\s*([A-Z0-9_]+):\s*") +regex_firmware_splitter = re.compile(r"\s*([A-Z_]+):\s*") """Regex to use for splitting M115 responses.""" regex_resend_linenumber = re.compile(r"(N|N:)?(?P%s)" % regex_int_pattern) From 96aead40dcec506d07dc0d009ddbd3e58e80c425 Mon Sep 17 00:00:00 2001 From: LazeMSS Date: Tue, 2 Feb 2021 18:03:31 +0100 Subject: [PATCH 02/45] Fixed invalid html for video --- src/octoprint/templates/tabs/control.jinja2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/octoprint/templates/tabs/control.jinja2 b/src/octoprint/templates/tabs/control.jinja2 index 5e3cdfb1e..7f772187b 100644 --- a/src/octoprint/templates/tabs/control.jinja2 +++ b/src/octoprint/templates/tabs/control.jinja2 @@ -1,7 +1,7 @@ {% if enableWebcam %}
-
From 13aa5a4e2581e9f74c892c38dbf330fa0d6b7cc4 Mon Sep 17 00:00:00 2001 From: orel Date: Fri, 5 Feb 2021 16:58:55 +0100 Subject: [PATCH 03/45] Enhance jsclient-socket documentation --- docs/jsclientlib/socket.rst | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/docs/jsclientlib/socket.rst b/docs/jsclientlib/socket.rst index 925528490..7bffa2f54 100644 --- a/docs/jsclientlib/socket.rst +++ b/docs/jsclientlib/socket.rst @@ -64,12 +64,24 @@ Sends a message of type ``type`` with the provided ``payload`` to the server. - Note that at the time of writing, OctoPrint only supports the ``throttle`` message. See + Note that at the time of writing, OctoPrint only supports the ``throttle`` and ``auth`` messages. See also the :ref:`Push API documentation `. :param string type: Type of message to send :param object payload: Payload to send +.. js:function:: OctoPrintClient.socket.sendAuth(userId, session) + + Sends an ``auth`` message with the provided ``userId`` and ``session`` to the server. + + ``session`` is expected to be the ``session`` value retrieved + from any valid :ref:`OctoPrint.browser.login(userId,...) ` response. + + See also the :ref:`Push API documentation `. + + :param string userId: An existing OctoPrint username + :param string session: A valid session id for the provided username + .. js:function:: OctoPrintClient.socket.onRateTooLow(measured, minimum) Called by the socket client when the measured message round trip times have been lower than @@ -102,6 +114,17 @@ Instructs the server to decrease the message rate by 500ms. +Sample to setup an authed socket +================================ + +.. code-block:: javascript + + OctoPrint.socket.connect(); + OctoPrint.browser.login("myusername", "mypassword", true) + .done(function(response) { + client.socket.sendAuth("myusername", response.session); + }); + .. _sec-jsclient-socket-throttling: Communication Throttling From eddc288d9eb9ec9056d1e8f6f65dd9e8034b2dcc Mon Sep 17 00:00:00 2001 From: orel Date: Fri, 5 Feb 2021 17:05:04 +0100 Subject: [PATCH 04/45] Fix typo as there is no instanciated client in the sample... --- docs/jsclientlib/socket.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/jsclientlib/socket.rst b/docs/jsclientlib/socket.rst index 7bffa2f54..70b9bc5dc 100644 --- a/docs/jsclientlib/socket.rst +++ b/docs/jsclientlib/socket.rst @@ -122,7 +122,7 @@ Sample to setup an authed socket OctoPrint.socket.connect(); OctoPrint.browser.login("myusername", "mypassword", true) .done(function(response) { - client.socket.sendAuth("myusername", response.session); + OctoPrint.socket.sendAuth("myusername", response.session); }); .. _sec-jsclient-socket-throttling: From 641a4cdb0051dc82815720127f6589ecf9d9f8e5 Mon Sep 17 00:00:00 2001 From: Orel Date: Fri, 5 Feb 2021 20:46:00 +0100 Subject: [PATCH 05/45] sockJS include when playing with jsclient lib --- docs/jsclientlib/index.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/jsclientlib/index.rst b/docs/jsclientlib/index.rst index 43b734769..4d22e8876 100644 --- a/docs/jsclientlib/index.rst +++ b/docs/jsclientlib/index.rst @@ -40,6 +40,12 @@ because the library depends on those to be available (as ``$`` and ``_``). You c +Moreover, if you need to use the socket module, you'll need to include sockJS. You can embedded it like this: + +.. code-block:: html+jinja + + + Note that all components depend on the ``base`` component to be present, so if you are only including a select number of components, make sure to at the very least include that one to be able to utilize the client. From 9792e1e3ae91d1547470f54336b46bd063afcea2 Mon Sep 17 00:00:00 2001 From: Orel Date: Fri, 5 Feb 2021 20:51:33 +0100 Subject: [PATCH 06/45] Fix my bad english... --- docs/jsclientlib/index.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/jsclientlib/index.rst b/docs/jsclientlib/index.rst index 4d22e8876..280b3c241 100644 --- a/docs/jsclientlib/index.rst +++ b/docs/jsclientlib/index.rst @@ -40,7 +40,7 @@ because the library depends on those to be available (as ``$`` and ``_``). You c -Moreover, if you need to use the socket module, you'll need to include sockJS. You can embedded it like this: +Moreover, if you need to use the socket module, you'll need to include sockJS. You can embed it like this: .. code-block:: html+jinja From 2913eb5fd81a555dc1c3103bb689b37d35647327 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Mon, 8 Feb 2021 14:21:39 +0100 Subject: [PATCH 07/45] =?UTF-8?q?=F0=9F=A5=85=20Only=20minify=20non-minifi?= =?UTF-8?q?ed=20JS?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If the file ends on ".min.js" we'll keep our hands off of it. Closes #4007 --- src/octoprint/server/__init__.py | 10 ++++++---- src/octoprint/server/util/webassets.py | 17 +++++++++++++++++ 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/src/octoprint/server/__init__.py b/src/octoprint/server/__init__.py index 004646f81..2e730506c 100644 --- a/src/octoprint/server/__init__.py +++ b/src/octoprint/server/__init__.py @@ -2066,6 +2066,7 @@ class Server(object): JsDelimiterBundler, JsPluginBundle, LessImportRewrite, + RJSMinExtended, SourceMapRemove, SourceMapRewrite, ) @@ -2075,6 +2076,7 @@ class Server(object): register_filter(SourceMapRemove) register_filter(JsDelimiterBundler) register_filter(GzipFile) + register_filter(RJSMinExtended) def all_assets_for_plugins(collection): """Gets all plugin assets for a dict of plugin->assets""" @@ -2085,16 +2087,16 @@ class Server(object): # -- JS -------------------------------------------------------------------------------------------------------- - filters = ["sourcemap_remove", "js_delimiter_bundler"] + filters = ["sourcemap_remove"] if self._settings.getBoolean(["devel", "webassets", "minify"]): - filters.append("rjsmin") - filters.append("gzip") + filters += ["rjsmin_extended"] + filters += ["js_delimiter_bundler", "gzip"] js_filters = filters if self._settings.getBoolean(["devel", "webassets", "minify_plugins"]): js_plugin_filters = js_filters else: - js_plugin_filters = [x for x in js_filters if x not in ("rjsmin",)] + js_plugin_filters = [x for x in js_filters if x not in ("rjsmin_extended",)] def js_bundles_for_plugins(collection, filters=None): """Produces JsPluginBundle instances that output IIFE wrapped assets""" diff --git a/src/octoprint/server/util/webassets.py b/src/octoprint/server/util/webassets.py index da50f5309..2c44b1ea7 100644 --- a/src/octoprint/server/util/webassets.py +++ b/src/octoprint/server/util/webassets.py @@ -19,6 +19,7 @@ import webassets.filter.cssrewrite.urlpath as urlpath from webassets.bundle import Bundle from webassets.filter import Filter from webassets.filter.cssrewrite.base import PatternRewriter +from webassets.filter.rjsmin import rjsmin from webassets.merge import BaseHunk, MemoryHunk @@ -105,6 +106,22 @@ class JsDelimiterBundler(Filter): out.write("\n;\n") +class RJSMinExtended(Filter): + name = "rjsmin_extended" + options = { + "keep_bang_comments": "RJSMIN_KEEP_BANG_COMMENTS", + } + + def input(self, _in, out, **kw): + source = kw["source"] + if source.endswith(".min.js"): + # out.write("// source is already minified, not minifying again\n") + out.write(_in.read()) + else: + keep = self.keep_bang_comments or False + out.write(rjsmin.jsmin(_in.read(), keep_bang_comments=keep)) + + class GzipFile(Filter): name = "gzip" options = {} From a9ea150b927db7d0a275ece9103218eab3e9bfa2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Mon, 8 Feb 2021 18:13:30 +0100 Subject: [PATCH 08/45] =?UTF-8?q?=F0=9F=A5=85=20Add=20eslint=20with=20ES5?= =?UTF-8?q?=20enforcement?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Make sure our core JS files stay ES5 compatible. Alternatively we could find a way run them through babel first, initial experiments with dukpy have sadly resulted in a blocked server, so far no clue why. Related to #3920 --- .eslintignore | 1 + .eslintrc.yaml | 22 ++++++++++++++++ .github/workflows/build.yml | 51 ++++++++++++++++++++++++------------- .pre-commit-config.yaml | 6 +++++ 4 files changed, 63 insertions(+), 17 deletions(-) create mode 100644 .eslintignore create mode 100644 .eslintrc.yaml diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 000000000..677061a2d --- /dev/null +++ b/.eslintignore @@ -0,0 +1 @@ +tests/cypress/** diff --git a/.eslintrc.yaml b/.eslintrc.yaml new file mode 100644 index 000000000..1f35d73ef --- /dev/null +++ b/.eslintrc.yaml @@ -0,0 +1,22 @@ +env: + browser: true + jquery: true +parserOptions: + ecmaVersion: 5 +rules: {} +overrides: + - files: + - "src/octoprint/static/js/app/**" + rules: + es5/no-block-scoping: error + es5/no-arrow-functions: error + es5/no-default-parameters: error + es5/no-rest-parameters: error + es5/no-spread: error + es5/no-destructuring: error + es5/no-for-of: error + es5/no-generators: error + es5/no-template-literals: error + +plugins: + - eslint-plugin-es5 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ee710bab7..d0ac38df5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -46,22 +46,6 @@ jobs: run: | pre-commit run --hook-stage manual black --all-files --show-diff-on-failure - lint-prettier: - name: ๐Ÿงน prettier - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: ๐Ÿ— Set up Python 3.7 - uses: actions/setup-python@v1 - with: - python-version: 3.7 - - name: ๐Ÿ— Set up dev dependencies - run: | - pip install -e .[develop] - - name: ๐Ÿš€ Run prettier - run: | - pre-commit run --hook-stage manual prettier --all-files --show-diff-on-failure - lint-isort: name: ๐Ÿงน isort runs-on: ubuntu-latest @@ -94,6 +78,38 @@ jobs: run: | pre-commit run --hook-stage manual flake8 --all-files + lint-prettier: + name: ๐Ÿงน prettier + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: ๐Ÿ— Set up Python 3.7 + uses: actions/setup-python@v1 + with: + python-version: 3.7 + - name: ๐Ÿ— Set up dev dependencies + run: | + pip install -e .[develop] + - name: ๐Ÿš€ Run prettier + run: | + pre-commit run --hook-stage manual prettier --all-files --show-diff-on-failure + + lint-eslint: + name: ๐Ÿงน eslint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: ๐Ÿ— Set up Python 3.7 + uses: actions/setup-python@v1 + with: + python-version: 3.7 + - name: ๐Ÿ— Set up dev dependencies + run: | + pip install -e .[develop] + - name: ๐Ÿš€ Run eslint + run: | + pre-commit run --hook-stage manual eslint --all-files + test-unit: name: ๐Ÿงช Unit tests strategy: @@ -192,9 +208,10 @@ jobs: if: github.event_name == 'release' needs: - lint-black - - lint-prettier - lint-isort - lint-flake8 + - lint-prettier + - lint-eslint - test-unit - test-install - test-e2e diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ea54569cb..2202e8a22 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -42,3 +42,9 @@ repos: rev: v2.1.2 hooks: - id: prettier + - repo: https://github.com/pre-commit/mirrors-eslint + rev: v7.19.0 + hooks: + - id: eslint + additional_dependencies: + - eslint-plugin-es5@v1.3.0 From 473d72f5165520cf79594141876428152651e9be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Mon, 8 Feb 2021 18:13:58 +0100 Subject: [PATCH 09/45] =?UTF-8?q?=F0=9F=97=91=20Better=20backwards=20compa?= =?UTF-8?q?tibility=20with=20ancient=20browsers?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added an ES6 polyfill, fixed some minor issues in less.js, put less.js into lib bundle again. Further steps should be taken to ensure the core JS files stay ES5 compliant with regards to the use of arrow functions, let, const and so on, at least the versions bundled into the webassets. Closes #3920 --- THIRDPARTYLICENSES.md | 1 + src/octoprint/server/__init__.py | 2 + .../static/js/lib/babel-polyfill.min.js | 6 + src/octoprint/static/js/lib/less.js | 11277 ++++++++++++++++ src/octoprint/static/js/lib/less.min.js | 11 - .../templates/stylesheets-preload.jinja2 | 2 +- src/octoprint/templates/stylesheets.jinja2 | 1 - 7 files changed, 11287 insertions(+), 13 deletions(-) create mode 100644 src/octoprint/static/js/lib/babel-polyfill.min.js create mode 100644 src/octoprint/static/js/lib/less.js delete mode 100644 src/octoprint/static/js/lib/less.min.js diff --git a/THIRDPARTYLICENSES.md b/THIRDPARTYLICENSES.md index f3c0cb7f9..80556b1cb 100644 --- a/THIRDPARTYLICENSES.md +++ b/THIRDPARTYLICENSES.md @@ -4,6 +4,7 @@ * [AVLTree](https://gist.github.com/viking/2424106) (modified): GPL, LGPL (dual licensed) * [Babel JavaScript Support](https://github.com/mitsuhiko/babel/blob/master/contrib/babel.js): BSD + * [@babel/polyfill](https://babeljs.io/docs/en/babel-polyfill/): MIT * [Bootstrap](http://getbootstrap.com/): Apache License 2.0 * [Bootstrap Modal](http://jschr.github.io/bootstrap-modal/): Apache License 2.0 * [Bootstrap Slider Knockout Binding](https://github.com/cosminstefanxp/bootstrap-slider-knockout-binding): MIT diff --git a/src/octoprint/server/__init__.py b/src/octoprint/server/__init__.py index 2e730506c..c1adc7451 100644 --- a/src/octoprint/server/__init__.py +++ b/src/octoprint/server/__init__.py @@ -1979,6 +1979,7 @@ class Server(object): ) js_libs = [ + "js/lib/babel-polyfill.min.js", "js/lib/jquery/jquery.min.js", "js/lib/modernizr.custom.js", "js/lib/lodash.min.js", @@ -2022,6 +2023,7 @@ class Server(object): "js/lib/sockjs.min.js", "js/lib/ResizeSensor.js", "js/lib/hls.js", + "js/lib/less.js", ] js_client = [ "js/app/client/base.js", diff --git a/src/octoprint/static/js/lib/babel-polyfill.min.js b/src/octoprint/static/js/lib/babel-polyfill.min.js new file mode 100644 index 000000000..7bb27e000 --- /dev/null +++ b/src/octoprint/static/js/lib/babel-polyfill.min.js @@ -0,0 +1,6 @@ +/* + * @babel/polyfill + * license: MIT + * source: https://cdnjs.cloudflare.com/ajax/libs/babel-polyfill/7.12.1/polyfill.min.js + */ +!function r(c,a,f){function o(n,t){if(!a[n]){if(!c[n]){var e="function"==typeof require&&require;if(!t&&e)return e(n,!0);if(s)return s(n,!0);var i=new Error("Cannot find module '"+n+"'");throw i.code="MODULE_NOT_FOUND",i}var u=a[n]={exports:{}};c[n][0].call(u.exports,function(t){return o(c[n][1][t]||t)},u,u.exports,r,c,a,f)}return a[n].exports}for(var s="function"==typeof require&&require,t=0;tu;)o.call(t,e=i[u++])&&n.push(e);return n}},{102:102,105:105,106:106}],60:[function(t,n,r){var g=t(68),y=t(50),d=t(70),x=t(116),m=t(52),S="prototype",b=function(t,n,r){var e,i,o,u,c=t&b.F,a=t&b.G,f=t&b.S,s=t&b.P,l=t&b.B,h=a?g:f?g[n]||(g[n]={}):(g[n]||{})[S],p=a?y:y[n]||(y[n]={}),v=p[S]||(p[S]={});for(e in a&&(r=n),r)o=((i=!c&&h&&void 0!==h[e])?h:r)[e],u=l&&i?m(o,g):s&&"function"==typeof o?m(Function.call,o):o,h&&x(h,e,o,t&b.U),p[e]!=o&&d(p,e,u),s&&v[e]!=o&&(v[e]=o)};g.core=y,b.F=1,b.G=2,b.S=4,b.P=8,b.B=16,b.W=32,b.U=64,b.R=128,n.exports=b},{116:116,50:50,52:52,68:68,70:70}],61:[function(t,n,r){var e=t(150)("match");n.exports=function(n){var r=/./;try{"/./"[n](r)}catch(t){try{return r[e]=!1,!"/./"[n](r)}catch(t){}}return!0}},{150:150}],62:[function(t,n,r){arguments[4][21][0].apply(r,arguments)},{21:21}],63:[function(t,n,r){"use strict";t(246);var s=t(116),l=t(70),h=t(62),p=t(55),v=t(150),g=t(118),y=v("species"),d=!h(function(){var t=/./;return t.exec=function(){var t=[];return t.groups={a:"7"},t},"7"!=="".replace(t,"$")}),x=function(){var t=/(?:)/,n=t.exec;t.exec=function(){return n.apply(this,arguments)};var r="ab".split(t);return 2===r.length&&"a"===r[0]&&"b"===r[1]}();n.exports=function(r,t,n){var e=v(r),o=!h(function(){var t={};return t[e]=function(){return 7},7!=""[r](t)}),i=o?!h(function(){var t=!1,n=/a/;return n.exec=function(){return t=!0,null},"split"===r&&(n.constructor={},n.constructor[y]=function(){return n}),n[e](""),!t}):void 0;if(!o||!i||"replace"===r&&!d||"split"===r&&!x){var u=/./[e],c=n(p,e,""[r],function maybeCallNative(t,n,r,e,i){return n.exec===g?o&&!i?{done:!0,value:u.call(n,r,e)}:{done:!0,value:t.call(r,n,e)}:{done:!1}}),a=c[0],f=c[1];s(String.prototype,r,a),l(RegExp.prototype,e,2==t?function(t,n){return f.call(t,this,n)}:function(t){return f.call(t,this)})}}},{116:116,118:118,150:150,246:246,55:55,62:62,70:70}],64:[function(t,n,r){"use strict";var e=t(36);n.exports=function(){var t=e(this),n="";return t.global&&(n+="g"),t.ignoreCase&&(n+="i"),t.multiline&&(n+="m"),t.unicode&&(n+="u"),t.sticky&&(n+="y"),n}},{36:36}],65:[function(t,n,r){"use strict";var p=t(77),v=t(79),g=t(139),y=t(52),d=t(150)("isConcatSpreadable");n.exports=function flattenIntoArray(t,n,r,e,i,o,u,c){for(var a,f,s=i,l=0,h=!!u&&y(u,c,3);ldocument.F=Object<\/script>"),t.close(),f=t.F;r--;)delete f[a][u[r]];return f()};t.exports=Object.create||function create(t,n){var r;return null!==t?(Hq[a]=i(t),r=new Hq,Hq[a]=null,r[c]=t):r=f(),void 0===n?r:o(r,n)}},{123:123,36:36,57:57,58:58,71:71,98:98}],97:[function(t,n,r){arguments[4][27][0].apply(r,arguments)},{141:141,27:27,36:36,56:56,72:72}],98:[function(t,n,r){var u=t(97),c=t(36),a=t(105);n.exports=t(56)?Object.defineProperties:function defineProperties(t,n){c(t);for(var r,e=a(n),i=e.length,o=0;oi;)u(e,r=n[i++])&&(~a(o,r)||o.push(r));return o}},{123:123,138:138,39:39,69:69}],105:[function(t,n,r){var e=t(104),i=t(58);n.exports=Object.keys||function keys(t){return e(t,i)}},{104:104,58:58}],106:[function(t,n,r){r.f={}.propertyIsEnumerable},{}],107:[function(t,n,r){var i=t(60),o=t(50),u=t(62);n.exports=function(t,n){var r=(o.Object||{})[t]||Object[t],e={};e[t]=n(r),i(i.S+i.F*u(function(){r(1)}),"Object",e)}},{50:50,60:60,62:62}],108:[function(t,n,r){var a=t(56),f=t(105),s=t(138),l=t(106).f;n.exports=function(c){return function(t){for(var n,r=s(t),e=f(r),i=e.length,o=0,u=[];o>>0||(u.test(r)?16:10))}:e},{132:132,133:133,68:68}],112:[function(t,n,r){n.exports=function(t){try{return{e:!1,v:t()}}catch(t){return{e:!0,v:t}}}},{}],113:[function(t,n,r){var e=t(36),i=t(79),o=t(94);n.exports=function(t,n){if(e(t),i(n)&&n.constructor===t)return n;var r=o.f(t);return(0,r.resolve)(n),r.promise}},{36:36,79:79,94:94}],114:[function(t,n,r){arguments[4][28][0].apply(r,arguments)},{28:28}],115:[function(t,n,r){var i=t(116);n.exports=function(t,n,r){for(var e in n)i(t,e,n[e],r);return t}},{116:116}],116:[function(t,n,r){var o=t(68),u=t(70),c=t(69),a=t(145)("src"),e=t(67),i="toString",f=(""+e).split(i);t(50).inspectSource=function(t){return e.call(t)},(n.exports=function(t,n,r,e){var i="function"==typeof r;i&&(c(r,"name")||u(r,"name",n)),t[n]!==r&&(i&&(c(r,a)||u(r,a,t[n]?""+t[n]:f.join(String(n)))),t===o?t[n]=r:e?t[n]?t[n]=r:u(t,n,r):(delete t[n],u(t,n,r)))})(Function.prototype,i,function toString(){return"function"==typeof this&&this[a]||e.call(this)})},{145:145,50:50,67:67,68:68,69:69,70:70}],117:[function(t,n,r){"use strict";var i=t(45),o=RegExp.prototype.exec;n.exports=function(t,n){var r=t.exec;if("function"==typeof r){var e=r.call(t,n);if("object"!=typeof e)throw new TypeError("RegExp exec method returned something other than an Object or null");return e}if("RegExp"!==i(t))throw new TypeError("RegExp#exec called on incompatible receiver");return o.call(t,n)}},{45:45}],118:[function(t,n,r){"use strict";var e,i,u=t(64),c=RegExp.prototype.exec,a=String.prototype.replace,o=c,f="lastIndex",s=(e=/a/,i=/b*/g,c.call(e,"a"),c.call(i,"a"),0!==e[f]||0!==i[f]),l=void 0!==/()??/.exec("")[1];(s||l)&&(o=function exec(t){var n,r,e,i,o=this;return l&&(r=new RegExp("^"+o.source+"$(?!\\s)",u.call(o))),s&&(n=o[f]),e=c.call(o,t),s&&e&&(o[f]=o.global?e.index+e[0].length:n),l&&e&&1"+i+""}var e=t(60),i=t(62),u=t(55),c=/"/g;n.exports=function(n,t){var r={};r[n]=t(sw),e(e.P+e.F*i(function(){var t=""[n]('"');return t!==t.toLowerCase()||3a&&(f=f.slice(0,a)),e?f+i:i+f}},{131:131,139:139,55:55}],131:[function(t,n,r){"use strict";var i=t(137),o=t(55);n.exports=function repeat(t){var n=String(o(this)),r="",e=i(t);if(e<0||e==1/0)throw RangeError("Count can't be negative");for(;0>>=1)&&(n+=n))1&e&&(r+=n);return r}},{137:137,55:55}],132:[function(t,n,r){function lx(t,n,r){var e={},i=c(function(){return!!a[t]()||"โ€‹ย…"!="โ€‹ย…"[t]()}),o=e[t]=i?n(s):a[t];r&&(e[r]=o),u(u.P+u.F*i,"String",e)}var u=t(60),e=t(55),c=t(62),a=t(133),i="["+a+"]",o=RegExp("^"+i+i+"*"),f=RegExp(i+i+"*$"),s=lx.trim=function(t,n){return t=String(e(t)),1&n&&(t=t.replace(o,"")),2&n&&(t=t.replace(f,"")),t};n.exports=lx},{133:133,55:55,60:60,62:62}],133:[function(t,n,r){n.exports="\t\n\v\f\r แš€แ Žโ€€โ€โ€‚โ€ƒโ€„โ€…โ€†โ€‡โ€ˆโ€‰โ€Šโ€ฏโŸใ€€\u2028\u2029\ufeff"},{}],134:[function(t,n,r){function Rx(){var t=+this;if(d.hasOwnProperty(t)){var n=d[t];delete d[t],n()}}function Sx(t){Rx.call(t.data)}var e,i,o,u=t(52),c=t(74),a=t(71),f=t(57),s=t(68),l=s.process,h=s.setImmediate,p=s.clearImmediate,v=s.MessageChannel,g=s.Dispatch,y=0,d={},x="onreadystatechange";h&&p||(h=function setImmediate(t){for(var n=[],r=1;r>1,s=23===n?A(2,-24)-A(2,-77):0,l=0,h=t<0||0===t&&1/t<0?1:0;for((t=P(t))!=t||t===I?(i=t!=t?1:0,e=a):(e=M(k(t)/R),t*(o=A(2,-e))<1&&(e--,o*=2),2<=(t+=1<=e+f?s/o:s*A(2,1-f))*o&&(e++,o/=2),a<=e+f?(i=0,e=a):1<=e+f?(i=(t*o-1)*A(2,n),e+=f):(i=t*A(2,f-1)*A(2,n),e=0));8<=n;u[l++]=255&i,i/=256,n-=8);for(e=e<>1,c=i-7,a=r-1,f=t[a--],s=127&f;for(f>>=7;0>=-c,c+=n;0>8&255]}function packI32(t){return[255&t,t>>8&255,t>>16&255,t>>24&255]}function packF64(t){return packIEEE754(t,52,8)}function packF32(t){return packIEEE754(t,23,4)}function addGetter(t,n,r){g(t[S],n,{get:function(){return this[r]}})}function get(t,n,r,e){var i=p(+r);if(i+n>t[L])throw O(b);var o=t[T]._b,u=i+t[C],c=o.slice(u,u+n);return e?c:c.reverse()}function set(t,n,r,e,i,o){var u=p(+r);if(u+n>t[L])throw O(b);for(var c=t[T]._b,a=u+t[C],f=e(+i),s=0;sW;)(G=D[W++])in w||c(w,G,F[G]);o||(U.constructor=w)}var V=new _(new w(2)),B=_[S].setInt8;V.setInt8(0,2147483648),V.setInt8(1,2147483649),!V.getInt8(0)&&V.getInt8(1)||a(_[S],{setInt8:function setInt8(t,n){B.call(this,t,n<<24>>24)},setUint8:function setUint8(t,n){B.call(this,t,n<<24>>24)}},!0)}else w=function ArrayBuffer(t){s(this,w,x);var n=p(t);this._b=y.call(new Array(n),0),this[L]=n},_=function DataView(t,n,r){s(this,_,m),s(t,w,m);var e=t[L],i=l(n);if(i<0||e>24},getUint8:function getUint8(t){return get(this,1,t)[0]},getInt16:function getInt16(t){var n=get(this,2,t,arguments[1]);return(n[1]<<8|n[0])<<16>>16},getUint16:function getUint16(t){var n=get(this,2,t,arguments[1]);return n[1]<<8|n[0]},getInt32:function getInt32(t){return unpackI32(get(this,4,t,arguments[1]))},getUint32:function getUint32(t){return unpackI32(get(this,4,t,arguments[1]))>>>0},getFloat32:function getFloat32(t){return unpackIEEE754(get(this,4,t,arguments[1]),23,4)},getFloat64:function getFloat64(t){return unpackIEEE754(get(this,8,t,arguments[1]),52,8)},setInt8:function setInt8(t,n){set(this,1,t,packI8,n)},setUint8:function setUint8(t,n){set(this,1,t,packI8,n)},setInt16:function setInt16(t,n){set(this,2,t,packI16,n,arguments[2])},setUint16:function setUint16(t,n){set(this,2,t,packI16,n,arguments[2])},setInt32:function setInt32(t,n){set(this,4,t,packI32,n,arguments[2])},setUint32:function setUint32(t,n){set(this,4,t,packI32,n,arguments[2])},setFloat32:function setFloat32(t,n){set(this,4,t,packF32,n,arguments[2])},setFloat64:function setFloat64(t,n){set(this,8,t,packF64,n,arguments[2])}});d(w,x),d(_,m),c(_[S],u.VIEW,!0),r[x]=w,r[m]=_},{101:101,115:115,122:122,136:136,137:137,139:139,144:144,35:35,38:38,56:56,62:62,68:68,70:70,87:87,97:97}],144:[function(t,n,r){for(var e,i=t(68),o=t(70),u=t(145),c=u("typed_array"),a=u("view"),f=!(!i.ArrayBuffer||!i.DataView),s=f,l=0,h="Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array".split(",");l<9;)(e=i[h[l++]])?(o(e.prototype,c,!0),o(e.prototype,a,!0)):s=!1;n.exports={ABV:f,CONSTR:s,TYPED:c,VIEW:a}},{145:145,68:68,70:70}],145:[function(t,n,r){var e=0,i=Math.random();n.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++e+i).toString(36))}},{}],146:[function(t,n,r){var e=t(68).navigator;n.exports=e&&e.userAgent||""},{68:68}],147:[function(t,n,r){var e=t(79);n.exports=function(t,n){if(!e(t)||t._t!==n)throw TypeError("Incompatible receiver, "+n+" required!");return t}},{79:79}],148:[function(t,n,r){var e=t(68),i=t(50),o=t(87),u=t(149),c=t(97).f;n.exports=function(t){var n=i.Symbol||(i.Symbol=o?{}:e.Symbol||{});"_"==t.charAt(0)||t in n||c(n,t,{value:u.f(t)})}},{149:149,50:50,68:68,87:87,97:97}],149:[function(t,n,r){r.f=t(150)},{150:150}],150:[function(t,n,r){var e=t(124)("wks"),i=t(145),o=t(68).Symbol,u="function"==typeof o;(n.exports=function(t){return e[t]||(e[t]=u&&o[t]||(u?o:i)("Symbol."+t))}).store=e},{124:124,145:145,68:68}],151:[function(t,n,r){var e=t(45),i=t(150)("iterator"),o=t(86);n.exports=t(50).getIteratorMethod=function(t){if(null!=t)return t[i]||t["@@iterator"]||o[e(t)]}},{150:150,45:45,50:50,86:86}],152:[function(t,n,r){var e=t(60);e(e.P,"Array",{copyWithin:t(37)}),t(33)("copyWithin")},{33:33,37:37,60:60}],153:[function(t,n,r){"use strict";var e=t(60),i=t(40)(4);e(e.P+e.F*!t(126)([].every,!0),"Array",{every:function every(t){return i(this,t,arguments[1])}})},{126:126,40:40,60:60}],154:[function(t,n,r){var e=t(60);e(e.P,"Array",{fill:t(38)}),t(33)("fill")},{33:33,38:38,60:60}],155:[function(t,n,r){"use strict";var e=t(60),i=t(40)(2);e(e.P+e.F*!t(126)([].filter,!0),"Array",{filter:function filter(t){return i(this,t,arguments[1])}})},{126:126,40:40,60:60}],156:[function(t,n,r){"use strict";var e=t(60),i=t(40)(6),o="findIndex",u=!0;o in[]&&Array(1)[o](function(){u=!1}),e(e.P+e.F*u,"Array",{findIndex:function findIndex(t){return i(this,t,1=t.length?(this._t=void 0,i(1)):i(0,"keys"==n?r:"values"==n?t[r]:[r,t[r]])},"values"),o.Arguments=o.Array,e("keys"),e("values"),e("entries")},{138:138,33:33,83:83,85:85,86:86}],163:[function(t,n,r){"use strict";var e=t(60),i=t(138),o=[].join;e(e.P+e.F*(t(75)!=Object||!t(126)(o)),"Array",{join:function join(t){return o.call(i(this),void 0===t?",":t)}})},{126:126,138:138,60:60,75:75}],164:[function(t,n,r){"use strict";var e=t(60),i=t(138),o=t(137),u=t(139),c=[].lastIndexOf,a=!!c&&1/[1].lastIndexOf(1,-0)<0;e(e.P+e.F*(a||!t(126)(c)),"Array",{lastIndexOf:function lastIndexOf(t){if(a)return c.apply(this,arguments)||0;var n=i(this),r=u(n.length),e=r-1;for(1>>=0)?31-Math.floor(Math.log(t+.5)*Math.LOG2E):32}})},{60:60}],187:[function(t,n,r){var e=t(60),i=Math.exp;e(e.S,"Math",{cosh:function cosh(t){return(i(t=+t)+i(-t))/2}})},{60:60}],188:[function(t,n,r){var e=t(60),i=t(88);e(e.S+e.F*(i!=Math.expm1),"Math",{expm1:i})},{60:60,88:88}],189:[function(t,n,r){var e=t(60);e(e.S,"Math",{fround:t(89)})},{60:60,89:89}],190:[function(t,n,r){var e=t(60),a=Math.abs;e(e.S,"Math",{hypot:function hypot(t,n){for(var r,e,i=0,o=0,u=arguments.length,c=0;o>>16)*u+o*(r&i>>>16)<<16>>>0)}})},{60:60,62:62}],192:[function(t,n,r){var e=t(60);e(e.S,"Math",{log10:function log10(t){return Math.log(t)*Math.LOG10E}})},{60:60}],193:[function(t,n,r){var e=t(60);e(e.S,"Math",{log1p:t(90)})},{60:60,90:90}],194:[function(t,n,r){var e=t(60);e(e.S,"Math",{log2:function log2(t){return Math.log(t)/Math.LN2}})},{60:60}],195:[function(t,n,r){var e=t(60);e(e.S,"Math",{sign:t(91)})},{60:60,91:91}],196:[function(t,n,r){var e=t(60),i=t(88),o=Math.exp;e(e.S+e.F*t(62)(function(){return-2e-17!=!Math.sinh(-2e-17)}),"Math",{sinh:function sinh(t){return Math.abs(t=+t)<1?(i(t)-i(-t))/2:(o(t-1)-o(-t-1))*(Math.E/2)}})},{60:60,62:62,88:88}],197:[function(t,n,r){var e=t(60),i=t(88),o=Math.exp;e(e.S,"Math",{tanh:function tanh(t){var n=i(t=+t),r=i(-t);return n==1/0?1:r==1/0?-1:(n-r)/(o(t)+o(-t))}})},{60:60,88:88}],198:[function(t,n,r){var e=t(60);e(e.S,"Math",{trunc:function trunc(t){return(0b;b++)i(g,m=S[b])&&!i(v,m)&&l(v,m,f(g,m));(v.prototype=y).constructor=v,t(116)(e,p,v)}},{101:101,116:116,132:132,141:141,46:46,56:56,62:62,68:68,69:69,73:73,96:96,97:97,99:99}],200:[function(t,n,r){var e=t(60);e(e.S,"Number",{EPSILON:Math.pow(2,-52)})},{60:60}],201:[function(t,n,r){var e=t(60),i=t(68).isFinite;e(e.S,"Number",{isFinite:function isFinite(t){return"number"==typeof t&&i(t)}})},{60:60,68:68}],202:[function(t,n,r){var e=t(60);e(e.S,"Number",{isInteger:t(78)})},{60:60,78:78}],203:[function(t,n,r){var e=t(60);e(e.S,"Number",{isNaN:function isNaN(t){return t!=t}})},{60:60}],204:[function(t,n,r){var e=t(60),i=t(78),o=Math.abs;e(e.S,"Number",{isSafeInteger:function isSafeInteger(t){return i(t)&&o(t)<=9007199254740991}})},{60:60,78:78}],205:[function(t,n,r){var e=t(60);e(e.S,"Number",{MAX_SAFE_INTEGER:9007199254740991})},{60:60}],206:[function(t,n,r){var e=t(60);e(e.S,"Number",{MIN_SAFE_INTEGER:-9007199254740991})},{60:60}],207:[function(t,n,r){var e=t(60),i=t(110);e(e.S+e.F*(Number.parseFloat!=i),"Number",{parseFloat:i})},{110:110,60:60}],208:[function(t,n,r){var e=t(60),i=t(111);e(e.S+e.F*(Number.parseInt!=i),"Number",{parseInt:i})},{111:111,60:60}],209:[function(t,n,r){"use strict";function PO(t,n){for(var r=-1,e=n;++r<6;)e+=t*u[r],u[r]=e%1e7,e=o(e/1e7)}function QO(t){for(var n=6,r=0;0<=--n;)r+=u[n],u[n]=o(r/t),r=r%t*1e7}function RO(){for(var t=6,n="";0<=--t;)if(""!==n||0===t||0!==u[t]){var r=String(u[t]);n=""===n?r:n+l.call("0",7-r.length)+r}return n}var e=t(60),f=t(137),s=t(32),l=t(131),i=1..toFixed,o=Math.floor,u=[0,0,0,0,0,0],h="Number.toFixed: incorrect invocation!",p=function(t,n,r){return 0===n?r:n%2==1?p(t,n-1,r*t):p(t*t,n/2,r)};e(e.P+e.F*(!!i&&("0.000"!==8e-5.toFixed(3)||"1"!==.9.toFixed(0)||"1.25"!==1.255.toFixed(2)||"1000000000000000128"!==(0xde0b6b3a7640080).toFixed(0))||!t(62)(function(){i.call({})})),"Number",{toFixed:function toFixed(t){var n,r,e,i,o=s(this,h),u=f(t),c="",a="0";if(u<0||20t;)n(e[t++]);s._c=[],s._n=!1,r&&!s._h&&R(s)})}}function cS(t){var n=this;n._d||(n._d=!0,(n=n._w||n)._v=t,n._s=2,n._a||(n._a=n._c.slice()),$R(n,!0))}var e,i,o,u,c=r(87),a=r(68),f=r(52),s=r(45),l=r(60),h=r(79),p=r(31),v=r(35),g=r(66),y=r(125),d=r(134).set,x=r(93)(),m=r(94),S=r(112),b=r(146),w=r(113),_="Promise",E=a.TypeError,O=a.process,I=O&&O.versions,F=I&&I.v8||"",P=a[_],A="process"==s(O),M=i=m.f,k=!!function(){try{var t=P.resolve(1),n=(t.constructor={})[r(150)("species")]=function(t){t(SR,SR)};return(A||"function"==typeof PromiseRejectionEvent)&&t.then(SR)instanceof n&&0!==F.indexOf("6.6")&&-1===b.indexOf("Chrome/66")}catch(t){}}(),R=function(o){d.call(a,function(){var t,n,r,e=o._v,i=N(o);if(i&&(t=S(function(){A?O.emit("unhandledRejection",e,o):(n=a.onunhandledrejection)?n({promise:o,reason:e}):(r=a.console)&&r.error&&r.error("Unhandled promise rejection",e)}),o._h=A||N(o)?2:1),o._a=void 0,i&&t.e)throw t.v})},N=function(t){return 1!==t._h&&0===(t._a||t._c).length},j=function(n){d.call(a,function(){var t;A?O.emit("rejectionHandled",n):(t=a.onrejectionhandled)&&t({promise:n,reason:n._v})})},T=function(t){var r,e=this;if(!e._d){e._d=!0,e=e._w||e;try{if(e===t)throw E("Promise can't be resolved itself");(r=ZR(t))?x(function(){var n={_w:e,_d:!1};try{r.call(t,f(T,n,1),f(cS,n,1))}catch(t){cS.call(n,t)}}):(e._v=t,e._s=1,$R(e,!1))}catch(t){cS.call({_w:e,_d:!1},t)}}};k||(P=function Promise(t){v(this,P,_,"_h"),p(t),e.call(this);try{t(f(T,this,1),f(cS,this,1))}catch(t){cS.call(this,t)}},(e=function Promise(t){this._c=[],this._a=void 0,this._s=0,this._d=!1,this._v=void 0,this._h=0,this._n=!1}).prototype=r(115)(P.prototype,{then:function then(t,n){var r=M(y(this,P));return r.ok="function"!=typeof t||t,r.fail="function"==typeof n&&n,r.domain=A?O.domain:void 0,this._c.push(r),this._a&&this._a.push(r),this._s&&$R(this,!1),r.promise},catch:function(t){return this.then(void 0,t)}}),o=function(){var t=new e;this.promise=t,this.resolve=f(T,t,1),this.reject=f(cS,t,1)},m.f=M=function(t){return t===P||t===u?new o(t):i(t)}),l(l.G+l.W+l.F*!k,{Promise:P}),r(122)(P,_),r(121)(_),u=r(50)[_],l(l.S+l.F*!k,_,{reject:function reject(t){var n=M(this);return(0,n.reject)(t),n.promise}}),l(l.S+l.F*(c||!k),_,{resolve:function resolve(t){return w(c&&this===u?P:this,t)}}),l(l.S+l.F*!(k&&r(84)(function(t){P.all(t).catch(SR)})),_,{all:function all(t){var u=this,n=M(u),c=n.resolve,a=n.reject,r=S(function(){var e=[],i=0,o=1;g(t,!1,function(t){var n=i++,r=!1;e.push(void 0),o++,u.resolve(t).then(function(t){r||(r=!0,e[n]=t,--o||c(e))},a)}),--o||c(e)});return r.e&&a(r.v),n.promise},race:function race(t){var n=this,r=M(n),e=r.reject,i=S(function(){g(t,!1,function(t){n.resolve(t).then(r.resolve,e)})});return i.e&&e(i.v),r.promise}})},{112:112,113:113,115:115,121:121,122:122,125:125,134:134,146:146,150:150,31:31,35:35,45:45,50:50,52:52,60:60,66:66,68:68,79:79,84:84,87:87,93:93,94:94}],231:[function(t,n,r){var e=t(60),o=t(31),u=t(36),c=(t(68).Reflect||{}).apply,a=Function.apply;e(e.S+e.F*!t(62)(function(){c(function(){})}),"Reflect",{apply:function apply(t,n,r){var e=o(t),i=u(r);return c?c(e,n,i):a.call(e,n,i)}})},{31:31,36:36,60:60,62:62,68:68}],232:[function(t,n,r){var e=t(60),c=t(96),a=t(31),f=t(36),s=t(79),i=t(62),l=t(44),h=(t(68).Reflect||{}).construct,p=i(function(){function F(){}return!(h(function(){},[],F)instanceof F)}),v=!i(function(){h(function(){})});e(e.S+e.F*(p||v),"Reflect",{construct:function construct(t,n){a(t),f(n);var r=arguments.length<3?t:a(arguments[2]);if(v&&!p)return h(t,n,r);if(t==r){switch(n.length){case 0:return new t;case 1:return new t(n[0]);case 2:return new t(n[0],n[1]);case 3:return new t(n[0],n[1],n[2]);case 4:return new t(n[0],n[1],n[2],n[3])}var e=[null];return e.push.apply(e,n),new(l.apply(t,e))}var i=r.prototype,o=c(s(i)?i:Object.prototype),u=Function.apply.call(t,o,n);return s(u)?u:o}})},{31:31,36:36,44:44,60:60,62:62,68:68,79:79,96:96}],233:[function(t,n,r){var e=t(97),i=t(60),o=t(36),u=t(141);i(i.S+i.F*t(62)(function(){Reflect.defineProperty(e.f({},1,{value:1}),1,{value:2})}),"Reflect",{defineProperty:function defineProperty(t,n,r){o(t),n=u(n,!0),o(r);try{return e.f(t,n,r),!0}catch(t){return!1}}})},{141:141,36:36,60:60,62:62,97:97}],234:[function(t,n,r){var e=t(60),i=t(99).f,o=t(36);e(e.S,"Reflect",{deleteProperty:function deleteProperty(t,n){var r=i(o(t),n);return!(r&&!r.configurable)&&delete t[n]}})},{36:36,60:60,99:99}],235:[function(t,n,r){"use strict";function AU(t){this._t=i(t),this._i=0;var n,r=this._k=[];for(n in t)r.push(n)}var e=t(60),i=t(36);t(82)(AU,"Object",function(){var t,n=this._k;do{if(this._i>=n.length)return{value:void 0,done:!0}}while(!((t=n[this._i++])in this._t));return{value:t,done:!1}}),e(e.S,"Reflect",{enumerate:function enumerate(t){return new AU(t)}})},{36:36,60:60,82:82}],236:[function(t,n,r){var e=t(99),i=t(60),o=t(36);i(i.S,"Reflect",{getOwnPropertyDescriptor:function getOwnPropertyDescriptor(t,n){return e.f(o(t),n)}})},{36:36,60:60,99:99}],237:[function(t,n,r){var e=t(60),i=t(103),o=t(36);e(e.S,"Reflect",{getPrototypeOf:function getPrototypeOf(t){return i(o(t))}})},{103:103,36:36,60:60}],238:[function(t,n,r){var o=t(99),u=t(103),c=t(69),e=t(60),a=t(79),f=t(36);e(e.S,"Reflect",{get:function get(t,n){var r,e,i=arguments.length<3?t:arguments[2];return f(t)===i?t[n]:(r=o.f(t,n))?c(r,"value")?r.value:void 0!==r.get?r.get.call(i):void 0:a(e=u(t))?get(e,n,i):void 0}})},{103:103,36:36,60:60,69:69,79:79,99:99}],239:[function(t,n,r){var e=t(60);e(e.S,"Reflect",{has:function has(t,n){return n in t}})},{60:60}],240:[function(t,n,r){var e=t(60),i=t(36),o=Object.isExtensible;e(e.S,"Reflect",{isExtensible:function isExtensible(t){return i(t),!o||o(t)}})},{36:36,60:60}],241:[function(t,n,r){var e=t(60);e(e.S,"Reflect",{ownKeys:t(109)})},{109:109,60:60}],242:[function(t,n,r){var e=t(60),i=t(36),o=Object.preventExtensions;e(e.S,"Reflect",{preventExtensions:function preventExtensions(t){i(t);try{return o&&o(t),!0}catch(t){return!1}}})},{36:36,60:60}],243:[function(t,n,r){var e=t(60),i=t(120);i&&e(e.S,"Reflect",{setPrototypeOf:function setPrototypeOf(t,n){i.check(t,n);try{return i.set(t,n),!0}catch(t){return!1}}})},{120:120,60:60}],244:[function(t,n,r){var c=t(97),a=t(99),f=t(103),s=t(69),e=t(60),l=t(114),h=t(36),p=t(79);e(e.S,"Reflect",{set:function set(t,n,r){var e,i,o=arguments.length<4?t:arguments[3],u=a.f(h(t),n);if(!u){if(p(i=f(t)))return set(i,n,r,o);u=l(0)}if(s(u,"value")){if(!1===u.writable||!p(o))return!1;if(e=a.f(o,n)){if(e.get||e.set||!1===e.writable)return!1;e.value=r,c.f(o,n,e)}else c.f(o,n,l(0,r));return!0}return void 0!==u.set&&(u.set.call(o,r),!0)}})},{103:103,114:114,36:36,60:60,69:69,79:79,97:97,99:99}],245:[function(t,n,r){var e=t(68),o=t(73),i=t(97).f,u=t(101).f,c=t(80),a=t(64),f=e.RegExp,s=f,l=f.prototype,h=/a/g,p=/a/g,v=new f(h)!==h;if(t(56)&&(!v||t(62)(function(){return p[t(150)("match")]=!1,f(h)!=h||f(p)==p||"/a/i"!=f(h,"i")}))){f=function RegExp(t,n){var r=this instanceof f,e=c(t),i=void 0===n;return!r&&e&&t.constructor===f&&i?t:o(v?new s(e&&!i?t.source:t,n):s((e=t instanceof f)?t.source:t,e&&i?a.call(t):n),r?this:l,f)};function vW(n){n in f||i(f,n,{configurable:!0,get:function(){return s[n]},set:function(t){s[n]=t}})}for(var g=u(s),y=0;g.length>y;)vW(g[y++]);(l.constructor=f).prototype=l,t(116)(e,"RegExp",f)}t(121)("RegExp")},{101:101,116:116,121:121,150:150,56:56,62:62,64:64,68:68,73:73,80:80,97:97}],246:[function(t,n,r){"use strict";var e=t(118);t(60)({target:"RegExp",proto:!0,forced:e!==/./.exec},{exec:e})},{118:118,60:60}],247:[function(t,n,r){t(56)&&"g"!=/./g.flags&&t(97).f(RegExp.prototype,"flags",{configurable:!0,get:t(64)})},{56:56,64:64,97:97}],248:[function(t,n,r){"use strict";var l=t(36),h=t(139),p=t(34),v=t(117);t(63)("match",1,function(e,i,f,s){return[function match(t){var n=e(this),r=null==t?void 0:t[i];return void 0!==r?r.call(t,n):new RegExp(t)[i](String(n))},function(t){var n=s(f,t,this);if(n.done)return n.value;var r=l(t),e=String(this);if(!r.global)return v(r,e);for(var i,o=r.unicode,u=[],c=r.lastIndex=0;null!==(i=v(r,e));){var a=String(i[0]);""===(u[c]=a)&&(r.lastIndex=p(e,h(r.lastIndex),o)),c++}return 0===c?null:u}]})},{117:117,139:139,34:34,36:36,63:63}],249:[function(t,n,r){"use strict";var _=t(36),e=t(140),E=t(139),O=t(137),I=t(34),F=t(117),P=Math.max,A=Math.min,h=Math.floor,p=/\$([$&`']|\d\d?|<[^>]*>)/g,v=/\$([$&`']|\d\d?)/g;t(63)("replace",2,function(i,o,b,w){return[function replace(t,n){var r=i(this),e=null==t?void 0:t[o];return void 0!==e?e.call(t,r,n):b.call(String(r),t,n)},function(t,n){var r=w(b,t,this,n);if(r.done)return r.value;var e=_(t),i=String(this),o="function"==typeof n;o||(n=String(n));var u=e.global;if(u){var c=e.unicode;e.lastIndex=0}for(var a=[];;){var f=F(e,i);if(null===f)break;if(a.push(f),!u)break;""===String(f[0])&&(e.lastIndex=I(i,E(e.lastIndex),c))}for(var s,l="",h=0,p=0;p>>0,s=new RegExp(t.source,c+"g");(e=h.call(s,r))&&!(a<(i=s[g])&&(u.push(r.slice(a,e.index)),1=f));)s[g]===e.index&&s[g]++;return a===r[v]?!o&&s.test("")||u.push(""):u.push(r.slice(a)),u[v]>f?u.slice(0,f):u}:"0"[u](void 0,0)[v]?function(t,n){return void 0===t&&0===n?[]:y.call(this,t,n)}:y,[function split(t,n){var r=i(this),e=null==t?void 0:t[o];return void 0!==e?e.call(t,r,n):x.call(String(r),t,n)},function(t,n){var r=d(x,t,this,n,x!==y);if(r.done)return r.value;var e=m(t),i=String(this),o=S(e,RegExp),u=e.unicode,c=(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.unicode?"u":"")+(I?"y":"g"),a=new o(I?e:"^(?:"+e.source+")",c),f=void 0===n?O:n>>>0;if(0==f)return[];if(0===i.length)return null===_(a,i)?[i]:[];for(var s=0,l=0,h=[];l>10),n%1024+56320))}return r.join("")}})},{135:135,60:60}],264:[function(t,n,r){"use strict";var e=t(60),i=t(128),o="includes";e(e.P+e.F*t(61)(o),"String",{includes:function includes(t){return!!~i(this,t,o).indexOf(t,1=n.length?{value:void 0,done:!0}:(t=e(n,r),this._i+=t.length,{value:t,done:!1})})},{127:127,83:83}],267:[function(t,n,r){"use strict";t(129)("link",function(n){return function link(t){return n(this,"a","href",t)}})},{129:129}],268:[function(t,n,r){var e=t(60),u=t(138),c=t(139);e(e.S,"String",{raw:function raw(t){for(var n=u(t.raw),r=c(n.length),e=arguments.length,i=[],o=0;oi;)u(W,n=r[i++])||n==C||n==a||e.push(n);return e}function B1(t){for(var n,r=t===B,e=R(r?V:b(t)),i=[],o=0;e.length>o;)!u(W,n=e[o++])||r&&!u(B,n)||i.push(W[n]);return i}var e=t(68),u=t(69),i=t(56),o=t(60),c=t(116),a=t(92).KEY,f=t(62),s=t(124),l=t(122),h=t(145),p=t(150),v=t(149),g=t(148),y=t(59),d=t(77),x=t(36),m=t(79),S=t(140),b=t(138),w=t(141),_=t(114),E=t(96),O=t(100),I=t(99),F=t(102),P=t(97),A=t(105),M=I.f,k=P.f,R=O.f,N=e.Symbol,j=e.JSON,T=j&&j.stringify,L="prototype",C=p("_hidden"),G=p("toPrimitive"),U={}.propertyIsEnumerable,D=s("symbol-registry"),W=s("symbols"),V=s("op-symbols"),B=Object[L],q="function"==typeof N&&!!F.f,z=e.QObject,$=!z||!z[L]||!z[L].findChild,Y=i&&f(function(){return 7!=E(k({},"a",{get:function(){return k(this,"a",{value:7}).a}})).a})?function(t,n,r){var e=M(B,n);e&&delete B[n],k(t,n,r),e&&t!==B&&k(B,n,e)}:k,J=q&&"symbol"==typeof N.iterator?function(t){return"symbol"==typeof t}:function(t){return t instanceof N},H=function defineProperty(t,n,r){return t===B&&H(V,n,r),x(t),n=w(n,!0),x(r),u(W,n)?(r.enumerable?(u(t,C)&&t[C][n]&&(t[C][n]=!1),r=E(r,{enumerable:_(0,!1)})):(u(t,C)||k(t,C,_(1,{})),t[C][n]=!0),Y(t,n,r)):k(t,n,r)};q||(c((N=function Symbol(){if(this instanceof N)throw TypeError("Symbol is not a constructor!");var n=h(0K;)p(Q[K++]);for(var Z=A(p.store),X=0;Z.length>X;)g(Z[X++]);o(o.S+o.F*!q,"Symbol",{for:function(t){return u(D,t+="")?D[t]:D[t]=N(t)},keyFor:function keyFor(t){if(!J(t))throw TypeError(t+" is not a symbol!");for(var n in D)if(D[n]===t)return n},useSetter:function(){$=!0},useSimple:function(){$=!1}}),o(o.S+o.F*!q,"Object",{create:function create(t,n){return void 0===n?E(t):w1(E(t),n)},defineProperty:H,defineProperties:w1,getOwnPropertyDescriptor:z1,getOwnPropertyNames:A1,getOwnPropertySymbols:B1});var tt=f(function(){F.f(1)});o(o.S+o.F*tt,"Object",{getOwnPropertySymbols:function getOwnPropertySymbols(t){return F.f(S(t))}}),j&&o(o.S+o.F*(!q||f(function(){var t=N();return"[null]"!=T([t])||"{}"!=T({a:t})||"{}"!=T(Object(t))})),"JSON",{stringify:function stringify(t){for(var n,r,e=[t],i=1;ic;)void 0!==(r=i(e,n=o[c++]))&&l(u,n,r);return u}})},{109:109,138:138,51:51,60:60,99:99}],294:[function(t,n,r){var e=t(60),i=t(108)(!1);e(e.S,"Object",{values:function values(t){return i(t)}})},{108:108,60:60}],295:[function(t,n,r){"use strict";var e=t(60),i=t(50),o=t(68),u=t(125),c=t(113);e(e.P+e.R,"Promise",{finally:function(n){var r=u(this,i.Promise||o.Promise),t="function"==typeof n;return this.then(t?function(t){return c(r,n()).then(function(){return t})}:n,t?function(t){return c(r,n()).then(function(){throw t})}:n)}})},{113:113,125:125,50:50,60:60,68:68}],296:[function(t,n,r){"use strict";var e=t(60),i=t(130),o=t(146),u=/Version\/10\.\d+(\.\d+)?( Mobile\/\w+)? Safari\//.test(o);e(e.P+e.F*u,"String",{padEnd:function padEnd(t){return i(this,t,1 + * Licensed under the Apache-2.0 License. + * + * @license Apache-2.0 + */ + +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : + typeof define === 'function' && define.amd ? define(factory) : + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.less = factory()); +}(this, (function () { 'use strict'; + + // Export a new default each time + function defaultOptions () { + return { + /* Inline Javascript - @plugin still allowed */ + javascriptEnabled: false, + /* Outputs a makefile import dependency list to stdout. */ + depends: false, + /* (DEPRECATED) Compress using less built-in compression. + * This does an okay job but does not utilise all the tricks of + * dedicated css compression. */ + compress: false, + /* Runs the less parser and just reports errors without any output. */ + lint: false, + /* Sets available include paths. + * If the file in an @import rule does not exist at that exact location, + * less will look for it at the location(s) passed to this option. + * You might use this for instance to specify a path to a library which + * you want to be referenced simply and relatively in the less files. */ + paths: [], + /* color output in the terminal */ + color: true, + /* The strictImports controls whether the compiler will allow an @import inside of either + * @media blocks or (a later addition) other selector blocks. + * See: https://github.com/less/less.js/issues/656 */ + strictImports: false, + /* Allow Imports from Insecure HTTPS Hosts */ + insecure: false, + /* Allows you to add a path to every generated import and url in your css. + * This does not affect less import statements that are processed, just ones + * that are left in the output css. */ + rootpath: '', + /* By default URLs are kept as-is, so if you import a file in a sub-directory + * that references an image, exactly the same URL will be output in the css. + * This option allows you to re-write URL's in imported files so that the + * URL is always relative to the base imported file */ + rewriteUrls: false, + /* How to process math + * 0 always - eagerly try to solve all operations + * 1 parens-division - require parens for division "/" + * 2 parens | strict - require parens for all operations + * 3 strict-legacy - legacy strict behavior (super-strict) + */ + math: 1, + /* Without this option, less attempts to guess at the output unit when it does maths. */ + strictUnits: false, + /* Effectively the declaration is put at the top of your base Less file, + * meaning it can be used but it also can be overridden if this variable + * is defined in the file. */ + globalVars: null, + /* As opposed to the global variable option, this puts the declaration at the + * end of your base file, meaning it will override anything defined in your Less file. */ + modifyVars: null, + /* This option allows you to specify a argument to go on to every URL. */ + urlArgs: '' + }; + } + + function extractId(href) { + return href.replace(/^[a-z-]+:\/+?[^\/]+/, '') // Remove protocol & domain + .replace(/[\?\&]livereload=\w+/, '') // Remove LiveReload cachebuster + .replace(/^\//, '') // Remove root / + .replace(/\.[a-zA-Z]+$/, '') // Remove simple extension + .replace(/[^\.\w-]+/g, '-') // Replace illegal characters + .replace(/\./g, ':'); // Replace dots with colons(for valid id) + } + function addDataAttr(options, tag) { + for (var opt in tag.dataset) { + if (tag.dataset.hasOwnProperty(opt)) { + if (opt === 'env' || opt === 'dumpLineNumbers' || opt === 'rootpath' || opt === 'errorReporting') { + options[opt] = tag.dataset[opt]; + } + else { + try { + options[opt] = JSON.parse(tag.dataset[opt]); + } + catch (_) { } + } + } + } + } + + var browser = { + createCSS: function (document, styles, sheet) { + // Strip the query-string + var href = sheet.href || ''; + // If there is no title set, use the filename, minus the extension + var id = "less:" + (sheet.title || extractId(href)); + // If this has already been inserted into the DOM, we may need to replace it + var oldStyleNode = document.getElementById(id); + var keepOldStyleNode = false; + // Create a new stylesheet node for insertion or (if necessary) replacement + var styleNode = document.createElement('style'); + styleNode.setAttribute('type', 'text/css'); + if (sheet.media) { + styleNode.setAttribute('media', sheet.media); + } + styleNode.id = id; + if (!styleNode.styleSheet) { + styleNode.appendChild(document.createTextNode(styles)); + // If new contents match contents of oldStyleNode, don't replace oldStyleNode + keepOldStyleNode = (oldStyleNode !== null && oldStyleNode.childNodes.length > 0 && styleNode.childNodes.length > 0 && + oldStyleNode.firstChild.nodeValue === styleNode.firstChild.nodeValue); + } + var head = document.getElementsByTagName('head')[0]; + // If there is no oldStyleNode, just append; otherwise, only append if we need + // to replace oldStyleNode with an updated stylesheet + if (oldStyleNode === null || keepOldStyleNode === false) { + var nextEl = sheet && sheet.nextSibling || null; + if (nextEl) { + nextEl.parentNode.insertBefore(styleNode, nextEl); + } + else { + head.appendChild(styleNode); + } + } + if (oldStyleNode && keepOldStyleNode === false) { + oldStyleNode.parentNode.removeChild(oldStyleNode); + } + // For IE. + // This needs to happen *after* the style element is added to the DOM, otherwise IE 7 and 8 may crash. + // See http://social.msdn.microsoft.com/Forums/en-US/7e081b65-878a-4c22-8e68-c10d39c2ed32/internet-explorer-crashes-appending-style-element-to-head + if (styleNode.styleSheet) { + try { + styleNode.styleSheet.cssText = styles; + } + catch (e) { + throw new Error('Couldn\'t reassign styleSheet.cssText.'); + } + } + }, + currentScript: function (window) { + var document = window.document; + return document.currentScript || (function () { + var scripts = document.getElementsByTagName('script'); + return scripts[scripts.length - 1]; + })(); + } + }; + + var addDefaultOptions = (function (window, options) { + // use options from the current script tag data attribues + addDataAttr(options, browser.currentScript(window)); + if (options.isFileProtocol === undefined) { + options.isFileProtocol = /^(file|(chrome|safari)(-extension)?|resource|qrc|app):/.test(window.location.protocol); + } + // Load styles asynchronously (default: false) + // + // This is set to `false` by default, so that the body + // doesn't start loading before the stylesheets are parsed. + // Setting this to `true` can result in flickering. + // + options.async = options.async || false; + options.fileAsync = options.fileAsync || false; + // Interval between watch polls + options.poll = options.poll || (options.isFileProtocol ? 1000 : 1500); + options.env = options.env || (window.location.hostname == '127.0.0.1' || + window.location.hostname == '0.0.0.0' || + window.location.hostname == 'localhost' || + (window.location.port && + window.location.port.length > 0) || + options.isFileProtocol ? 'development' + : 'production'); + var dumpLineNumbers = /!dumpLineNumbers:(comments|mediaquery|all)/.exec(window.location.hash); + if (dumpLineNumbers) { + options.dumpLineNumbers = dumpLineNumbers[1]; + } + if (options.useFileCache === undefined) { + options.useFileCache = true; + } + if (options.onReady === undefined) { + options.onReady = true; + } + if (options.relativeUrls) { + options.rewriteUrls = 'all'; + } + }); + + var logger = { + error: function (msg) { + this._fireEvent('error', msg); + }, + warn: function (msg) { + this._fireEvent('warn', msg); + }, + info: function (msg) { + this._fireEvent('info', msg); + }, + debug: function (msg) { + this._fireEvent('debug', msg); + }, + addListener: function (listener) { + this._listeners.push(listener); + }, + removeListener: function (listener) { + for (var i = 0; i < this._listeners.length; i++) { + if (this._listeners[i] === listener) { + this._listeners.splice(i, 1); + return; + } + } + }, + _fireEvent: function (type, msg) { + for (var i = 0; i < this._listeners.length; i++) { + var logFunction = this._listeners[i][type]; + if (logFunction) { + logFunction(msg); + } + } + }, + _listeners: [] + }; + + /** + * @todo Document why this abstraction exists, and the relationship between + * environment, file managers, and plugin manager + */ + var Environment = /** @class */ (function () { + function Environment(externalEnvironment, fileManagers) { + this.fileManagers = fileManagers || []; + externalEnvironment = externalEnvironment || {}; + var optionalFunctions = ['encodeBase64', 'mimeLookup', 'charsetLookup', 'getSourceMapGenerator']; + var requiredFunctions = []; + var functions = requiredFunctions.concat(optionalFunctions); + for (var i = 0; i < functions.length; i++) { + var propName = functions[i]; + var environmentFunc = externalEnvironment[propName]; + if (environmentFunc) { + this[propName] = environmentFunc.bind(externalEnvironment); + } + else if (i < requiredFunctions.length) { + this.warn("missing required function in environment - " + propName); + } + } + } + Environment.prototype.getFileManager = function (filename, currentDirectory, options, environment, isSync) { + if (!filename) { + logger.warn('getFileManager called with no filename.. Please report this issue. continuing.'); + } + if (currentDirectory == null) { + logger.warn('getFileManager called with null directory.. Please report this issue. continuing.'); + } + var fileManagers = this.fileManagers; + if (options.pluginManager) { + fileManagers = [].concat(fileManagers).concat(options.pluginManager.getFileManagers()); + } + for (var i = fileManagers.length - 1; i >= 0; i--) { + var fileManager = fileManagers[i]; + if (fileManager[isSync ? 'supportsSync' : 'supports'](filename, currentDirectory, options, environment)) { + return fileManager; + } + } + return null; + }; + Environment.prototype.addFileManager = function (fileManager) { + this.fileManagers.push(fileManager); + }; + Environment.prototype.clearFileManagers = function () { + this.fileManagers = []; + }; + return Environment; + }()); + + var colors = { + 'aliceblue': '#f0f8ff', + 'antiquewhite': '#faebd7', + 'aqua': '#00ffff', + 'aquamarine': '#7fffd4', + 'azure': '#f0ffff', + 'beige': '#f5f5dc', + 'bisque': '#ffe4c4', + 'black': '#000000', + 'blanchedalmond': '#ffebcd', + 'blue': '#0000ff', + 'blueviolet': '#8a2be2', + 'brown': '#a52a2a', + 'burlywood': '#deb887', + 'cadetblue': '#5f9ea0', + 'chartreuse': '#7fff00', + 'chocolate': '#d2691e', + 'coral': '#ff7f50', + 'cornflowerblue': '#6495ed', + 'cornsilk': '#fff8dc', + 'crimson': '#dc143c', + 'cyan': '#00ffff', + 'darkblue': '#00008b', + 'darkcyan': '#008b8b', + 'darkgoldenrod': '#b8860b', + 'darkgray': '#a9a9a9', + 'darkgrey': '#a9a9a9', + 'darkgreen': '#006400', + 'darkkhaki': '#bdb76b', + 'darkmagenta': '#8b008b', + 'darkolivegreen': '#556b2f', + 'darkorange': '#ff8c00', + 'darkorchid': '#9932cc', + 'darkred': '#8b0000', + 'darksalmon': '#e9967a', + 'darkseagreen': '#8fbc8f', + 'darkslateblue': '#483d8b', + 'darkslategray': '#2f4f4f', + 'darkslategrey': '#2f4f4f', + 'darkturquoise': '#00ced1', + 'darkviolet': '#9400d3', + 'deeppink': '#ff1493', + 'deepskyblue': '#00bfff', + 'dimgray': '#696969', + 'dimgrey': '#696969', + 'dodgerblue': '#1e90ff', + 'firebrick': '#b22222', + 'floralwhite': '#fffaf0', + 'forestgreen': '#228b22', + 'fuchsia': '#ff00ff', + 'gainsboro': '#dcdcdc', + 'ghostwhite': '#f8f8ff', + 'gold': '#ffd700', + 'goldenrod': '#daa520', + 'gray': '#808080', + 'grey': '#808080', + 'green': '#008000', + 'greenyellow': '#adff2f', + 'honeydew': '#f0fff0', + 'hotpink': '#ff69b4', + 'indianred': '#cd5c5c', + 'indigo': '#4b0082', + 'ivory': '#fffff0', + 'khaki': '#f0e68c', + 'lavender': '#e6e6fa', + 'lavenderblush': '#fff0f5', + 'lawngreen': '#7cfc00', + 'lemonchiffon': '#fffacd', + 'lightblue': '#add8e6', + 'lightcoral': '#f08080', + 'lightcyan': '#e0ffff', + 'lightgoldenrodyellow': '#fafad2', + 'lightgray': '#d3d3d3', + 'lightgrey': '#d3d3d3', + 'lightgreen': '#90ee90', + 'lightpink': '#ffb6c1', + 'lightsalmon': '#ffa07a', + 'lightseagreen': '#20b2aa', + 'lightskyblue': '#87cefa', + 'lightslategray': '#778899', + 'lightslategrey': '#778899', + 'lightsteelblue': '#b0c4de', + 'lightyellow': '#ffffe0', + 'lime': '#00ff00', + 'limegreen': '#32cd32', + 'linen': '#faf0e6', + 'magenta': '#ff00ff', + 'maroon': '#800000', + 'mediumaquamarine': '#66cdaa', + 'mediumblue': '#0000cd', + 'mediumorchid': '#ba55d3', + 'mediumpurple': '#9370d8', + 'mediumseagreen': '#3cb371', + 'mediumslateblue': '#7b68ee', + 'mediumspringgreen': '#00fa9a', + 'mediumturquoise': '#48d1cc', + 'mediumvioletred': '#c71585', + 'midnightblue': '#191970', + 'mintcream': '#f5fffa', + 'mistyrose': '#ffe4e1', + 'moccasin': '#ffe4b5', + 'navajowhite': '#ffdead', + 'navy': '#000080', + 'oldlace': '#fdf5e6', + 'olive': '#808000', + 'olivedrab': '#6b8e23', + 'orange': '#ffa500', + 'orangered': '#ff4500', + 'orchid': '#da70d6', + 'palegoldenrod': '#eee8aa', + 'palegreen': '#98fb98', + 'paleturquoise': '#afeeee', + 'palevioletred': '#d87093', + 'papayawhip': '#ffefd5', + 'peachpuff': '#ffdab9', + 'peru': '#cd853f', + 'pink': '#ffc0cb', + 'plum': '#dda0dd', + 'powderblue': '#b0e0e6', + 'purple': '#800080', + 'rebeccapurple': '#663399', + 'red': '#ff0000', + 'rosybrown': '#bc8f8f', + 'royalblue': '#4169e1', + 'saddlebrown': '#8b4513', + 'salmon': '#fa8072', + 'sandybrown': '#f4a460', + 'seagreen': '#2e8b57', + 'seashell': '#fff5ee', + 'sienna': '#a0522d', + 'silver': '#c0c0c0', + 'skyblue': '#87ceeb', + 'slateblue': '#6a5acd', + 'slategray': '#708090', + 'slategrey': '#708090', + 'snow': '#fffafa', + 'springgreen': '#00ff7f', + 'steelblue': '#4682b4', + 'tan': '#d2b48c', + 'teal': '#008080', + 'thistle': '#d8bfd8', + 'tomato': '#ff6347', + 'turquoise': '#40e0d0', + 'violet': '#ee82ee', + 'wheat': '#f5deb3', + 'white': '#ffffff', + 'whitesmoke': '#f5f5f5', + 'yellow': '#ffff00', + 'yellowgreen': '#9acd32' + }; + + var unitConversions = { + length: { + 'm': 1, + 'cm': 0.01, + 'mm': 0.001, + 'in': 0.0254, + 'px': 0.0254 / 96, + 'pt': 0.0254 / 72, + 'pc': 0.0254 / 72 * 12 + }, + duration: { + 's': 1, + 'ms': 0.001 + }, + angle: { + 'rad': 1 / (2 * Math.PI), + 'deg': 1 / 360, + 'grad': 1 / 400, + 'turn': 1 + } + }; + + var data = { colors: colors, unitConversions: unitConversions }; + + /** + * The reason why Node is a class and other nodes simply do not extend + * from Node (since we're transpiling) is due to this issue: + * + * https://github.com/less/less.js/issues/3434 + */ + var Node = /** @class */ (function () { + function Node() { + this.parent = null; + this.visibilityBlocks = undefined; + this.nodeVisible = undefined; + this.rootNode = null; + this.parsed = null; + var self = this; + Object.defineProperty(this, 'currentFileInfo', { + get: function () { return self.fileInfo(); } + }); + Object.defineProperty(this, 'index', { + get: function () { return self.getIndex(); } + }); + } + Node.prototype.setParent = function (nodes, parent) { + function set(node) { + if (node && node instanceof Node) { + node.parent = parent; + } + } + if (Array.isArray(nodes)) { + nodes.forEach(set); + } + else { + set(nodes); + } + }; + Node.prototype.getIndex = function () { + return this._index || (this.parent && this.parent.getIndex()) || 0; + }; + Node.prototype.fileInfo = function () { + return this._fileInfo || (this.parent && this.parent.fileInfo()) || {}; + }; + Node.prototype.isRulesetLike = function () { return false; }; + Node.prototype.toCSS = function (context) { + var strs = []; + this.genCSS(context, { + add: function (chunk, fileInfo, index) { + strs.push(chunk); + }, + isEmpty: function () { + return strs.length === 0; + } + }); + return strs.join(''); + }; + Node.prototype.genCSS = function (context, output) { + output.add(this.value); + }; + Node.prototype.accept = function (visitor) { + this.value = visitor.visit(this.value); + }; + Node.prototype.eval = function () { return this; }; + Node.prototype._operate = function (context, op, a, b) { + switch (op) { + case '+': return a + b; + case '-': return a - b; + case '*': return a * b; + case '/': return a / b; + } + }; + Node.prototype.fround = function (context, value) { + var precision = context && context.numPrecision; + // add "epsilon" to ensure numbers like 1.000000005 (represented as 1.000000004999...) are properly rounded: + return (precision) ? Number((value + 2e-16).toFixed(precision)) : value; + }; + Node.compare = function (a, b) { + /* returns: + -1: a < b + 0: a = b + 1: a > b + and *any* other value for a != b (e.g. undefined, NaN, -2 etc.) */ + if ((a.compare) && + // for "symmetric results" force toCSS-based comparison + // of Quoted or Anonymous if either value is one of those + !(b.type === 'Quoted' || b.type === 'Anonymous')) { + return a.compare(b); + } + else if (b.compare) { + return -b.compare(a); + } + else if (a.type !== b.type) { + return undefined; + } + a = a.value; + b = b.value; + if (!Array.isArray(a)) { + return a === b ? 0 : undefined; + } + if (a.length !== b.length) { + return undefined; + } + for (var i = 0; i < a.length; i++) { + if (Node.compare(a[i], b[i]) !== 0) { + return undefined; + } + } + return 0; + }; + Node.numericCompare = function (a, b) { + return a < b ? -1 + : a === b ? 0 + : a > b ? 1 : undefined; + }; + // Returns true if this node represents root of ast imported by reference + Node.prototype.blocksVisibility = function () { + if (this.visibilityBlocks == null) { + this.visibilityBlocks = 0; + } + return this.visibilityBlocks !== 0; + }; + Node.prototype.addVisibilityBlock = function () { + if (this.visibilityBlocks == null) { + this.visibilityBlocks = 0; + } + this.visibilityBlocks = this.visibilityBlocks + 1; + }; + Node.prototype.removeVisibilityBlock = function () { + if (this.visibilityBlocks == null) { + this.visibilityBlocks = 0; + } + this.visibilityBlocks = this.visibilityBlocks - 1; + }; + // Turns on node visibility - if called node will be shown in output regardless + // of whether it comes from import by reference or not + Node.prototype.ensureVisibility = function () { + this.nodeVisible = true; + }; + // Turns off node visibility - if called node will NOT be shown in output regardless + // of whether it comes from import by reference or not + Node.prototype.ensureInvisibility = function () { + this.nodeVisible = false; + }; + // return values: + // false - the node must not be visible + // true - the node must be visible + // undefined or null - the node has the same visibility as its parent + Node.prototype.isVisible = function () { + return this.nodeVisible; + }; + Node.prototype.visibilityInfo = function () { + return { + visibilityBlocks: this.visibilityBlocks, + nodeVisible: this.nodeVisible + }; + }; + Node.prototype.copyVisibilityInfo = function (info) { + if (!info) { + return; + } + this.visibilityBlocks = info.visibilityBlocks; + this.nodeVisible = info.nodeVisible; + }; + return Node; + }()); + + // + // RGB Colors - #ff0014, #eee + // + var Color = function (rgb, a, originalForm) { + var self = this; + // + // The end goal here, is to parse the arguments + // into an integer triplet, such as `128, 255, 0` + // + // This facilitates operations and conversions. + // + if (Array.isArray(rgb)) { + this.rgb = rgb; + } + else if (rgb.length >= 6) { + this.rgb = []; + rgb.match(/.{2}/g).map(function (c, i) { + if (i < 3) { + self.rgb.push(parseInt(c, 16)); + } + else { + self.alpha = (parseInt(c, 16)) / 255; + } + }); + } + else { + this.rgb = []; + rgb.split('').map(function (c, i) { + if (i < 3) { + self.rgb.push(parseInt(c + c, 16)); + } + else { + self.alpha = (parseInt(c + c, 16)) / 255; + } + }); + } + this.alpha = this.alpha || (typeof a === 'number' ? a : 1); + if (typeof originalForm !== 'undefined') { + this.value = originalForm; + } + }; + Color.prototype = Object.assign(new Node(), { + type: 'Color', + luma: function () { + var r = this.rgb[0] / 255, g = this.rgb[1] / 255, b = this.rgb[2] / 255; + r = (r <= 0.03928) ? r / 12.92 : Math.pow(((r + 0.055) / 1.055), 2.4); + g = (g <= 0.03928) ? g / 12.92 : Math.pow(((g + 0.055) / 1.055), 2.4); + b = (b <= 0.03928) ? b / 12.92 : Math.pow(((b + 0.055) / 1.055), 2.4); + return 0.2126 * r + 0.7152 * g + 0.0722 * b; + }, + genCSS: function (context, output) { + output.add(this.toCSS(context)); + }, + toCSS: function (context, doNotCompress) { + var compress = context && context.compress && !doNotCompress; + var color; + var alpha; + var colorFunction; + var args = []; + // `value` is set if this color was originally + // converted from a named color string so we need + // to respect this and try to output named color too. + alpha = this.fround(context, this.alpha); + if (this.value) { + if (this.value.indexOf('rgb') === 0) { + if (alpha < 1) { + colorFunction = 'rgba'; + } + } + else if (this.value.indexOf('hsl') === 0) { + if (alpha < 1) { + colorFunction = 'hsla'; + } + else { + colorFunction = 'hsl'; + } + } + else { + return this.value; + } + } + else { + if (alpha < 1) { + colorFunction = 'rgba'; + } + } + switch (colorFunction) { + case 'rgba': + args = this.rgb.map(function (c) { + return clamp(Math.round(c), 255); + }).concat(clamp(alpha, 1)); + break; + case 'hsla': + args.push(clamp(alpha, 1)); + case 'hsl': + color = this.toHSL(); + args = [ + this.fround(context, color.h), + this.fround(context, color.s * 100) + "%", + this.fround(context, color.l * 100) + "%" + ].concat(args); + } + if (colorFunction) { + // Values are capped between `0` and `255`, rounded and zero-padded. + return colorFunction + "(" + args.join("," + (compress ? '' : ' ')) + ")"; + } + color = this.toRGB(); + if (compress) { + var splitcolor = color.split(''); + // Convert color to short format + if (splitcolor[1] === splitcolor[2] && splitcolor[3] === splitcolor[4] && splitcolor[5] === splitcolor[6]) { + color = "#" + splitcolor[1] + splitcolor[3] + splitcolor[5]; + } + } + return color; + }, + // + // Operations have to be done per-channel, if not, + // channels will spill onto each other. Once we have + // our result, in the form of an integer triplet, + // we create a new Color node to hold the result. + // + operate: function (context, op, other) { + var rgb = new Array(3); + var alpha = this.alpha * (1 - other.alpha) + other.alpha; + for (var c = 0; c < 3; c++) { + rgb[c] = this._operate(context, op, this.rgb[c], other.rgb[c]); + } + return new Color(rgb, alpha); + }, + toRGB: function () { + return toHex(this.rgb); + }, + toHSL: function () { + var r = this.rgb[0] / 255, g = this.rgb[1] / 255, b = this.rgb[2] / 255, a = this.alpha; + var max = Math.max(r, g, b), min = Math.min(r, g, b); + var h; + var s; + var l = (max + min) / 2; + var d = max - min; + if (max === min) { + h = s = 0; + } + else { + s = l > 0.5 ? d / (2 - max - min) : d / (max + min); + switch (max) { + case r: + h = (g - b) / d + (g < b ? 6 : 0); + break; + case g: + h = (b - r) / d + 2; + break; + case b: + h = (r - g) / d + 4; + break; + } + h /= 6; + } + return { h: h * 360, s: s, l: l, a: a }; + }, + // Adapted from http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript + toHSV: function () { + var r = this.rgb[0] / 255, g = this.rgb[1] / 255, b = this.rgb[2] / 255, a = this.alpha; + var max = Math.max(r, g, b), min = Math.min(r, g, b); + var h; + var s; + var v = max; + var d = max - min; + if (max === 0) { + s = 0; + } + else { + s = d / max; + } + if (max === min) { + h = 0; + } + else { + switch (max) { + case r: + h = (g - b) / d + (g < b ? 6 : 0); + break; + case g: + h = (b - r) / d + 2; + break; + case b: + h = (r - g) / d + 4; + break; + } + h /= 6; + } + return { h: h * 360, s: s, v: v, a: a }; + }, + toARGB: function () { + return toHex([this.alpha * 255].concat(this.rgb)); + }, + compare: function (x) { + return (x.rgb && + x.rgb[0] === this.rgb[0] && + x.rgb[1] === this.rgb[1] && + x.rgb[2] === this.rgb[2] && + x.alpha === this.alpha) ? 0 : undefined; + } + }); + Color.fromKeyword = function (keyword) { + var c; + var key = keyword.toLowerCase(); + if (colors.hasOwnProperty(key)) { + c = new Color(colors[key].slice(1)); + } + else if (key === 'transparent') { + c = new Color([0, 0, 0], 0); + } + if (c) { + c.value = keyword; + return c; + } + }; + function clamp(v, max) { + return Math.min(Math.max(v, 0), max); + } + function toHex(v) { + return "#" + v.map(function (c) { + c = clamp(Math.round(c), 255); + return (c < 16 ? '0' : '') + c.toString(16); + }).join(''); + } + + var Paren = function (node) { + this.value = node; + }; + Paren.prototype = Object.assign(new Node(), { + type: 'Paren', + genCSS: function (context, output) { + output.add('('); + this.value.genCSS(context, output); + output.add(')'); + }, + eval: function (context) { + return new Paren(this.value.eval(context)); + } + }); + + var _noSpaceCombinators = { + '': true, + ' ': true, + '|': true + }; + var Combinator = function (value) { + if (value === ' ') { + this.value = ' '; + this.emptyOrWhitespace = true; + } + else { + this.value = value ? value.trim() : ''; + this.emptyOrWhitespace = this.value === ''; + } + }; + Combinator.prototype = Object.assign(new Node(), { + type: 'Combinator', + genCSS: function (context, output) { + var spaceOrEmpty = (context.compress || _noSpaceCombinators[this.value]) ? '' : ' '; + output.add(spaceOrEmpty + this.value + spaceOrEmpty); + } + }); + + var Element = function (combinator, value, isVariable, index, currentFileInfo, visibilityInfo) { + this.combinator = combinator instanceof Combinator ? + combinator : new Combinator(combinator); + if (typeof value === 'string') { + this.value = value.trim(); + } + else if (value) { + this.value = value; + } + else { + this.value = ''; + } + this.isVariable = isVariable; + this._index = index; + this._fileInfo = currentFileInfo; + this.copyVisibilityInfo(visibilityInfo); + this.setParent(this.combinator, this); + }; + Element.prototype = Object.assign(new Node(), { + type: 'Element', + accept: function (visitor) { + var value = this.value; + this.combinator = visitor.visit(this.combinator); + if (typeof value === 'object') { + this.value = visitor.visit(value); + } + }, + eval: function (context) { + return new Element(this.combinator, this.value.eval ? this.value.eval(context) : this.value, this.isVariable, this.getIndex(), this.fileInfo(), this.visibilityInfo()); + }, + clone: function () { + return new Element(this.combinator, this.value, this.isVariable, this.getIndex(), this.fileInfo(), this.visibilityInfo()); + }, + genCSS: function (context, output) { + output.add(this.toCSS(context), this.fileInfo(), this.getIndex()); + }, + toCSS: function (context) { + context = context || {}; + var value = this.value; + var firstSelector = context.firstSelector; + if (value instanceof Paren) { + // selector in parens should not be affected by outer selector + // flags (breaks only interpolated selectors - see #1973) + context.firstSelector = true; + } + value = value.toCSS ? value.toCSS(context) : value; + context.firstSelector = firstSelector; + if (value === '' && this.combinator.value.charAt(0) === '&') { + return ''; + } + else { + return this.combinator.toCSS(context) + value; + } + } + }); + + var Math$1 = { + ALWAYS: 0, + PARENS_DIVISION: 1, + PARENS: 2 + // removed - STRICT_LEGACY: 3 + }; + var RewriteUrls = { + OFF: 0, + LOCAL: 1, + ALL: 2 + }; + + /** + * Returns the object type of the given payload + * + * @param {*} payload + * @returns {string} + */ + function getType(payload) { + return Object.prototype.toString.call(payload).slice(8, -1); + } + /** + * Returns whether the payload is a plain JavaScript object (excluding special classes or objects with other prototypes) + * + * @param {*} payload + * @returns {payload is Record} + */ + function isPlainObject(payload) { + if (getType(payload) !== 'Object') + return false; + return payload.constructor === Object && Object.getPrototypeOf(payload) === Object.prototype; + } + /** + * Returns whether the payload is an array + * + * @param {any} payload + * @returns {payload is any[]} + */ + function isArray(payload) { + return getType(payload) === 'Array'; + } + + /*! ***************************************************************************** + Copyright (c) Microsoft Corporation. All rights reserved. + Licensed under the Apache License, Version 2.0 (the "License"); you may not use + this file except in compliance with the License. You may obtain a copy of the + License at http://www.apache.org/licenses/LICENSE-2.0 + + THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED + WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, + MERCHANTABLITY OR NON-INFRINGEMENT. + + See the Apache Version 2.0 License for specific language governing permissions + and limitations under the License. + ***************************************************************************** */ + + function __spreadArrays() { + for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; + for (var r = Array(s), k = 0, i = 0; i < il; i++) + for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) + r[k] = a[j]; + return r; + } + + function assignProp(carry, key, newVal, originalObject, includeNonenumerable) { + var propType = {}.propertyIsEnumerable.call(originalObject, key) + ? 'enumerable' + : 'nonenumerable'; + if (propType === 'enumerable') + carry[key] = newVal; + if (includeNonenumerable && propType === 'nonenumerable') { + Object.defineProperty(carry, key, { + value: newVal, + enumerable: false, + writable: true, + configurable: true, + }); + } + } + /** + * Copy (clone) an object and all its props recursively to get rid of any prop referenced of the original object. Arrays are also cloned, however objects inside arrays are still linked. + * + * @export + * @template T + * @param {T} target Target can be anything + * @param {Options} [options={}] Options can be `props` or `nonenumerable` + * @returns {T} the target with replaced values + * @export + */ + function copy(target, options) { + if (options === void 0) { options = {}; } + if (isArray(target)) + return target.map(function (i) { return copy(i, options); }); + if (!isPlainObject(target)) + return target; + var props = Object.getOwnPropertyNames(target); + var symbols = Object.getOwnPropertySymbols(target); + return __spreadArrays(props, symbols).reduce(function (carry, key) { + if (isArray(options.props) && !options.props.includes(key)) { + return carry; + } + var val = target[key]; + var newVal = copy(val, options); + assignProp(carry, key, newVal, target, options.nonenumerable); + return carry; + }, {}); + } + + /* jshint proto: true */ + function getLocation(index, inputStream) { + var n = index + 1; + var line = null; + var column = -1; + while (--n >= 0 && inputStream.charAt(n) !== '\n') { + column++; + } + if (typeof index === 'number') { + line = (inputStream.slice(0, index).match(/\n/g) || '').length; + } + return { + line: line, + column: column + }; + } + function copyArray(arr) { + var i; + var length = arr.length; + var copy = new Array(length); + for (i = 0; i < length; i++) { + copy[i] = arr[i]; + } + return copy; + } + function clone(obj) { + var cloned = {}; + for (var prop in obj) { + if (obj.hasOwnProperty(prop)) { + cloned[prop] = obj[prop]; + } + } + return cloned; + } + function defaults(obj1, obj2) { + var newObj = obj2 || {}; + if (!obj2._defaults) { + newObj = {}; + var defaults_1 = copy(obj1); + newObj._defaults = defaults_1; + var cloned = obj2 ? copy(obj2) : {}; + Object.assign(newObj, defaults_1, cloned); + } + return newObj; + } + function copyOptions(obj1, obj2) { + if (obj2 && obj2._defaults) { + return obj2; + } + var opts = defaults(obj1, obj2); + if (opts.strictMath) { + opts.math = Math$1.PARENS; + } + // Back compat with changed relativeUrls option + if (opts.relativeUrls) { + opts.rewriteUrls = RewriteUrls.ALL; + } + if (typeof opts.math === 'string') { + switch (opts.math.toLowerCase()) { + case 'always': + opts.math = Math$1.ALWAYS; + break; + case 'parens-division': + opts.math = Math$1.PARENS_DIVISION; + break; + case 'strict': + case 'parens': + opts.math = Math$1.PARENS; + break; + default: + opts.math = Math$1.PARENS; + } + } + if (typeof opts.rewriteUrls === 'string') { + switch (opts.rewriteUrls.toLowerCase()) { + case 'off': + opts.rewriteUrls = RewriteUrls.OFF; + break; + case 'local': + opts.rewriteUrls = RewriteUrls.LOCAL; + break; + case 'all': + opts.rewriteUrls = RewriteUrls.ALL; + break; + } + } + return opts; + } + function merge(obj1, obj2) { + for (var prop in obj2) { + if (obj2.hasOwnProperty(prop)) { + obj1[prop] = obj2[prop]; + } + } + return obj1; + } + function flattenArray(arr, result) { + if (result === void 0) { result = []; } + for (var i = 0, length_1 = arr.length; i < length_1; i++) { + var value = arr[i]; + if (Array.isArray(value)) { + flattenArray(value, result); + } + else { + if (value !== undefined) { + result.push(value); + } + } + } + return result; + } + + var utils = /*#__PURE__*/Object.freeze({ + __proto__: null, + getLocation: getLocation, + copyArray: copyArray, + clone: clone, + defaults: defaults, + copyOptions: copyOptions, + merge: merge, + flattenArray: flattenArray + }); + + var anonymousFunc = /(|Function):(\d+):(\d+)/; + /** + * This is a centralized class of any error that could be thrown internally (mostly by the parser). + * Besides standard .message it keeps some additional data like a path to the file where the error + * occurred along with line and column numbers. + * + * @class + * @extends Error + * @type {module.LessError} + * + * @prop {string} type + * @prop {string} filename + * @prop {number} index + * @prop {number} line + * @prop {number} column + * @prop {number} callLine + * @prop {number} callExtract + * @prop {string[]} extract + * + * @param {Object} e - An error object to wrap around or just a descriptive object + * @param {Object} fileContentMap - An object with file contents in 'contents' property (like importManager) @todo - move to fileManager? + * @param {string} [currentFilename] + */ + var LessError = function (e, fileContentMap, currentFilename) { + Error.call(this); + var filename = e.filename || currentFilename; + this.message = e.message; + this.stack = e.stack; + if (fileContentMap && filename) { + var input = fileContentMap.contents[filename]; + var loc = getLocation(e.index, input); + var line = loc.line; + var col = loc.column; + var callLine = e.call && getLocation(e.call, input).line; + var lines = input ? input.split('\n') : ''; + this.type = e.type || 'Syntax'; + this.filename = filename; + this.index = e.index; + this.line = typeof line === 'number' ? line + 1 : null; + this.column = col; + if (!this.line && this.stack) { + var found = this.stack.match(anonymousFunc); + /** + * We have to figure out how this environment stringifies anonymous functions + * so we can correctly map plugin errors. + * + * Note, in Node 8, the output of anonymous funcs varied based on parameters + * being present or not, so we inject dummy params. + */ + var func = new Function('a', 'throw new Error()'); + var lineAdjust = 0; + try { + func(); + } + catch (e) { + var match = e.stack.match(anonymousFunc); + var line = parseInt(match[2]); + lineAdjust = 1 - line; + } + if (found) { + if (found[2]) { + this.line = parseInt(found[2]) + lineAdjust; + } + if (found[3]) { + this.column = parseInt(found[3]); + } + } + } + this.callLine = callLine + 1; + this.callExtract = lines[callLine]; + this.extract = [ + lines[this.line - 2], + lines[this.line - 1], + lines[this.line] + ]; + } + }; + if (typeof Object.create === 'undefined') { + var F = function () { }; + F.prototype = Error.prototype; + LessError.prototype = new F(); + } + else { + LessError.prototype = Object.create(Error.prototype); + } + LessError.prototype.constructor = LessError; + /** + * An overridden version of the default Object.prototype.toString + * which uses additional information to create a helpful message. + * + * @param {Object} options + * @returns {string} + */ + LessError.prototype.toString = function (options) { + options = options || {}; + var message = ''; + var extract = this.extract || []; + var error = []; + var stylize = function (str) { return str; }; + if (options.stylize) { + var type = typeof options.stylize; + if (type !== 'function') { + throw Error("options.stylize should be a function, got a " + type + "!"); + } + stylize = options.stylize; + } + if (this.line !== null) { + if (typeof extract[0] === 'string') { + error.push(stylize(this.line - 1 + " " + extract[0], 'grey')); + } + if (typeof extract[1] === 'string') { + var errorTxt = this.line + " "; + if (extract[1]) { + errorTxt += extract[1].slice(0, this.column) + + stylize(stylize(stylize(extract[1].substr(this.column, 1), 'bold') + + extract[1].slice(this.column + 1), 'red'), 'inverse'); + } + error.push(errorTxt); + } + if (typeof extract[2] === 'string') { + error.push(stylize(this.line + 1 + " " + extract[2], 'grey')); + } + error = error.join('\n') + stylize('', 'reset') + "\n"; + } + message += stylize(this.type + "Error: " + this.message, 'red'); + if (this.filename) { + message += stylize(' in ', 'red') + this.filename; + } + if (this.line) { + message += stylize(" on line " + this.line + ", column " + (this.column + 1) + ":", 'grey'); + } + message += "\n" + error; + if (this.callLine) { + message += stylize('from ', 'red') + (this.filename || '') + "/n"; + message += stylize(this.callLine, 'grey') + " " + this.callExtract + "/n"; + } + return message; + }; + + var Selector = function (elements, extendList, condition, index, currentFileInfo, visibilityInfo) { + this.extendList = extendList; + this.condition = condition; + this.evaldCondition = !condition; + this._index = index; + this._fileInfo = currentFileInfo; + this.elements = this.getElements(elements); + this.mixinElements_ = undefined; + this.copyVisibilityInfo(visibilityInfo); + this.setParent(this.elements, this); + }; + Selector.prototype = Object.assign(new Node(), { + type: 'Selector', + accept: function (visitor) { + if (this.elements) { + this.elements = visitor.visitArray(this.elements); + } + if (this.extendList) { + this.extendList = visitor.visitArray(this.extendList); + } + if (this.condition) { + this.condition = visitor.visit(this.condition); + } + }, + createDerived: function (elements, extendList, evaldCondition) { + elements = this.getElements(elements); + var newSelector = new Selector(elements, extendList || this.extendList, null, this.getIndex(), this.fileInfo(), this.visibilityInfo()); + newSelector.evaldCondition = (evaldCondition != null) ? evaldCondition : this.evaldCondition; + newSelector.mediaEmpty = this.mediaEmpty; + return newSelector; + }, + getElements: function (els) { + if (!els) { + return [new Element('', '&', false, this._index, this._fileInfo)]; + } + if (typeof els === 'string') { + this.parse.parseNode(els, ['selector'], this._index, this._fileInfo, function (err, result) { + if (err) { + throw new LessError({ + index: err.index, + message: err.message + }, this.parse.imports, this._fileInfo.filename); + } + els = result[0].elements; + }); + } + return els; + }, + createEmptySelectors: function () { + var el = new Element('', '&', false, this._index, this._fileInfo), sels = [new Selector([el], null, null, this._index, this._fileInfo)]; + sels[0].mediaEmpty = true; + return sels; + }, + match: function (other) { + var elements = this.elements; + var len = elements.length; + var olen; + var i; + other = other.mixinElements(); + olen = other.length; + if (olen === 0 || len < olen) { + return 0; + } + else { + for (i = 0; i < olen; i++) { + if (elements[i].value !== other[i]) { + return 0; + } + } + } + return olen; // return number of matched elements + }, + mixinElements: function () { + if (this.mixinElements_) { + return this.mixinElements_; + } + var elements = this.elements.map(function (v) { + return v.combinator.value + (v.value.value || v.value); + }).join('').match(/[,&#\*\.\w-]([\w-]|(\\.))*/g); + if (elements) { + if (elements[0] === '&') { + elements.shift(); + } + } + else { + elements = []; + } + return (this.mixinElements_ = elements); + }, + isJustParentSelector: function () { + return !this.mediaEmpty && + this.elements.length === 1 && + this.elements[0].value === '&' && + (this.elements[0].combinator.value === ' ' || this.elements[0].combinator.value === ''); + }, + eval: function (context) { + var evaldCondition = this.condition && this.condition.eval(context); + var elements = this.elements; + var extendList = this.extendList; + elements = elements && elements.map(function (e) { return e.eval(context); }); + extendList = extendList && extendList.map(function (extend) { return extend.eval(context); }); + return this.createDerived(elements, extendList, evaldCondition); + }, + genCSS: function (context, output) { + var i, element; + if ((!context || !context.firstSelector) && this.elements[0].combinator.value === '') { + output.add(' ', this.fileInfo(), this.getIndex()); + } + for (i = 0; i < this.elements.length; i++) { + element = this.elements[i]; + element.genCSS(context, output); + } + }, + getIsOutput: function () { + return this.evaldCondition; + } + }); + + var Value = function (value) { + if (!value) { + throw new Error('Value requires an array argument'); + } + if (!Array.isArray(value)) { + this.value = [value]; + } + else { + this.value = value; + } + }; + Value.prototype = Object.assign(new Node(), { + type: 'Value', + accept: function (visitor) { + if (this.value) { + this.value = visitor.visitArray(this.value); + } + }, + eval: function (context) { + if (this.value.length === 1) { + return this.value[0].eval(context); + } + else { + return new Value(this.value.map(function (v) { + return v.eval(context); + })); + } + }, + genCSS: function (context, output) { + var i; + for (i = 0; i < this.value.length; i++) { + this.value[i].genCSS(context, output); + if (i + 1 < this.value.length) { + output.add((context && context.compress) ? ',' : ', '); + } + } + } + }); + + var Keyword = function (value) { + this.value = value; + }; + Keyword.prototype = Object.assign(new Node(), { + type: 'Keyword', + genCSS: function (context, output) { + if (this.value === '%') { + throw { type: 'Syntax', message: 'Invalid % without number' }; + } + output.add(this.value); + } + }); + Keyword.True = new Keyword('true'); + Keyword.False = new Keyword('false'); + + var Anonymous = function (value, index, currentFileInfo, mapLines, rulesetLike, visibilityInfo) { + this.value = value; + this._index = index; + this._fileInfo = currentFileInfo; + this.mapLines = mapLines; + this.rulesetLike = (typeof rulesetLike === 'undefined') ? false : rulesetLike; + this.allowRoot = true; + this.copyVisibilityInfo(visibilityInfo); + }; + Anonymous.prototype = Object.assign(new Node(), { + type: 'Anonymous', + eval: function () { + return new Anonymous(this.value, this._index, this._fileInfo, this.mapLines, this.rulesetLike, this.visibilityInfo()); + }, + compare: function (other) { + return other.toCSS && this.toCSS() === other.toCSS() ? 0 : undefined; + }, + isRulesetLike: function () { + return this.rulesetLike; + }, + genCSS: function (context, output) { + this.nodeVisible = Boolean(this.value); + if (this.nodeVisible) { + output.add(this.value, this._fileInfo, this._index, this.mapLines); + } + } + }); + + var MATH = Math$1; + function evalName(context, name) { + var value = ''; + var i; + var n = name.length; + var output = { add: function (s) { value += s; } }; + for (i = 0; i < n; i++) { + name[i].eval(context).genCSS(context, output); + } + return value; + } + var Declaration = function (name, value, important, merge, index, currentFileInfo, inline, variable) { + this.name = name; + this.value = (value instanceof Node) ? value : new Value([value ? new Anonymous(value) : null]); + this.important = important ? " " + important.trim() : ''; + this.merge = merge; + this._index = index; + this._fileInfo = currentFileInfo; + this.inline = inline || false; + this.variable = (variable !== undefined) ? variable + : (name.charAt && (name.charAt(0) === '@')); + this.allowRoot = true; + this.setParent(this.value, this); + }; + Declaration.prototype = Object.assign(new Node(), { + type: 'Declaration', + genCSS: function (context, output) { + output.add(this.name + (context.compress ? ':' : ': '), this.fileInfo(), this.getIndex()); + try { + this.value.genCSS(context, output); + } + catch (e) { + e.index = this._index; + e.filename = this._fileInfo.filename; + throw e; + } + output.add(this.important + ((this.inline || (context.lastRule && context.compress)) ? '' : ';'), this._fileInfo, this._index); + }, + eval: function (context) { + var mathBypass = false, prevMath, name = this.name, evaldValue, variable = this.variable; + if (typeof name !== 'string') { + // expand 'primitive' name directly to get + // things faster (~10% for benchmark.less): + name = (name.length === 1) && (name[0] instanceof Keyword) ? + name[0].value : evalName(context, name); + variable = false; // never treat expanded interpolation as new variable name + } + // @todo remove when parens-division is default + if (name === 'font' && context.math === MATH.ALWAYS) { + mathBypass = true; + prevMath = context.math; + context.math = MATH.PARENS_DIVISION; + } + try { + context.importantScope.push({}); + evaldValue = this.value.eval(context); + if (!this.variable && evaldValue.type === 'DetachedRuleset') { + throw { message: 'Rulesets cannot be evaluated on a property.', + index: this.getIndex(), filename: this.fileInfo().filename }; + } + var important = this.important; + var importantResult = context.importantScope.pop(); + if (!important && importantResult.important) { + important = importantResult.important; + } + return new Declaration(name, evaldValue, important, this.merge, this.getIndex(), this.fileInfo(), this.inline, variable); + } + catch (e) { + if (typeof e.index !== 'number') { + e.index = this.getIndex(); + e.filename = this.fileInfo().filename; + } + throw e; + } + finally { + if (mathBypass) { + context.math = prevMath; + } + } + }, + makeImportant: function () { + return new Declaration(this.name, this.value, '!important', this.merge, this.getIndex(), this.fileInfo(), this.inline); + } + }); + + var debugInfo = /** @class */ (function () { + function debugInfo(context, ctx, lineSeparator) { + var result = ''; + if (context.dumpLineNumbers && !context.compress) { + switch (context.dumpLineNumbers) { + case 'comments': + result = debugInfo.asComment(ctx); + break; + case 'mediaquery': + result = debugInfo.asMediaQuery(ctx); + break; + case 'all': + result = debugInfo.asComment(ctx) + (lineSeparator || '') + debugInfo.asMediaQuery(ctx); + break; + } + } + return result; + } + debugInfo.asComment = function (ctx) { + return "/* line " + ctx.debugInfo.lineNumber + ", " + ctx.debugInfo.fileName + " */\n"; + }; + debugInfo.asMediaQuery = function (ctx) { + var filenameWithProtocol = ctx.debugInfo.fileName; + if (!/^[a-z]+:\/\//i.test(filenameWithProtocol)) { + filenameWithProtocol = "file://" + filenameWithProtocol; + } + return "@media -sass-debug-info{filename{font-family:" + filenameWithProtocol.replace(/([.:\/\\])/g, function (a) { + if (a == '\\') { + a = '\/'; + } + return "\\" + a; + }) + "}line{font-family:\\00003" + ctx.debugInfo.lineNumber + "}}\n"; + }; + return debugInfo; + }()); + + var Comment = function (value, isLineComment, index, currentFileInfo) { + this.value = value; + this.isLineComment = isLineComment; + this._index = index; + this._fileInfo = currentFileInfo; + this.allowRoot = true; + }; + Comment.prototype = Object.assign(new Node(), { + type: 'Comment', + genCSS: function (context, output) { + if (this.debugInfo) { + output.add(debugInfo(context, this), this.fileInfo(), this.getIndex()); + } + output.add(this.value); + }, + isSilent: function (context) { + var isCompressed = context.compress && this.value[2] !== '!'; + return this.isLineComment || isCompressed; + } + }); + + var contexts = {}; + var copyFromOriginal = function copyFromOriginal(original, destination, propertiesToCopy) { + if (!original) { + return; + } + for (var i = 0; i < propertiesToCopy.length; i++) { + if (original.hasOwnProperty(propertiesToCopy[i])) { + destination[propertiesToCopy[i]] = original[propertiesToCopy[i]]; + } + } + }; + /* + parse is used whilst parsing + */ + var parseCopyProperties = [ + // options + 'paths', + 'rewriteUrls', + 'rootpath', + 'strictImports', + 'insecure', + 'dumpLineNumbers', + 'compress', + 'syncImport', + 'chunkInput', + 'mime', + 'useFileCache', + // context + 'processImports', + // Used by the import manager to stop multiple import visitors being created. + 'pluginManager' // Used as the plugin manager for the session + ]; + contexts.Parse = function (options) { + copyFromOriginal(options, this, parseCopyProperties); + if (typeof this.paths === 'string') { + this.paths = [this.paths]; + } + }; + var evalCopyProperties = [ + 'paths', + 'compress', + 'math', + 'strictUnits', + 'sourceMap', + 'importMultiple', + 'urlArgs', + 'javascriptEnabled', + 'pluginManager', + 'importantScope', + 'rewriteUrls' // option - whether to adjust URL's to be relative + ]; + contexts.Eval = function (options, frames) { + copyFromOriginal(options, this, evalCopyProperties); + if (typeof this.paths === 'string') { + this.paths = [this.paths]; + } + this.frames = frames || []; + this.importantScope = this.importantScope || []; + }; + contexts.Eval.prototype.enterCalc = function () { + if (!this.calcStack) { + this.calcStack = []; + } + this.calcStack.push(true); + this.inCalc = true; + }; + contexts.Eval.prototype.exitCalc = function () { + this.calcStack.pop(); + if (!this.calcStack.length) { + this.inCalc = false; + } + }; + contexts.Eval.prototype.inParenthesis = function () { + if (!this.parensStack) { + this.parensStack = []; + } + this.parensStack.push(true); + }; + contexts.Eval.prototype.outOfParenthesis = function () { + this.parensStack.pop(); + }; + contexts.Eval.prototype.inCalc = false; + contexts.Eval.prototype.mathOn = true; + contexts.Eval.prototype.isMathOn = function (op) { + if (!this.mathOn) { + return false; + } + if (op === '/' && this.math !== Math$1.ALWAYS && (!this.parensStack || !this.parensStack.length)) { + return false; + } + if (this.math > Math$1.PARENS_DIVISION) { + return this.parensStack && this.parensStack.length; + } + return true; + }; + contexts.Eval.prototype.pathRequiresRewrite = function (path) { + var isRelative = this.rewriteUrls === RewriteUrls.LOCAL ? isPathLocalRelative : isPathRelative; + return isRelative(path); + }; + contexts.Eval.prototype.rewritePath = function (path, rootpath) { + var newPath; + rootpath = rootpath || ''; + newPath = this.normalizePath(rootpath + path); + // If a path was explicit relative and the rootpath was not an absolute path + // we must ensure that the new path is also explicit relative. + if (isPathLocalRelative(path) && + isPathRelative(rootpath) && + isPathLocalRelative(newPath) === false) { + newPath = "./" + newPath; + } + return newPath; + }; + contexts.Eval.prototype.normalizePath = function (path) { + var segments = path.split('/').reverse(); + var segment; + path = []; + while (segments.length !== 0) { + segment = segments.pop(); + switch (segment) { + case '.': + break; + case '..': + if ((path.length === 0) || (path[path.length - 1] === '..')) { + path.push(segment); + } + else { + path.pop(); + } + break; + default: + path.push(segment); + break; + } + } + return path.join('/'); + }; + function isPathRelative(path) { + return !/^(?:[a-z-]+:|\/|#)/i.test(path); + } + function isPathLocalRelative(path) { + return path.charAt(0) === '.'; + } + // todo - do the same for the toCSS ? + + function makeRegistry(base) { + return { + _data: {}, + add: function (name, func) { + // precautionary case conversion, as later querying of + // the registry by function-caller uses lower case as well. + name = name.toLowerCase(); + if (this._data.hasOwnProperty(name)) ; + this._data[name] = func; + }, + addMultiple: function (functions) { + var _this = this; + Object.keys(functions).forEach(function (name) { + _this.add(name, functions[name]); + }); + }, + get: function (name) { + return this._data[name] || (base && base.get(name)); + }, + getLocalFunctions: function () { + return this._data; + }, + inherit: function () { + return makeRegistry(this); + }, + create: function (base) { + return makeRegistry(base); + } + }; + } + var functionRegistry = makeRegistry(null); + + var defaultFunc = { + eval: function () { + var v = this.value_; + var e = this.error_; + if (e) { + throw e; + } + if (v != null) { + return v ? Keyword.True : Keyword.False; + } + }, + value: function (v) { + this.value_ = v; + }, + error: function (e) { + this.error_ = e; + }, + reset: function () { + this.value_ = this.error_ = null; + } + }; + + var Ruleset = function (selectors, rules, strictImports, visibilityInfo) { + this.selectors = selectors; + this.rules = rules; + this._lookups = {}; + this._variables = null; + this._properties = null; + this.strictImports = strictImports; + this.copyVisibilityInfo(visibilityInfo); + this.allowRoot = true; + this.setParent(this.selectors, this); + this.setParent(this.rules, this); + }; + Ruleset.prototype = Object.assign(new Node(), { + type: 'Ruleset', + isRuleset: true, + isRulesetLike: function () { return true; }, + accept: function (visitor) { + if (this.paths) { + this.paths = visitor.visitArray(this.paths, true); + } + else if (this.selectors) { + this.selectors = visitor.visitArray(this.selectors); + } + if (this.rules && this.rules.length) { + this.rules = visitor.visitArray(this.rules); + } + }, + eval: function (context) { + var selectors; + var selCnt; + var selector; + var i; + var hasVariable; + var hasOnePassingSelector = false; + if (this.selectors && (selCnt = this.selectors.length)) { + selectors = new Array(selCnt); + defaultFunc.error({ + type: 'Syntax', + message: 'it is currently only allowed in parametric mixin guards,' + }); + for (i = 0; i < selCnt; i++) { + selector = this.selectors[i].eval(context); + for (var j = 0; j < selector.elements.length; j++) { + if (selector.elements[j].isVariable) { + hasVariable = true; + break; + } + } + selectors[i] = selector; + if (selector.evaldCondition) { + hasOnePassingSelector = true; + } + } + if (hasVariable) { + var toParseSelectors = new Array(selCnt); + for (i = 0; i < selCnt; i++) { + selector = selectors[i]; + toParseSelectors[i] = selector.toCSS(context); + } + this.parse.parseNode(toParseSelectors.join(','), ["selectors"], selectors[0].getIndex(), selectors[0].fileInfo(), function (err, result) { + if (result) { + selectors = flattenArray(result); + } + }); + } + defaultFunc.reset(); + } + else { + hasOnePassingSelector = true; + } + var rules = this.rules ? copyArray(this.rules) : null; + var ruleset = new Ruleset(selectors, rules, this.strictImports, this.visibilityInfo()); + var rule; + var subRule; + ruleset.originalRuleset = this; + ruleset.root = this.root; + ruleset.firstRoot = this.firstRoot; + ruleset.allowImports = this.allowImports; + if (this.debugInfo) { + ruleset.debugInfo = this.debugInfo; + } + if (!hasOnePassingSelector) { + rules.length = 0; + } + // inherit a function registry from the frames stack when possible; + // otherwise from the global registry + ruleset.functionRegistry = (function (frames) { + var i = 0; + var n = frames.length; + var found; + for (; i !== n; ++i) { + found = frames[i].functionRegistry; + if (found) { + return found; + } + } + return functionRegistry; + }(context.frames)).inherit(); + // push the current ruleset to the frames stack + var ctxFrames = context.frames; + ctxFrames.unshift(ruleset); + // currrent selectors + var ctxSelectors = context.selectors; + if (!ctxSelectors) { + context.selectors = ctxSelectors = []; + } + ctxSelectors.unshift(this.selectors); + // Evaluate imports + if (ruleset.root || ruleset.allowImports || !ruleset.strictImports) { + ruleset.evalImports(context); + } + // Store the frames around mixin definitions, + // so they can be evaluated like closures when the time comes. + var rsRules = ruleset.rules; + for (i = 0; (rule = rsRules[i]); i++) { + if (rule.evalFirst) { + rsRules[i] = rule.eval(context); + } + } + var mediaBlockCount = (context.mediaBlocks && context.mediaBlocks.length) || 0; + // Evaluate mixin calls. + for (i = 0; (rule = rsRules[i]); i++) { + if (rule.type === 'MixinCall') { + /* jshint loopfunc:true */ + rules = rule.eval(context).filter(function (r) { + if ((r instanceof Declaration) && r.variable) { + // do not pollute the scope if the variable is + // already there. consider returning false here + // but we need a way to "return" variable from mixins + return !(ruleset.variable(r.name)); + } + return true; + }); + rsRules.splice.apply(rsRules, [i, 1].concat(rules)); + i += rules.length - 1; + ruleset.resetCache(); + } + else if (rule.type === 'VariableCall') { + /* jshint loopfunc:true */ + rules = rule.eval(context).rules.filter(function (r) { + if ((r instanceof Declaration) && r.variable) { + // do not pollute the scope at all + return false; + } + return true; + }); + rsRules.splice.apply(rsRules, [i, 1].concat(rules)); + i += rules.length - 1; + ruleset.resetCache(); + } + } + // Evaluate everything else + for (i = 0; (rule = rsRules[i]); i++) { + if (!rule.evalFirst) { + rsRules[i] = rule = rule.eval ? rule.eval(context) : rule; + } + } + // Evaluate everything else + for (i = 0; (rule = rsRules[i]); i++) { + // for rulesets, check if it is a css guard and can be removed + if (rule instanceof Ruleset && rule.selectors && rule.selectors.length === 1) { + // check if it can be folded in (e.g. & where) + if (rule.selectors[0] && rule.selectors[0].isJustParentSelector()) { + rsRules.splice(i--, 1); + for (var j = 0; (subRule = rule.rules[j]); j++) { + if (subRule instanceof Node) { + subRule.copyVisibilityInfo(rule.visibilityInfo()); + if (!(subRule instanceof Declaration) || !subRule.variable) { + rsRules.splice(++i, 0, subRule); + } + } + } + } + } + } + // Pop the stack + ctxFrames.shift(); + ctxSelectors.shift(); + if (context.mediaBlocks) { + for (i = mediaBlockCount; i < context.mediaBlocks.length; i++) { + context.mediaBlocks[i].bubbleSelectors(selectors); + } + } + return ruleset; + }, + evalImports: function (context) { + var rules = this.rules; + var i; + var importRules; + if (!rules) { + return; + } + for (i = 0; i < rules.length; i++) { + if (rules[i].type === 'Import') { + importRules = rules[i].eval(context); + if (importRules && (importRules.length || importRules.length === 0)) { + rules.splice.apply(rules, [i, 1].concat(importRules)); + i += importRules.length - 1; + } + else { + rules.splice(i, 1, importRules); + } + this.resetCache(); + } + } + }, + makeImportant: function () { + var result = new Ruleset(this.selectors, this.rules.map(function (r) { + if (r.makeImportant) { + return r.makeImportant(); + } + else { + return r; + } + }), this.strictImports, this.visibilityInfo()); + return result; + }, + matchArgs: function (args) { + return !args || args.length === 0; + }, + // lets you call a css selector with a guard + matchCondition: function (args, context) { + var lastSelector = this.selectors[this.selectors.length - 1]; + if (!lastSelector.evaldCondition) { + return false; + } + if (lastSelector.condition && + !lastSelector.condition.eval(new contexts.Eval(context, context.frames))) { + return false; + } + return true; + }, + resetCache: function () { + this._rulesets = null; + this._variables = null; + this._properties = null; + this._lookups = {}; + }, + variables: function () { + if (!this._variables) { + this._variables = !this.rules ? {} : this.rules.reduce(function (hash, r) { + if (r instanceof Declaration && r.variable === true) { + hash[r.name] = r; + } + // when evaluating variables in an import statement, imports have not been eval'd + // so we need to go inside import statements. + // guard against root being a string (in the case of inlined less) + if (r.type === 'Import' && r.root && r.root.variables) { + var vars = r.root.variables(); + for (var name_1 in vars) { + if (vars.hasOwnProperty(name_1)) { + hash[name_1] = r.root.variable(name_1); + } + } + } + return hash; + }, {}); + } + return this._variables; + }, + properties: function () { + if (!this._properties) { + this._properties = !this.rules ? {} : this.rules.reduce(function (hash, r) { + if (r instanceof Declaration && r.variable !== true) { + var name_2 = (r.name.length === 1) && (r.name[0] instanceof Keyword) ? + r.name[0].value : r.name; + // Properties don't overwrite as they can merge + if (!hash["$" + name_2]) { + hash["$" + name_2] = [r]; + } + else { + hash["$" + name_2].push(r); + } + } + return hash; + }, {}); + } + return this._properties; + }, + variable: function (name) { + var decl = this.variables()[name]; + if (decl) { + return this.parseValue(decl); + } + }, + property: function (name) { + var decl = this.properties()[name]; + if (decl) { + return this.parseValue(decl); + } + }, + lastDeclaration: function () { + for (var i = this.rules.length; i > 0; i--) { + var decl = this.rules[i - 1]; + if (decl instanceof Declaration) { + return this.parseValue(decl); + } + } + }, + parseValue: function (toParse) { + var self = this; + function transformDeclaration(decl) { + if (decl.value instanceof Anonymous && !decl.parsed) { + if (typeof decl.value.value === 'string') { + this.parse.parseNode(decl.value.value, ['value', 'important'], decl.value.getIndex(), decl.fileInfo(), function (err, result) { + if (err) { + decl.parsed = true; + } + if (result) { + decl.value = result[0]; + decl.important = result[1] || ''; + decl.parsed = true; + } + }); + } + else { + decl.parsed = true; + } + return decl; + } + else { + return decl; + } + } + if (!Array.isArray(toParse)) { + return transformDeclaration.call(self, toParse); + } + else { + var nodes_1 = []; + toParse.forEach(function (n) { + nodes_1.push(transformDeclaration.call(self, n)); + }); + return nodes_1; + } + }, + rulesets: function () { + if (!this.rules) { + return []; + } + var filtRules = []; + var rules = this.rules; + var i; + var rule; + for (i = 0; (rule = rules[i]); i++) { + if (rule.isRuleset) { + filtRules.push(rule); + } + } + return filtRules; + }, + prependRule: function (rule) { + var rules = this.rules; + if (rules) { + rules.unshift(rule); + } + else { + this.rules = [rule]; + } + this.setParent(rule, this); + }, + find: function (selector, self, filter) { + self = self || this; + var rules = []; + var match; + var foundMixins; + var key = selector.toCSS(); + if (key in this._lookups) { + return this._lookups[key]; + } + this.rulesets().forEach(function (rule) { + if (rule !== self) { + for (var j = 0; j < rule.selectors.length; j++) { + match = selector.match(rule.selectors[j]); + if (match) { + if (selector.elements.length > match) { + if (!filter || filter(rule)) { + foundMixins = rule.find(new Selector(selector.elements.slice(match)), self, filter); + for (var i = 0; i < foundMixins.length; ++i) { + foundMixins[i].path.push(rule); + } + Array.prototype.push.apply(rules, foundMixins); + } + } + else { + rules.push({ rule: rule, path: [] }); + } + break; + } + } + } + }); + this._lookups[key] = rules; + return rules; + }, + genCSS: function (context, output) { + var i; + var j; + var charsetRuleNodes = []; + var ruleNodes = []; + var // Line number debugging + debugInfo$1; + var rule; + var path; + context.tabLevel = (context.tabLevel || 0); + if (!this.root) { + context.tabLevel++; + } + var tabRuleStr = context.compress ? '' : Array(context.tabLevel + 1).join(' '); + var tabSetStr = context.compress ? '' : Array(context.tabLevel).join(' '); + var sep; + var charsetNodeIndex = 0; + var importNodeIndex = 0; + for (i = 0; (rule = this.rules[i]); i++) { + if (rule instanceof Comment) { + if (importNodeIndex === i) { + importNodeIndex++; + } + ruleNodes.push(rule); + } + else if (rule.isCharset && rule.isCharset()) { + ruleNodes.splice(charsetNodeIndex, 0, rule); + charsetNodeIndex++; + importNodeIndex++; + } + else if (rule.type === 'Import') { + ruleNodes.splice(importNodeIndex, 0, rule); + importNodeIndex++; + } + else { + ruleNodes.push(rule); + } + } + ruleNodes = charsetRuleNodes.concat(ruleNodes); + // If this is the root node, we don't render + // a selector, or {}. + if (!this.root) { + debugInfo$1 = debugInfo(context, this, tabSetStr); + if (debugInfo$1) { + output.add(debugInfo$1); + output.add(tabSetStr); + } + var paths = this.paths; + var pathCnt = paths.length; + var pathSubCnt = void 0; + sep = context.compress ? ',' : (",\n" + tabSetStr); + for (i = 0; i < pathCnt; i++) { + path = paths[i]; + if (!(pathSubCnt = path.length)) { + continue; + } + if (i > 0) { + output.add(sep); + } + context.firstSelector = true; + path[0].genCSS(context, output); + context.firstSelector = false; + for (j = 1; j < pathSubCnt; j++) { + path[j].genCSS(context, output); + } + } + output.add((context.compress ? '{' : ' {\n') + tabRuleStr); + } + // Compile rules and rulesets + for (i = 0; (rule = ruleNodes[i]); i++) { + if (i + 1 === ruleNodes.length) { + context.lastRule = true; + } + var currentLastRule = context.lastRule; + if (rule.isRulesetLike(rule)) { + context.lastRule = false; + } + if (rule.genCSS) { + rule.genCSS(context, output); + } + else if (rule.value) { + output.add(rule.value.toString()); + } + context.lastRule = currentLastRule; + if (!context.lastRule && rule.isVisible()) { + output.add(context.compress ? '' : ("\n" + tabRuleStr)); + } + else { + context.lastRule = false; + } + } + if (!this.root) { + output.add((context.compress ? '}' : "\n" + tabSetStr + "}")); + context.tabLevel--; + } + if (!output.isEmpty() && !context.compress && this.firstRoot) { + output.add('\n'); + } + }, + joinSelectors: function (paths, context, selectors) { + for (var s = 0; s < selectors.length; s++) { + this.joinSelector(paths, context, selectors[s]); + } + }, + joinSelector: function (paths, context, selector) { + function createParenthesis(elementsToPak, originalElement) { + var replacementParen, j; + if (elementsToPak.length === 0) { + replacementParen = new Paren(elementsToPak[0]); + } + else { + var insideParent = new Array(elementsToPak.length); + for (j = 0; j < elementsToPak.length; j++) { + insideParent[j] = new Element(null, elementsToPak[j], originalElement.isVariable, originalElement._index, originalElement._fileInfo); + } + replacementParen = new Paren(new Selector(insideParent)); + } + return replacementParen; + } + function createSelector(containedElement, originalElement) { + var element, selector; + element = new Element(null, containedElement, originalElement.isVariable, originalElement._index, originalElement._fileInfo); + selector = new Selector([element]); + return selector; + } + // joins selector path from `beginningPath` with selector path in `addPath` + // `replacedElement` contains element that is being replaced by `addPath` + // returns concatenated path + function addReplacementIntoPath(beginningPath, addPath, replacedElement, originalSelector) { + var newSelectorPath, lastSelector, newJoinedSelector; + // our new selector path + newSelectorPath = []; + // construct the joined selector - if & is the first thing this will be empty, + // if not newJoinedSelector will be the last set of elements in the selector + if (beginningPath.length > 0) { + newSelectorPath = copyArray(beginningPath); + lastSelector = newSelectorPath.pop(); + newJoinedSelector = originalSelector.createDerived(copyArray(lastSelector.elements)); + } + else { + newJoinedSelector = originalSelector.createDerived([]); + } + if (addPath.length > 0) { + // /deep/ is a CSS4 selector - (removed, so should deprecate) + // that is valid without anything in front of it + // so if the & does not have a combinator that is "" or " " then + // and there is a combinator on the parent, then grab that. + // this also allows + a { & .b { .a & { ... though not sure why you would want to do that + var combinator = replacedElement.combinator; + var parentEl = addPath[0].elements[0]; + if (combinator.emptyOrWhitespace && !parentEl.combinator.emptyOrWhitespace) { + combinator = parentEl.combinator; + } + // join the elements so far with the first part of the parent + newJoinedSelector.elements.push(new Element(combinator, parentEl.value, replacedElement.isVariable, replacedElement._index, replacedElement._fileInfo)); + newJoinedSelector.elements = newJoinedSelector.elements.concat(addPath[0].elements.slice(1)); + } + // now add the joined selector - but only if it is not empty + if (newJoinedSelector.elements.length !== 0) { + newSelectorPath.push(newJoinedSelector); + } + // put together the parent selectors after the join (e.g. the rest of the parent) + if (addPath.length > 1) { + var restOfPath = addPath.slice(1); + restOfPath = restOfPath.map(function (selector) { + return selector.createDerived(selector.elements, []); + }); + newSelectorPath = newSelectorPath.concat(restOfPath); + } + return newSelectorPath; + } + // joins selector path from `beginningPath` with every selector path in `addPaths` array + // `replacedElement` contains element that is being replaced by `addPath` + // returns array with all concatenated paths + function addAllReplacementsIntoPath(beginningPath, addPaths, replacedElement, originalSelector, result) { + var j; + for (j = 0; j < beginningPath.length; j++) { + var newSelectorPath = addReplacementIntoPath(beginningPath[j], addPaths, replacedElement, originalSelector); + result.push(newSelectorPath); + } + return result; + } + function mergeElementsOnToSelectors(elements, selectors) { + var i, sel; + if (elements.length === 0) { + return; + } + if (selectors.length === 0) { + selectors.push([new Selector(elements)]); + return; + } + for (i = 0; (sel = selectors[i]); i++) { + // if the previous thing in sel is a parent this needs to join on to it + if (sel.length > 0) { + sel[sel.length - 1] = sel[sel.length - 1].createDerived(sel[sel.length - 1].elements.concat(elements)); + } + else { + sel.push(new Selector(elements)); + } + } + } + // replace all parent selectors inside `inSelector` by content of `context` array + // resulting selectors are returned inside `paths` array + // returns true if `inSelector` contained at least one parent selector + function replaceParentSelector(paths, context, inSelector) { + // The paths are [[Selector]] + // The first list is a list of comma separated selectors + // The inner list is a list of inheritance separated selectors + // e.g. + // .a, .b { + // .c { + // } + // } + // == [[.a] [.c]] [[.b] [.c]] + // + var i, j, k, currentElements, newSelectors, selectorsMultiplied, sel, el, hadParentSelector = false, length, lastSelector; + function findNestedSelector(element) { + var maybeSelector; + if (!(element.value instanceof Paren)) { + return null; + } + maybeSelector = element.value.value; + if (!(maybeSelector instanceof Selector)) { + return null; + } + return maybeSelector; + } + // the elements from the current selector so far + currentElements = []; + // the current list of new selectors to add to the path. + // We will build it up. We initiate it with one empty selector as we "multiply" the new selectors + // by the parents + newSelectors = [ + [] + ]; + for (i = 0; (el = inSelector.elements[i]); i++) { + // non parent reference elements just get added + if (el.value !== '&') { + var nestedSelector = findNestedSelector(el); + if (nestedSelector != null) { + // merge the current list of non parent selector elements + // on to the current list of selectors to add + mergeElementsOnToSelectors(currentElements, newSelectors); + var nestedPaths = []; + var replaced = void 0; + var replacedNewSelectors = []; + replaced = replaceParentSelector(nestedPaths, context, nestedSelector); + hadParentSelector = hadParentSelector || replaced; + // the nestedPaths array should have only one member - replaceParentSelector does not multiply selectors + for (k = 0; k < nestedPaths.length; k++) { + var replacementSelector = createSelector(createParenthesis(nestedPaths[k], el), el); + addAllReplacementsIntoPath(newSelectors, [replacementSelector], el, inSelector, replacedNewSelectors); + } + newSelectors = replacedNewSelectors; + currentElements = []; + } + else { + currentElements.push(el); + } + } + else { + hadParentSelector = true; + // the new list of selectors to add + selectorsMultiplied = []; + // merge the current list of non parent selector elements + // on to the current list of selectors to add + mergeElementsOnToSelectors(currentElements, newSelectors); + // loop through our current selectors + for (j = 0; j < newSelectors.length; j++) { + sel = newSelectors[j]; + // if we don't have any parent paths, the & might be in a mixin so that it can be used + // whether there are parents or not + if (context.length === 0) { + // the combinator used on el should now be applied to the next element instead so that + // it is not lost + if (sel.length > 0) { + sel[0].elements.push(new Element(el.combinator, '', el.isVariable, el._index, el._fileInfo)); + } + selectorsMultiplied.push(sel); + } + else { + // and the parent selectors + for (k = 0; k < context.length; k++) { + // We need to put the current selectors + // then join the last selector's elements on to the parents selectors + var newSelectorPath = addReplacementIntoPath(sel, context[k], el, inSelector); + // add that to our new set of selectors + selectorsMultiplied.push(newSelectorPath); + } + } + } + // our new selectors has been multiplied, so reset the state + newSelectors = selectorsMultiplied; + currentElements = []; + } + } + // if we have any elements left over (e.g. .a& .b == .b) + // add them on to all the current selectors + mergeElementsOnToSelectors(currentElements, newSelectors); + for (i = 0; i < newSelectors.length; i++) { + length = newSelectors[i].length; + if (length > 0) { + paths.push(newSelectors[i]); + lastSelector = newSelectors[i][length - 1]; + newSelectors[i][length - 1] = lastSelector.createDerived(lastSelector.elements, inSelector.extendList); + } + } + return hadParentSelector; + } + function deriveSelector(visibilityInfo, deriveFrom) { + var newSelector = deriveFrom.createDerived(deriveFrom.elements, deriveFrom.extendList, deriveFrom.evaldCondition); + newSelector.copyVisibilityInfo(visibilityInfo); + return newSelector; + } + // joinSelector code follows + var i, newPaths, hadParentSelector; + newPaths = []; + hadParentSelector = replaceParentSelector(newPaths, context, selector); + if (!hadParentSelector) { + if (context.length > 0) { + newPaths = []; + for (i = 0; i < context.length; i++) { + var concatenated = context[i].map(deriveSelector.bind(this, selector.visibilityInfo())); + concatenated.push(selector); + newPaths.push(concatenated); + } + } + else { + newPaths = [[selector]]; + } + } + for (i = 0; i < newPaths.length; i++) { + paths.push(newPaths[i]); + } + } + }); + + var AtRule = function (name, value, rules, index, currentFileInfo, debugInfo, isRooted, visibilityInfo) { + var i; + this.name = name; + this.value = (value instanceof Node) ? value : (value ? new Anonymous(value) : value); + if (rules) { + if (Array.isArray(rules)) { + this.rules = rules; + } + else { + this.rules = [rules]; + this.rules[0].selectors = (new Selector([], null, null, index, currentFileInfo)).createEmptySelectors(); + } + for (i = 0; i < this.rules.length; i++) { + this.rules[i].allowImports = true; + } + this.setParent(this.rules, this); + } + this._index = index; + this._fileInfo = currentFileInfo; + this.debugInfo = debugInfo; + this.isRooted = isRooted || false; + this.copyVisibilityInfo(visibilityInfo); + this.allowRoot = true; + }; + AtRule.prototype = Object.assign(new Node(), { + type: 'AtRule', + accept: function (visitor) { + var value = this.value, rules = this.rules; + if (rules) { + this.rules = visitor.visitArray(rules); + } + if (value) { + this.value = visitor.visit(value); + } + }, + isRulesetLike: function () { + return this.rules || !this.isCharset(); + }, + isCharset: function () { + return '@charset' === this.name; + }, + genCSS: function (context, output) { + var value = this.value, rules = this.rules; + output.add(this.name, this.fileInfo(), this.getIndex()); + if (value) { + output.add(' '); + value.genCSS(context, output); + } + if (rules) { + this.outputRuleset(context, output, rules); + } + else { + output.add(';'); + } + }, + eval: function (context) { + var mediaPathBackup, mediaBlocksBackup, value = this.value, rules = this.rules; + // media stored inside other atrule should not bubble over it + // backpup media bubbling information + mediaPathBackup = context.mediaPath; + mediaBlocksBackup = context.mediaBlocks; + // deleted media bubbling information + context.mediaPath = []; + context.mediaBlocks = []; + if (value) { + value = value.eval(context); + } + if (rules) { + // assuming that there is only one rule at this point - that is how parser constructs the rule + rules = [rules[0].eval(context)]; + rules[0].root = true; + } + // restore media bubbling information + context.mediaPath = mediaPathBackup; + context.mediaBlocks = mediaBlocksBackup; + return new AtRule(this.name, value, rules, this.getIndex(), this.fileInfo(), this.debugInfo, this.isRooted, this.visibilityInfo()); + }, + variable: function (name) { + if (this.rules) { + // assuming that there is only one rule at this point - that is how parser constructs the rule + return Ruleset.prototype.variable.call(this.rules[0], name); + } + }, + find: function () { + if (this.rules) { + // assuming that there is only one rule at this point - that is how parser constructs the rule + return Ruleset.prototype.find.apply(this.rules[0], arguments); + } + }, + rulesets: function () { + if (this.rules) { + // assuming that there is only one rule at this point - that is how parser constructs the rule + return Ruleset.prototype.rulesets.apply(this.rules[0]); + } + }, + outputRuleset: function (context, output, rules) { + var ruleCnt = rules.length; + var i; + context.tabLevel = (context.tabLevel | 0) + 1; + // Compressed + if (context.compress) { + output.add('{'); + for (i = 0; i < ruleCnt; i++) { + rules[i].genCSS(context, output); + } + output.add('}'); + context.tabLevel--; + return; + } + // Non-compressed + var tabSetStr = "\n" + Array(context.tabLevel).join(' '), tabRuleStr = tabSetStr + " "; + if (!ruleCnt) { + output.add(" {" + tabSetStr + "}"); + } + else { + output.add(" {" + tabRuleStr); + rules[0].genCSS(context, output); + for (i = 1; i < ruleCnt; i++) { + output.add(tabRuleStr); + rules[i].genCSS(context, output); + } + output.add(tabSetStr + "}"); + } + context.tabLevel--; + } + }); + + var DetachedRuleset = function (ruleset, frames) { + this.ruleset = ruleset; + this.frames = frames; + this.setParent(this.ruleset, this); + }; + DetachedRuleset.prototype = Object.assign(new Node(), { + type: 'DetachedRuleset', + evalFirst: true, + accept: function (visitor) { + this.ruleset = visitor.visit(this.ruleset); + }, + eval: function (context) { + var frames = this.frames || copyArray(context.frames); + return new DetachedRuleset(this.ruleset, frames); + }, + callEval: function (context) { + return this.ruleset.eval(this.frames ? new contexts.Eval(context, this.frames.concat(context.frames)) : context); + } + }); + + var Unit = function (numerator, denominator, backupUnit) { + this.numerator = numerator ? copyArray(numerator).sort() : []; + this.denominator = denominator ? copyArray(denominator).sort() : []; + if (backupUnit) { + this.backupUnit = backupUnit; + } + else if (numerator && numerator.length) { + this.backupUnit = numerator[0]; + } + }; + Unit.prototype = Object.assign(new Node(), { + type: 'Unit', + clone: function () { + return new Unit(copyArray(this.numerator), copyArray(this.denominator), this.backupUnit); + }, + genCSS: function (context, output) { + // Dimension checks the unit is singular and throws an error if in strict math mode. + var strictUnits = context && context.strictUnits; + if (this.numerator.length === 1) { + output.add(this.numerator[0]); // the ideal situation + } + else if (!strictUnits && this.backupUnit) { + output.add(this.backupUnit); + } + else if (!strictUnits && this.denominator.length) { + output.add(this.denominator[0]); + } + }, + toString: function () { + var i, returnStr = this.numerator.join('*'); + for (i = 0; i < this.denominator.length; i++) { + returnStr += "/" + this.denominator[i]; + } + return returnStr; + }, + compare: function (other) { + return this.is(other.toString()) ? 0 : undefined; + }, + is: function (unitString) { + return this.toString().toUpperCase() === unitString.toUpperCase(); + }, + isLength: function () { + return RegExp('^(px|em|ex|ch|rem|in|cm|mm|pc|pt|ex|vw|vh|vmin|vmax)$', 'gi').test(this.toCSS()); + }, + isEmpty: function () { + return this.numerator.length === 0 && this.denominator.length === 0; + }, + isSingular: function () { + return this.numerator.length <= 1 && this.denominator.length === 0; + }, + map: function (callback) { + var i; + for (i = 0; i < this.numerator.length; i++) { + this.numerator[i] = callback(this.numerator[i], false); + } + for (i = 0; i < this.denominator.length; i++) { + this.denominator[i] = callback(this.denominator[i], true); + } + }, + usedUnits: function () { + var group; + var result = {}; + var mapUnit; + var groupName; + mapUnit = function (atomicUnit) { + /* jshint loopfunc:true */ + if (group.hasOwnProperty(atomicUnit) && !result[groupName]) { + result[groupName] = atomicUnit; + } + return atomicUnit; + }; + for (groupName in unitConversions) { + if (unitConversions.hasOwnProperty(groupName)) { + group = unitConversions[groupName]; + this.map(mapUnit); + } + } + return result; + }, + cancel: function () { + var counter = {}; + var atomicUnit; + var i; + for (i = 0; i < this.numerator.length; i++) { + atomicUnit = this.numerator[i]; + counter[atomicUnit] = (counter[atomicUnit] || 0) + 1; + } + for (i = 0; i < this.denominator.length; i++) { + atomicUnit = this.denominator[i]; + counter[atomicUnit] = (counter[atomicUnit] || 0) - 1; + } + this.numerator = []; + this.denominator = []; + for (atomicUnit in counter) { + if (counter.hasOwnProperty(atomicUnit)) { + var count = counter[atomicUnit]; + if (count > 0) { + for (i = 0; i < count; i++) { + this.numerator.push(atomicUnit); + } + } + else if (count < 0) { + for (i = 0; i < -count; i++) { + this.denominator.push(atomicUnit); + } + } + } + } + this.numerator.sort(); + this.denominator.sort(); + } + }); + + // + // A number with a unit + // + var Dimension = function (value, unit) { + this.value = parseFloat(value); + if (isNaN(this.value)) { + throw new Error('Dimension is not a number.'); + } + this.unit = (unit && unit instanceof Unit) ? unit : + new Unit(unit ? [unit] : undefined); + this.setParent(this.unit, this); + }; + Dimension.prototype = Object.assign(new Node(), { + type: 'Dimension', + accept: function (visitor) { + this.unit = visitor.visit(this.unit); + }, + eval: function (context) { + return this; + }, + toColor: function () { + return new Color([this.value, this.value, this.value]); + }, + genCSS: function (context, output) { + if ((context && context.strictUnits) && !this.unit.isSingular()) { + throw new Error("Multiple units in dimension. Correct the units or use the unit function. Bad unit: " + this.unit.toString()); + } + var value = this.fround(context, this.value); + var strValue = String(value); + if (value !== 0 && value < 0.000001 && value > -0.000001) { + // would be output 1e-6 etc. + strValue = value.toFixed(20).replace(/0+$/, ''); + } + if (context && context.compress) { + // Zero values doesn't need a unit + if (value === 0 && this.unit.isLength()) { + output.add(strValue); + return; + } + // Float values doesn't need a leading zero + if (value > 0 && value < 1) { + strValue = (strValue).substr(1); + } + } + output.add(strValue); + this.unit.genCSS(context, output); + }, + // In an operation between two Dimensions, + // we default to the first Dimension's unit, + // so `1px + 2` will yield `3px`. + operate: function (context, op, other) { + /* jshint noempty:false */ + var value = this._operate(context, op, this.value, other.value); + var unit = this.unit.clone(); + if (op === '+' || op === '-') { + if (unit.numerator.length === 0 && unit.denominator.length === 0) { + unit = other.unit.clone(); + if (this.unit.backupUnit) { + unit.backupUnit = this.unit.backupUnit; + } + } + else if (other.unit.numerator.length === 0 && unit.denominator.length === 0) ; + else { + other = other.convertTo(this.unit.usedUnits()); + if (context.strictUnits && other.unit.toString() !== unit.toString()) { + throw new Error("Incompatible units. Change the units or use the unit function. " + + ("Bad units: '" + unit.toString() + "' and '" + other.unit.toString() + "'.")); + } + value = this._operate(context, op, this.value, other.value); + } + } + else if (op === '*') { + unit.numerator = unit.numerator.concat(other.unit.numerator).sort(); + unit.denominator = unit.denominator.concat(other.unit.denominator).sort(); + unit.cancel(); + } + else if (op === '/') { + unit.numerator = unit.numerator.concat(other.unit.denominator).sort(); + unit.denominator = unit.denominator.concat(other.unit.numerator).sort(); + unit.cancel(); + } + return new Dimension(value, unit); + }, + compare: function (other) { + var a, b; + if (!(other instanceof Dimension)) { + return undefined; + } + if (this.unit.isEmpty() || other.unit.isEmpty()) { + a = this; + b = other; + } + else { + a = this.unify(); + b = other.unify(); + if (a.unit.compare(b.unit) !== 0) { + return undefined; + } + } + return Node.numericCompare(a.value, b.value); + }, + unify: function () { + return this.convertTo({ length: 'px', duration: 's', angle: 'rad' }); + }, + convertTo: function (conversions) { + var value = this.value; + var unit = this.unit.clone(); + var i; + var groupName; + var group; + var targetUnit; + var derivedConversions = {}; + var applyUnit; + if (typeof conversions === 'string') { + for (i in unitConversions) { + if (unitConversions[i].hasOwnProperty(conversions)) { + derivedConversions = {}; + derivedConversions[i] = conversions; + } + } + conversions = derivedConversions; + } + applyUnit = function (atomicUnit, denominator) { + /* jshint loopfunc:true */ + if (group.hasOwnProperty(atomicUnit)) { + if (denominator) { + value = value / (group[atomicUnit] / group[targetUnit]); + } + else { + value = value * (group[atomicUnit] / group[targetUnit]); + } + return targetUnit; + } + return atomicUnit; + }; + for (groupName in conversions) { + if (conversions.hasOwnProperty(groupName)) { + targetUnit = conversions[groupName]; + group = unitConversions[groupName]; + unit.map(applyUnit); + } + } + unit.cancel(); + return new Dimension(value, unit); + } + }); + + var MATH$1 = Math$1; + var Operation = function (op, operands, isSpaced) { + this.op = op.trim(); + this.operands = operands; + this.isSpaced = isSpaced; + }; + Operation.prototype = Object.assign(new Node(), { + type: 'Operation', + accept: function (visitor) { + this.operands = visitor.visitArray(this.operands); + }, + eval: function (context) { + var a = this.operands[0].eval(context), b = this.operands[1].eval(context), op; + if (context.isMathOn(this.op)) { + op = this.op === './' ? '/' : this.op; + if (a instanceof Dimension && b instanceof Color) { + a = a.toColor(); + } + if (b instanceof Dimension && a instanceof Color) { + b = b.toColor(); + } + if (!a.operate || !b.operate) { + if ((a instanceof Operation || b instanceof Operation) + && a.op === '/' && context.math === MATH$1.PARENS_DIVISION) { + return new Operation(this.op, [a, b], this.isSpaced); + } + throw { type: 'Operation', + message: 'Operation on an invalid type' }; + } + return a.operate(context, op, b); + } + else { + return new Operation(this.op, [a, b], this.isSpaced); + } + }, + genCSS: function (context, output) { + this.operands[0].genCSS(context, output); + if (this.isSpaced) { + output.add(' '); + } + output.add(this.op); + if (this.isSpaced) { + output.add(' '); + } + this.operands[1].genCSS(context, output); + } + }); + + /*! ***************************************************************************** + Copyright (c) Microsoft Corporation. + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted. + + THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH + REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, + INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + PERFORMANCE OF THIS SOFTWARE. + ***************************************************************************** */ + + function __spreadArrays$1() { + for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; + for (var r = Array(s), k = 0, i = 0; i < il; i++) + for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) + r[k] = a[j]; + return r; + } + + var Expression = function (value, noSpacing) { + this.value = value; + this.noSpacing = noSpacing; + if (!value) { + throw new Error('Expression requires an array parameter'); + } + }; + Expression.prototype = Object.assign(new Node(), { + type: 'Expression', + accept: function (visitor) { + this.value = visitor.visitArray(this.value); + }, + eval: function (context) { + var returnValue; + var mathOn = context.isMathOn(); + var inParenthesis = this.parens; + var doubleParen = false; + if (inParenthesis) { + context.inParenthesis(); + } + if (this.value.length > 1) { + returnValue = new Expression(this.value.map(function (e) { + if (!e.eval) { + return e; + } + return e.eval(context); + }), this.noSpacing); + } + else if (this.value.length === 1) { + if (this.value[0].parens && !this.value[0].parensInOp && !context.inCalc) { + doubleParen = true; + } + returnValue = this.value[0].eval(context); + } + else { + returnValue = this; + } + if (inParenthesis) { + context.outOfParenthesis(); + } + if (this.parens && this.parensInOp && !mathOn && !doubleParen + && (!(returnValue instanceof Dimension))) { + returnValue = new Paren(returnValue); + } + return returnValue; + }, + genCSS: function (context, output) { + for (var i = 0; i < this.value.length; i++) { + this.value[i].genCSS(context, output); + if (!this.noSpacing && i + 1 < this.value.length) { + output.add(' '); + } + } + }, + throwAwayComments: function () { + this.value = this.value.filter(function (v) { + return !(v instanceof Comment); + }); + } + }); + + var functionCaller = /** @class */ (function () { + function functionCaller(name, context, index, currentFileInfo) { + this.name = name.toLowerCase(); + this.index = index; + this.context = context; + this.currentFileInfo = currentFileInfo; + this.func = context.frames[0].functionRegistry.get(this.name); + } + functionCaller.prototype.isValid = function () { + return Boolean(this.func); + }; + functionCaller.prototype.call = function (args) { + var _this = this; + if (!(Array.isArray(args))) { + args = [args]; + } + var evalArgs = this.func.evalArgs; + if (evalArgs !== false) { + args = args.map(function (a) { return a.eval(_this.context); }); + } + var commentFilter = function (item) { return !(item.type === 'Comment'); }; + // This code is terrible and should be replaced as per this issue... + // https://github.com/less/less.js/issues/2477 + args = args + .filter(commentFilter) + .map(function (item) { + if (item.type === 'Expression') { + var subNodes = item.value.filter(commentFilter); + if (subNodes.length === 1) { + return subNodes[0]; + } + else { + return new Expression(subNodes); + } + } + return item; + }); + if (evalArgs === false) { + return this.func.apply(this, __spreadArrays$1([this.context], args)); + } + return this.func.apply(this, args); + }; + return functionCaller; + }()); + + // + // A function call node. + // + var Call = function (name, args, index, currentFileInfo) { + this.name = name; + this.args = args; + this.calc = name === 'calc'; + this._index = index; + this._fileInfo = currentFileInfo; + }; + Call.prototype = Object.assign(new Node(), { + type: 'Call', + accept: function (visitor) { + if (this.args) { + this.args = visitor.visitArray(this.args); + } + }, + // + // When evaluating a function call, + // we either find the function in the functionRegistry, + // in which case we call it, passing the evaluated arguments, + // if this returns null or we cannot find the function, we + // simply print it out as it appeared originally [2]. + // + // The reason why we evaluate the arguments, is in the case where + // we try to pass a variable to a function, like: `saturate(@color)`. + // The function should receive the value, not the variable. + // + eval: function (context) { + var _this = this; + /** + * Turn off math for calc(), and switch back on for evaluating nested functions + */ + var currentMathContext = context.mathOn; + context.mathOn = !this.calc; + if (this.calc || context.inCalc) { + context.enterCalc(); + } + var exitCalc = function () { + if (_this.calc || context.inCalc) { + context.exitCalc(); + } + context.mathOn = currentMathContext; + }; + var result; + var funcCaller = new functionCaller(this.name, context, this.getIndex(), this.fileInfo()); + if (funcCaller.isValid()) { + try { + result = funcCaller.call(this.args); + exitCalc(); + } + catch (e) { + if (e.hasOwnProperty('line') && e.hasOwnProperty('column')) { + throw e; + } + throw { + type: e.type || 'Runtime', + message: "Error evaluating function `" + this.name + "`" + (e.message ? ": " + e.message : ''), + index: this.getIndex(), + filename: this.fileInfo().filename, + line: e.lineNumber, + column: e.columnNumber + }; + } + } + if (result !== null && result !== undefined) { + // Results that that are not nodes are cast as Anonymous nodes + // Falsy values or booleans are returned as empty nodes + if (!(result instanceof Node)) { + if (!result || result === true) { + result = new Anonymous(null); + } + else { + result = new Anonymous(result.toString()); + } + } + result._index = this._index; + result._fileInfo = this._fileInfo; + return result; + } + var args = this.args.map(function (a) { return a.eval(context); }); + exitCalc(); + return new Call(this.name, args, this.getIndex(), this.fileInfo()); + }, + genCSS: function (context, output) { + output.add(this.name + "(", this.fileInfo(), this.getIndex()); + for (var i = 0; i < this.args.length; i++) { + this.args[i].genCSS(context, output); + if (i + 1 < this.args.length) { + output.add(', '); + } + } + output.add(')'); + } + }); + + var Variable = function (name, index, currentFileInfo) { + this.name = name; + this._index = index; + this._fileInfo = currentFileInfo; + }; + Variable.prototype = Object.assign(new Node(), { + type: 'Variable', + eval: function (context) { + var variable, name = this.name; + if (name.indexOf('@@') === 0) { + name = "@" + new Variable(name.slice(1), this.getIndex(), this.fileInfo()).eval(context).value; + } + if (this.evaluating) { + throw { type: 'Name', message: "Recursive variable definition for " + name, filename: this.fileInfo().filename, + index: this.getIndex() }; + } + this.evaluating = true; + variable = this.find(context.frames, function (frame) { + var v = frame.variable(name); + if (v) { + if (v.important) { + var importantScope = context.importantScope[context.importantScope.length - 1]; + importantScope.important = v.important; + } + // If in calc, wrap vars in a function call to cascade evaluate args first + if (context.inCalc) { + return (new Call('_SELF', [v.value])).eval(context); + } + else { + return v.value.eval(context); + } + } + }); + if (variable) { + this.evaluating = false; + return variable; + } + else { + throw { type: 'Name', message: "variable " + name + " is undefined", filename: this.fileInfo().filename, + index: this.getIndex() }; + } + }, + find: function (obj, fun) { + for (var i = 0, r = void 0; i < obj.length; i++) { + r = fun.call(obj, obj[i]); + if (r) { + return r; + } + } + return null; + } + }); + + var Property = function (name, index, currentFileInfo) { + this.name = name; + this._index = index; + this._fileInfo = currentFileInfo; + }; + Property.prototype = Object.assign(new Node(), { + type: 'Property', + eval: function (context) { + var property; + var name = this.name; + // TODO: shorten this reference + var mergeRules = context.pluginManager.less.visitors.ToCSSVisitor.prototype._mergeRules; + if (this.evaluating) { + throw { type: 'Name', message: "Recursive property reference for " + name, filename: this.fileInfo().filename, + index: this.getIndex() }; + } + this.evaluating = true; + property = this.find(context.frames, function (frame) { + var v; + var vArr = frame.property(name); + if (vArr) { + for (var i = 0; i < vArr.length; i++) { + v = vArr[i]; + vArr[i] = new Declaration(v.name, v.value, v.important, v.merge, v.index, v.currentFileInfo, v.inline, v.variable); + } + mergeRules(vArr); + v = vArr[vArr.length - 1]; + if (v.important) { + var importantScope = context.importantScope[context.importantScope.length - 1]; + importantScope.important = v.important; + } + v = v.value.eval(context); + return v; + } + }); + if (property) { + this.evaluating = false; + return property; + } + else { + throw { type: 'Name', message: "Property '" + name + "' is undefined", filename: this.currentFileInfo.filename, + index: this.index }; + } + }, + find: function (obj, fun) { + for (var i = 0, r = void 0; i < obj.length; i++) { + r = fun.call(obj, obj[i]); + if (r) { + return r; + } + } + return null; + } + }); + + var Attribute = function (key, op, value) { + this.key = key; + this.op = op; + this.value = value; + }; + Attribute.prototype = Object.assign(new Node(), { + type: 'Attribute', + eval: function (context) { + return new Attribute(this.key.eval ? this.key.eval(context) : this.key, this.op, (this.value && this.value.eval) ? this.value.eval(context) : this.value); + }, + genCSS: function (context, output) { + output.add(this.toCSS(context)); + }, + toCSS: function (context) { + var value = this.key.toCSS ? this.key.toCSS(context) : this.key; + if (this.op) { + value += this.op; + value += (this.value.toCSS ? this.value.toCSS(context) : this.value); + } + return "[" + value + "]"; + } + }); + + var Quoted = function (str, content, escaped, index, currentFileInfo) { + this.escaped = (escaped == null) ? true : escaped; + this.value = content || ''; + this.quote = str.charAt(0); + this._index = index; + this._fileInfo = currentFileInfo; + this.variableRegex = /@\{([\w-]+)\}/g; + this.propRegex = /\$\{([\w-]+)\}/g; + this.allowRoot = escaped; + }; + Quoted.prototype = Object.assign(new Node(), { + type: 'Quoted', + genCSS: function (context, output) { + if (!this.escaped) { + output.add(this.quote, this.fileInfo(), this.getIndex()); + } + output.add(this.value); + if (!this.escaped) { + output.add(this.quote); + } + }, + containsVariables: function () { + return this.value.match(this.variableRegex); + }, + eval: function (context) { + var that = this; + var value = this.value; + var variableReplacement = function (_, name) { + var v = new Variable("@" + name, that.getIndex(), that.fileInfo()).eval(context, true); + return (v instanceof Quoted) ? v.value : v.toCSS(); + }; + var propertyReplacement = function (_, name) { + var v = new Property("$" + name, that.getIndex(), that.fileInfo()).eval(context, true); + return (v instanceof Quoted) ? v.value : v.toCSS(); + }; + function iterativeReplace(value, regexp, replacementFnc) { + var evaluatedValue = value; + do { + value = evaluatedValue.toString(); + evaluatedValue = value.replace(regexp, replacementFnc); + } while (value !== evaluatedValue); + return evaluatedValue; + } + value = iterativeReplace(value, this.variableRegex, variableReplacement); + value = iterativeReplace(value, this.propRegex, propertyReplacement); + return new Quoted(this.quote + value + this.quote, value, this.escaped, this.getIndex(), this.fileInfo()); + }, + compare: function (other) { + // when comparing quoted strings allow the quote to differ + if (other.type === 'Quoted' && !this.escaped && !other.escaped) { + return Node.numericCompare(this.value, other.value); + } + else { + return other.toCSS && this.toCSS() === other.toCSS() ? 0 : undefined; + } + } + }); + + function escapePath(path) { + return path.replace(/[\(\)'"\s]/g, function (match) { return "\\" + match; }); + } + var URL = function (val, index, currentFileInfo, isEvald) { + this.value = val; + this._index = index; + this._fileInfo = currentFileInfo; + this.isEvald = isEvald; + }; + URL.prototype = Object.assign(new Node(), { + type: 'Url', + accept: function (visitor) { + this.value = visitor.visit(this.value); + }, + genCSS: function (context, output) { + output.add('url('); + this.value.genCSS(context, output); + output.add(')'); + }, + eval: function (context) { + var val = this.value.eval(context); + var rootpath; + if (!this.isEvald) { + // Add the rootpath if the URL requires a rewrite + rootpath = this.fileInfo() && this.fileInfo().rootpath; + if (typeof rootpath === 'string' && + typeof val.value === 'string' && + context.pathRequiresRewrite(val.value)) { + if (!val.quote) { + rootpath = escapePath(rootpath); + } + val.value = context.rewritePath(val.value, rootpath); + } + else { + val.value = context.normalizePath(val.value); + } + // Add url args if enabled + if (context.urlArgs) { + if (!val.value.match(/^\s*data:/)) { + var delimiter = val.value.indexOf('?') === -1 ? '?' : '&'; + var urlArgs = delimiter + context.urlArgs; + if (val.value.indexOf('#') !== -1) { + val.value = val.value.replace('#', urlArgs + "#"); + } + else { + val.value += urlArgs; + } + } + } + } + return new URL(val, this.getIndex(), this.fileInfo(), true); + } + }); + + var Media = function (value, features, index, currentFileInfo, visibilityInfo) { + this._index = index; + this._fileInfo = currentFileInfo; + var selectors = (new Selector([], null, null, this._index, this._fileInfo)).createEmptySelectors(); + this.features = new Value(features); + this.rules = [new Ruleset(selectors, value)]; + this.rules[0].allowImports = true; + this.copyVisibilityInfo(visibilityInfo); + this.allowRoot = true; + this.setParent(selectors, this); + this.setParent(this.features, this); + this.setParent(this.rules, this); + }; + Media.prototype = Object.assign(new AtRule(), { + type: 'Media', + isRulesetLike: function () { + return true; + }, + accept: function (visitor) { + if (this.features) { + this.features = visitor.visit(this.features); + } + if (this.rules) { + this.rules = visitor.visitArray(this.rules); + } + }, + genCSS: function (context, output) { + output.add('@media ', this._fileInfo, this._index); + this.features.genCSS(context, output); + this.outputRuleset(context, output, this.rules); + }, + eval: function (context) { + if (!context.mediaBlocks) { + context.mediaBlocks = []; + context.mediaPath = []; + } + var media = new Media(null, [], this._index, this._fileInfo, this.visibilityInfo()); + if (this.debugInfo) { + this.rules[0].debugInfo = this.debugInfo; + media.debugInfo = this.debugInfo; + } + media.features = this.features.eval(context); + context.mediaPath.push(media); + context.mediaBlocks.push(media); + this.rules[0].functionRegistry = context.frames[0].functionRegistry.inherit(); + context.frames.unshift(this.rules[0]); + media.rules = [this.rules[0].eval(context)]; + context.frames.shift(); + context.mediaPath.pop(); + return context.mediaPath.length === 0 ? media.evalTop(context) : + media.evalNested(context); + }, + evalTop: function (context) { + var result = this; + // Render all dependent Media blocks. + if (context.mediaBlocks.length > 1) { + var selectors = (new Selector([], null, null, this.getIndex(), this.fileInfo())).createEmptySelectors(); + result = new Ruleset(selectors, context.mediaBlocks); + result.multiMedia = true; + result.copyVisibilityInfo(this.visibilityInfo()); + this.setParent(result, this); + } + delete context.mediaBlocks; + delete context.mediaPath; + return result; + }, + evalNested: function (context) { + var i; + var value; + var path = context.mediaPath.concat([this]); + // Extract the media-query conditions separated with `,` (OR). + for (i = 0; i < path.length; i++) { + value = path[i].features instanceof Value ? + path[i].features.value : path[i].features; + path[i] = Array.isArray(value) ? value : [value]; + } + // Trace all permutations to generate the resulting media-query. + // + // (a, b and c) with nested (d, e) -> + // a and d + // a and e + // b and c and d + // b and c and e + this.features = new Value(this.permute(path).map(function (path) { + path = path.map(function (fragment) { return fragment.toCSS ? fragment : new Anonymous(fragment); }); + for (i = path.length - 1; i > 0; i--) { + path.splice(i, 0, new Anonymous('and')); + } + return new Expression(path); + })); + this.setParent(this.features, this); + // Fake a tree-node that doesn't output anything. + return new Ruleset([], []); + }, + permute: function (arr) { + if (arr.length === 0) { + return []; + } + else if (arr.length === 1) { + return arr[0]; + } + else { + var result = []; + var rest = this.permute(arr.slice(1)); + for (var i = 0; i < rest.length; i++) { + for (var j = 0; j < arr[0].length; j++) { + result.push([arr[0][j]].concat(rest[i])); + } + } + return result; + } + }, + bubbleSelectors: function (selectors) { + if (!selectors) { + return; + } + this.rules = [new Ruleset(copyArray(selectors), [this.rules[0]])]; + this.setParent(this.rules, this); + } + }); + + // + // CSS @import node + // + // The general strategy here is that we don't want to wait + // for the parsing to be completed, before we start importing + // the file. That's because in the context of a browser, + // most of the time will be spent waiting for the server to respond. + // + // On creation, we push the import path to our import queue, though + // `import,push`, we also pass it a callback, which it'll call once + // the file has been fetched, and parsed. + // + var Import = function (path, features, options, index, currentFileInfo, visibilityInfo) { + this.options = options; + this._index = index; + this._fileInfo = currentFileInfo; + this.path = path; + this.features = features; + this.allowRoot = true; + if (this.options.less !== undefined || this.options.inline) { + this.css = !this.options.less || this.options.inline; + } + else { + var pathValue = this.getPath(); + if (pathValue && /[#\.\&\?]css([\?;].*)?$/.test(pathValue)) { + this.css = true; + } + } + this.copyVisibilityInfo(visibilityInfo); + this.setParent(this.features, this); + this.setParent(this.path, this); + }; + Import.prototype = Object.assign(new Node(), { + type: 'Import', + accept: function (visitor) { + if (this.features) { + this.features = visitor.visit(this.features); + } + this.path = visitor.visit(this.path); + if (!this.options.isPlugin && !this.options.inline && this.root) { + this.root = visitor.visit(this.root); + } + }, + genCSS: function (context, output) { + if (this.css && this.path._fileInfo.reference === undefined) { + output.add('@import ', this._fileInfo, this._index); + this.path.genCSS(context, output); + if (this.features) { + output.add(' '); + this.features.genCSS(context, output); + } + output.add(';'); + } + }, + getPath: function () { + return (this.path instanceof URL) ? + this.path.value.value : this.path.value; + }, + isVariableImport: function () { + var path = this.path; + if (path instanceof URL) { + path = path.value; + } + if (path instanceof Quoted) { + return path.containsVariables(); + } + return true; + }, + evalForImport: function (context) { + var path = this.path; + if (path instanceof URL) { + path = path.value; + } + return new Import(path.eval(context), this.features, this.options, this._index, this._fileInfo, this.visibilityInfo()); + }, + evalPath: function (context) { + var path = this.path.eval(context); + var fileInfo = this._fileInfo; + if (!(path instanceof URL)) { + // Add the rootpath if the URL requires a rewrite + var pathValue = path.value; + if (fileInfo && + pathValue && + context.pathRequiresRewrite(pathValue)) { + path.value = context.rewritePath(pathValue, fileInfo.rootpath); + } + else { + path.value = context.normalizePath(path.value); + } + } + return path; + }, + eval: function (context) { + var result = this.doEval(context); + if (this.options.reference || this.blocksVisibility()) { + if (result.length || result.length === 0) { + result.forEach(function (node) { + node.addVisibilityBlock(); + }); + } + else { + result.addVisibilityBlock(); + } + } + return result; + }, + doEval: function (context) { + var ruleset; + var registry; + var features = this.features && this.features.eval(context); + if (this.options.isPlugin) { + if (this.root && this.root.eval) { + try { + this.root.eval(context); + } + catch (e) { + e.message = 'Plugin error during evaluation'; + throw new LessError(e, this.root.imports, this.root.filename); + } + } + registry = context.frames[0] && context.frames[0].functionRegistry; + if (registry && this.root && this.root.functions) { + registry.addMultiple(this.root.functions); + } + return []; + } + if (this.skip) { + if (typeof this.skip === 'function') { + this.skip = this.skip(); + } + if (this.skip) { + return []; + } + } + if (this.options.inline) { + var contents = new Anonymous(this.root, 0, { + filename: this.importedFilename, + reference: this.path._fileInfo && this.path._fileInfo.reference + }, true, true); + return this.features ? new Media([contents], this.features.value) : [contents]; + } + else if (this.css) { + var newImport = new Import(this.evalPath(context), features, this.options, this._index); + if (!newImport.css && this.error) { + throw this.error; + } + return newImport; + } + else if (this.root) { + ruleset = new Ruleset(null, copyArray(this.root.rules)); + ruleset.evalImports(context); + return this.features ? new Media(ruleset.rules, this.features.value) : ruleset.rules; + } + else { + return []; + } + } + }); + + var JsEvalNode = function () { }; + JsEvalNode.prototype = Object.assign(new Node(), { + evaluateJavaScript: function (expression, context) { + var result; + var that = this; + var evalContext = {}; + if (!context.javascriptEnabled) { + throw { message: 'Inline JavaScript is not enabled. Is it set in your options?', + filename: this.fileInfo().filename, + index: this.getIndex() }; + } + expression = expression.replace(/@\{([\w-]+)\}/g, function (_, name) { + return that.jsify(new Variable("@" + name, that.getIndex(), that.fileInfo()).eval(context)); + }); + try { + expression = new Function("return (" + expression + ")"); + } + catch (e) { + throw { message: "JavaScript evaluation error: " + e.message + " from `" + expression + "`", filename: this.fileInfo().filename, + index: this.getIndex() }; + } + var variables = context.frames[0].variables(); + for (var k in variables) { + if (variables.hasOwnProperty(k)) { + /* jshint loopfunc:true */ + evalContext[k.slice(1)] = { + value: variables[k].value, + toJS: function () { + return this.value.eval(context).toCSS(); + } + }; + } + } + try { + result = expression.call(evalContext); + } + catch (e) { + throw { message: "JavaScript evaluation error: '" + e.name + ": " + e.message.replace(/["]/g, '\'') + "'", filename: this.fileInfo().filename, + index: this.getIndex() }; + } + return result; + }, + jsify: function (obj) { + if (Array.isArray(obj.value) && (obj.value.length > 1)) { + return "[" + obj.value.map(function (v) { return v.toCSS(); }).join(', ') + "]"; + } + else { + return obj.toCSS(); + } + } + }); + + var JavaScript = function (string, escaped, index, currentFileInfo) { + this.escaped = escaped; + this.expression = string; + this._index = index; + this._fileInfo = currentFileInfo; + }; + JavaScript.prototype = Object.assign(new JsEvalNode(), { + type: 'JavaScript', + eval: function (context) { + var result = this.evaluateJavaScript(this.expression, context); + var type = typeof result; + if (type === 'number' && !isNaN(result)) { + return new Dimension(result); + } + else if (type === 'string') { + return new Quoted("\"" + result + "\"", result, this.escaped, this._index); + } + else if (Array.isArray(result)) { + return new Anonymous(result.join(', ')); + } + else { + return new Anonymous(result); + } + } + }); + + var Assignment = function (key, val) { + this.key = key; + this.value = val; + }; + Assignment.prototype = Object.assign(new Node(), { + type: 'Assignment', + accept: function (visitor) { + this.value = visitor.visit(this.value); + }, + eval: function (context) { + if (this.value.eval) { + return new Assignment(this.key, this.value.eval(context)); + } + return this; + }, + genCSS: function (context, output) { + output.add(this.key + "="); + if (this.value.genCSS) { + this.value.genCSS(context, output); + } + else { + output.add(this.value); + } + } + }); + + var Condition = function (op, l, r, i, negate) { + this.op = op.trim(); + this.lvalue = l; + this.rvalue = r; + this._index = i; + this.negate = negate; + }; + Condition.prototype = Object.assign(new Node(), { + type: 'Condition', + accept: function (visitor) { + this.lvalue = visitor.visit(this.lvalue); + this.rvalue = visitor.visit(this.rvalue); + }, + eval: function (context) { + var result = (function (op, a, b) { + switch (op) { + case 'and': return a && b; + case 'or': return a || b; + default: + switch (Node.compare(a, b)) { + case -1: + return op === '<' || op === '=<' || op === '<='; + case 0: + return op === '=' || op === '>=' || op === '=<' || op === '<='; + case 1: + return op === '>' || op === '>='; + default: + return false; + } + } + })(this.op, this.lvalue.eval(context), this.rvalue.eval(context)); + return this.negate ? !result : result; + } + }); + + var UnicodeDescriptor = function (value) { + this.value = value; + }; + UnicodeDescriptor.prototype = Object.assign(new Node(), { + type: 'UnicodeDescriptor' + }); + + var Negative = function (node) { + this.value = node; + }; + Negative.prototype = Object.assign(new Node(), { + type: 'Negative', + genCSS: function (context, output) { + output.add('-'); + this.value.genCSS(context, output); + }, + eval: function (context) { + if (context.isMathOn()) { + return (new Operation('*', [new Dimension(-1), this.value])).eval(context); + } + return new Negative(this.value.eval(context)); + } + }); + + var Extend = function (selector, option, index, currentFileInfo, visibilityInfo) { + this.selector = selector; + this.option = option; + this.object_id = Extend.next_id++; + this.parent_ids = [this.object_id]; + this._index = index; + this._fileInfo = currentFileInfo; + this.copyVisibilityInfo(visibilityInfo); + this.allowRoot = true; + switch (option) { + case 'all': + this.allowBefore = true; + this.allowAfter = true; + break; + default: + this.allowBefore = false; + this.allowAfter = false; + break; + } + this.setParent(this.selector, this); + }; + Extend.prototype = Object.assign(new Node(), { + type: 'Extend', + accept: function (visitor) { + this.selector = visitor.visit(this.selector); + }, + eval: function (context) { + return new Extend(this.selector.eval(context), this.option, this.getIndex(), this.fileInfo(), this.visibilityInfo()); + }, + clone: function (context) { + return new Extend(this.selector, this.option, this.getIndex(), this.fileInfo(), this.visibilityInfo()); + }, + // it concatenates (joins) all selectors in selector array + findSelfSelectors: function (selectors) { + var selfElements = [], i, selectorElements; + for (i = 0; i < selectors.length; i++) { + selectorElements = selectors[i].elements; + // duplicate the logic in genCSS function inside the selector node. + // future TODO - move both logics into the selector joiner visitor + if (i > 0 && selectorElements.length && selectorElements[0].combinator.value === '') { + selectorElements[0].combinator.value = ' '; + } + selfElements = selfElements.concat(selectors[i].elements); + } + this.selfSelectors = [new Selector(selfElements)]; + this.selfSelectors[0].copyVisibilityInfo(this.visibilityInfo()); + } + }); + Extend.next_id = 0; + + var VariableCall = function (variable, index, currentFileInfo) { + this.variable = variable; + this._index = index; + this._fileInfo = currentFileInfo; + this.allowRoot = true; + }; + VariableCall.prototype = Object.assign(new Node(), { + type: 'VariableCall', + eval: function (context) { + var rules; + var detachedRuleset = new Variable(this.variable, this.getIndex(), this.fileInfo()).eval(context); + var error = new LessError({ message: "Could not evaluate variable call " + this.variable }); + if (!detachedRuleset.ruleset) { + if (detachedRuleset.rules) { + rules = detachedRuleset; + } + else if (Array.isArray(detachedRuleset)) { + rules = new Ruleset('', detachedRuleset); + } + else if (Array.isArray(detachedRuleset.value)) { + rules = new Ruleset('', detachedRuleset.value); + } + else { + throw error; + } + detachedRuleset = new DetachedRuleset(rules); + } + if (detachedRuleset.ruleset) { + return detachedRuleset.callEval(context); + } + throw error; + } + }); + + var NamespaceValue = function (ruleCall, lookups, index, fileInfo) { + this.value = ruleCall; + this.lookups = lookups; + this._index = index; + this._fileInfo = fileInfo; + }; + NamespaceValue.prototype = Object.assign(new Node(), { + type: 'NamespaceValue', + eval: function (context) { + var i, name, rules = this.value.eval(context); + for (i = 0; i < this.lookups.length; i++) { + name = this.lookups[i]; + /** + * Eval'd DRs return rulesets. + * Eval'd mixins return rules, so let's make a ruleset if we need it. + * We need to do this because of late parsing of values + */ + if (Array.isArray(rules)) { + rules = new Ruleset([new Selector()], rules); + } + if (name === '') { + rules = rules.lastDeclaration(); + } + else if (name.charAt(0) === '@') { + if (name.charAt(1) === '@') { + name = "@" + new Variable(name.substr(1)).eval(context).value; + } + if (rules.variables) { + rules = rules.variable(name); + } + if (!rules) { + throw { type: 'Name', message: "variable " + name + " not found", filename: this.fileInfo().filename, + index: this.getIndex() }; + } + } + else { + if (name.substring(0, 2) === '$@') { + name = "$" + new Variable(name.substr(1)).eval(context).value; + } + else { + name = name.charAt(0) === '$' ? name : "$" + name; + } + if (rules.properties) { + rules = rules.property(name); + } + if (!rules) { + throw { type: 'Name', message: "property \"" + name.substr(1) + "\" not found", filename: this.fileInfo().filename, + index: this.getIndex() }; + } + // Properties are an array of values, since a ruleset can have multiple props. + // We pick the last one (the "cascaded" value) + rules = rules[rules.length - 1]; + } + if (rules.value) { + rules = rules.eval(context).value; + } + if (rules.ruleset) { + rules = rules.ruleset.eval(context); + } + } + return rules; + } + }); + + var Definition = function (name, params, rules, condition, variadic, frames, visibilityInfo) { + this.name = name || 'anonymous mixin'; + this.selectors = [new Selector([new Element(null, name, false, this._index, this._fileInfo)])]; + this.params = params; + this.condition = condition; + this.variadic = variadic; + this.arity = params.length; + this.rules = rules; + this._lookups = {}; + var optionalParameters = []; + this.required = params.reduce(function (count, p) { + if (!p.name || (p.name && !p.value)) { + return count + 1; + } + else { + optionalParameters.push(p.name); + return count; + } + }, 0); + this.optionalParameters = optionalParameters; + this.frames = frames; + this.copyVisibilityInfo(visibilityInfo); + this.allowRoot = true; + }; + Definition.prototype = Object.assign(new Ruleset(), { + type: 'MixinDefinition', + evalFirst: true, + accept: function (visitor) { + if (this.params && this.params.length) { + this.params = visitor.visitArray(this.params); + } + this.rules = visitor.visitArray(this.rules); + if (this.condition) { + this.condition = visitor.visit(this.condition); + } + }, + evalParams: function (context, mixinEnv, args, evaldArguments) { + /* jshint boss:true */ + var frame = new Ruleset(null, null); + var varargs; + var arg; + var params = copyArray(this.params); + var i; + var j; + var val; + var name; + var isNamedFound; + var argIndex; + var argsLength = 0; + if (mixinEnv.frames && mixinEnv.frames[0] && mixinEnv.frames[0].functionRegistry) { + frame.functionRegistry = mixinEnv.frames[0].functionRegistry.inherit(); + } + mixinEnv = new contexts.Eval(mixinEnv, [frame].concat(mixinEnv.frames)); + if (args) { + args = copyArray(args); + argsLength = args.length; + for (i = 0; i < argsLength; i++) { + arg = args[i]; + if (name = (arg && arg.name)) { + isNamedFound = false; + for (j = 0; j < params.length; j++) { + if (!evaldArguments[j] && name === params[j].name) { + evaldArguments[j] = arg.value.eval(context); + frame.prependRule(new Declaration(name, arg.value.eval(context))); + isNamedFound = true; + break; + } + } + if (isNamedFound) { + args.splice(i, 1); + i--; + continue; + } + else { + throw { type: 'Runtime', message: "Named argument for " + this.name + " " + args[i].name + " not found" }; + } + } + } + } + argIndex = 0; + for (i = 0; i < params.length; i++) { + if (evaldArguments[i]) { + continue; + } + arg = args && args[argIndex]; + if (name = params[i].name) { + if (params[i].variadic) { + varargs = []; + for (j = argIndex; j < argsLength; j++) { + varargs.push(args[j].value.eval(context)); + } + frame.prependRule(new Declaration(name, new Expression(varargs).eval(context))); + } + else { + val = arg && arg.value; + if (val) { + // This was a mixin call, pass in a detached ruleset of it's eval'd rules + if (Array.isArray(val)) { + val = new DetachedRuleset(new Ruleset('', val)); + } + else { + val = val.eval(context); + } + } + else if (params[i].value) { + val = params[i].value.eval(mixinEnv); + frame.resetCache(); + } + else { + throw { type: 'Runtime', message: "wrong number of arguments for " + this.name + " (" + argsLength + " for " + this.arity + ")" }; + } + frame.prependRule(new Declaration(name, val)); + evaldArguments[i] = val; + } + } + if (params[i].variadic && args) { + for (j = argIndex; j < argsLength; j++) { + evaldArguments[j] = args[j].value.eval(context); + } + } + argIndex++; + } + return frame; + }, + makeImportant: function () { + var rules = !this.rules ? this.rules : this.rules.map(function (r) { + if (r.makeImportant) { + return r.makeImportant(true); + } + else { + return r; + } + }); + var result = new Definition(this.name, this.params, rules, this.condition, this.variadic, this.frames); + return result; + }, + eval: function (context) { + return new Definition(this.name, this.params, this.rules, this.condition, this.variadic, this.frames || copyArray(context.frames)); + }, + evalCall: function (context, args, important) { + var _arguments = []; + var mixinFrames = this.frames ? this.frames.concat(context.frames) : context.frames; + var frame = this.evalParams(context, new contexts.Eval(context, mixinFrames), args, _arguments); + var rules; + var ruleset; + frame.prependRule(new Declaration('@arguments', new Expression(_arguments).eval(context))); + rules = copyArray(this.rules); + ruleset = new Ruleset(null, rules); + ruleset.originalRuleset = this; + ruleset = ruleset.eval(new contexts.Eval(context, [this, frame].concat(mixinFrames))); + if (important) { + ruleset = ruleset.makeImportant(); + } + return ruleset; + }, + matchCondition: function (args, context) { + if (this.condition && !this.condition.eval(new contexts.Eval(context, [this.evalParams(context, /* the parameter variables */ new contexts.Eval(context, this.frames ? this.frames.concat(context.frames) : context.frames), args, [])] + .concat(this.frames || []) // the parent namespace/mixin frames + .concat(context.frames)))) { // the current environment frames + return false; + } + return true; + }, + matchArgs: function (args, context) { + var allArgsCnt = (args && args.length) || 0; + var len; + var optionalParameters = this.optionalParameters; + var requiredArgsCnt = !args ? 0 : args.reduce(function (count, p) { + if (optionalParameters.indexOf(p.name) < 0) { + return count + 1; + } + else { + return count; + } + }, 0); + if (!this.variadic) { + if (requiredArgsCnt < this.required) { + return false; + } + if (allArgsCnt > this.params.length) { + return false; + } + } + else { + if (requiredArgsCnt < (this.required - 1)) { + return false; + } + } + // check patterns + len = Math.min(requiredArgsCnt, this.arity); + for (var i = 0; i < len; i++) { + if (!this.params[i].name && !this.params[i].variadic) { + if (args[i].value.eval(context).toCSS() != this.params[i].value.eval(context).toCSS()) { + return false; + } + } + } + return true; + } + }); + + var MixinCall = function (elements, args, index, currentFileInfo, important) { + this.selector = new Selector(elements); + this.arguments = args || []; + this._index = index; + this._fileInfo = currentFileInfo; + this.important = important; + this.allowRoot = true; + this.setParent(this.selector, this); + }; + MixinCall.prototype = Object.assign(new Node(), { + type: 'MixinCall', + accept: function (visitor) { + if (this.selector) { + this.selector = visitor.visit(this.selector); + } + if (this.arguments.length) { + this.arguments = visitor.visitArray(this.arguments); + } + }, + eval: function (context) { + var mixins; + var mixin; + var mixinPath; + var args = []; + var arg; + var argValue; + var rules = []; + var match = false; + var i; + var m; + var f; + var isRecursive; + var isOneFound; + var candidates = []; + var candidate; + var conditionResult = []; + var defaultResult; + var defFalseEitherCase = -1; + var defNone = 0; + var defTrue = 1; + var defFalse = 2; + var count; + var originalRuleset; + var noArgumentsFilter; + this.selector = this.selector.eval(context); + function calcDefGroup(mixin, mixinPath) { + var f, p, namespace; + for (f = 0; f < 2; f++) { + conditionResult[f] = true; + defaultFunc.value(f); + for (p = 0; p < mixinPath.length && conditionResult[f]; p++) { + namespace = mixinPath[p]; + if (namespace.matchCondition) { + conditionResult[f] = conditionResult[f] && namespace.matchCondition(null, context); + } + } + if (mixin.matchCondition) { + conditionResult[f] = conditionResult[f] && mixin.matchCondition(args, context); + } + } + if (conditionResult[0] || conditionResult[1]) { + if (conditionResult[0] != conditionResult[1]) { + return conditionResult[1] ? + defTrue : defFalse; + } + return defNone; + } + return defFalseEitherCase; + } + for (i = 0; i < this.arguments.length; i++) { + arg = this.arguments[i]; + argValue = arg.value.eval(context); + if (arg.expand && Array.isArray(argValue.value)) { + argValue = argValue.value; + for (m = 0; m < argValue.length; m++) { + args.push({ value: argValue[m] }); + } + } + else { + args.push({ name: arg.name, value: argValue }); + } + } + noArgumentsFilter = function (rule) { return rule.matchArgs(null, context); }; + for (i = 0; i < context.frames.length; i++) { + if ((mixins = context.frames[i].find(this.selector, null, noArgumentsFilter)).length > 0) { + isOneFound = true; + // To make `default()` function independent of definition order we have two "subpasses" here. + // At first we evaluate each guard *twice* (with `default() == true` and `default() == false`), + // and build candidate list with corresponding flags. Then, when we know all possible matches, + // we make a final decision. + for (m = 0; m < mixins.length; m++) { + mixin = mixins[m].rule; + mixinPath = mixins[m].path; + isRecursive = false; + for (f = 0; f < context.frames.length; f++) { + if ((!(mixin instanceof Definition)) && mixin === (context.frames[f].originalRuleset || context.frames[f])) { + isRecursive = true; + break; + } + } + if (isRecursive) { + continue; + } + if (mixin.matchArgs(args, context)) { + candidate = { mixin: mixin, group: calcDefGroup(mixin, mixinPath) }; + if (candidate.group !== defFalseEitherCase) { + candidates.push(candidate); + } + match = true; + } + } + defaultFunc.reset(); + count = [0, 0, 0]; + for (m = 0; m < candidates.length; m++) { + count[candidates[m].group]++; + } + if (count[defNone] > 0) { + defaultResult = defFalse; + } + else { + defaultResult = defTrue; + if ((count[defTrue] + count[defFalse]) > 1) { + throw { type: 'Runtime', message: "Ambiguous use of `default()` found when matching for `" + this.format(args) + "`", index: this.getIndex(), filename: this.fileInfo().filename }; + } + } + for (m = 0; m < candidates.length; m++) { + candidate = candidates[m].group; + if ((candidate === defNone) || (candidate === defaultResult)) { + try { + mixin = candidates[m].mixin; + if (!(mixin instanceof Definition)) { + originalRuleset = mixin.originalRuleset || mixin; + mixin = new Definition('', [], mixin.rules, null, false, null, originalRuleset.visibilityInfo()); + mixin.originalRuleset = originalRuleset; + } + var newRules = mixin.evalCall(context, args, this.important).rules; + this._setVisibilityToReplacement(newRules); + Array.prototype.push.apply(rules, newRules); + } + catch (e) { + throw { message: e.message, index: this.getIndex(), filename: this.fileInfo().filename, stack: e.stack }; + } + } + } + if (match) { + return rules; + } + } + } + if (isOneFound) { + throw { type: 'Runtime', message: "No matching definition was found for `" + this.format(args) + "`", index: this.getIndex(), filename: this.fileInfo().filename }; + } + else { + throw { type: 'Name', message: this.selector.toCSS().trim() + " is undefined", index: this.getIndex(), filename: this.fileInfo().filename }; + } + }, + _setVisibilityToReplacement: function (replacement) { + var i, rule; + if (this.blocksVisibility()) { + for (i = 0; i < replacement.length; i++) { + rule = replacement[i]; + rule.addVisibilityBlock(); + } + } + }, + format: function (args) { + return this.selector.toCSS().trim() + "(" + (args ? args.map(function (a) { + var argValue = ''; + if (a.name) { + argValue += a.name + ":"; + } + if (a.value.toCSS) { + argValue += a.value.toCSS(); + } + else { + argValue += '???'; + } + return argValue; + }).join(', ') : '') + ")"; + } + }); + + var tree = { + Node: Node, Color: Color, AtRule: AtRule, DetachedRuleset: DetachedRuleset, Operation: Operation, + Dimension: Dimension, Unit: Unit, Keyword: Keyword, Variable: Variable, Property: Property, + Ruleset: Ruleset, Element: Element, Attribute: Attribute, Combinator: Combinator, Selector: Selector, + Quoted: Quoted, Expression: Expression, Declaration: Declaration, Call: Call, URL: URL, Import: Import, + Comment: Comment, Anonymous: Anonymous, Value: Value, JavaScript: JavaScript, Assignment: Assignment, + Condition: Condition, Paren: Paren, Media: Media, UnicodeDescriptor: UnicodeDescriptor, Negative: Negative, + Extend: Extend, VariableCall: VariableCall, NamespaceValue: NamespaceValue, + mixin: { + Call: MixinCall, + Definition: Definition + } + }; + + var AbstractFileManager = /** @class */ (function () { + function AbstractFileManager() { + } + AbstractFileManager.prototype.getPath = function (filename) { + var j = filename.lastIndexOf('?'); + if (j > 0) { + filename = filename.slice(0, j); + } + j = filename.lastIndexOf('/'); + if (j < 0) { + j = filename.lastIndexOf('\\'); + } + if (j < 0) { + return ''; + } + return filename.slice(0, j + 1); + }; + AbstractFileManager.prototype.tryAppendExtension = function (path, ext) { + return /(\.[a-z]*$)|([\?;].*)$/.test(path) ? path : path + ext; + }; + AbstractFileManager.prototype.tryAppendLessExtension = function (path) { + return this.tryAppendExtension(path, '.less'); + }; + AbstractFileManager.prototype.supportsSync = function () { + return false; + }; + AbstractFileManager.prototype.alwaysMakePathsAbsolute = function () { + return false; + }; + AbstractFileManager.prototype.isPathAbsolute = function (filename) { + return (/^(?:[a-z-]+:|\/|\\|#)/i).test(filename); + }; + // TODO: pull out / replace? + AbstractFileManager.prototype.join = function (basePath, laterPath) { + if (!basePath) { + return laterPath; + } + return basePath + laterPath; + }; + AbstractFileManager.prototype.pathDiff = function (url, baseUrl) { + // diff between two paths to create a relative path + var urlParts = this.extractUrlParts(url); + var baseUrlParts = this.extractUrlParts(baseUrl); + var i; + var max; + var urlDirectories; + var baseUrlDirectories; + var diff = ''; + if (urlParts.hostPart !== baseUrlParts.hostPart) { + return ''; + } + max = Math.max(baseUrlParts.directories.length, urlParts.directories.length); + for (i = 0; i < max; i++) { + if (baseUrlParts.directories[i] !== urlParts.directories[i]) { + break; + } + } + baseUrlDirectories = baseUrlParts.directories.slice(i); + urlDirectories = urlParts.directories.slice(i); + for (i = 0; i < baseUrlDirectories.length - 1; i++) { + diff += '../'; + } + for (i = 0; i < urlDirectories.length - 1; i++) { + diff += urlDirectories[i] + "/"; + } + return diff; + }; + // helper function, not part of API + AbstractFileManager.prototype.extractUrlParts = function (url, baseUrl) { + // urlParts[1] = protocol://hostname/ OR / + // urlParts[2] = / if path relative to host base + // urlParts[3] = directories + // urlParts[4] = filename + // urlParts[5] = parameters + var urlPartsRegex = /^((?:[a-z-]+:)?\/{2}(?:[^\/\?#]*\/)|([\/\\]))?((?:[^\/\\\?#]*[\/\\])*)([^\/\\\?#]*)([#\?].*)?$/i; + var urlParts = url.match(urlPartsRegex); + var returner = {}; + var rawDirectories = []; + var directories = []; + var i; + var baseUrlParts; + if (!urlParts) { + throw new Error("Could not parse sheet href - '" + url + "'"); + } + // Stylesheets in IE don't always return the full path + if (baseUrl && (!urlParts[1] || urlParts[2])) { + baseUrlParts = baseUrl.match(urlPartsRegex); + if (!baseUrlParts) { + throw new Error("Could not parse page url - '" + baseUrl + "'"); + } + urlParts[1] = urlParts[1] || baseUrlParts[1] || ''; + if (!urlParts[2]) { + urlParts[3] = baseUrlParts[3] + urlParts[3]; + } + } + if (urlParts[3]) { + rawDirectories = urlParts[3].replace(/\\/g, '/').split('/'); + // collapse '..' and skip '.' + for (i = 0; i < rawDirectories.length; i++) { + if (rawDirectories[i] === '..') { + directories.pop(); + } + else if (rawDirectories[i] !== '.') { + directories.push(rawDirectories[i]); + } + } + } + returner.hostPart = urlParts[1]; + returner.directories = directories; + returner.rawPath = (urlParts[1] || '') + rawDirectories.join('/'); + returner.path = (urlParts[1] || '') + directories.join('/'); + returner.filename = urlParts[4]; + returner.fileUrl = returner.path + (urlParts[4] || ''); + returner.url = returner.fileUrl + (urlParts[5] || ''); + return returner; + }; + return AbstractFileManager; + }()); + + var AbstractPluginLoader = /** @class */ (function () { + function AbstractPluginLoader() { + // Implemented by Node.js plugin loader + this.require = function () { + return null; + }; + } + AbstractPluginLoader.prototype.evalPlugin = function (contents, context, imports, pluginOptions, fileInfo) { + var loader, registry, pluginObj, localModule, pluginManager, filename, result; + pluginManager = context.pluginManager; + if (fileInfo) { + if (typeof fileInfo === 'string') { + filename = fileInfo; + } + else { + filename = fileInfo.filename; + } + } + var shortname = (new this.less.FileManager()).extractUrlParts(filename).filename; + if (filename) { + pluginObj = pluginManager.get(filename); + if (pluginObj) { + result = this.trySetOptions(pluginObj, filename, shortname, pluginOptions); + if (result) { + return result; + } + try { + if (pluginObj.use) { + pluginObj.use.call(this.context, pluginObj); + } + } + catch (e) { + e.message = e.message || 'Error during @plugin call'; + return new LessError(e, imports, filename); + } + return pluginObj; + } + } + localModule = { + exports: {}, + pluginManager: pluginManager, + fileInfo: fileInfo + }; + registry = functionRegistry.create(); + var registerPlugin = function (obj) { + pluginObj = obj; + }; + try { + loader = new Function('module', 'require', 'registerPlugin', 'functions', 'tree', 'less', 'fileInfo', contents); + loader(localModule, this.require(filename), registerPlugin, registry, this.less.tree, this.less, fileInfo); + } + catch (e) { + return new LessError(e, imports, filename); + } + if (!pluginObj) { + pluginObj = localModule.exports; + } + pluginObj = this.validatePlugin(pluginObj, filename, shortname); + if (pluginObj instanceof LessError) { + return pluginObj; + } + if (pluginObj) { + pluginObj.imports = imports; + pluginObj.filename = filename; + // For < 3.x (or unspecified minVersion) - setOptions() before install() + if (!pluginObj.minVersion || this.compareVersion('3.0.0', pluginObj.minVersion) < 0) { + result = this.trySetOptions(pluginObj, filename, shortname, pluginOptions); + if (result) { + return result; + } + } + // Run on first load + pluginManager.addPlugin(pluginObj, fileInfo.filename, registry); + pluginObj.functions = registry.getLocalFunctions(); + // Need to call setOptions again because the pluginObj might have functions + result = this.trySetOptions(pluginObj, filename, shortname, pluginOptions); + if (result) { + return result; + } + // Run every @plugin call + try { + if (pluginObj.use) { + pluginObj.use.call(this.context, pluginObj); + } + } + catch (e) { + e.message = e.message || 'Error during @plugin call'; + return new LessError(e, imports, filename); + } + } + else { + return new LessError({ message: 'Not a valid plugin' }, imports, filename); + } + return pluginObj; + }; + AbstractPluginLoader.prototype.trySetOptions = function (plugin, filename, name, options) { + if (options && !plugin.setOptions) { + return new LessError({ + message: "Options have been provided but the plugin " + name + " does not support any options." + }); + } + try { + plugin.setOptions && plugin.setOptions(options); + } + catch (e) { + return new LessError(e); + } + }; + AbstractPluginLoader.prototype.validatePlugin = function (plugin, filename, name) { + if (plugin) { + // support plugins being a function + // so that the plugin can be more usable programmatically + if (typeof plugin === 'function') { + plugin = new plugin(); + } + if (plugin.minVersion) { + if (this.compareVersion(plugin.minVersion, this.less.version) < 0) { + return new LessError({ + message: "Plugin " + name + " requires version " + this.versionToString(plugin.minVersion) + }); + } + } + return plugin; + } + return null; + }; + AbstractPluginLoader.prototype.compareVersion = function (aVersion, bVersion) { + if (typeof aVersion === 'string') { + aVersion = aVersion.match(/^(\d+)\.?(\d+)?\.?(\d+)?/); + aVersion.shift(); + } + for (var i = 0; i < aVersion.length; i++) { + if (aVersion[i] !== bVersion[i]) { + return parseInt(aVersion[i]) > parseInt(bVersion[i]) ? -1 : 1; + } + } + return 0; + }; + AbstractPluginLoader.prototype.versionToString = function (version) { + var versionString = ''; + for (var i = 0; i < version.length; i++) { + versionString += (versionString ? '.' : '') + version[i]; + } + return versionString; + }; + AbstractPluginLoader.prototype.printUsage = function (plugins) { + for (var i = 0; i < plugins.length; i++) { + var plugin = plugins[i]; + if (plugin.printUsage) { + plugin.printUsage(); + } + } + }; + return AbstractPluginLoader; + }()); + + var _visitArgs = { visitDeeper: true }; + var _hasIndexed = false; + function _noop(node) { + return node; + } + function indexNodeTypes(parent, ticker) { + // add .typeIndex to tree node types for lookup table + var key, child; + for (key in parent) { + /* eslint guard-for-in: 0 */ + child = parent[key]; + switch (typeof child) { + case 'function': + // ignore bound functions directly on tree which do not have a prototype + // or aren't nodes + if (child.prototype && child.prototype.type) { + child.prototype.typeIndex = ticker++; + } + break; + case 'object': + ticker = indexNodeTypes(child, ticker); + break; + } + } + return ticker; + } + var Visitor = /** @class */ (function () { + function Visitor(implementation) { + this._implementation = implementation; + this._visitInCache = {}; + this._visitOutCache = {}; + if (!_hasIndexed) { + indexNodeTypes(tree, 1); + _hasIndexed = true; + } + } + Visitor.prototype.visit = function (node) { + if (!node) { + return node; + } + var nodeTypeIndex = node.typeIndex; + if (!nodeTypeIndex) { + // MixinCall args aren't a node type? + if (node.value && node.value.typeIndex) { + this.visit(node.value); + } + return node; + } + var impl = this._implementation; + var func = this._visitInCache[nodeTypeIndex]; + var funcOut = this._visitOutCache[nodeTypeIndex]; + var visitArgs = _visitArgs; + var fnName; + visitArgs.visitDeeper = true; + if (!func) { + fnName = "visit" + node.type; + func = impl[fnName] || _noop; + funcOut = impl[fnName + "Out"] || _noop; + this._visitInCache[nodeTypeIndex] = func; + this._visitOutCache[nodeTypeIndex] = funcOut; + } + if (func !== _noop) { + var newNode = func.call(impl, node, visitArgs); + if (node && impl.isReplacing) { + node = newNode; + } + } + if (visitArgs.visitDeeper && node) { + if (node.length) { + for (var i = 0, cnt = node.length; i < cnt; i++) { + if (node[i].accept) { + node[i].accept(this); + } + } + } + else if (node.accept) { + node.accept(this); + } + } + if (funcOut != _noop) { + funcOut.call(impl, node); + } + return node; + }; + Visitor.prototype.visitArray = function (nodes, nonReplacing) { + if (!nodes) { + return nodes; + } + var cnt = nodes.length; + var i; + // Non-replacing + if (nonReplacing || !this._implementation.isReplacing) { + for (i = 0; i < cnt; i++) { + this.visit(nodes[i]); + } + return nodes; + } + // Replacing + var out = []; + for (i = 0; i < cnt; i++) { + var evald = this.visit(nodes[i]); + if (evald === undefined) { + continue; + } + if (!evald.splice) { + out.push(evald); + } + else if (evald.length) { + this.flatten(evald, out); + } + } + return out; + }; + Visitor.prototype.flatten = function (arr, out) { + if (!out) { + out = []; + } + var cnt, i, item, nestedCnt, j, nestedItem; + for (i = 0, cnt = arr.length; i < cnt; i++) { + item = arr[i]; + if (item === undefined) { + continue; + } + if (!item.splice) { + out.push(item); + continue; + } + for (j = 0, nestedCnt = item.length; j < nestedCnt; j++) { + nestedItem = item[j]; + if (nestedItem === undefined) { + continue; + } + if (!nestedItem.splice) { + out.push(nestedItem); + } + else if (nestedItem.length) { + this.flatten(nestedItem, out); + } + } + } + return out; + }; + return Visitor; + }()); + + var ImportSequencer = /** @class */ (function () { + function ImportSequencer(onSequencerEmpty) { + this.imports = []; + this.variableImports = []; + this._onSequencerEmpty = onSequencerEmpty; + this._currentDepth = 0; + } + ImportSequencer.prototype.addImport = function (callback) { + var importSequencer = this, importItem = { + callback: callback, + args: null, + isReady: false + }; + this.imports.push(importItem); + return function () { + importItem.args = Array.prototype.slice.call(arguments, 0); + importItem.isReady = true; + importSequencer.tryRun(); + }; + }; + ImportSequencer.prototype.addVariableImport = function (callback) { + this.variableImports.push(callback); + }; + ImportSequencer.prototype.tryRun = function () { + this._currentDepth++; + try { + while (true) { + while (this.imports.length > 0) { + var importItem = this.imports[0]; + if (!importItem.isReady) { + return; + } + this.imports = this.imports.slice(1); + importItem.callback.apply(null, importItem.args); + } + if (this.variableImports.length === 0) { + break; + } + var variableImport = this.variableImports[0]; + this.variableImports = this.variableImports.slice(1); + variableImport(); + } + } + finally { + this._currentDepth--; + } + if (this._currentDepth === 0 && this._onSequencerEmpty) { + this._onSequencerEmpty(); + } + }; + return ImportSequencer; + }()); + + var ImportVisitor = function (importer, finish) { + this._visitor = new Visitor(this); + this._importer = importer; + this._finish = finish; + this.context = new contexts.Eval(); + this.importCount = 0; + this.onceFileDetectionMap = {}; + this.recursionDetector = {}; + this._sequencer = new ImportSequencer(this._onSequencerEmpty.bind(this)); + }; + ImportVisitor.prototype = { + isReplacing: false, + run: function (root) { + try { + // process the contents + this._visitor.visit(root); + } + catch (e) { + this.error = e; + } + this.isFinished = true; + this._sequencer.tryRun(); + }, + _onSequencerEmpty: function () { + if (!this.isFinished) { + return; + } + this._finish(this.error); + }, + visitImport: function (importNode, visitArgs) { + var inlineCSS = importNode.options.inline; + if (!importNode.css || inlineCSS) { + var context = new contexts.Eval(this.context, copyArray(this.context.frames)); + var importParent = context.frames[0]; + this.importCount++; + if (importNode.isVariableImport()) { + this._sequencer.addVariableImport(this.processImportNode.bind(this, importNode, context, importParent)); + } + else { + this.processImportNode(importNode, context, importParent); + } + } + visitArgs.visitDeeper = false; + }, + processImportNode: function (importNode, context, importParent) { + var evaldImportNode; + var inlineCSS = importNode.options.inline; + try { + evaldImportNode = importNode.evalForImport(context); + } + catch (e) { + if (!e.filename) { + e.index = importNode.getIndex(); + e.filename = importNode.fileInfo().filename; + } + // attempt to eval properly and treat as css + importNode.css = true; + // if that fails, this error will be thrown + importNode.error = e; + } + if (evaldImportNode && (!evaldImportNode.css || inlineCSS)) { + if (evaldImportNode.options.multiple) { + context.importMultiple = true; + } + // try appending if we haven't determined if it is css or not + var tryAppendLessExtension = evaldImportNode.css === undefined; + for (var i = 0; i < importParent.rules.length; i++) { + if (importParent.rules[i] === importNode) { + importParent.rules[i] = evaldImportNode; + break; + } + } + var onImported = this.onImported.bind(this, evaldImportNode, context), sequencedOnImported = this._sequencer.addImport(onImported); + this._importer.push(evaldImportNode.getPath(), tryAppendLessExtension, evaldImportNode.fileInfo(), evaldImportNode.options, sequencedOnImported); + } + else { + this.importCount--; + if (this.isFinished) { + this._sequencer.tryRun(); + } + } + }, + onImported: function (importNode, context, e, root, importedAtRoot, fullPath) { + if (e) { + if (!e.filename) { + e.index = importNode.getIndex(); + e.filename = importNode.fileInfo().filename; + } + this.error = e; + } + var importVisitor = this, inlineCSS = importNode.options.inline, isPlugin = importNode.options.isPlugin, isOptional = importNode.options.optional, duplicateImport = importedAtRoot || fullPath in importVisitor.recursionDetector; + if (!context.importMultiple) { + if (duplicateImport) { + importNode.skip = true; + } + else { + importNode.skip = function () { + if (fullPath in importVisitor.onceFileDetectionMap) { + return true; + } + importVisitor.onceFileDetectionMap[fullPath] = true; + return false; + }; + } + } + if (!fullPath && isOptional) { + importNode.skip = true; + } + if (root) { + importNode.root = root; + importNode.importedFilename = fullPath; + if (!inlineCSS && !isPlugin && (context.importMultiple || !duplicateImport)) { + importVisitor.recursionDetector[fullPath] = true; + var oldContext = this.context; + this.context = context; + try { + this._visitor.visit(root); + } + catch (e) { + this.error = e; + } + this.context = oldContext; + } + } + importVisitor.importCount--; + if (importVisitor.isFinished) { + importVisitor._sequencer.tryRun(); + } + }, + visitDeclaration: function (declNode, visitArgs) { + if (declNode.value.type === 'DetachedRuleset') { + this.context.frames.unshift(declNode); + } + else { + visitArgs.visitDeeper = false; + } + }, + visitDeclarationOut: function (declNode) { + if (declNode.value.type === 'DetachedRuleset') { + this.context.frames.shift(); + } + }, + visitAtRule: function (atRuleNode, visitArgs) { + this.context.frames.unshift(atRuleNode); + }, + visitAtRuleOut: function (atRuleNode) { + this.context.frames.shift(); + }, + visitMixinDefinition: function (mixinDefinitionNode, visitArgs) { + this.context.frames.unshift(mixinDefinitionNode); + }, + visitMixinDefinitionOut: function (mixinDefinitionNode) { + this.context.frames.shift(); + }, + visitRuleset: function (rulesetNode, visitArgs) { + this.context.frames.unshift(rulesetNode); + }, + visitRulesetOut: function (rulesetNode) { + this.context.frames.shift(); + }, + visitMedia: function (mediaNode, visitArgs) { + this.context.frames.unshift(mediaNode.rules[0]); + }, + visitMediaOut: function (mediaNode) { + this.context.frames.shift(); + } + }; + + var SetTreeVisibilityVisitor = /** @class */ (function () { + function SetTreeVisibilityVisitor(visible) { + this.visible = visible; + } + SetTreeVisibilityVisitor.prototype.run = function (root) { + this.visit(root); + }; + SetTreeVisibilityVisitor.prototype.visitArray = function (nodes) { + if (!nodes) { + return nodes; + } + var cnt = nodes.length; + var i; + for (i = 0; i < cnt; i++) { + this.visit(nodes[i]); + } + return nodes; + }; + SetTreeVisibilityVisitor.prototype.visit = function (node) { + if (!node) { + return node; + } + if (node.constructor === Array) { + return this.visitArray(node); + } + if (!node.blocksVisibility || node.blocksVisibility()) { + return node; + } + if (this.visible) { + node.ensureVisibility(); + } + else { + node.ensureInvisibility(); + } + node.accept(this); + return node; + }; + return SetTreeVisibilityVisitor; + }()); + + /* jshint loopfunc:true */ + var ExtendFinderVisitor = /** @class */ (function () { + function ExtendFinderVisitor() { + this._visitor = new Visitor(this); + this.contexts = []; + this.allExtendsStack = [[]]; + } + ExtendFinderVisitor.prototype.run = function (root) { + root = this._visitor.visit(root); + root.allExtends = this.allExtendsStack[0]; + return root; + }; + ExtendFinderVisitor.prototype.visitDeclaration = function (declNode, visitArgs) { + visitArgs.visitDeeper = false; + }; + ExtendFinderVisitor.prototype.visitMixinDefinition = function (mixinDefinitionNode, visitArgs) { + visitArgs.visitDeeper = false; + }; + ExtendFinderVisitor.prototype.visitRuleset = function (rulesetNode, visitArgs) { + if (rulesetNode.root) { + return; + } + var i; + var j; + var extend; + var allSelectorsExtendList = []; + var extendList; + // get &:extend(.a); rules which apply to all selectors in this ruleset + var rules = rulesetNode.rules, ruleCnt = rules ? rules.length : 0; + for (i = 0; i < ruleCnt; i++) { + if (rulesetNode.rules[i] instanceof tree.Extend) { + allSelectorsExtendList.push(rules[i]); + rulesetNode.extendOnEveryPath = true; + } + } + // now find every selector and apply the extends that apply to all extends + // and the ones which apply to an individual extend + var paths = rulesetNode.paths; + for (i = 0; i < paths.length; i++) { + var selectorPath = paths[i], selector = selectorPath[selectorPath.length - 1], selExtendList = selector.extendList; + extendList = selExtendList ? copyArray(selExtendList).concat(allSelectorsExtendList) + : allSelectorsExtendList; + if (extendList) { + extendList = extendList.map(function (allSelectorsExtend) { + return allSelectorsExtend.clone(); + }); + } + for (j = 0; j < extendList.length; j++) { + this.foundExtends = true; + extend = extendList[j]; + extend.findSelfSelectors(selectorPath); + extend.ruleset = rulesetNode; + if (j === 0) { + extend.firstExtendOnThisSelectorPath = true; + } + this.allExtendsStack[this.allExtendsStack.length - 1].push(extend); + } + } + this.contexts.push(rulesetNode.selectors); + }; + ExtendFinderVisitor.prototype.visitRulesetOut = function (rulesetNode) { + if (!rulesetNode.root) { + this.contexts.length = this.contexts.length - 1; + } + }; + ExtendFinderVisitor.prototype.visitMedia = function (mediaNode, visitArgs) { + mediaNode.allExtends = []; + this.allExtendsStack.push(mediaNode.allExtends); + }; + ExtendFinderVisitor.prototype.visitMediaOut = function (mediaNode) { + this.allExtendsStack.length = this.allExtendsStack.length - 1; + }; + ExtendFinderVisitor.prototype.visitAtRule = function (atRuleNode, visitArgs) { + atRuleNode.allExtends = []; + this.allExtendsStack.push(atRuleNode.allExtends); + }; + ExtendFinderVisitor.prototype.visitAtRuleOut = function (atRuleNode) { + this.allExtendsStack.length = this.allExtendsStack.length - 1; + }; + return ExtendFinderVisitor; + }()); + var ProcessExtendsVisitor = /** @class */ (function () { + function ProcessExtendsVisitor() { + this._visitor = new Visitor(this); + } + ProcessExtendsVisitor.prototype.run = function (root) { + var extendFinder = new ExtendFinderVisitor(); + this.extendIndices = {}; + extendFinder.run(root); + if (!extendFinder.foundExtends) { + return root; + } + root.allExtends = root.allExtends.concat(this.doExtendChaining(root.allExtends, root.allExtends)); + this.allExtendsStack = [root.allExtends]; + var newRoot = this._visitor.visit(root); + this.checkExtendsForNonMatched(root.allExtends); + return newRoot; + }; + ProcessExtendsVisitor.prototype.checkExtendsForNonMatched = function (extendList) { + var indices = this.extendIndices; + extendList.filter(function (extend) { + return !extend.hasFoundMatches && extend.parent_ids.length == 1; + }).forEach(function (extend) { + var selector = '_unknown_'; + try { + selector = extend.selector.toCSS({}); + } + catch (_) { } + if (!indices[extend.index + " " + selector]) { + indices[extend.index + " " + selector] = true; + logger.warn("extend '" + selector + "' has no matches"); + } + }); + }; + ProcessExtendsVisitor.prototype.doExtendChaining = function (extendsList, extendsListTarget, iterationCount) { + // + // chaining is different from normal extension.. if we extend an extend then we are not just copying, altering + // and pasting the selector we would do normally, but we are also adding an extend with the same target selector + // this means this new extend can then go and alter other extends + // + // this method deals with all the chaining work - without it, extend is flat and doesn't work on other extend selectors + // this is also the most expensive.. and a match on one selector can cause an extension of a selector we had already + // processed if we look at each selector at a time, as is done in visitRuleset + var extendIndex; + var targetExtendIndex; + var matches; + var extendsToAdd = []; + var newSelector; + var extendVisitor = this; + var selectorPath; + var extend; + var targetExtend; + var newExtend; + iterationCount = iterationCount || 0; + // loop through comparing every extend with every target extend. + // a target extend is the one on the ruleset we are looking at copy/edit/pasting in place + // e.g. .a:extend(.b) {} and .b:extend(.c) {} then the first extend extends the second one + // and the second is the target. + // the separation into two lists allows us to process a subset of chains with a bigger set, as is the + // case when processing media queries + for (extendIndex = 0; extendIndex < extendsList.length; extendIndex++) { + for (targetExtendIndex = 0; targetExtendIndex < extendsListTarget.length; targetExtendIndex++) { + extend = extendsList[extendIndex]; + targetExtend = extendsListTarget[targetExtendIndex]; + // look for circular references + if (extend.parent_ids.indexOf(targetExtend.object_id) >= 0) { + continue; + } + // find a match in the target extends self selector (the bit before :extend) + selectorPath = [targetExtend.selfSelectors[0]]; + matches = extendVisitor.findMatch(extend, selectorPath); + if (matches.length) { + extend.hasFoundMatches = true; + // we found a match, so for each self selector.. + extend.selfSelectors.forEach(function (selfSelector) { + var info = targetExtend.visibilityInfo(); + // process the extend as usual + newSelector = extendVisitor.extendSelector(matches, selectorPath, selfSelector, extend.isVisible()); + // but now we create a new extend from it + newExtend = new (tree.Extend)(targetExtend.selector, targetExtend.option, 0, targetExtend.fileInfo(), info); + newExtend.selfSelectors = newSelector; + // add the extend onto the list of extends for that selector + newSelector[newSelector.length - 1].extendList = [newExtend]; + // record that we need to add it. + extendsToAdd.push(newExtend); + newExtend.ruleset = targetExtend.ruleset; + // remember its parents for circular references + newExtend.parent_ids = newExtend.parent_ids.concat(targetExtend.parent_ids, extend.parent_ids); + // only process the selector once.. if we have :extend(.a,.b) then multiple + // extends will look at the same selector path, so when extending + // we know that any others will be duplicates in terms of what is added to the css + if (targetExtend.firstExtendOnThisSelectorPath) { + newExtend.firstExtendOnThisSelectorPath = true; + targetExtend.ruleset.paths.push(newSelector); + } + }); + } + } + } + if (extendsToAdd.length) { + // try to detect circular references to stop a stack overflow. + // may no longer be needed. + this.extendChainCount++; + if (iterationCount > 100) { + var selectorOne = '{unable to calculate}'; + var selectorTwo = '{unable to calculate}'; + try { + selectorOne = extendsToAdd[0].selfSelectors[0].toCSS(); + selectorTwo = extendsToAdd[0].selector.toCSS(); + } + catch (e) { } + throw { message: "extend circular reference detected. One of the circular extends is currently:" + selectorOne + ":extend(" + selectorTwo + ")" }; + } + // now process the new extends on the existing rules so that we can handle a extending b extending c extending + // d extending e... + return extendsToAdd.concat(extendVisitor.doExtendChaining(extendsToAdd, extendsListTarget, iterationCount + 1)); + } + else { + return extendsToAdd; + } + }; + ProcessExtendsVisitor.prototype.visitDeclaration = function (ruleNode, visitArgs) { + visitArgs.visitDeeper = false; + }; + ProcessExtendsVisitor.prototype.visitMixinDefinition = function (mixinDefinitionNode, visitArgs) { + visitArgs.visitDeeper = false; + }; + ProcessExtendsVisitor.prototype.visitSelector = function (selectorNode, visitArgs) { + visitArgs.visitDeeper = false; + }; + ProcessExtendsVisitor.prototype.visitRuleset = function (rulesetNode, visitArgs) { + if (rulesetNode.root) { + return; + } + var matches; + var pathIndex; + var extendIndex; + var allExtends = this.allExtendsStack[this.allExtendsStack.length - 1]; + var selectorsToAdd = []; + var extendVisitor = this; + var selectorPath; + // look at each selector path in the ruleset, find any extend matches and then copy, find and replace + for (extendIndex = 0; extendIndex < allExtends.length; extendIndex++) { + for (pathIndex = 0; pathIndex < rulesetNode.paths.length; pathIndex++) { + selectorPath = rulesetNode.paths[pathIndex]; + // extending extends happens initially, before the main pass + if (rulesetNode.extendOnEveryPath) { + continue; + } + var extendList = selectorPath[selectorPath.length - 1].extendList; + if (extendList && extendList.length) { + continue; + } + matches = this.findMatch(allExtends[extendIndex], selectorPath); + if (matches.length) { + allExtends[extendIndex].hasFoundMatches = true; + allExtends[extendIndex].selfSelectors.forEach(function (selfSelector) { + var extendedSelectors; + extendedSelectors = extendVisitor.extendSelector(matches, selectorPath, selfSelector, allExtends[extendIndex].isVisible()); + selectorsToAdd.push(extendedSelectors); + }); + } + } + } + rulesetNode.paths = rulesetNode.paths.concat(selectorsToAdd); + }; + ProcessExtendsVisitor.prototype.findMatch = function (extend, haystackSelectorPath) { + // + // look through the haystack selector path to try and find the needle - extend.selector + // returns an array of selector matches that can then be replaced + // + var haystackSelectorIndex; + var hackstackSelector; + var hackstackElementIndex; + var haystackElement; + var targetCombinator; + var i; + var extendVisitor = this; + var needleElements = extend.selector.elements; + var potentialMatches = []; + var potentialMatch; + var matches = []; + // loop through the haystack elements + for (haystackSelectorIndex = 0; haystackSelectorIndex < haystackSelectorPath.length; haystackSelectorIndex++) { + hackstackSelector = haystackSelectorPath[haystackSelectorIndex]; + for (hackstackElementIndex = 0; hackstackElementIndex < hackstackSelector.elements.length; hackstackElementIndex++) { + haystackElement = hackstackSelector.elements[hackstackElementIndex]; + // if we allow elements before our match we can add a potential match every time. otherwise only at the first element. + if (extend.allowBefore || (haystackSelectorIndex === 0 && hackstackElementIndex === 0)) { + potentialMatches.push({ pathIndex: haystackSelectorIndex, index: hackstackElementIndex, matched: 0, + initialCombinator: haystackElement.combinator }); + } + for (i = 0; i < potentialMatches.length; i++) { + potentialMatch = potentialMatches[i]; + // selectors add " " onto the first element. When we use & it joins the selectors together, but if we don't + // then each selector in haystackSelectorPath has a space before it added in the toCSS phase. so we need to + // work out what the resulting combinator will be + targetCombinator = haystackElement.combinator.value; + if (targetCombinator === '' && hackstackElementIndex === 0) { + targetCombinator = ' '; + } + // if we don't match, null our match to indicate failure + if (!extendVisitor.isElementValuesEqual(needleElements[potentialMatch.matched].value, haystackElement.value) || + (potentialMatch.matched > 0 && needleElements[potentialMatch.matched].combinator.value !== targetCombinator)) { + potentialMatch = null; + } + else { + potentialMatch.matched++; + } + // if we are still valid and have finished, test whether we have elements after and whether these are allowed + if (potentialMatch) { + potentialMatch.finished = potentialMatch.matched === needleElements.length; + if (potentialMatch.finished && + (!extend.allowAfter && + (hackstackElementIndex + 1 < hackstackSelector.elements.length || haystackSelectorIndex + 1 < haystackSelectorPath.length))) { + potentialMatch = null; + } + } + // if null we remove, if not, we are still valid, so either push as a valid match or continue + if (potentialMatch) { + if (potentialMatch.finished) { + potentialMatch.length = needleElements.length; + potentialMatch.endPathIndex = haystackSelectorIndex; + potentialMatch.endPathElementIndex = hackstackElementIndex + 1; // index after end of match + potentialMatches.length = 0; // we don't allow matches to overlap, so start matching again + matches.push(potentialMatch); + } + } + else { + potentialMatches.splice(i, 1); + i--; + } + } + } + } + return matches; + }; + ProcessExtendsVisitor.prototype.isElementValuesEqual = function (elementValue1, elementValue2) { + if (typeof elementValue1 === 'string' || typeof elementValue2 === 'string') { + return elementValue1 === elementValue2; + } + if (elementValue1 instanceof tree.Attribute) { + if (elementValue1.op !== elementValue2.op || elementValue1.key !== elementValue2.key) { + return false; + } + if (!elementValue1.value || !elementValue2.value) { + if (elementValue1.value || elementValue2.value) { + return false; + } + return true; + } + elementValue1 = elementValue1.value.value || elementValue1.value; + elementValue2 = elementValue2.value.value || elementValue2.value; + return elementValue1 === elementValue2; + } + elementValue1 = elementValue1.value; + elementValue2 = elementValue2.value; + if (elementValue1 instanceof tree.Selector) { + if (!(elementValue2 instanceof tree.Selector) || elementValue1.elements.length !== elementValue2.elements.length) { + return false; + } + for (var i = 0; i < elementValue1.elements.length; i++) { + if (elementValue1.elements[i].combinator.value !== elementValue2.elements[i].combinator.value) { + if (i !== 0 || (elementValue1.elements[i].combinator.value || ' ') !== (elementValue2.elements[i].combinator.value || ' ')) { + return false; + } + } + if (!this.isElementValuesEqual(elementValue1.elements[i].value, elementValue2.elements[i].value)) { + return false; + } + } + return true; + } + return false; + }; + ProcessExtendsVisitor.prototype.extendSelector = function (matches, selectorPath, replacementSelector, isVisible) { + // for a set of matches, replace each match with the replacement selector + var currentSelectorPathIndex = 0, currentSelectorPathElementIndex = 0, path = [], matchIndex, selector, firstElement, match, newElements; + for (matchIndex = 0; matchIndex < matches.length; matchIndex++) { + match = matches[matchIndex]; + selector = selectorPath[match.pathIndex]; + firstElement = new tree.Element(match.initialCombinator, replacementSelector.elements[0].value, replacementSelector.elements[0].isVariable, replacementSelector.elements[0].getIndex(), replacementSelector.elements[0].fileInfo()); + if (match.pathIndex > currentSelectorPathIndex && currentSelectorPathElementIndex > 0) { + path[path.length - 1].elements = path[path.length - 1] + .elements.concat(selectorPath[currentSelectorPathIndex].elements.slice(currentSelectorPathElementIndex)); + currentSelectorPathElementIndex = 0; + currentSelectorPathIndex++; + } + newElements = selector.elements + .slice(currentSelectorPathElementIndex, match.index) + .concat([firstElement]) + .concat(replacementSelector.elements.slice(1)); + if (currentSelectorPathIndex === match.pathIndex && matchIndex > 0) { + path[path.length - 1].elements = + path[path.length - 1].elements.concat(newElements); + } + else { + path = path.concat(selectorPath.slice(currentSelectorPathIndex, match.pathIndex)); + path.push(new tree.Selector(newElements)); + } + currentSelectorPathIndex = match.endPathIndex; + currentSelectorPathElementIndex = match.endPathElementIndex; + if (currentSelectorPathElementIndex >= selectorPath[currentSelectorPathIndex].elements.length) { + currentSelectorPathElementIndex = 0; + currentSelectorPathIndex++; + } + } + if (currentSelectorPathIndex < selectorPath.length && currentSelectorPathElementIndex > 0) { + path[path.length - 1].elements = path[path.length - 1] + .elements.concat(selectorPath[currentSelectorPathIndex].elements.slice(currentSelectorPathElementIndex)); + currentSelectorPathIndex++; + } + path = path.concat(selectorPath.slice(currentSelectorPathIndex, selectorPath.length)); + path = path.map(function (currentValue) { + // we can re-use elements here, because the visibility property matters only for selectors + var derived = currentValue.createDerived(currentValue.elements); + if (isVisible) { + derived.ensureVisibility(); + } + else { + derived.ensureInvisibility(); + } + return derived; + }); + return path; + }; + ProcessExtendsVisitor.prototype.visitMedia = function (mediaNode, visitArgs) { + var newAllExtends = mediaNode.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length - 1]); + newAllExtends = newAllExtends.concat(this.doExtendChaining(newAllExtends, mediaNode.allExtends)); + this.allExtendsStack.push(newAllExtends); + }; + ProcessExtendsVisitor.prototype.visitMediaOut = function (mediaNode) { + var lastIndex = this.allExtendsStack.length - 1; + this.allExtendsStack.length = lastIndex; + }; + ProcessExtendsVisitor.prototype.visitAtRule = function (atRuleNode, visitArgs) { + var newAllExtends = atRuleNode.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length - 1]); + newAllExtends = newAllExtends.concat(this.doExtendChaining(newAllExtends, atRuleNode.allExtends)); + this.allExtendsStack.push(newAllExtends); + }; + ProcessExtendsVisitor.prototype.visitAtRuleOut = function (atRuleNode) { + var lastIndex = this.allExtendsStack.length - 1; + this.allExtendsStack.length = lastIndex; + }; + return ProcessExtendsVisitor; + }()); + + var JoinSelectorVisitor = /** @class */ (function () { + function JoinSelectorVisitor() { + this.contexts = [[]]; + this._visitor = new Visitor(this); + } + JoinSelectorVisitor.prototype.run = function (root) { + return this._visitor.visit(root); + }; + JoinSelectorVisitor.prototype.visitDeclaration = function (declNode, visitArgs) { + visitArgs.visitDeeper = false; + }; + JoinSelectorVisitor.prototype.visitMixinDefinition = function (mixinDefinitionNode, visitArgs) { + visitArgs.visitDeeper = false; + }; + JoinSelectorVisitor.prototype.visitRuleset = function (rulesetNode, visitArgs) { + var context = this.contexts[this.contexts.length - 1]; + var paths = []; + var selectors; + this.contexts.push(paths); + if (!rulesetNode.root) { + selectors = rulesetNode.selectors; + if (selectors) { + selectors = selectors.filter(function (selector) { return selector.getIsOutput(); }); + rulesetNode.selectors = selectors.length ? selectors : (selectors = null); + if (selectors) { + rulesetNode.joinSelectors(paths, context, selectors); + } + } + if (!selectors) { + rulesetNode.rules = null; + } + rulesetNode.paths = paths; + } + }; + JoinSelectorVisitor.prototype.visitRulesetOut = function (rulesetNode) { + this.contexts.length = this.contexts.length - 1; + }; + JoinSelectorVisitor.prototype.visitMedia = function (mediaNode, visitArgs) { + var context = this.contexts[this.contexts.length - 1]; + mediaNode.rules[0].root = (context.length === 0 || context[0].multiMedia); + }; + JoinSelectorVisitor.prototype.visitAtRule = function (atRuleNode, visitArgs) { + var context = this.contexts[this.contexts.length - 1]; + if (atRuleNode.rules && atRuleNode.rules.length) { + atRuleNode.rules[0].root = (atRuleNode.isRooted || context.length === 0 || null); + } + }; + return JoinSelectorVisitor; + }()); + + var CSSVisitorUtils = /** @class */ (function () { + function CSSVisitorUtils(context) { + this._visitor = new Visitor(this); + this._context = context; + } + CSSVisitorUtils.prototype.containsSilentNonBlockedChild = function (bodyRules) { + var rule; + if (!bodyRules) { + return false; + } + for (var r = 0; r < bodyRules.length; r++) { + rule = bodyRules[r]; + if (rule.isSilent && rule.isSilent(this._context) && !rule.blocksVisibility()) { + // the atrule contains something that was referenced (likely by extend) + // therefore it needs to be shown in output too + return true; + } + } + return false; + }; + CSSVisitorUtils.prototype.keepOnlyVisibleChilds = function (owner) { + if (owner && owner.rules) { + owner.rules = owner.rules.filter(function (thing) { return thing.isVisible(); }); + } + }; + CSSVisitorUtils.prototype.isEmpty = function (owner) { + return (owner && owner.rules) + ? (owner.rules.length === 0) : true; + }; + CSSVisitorUtils.prototype.hasVisibleSelector = function (rulesetNode) { + return (rulesetNode && rulesetNode.paths) + ? (rulesetNode.paths.length > 0) : false; + }; + CSSVisitorUtils.prototype.resolveVisibility = function (node, originalRules) { + if (!node.blocksVisibility()) { + if (this.isEmpty(node) && !this.containsSilentNonBlockedChild(originalRules)) { + return; + } + return node; + } + var compiledRulesBody = node.rules[0]; + this.keepOnlyVisibleChilds(compiledRulesBody); + if (this.isEmpty(compiledRulesBody)) { + return; + } + node.ensureVisibility(); + node.removeVisibilityBlock(); + return node; + }; + CSSVisitorUtils.prototype.isVisibleRuleset = function (rulesetNode) { + if (rulesetNode.firstRoot) { + return true; + } + if (this.isEmpty(rulesetNode)) { + return false; + } + if (!rulesetNode.root && !this.hasVisibleSelector(rulesetNode)) { + return false; + } + return true; + }; + return CSSVisitorUtils; + }()); + var ToCSSVisitor = function (context) { + this._visitor = new Visitor(this); + this._context = context; + this.utils = new CSSVisitorUtils(context); + }; + ToCSSVisitor.prototype = { + isReplacing: true, + run: function (root) { + return this._visitor.visit(root); + }, + visitDeclaration: function (declNode, visitArgs) { + if (declNode.blocksVisibility() || declNode.variable) { + return; + } + return declNode; + }, + visitMixinDefinition: function (mixinNode, visitArgs) { + // mixin definitions do not get eval'd - this means they keep state + // so we have to clear that state here so it isn't used if toCSS is called twice + mixinNode.frames = []; + }, + visitExtend: function (extendNode, visitArgs) { + }, + visitComment: function (commentNode, visitArgs) { + if (commentNode.blocksVisibility() || commentNode.isSilent(this._context)) { + return; + } + return commentNode; + }, + visitMedia: function (mediaNode, visitArgs) { + var originalRules = mediaNode.rules[0].rules; + mediaNode.accept(this._visitor); + visitArgs.visitDeeper = false; + return this.utils.resolveVisibility(mediaNode, originalRules); + }, + visitImport: function (importNode, visitArgs) { + if (importNode.blocksVisibility()) { + return; + } + return importNode; + }, + visitAtRule: function (atRuleNode, visitArgs) { + if (atRuleNode.rules && atRuleNode.rules.length) { + return this.visitAtRuleWithBody(atRuleNode, visitArgs); + } + else { + return this.visitAtRuleWithoutBody(atRuleNode, visitArgs); + } + }, + visitAnonymous: function (anonymousNode, visitArgs) { + if (!anonymousNode.blocksVisibility()) { + anonymousNode.accept(this._visitor); + return anonymousNode; + } + }, + visitAtRuleWithBody: function (atRuleNode, visitArgs) { + // if there is only one nested ruleset and that one has no path, then it is + // just fake ruleset + function hasFakeRuleset(atRuleNode) { + var bodyRules = atRuleNode.rules; + return bodyRules.length === 1 && (!bodyRules[0].paths || bodyRules[0].paths.length === 0); + } + function getBodyRules(atRuleNode) { + var nodeRules = atRuleNode.rules; + if (hasFakeRuleset(atRuleNode)) { + return nodeRules[0].rules; + } + return nodeRules; + } + // it is still true that it is only one ruleset in array + // this is last such moment + // process childs + var originalRules = getBodyRules(atRuleNode); + atRuleNode.accept(this._visitor); + visitArgs.visitDeeper = false; + if (!this.utils.isEmpty(atRuleNode)) { + this._mergeRules(atRuleNode.rules[0].rules); + } + return this.utils.resolveVisibility(atRuleNode, originalRules); + }, + visitAtRuleWithoutBody: function (atRuleNode, visitArgs) { + if (atRuleNode.blocksVisibility()) { + return; + } + if (atRuleNode.name === '@charset') { + // Only output the debug info together with subsequent @charset definitions + // a comment (or @media statement) before the actual @charset atrule would + // be considered illegal css as it has to be on the first line + if (this.charset) { + if (atRuleNode.debugInfo) { + var comment = new tree.Comment("/* " + atRuleNode.toCSS(this._context).replace(/\n/g, '') + " */\n"); + comment.debugInfo = atRuleNode.debugInfo; + return this._visitor.visit(comment); + } + return; + } + this.charset = true; + } + return atRuleNode; + }, + checkValidNodes: function (rules, isRoot) { + if (!rules) { + return; + } + for (var i = 0; i < rules.length; i++) { + var ruleNode = rules[i]; + if (isRoot && ruleNode instanceof tree.Declaration && !ruleNode.variable) { + throw { message: 'Properties must be inside selector blocks. They cannot be in the root', + index: ruleNode.getIndex(), filename: ruleNode.fileInfo() && ruleNode.fileInfo().filename }; + } + if (ruleNode instanceof tree.Call) { + throw { message: "Function '" + ruleNode.name + "' did not return a root node", index: ruleNode.getIndex(), filename: ruleNode.fileInfo() && ruleNode.fileInfo().filename }; + } + if (ruleNode.type && !ruleNode.allowRoot) { + throw { message: ruleNode.type + " node returned by a function is not valid here", index: ruleNode.getIndex(), filename: ruleNode.fileInfo() && ruleNode.fileInfo().filename }; + } + } + }, + visitRuleset: function (rulesetNode, visitArgs) { + // at this point rulesets are nested into each other + var rule; + var rulesets = []; + this.checkValidNodes(rulesetNode.rules, rulesetNode.firstRoot); + if (!rulesetNode.root) { + // remove invisible paths + this._compileRulesetPaths(rulesetNode); + // remove rulesets from this ruleset body and compile them separately + var nodeRules = rulesetNode.rules; + var nodeRuleCnt = nodeRules ? nodeRules.length : 0; + for (var i = 0; i < nodeRuleCnt;) { + rule = nodeRules[i]; + if (rule && rule.rules) { + // visit because we are moving them out from being a child + rulesets.push(this._visitor.visit(rule)); + nodeRules.splice(i, 1); + nodeRuleCnt--; + continue; + } + i++; + } + // accept the visitor to remove rules and refactor itself + // then we can decide nogw whether we want it or not + // compile body + if (nodeRuleCnt > 0) { + rulesetNode.accept(this._visitor); + } + else { + rulesetNode.rules = null; + } + visitArgs.visitDeeper = false; + } + else { // if (! rulesetNode.root) { + rulesetNode.accept(this._visitor); + visitArgs.visitDeeper = false; + } + if (rulesetNode.rules) { + this._mergeRules(rulesetNode.rules); + this._removeDuplicateRules(rulesetNode.rules); + } + // now decide whether we keep the ruleset + if (this.utils.isVisibleRuleset(rulesetNode)) { + rulesetNode.ensureVisibility(); + rulesets.splice(0, 0, rulesetNode); + } + if (rulesets.length === 1) { + return rulesets[0]; + } + return rulesets; + }, + _compileRulesetPaths: function (rulesetNode) { + if (rulesetNode.paths) { + rulesetNode.paths = rulesetNode.paths + .filter(function (p) { + var i; + if (p[0].elements[0].combinator.value === ' ') { + p[0].elements[0].combinator = new (tree.Combinator)(''); + } + for (i = 0; i < p.length; i++) { + if (p[i].isVisible() && p[i].getIsOutput()) { + return true; + } + } + return false; + }); + } + }, + _removeDuplicateRules: function (rules) { + if (!rules) { + return; + } + // remove duplicates + var ruleCache = {}; + var ruleList; + var rule; + var i; + for (i = rules.length - 1; i >= 0; i--) { + rule = rules[i]; + if (rule instanceof tree.Declaration) { + if (!ruleCache[rule.name]) { + ruleCache[rule.name] = rule; + } + else { + ruleList = ruleCache[rule.name]; + if (ruleList instanceof tree.Declaration) { + ruleList = ruleCache[rule.name] = [ruleCache[rule.name].toCSS(this._context)]; + } + var ruleCSS = rule.toCSS(this._context); + if (ruleList.indexOf(ruleCSS) !== -1) { + rules.splice(i, 1); + } + else { + ruleList.push(ruleCSS); + } + } + } + } + }, + _mergeRules: function (rules) { + if (!rules) { + return; + } + var groups = {}; + var groupsArr = []; + for (var i = 0; i < rules.length; i++) { + var rule = rules[i]; + if (rule.merge) { + var key = rule.name; + groups[key] ? rules.splice(i--, 1) : + groupsArr.push(groups[key] = []); + groups[key].push(rule); + } + } + groupsArr.forEach(function (group) { + if (group.length > 0) { + var result_1 = group[0]; + var space_1 = []; + var comma_1 = [new tree.Expression(space_1)]; + group.forEach(function (rule) { + if ((rule.merge === '+') && (space_1.length > 0)) { + comma_1.push(new tree.Expression(space_1 = [])); + } + space_1.push(rule.value); + result_1.important = result_1.important || rule.important; + }); + result_1.value = new tree.Value(comma_1); + } + }); + } + }; + + var visitors = { + Visitor: Visitor, + ImportVisitor: ImportVisitor, + MarkVisibleSelectorsVisitor: SetTreeVisibilityVisitor, + ExtendVisitor: ProcessExtendsVisitor, + JoinSelectorVisitor: JoinSelectorVisitor, + ToCSSVisitor: ToCSSVisitor + }; + + // Split the input into chunks. + function chunker (input, fail) { + var len = input.length; + var level = 0; + var parenLevel = 0; + var lastOpening; + var lastOpeningParen; + var lastMultiComment; + var lastMultiCommentEndBrace; + var chunks = []; + var emitFrom = 0; + var chunkerCurrentIndex; + var currentChunkStartIndex; + var cc; + var cc2; + var matched; + function emitChunk(force) { + var len = chunkerCurrentIndex - emitFrom; + if (((len < 512) && !force) || !len) { + return; + } + chunks.push(input.slice(emitFrom, chunkerCurrentIndex + 1)); + emitFrom = chunkerCurrentIndex + 1; + } + for (chunkerCurrentIndex = 0; chunkerCurrentIndex < len; chunkerCurrentIndex++) { + cc = input.charCodeAt(chunkerCurrentIndex); + if (((cc >= 97) && (cc <= 122)) || (cc < 34)) { + // a-z or whitespace + continue; + } + switch (cc) { + case 40: // ( + parenLevel++; + lastOpeningParen = chunkerCurrentIndex; + continue; + case 41: // ) + if (--parenLevel < 0) { + return fail('missing opening `(`', chunkerCurrentIndex); + } + continue; + case 59: // ; + if (!parenLevel) { + emitChunk(); + } + continue; + case 123: // { + level++; + lastOpening = chunkerCurrentIndex; + continue; + case 125: // } + if (--level < 0) { + return fail('missing opening `{`', chunkerCurrentIndex); + } + if (!level && !parenLevel) { + emitChunk(); + } + continue; + case 92: // \ + if (chunkerCurrentIndex < len - 1) { + chunkerCurrentIndex++; + continue; + } + return fail('unescaped `\\`', chunkerCurrentIndex); + case 34: + case 39: + case 96: // ", ' and ` + matched = 0; + currentChunkStartIndex = chunkerCurrentIndex; + for (chunkerCurrentIndex = chunkerCurrentIndex + 1; chunkerCurrentIndex < len; chunkerCurrentIndex++) { + cc2 = input.charCodeAt(chunkerCurrentIndex); + if (cc2 > 96) { + continue; + } + if (cc2 == cc) { + matched = 1; + break; + } + if (cc2 == 92) { // \ + if (chunkerCurrentIndex == len - 1) { + return fail('unescaped `\\`', chunkerCurrentIndex); + } + chunkerCurrentIndex++; + } + } + if (matched) { + continue; + } + return fail("unmatched `" + String.fromCharCode(cc) + "`", currentChunkStartIndex); + case 47: // /, check for comment + if (parenLevel || (chunkerCurrentIndex == len - 1)) { + continue; + } + cc2 = input.charCodeAt(chunkerCurrentIndex + 1); + if (cc2 == 47) { + // //, find lnfeed + for (chunkerCurrentIndex = chunkerCurrentIndex + 2; chunkerCurrentIndex < len; chunkerCurrentIndex++) { + cc2 = input.charCodeAt(chunkerCurrentIndex); + if ((cc2 <= 13) && ((cc2 == 10) || (cc2 == 13))) { + break; + } + } + } + else if (cc2 == 42) { + // /*, find */ + lastMultiComment = currentChunkStartIndex = chunkerCurrentIndex; + for (chunkerCurrentIndex = chunkerCurrentIndex + 2; chunkerCurrentIndex < len - 1; chunkerCurrentIndex++) { + cc2 = input.charCodeAt(chunkerCurrentIndex); + if (cc2 == 125) { + lastMultiCommentEndBrace = chunkerCurrentIndex; + } + if (cc2 != 42) { + continue; + } + if (input.charCodeAt(chunkerCurrentIndex + 1) == 47) { + break; + } + } + if (chunkerCurrentIndex == len - 1) { + return fail('missing closing `*/`', currentChunkStartIndex); + } + chunkerCurrentIndex++; + } + continue; + case 42: // *, check for unmatched */ + if ((chunkerCurrentIndex < len - 1) && (input.charCodeAt(chunkerCurrentIndex + 1) == 47)) { + return fail('unmatched `/*`', chunkerCurrentIndex); + } + continue; + } + } + if (level !== 0) { + if ((lastMultiComment > lastOpening) && (lastMultiCommentEndBrace > lastMultiComment)) { + return fail('missing closing `}` or `*/`', lastOpening); + } + else { + return fail('missing closing `}`', lastOpening); + } + } + else if (parenLevel !== 0) { + return fail('missing closing `)`', lastOpeningParen); + } + emitChunk(true); + return chunks; + } + + var getParserInput = (function () { + var // Less input string + input; + var // current chunk + j; + var // holds state for backtracking + saveStack = []; + var // furthest index the parser has gone to + furthest; + var // if this is furthest we got to, this is the probably cause + furthestPossibleErrorMessage; + var // chunkified input + chunks; + var // current chunk + current; + var // index of current chunk, in `input` + currentPos; + var parserInput = {}; + var CHARCODE_SPACE = 32; + var CHARCODE_TAB = 9; + var CHARCODE_LF = 10; + var CHARCODE_CR = 13; + var CHARCODE_PLUS = 43; + var CHARCODE_COMMA = 44; + var CHARCODE_FORWARD_SLASH = 47; + var CHARCODE_9 = 57; + function skipWhitespace(length) { + var oldi = parserInput.i; + var oldj = j; + var curr = parserInput.i - currentPos; + var endIndex = parserInput.i + current.length - curr; + var mem = (parserInput.i += length); + var inp = input; + var c; + var nextChar; + var comment; + for (; parserInput.i < endIndex; parserInput.i++) { + c = inp.charCodeAt(parserInput.i); + if (parserInput.autoCommentAbsorb && c === CHARCODE_FORWARD_SLASH) { + nextChar = inp.charAt(parserInput.i + 1); + if (nextChar === '/') { + comment = { index: parserInput.i, isLineComment: true }; + var nextNewLine = inp.indexOf('\n', parserInput.i + 2); + if (nextNewLine < 0) { + nextNewLine = endIndex; + } + parserInput.i = nextNewLine; + comment.text = inp.substr(comment.index, parserInput.i - comment.index); + parserInput.commentStore.push(comment); + continue; + } + else if (nextChar === '*') { + var nextStarSlash = inp.indexOf('*/', parserInput.i + 2); + if (nextStarSlash >= 0) { + comment = { + index: parserInput.i, + text: inp.substr(parserInput.i, nextStarSlash + 2 - parserInput.i), + isLineComment: false + }; + parserInput.i += comment.text.length - 1; + parserInput.commentStore.push(comment); + continue; + } + } + break; + } + if ((c !== CHARCODE_SPACE) && (c !== CHARCODE_LF) && (c !== CHARCODE_TAB) && (c !== CHARCODE_CR)) { + break; + } + } + current = current.slice(length + parserInput.i - mem + curr); + currentPos = parserInput.i; + if (!current.length) { + if (j < chunks.length - 1) { + current = chunks[++j]; + skipWhitespace(0); // skip space at the beginning of a chunk + return true; // things changed + } + parserInput.finished = true; + } + return oldi !== parserInput.i || oldj !== j; + } + parserInput.save = function () { + currentPos = parserInput.i; + saveStack.push({ current: current, i: parserInput.i, j: j }); + }; + parserInput.restore = function (possibleErrorMessage) { + if (parserInput.i > furthest || (parserInput.i === furthest && possibleErrorMessage && !furthestPossibleErrorMessage)) { + furthest = parserInput.i; + furthestPossibleErrorMessage = possibleErrorMessage; + } + var state = saveStack.pop(); + current = state.current; + currentPos = parserInput.i = state.i; + j = state.j; + }; + parserInput.forget = function () { + saveStack.pop(); + }; + parserInput.isWhitespace = function (offset) { + var pos = parserInput.i + (offset || 0); + var code = input.charCodeAt(pos); + return (code === CHARCODE_SPACE || code === CHARCODE_CR || code === CHARCODE_TAB || code === CHARCODE_LF); + }; + // Specialization of $(tok) + parserInput.$re = function (tok) { + if (parserInput.i > currentPos) { + current = current.slice(parserInput.i - currentPos); + currentPos = parserInput.i; + } + var m = tok.exec(current); + if (!m) { + return null; + } + skipWhitespace(m[0].length); + if (typeof m === 'string') { + return m; + } + return m.length === 1 ? m[0] : m; + }; + parserInput.$char = function (tok) { + if (input.charAt(parserInput.i) !== tok) { + return null; + } + skipWhitespace(1); + return tok; + }; + parserInput.$str = function (tok) { + var tokLength = tok.length; + // https://jsperf.com/string-startswith/21 + for (var i = 0; i < tokLength; i++) { + if (input.charAt(parserInput.i + i) !== tok.charAt(i)) { + return null; + } + } + skipWhitespace(tokLength); + return tok; + }; + parserInput.$quoted = function (loc) { + var pos = loc || parserInput.i; + var startChar = input.charAt(pos); + if (startChar !== '\'' && startChar !== '"') { + return; + } + var length = input.length; + var currentPosition = pos; + for (var i = 1; i + currentPosition < length; i++) { + var nextChar = input.charAt(i + currentPosition); + switch (nextChar) { + case '\\': + i++; + continue; + case '\r': + case '\n': + break; + case startChar: + var str = input.substr(currentPosition, i + 1); + if (!loc && loc !== 0) { + skipWhitespace(i + 1); + return str; + } + return [startChar, str]; + } + } + return null; + }; + /** + * Permissive parsing. Ignores everything except matching {} [] () and quotes + * until matching token (outside of blocks) + */ + parserInput.$parseUntil = function (tok) { + var quote = ''; + var returnVal = null; + var inComment = false; + var blockDepth = 0; + var blockStack = []; + var parseGroups = []; + var length = input.length; + var startPos = parserInput.i; + var lastPos = parserInput.i; + var i = parserInput.i; + var loop = true; + var testChar; + if (typeof tok === 'string') { + testChar = function (char) { return char === tok; }; + } + else { + testChar = function (char) { return tok.test(char); }; + } + do { + var nextChar = input.charAt(i); + if (blockDepth === 0 && testChar(nextChar)) { + returnVal = input.substr(lastPos, i - lastPos); + if (returnVal) { + parseGroups.push(returnVal); + } + else { + parseGroups.push(' '); + } + returnVal = parseGroups; + skipWhitespace(i - startPos); + loop = false; + } + else { + if (inComment) { + if (nextChar === '*' && + input.charAt(i + 1) === '/') { + i++; + blockDepth--; + inComment = false; + } + i++; + continue; + } + switch (nextChar) { + case '\\': + i++; + nextChar = input.charAt(i); + parseGroups.push(input.substr(lastPos, i - lastPos + 1)); + lastPos = i + 1; + break; + case '/': + if (input.charAt(i + 1) === '*') { + i++; + inComment = true; + blockDepth++; + } + break; + case '\'': + case '"': + quote = parserInput.$quoted(i); + if (quote) { + parseGroups.push(input.substr(lastPos, i - lastPos), quote); + i += quote[1].length - 1; + lastPos = i + 1; + } + else { + skipWhitespace(i - startPos); + returnVal = nextChar; + loop = false; + } + break; + case '{': + blockStack.push('}'); + blockDepth++; + break; + case '(': + blockStack.push(')'); + blockDepth++; + break; + case '[': + blockStack.push(']'); + blockDepth++; + break; + case '}': + case ')': + case ']': + var expected = blockStack.pop(); + if (nextChar === expected) { + blockDepth--; + } + else { + // move the parser to the error and return expected + skipWhitespace(i - startPos); + returnVal = expected; + loop = false; + } + } + i++; + if (i > length) { + loop = false; + } + } + } while (loop); + return returnVal ? returnVal : null; + }; + parserInput.autoCommentAbsorb = true; + parserInput.commentStore = []; + parserInput.finished = false; + // Same as $(), but don't change the state of the parser, + // just return the match. + parserInput.peek = function (tok) { + if (typeof tok === 'string') { + // https://jsperf.com/string-startswith/21 + for (var i = 0; i < tok.length; i++) { + if (input.charAt(parserInput.i + i) !== tok.charAt(i)) { + return false; + } + } + return true; + } + else { + return tok.test(current); + } + }; + // Specialization of peek() + // TODO remove or change some currentChar calls to peekChar + parserInput.peekChar = function (tok) { return input.charAt(parserInput.i) === tok; }; + parserInput.currentChar = function () { return input.charAt(parserInput.i); }; + parserInput.prevChar = function () { return input.charAt(parserInput.i - 1); }; + parserInput.getInput = function () { return input; }; + parserInput.peekNotNumeric = function () { + var c = input.charCodeAt(parserInput.i); + // Is the first char of the dimension 0-9, '.', '+' or '-' + return (c > CHARCODE_9 || c < CHARCODE_PLUS) || c === CHARCODE_FORWARD_SLASH || c === CHARCODE_COMMA; + }; + parserInput.start = function (str, chunkInput, failFunction) { + input = str; + parserInput.i = j = currentPos = furthest = 0; + // chunking apparently makes things quicker (but my tests indicate + // it might actually make things slower in node at least) + // and it is a non-perfect parse - it can't recognise + // unquoted urls, meaning it can't distinguish comments + // meaning comments with quotes or {}() in them get 'counted' + // and then lead to parse errors. + // In addition if the chunking chunks in the wrong place we might + // not be able to parse a parser statement in one go + // this is officially deprecated but can be switched on via an option + // in the case it causes too much performance issues. + if (chunkInput) { + chunks = chunker(str, failFunction); + } + else { + chunks = [str]; + } + current = chunks[0]; + skipWhitespace(0); + }; + parserInput.end = function () { + var message; + var isFinished = parserInput.i >= input.length; + if (parserInput.i < furthest) { + message = furthestPossibleErrorMessage; + parserInput.i = furthest; + } + return { + isFinished: isFinished, + furthest: parserInput.i, + furthestPossibleErrorMessage: message, + furthestReachedEnd: parserInput.i >= input.length - 1, + furthestChar: input[parserInput.i] + }; + }; + return parserInput; + }); + + // + // less.js - parser + // + // A relatively straight-forward predictive parser. + // There is no tokenization/lexing stage, the input is parsed + // in one sweep. + // + // To make the parser fast enough to run in the browser, several + // optimization had to be made: + // + // - Matching and slicing on a huge input is often cause of slowdowns. + // The solution is to chunkify the input into smaller strings. + // The chunks are stored in the `chunks` var, + // `j` holds the current chunk index, and `currentPos` holds + // the index of the current chunk in relation to `input`. + // This gives us an almost 4x speed-up. + // + // - In many cases, we don't need to match individual tokens; + // for example, if a value doesn't hold any variables, operations + // or dynamic references, the parser can effectively 'skip' it, + // treating it as a literal. + // An example would be '1px solid #000' - which evaluates to itself, + // we don't need to know what the individual components are. + // The drawback, of course is that you don't get the benefits of + // syntax-checking on the CSS. This gives us a 50% speed-up in the parser, + // and a smaller speed-up in the code-gen. + // + // + // Token matching is done with the `$` function, which either takes + // a terminal string or regexp, or a non-terminal function to call. + // It also takes care of moving all the indices forwards. + // + var Parser = function Parser(context, imports, fileInfo) { + var parsers; + var parserInput = getParserInput(); + function error(msg, type) { + throw new LessError({ + index: parserInput.i, + filename: fileInfo.filename, + type: type || 'Syntax', + message: msg + }, imports); + } + function expect(arg, msg) { + // some older browsers return typeof 'function' for RegExp + var result = (arg instanceof Function) ? arg.call(parsers) : parserInput.$re(arg); + if (result) { + return result; + } + error(msg || (typeof arg === 'string' + ? "expected '" + arg + "' got '" + parserInput.currentChar() + "'" + : 'unexpected token')); + } + // Specialization of expect() + function expectChar(arg, msg) { + if (parserInput.$char(arg)) { + return arg; + } + error(msg || "expected '" + arg + "' got '" + parserInput.currentChar() + "'"); + } + function getDebugInfo(index) { + var filename = fileInfo.filename; + return { + lineNumber: getLocation(index, parserInput.getInput()).line + 1, + fileName: filename + }; + } + /** + * Used after initial parsing to create nodes on the fly + * + * @param {String} str - string to parse + * @param {Array} parseList - array of parsers to run input through e.g. ["value", "important"] + * @param {Number} currentIndex - start number to begin indexing + * @param {Object} fileInfo - fileInfo to attach to created nodes + */ + function parseNode(str, parseList, currentIndex, fileInfo, callback) { + var result; + var returnNodes = []; + var parser = parserInput; + try { + parser.start(str, false, function fail(msg, index) { + callback({ + message: msg, + index: index + currentIndex + }); + }); + for (var x = 0, p = void 0, i = void 0; (p = parseList[x]); x++) { + i = parser.i; + result = parsers[p](); + if (result) { + try { + result._index = i + currentIndex; + result._fileInfo = fileInfo; + } + catch (e) { } + returnNodes.push(result); + } + else { + returnNodes.push(null); + } + } + var endInfo = parser.end(); + if (endInfo.isFinished) { + callback(null, returnNodes); + } + else { + callback(true, null); + } + } + catch (e) { + throw new LessError({ + index: e.index + currentIndex, + message: e.message + }, imports, fileInfo.filename); + } + } + // + // The Parser + // + return { + parserInput: parserInput, + imports: imports, + fileInfo: fileInfo, + parseNode: parseNode, + // + // Parse an input string into an abstract syntax tree, + // @param str A string containing 'less' markup + // @param callback call `callback` when done. + // @param [additionalData] An optional map which can contains vars - a map (key, value) of variables to apply + // + parse: function (str, callback, additionalData) { + var root; + var error = null; + var globalVars; + var modifyVars; + var ignored; + var preText = ''; + globalVars = (additionalData && additionalData.globalVars) ? Parser.serializeVars(additionalData.globalVars) + "\n" : ''; + modifyVars = (additionalData && additionalData.modifyVars) ? "\n" + Parser.serializeVars(additionalData.modifyVars) : ''; + if (context.pluginManager) { + var preProcessors = context.pluginManager.getPreProcessors(); + for (var i = 0; i < preProcessors.length; i++) { + str = preProcessors[i].process(str, { context: context, imports: imports, fileInfo: fileInfo }); + } + } + if (globalVars || (additionalData && additionalData.banner)) { + preText = ((additionalData && additionalData.banner) ? additionalData.banner : '') + globalVars; + ignored = imports.contentsIgnoredChars; + ignored[fileInfo.filename] = ignored[fileInfo.filename] || 0; + ignored[fileInfo.filename] += preText.length; + } + str = str.replace(/\r\n?/g, '\n'); + // Remove potential UTF Byte Order Mark + str = preText + str.replace(/^\uFEFF/, '') + modifyVars; + imports.contents[fileInfo.filename] = str; + // Start with the primary rule. + // The whole syntax tree is held under a Ruleset node, + // with the `root` property set to true, so no `{}` are + // output. The callback is called when the input is parsed. + try { + parserInput.start(str, context.chunkInput, function fail(msg, index) { + throw new LessError({ + index: index, + type: 'Parse', + message: msg, + filename: fileInfo.filename + }, imports); + }); + tree.Node.prototype.parse = this; + root = new tree.Ruleset(null, this.parsers.primary()); + tree.Node.prototype.rootNode = root; + root.root = true; + root.firstRoot = true; + root.functionRegistry = functionRegistry.inherit(); + } + catch (e) { + return callback(new LessError(e, imports, fileInfo.filename)); + } + // If `i` is smaller than the `input.length - 1`, + // it means the parser wasn't able to parse the whole + // string, so we've got a parsing error. + // + // We try to extract a \n delimited string, + // showing the line where the parse error occurred. + // We split it up into two parts (the part which parsed, + // and the part which didn't), so we can color them differently. + var endInfo = parserInput.end(); + if (!endInfo.isFinished) { + var message = endInfo.furthestPossibleErrorMessage; + if (!message) { + message = 'Unrecognised input'; + if (endInfo.furthestChar === '}') { + message += '. Possibly missing opening \'{\''; + } + else if (endInfo.furthestChar === ')') { + message += '. Possibly missing opening \'(\''; + } + else if (endInfo.furthestReachedEnd) { + message += '. Possibly missing something'; + } + } + error = new LessError({ + type: 'Parse', + message: message, + index: endInfo.furthest, + filename: fileInfo.filename + }, imports); + } + var finish = function (e) { + e = error || e || imports.error; + if (e) { + if (!(e instanceof LessError)) { + e = new LessError(e, imports, fileInfo.filename); + } + return callback(e); + } + else { + return callback(null, root); + } + }; + if (context.processImports !== false) { + new visitors.ImportVisitor(imports, finish) + .run(root); + } + else { + return finish(); + } + }, + // + // Here in, the parsing rules/functions + // + // The basic structure of the syntax tree generated is as follows: + // + // Ruleset -> Declaration -> Value -> Expression -> Entity + // + // Here's some Less code: + // + // .class { + // color: #fff; + // border: 1px solid #000; + // width: @w + 4px; + // > .child {...} + // } + // + // And here's what the parse tree might look like: + // + // Ruleset (Selector '.class', [ + // Declaration ("color", Value ([Expression [Color #fff]])) + // Declaration ("border", Value ([Expression [Dimension 1px][Keyword "solid"][Color #000]])) + // Declaration ("width", Value ([Expression [Operation " + " [Variable "@w"][Dimension 4px]]])) + // Ruleset (Selector [Element '>', '.child'], [...]) + // ]) + // + // In general, most rules will try to parse a token with the `$re()` function, and if the return + // value is truly, will return a new node, of the relevant type. Sometimes, we need to check + // first, before parsing, that's when we use `peek()`. + // + parsers: parsers = { + // + // The `primary` rule is the *entry* and *exit* point of the parser. + // The rules here can appear at any level of the parse tree. + // + // The recursive nature of the grammar is an interplay between the `block` + // rule, which represents `{ ... }`, the `ruleset` rule, and this `primary` rule, + // as represented by this simplified grammar: + // + // primary โ†’ (ruleset | declaration)+ + // ruleset โ†’ selector+ block + // block โ†’ '{' primary '}' + // + // Only at one point is the primary rule not called from the + // block rule: at the root level. + // + primary: function () { + var mixin = this.mixin; + var root = []; + var node; + while (true) { + while (true) { + node = this.comment(); + if (!node) { + break; + } + root.push(node); + } + // always process comments before deciding if finished + if (parserInput.finished) { + break; + } + if (parserInput.peek('}')) { + break; + } + node = this.extendRule(); + if (node) { + root = root.concat(node); + continue; + } + node = mixin.definition() || this.declaration() || mixin.call(false, false) || + this.ruleset() || this.variableCall() || this.entities.call() || this.atrule(); + if (node) { + root.push(node); + } + else { + var foundSemiColon = false; + while (parserInput.$char(';')) { + foundSemiColon = true; + } + if (!foundSemiColon) { + break; + } + } + } + return root; + }, + // comments are collected by the main parsing mechanism and then assigned to nodes + // where the current structure allows it + comment: function () { + if (parserInput.commentStore.length) { + var comment = parserInput.commentStore.shift(); + return new (tree.Comment)(comment.text, comment.isLineComment, comment.index, fileInfo); + } + }, + // + // Entities are tokens which can be found inside an Expression + // + entities: { + mixinLookup: function () { + return parsers.mixin.call(true, true); + }, + // + // A string, which supports escaping " and ' + // + // "milky way" 'he\'s the one!' + // + quoted: function (forceEscaped) { + var str; + var index = parserInput.i; + var isEscaped = false; + parserInput.save(); + if (parserInput.$char('~')) { + isEscaped = true; + } + else if (forceEscaped) { + parserInput.restore(); + return; + } + str = parserInput.$quoted(); + if (!str) { + parserInput.restore(); + return; + } + parserInput.forget(); + return new (tree.Quoted)(str.charAt(0), str.substr(1, str.length - 2), isEscaped, index, fileInfo); + }, + // + // A catch-all word, such as: + // + // black border-collapse + // + keyword: function () { + var k = parserInput.$char('%') || parserInput.$re(/^\[?(?:[\w-]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+\]?/); + if (k) { + return tree.Color.fromKeyword(k) || new (tree.Keyword)(k); + } + }, + // + // A function call + // + // rgb(255, 0, 255) + // + // The arguments are parsed with the `entities.arguments` parser. + // + call: function () { + var name; + var args; + var func; + var index = parserInput.i; + // http://jsperf.com/case-insensitive-regex-vs-strtolower-then-regex/18 + if (parserInput.peek(/^url\(/i)) { + return; + } + parserInput.save(); + name = parserInput.$re(/^([\w-]+|%|~|progid:[\w\.]+)\(/); + if (!name) { + parserInput.forget(); + return; + } + name = name[1]; + func = this.customFuncCall(name); + if (func) { + args = func.parse(); + if (args && func.stop) { + parserInput.forget(); + return args; + } + } + args = this.arguments(args); + if (!parserInput.$char(')')) { + parserInput.restore('Could not parse call arguments or missing \')\''); + return; + } + parserInput.forget(); + return new (tree.Call)(name, args, index, fileInfo); + }, + // + // Parsing rules for functions with non-standard args, e.g.: + // + // boolean(not(2 > 1)) + // + // This is a quick prototype, to be modified/improved when + // more custom-parsed funcs come (e.g. `selector(...)`) + // + customFuncCall: function (name) { + /* Ideally the table is to be moved out of here for faster perf., + but it's quite tricky since it relies on all these `parsers` + and `expect` available only here */ + return { + alpha: f(parsers.ieAlpha, true), + boolean: f(condition), + 'if': f(condition) + }[name.toLowerCase()]; + function f(parse, stop) { + return { + parse: parse, + stop: stop // when true - stop after parse() and return its result, + // otherwise continue for plain args + }; + } + function condition() { + return [expect(parsers.condition, 'expected condition')]; + } + }, + arguments: function (prevArgs) { + var argsComma = prevArgs || []; + var argsSemiColon = []; + var isSemiColonSeparated; + var value; + parserInput.save(); + while (true) { + if (prevArgs) { + prevArgs = false; + } + else { + value = parsers.detachedRuleset() || this.assignment() || parsers.expression(); + if (!value) { + break; + } + if (value.value && value.value.length == 1) { + value = value.value[0]; + } + argsComma.push(value); + } + if (parserInput.$char(',')) { + continue; + } + if (parserInput.$char(';') || isSemiColonSeparated) { + isSemiColonSeparated = true; + value = (argsComma.length < 1) ? argsComma[0] + : new tree.Value(argsComma); + argsSemiColon.push(value); + argsComma = []; + } + } + parserInput.forget(); + return isSemiColonSeparated ? argsSemiColon : argsComma; + }, + literal: function () { + return this.dimension() || + this.color() || + this.quoted() || + this.unicodeDescriptor(); + }, + // Assignments are argument entities for calls. + // They are present in ie filter properties as shown below. + // + // filter: progid:DXImageTransform.Microsoft.Alpha( *opacity=50* ) + // + assignment: function () { + var key; + var value; + parserInput.save(); + key = parserInput.$re(/^\w+(?=\s?=)/i); + if (!key) { + parserInput.restore(); + return; + } + if (!parserInput.$char('=')) { + parserInput.restore(); + return; + } + value = parsers.entity(); + if (value) { + parserInput.forget(); + return new (tree.Assignment)(key, value); + } + else { + parserInput.restore(); + } + }, + // + // Parse url() tokens + // + // We use a specific rule for urls, because they don't really behave like + // standard function calls. The difference is that the argument doesn't have + // to be enclosed within a string, so it can't be parsed as an Expression. + // + url: function () { + var value; + var index = parserInput.i; + parserInput.autoCommentAbsorb = false; + if (!parserInput.$str('url(')) { + parserInput.autoCommentAbsorb = true; + return; + } + value = this.quoted() || this.variable() || this.property() || + parserInput.$re(/^(?:(?:\\[\(\)'"])|[^\(\)'"])+/) || ''; + parserInput.autoCommentAbsorb = true; + expectChar(')'); + return new (tree.URL)((value.value != null || + value instanceof tree.Variable || + value instanceof tree.Property) ? + value : new (tree.Anonymous)(value, index), index, fileInfo); + }, + // + // A Variable entity, such as `@fink`, in + // + // width: @fink + 2px + // + // We use a different parser for variable definitions, + // see `parsers.variable`. + // + variable: function () { + var ch; + var name; + var index = parserInput.i; + parserInput.save(); + if (parserInput.currentChar() === '@' && (name = parserInput.$re(/^@@?[\w-]+/))) { + ch = parserInput.currentChar(); + if (ch === '(' || ch === '[' && !parserInput.prevChar().match(/^\s/)) { + // this may be a VariableCall lookup + var result = parsers.variableCall(name); + if (result) { + parserInput.forget(); + return result; + } + } + parserInput.forget(); + return new (tree.Variable)(name, index, fileInfo); + } + parserInput.restore(); + }, + // A variable entity using the protective {} e.g. @{var} + variableCurly: function () { + var curly; + var index = parserInput.i; + if (parserInput.currentChar() === '@' && (curly = parserInput.$re(/^@\{([\w-]+)\}/))) { + return new (tree.Variable)("@" + curly[1], index, fileInfo); + } + }, + // + // A Property accessor, such as `$color`, in + // + // background-color: $color + // + property: function () { + var name; + var index = parserInput.i; + if (parserInput.currentChar() === '$' && (name = parserInput.$re(/^\$[\w-]+/))) { + return new (tree.Property)(name, index, fileInfo); + } + }, + // A property entity useing the protective {} e.g. ${prop} + propertyCurly: function () { + var curly; + var index = parserInput.i; + if (parserInput.currentChar() === '$' && (curly = parserInput.$re(/^\$\{([\w-]+)\}/))) { + return new (tree.Property)("$" + curly[1], index, fileInfo); + } + }, + // + // A Hexadecimal color + // + // #4F3C2F + // + // `rgb` and `hsl` colors are parsed through the `entities.call` parser. + // + color: function () { + var rgb; + parserInput.save(); + if (parserInput.currentChar() === '#' && (rgb = parserInput.$re(/^#([A-Fa-f0-9]{8}|[A-Fa-f0-9]{6}|[A-Fa-f0-9]{3,4})([\w.#\[])?/))) { + if (!rgb[2]) { + parserInput.forget(); + return new (tree.Color)(rgb[1], undefined, rgb[0]); + } + } + parserInput.restore(); + }, + colorKeyword: function () { + parserInput.save(); + var autoCommentAbsorb = parserInput.autoCommentAbsorb; + parserInput.autoCommentAbsorb = false; + var k = parserInput.$re(/^[_A-Za-z-][_A-Za-z0-9-]+/); + parserInput.autoCommentAbsorb = autoCommentAbsorb; + if (!k) { + parserInput.forget(); + return; + } + parserInput.restore(); + var color = tree.Color.fromKeyword(k); + if (color) { + parserInput.$str(k); + return color; + } + }, + // + // A Dimension, that is, a number and a unit + // + // 0.5em 95% + // + dimension: function () { + if (parserInput.peekNotNumeric()) { + return; + } + var value = parserInput.$re(/^([+-]?\d*\.?\d+)(%|[a-z_]+)?/i); + if (value) { + return new (tree.Dimension)(value[1], value[2]); + } + }, + // + // A unicode descriptor, as is used in unicode-range + // + // U+0?? or U+00A1-00A9 + // + unicodeDescriptor: function () { + var ud; + ud = parserInput.$re(/^U\+[0-9a-fA-F?]+(\-[0-9a-fA-F?]+)?/); + if (ud) { + return new (tree.UnicodeDescriptor)(ud[0]); + } + }, + // + // JavaScript code to be evaluated + // + // `window.location.href` + // + javascript: function () { + var js; + var index = parserInput.i; + parserInput.save(); + var escape = parserInput.$char('~'); + var jsQuote = parserInput.$char('`'); + if (!jsQuote) { + parserInput.restore(); + return; + } + js = parserInput.$re(/^[^`]*`/); + if (js) { + parserInput.forget(); + return new (tree.JavaScript)(js.substr(0, js.length - 1), Boolean(escape), index, fileInfo); + } + parserInput.restore('invalid javascript definition'); + } + }, + // + // The variable part of a variable definition. Used in the `rule` parser + // + // @fink: + // + variable: function () { + var name; + if (parserInput.currentChar() === '@' && (name = parserInput.$re(/^(@[\w-]+)\s*:/))) { + return name[1]; + } + }, + // + // Call a variable value to retrieve a detached ruleset + // or a value from a detached ruleset's rules. + // + // @fink(); + // @fink; + // color: @fink[@color]; + // + variableCall: function (parsedName) { + var lookups; + var i = parserInput.i; + var inValue = !!parsedName; + var name = parsedName; + parserInput.save(); + if (name || (parserInput.currentChar() === '@' + && (name = parserInput.$re(/^(@[\w-]+)(\(\s*\))?/)))) { + lookups = this.mixin.ruleLookups(); + if (!lookups && ((inValue && parserInput.$str('()') !== '()') || (name[2] !== '()'))) { + parserInput.restore('Missing \'[...]\' lookup in variable call'); + return; + } + if (!inValue) { + name = name[1]; + } + var call = new tree.VariableCall(name, i, fileInfo); + if (!inValue && parsers.end()) { + parserInput.forget(); + return call; + } + else { + parserInput.forget(); + return new tree.NamespaceValue(call, lookups, i, fileInfo); + } + } + parserInput.restore(); + }, + // + // extend syntax - used to extend selectors + // + extend: function (isRule) { + var elements; + var e; + var index = parserInput.i; + var option; + var extendList; + var extend; + if (!parserInput.$str(isRule ? '&:extend(' : ':extend(')) { + return; + } + do { + option = null; + elements = null; + while (!(option = parserInput.$re(/^(all)(?=\s*(\)|,))/))) { + e = this.element(); + if (!e) { + break; + } + if (elements) { + elements.push(e); + } + else { + elements = [e]; + } + } + option = option && option[1]; + if (!elements) { + error('Missing target selector for :extend().'); + } + extend = new (tree.Extend)(new (tree.Selector)(elements), option, index, fileInfo); + if (extendList) { + extendList.push(extend); + } + else { + extendList = [extend]; + } + } while (parserInput.$char(',')); + expect(/^\)/); + if (isRule) { + expect(/^;/); + } + return extendList; + }, + // + // extendRule - used in a rule to extend all the parent selectors + // + extendRule: function () { + return this.extend(true); + }, + // + // Mixins + // + mixin: { + // + // A Mixin call, with an optional argument list + // + // #mixins > .square(#fff); + // #mixins.square(#fff); + // .rounded(4px, black); + // .button; + // + // We can lookup / return a value using the lookup syntax: + // + // color: #mixin.square(#fff)[@color]; + // + // The `while` loop is there because mixins can be + // namespaced, but we only support the child and descendant + // selector for now. + // + call: function (inValue, getLookup) { + var s = parserInput.currentChar(); + var important = false; + var lookups; + var index = parserInput.i; + var elements; + var args; + var hasParens; + if (s !== '.' && s !== '#') { + return; + } + parserInput.save(); // stop us absorbing part of an invalid selector + elements = this.elements(); + if (elements) { + if (parserInput.$char('(')) { + args = this.args(true).args; + expectChar(')'); + hasParens = true; + } + if (getLookup !== false) { + lookups = this.ruleLookups(); + } + if (getLookup === true && !lookups) { + parserInput.restore(); + return; + } + if (inValue && !lookups && !hasParens) { + // This isn't a valid in-value mixin call + parserInput.restore(); + return; + } + if (!inValue && parsers.important()) { + important = true; + } + if (inValue || parsers.end()) { + parserInput.forget(); + var mixin = new (tree.mixin.Call)(elements, args, index, fileInfo, !lookups && important); + if (lookups) { + return new tree.NamespaceValue(mixin, lookups); + } + else { + return mixin; + } + } + } + parserInput.restore(); + }, + /** + * Matching elements for mixins + * (Start with . or # and can have > ) + */ + elements: function () { + var elements; + var e; + var c; + var elem; + var elemIndex; + var re = /^[#.](?:[\w-]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/; + while (true) { + elemIndex = parserInput.i; + e = parserInput.$re(re); + if (!e) { + break; + } + elem = new (tree.Element)(c, e, false, elemIndex, fileInfo); + if (elements) { + elements.push(elem); + } + else { + elements = [elem]; + } + c = parserInput.$char('>'); + } + return elements; + }, + args: function (isCall) { + var entities = parsers.entities; + var returner = { args: null, variadic: false }; + var expressions = []; + var argsSemiColon = []; + var argsComma = []; + var isSemiColonSeparated; + var expressionContainsNamed; + var name; + var nameLoop; + var value; + var arg; + var expand; + var hasSep = true; + parserInput.save(); + while (true) { + if (isCall) { + arg = parsers.detachedRuleset() || parsers.expression(); + } + else { + parserInput.commentStore.length = 0; + if (parserInput.$str('...')) { + returner.variadic = true; + if (parserInput.$char(';') && !isSemiColonSeparated) { + isSemiColonSeparated = true; + } + (isSemiColonSeparated ? argsSemiColon : argsComma) + .push({ variadic: true }); + break; + } + arg = entities.variable() || entities.property() || entities.literal() || entities.keyword() || this.call(true); + } + if (!arg || !hasSep) { + break; + } + nameLoop = null; + if (arg.throwAwayComments) { + arg.throwAwayComments(); + } + value = arg; + var val = null; + if (isCall) { + // Variable + if (arg.value && arg.value.length == 1) { + val = arg.value[0]; + } + } + else { + val = arg; + } + if (val && (val instanceof tree.Variable || val instanceof tree.Property)) { + if (parserInput.$char(':')) { + if (expressions.length > 0) { + if (isSemiColonSeparated) { + error('Cannot mix ; and , as delimiter types'); + } + expressionContainsNamed = true; + } + value = parsers.detachedRuleset() || parsers.expression(); + if (!value) { + if (isCall) { + error('could not understand value for named argument'); + } + else { + parserInput.restore(); + returner.args = []; + return returner; + } + } + nameLoop = (name = val.name); + } + else if (parserInput.$str('...')) { + if (!isCall) { + returner.variadic = true; + if (parserInput.$char(';') && !isSemiColonSeparated) { + isSemiColonSeparated = true; + } + (isSemiColonSeparated ? argsSemiColon : argsComma) + .push({ name: arg.name, variadic: true }); + break; + } + else { + expand = true; + } + } + else if (!isCall) { + name = nameLoop = val.name; + value = null; + } + } + if (value) { + expressions.push(value); + } + argsComma.push({ name: nameLoop, value: value, expand: expand }); + if (parserInput.$char(',')) { + hasSep = true; + continue; + } + hasSep = parserInput.$char(';') === ';'; + if (hasSep || isSemiColonSeparated) { + if (expressionContainsNamed) { + error('Cannot mix ; and , as delimiter types'); + } + isSemiColonSeparated = true; + if (expressions.length > 1) { + value = new (tree.Value)(expressions); + } + argsSemiColon.push({ name: name, value: value, expand: expand }); + name = null; + expressions = []; + expressionContainsNamed = false; + } + } + parserInput.forget(); + returner.args = isSemiColonSeparated ? argsSemiColon : argsComma; + return returner; + }, + // + // A Mixin definition, with a list of parameters + // + // .rounded (@radius: 2px, @color) { + // ... + // } + // + // Until we have a finer grained state-machine, we have to + // do a look-ahead, to make sure we don't have a mixin call. + // See the `rule` function for more information. + // + // We start by matching `.rounded (`, and then proceed on to + // the argument list, which has optional default values. + // We store the parameters in `params`, with a `value` key, + // if there is a value, such as in the case of `@radius`. + // + // Once we've got our params list, and a closing `)`, we parse + // the `{...}` block. + // + definition: function () { + var name; + var params = []; + var match; + var ruleset; + var cond; + var variadic = false; + if ((parserInput.currentChar() !== '.' && parserInput.currentChar() !== '#') || + parserInput.peek(/^[^{]*\}/)) { + return; + } + parserInput.save(); + match = parserInput.$re(/^([#.](?:[\w-]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+)\s*\(/); + if (match) { + name = match[1]; + var argInfo = this.args(false); + params = argInfo.args; + variadic = argInfo.variadic; + // .mixincall("@{a}"); + // looks a bit like a mixin definition.. + // also + // .mixincall(@a: {rule: set;}); + // so we have to be nice and restore + if (!parserInput.$char(')')) { + parserInput.restore('Missing closing \')\''); + return; + } + parserInput.commentStore.length = 0; + if (parserInput.$str('when')) { // Guard + cond = expect(parsers.conditions, 'expected condition'); + } + ruleset = parsers.block(); + if (ruleset) { + parserInput.forget(); + return new (tree.mixin.Definition)(name, params, ruleset, cond, variadic); + } + else { + parserInput.restore(); + } + } + else { + parserInput.restore(); + } + }, + ruleLookups: function () { + var rule; + var lookups = []; + if (parserInput.currentChar() !== '[') { + return; + } + while (true) { + parserInput.save(); + rule = this.lookupValue(); + if (!rule && rule !== '') { + parserInput.restore(); + break; + } + lookups.push(rule); + parserInput.forget(); + } + if (lookups.length > 0) { + return lookups; + } + }, + lookupValue: function () { + parserInput.save(); + if (!parserInput.$char('[')) { + parserInput.restore(); + return; + } + var name = parserInput.$re(/^(?:[@$]{0,2})[_a-zA-Z0-9-]*/); + if (!parserInput.$char(']')) { + parserInput.restore(); + return; + } + if (name || name === '') { + parserInput.forget(); + return name; + } + parserInput.restore(); + } + }, + // + // Entities are the smallest recognized token, + // and can be found inside a rule's value. + // + entity: function () { + var entities = this.entities; + return this.comment() || entities.literal() || entities.variable() || entities.url() || + entities.property() || entities.call() || entities.keyword() || this.mixin.call(true) || + entities.javascript(); + }, + // + // A Declaration terminator. Note that we use `peek()` to check for '}', + // because the `block` rule will be expecting it, but we still need to make sure + // it's there, if ';' was omitted. + // + end: function () { + return parserInput.$char(';') || parserInput.peek('}'); + }, + // + // IE's alpha function + // + // alpha(opacity=88) + // + ieAlpha: function () { + var value; + // http://jsperf.com/case-insensitive-regex-vs-strtolower-then-regex/18 + if (!parserInput.$re(/^opacity=/i)) { + return; + } + value = parserInput.$re(/^\d+/); + if (!value) { + value = expect(parsers.entities.variable, 'Could not parse alpha'); + value = "@{" + value.name.slice(1) + "}"; + } + expectChar(')'); + return new tree.Quoted('', "alpha(opacity=" + value + ")"); + }, + // + // A Selector Element + // + // div + // + h1 + // #socks + // input[type="text"] + // + // Elements are the building blocks for Selectors, + // they are made out of a `Combinator` (see combinator rule), + // and an element name, such as a tag a class, or `*`. + // + element: function () { + var e; + var c; + var v; + var index = parserInput.i; + c = this.combinator(); + e = parserInput.$re(/^(?:\d+\.\d+|\d+)%/) || + parserInput.$re(/^(?:[.#]?|:*)(?:[\w-]|[^\x00-\x9f]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/) || + parserInput.$char('*') || parserInput.$char('&') || this.attribute() || + parserInput.$re(/^\([^&()@]+\)/) || parserInput.$re(/^[\.#:](?=@)/) || + this.entities.variableCurly(); + if (!e) { + parserInput.save(); + if (parserInput.$char('(')) { + if ((v = this.selector(false)) && parserInput.$char(')')) { + e = new (tree.Paren)(v); + parserInput.forget(); + } + else { + parserInput.restore('Missing closing \')\''); + } + } + else { + parserInput.forget(); + } + } + if (e) { + return new (tree.Element)(c, e, e instanceof tree.Variable, index, fileInfo); + } + }, + // + // Combinators combine elements together, in a Selector. + // + // Because our parser isn't white-space sensitive, special care + // has to be taken, when parsing the descendant combinator, ` `, + // as it's an empty space. We have to check the previous character + // in the input, to see if it's a ` ` character. More info on how + // we deal with this in *combinator.js*. + // + combinator: function () { + var c = parserInput.currentChar(); + if (c === '/') { + parserInput.save(); + var slashedCombinator = parserInput.$re(/^\/[a-z]+\//i); + if (slashedCombinator) { + parserInput.forget(); + return new (tree.Combinator)(slashedCombinator); + } + parserInput.restore(); + } + if (c === '>' || c === '+' || c === '~' || c === '|' || c === '^') { + parserInput.i++; + if (c === '^' && parserInput.currentChar() === '^') { + c = '^^'; + parserInput.i++; + } + while (parserInput.isWhitespace()) { + parserInput.i++; + } + return new (tree.Combinator)(c); + } + else if (parserInput.isWhitespace(-1)) { + return new (tree.Combinator)(' '); + } + else { + return new (tree.Combinator)(null); + } + }, + // + // A CSS Selector + // with less extensions e.g. the ability to extend and guard + // + // .class > div + h1 + // li a:hover + // + // Selectors are made out of one or more Elements, see above. + // + selector: function (isLess) { + var index = parserInput.i; + var elements; + var extendList; + var c; + var e; + var allExtends; + var when; + var condition; + isLess = isLess !== false; + while ((isLess && (extendList = this.extend())) || (isLess && (when = parserInput.$str('when'))) || (e = this.element())) { + if (when) { + condition = expect(this.conditions, 'expected condition'); + } + else if (condition) { + error('CSS guard can only be used at the end of selector'); + } + else if (extendList) { + if (allExtends) { + allExtends = allExtends.concat(extendList); + } + else { + allExtends = extendList; + } + } + else { + if (allExtends) { + error('Extend can only be used at the end of selector'); + } + c = parserInput.currentChar(); + if (elements) { + elements.push(e); + } + else { + elements = [e]; + } + e = null; + } + if (c === '{' || c === '}' || c === ';' || c === ',' || c === ')') { + break; + } + } + if (elements) { + return new (tree.Selector)(elements, allExtends, condition, index, fileInfo); + } + if (allExtends) { + error('Extend must be used to extend a selector, it cannot be used on its own'); + } + }, + selectors: function () { + var s; + var selectors; + while (true) { + s = this.selector(); + if (!s) { + break; + } + if (selectors) { + selectors.push(s); + } + else { + selectors = [s]; + } + parserInput.commentStore.length = 0; + if (s.condition && selectors.length > 1) { + error("Guards are only currently allowed on a single selector."); + } + if (!parserInput.$char(',')) { + break; + } + if (s.condition) { + error("Guards are only currently allowed on a single selector."); + } + parserInput.commentStore.length = 0; + } + return selectors; + }, + attribute: function () { + if (!parserInput.$char('[')) { + return; + } + var entities = this.entities; + var key; + var val; + var op; + if (!(key = entities.variableCurly())) { + key = expect(/^(?:[_A-Za-z0-9-\*]*\|)?(?:[_A-Za-z0-9-]|\\.)+/); + } + op = parserInput.$re(/^[|~*$^]?=/); + if (op) { + val = entities.quoted() || parserInput.$re(/^[0-9]+%/) || parserInput.$re(/^[\w-]+/) || entities.variableCurly(); + } + expectChar(']'); + return new (tree.Attribute)(key, op, val); + }, + // + // The `block` rule is used by `ruleset` and `mixin.definition`. + // It's a wrapper around the `primary` rule, with added `{}`. + // + block: function () { + var content; + if (parserInput.$char('{') && (content = this.primary()) && parserInput.$char('}')) { + return content; + } + }, + blockRuleset: function () { + var block = this.block(); + if (block) { + block = new tree.Ruleset(null, block); + } + return block; + }, + detachedRuleset: function () { + var argInfo; + var params; + var variadic; + parserInput.save(); + if (parserInput.$re(/^[.#]\(/)) { + /** + * DR args currently only implemented for each() function, and not + * yet settable as `@dr: #(@arg) {}` + * This should be done when DRs are merged with mixins. + * See: https://github.com/less/less-meta/issues/16 + */ + argInfo = this.mixin.args(false); + params = argInfo.args; + variadic = argInfo.variadic; + if (!parserInput.$char(')')) { + parserInput.restore(); + return; + } + } + var blockRuleset = this.blockRuleset(); + if (blockRuleset) { + parserInput.forget(); + if (params) { + return new tree.mixin.Definition(null, params, blockRuleset, null, variadic); + } + return new tree.DetachedRuleset(blockRuleset); + } + parserInput.restore(); + }, + // + // div, .class, body > p {...} + // + ruleset: function () { + var selectors; + var rules; + var debugInfo; + parserInput.save(); + if (context.dumpLineNumbers) { + debugInfo = getDebugInfo(parserInput.i); + } + selectors = this.selectors(); + if (selectors && (rules = this.block())) { + parserInput.forget(); + var ruleset = new (tree.Ruleset)(selectors, rules, context.strictImports); + if (context.dumpLineNumbers) { + ruleset.debugInfo = debugInfo; + } + return ruleset; + } + else { + parserInput.restore(); + } + }, + declaration: function () { + var name; + var value; + var index = parserInput.i; + var hasDR; + var c = parserInput.currentChar(); + var important; + var merge; + var isVariable; + if (c === '.' || c === '#' || c === '&' || c === ':') { + return; + } + parserInput.save(); + name = this.variable() || this.ruleProperty(); + if (name) { + isVariable = typeof name === 'string'; + if (isVariable) { + value = this.detachedRuleset(); + if (value) { + hasDR = true; + } + } + parserInput.commentStore.length = 0; + if (!value) { + // a name returned by this.ruleProperty() is always an array of the form: + // [string-1, ..., string-n, ""] or [string-1, ..., string-n, "+"] + // where each item is a tree.Keyword or tree.Variable + merge = !isVariable && name.length > 1 && name.pop().value; + // Custom property values get permissive parsing + if (name[0].value && name[0].value.slice(0, 2) === '--') { + value = this.permissiveValue(); + } + // Try to store values as anonymous + // If we need the value later we'll re-parse it in ruleset.parseValue + else { + value = this.anonymousValue(); + } + if (value) { + parserInput.forget(); + // anonymous values absorb the end ';' which is required for them to work + return new (tree.Declaration)(name, value, false, merge, index, fileInfo); + } + if (!value) { + value = this.value(); + } + if (value) { + important = this.important(); + } + else if (isVariable) { + // As a last resort, try permissiveValue + value = this.permissiveValue(); + } + } + if (value && (this.end() || hasDR)) { + parserInput.forget(); + return new (tree.Declaration)(name, value, important, merge, index, fileInfo); + } + else { + parserInput.restore(); + } + } + else { + parserInput.restore(); + } + }, + anonymousValue: function () { + var index = parserInput.i; + var match = parserInput.$re(/^([^.#@\$+\/'"*`(;{}-]*);/); + if (match) { + return new (tree.Anonymous)(match[1], index); + } + }, + /** + * Used for custom properties, at-rules, and variables (as fallback) + * Parses almost anything inside of {} [] () "" blocks + * until it reaches outer-most tokens. + * + * First, it will try to parse comments and entities to reach + * the end. This is mostly like the Expression parser except no + * math is allowed. + */ + permissiveValue: function (untilTokens) { + var i; + var e; + var done; + var value; + var tok = untilTokens || ';'; + var index = parserInput.i; + var result = []; + function testCurrentChar() { + var char = parserInput.currentChar(); + if (typeof tok === 'string') { + return char === tok; + } + else { + return tok.test(char); + } + } + if (testCurrentChar()) { + return; + } + value = []; + do { + e = this.comment(); + if (e) { + value.push(e); + continue; + } + e = this.entity(); + if (e) { + value.push(e); + } + } while (e); + done = testCurrentChar(); + if (value.length > 0) { + value = new (tree.Expression)(value); + if (done) { + return value; + } + else { + result.push(value); + } + // Preserve space before $parseUntil as it will not + if (parserInput.prevChar() === ' ') { + result.push(new tree.Anonymous(' ', index)); + } + } + parserInput.save(); + value = parserInput.$parseUntil(tok); + if (value) { + if (typeof value === 'string') { + error("Expected '" + value + "'", 'Parse'); + } + if (value.length === 1 && value[0] === ' ') { + parserInput.forget(); + return new tree.Anonymous('', index); + } + var item = void 0; + for (i = 0; i < value.length; i++) { + item = value[i]; + if (Array.isArray(item)) { + // Treat actual quotes as normal quoted values + result.push(new tree.Quoted(item[0], item[1], true, index, fileInfo)); + } + else { + if (i === value.length - 1) { + item = item.trim(); + } + // Treat like quoted values, but replace vars like unquoted expressions + var quote = new tree.Quoted('\'', item, true, index, fileInfo); + quote.variableRegex = /@([\w-]+)/g; + quote.propRegex = /\$([\w-]+)/g; + result.push(quote); + } + } + parserInput.forget(); + return new tree.Expression(result, true); + } + parserInput.restore(); + }, + // + // An @import atrule + // + // @import "lib"; + // + // Depending on our environment, importing is done differently: + // In the browser, it's an XHR request, in Node, it would be a + // file-system operation. The function used for importing is + // stored in `import`, which we pass to the Import constructor. + // + 'import': function () { + var path; + var features; + var index = parserInput.i; + var dir = parserInput.$re(/^@import?\s+/); + if (dir) { + var options = (dir ? this.importOptions() : null) || {}; + if ((path = this.entities.quoted() || this.entities.url())) { + features = this.mediaFeatures(); + if (!parserInput.$char(';')) { + parserInput.i = index; + error('missing semi-colon or unrecognised media features on import'); + } + features = features && new (tree.Value)(features); + return new (tree.Import)(path, features, options, index, fileInfo); + } + else { + parserInput.i = index; + error('malformed import statement'); + } + } + }, + importOptions: function () { + var o; + var options = {}; + var optionName; + var value; + // list of options, surrounded by parens + if (!parserInput.$char('(')) { + return null; + } + do { + o = this.importOption(); + if (o) { + optionName = o; + value = true; + switch (optionName) { + case 'css': + optionName = 'less'; + value = false; + break; + case 'once': + optionName = 'multiple'; + value = false; + break; + } + options[optionName] = value; + if (!parserInput.$char(',')) { + break; + } + } + } while (o); + expectChar(')'); + return options; + }, + importOption: function () { + var opt = parserInput.$re(/^(less|css|multiple|once|inline|reference|optional)/); + if (opt) { + return opt[1]; + } + }, + mediaFeature: function () { + var entities = this.entities; + var nodes = []; + var e; + var p; + parserInput.save(); + do { + e = entities.keyword() || entities.variable() || entities.mixinLookup(); + if (e) { + nodes.push(e); + } + else if (parserInput.$char('(')) { + p = this.property(); + e = this.value(); + if (parserInput.$char(')')) { + if (p && e) { + nodes.push(new (tree.Paren)(new (tree.Declaration)(p, e, null, null, parserInput.i, fileInfo, true))); + } + else if (e) { + nodes.push(new (tree.Paren)(e)); + } + else { + error('badly formed media feature definition'); + } + } + else { + error('Missing closing \')\'', 'Parse'); + } + } + } while (e); + parserInput.forget(); + if (nodes.length > 0) { + return new (tree.Expression)(nodes); + } + }, + mediaFeatures: function () { + var entities = this.entities; + var features = []; + var e; + do { + e = this.mediaFeature(); + if (e) { + features.push(e); + if (!parserInput.$char(',')) { + break; + } + } + else { + e = entities.variable() || entities.mixinLookup(); + if (e) { + features.push(e); + if (!parserInput.$char(',')) { + break; + } + } + } + } while (e); + return features.length > 0 ? features : null; + }, + media: function () { + var features; + var rules; + var media; + var debugInfo; + var index = parserInput.i; + if (context.dumpLineNumbers) { + debugInfo = getDebugInfo(index); + } + parserInput.save(); + if (parserInput.$str('@media')) { + features = this.mediaFeatures(); + rules = this.block(); + if (!rules) { + error('media definitions require block statements after any features'); + } + parserInput.forget(); + media = new (tree.Media)(rules, features, index, fileInfo); + if (context.dumpLineNumbers) { + media.debugInfo = debugInfo; + } + return media; + } + parserInput.restore(); + }, + // + // A @plugin directive, used to import plugins dynamically. + // + // @plugin (args) "lib"; + // + plugin: function () { + var path; + var args; + var options; + var index = parserInput.i; + var dir = parserInput.$re(/^@plugin?\s+/); + if (dir) { + args = this.pluginArgs(); + if (args) { + options = { + pluginArgs: args, + isPlugin: true + }; + } + else { + options = { isPlugin: true }; + } + if ((path = this.entities.quoted() || this.entities.url())) { + if (!parserInput.$char(';')) { + parserInput.i = index; + error('missing semi-colon on @plugin'); + } + return new (tree.Import)(path, null, options, index, fileInfo); + } + else { + parserInput.i = index; + error('malformed @plugin statement'); + } + } + }, + pluginArgs: function () { + // list of options, surrounded by parens + parserInput.save(); + if (!parserInput.$char('(')) { + parserInput.restore(); + return null; + } + var args = parserInput.$re(/^\s*([^\);]+)\)\s*/); + if (args[1]) { + parserInput.forget(); + return args[1].trim(); + } + else { + parserInput.restore(); + return null; + } + }, + // + // A CSS AtRule + // + // @charset "utf-8"; + // + atrule: function () { + var index = parserInput.i; + var name; + var value; + var rules; + var nonVendorSpecificName; + var hasIdentifier; + var hasExpression; + var hasUnknown; + var hasBlock = true; + var isRooted = true; + if (parserInput.currentChar() !== '@') { + return; + } + value = this['import']() || this.plugin() || this.media(); + if (value) { + return value; + } + parserInput.save(); + name = parserInput.$re(/^@[a-z-]+/); + if (!name) { + return; + } + nonVendorSpecificName = name; + if (name.charAt(1) == '-' && name.indexOf('-', 2) > 0) { + nonVendorSpecificName = "@" + name.slice(name.indexOf('-', 2) + 1); + } + switch (nonVendorSpecificName) { + case '@charset': + hasIdentifier = true; + hasBlock = false; + break; + case '@namespace': + hasExpression = true; + hasBlock = false; + break; + case '@keyframes': + case '@counter-style': + hasIdentifier = true; + break; + case '@document': + case '@supports': + hasUnknown = true; + isRooted = false; + break; + default: + hasUnknown = true; + break; + } + parserInput.commentStore.length = 0; + if (hasIdentifier) { + value = this.entity(); + if (!value) { + error("expected " + name + " identifier"); + } + } + else if (hasExpression) { + value = this.expression(); + if (!value) { + error("expected " + name + " expression"); + } + } + else if (hasUnknown) { + value = this.permissiveValue(/^[{;]/); + hasBlock = (parserInput.currentChar() === '{'); + if (!value) { + if (!hasBlock && parserInput.currentChar() !== ';') { + error(name + " rule is missing block or ending semi-colon"); + } + } + else if (!value.value) { + value = null; + } + } + if (hasBlock) { + rules = this.blockRuleset(); + } + if (rules || (!hasBlock && value && parserInput.$char(';'))) { + parserInput.forget(); + return new (tree.AtRule)(name, value, rules, index, fileInfo, context.dumpLineNumbers ? getDebugInfo(index) : null, isRooted); + } + parserInput.restore('at-rule options not recognised'); + }, + // + // A Value is a comma-delimited list of Expressions + // + // font-family: Baskerville, Georgia, serif; + // + // In a Rule, a Value represents everything after the `:`, + // and before the `;`. + // + value: function () { + var e; + var expressions = []; + var index = parserInput.i; + do { + e = this.expression(); + if (e) { + expressions.push(e); + if (!parserInput.$char(',')) { + break; + } + } + } while (e); + if (expressions.length > 0) { + return new (tree.Value)(expressions, index); + } + }, + important: function () { + if (parserInput.currentChar() === '!') { + return parserInput.$re(/^! *important/); + } + }, + sub: function () { + var a; + var e; + parserInput.save(); + if (parserInput.$char('(')) { + a = this.addition(); + if (a && parserInput.$char(')')) { + parserInput.forget(); + e = new (tree.Expression)([a]); + e.parens = true; + return e; + } + parserInput.restore('Expected \')\''); + return; + } + parserInput.restore(); + }, + multiplication: function () { + var m; + var a; + var op; + var operation; + var isSpaced; + m = this.operand(); + if (m) { + isSpaced = parserInput.isWhitespace(-1); + while (true) { + if (parserInput.peek(/^\/[*\/]/)) { + break; + } + parserInput.save(); + op = parserInput.$char('/') || parserInput.$char('*') || parserInput.$str('./'); + if (!op) { + parserInput.forget(); + break; + } + a = this.operand(); + if (!a) { + parserInput.restore(); + break; + } + parserInput.forget(); + m.parensInOp = true; + a.parensInOp = true; + operation = new (tree.Operation)(op, [operation || m, a], isSpaced); + isSpaced = parserInput.isWhitespace(-1); + } + return operation || m; + } + }, + addition: function () { + var m; + var a; + var op; + var operation; + var isSpaced; + m = this.multiplication(); + if (m) { + isSpaced = parserInput.isWhitespace(-1); + while (true) { + op = parserInput.$re(/^[-+]\s+/) || (!isSpaced && (parserInput.$char('+') || parserInput.$char('-'))); + if (!op) { + break; + } + a = this.multiplication(); + if (!a) { + break; + } + m.parensInOp = true; + a.parensInOp = true; + operation = new (tree.Operation)(op, [operation || m, a], isSpaced); + isSpaced = parserInput.isWhitespace(-1); + } + return operation || m; + } + }, + conditions: function () { + var a; + var b; + var index = parserInput.i; + var condition; + a = this.condition(true); + if (a) { + while (true) { + if (!parserInput.peek(/^,\s*(not\s*)?\(/) || !parserInput.$char(',')) { + break; + } + b = this.condition(true); + if (!b) { + break; + } + condition = new (tree.Condition)('or', condition || a, b, index); + } + return condition || a; + } + }, + condition: function (needsParens) { + var result; + var logical; + var next; + function or() { + return parserInput.$str('or'); + } + result = this.conditionAnd(needsParens); + if (!result) { + return; + } + logical = or(); + if (logical) { + next = this.condition(needsParens); + if (next) { + result = new (tree.Condition)(logical, result, next); + } + else { + return; + } + } + return result; + }, + conditionAnd: function (needsParens) { + var result; + var logical; + var next; + var self = this; + function insideCondition() { + var cond = self.negatedCondition(needsParens) || self.parenthesisCondition(needsParens); + if (!cond && !needsParens) { + return self.atomicCondition(needsParens); + } + return cond; + } + function and() { + return parserInput.$str('and'); + } + result = insideCondition(); + if (!result) { + return; + } + logical = and(); + if (logical) { + next = this.conditionAnd(needsParens); + if (next) { + result = new (tree.Condition)(logical, result, next); + } + else { + return; + } + } + return result; + }, + negatedCondition: function (needsParens) { + if (parserInput.$str('not')) { + var result = this.parenthesisCondition(needsParens); + if (result) { + result.negate = !result.negate; + } + return result; + } + }, + parenthesisCondition: function (needsParens) { + function tryConditionFollowedByParenthesis(me) { + var body; + parserInput.save(); + body = me.condition(needsParens); + if (!body) { + parserInput.restore(); + return; + } + if (!parserInput.$char(')')) { + parserInput.restore(); + return; + } + parserInput.forget(); + return body; + } + var body; + parserInput.save(); + if (!parserInput.$str('(')) { + parserInput.restore(); + return; + } + body = tryConditionFollowedByParenthesis(this); + if (body) { + parserInput.forget(); + return body; + } + body = this.atomicCondition(needsParens); + if (!body) { + parserInput.restore(); + return; + } + if (!parserInput.$char(')')) { + parserInput.restore("expected ')' got '" + parserInput.currentChar() + "'"); + return; + } + parserInput.forget(); + return body; + }, + atomicCondition: function (needsParens) { + var entities = this.entities; + var index = parserInput.i; + var a; + var b; + var c; + var op; + function cond() { + return this.addition() || entities.keyword() || entities.quoted() || entities.mixinLookup(); + } + cond = cond.bind(this); + a = cond(); + if (a) { + if (parserInput.$char('>')) { + if (parserInput.$char('=')) { + op = '>='; + } + else { + op = '>'; + } + } + else if (parserInput.$char('<')) { + if (parserInput.$char('=')) { + op = '<='; + } + else { + op = '<'; + } + } + else if (parserInput.$char('=')) { + if (parserInput.$char('>')) { + op = '=>'; + } + else if (parserInput.$char('<')) { + op = '=<'; + } + else { + op = '='; + } + } + if (op) { + b = cond(); + if (b) { + c = new (tree.Condition)(op, a, b, index, false); + } + else { + error('expected expression'); + } + } + else { + c = new (tree.Condition)('=', a, new (tree.Keyword)('true'), index, false); + } + return c; + } + }, + // + // An operand is anything that can be part of an operation, + // such as a Color, or a Variable + // + operand: function () { + var entities = this.entities; + var negate; + if (parserInput.peek(/^-[@\$\(]/)) { + negate = parserInput.$char('-'); + } + var o = this.sub() || entities.dimension() || + entities.color() || entities.variable() || + entities.property() || entities.call() || + entities.quoted(true) || entities.colorKeyword() || + entities.mixinLookup(); + if (negate) { + o.parensInOp = true; + o = new (tree.Negative)(o); + } + return o; + }, + // + // Expressions either represent mathematical operations, + // or white-space delimited Entities. + // + // 1px solid black + // @var * 2 + // + expression: function () { + var entities = []; + var e; + var delim; + var index = parserInput.i; + do { + e = this.comment(); + if (e) { + entities.push(e); + continue; + } + e = this.addition() || this.entity(); + if (e instanceof tree.Comment) { + e = null; + } + if (e) { + entities.push(e); + // operations do not allow keyword "/" dimension (e.g. small/20px) so we support that here + if (!parserInput.peek(/^\/[\/*]/)) { + delim = parserInput.$char('/'); + if (delim) { + entities.push(new (tree.Anonymous)(delim, index)); + } + } + } + } while (e); + if (entities.length > 0) { + return new (tree.Expression)(entities); + } + }, + property: function () { + var name = parserInput.$re(/^(\*?-?[_a-zA-Z0-9-]+)\s*:/); + if (name) { + return name[1]; + } + }, + ruleProperty: function () { + var name = []; + var index = []; + var s; + var k; + parserInput.save(); + var simpleProperty = parserInput.$re(/^([_a-zA-Z0-9-]+)\s*:/); + if (simpleProperty) { + name = [new (tree.Keyword)(simpleProperty[1])]; + parserInput.forget(); + return name; + } + function match(re) { + var i = parserInput.i; + var chunk = parserInput.$re(re); + if (chunk) { + index.push(i); + return name.push(chunk[1]); + } + } + match(/^(\*?)/); + while (true) { + if (!match(/^((?:[\w-]+)|(?:[@\$]\{[\w-]+\}))/)) { + break; + } + } + if ((name.length > 1) && match(/^((?:\+_|\+)?)\s*:/)) { + parserInput.forget(); + // at last, we have the complete match now. move forward, + // convert name particles to tree objects and return: + if (name[0] === '') { + name.shift(); + index.shift(); + } + for (k = 0; k < name.length; k++) { + s = name[k]; + name[k] = (s.charAt(0) !== '@' && s.charAt(0) !== '$') ? + new (tree.Keyword)(s) : + (s.charAt(0) === '@' ? + new (tree.Variable)("@" + s.slice(2, -1), index[k], fileInfo) : + new (tree.Property)("$" + s.slice(2, -1), index[k], fileInfo)); + } + return name; + } + parserInput.restore(); + } + } + }; + }; + Parser.serializeVars = function (vars) { + var s = ''; + for (var name_1 in vars) { + if (Object.hasOwnProperty.call(vars, name_1)) { + var value = vars[name_1]; + s += ((name_1[0] === '@') ? '' : '@') + name_1 + ": " + value + ((String(value).slice(-1) === ';') ? '' : ';'); + } + } + return s; + }; + + function boolean(condition) { + return condition ? Keyword.True : Keyword.False; + } + /** + * Functions with evalArgs set to false are sent context + * as the first argument. + */ + function If(context, condition, trueValue, falseValue) { + return condition.eval(context) ? trueValue.eval(context) + : (falseValue ? falseValue.eval(context) : new Anonymous); + } + If.evalArgs = false; + function isdefined(context, variable) { + try { + variable.eval(context); + return Keyword.True; + } + catch (e) { + return Keyword.False; + } + } + isdefined.evalArgs = false; + var boolean$1 = { isdefined: isdefined, boolean: boolean, 'if': If }; + + var colorFunctions; + function clamp$1(val) { + return Math.min(1, Math.max(0, val)); + } + function hsla(origColor, hsl) { + var color = colorFunctions.hsla(hsl.h, hsl.s, hsl.l, hsl.a); + if (color) { + if (origColor.value && + /^(rgb|hsl)/.test(origColor.value)) { + color.value = origColor.value; + } + else { + color.value = 'rgb'; + } + return color; + } + } + function toHSL(color) { + if (color.toHSL) { + return color.toHSL(); + } + else { + throw new Error('Argument cannot be evaluated to a color'); + } + } + function toHSV(color) { + if (color.toHSV) { + return color.toHSV(); + } + else { + throw new Error('Argument cannot be evaluated to a color'); + } + } + function number(n) { + if (n instanceof Dimension) { + return parseFloat(n.unit.is('%') ? n.value / 100 : n.value); + } + else if (typeof n === 'number') { + return n; + } + else { + throw { + type: 'Argument', + message: 'color functions take numbers as parameters' + }; + } + } + function scaled(n, size) { + if (n instanceof Dimension && n.unit.is('%')) { + return parseFloat(n.value * size / 100); + } + else { + return number(n); + } + } + colorFunctions = { + rgb: function (r, g, b) { + var a = 1; + /** + * Comma-less syntax + * e.g. rgb(0 128 255 / 50%) + */ + if (r instanceof Expression) { + var val = r.value; + r = val[0]; + g = val[1]; + b = val[2]; + /** + * @todo - should this be normalized in + * function caller? Or parsed differently? + */ + if (b instanceof Operation) { + var op = b; + b = op.operands[0]; + a = op.operands[1]; + } + } + var color = colorFunctions.rgba(r, g, b, a); + if (color) { + color.value = 'rgb'; + return color; + } + }, + rgba: function (r, g, b, a) { + try { + if (r instanceof Color) { + if (g) { + a = number(g); + } + else { + a = r.alpha; + } + return new Color(r.rgb, a, 'rgba'); + } + var rgb = [r, g, b].map(function (c) { return scaled(c, 255); }); + a = number(a); + return new Color(rgb, a, 'rgba'); + } + catch (e) { } + }, + hsl: function (h, s, l) { + var a = 1; + if (h instanceof Expression) { + var val = h.value; + h = val[0]; + s = val[1]; + l = val[2]; + if (l instanceof Operation) { + var op = l; + l = op.operands[0]; + a = op.operands[1]; + } + } + var color = colorFunctions.hsla(h, s, l, a); + if (color) { + color.value = 'hsl'; + return color; + } + }, + hsla: function (h, s, l, a) { + try { + if (h instanceof Color) { + if (s) { + a = number(s); + } + else { + a = h.alpha; + } + return new Color(h.rgb, a, 'hsla'); + } + var m1_1; + var m2_1; + // EDIT: function hue(h) => var hue = function(h), see #3920 + var hue = function(h) { + h = h < 0 ? h + 1 : (h > 1 ? h - 1 : h); + if (h * 6 < 1) { + return m1_1 + (m2_1 - m1_1) * h * 6; + } + else if (h * 2 < 1) { + return m2_1; + } + else if (h * 3 < 2) { + return m1_1 + (m2_1 - m1_1) * (2 / 3 - h) * 6; + } + else { + return m1_1; + } + } + h = (number(h) % 360) / 360; + s = clamp$1(number(s)); + l = clamp$1(number(l)); + a = clamp$1(number(a)); + m2_1 = l <= 0.5 ? l * (s + 1) : l + s - l * s; + m1_1 = l * 2 - m2_1; + var rgb = [ + hue(h + 1 / 3) * 255, + hue(h) * 255, + hue(h - 1 / 3) * 255 + ]; + a = number(a); + return new Color(rgb, a, 'hsla'); + } + catch (e) { } + }, + hsv: function (h, s, v) { + return colorFunctions.hsva(h, s, v, 1.0); + }, + hsva: function (h, s, v, a) { + h = ((number(h) % 360) / 360) * 360; + s = number(s); + v = number(v); + a = number(a); + var i; + var f; + i = Math.floor((h / 60) % 6); + f = (h / 60) - i; + var vs = [v, + v * (1 - s), + v * (1 - f * s), + v * (1 - (1 - f) * s)]; + var perm = [[0, 3, 1], + [2, 0, 1], + [1, 0, 3], + [1, 2, 0], + [3, 1, 0], + [0, 1, 2]]; + return colorFunctions.rgba(vs[perm[i][0]] * 255, vs[perm[i][1]] * 255, vs[perm[i][2]] * 255, a); + }, + hue: function (color) { + return new Dimension(toHSL(color).h); + }, + saturation: function (color) { + return new Dimension(toHSL(color).s * 100, '%'); + }, + lightness: function (color) { + return new Dimension(toHSL(color).l * 100, '%'); + }, + hsvhue: function (color) { + return new Dimension(toHSV(color).h); + }, + hsvsaturation: function (color) { + return new Dimension(toHSV(color).s * 100, '%'); + }, + hsvvalue: function (color) { + return new Dimension(toHSV(color).v * 100, '%'); + }, + red: function (color) { + return new Dimension(color.rgb[0]); + }, + green: function (color) { + return new Dimension(color.rgb[1]); + }, + blue: function (color) { + return new Dimension(color.rgb[2]); + }, + alpha: function (color) { + return new Dimension(toHSL(color).a); + }, + luma: function (color) { + return new Dimension(color.luma() * color.alpha * 100, '%'); + }, + luminance: function (color) { + var luminance = (0.2126 * color.rgb[0] / 255) + + (0.7152 * color.rgb[1] / 255) + + (0.0722 * color.rgb[2] / 255); + return new Dimension(luminance * color.alpha * 100, '%'); + }, + saturate: function (color, amount, method) { + // filter: saturate(3.2); + // should be kept as is, so check for color + if (!color.rgb) { + return null; + } + var hsl = toHSL(color); + if (typeof method !== 'undefined' && method.value === 'relative') { + hsl.s += hsl.s * amount.value / 100; + } + else { + hsl.s += amount.value / 100; + } + hsl.s = clamp$1(hsl.s); + return hsla(color, hsl); + }, + desaturate: function (color, amount, method) { + var hsl = toHSL(color); + if (typeof method !== 'undefined' && method.value === 'relative') { + hsl.s -= hsl.s * amount.value / 100; + } + else { + hsl.s -= amount.value / 100; + } + hsl.s = clamp$1(hsl.s); + return hsla(color, hsl); + }, + lighten: function (color, amount, method) { + var hsl = toHSL(color); + if (typeof method !== 'undefined' && method.value === 'relative') { + hsl.l += hsl.l * amount.value / 100; + } + else { + hsl.l += amount.value / 100; + } + hsl.l = clamp$1(hsl.l); + return hsla(color, hsl); + }, + darken: function (color, amount, method) { + var hsl = toHSL(color); + if (typeof method !== 'undefined' && method.value === 'relative') { + hsl.l -= hsl.l * amount.value / 100; + } + else { + hsl.l -= amount.value / 100; + } + hsl.l = clamp$1(hsl.l); + return hsla(color, hsl); + }, + fadein: function (color, amount, method) { + var hsl = toHSL(color); + if (typeof method !== 'undefined' && method.value === 'relative') { + hsl.a += hsl.a * amount.value / 100; + } + else { + hsl.a += amount.value / 100; + } + hsl.a = clamp$1(hsl.a); + return hsla(color, hsl); + }, + fadeout: function (color, amount, method) { + var hsl = toHSL(color); + if (typeof method !== 'undefined' && method.value === 'relative') { + hsl.a -= hsl.a * amount.value / 100; + } + else { + hsl.a -= amount.value / 100; + } + hsl.a = clamp$1(hsl.a); + return hsla(color, hsl); + }, + fade: function (color, amount) { + var hsl = toHSL(color); + hsl.a = amount.value / 100; + hsl.a = clamp$1(hsl.a); + return hsla(color, hsl); + }, + spin: function (color, amount) { + var hsl = toHSL(color); + var hue = (hsl.h + amount.value) % 360; + hsl.h = hue < 0 ? 360 + hue : hue; + return hsla(color, hsl); + }, + // + // Copyright (c) 2006-2009 Hampton Catlin, Natalie Weizenbaum, and Chris Eppstein + // http://sass-lang.com + // + mix: function (color1, color2, weight) { + if (!weight) { + weight = new Dimension(50); + } + var p = weight.value / 100.0; + var w = p * 2 - 1; + var a = toHSL(color1).a - toHSL(color2).a; + var w1 = (((w * a == -1) ? w : (w + a) / (1 + w * a)) + 1) / 2.0; + var w2 = 1 - w1; + var rgb = [color1.rgb[0] * w1 + color2.rgb[0] * w2, + color1.rgb[1] * w1 + color2.rgb[1] * w2, + color1.rgb[2] * w1 + color2.rgb[2] * w2]; + var alpha = color1.alpha * p + color2.alpha * (1 - p); + return new Color(rgb, alpha); + }, + greyscale: function (color) { + return colorFunctions.desaturate(color, new Dimension(100)); + }, + contrast: function (color, dark, light, threshold) { + // filter: contrast(3.2); + // should be kept as is, so check for color + if (!color.rgb) { + return null; + } + if (typeof light === 'undefined') { + light = colorFunctions.rgba(255, 255, 255, 1.0); + } + if (typeof dark === 'undefined') { + dark = colorFunctions.rgba(0, 0, 0, 1.0); + } + // Figure out which is actually light and dark: + if (dark.luma() > light.luma()) { + var t = light; + light = dark; + dark = t; + } + if (typeof threshold === 'undefined') { + threshold = 0.43; + } + else { + threshold = number(threshold); + } + if (color.luma() < threshold) { + return light; + } + else { + return dark; + } + }, + // Changes made in 2.7.0 - Reverted in 3.0.0 + // contrast: function (color, color1, color2, threshold) { + // // Return which of `color1` and `color2` has the greatest contrast with `color` + // // according to the standard WCAG contrast ratio calculation. + // // http://www.w3.org/TR/WCAG20/#contrast-ratiodef + // // The threshold param is no longer used, in line with SASS. + // // filter: contrast(3.2); + // // should be kept as is, so check for color + // if (!color.rgb) { + // return null; + // } + // if (typeof color1 === 'undefined') { + // color1 = colorFunctions.rgba(0, 0, 0, 1.0); + // } + // if (typeof color2 === 'undefined') { + // color2 = colorFunctions.rgba(255, 255, 255, 1.0); + // } + // var contrast1, contrast2; + // var luma = color.luma(); + // var luma1 = color1.luma(); + // var luma2 = color2.luma(); + // // Calculate contrast ratios for each color + // if (luma > luma1) { + // contrast1 = (luma + 0.05) / (luma1 + 0.05); + // } else { + // contrast1 = (luma1 + 0.05) / (luma + 0.05); + // } + // if (luma > luma2) { + // contrast2 = (luma + 0.05) / (luma2 + 0.05); + // } else { + // contrast2 = (luma2 + 0.05) / (luma + 0.05); + // } + // if (contrast1 > contrast2) { + // return color1; + // } else { + // return color2; + // } + // }, + argb: function (color) { + return new Anonymous(color.toARGB()); + }, + color: function (c) { + if ((c instanceof Quoted) && + (/^#([A-Fa-f0-9]{8}|[A-Fa-f0-9]{6}|[A-Fa-f0-9]{3,4})$/i.test(c.value))) { + var val = c.value.slice(1); + return new Color(val, undefined, "#" + val); + } + if ((c instanceof Color) || (c = Color.fromKeyword(c.value))) { + c.value = undefined; + return c; + } + throw { + type: 'Argument', + message: 'argument must be a color keyword or 3|4|6|8 digit hex e.g. #FFF' + }; + }, + tint: function (color, amount) { + return colorFunctions.mix(colorFunctions.rgb(255, 255, 255), color, amount); + }, + shade: function (color, amount) { + return colorFunctions.mix(colorFunctions.rgb(0, 0, 0), color, amount); + } + }; + var color = colorFunctions; + + // Color Blending + // ref: http://www.w3.org/TR/compositing-1 + function colorBlend(mode, color1, color2) { + var ab = color1.alpha; // result + var // backdrop + cb; + var as = color2.alpha; + var // source + cs; + var ar; + var cr; + var r = []; + ar = as + ab * (1 - as); + for (var i = 0; i < 3; i++) { + cb = color1.rgb[i] / 255; + cs = color2.rgb[i] / 255; + cr = mode(cb, cs); + if (ar) { + cr = (as * cs + ab * (cb - + as * (cb + cs - cr))) / ar; + } + r[i] = cr * 255; + } + return new Color(r, ar); + } + var colorBlendModeFunctions = { + multiply: function (cb, cs) { + return cb * cs; + }, + screen: function (cb, cs) { + return cb + cs - cb * cs; + }, + overlay: function (cb, cs) { + cb *= 2; + return (cb <= 1) ? + colorBlendModeFunctions.multiply(cb, cs) : + colorBlendModeFunctions.screen(cb - 1, cs); + }, + softlight: function (cb, cs) { + var d = 1; + var e = cb; + if (cs > 0.5) { + e = 1; + d = (cb > 0.25) ? Math.sqrt(cb) + : ((16 * cb - 12) * cb + 4) * cb; + } + return cb - (1 - 2 * cs) * e * (d - cb); + }, + hardlight: function (cb, cs) { + return colorBlendModeFunctions.overlay(cs, cb); + }, + difference: function (cb, cs) { + return Math.abs(cb - cs); + }, + exclusion: function (cb, cs) { + return cb + cs - 2 * cb * cs; + }, + // non-w3c functions: + average: function (cb, cs) { + return (cb + cs) / 2; + }, + negation: function (cb, cs) { + return 1 - Math.abs(cb + cs - 1); + } + }; + for (var f in colorBlendModeFunctions) { + if (colorBlendModeFunctions.hasOwnProperty(f)) { + colorBlend[f] = colorBlend.bind(null, colorBlendModeFunctions[f]); + } + } + + var dataUri = (function (environment) { + var fallback = function (functionThis, node) { return new URL(node, functionThis.index, functionThis.currentFileInfo).eval(functionThis.context); }; + return { 'data-uri': function (mimetypeNode, filePathNode) { + if (!filePathNode) { + filePathNode = mimetypeNode; + mimetypeNode = null; + } + var mimetype = mimetypeNode && mimetypeNode.value; + var filePath = filePathNode.value; + var currentFileInfo = this.currentFileInfo; + var currentDirectory = currentFileInfo.rewriteUrls ? + currentFileInfo.currentDirectory : currentFileInfo.entryPath; + var fragmentStart = filePath.indexOf('#'); + var fragment = ''; + if (fragmentStart !== -1) { + fragment = filePath.slice(fragmentStart); + filePath = filePath.slice(0, fragmentStart); + } + var context = clone(this.context); + context.rawBuffer = true; + var fileManager = environment.getFileManager(filePath, currentDirectory, context, environment, true); + if (!fileManager) { + return fallback(this, filePathNode); + } + var useBase64 = false; + // detect the mimetype if not given + if (!mimetypeNode) { + mimetype = environment.mimeLookup(filePath); + if (mimetype === 'image/svg+xml') { + useBase64 = false; + } + else { + // use base 64 unless it's an ASCII or UTF-8 format + var charset = environment.charsetLookup(mimetype); + useBase64 = ['US-ASCII', 'UTF-8'].indexOf(charset) < 0; + } + if (useBase64) { + mimetype += ';base64'; + } + } + else { + useBase64 = /;base64$/.test(mimetype); + } + var fileSync = fileManager.loadFileSync(filePath, currentDirectory, context, environment); + if (!fileSync.contents) { + logger.warn("Skipped data-uri embedding of " + filePath + " because file not found"); + return fallback(this, filePathNode || mimetypeNode); + } + var buf = fileSync.contents; + if (useBase64 && !environment.encodeBase64) { + return fallback(this, filePathNode); + } + buf = useBase64 ? environment.encodeBase64(buf) : encodeURIComponent(buf); + var uri = "data:" + mimetype + "," + buf + fragment; + return new URL(new Quoted("\"" + uri + "\"", uri, false, this.index, this.currentFileInfo), this.index, this.currentFileInfo); + } }; + }); + + var getItemsFromNode = function (node) { + // handle non-array values as an array of length 1 + // return 'undefined' if index is invalid + var items = Array.isArray(node.value) ? + node.value : Array(node); + return items; + }; + var list = { + _SELF: function (n) { + return n; + }, + '~': function () { + var expr = []; + for (var _i = 0; _i < arguments.length; _i++) { + expr[_i] = arguments[_i]; + } + if (expr.length === 1) { + return expr[0]; + } + return new Value(expr); + }, + extract: function (values, index) { + // (1-based index) + index = index.value - 1; + return getItemsFromNode(values)[index]; + }, + length: function (values) { + return new Dimension(getItemsFromNode(values).length); + }, + /** + * Creates a Less list of incremental values. + * Modeled after Lodash's range function, also exists natively in PHP + * + * @param {Dimension} [start=1] + * @param {Dimension} end - e.g. 10 or 10px - unit is added to output + * @param {Dimension} [step=1] + */ + range: function (start, end, step) { + var from; + var to; + var stepValue = 1; + var list = []; + if (end) { + to = end; + from = start.value; + if (step) { + stepValue = step.value; + } + } + else { + from = 1; + to = start; + } + for (var i = from; i <= to.value; i += stepValue) { + list.push(new Dimension(i, to.unit)); + } + return new Expression(list); + }, + each: function (list, rs) { + var _this = this; + var rules = []; + var newRules; + var iterator; + var tryEval = function (val) { + if (val instanceof Node) { + return val.eval(_this.context); + } + return val; + }; + if (list.value && !(list instanceof Quoted)) { + if (Array.isArray(list.value)) { + iterator = list.value.map(tryEval); + } + else { + iterator = [tryEval(list.value)]; + } + } + else if (list.ruleset) { + iterator = tryEval(list.ruleset).rules; + } + else if (list.rules) { + iterator = list.rules.map(tryEval); + } + else if (Array.isArray(list)) { + iterator = list.map(tryEval); + } + else { + iterator = [tryEval(list)]; + } + var valueName = '@value'; + var keyName = '@key'; + var indexName = '@index'; + if (rs.params) { + valueName = rs.params[0] && rs.params[0].name; + keyName = rs.params[1] && rs.params[1].name; + indexName = rs.params[2] && rs.params[2].name; + rs = rs.rules; + } + else { + rs = rs.ruleset; + } + for (var i = 0; i < iterator.length; i++) { + var key = void 0; + var value = void 0; + var item = iterator[i]; + if (item instanceof Declaration) { + key = typeof item.name === 'string' ? item.name : item.name[0].value; + value = item.value; + } + else { + key = new Dimension(i + 1); + value = item; + } + if (item instanceof Comment) { + continue; + } + newRules = rs.rules.slice(0); + if (valueName) { + newRules.push(new Declaration(valueName, value, false, false, this.index, this.currentFileInfo)); + } + if (indexName) { + newRules.push(new Declaration(indexName, new Dimension(i + 1), false, false, this.index, this.currentFileInfo)); + } + if (keyName) { + newRules.push(new Declaration(keyName, key, false, false, this.index, this.currentFileInfo)); + } + rules.push(new Ruleset([new (Selector)([new Element("", '&')])], newRules, rs.strictImports, rs.visibilityInfo())); + } + return new Ruleset([new (Selector)([new Element("", '&')])], rules, rs.strictImports, rs.visibilityInfo()).eval(this.context); + } + }; + + var MathHelper = function (fn, unit, n) { + if (!(n instanceof Dimension)) { + throw { type: 'Argument', message: 'argument must be a number' }; + } + if (unit == null) { + unit = n.unit; + } + else { + n = n.unify(); + } + return new Dimension(fn(parseFloat(n.value)), unit); + }; + + var mathFunctions = { + // name, unit + ceil: null, + floor: null, + sqrt: null, + abs: null, + tan: '', + sin: '', + cos: '', + atan: 'rad', + asin: 'rad', + acos: 'rad' + }; + for (var f$1 in mathFunctions) { + if (mathFunctions.hasOwnProperty(f$1)) { + mathFunctions[f$1] = MathHelper.bind(null, Math[f$1], mathFunctions[f$1]); + } + } + mathFunctions.round = function (n, f) { + var fraction = typeof f === 'undefined' ? 0 : f.value; + return MathHelper(function (num) { return num.toFixed(fraction); }, null, n); + }; + + var minMax = function (isMin, args) { + args = Array.prototype.slice.call(args); + switch (args.length) { + case 0: throw { type: 'Argument', message: 'one or more arguments required' }; + } + var i; // key is the unit.toString() for unified Dimension values, + var j; + var current; + var currentUnified; + var referenceUnified; + var unit; + var unitStatic; + var unitClone; + var // elems only contains original argument values. + order = []; + var values = {}; + // value is the index into the order array. + for (i = 0; i < args.length; i++) { + current = args[i]; + if (!(current instanceof Dimension)) { + if (Array.isArray(args[i].value)) { + Array.prototype.push.apply(args, Array.prototype.slice.call(args[i].value)); + } + continue; + } + currentUnified = current.unit.toString() === '' && unitClone !== undefined ? new Dimension(current.value, unitClone).unify() : current.unify(); + unit = currentUnified.unit.toString() === '' && unitStatic !== undefined ? unitStatic : currentUnified.unit.toString(); + unitStatic = unit !== '' && unitStatic === undefined || unit !== '' && order[0].unify().unit.toString() === '' ? unit : unitStatic; + unitClone = unit !== '' && unitClone === undefined ? current.unit.toString() : unitClone; + j = values[''] !== undefined && unit !== '' && unit === unitStatic ? values[''] : values[unit]; + if (j === undefined) { + if (unitStatic !== undefined && unit !== unitStatic) { + throw { type: 'Argument', message: 'incompatible types' }; + } + values[unit] = order.length; + order.push(current); + continue; + } + referenceUnified = order[j].unit.toString() === '' && unitClone !== undefined ? new Dimension(order[j].value, unitClone).unify() : order[j].unify(); + if (isMin && currentUnified.value < referenceUnified.value || + !isMin && currentUnified.value > referenceUnified.value) { + order[j] = current; + } + } + if (order.length == 1) { + return order[0]; + } + args = order.map(function (a) { return a.toCSS(this.context); }).join(this.context.compress ? ',' : ', '); + return new Anonymous((isMin ? 'min' : 'max') + "(" + args + ")"); + }; + var number$1 = { + min: function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + try { + return minMax(true, args); + } + catch (e) { } + }, + max: function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + try { + return minMax(false, args); + } + catch (e) { } + }, + convert: function (val, unit) { + return val.convertTo(unit.value); + }, + pi: function () { + return new Dimension(Math.PI); + }, + mod: function (a, b) { + return new Dimension(a.value % b.value, a.unit); + }, + pow: function (x, y) { + if (typeof x === 'number' && typeof y === 'number') { + x = new Dimension(x); + y = new Dimension(y); + } + else if (!(x instanceof Dimension) || !(y instanceof Dimension)) { + throw { type: 'Argument', message: 'arguments must be numbers' }; + } + return new Dimension(Math.pow(x.value, y.value), x.unit); + }, + percentage: function (n) { + var result = MathHelper(function (num) { return num * 100; }, '%', n); + return result; + } + }; + + var string = { + e: function (str) { + return new Quoted('"', str instanceof JavaScript ? str.evaluated : str.value, true); + }, + escape: function (str) { + return new Anonymous(encodeURI(str.value).replace(/=/g, '%3D').replace(/:/g, '%3A').replace(/#/g, '%23').replace(/;/g, '%3B') + .replace(/\(/g, '%28').replace(/\)/g, '%29')); + }, + replace: function (string, pattern, replacement, flags) { + var result = string.value; + replacement = (replacement.type === 'Quoted') ? + replacement.value : replacement.toCSS(); + result = result.replace(new RegExp(pattern.value, flags ? flags.value : ''), replacement); + return new Quoted(string.quote || '', result, string.escaped); + }, + '%': function (string /* arg, arg, ... */) { + var args = Array.prototype.slice.call(arguments, 1); + var result = string.value; + var _loop_1 = function (i) { + /* jshint loopfunc:true */ + result = result.replace(/%[sda]/i, function (token) { + var value = ((args[i].type === 'Quoted') && + token.match(/s/i)) ? args[i].value : args[i].toCSS(); + return token.match(/[A-Z]$/) ? encodeURIComponent(value) : value; + }); + }; + for (var i = 0; i < args.length; i++) { + _loop_1(i); + } + result = result.replace(/%%/g, '%'); + return new Quoted(string.quote || '', result, string.escaped); + } + }; + + var svg = (function (environment) { + return { 'svg-gradient': function (direction) { + var stops; + var gradientDirectionSvg; + var gradientType = 'linear'; + var rectangleDimension = 'x="0" y="0" width="1" height="1"'; + var renderEnv = { compress: false }; + var returner; + var directionValue = direction.toCSS(renderEnv); + var i; + var color; + var position; + var positionValue; + var alpha; + function throwArgumentDescriptor() { + throw { type: 'Argument', + message: 'svg-gradient expects direction, start_color [start_position], [color position,]...,' + + ' end_color [end_position] or direction, color list' }; + } + if (arguments.length == 2) { + if (arguments[1].value.length < 2) { + throwArgumentDescriptor(); + } + stops = arguments[1].value; + } + else if (arguments.length < 3) { + throwArgumentDescriptor(); + } + else { + stops = Array.prototype.slice.call(arguments, 1); + } + switch (directionValue) { + case 'to bottom': + gradientDirectionSvg = 'x1="0%" y1="0%" x2="0%" y2="100%"'; + break; + case 'to right': + gradientDirectionSvg = 'x1="0%" y1="0%" x2="100%" y2="0%"'; + break; + case 'to bottom right': + gradientDirectionSvg = 'x1="0%" y1="0%" x2="100%" y2="100%"'; + break; + case 'to top right': + gradientDirectionSvg = 'x1="0%" y1="100%" x2="100%" y2="0%"'; + break; + case 'ellipse': + case 'ellipse at center': + gradientType = 'radial'; + gradientDirectionSvg = 'cx="50%" cy="50%" r="75%"'; + rectangleDimension = 'x="-50" y="-50" width="101" height="101"'; + break; + default: + throw { type: 'Argument', message: 'svg-gradient direction must be \'to bottom\', \'to right\',' + + ' \'to bottom right\', \'to top right\' or \'ellipse at center\'' }; + } + returner = "<" + gradientType + "Gradient id=\"g\" " + gradientDirectionSvg + ">"; + for (i = 0; i < stops.length; i += 1) { + if (stops[i] instanceof Expression) { + color = stops[i].value[0]; + position = stops[i].value[1]; + } + else { + color = stops[i]; + position = undefined; + } + if (!(color instanceof Color) || (!((i === 0 || i + 1 === stops.length) && position === undefined) && !(position instanceof Dimension))) { + throwArgumentDescriptor(); + } + positionValue = position ? position.toCSS(renderEnv) : i === 0 ? '0%' : '100%'; + alpha = color.alpha; + returner += ""; + } + returner += ""; + returner = encodeURIComponent(returner); + returner = "data:image/svg+xml," + returner; + return new URL(new Quoted("'" + returner + "'", returner, false, this.index, this.currentFileInfo), this.index, this.currentFileInfo); + } }; + }); + + var isa = function (n, Type) { return (n instanceof Type) ? Keyword.True : Keyword.False; }; + var isunit = function (n, unit) { + if (unit === undefined) { + throw { type: 'Argument', message: 'missing the required second argument to isunit.' }; + } + unit = typeof unit.value === 'string' ? unit.value : unit; + if (typeof unit !== 'string') { + throw { type: 'Argument', message: 'Second argument to isunit should be a unit or a string.' }; + } + return (n instanceof Dimension) && n.unit.is(unit) ? Keyword.True : Keyword.False; + }; + var types = { + isruleset: function (n) { + return isa(n, DetachedRuleset); + }, + iscolor: function (n) { + return isa(n, Color); + }, + isnumber: function (n) { + return isa(n, Dimension); + }, + isstring: function (n) { + return isa(n, Quoted); + }, + iskeyword: function (n) { + return isa(n, Keyword); + }, + isurl: function (n) { + return isa(n, URL); + }, + ispixel: function (n) { + return isunit(n, 'px'); + }, + ispercentage: function (n) { + return isunit(n, '%'); + }, + isem: function (n) { + return isunit(n, 'em'); + }, + isunit: isunit, + unit: function (val, unit) { + if (!(val instanceof Dimension)) { + throw { type: 'Argument', message: "the first argument to unit must be a number" + (val instanceof Operation ? '. Have you forgotten parenthesis?' : '') }; + } + if (unit) { + if (unit instanceof Keyword) { + unit = unit.value; + } + else { + unit = unit.toCSS(); + } + } + else { + unit = ''; + } + return new Dimension(val.value, unit); + }, + 'get-unit': function (n) { + return new Anonymous(n.unit); + } + }; + + var functions = (function (environment) { + var functions = { functionRegistry: functionRegistry, functionCaller: functionCaller }; + // register functions + functionRegistry.addMultiple(boolean$1); + functionRegistry.add('default', defaultFunc.eval.bind(defaultFunc)); + functionRegistry.addMultiple(color); + functionRegistry.addMultiple(colorBlend); + functionRegistry.addMultiple(dataUri(environment)); + functionRegistry.addMultiple(list); + functionRegistry.addMultiple(mathFunctions); + functionRegistry.addMultiple(number$1); + functionRegistry.addMultiple(string); + functionRegistry.addMultiple(svg()); + functionRegistry.addMultiple(types); + return functions; + }); + + function transformTree (root, options) { + options = options || {}; + var evaldRoot; + var variables = options.variables; + var evalEnv = new contexts.Eval(options); + // + // Allows setting variables with a hash, so: + // + // `{ color: new tree.Color('#f01') }` will become: + // + // new tree.Declaration('@color', + // new tree.Value([ + // new tree.Expression([ + // new tree.Color('#f01') + // ]) + // ]) + // ) + // + if (typeof variables === 'object' && !Array.isArray(variables)) { + variables = Object.keys(variables).map(function (k) { + var value = variables[k]; + if (!(value instanceof tree.Value)) { + if (!(value instanceof tree.Expression)) { + value = new tree.Expression([value]); + } + value = new tree.Value([value]); + } + return new tree.Declaration("@" + k, value, false, null, 0); + }); + evalEnv.frames = [new tree.Ruleset(null, variables)]; + } + var visitors$1 = [ + new visitors.JoinSelectorVisitor(), + new visitors.MarkVisibleSelectorsVisitor(true), + new visitors.ExtendVisitor(), + new visitors.ToCSSVisitor({ compress: Boolean(options.compress) }) + ]; + var preEvalVisitors = []; + var v; + var visitorIterator; + /** + * first() / get() allows visitors to be added while visiting + * + * @todo Add scoping for visitors just like functions for @plugin; right now they're global + */ + if (options.pluginManager) { + visitorIterator = options.pluginManager.visitor(); + for (var i = 0; i < 2; i++) { + visitorIterator.first(); + while ((v = visitorIterator.get())) { + if (v.isPreEvalVisitor) { + if (i === 0 || preEvalVisitors.indexOf(v) === -1) { + preEvalVisitors.push(v); + v.run(root); + } + } + else { + if (i === 0 || visitors$1.indexOf(v) === -1) { + if (v.isPreVisitor) { + visitors$1.unshift(v); + } + else { + visitors$1.push(v); + } + } + } + } + } + } + evaldRoot = root.eval(evalEnv); + for (var i = 0; i < visitors$1.length; i++) { + visitors$1[i].run(evaldRoot); + } + // Run any remaining visitors added after eval pass + if (options.pluginManager) { + visitorIterator.first(); + while ((v = visitorIterator.get())) { + if (visitors$1.indexOf(v) === -1 && preEvalVisitors.indexOf(v) === -1) { + v.run(evaldRoot); + } + } + } + return evaldRoot; + } + + /** + * Plugin Manager + */ + var PluginManager = /** @class */ (function () { + function PluginManager(less) { + this.less = less; + this.visitors = []; + this.preProcessors = []; + this.postProcessors = []; + this.installedPlugins = []; + this.fileManagers = []; + this.iterator = -1; + this.pluginCache = {}; + this.Loader = new less.PluginLoader(less); + } + /** + * Adds all the plugins in the array + * @param {Array} plugins + */ + PluginManager.prototype.addPlugins = function (plugins) { + if (plugins) { + for (var i = 0; i < plugins.length; i++) { + this.addPlugin(plugins[i]); + } + } + }; + /** + * + * @param plugin + * @param {String} filename + */ + PluginManager.prototype.addPlugin = function (plugin, filename, functionRegistry) { + this.installedPlugins.push(plugin); + if (filename) { + this.pluginCache[filename] = plugin; + } + if (plugin.install) { + plugin.install(this.less, this, functionRegistry || this.less.functions.functionRegistry); + } + }; + /** + * + * @param filename + */ + PluginManager.prototype.get = function (filename) { + return this.pluginCache[filename]; + }; + /** + * Adds a visitor. The visitor object has options on itself to determine + * when it should run. + * @param visitor + */ + PluginManager.prototype.addVisitor = function (visitor) { + this.visitors.push(visitor); + }; + /** + * Adds a pre processor object + * @param {object} preProcessor + * @param {number} priority - guidelines 1 = before import, 1000 = import, 2000 = after import + */ + PluginManager.prototype.addPreProcessor = function (preProcessor, priority) { + var indexToInsertAt; + for (indexToInsertAt = 0; indexToInsertAt < this.preProcessors.length; indexToInsertAt++) { + if (this.preProcessors[indexToInsertAt].priority >= priority) { + break; + } + } + this.preProcessors.splice(indexToInsertAt, 0, { preProcessor: preProcessor, priority: priority }); + }; + /** + * Adds a post processor object + * @param {object} postProcessor + * @param {number} priority - guidelines 1 = before compression, 1000 = compression, 2000 = after compression + */ + PluginManager.prototype.addPostProcessor = function (postProcessor, priority) { + var indexToInsertAt; + for (indexToInsertAt = 0; indexToInsertAt < this.postProcessors.length; indexToInsertAt++) { + if (this.postProcessors[indexToInsertAt].priority >= priority) { + break; + } + } + this.postProcessors.splice(indexToInsertAt, 0, { postProcessor: postProcessor, priority: priority }); + }; + /** + * + * @param manager + */ + PluginManager.prototype.addFileManager = function (manager) { + this.fileManagers.push(manager); + }; + /** + * + * @returns {Array} + * @private + */ + PluginManager.prototype.getPreProcessors = function () { + var preProcessors = []; + for (var i = 0; i < this.preProcessors.length; i++) { + preProcessors.push(this.preProcessors[i].preProcessor); + } + return preProcessors; + }; + /** + * + * @returns {Array} + * @private + */ + PluginManager.prototype.getPostProcessors = function () { + var postProcessors = []; + for (var i = 0; i < this.postProcessors.length; i++) { + postProcessors.push(this.postProcessors[i].postProcessor); + } + return postProcessors; + }; + /** + * + * @returns {Array} + * @private + */ + PluginManager.prototype.getVisitors = function () { + return this.visitors; + }; + PluginManager.prototype.visitor = function () { + var self = this; + return { + first: function () { + self.iterator = -1; + return self.visitors[self.iterator]; + }, + get: function () { + self.iterator += 1; + return self.visitors[self.iterator]; + } + }; + }; + /** + * + * @returns {Array} + * @private + */ + PluginManager.prototype.getFileManagers = function () { + return this.fileManagers; + }; + return PluginManager; + }()); + var pm; + var PluginManagerFactory = function (less, newFactory) { + if (newFactory || !pm) { + pm = new PluginManager(less); + } + return pm; + }; + + function SourceMapOutput (environment) { + var SourceMapOutput = /** @class */ (function () { + function SourceMapOutput(options) { + this._css = []; + this._rootNode = options.rootNode; + this._contentsMap = options.contentsMap; + this._contentsIgnoredCharsMap = options.contentsIgnoredCharsMap; + if (options.sourceMapFilename) { + this._sourceMapFilename = options.sourceMapFilename.replace(/\\/g, '/'); + } + this._outputFilename = options.outputFilename; + this.sourceMapURL = options.sourceMapURL; + if (options.sourceMapBasepath) { + this._sourceMapBasepath = options.sourceMapBasepath.replace(/\\/g, '/'); + } + if (options.sourceMapRootpath) { + this._sourceMapRootpath = options.sourceMapRootpath.replace(/\\/g, '/'); + if (this._sourceMapRootpath.charAt(this._sourceMapRootpath.length - 1) !== '/') { + this._sourceMapRootpath += '/'; + } + } + else { + this._sourceMapRootpath = ''; + } + this._outputSourceFiles = options.outputSourceFiles; + this._sourceMapGeneratorConstructor = environment.getSourceMapGenerator(); + this._lineNumber = 0; + this._column = 0; + } + SourceMapOutput.prototype.removeBasepath = function (path) { + if (this._sourceMapBasepath && path.indexOf(this._sourceMapBasepath) === 0) { + path = path.substring(this._sourceMapBasepath.length); + if (path.charAt(0) === '\\' || path.charAt(0) === '/') { + path = path.substring(1); + } + } + return path; + }; + SourceMapOutput.prototype.normalizeFilename = function (filename) { + filename = filename.replace(/\\/g, '/'); + filename = this.removeBasepath(filename); + return (this._sourceMapRootpath || '') + filename; + }; + SourceMapOutput.prototype.add = function (chunk, fileInfo, index, mapLines) { + // ignore adding empty strings + if (!chunk) { + return; + } + var lines, sourceLines, columns, sourceColumns, i; + if (fileInfo && fileInfo.filename) { + var inputSource = this._contentsMap[fileInfo.filename]; + // remove vars/banner added to the top of the file + if (this._contentsIgnoredCharsMap[fileInfo.filename]) { + // adjust the index + index -= this._contentsIgnoredCharsMap[fileInfo.filename]; + if (index < 0) { + index = 0; + } + // adjust the source + inputSource = inputSource.slice(this._contentsIgnoredCharsMap[fileInfo.filename]); + } + /** + * ignore empty content, or failsafe + * if contents map is incorrect + */ + if (inputSource === undefined) { + this._css.push(chunk); + return; + } + inputSource = inputSource.substring(0, index); + sourceLines = inputSource.split('\n'); + sourceColumns = sourceLines[sourceLines.length - 1]; + } + lines = chunk.split('\n'); + columns = lines[lines.length - 1]; + if (fileInfo && fileInfo.filename) { + if (!mapLines) { + this._sourceMapGenerator.addMapping({ generated: { line: this._lineNumber + 1, column: this._column }, + original: { line: sourceLines.length, column: sourceColumns.length }, + source: this.normalizeFilename(fileInfo.filename) }); + } + else { + for (i = 0; i < lines.length; i++) { + this._sourceMapGenerator.addMapping({ generated: { line: this._lineNumber + i + 1, column: i === 0 ? this._column : 0 }, + original: { line: sourceLines.length + i, column: i === 0 ? sourceColumns.length : 0 }, + source: this.normalizeFilename(fileInfo.filename) }); + } + } + } + if (lines.length === 1) { + this._column += columns.length; + } + else { + this._lineNumber += lines.length - 1; + this._column = columns.length; + } + this._css.push(chunk); + }; + SourceMapOutput.prototype.isEmpty = function () { + return this._css.length === 0; + }; + SourceMapOutput.prototype.toCSS = function (context) { + this._sourceMapGenerator = new this._sourceMapGeneratorConstructor({ file: this._outputFilename, sourceRoot: null }); + if (this._outputSourceFiles) { + for (var filename in this._contentsMap) { + if (this._contentsMap.hasOwnProperty(filename)) { + var source = this._contentsMap[filename]; + if (this._contentsIgnoredCharsMap[filename]) { + source = source.slice(this._contentsIgnoredCharsMap[filename]); + } + this._sourceMapGenerator.setSourceContent(this.normalizeFilename(filename), source); + } + } + } + this._rootNode.genCSS(context, this); + if (this._css.length > 0) { + var sourceMapURL = void 0; + var sourceMapContent = JSON.stringify(this._sourceMapGenerator.toJSON()); + if (this.sourceMapURL) { + sourceMapURL = this.sourceMapURL; + } + else if (this._sourceMapFilename) { + sourceMapURL = this._sourceMapFilename; + } + this.sourceMapURL = sourceMapURL; + this.sourceMap = sourceMapContent; + } + return this._css.join(''); + }; + return SourceMapOutput; + }()); + return SourceMapOutput; + } + + function SourceMapBuilder (SourceMapOutput, environment) { + var SourceMapBuilder = /** @class */ (function () { + function SourceMapBuilder(options) { + this.options = options; + } + SourceMapBuilder.prototype.toCSS = function (rootNode, options, imports) { + var sourceMapOutput = new SourceMapOutput({ + contentsIgnoredCharsMap: imports.contentsIgnoredChars, + rootNode: rootNode, + contentsMap: imports.contents, + sourceMapFilename: this.options.sourceMapFilename, + sourceMapURL: this.options.sourceMapURL, + outputFilename: this.options.sourceMapOutputFilename, + sourceMapBasepath: this.options.sourceMapBasepath, + sourceMapRootpath: this.options.sourceMapRootpath, + outputSourceFiles: this.options.outputSourceFiles, + sourceMapGenerator: this.options.sourceMapGenerator, + sourceMapFileInline: this.options.sourceMapFileInline, + disableSourcemapAnnotation: this.options.disableSourcemapAnnotation + }); + var css = sourceMapOutput.toCSS(options); + this.sourceMap = sourceMapOutput.sourceMap; + this.sourceMapURL = sourceMapOutput.sourceMapURL; + if (this.options.sourceMapInputFilename) { + this.sourceMapInputFilename = sourceMapOutput.normalizeFilename(this.options.sourceMapInputFilename); + } + if (this.options.sourceMapBasepath !== undefined && this.sourceMapURL !== undefined) { + this.sourceMapURL = sourceMapOutput.removeBasepath(this.sourceMapURL); + } + return css + this.getCSSAppendage(); + }; + SourceMapBuilder.prototype.getCSSAppendage = function () { + var sourceMapURL = this.sourceMapURL; + if (this.options.sourceMapFileInline) { + if (this.sourceMap === undefined) { + return ''; + } + sourceMapURL = "data:application/json;base64," + environment.encodeBase64(this.sourceMap); + } + if (this.options.disableSourcemapAnnotation) { + return ''; + } + if (sourceMapURL) { + return "/*# sourceMappingURL=" + sourceMapURL + " */"; + } + return ''; + }; + SourceMapBuilder.prototype.getExternalSourceMap = function () { + return this.sourceMap; + }; + SourceMapBuilder.prototype.setExternalSourceMap = function (sourceMap) { + this.sourceMap = sourceMap; + }; + SourceMapBuilder.prototype.isInline = function () { + return this.options.sourceMapFileInline; + }; + SourceMapBuilder.prototype.getSourceMapURL = function () { + return this.sourceMapURL; + }; + SourceMapBuilder.prototype.getOutputFilename = function () { + return this.options.sourceMapOutputFilename; + }; + SourceMapBuilder.prototype.getInputFilename = function () { + return this.sourceMapInputFilename; + }; + return SourceMapBuilder; + }()); + return SourceMapBuilder; + } + + function ParseTree (SourceMapBuilder) { + var ParseTree = /** @class */ (function () { + function ParseTree(root, imports) { + this.root = root; + this.imports = imports; + } + ParseTree.prototype.toCSS = function (options) { + var evaldRoot; + var result = {}; + var sourceMapBuilder; + try { + evaldRoot = transformTree(this.root, options); + } + catch (e) { + throw new LessError(e, this.imports); + } + try { + var compress = Boolean(options.compress); + if (compress) { + logger.warn('The compress option has been deprecated. ' + + 'We recommend you use a dedicated css minifier, for instance see less-plugin-clean-css.'); + } + var toCSSOptions = { + compress: compress, + dumpLineNumbers: options.dumpLineNumbers, + strictUnits: Boolean(options.strictUnits), + numPrecision: 8 + }; + if (options.sourceMap) { + sourceMapBuilder = new SourceMapBuilder(options.sourceMap); + result.css = sourceMapBuilder.toCSS(evaldRoot, toCSSOptions, this.imports); + } + else { + result.css = evaldRoot.toCSS(toCSSOptions); + } + } + catch (e) { + throw new LessError(e, this.imports); + } + if (options.pluginManager) { + var postProcessors = options.pluginManager.getPostProcessors(); + for (var i = 0; i < postProcessors.length; i++) { + result.css = postProcessors[i].process(result.css, { sourceMap: sourceMapBuilder, options: options, imports: this.imports }); + } + } + if (options.sourceMap) { + result.map = sourceMapBuilder.getExternalSourceMap(); + } + result.imports = []; + for (var file in this.imports.files) { + if (this.imports.files.hasOwnProperty(file) && file !== this.imports.rootFilename) { + result.imports.push(file); + } + } + return result; + }; + return ParseTree; + }()); + return ParseTree; + } + + function ImportManager (environment) { + // FileInfo = { + // 'rewriteUrls' - option - whether to adjust URL's to be relative + // 'filename' - full resolved filename of current file + // 'rootpath' - path to append to normal URLs for this node + // 'currentDirectory' - path to the current file, absolute + // 'rootFilename' - filename of the base file + // 'entryPath' - absolute path to the entry file + // 'reference' - whether the file should not be output and only output parts that are referenced + var ImportManager = /** @class */ (function () { + function ImportManager(less, context, rootFileInfo) { + this.less = less; + this.rootFilename = rootFileInfo.filename; + this.paths = context.paths || []; // Search paths, when importing + this.contents = {}; // map - filename to contents of all the files + this.contentsIgnoredChars = {}; // map - filename to lines at the beginning of each file to ignore + this.mime = context.mime; + this.error = null; + this.context = context; + // Deprecated? Unused outside of here, could be useful. + this.queue = []; // Files which haven't been imported yet + this.files = {}; // Holds the imported parse trees. + } + /** + * Add an import to be imported + * @param path - the raw path + * @param tryAppendExtension - whether to try appending a file extension (.less or .js if the path has no extension) + * @param currentFileInfo - the current file info (used for instance to work out relative paths) + * @param importOptions - import options + * @param callback - callback for when it is imported + */ + ImportManager.prototype.push = function (path, tryAppendExtension, currentFileInfo, importOptions, callback) { + var importManager = this, pluginLoader = this.context.pluginManager.Loader; + this.queue.push(path); + var fileParsedFunc = function (e, root, fullPath) { + importManager.queue.splice(importManager.queue.indexOf(path), 1); // Remove the path from the queue + var importedEqualsRoot = fullPath === importManager.rootFilename; + if (importOptions.optional && e) { + callback(null, { rules: [] }, false, null); + logger.info("The file " + fullPath + " was skipped because it was not found and the import was marked optional."); + } + else { + // Inline imports aren't cached here. + // If we start to cache them, please make sure they won't conflict with non-inline imports of the + // same name as they used to do before this comment and the condition below have been added. + if (!importManager.files[fullPath] && !importOptions.inline) { + importManager.files[fullPath] = { root: root, options: importOptions }; + } + if (e && !importManager.error) { + importManager.error = e; + } + callback(e, root, importedEqualsRoot, fullPath); + } + }; + var newFileInfo = { + rewriteUrls: this.context.rewriteUrls, + entryPath: currentFileInfo.entryPath, + rootpath: currentFileInfo.rootpath, + rootFilename: currentFileInfo.rootFilename + }; + var fileManager = environment.getFileManager(path, currentFileInfo.currentDirectory, this.context, environment); + if (!fileManager) { + fileParsedFunc({ message: "Could not find a file-manager for " + path }); + return; + } + var loadFileCallback = function (loadedFile) { + var plugin; + var resolvedFilename = loadedFile.filename; + var contents = loadedFile.contents.replace(/^\uFEFF/, ''); + // Pass on an updated rootpath if path of imported file is relative and file + // is in a (sub|sup) directory + // + // Examples: + // - If path of imported file is 'module/nav/nav.less' and rootpath is 'less/', + // then rootpath should become 'less/module/nav/' + // - If path of imported file is '../mixins.less' and rootpath is 'less/', + // then rootpath should become 'less/../' + newFileInfo.currentDirectory = fileManager.getPath(resolvedFilename); + if (newFileInfo.rewriteUrls) { + newFileInfo.rootpath = fileManager.join((importManager.context.rootpath || ''), fileManager.pathDiff(newFileInfo.currentDirectory, newFileInfo.entryPath)); + if (!fileManager.isPathAbsolute(newFileInfo.rootpath) && fileManager.alwaysMakePathsAbsolute()) { + newFileInfo.rootpath = fileManager.join(newFileInfo.entryPath, newFileInfo.rootpath); + } + } + newFileInfo.filename = resolvedFilename; + var newEnv = new contexts.Parse(importManager.context); + newEnv.processImports = false; + importManager.contents[resolvedFilename] = contents; + if (currentFileInfo.reference || importOptions.reference) { + newFileInfo.reference = true; + } + if (importOptions.isPlugin) { + plugin = pluginLoader.evalPlugin(contents, newEnv, importManager, importOptions.pluginArgs, newFileInfo); + if (plugin instanceof LessError) { + fileParsedFunc(plugin, null, resolvedFilename); + } + else { + fileParsedFunc(null, plugin, resolvedFilename); + } + } + else if (importOptions.inline) { + fileParsedFunc(null, contents, resolvedFilename); + } + else { + // import (multiple) parse trees apparently get altered and can't be cached. + // TODO: investigate why this is + if (importManager.files[resolvedFilename] + && !importManager.files[resolvedFilename].options.multiple + && !importOptions.multiple) { + fileParsedFunc(null, importManager.files[resolvedFilename].root, resolvedFilename); + } + else { + new Parser(newEnv, importManager, newFileInfo).parse(contents, function (e, root) { + fileParsedFunc(e, root, resolvedFilename); + }); + } + } + }; + var loadedFile; + var promise; + var context = clone(this.context); + if (tryAppendExtension) { + context.ext = importOptions.isPlugin ? '.js' : '.less'; + } + if (importOptions.isPlugin) { + context.mime = 'application/javascript'; + if (context.syncImport) { + loadedFile = pluginLoader.loadPluginSync(path, currentFileInfo.currentDirectory, context, environment, fileManager); + } + else { + promise = pluginLoader.loadPlugin(path, currentFileInfo.currentDirectory, context, environment, fileManager); + } + } + else { + if (context.syncImport) { + loadedFile = fileManager.loadFileSync(path, currentFileInfo.currentDirectory, context, environment); + } + else { + promise = fileManager.loadFile(path, currentFileInfo.currentDirectory, context, environment, function (err, loadedFile) { + if (err) { + fileParsedFunc(err); + } + else { + loadFileCallback(loadedFile); + } + }); + } + } + if (loadedFile) { + if (!loadedFile.filename) { + fileParsedFunc(loadedFile); + } + else { + loadFileCallback(loadedFile); + } + } + else if (promise) { + promise.then(loadFileCallback, fileParsedFunc); + } + }; + return ImportManager; + }()); + return ImportManager; + } + + function Parse (environment, ParseTree, ImportManager) { + var parse = function (input, options, callback) { + if (typeof options === 'function') { + callback = options; + options = copyOptions(this.options, {}); + } + else { + options = copyOptions(this.options, options || {}); + } + if (!callback) { + var self_1 = this; + return new Promise(function (resolve, reject) { + parse.call(self_1, input, options, function (err, output) { + if (err) { + reject(err); + } + else { + resolve(output); + } + }); + }); + } + else { + var context_1; + var rootFileInfo = void 0; + var pluginManager_1 = new PluginManagerFactory(this, !options.reUsePluginManager); + options.pluginManager = pluginManager_1; + context_1 = new contexts.Parse(options); + if (options.rootFileInfo) { + rootFileInfo = options.rootFileInfo; + } + else { + var filename = options.filename || 'input'; + var entryPath = filename.replace(/[^\/\\]*$/, ''); + rootFileInfo = { + filename: filename, + rewriteUrls: context_1.rewriteUrls, + rootpath: context_1.rootpath || '', + currentDirectory: entryPath, + entryPath: entryPath, + rootFilename: filename + }; + // add in a missing trailing slash + if (rootFileInfo.rootpath && rootFileInfo.rootpath.slice(-1) !== '/') { + rootFileInfo.rootpath += '/'; + } + } + var imports_1 = new ImportManager(this, context_1, rootFileInfo); + this.importManager = imports_1; + // TODO: allow the plugins to be just a list of paths or names + // Do an async plugin queue like lessc + if (options.plugins) { + options.plugins.forEach(function (plugin) { + var evalResult, contents; + if (plugin.fileContent) { + contents = plugin.fileContent.replace(/^\uFEFF/, ''); + evalResult = pluginManager_1.Loader.evalPlugin(contents, context_1, imports_1, plugin.options, plugin.filename); + if (evalResult instanceof LessError) { + return callback(evalResult); + } + } + else { + pluginManager_1.addPlugin(plugin); + } + }); + } + new Parser(context_1, imports_1, rootFileInfo) + .parse(input, function (e, root) { + if (e) { + return callback(e); + } + callback(null, root, imports_1, options); + }, options); + } + }; + return parse; + } + + function Render (environment, ParseTree, ImportManager) { + var render = function (input, options, callback) { + if (typeof options === 'function') { + callback = options; + options = copyOptions(this.options, {}); + } + else { + options = copyOptions(this.options, options || {}); + } + if (!callback) { + var self_1 = this; + return new Promise(function (resolve, reject) { + render.call(self_1, input, options, function (err, output) { + if (err) { + reject(err); + } + else { + resolve(output); + } + }); + }); + } + else { + this.parse(input, options, function (err, root, imports, options) { + if (err) { + return callback(err); + } + var result; + try { + var parseTree = new ParseTree(root, imports); + result = parseTree.toCSS(options); + } + catch (err) { + return callback(err); + } + callback(null, result); + }); + } + }; + return render; + } + + var version = "4.1.1"; + + function parseNodeVersion(version) { + var match = version.match(/^v(\d{1,2})\.(\d{1,2})\.(\d{1,2})(?:-([0-9A-Za-z-.]+))?(?:\+([0-9A-Za-z-.]+))?$/); // eslint-disable-line max-len + if (!match) { + throw new Error('Unable to parse: ' + version); + } + + var res = { + major: parseInt(match[1], 10), + minor: parseInt(match[2], 10), + patch: parseInt(match[3], 10), + pre: match[4] || '', + build: match[5] || '', + }; + + return res; + } + + var parseNodeVersion_1 = parseNodeVersion; + + function lessRoot (environment, fileManagers) { + var sourceMapOutput, sourceMapBuilder, parseTree, importManager; + environment = new Environment(environment, fileManagers); + sourceMapOutput = SourceMapOutput(environment); + sourceMapBuilder = SourceMapBuilder(sourceMapOutput, environment); + parseTree = ParseTree(sourceMapBuilder); + importManager = ImportManager(environment); + var render = Render(environment, parseTree); + var parse = Parse(environment, parseTree, importManager); + var v = parseNodeVersion_1("v" + version); + var initial = { + version: [v.major, v.minor, v.patch], + data: data, + tree: tree, + Environment: Environment, + AbstractFileManager: AbstractFileManager, + AbstractPluginLoader: AbstractPluginLoader, + environment: environment, + visitors: visitors, + Parser: Parser, + functions: functions(environment), + contexts: contexts, + SourceMapOutput: sourceMapOutput, + SourceMapBuilder: sourceMapBuilder, + ParseTree: parseTree, + ImportManager: importManager, + render: render, + parse: parse, + LessError: LessError, + transformTree: transformTree, + utils: utils, + PluginManager: PluginManagerFactory, + logger: logger + }; + // Create a public API + var ctor = function (t) { + return function () { + var obj = Object.create(t.prototype); + t.apply(obj, Array.prototype.slice.call(arguments, 0)); + return obj; + }; + }; + var t; + var api = Object.create(initial); + for (var n in initial.tree) { + /* eslint guard-for-in: 0 */ + t = initial.tree[n]; + if (typeof t === 'function') { + api[n.toLowerCase()] = ctor(t); + } + else { + api[n] = Object.create(null); + for (var o in t) { + /* eslint guard-for-in: 0 */ + api[n][o.toLowerCase()] = ctor(t[o]); + } + } + } + /** + * Some of the functions assume a `this` context of the API object, + * which causes it to fail when wrapped for ES6 imports. + * + * An assumed `this` should be removed in the future. + */ + initial.parse = initial.parse.bind(api); + initial.render = initial.render.bind(api); + return api; + } + + /* global window, XMLHttpRequest */ + var options; + var logger$1; + var fileCache = {}; + // TODOS - move log somewhere. pathDiff and doing something similar in node. use pathDiff in the other browser file for the initial load + var FileManager = function () { }; + FileManager.prototype = Object.assign(new AbstractFileManager(), { + alwaysMakePathsAbsolute: function () { + return true; + }, + join: function (basePath, laterPath) { + if (!basePath) { + return laterPath; + } + return this.extractUrlParts(laterPath, basePath).path; + }, + doXHR: function (url, type, callback, errback) { + var xhr = new XMLHttpRequest(); + var async = options.isFileProtocol ? options.fileAsync : true; + if (typeof xhr.overrideMimeType === 'function') { + xhr.overrideMimeType('text/css'); + } + logger$1.debug("XHR: Getting '" + url + "'"); + xhr.open('GET', url, async); + xhr.setRequestHeader('Accept', type || 'text/x-less, text/css; q=0.9, */*; q=0.5'); + xhr.send(null); + function handleResponse(xhr, callback, errback) { + if (xhr.status >= 200 && xhr.status < 300) { + callback(xhr.responseText, xhr.getResponseHeader('Last-Modified')); + } + else if (typeof errback === 'function') { + errback(xhr.status, url); + } + } + if (options.isFileProtocol && !options.fileAsync) { + if (xhr.status === 0 || (xhr.status >= 200 && xhr.status < 300)) { + callback(xhr.responseText); + } + else { + errback(xhr.status, url); + } + } + else if (async) { + xhr.onreadystatechange = function () { + if (xhr.readyState == 4) { + handleResponse(xhr, callback, errback); + } + }; + } + else { + handleResponse(xhr, callback, errback); + } + }, + supports: function () { + return true; + }, + clearFileCache: function () { + fileCache = {}; + }, + loadFile: function (filename, currentDirectory, options, environment) { + // TODO: Add prefix support like less-node? + // What about multiple paths? + if (currentDirectory && !this.isPathAbsolute(filename)) { + filename = currentDirectory + filename; + } + filename = options.ext ? this.tryAppendExtension(filename, options.ext) : filename; + options = options || {}; + // sheet may be set to the stylesheet for the initial load or a collection of properties including + // some context variables for imports + var hrefParts = this.extractUrlParts(filename, window.location.href); + var href = hrefParts.url; + var self = this; + return new Promise(function (resolve, reject) { + if (options.useFileCache && fileCache[href]) { + try { + var lessText = fileCache[href]; + return resolve({ contents: lessText, filename: href, webInfo: { lastModified: new Date() } }); + } + catch (e) { + return reject({ filename: href, message: "Error loading file " + href + " error was " + e.message }); + } + } + self.doXHR(href, options.mime, function doXHRCallback(data, lastModified) { + // per file cache + fileCache[href] = data; + // Use remote copy (re-parse) + resolve({ contents: data, filename: href, webInfo: { lastModified: lastModified } }); + }, function doXHRError(status, url) { + reject({ type: 'File', message: "'" + url + "' wasn't found (" + status + ")", href: href }); + }); + }); + } + }); + var FM = (function (opts, log) { + options = opts; + logger$1 = log; + return FileManager; + }); + + // TODO: Add tests for browser @plugin + /** + * Browser Plugin Loader + */ + var PluginLoader = function (less) { + this.less = less; + // Should we shim this.require for browser? Probably not? + }; + PluginLoader.prototype = Object.assign(new AbstractPluginLoader(), { + loadPlugin: function (filename, basePath, context, environment, fileManager) { + return new Promise(function (fulfill, reject) { + fileManager.loadFile(filename, basePath, context, environment) + .then(fulfill).catch(reject); + }); + } + }); + + var LogListener = (function (less, options) { + var logLevel_debug = 4; + var logLevel_info = 3; + var logLevel_warn = 2; + var logLevel_error = 1; + // The amount of logging in the javascript console. + // 3 - Debug, information and errors + // 2 - Information and errors + // 1 - Errors + // 0 - None + // Defaults to 2 + options.logLevel = typeof options.logLevel !== 'undefined' ? options.logLevel : (options.env === 'development' ? logLevel_info : logLevel_error); + if (!options.loggers) { + options.loggers = [{ + debug: function (msg) { + if (options.logLevel >= logLevel_debug) { + console.log(msg); + } + }, + info: function (msg) { + if (options.logLevel >= logLevel_info) { + console.log(msg); + } + }, + warn: function (msg) { + if (options.logLevel >= logLevel_warn) { + console.warn(msg); + } + }, + error: function (msg) { + if (options.logLevel >= logLevel_error) { + console.error(msg); + } + } + }]; + } + for (var i = 0; i < options.loggers.length; i++) { + less.logger.addListener(options.loggers[i]); + } + }); + + var ErrorReporting = (function (window, less, options) { + function errorHTML(e, rootHref) { + var id = "less-error-message:" + extractId(rootHref || ''); + var template = '
  • {content}
  • '; + var elem = window.document.createElement('div'); + var timer; + var content; + var errors = []; + var filename = e.filename || rootHref; + var filenameNoPath = filename.match(/([^\/]+(\?.*)?)$/)[1]; + elem.id = id; + elem.className = 'less-error-message'; + content = "

    " + (e.type || 'Syntax') + "Error: " + (e.message || 'There is an error in your .less file') + + ("

    in " + filenameNoPath + " "); + var errorline = function (e, i, classname) { + if (e.extract[i] !== undefined) { + errors.push(template.replace(/\{line\}/, (parseInt(e.line, 10) || 0) + (i - 1)) + .replace(/\{class\}/, classname) + .replace(/\{content\}/, e.extract[i])); + } + }; + if (e.line) { + errorline(e, 0, ''); + errorline(e, 1, 'line'); + errorline(e, 2, ''); + content += "on line " + e.line + ", column " + (e.column + 1) + ":

      " + errors.join('') + "
    "; + } + if (e.stack && (e.extract || options.logLevel >= 4)) { + content += "
    Stack Trace
    " + e.stack.split('\n').slice(1).join('
    '); + } + elem.innerHTML = content; + // CSS for error messages + browser.createCSS(window.document, [ + '.less-error-message ul, .less-error-message li {', + 'list-style-type: none;', + 'margin-right: 15px;', + 'padding: 4px 0;', + 'margin: 0;', + '}', + '.less-error-message label {', + 'font-size: 12px;', + 'margin-right: 15px;', + 'padding: 4px 0;', + 'color: #cc7777;', + '}', + '.less-error-message pre {', + 'color: #dd6666;', + 'padding: 4px 0;', + 'margin: 0;', + 'display: inline-block;', + '}', + '.less-error-message pre.line {', + 'color: #ff0000;', + '}', + '.less-error-message h3 {', + 'font-size: 20px;', + 'font-weight: bold;', + 'padding: 15px 0 5px 0;', + 'margin: 0;', + '}', + '.less-error-message a {', + 'color: #10a', + '}', + '.less-error-message .error {', + 'color: red;', + 'font-weight: bold;', + 'padding-bottom: 2px;', + 'border-bottom: 1px dashed red;', + '}' + ].join('\n'), { title: 'error-message' }); + elem.style.cssText = [ + 'font-family: Arial, sans-serif', + 'border: 1px solid #e00', + 'background-color: #eee', + 'border-radius: 5px', + '-webkit-border-radius: 5px', + '-moz-border-radius: 5px', + 'color: #e00', + 'padding: 15px', + 'margin-bottom: 15px' + ].join(';'); + if (options.env === 'development') { + timer = setInterval(function () { + var document = window.document; + var body = document.body; + if (body) { + if (document.getElementById(id)) { + body.replaceChild(elem, document.getElementById(id)); + } + else { + body.insertBefore(elem, body.firstChild); + } + clearInterval(timer); + } + }, 10); + } + } + function removeErrorHTML(path) { + var node = window.document.getElementById("less-error-message:" + extractId(path)); + if (node) { + node.parentNode.removeChild(node); + } + } + function removeError(path) { + if (!options.errorReporting || options.errorReporting === 'html') { + removeErrorHTML(path); + } + else if (options.errorReporting === 'console') ; + else if (typeof options.errorReporting === 'function') { + options.errorReporting('remove', path); + } + } + function errorConsole(e, rootHref) { + var template = '{line} {content}'; + var filename = e.filename || rootHref; + var errors = []; + var content = (e.type || 'Syntax') + "Error: " + (e.message || 'There is an error in your .less file') + " in " + filename; + var errorline = function (e, i, classname) { + if (e.extract[i] !== undefined) { + errors.push(template.replace(/\{line\}/, (parseInt(e.line, 10) || 0) + (i - 1)) + .replace(/\{class\}/, classname) + .replace(/\{content\}/, e.extract[i])); + } + }; + if (e.line) { + errorline(e, 0, ''); + errorline(e, 1, 'line'); + errorline(e, 2, ''); + content += " on line " + e.line + ", column " + (e.column + 1) + ":\n" + errors.join('\n'); + } + if (e.stack && (e.extract || options.logLevel >= 4)) { + content += "\nStack Trace\n" + e.stack; + } + less.logger.error(content); + } + function error(e, rootHref) { + if (!options.errorReporting || options.errorReporting === 'html') { + errorHTML(e, rootHref); + } + else if (options.errorReporting === 'console') { + errorConsole(e, rootHref); + } + else if (typeof options.errorReporting === 'function') { + options.errorReporting('add', e, rootHref); + } + } + return { + add: error, + remove: removeError + }; + }); + + // Cache system is a bit outdated and could do with work + var Cache = (function (window, options, logger) { + var cache = null; + if (options.env !== 'development') { + try { + cache = (typeof window.localStorage === 'undefined') ? null : window.localStorage; + } + catch (_) { } + } + return { + setCSS: function (path, lastModified, modifyVars, styles) { + if (cache) { + logger.info("saving " + path + " to cache."); + try { + cache.setItem(path, styles); + cache.setItem(path + ":timestamp", lastModified); + if (modifyVars) { + cache.setItem(path + ":vars", JSON.stringify(modifyVars)); + } + } + catch (e) { + // TODO - could do with adding more robust error handling + logger.error("failed to save \"" + path + "\" to local storage for caching."); + } + } + }, + getCSS: function (path, webInfo, modifyVars) { + var css = cache && cache.getItem(path); + var timestamp = cache && cache.getItem(path + ":timestamp"); + var vars = cache && cache.getItem(path + ":vars"); + modifyVars = modifyVars || {}; + vars = vars || "{}"; // if not set, treat as the JSON representation of an empty object + if (timestamp && webInfo.lastModified && + (new Date(webInfo.lastModified).valueOf() === + new Date(timestamp).valueOf()) && + JSON.stringify(modifyVars) === vars) { + // Use local copy + return css; + } + } + }; + }); + + var ImageSize = (function () { + function imageSize() { + throw { + type: 'Runtime', + message: 'Image size functions are not supported in browser version of less' + }; + } + var imageFunctions = { + 'image-size': function (filePathNode) { + imageSize(); + return -1; + }, + 'image-width': function (filePathNode) { + imageSize(); + return -1; + }, + 'image-height': function (filePathNode) { + imageSize(); + return -1; + } + }; + functionRegistry.addMultiple(imageFunctions); + }); + + // + var root = (function (window, options) { + var document = window.document; + var less = lessRoot(); + less.options = options; + var environment = less.environment; + var FileManager = FM(options, less.logger); + var fileManager = new FileManager(); + environment.addFileManager(fileManager); + less.FileManager = FileManager; + less.PluginLoader = PluginLoader; + LogListener(less, options); + var errors = ErrorReporting(window, less, options); + var cache = less.cache = options.cache || Cache(window, options, less.logger); + ImageSize(less.environment); + // Setup user functions - Deprecate? + if (options.functions) { + less.functions.functionRegistry.addMultiple(options.functions); + } + var typePattern = /^text\/(x-)?less$/; + function clone(obj) { + var cloned = {}; + for (var prop in obj) { + if (obj.hasOwnProperty(prop)) { + cloned[prop] = obj[prop]; + } + } + return cloned; + } + // only really needed for phantom + function bind(func, thisArg) { + var curryArgs = Array.prototype.slice.call(arguments, 2); + return function () { + var args = curryArgs.concat(Array.prototype.slice.call(arguments, 0)); + return func.apply(thisArg, args); + }; + } + function loadStyles(modifyVars) { + var styles = document.getElementsByTagName('style'); + var style; + for (var i = 0; i < styles.length; i++) { + style = styles[i]; + if (style.type.match(typePattern)) { + var instanceOptions = clone(options); + instanceOptions.modifyVars = modifyVars; + var lessText = style.innerHTML || ''; + instanceOptions.filename = document.location.href.replace(/#.*$/, ''); + /* jshint loopfunc:true */ + // use closure to store current style + less.render(lessText, instanceOptions, bind(function (style, e, result) { + if (e) { + errors.add(e, 'inline'); + } + else { + style.type = 'text/css'; + if (style.styleSheet) { + style.styleSheet.cssText = result.css; + } + else { + style.innerHTML = result.css; + } + } + }, null, style)); + } + } + } + function loadStyleSheet(sheet, callback, reload, remaining, modifyVars) { + var instanceOptions = clone(options); + addDataAttr(instanceOptions, sheet); + instanceOptions.mime = sheet.type; + if (modifyVars) { + instanceOptions.modifyVars = modifyVars; + } + function loadInitialFileCallback(loadedFile) { + var data = loadedFile.contents; + var path = loadedFile.filename; + var webInfo = loadedFile.webInfo; + var newFileInfo = { + currentDirectory: fileManager.getPath(path), + filename: path, + rootFilename: path, + rewriteUrls: instanceOptions.rewriteUrls + }; + newFileInfo.entryPath = newFileInfo.currentDirectory; + newFileInfo.rootpath = instanceOptions.rootpath || newFileInfo.currentDirectory; + if (webInfo) { + webInfo.remaining = remaining; + var css = cache.getCSS(path, webInfo, instanceOptions.modifyVars); + if (!reload && css) { + webInfo.local = true; + callback(null, css, data, sheet, webInfo, path); + return; + } + } + // TODO add tests around how this behaves when reloading + errors.remove(path); + instanceOptions.rootFileInfo = newFileInfo; + less.render(data, instanceOptions, function (e, result) { + if (e) { + e.href = path; + callback(e); + } + else { + cache.setCSS(sheet.href, webInfo.lastModified, instanceOptions.modifyVars, result.css); + callback(null, result.css, data, sheet, webInfo, path); + } + }); + } + fileManager.loadFile(sheet.href, null, instanceOptions, environment) + .then(function (loadedFile) { + loadInitialFileCallback(loadedFile); + }).catch(function (err) { + console.log(err); + callback(err); + }); + } + function loadStyleSheets(callback, reload, modifyVars) { + for (var i = 0; i < less.sheets.length; i++) { + loadStyleSheet(less.sheets[i], callback, reload, less.sheets.length - (i + 1), modifyVars); + } + } + function initRunningMode() { + if (less.env === 'development') { + less.watchTimer = setInterval(function () { + if (less.watchMode) { + fileManager.clearFileCache(); + loadStyleSheets(function (e, css, _, sheet, webInfo) { + if (e) { + errors.add(e, e.href || sheet.href); + } + else if (css) { + browser.createCSS(window.document, css, sheet); + } + }); + } + }, options.poll); + } + } + // + // Watch mode + // + less.watch = function () { + if (!less.watchMode) { + less.env = 'development'; + initRunningMode(); + } + this.watchMode = true; + return true; + }; + less.unwatch = function () { clearInterval(less.watchTimer); this.watchMode = false; return false; }; + // + // Synchronously get all tags with the 'rel' attribute set to + // "stylesheet/less". + // + less.registerStylesheetsImmediately = function () { + var links = document.getElementsByTagName('link'); + less.sheets = []; + for (var i = 0; i < links.length; i++) { + if (links[i].rel === 'stylesheet/less' || (links[i].rel.match(/stylesheet/) && + (links[i].type.match(typePattern)))) { + less.sheets.push(links[i]); + } + } + }; + // + // Asynchronously get all tags with the 'rel' attribute set to + // "stylesheet/less", returning a Promise. + // + less.registerStylesheets = function () { return new Promise(function (resolve, reject) { + less.registerStylesheetsImmediately(); + resolve(); + }); }; + // + // With this function, it's possible to alter variables and re-render + // CSS without reloading less-files + // + less.modifyVars = function (record) { return less.refresh(true, record, false); }; + less.refresh = function (reload, modifyVars, clearFileCache) { + if ((reload || clearFileCache) && clearFileCache !== false) { + fileManager.clearFileCache(); + } + return new Promise(function (resolve, reject) { + var startTime; + var endTime; + var totalMilliseconds; + var remainingSheets; + startTime = endTime = new Date(); + // Set counter for remaining unprocessed sheets + remainingSheets = less.sheets.length; + if (remainingSheets === 0) { + endTime = new Date(); + totalMilliseconds = endTime - startTime; + less.logger.info('Less has finished and no sheets were loaded.'); + resolve({ + startTime: startTime, + endTime: endTime, + totalMilliseconds: totalMilliseconds, + sheets: less.sheets.length + }); + } + else { + // Relies on less.sheets array, callback seems to be guaranteed to be called for every element of the array + loadStyleSheets(function (e, css, _, sheet, webInfo) { + if (e) { + errors.add(e, e.href || sheet.href); + reject(e); + return; + } + if (webInfo.local) { + less.logger.info("Loading " + sheet.href + " from cache."); + } + else { + less.logger.info("Rendered " + sheet.href + " successfully."); + } + browser.createCSS(window.document, css, sheet); + less.logger.info("CSS for " + sheet.href + " generated in " + (new Date() - endTime) + "ms"); + // Count completed sheet + remainingSheets--; + // Check if the last remaining sheet was processed and then call the promise + if (remainingSheets === 0) { + totalMilliseconds = new Date() - startTime; + less.logger.info("Less has finished. CSS generated in " + totalMilliseconds + "ms"); + resolve({ + startTime: startTime, + endTime: endTime, + totalMilliseconds: totalMilliseconds, + sheets: less.sheets.length + }); + } + endTime = new Date(); + }, reload, modifyVars); + } + loadStyles(modifyVars); + }); + }; + less.refreshStyles = loadStyles; + return less; + }); + + /** + * Kicks off less and compiles any stylesheets + * used in the browser distributed version of less + * to kick-start less using the browser api + */ + var options$1 = defaultOptions(); + if (window.less) { + for (var key in window.less) { + if (window.less.hasOwnProperty(key)) { + options$1[key] = window.less[key]; + } + } + } + addDefaultOptions(window, options$1); + options$1.plugins = options$1.plugins || []; + if (window.LESS_PLUGINS) { + options$1.plugins = options$1.plugins.concat(window.LESS_PLUGINS); + } + var less = root(window, options$1); + window.less = less; + var css; + var head; + var style; + // Always restore page visibility + function resolveOrReject(data) { + if (data.filename) { + console.warn(data); + } + if (!options$1.async) { + head.removeChild(style); + } + } + if (options$1.onReady) { + if (/!watch/.test(window.location.hash)) { + less.watch(); + } + // Simulate synchronous stylesheet loading by hiding page rendering + if (!options$1.async) { + css = 'body { display: none !important }'; + head = document.head || document.getElementsByTagName('head')[0]; + style = document.createElement('style'); + style.type = 'text/css'; + if (style.styleSheet) { + style.styleSheet.cssText = css; + } + else { + style.appendChild(document.createTextNode(css)); + } + head.appendChild(style); + } + less.registerStylesheetsImmediately(); + less.pageLoadFinished = less.refresh(less.env === 'development').then(resolveOrReject, resolveOrReject); + } + + return less; + +}))); diff --git a/src/octoprint/static/js/lib/less.min.js b/src/octoprint/static/js/lib/less.min.js deleted file mode 100644 index 5f8b1509e..000000000 --- a/src/octoprint/static/js/lib/less.min.js +++ /dev/null @@ -1,11 +0,0 @@ -/** - * Less - Leaner CSS v3.12.2 - * http://lesscss.org - * - * Copyright (c) 2009-2020, Alexis Sellier - * Licensed under the Apache-2.0 License. - * - * @license Apache-2.0 - */ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).less=t()}(this,(function(){"use strict";function e(e){return e.replace(/^[a-z-]+:\/+?[^\/]+/,"").replace(/[\?\&]livereload=\w+/,"").replace(/^\//,"").replace(/\.[a-zA-Z]+$/,"").replace(/[^\.\w-]+/g,"-").replace(/\./g,":")}function t(e,t){for(var n in t.dataset)if(t.dataset.hasOwnProperty(n))if("env"===n||"dumpLineNumbers"===n||"rootpath"===n||"errorReporting"===n)e[n]=t.dataset[n];else try{e[n]=JSON.parse(t.dataset[n])}catch(e){}}var n=function(t,n,i){var r=i.href||"",o="less:"+(i.title||e(r)),s=t.getElementById(o),a=!1,l=t.createElement("style");l.setAttribute("type","text/css"),i.media&&l.setAttribute("media",i.media),l.id=o,l.styleSheet||(l.appendChild(t.createTextNode(n)),a=null!==s&&s.childNodes.length>0&&l.childNodes.length>0&&s.firstChild.nodeValue===l.firstChild.nodeValue);var u=t.getElementsByTagName("head")[0];if(null===s||!1===a){var c=i&&i.nextSibling||null;c?c.parentNode.insertBefore(l,c):u.appendChild(l)}if(s&&!1===a&&s.parentNode.removeChild(s),l.styleSheet)try{l.styleSheet.cssText=n}catch(e){throw new Error("Couldn't reassign styleSheet.cssText.")}},i=function(e){var t,n=e.document;return n.currentScript||(t=n.getElementsByTagName("script"))[t.length-1]},r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)};function o(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var s=function(){return(s=Object.assign||function(e){for(var t,n=1,i=arguments.length;nt?1:void 0};var f=function(e){function t(t,n,i){var r=e.call(this)||this,o=r;return Array.isArray(t)?r.rgb=t:t.length>=6?(r.rgb=[],t.match(/.{2}/g).map((function(e,t){t<3?o.rgb.push(parseInt(e,16)):o.alpha=parseInt(e,16)/255}))):(r.rgb=[],t.split("").map((function(e,t){t<3?o.rgb.push(parseInt(e+e,16)):o.alpha=parseInt(e+e,16)/255}))),r.alpha=r.alpha||("number"==typeof n?n:1),void 0!==i&&(r.value=i),r}return o(t,e),t.prototype.luma=function(){var e=this.rgb[0]/255,t=this.rgb[1]/255,n=this.rgb[2]/255;return.2126*(e=e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4))+.7152*(t=t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4))+.0722*(n=n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4))},t.prototype.genCSS=function(e,t){t.add(this.toCSS(e))},t.prototype.toCSS=function(e,t){var n,i,r,o=e&&e.compress&&!t,s=[];if(i=this.fround(e,this.alpha),this.value)if(0===this.value.indexOf("rgb"))i<1&&(r="rgba");else{if(0!==this.value.indexOf("hsl"))return this.value;r=i<1?"hsla":"hsl"}else i<1&&(r="rgba");switch(r){case"rgba":s=this.rgb.map((function(e){return p(Math.round(e),255)})).concat(p(i,1));break;case"hsla":s.push(p(i,1));case"hsl":n=this.toHSL(),s=[this.fround(e,n.h),this.fround(e,100*n.s)+"%",this.fround(e,100*n.l)+"%"].concat(s)}if(r)return r+"("+s.join(","+(o?"":" "))+")";if(n=this.toRGB(),o){var a=n.split("");a[1]===a[2]&&a[3]===a[4]&&a[5]===a[6]&&(n="#"+a[1]+a[3]+a[5])}return n},t.prototype.operate=function(e,n,i){for(var r=new Array(3),o=this.alpha*(1-i.alpha)+i.alpha,s=0;s<3;s++)r[s]=this._operate(e,n,this.rgb[s],i.rgb[s]);return new t(r,o)},t.prototype.toRGB=function(){return v(this.rgb)},t.prototype.toHSL=function(){var e,t,n=this.rgb[0]/255,i=this.rgb[1]/255,r=this.rgb[2]/255,o=this.alpha,s=Math.max(n,i,r),a=Math.min(n,i,r),l=(s+a)/2,u=s-a;if(s===a)e=t=0;else{switch(t=l>.5?u/(2-s-a):u/(s+a),s){case n:e=(i-r)/u+(i=0&&"\n"!==t.charAt(n);)r++;return"number"==typeof e&&(i=(t.slice(0,e).match(/\n/g)||"").length),{line:i,column:r}}function C(e){var t,n=e.length,i=new Array(n);for(t=0;t|Function):(\d+):(\d+)/,R=function(e,t,n){Error.call(this);var i=e.filename||n;if(this.message=e.message,this.stack=e.stack,t&&i){var r=t.contents[i],o=I(e.index,r),s=o.line,a=o.column,l=e.call&&I(e.call,r).line,u=r?r.split("\n"):"";if(this.type=e.type||"Syntax",this.filename=i,this.index=e.index,this.line="number"==typeof s?s+1:null,this.column=a,!this.line&&this.stack){var c=this.stack.match(E),h=new Function("a","throw new Error()"),f=0;try{h()}catch(e){var p=e.stack.match(E);f=1-parseInt(p[2])}c&&(c[2]&&(this.line=parseInt(c[2])+f),c[3]&&(this.column=parseInt(c[3])))}this.callLine=l+1,this.callExtract=u[l],this.extract=[u[this.line-2],u[this.line-1],u[this.line]]}};if(void 0===Object.create){var V=function(){};V.prototype=Error.prototype,R.prototype=new V}else R.prototype=Object.create(Error.prototype);R.prototype.constructor=R,R.prototype.toString=function(e){void 0===e&&(e={});var t="",n=this.extract||[],i=[],r=function(e){return e};if(e.stylize){var o=typeof e.stylize;if("function"!==o)throw Error("options.stylize should be a function, got a "+o+"!");r=e.stylize}if(null!==this.line){if("string"==typeof n[0]&&i.push(r(this.line-1+" "+n[0],"grey")),"string"==typeof n[1]){var s=this.line+" ";n[1]&&(s+=n[1].slice(0,this.column)+r(r(r(n[1].substr(this.column,1),"bold")+n[1].slice(this.column+1),"red"),"inverse")),i.push(s)}"string"==typeof n[2]&&i.push(r(this.line+1+" "+n[2],"grey")),i=i.join("\n")+r("","reset")+"\n"}return t+=r(this.type+"Error: "+this.message,"red"),this.filename&&(t+=r(" in ","red")+this.filename),this.line&&(t+=r(" on line "+this.line+", column "+(this.column+1)+":","grey")),t+="\n"+i,this.callLine&&(t+=r("from ","red")+(this.filename||"")+"/n",t+=r(this.callLine,"grey")+" "+this.callExtract+"/n"),t};var F=function(e){function t(t,n,i,r,o,s){var a=e.call(this)||this;return a.extendList=n,a.condition=i,a.evaldCondition=!i,a._index=r,a._fileInfo=o,a.elements=a.getElements(t),a.mixinElements_=void 0,a.copyVisibilityInfo(s),a.setParent(a.elements,a),a}return o(t,e),t.prototype.accept=function(e){this.elements&&(this.elements=e.visitArray(this.elements)),this.extendList&&(this.extendList=e.visitArray(this.extendList)),this.condition&&(this.condition=e.visit(this.condition))},t.prototype.createDerived=function(e,n,i){var r=new t(e=this.getElements(e),n||this.extendList,null,this.getIndex(),this.fileInfo(),this.visibilityInfo());return r.evaldCondition=null!=i?i:this.evaldCondition,r.mediaEmpty=this.mediaEmpty,r},t.prototype.getElements=function(e){return e?("string"==typeof e&&this.parse.parseNode(e,["selector"],this._index,this._fileInfo,(function(t,n){if(t)throw new R({index:t.index,message:t.message},this.parse.imports,this._fileInfo.filename);e=n[0].elements})),e):[new y("","&",!1,this._index,this._fileInfo)]},t.prototype.createEmptySelectors=function(){var e=[new t([new y("","&",!1,this._index,this._fileInfo)],null,null,this._index,this._fileInfo)];return e[0].mediaEmpty=!0,e},t.prototype.match=function(e){var t,n,i=this.elements,r=i.length;if(0===(t=(e=e.mixinElements()).length)||rb.PARENS_DIVISION)||this.parensStack&&this.parensStack.length))},e.prototype.pathRequiresRewrite=function(e){return(this.rewriteUrls===x?W:G)(e)},e.prototype.rewritePath=function(e,t){var n;return t=t||"",n=this.normalizePath(t+e),W(e)&&G(t)&&!1===W(n)&&(n="./"+n),n},e.prototype.normalizePath=function(e){var t,n=e.split("/").reverse();for(e=[];0!==n.length;)switch(t=n.pop()){case".":break;case"..":0===e.length||".."===e[e.length-1]?e.push(t):e.pop();break;default:e.push(t)}return e.join("/")},e}();var J=function e(t){return{_data:{},add:function(e,t){e=e.toLowerCase(),this._data.hasOwnProperty(e),this._data[e]=t},addMultiple:function(e){var t=this;Object.keys(e).forEach((function(n){t.add(n,e[n])}))},get:function(e){return this._data[e]||t&&t.get(e)},getLocalFunctions:function(){return this._data},inherit:function(){return e(this)},create:function(t){return e(t)}}}(null),H={eval:function(){var e=this.value_,t=this.error_;if(t)throw t;if(null!=e)return e?O.True:O.False},value:function(e){this.value_=e},error:function(e){this.error_=e},reset:function(){this.value_=this.error_=null}},Q=function(e){function t(t,n,i,r){var o=e.call(this)||this;return o.selectors=t,o.rules=n,o._lookups={},o._variables=null,o._properties=null,o.strictImports=i,o.copyVisibilityInfo(r),o.allowRoot=!0,o.setParent(o.selectors,o),o.setParent(o.rules,o),o}return o(t,e),t.prototype.isRulesetLike=function(){return!0},t.prototype.accept=function(e){this.paths?this.paths=e.visitArray(this.paths,!0):this.selectors&&(this.selectors=e.visitArray(this.selectors)),this.rules&&this.rules.length&&(this.rules=e.visitArray(this.rules))},t.prototype.eval=function(e){var n,i,r,o,s,a=!1;if(this.selectors&&(i=this.selectors.length)){for(n=new Array(i),H.error({type:"Syntax",message:"it is currently only allowed in parametric mixin guards,"}),o=0;o0;e--){var t=this.rules[e-1];if(t instanceof N)return this.parseValue(t)}},t.prototype.parseValue=function(e){var t=this;function n(e){return e.value instanceof L&&!e.parsed?("string"==typeof e.value.value?this.parse.parseNode(e.value.value,["value","important"],e.value.getIndex(),e.fileInfo(),(function(t,n){t&&(e.parsed=!0),n&&(e.value=n[0],e.important=n[1]||"",e.parsed=!0)})):e.parsed=!0,e):e}if(Array.isArray(e)){var i=[];return e.forEach((function(e){i.push(n.call(t,e))})),i}return n.call(t,e)},t.prototype.rulesets=function(){if(!this.rules)return[];var e,t,n=[],i=this.rules;for(e=0;t=i[e];e++)t.isRuleset&&n.push(t);return n},t.prototype.prependRule=function(e){var t=this.rules;t?t.unshift(e):this.rules=[e],this.setParent(e,this)},t.prototype.find=function(e,t,n){void 0===t&&(t=this);var i,r,o=[],s=e.toCSS();return s in this._lookups?this._lookups[s]:(this.rulesets().forEach((function(s){if(s!==t)for(var a=0;ai){if(!n||n(s)){r=s.find(new F(e.elements.slice(i)),t,n);for(var l=0;l0&&t.add(l),e.firstSelector=!0,s[0].genCSS(e,t),e.firstSelector=!1,i=1;i0?(o=(r=C(e)).pop(),s=i.createDerived(C(o.elements))):s=i.createDerived([]),t.length>0){var a=n.combinator,l=t[0].elements[0];a.emptyOrWhitespace&&!l.combinator.emptyOrWhitespace&&(a=l.combinator),s.elements.push(new y(a,l.value,n.isVariable,n._index,n._fileInfo)),s.elements=s.elements.concat(t[0].elements.slice(1))}if(0!==s.elements.length&&r.push(s),t.length>1){var u=t.slice(1);u=u.map((function(e){return e.createDerived(e.elements,[])})),r=r.concat(u)}return r}function s(e,t,n,i,r){var s;for(s=0;s0?i[i.length-1]=i[i.length-1].createDerived(i[i.length-1].elements.concat(e)):i.push(new F(e));else t.push([new F(e)])}function l(e,t){var n=t.createDerived(t.elements,t.extendList,t.evaldCondition);return n.copyVisibilityInfo(e),n}var u,c;if(!function e(t,n,l){var u,c,h,f,p,v,m,g,b,w,x,S,I=!1;for(f=[],p=[[]],u=0;g=l.elements[u];u++)if("&"!==g.value){var C=(S=void 0,(x=g).value instanceof d&&(S=x.value.value)instanceof F?S:null);if(null!=C){a(f,p);var k,_=[],A=[];for(k=e(_,n,C),I=I||k,h=0;h<_.length;h++){s(p,[r(i(_[h],g),g)],g,l,A)}p=A,f=[]}else f.push(g)}else{for(I=!0,v=[],a(f,p),c=0;c0&&m[0].elements.push(new y(g.combinator,"",g.isVariable,g._index,g._fileInfo)),v.push(m);else for(h=0;h0&&(t.push(p[u]),w=p[u][b-1],p[u][b-1]=w.createDerived(w.elements,l.extendList));return I}(c=[],t,n))if(t.length>0)for(c=[],u=0;u0)for(t=0;t-1e-6&&(i=n.toFixed(20).replace(/0+$/,"")),e&&e.compress){if(0===n&&this.unit.isLength())return void t.add(i);n>0&&n<1&&(i=i.substr(1))}t.add(i),this.unit.genCSS(e,t)},t.prototype.operate=function(e,n,i){var r=this._operate(e,n,this.value,i.value),o=this.unit.clone();if("+"===n||"-"===n)if(0===o.numerator.length&&0===o.denominator.length)o=i.unit.clone(),this.unit.backupUnit&&(o.backupUnit=this.unit.backupUnit);else if(0===i.unit.numerator.length&&0===o.denominator.length);else{if(i=i.convertTo(this.unit.usedUnits()),e.strictUnits&&i.unit.toString()!==o.toString())throw new Error("Incompatible units. Change the units or use the unit function. Bad units: '"+o.toString()+"' and '"+i.unit.toString()+"'.");r=this._operate(e,n,this.value,i.value)}else"*"===n?(o.numerator=o.numerator.concat(i.unit.numerator).sort(),o.denominator=o.denominator.concat(i.unit.denominator).sort(),o.cancel()):"/"===n&&(o.numerator=o.numerator.concat(i.unit.denominator).sort(),o.denominator=o.denominator.concat(i.unit.numerator).sort(),o.cancel());return new t(r,o)},t.prototype.compare=function(e){var n,i;if(e instanceof t){if(this.unit.isEmpty()||e.unit.isEmpty())n=this,i=e;else if(n=this.unify(),i=e.unify(),0!==n.unit.compare(i.unit))return;return h.numericCompare(n.value,i.value)}},t.prototype.unify=function(){return this.convertTo({length:"px",duration:"s",angle:"rad"})},t.prototype.convertTo=function(e){var n,i,r,o,s,a=this.value,l=this.unit.clone(),c={};if("string"==typeof e){for(n in u)u[n].hasOwnProperty(e)&&((c={})[n]=e);e=c}for(i in s=function(e,t){return r.hasOwnProperty(e)?(t?a/=r[e]/r[o]:a*=r[e]/r[o],o):e},e)e.hasOwnProperty(i)&&(o=e[i],r=u[i],l.map(s));return l.cancel(),new t(a,l)},t}(h);X.prototype.type="Dimension";var ee=b,te=function(e){function t(t,n,i){var r=e.call(this)||this;return r.op=t.trim(),r.operands=n,r.isSpaced=i,r}return o(t,e),t.prototype.accept=function(e){this.operands=e.visitArray(this.operands)},t.prototype.eval=function(e){var n,i=this.operands[0].eval(e),r=this.operands[1].eval(e);if(e.isMathOn(this.op)){if(n="./"===this.op?"/":this.op,i instanceof X&&r instanceof f&&(i=i.toColor()),r instanceof X&&i instanceof f&&(r=r.toColor()),!i.operate){if(i instanceof t&&"/"===i.op&&e.math===ee.PARENS_DIVISION)return new t(this.op,[i,r],this.isSpaced);throw{type:"Operation",message:"Operation on an invalid type"}}return i.operate(e,n,r)}return new t(this.op,[i,r],this.isSpaced)},t.prototype.genCSS=function(e,t){this.operands[0].genCSS(e,t),this.isSpaced&&t.add(" "),t.add(this.op),this.isSpaced&&t.add(" "),this.operands[1].genCSS(e,t)},t}(h);te.prototype.type="Operation";var ne=b,ie=function(e){function t(t,n){var i=e.call(this)||this;if(i.value=t,i.noSpacing=n,!t)throw new Error("Expression requires an array parameter");return i}return o(t,e),t.prototype.accept=function(e){this.value=e.visitArray(this.value)},t.prototype.eval=function(e){var n,i=e.isMathOn(),r=this.parens&&(e.math!==ne.STRICT_LEGACY||!this.parensInOp),o=!1;return r&&e.inParenthesis(),this.value.length>1?n=new t(this.value.map((function(t){return t.eval?t.eval(e):t})),this.noSpacing):1===this.value.length?(!this.value[0].parens||this.value[0].parensInOp||e.inCalc||(o=!0),n=this.value[0].eval(e)):n=this,r&&e.outOfParenthesis(),!this.parens||!this.parensInOp||i||o||n instanceof X||(n=new d(n)),n},t.prototype.genCSS=function(e,t){for(var n=0;n1){var n=new F([],null,null,this.getIndex(),this.fileInfo()).createEmptySelectors();(t=new Q(n,e.mediaBlocks)).multiMedia=!0,t.copyVisibilityInfo(this.visibilityInfo()),this.setParent(t,this)}return delete e.mediaBlocks,delete e.mediaPath,t},t.prototype.evalNested=function(e){var t,n,i=e.mediaPath.concat([this]);for(t=0;t0;t--)e.splice(t,0,new L("and"));return new ie(e)}))),this.setParent(this.features,this),new Q([],[])},t.prototype.permute=function(e){if(0===e.length)return[];if(1===e.length)return e[0];for(var t=[],n=this.permute(e.slice(1)),i=0;i1?"["+e.value.map((function(e){return e.toCSS()})).join(", ")+"]":e.toCSS()},t}(h));pe.prototype.type="JavaScript";var ve=function(e){function t(t,n){var i=e.call(this)||this;return i.key=t,i.value=n,i}return o(t,e),t.prototype.accept=function(e){this.value=e.visit(this.value)},t.prototype.eval=function(e){return this.value.eval?new t(this.key,this.value.eval(e)):this},t.prototype.genCSS=function(e,t){t.add(this.key+"="),this.value.genCSS?this.value.genCSS(e,t):t.add(this.value)},t}(h);ve.prototype.type="Assignment";var de=function(e){function t(t,n,i,r,o){var s=e.call(this)||this;return s.op=t.trim(),s.lvalue=n,s.rvalue=i,s._index=r,s.negate=o,s}return o(t,e),t.prototype.accept=function(e){this.lvalue=e.visit(this.lvalue),this.rvalue=e.visit(this.rvalue)},t.prototype.eval=function(e){var t=function(e,t,n){switch(e){case"and":return t&&n;case"or":return t||n;default:switch(h.compare(t,n)){case-1:return"<"===e||"=<"===e||"<="===e;case 0:return"="===e||">="===e||"=<"===e||"<="===e;case 1:return">"===e||">="===e;default:return!1}}}(this.op,this.lvalue.eval(e),this.rvalue.eval(e));return this.negate?!t:t},t}(h);de.prototype.type="Condition";var me=function(e){function t(t){var n=e.call(this)||this;return n.value=t,n}return o(t,e),t}(h);me.prototype.type="UnicodeDescriptor";var ge=function(e){function t(t){var n=e.call(this)||this;return n.value=t,n}return o(t,e),t.prototype.genCSS=function(e,t){t.add("-"),this.value.genCSS(e,t)},t.prototype.eval=function(e){return e.isMathOn()?new te("*",[new X(-1),this.value]).eval(e):new t(this.value.eval(e))},t}(h);ge.prototype.type="Negative";var ye=function(e){function t(n,i,r,o,s){var a=e.call(this)||this;switch(a.selector=n,a.option=i,a.object_id=t.next_id++,a.parent_ids=[a.object_id],a._index=r,a._fileInfo=o,a.copyVisibilityInfo(s),a.allowRoot=!0,i){case"all":a.allowBefore=!0,a.allowAfter=!0;break;default:a.allowBefore=!1,a.allowAfter=!1}return a.setParent(a.selector,a),a}return o(t,e),t.prototype.accept=function(e){this.selector=e.visit(this.selector)},t.prototype.eval=function(e){return new t(this.selector.eval(e),this.option,this.getIndex(),this.fileInfo(),this.visibilityInfo())},t.prototype.clone=function(e){return new t(this.selector,this.option,this.getIndex(),this.fileInfo(),this.visibilityInfo())},t.prototype.findSelfSelectors=function(e){var t,n,i=[];for(t=0;t0&&n.length&&""===n[0].combinator.value&&(n[0].combinator.value=" "),i=i.concat(e[t].elements);this.selfSelectors=[new F(i)],this.selfSelectors[0].copyVisibilityInfo(this.visibilityInfo())},t}(h);ye.next_id=0,ye.prototype.type="Extend";var be=function(e){function t(t,n,i){var r=e.call(this)||this;return r.variable=t,r._index=n,r._fileInfo=i,r.allowRoot=!0,r}return o(t,e),t.prototype.eval=function(e){var t,n=new se(this.variable,this.getIndex(),this.fileInfo()).eval(e),i=new R({message:"Could not evaluate variable call "+this.variable});if(!n.ruleset){if(n.rules)t=n;else if(Array.isArray(n))t=new Q("",n);else{if(!Array.isArray(n.value))throw i;t=new Q("",n.value)}n=new Z(t)}if(n.ruleset)return n.callEval(e);throw i},t}(h);be.prototype.type="VariableCall";var we=function(e){function t(t,n,i,r){var o=e.call(this)||this;return o.value=t,o.lookups=n,o._index=i,o._fileInfo=r,o}return o(t,e),t.prototype.eval=function(e){var t,n,i=this.value.eval(e);for(t=0;tthis.params.length)return!1}n=Math.min(o,this.arity);for(var s=0;s0){for(c=!0,a=0;a0)f=2;else if(f=1,p[1]+p[2]>1)throw{type:"Runtime",message:"Ambiguous use of `default()` found when matching for `"+this.format(m)+"`",index:this.getIndex(),filename:this.fileInfo().filename};for(a=0;a=0;s--){var a=o[s];if(a[r?"supportsSync":"supports"](e,t,n,i))return a}return null},e.prototype.addFileManager=function(e){this.fileManagers.push(e)},e.prototype.clearFileManagers=function(){this.fileManagers=[]},e}(),_e=function(){function e(){}return e.prototype.getPath=function(e){var t=e.lastIndexOf("?");return t>0&&(e=e.slice(0,t)),(t=e.lastIndexOf("/"))<0&&(t=e.lastIndexOf("\\")),t<0?"":e.slice(0,t+1)},e.prototype.tryAppendExtension=function(e,t){return/(\.[a-z]*$)|([\?;].*)$/.test(e)?e:e+t},e.prototype.tryAppendLessExtension=function(e){return this.tryAppendExtension(e,".less")},e.prototype.supportsSync=function(){return!1},e.prototype.alwaysMakePathsAbsolute=function(){return!1},e.prototype.isPathAbsolute=function(e){return/^(?:[a-z-]+:|\/|\\|#)/i.test(e)},e.prototype.join=function(e,t){return e?e+t:t},e.prototype.pathDiff=function(e,t){var n,i,r,o,s=this.extractUrlParts(e),a=this.extractUrlParts(t),l="";if(s.hostPart!==a.hostPart)return"";for(i=Math.max(a.directories.length,s.directories.length),n=0;nparseInt(t[n])?-1:1;return 0},e.prototype.versionToString=function(e){for(var t="",n=0;n0;){var e=this.imports[0];if(!e.isReady)return;this.imports=this.imports.slice(1),e.callback.apply(null,e.args)}if(0===this.variableImports.length)break;var t=this.variableImports[0];this.variableImports=this.variableImports.slice(1),t()}}finally{this._currentDepth--}0===this._currentDepth&&this._onSequencerEmpty&&this._onSequencerEmpty()},e}(),Fe=function(e,t){this._visitor=new Re(this),this._importer=e,this._finish=t,this.context=new q.Eval,this.importCount=0,this.onceFileDetectionMap={},this.recursionDetector={},this._sequencer=new Ve(this._onSequencerEmpty.bind(this))};Fe.prototype={isReplacing:!1,run:function(e){try{this._visitor.visit(e)}catch(e){this.error=e}this.isFinished=!0,this._sequencer.tryRun()},_onSequencerEmpty:function(){this.isFinished&&this._finish(this.error)},visitImport:function(e,t){var n=e.options.inline;if(!e.css||n){var i=new q.Eval(this.context,C(this.context.frames)),r=i.frames[0];this.importCount++,e.isVariableImport()?this._sequencer.addVariableImport(this.processImportNode.bind(this,e,i,r)):this.processImportNode(e,i,r)}t.visitDeeper=!1},processImportNode:function(e,t,n){var i,r=e.options.inline;try{i=e.evalForImport(t)}catch(t){t.filename||(t.index=e.getIndex(),t.filename=e.fileInfo().filename),e.css=!0,e.error=t}if(!i||i.css&&!r)this.importCount--,this.isFinished&&this._sequencer.tryRun();else{i.options.multiple&&(t.importMultiple=!0);for(var o=void 0===i.css,s=0;s=0||(a=[u.selfSelectors[0]],(o=f.findMatch(l,a)).length&&(l.hasFoundMatches=!0,l.selfSelectors.forEach((function(e){var t=u.visibilityInfo();s=f.extendSelector(o,a,e,l.isVisible()),(c=new Ie.Extend(u.selector,u.option,0,u.fileInfo(),t)).selfSelectors=s,s[s.length-1].extendList=[c],h.push(c),c.ruleset=u.ruleset,c.parent_ids=c.parent_ids.concat(u.parent_ids,l.parent_ids),u.firstExtendOnThisSelectorPath&&(c.firstExtendOnThisSelectorPath=!0,u.ruleset.paths.push(s))}))));if(h.length){if(this.extendChainCount++,n>100){var p="{unable to calculate}",v="{unable to calculate}";try{p=h[0].selfSelectors[0].toCSS(),v=h[0].selector.toCSS()}catch(e){}throw{message:"extend circular reference detected. One of the circular extends is currently:"+p+":extend("+v+")"}}return h.concat(f.doExtendChaining(h,t,n+1))}return h},e.prototype.visitDeclaration=function(e,t){t.visitDeeper=!1},e.prototype.visitMixinDefinition=function(e,t){t.visitDeeper=!1},e.prototype.visitSelector=function(e,t){t.visitDeeper=!1},e.prototype.visitRuleset=function(e,t){if(!e.root){var n,i,r,o,s=this.allExtendsStack[this.allExtendsStack.length-1],a=[],l=this;for(r=0;r0&&u[l.matched].combinator.value!==s?l=null:l.matched++,l&&(l.finished=l.matched===u.length,l.finished&&!e.allowAfter&&(r+1u&&c>0&&(h[h.length-1].elements=h[h.length-1].elements.concat(t[u].elements.slice(c)),c=0,u++),l=o.elements.slice(c,a.index).concat([s]).concat(n.elements.slice(1)),u===a.pathIndex&&r>0?h[h.length-1].elements=h[h.length-1].elements.concat(l):(h=h.concat(t.slice(u,a.pathIndex))).push(new Ie.Selector(l)),u=a.endPathIndex,(c=a.endPathElementIndex)>=t[u].elements.length&&(c=0,u++);return u0&&(h[h.length-1].elements=h[h.length-1].elements.concat(t[u].elements.slice(c)),u++),h=(h=h.concat(t.slice(u,t.length))).map((function(e){var t=e.createDerived(e.elements);return i?t.ensureVisibility():t.ensureInvisibility(),t}))},e.prototype.visitMedia=function(e,t){var n=e.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length-1]);n=n.concat(this.doExtendChaining(n,e.allExtends)),this.allExtendsStack.push(n)},e.prototype.visitMediaOut=function(e){var t=this.allExtendsStack.length-1;this.allExtendsStack.length=t},e.prototype.visitAtRule=function(e,t){var n=e.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length-1]);n=n.concat(this.doExtendChaining(n,e.allExtends)),this.allExtendsStack.push(n)},e.prototype.visitAtRuleOut=function(e){var t=this.allExtendsStack.length-1;this.allExtendsStack.length=t},e}(),De=function(){function e(){this.contexts=[[]],this._visitor=new Re(this)}return e.prototype.run=function(e){return this._visitor.visit(e)},e.prototype.visitDeclaration=function(e,t){t.visitDeeper=!1},e.prototype.visitMixinDefinition=function(e,t){t.visitDeeper=!1},e.prototype.visitRuleset=function(e,t){var n,i=this.contexts[this.contexts.length-1],r=[];this.contexts.push(r),e.root||((n=e.selectors)&&(n=n.filter((function(e){return e.getIsOutput()})),e.selectors=n.length?n:n=null,n&&e.joinSelectors(r,i,n)),n||(e.rules=null),e.paths=r)},e.prototype.visitRulesetOut=function(e){this.contexts.length=this.contexts.length-1},e.prototype.visitMedia=function(e,t){var n=this.contexts[this.contexts.length-1];e.rules[0].root=0===n.length||n[0].multiMedia},e.prototype.visitAtRule=function(e,t){var n=this.contexts[this.contexts.length-1];e.rules&&e.rules.length&&(e.rules[0].root=e.isRooted||0===n.length||null)},e}(),Ne=function(){function e(e){this._visitor=new Re(this),this._context=e}return e.prototype.containsSilentNonBlockedChild=function(e){var t;if(!e)return!1;for(var n=0;n0},e.prototype.resolveVisibility=function(e,t){if(!e.blocksVisibility()){if(this.isEmpty(e)&&!this.containsSilentNonBlockedChild(t))return;return e}var n=e.rules[0];if(this.keepOnlyVisibleChilds(n),!this.isEmpty(n))return e.ensureVisibility(),e.removeVisibilityBlock(),e},e.prototype.isVisibleRuleset=function(e){return!!e.firstRoot||!this.isEmpty(e)&&!(!e.root&&!this.hasVisibleSelector(e))},e}(),Be=function(e){this._visitor=new Re(this),this._context=e,this.utils=new Ne(e)};Be.prototype={isReplacing:!0,run:function(e){return this._visitor.visit(e)},visitDeclaration:function(e,t){if(!e.blocksVisibility()&&!e.variable)return e},visitMixinDefinition:function(e,t){e.frames=[]},visitExtend:function(e,t){},visitComment:function(e,t){if(!e.blocksVisibility()&&!e.isSilent(this._context))return e},visitMedia:function(e,t){var n=e.rules[0].rules;return e.accept(this._visitor),t.visitDeeper=!1,this.utils.resolveVisibility(e,n)},visitImport:function(e,t){if(!e.blocksVisibility())return e},visitAtRule:function(e,t){return e.rules&&e.rules.length?this.visitAtRuleWithBody(e,t):this.visitAtRuleWithoutBody(e,t)},visitAnonymous:function(e,t){if(!e.blocksVisibility())return e.accept(this._visitor),e},visitAtRuleWithBody:function(e,t){var n=function(e){var t=e.rules;return function(e){var t=e.rules;return 1===t.length&&(!t[0].paths||0===t[0].paths.length)}(e)?t[0].rules:t}(e);return e.accept(this._visitor),t.visitDeeper=!1,this.utils.isEmpty(e)||this._mergeRules(e.rules[0].rules),this.utils.resolveVisibility(e,n)},visitAtRuleWithoutBody:function(e,t){if(!e.blocksVisibility()){if("@charset"===e.name){if(this.charset){if(e.debugInfo){var n=new Ie.Comment("/* "+e.toCSS(this._context).replace(/\n/g,"")+" */\n");return n.debugInfo=e.debugInfo,this._visitor.visit(n)}return}this.charset=!0}return e}},checkValidNodes:function(e,t){if(e)for(var n=0;n0?e.accept(this._visitor):e.rules=null,t.visitDeeper=!1}return e.rules&&(this._mergeRules(e.rules),this._removeDuplicateRules(e.rules)),this.utils.isVisibleRuleset(e)&&(e.ensureVisibility(),i.splice(0,0,e)),1===i.length?i[0]:i},_compileRulesetPaths:function(e){e.paths&&(e.paths=e.paths.filter((function(e){var t;for(" "===e[0].elements[0].combinator.value&&(e[0].elements[0].combinator=new Ie.Combinator("")),t=0;t=0;i--)if((n=e[i])instanceof Ie.Declaration)if(r[n.name]){(t=r[n.name])instanceof Ie.Declaration&&(t=r[n.name]=[r[n.name].toCSS(this._context)]);var o=n.toCSS(this._context);-1!==t.indexOf(o)?e.splice(i,1):t.push(o)}else r[n.name]=n}},_mergeRules:function(e){if(e){for(var t={},n=[],i=0;i0){var t=e[0],n=[],i=[new Ie.Expression(n)];e.forEach((function(e){"+"===e.merge&&n.length>0&&i.push(new Ie.Expression(n=[])),n.push(e.value),t.important=t.important||e.important})),t.value=new Ie.Value(i)}}))}}};var Ue={Visitor:Re,ImportVisitor:Fe,MarkVisibleSelectorsVisitor:$e,ExtendVisitor:Le,JoinSelectorVisitor:De,ToCSSVisitor:Be},qe=function(){var e,t,n,i,r,o,s,a=[],l={};function u(n){for(var i,a,c,h=l.i,f=t,p=l.i-s,v=l.i+o.length-p,d=l.i+=n,m=e;l.i=0){c={index:l.i,text:m.substr(l.i,y+2-l.i),isLineComment:!1},l.i+=c.text.length-1,l.commentStore.push(c);continue}}break}if(32!==i&&10!==i&&9!==i&&13!==i)break}if(o=o.slice(n+l.i-d+p),s=l.i,!o.length){if(tn||l.i===n&&e&&!i)&&(n=l.i,i=e);var r=a.pop();o=r.current,s=l.i=r.i,t=r.j},l.forget=function(){a.pop()},l.isWhitespace=function(t){var n=l.i+(t||0),i=e.charCodeAt(n);return 32===i||13===i||9===i||10===i},l.$re=function(e){l.i>s&&(o=o.slice(l.i-s),s=l.i);var t=e.exec(o);return t?(u(t[0].length),"string"==typeof t?t:1===t.length?t[0]:t):null},l.$char=function(t){return e.charAt(l.i)!==t?null:(u(1),t)},l.$str=function(t){for(var n=t.length,i=0;ih&&(d=!1)}}while(d);return r||null},l.autoCommentAbsorb=!0,l.commentStore=[],l.finished=!1,l.peek=function(t){if("string"==typeof t){for(var n=0;n57||t<43||47===t||44===t},l.start=function(i,a,c){e=i,l.i=t=s=n=0,r=a?function(e,t){var n,i,r,o,s,a,l,u,c,h=e.length,f=0,p=0,v=[],d=0;function m(t){var n=s-d;n<512&&!t||!n||(v.push(e.slice(d,s+1)),d=s+1)}for(s=0;s=97&&l<=122||l<34))switch(l){case 40:p++,i=s;continue;case 41:if(--p<0)return t("missing opening `(`",s);continue;case 59:p||m();continue;case 123:f++,n=s;continue;case 125:if(--f<0)return t("missing opening `{`",s);f||p||m();continue;case 92:if(s96)){if(u==l){c=1;break}if(92==u){if(s==h-1)return t("unescaped `\\`",s);s++}}if(c)continue;return t("unmatched `"+String.fromCharCode(l)+"`",a);case 47:if(p||s==h-1)continue;if(47==(u=e.charCodeAt(s+1)))for(s+=2;sn&&o>r?"missing closing `}` or `*/`":"missing closing `}`",n):0!==p?t("missing closing `)`",i):(m(!0),v)}(i,c):[i],o=r[0],u(0)},l.end=function(){var t,r=l.i>=e.length;return l.i=e.length-1,furthestChar:e[l.i]}},l},je=function e(t,n,i){var r,o=qe();function s(e,t){throw new R({index:o.i,filename:i.filename,type:t||"Syntax",message:e},n)}function a(e,t){var n=e instanceof Function?e.call(r):o.$re(e);if(n)return n;s(t||("string"==typeof e?"expected '"+e+"' got '"+o.currentChar()+"'":"unexpected token"))}function l(e,t){if(o.$char(e))return e;s(t||"expected '"+e+"' got '"+o.currentChar()+"'")}function u(e){var t=i.filename;return{lineNumber:I(e,o.getInput()).line+1,fileName:t}}return{parserInput:o,imports:n,fileInfo:i,parseNode:function(e,t,i,s,a){var l,u=[],c=o;try{c.start(e,!1,(function(e,t){a({message:e,index:t+i})}));for(var h=0,f=void 0,p=void 0;f=t[h];h++)if(p=c.i,l=r[f]()){try{l._index=p+i,l._fileInfo=s}catch(e){}u.push(l)}else u.push(null);c.end().isFinished?a(null,u):a(!0,null)}catch(e){throw new R({index:e.index+i,message:e.message},n,s.filename)}},parse:function(r,s,a){var l,u,c,h,f=null,p="";if(u=a&&a.globalVars?e.serializeVars(a.globalVars)+"\n":"",c=a&&a.modifyVars?"\n"+e.serializeVars(a.modifyVars):"",t.pluginManager)for(var v=t.pluginManager.getPreProcessors(),d=0;d");return e},args:function(e){var t,n,i,a,l,u,c,h=r.entities,f={args:null,variadic:!1},p=[],v=[],d=[],m=!0;for(o.save();;){if(e)u=r.detachedRuleset()||r.expression();else{if(o.commentStore.length=0,o.$str("...")){f.variadic=!0,o.$char(";")&&!t&&(t=!0),(t?v:d).push({variadic:!0});break}u=h.variable()||h.property()||h.literal()||h.keyword()||this.call(!0)}if(!u||!m)break;a=null,u.throwAwayComments&&u.throwAwayComments(),l=u;var g=null;if(e?u.value&&1==u.value.length&&(g=u.value[0]):g=u,g&&(g instanceof Ie.Variable||g instanceof Ie.Property))if(o.$char(":")){if(p.length>0&&(t&&s("Cannot mix ; and , as delimiter types"),n=!0),!(l=r.detachedRuleset()||r.expression())){if(!e)return o.restore(),f.args=[],f;s("could not understand value for named argument")}a=i=g.name}else if(o.$str("...")){if(!e){f.variadic=!0,o.$char(";")&&!t&&(t=!0),(t?v:d).push({name:u.name,variadic:!0});break}c=!0}else e||(i=a=g.name,l=null);l&&p.push(l),d.push({name:a,value:l,expand:c}),o.$char(",")?m=!0:((m=";"===o.$char(";"))||t)&&(n&&s("Cannot mix ; and , as delimiter types"),t=!0,p.length>1&&(l=new Ie.Value(p)),v.push({name:i,value:l,expand:c}),i=null,p=[],n=!1)}return o.forget(),f.args=t?v:d,f},definition:function(){var e,t,n,i,s=[],l=!1;if(!("."!==o.currentChar()&&"#"!==o.currentChar()||o.peek(/^[^{]*\}/)))if(o.save(),t=o.$re(/^([#.](?:[\w-]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+)\s*\(/)){e=t[1];var u=this.args(!1);if(s=u.args,l=u.variadic,!o.$char(")"))return void o.restore("Missing closing ')'");if(o.commentStore.length=0,o.$str("when")&&(i=a(r.conditions,"expected condition")),n=r.block())return o.forget(),new Ie.mixin.Definition(e,s,n,i,l);o.restore()}else o.restore()},ruleLookups:function(){var e,t=[];if("["===o.currentChar()){for(;;){if(o.save(),!(e=this.lookupValue())&&""!==e){o.restore();break}t.push(e),o.forget()}return t.length>0?t:void 0}},lookupValue:function(){if(o.save(),o.$char("[")){var e=o.$re(/^(?:[@$]{0,2})[_a-zA-Z0-9-]*/);if(o.$char("]"))return e||""===e?(o.forget(),e):void o.restore();o.restore()}else o.restore()}},entity:function(){var e=this.entities;return this.comment()||e.literal()||e.variable()||e.url()||e.property()||e.call()||e.keyword()||this.mixin.call(!0)||e.javascript()},end:function(){return o.$char(";")||o.peek("}")},ieAlpha:function(){var e;if(o.$re(/^opacity=/i))return(e=o.$re(/^\d+/))||(e="@{"+(e=a(r.entities.variable,"Could not parse alpha")).name.slice(1)+"}"),l(")"),new Ie.Quoted("","alpha(opacity="+e+")")},element:function(){var e,t,n,r=o.i;if(t=this.combinator(),(e=o.$re(/^(?:\d+\.\d+|\d+)%/)||o.$re(/^(?:[.#]?|:*)(?:[\w-]|[^\x00-\x9f]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/)||o.$char("*")||o.$char("&")||this.attribute()||o.$re(/^\([^&()@]+\)/)||o.$re(/^[\.#:](?=@)/)||this.entities.variableCurly())||(o.save(),o.$char("(")?(n=this.selector(!1))&&o.$char(")")?(e=new Ie.Paren(n),o.forget()):o.restore("Missing closing ')'"):o.forget()),e)return new Ie.Element(t,e,e instanceof Ie.Variable,r,i)},combinator:function(){var e=o.currentChar();if("/"===e){o.save();var t=o.$re(/^\/[a-z]+\//i);if(t)return o.forget(),new Ie.Combinator(t);o.restore()}if(">"===e||"+"===e||"~"===e||"|"===e||"^"===e){for(o.i++,"^"===e&&"^"===o.currentChar()&&(e="^^",o.i++);o.isWhitespace();)o.i++;return new Ie.Combinator(e)}return o.isWhitespace(-1)?new Ie.Combinator(" "):new Ie.Combinator(null)},selector:function(e){var t,n,r,l,u,c,h,f=o.i;for(e=!1!==e;(e&&(n=this.extend())||e&&(c=o.$str("when"))||(l=this.element()))&&(c?h=a(this.conditions,"expected condition"):h?s("CSS guard can only be used at the end of selector"):n?u=u?u.concat(n):n:(u&&s("Extend can only be used at the end of selector"),r=o.currentChar(),t?t.push(l):t=[l],l=null),"{"!==r&&"}"!==r&&";"!==r&&","!==r&&")"!==r););if(t)return new Ie.Selector(t,u,h,f,i);u&&s("Extend must be used to extend a selector, it cannot be used on its own")},selectors:function(){for(var e,t;(e=this.selector())&&(t?t.push(e):t=[e],o.commentStore.length=0,e.condition&&t.length>1&&s("Guards are only currently allowed on a single selector."),o.$char(","));)e.condition&&s("Guards are only currently allowed on a single selector."),o.commentStore.length=0;return t},attribute:function(){if(o.$char("[")){var e,t,n,i=this.entities;return(e=i.variableCurly())||(e=a(/^(?:[_A-Za-z0-9-\*]*\|)?(?:[_A-Za-z0-9-]|\\.)+/)),(n=o.$re(/^[|~*$^]?=/))&&(t=i.quoted()||o.$re(/^[0-9]+%/)||o.$re(/^[\w-]+/)||i.variableCurly()),l("]"),new Ie.Attribute(e,n,t)}},block:function(){var e;if(o.$char("{")&&(e=this.primary())&&o.$char("}"))return e},blockRuleset:function(){var e=this.block();return e&&(e=new Ie.Ruleset(null,e)),e},detachedRuleset:function(){var e,t,n;if(o.save(),!o.$re(/^[.#]\(/)||(t=(e=this.mixin.args(!1)).args,n=e.variadic,o.$char(")"))){var i=this.blockRuleset();if(i)return o.forget(),t?new Ie.mixin.Definition(null,t,i,null,n):new Ie.DetachedRuleset(i);o.restore()}else o.restore()},ruleset:function(){var e,n,i;if(o.save(),t.dumpLineNumbers&&(i=u(o.i)),(e=this.selectors())&&(n=this.block())){o.forget();var r=new Ie.Ruleset(e,n,t.strictImports);return t.dumpLineNumbers&&(r.debugInfo=i),r}o.restore()},declaration:function(){var e,t,n,r,s,a,l=o.i,u=o.currentChar();if("."!==u&&"#"!==u&&"&"!==u&&":"!==u)if(o.save(),e=this.variable()||this.ruleProperty()){if((a="string"==typeof e)&&(t=this.detachedRuleset())&&(n=!0),o.commentStore.length=0,!t){if(s=!a&&e.length>1&&e.pop().value,t=e[0].value&&"--"===e[0].value.slice(0,2)?this.permissiveValue():this.anonymousValue())return o.forget(),new Ie.Declaration(e,t,!1,s,l,i);t||(t=this.value()),t?r=this.important():a&&(t=this.permissiveValue())}if(t&&(this.end()||n))return o.forget(),new Ie.Declaration(e,t,r,s,l,i);o.restore()}else o.restore()},anonymousValue:function(){var e=o.i,t=o.$re(/^([^.#@\$+\/'"*`(;{}-]*);/);if(t)return new Ie.Anonymous(t[1],e)},permissiveValue:function(e){var t,n,r,a,l=e||";",u=o.i,c=[];function h(){var e=o.currentChar();return"string"==typeof l?e===l:l.test(e)}if(!h()){a=[];do{((n=this.comment())||(n=this.entity()))&&a.push(n)}while(n);if(r=h(),a.length>0){if(a=new Ie.Expression(a),r)return a;c.push(a)," "===o.prevChar()&&c.push(new Ie.Anonymous(" ",u))}if(o.save(),a=o.$parseUntil(l)){if("string"==typeof a&&s("Expected '"+a+"'","Parse"),1===a.length&&" "===a[0])return o.forget(),new Ie.Anonymous("",u);var f=void 0;for(t=0;t0)return new Ie.Expression(r)},mediaFeatures:function(){var e,t=this.entities,n=[];do{if(e=this.mediaFeature()){if(n.push(e),!o.$char(","))break}else if((e=t.variable()||t.mixinLookup())&&(n.push(e),!o.$char(",")))break}while(e);return n.length>0?n:null},media:function(){var e,n,r,a,l=o.i;if(t.dumpLineNumbers&&(a=u(l)),o.save(),o.$str("@media"))return e=this.mediaFeatures(),(n=this.block())||s("media definitions require block statements after any features"),o.forget(),r=new Ie.Media(n,e,l,i),t.dumpLineNumbers&&(r.debugInfo=a),r;o.restore()},plugin:function(){var e,t,n,r=o.i;if(o.$re(/^@plugin?\s+/)){if(n=(t=this.pluginArgs())?{pluginArgs:t,isPlugin:!0}:{isPlugin:!0},e=this.entities.quoted()||this.entities.url())return o.$char(";")||(o.i=r,s("missing semi-colon on @plugin")),new Ie.Import(e,null,n,r,i);o.i=r,s("malformed @plugin statement")}},pluginArgs:function(){if(o.save(),!o.$char("("))return o.restore(),null;var e=o.$re(/^\s*([^\);]+)\)\s*/);return e[1]?(o.forget(),e[1].trim()):(o.restore(),null)},atrule:function(){var e,n,r,a,l,c,h,f=o.i,p=!0,v=!0;if("@"===o.currentChar()){if(n=this.import()||this.plugin()||this.media())return n;if(o.save(),e=o.$re(/^@[a-z-]+/)){switch(a=e,"-"==e.charAt(1)&&e.indexOf("-",2)>0&&(a="@"+e.slice(e.indexOf("-",2)+1)),a){case"@charset":l=!0,p=!1;break;case"@namespace":c=!0,p=!1;break;case"@keyframes":case"@counter-style":l=!0;break;case"@document":case"@supports":h=!0,v=!1;break;default:h=!0}if(o.commentStore.length=0,l?(n=this.entity())||s("expected "+e+" identifier"):c?(n=this.expression())||s("expected "+e+" expression"):h&&(n=this.permissiveValue(/^[{;]/),p="{"===o.currentChar(),n?n.value||(n=null):p||";"===o.currentChar()||s(e+" rule is missing block or ending semi-colon")),p&&(r=this.blockRuleset()),r||!p&&n&&o.$char(";"))return o.forget(),new Ie.AtRule(e,n,r,f,i,t.dumpLineNumbers?u(f):null,v);o.restore("at-rule options not recognised")}}},value:function(){var e,t=[],n=o.i;do{if((e=this.expression())&&(t.push(e),!o.$char(",")))break}while(e);if(t.length>0)return new Ie.Value(t,n)},important:function(){if("!"===o.currentChar())return o.$re(/^! *important/)},sub:function(){var e,t;if(o.save(),o.$char("("))return(e=this.addition())&&o.$char(")")?(o.forget(),(t=new Ie.Expression([e])).parens=!0,t):void o.restore("Expected ')'");o.restore()},multiplication:function(){var e,t,n,i,r;if(e=this.operand()){for(r=o.isWhitespace(-1);!o.peek(/^\/[*\/]/);){if(o.save(),!(n=o.$char("/")||o.$char("*")||o.$str("./"))){o.forget();break}if(!(t=this.operand())){o.restore();break}o.forget(),e.parensInOp=!0,t.parensInOp=!0,i=new Ie.Operation(n,[i||e,t],r),r=o.isWhitespace(-1)}return i||e}},addition:function(){var e,t,n,i,r;if(e=this.multiplication()){for(r=o.isWhitespace(-1);(n=o.$re(/^[-+]\s+/)||!r&&(o.$char("+")||o.$char("-")))&&(t=this.multiplication());)e.parensInOp=!0,t.parensInOp=!0,i=new Ie.Operation(n,[i||e,t],r),r=o.isWhitespace(-1);return i||e}},conditions:function(){var e,t,n,i=o.i;if(e=this.condition(!0)){for(;o.peek(/^,\s*(not\s*)?\(/)&&o.$char(",")&&(t=this.condition(!0));)n=new Ie.Condition("or",n||e,t,i);return n||e}},condition:function(e){var t,n,i;if(t=this.conditionAnd(e)){if(n=o.$str("or")){if(!(i=this.condition(e)))return;t=new Ie.Condition(n,t,i)}return t}},conditionAnd:function(e){var t,n,i,r,s=this;if(t=(r=s.negatedCondition(e)||s.parenthesisCondition(e))||e?r:s.atomicCondition(e)){if(n=o.$str("and")){if(!(i=this.conditionAnd(e)))return;t=new Ie.Condition(n,t,i)}return t}},negatedCondition:function(e){if(o.$str("not")){var t=this.parenthesisCondition(e);return t&&(t.negate=!t.negate),t}},parenthesisCondition:function(e){var t;if(o.save(),o.$str("(")){if(t=function(t){var n;if(o.save(),n=t.condition(e)){if(o.$char(")"))return o.forget(),n;o.restore()}else o.restore()}(this))return o.forget(),t;if(t=this.atomicCondition(e)){if(o.$char(")"))return o.forget(),t;o.restore("expected ')' got '"+o.currentChar()+"'")}else o.restore()}else o.restore()},atomicCondition:function(e){var t,n,i,r,a=this.entities,l=o.i;function u(){return this.addition()||a.keyword()||a.quoted()||a.mixinLookup()}if(t=(u=u.bind(this))())return o.$char(">")?r=o.$char("=")?">=":">":o.$char("<")?r=o.$char("=")?"<=":"<":o.$char("=")&&(r=o.$char(">")?"=>":o.$char("<")?"=<":"="),r?(n=u())?i=new Ie.Condition(r,t,n,l,!1):s("expected expression"):i=new Ie.Condition("=",t,new Ie.Keyword("true"),l,!1),i},operand:function(){var e,t=this.entities;o.peek(/^-[@\$\(]/)&&(e=o.$char("-"));var n=this.sub()||t.dimension()||t.color()||t.variable()||t.property()||t.call()||t.quoted(!0)||t.colorKeyword()||t.mixinLookup();return e&&(n.parensInOp=!0,n=new Ie.Negative(n)),n},expression:function(){var e,t,n=[],i=o.i;do{(e=this.comment())?n.push(e):((e=this.addition()||this.entity())instanceof Ie.Comment&&(e=null),e&&(n.push(e),o.peek(/^\/[\/*]/)||(t=o.$char("/"))&&n.push(new Ie.Anonymous(t,i))))}while(e);if(n.length>0)return new Ie.Expression(n)},property:function(){var e=o.$re(/^(\*?-?[_a-zA-Z0-9-]+)\s*:/);if(e)return e[1]},ruleProperty:function(){var e,t,n=[],r=[];o.save();var s=o.$re(/^([_a-zA-Z0-9-]+)\s*:/);if(s)return n=[new Ie.Keyword(s[1])],o.forget(),n;function a(e){var t=o.i,i=o.$re(e);if(i)return r.push(t),n.push(i[1])}for(a(/^(\*?)/);a(/^((?:[\w-]+)|(?:[@\$]\{[\w-]+\}))/););if(n.length>1&&a(/^((?:\+_|\+)?)\s*:/)){for(o.forget(),""===n[0]&&(n.shift(),r.shift()),t=0;t1?e-1:e)<1?r+(o-r)*e*6:2*e<1?o:3*e<2?r+(o-r)*(2/3-e)*6:r}e=Ke(e)%360/360,t=We(Ke(t)),n=We(Ke(n)),i=We(Ke(i)),r=2*n-(o=n<=.5?n*(t+1):n+t-n*t);var a=[255*s(e+1/3),255*s(e),255*s(e-1/3)];return i=Ke(i),new f(a,i,"hsla")}catch(e){}},hsv:function(e,t,n){return ze.hsva(e,t,n,1)},hsva:function(e,t,n,i){var r,o;e=Ke(e)%360/360*360,t=Ke(t),n=Ke(n),i=Ke(i);var s=[n,n*(1-t),n*(1-(o=e/60-(r=Math.floor(e/60%6)))*t),n*(1-(1-o)*t)],a=[[0,3,1],[2,0,1],[1,0,3],[1,2,0],[3,1,0],[0,1,2]];return ze.rgba(255*s[a[r][0]],255*s[a[r][1]],255*s[a[r][2]],i)},hue:function(e){return new X(He(e).h)},saturation:function(e){return new X(100*He(e).s,"%")},lightness:function(e){return new X(100*He(e).l,"%")},hsvhue:function(e){return new X(Qe(e).h)},hsvsaturation:function(e){return new X(100*Qe(e).s,"%")},hsvvalue:function(e){return new X(100*Qe(e).v,"%")},red:function(e){return new X(e.rgb[0])},green:function(e){return new X(e.rgb[1])},blue:function(e){return new X(e.rgb[2])},alpha:function(e){return new X(He(e).a)},luma:function(e){return new X(e.luma()*e.alpha*100,"%")},luminance:function(e){var t=.2126*e.rgb[0]/255+.7152*e.rgb[1]/255+.0722*e.rgb[2]/255;return new X(t*e.alpha*100,"%")},saturate:function(e,t,n){if(!e.rgb)return null;var i=He(e);return void 0!==n&&"relative"===n.value?i.s+=i.s*t.value/100:i.s+=t.value/100,i.s=We(i.s),Je(e,i)},desaturate:function(e,t,n){var i=He(e);return void 0!==n&&"relative"===n.value?i.s-=i.s*t.value/100:i.s-=t.value/100,i.s=We(i.s),Je(e,i)},lighten:function(e,t,n){var i=He(e);return void 0!==n&&"relative"===n.value?i.l+=i.l*t.value/100:i.l+=t.value/100,i.l=We(i.l),Je(e,i)},darken:function(e,t,n){var i=He(e);return void 0!==n&&"relative"===n.value?i.l-=i.l*t.value/100:i.l-=t.value/100,i.l=We(i.l),Je(e,i)},fadein:function(e,t,n){var i=He(e);return void 0!==n&&"relative"===n.value?i.a+=i.a*t.value/100:i.a+=t.value/100,i.a=We(i.a),Je(e,i)},fadeout:function(e,t,n){var i=He(e);return void 0!==n&&"relative"===n.value?i.a-=i.a*t.value/100:i.a-=t.value/100,i.a=We(i.a),Je(e,i)},fade:function(e,t){var n=He(e);return n.a=t.value/100,n.a=We(n.a),Je(e,n)},spin:function(e,t){var n=He(e),i=(n.h+t.value)%360;return n.h=i<0?360+i:i,Je(e,n)},mix:function(e,t,n){n||(n=new X(50));var i=n.value/100,r=2*i-1,o=He(e).a-He(t).a,s=((r*o==-1?r:(r+o)/(1+r*o))+1)/2,a=1-s,l=[e.rgb[0]*s+t.rgb[0]*a,e.rgb[1]*s+t.rgb[1]*a,e.rgb[2]*s+t.rgb[2]*a],u=e.alpha*i+t.alpha*(1-i);return new f(l,u)},greyscale:function(e){return ze.desaturate(e,new X(100))},contrast:function(e,t,n,i){if(!e.rgb)return null;if(void 0===n&&(n=ze.rgba(255,255,255,1)),void 0===t&&(t=ze.rgba(0,0,0,1)),t.luma()>n.luma()){var r=n;n=t,t=r}return i=void 0===i?.43:Ke(i),e.luma().5&&(i=1,n=e>.25?Math.sqrt(e):((16*e-12)*e+4)*e),e-(1-2*t)*i*(n-e)},hardlight:function(e,t){return Xe.overlay(t,e)},difference:function(e,t){return Math.abs(e-t)},exclusion:function(e,t){return e+t-2*e*t},average:function(e,t){return(e+t)/2},negation:function(e,t){return 1-Math.abs(e+t-1)}};for(var et in Xe)Xe.hasOwnProperty(et)&&(Ye[et]=Ye.bind(null,Xe[et]));var tt=function(e){return Array.isArray(e.value)?e.value:Array(e)},nt={_SELF:function(e){return e},extract:function(e,t){return t=t.value-1,tt(e)[t]},length:function(e){return new X(tt(e).length)},range:function(e,t,n){var i,r,o=1,s=[];t?(r=t,i=e.value,n&&(o=n.value)):(i=1,r=e);for(var a=i;a<=r.value;a+=o)s.push(new X(a,r.unit));return new ie(s)},each:function(e,t){var n,i,r=[];i=!e.value||e instanceof ue?e.ruleset?e.ruleset.rules:e.rules?e.rules:Array.isArray(e)?e:[e]:Array.isArray(e.value)?e.value:[e.value];var o="@value",s="@key",a="@index";t.params?(o=t.params[0]&&t.params[0].name,s=t.params[1]&&t.params[1].name,a=t.params[2]&&t.params[2].name,t=t.rules):t=t.ruleset;for(var l=0;ls.value)&&(c[i]=r);else{if(void 0!==l&&a!==l)throw{type:"Argument",message:"incompatible types"};h[a]=c.length,c.push(r)}else Array.isArray(t[n].value)&&Array.prototype.push.apply(t,Array.prototype.slice.call(t[n].value));return 1==c.length?c[0]:(t=c.map((function(e){return e.toCSS(this.context)})).join(this.context.compress?",":", "),new L((e?"min":"max")+"("+t+")"))},lt={min:function(){for(var e=[],t=0;t",r=0;r";return i+="',i=encodeURIComponent(i),new ce(new ue("'"+(i="data:image/svg+xml,"+i)+"'",i,!1,this.index,this.currentFileInfo),this.index,this.currentFileInfo)}}),J.addMultiple(ft),t},vt=function(e,t){var n;void 0===t&&(t={});var i=t.variables,r=new q.Eval(t);"object"!=typeof i||Array.isArray(i)||(i=Object.keys(i).map((function(e){var t=i[e];return t instanceof Ie.Value||(t instanceof Ie.Expression||(t=new Ie.Expression([t])),t=new Ie.Value([t])),new Ie.Declaration("@"+e,t,!1,null,0)})),r.frames=[new Ie.Ruleset(null,i)]);var o,s,a=[new Ue.JoinSelectorVisitor,new Ue.MarkVisibleSelectorsVisitor(!0),new Ue.ExtendVisitor,new Ue.ToCSSVisitor({compress:Boolean(t.compress)})],l=[];if(t.pluginManager){s=t.pluginManager.visitor();for(var u=0;u<2;u++)for(s.first();o=s.get();)o.isPreEvalVisitor?0!==u&&-1!==l.indexOf(o)||(l.push(o),o.run(e)):0!==u&&-1!==a.indexOf(o)||(o.isPreVisitor?a.unshift(o):a.push(o))}n=e.eval(r);for(u=0;u=t);n++);this.preProcessors.splice(n,0,{preProcessor:e,priority:t})},e.prototype.addPostProcessor=function(e,t){var n;for(n=0;n=t);n++);this.postProcessors.splice(n,0,{postProcessor:e,priority:t})},e.prototype.addFileManager=function(e){this.fileManagers.push(e)},e.prototype.getPreProcessors=function(){for(var e=[],t=0;t0){var i=void 0,r=JSON.stringify(this._sourceMapGenerator.toJSON());this.sourceMapURL?i=this.sourceMapURL:this._sourceMapFilename&&(i=this._sourceMapFilename),this.sourceMapURL=i,this.sourceMap=r}return this._css.join("")},t}()}(e=new ke(e,t)),r=function(e,t){return function(){function n(e){this.options=e}return n.prototype.toCSS=function(t,n,i){var r=new e({contentsIgnoredCharsMap:i.contentsIgnoredChars,rootNode:t,contentsMap:i.contents,sourceMapFilename:this.options.sourceMapFilename,sourceMapURL:this.options.sourceMapURL,outputFilename:this.options.sourceMapOutputFilename,sourceMapBasepath:this.options.sourceMapBasepath,sourceMapRootpath:this.options.sourceMapRootpath,outputSourceFiles:this.options.outputSourceFiles,sourceMapGenerator:this.options.sourceMapGenerator,sourceMapFileInline:this.options.sourceMapFileInline,disableSourcemapAnnotation:this.options.disableSourcemapAnnotation}),o=r.toCSS(n);return this.sourceMap=r.sourceMap,this.sourceMapURL=r.sourceMapURL,this.options.sourceMapInputFilename&&(this.sourceMapInputFilename=r.normalizeFilename(this.options.sourceMapInputFilename)),void 0!==this.options.sourceMapBasepath&&void 0!==this.sourceMapURL&&(this.sourceMapURL=r.removeBasepath(this.sourceMapURL)),o+this.getCSSAppendage()},n.prototype.getCSSAppendage=function(){var e=this.sourceMapURL;if(this.options.sourceMapFileInline){if(void 0===this.sourceMap)return"";e="data:application/json;base64,"+t.encodeBase64(this.sourceMap)}return this.options.disableSourcemapAnnotation?"":e?"/*# sourceMappingURL="+e+" */":""},n.prototype.getExternalSourceMap=function(){return this.sourceMap},n.prototype.setExternalSourceMap=function(e){this.sourceMap=e},n.prototype.isInline=function(){return this.options.sourceMapFileInline},n.prototype.getSourceMapURL=function(){return this.sourceMapURL},n.prototype.getOutputFilename=function(){return this.options.sourceMapOutputFilename},n.prototype.getInputFilename=function(){return this.sourceMapInputFilename},n}()}(i,e),o=function(e){return function(){function t(e,t){this.root=e,this.imports=t}return t.prototype.toCSS=function(t){var n,i,r={};try{n=vt(this.root,t)}catch(e){throw new R(e,this.imports)}try{var o=Boolean(t.compress);o&&Ce.warn("The compress option has been deprecated. We recommend you use a dedicated css minifier, for instance see less-plugin-clean-css.");var s={compress:o,dumpLineNumbers:t.dumpLineNumbers,strictUnits:Boolean(t.strictUnits),numPrecision:8};t.sourceMap?(i=new e(t.sourceMap),r.css=i.toCSS(n,s,this.imports)):r.css=n.toCSS(s)}catch(e){throw new R(e,this.imports)}if(t.pluginManager)for(var a=t.pluginManager.getPostProcessors(),l=0;l=200&&t.status<300?n(t.responseText,t.getResponseHeader("Last-Modified")):"function"==typeof i&&i(t.status,e)}"function"==typeof r.overrideMimeType&&r.overrideMimeType("text/css"),yt.debug("XHR: Getting '"+e+"'"),r.open("GET",e,o),r.setRequestHeader("Accept",t||"text/x-less, text/css; q=0.9, */*; q=0.5"),r.send(null),gt.isFileProtocol&&!gt.fileAsync?0===r.status||r.status>=200&&r.status<300?n(r.responseText):i(r.status,e):o?r.onreadystatechange=function(){4==r.readyState&&s(r,n,i)}:s(r,n,i)},t.prototype.supports=function(){return!0},t.prototype.clearFileCache=function(){wt={}},t.prototype.loadFile=function(e,t,n,i){t&&!this.isPathAbsolute(e)&&(e=t+e),e=n.ext?this.tryAppendExtension(e,n.ext):e,n=n||{};var r=this.extractUrlParts(e,window.location.href).url,o=this;return new Promise((function(e,t){if(n.useFileCache&&wt[r])try{var i=wt[r];return e({contents:i,filename:r,webInfo:{lastModified:new Date}})}catch(e){return t({filename:r,message:"Error loading file "+r+" error was "+e.message})}o.doXHR(r,n.mime,(function(t,n){wt[r]=t,e({contents:t,filename:r,webInfo:{lastModified:n}})}),(function(e,n){t({type:"File",message:"'"+n+"' wasn't found ("+e+")",href:r})}))}))},t}(_e),St=function(e,t){return gt=e,yt=t,xt},It=function(e){function t(t){var n=e.call(this)||this;return n.less=t,n}return o(t,e),t.prototype.loadPlugin=function(e,t,n,i,r){return new Promise((function(o,s){r.loadFile(e,t,n,i).then(o).catch(s)}))},t}(Ae),Ct=function(t,i,r){return{add:function(o,s){r.errorReporting&&"html"!==r.errorReporting?"console"===r.errorReporting?function(e,t){var n=e.filename||t,o=[],s=(e.type||"Syntax")+"Error: "+(e.message||"There is an error in your .less file")+" in "+n,a=function(e,t,n){void 0!==e.extract[t]&&o.push("{line} {content}".replace(/\{line\}/,(parseInt(e.line,10)||0)+(t-1)).replace(/\{class\}/,n).replace(/\{content\}/,e.extract[t]))};e.line&&(a(e,0,""),a(e,1,"line"),a(e,2,""),s+=" on line "+e.line+", column "+(e.column+1)+":\n"+o.join("\n")),e.stack&&(e.extract||r.logLevel>=4)&&(s+="\nStack Trace\n"+e.stack),i.logger.error(s)}(o,s):"function"==typeof r.errorReporting&&r.errorReporting("add",o,s):function(i,o){var s,a,l="less-error-message:"+e(o||""),u=t.document.createElement("div"),c=[],h=i.filename||o,f=h.match(/([^\/]+(\?.*)?)$/)[1];u.id=l,u.className="less-error-message",a="

    "+(i.type||"Syntax")+"Error: "+(i.message||"There is an error in your .less file")+'

    in '+f+" ";var p=function(e,t,n){void 0!==e.extract[t]&&c.push('

  • {content}
  • '.replace(/\{line\}/,(parseInt(e.line,10)||0)+(t-1)).replace(/\{class\}/,n).replace(/\{content\}/,e.extract[t]))};i.line&&(p(i,0,""),p(i,1,"line"),p(i,2,""),a+="on line "+i.line+", column "+(i.column+1)+":

      "+c.join("")+"
    "),i.stack&&(i.extract||r.logLevel>=4)&&(a+="
    Stack Trace
    "+i.stack.split("\n").slice(1).join("
    ")),u.innerHTML=a,n(t.document,[".less-error-message ul, .less-error-message li {","list-style-type: none;","margin-right: 15px;","padding: 4px 0;","margin: 0;","}",".less-error-message label {","font-size: 12px;","margin-right: 15px;","padding: 4px 0;","color: #cc7777;","}",".less-error-message pre {","color: #dd6666;","padding: 4px 0;","margin: 0;","display: inline-block;","}",".less-error-message pre.line {","color: #ff0000;","}",".less-error-message h3 {","font-size: 20px;","font-weight: bold;","padding: 15px 0 5px 0;","margin: 0;","}",".less-error-message a {","color: #10a","}",".less-error-message .error {","color: red;","font-weight: bold;","padding-bottom: 2px;","border-bottom: 1px dashed red;","}"].join("\n"),{title:"error-message"}),u.style.cssText=["font-family: Arial, sans-serif","border: 1px solid #e00","background-color: #eee","border-radius: 5px","-webkit-border-radius: 5px","-moz-border-radius: 5px","color: #e00","padding: 15px","margin-bottom: 15px"].join(";"),"development"===r.env&&(s=setInterval((function(){var e=t.document,n=e.body;n&&(e.getElementById(l)?n.replaceChild(u,e.getElementById(l)):n.insertBefore(u,n.firstChild),clearInterval(s))}),10))}(o,s)},remove:function(n){r.errorReporting&&"html"!==r.errorReporting?"console"===r.errorReporting||"function"==typeof r.errorReporting&&r.errorReporting("remove",n):function(n){var i=t.document.getElementById("less-error-message:"+e(n));i&&i.parentNode.removeChild(i)}(n)}}},kt={javascriptEnabled:!1,depends:!1,compress:!1,lint:!1,paths:[],color:!0,strictImports:!1,insecure:!1,rootpath:"",rewriteUrls:!1,math:0,strictUnits:!1,globalVars:null,modifyVars:null,urlArgs:""};if(window.less)for(var _t in window.less)window.less.hasOwnProperty(_t)&&(kt[_t]=window.less[_t]);!function(e,n){t(n,i(e)),void 0===n.isFileProtocol&&(n.isFileProtocol=/^(file|(chrome|safari)(-extension)?|resource|qrc|app):/.test(e.location.protocol)),n.async=n.async||!1,n.fileAsync=n.fileAsync||!1,n.poll=n.poll||(n.isFileProtocol?1e3:1500),n.env=n.env||("127.0.0.1"==e.location.hostname||"0.0.0.0"==e.location.hostname||"localhost"==e.location.hostname||e.location.port&&e.location.port.length>0||n.isFileProtocol?"development":"production");var r=/!dumpLineNumbers:(comments|mediaquery|all)/.exec(e.location.hash);r&&(n.dumpLineNumbers=r[1]),void 0===n.useFileCache&&(n.useFileCache=!0),void 0===n.onReady&&(n.onReady=!0),n.relativeUrls&&(n.rewriteUrls="all")}(window,kt),kt.plugins=kt.plugins||[],window.LESS_PLUGINS&&(kt.plugins=kt.plugins.concat(window.LESS_PLUGINS));var At,Mt,Pt,Et=function(e,i){var r=e.document,o=bt();o.options=i;var s=o.environment,a=St(i,o.logger),l=new a;s.addFileManager(l),o.FileManager=a,o.PluginLoader=It,function(e,t){t.logLevel=void 0!==t.logLevel?t.logLevel:"development"===t.env?3:1,t.loggers||(t.loggers=[{debug:function(e){t.logLevel>=4&&console.log(e)},info:function(e){t.logLevel>=3&&console.log(e)},warn:function(e){t.logLevel>=2&&console.warn(e)},error:function(e){t.logLevel>=1&&console.error(e)}}]);for(var n=0;n + {% assets "css_libs" %}{% endassets %} {% assets "css_core" %}{% endassets %} {% assets "css_plugins" %}{% endassets %} diff --git a/src/octoprint/templates/stylesheets.jinja2 b/src/octoprint/templates/stylesheets.jinja2 index 3f94a2c20..d5cad8593 100644 --- a/src/octoprint/templates/stylesheets.jinja2 +++ b/src/octoprint/templates/stylesheets.jinja2 @@ -4,4 +4,3 @@ {% assets "css_plugins" %}{% endassets %} {% assets "less_core" %}{% endassets %} {% assets "less_plugins" %}{% endassets %} - From 3a90b394c0b99df8ec13575cfb4e22500208a620 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Mon, 8 Feb 2021 18:21:01 +0100 Subject: [PATCH 10/45] =?UTF-8?q?=F0=9F=9A=A8=20let=20=3D>=20var=20&=20act?= =?UTF-8?q?ually=20use=20the=20sorting=20result?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .eslintignore | 2 +- src/octoprint/plugins/logging/static/js/logging.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.eslintignore b/.eslintignore index 677061a2d..4dcb7dbaa 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1 +1 @@ -tests/cypress/** +tests/cypress diff --git a/src/octoprint/plugins/logging/static/js/logging.js b/src/octoprint/plugins/logging/static/js/logging.js index 05a17bf54..53052f376 100644 --- a/src/octoprint/plugins/logging/static/js/logging.js +++ b/src/octoprint/plugins/logging/static/js/logging.js @@ -97,10 +97,10 @@ $(function () { levels.push(item); configuredLoggers.push(logger); }); - let sortedLevels = _.sortBy(levels, function (o) { + var sortedLevels = _.sortBy(levels, function (o) { return o.component; }); - self.configuredLoggers(levels); + self.configuredLoggers(sortedLevels); // loggers var availableLoggers = _.difference(response.loggers, configuredLoggers); From 664a8fff79bdc7a5dced39a22e2b7fc6df63b2df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Mon, 8 Feb 2021 19:15:06 +0100 Subject: [PATCH 11/45] =?UTF-8?q?=F0=9F=8E=A8=20Fix=20eslint=20config?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .eslintignore | 1 - .eslintrc.yaml | 36 +++++++++++++++++++++++++++--------- .pre-commit-config.yaml | 4 ++++ 3 files changed, 31 insertions(+), 10 deletions(-) delete mode 100644 .eslintignore diff --git a/.eslintignore b/.eslintignore deleted file mode 100644 index 4dcb7dbaa..000000000 --- a/.eslintignore +++ /dev/null @@ -1 +0,0 @@ -tests/cypress diff --git a/.eslintrc.yaml b/.eslintrc.yaml index 1f35d73ef..c34fe2339 100644 --- a/.eslintrc.yaml +++ b/.eslintrc.yaml @@ -1,22 +1,40 @@ -env: - browser: true - jquery: true -parserOptions: - ecmaVersion: 5 -rules: {} overrides: - files: - "src/octoprint/static/js/app/**" + env: + browser: true + jquery: true + parserOptions: + ecmaVersion: 5 rules: - es5/no-block-scoping: error es5/no-arrow-functions: error + es5/no-binary-and-octal-literals: error + es5/no-block-scoping: error + es5/no-classes: error + es5/no-computed-properties: error es5/no-default-parameters: error - es5/no-rest-parameters: error - es5/no-spread: error es5/no-destructuring: error + es5/no-exponentiation-operator: error es5/no-for-of: error es5/no-generators: error + es5/no-modules: error + es5/no-object-super: error + es5/no-rest-parameters: error + es5/no-shorthand-properties: error + es5/no-spread: error es5/no-template-literals: error + es5/no-typeof-symbol: error + es5/no-unicode-code-point-escape: error + es5/no-unicode-regex: error + - files: + - "tests/cypress/**" + env: + node: true + es6: true + cypress/globals: true + extends: + - "plugin:cypress/recommended" plugins: - eslint-plugin-es5 + - cypress diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 2202e8a22..1db0fb13e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -47,4 +47,8 @@ repos: hooks: - id: eslint additional_dependencies: + - eslint@7.19.0 - eslint-plugin-es5@v1.3.0 + - eslint-plugin-cypress@2.11.2 + files: \.js$ + exclude: ^(src/octoprint/vendor/|tests/static/js/lib|tests/util/_files|docs/|scripts/|translations/) From 5eb03c1e9ec62cd7911780919d5bbe7192324fa6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Tue, 9 Feb 2021 14:43:31 +0100 Subject: [PATCH 12/45] =?UTF-8?q?=F0=9F=9A=B8=20Request=20unzipped=20log?= =?UTF-8?q?=20files=20in=20bug=20reports?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/ISSUE_TEMPLATE/bug_report.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 6e56ba502..5127633d4 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -92,10 +92,10 @@ inputs: value: >- Please also be sure to upload the following files below: - * `octoprint.log`: See [here](https://community.octoprint.org/t/where-can-i-find-octoprints-and-octopis-log-files/299) if you don't know where to find that. + * `octoprint.log`: See [here](https://community.octoprint.org/t/where-can-i-find-octoprints-and-octopis-log-files/299) if you don't know where to find that. Please do not zip, modify or paste, just attach down below as-is. * `serial.log` or the contents of your terminal tab, if applicable. Always include if unsure. **Please note that you need to enable `serial.log` first**, - see [here](https://community.octoprint.org/t/where-can-i-find-octoprints-and-octopis-log-files/299) if you don't know how to do or where to find it. + see [here](https://community.octoprint.org/t/where-can-i-find-octoprints-and-octopis-log-files/299) if you don't know how to do or where to find it. Please do not zip, modify or paste, just attach down below as-is. * Your browser's JavaScript console, if you are reporting a problem with the user interface. See [here](https://webmasters.stackexchange.com/questions/8525/how-to-open-the-javascript-console-in-different-browsers) on where to find that. * If possible, screenshots or videos showing the problem, especially if you @@ -109,7 +109,7 @@ inputs: attributes: label: Checklist of files to include below choices: - - label: octoprint.log + - label: octoprint.log (unmodified, unzipped, just attached below) required: true - label: serial.log or contents of your terminal tab (always include in cases of issues with printer communication) - label: Contents of the JavaScript browser console (always include in cases of issues with the user interface) From 5257a2c863ee002dca0099f6c8fdc0bc5ef1b2b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Tue, 9 Feb 2021 15:11:19 +0100 Subject: [PATCH 13/45] =?UTF-8?q?=F0=9F=9A=B8=20Made=20bundleviewer=20comp?= =?UTF-8?q?atible=20to=20zipped=20logs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/ISSUE_TEMPLATE/bug_report.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 5127633d4..84d1592e0 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -92,10 +92,10 @@ inputs: value: >- Please also be sure to upload the following files below: - * `octoprint.log`: See [here](https://community.octoprint.org/t/where-can-i-find-octoprints-and-octopis-log-files/299) if you don't know where to find that. Please do not zip, modify or paste, just attach down below as-is. + * `octoprint.log`: See [here](https://community.octoprint.org/t/where-can-i-find-octoprints-and-octopis-log-files/299) if you don't know where to find that. Just attach down below as-is. * `serial.log` or the contents of your terminal tab, if applicable. Always include if unsure. **Please note that you need to enable `serial.log` first**, - see [here](https://community.octoprint.org/t/where-can-i-find-octoprints-and-octopis-log-files/299) if you don't know how to do or where to find it. Please do not zip, modify or paste, just attach down below as-is. + see [here](https://community.octoprint.org/t/where-can-i-find-octoprints-and-octopis-log-files/299) if you don't know how to do or where to find it. Just attach down below as-is. * Your browser's JavaScript console, if you are reporting a problem with the user interface. See [here](https://webmasters.stackexchange.com/questions/8525/how-to-open-the-javascript-console-in-different-browsers) on where to find that. * If possible, screenshots or videos showing the problem, especially if you @@ -109,7 +109,7 @@ inputs: attributes: label: Checklist of files to include below choices: - - label: octoprint.log (unmodified, unzipped, just attached below) + - label: octoprint.log required: true - label: serial.log or contents of your terminal tab (always include in cases of issues with printer communication) - label: Contents of the JavaScript browser console (always include in cases of issues with the user interface) From f50f7ab4f5826683dc2daec22e879e8f12f6e81f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Tue, 9 Feb 2021 15:47:07 +0100 Subject: [PATCH 14/45] =?UTF-8?q?=F0=9F=9A=B8=20Additional=20field=20for?= =?UTF-8?q?=20"safe=20mode=20untested"=20explanation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/ISSUE_TEMPLATE/bug_report.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 84d1592e0..e0816d0f9 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -58,6 +58,17 @@ inputs: - No, it did not persist (it's an issue with one of your installed plugins, don't report here) - I cannot test this issue in safe mode (state why below) required: true + - type: input + attributes: + label: If you could not test in safe mode, please state why + description: >- + Issues caused by a third party plugin are a major cause of bugs reported here, so we really need to + rule out that a plugin is at fault here. [Safe mode](https://docs.octoprint.org/en/master/features/safemode.html) is an easy way to do that. Only skip safe mode + if your particular problem *absolutely requires* third party plugins to be enabled. "It would take + too long" is **not** a reason to skip testing in safe mode, neither is "I do not know how to + enable it" as you can find info on that [here](https://docs.octoprint.org/en/master/features/safemode.html). + + If you really *cannot* test in safe mode, leave a short explanation as to why. - type: description attributes: value: | From 0904f9917d5e4cfc1d8c0cbe61bc7dfa67622875 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Tue, 9 Feb 2021 16:09:49 +0100 Subject: [PATCH 15/45] =?UTF-8?q?=F0=9F=90=9B=20Login:=20ignore=20disconne?= =?UTF-8?q?ct=20on=20page=20reload?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #3938 --- src/octoprint/static/js/login/login.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/octoprint/static/js/login/login.js b/src/octoprint/static/js/login/login.js index 7adecd03c..b79f8f89a 100644 --- a/src/octoprint/static/js/login/login.js +++ b/src/octoprint/static/js/login/login.js @@ -16,6 +16,8 @@ $(function () { var buttonElement = $("#login-button"); var reconnectElement = $("#login-reconnect"); + var ignoreDisconnect = false; + buttonElement.click(function () { var usernameElement = $("#login-user"); var passwordElement = $("#login-password"); @@ -31,6 +33,7 @@ $(function () { OctoPrint.browser .login(username, password, remember) .done(function () { + ignoreDisconnect = true; window.location.href = REDIRECT_URL; }) .fail(function () { @@ -52,6 +55,7 @@ $(function () { }; OctoPrint.socket.onDisconnected = function () { + if (ignoreDisconnect) return; buttonElement.prop("disabled", true); offlineElement.addClass("in"); }; From 3b05e15e13916ca52eeee13cb1234d77d5a6af2b Mon Sep 17 00:00:00 2001 From: LazeMSS Date: Tue, 9 Feb 2021 22:43:11 +0100 Subject: [PATCH 16/45] A small css bug that causes a lot of havoc in the styles when trying to change skin --- src/octoprint/static/less/octoprint.less | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/octoprint/static/less/octoprint.less b/src/octoprint/static/less/octoprint.less index ec5e19181..2099d09fa 100644 --- a/src/octoprint/static/less/octoprint.less +++ b/src/octoprint/static/less/octoprint.less @@ -253,7 +253,7 @@ body { .accordion-heading-button { float: right; - a { + >a { display: inline-block; padding: 8px 15px; font-size: 14px; From 740287528aa7dbe1317fa44c2e235a44dce98e27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Wed, 10 Feb 2021 11:28:05 +0100 Subject: [PATCH 17/45] =?UTF-8?q?=E2=9C=A8=20swu:=20New=20py2=20specific?= =?UTF-8?q?=20check=20overlay?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Also: compatible flag. Will allow us to flag future updates as incompatible via the plugin repository. --- .../plugins/softwareupdate/__init__.py | 72 +++++++++++++------ .../static/js/softwareupdate.js | 6 +- .../templates/softwareupdate_settings.jinja2 | 8 ++- 3 files changed, 62 insertions(+), 24 deletions(-) diff --git a/src/octoprint/plugins/softwareupdate/__init__.py b/src/octoprint/plugins/softwareupdate/__init__.py index f8e900b72..798ffa6c7 100644 --- a/src/octoprint/plugins/softwareupdate/__init__.py +++ b/src/octoprint/plugins/softwareupdate/__init__.py @@ -34,7 +34,11 @@ from octoprint.server.util.flask import ( ) from octoprint.util import dict_merge, get_formatted_size, to_unicode from octoprint.util.pip import create_pip_caller -from octoprint.util.version import get_comparable_version, get_python_version_string +from octoprint.util.version import ( + get_comparable_version, + get_python_version_string, + is_python_compatible, +) from . import cli, exceptions, updaters, util, version_checks @@ -372,23 +376,33 @@ class SoftwareUpdatePlugin( or self._overlay_cache_timestamp + self._overlay_cache_ttl < time.time() ) + def _get_check_overlay(self, url): + self._logger.info("Fetching check overlays from {}".format(url)) + try: + r = requests.get(url, timeout=3.1) + r.raise_for_status() + data = r.json() + except Exception as exc: + self._logger.error( + "Could not fetch check overlay from {}: {}".format(url, exc) + ) + return {} + else: + return data + def _get_check_overlays(self, force=False): if self._check_overlays_stale or force: if self._connectivity_checker.online: - # reload from URL - url = self._settings.get(["check_overlay_url"]) - self._logger.info("Fetching check overlays from {}".format(url)) - try: - r = requests.get(url, timeout=3.1) - r.raise_for_status() - data = r.json() - except Exception as exc: - self._logger.error( - "Could not fetch check overlay from {}: {}".format(url, exc) + self._overlay_cache = self._get_check_overlay( + self._settings.get(["check_overlay_url"]) + ) + if is_python_compatible("<3"): + data = self._get_check_overlay( + self._settings.get(["check_overlay_py2_url"]) + ) + self._overlay_cache = octoprint.util.dict_merge( + self._overlay_cache, data ) - self._overlay_cache = {} - else: - self._overlay_cache = data else: self._logger.info("Not fetching check overlays, we are offline") @@ -535,6 +549,7 @@ class SoftwareUpdatePlugin( "ignore_throttled": False, "minimum_free_storage": 150, "check_overlay_url": "https://plugins.octoprint.org/update_check_overlay.json", + "check_overlay_py2_url": "https://plugins.octoprint.org/update_check_overlay_py2.json", "check_overlay_ttl": 6 * 60, "credentials": { "github": None, @@ -1336,6 +1351,7 @@ class SoftwareUpdatePlugin( ) target_disabled = populated_check.get("disabled", False) + target_compatible = populated_check.get("compatible", True) update_available = update_available or ( target_update_available and not target_disabled ) @@ -1385,6 +1401,7 @@ class SoftwareUpdatePlugin( "online": target_online, "error": target_error, "disabled": target_disabled, + "compatible": target_compatible, "releaseChannels": {}, } @@ -1490,6 +1507,9 @@ class SoftwareUpdatePlugin( update_available = False error = None + disabled = check.get("disabled", False) + compatible = check.get("compatible", True) + try: version_checker = self._get_version_checker(target, check) information, is_current = version_checker.get_latest( @@ -1506,7 +1526,7 @@ class SoftwareUpdatePlugin( ) del self._version_cache[target] self._version_cache_dirty = True - elif not is_current: + elif not is_current and compatible: update_available = True except exceptions.CannotCheckOffline: update_possible = False @@ -1544,15 +1564,15 @@ class SoftwareUpdatePlugin( else: try: updater = self._get_updater(target, check) - update_possible = updater.can_perform_update(target, check, online=online) + update_possible = compatible and updater.can_perform_update( + target, check, online=online + ) except Exception: self._logger.exception( "Error while checking if {} can be updated".format(target) ) update_possible = False - disabled = check.get("disabled", False) - self._version_cache[target] = { "timestamp": time.time(), "hash": current_hash, @@ -1562,6 +1582,7 @@ class SoftwareUpdatePlugin( "online": online, "error": error, "disabled": disabled, + "compatible": compatible, } self._version_cache_dirty = True return information, update_available, update_possible, online, error @@ -1643,7 +1664,7 @@ class SoftwareUpdatePlugin( continue check = checks[target] - if "enabled" in check and not check["enabled"]: + if not check.get("enabled", True) or not check.get("compatible", True): continue if target not in check_targets: @@ -1736,8 +1757,17 @@ class SoftwareUpdatePlugin( if not update_possible: self._logger.warning( - "Cannot perform update for %s, update type is not fully configured" - % target + "Cannot perform update for {}, update type is not fully configured".format( + target + ) + ) + return False, None + + if not information.get("compatible", True): + self._logger.warning( + "Cannot perform update for {}, update is reported as incompatible".format( + target + ) ) return False, None diff --git a/src/octoprint/plugins/softwareupdate/static/js/softwareupdate.js b/src/octoprint/plugins/softwareupdate/static/js/softwareupdate.js index ddaef83a5..b090c2651 100644 --- a/src/octoprint/plugins/softwareupdate/static/js/softwareupdate.js +++ b/src/octoprint/plugins/softwareupdate/static/js/softwareupdate.js @@ -386,7 +386,11 @@ $(function () { text += "
      "; _.each(self.versions.items(), function (update_info) { - if (update_info.updateAvailable && !update_info.disabled) { + if ( + update_info.updateAvailable && + !update_info.disabled && + update_info.compatible + ) { text += "
    • " + "
      + + {{ _('Update') }} :
      - + {{ _('Release Channel:') }} {{ _('Installed:') }} {{ _('Available:') }} {{ _('Release Notes:') }} + + {{ _('Newer versions of this plugin are not compatible to this setup.') }} + From 4b024823499a68e21494755fc7ef148691720406 Mon Sep 17 00:00:00 2001 From: LazeMSS Date: Thu, 11 Feb 2021 10:08:54 +0100 Subject: [PATCH 18/45] Center Viewport on gcode viewer is cased wrong --- src/octoprint/plugins/gcodeviewer/static/js/gcodeviewer.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/octoprint/plugins/gcodeviewer/static/js/gcodeviewer.js b/src/octoprint/plugins/gcodeviewer/static/js/gcodeviewer.js index 6fb9ba4e3..c462bc1c3 100644 --- a/src/octoprint/plugins/gcodeviewer/static/js/gcodeviewer.js +++ b/src/octoprint/plugins/gcodeviewer/static/js/gcodeviewer.js @@ -879,8 +879,8 @@ $(function () { self.resetOptions(); var current = loadFromLocalStorage(optionsLocalStorageKey); - if (current["centerViewport"] !== undefined) - self.renderer_centerViewport(current["centerViewport"]); + if (current["centerViewPort"] !== undefined) + self.renderer_centerViewport(current["centerViewPort"]); if (current["zoomOnModel"] !== undefined) self.renderer_zoomOnModel(current["zoomOnModel"]); if (current["showMoves"] !== undefined) From c773c256c181a0be94b58d3d5f75252f99532585 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Thu, 11 Feb 2021 10:18:22 +0100 Subject: [PATCH 19/45] =?UTF-8?q?=F0=9F=8E=A8=20Fix=20formatting?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/octoprint/static/less/octoprint.less | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/octoprint/static/less/octoprint.less b/src/octoprint/static/less/octoprint.less index 2099d09fa..095ce129a 100644 --- a/src/octoprint/static/less/octoprint.less +++ b/src/octoprint/static/less/octoprint.less @@ -253,7 +253,7 @@ body { .accordion-heading-button { float: right; - >a { + > a { display: inline-block; padding: 8px 15px; font-size: 14px; From 85a6144de9fe71fe084f0e4f3cc9f60b5d4fd364 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Sun, 14 Feb 2021 18:42:55 +0100 Subject: [PATCH 20/45] =?UTF-8?q?=F0=9F=93=9D=20Improve=20dev=20env=20setu?= =?UTF-8?q?p=20docs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/development/environment.rst | 52 ++++++++++++++++++++++++-------- 1 file changed, 40 insertions(+), 12 deletions(-) diff --git a/docs/development/environment.rst b/docs/development/environment.rst index f53227f03..93756517b 100644 --- a/docs/development/environment.rst +++ b/docs/development/environment.rst @@ -1,14 +1,15 @@ .. _sec-development-environment: +************************************ Setting up a Development environment -==================================== +************************************ .. _sec-development-environment-source: Obtaining, building and running the source ------------------------------------------- +========================================== -This describes the general steps in obtaining, building and running. OS specific instructions can be found +This describes the **general, platform agnostic** steps in obtaining, building and running. OS specific instructions can be found below. * Prerequisites: @@ -80,10 +81,11 @@ Go to the directory `docs` and you can then build the documentation: * ``sphinx-build -b html . _build`` The documentation will be available in the newly created ``_build`` directory. You can simply browse it locally by opening ``index.html`` + .. _sec-development-environment-source-linux: Linux -..... +----- This assumes you'll host your OctoPrint development checkout at ``~/devel/OctoPrint``. If you want to use a different location, please substitute accordingly. @@ -126,7 +128,7 @@ You can then start OctoPrint via ``octoprint`` after activating one of the two v .. _sec-development-environment-windows: Windows -....... +------- This assumes you'll host your OctoPrint development checkout at ``C:\Devel\OctoPrint``. If you want to use a different location, please substitute accordingly. @@ -135,17 +137,18 @@ First download & install: * `Git for Windows `_ * `Latest *stable* Python 2.7 and Python 3.8 releases from python.org `_ - (at the time of writing those are ``2.7.18`` and ``3.8.4``) + (at the time of writing those are ``2.7.18`` and ``3.8.7``) * make sure to have the installer add Python to the ``PATH`` and have it install ``pip`` too * it's recommended to install Python 2.7 into ``C:\Python27`` and Python 3 into ``C:\Python38`` - if you select different install locations please substitute accordingly + * it's also recommended to have both versions get installed for all users * `Microsoft Visual C++ Compiler for Python 2.7 `_ * `Build Tools For Visual Studio 2019 `_ * install "C++ build tools" and ensure the latest versions of "MSVCv142 - VS 2019 C++ x64/x86 build tools" and - "Windows 10 SDK" are checked. + "Windows 10 SDK" are checked under individual components. Open the Git Bash you just installed and in that: @@ -158,18 +161,43 @@ Open the Git Bash you just installed and in that: virtualenv --python=C:\Python27\python.exe venv2 virtualenv --python=C:\Python38\python.exe venv3 source ./venv2/Scripts/activate - pip install --upgrade pip + python -m pip install --upgrade pip pip install -e .[develop,plugins] source ./venv3/Scripts/activate pip install --upgrade pip - pip install -e .[develop,plugins,docs] + python -m pip install -e .[develop,plugins,docs] pre-commit install git config blame.ignoreRevsFile .git-blame-ignore-revs +.. _sec-development-environment-windows-optional: + +Optional but recommended tools +.............................. + +These are some tools that are recommended but not required to have on hand: + + * `Visual Studio Code `_ + * `Windows Terminal `_ + + Add the following profile to ``profiles.list`` in the settings, that will allow you to + easily start Git Bash from the terminal: + + .. code-block:: js + + { + "guid": "{3df4550c-eebd-496c-a189-e55f2f8b01ce}", + "hidden": false, + "name": "Git Bash", + "commandline": "C:\\Program Files\\Git\\bin\\bash.exe --login -i", + "startingDirectory": "C:\\Devel", + "tabTitle": "Git Bash", + "suppressApplicationTitle": true + }, + .. _sec-development-environment-mac: Mac OS X -........ +-------- .. note:: @@ -220,7 +248,7 @@ You'll need a user account with administrator privileges. .. _sec-development-environment-ides: IDE Setup ---------- +========= .. todo:: @@ -231,7 +259,7 @@ IDE Setup .. _sec-development-environment-ides-pycharm: PyCharm -....... +------- - "File" > "Open ...", select OctoPrint checkout folder (e.g. ``~/devel/OctoPrint`` or ``C:\Devel\OctoPrint``) - Register virtual environments: From 8a0f6171ad93c3426b764682f3f1ae1636650edf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Mon, 15 Feb 2021 19:16:50 +0100 Subject: [PATCH 21/45] =?UTF-8?q?=F0=9F=8E=A8=20Output=20json/yaml=20with?= =?UTF-8?q?=202=20space=20indentation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/octoprint/access/groups.py | 2 +- src/octoprint/access/users.py | 2 +- src/octoprint/cli/analysis.py | 2 +- src/octoprint/cli/config.py | 4 ++-- src/octoprint/environment.py | 2 +- src/octoprint/filemanager/storage.py | 4 ++-- src/octoprint/server/util/flask.py | 2 +- src/octoprint/settings.py | 2 +- src/octoprint/static/css/octoprint.css | 2 +- 9 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/octoprint/access/groups.py b/src/octoprint/access/groups.py index beee5faf5..f81b7cf06 100644 --- a/src/octoprint/access/groups.py +++ b/src/octoprint/access/groups.py @@ -352,7 +352,7 @@ class FilebasedGroupManager(GroupManager): import yaml yaml.safe_dump( - data, f, default_flow_style=False, indent=4, allow_unicode=True + data, f, default_flow_style=False, indent=2, allow_unicode=True ) self._dirty = False self._load() diff --git a/src/octoprint/access/users.py b/src/octoprint/access/users.py index a7340bfed..515c96c85 100644 --- a/src/octoprint/access/users.py +++ b/src/octoprint/access/users.py @@ -609,7 +609,7 @@ class FilebasedUserManager(UserManager): self._userfile, mode="wt", permissions=0o600, max_permissions=0o666 ) as f: yaml.safe_dump( - data, f, default_flow_style=False, indent=4, allow_unicode=True + data, f, default_flow_style=False, indent=2, allow_unicode=True ) self._dirty = False self._load() diff --git a/src/octoprint/cli/analysis.py b/src/octoprint/cli/analysis.py index 80c53d0a0..98155753a 100644 --- a/src/octoprint/cli/analysis.py +++ b/src/octoprint/cli/analysis.py @@ -145,7 +145,7 @@ def gcode_command( yaml.safe_dump( interpreter.get_result(), default_flow_style=False, - indent=4, + indent=2, allow_unicode=True, ) ) diff --git a/src/octoprint/cli/config.py b/src/octoprint/cli/config.py index c45e56394..f07653c2c 100644 --- a/src/octoprint/cli/config.py +++ b/src/octoprint/cli/config.py @@ -218,7 +218,7 @@ def get_command(ctx, path, as_json=False, as_yaml=False, as_raw=False): output = json.dumps(value) elif as_yaml: output = yaml.safe_dump( - value, default_flow_style=False, indent=4, allow_unicode=True + value, default_flow_style=False, indent=2, allow_unicode=True ) elif as_raw: output = value @@ -244,7 +244,7 @@ def effective_command(ctx, as_json=False, as_yaml=False, as_raw=False): output = json.dumps(value) elif as_yaml: output = yaml.safe_dump( - value, default_flow_style=False, indent=4, allow_unicode=True + value, default_flow_style=False, indent=2, allow_unicode=True ) elif as_raw: output = value diff --git a/src/octoprint/environment.py b/src/octoprint/environment.py index f8be4d4fa..7011ad4b0 100644 --- a/src/octoprint/environment.py +++ b/src/octoprint/environment.py @@ -169,7 +169,7 @@ class EnvironmentDetector(object): environment = copy.deepcopy(self._cache) dumped_environment = yaml.safe_dump( - environment, default_flow_style=False, indent=4, allow_unicode=True + environment, default_flow_style=False, indent=2, allow_unicode=True ).strip() environment_lines = "\n".join( map(lambda l: "| {}".format(l), dumped_environment.split("\n")) diff --git a/src/octoprint/filemanager/storage.py b/src/octoprint/filemanager/storage.py index 2d0dd8e5b..4c9662145 100644 --- a/src/octoprint/filemanager/storage.py +++ b/src/octoprint/filemanager/storage.py @@ -1875,7 +1875,7 @@ class LocalFileStorage(StorageInterface): try: with atomic_write(metadata_path, mode="wb") as f: f.write( - to_bytes(json.dumps(metadata, indent=4, separators=(",", ": "))) + to_bytes(json.dumps(metadata, indent=2, separators=(",", ": "))) ) except Exception: self._logger.exception( @@ -1949,7 +1949,7 @@ class LocalFileStorage(StorageInterface): return with atomic_write(metadata_path_json, mode="wb") as f: - f.write(to_bytes(json.dumps(metadata, indent=4, separators=(",", ": ")))) + f.write(to_bytes(json.dumps(metadata, indent=2, separators=(",", ": ")))) try: os.remove(metadata_path_yaml) diff --git a/src/octoprint/server/util/flask.py b/src/octoprint/server/util/flask.py index df3ef21af..e565461bb 100644 --- a/src/octoprint/server/util/flask.py +++ b/src/octoprint/server/util/flask.py @@ -1061,7 +1061,7 @@ class PreemptiveCache(object): data, handle, default_flow_style=False, - indent=4, + indent=2, allow_unicode=True, ) except Exception: diff --git a/src/octoprint/settings.py b/src/octoprint/settings.py index 8389d480b..73a7fc3e4 100644 --- a/src/octoprint/settings.py +++ b/src/octoprint/settings.py @@ -1680,7 +1680,7 @@ class Settings(object): self._config, configFile, default_flow_style=False, - indent=4, + indent=2, allow_unicode=True, ) self._dirty = False diff --git a/src/octoprint/static/css/octoprint.css b/src/octoprint/static/css/octoprint.css index 48aedb6ba..70fc4e7ac 100644 --- a/src/octoprint/static/css/octoprint.css +++ b/src/octoprint/static/css/octoprint.css @@ -1 +1 @@ -.btn{display:inline-block;*display:inline;*zoom:1;padding:4px 12px;margin-bottom:0;font-size:14px;line-height:20px;text-align:center;vertical-align:middle;cursor:pointer;color:#333;text-shadow:0 1px 1px rgba(255,255,255,.75);background-color:#f5f5f5;background-image:-moz-linear-gradient(top,#fff,#e6e6e6);background-image:-webkit-gradient(linear,0 0,0 100%,from(#fff),to(#e6e6e6));background-image:-webkit-linear-gradient(top,#fff,#e6e6e6);background-image:-o-linear-gradient(top,#fff,#e6e6e6);background-image:linear-gradient(to bottom,#fff,#e6e6e6);background-repeat:repeat-x;*background-color:#e6e6e6;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);border:1px solid #ccc;*border:0;border-bottom-color:#b3b3b3;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;*margin-left:.3em;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05);-moz-box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05)}.btn.active,.btn.disabled,.btn:active,.btn:focus,.btn:hover,.btn[disabled]{color:#333;background-color:#e6e6e6;*background-color:#d9d9d9}.btn.active,.btn:active{background-color:#ccc \9}.btn:first-child{*margin-left:0}.btn:focus,.btn:hover{color:#333;text-decoration:none;background-position:0 -15px;-webkit-transition:background-position .1s linear;-moz-transition:background-position .1s linear;-o-transition:background-position .1s linear;transition:background-position .1s linear}.btn:focus{outline:#333 dotted thin;outline:-webkit-focus-ring-color auto 5px;outline-offset:-2px}.btn.active,.btn:active{background-image:none;outline:0;-webkit-box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05);-moz-box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05)}.btn.disabled,.btn[disabled]{cursor:default;background-image:none;opacity:.65;filter:alpha(opacity=65);-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}.btn-large{padding:11px 19px;font-size:17.5px;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px}.btn-large [class*=" icon-"],.btn-large [class^=icon-]{margin-top:4px}.btn-small{padding:2px 10px;font-size:11.9px;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.btn-small [class*=" icon-"],.btn-small [class^=icon-]{margin-top:0}.btn-mini [class*=" icon-"],.btn-mini [class^=icon-]{margin-top:-1px}.btn-mini{padding:0 6px;font-size:10.5px;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.btn-block{display:block;width:100%;padding-left:0;padding-right:0;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.btn-block+.btn-block{margin-top:5px}input[type=submit].btn-block,input[type=reset].btn-block,input[type=button].btn-block{width:100%}.btn-primary{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,.25);background-color:#006dcc;background-image:-moz-linear-gradient(top,#08c,#04c);background-image:-webkit-gradient(linear,0 0,0 100%,from(#08c),to(#04c));background-image:-webkit-linear-gradient(top,#08c,#04c);background-image:-o-linear-gradient(top,#08c,#04c);background-image:linear-gradient(to bottom,#08c,#04c);background-repeat:repeat-x;border-color:#04c #04c #002a80;border-color:rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25);*background-color:#04c;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.btn-primary.active,.btn-primary.disabled,.btn-primary:active,.btn-primary:focus,.btn-primary:hover,.btn-primary[disabled]{color:#fff;background-color:#04c;*background-color:#003bb3}.btn-primary.active,.btn-primary:active{background-color:#039 \9}.btn-warning{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,.25);background-color:#faa732;background-image:-moz-linear-gradient(top,#fbb450,#f89406);background-image:-webkit-gradient(linear,0 0,0 100%,from(#fbb450),to(#f89406));background-image:-webkit-linear-gradient(top,#fbb450,#f89406);background-image:-o-linear-gradient(top,#fbb450,#f89406);background-image:linear-gradient(to bottom,#fbb450,#f89406);background-repeat:repeat-x;border-color:#f89406 #f89406 #ad6704;border-color:rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25);*background-color:#f89406;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.btn-warning.active,.btn-warning.disabled,.btn-warning:active,.btn-warning:focus,.btn-warning:hover,.btn-warning[disabled]{color:#fff;background-color:#f89406;*background-color:#df8505}.btn-warning.active,.btn-warning:active{background-color:#c67605 \9}.btn-danger{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,.25);background-color:#da4f49;background-image:-moz-linear-gradient(top,#ee5f5b,#bd362f);background-image:-webkit-gradient(linear,0 0,0 100%,from(#ee5f5b),to(#bd362f));background-image:-webkit-linear-gradient(top,#ee5f5b,#bd362f);background-image:-o-linear-gradient(top,#ee5f5b,#bd362f);background-image:linear-gradient(to bottom,#ee5f5b,#bd362f);background-repeat:repeat-x;border-color:#bd362f #bd362f #802420;border-color:rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25);*background-color:#bd362f;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.btn-danger.active,.btn-danger.disabled,.btn-danger:active,.btn-danger:focus,.btn-danger:hover,.btn-danger[disabled]{color:#fff;background-color:#bd362f;*background-color:#a9302a}.btn-danger.active,.btn-danger:active{background-color:#942a25 \9}.btn-success{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,.25);background-color:#5bb75b;background-image:-moz-linear-gradient(top,#62c462,#51a351);background-image:-webkit-gradient(linear,0 0,0 100%,from(#62c462),to(#51a351));background-image:-webkit-linear-gradient(top,#62c462,#51a351);background-image:-o-linear-gradient(top,#62c462,#51a351);background-image:linear-gradient(to bottom,#62c462,#51a351);background-repeat:repeat-x;border-color:#51a351 #51a351 #387038;border-color:rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25);*background-color:#51a351;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.btn-success.active,.btn-success.disabled,.btn-success:active,.btn-success:focus,.btn-success:hover,.btn-success[disabled]{color:#fff;background-color:#51a351;*background-color:#499249}.btn-success.active,.btn-success:active{background-color:#408140 \9}.btn-info{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,.25);background-color:#49afcd;background-image:-moz-linear-gradient(top,#5bc0de,#2f96b4);background-image:-webkit-gradient(linear,0 0,0 100%,from(#5bc0de),to(#2f96b4));background-image:-webkit-linear-gradient(top,#5bc0de,#2f96b4);background-image:-o-linear-gradient(top,#5bc0de,#2f96b4);background-image:linear-gradient(to bottom,#5bc0de,#2f96b4);background-repeat:repeat-x;border-color:#2f96b4 #2f96b4 #1f6377;border-color:rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25);*background-color:#2f96b4;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.btn-info.active,.btn-info.disabled,.btn-info:active,.btn-info:focus,.btn-info:hover,.btn-info[disabled]{color:#fff;background-color:#2f96b4;*background-color:#2a85a0}.btn-info.active,.btn-info:active{background-color:#24748c \9}.btn-inverse{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,.25);background-color:#363636;background-image:-moz-linear-gradient(top,#444,#222);background-image:-webkit-gradient(linear,0 0,0 100%,from(#444),to(#222));background-image:-webkit-linear-gradient(top,#444,#222);background-image:-o-linear-gradient(top,#444,#222);background-image:linear-gradient(to bottom,#444,#222);background-repeat:repeat-x;border-color:#222 #222 #000;border-color:rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25);*background-color:#222;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.btn-inverse.active,.btn-inverse.disabled,.btn-inverse:active,.btn-inverse:focus,.btn-inverse:hover,.btn-inverse[disabled]{color:#fff;background-color:#222;*background-color:#151515}.btn-inverse.active,.btn-inverse:active{background-color:#080808 \9}button.btn,input[type=submit].btn{*padding-top:3px;*padding-bottom:3px}button.btn::-moz-focus-inner,input[type=submit].btn::-moz-focus-inner{padding:0;border:0}button.btn.btn-large,input[type=submit].btn.btn-large{*padding-top:7px;*padding-bottom:7px}button.btn.btn-small,input[type=submit].btn.btn-small{*padding-top:3px;*padding-bottom:3px}button.btn.btn-mini,input[type=submit].btn.btn-mini{*padding-top:1px;*padding-bottom:1px}.btn-link,.btn-link:active,.btn-link[disabled]{background-color:transparent;background-image:none;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}.btn-link{border-color:transparent;cursor:pointer;color:#08c;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0}.btn-link:focus,.btn-link:hover{color:#005580;text-decoration:underline;background-color:transparent}.btn-link[disabled]:focus,.btn-link[disabled]:hover{color:#333;text-decoration:none}.clearfix{*zoom:1}.clearfix:after,.clearfix:before{display:table;content:"";line-height:0}.clearfix:after{clear:both}.hide-text{font:0/0 a;color:transparent;text-shadow:none;background-color:transparent;border:0}.input-block-level{display:block;width:100%;min-height:30px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.nowrap{white-space:nowrap}.actioncol{text-align:center;white-space:nowrap}.actioncol a{text-decoration:none;color:#000}.actioncol a.disabled{color:#ccc;cursor:default}#navbar .navbar-inner{background-color:#ebebeb;background-image:-moz-linear-gradient(top,#fff,#ccc);background-image:-webkit-gradient(linear,0 0,0 100%,from(#fff),to(#ccc));background-image:-webkit-linear-gradient(top,#fff,#ccc);background-image:-o-linear-gradient(top,#fff,#ccc);background-image:linear-gradient(to bottom,#fff,#ccc);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffcccccc', GradientType=0)}#navbar .navbar-inner .brand,#navbar .navbar-inner .nav>li>a{text-shadow:0 1px 0 #ccc;color:#333}#navbar .navbar-inner .brand .caret,#navbar .navbar-inner .nav>li>a .caret{border-bottom-color:#939393;border-top-color:#939393}#navbar .navbar-inner .brand:focus .caret,#navbar .navbar-inner .brand:hover .caret,#navbar .navbar-inner .nav>li>a:focus .caret,#navbar .navbar-inner .nav>li>a:hover .caret{border-bottom-color:#636363;border-top-color:#636363}#navbar .navbar-inner .brand span{background-image:url(../img/tentacle-20x20.png)}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){#navbar .navbar-inner .brand span{background-image:url(../img/tentacle-20x20@2x.png)}}#navbar .navbar-inner .nav>li.dropdown.active>.dropdown-toggle,#navbar .navbar-inner .nav>li.dropdown.open.active>.dropdown-toggle,#navbar .navbar-inner .nav>li.dropdown.open>.dropdown-toggle{background-color:#e0e0e0;background-image:-moz-linear-gradient(top,#ccc,#fff);background-image:-webkit-gradient(linear,0 0,0 100%,from(#ccc),to(#fff));background-image:-webkit-linear-gradient(top,#ccc,#fff);background-image:-o-linear-gradient(top,#ccc,#fff);background-image:linear-gradient(to bottom,#ccc,#fff);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffcccccc', endColorstr='#ffffffff', GradientType=0)}#navbar .navbar-inner .nav>li>a:hover{background-color:#dedede;background-image:-moz-linear-gradient(top,#f2f2f2,#bfbfbf);background-image:-webkit-gradient(linear,0 0,0 100%,from(#f2f2f2),to(#bfbfbf));background-image:-webkit-linear-gradient(top,#f2f2f2,#bfbfbf);background-image:-o-linear-gradient(top,#f2f2f2,#bfbfbf);background-image:linear-gradient(to bottom,#f2f2f2,#bfbfbf);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2f2f2', endColorstr='#ffbfbfbf', GradientType=0)}#navbar .navbar-inner.transparent{background-color:rgba(235,235,235,.6);background-image:"../img/trans-background.png";background-image:-moz-linear-gradient(top,rgba(255,255,255,.6),rgba(204,204,204,.6)),url(../img/trans-background.png);background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(255,255,255,.6)),to(rgba(204,204,204,.6))),url(../img/trans-background.png);background-image:-webkit-linear-gradient(top,rgba(255,255,255,.6),rgba(204,204,204,.6)),url(../img/trans-background.png);background-image:-o-linear-gradient(top,rgba(255,255,255,.6),rgba(204,204,204,.6)),url(../img/trans-background.png);background-image:linear-gradient(to bottom,rgba(255,255,255,.6),rgba(204,204,204,.6)),url(../img/trans-background.png);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#99ffffff', endColorstr='#99cccccc', GradientType=0)}#navbar .navbar-inner.transparent .brand,#navbar .navbar-inner.transparent .nav>li>a{text-shadow:0 1px 0 #ccc;color:#333}#navbar .navbar-inner.transparent .brand .caret,#navbar .navbar-inner.transparent .nav>li>a .caret{border-bottom-color:#939393;border-top-color:#939393}#navbar .navbar-inner.transparent .brand:focus .caret,#navbar .navbar-inner.transparent .brand:hover .caret,#navbar .navbar-inner.transparent .nav>li>a:focus .caret,#navbar .navbar-inner.transparent .nav>li>a:hover .caret{border-bottom-color:#636363;border-top-color:#636363}#navbar .navbar-inner.transparent .brand span{background-image:url(../img/tentacle-20x20.png)}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){#navbar .navbar-inner.transparent .brand span{background-image:url(../img/tentacle-20x20@2x.png)}}#navbar .navbar-inner.transparent .nav>li.dropdown.active>.dropdown-toggle,#navbar .navbar-inner.transparent .nav>li.dropdown.open.active>.dropdown-toggle,#navbar .navbar-inner.transparent .nav>li.dropdown.open>.dropdown-toggle{background-color:rgba(224,224,224,.6);background-image:"../img/trans-background.png";background-image:-moz-linear-gradient(top,rgba(204,204,204,.6),rgba(255,255,255,.6)),url(../img/trans-background.png);background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(204,204,204,.6)),to(rgba(255,255,255,.6))),url(../img/trans-background.png);background-image:-webkit-linear-gradient(top,rgba(204,204,204,.6),rgba(255,255,255,.6)),url(../img/trans-background.png);background-image:-o-linear-gradient(top,rgba(204,204,204,.6),rgba(255,255,255,.6)),url(../img/trans-background.png);background-image:linear-gradient(to bottom,rgba(204,204,204,.6),rgba(255,255,255,.6)),url(../img/trans-background.png);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#99cccccc', endColorstr='#99ffffff', GradientType=0)}#navbar .navbar-inner.transparent .nav>li>a:hover{background-color:rgba(222,222,222,.6);background-image:"../img/trans-background.png";background-image:-moz-linear-gradient(top,rgba(242,242,242,.6),rgba(191,191,191,.6)),url(../img/trans-background.png);background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(242,242,242,.6)),to(rgba(191,191,191,.6))),url(../img/trans-background.png);background-image:-webkit-linear-gradient(top,rgba(242,242,242,.6),rgba(191,191,191,.6)),url(../img/trans-background.png);background-image:-o-linear-gradient(top,rgba(242,242,242,.6),rgba(191,191,191,.6)),url(../img/trans-background.png);background-image:linear-gradient(to bottom,rgba(242,242,242,.6),rgba(191,191,191,.6)),url(../img/trans-background.png);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#99f2f2f2', endColorstr='#99bfbfbf', GradientType=0)}#navbar .navbar-inner.red{background-color:#bb645f;background-image:-moz-linear-gradient(top,#e28e8a,#802420);background-image:-webkit-gradient(linear,0 0,0 100%,from(#e28e8a),to(#802420));background-image:-webkit-linear-gradient(top,#e28e8a,#802420);background-image:-o-linear-gradient(top,#e28e8a,#802420);background-image:linear-gradient(to bottom,#e28e8a,#802420);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffe28e8a', endColorstr='#ff802420', GradientType=0)}#navbar .navbar-inner.red .brand,#navbar .navbar-inner.red .nav>li>a{text-shadow:0 1px 0 #d86761;color:#f2f2f2}#navbar .navbar-inner.red .brand .caret,#navbar .navbar-inner.red .nav>li>a .caret{border-bottom-color:#d89491;border-top-color:#d89491}#navbar .navbar-inner.red .brand:focus .caret,#navbar .navbar-inner.red .brand:hover .caret,#navbar .navbar-inner.red .nav>li>a:focus .caret,#navbar .navbar-inner.red .nav>li>a:hover .caret{border-bottom-color:#e5c3c1;border-top-color:#e5c3c1}#navbar .navbar-inner.red .brand span{background-image:url(../img/tentacle-20x20-light.png)}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){#navbar .navbar-inner.red .brand span{background-image:url(../img/tentacle-20x20-light@2x.png)}}#navbar .navbar-inner.red .nav>li.dropdown.active>.dropdown-toggle,#navbar .navbar-inner.red .nav>li.dropdown.open.active>.dropdown-toggle,#navbar .navbar-inner.red .nav>li.dropdown.open>.dropdown-toggle{background-color:#a74f4a;background-image:-moz-linear-gradient(top,#802420,#e28e8a);background-image:-webkit-gradient(linear,0 0,0 100%,from(#802420),to(#e28e8a));background-image:-webkit-linear-gradient(top,#802420,#e28e8a);background-image:-o-linear-gradient(top,#802420,#e28e8a);background-image:linear-gradient(to bottom,#802420,#e28e8a);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff802420', endColorstr='#ffe28e8a', GradientType=0)}#navbar .navbar-inner.red .nav>li>a:hover{background-color:#af5651;background-image:-moz-linear-gradient(top,#dd7a75,#6b1f1b);background-image:-webkit-gradient(linear,0 0,0 100%,from(#dd7a75),to(#6b1f1b));background-image:-webkit-linear-gradient(top,#dd7a75,#6b1f1b);background-image:-o-linear-gradient(top,#dd7a75,#6b1f1b);background-image:linear-gradient(to bottom,#dd7a75,#6b1f1b);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdd7a75', endColorstr='#ff6b1f1b', GradientType=0)}#navbar .navbar-inner.red.transparent{background-color:rgba(187,100,95,.6);background-image:"../img/trans-background.png";background-image:-moz-linear-gradient(top,rgba(226,142,138,.6),rgba(128,36,32,.6)),url(../img/trans-background.png);background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(226,142,138,.6)),to(rgba(128,36,32,.6))),url(../img/trans-background.png);background-image:-webkit-linear-gradient(top,rgba(226,142,138,.6),rgba(128,36,32,.6)),url(../img/trans-background.png);background-image:-o-linear-gradient(top,rgba(226,142,138,.6),rgba(128,36,32,.6)),url(../img/trans-background.png);background-image:linear-gradient(to bottom,rgba(226,142,138,.6),rgba(128,36,32,.6)),url(../img/trans-background.png);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#99e28e8a', endColorstr='#99802420', GradientType=0)}#navbar .navbar-inner.red.transparent .brand,#navbar .navbar-inner.red.transparent .nav>li>a{text-shadow:0 1px 0 #d86761;color:#f2f2f2}#navbar .navbar-inner.red.transparent .brand .caret,#navbar .navbar-inner.red.transparent .nav>li>a .caret{border-bottom-color:#d89491;border-top-color:#d89491}#navbar .navbar-inner.red.transparent .brand:focus .caret,#navbar .navbar-inner.red.transparent .brand:hover .caret,#navbar .navbar-inner.red.transparent .nav>li>a:focus .caret,#navbar .navbar-inner.red.transparent .nav>li>a:hover .caret{border-bottom-color:#e5c3c1;border-top-color:#e5c3c1}#navbar .navbar-inner.red.transparent .brand span{background-image:url(../img/tentacle-20x20-light.png)}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){#navbar .navbar-inner.red.transparent .brand span{background-image:url(../img/tentacle-20x20-light@2x.png)}}#navbar .navbar-inner.red.transparent .nav>li.dropdown.active>.dropdown-toggle,#navbar .navbar-inner.red.transparent .nav>li.dropdown.open.active>.dropdown-toggle,#navbar .navbar-inner.red.transparent .nav>li.dropdown.open>.dropdown-toggle{background-color:rgba(167,79,74,.6);background-image:"../img/trans-background.png";background-image:-moz-linear-gradient(top,rgba(128,36,32,.6),rgba(226,142,138,.6)),url(../img/trans-background.png);background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(128,36,32,.6)),to(rgba(226,142,138,.6))),url(../img/trans-background.png);background-image:-webkit-linear-gradient(top,rgba(128,36,32,.6),rgba(226,142,138,.6)),url(../img/trans-background.png);background-image:-o-linear-gradient(top,rgba(128,36,32,.6),rgba(226,142,138,.6)),url(../img/trans-background.png);background-image:linear-gradient(to bottom,rgba(128,36,32,.6),rgba(226,142,138,.6)),url(../img/trans-background.png);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#99802420', endColorstr='#99e28e8a', GradientType=0)}#navbar .navbar-inner.red.transparent .nav>li>a:hover{background-color:rgba(175,86,81,.6);background-image:"../img/trans-background.png";background-image:-moz-linear-gradient(top,rgba(221,122,117,.6),rgba(107,31,27,.6)),url(../img/trans-background.png);background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(221,122,117,.6)),to(rgba(107,31,27,.6))),url(../img/trans-background.png);background-image:-webkit-linear-gradient(top,rgba(221,122,117,.6),rgba(107,31,27,.6)),url(../img/trans-background.png);background-image:-o-linear-gradient(top,rgba(221,122,117,.6),rgba(107,31,27,.6)),url(../img/trans-background.png);background-image:linear-gradient(to bottom,rgba(221,122,117,.6),rgba(107,31,27,.6)),url(../img/trans-background.png);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#99dd7a75', endColorstr='#996b1f1b', GradientType=0)}#navbar .navbar-inner.orange{background-color:#e39665;background-image:-moz-linear-gradient(top,#f9c3a0,#c2530c);background-image:-webkit-gradient(linear,0 0,0 100%,from(#f9c3a0),to(#c2530c));background-image:-webkit-linear-gradient(top,#f9c3a0,#c2530c);background-image:-o-linear-gradient(top,#f9c3a0,#c2530c);background-image:linear-gradient(to bottom,#f9c3a0,#c2530c);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff9c3a0', endColorstr='#ffc2530c', GradientType=0)}#navbar .navbar-inner.orange .brand,#navbar .navbar-inner.orange .nav>li>a{text-shadow:0 1px 0 #f6a570;color:#f2f2f2}#navbar .navbar-inner.orange .brand .caret,#navbar .navbar-inner.orange .nav>li>a .caret{border-bottom-color:#f2b58d;border-top-color:#f2b58d}#navbar .navbar-inner.orange .brand:focus .caret,#navbar .navbar-inner.orange .brand:hover .caret,#navbar .navbar-inner.orange .nav>li>a:focus .caret,#navbar .navbar-inner.orange .nav>li>a:hover .caret{border-bottom-color:#f2d3bf;border-top-color:#f2d3bf}#navbar .navbar-inner.orange .brand span{background-image:url(../img/tentacle-20x20-light.png)}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){#navbar .navbar-inner.orange .brand span{background-image:url(../img/tentacle-20x20-light@2x.png)}}#navbar .navbar-inner.orange .nav>li.dropdown.active>.dropdown-toggle,#navbar .navbar-inner.orange .nav>li.dropdown.open.active>.dropdown-toggle,#navbar .navbar-inner.orange .nav>li.dropdown.open>.dropdown-toggle{background-color:#d88047;background-image:-moz-linear-gradient(top,#c2530c,#f9c3a0);background-image:-webkit-gradient(linear,0 0,0 100%,from(#c2530c),to(#f9c3a0));background-image:-webkit-linear-gradient(top,#c2530c,#f9c3a0);background-image:-o-linear-gradient(top,#c2530c,#f9c3a0);background-image:linear-gradient(to bottom,#c2530c,#f9c3a0);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffc2530c', endColorstr='#fff9c3a0', GradientType=0)}#navbar .navbar-inner.orange .nav>li>a:hover{background-color:#d98956;background-image:-moz-linear-gradient(top,#f8b488,#aa490a);background-image:-webkit-gradient(linear,0 0,0 100%,from(#f8b488),to(#aa490a));background-image:-webkit-linear-gradient(top,#f8b488,#aa490a);background-image:-o-linear-gradient(top,#f8b488,#aa490a);background-image:linear-gradient(to bottom,#f8b488,#aa490a);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff8b488', endColorstr='#ffaa490a', GradientType=0)}#navbar .navbar-inner.orange.transparent{background-color:rgba(227,150,101,.6);background-image:"../img/trans-background.png";background-image:-moz-linear-gradient(top,rgba(249,195,160,.6),rgba(194,83,12,.6)),url(../img/trans-background.png);background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(249,195,160,.6)),to(rgba(194,83,12,.6))),url(../img/trans-background.png);background-image:-webkit-linear-gradient(top,rgba(249,195,160,.6),rgba(194,83,12,.6)),url(../img/trans-background.png);background-image:-o-linear-gradient(top,rgba(249,195,160,.6),rgba(194,83,12,.6)),url(../img/trans-background.png);background-image:linear-gradient(to bottom,rgba(249,195,160,.6),rgba(194,83,12,.6)),url(../img/trans-background.png);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#99f9c3a0', endColorstr='#99c2530c', GradientType=0)}#navbar .navbar-inner.orange.transparent .brand,#navbar .navbar-inner.orange.transparent .nav>li>a{text-shadow:0 1px 0 #f6a570;color:#f2f2f2}#navbar .navbar-inner.orange.transparent .brand .caret,#navbar .navbar-inner.orange.transparent .nav>li>a .caret{border-bottom-color:#f2b58d;border-top-color:#f2b58d}#navbar .navbar-inner.orange.transparent .brand:focus .caret,#navbar .navbar-inner.orange.transparent .brand:hover .caret,#navbar .navbar-inner.orange.transparent .nav>li>a:focus .caret,#navbar .navbar-inner.orange.transparent .nav>li>a:hover .caret{border-bottom-color:#f2d3bf;border-top-color:#f2d3bf}#navbar .navbar-inner.orange.transparent .brand span{background-image:url(../img/tentacle-20x20-light.png)}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){#navbar .navbar-inner.orange.transparent .brand span{background-image:url(../img/tentacle-20x20-light@2x.png)}}#navbar .navbar-inner.orange.transparent .nav>li.dropdown.active>.dropdown-toggle,#navbar .navbar-inner.orange.transparent .nav>li.dropdown.open.active>.dropdown-toggle,#navbar .navbar-inner.orange.transparent .nav>li.dropdown.open>.dropdown-toggle{background-color:rgba(216,128,71,.6);background-image:"../img/trans-background.png";background-image:-moz-linear-gradient(top,rgba(194,83,12,.6),rgba(249,195,160,.6)),url(../img/trans-background.png);background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(194,83,12,.6)),to(rgba(249,195,160,.6))),url(../img/trans-background.png);background-image:-webkit-linear-gradient(top,rgba(194,83,12,.6),rgba(249,195,160,.6)),url(../img/trans-background.png);background-image:-o-linear-gradient(top,rgba(194,83,12,.6),rgba(249,195,160,.6)),url(../img/trans-background.png);background-image:linear-gradient(to bottom,rgba(194,83,12,.6),rgba(249,195,160,.6)),url(../img/trans-background.png);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#99c2530c', endColorstr='#99f9c3a0', GradientType=0)}#navbar .navbar-inner.orange.transparent .nav>li>a:hover{background-color:rgba(217,137,86,.6);background-image:"../img/trans-background.png";background-image:-moz-linear-gradient(top,rgba(248,180,136,.6),rgba(170,73,10,.6)),url(../img/trans-background.png);background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(248,180,136,.6)),to(rgba(170,73,10,.6))),url(../img/trans-background.png);background-image:-webkit-linear-gradient(top,rgba(248,180,136,.6),rgba(170,73,10,.6)),url(../img/trans-background.png);background-image:-o-linear-gradient(top,rgba(248,180,136,.6),rgba(170,73,10,.6)),url(../img/trans-background.png);background-image:linear-gradient(to bottom,rgba(248,180,136,.6),rgba(170,73,10,.6)),url(../img/trans-background.png);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#99f8b488', endColorstr='#99aa490a', GradientType=0)}#navbar .navbar-inner.yellow{background-color:#e3d765;background-image:-moz-linear-gradient(top,#f9f0a0,#c2b00c);background-image:-webkit-gradient(linear,0 0,0 100%,from(#f9f0a0),to(#c2b00c));background-image:-webkit-linear-gradient(top,#f9f0a0,#c2b00c);background-image:-o-linear-gradient(top,#f9f0a0,#c2b00c);background-image:linear-gradient(to bottom,#f9f0a0,#c2b00c);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff9f0a0', endColorstr='#ffc2b00c', GradientType=0)}#navbar .navbar-inner.yellow .brand,#navbar .navbar-inner.yellow .nav>li>a{text-shadow:0 1px 0 #c2b00c;color:#f2f2f2}#navbar .navbar-inner.yellow .brand .caret,#navbar .navbar-inner.yellow .nav>li>a .caret{border-bottom-color:#f2e88d;border-top-color:#f2e88d}#navbar .navbar-inner.yellow .brand:focus .caret,#navbar .navbar-inner.yellow .brand:hover .caret,#navbar .navbar-inner.yellow .nav>li>a:focus .caret,#navbar .navbar-inner.yellow .nav>li>a:hover .caret{border-bottom-color:#f2edbf;border-top-color:#f2edbf}#navbar .navbar-inner.yellow .brand span{background-image:url(../img/tentacle-20x20-light.png)}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){#navbar .navbar-inner.yellow .brand span{background-image:url(../img/tentacle-20x20-light@2x.png)}}#navbar .navbar-inner.yellow .nav>li.dropdown.active>.dropdown-toggle,#navbar .navbar-inner.yellow .nav>li.dropdown.open.active>.dropdown-toggle,#navbar .navbar-inner.yellow .nav>li.dropdown.open>.dropdown-toggle{background-color:#d8ca47;background-image:-moz-linear-gradient(top,#c2b00c,#f9f0a0);background-image:-webkit-gradient(linear,0 0,0 100%,from(#c2b00c),to(#f9f0a0));background-image:-webkit-linear-gradient(top,#c2b00c,#f9f0a0);background-image:-o-linear-gradient(top,#c2b00c,#f9f0a0);background-image:linear-gradient(to bottom,#c2b00c,#f9f0a0);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffc2b00c', endColorstr='#fff9f0a0', GradientType=0)}#navbar .navbar-inner.yellow .nav>li>a:hover{background-color:#d9cc56;background-image:-moz-linear-gradient(top,#f8ed88,#aa9a0a);background-image:-webkit-gradient(linear,0 0,0 100%,from(#f8ed88),to(#aa9a0a));background-image:-webkit-linear-gradient(top,#f8ed88,#aa9a0a);background-image:-o-linear-gradient(top,#f8ed88,#aa9a0a);background-image:linear-gradient(to bottom,#f8ed88,#aa9a0a);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff8ed88', endColorstr='#ffaa9a0a', GradientType=0)}#navbar .navbar-inner.yellow.transparent{background-color:rgba(227,215,101,.6);background-image:"../img/trans-background.png";background-image:-moz-linear-gradient(top,rgba(249,240,160,.6),rgba(194,176,12,.6)),url(../img/trans-background.png);background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(249,240,160,.6)),to(rgba(194,176,12,.6))),url(../img/trans-background.png);background-image:-webkit-linear-gradient(top,rgba(249,240,160,.6),rgba(194,176,12,.6)),url(../img/trans-background.png);background-image:-o-linear-gradient(top,rgba(249,240,160,.6),rgba(194,176,12,.6)),url(../img/trans-background.png);background-image:linear-gradient(to bottom,rgba(249,240,160,.6),rgba(194,176,12,.6)),url(../img/trans-background.png);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#99f9f0a0', endColorstr='#99c2b00c', GradientType=0)}#navbar .navbar-inner.yellow.transparent .brand,#navbar .navbar-inner.yellow.transparent .nav>li>a{text-shadow:0 1px 0 #c2b00c;color:#f2f2f2}#navbar .navbar-inner.yellow.transparent .brand .caret,#navbar .navbar-inner.yellow.transparent .nav>li>a .caret{border-bottom-color:#f2e88d;border-top-color:#f2e88d}#navbar .navbar-inner.yellow.transparent .brand:focus .caret,#navbar .navbar-inner.yellow.transparent .brand:hover .caret,#navbar .navbar-inner.yellow.transparent .nav>li>a:focus .caret,#navbar .navbar-inner.yellow.transparent .nav>li>a:hover .caret{border-bottom-color:#f2edbf;border-top-color:#f2edbf}#navbar .navbar-inner.yellow.transparent .brand span{background-image:url(../img/tentacle-20x20-light.png)}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){#navbar .navbar-inner.yellow.transparent .brand span{background-image:url(../img/tentacle-20x20-light@2x.png)}}#navbar .navbar-inner.yellow.transparent .nav>li.dropdown.active>.dropdown-toggle,#navbar .navbar-inner.yellow.transparent .nav>li.dropdown.open.active>.dropdown-toggle,#navbar .navbar-inner.yellow.transparent .nav>li.dropdown.open>.dropdown-toggle{background-color:rgba(216,202,71,.6);background-image:"../img/trans-background.png";background-image:-moz-linear-gradient(top,rgba(194,176,12,.6),rgba(249,240,160,.6)),url(../img/trans-background.png);background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(194,176,12,.6)),to(rgba(249,240,160,.6))),url(../img/trans-background.png);background-image:-webkit-linear-gradient(top,rgba(194,176,12,.6),rgba(249,240,160,.6)),url(../img/trans-background.png);background-image:-o-linear-gradient(top,rgba(194,176,12,.6),rgba(249,240,160,.6)),url(../img/trans-background.png);background-image:linear-gradient(to bottom,rgba(194,176,12,.6),rgba(249,240,160,.6)),url(../img/trans-background.png);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#99c2b00c', endColorstr='#99f9f0a0', GradientType=0)}#navbar .navbar-inner.yellow.transparent .nav>li>a:hover{background-color:rgba(217,204,86,.6);background-image:"../img/trans-background.png";background-image:-moz-linear-gradient(top,rgba(248,237,136,.6),rgba(170,154,10,.6)),url(../img/trans-background.png);background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(248,237,136,.6)),to(rgba(170,154,10,.6))),url(../img/trans-background.png);background-image:-webkit-linear-gradient(top,rgba(248,237,136,.6),rgba(170,154,10,.6)),url(../img/trans-background.png);background-image:-o-linear-gradient(top,rgba(248,237,136,.6),rgba(170,154,10,.6)),url(../img/trans-background.png);background-image:linear-gradient(to bottom,rgba(248,237,136,.6),rgba(170,154,10,.6)),url(../img/trans-background.png);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#99f8ed88', endColorstr='#99aa9a0a', GradientType=0)}#navbar .navbar-inner.green{background-color:#98f064;background-image:-moz-linear-gradient(top,#c8ffa7,#50da00);background-image:-webkit-gradient(linear,0 0,0 100%,from(#c8ffa7),to(#50da00));background-image:-webkit-linear-gradient(top,#c8ffa7,#50da00);background-image:-o-linear-gradient(top,#c8ffa7,#50da00);background-image:linear-gradient(to bottom,#c8ffa7,#50da00);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffc8ffa7', endColorstr='#ff50da00', GradientType=0)}#navbar .navbar-inner.green .brand,#navbar .navbar-inner.green .nav>li>a{text-shadow:0 1px 0 #50da00;color:#333}#navbar .navbar-inner.green .brand .caret,#navbar .navbar-inner.green .nav>li>a .caret{border-bottom-color:#55992e;border-top-color:#55992e}#navbar .navbar-inner.green .brand:focus .caret,#navbar .navbar-inner.green .brand:hover .caret,#navbar .navbar-inner.green .nav>li>a:focus .caret,#navbar .navbar-inner.green .nav>li>a:hover .caret{border-bottom-color:#446630;border-top-color:#446630}#navbar .navbar-inner.green .brand span{background-image:url(../img/tentacle-20x20.png)}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){#navbar .navbar-inner.green .brand span{background-image:url(../img/tentacle-20x20@2x.png)}}#navbar .navbar-inner.green .nav>li.dropdown.active>.dropdown-toggle,#navbar .navbar-inner.green .nav>li.dropdown.open.active>.dropdown-toggle,#navbar .navbar-inner.green .nav>li.dropdown.open>.dropdown-toggle{background-color:#80e943;background-image:-moz-linear-gradient(top,#50da00,#c8ffa7);background-image:-webkit-gradient(linear,0 0,0 100%,from(#50da00),to(#c8ffa7));background-image:-webkit-linear-gradient(top,#50da00,#c8ffa7);background-image:-o-linear-gradient(top,#50da00,#c8ffa7);background-image:linear-gradient(to bottom,#50da00,#c8ffa7);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff50da00', endColorstr='#ffc8ffa7', GradientType=0)}#navbar .navbar-inner.green .nav>li>a:hover{background-color:#8ae655;background-image:-moz-linear-gradient(top,#b8ff8e,#47c100);background-image:-webkit-gradient(linear,0 0,0 100%,from(#b8ff8e),to(#47c100));background-image:-webkit-linear-gradient(top,#b8ff8e,#47c100);background-image:-o-linear-gradient(top,#b8ff8e,#47c100);background-image:linear-gradient(to bottom,#b8ff8e,#47c100);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffb8ff8e', endColorstr='#ff47c100', GradientType=0)}#navbar .navbar-inner.green.transparent{background-color:rgba(152,240,100,.6);background-image:"../img/trans-background.png";background-image:-moz-linear-gradient(top,rgba(200,255,167,.6),rgba(80,218,0,.6)),url(../img/trans-background.png);background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(200,255,167,.6)),to(rgba(80,218,0,.6))),url(../img/trans-background.png);background-image:-webkit-linear-gradient(top,rgba(200,255,167,.6),rgba(80,218,0,.6)),url(../img/trans-background.png);background-image:-o-linear-gradient(top,rgba(200,255,167,.6),rgba(80,218,0,.6)),url(../img/trans-background.png);background-image:linear-gradient(to bottom,rgba(200,255,167,.6),rgba(80,218,0,.6)),url(../img/trans-background.png);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#99c8ffa7', endColorstr='#9950da00', GradientType=0)}#navbar .navbar-inner.green.transparent .brand,#navbar .navbar-inner.green.transparent .nav>li>a{text-shadow:0 1px 0 #50da00;color:#333}#navbar .navbar-inner.green.transparent .brand .caret,#navbar .navbar-inner.green.transparent .nav>li>a .caret{border-bottom-color:#55992e;border-top-color:#55992e}#navbar .navbar-inner.green.transparent .brand:focus .caret,#navbar .navbar-inner.green.transparent .brand:hover .caret,#navbar .navbar-inner.green.transparent .nav>li>a:focus .caret,#navbar .navbar-inner.green.transparent .nav>li>a:hover .caret{border-bottom-color:#446630;border-top-color:#446630}#navbar .navbar-inner.green.transparent .brand span{background-image:url(../img/tentacle-20x20.png)}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){#navbar .navbar-inner.green.transparent .brand span{background-image:url(../img/tentacle-20x20@2x.png)}}#navbar .navbar-inner.green.transparent .nav>li.dropdown.active>.dropdown-toggle,#navbar .navbar-inner.green.transparent .nav>li.dropdown.open.active>.dropdown-toggle,#navbar .navbar-inner.green.transparent .nav>li.dropdown.open>.dropdown-toggle{background-color:rgba(128,233,67,.6);background-image:"../img/trans-background.png";background-image:-moz-linear-gradient(top,rgba(80,218,0,.6),rgba(200,255,167,.6)),url(../img/trans-background.png);background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(80,218,0,.6)),to(rgba(200,255,167,.6))),url(../img/trans-background.png);background-image:-webkit-linear-gradient(top,rgba(80,218,0,.6),rgba(200,255,167,.6)),url(../img/trans-background.png);background-image:-o-linear-gradient(top,rgba(80,218,0,.6),rgba(200,255,167,.6)),url(../img/trans-background.png);background-image:linear-gradient(to bottom,rgba(80,218,0,.6),rgba(200,255,167,.6)),url(../img/trans-background.png);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#9950da00', endColorstr='#99c8ffa7', GradientType=0)}#navbar .navbar-inner.green.transparent .nav>li>a:hover{background-color:rgba(138,230,85,.6);background-image:"../img/trans-background.png";background-image:-moz-linear-gradient(top,rgba(184,255,142,.6),rgba(71,193,0,.6)),url(../img/trans-background.png);background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(184,255,142,.6)),to(rgba(71,193,0,.6))),url(../img/trans-background.png);background-image:-webkit-linear-gradient(top,rgba(184,255,142,.6),rgba(71,193,0,.6)),url(../img/trans-background.png);background-image:-o-linear-gradient(top,rgba(184,255,142,.6),rgba(71,193,0,.6)),url(../img/trans-background.png);background-image:linear-gradient(to bottom,rgba(184,255,142,.6),rgba(71,193,0,.6)),url(../img/trans-background.png);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#99b8ff8e', endColorstr='#9947c100', GradientType=0)}#navbar .navbar-inner.blue{background-color:#2e63cc;background-image:-moz-linear-gradient(top,#4d88ff,#002b80);background-image:-webkit-gradient(linear,0 0,0 100%,from(#4d88ff),to(#002b80));background-image:-webkit-linear-gradient(top,#4d88ff,#002b80);background-image:-o-linear-gradient(top,#4d88ff,#002b80);background-image:linear-gradient(to bottom,#4d88ff,#002b80);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff4d88ff', endColorstr='#ff002b80', GradientType=0)}#navbar .navbar-inner.blue .brand,#navbar .navbar-inner.blue .nav>li>a{text-shadow:0 1px 0 #1a66ff;color:#f2f2f2}#navbar .navbar-inner.blue .brand .caret,#navbar .navbar-inner.blue .nav>li>a .caret{border-bottom-color:#799bdf;border-top-color:#799bdf}#navbar .navbar-inner.blue .brand:focus .caret,#navbar .navbar-inner.blue .brand:hover .caret,#navbar .navbar-inner.blue .nav>li>a:focus .caret,#navbar .navbar-inner.blue .nav>li>a:hover .caret{border-bottom-color:#b6c7e9;border-top-color:#b6c7e9}#navbar .navbar-inner.blue .brand span{background-image:url(../img/tentacle-20x20-light.png)}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){#navbar .navbar-inner.blue .brand span{background-image:url(../img/tentacle-20x20-light@2x.png)}}#navbar .navbar-inner.blue .nav>li.dropdown.active>.dropdown-toggle,#navbar .navbar-inner.blue .nav>li.dropdown.open.active>.dropdown-toggle,#navbar .navbar-inner.blue .nav>li.dropdown.open>.dropdown-toggle{background-color:#1f50b3;background-image:-moz-linear-gradient(top,#002b80,#4d88ff);background-image:-webkit-gradient(linear,0 0,0 100%,from(#002b80),to(#4d88ff));background-image:-webkit-linear-gradient(top,#002b80,#4d88ff);background-image:-o-linear-gradient(top,#002b80,#4d88ff);background-image:linear-gradient(to bottom,#002b80,#4d88ff);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff002b80', endColorstr='#ff4d88ff', GradientType=0)}#navbar .navbar-inner.blue .nav>li>a:hover{background-color:#1f55c2;background-image:-moz-linear-gradient(top,#37f,#026);background-image:-webkit-gradient(linear,0 0,0 100%,from(#37f),to(#026));background-image:-webkit-linear-gradient(top,#37f,#026);background-image:-o-linear-gradient(top,#37f,#026);background-image:linear-gradient(to bottom,#37f,#026);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff3377ff', endColorstr='#ff002266', GradientType=0)}#navbar .navbar-inner.blue.transparent{background-color:rgba(46,99,204,.6);background-image:"../img/trans-background.png";background-image:-moz-linear-gradient(top,rgba(77,136,255,.6),rgba(0,43,128,.6)),url(../img/trans-background.png);background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(77,136,255,.6)),to(rgba(0,43,128,.6))),url(../img/trans-background.png);background-image:-webkit-linear-gradient(top,rgba(77,136,255,.6),rgba(0,43,128,.6)),url(../img/trans-background.png);background-image:-o-linear-gradient(top,rgba(77,136,255,.6),rgba(0,43,128,.6)),url(../img/trans-background.png);background-image:linear-gradient(to bottom,rgba(77,136,255,.6),rgba(0,43,128,.6)),url(../img/trans-background.png);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#994d88ff', endColorstr='#99002b80', GradientType=0)}#navbar .navbar-inner.blue.transparent .brand,#navbar .navbar-inner.blue.transparent .nav>li>a{text-shadow:0 1px 0 #1a66ff;color:#f2f2f2}#navbar .navbar-inner.blue.transparent .brand .caret,#navbar .navbar-inner.blue.transparent .nav>li>a .caret{border-bottom-color:#799bdf;border-top-color:#799bdf}#navbar .navbar-inner.blue.transparent .brand:focus .caret,#navbar .navbar-inner.blue.transparent .brand:hover .caret,#navbar .navbar-inner.blue.transparent .nav>li>a:focus .caret,#navbar .navbar-inner.blue.transparent .nav>li>a:hover .caret{border-bottom-color:#b6c7e9;border-top-color:#b6c7e9}#navbar .navbar-inner.blue.transparent .brand span{background-image:url(../img/tentacle-20x20-light.png)}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){#navbar .navbar-inner.blue.transparent .brand span{background-image:url(../img/tentacle-20x20-light@2x.png)}}#navbar .navbar-inner.blue.transparent .nav>li.dropdown.active>.dropdown-toggle,#navbar .navbar-inner.blue.transparent .nav>li.dropdown.open.active>.dropdown-toggle,#navbar .navbar-inner.blue.transparent .nav>li.dropdown.open>.dropdown-toggle{background-color:rgba(31,80,179,.6);background-image:"../img/trans-background.png";background-image:-moz-linear-gradient(top,rgba(0,43,128,.6),rgba(77,136,255,.6)),url(../img/trans-background.png);background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(0,43,128,.6)),to(rgba(77,136,255,.6))),url(../img/trans-background.png);background-image:-webkit-linear-gradient(top,rgba(0,43,128,.6),rgba(77,136,255,.6)),url(../img/trans-background.png);background-image:-o-linear-gradient(top,rgba(0,43,128,.6),rgba(77,136,255,.6)),url(../img/trans-background.png);background-image:linear-gradient(to bottom,rgba(0,43,128,.6),rgba(77,136,255,.6)),url(../img/trans-background.png);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#99002b80', endColorstr='#994d88ff', GradientType=0)}#navbar .navbar-inner.blue.transparent .nav>li>a:hover{background-color:rgba(31,85,194,.6);background-image:"../img/trans-background.png";background-image:-moz-linear-gradient(top,rgba(51,119,255,.6),rgba(0,34,102,.6)),url(../img/trans-background.png);background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(51,119,255,.6)),to(rgba(0,34,102,.6))),url(../img/trans-background.png);background-image:-webkit-linear-gradient(top,rgba(51,119,255,.6),rgba(0,34,102,.6)),url(../img/trans-background.png);background-image:-o-linear-gradient(top,rgba(51,119,255,.6),rgba(0,34,102,.6)),url(../img/trans-background.png);background-image:linear-gradient(to bottom,rgba(51,119,255,.6),rgba(0,34,102,.6)),url(../img/trans-background.png);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#993377ff', endColorstr='#99002266', GradientType=0)}#navbar .navbar-inner.violet{background-color:#9864f0;background-image:-moz-linear-gradient(top,#c8a7ff,#5000da);background-image:-webkit-gradient(linear,0 0,0 100%,from(#c8a7ff),to(#5000da));background-image:-webkit-linear-gradient(top,#c8a7ff,#5000da);background-image:-o-linear-gradient(top,#c8a7ff,#5000da);background-image:linear-gradient(to bottom,#c8a7ff,#5000da);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffc8a7ff', endColorstr='#ff5000da', GradientType=0)}#navbar .navbar-inner.violet .brand,#navbar .navbar-inner.violet .nav>li>a{text-shadow:0 1px 0 #a774ff;color:#f2f2f2}#navbar .navbar-inner.violet .brand .caret,#navbar .navbar-inner.violet .nav>li>a .caret{border-bottom-color:#b58df9;border-top-color:#b58df9}#navbar .navbar-inner.violet .brand:focus .caret,#navbar .navbar-inner.violet .brand:hover .caret,#navbar .navbar-inner.violet .nav>li>a:focus .caret,#navbar .navbar-inner.violet .nav>li>a:hover .caret{border-bottom-color:#d3bff5;border-top-color:#d3bff5}#navbar .navbar-inner.violet .brand span{background-image:url(../img/tentacle-20x20-light.png)}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){#navbar .navbar-inner.violet .brand span{background-image:url(../img/tentacle-20x20-light@2x.png)}}#navbar .navbar-inner.violet .nav>li.dropdown.active>.dropdown-toggle,#navbar .navbar-inner.violet .nav>li.dropdown.open.active>.dropdown-toggle,#navbar .navbar-inner.violet .nav>li.dropdown.open>.dropdown-toggle{background-color:#8043e9;background-image:-moz-linear-gradient(top,#5000da,#c8a7ff);background-image:-webkit-gradient(linear,0 0,0 100%,from(#5000da),to(#c8a7ff));background-image:-webkit-linear-gradient(top,#5000da,#c8a7ff);background-image:-o-linear-gradient(top,#5000da,#c8a7ff);background-image:linear-gradient(to bottom,#5000da,#c8a7ff);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5000da', endColorstr='#ffc8a7ff', GradientType=0)}#navbar .navbar-inner.violet .nav>li>a:hover{background-color:#8a55e6;background-image:-moz-linear-gradient(top,#b88eff,#4700c1);background-image:-webkit-gradient(linear,0 0,0 100%,from(#b88eff),to(#4700c1));background-image:-webkit-linear-gradient(top,#b88eff,#4700c1);background-image:-o-linear-gradient(top,#b88eff,#4700c1);background-image:linear-gradient(to bottom,#b88eff,#4700c1);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffb88eff', endColorstr='#ff4700c1', GradientType=0)}#navbar .navbar-inner.violet.transparent{background-color:rgba(152,100,240,.6);background-image:"../img/trans-background.png";background-image:-moz-linear-gradient(top,rgba(200,167,255,.6),rgba(80,0,218,.6)),url(../img/trans-background.png);background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(200,167,255,.6)),to(rgba(80,0,218,.6))),url(../img/trans-background.png);background-image:-webkit-linear-gradient(top,rgba(200,167,255,.6),rgba(80,0,218,.6)),url(../img/trans-background.png);background-image:-o-linear-gradient(top,rgba(200,167,255,.6),rgba(80,0,218,.6)),url(../img/trans-background.png);background-image:linear-gradient(to bottom,rgba(200,167,255,.6),rgba(80,0,218,.6)),url(../img/trans-background.png);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#99c8a7ff', endColorstr='#995000da', GradientType=0)}#navbar .navbar-inner.violet.transparent .brand,#navbar .navbar-inner.violet.transparent .nav>li>a{text-shadow:0 1px 0 #a774ff;color:#f2f2f2}#navbar .navbar-inner.violet.transparent .brand .caret,#navbar .navbar-inner.violet.transparent .nav>li>a .caret{border-bottom-color:#b58df9;border-top-color:#b58df9}#navbar .navbar-inner.violet.transparent .brand:focus .caret,#navbar .navbar-inner.violet.transparent .brand:hover .caret,#navbar .navbar-inner.violet.transparent .nav>li>a:focus .caret,#navbar .navbar-inner.violet.transparent .nav>li>a:hover .caret{border-bottom-color:#d3bff5;border-top-color:#d3bff5}#navbar .navbar-inner.violet.transparent .brand span{background-image:url(../img/tentacle-20x20-light.png)}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){#navbar .navbar-inner.violet.transparent .brand span{background-image:url(../img/tentacle-20x20-light@2x.png)}}#navbar .navbar-inner.violet.transparent .nav>li.dropdown.active>.dropdown-toggle,#navbar .navbar-inner.violet.transparent .nav>li.dropdown.open.active>.dropdown-toggle,#navbar .navbar-inner.violet.transparent .nav>li.dropdown.open>.dropdown-toggle{background-color:rgba(128,67,233,.6);background-image:"../img/trans-background.png";background-image:-moz-linear-gradient(top,rgba(80,0,218,.6),rgba(200,167,255,.6)),url(../img/trans-background.png);background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(80,0,218,.6)),to(rgba(200,167,255,.6))),url(../img/trans-background.png);background-image:-webkit-linear-gradient(top,rgba(80,0,218,.6),rgba(200,167,255,.6)),url(../img/trans-background.png);background-image:-o-linear-gradient(top,rgba(80,0,218,.6),rgba(200,167,255,.6)),url(../img/trans-background.png);background-image:linear-gradient(to bottom,rgba(80,0,218,.6),rgba(200,167,255,.6)),url(../img/trans-background.png);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#995000da', endColorstr='#99c8a7ff', GradientType=0)}#navbar .navbar-inner.violet.transparent .nav>li>a:hover{background-color:rgba(138,85,230,.6);background-image:"../img/trans-background.png";background-image:-moz-linear-gradient(top,rgba(184,142,255,.6),rgba(71,0,193,.6)),url(../img/trans-background.png);background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(184,142,255,.6)),to(rgba(71,0,193,.6))),url(../img/trans-background.png);background-image:-webkit-linear-gradient(top,rgba(184,142,255,.6),rgba(71,0,193,.6)),url(../img/trans-background.png);background-image:-o-linear-gradient(top,rgba(184,142,255,.6),rgba(71,0,193,.6)),url(../img/trans-background.png);background-image:linear-gradient(to bottom,rgba(184,142,255,.6),rgba(71,0,193,.6)),url(../img/trans-background.png);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#99b88eff', endColorstr='#994700c1', GradientType=0)}#navbar .navbar-inner.black{background-color:#4f4f4f;background-image:-moz-linear-gradient(top,#787878,#121212);background-image:-webkit-gradient(linear,0 0,0 100%,from(#787878),to(#121212));background-image:-webkit-linear-gradient(top,#787878,#121212);background-image:-o-linear-gradient(top,#787878,#121212);background-image:linear-gradient(to bottom,#787878,#121212);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff787878', endColorstr='#ff121212', GradientType=0)}#navbar .navbar-inner.black .brand,#navbar .navbar-inner.black .nav>li>a{text-shadow:0 1px 0 #5e5e5e;color:#f2f2f2}#navbar .navbar-inner.black .brand .caret,#navbar .navbar-inner.black .nav>li>a .caret{border-bottom-color:#959595;border-top-color:#959595}#navbar .navbar-inner.black .brand:focus .caret,#navbar .navbar-inner.black .brand:hover .caret,#navbar .navbar-inner.black .nav>li>a:focus .caret,#navbar .navbar-inner.black .nav>li>a:hover .caret{border-bottom-color:#c4c4c4;border-top-color:#c4c4c4}#navbar .navbar-inner.black .brand span{background-image:url(../img/tentacle-20x20-light.png)}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){#navbar .navbar-inner.black .brand span{background-image:url(../img/tentacle-20x20-light@2x.png)}}#navbar .navbar-inner.black .nav>li.dropdown.active>.dropdown-toggle,#navbar .navbar-inner.black .nav>li.dropdown.open.active>.dropdown-toggle,#navbar .navbar-inner.black .nav>li.dropdown.open>.dropdown-toggle{background-color:#3b3b3b;background-image:-moz-linear-gradient(top,#121212,#787878);background-image:-webkit-gradient(linear,0 0,0 100%,from(#121212),to(#787878));background-image:-webkit-linear-gradient(top,#121212,#787878);background-image:-o-linear-gradient(top,#121212,#787878);background-image:linear-gradient(to bottom,#121212,#787878);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff121212', endColorstr='#ff787878', GradientType=0)}#navbar .navbar-inner.black .nav>li>a:hover{background-color:#424242;background-image:-moz-linear-gradient(top,#6b6b6b,#050505);background-image:-webkit-gradient(linear,0 0,0 100%,from(#6b6b6b),to(#050505));background-image:-webkit-linear-gradient(top,#6b6b6b,#050505);background-image:-o-linear-gradient(top,#6b6b6b,#050505);background-image:linear-gradient(to bottom,#6b6b6b,#050505);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff6b6b6b', endColorstr='#ff050505', GradientType=0)}#navbar .navbar-inner.black.transparent{background-color:rgba(79,79,79,.6);background-image:"../img/trans-background.png";background-image:-moz-linear-gradient(top,rgba(120,120,120,.6),rgba(18,18,18,.6)),url(../img/trans-background.png);background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(120,120,120,.6)),to(rgba(18,18,18,.6))),url(../img/trans-background.png);background-image:-webkit-linear-gradient(top,rgba(120,120,120,.6),rgba(18,18,18,.6)),url(../img/trans-background.png);background-image:-o-linear-gradient(top,rgba(120,120,120,.6),rgba(18,18,18,.6)),url(../img/trans-background.png);background-image:linear-gradient(to bottom,rgba(120,120,120,.6),rgba(18,18,18,.6)),url(../img/trans-background.png);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#99787878', endColorstr='#99121212', GradientType=0)}#navbar .navbar-inner.black.transparent .brand,#navbar .navbar-inner.black.transparent .nav>li>a{text-shadow:0 1px 0 #5e5e5e;color:#f2f2f2}#navbar .navbar-inner.black.transparent .brand .caret,#navbar .navbar-inner.black.transparent .nav>li>a .caret{border-bottom-color:#959595;border-top-color:#959595}#navbar .navbar-inner.black.transparent .brand:focus .caret,#navbar .navbar-inner.black.transparent .brand:hover .caret,#navbar .navbar-inner.black.transparent .nav>li>a:focus .caret,#navbar .navbar-inner.black.transparent .nav>li>a:hover .caret{border-bottom-color:#c4c4c4;border-top-color:#c4c4c4}#navbar .navbar-inner.black.transparent .brand span{background-image:url(../img/tentacle-20x20-light.png)}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){#navbar .navbar-inner.black.transparent .brand span{background-image:url(../img/tentacle-20x20-light@2x.png)}}#navbar .navbar-inner.black.transparent .nav>li.dropdown.active>.dropdown-toggle,#navbar .navbar-inner.black.transparent .nav>li.dropdown.open.active>.dropdown-toggle,#navbar .navbar-inner.black.transparent .nav>li.dropdown.open>.dropdown-toggle{background-color:rgba(59,59,59,.6);background-image:"../img/trans-background.png";background-image:-moz-linear-gradient(top,rgba(18,18,18,.6),rgba(120,120,120,.6)),url(../img/trans-background.png);background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(18,18,18,.6)),to(rgba(120,120,120,.6))),url(../img/trans-background.png);background-image:-webkit-linear-gradient(top,rgba(18,18,18,.6),rgba(120,120,120,.6)),url(../img/trans-background.png);background-image:-o-linear-gradient(top,rgba(18,18,18,.6),rgba(120,120,120,.6)),url(../img/trans-background.png);background-image:linear-gradient(to bottom,rgba(18,18,18,.6),rgba(120,120,120,.6)),url(../img/trans-background.png);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#99121212', endColorstr='#99787878', GradientType=0)}#navbar .navbar-inner.black.transparent .nav>li>a:hover{background-color:rgba(66,66,66,.6);background-image:"../img/trans-background.png";background-image:-moz-linear-gradient(top,rgba(107,107,107,.6),rgba(5,5,5,.6)),url(../img/trans-background.png);background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(107,107,107,.6)),to(rgba(5,5,5,.6))),url(../img/trans-background.png);background-image:-webkit-linear-gradient(top,rgba(107,107,107,.6),rgba(5,5,5,.6)),url(../img/trans-background.png);background-image:-o-linear-gradient(top,rgba(107,107,107,.6),rgba(5,5,5,.6)),url(../img/trans-background.png);background-image:linear-gradient(to bottom,rgba(107,107,107,.6),rgba(5,5,5,.6)),url(../img/trans-background.png);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#996b6b6b', endColorstr='#99050505', GradientType=0)}#navbar .navbar-inner.white{background-color:#e9e9e9;background-image:-moz-linear-gradient(top,#fff,#c8c8c8);background-image:-webkit-gradient(linear,0 0,0 100%,from(#fff),to(#c8c8c8));background-image:-webkit-linear-gradient(top,#fff,#c8c8c8);background-image:-o-linear-gradient(top,#fff,#c8c8c8);background-image:linear-gradient(to bottom,#fff,#c8c8c8);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffc8c8c8', GradientType=0)}#navbar .navbar-inner.white .brand,#navbar .navbar-inner.white .nav>li>a{text-shadow:0 1px 0 #c8c8c8;color:#333}#navbar .navbar-inner.white .brand .caret,#navbar .navbar-inner.white .nav>li>a .caret{border-bottom-color:#919191;border-top-color:#919191}#navbar .navbar-inner.white .brand:focus .caret,#navbar .navbar-inner.white .brand:hover .caret,#navbar .navbar-inner.white .nav>li>a:focus .caret,#navbar .navbar-inner.white .nav>li>a:hover .caret{border-bottom-color:#626262;border-top-color:#626262}#navbar .navbar-inner.white .brand span{background-image:url(../img/tentacle-20x20.png)}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){#navbar .navbar-inner.white .brand span{background-image:url(../img/tentacle-20x20@2x.png)}}#navbar .navbar-inner.white .nav>li.dropdown.active>.dropdown-toggle,#navbar .navbar-inner.white .nav>li.dropdown.open.active>.dropdown-toggle,#navbar .navbar-inner.white .nav>li.dropdown.open>.dropdown-toggle{background-color:#dedede;background-image:-moz-linear-gradient(top,#c8c8c8,#fff);background-image:-webkit-gradient(linear,0 0,0 100%,from(#c8c8c8),to(#fff));background-image:-webkit-linear-gradient(top,#c8c8c8,#fff);background-image:-o-linear-gradient(top,#c8c8c8,#fff);background-image:linear-gradient(to bottom,#c8c8c8,#fff);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffc8c8c8', endColorstr='#ffffffff', GradientType=0)}#navbar .navbar-inner.white .nav>li>a:hover{background-color:#dcdcdc;background-image:-moz-linear-gradient(top,#f2f2f2,#bbb);background-image:-webkit-gradient(linear,0 0,0 100%,from(#f2f2f2),to(#bbb));background-image:-webkit-linear-gradient(top,#f2f2f2,#bbb);background-image:-o-linear-gradient(top,#f2f2f2,#bbb);background-image:linear-gradient(to bottom,#f2f2f2,#bbb);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2f2f2', endColorstr='#ffbbbbbb', GradientType=0)}#navbar .navbar-inner.white.transparent{background-color:rgba(233,233,233,.6);background-image:"../img/trans-background.png";background-image:-moz-linear-gradient(top,rgba(255,255,255,.6),rgba(200,200,200,.6)),url(../img/trans-background.png);background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(255,255,255,.6)),to(rgba(200,200,200,.6))),url(../img/trans-background.png);background-image:-webkit-linear-gradient(top,rgba(255,255,255,.6),rgba(200,200,200,.6)),url(../img/trans-background.png);background-image:-o-linear-gradient(top,rgba(255,255,255,.6),rgba(200,200,200,.6)),url(../img/trans-background.png);background-image:linear-gradient(to bottom,rgba(255,255,255,.6),rgba(200,200,200,.6)),url(../img/trans-background.png);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#99ffffff', endColorstr='#99c8c8c8', GradientType=0)}#navbar .navbar-inner.white.transparent .brand,#navbar .navbar-inner.white.transparent .nav>li>a{text-shadow:0 1px 0 #c8c8c8;color:#333}#navbar .navbar-inner.white.transparent .brand .caret,#navbar .navbar-inner.white.transparent .nav>li>a .caret{border-bottom-color:#919191;border-top-color:#919191}#navbar .navbar-inner.white.transparent .brand:focus .caret,#navbar .navbar-inner.white.transparent .brand:hover .caret,#navbar .navbar-inner.white.transparent .nav>li>a:focus .caret,#navbar .navbar-inner.white.transparent .nav>li>a:hover .caret{border-bottom-color:#626262;border-top-color:#626262}#navbar .navbar-inner.white.transparent .brand span{background-image:url(../img/tentacle-20x20.png)}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){#navbar .navbar-inner.white.transparent .brand span{background-image:url(../img/tentacle-20x20@2x.png)}}#navbar .navbar-inner.white.transparent .nav>li.dropdown.active>.dropdown-toggle,#navbar .navbar-inner.white.transparent .nav>li.dropdown.open.active>.dropdown-toggle,#navbar .navbar-inner.white.transparent .nav>li.dropdown.open>.dropdown-toggle{background-color:rgba(222,222,222,.6);background-image:"../img/trans-background.png";background-image:-moz-linear-gradient(top,rgba(200,200,200,.6),rgba(255,255,255,.6)),url(../img/trans-background.png);background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(200,200,200,.6)),to(rgba(255,255,255,.6))),url(../img/trans-background.png);background-image:-webkit-linear-gradient(top,rgba(200,200,200,.6),rgba(255,255,255,.6)),url(../img/trans-background.png);background-image:-o-linear-gradient(top,rgba(200,200,200,.6),rgba(255,255,255,.6)),url(../img/trans-background.png);background-image:linear-gradient(to bottom,rgba(200,200,200,.6),rgba(255,255,255,.6)),url(../img/trans-background.png);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#99c8c8c8', endColorstr='#99ffffff', GradientType=0)}#navbar .navbar-inner.white.transparent .nav>li>a:hover{background-color:rgba(220,220,220,.6);background-image:"../img/trans-background.png";background-image:-moz-linear-gradient(top,rgba(242,242,242,.6),rgba(187,187,187,.6)),url(../img/trans-background.png);background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(242,242,242,.6)),to(rgba(187,187,187,.6))),url(../img/trans-background.png);background-image:-webkit-linear-gradient(top,rgba(242,242,242,.6),rgba(187,187,187,.6)),url(../img/trans-background.png);background-image:-o-linear-gradient(top,rgba(242,242,242,.6),rgba(187,187,187,.6)),url(../img/trans-background.png);background-image:linear-gradient(to bottom,rgba(242,242,242,.6),rgba(187,187,187,.6)),url(../img/trans-background.png);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#99f2f2f2', endColorstr='#99bbbbbb', GradientType=0)}#navbar .navbar-inner .brand{padding:10px 20px 6px}#navbar .navbar-inner .brand span{padding-left:26px;background-size:20px 20px;background-repeat:no-repeat;display:inline-block;max-width:250px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;vertical-align:top;line-height:20px;height:24px}#navbar_login a.dropdown-toggle span{display:inline-block;max-width:100px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;vertical-align:top}.octoprint-container{margin-top:20px}.octoprint-container .tab-content{padding:9px 15px;border-left:1px solid #ddd;border-right:1px solid #ddd;border-bottom:1px solid #ddd;-webkit-border-bottom-right-radius:4px;-moz-border-radius-bottomright:4px;border-bottom-right-radius:4px;-webkit-border-bottom-left-radius:4px;-moz-border-radius-bottomleft:4px;border-bottom-left-radius:4px}.octoprint-container .nav{margin-bottom:0}.octoprint-container .tab-content h1{display:block;width:100%;padding:0;margin-bottom:20px;font-size:21px;line-height:40px;color:#333;border:0;border-bottom:1px solid #e5e5e5;font-weight:400}.octoprint-container .accordion-heading .accordion-heading-button{float:right}.octoprint-container .accordion-heading .accordion-heading-button a{display:inline-block;padding:8px 15px;font-size:14px;line-height:20px;color:#000;text-decoration:none;background:0 0;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}.octoprint-container .accordion-heading a.accordion-toggle{display:inline-block}.octoprint-container .accordion-heading [class*=" icon-"],.octoprint-container .accordion-heading [class^=icon-]{color:#000}.print-control .btn{padding-left:4px;padding-right:4px}.upload-buttons .btn{margin-right:0}table{table-layout:fixed}table .popover-title{text-overflow:ellipsis;word-break:break-all}table td,table th{overflow:hidden}table td.gcode_files_name,table th.gcode_files_name{text-overflow:ellipsis;text-align:left;white-space:nowrap}table td.gcode_files_action,table th.gcode_files_action{width:90px;text-align:center;white-space:nowrap}table td.gcode_files_action a,table th.gcode_files_action a{text-decoration:none;color:#000}table td.gcode_files_action a.disabled,table th.gcode_files_action a.disabled{color:#ccc;cursor:default}table td.timelapse_files_checkbox,table td.timelapse_unrendered_checkbox,table th.timelapse_files_checkbox,table th.timelapse_unrendered_checkbox{text-align:center;width:10px}table td.timelapse_files_checkbox input[type=checkbox],table td.timelapse_unrendered_checkbox input[type=checkbox],table th.timelapse_files_checkbox input[type=checkbox],table th.timelapse_unrendered_checkbox input[type=checkbox]{margin-top:0}table td.timelapse_files_name,table td.timelapse_unrendered_name,table th.timelapse_files_name,table th.timelapse_unrendered_name{text-overflow:ellipsis;text-align:left}table td.timelapse_files_size,table td.timelapse_unrendered_size,table th.timelapse_files_size,table th.timelapse_unrendered_size{text-align:right;width:55px}table td.timelapse_unrendered_count,table th.timelapse_unrendered_count{text-align:right;width:45px}table td.timelapse_files_action,table td.timelapse_unrendered_action,table th.timelapse_files_action,table th.timelapse_unrendered_action{width:60px;text-align:center;white-space:nowrap}table td.timelapse_files_action a,table td.timelapse_unrendered_action a,table th.timelapse_files_action a,table th.timelapse_unrendered_action a{text-decoration:none;color:#000}table td.timelapse_files_action a.disabled,table td.timelapse_unrendered_action a.disabled,table th.timelapse_files_action a.disabled,table th.timelapse_unrendered_action a.disabled{color:#ccc;cursor:default}table td.settings_users_name,table th.settings_users_name{text-overflow:ellipsis;text-align:left;width:100px}table td.settings_users_active,table th.settings_users_active{text-align:center;width:55px}table td table.settings_users_details_table,table th table.settings_users_details_table{font-size:.8em;margin-bottom:0}table td table.settings_users_details_table .settings_users_details_key,table th table.settings_users_details_table .settings_users_details_key{width:100px}table td table.settings_users_details_table td,table td table.settings_users_details_table th,table th table.settings_users_details_table td,table th table.settings_users_details_table th{border:0;padding:0}table td.settings_groups_default,table th.settings_groups_default{text-align:center;width:20px}table td.settings_groups_name,table th.settings_groups_name{width:180px}table td table.settings_groups_details_table,table th table.settings_groups_details_table{font-size:.8em;margin-bottom:0}table td table.settings_groups_details_table .settings_groups_details_key,table th table.settings_groups_details_table .settings_groups_details_key{width:100px}table td table.settings_groups_details_table td,table td table.settings_groups_details_table th,table th table.settings_groups_details_table td,table th table.settings_groups_details_table th{border:0;padding:0}table td.settings_groups_actions,table td.settings_users_actions,table th.settings_groups_actions,table th.settings_users_actions{width:60px;text-align:center;white-space:nowrap}table td.settings_groups_actions a,table td.settings_users_actions a,table th.settings_groups_actions a,table th.settings_users_actions a{text-decoration:none;color:#000}table td.settings_groups_actions a.disabled,table td.settings_users_actions a.disabled,table th.settings_groups_actions a.disabled,table th.settings_users_actions a.disabled{color:#ccc;cursor:default}table td.settings_accesscontrol_groups_list_checkbox,table td.settings_accesscontrol_permissions_list_checkbox,table td.settings_accesscontrol_subgroups_list_checkbox,table th.settings_accesscontrol_groups_list_checkbox,table th.settings_accesscontrol_permissions_list_checkbox,table th.settings_accesscontrol_subgroups_list_checkbox{width:20px}table td #settings-usersDialogAddUser,table td #settings-usersDialogEditUser,table th #settings-usersDialogAddUser,table th #settings-usersDialogEditUser{position:relative;top:50%;transform:translateY(-50%);margin-top:0!important}table td.settings_printerProfiles_profiles_name,table th.settings_printerProfiles_profiles_name{text-overflow:ellipsis;text-align:left}table td.settings_printerProfiles_profiles_model,table th.settings_printerProfiles_profiles_model{text-align:left;width:250px}table td.settings_printerProfiles_profiles_action,table th.settings_printerProfiles_profiles_action{width:80px;text-align:center;white-space:nowrap}table td.settings_printerProfiles_profiles_action a,table th.settings_printerProfiles_profiles_action a{text-decoration:none;color:#000}table td.settings_printerProfiles_profiles_action a.disabled,table th.settings_printerProfiles_profiles_action a.disabled{color:#ccc;cursor:default}#temperature-graph{height:350px;width:100%;background:url(../img/graph-background.png) center no-repeat}#temperature-table{table-layout:fixed;width:100%;margin-top:20px}#temperature-table td,#temperature-table th{line-height:25px}#temperature-table td.temperature_actual,#temperature-table td.temperature_offset,#temperature-table td.temperature_target,#temperature-table td.temperature_tool,#temperature-table th.temperature_actual,#temperature-table th.temperature_offset,#temperature-table th.temperature_target,#temperature-table th.temperature_tool{vertical-align:middle;text-align:center}#temperature-table td.temperature_actual form,#temperature-table td.temperature_offset form,#temperature-table td.temperature_target form,#temperature-table td.temperature_tool form,#temperature-table th.temperature_actual form,#temperature-table th.temperature_offset form,#temperature-table th.temperature_target form,#temperature-table th.temperature_tool form{margin:0}#temperature-table td.temperature_actual .dropdown-menu,#temperature-table td.temperature_offset .dropdown-menu,#temperature-table td.temperature_target .dropdown-menu,#temperature-table td.temperature_tool .dropdown-menu,#temperature-table th.temperature_actual .dropdown-menu,#temperature-table th.temperature_offset .dropdown-menu,#temperature-table th.temperature_target .dropdown-menu,#temperature-table th.temperature_tool .dropdown-menu{text-align:left}#temperature-table td.temperature_tool,#temperature-table th.temperature_tool{width:16%;text-align:left;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}#temperature-table td.temperature_actual,#temperature-table th.temperature_actual{width:12%}#temperature-table td.temperature_target,#temperature-table th.temperature_target{width:42%;overflow:visible}#temperature-table td.temperature_offset,#temperature-table th.temperature_offset{width:30%}.tab-content,.tab-pane{overflow:visible}#speed_fill,#speed_innerWall,#speed_outerWall,#speed_support,#temp_newBedTemp,#temp_newTemp,#webcam_timelapse_fps,#webcam_timelapse_interval,#webcam_timelapse_postRoll,#webcam_timelapse_retractionZHop{text-align:right}ul.dropdown-menu li a{cursor:pointer}#connection_baudrates,#connection_ports,#connection_printers{width:100%}#offline_overlay,#reloadui_overlay{position:fixed;top:0;left:0;width:100%;height:100%;display:none}#offline_overlay{z-index:10002}#reloadui_overlay{z-index:10001}#offline_overlay_background,#reloadui_overlay_background{position:fixed;top:0;left:0;width:100%;height:100%;background-color:#000;filter:alpha(opacity=50);-moz-opacity:.5;-khtml-opacity:.5;opacity:.5}#offline_overlay_wrapper,#reloadui_overlay_wrapper{position:absolute;top:0;bottom:0;left:0;right:0;padding-top:60px}#offline_overlay_wrapper .container,#reloadui_overlay_wrapper .container{margin:auto}#webcam_container{width:100%;position:relative;outline:0;background-color:#000}#webcam_container .keycontrol_overlay{position:absolute;left:10px;right:10px;bottom:10px;background:rgba(0,0,0,.5);font-size:85%;color:#fff;padding:0}#webcam_container .keycontrol_overlay kbd{border:1px solid #eee;border-radius:3px;margin-left:2px;margin-right:2px;font-size:90%;padding:2px;min-width:1em}#webcam_container .keycontrol_overlay .keycontrol_overlay_heading{position:relative;padding:10px;font-weight:700}#webcam_container .keycontrol_overlay .keycontrol_overlay_column{position:relative;width:45%;padding:10px;float:left}#webcam_container .nowebcam{position:absolute;top:0;left:0;right:0;bottom:0}#webcam_container .nowebcam .text{color:#fff;text-align:center;position:relative;margin:auto;width:80%;top:50%;transform:translateY(-50%);display:block}#webcam_container .nowebcam .text.webcam_loading{animation:pulsate 3s ease-out;animation-iteration-count:infinite}#webcam_container .webcam_rotated{position:relative;width:100%;padding-bottom:100%;pointer-events:none}#webcam_container .webcam_rotated .webcam_fixed_ratio{position:absolute;transform:rotate(-90deg);top:0;bottom:0;pointer-events:none}#webcam_container .webcam_rotated .webcam_fixed_ratio .webcam_fixed_ratio_inner{width:100%;height:100%;pointer-events:none}#webcam_container .webcam_unrotated .webcam_fixed_ratio{width:100%;pointer-events:none;padding-bottom:100%;position:relative}#webcam_container .webcam_unrotated .webcam_fixed_ratio.ratio43{padding-bottom:75%}#webcam_container .webcam_unrotated .webcam_fixed_ratio.ratio169{padding-bottom:56.25%}#webcam_container .webcam_unrotated .webcam_fixed_ratio.ratio1610{padding-bottom:62.5%}#webcam_container .webcam_unrotated .webcam_fixed_ratio .webcam_fixed_ratio_inner{position:absolute;top:0;bottom:0;left:0;right:0;pointer-events:none}#webcam_container img{width:100%;height:100%;object-fit:contain}#state_wrapper hr{margin:5px 0}#files .gcode_files .scroll-wrapper{overflow-x:hidden;overflow-y:scroll;height:306px;padding-right:2px}#files .gcode_files .entry{padding:5px;line-height:20px;border-bottom:1px solid #ddd;position:relative}#files .gcode_files .entry:hover{background-color:#f5f5f5}#files .gcode_files .entry .title{text-overflow:ellipsis;word-break:break-all;margin-right:30px}#files .gcode_files .entry .additionalInfo,#files .gcode_files .entry .internal,#files .gcode_files .entry .size,#files .gcode_files .entry .uploaded{font-size:85%;color:#999}#files .gcode_files .entry .uploaded [title]{cursor:help}#files .gcode_files .entry .internal{word-break:break-all}#files .gcode_files .entry .action-buttons{position:absolute;bottom:5px;right:5px}#files .gcode_files .entry .additionalInfo{padding-bottom:22px}@keyframes highlightframes{0%{background:#ff0}100%{background:0 0}}#files .gcode_files .entry.highlight{animation:highlightframes 2s}#files .gcode_files .back .back-path{white-space:nowrap}#files .gcode_files .back .back-path span{word-wrap:break-word;white-space:pre-line}#files .upload-buttons{margin-top:10px}#files .form-search{text-align:center;margin-bottom:5px!important}#control{overflow:hidden}#control .jog-panel{float:left;margin-right:19px}#control h1{text-align:left}#control .jog-panel>div{text-align:center}#control .jog-panel>div.distance{text-align:left}#control .jog-panel .slider{margin-bottom:10px}#control .box{width:30px;height:30px;margin-right:10px;margin-bottom:10px;padding-left:8px}#control .control-box{display:block;height:30px;margin-bottom:10px}#control .btn-group{margin-bottom:10px}#control .btn-group.distance>.btn{width:43px;padding:3px 0;height:30px}#control .slider-handle{width:14px;height:14px;margin-left:-7px;margin-top:-3px}#control .custom_section h1{cursor:pointer}#control .custom_section_horizontal>.custom_control{display:inline-block}#control .custom_section_vertical>.custom_control{display:block}#control .custom_control .slider{margin-left:10px;margin-right:10px;margin-bottom:2px}#control .pulsate_text_opacity{animation:pulsate_input 1s ease-out;animation-iteration-count:infinite}@keyframes pulsate_input{0%{color:#555}50%{color:rgba(85,85,85,.2)}100%{color:#555}}#term .terminal{margin-bottom:30px}#term .terminal #terminal-output,#term .terminal #terminal-output-lowfi{min-height:340px;margin-bottom:5px}#settings_dialog .aboutlink,#settings_dialog .systeminfolink{float:left}#settings_dialog_menu,#wizard_dialog_menu{margin-left:0}#wizard_firstrun_acl .acl_decision{margin-top:1em}#wizard_firstrun_end p,#wizard_firstrun_start p{margin-bottom:1.5em;line-height:1.5}#settings_appearance_managelanguagesdialog_list{width:auto;height:300px;overflow-x:hidden;overflow-y:scroll;padding-right:2px}#settings_appearance_managelanguagesdialog_emptylist{overflow:hidden;width:100%;height:300px;text-align:center;display:table}#settings_appearance_managelanguagesdialog_emptylist div{display:table-cell;vertical-align:middle}#about_authors ul,#about_sponsors ul{columns:3;-webkit-columns:3;-moz-columns:3}.footer ul{margin:0}.footer ul li{display:inline;margin-left:1em;font-size:85%}.footer ul li:first-child{margin-left:0}.footer ul li a{color:#555}.footer #footer_links,.footer #footer_version{max-width:50%}.ui-pnotify{position:fixed}.ui-pnotify .alert a{color:#c09853}.ui-pnotify .alert-danger a,.ui-pnotify .alert-error a{color:#b94a48}.ui-pnotify .alert-success a{color:#468847}.ui-pnotify .alert-info a{color:#3a87ad}.pnotify_additional_info .pnotify_more{font-size:85%}.text-right{text-align:right}.text-center{text-align:center}.text-block{display:block}.overflow_visible{overflow:visible!important}.clickable{cursor:pointer}.border_box{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.hidden{display:none}textarea.block{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;width:100%}@keyframes pulsate{0%{opacity:.5}50%{opacity:1}100%{opacity:.5}}#drop_overlay{position:fixed;top:0;left:0;width:100%;height:100%;z-index:10000;display:none}#drop_overlay.in{display:block}#drop_overlay #drop_overlay_background{position:fixed;top:0;left:0;width:100%;height:100%;background-color:#000;filter:alpha(opacity=50);-moz-opacity:.5;-khtml-opacity:.5;opacity:.5}#drop_overlay #drop_overlay_wrapper{position:absolute;top:0;bottom:0;left:0;right:0;padding-top:60px}#drop_overlay #drop_overlay_wrapper #drop,#drop_overlay #drop_overlay_wrapper #drop_background{position:absolute;top:0;left:0;margin-left:0;width:100%}#drop_overlay #drop_overlay_wrapper #drop_locally,#drop_overlay #drop_overlay_wrapper #drop_locally_background{position:absolute;top:0;left:50%;margin-left:-50%;width:50%;border-right:2px dashed #ccc}#drop_overlay #drop_overlay_wrapper #drop_sd,#drop_overlay #drop_overlay_wrapper #drop_sd_background{position:absolute;top:0;left:50%;margin-left:0;width:50%;border-left:2px dashed #ccc}#drop_overlay #drop_overlay_wrapper .dropzone{height:100%;z-index:10001;color:#fff;font-size:30px}#drop_overlay #drop_overlay_wrapper .dropzone i{font-size:50px}#drop_overlay #drop_overlay_wrapper .dropzone .text{display:block;text-align:center;line-height:40px;position:absolute;width:100%;bottom:5%;filter:alpha(opacity=100);-moz-opacity:1;-khtml-opacity:1;opacity:1}#drop_overlay #drop_overlay_wrapper .dropzone_background{width:50%;height:100%;background-color:#000;filter:alpha(opacity=25);-moz-opacity:.25;-khtml-opacity:.25;opacity:.25}#drop_overlay #drop_overlay_wrapper .dropzone_background.hover{background-color:#000;filter:alpha(opacity=50);-moz-opacity:.5;-khtml-opacity:.5;opacity:.5}#drop_overlay #drop_overlay_wrapper .dropzone_background.fade{-webkit-transition:all .3s ease-out;-moz-transition:all .3s ease-out;-ms-transition:all .3s ease-out;-o-transition:all .3s ease-out;transition:all .3s ease-out;opacity:1}.center{float:none;margin-left:auto;margin-right:auto}.flipH{-webkit-transform:scaleX(-1);-moz-transform:scaleX(-1);-ms-transform:scaleX(-1);transform:scaleX(-1)}.flipV{-webkit-transform:scaleY(-1);-moz-transform:scaleY(-1);-ms-transform:scaleY(-1);transform:scaleY(-1)}.flipH.flipV{-webkit-transform:scaleX(-1) scaleY(-1);-moz-transform:scaleX(-1) scaleY(-1);-ms-transform:scaleX(-1) scaleY(-1);transform:scaleX(-1) scaleY(-1)}.rotate90{-webkit-transform:rotate(-90deg);transform:rotate(-90deg)}.ui-pnotify a{text-decoration:underline}.btn-mini .caret,.btn-small .caret{margin-top:8px}.dropdown-menu-right{right:0;left:auto}.slider .slider-selection{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,.25);background-color:#006dcc;background-image:-moz-linear-gradient(top,#08c,#04c);background-image:-webkit-gradient(linear,0 0,0 100%,from(#08c),to(#04c));background-image:-webkit-linear-gradient(top,#08c,#04c);background-image:-o-linear-gradient(top,#08c,#04c);background-image:linear-gradient(to bottom,#08c,#04c);background-repeat:repeat-x;border-color:#04c #04c #002a80;border-color:rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25);*background-color:#04c;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.slider .slider-selection.active,.slider .slider-selection.disabled,.slider .slider-selection:active,.slider .slider-selection:focus,.slider .slider-selection:hover,.slider .slider-selection[disabled]{color:#fff;background-color:#04c;*background-color:#003bb3}.slider .slider-selection.active,.slider .slider-selection:active{background-color:#039 \9}.slider.slider-disabled .slider-selection{background-image:none;opacity:.65;filter:alpha(opacity=65);-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}.slider .slider-track{background-color:#f5f5f5;border:1px solid #e3e3e3;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.05);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,.05);box-shadow:inset 0 1px 1px rgba(0,0,0,.05)}.slider.slider-disabled .slider-track{background-image:none;opacity:.65;filter:alpha(opacity=65);-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}.slider .slider-handle{display:inline-block;*display:inline;*zoom:1;font-size:14px;line-height:20px;text-align:center;vertical-align:middle;cursor:pointer;color:#333;text-shadow:0 1px 1px rgba(255,255,255,.75);background-color:#f5f5f5;background-image:-moz-linear-gradient(top,#fff,#e6e6e6);background-image:-webkit-gradient(linear,0 0,0 100%,from(#fff),to(#e6e6e6));background-image:-webkit-linear-gradient(top,#fff,#e6e6e6);background-image:-o-linear-gradient(top,#fff,#e6e6e6);background-image:linear-gradient(to bottom,#fff,#e6e6e6);background-repeat:repeat-x;*background-color:#e6e6e6;border:1px solid #ccc;*border:0;border-bottom-color:#b3b3b3;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;*margin-left:.3em;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05);-moz-box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05);padding:0;margin-bottom:0;opacity:1;filter:alpha(opacity=100)}.slider .slider-handle.active,.slider .slider-handle.disabled,.slider .slider-handle:active,.slider .slider-handle:focus,.slider .slider-handle:hover,.slider .slider-handle[disabled]{color:#333;background-color:#e6e6e6;*background-color:#d9d9d9}.slider .slider-handle.active,.slider .slider-handle:active{background-color:#ccc \9}.slider .slider-handle:first-child{*margin-left:0}.slider .slider-handle:focus,.slider .slider-handle:hover{color:#333;text-decoration:none;background-position:0 -15px;-webkit-transition:background-position .1s linear;-moz-transition:background-position .1s linear;-o-transition:background-position .1s linear;transition:background-position .1s linear}.slider .slider-handle:focus{outline:#333 dotted thin;outline:-webkit-focus-ring-color auto 5px;outline-offset:-2px}.slider .slider-handle.active,.slider .slider-handle:active{background-image:none;outline:0;-webkit-box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05);-moz-box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05)}.slider .slider-handle.disabled,.slider .slider-handle[disabled]{cursor:default;background-image:none;opacity:.65;filter:alpha(opacity=65);-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}.slider .slider-handle.hide{display:none}.slider .slider-handle.round{-webkit-border-radius:50%;-moz-border-radius:50%;border-radius:50%}.modal.large{width:975px;margin-left:-487px}.full-sized-box{position:absolute;bottom:0;left:0;right:0;top:0;padding:15px}.full-sized-box .row-fluid{height:100%}@media (max-width:979px){.full-sized-box{position:static}}:root .full-sized-box,_::-webkit-full-page-media,_:future{position:static}.safari ::-webkit-scrollbar{width:10px}.safari ::-webkit-scrollbar-track{border-radius:8px;-webkit-border-radius:8px}.safari ::-webkit-scrollbar-thumb{-webkit-border-radius:10px;border-radius:10px;background:rgba(100,100,100,.8)}.scrollable{height:100%;overflow:auto;-webkit-overflow-scrolling:touch}.pre-output span{display:block}.input-append .add-on.add-on-limited,.input-prepend .add-on.add-on-limited{overflow-x:hidden;text-overflow:ellipsis;width:inherit}.input-append .btn-group:first-child .btn:first-child,.input-prepend .btn-group:first-child .btn:first-child{-webkit-border-radius:4px 0 0 4px;-moz-border-radius:4px 0 0 4px;border-radius:4px 0 0 4px}.input-append .btn-group .btn:first-child,.input-prepend .btn-group .btn:first-child{-webkit-border-radius:0;-moz-border-radius:0;border-radius:0}.input-append.input-block-level,.input-prepend.input-block-level{display:table}.input-append.input-block-level .add-on,.input-prepend.input-block-level .add-on{display:table-cell;width:1%}.input-append.input-block-level>input,.input-prepend.input-block-level>input{box-sizing:border-box;display:table;min-height:inherit;width:100%}.input-append.input-block-level :not(:last-child),.input-prepend.input-block-level :not(:last-child){border-right:0}.control-group.error .input-append .fileinput-button,.control-group.error .input-prepend .fileinput-button{border-color:#b94a48}.control-text{padding-top:5px;cursor:default}input[type=number]{text-align:right}input[type=number].input-nospin::-webkit-inner-spin-button,input[type=number].input-nospin::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}input[type=number].input-nospin{-moz-appearance:textfield}.dropdown-menu li a.disabled,.dropdown-menu li a.disabled:active,.dropdown-menu li a.disabled:hover,.dropdown-menu li a.disabled:visited{background-color:transparent;background-image:none;color:#aaa;cursor:default}textarea.monospace{font-family:monospace}.progress-text,.progress-text-centered{position:relative}.progress-text .progress-text-back,.progress-text .progress-text-front,.progress-text-centered .progress-text-back,.progress-text-centered .progress-text-front{white-space:nowrap}.progress-text .progress-text-front,.progress-text-centered .progress-text-front{box-sizing:border-box;padding:0 10px;width:100%;display:block}.progress-text .progress-text-back,.progress-text-centered .progress-text-back{position:absolute;font-size:12px;line-height:20px;display:block;box-sizing:border-box;text-align:center;padding:0 10px}.progress-text .bar,.progress-text-centered .bar{position:absolute;overflow:hidden}.progress-text-centered .progress-text-front{position:absolute;font-size:12px;line-height:20px;display:block;text-align:center;color:#fff}.progress-text-centered .progress-text-back{width:100%}.search-query-with-clear{position:relative}.search-query-with-clear .search-clear{display:inline-block;color:#ccc;position:absolute;right:28px;height:20px;padding:4px 0;cursor:pointer;visibility:hidden}.search-query-with-clear.active-clear .search-query{padding-right:28px;width:192px}.search-query-with-clear.active-clear .search-clear{visibility:visible}.search-query-with-clear input::-ms-clear{display:none}.search-query-with-clear input[type=search]::-webkit-search-cancel-button,.search-query-with-clear input[type=search]::-webkit-search-decoration,.search-query-with-clear input[type=search]::-webkit-search-results-button,.search-query-with-clear input[type=search]::-webkit-search-results-decoration{-webkit-appearance:none}#navbar_login:not(.open) #login_dropdown_loggedout{display:block;z-index:-1;height:0;width:0;padding:0!important;overflow:hidden;border:0;box-shadow:none;left:-9999px}#navbar_login:not(.open) #login_dropdown_loggedout.hide{display:none}#loginForm{margin:0}#loginForm button{margin-top:20px}#page-container-loading{position:fixed;top:0;left:0;width:100%;height:100%;background-color:#fff;z-index:12301}#page-container-loading .wrapper{position:absolute;top:0;bottom:0;left:0;right:0}#page-container-loading .wrapper .outer{display:table;width:100%;height:100%}#page-container-loading .wrapper .outer .inner{display:table-cell;vertical-align:middle}#page-container-loading .wrapper .outer .inner .content{text-align:center}#page-container-noscript{position:fixed;top:0;left:0;width:100%;height:100%;background-color:#fff;z-index:12310}#page-container-noscript .wrapper{position:absolute;top:0;bottom:0;left:0;right:0}#page-container-noscript .wrapper .outer{display:table;width:100%;height:100%}#page-container-noscript .wrapper .outer .inner{display:table-cell;vertical-align:middle}#page-container-noscript .wrapper .outer .inner .content{text-align:center} \ No newline at end of file +.btn{display:inline-block;*display:inline;*zoom:1;padding:4px 12px;margin-bottom:0;font-size:14px;line-height:20px;text-align:center;vertical-align:middle;cursor:pointer;color:#333;text-shadow:0 1px 1px rgba(255,255,255,.75);background-color:#f5f5f5;background-image:-moz-linear-gradient(top,#fff,#e6e6e6);background-image:-webkit-gradient(linear,0 0,0 100%,from(#fff),to(#e6e6e6));background-image:-webkit-linear-gradient(top,#fff,#e6e6e6);background-image:-o-linear-gradient(top,#fff,#e6e6e6);background-image:linear-gradient(to bottom,#fff,#e6e6e6);background-repeat:repeat-x;*background-color:#e6e6e6;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);border:1px solid #ccc;*border:0;border-bottom-color:#b3b3b3;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;*margin-left:.3em;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05);-moz-box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05)}.btn.active,.btn.disabled,.btn:active,.btn:focus,.btn:hover,.btn[disabled]{color:#333;background-color:#e6e6e6;*background-color:#d9d9d9}.btn.active,.btn:active{background-color:#ccc \9}.btn:first-child{*margin-left:0}.btn:focus,.btn:hover{color:#333;text-decoration:none;background-position:0 -15px;-webkit-transition:background-position .1s linear;-moz-transition:background-position .1s linear;-o-transition:background-position .1s linear;transition:background-position .1s linear}.btn:focus{outline:#333 dotted thin;outline:-webkit-focus-ring-color auto 5px;outline-offset:-2px}.btn.active,.btn:active{background-image:none;outline:0;-webkit-box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05);-moz-box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05)}.btn.disabled,.btn[disabled]{cursor:default;background-image:none;opacity:.65;filter:alpha(opacity=65);-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}.btn-large{padding:11px 19px;font-size:17.5px;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px}.btn-large [class*=" icon-"],.btn-large [class^=icon-]{margin-top:4px}.btn-small{padding:2px 10px;font-size:11.9px;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.btn-small [class*=" icon-"],.btn-small [class^=icon-]{margin-top:0}.btn-mini [class*=" icon-"],.btn-mini [class^=icon-]{margin-top:-1px}.btn-mini{padding:0 6px;font-size:10.5px;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.btn-block{display:block;width:100%;padding-left:0;padding-right:0;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.btn-block+.btn-block{margin-top:5px}input[type=submit].btn-block,input[type=reset].btn-block,input[type=button].btn-block{width:100%}.btn-primary{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,.25);background-color:#006dcc;background-image:-moz-linear-gradient(top,#08c,#04c);background-image:-webkit-gradient(linear,0 0,0 100%,from(#08c),to(#04c));background-image:-webkit-linear-gradient(top,#08c,#04c);background-image:-o-linear-gradient(top,#08c,#04c);background-image:linear-gradient(to bottom,#08c,#04c);background-repeat:repeat-x;border-color:#04c #04c #002a80;border-color:rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25);*background-color:#04c;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.btn-primary.active,.btn-primary.disabled,.btn-primary:active,.btn-primary:focus,.btn-primary:hover,.btn-primary[disabled]{color:#fff;background-color:#04c;*background-color:#003bb3}.btn-primary.active,.btn-primary:active{background-color:#039 \9}.btn-warning{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,.25);background-color:#faa732;background-image:-moz-linear-gradient(top,#fbb450,#f89406);background-image:-webkit-gradient(linear,0 0,0 100%,from(#fbb450),to(#f89406));background-image:-webkit-linear-gradient(top,#fbb450,#f89406);background-image:-o-linear-gradient(top,#fbb450,#f89406);background-image:linear-gradient(to bottom,#fbb450,#f89406);background-repeat:repeat-x;border-color:#f89406 #f89406 #ad6704;border-color:rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25);*background-color:#f89406;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.btn-warning.active,.btn-warning.disabled,.btn-warning:active,.btn-warning:focus,.btn-warning:hover,.btn-warning[disabled]{color:#fff;background-color:#f89406;*background-color:#df8505}.btn-warning.active,.btn-warning:active{background-color:#c67605 \9}.btn-danger{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,.25);background-color:#da4f49;background-image:-moz-linear-gradient(top,#ee5f5b,#bd362f);background-image:-webkit-gradient(linear,0 0,0 100%,from(#ee5f5b),to(#bd362f));background-image:-webkit-linear-gradient(top,#ee5f5b,#bd362f);background-image:-o-linear-gradient(top,#ee5f5b,#bd362f);background-image:linear-gradient(to bottom,#ee5f5b,#bd362f);background-repeat:repeat-x;border-color:#bd362f #bd362f #802420;border-color:rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25);*background-color:#bd362f;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.btn-danger.active,.btn-danger.disabled,.btn-danger:active,.btn-danger:focus,.btn-danger:hover,.btn-danger[disabled]{color:#fff;background-color:#bd362f;*background-color:#a9302a}.btn-danger.active,.btn-danger:active{background-color:#942a25 \9}.btn-success{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,.25);background-color:#5bb75b;background-image:-moz-linear-gradient(top,#62c462,#51a351);background-image:-webkit-gradient(linear,0 0,0 100%,from(#62c462),to(#51a351));background-image:-webkit-linear-gradient(top,#62c462,#51a351);background-image:-o-linear-gradient(top,#62c462,#51a351);background-image:linear-gradient(to bottom,#62c462,#51a351);background-repeat:repeat-x;border-color:#51a351 #51a351 #387038;border-color:rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25);*background-color:#51a351;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.btn-success.active,.btn-success.disabled,.btn-success:active,.btn-success:focus,.btn-success:hover,.btn-success[disabled]{color:#fff;background-color:#51a351;*background-color:#499249}.btn-success.active,.btn-success:active{background-color:#408140 \9}.btn-info{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,.25);background-color:#49afcd;background-image:-moz-linear-gradient(top,#5bc0de,#2f96b4);background-image:-webkit-gradient(linear,0 0,0 100%,from(#5bc0de),to(#2f96b4));background-image:-webkit-linear-gradient(top,#5bc0de,#2f96b4);background-image:-o-linear-gradient(top,#5bc0de,#2f96b4);background-image:linear-gradient(to bottom,#5bc0de,#2f96b4);background-repeat:repeat-x;border-color:#2f96b4 #2f96b4 #1f6377;border-color:rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25);*background-color:#2f96b4;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.btn-info.active,.btn-info.disabled,.btn-info:active,.btn-info:focus,.btn-info:hover,.btn-info[disabled]{color:#fff;background-color:#2f96b4;*background-color:#2a85a0}.btn-info.active,.btn-info:active{background-color:#24748c \9}.btn-inverse{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,.25);background-color:#363636;background-image:-moz-linear-gradient(top,#444,#222);background-image:-webkit-gradient(linear,0 0,0 100%,from(#444),to(#222));background-image:-webkit-linear-gradient(top,#444,#222);background-image:-o-linear-gradient(top,#444,#222);background-image:linear-gradient(to bottom,#444,#222);background-repeat:repeat-x;border-color:#222 #222 #000;border-color:rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25);*background-color:#222;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.btn-inverse.active,.btn-inverse.disabled,.btn-inverse:active,.btn-inverse:focus,.btn-inverse:hover,.btn-inverse[disabled]{color:#fff;background-color:#222;*background-color:#151515}.btn-inverse.active,.btn-inverse:active{background-color:#080808 \9}button.btn,input[type=submit].btn{*padding-top:3px;*padding-bottom:3px}button.btn::-moz-focus-inner,input[type=submit].btn::-moz-focus-inner{padding:0;border:0}button.btn.btn-large,input[type=submit].btn.btn-large{*padding-top:7px;*padding-bottom:7px}button.btn.btn-small,input[type=submit].btn.btn-small{*padding-top:3px;*padding-bottom:3px}button.btn.btn-mini,input[type=submit].btn.btn-mini{*padding-top:1px;*padding-bottom:1px}.btn-link,.btn-link:active,.btn-link[disabled]{background-color:transparent;background-image:none;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}.btn-link{border-color:transparent;cursor:pointer;color:#08c;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0}.btn-link:focus,.btn-link:hover{color:#005580;text-decoration:underline;background-color:transparent}.btn-link[disabled]:focus,.btn-link[disabled]:hover{color:#333;text-decoration:none}.clearfix{*zoom:1}.clearfix:after,.clearfix:before{display:table;content:"";line-height:0}.clearfix:after{clear:both}.hide-text{font:0/0 a;color:transparent;text-shadow:none;background-color:transparent;border:0}.input-block-level{display:block;width:100%;min-height:30px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.nowrap{white-space:nowrap}.actioncol{text-align:center;white-space:nowrap}.actioncol a{text-decoration:none;color:#000}.actioncol a.disabled{color:#ccc;cursor:default}#navbar .navbar-inner{background-color:#ebebeb;background-image:-moz-linear-gradient(top,#fff,#ccc);background-image:-webkit-gradient(linear,0 0,0 100%,from(#fff),to(#ccc));background-image:-webkit-linear-gradient(top,#fff,#ccc);background-image:-o-linear-gradient(top,#fff,#ccc);background-image:linear-gradient(to bottom,#fff,#ccc);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffcccccc', GradientType=0)}#navbar .navbar-inner .brand,#navbar .navbar-inner .nav>li>a{text-shadow:0 1px 0 #ccc;color:#333}#navbar .navbar-inner .brand .caret,#navbar .navbar-inner .nav>li>a .caret{border-bottom-color:#939393;border-top-color:#939393}#navbar .navbar-inner .brand:focus .caret,#navbar .navbar-inner .brand:hover .caret,#navbar .navbar-inner .nav>li>a:focus .caret,#navbar .navbar-inner .nav>li>a:hover .caret{border-bottom-color:#636363;border-top-color:#636363}#navbar .navbar-inner .brand span{background-image:url(../img/tentacle-20x20.png)}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){#navbar .navbar-inner .brand span{background-image:url(../img/tentacle-20x20@2x.png)}}#navbar .navbar-inner .nav>li.dropdown.active>.dropdown-toggle,#navbar .navbar-inner .nav>li.dropdown.open.active>.dropdown-toggle,#navbar .navbar-inner .nav>li.dropdown.open>.dropdown-toggle{background-color:#e0e0e0;background-image:-moz-linear-gradient(top,#ccc,#fff);background-image:-webkit-gradient(linear,0 0,0 100%,from(#ccc),to(#fff));background-image:-webkit-linear-gradient(top,#ccc,#fff);background-image:-o-linear-gradient(top,#ccc,#fff);background-image:linear-gradient(to bottom,#ccc,#fff);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffcccccc', endColorstr='#ffffffff', GradientType=0)}#navbar .navbar-inner .nav>li>a:hover{background-color:#dedede;background-image:-moz-linear-gradient(top,#f2f2f2,#bfbfbf);background-image:-webkit-gradient(linear,0 0,0 100%,from(#f2f2f2),to(#bfbfbf));background-image:-webkit-linear-gradient(top,#f2f2f2,#bfbfbf);background-image:-o-linear-gradient(top,#f2f2f2,#bfbfbf);background-image:linear-gradient(to bottom,#f2f2f2,#bfbfbf);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2f2f2', endColorstr='#ffbfbfbf', GradientType=0)}#navbar .navbar-inner.transparent{background-color:rgba(235,235,235,.6);background-image:"../img/trans-background.png";background-image:-moz-linear-gradient(top,rgba(255,255,255,.6),rgba(204,204,204,.6)),url(../img/trans-background.png);background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(255,255,255,.6)),to(rgba(204,204,204,.6))),url(../img/trans-background.png);background-image:-webkit-linear-gradient(top,rgba(255,255,255,.6),rgba(204,204,204,.6)),url(../img/trans-background.png);background-image:-o-linear-gradient(top,rgba(255,255,255,.6),rgba(204,204,204,.6)),url(../img/trans-background.png);background-image:linear-gradient(to bottom,rgba(255,255,255,.6),rgba(204,204,204,.6)),url(../img/trans-background.png);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#99ffffff', endColorstr='#99cccccc', GradientType=0)}#navbar .navbar-inner.transparent .brand,#navbar .navbar-inner.transparent .nav>li>a{text-shadow:0 1px 0 #ccc;color:#333}#navbar .navbar-inner.transparent .brand .caret,#navbar .navbar-inner.transparent .nav>li>a .caret{border-bottom-color:#939393;border-top-color:#939393}#navbar .navbar-inner.transparent .brand:focus .caret,#navbar .navbar-inner.transparent .brand:hover .caret,#navbar .navbar-inner.transparent .nav>li>a:focus .caret,#navbar .navbar-inner.transparent .nav>li>a:hover .caret{border-bottom-color:#636363;border-top-color:#636363}#navbar .navbar-inner.transparent .brand span{background-image:url(../img/tentacle-20x20.png)}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){#navbar .navbar-inner.transparent .brand span{background-image:url(../img/tentacle-20x20@2x.png)}}#navbar .navbar-inner.transparent .nav>li.dropdown.active>.dropdown-toggle,#navbar .navbar-inner.transparent .nav>li.dropdown.open.active>.dropdown-toggle,#navbar .navbar-inner.transparent .nav>li.dropdown.open>.dropdown-toggle{background-color:rgba(224,224,224,.6);background-image:"../img/trans-background.png";background-image:-moz-linear-gradient(top,rgba(204,204,204,.6),rgba(255,255,255,.6)),url(../img/trans-background.png);background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(204,204,204,.6)),to(rgba(255,255,255,.6))),url(../img/trans-background.png);background-image:-webkit-linear-gradient(top,rgba(204,204,204,.6),rgba(255,255,255,.6)),url(../img/trans-background.png);background-image:-o-linear-gradient(top,rgba(204,204,204,.6),rgba(255,255,255,.6)),url(../img/trans-background.png);background-image:linear-gradient(to bottom,rgba(204,204,204,.6),rgba(255,255,255,.6)),url(../img/trans-background.png);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#99cccccc', endColorstr='#99ffffff', GradientType=0)}#navbar .navbar-inner.transparent .nav>li>a:hover{background-color:rgba(222,222,222,.6);background-image:"../img/trans-background.png";background-image:-moz-linear-gradient(top,rgba(242,242,242,.6),rgba(191,191,191,.6)),url(../img/trans-background.png);background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(242,242,242,.6)),to(rgba(191,191,191,.6))),url(../img/trans-background.png);background-image:-webkit-linear-gradient(top,rgba(242,242,242,.6),rgba(191,191,191,.6)),url(../img/trans-background.png);background-image:-o-linear-gradient(top,rgba(242,242,242,.6),rgba(191,191,191,.6)),url(../img/trans-background.png);background-image:linear-gradient(to bottom,rgba(242,242,242,.6),rgba(191,191,191,.6)),url(../img/trans-background.png);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#99f2f2f2', endColorstr='#99bfbfbf', GradientType=0)}#navbar .navbar-inner.red{background-color:#bb645f;background-image:-moz-linear-gradient(top,#e28e8a,#802420);background-image:-webkit-gradient(linear,0 0,0 100%,from(#e28e8a),to(#802420));background-image:-webkit-linear-gradient(top,#e28e8a,#802420);background-image:-o-linear-gradient(top,#e28e8a,#802420);background-image:linear-gradient(to bottom,#e28e8a,#802420);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffe28e8a', endColorstr='#ff802420', GradientType=0)}#navbar .navbar-inner.red .brand,#navbar .navbar-inner.red .nav>li>a{text-shadow:0 1px 0 #d86761;color:#f2f2f2}#navbar .navbar-inner.red .brand .caret,#navbar .navbar-inner.red .nav>li>a .caret{border-bottom-color:#d89491;border-top-color:#d89491}#navbar .navbar-inner.red .brand:focus .caret,#navbar .navbar-inner.red .brand:hover .caret,#navbar .navbar-inner.red .nav>li>a:focus .caret,#navbar .navbar-inner.red .nav>li>a:hover .caret{border-bottom-color:#e5c3c1;border-top-color:#e5c3c1}#navbar .navbar-inner.red .brand span{background-image:url(../img/tentacle-20x20-light.png)}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){#navbar .navbar-inner.red .brand span{background-image:url(../img/tentacle-20x20-light@2x.png)}}#navbar .navbar-inner.red .nav>li.dropdown.active>.dropdown-toggle,#navbar .navbar-inner.red .nav>li.dropdown.open.active>.dropdown-toggle,#navbar .navbar-inner.red .nav>li.dropdown.open>.dropdown-toggle{background-color:#a74f4a;background-image:-moz-linear-gradient(top,#802420,#e28e8a);background-image:-webkit-gradient(linear,0 0,0 100%,from(#802420),to(#e28e8a));background-image:-webkit-linear-gradient(top,#802420,#e28e8a);background-image:-o-linear-gradient(top,#802420,#e28e8a);background-image:linear-gradient(to bottom,#802420,#e28e8a);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff802420', endColorstr='#ffe28e8a', GradientType=0)}#navbar .navbar-inner.red .nav>li>a:hover{background-color:#af5651;background-image:-moz-linear-gradient(top,#dd7a75,#6b1f1b);background-image:-webkit-gradient(linear,0 0,0 100%,from(#dd7a75),to(#6b1f1b));background-image:-webkit-linear-gradient(top,#dd7a75,#6b1f1b);background-image:-o-linear-gradient(top,#dd7a75,#6b1f1b);background-image:linear-gradient(to bottom,#dd7a75,#6b1f1b);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdd7a75', endColorstr='#ff6b1f1b', GradientType=0)}#navbar .navbar-inner.red.transparent{background-color:rgba(187,100,95,.6);background-image:"../img/trans-background.png";background-image:-moz-linear-gradient(top,rgba(226,142,138,.6),rgba(128,36,32,.6)),url(../img/trans-background.png);background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(226,142,138,.6)),to(rgba(128,36,32,.6))),url(../img/trans-background.png);background-image:-webkit-linear-gradient(top,rgba(226,142,138,.6),rgba(128,36,32,.6)),url(../img/trans-background.png);background-image:-o-linear-gradient(top,rgba(226,142,138,.6),rgba(128,36,32,.6)),url(../img/trans-background.png);background-image:linear-gradient(to bottom,rgba(226,142,138,.6),rgba(128,36,32,.6)),url(../img/trans-background.png);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#99e28e8a', endColorstr='#99802420', GradientType=0)}#navbar .navbar-inner.red.transparent .brand,#navbar .navbar-inner.red.transparent .nav>li>a{text-shadow:0 1px 0 #d86761;color:#f2f2f2}#navbar .navbar-inner.red.transparent .brand .caret,#navbar .navbar-inner.red.transparent .nav>li>a .caret{border-bottom-color:#d89491;border-top-color:#d89491}#navbar .navbar-inner.red.transparent .brand:focus .caret,#navbar .navbar-inner.red.transparent .brand:hover .caret,#navbar .navbar-inner.red.transparent .nav>li>a:focus .caret,#navbar .navbar-inner.red.transparent .nav>li>a:hover .caret{border-bottom-color:#e5c3c1;border-top-color:#e5c3c1}#navbar .navbar-inner.red.transparent .brand span{background-image:url(../img/tentacle-20x20-light.png)}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){#navbar .navbar-inner.red.transparent .brand span{background-image:url(../img/tentacle-20x20-light@2x.png)}}#navbar .navbar-inner.red.transparent .nav>li.dropdown.active>.dropdown-toggle,#navbar .navbar-inner.red.transparent .nav>li.dropdown.open.active>.dropdown-toggle,#navbar .navbar-inner.red.transparent .nav>li.dropdown.open>.dropdown-toggle{background-color:rgba(167,79,74,.6);background-image:"../img/trans-background.png";background-image:-moz-linear-gradient(top,rgba(128,36,32,.6),rgba(226,142,138,.6)),url(../img/trans-background.png);background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(128,36,32,.6)),to(rgba(226,142,138,.6))),url(../img/trans-background.png);background-image:-webkit-linear-gradient(top,rgba(128,36,32,.6),rgba(226,142,138,.6)),url(../img/trans-background.png);background-image:-o-linear-gradient(top,rgba(128,36,32,.6),rgba(226,142,138,.6)),url(../img/trans-background.png);background-image:linear-gradient(to bottom,rgba(128,36,32,.6),rgba(226,142,138,.6)),url(../img/trans-background.png);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#99802420', endColorstr='#99e28e8a', GradientType=0)}#navbar .navbar-inner.red.transparent .nav>li>a:hover{background-color:rgba(175,86,81,.6);background-image:"../img/trans-background.png";background-image:-moz-linear-gradient(top,rgba(221,122,117,.6),rgba(107,31,27,.6)),url(../img/trans-background.png);background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(221,122,117,.6)),to(rgba(107,31,27,.6))),url(../img/trans-background.png);background-image:-webkit-linear-gradient(top,rgba(221,122,117,.6),rgba(107,31,27,.6)),url(../img/trans-background.png);background-image:-o-linear-gradient(top,rgba(221,122,117,.6),rgba(107,31,27,.6)),url(../img/trans-background.png);background-image:linear-gradient(to bottom,rgba(221,122,117,.6),rgba(107,31,27,.6)),url(../img/trans-background.png);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#99dd7a75', endColorstr='#996b1f1b', GradientType=0)}#navbar .navbar-inner.orange{background-color:#e39665;background-image:-moz-linear-gradient(top,#f9c3a0,#c2530c);background-image:-webkit-gradient(linear,0 0,0 100%,from(#f9c3a0),to(#c2530c));background-image:-webkit-linear-gradient(top,#f9c3a0,#c2530c);background-image:-o-linear-gradient(top,#f9c3a0,#c2530c);background-image:linear-gradient(to bottom,#f9c3a0,#c2530c);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff9c3a0', endColorstr='#ffc2530c', GradientType=0)}#navbar .navbar-inner.orange .brand,#navbar .navbar-inner.orange .nav>li>a{text-shadow:0 1px 0 #f6a570;color:#f2f2f2}#navbar .navbar-inner.orange .brand .caret,#navbar .navbar-inner.orange .nav>li>a .caret{border-bottom-color:#f2b58d;border-top-color:#f2b58d}#navbar .navbar-inner.orange .brand:focus .caret,#navbar .navbar-inner.orange .brand:hover .caret,#navbar .navbar-inner.orange .nav>li>a:focus .caret,#navbar .navbar-inner.orange .nav>li>a:hover .caret{border-bottom-color:#f2d3bf;border-top-color:#f2d3bf}#navbar .navbar-inner.orange .brand span{background-image:url(../img/tentacle-20x20-light.png)}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){#navbar .navbar-inner.orange .brand span{background-image:url(../img/tentacle-20x20-light@2x.png)}}#navbar .navbar-inner.orange .nav>li.dropdown.active>.dropdown-toggle,#navbar .navbar-inner.orange .nav>li.dropdown.open.active>.dropdown-toggle,#navbar .navbar-inner.orange .nav>li.dropdown.open>.dropdown-toggle{background-color:#d88047;background-image:-moz-linear-gradient(top,#c2530c,#f9c3a0);background-image:-webkit-gradient(linear,0 0,0 100%,from(#c2530c),to(#f9c3a0));background-image:-webkit-linear-gradient(top,#c2530c,#f9c3a0);background-image:-o-linear-gradient(top,#c2530c,#f9c3a0);background-image:linear-gradient(to bottom,#c2530c,#f9c3a0);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffc2530c', endColorstr='#fff9c3a0', GradientType=0)}#navbar .navbar-inner.orange .nav>li>a:hover{background-color:#d98956;background-image:-moz-linear-gradient(top,#f8b488,#aa490a);background-image:-webkit-gradient(linear,0 0,0 100%,from(#f8b488),to(#aa490a));background-image:-webkit-linear-gradient(top,#f8b488,#aa490a);background-image:-o-linear-gradient(top,#f8b488,#aa490a);background-image:linear-gradient(to bottom,#f8b488,#aa490a);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff8b488', endColorstr='#ffaa490a', GradientType=0)}#navbar .navbar-inner.orange.transparent{background-color:rgba(227,150,101,.6);background-image:"../img/trans-background.png";background-image:-moz-linear-gradient(top,rgba(249,195,160,.6),rgba(194,83,12,.6)),url(../img/trans-background.png);background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(249,195,160,.6)),to(rgba(194,83,12,.6))),url(../img/trans-background.png);background-image:-webkit-linear-gradient(top,rgba(249,195,160,.6),rgba(194,83,12,.6)),url(../img/trans-background.png);background-image:-o-linear-gradient(top,rgba(249,195,160,.6),rgba(194,83,12,.6)),url(../img/trans-background.png);background-image:linear-gradient(to bottom,rgba(249,195,160,.6),rgba(194,83,12,.6)),url(../img/trans-background.png);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#99f9c3a0', endColorstr='#99c2530c', GradientType=0)}#navbar .navbar-inner.orange.transparent .brand,#navbar .navbar-inner.orange.transparent .nav>li>a{text-shadow:0 1px 0 #f6a570;color:#f2f2f2}#navbar .navbar-inner.orange.transparent .brand .caret,#navbar .navbar-inner.orange.transparent .nav>li>a .caret{border-bottom-color:#f2b58d;border-top-color:#f2b58d}#navbar .navbar-inner.orange.transparent .brand:focus .caret,#navbar .navbar-inner.orange.transparent .brand:hover .caret,#navbar .navbar-inner.orange.transparent .nav>li>a:focus .caret,#navbar .navbar-inner.orange.transparent .nav>li>a:hover .caret{border-bottom-color:#f2d3bf;border-top-color:#f2d3bf}#navbar .navbar-inner.orange.transparent .brand span{background-image:url(../img/tentacle-20x20-light.png)}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){#navbar .navbar-inner.orange.transparent .brand span{background-image:url(../img/tentacle-20x20-light@2x.png)}}#navbar .navbar-inner.orange.transparent .nav>li.dropdown.active>.dropdown-toggle,#navbar .navbar-inner.orange.transparent .nav>li.dropdown.open.active>.dropdown-toggle,#navbar .navbar-inner.orange.transparent .nav>li.dropdown.open>.dropdown-toggle{background-color:rgba(216,128,71,.6);background-image:"../img/trans-background.png";background-image:-moz-linear-gradient(top,rgba(194,83,12,.6),rgba(249,195,160,.6)),url(../img/trans-background.png);background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(194,83,12,.6)),to(rgba(249,195,160,.6))),url(../img/trans-background.png);background-image:-webkit-linear-gradient(top,rgba(194,83,12,.6),rgba(249,195,160,.6)),url(../img/trans-background.png);background-image:-o-linear-gradient(top,rgba(194,83,12,.6),rgba(249,195,160,.6)),url(../img/trans-background.png);background-image:linear-gradient(to bottom,rgba(194,83,12,.6),rgba(249,195,160,.6)),url(../img/trans-background.png);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#99c2530c', endColorstr='#99f9c3a0', GradientType=0)}#navbar .navbar-inner.orange.transparent .nav>li>a:hover{background-color:rgba(217,137,86,.6);background-image:"../img/trans-background.png";background-image:-moz-linear-gradient(top,rgba(248,180,136,.6),rgba(170,73,10,.6)),url(../img/trans-background.png);background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(248,180,136,.6)),to(rgba(170,73,10,.6))),url(../img/trans-background.png);background-image:-webkit-linear-gradient(top,rgba(248,180,136,.6),rgba(170,73,10,.6)),url(../img/trans-background.png);background-image:-o-linear-gradient(top,rgba(248,180,136,.6),rgba(170,73,10,.6)),url(../img/trans-background.png);background-image:linear-gradient(to bottom,rgba(248,180,136,.6),rgba(170,73,10,.6)),url(../img/trans-background.png);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#99f8b488', endColorstr='#99aa490a', GradientType=0)}#navbar .navbar-inner.yellow{background-color:#e3d765;background-image:-moz-linear-gradient(top,#f9f0a0,#c2b00c);background-image:-webkit-gradient(linear,0 0,0 100%,from(#f9f0a0),to(#c2b00c));background-image:-webkit-linear-gradient(top,#f9f0a0,#c2b00c);background-image:-o-linear-gradient(top,#f9f0a0,#c2b00c);background-image:linear-gradient(to bottom,#f9f0a0,#c2b00c);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff9f0a0', endColorstr='#ffc2b00c', GradientType=0)}#navbar .navbar-inner.yellow .brand,#navbar .navbar-inner.yellow .nav>li>a{text-shadow:0 1px 0 #c2b00c;color:#f2f2f2}#navbar .navbar-inner.yellow .brand .caret,#navbar .navbar-inner.yellow .nav>li>a .caret{border-bottom-color:#f2e88d;border-top-color:#f2e88d}#navbar .navbar-inner.yellow .brand:focus .caret,#navbar .navbar-inner.yellow .brand:hover .caret,#navbar .navbar-inner.yellow .nav>li>a:focus .caret,#navbar .navbar-inner.yellow .nav>li>a:hover .caret{border-bottom-color:#f2edbf;border-top-color:#f2edbf}#navbar .navbar-inner.yellow .brand span{background-image:url(../img/tentacle-20x20-light.png)}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){#navbar .navbar-inner.yellow .brand span{background-image:url(../img/tentacle-20x20-light@2x.png)}}#navbar .navbar-inner.yellow .nav>li.dropdown.active>.dropdown-toggle,#navbar .navbar-inner.yellow .nav>li.dropdown.open.active>.dropdown-toggle,#navbar .navbar-inner.yellow .nav>li.dropdown.open>.dropdown-toggle{background-color:#d8ca47;background-image:-moz-linear-gradient(top,#c2b00c,#f9f0a0);background-image:-webkit-gradient(linear,0 0,0 100%,from(#c2b00c),to(#f9f0a0));background-image:-webkit-linear-gradient(top,#c2b00c,#f9f0a0);background-image:-o-linear-gradient(top,#c2b00c,#f9f0a0);background-image:linear-gradient(to bottom,#c2b00c,#f9f0a0);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffc2b00c', endColorstr='#fff9f0a0', GradientType=0)}#navbar .navbar-inner.yellow .nav>li>a:hover{background-color:#d9cc56;background-image:-moz-linear-gradient(top,#f8ed88,#aa9a0a);background-image:-webkit-gradient(linear,0 0,0 100%,from(#f8ed88),to(#aa9a0a));background-image:-webkit-linear-gradient(top,#f8ed88,#aa9a0a);background-image:-o-linear-gradient(top,#f8ed88,#aa9a0a);background-image:linear-gradient(to bottom,#f8ed88,#aa9a0a);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff8ed88', endColorstr='#ffaa9a0a', GradientType=0)}#navbar .navbar-inner.yellow.transparent{background-color:rgba(227,215,101,.6);background-image:"../img/trans-background.png";background-image:-moz-linear-gradient(top,rgba(249,240,160,.6),rgba(194,176,12,.6)),url(../img/trans-background.png);background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(249,240,160,.6)),to(rgba(194,176,12,.6))),url(../img/trans-background.png);background-image:-webkit-linear-gradient(top,rgba(249,240,160,.6),rgba(194,176,12,.6)),url(../img/trans-background.png);background-image:-o-linear-gradient(top,rgba(249,240,160,.6),rgba(194,176,12,.6)),url(../img/trans-background.png);background-image:linear-gradient(to bottom,rgba(249,240,160,.6),rgba(194,176,12,.6)),url(../img/trans-background.png);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#99f9f0a0', endColorstr='#99c2b00c', GradientType=0)}#navbar .navbar-inner.yellow.transparent .brand,#navbar .navbar-inner.yellow.transparent .nav>li>a{text-shadow:0 1px 0 #c2b00c;color:#f2f2f2}#navbar .navbar-inner.yellow.transparent .brand .caret,#navbar .navbar-inner.yellow.transparent .nav>li>a .caret{border-bottom-color:#f2e88d;border-top-color:#f2e88d}#navbar .navbar-inner.yellow.transparent .brand:focus .caret,#navbar .navbar-inner.yellow.transparent .brand:hover .caret,#navbar .navbar-inner.yellow.transparent .nav>li>a:focus .caret,#navbar .navbar-inner.yellow.transparent .nav>li>a:hover .caret{border-bottom-color:#f2edbf;border-top-color:#f2edbf}#navbar .navbar-inner.yellow.transparent .brand span{background-image:url(../img/tentacle-20x20-light.png)}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){#navbar .navbar-inner.yellow.transparent .brand span{background-image:url(../img/tentacle-20x20-light@2x.png)}}#navbar .navbar-inner.yellow.transparent .nav>li.dropdown.active>.dropdown-toggle,#navbar .navbar-inner.yellow.transparent .nav>li.dropdown.open.active>.dropdown-toggle,#navbar .navbar-inner.yellow.transparent .nav>li.dropdown.open>.dropdown-toggle{background-color:rgba(216,202,71,.6);background-image:"../img/trans-background.png";background-image:-moz-linear-gradient(top,rgba(194,176,12,.6),rgba(249,240,160,.6)),url(../img/trans-background.png);background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(194,176,12,.6)),to(rgba(249,240,160,.6))),url(../img/trans-background.png);background-image:-webkit-linear-gradient(top,rgba(194,176,12,.6),rgba(249,240,160,.6)),url(../img/trans-background.png);background-image:-o-linear-gradient(top,rgba(194,176,12,.6),rgba(249,240,160,.6)),url(../img/trans-background.png);background-image:linear-gradient(to bottom,rgba(194,176,12,.6),rgba(249,240,160,.6)),url(../img/trans-background.png);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#99c2b00c', endColorstr='#99f9f0a0', GradientType=0)}#navbar .navbar-inner.yellow.transparent .nav>li>a:hover{background-color:rgba(217,204,86,.6);background-image:"../img/trans-background.png";background-image:-moz-linear-gradient(top,rgba(248,237,136,.6),rgba(170,154,10,.6)),url(../img/trans-background.png);background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(248,237,136,.6)),to(rgba(170,154,10,.6))),url(../img/trans-background.png);background-image:-webkit-linear-gradient(top,rgba(248,237,136,.6),rgba(170,154,10,.6)),url(../img/trans-background.png);background-image:-o-linear-gradient(top,rgba(248,237,136,.6),rgba(170,154,10,.6)),url(../img/trans-background.png);background-image:linear-gradient(to bottom,rgba(248,237,136,.6),rgba(170,154,10,.6)),url(../img/trans-background.png);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#99f8ed88', endColorstr='#99aa9a0a', GradientType=0)}#navbar .navbar-inner.green{background-color:#98f064;background-image:-moz-linear-gradient(top,#c8ffa7,#50da00);background-image:-webkit-gradient(linear,0 0,0 100%,from(#c8ffa7),to(#50da00));background-image:-webkit-linear-gradient(top,#c8ffa7,#50da00);background-image:-o-linear-gradient(top,#c8ffa7,#50da00);background-image:linear-gradient(to bottom,#c8ffa7,#50da00);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffc8ffa7', endColorstr='#ff50da00', GradientType=0)}#navbar .navbar-inner.green .brand,#navbar .navbar-inner.green .nav>li>a{text-shadow:0 1px 0 #50da00;color:#333}#navbar .navbar-inner.green .brand .caret,#navbar .navbar-inner.green .nav>li>a .caret{border-bottom-color:#55992e;border-top-color:#55992e}#navbar .navbar-inner.green .brand:focus .caret,#navbar .navbar-inner.green .brand:hover .caret,#navbar .navbar-inner.green .nav>li>a:focus .caret,#navbar .navbar-inner.green .nav>li>a:hover .caret{border-bottom-color:#446630;border-top-color:#446630}#navbar .navbar-inner.green .brand span{background-image:url(../img/tentacle-20x20.png)}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){#navbar .navbar-inner.green .brand span{background-image:url(../img/tentacle-20x20@2x.png)}}#navbar .navbar-inner.green .nav>li.dropdown.active>.dropdown-toggle,#navbar .navbar-inner.green .nav>li.dropdown.open.active>.dropdown-toggle,#navbar .navbar-inner.green .nav>li.dropdown.open>.dropdown-toggle{background-color:#80e943;background-image:-moz-linear-gradient(top,#50da00,#c8ffa7);background-image:-webkit-gradient(linear,0 0,0 100%,from(#50da00),to(#c8ffa7));background-image:-webkit-linear-gradient(top,#50da00,#c8ffa7);background-image:-o-linear-gradient(top,#50da00,#c8ffa7);background-image:linear-gradient(to bottom,#50da00,#c8ffa7);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff50da00', endColorstr='#ffc8ffa7', GradientType=0)}#navbar .navbar-inner.green .nav>li>a:hover{background-color:#8ae655;background-image:-moz-linear-gradient(top,#b8ff8e,#47c100);background-image:-webkit-gradient(linear,0 0,0 100%,from(#b8ff8e),to(#47c100));background-image:-webkit-linear-gradient(top,#b8ff8e,#47c100);background-image:-o-linear-gradient(top,#b8ff8e,#47c100);background-image:linear-gradient(to bottom,#b8ff8e,#47c100);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffb8ff8e', endColorstr='#ff47c100', GradientType=0)}#navbar .navbar-inner.green.transparent{background-color:rgba(152,240,100,.6);background-image:"../img/trans-background.png";background-image:-moz-linear-gradient(top,rgba(200,255,167,.6),rgba(80,218,0,.6)),url(../img/trans-background.png);background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(200,255,167,.6)),to(rgba(80,218,0,.6))),url(../img/trans-background.png);background-image:-webkit-linear-gradient(top,rgba(200,255,167,.6),rgba(80,218,0,.6)),url(../img/trans-background.png);background-image:-o-linear-gradient(top,rgba(200,255,167,.6),rgba(80,218,0,.6)),url(../img/trans-background.png);background-image:linear-gradient(to bottom,rgba(200,255,167,.6),rgba(80,218,0,.6)),url(../img/trans-background.png);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#99c8ffa7', endColorstr='#9950da00', GradientType=0)}#navbar .navbar-inner.green.transparent .brand,#navbar .navbar-inner.green.transparent .nav>li>a{text-shadow:0 1px 0 #50da00;color:#333}#navbar .navbar-inner.green.transparent .brand .caret,#navbar .navbar-inner.green.transparent .nav>li>a .caret{border-bottom-color:#55992e;border-top-color:#55992e}#navbar .navbar-inner.green.transparent .brand:focus .caret,#navbar .navbar-inner.green.transparent .brand:hover .caret,#navbar .navbar-inner.green.transparent .nav>li>a:focus .caret,#navbar .navbar-inner.green.transparent .nav>li>a:hover .caret{border-bottom-color:#446630;border-top-color:#446630}#navbar .navbar-inner.green.transparent .brand span{background-image:url(../img/tentacle-20x20.png)}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){#navbar .navbar-inner.green.transparent .brand span{background-image:url(../img/tentacle-20x20@2x.png)}}#navbar .navbar-inner.green.transparent .nav>li.dropdown.active>.dropdown-toggle,#navbar .navbar-inner.green.transparent .nav>li.dropdown.open.active>.dropdown-toggle,#navbar .navbar-inner.green.transparent .nav>li.dropdown.open>.dropdown-toggle{background-color:rgba(128,233,67,.6);background-image:"../img/trans-background.png";background-image:-moz-linear-gradient(top,rgba(80,218,0,.6),rgba(200,255,167,.6)),url(../img/trans-background.png);background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(80,218,0,.6)),to(rgba(200,255,167,.6))),url(../img/trans-background.png);background-image:-webkit-linear-gradient(top,rgba(80,218,0,.6),rgba(200,255,167,.6)),url(../img/trans-background.png);background-image:-o-linear-gradient(top,rgba(80,218,0,.6),rgba(200,255,167,.6)),url(../img/trans-background.png);background-image:linear-gradient(to bottom,rgba(80,218,0,.6),rgba(200,255,167,.6)),url(../img/trans-background.png);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#9950da00', endColorstr='#99c8ffa7', GradientType=0)}#navbar .navbar-inner.green.transparent .nav>li>a:hover{background-color:rgba(138,230,85,.6);background-image:"../img/trans-background.png";background-image:-moz-linear-gradient(top,rgba(184,255,142,.6),rgba(71,193,0,.6)),url(../img/trans-background.png);background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(184,255,142,.6)),to(rgba(71,193,0,.6))),url(../img/trans-background.png);background-image:-webkit-linear-gradient(top,rgba(184,255,142,.6),rgba(71,193,0,.6)),url(../img/trans-background.png);background-image:-o-linear-gradient(top,rgba(184,255,142,.6),rgba(71,193,0,.6)),url(../img/trans-background.png);background-image:linear-gradient(to bottom,rgba(184,255,142,.6),rgba(71,193,0,.6)),url(../img/trans-background.png);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#99b8ff8e', endColorstr='#9947c100', GradientType=0)}#navbar .navbar-inner.blue{background-color:#2e63cc;background-image:-moz-linear-gradient(top,#4d88ff,#002b80);background-image:-webkit-gradient(linear,0 0,0 100%,from(#4d88ff),to(#002b80));background-image:-webkit-linear-gradient(top,#4d88ff,#002b80);background-image:-o-linear-gradient(top,#4d88ff,#002b80);background-image:linear-gradient(to bottom,#4d88ff,#002b80);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff4d88ff', endColorstr='#ff002b80', GradientType=0)}#navbar .navbar-inner.blue .brand,#navbar .navbar-inner.blue .nav>li>a{text-shadow:0 1px 0 #1a66ff;color:#f2f2f2}#navbar .navbar-inner.blue .brand .caret,#navbar .navbar-inner.blue .nav>li>a .caret{border-bottom-color:#799bdf;border-top-color:#799bdf}#navbar .navbar-inner.blue .brand:focus .caret,#navbar .navbar-inner.blue .brand:hover .caret,#navbar .navbar-inner.blue .nav>li>a:focus .caret,#navbar .navbar-inner.blue .nav>li>a:hover .caret{border-bottom-color:#b6c7e9;border-top-color:#b6c7e9}#navbar .navbar-inner.blue .brand span{background-image:url(../img/tentacle-20x20-light.png)}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){#navbar .navbar-inner.blue .brand span{background-image:url(../img/tentacle-20x20-light@2x.png)}}#navbar .navbar-inner.blue .nav>li.dropdown.active>.dropdown-toggle,#navbar .navbar-inner.blue .nav>li.dropdown.open.active>.dropdown-toggle,#navbar .navbar-inner.blue .nav>li.dropdown.open>.dropdown-toggle{background-color:#1f50b3;background-image:-moz-linear-gradient(top,#002b80,#4d88ff);background-image:-webkit-gradient(linear,0 0,0 100%,from(#002b80),to(#4d88ff));background-image:-webkit-linear-gradient(top,#002b80,#4d88ff);background-image:-o-linear-gradient(top,#002b80,#4d88ff);background-image:linear-gradient(to bottom,#002b80,#4d88ff);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff002b80', endColorstr='#ff4d88ff', GradientType=0)}#navbar .navbar-inner.blue .nav>li>a:hover{background-color:#1f55c2;background-image:-moz-linear-gradient(top,#37f,#026);background-image:-webkit-gradient(linear,0 0,0 100%,from(#37f),to(#026));background-image:-webkit-linear-gradient(top,#37f,#026);background-image:-o-linear-gradient(top,#37f,#026);background-image:linear-gradient(to bottom,#37f,#026);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff3377ff', endColorstr='#ff002266', GradientType=0)}#navbar .navbar-inner.blue.transparent{background-color:rgba(46,99,204,.6);background-image:"../img/trans-background.png";background-image:-moz-linear-gradient(top,rgba(77,136,255,.6),rgba(0,43,128,.6)),url(../img/trans-background.png);background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(77,136,255,.6)),to(rgba(0,43,128,.6))),url(../img/trans-background.png);background-image:-webkit-linear-gradient(top,rgba(77,136,255,.6),rgba(0,43,128,.6)),url(../img/trans-background.png);background-image:-o-linear-gradient(top,rgba(77,136,255,.6),rgba(0,43,128,.6)),url(../img/trans-background.png);background-image:linear-gradient(to bottom,rgba(77,136,255,.6),rgba(0,43,128,.6)),url(../img/trans-background.png);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#994d88ff', endColorstr='#99002b80', GradientType=0)}#navbar .navbar-inner.blue.transparent .brand,#navbar .navbar-inner.blue.transparent .nav>li>a{text-shadow:0 1px 0 #1a66ff;color:#f2f2f2}#navbar .navbar-inner.blue.transparent .brand .caret,#navbar .navbar-inner.blue.transparent .nav>li>a .caret{border-bottom-color:#799bdf;border-top-color:#799bdf}#navbar .navbar-inner.blue.transparent .brand:focus .caret,#navbar .navbar-inner.blue.transparent .brand:hover .caret,#navbar .navbar-inner.blue.transparent .nav>li>a:focus .caret,#navbar .navbar-inner.blue.transparent .nav>li>a:hover .caret{border-bottom-color:#b6c7e9;border-top-color:#b6c7e9}#navbar .navbar-inner.blue.transparent .brand span{background-image:url(../img/tentacle-20x20-light.png)}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){#navbar .navbar-inner.blue.transparent .brand span{background-image:url(../img/tentacle-20x20-light@2x.png)}}#navbar .navbar-inner.blue.transparent .nav>li.dropdown.active>.dropdown-toggle,#navbar .navbar-inner.blue.transparent .nav>li.dropdown.open.active>.dropdown-toggle,#navbar .navbar-inner.blue.transparent .nav>li.dropdown.open>.dropdown-toggle{background-color:rgba(31,80,179,.6);background-image:"../img/trans-background.png";background-image:-moz-linear-gradient(top,rgba(0,43,128,.6),rgba(77,136,255,.6)),url(../img/trans-background.png);background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(0,43,128,.6)),to(rgba(77,136,255,.6))),url(../img/trans-background.png);background-image:-webkit-linear-gradient(top,rgba(0,43,128,.6),rgba(77,136,255,.6)),url(../img/trans-background.png);background-image:-o-linear-gradient(top,rgba(0,43,128,.6),rgba(77,136,255,.6)),url(../img/trans-background.png);background-image:linear-gradient(to bottom,rgba(0,43,128,.6),rgba(77,136,255,.6)),url(../img/trans-background.png);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#99002b80', endColorstr='#994d88ff', GradientType=0)}#navbar .navbar-inner.blue.transparent .nav>li>a:hover{background-color:rgba(31,85,194,.6);background-image:"../img/trans-background.png";background-image:-moz-linear-gradient(top,rgba(51,119,255,.6),rgba(0,34,102,.6)),url(../img/trans-background.png);background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(51,119,255,.6)),to(rgba(0,34,102,.6))),url(../img/trans-background.png);background-image:-webkit-linear-gradient(top,rgba(51,119,255,.6),rgba(0,34,102,.6)),url(../img/trans-background.png);background-image:-o-linear-gradient(top,rgba(51,119,255,.6),rgba(0,34,102,.6)),url(../img/trans-background.png);background-image:linear-gradient(to bottom,rgba(51,119,255,.6),rgba(0,34,102,.6)),url(../img/trans-background.png);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#993377ff', endColorstr='#99002266', GradientType=0)}#navbar .navbar-inner.violet{background-color:#9864f0;background-image:-moz-linear-gradient(top,#c8a7ff,#5000da);background-image:-webkit-gradient(linear,0 0,0 100%,from(#c8a7ff),to(#5000da));background-image:-webkit-linear-gradient(top,#c8a7ff,#5000da);background-image:-o-linear-gradient(top,#c8a7ff,#5000da);background-image:linear-gradient(to bottom,#c8a7ff,#5000da);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffc8a7ff', endColorstr='#ff5000da', GradientType=0)}#navbar .navbar-inner.violet .brand,#navbar .navbar-inner.violet .nav>li>a{text-shadow:0 1px 0 #a774ff;color:#f2f2f2}#navbar .navbar-inner.violet .brand .caret,#navbar .navbar-inner.violet .nav>li>a .caret{border-bottom-color:#b58df9;border-top-color:#b58df9}#navbar .navbar-inner.violet .brand:focus .caret,#navbar .navbar-inner.violet .brand:hover .caret,#navbar .navbar-inner.violet .nav>li>a:focus .caret,#navbar .navbar-inner.violet .nav>li>a:hover .caret{border-bottom-color:#d3bff5;border-top-color:#d3bff5}#navbar .navbar-inner.violet .brand span{background-image:url(../img/tentacle-20x20-light.png)}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){#navbar .navbar-inner.violet .brand span{background-image:url(../img/tentacle-20x20-light@2x.png)}}#navbar .navbar-inner.violet .nav>li.dropdown.active>.dropdown-toggle,#navbar .navbar-inner.violet .nav>li.dropdown.open.active>.dropdown-toggle,#navbar .navbar-inner.violet .nav>li.dropdown.open>.dropdown-toggle{background-color:#8043e9;background-image:-moz-linear-gradient(top,#5000da,#c8a7ff);background-image:-webkit-gradient(linear,0 0,0 100%,from(#5000da),to(#c8a7ff));background-image:-webkit-linear-gradient(top,#5000da,#c8a7ff);background-image:-o-linear-gradient(top,#5000da,#c8a7ff);background-image:linear-gradient(to bottom,#5000da,#c8a7ff);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5000da', endColorstr='#ffc8a7ff', GradientType=0)}#navbar .navbar-inner.violet .nav>li>a:hover{background-color:#8a55e6;background-image:-moz-linear-gradient(top,#b88eff,#4700c1);background-image:-webkit-gradient(linear,0 0,0 100%,from(#b88eff),to(#4700c1));background-image:-webkit-linear-gradient(top,#b88eff,#4700c1);background-image:-o-linear-gradient(top,#b88eff,#4700c1);background-image:linear-gradient(to bottom,#b88eff,#4700c1);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffb88eff', endColorstr='#ff4700c1', GradientType=0)}#navbar .navbar-inner.violet.transparent{background-color:rgba(152,100,240,.6);background-image:"../img/trans-background.png";background-image:-moz-linear-gradient(top,rgba(200,167,255,.6),rgba(80,0,218,.6)),url(../img/trans-background.png);background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(200,167,255,.6)),to(rgba(80,0,218,.6))),url(../img/trans-background.png);background-image:-webkit-linear-gradient(top,rgba(200,167,255,.6),rgba(80,0,218,.6)),url(../img/trans-background.png);background-image:-o-linear-gradient(top,rgba(200,167,255,.6),rgba(80,0,218,.6)),url(../img/trans-background.png);background-image:linear-gradient(to bottom,rgba(200,167,255,.6),rgba(80,0,218,.6)),url(../img/trans-background.png);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#99c8a7ff', endColorstr='#995000da', GradientType=0)}#navbar .navbar-inner.violet.transparent .brand,#navbar .navbar-inner.violet.transparent .nav>li>a{text-shadow:0 1px 0 #a774ff;color:#f2f2f2}#navbar .navbar-inner.violet.transparent .brand .caret,#navbar .navbar-inner.violet.transparent .nav>li>a .caret{border-bottom-color:#b58df9;border-top-color:#b58df9}#navbar .navbar-inner.violet.transparent .brand:focus .caret,#navbar .navbar-inner.violet.transparent .brand:hover .caret,#navbar .navbar-inner.violet.transparent .nav>li>a:focus .caret,#navbar .navbar-inner.violet.transparent .nav>li>a:hover .caret{border-bottom-color:#d3bff5;border-top-color:#d3bff5}#navbar .navbar-inner.violet.transparent .brand span{background-image:url(../img/tentacle-20x20-light.png)}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){#navbar .navbar-inner.violet.transparent .brand span{background-image:url(../img/tentacle-20x20-light@2x.png)}}#navbar .navbar-inner.violet.transparent .nav>li.dropdown.active>.dropdown-toggle,#navbar .navbar-inner.violet.transparent .nav>li.dropdown.open.active>.dropdown-toggle,#navbar .navbar-inner.violet.transparent .nav>li.dropdown.open>.dropdown-toggle{background-color:rgba(128,67,233,.6);background-image:"../img/trans-background.png";background-image:-moz-linear-gradient(top,rgba(80,0,218,.6),rgba(200,167,255,.6)),url(../img/trans-background.png);background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(80,0,218,.6)),to(rgba(200,167,255,.6))),url(../img/trans-background.png);background-image:-webkit-linear-gradient(top,rgba(80,0,218,.6),rgba(200,167,255,.6)),url(../img/trans-background.png);background-image:-o-linear-gradient(top,rgba(80,0,218,.6),rgba(200,167,255,.6)),url(../img/trans-background.png);background-image:linear-gradient(to bottom,rgba(80,0,218,.6),rgba(200,167,255,.6)),url(../img/trans-background.png);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#995000da', endColorstr='#99c8a7ff', GradientType=0)}#navbar .navbar-inner.violet.transparent .nav>li>a:hover{background-color:rgba(138,85,230,.6);background-image:"../img/trans-background.png";background-image:-moz-linear-gradient(top,rgba(184,142,255,.6),rgba(71,0,193,.6)),url(../img/trans-background.png);background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(184,142,255,.6)),to(rgba(71,0,193,.6))),url(../img/trans-background.png);background-image:-webkit-linear-gradient(top,rgba(184,142,255,.6),rgba(71,0,193,.6)),url(../img/trans-background.png);background-image:-o-linear-gradient(top,rgba(184,142,255,.6),rgba(71,0,193,.6)),url(../img/trans-background.png);background-image:linear-gradient(to bottom,rgba(184,142,255,.6),rgba(71,0,193,.6)),url(../img/trans-background.png);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#99b88eff', endColorstr='#994700c1', GradientType=0)}#navbar .navbar-inner.black{background-color:#4f4f4f;background-image:-moz-linear-gradient(top,#787878,#121212);background-image:-webkit-gradient(linear,0 0,0 100%,from(#787878),to(#121212));background-image:-webkit-linear-gradient(top,#787878,#121212);background-image:-o-linear-gradient(top,#787878,#121212);background-image:linear-gradient(to bottom,#787878,#121212);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff787878', endColorstr='#ff121212', GradientType=0)}#navbar .navbar-inner.black .brand,#navbar .navbar-inner.black .nav>li>a{text-shadow:0 1px 0 #5e5e5e;color:#f2f2f2}#navbar .navbar-inner.black .brand .caret,#navbar .navbar-inner.black .nav>li>a .caret{border-bottom-color:#959595;border-top-color:#959595}#navbar .navbar-inner.black .brand:focus .caret,#navbar .navbar-inner.black .brand:hover .caret,#navbar .navbar-inner.black .nav>li>a:focus .caret,#navbar .navbar-inner.black .nav>li>a:hover .caret{border-bottom-color:#c4c4c4;border-top-color:#c4c4c4}#navbar .navbar-inner.black .brand span{background-image:url(../img/tentacle-20x20-light.png)}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){#navbar .navbar-inner.black .brand span{background-image:url(../img/tentacle-20x20-light@2x.png)}}#navbar .navbar-inner.black .nav>li.dropdown.active>.dropdown-toggle,#navbar .navbar-inner.black .nav>li.dropdown.open.active>.dropdown-toggle,#navbar .navbar-inner.black .nav>li.dropdown.open>.dropdown-toggle{background-color:#3b3b3b;background-image:-moz-linear-gradient(top,#121212,#787878);background-image:-webkit-gradient(linear,0 0,0 100%,from(#121212),to(#787878));background-image:-webkit-linear-gradient(top,#121212,#787878);background-image:-o-linear-gradient(top,#121212,#787878);background-image:linear-gradient(to bottom,#121212,#787878);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff121212', endColorstr='#ff787878', GradientType=0)}#navbar .navbar-inner.black .nav>li>a:hover{background-color:#424242;background-image:-moz-linear-gradient(top,#6b6b6b,#050505);background-image:-webkit-gradient(linear,0 0,0 100%,from(#6b6b6b),to(#050505));background-image:-webkit-linear-gradient(top,#6b6b6b,#050505);background-image:-o-linear-gradient(top,#6b6b6b,#050505);background-image:linear-gradient(to bottom,#6b6b6b,#050505);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff6b6b6b', endColorstr='#ff050505', GradientType=0)}#navbar .navbar-inner.black.transparent{background-color:rgba(79,79,79,.6);background-image:"../img/trans-background.png";background-image:-moz-linear-gradient(top,rgba(120,120,120,.6),rgba(18,18,18,.6)),url(../img/trans-background.png);background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(120,120,120,.6)),to(rgba(18,18,18,.6))),url(../img/trans-background.png);background-image:-webkit-linear-gradient(top,rgba(120,120,120,.6),rgba(18,18,18,.6)),url(../img/trans-background.png);background-image:-o-linear-gradient(top,rgba(120,120,120,.6),rgba(18,18,18,.6)),url(../img/trans-background.png);background-image:linear-gradient(to bottom,rgba(120,120,120,.6),rgba(18,18,18,.6)),url(../img/trans-background.png);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#99787878', endColorstr='#99121212', GradientType=0)}#navbar .navbar-inner.black.transparent .brand,#navbar .navbar-inner.black.transparent .nav>li>a{text-shadow:0 1px 0 #5e5e5e;color:#f2f2f2}#navbar .navbar-inner.black.transparent .brand .caret,#navbar .navbar-inner.black.transparent .nav>li>a .caret{border-bottom-color:#959595;border-top-color:#959595}#navbar .navbar-inner.black.transparent .brand:focus .caret,#navbar .navbar-inner.black.transparent .brand:hover .caret,#navbar .navbar-inner.black.transparent .nav>li>a:focus .caret,#navbar .navbar-inner.black.transparent .nav>li>a:hover .caret{border-bottom-color:#c4c4c4;border-top-color:#c4c4c4}#navbar .navbar-inner.black.transparent .brand span{background-image:url(../img/tentacle-20x20-light.png)}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){#navbar .navbar-inner.black.transparent .brand span{background-image:url(../img/tentacle-20x20-light@2x.png)}}#navbar .navbar-inner.black.transparent .nav>li.dropdown.active>.dropdown-toggle,#navbar .navbar-inner.black.transparent .nav>li.dropdown.open.active>.dropdown-toggle,#navbar .navbar-inner.black.transparent .nav>li.dropdown.open>.dropdown-toggle{background-color:rgba(59,59,59,.6);background-image:"../img/trans-background.png";background-image:-moz-linear-gradient(top,rgba(18,18,18,.6),rgba(120,120,120,.6)),url(../img/trans-background.png);background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(18,18,18,.6)),to(rgba(120,120,120,.6))),url(../img/trans-background.png);background-image:-webkit-linear-gradient(top,rgba(18,18,18,.6),rgba(120,120,120,.6)),url(../img/trans-background.png);background-image:-o-linear-gradient(top,rgba(18,18,18,.6),rgba(120,120,120,.6)),url(../img/trans-background.png);background-image:linear-gradient(to bottom,rgba(18,18,18,.6),rgba(120,120,120,.6)),url(../img/trans-background.png);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#99121212', endColorstr='#99787878', GradientType=0)}#navbar .navbar-inner.black.transparent .nav>li>a:hover{background-color:rgba(66,66,66,.6);background-image:"../img/trans-background.png";background-image:-moz-linear-gradient(top,rgba(107,107,107,.6),rgba(5,5,5,.6)),url(../img/trans-background.png);background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(107,107,107,.6)),to(rgba(5,5,5,.6))),url(../img/trans-background.png);background-image:-webkit-linear-gradient(top,rgba(107,107,107,.6),rgba(5,5,5,.6)),url(../img/trans-background.png);background-image:-o-linear-gradient(top,rgba(107,107,107,.6),rgba(5,5,5,.6)),url(../img/trans-background.png);background-image:linear-gradient(to bottom,rgba(107,107,107,.6),rgba(5,5,5,.6)),url(../img/trans-background.png);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#996b6b6b', endColorstr='#99050505', GradientType=0)}#navbar .navbar-inner.white{background-color:#e9e9e9;background-image:-moz-linear-gradient(top,#fff,#c8c8c8);background-image:-webkit-gradient(linear,0 0,0 100%,from(#fff),to(#c8c8c8));background-image:-webkit-linear-gradient(top,#fff,#c8c8c8);background-image:-o-linear-gradient(top,#fff,#c8c8c8);background-image:linear-gradient(to bottom,#fff,#c8c8c8);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffc8c8c8', GradientType=0)}#navbar .navbar-inner.white .brand,#navbar .navbar-inner.white .nav>li>a{text-shadow:0 1px 0 #c8c8c8;color:#333}#navbar .navbar-inner.white .brand .caret,#navbar .navbar-inner.white .nav>li>a .caret{border-bottom-color:#919191;border-top-color:#919191}#navbar .navbar-inner.white .brand:focus .caret,#navbar .navbar-inner.white .brand:hover .caret,#navbar .navbar-inner.white .nav>li>a:focus .caret,#navbar .navbar-inner.white .nav>li>a:hover .caret{border-bottom-color:#626262;border-top-color:#626262}#navbar .navbar-inner.white .brand span{background-image:url(../img/tentacle-20x20.png)}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){#navbar .navbar-inner.white .brand span{background-image:url(../img/tentacle-20x20@2x.png)}}#navbar .navbar-inner.white .nav>li.dropdown.active>.dropdown-toggle,#navbar .navbar-inner.white .nav>li.dropdown.open.active>.dropdown-toggle,#navbar .navbar-inner.white .nav>li.dropdown.open>.dropdown-toggle{background-color:#dedede;background-image:-moz-linear-gradient(top,#c8c8c8,#fff);background-image:-webkit-gradient(linear,0 0,0 100%,from(#c8c8c8),to(#fff));background-image:-webkit-linear-gradient(top,#c8c8c8,#fff);background-image:-o-linear-gradient(top,#c8c8c8,#fff);background-image:linear-gradient(to bottom,#c8c8c8,#fff);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffc8c8c8', endColorstr='#ffffffff', GradientType=0)}#navbar .navbar-inner.white .nav>li>a:hover{background-color:#dcdcdc;background-image:-moz-linear-gradient(top,#f2f2f2,#bbb);background-image:-webkit-gradient(linear,0 0,0 100%,from(#f2f2f2),to(#bbb));background-image:-webkit-linear-gradient(top,#f2f2f2,#bbb);background-image:-o-linear-gradient(top,#f2f2f2,#bbb);background-image:linear-gradient(to bottom,#f2f2f2,#bbb);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2f2f2', endColorstr='#ffbbbbbb', GradientType=0)}#navbar .navbar-inner.white.transparent{background-color:rgba(233,233,233,.6);background-image:"../img/trans-background.png";background-image:-moz-linear-gradient(top,rgba(255,255,255,.6),rgba(200,200,200,.6)),url(../img/trans-background.png);background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(255,255,255,.6)),to(rgba(200,200,200,.6))),url(../img/trans-background.png);background-image:-webkit-linear-gradient(top,rgba(255,255,255,.6),rgba(200,200,200,.6)),url(../img/trans-background.png);background-image:-o-linear-gradient(top,rgba(255,255,255,.6),rgba(200,200,200,.6)),url(../img/trans-background.png);background-image:linear-gradient(to bottom,rgba(255,255,255,.6),rgba(200,200,200,.6)),url(../img/trans-background.png);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#99ffffff', endColorstr='#99c8c8c8', GradientType=0)}#navbar .navbar-inner.white.transparent .brand,#navbar .navbar-inner.white.transparent .nav>li>a{text-shadow:0 1px 0 #c8c8c8;color:#333}#navbar .navbar-inner.white.transparent .brand .caret,#navbar .navbar-inner.white.transparent .nav>li>a .caret{border-bottom-color:#919191;border-top-color:#919191}#navbar .navbar-inner.white.transparent .brand:focus .caret,#navbar .navbar-inner.white.transparent .brand:hover .caret,#navbar .navbar-inner.white.transparent .nav>li>a:focus .caret,#navbar .navbar-inner.white.transparent .nav>li>a:hover .caret{border-bottom-color:#626262;border-top-color:#626262}#navbar .navbar-inner.white.transparent .brand span{background-image:url(../img/tentacle-20x20.png)}@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){#navbar .navbar-inner.white.transparent .brand span{background-image:url(../img/tentacle-20x20@2x.png)}}#navbar .navbar-inner.white.transparent .nav>li.dropdown.active>.dropdown-toggle,#navbar .navbar-inner.white.transparent .nav>li.dropdown.open.active>.dropdown-toggle,#navbar .navbar-inner.white.transparent .nav>li.dropdown.open>.dropdown-toggle{background-color:rgba(222,222,222,.6);background-image:"../img/trans-background.png";background-image:-moz-linear-gradient(top,rgba(200,200,200,.6),rgba(255,255,255,.6)),url(../img/trans-background.png);background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(200,200,200,.6)),to(rgba(255,255,255,.6))),url(../img/trans-background.png);background-image:-webkit-linear-gradient(top,rgba(200,200,200,.6),rgba(255,255,255,.6)),url(../img/trans-background.png);background-image:-o-linear-gradient(top,rgba(200,200,200,.6),rgba(255,255,255,.6)),url(../img/trans-background.png);background-image:linear-gradient(to bottom,rgba(200,200,200,.6),rgba(255,255,255,.6)),url(../img/trans-background.png);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#99c8c8c8', endColorstr='#99ffffff', GradientType=0)}#navbar .navbar-inner.white.transparent .nav>li>a:hover{background-color:rgba(220,220,220,.6);background-image:"../img/trans-background.png";background-image:-moz-linear-gradient(top,rgba(242,242,242,.6),rgba(187,187,187,.6)),url(../img/trans-background.png);background-image:-webkit-gradient(linear,0 0,0 100%,from(rgba(242,242,242,.6)),to(rgba(187,187,187,.6))),url(../img/trans-background.png);background-image:-webkit-linear-gradient(top,rgba(242,242,242,.6),rgba(187,187,187,.6)),url(../img/trans-background.png);background-image:-o-linear-gradient(top,rgba(242,242,242,.6),rgba(187,187,187,.6)),url(../img/trans-background.png);background-image:linear-gradient(to bottom,rgba(242,242,242,.6),rgba(187,187,187,.6)),url(../img/trans-background.png);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#99f2f2f2', endColorstr='#99bbbbbb', GradientType=0)}#navbar .navbar-inner .brand{padding:10px 20px 6px}#navbar .navbar-inner .brand span{padding-left:26px;background-size:20px 20px;background-repeat:no-repeat;display:inline-block;max-width:250px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;vertical-align:top;line-height:20px;height:24px}#navbar_login a.dropdown-toggle span{display:inline-block;max-width:100px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;vertical-align:top}.octoprint-container{margin-top:20px}.octoprint-container .tab-content{padding:9px 15px;border-left:1px solid #ddd;border-right:1px solid #ddd;border-bottom:1px solid #ddd;-webkit-border-bottom-right-radius:4px;-moz-border-radius-bottomright:4px;border-bottom-right-radius:4px;-webkit-border-bottom-left-radius:4px;-moz-border-radius-bottomleft:4px;border-bottom-left-radius:4px}.octoprint-container .nav{margin-bottom:0}.octoprint-container .tab-content h1{display:block;width:100%;padding:0;margin-bottom:20px;font-size:21px;line-height:40px;color:#333;border:0;border-bottom:1px solid #e5e5e5;font-weight:400}.octoprint-container .accordion-heading .accordion-heading-button{float:right}.octoprint-container .accordion-heading .accordion-heading-button>a{display:inline-block;padding:8px 15px;font-size:14px;line-height:20px;color:#000;text-decoration:none;background:0 0;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}.octoprint-container .accordion-heading a.accordion-toggle{display:inline-block}.octoprint-container .accordion-heading [class*=" icon-"],.octoprint-container .accordion-heading [class^=icon-]{color:#000}.print-control .btn{padding-left:4px;padding-right:4px}.upload-buttons .btn{margin-right:0}table{table-layout:fixed}table .popover-title{text-overflow:ellipsis;word-break:break-all}table td,table th{overflow:hidden}table td.gcode_files_name,table th.gcode_files_name{text-overflow:ellipsis;text-align:left;white-space:nowrap}table td.gcode_files_action,table th.gcode_files_action{width:90px;text-align:center;white-space:nowrap}table td.gcode_files_action a,table th.gcode_files_action a{text-decoration:none;color:#000}table td.gcode_files_action a.disabled,table th.gcode_files_action a.disabled{color:#ccc;cursor:default}table td.timelapse_files_checkbox,table td.timelapse_unrendered_checkbox,table th.timelapse_files_checkbox,table th.timelapse_unrendered_checkbox{text-align:center;width:10px}table td.timelapse_files_checkbox input[type=checkbox],table td.timelapse_unrendered_checkbox input[type=checkbox],table th.timelapse_files_checkbox input[type=checkbox],table th.timelapse_unrendered_checkbox input[type=checkbox]{margin-top:0}table td.timelapse_files_name,table td.timelapse_unrendered_name,table th.timelapse_files_name,table th.timelapse_unrendered_name{text-overflow:ellipsis;text-align:left}table td.timelapse_files_size,table td.timelapse_unrendered_size,table th.timelapse_files_size,table th.timelapse_unrendered_size{text-align:right;width:55px}table td.timelapse_unrendered_count,table th.timelapse_unrendered_count{text-align:right;width:45px}table td.timelapse_files_action,table td.timelapse_unrendered_action,table th.timelapse_files_action,table th.timelapse_unrendered_action{width:60px;text-align:center;white-space:nowrap}table td.timelapse_files_action a,table td.timelapse_unrendered_action a,table th.timelapse_files_action a,table th.timelapse_unrendered_action a{text-decoration:none;color:#000}table td.timelapse_files_action a.disabled,table td.timelapse_unrendered_action a.disabled,table th.timelapse_files_action a.disabled,table th.timelapse_unrendered_action a.disabled{color:#ccc;cursor:default}table td.settings_users_name,table th.settings_users_name{text-overflow:ellipsis;text-align:left;width:100px}table td.settings_users_active,table th.settings_users_active{text-align:center;width:55px}table td table.settings_users_details_table,table th table.settings_users_details_table{font-size:.8em;margin-bottom:0}table td table.settings_users_details_table .settings_users_details_key,table th table.settings_users_details_table .settings_users_details_key{width:100px}table td table.settings_users_details_table td,table td table.settings_users_details_table th,table th table.settings_users_details_table td,table th table.settings_users_details_table th{border:0;padding:0}table td.settings_groups_default,table th.settings_groups_default{text-align:center;width:20px}table td.settings_groups_name,table th.settings_groups_name{width:180px}table td table.settings_groups_details_table,table th table.settings_groups_details_table{font-size:.8em;margin-bottom:0}table td table.settings_groups_details_table .settings_groups_details_key,table th table.settings_groups_details_table .settings_groups_details_key{width:100px}table td table.settings_groups_details_table td,table td table.settings_groups_details_table th,table th table.settings_groups_details_table td,table th table.settings_groups_details_table th{border:0;padding:0}table td.settings_groups_actions,table td.settings_users_actions,table th.settings_groups_actions,table th.settings_users_actions{width:60px;text-align:center;white-space:nowrap}table td.settings_groups_actions a,table td.settings_users_actions a,table th.settings_groups_actions a,table th.settings_users_actions a{text-decoration:none;color:#000}table td.settings_groups_actions a.disabled,table td.settings_users_actions a.disabled,table th.settings_groups_actions a.disabled,table th.settings_users_actions a.disabled{color:#ccc;cursor:default}table td.settings_accesscontrol_groups_list_checkbox,table td.settings_accesscontrol_permissions_list_checkbox,table td.settings_accesscontrol_subgroups_list_checkbox,table th.settings_accesscontrol_groups_list_checkbox,table th.settings_accesscontrol_permissions_list_checkbox,table th.settings_accesscontrol_subgroups_list_checkbox{width:20px}table td #settings-usersDialogAddUser,table td #settings-usersDialogEditUser,table th #settings-usersDialogAddUser,table th #settings-usersDialogEditUser{position:relative;top:50%;transform:translateY(-50%);margin-top:0!important}table td.settings_printerProfiles_profiles_name,table th.settings_printerProfiles_profiles_name{text-overflow:ellipsis;text-align:left}table td.settings_printerProfiles_profiles_model,table th.settings_printerProfiles_profiles_model{text-align:left;width:250px}table td.settings_printerProfiles_profiles_action,table th.settings_printerProfiles_profiles_action{width:80px;text-align:center;white-space:nowrap}table td.settings_printerProfiles_profiles_action a,table th.settings_printerProfiles_profiles_action a{text-decoration:none;color:#000}table td.settings_printerProfiles_profiles_action a.disabled,table th.settings_printerProfiles_profiles_action a.disabled{color:#ccc;cursor:default}#temperature-graph{height:350px;width:100%;background:url(../img/graph-background.png) center no-repeat}#temperature-table{table-layout:fixed;width:100%;margin-top:20px}#temperature-table td,#temperature-table th{line-height:25px}#temperature-table td.temperature_actual,#temperature-table td.temperature_offset,#temperature-table td.temperature_target,#temperature-table td.temperature_tool,#temperature-table th.temperature_actual,#temperature-table th.temperature_offset,#temperature-table th.temperature_target,#temperature-table th.temperature_tool{vertical-align:middle;text-align:center}#temperature-table td.temperature_actual form,#temperature-table td.temperature_offset form,#temperature-table td.temperature_target form,#temperature-table td.temperature_tool form,#temperature-table th.temperature_actual form,#temperature-table th.temperature_offset form,#temperature-table th.temperature_target form,#temperature-table th.temperature_tool form{margin:0}#temperature-table td.temperature_actual .dropdown-menu,#temperature-table td.temperature_offset .dropdown-menu,#temperature-table td.temperature_target .dropdown-menu,#temperature-table td.temperature_tool .dropdown-menu,#temperature-table th.temperature_actual .dropdown-menu,#temperature-table th.temperature_offset .dropdown-menu,#temperature-table th.temperature_target .dropdown-menu,#temperature-table th.temperature_tool .dropdown-menu{text-align:left}#temperature-table td.temperature_tool,#temperature-table th.temperature_tool{width:16%;text-align:left;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}#temperature-table td.temperature_actual,#temperature-table th.temperature_actual{width:12%}#temperature-table td.temperature_target,#temperature-table th.temperature_target{width:42%;overflow:visible}#temperature-table td.temperature_offset,#temperature-table th.temperature_offset{width:30%}.tab-content,.tab-pane{overflow:visible}#speed_fill,#speed_innerWall,#speed_outerWall,#speed_support,#temp_newBedTemp,#temp_newTemp,#webcam_timelapse_fps,#webcam_timelapse_interval,#webcam_timelapse_postRoll,#webcam_timelapse_retractionZHop{text-align:right}ul.dropdown-menu li a{cursor:pointer}#connection_baudrates,#connection_ports,#connection_printers{width:100%}#offline_overlay,#reloadui_overlay{position:fixed;top:0;left:0;width:100%;height:100%;display:none}#offline_overlay{z-index:10002}#reloadui_overlay{z-index:10001}#offline_overlay_background,#reloadui_overlay_background{position:fixed;top:0;left:0;width:100%;height:100%;background-color:#000;filter:alpha(opacity=50);-moz-opacity:.5;-khtml-opacity:.5;opacity:.5}#offline_overlay_wrapper,#reloadui_overlay_wrapper{position:absolute;top:0;bottom:0;left:0;right:0;padding-top:60px}#offline_overlay_wrapper .container,#reloadui_overlay_wrapper .container{margin:auto}#webcam_container{width:100%;position:relative;outline:0;background-color:#000}#webcam_container .keycontrol_overlay{position:absolute;left:10px;right:10px;bottom:10px;background:rgba(0,0,0,.5);font-size:85%;color:#fff;padding:0}#webcam_container .keycontrol_overlay kbd{border:1px solid #eee;border-radius:3px;margin-left:2px;margin-right:2px;font-size:90%;padding:2px;min-width:1em}#webcam_container .keycontrol_overlay .keycontrol_overlay_heading{position:relative;padding:10px;font-weight:700}#webcam_container .keycontrol_overlay .keycontrol_overlay_column{position:relative;width:45%;padding:10px;float:left}#webcam_container .nowebcam{position:absolute;top:0;left:0;right:0;bottom:0}#webcam_container .nowebcam .text{color:#fff;text-align:center;position:relative;margin:auto;width:80%;top:50%;transform:translateY(-50%);display:block}#webcam_container .nowebcam .text.webcam_loading{animation:pulsate 3s ease-out;animation-iteration-count:infinite}#webcam_container .webcam_rotated{position:relative;width:100%;padding-bottom:100%;pointer-events:none}#webcam_container .webcam_rotated .webcam_fixed_ratio{position:absolute;transform:rotate(-90deg);top:0;bottom:0;pointer-events:none}#webcam_container .webcam_rotated .webcam_fixed_ratio .webcam_fixed_ratio_inner{width:100%;height:100%;pointer-events:none}#webcam_container .webcam_unrotated .webcam_fixed_ratio{width:100%;pointer-events:none;padding-bottom:100%;position:relative}#webcam_container .webcam_unrotated .webcam_fixed_ratio.ratio43{padding-bottom:75%}#webcam_container .webcam_unrotated .webcam_fixed_ratio.ratio169{padding-bottom:56.25%}#webcam_container .webcam_unrotated .webcam_fixed_ratio.ratio1610{padding-bottom:62.5%}#webcam_container .webcam_unrotated .webcam_fixed_ratio .webcam_fixed_ratio_inner{position:absolute;top:0;bottom:0;left:0;right:0;pointer-events:none}#webcam_container img{width:100%;height:100%;object-fit:contain}#state_wrapper hr{margin:5px 0}#files .gcode_files .scroll-wrapper{overflow-x:hidden;overflow-y:scroll;height:306px;padding-right:2px}#files .gcode_files .entry{padding:5px;line-height:20px;border-bottom:1px solid #ddd;position:relative}#files .gcode_files .entry:hover{background-color:#f5f5f5}#files .gcode_files .entry .title{text-overflow:ellipsis;word-break:break-all;margin-right:30px}#files .gcode_files .entry .additionalInfo,#files .gcode_files .entry .internal,#files .gcode_files .entry .size,#files .gcode_files .entry .uploaded{font-size:85%;color:#999}#files .gcode_files .entry .uploaded [title]{cursor:help}#files .gcode_files .entry .internal{word-break:break-all}#files .gcode_files .entry .action-buttons{position:absolute;bottom:5px;right:5px}#files .gcode_files .entry .additionalInfo{padding-bottom:22px}@keyframes highlightframes{0%{background:#ff0}100%{background:0 0}}#files .gcode_files .entry.highlight{animation:highlightframes 2s}#files .gcode_files .back .back-path{white-space:nowrap}#files .gcode_files .back .back-path span{word-wrap:break-word;white-space:pre-line}#files .upload-buttons{margin-top:10px}#files .form-search{text-align:center;margin-bottom:5px!important}#control{overflow:hidden}#control .jog-panel{float:left;margin-right:19px}#control h1{text-align:left}#control .jog-panel>div{text-align:center}#control .jog-panel>div.distance{text-align:left}#control .jog-panel .slider{margin-bottom:10px}#control .box{width:30px;height:30px;margin-right:10px;margin-bottom:10px;padding-left:8px}#control .control-box{display:block;height:30px;margin-bottom:10px}#control .btn-group{margin-bottom:10px}#control .btn-group.distance>.btn{width:43px;padding:3px 0;height:30px}#control .slider-handle{width:14px;height:14px;margin-left:-7px;margin-top:-3px}#control .custom_section h1{cursor:pointer}#control .custom_section_horizontal>.custom_control{display:inline-block}#control .custom_section_vertical>.custom_control{display:block}#control .custom_control .slider{margin-left:10px;margin-right:10px;margin-bottom:2px}#control .pulsate_text_opacity{animation:pulsate_input 1s ease-out;animation-iteration-count:infinite}@keyframes pulsate_input{0%{color:#555}50%{color:rgba(85,85,85,.2)}100%{color:#555}}#term .terminal{margin-bottom:30px}#term .terminal #terminal-output,#term .terminal #terminal-output-lowfi{min-height:340px;margin-bottom:5px}#settings_dialog .aboutlink,#settings_dialog .systeminfolink{float:left}#settings_dialog_menu,#wizard_dialog_menu{margin-left:0}#wizard_firstrun_acl .acl_decision{margin-top:1em}#wizard_firstrun_end p,#wizard_firstrun_start p{margin-bottom:1.5em;line-height:1.5}#settings_appearance_managelanguagesdialog_list{width:auto;height:300px;overflow-x:hidden;overflow-y:scroll;padding-right:2px}#settings_appearance_managelanguagesdialog_emptylist{overflow:hidden;width:100%;height:300px;text-align:center;display:table}#settings_appearance_managelanguagesdialog_emptylist div{display:table-cell;vertical-align:middle}#about_authors ul,#about_sponsors ul{columns:3;-webkit-columns:3;-moz-columns:3}.footer ul{margin:0}.footer ul li{display:inline;margin-left:1em;font-size:85%}.footer ul li:first-child{margin-left:0}.footer ul li a{color:#555}.footer #footer_links,.footer #footer_version{max-width:50%}.ui-pnotify{position:fixed}.ui-pnotify .alert a{color:#c09853}.ui-pnotify .alert-danger a,.ui-pnotify .alert-error a{color:#b94a48}.ui-pnotify .alert-success a{color:#468847}.ui-pnotify .alert-info a{color:#3a87ad}.pnotify_additional_info .pnotify_more{font-size:85%}.text-right{text-align:right}.text-center{text-align:center}.text-block{display:block}.overflow_visible{overflow:visible!important}.clickable{cursor:pointer}.border_box{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.hidden{display:none}textarea.block{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;width:100%}@keyframes pulsate{0%{opacity:.5}50%{opacity:1}100%{opacity:.5}}#drop_overlay{position:fixed;top:0;left:0;width:100%;height:100%;z-index:10000;display:none}#drop_overlay.in{display:block}#drop_overlay #drop_overlay_background{position:fixed;top:0;left:0;width:100%;height:100%;background-color:#000;filter:alpha(opacity=50);-moz-opacity:.5;-khtml-opacity:.5;opacity:.5}#drop_overlay #drop_overlay_wrapper{position:absolute;top:0;bottom:0;left:0;right:0;padding-top:60px}#drop_overlay #drop_overlay_wrapper #drop,#drop_overlay #drop_overlay_wrapper #drop_background{position:absolute;top:0;left:0;margin-left:0;width:100%}#drop_overlay #drop_overlay_wrapper #drop_locally,#drop_overlay #drop_overlay_wrapper #drop_locally_background{position:absolute;top:0;left:50%;margin-left:-50%;width:50%;border-right:2px dashed #ccc}#drop_overlay #drop_overlay_wrapper #drop_sd,#drop_overlay #drop_overlay_wrapper #drop_sd_background{position:absolute;top:0;left:50%;margin-left:0;width:50%;border-left:2px dashed #ccc}#drop_overlay #drop_overlay_wrapper .dropzone{height:100%;z-index:10001;color:#fff;font-size:30px}#drop_overlay #drop_overlay_wrapper .dropzone i{font-size:50px}#drop_overlay #drop_overlay_wrapper .dropzone .text{display:block;text-align:center;line-height:40px;position:absolute;width:100%;bottom:5%;filter:alpha(opacity=100);-moz-opacity:1;-khtml-opacity:1;opacity:1}#drop_overlay #drop_overlay_wrapper .dropzone_background{width:50%;height:100%;background-color:#000;filter:alpha(opacity=25);-moz-opacity:.25;-khtml-opacity:.25;opacity:.25}#drop_overlay #drop_overlay_wrapper .dropzone_background.hover{background-color:#000;filter:alpha(opacity=50);-moz-opacity:.5;-khtml-opacity:.5;opacity:.5}#drop_overlay #drop_overlay_wrapper .dropzone_background.fade{-webkit-transition:all .3s ease-out;-moz-transition:all .3s ease-out;-ms-transition:all .3s ease-out;-o-transition:all .3s ease-out;transition:all .3s ease-out;opacity:1}.center{float:none;margin-left:auto;margin-right:auto}.flipH{-webkit-transform:scaleX(-1);-moz-transform:scaleX(-1);-ms-transform:scaleX(-1);transform:scaleX(-1)}.flipV{-webkit-transform:scaleY(-1);-moz-transform:scaleY(-1);-ms-transform:scaleY(-1);transform:scaleY(-1)}.flipH.flipV{-webkit-transform:scaleX(-1) scaleY(-1);-moz-transform:scaleX(-1) scaleY(-1);-ms-transform:scaleX(-1) scaleY(-1);transform:scaleX(-1) scaleY(-1)}.rotate90{-webkit-transform:rotate(-90deg);transform:rotate(-90deg)}.ui-pnotify a{text-decoration:underline}.btn-mini .caret,.btn-small .caret{margin-top:8px}.dropdown-menu-right{right:0;left:auto}.slider .slider-selection{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,.25);background-color:#006dcc;background-image:-moz-linear-gradient(top,#08c,#04c);background-image:-webkit-gradient(linear,0 0,0 100%,from(#08c),to(#04c));background-image:-webkit-linear-gradient(top,#08c,#04c);background-image:-o-linear-gradient(top,#08c,#04c);background-image:linear-gradient(to bottom,#08c,#04c);background-repeat:repeat-x;border-color:#04c #04c #002a80;border-color:rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25);*background-color:#04c;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.slider .slider-selection.active,.slider .slider-selection.disabled,.slider .slider-selection:active,.slider .slider-selection:focus,.slider .slider-selection:hover,.slider .slider-selection[disabled]{color:#fff;background-color:#04c;*background-color:#003bb3}.slider .slider-selection.active,.slider .slider-selection:active{background-color:#039 \9}.slider.slider-disabled .slider-selection{background-image:none;opacity:.65;filter:alpha(opacity=65);-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}.slider .slider-track{background-color:#f5f5f5;border:1px solid #e3e3e3;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.05);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,.05);box-shadow:inset 0 1px 1px rgba(0,0,0,.05)}.slider.slider-disabled .slider-track{background-image:none;opacity:.65;filter:alpha(opacity=65);-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}.slider .slider-handle{display:inline-block;*display:inline;*zoom:1;font-size:14px;line-height:20px;text-align:center;vertical-align:middle;cursor:pointer;color:#333;text-shadow:0 1px 1px rgba(255,255,255,.75);background-color:#f5f5f5;background-image:-moz-linear-gradient(top,#fff,#e6e6e6);background-image:-webkit-gradient(linear,0 0,0 100%,from(#fff),to(#e6e6e6));background-image:-webkit-linear-gradient(top,#fff,#e6e6e6);background-image:-o-linear-gradient(top,#fff,#e6e6e6);background-image:linear-gradient(to bottom,#fff,#e6e6e6);background-repeat:repeat-x;*background-color:#e6e6e6;border:1px solid #ccc;*border:0;border-bottom-color:#b3b3b3;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;*margin-left:.3em;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05);-moz-box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05);padding:0;margin-bottom:0;opacity:1;filter:alpha(opacity=100)}.slider .slider-handle.active,.slider .slider-handle.disabled,.slider .slider-handle:active,.slider .slider-handle:focus,.slider .slider-handle:hover,.slider .slider-handle[disabled]{color:#333;background-color:#e6e6e6;*background-color:#d9d9d9}.slider .slider-handle.active,.slider .slider-handle:active{background-color:#ccc \9}.slider .slider-handle:first-child{*margin-left:0}.slider .slider-handle:focus,.slider .slider-handle:hover{color:#333;text-decoration:none;background-position:0 -15px;-webkit-transition:background-position .1s linear;-moz-transition:background-position .1s linear;-o-transition:background-position .1s linear;transition:background-position .1s linear}.slider .slider-handle:focus{outline:#333 dotted thin;outline:-webkit-focus-ring-color auto 5px;outline-offset:-2px}.slider .slider-handle.active,.slider .slider-handle:active{background-image:none;outline:0;-webkit-box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05);-moz-box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 2px 4px rgba(0,0,0,.15),0 1px 2px rgba(0,0,0,.05)}.slider .slider-handle.disabled,.slider .slider-handle[disabled]{cursor:default;background-image:none;opacity:.65;filter:alpha(opacity=65);-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}.slider .slider-handle.hide{display:none}.slider .slider-handle.round{-webkit-border-radius:50%;-moz-border-radius:50%;border-radius:50%}.modal.large{width:975px;margin-left:-487px}.full-sized-box{position:absolute;bottom:0;left:0;right:0;top:0;padding:15px}.full-sized-box .row-fluid{height:100%}@media (max-width:979px){.full-sized-box{position:static}}:root .full-sized-box,_::-webkit-full-page-media,_:future{position:static}.safari ::-webkit-scrollbar{width:10px}.safari ::-webkit-scrollbar-track{border-radius:8px;-webkit-border-radius:8px}.safari ::-webkit-scrollbar-thumb{-webkit-border-radius:10px;border-radius:10px;background:rgba(100,100,100,.8)}.scrollable{height:100%;overflow:auto;-webkit-overflow-scrolling:touch}.pre-output span{display:block}.input-append .add-on.add-on-limited,.input-prepend .add-on.add-on-limited{overflow-x:hidden;text-overflow:ellipsis;width:inherit}.input-append .btn-group:first-child .btn:first-child,.input-prepend .btn-group:first-child .btn:first-child{-webkit-border-radius:4px 0 0 4px;-moz-border-radius:4px 0 0 4px;border-radius:4px 0 0 4px}.input-append .btn-group .btn:first-child,.input-prepend .btn-group .btn:first-child{-webkit-border-radius:0;-moz-border-radius:0;border-radius:0}.input-append.input-block-level,.input-prepend.input-block-level{display:table}.input-append.input-block-level .add-on,.input-prepend.input-block-level .add-on{display:table-cell;width:1%}.input-append.input-block-level>input,.input-prepend.input-block-level>input{box-sizing:border-box;display:table;min-height:inherit;width:100%}.input-append.input-block-level :not(:last-child),.input-prepend.input-block-level :not(:last-child){border-right:0}.control-group.error .input-append .fileinput-button,.control-group.error .input-prepend .fileinput-button{border-color:#b94a48}.control-text{padding-top:5px;cursor:default}input[type=number]{text-align:right}input[type=number].input-nospin::-webkit-inner-spin-button,input[type=number].input-nospin::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}input[type=number].input-nospin{-moz-appearance:textfield}.dropdown-menu li a.disabled,.dropdown-menu li a.disabled:active,.dropdown-menu li a.disabled:hover,.dropdown-menu li a.disabled:visited{background-color:transparent;background-image:none;color:#aaa;cursor:default}textarea.monospace{font-family:monospace}.progress-text,.progress-text-centered{position:relative}.progress-text .progress-text-back,.progress-text .progress-text-front,.progress-text-centered .progress-text-back,.progress-text-centered .progress-text-front{white-space:nowrap}.progress-text .progress-text-front,.progress-text-centered .progress-text-front{box-sizing:border-box;padding:0 10px;width:100%;display:block}.progress-text .progress-text-back,.progress-text-centered .progress-text-back{position:absolute;font-size:12px;line-height:20px;display:block;box-sizing:border-box;text-align:center;padding:0 10px}.progress-text .bar,.progress-text-centered .bar{position:absolute;overflow:hidden}.progress-text-centered .progress-text-front{position:absolute;font-size:12px;line-height:20px;display:block;text-align:center;color:#fff}.progress-text-centered .progress-text-back{width:100%}.search-query-with-clear{position:relative}.search-query-with-clear .search-clear{display:inline-block;color:#ccc;position:absolute;right:28px;height:20px;padding:4px 0;cursor:pointer;visibility:hidden}.search-query-with-clear.active-clear .search-query{padding-right:28px;width:192px}.search-query-with-clear.active-clear .search-clear{visibility:visible}.search-query-with-clear input::-ms-clear{display:none}.search-query-with-clear input[type=search]::-webkit-search-cancel-button,.search-query-with-clear input[type=search]::-webkit-search-decoration,.search-query-with-clear input[type=search]::-webkit-search-results-button,.search-query-with-clear input[type=search]::-webkit-search-results-decoration{-webkit-appearance:none}#navbar_login:not(.open) #login_dropdown_loggedout{display:block;z-index:-1;height:0;width:0;padding:0!important;overflow:hidden;border:0;box-shadow:none;left:-9999px}#navbar_login:not(.open) #login_dropdown_loggedout.hide{display:none}#loginForm{margin:0}#loginForm button{margin-top:20px}#page-container-loading{position:fixed;top:0;left:0;width:100%;height:100%;background-color:#fff;z-index:12301}#page-container-loading .wrapper{position:absolute;top:0;bottom:0;left:0;right:0}#page-container-loading .wrapper .outer{display:table;width:100%;height:100%}#page-container-loading .wrapper .outer .inner{display:table-cell;vertical-align:middle}#page-container-loading .wrapper .outer .inner .content{text-align:center}#page-container-noscript{position:fixed;top:0;left:0;width:100%;height:100%;background-color:#fff;z-index:12310}#page-container-noscript .wrapper{position:absolute;top:0;bottom:0;left:0;right:0}#page-container-noscript .wrapper .outer{display:table;width:100%;height:100%}#page-container-noscript .wrapper .outer .inner{display:table-cell;vertical-align:middle}#page-container-noscript .wrapper .outer .inner .content{text-align:center} \ No newline at end of file From 47eeb0eb00e0f3983015d3e344a350548ca30799 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Tue, 16 Feb 2021 17:10:50 +0100 Subject: [PATCH 22/45] =?UTF-8?q?=F0=9F=93=9D=20Add=20some=20more=20exampl?= =?UTF-8?q?es=20for=20socket=20auth?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Also fix a problem with a config example's markup --- docs/api/push.rst | 26 ++++++++++++++++++++++++++ docs/features/accesscontrol.rst | 1 + docs/jsclientlib/browser.rst | 19 +++++++++++++++++++ 3 files changed, 46 insertions(+) diff --git a/docs/api/push.rst b/docs/api/push.rst index c9c6a4b04..36f6f1820 100644 --- a/docs/api/push.rst +++ b/docs/api/push.rst @@ -68,6 +68,32 @@ OctoPrint's SockJS socket also accepts two commands from the client to the serve "auth": "someuser:LGZ0trf8By" } + Example for a auth roundtrip with only an API key, using the :ref:`JS Client Library `: + + .. sourcecode:: javascript + + var client = new OctoPrintClient({baseurl: "http://example.com/octoprint1/", apikey: "apikey1"}); + client.socket.connect(); + client.browser.passiveLogin().done(function(response) { + client.socket.sendAuth(response.name, response.session).done(function() { + // the socket is now authenticated + }) + }) + + .. mermaid:: + + sequenceDiagram + participant Client + participant API + participant Websocket + + Client->>API: GET /api/login?passive=true&apikey=... + API->>Client: { name: ..., session: ..., ... } + + note over Client auth = name + ":" + session + + Client->>Websocket: { "auth": auth } + * ``throttle``: Usually, OctoPrint will push the general state update in the ``current`` message twice per second. For some clients that might still be too fast, so they can signal a different factor to OctoPrint utilizing the diff --git a/docs/features/accesscontrol.rst b/docs/features/accesscontrol.rst index 23bf90b75..62a548768 100644 --- a/docs/features/accesscontrol.rst +++ b/docs/features/accesscontrol.rst @@ -177,6 +177,7 @@ further down there's also a dedicated list of steps for OctoPi specifically. salt line): .. code-block:: yaml + accessControl: salt: aabbccddee1234523452345 autologinLocal: true diff --git a/docs/jsclientlib/browser.rst b/docs/jsclientlib/browser.rst index d44ba08bf..e71c26a60 100644 --- a/docs/jsclientlib/browser.rst +++ b/docs/jsclientlib/browser.rst @@ -29,6 +29,25 @@ Tries to perform a passive login into OctoPrint, using existing session data stored in the browser's cookies. + .. code-block:: javascript + + OctoPrint.browser.passiveLogin() + .done(function(response) { + // do something with the response + }) + + .. code-block:: javascript + + var client = new OctoPrintClient({ + baseurl: "https://example.com/", + apikey: "..." + }); + client.browser.passiveLogin() + .done(function(response) { + // do something with the response, e.g. authenticate with the socket + // via response.name and response.session + }) + :param object opts: Additional request options :returns Promise: A `jQuery Promise `_ for the request's response From 281c4b698c0e3cea31b4bcfdb13e60d45ec44ccf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Tue, 16 Feb 2021 17:21:19 +0100 Subject: [PATCH 23/45] =?UTF-8?q?=F0=9F=93=9D=20Merge=20auth=20example=20w?= =?UTF-8?q?ith=20existing=20one?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/api/push.rst | 13 ++----------- docs/jsclientlib/base.rst | 8 ++++---- docs/jsclientlib/socket.rst | 18 ++++++++++++++++++ 3 files changed, 24 insertions(+), 15 deletions(-) diff --git a/docs/api/push.rst b/docs/api/push.rst index 36f6f1820..f316ba70c 100644 --- a/docs/api/push.rst +++ b/docs/api/push.rst @@ -68,17 +68,8 @@ OctoPrint's SockJS socket also accepts two commands from the client to the serve "auth": "someuser:LGZ0trf8By" } - Example for a auth roundtrip with only an API key, using the :ref:`JS Client Library `: - - .. sourcecode:: javascript - - var client = new OctoPrintClient({baseurl: "http://example.com/octoprint1/", apikey: "apikey1"}); - client.socket.connect(); - client.browser.passiveLogin().done(function(response) { - client.socket.sendAuth(response.name, response.session).done(function() { - // the socket is now authenticated - }) - }) + An example for an auth roundtrip with only an API key using the :ref:`JS Client Library ` + can be found :ref:`here `. .. mermaid:: diff --git a/docs/jsclientlib/base.rst b/docs/jsclientlib/base.rst index 63833f0dc..37416fd10 100644 --- a/docs/jsclientlib/base.rst +++ b/docs/jsclientlib/base.rst @@ -14,13 +14,13 @@ The client library instance's options. The following keys are currently supported: - ``apikey`` - The API Key to use for requests against the OctoPrint API. Should usually be - the anonymous UI API Key provided on the socket. - ``baseurl`` The base URL of the OctoPrint API + ``apikey`` + The API Key to use for requests against the OctoPrint API. If left unset, you'll + need to authenticate your session through a login. + ``locale`` The locale to set in ``X-Locale`` headers on API requests. Useful for API endpoints that might return localized content. diff --git a/docs/jsclientlib/socket.rst b/docs/jsclientlib/socket.rst index 70b9bc5dc..fc4223546 100644 --- a/docs/jsclientlib/socket.rst +++ b/docs/jsclientlib/socket.rst @@ -114,9 +114,13 @@ Instructs the server to decrease the message rate by 500ms. +.. _sec-jsclient-socket-authsample: + Sample to setup an authed socket ================================ +If you have a username and a password: + .. code-block:: javascript OctoPrint.socket.connect(); @@ -125,6 +129,20 @@ Sample to setup an authed socket OctoPrint.socket.sendAuth("myusername", response.session); }); +If you have an API key: + +.. code-block:: javascript + + var client = new OctoPrintClient({ + baseurl: "http://example.com/", + apikey: "abcdef" + }); + client.socket.connect(); + client.browser.passiveLogin() + .done(function(response) { + client.socket.sendAuth(response.name, response.session); + }); + .. _sec-jsclient-socket-throttling: Communication Throttling From 68660035b612a70c020746e99db17e4c3fb9b827 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Tue, 16 Feb 2021 17:22:37 +0100 Subject: [PATCH 24/45] =?UTF-8?q?=F0=9F=93=9D=20Fix=20diagram?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/api/push.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/api/push.rst b/docs/api/push.rst index f316ba70c..5210ad599 100644 --- a/docs/api/push.rst +++ b/docs/api/push.rst @@ -81,7 +81,7 @@ OctoPrint's SockJS socket also accepts two commands from the client to the serve Client->>API: GET /api/login?passive=true&apikey=... API->>Client: { name: ..., session: ..., ... } - note over Client auth = name + ":" + session + note over Client: auth = name ":" session Client->>Websocket: { "auth": auth } From 0297a685360e9c12a18431c3ec02f0253cbbbc38 Mon Sep 17 00:00:00 2001 From: LazeMSS Date: Thu, 11 Feb 2021 10:08:54 +0100 Subject: [PATCH 25/45] Center Viewport on gcode viewer is cased wrong --- src/octoprint/plugins/gcodeviewer/static/js/gcodeviewer.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/octoprint/plugins/gcodeviewer/static/js/gcodeviewer.js b/src/octoprint/plugins/gcodeviewer/static/js/gcodeviewer.js index 6fb9ba4e3..c462bc1c3 100644 --- a/src/octoprint/plugins/gcodeviewer/static/js/gcodeviewer.js +++ b/src/octoprint/plugins/gcodeviewer/static/js/gcodeviewer.js @@ -879,8 +879,8 @@ $(function () { self.resetOptions(); var current = loadFromLocalStorage(optionsLocalStorageKey); - if (current["centerViewport"] !== undefined) - self.renderer_centerViewport(current["centerViewport"]); + if (current["centerViewPort"] !== undefined) + self.renderer_centerViewport(current["centerViewPort"]); if (current["zoomOnModel"] !== undefined) self.renderer_zoomOnModel(current["zoomOnModel"]); if (current["showMoves"] !== undefined) From 32fd4df542c952443def340e2925e4541e4bf9c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Thu, 4 Feb 2021 17:43:31 +0100 Subject: [PATCH 26/45] =?UTF-8?q?=E2=9C=A8=20backup:=20add=20warning=20abo?= =?UTF-8?q?ut=20max=20upload=20size?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #3993 --- src/octoprint/plugins/backup/__init__.py | 14 ++++++++++++-- src/octoprint/plugins/backup/static/js/backup.js | 6 ++++++ .../backup/templates/backup_settings.jinja2 | 13 ++++++++++++- src/octoprint/server/views.py | 13 +++++++++++++ src/octoprint/static/js/recovery/recovery.js | 5 +++++ src/octoprint/templates/recovery.jinja2 | 14 +++++++++++++- 6 files changed, 61 insertions(+), 4 deletions(-) diff --git a/src/octoprint/plugins/backup/__init__.py b/src/octoprint/plugins/backup/__init__.py index bd3e73ab8..85453b664 100644 --- a/src/octoprint/plugins/backup/__init__.py +++ b/src/octoprint/plugins/backup/__init__.py @@ -51,12 +51,15 @@ from flask_babel import gettext from octoprint.plugins.pluginmanager import DEFAULT_PLUGIN_REPOSITORY from octoprint.settings import valid_boolean_trues +from octoprint.util import get_formatted_size from octoprint.util.text import sanitize UNKNOWN_PLUGINS_FILE = "unknown_plugins_from_restore.json" BACKUP_DATE_TIME_FMT = "%Y%m%d-%H%M%S" +MAX_UPLOAD_SIZE = 1024 * 1024 * 1024 # 1GB + class BackupPlugin( octoprint.plugin.SettingsPlugin, @@ -124,6 +127,12 @@ class BackupPlugin( {"type": "wizard", "name": gettext("Restore Backup?")}, ] + def get_template_vars(self): + return { + "max_upload_size": MAX_UPLOAD_SIZE, + "max_upload_size_str": get_formatted_size(MAX_UPLOAD_SIZE), + } + ##~~ BlueprintPlugin @octoprint.plugin.BlueprintPlugin.route("/", methods=["GET"]) @@ -137,6 +146,7 @@ class BackupPlugin( backup_in_progress=len(self._in_progress) > 0, unknown_plugins=unknown_plugins, restore_supported=self._restore_supported(self._settings), + max_upload_size=MAX_UPLOAD_SIZE, ) @octoprint.plugin.BlueprintPlugin.route("/unknown_plugins", methods=["GET"]) @@ -391,8 +401,8 @@ class BackupPlugin( ] def bodysize_hook(self, current_max_body_sizes, *args, **kwargs): - # max upload size of 1GB for the restore endpoint - return [("POST", r"/restore", 1024 * 1024 * 1024)] + # max upload size for the restore endpoint + return [("POST", r"/restore", MAX_UPLOAD_SIZE)] # Exported plugin helpers def create_backup_helper(self, exclude=None, filename=None): diff --git a/src/octoprint/plugins/backup/static/js/backup.js b/src/octoprint/plugins/backup/static/js/backup.js index 5f1894efd..436f699d9 100644 --- a/src/octoprint/plugins/backup/static/js/backup.js +++ b/src/octoprint/plugins/backup/static/js/backup.js @@ -27,10 +27,15 @@ $(function () { self.excludeFromBackup = ko.observableArray([]); self.backupInProgress = ko.observable(false); self.restoreSupported = ko.observable(true); + self.maxUploadSize = ko.observable(0); self.backupUploadData = undefined; self.backupUploadName = ko.observable(); + self.isAboveUploadSize = function (data) { + return data.size > self.maxUploadSize(); + }; + var backupFileuploadOptions = { dataType: "json", maxNumberOfFiles: 1, @@ -70,6 +75,7 @@ $(function () { self.backups.updateItems(response.backups); self.unknownPlugins(response.unknown_plugins); self.restoreSupported(response.restore_supported); + self.maxUploadSize(response.max_upload_size); }; self.createBackup = function () { diff --git a/src/octoprint/plugins/backup/templates/backup_settings.jinja2 b/src/octoprint/plugins/backup/templates/backup_settings.jinja2 index d6fdede80..50077d250 100644 --- a/src/octoprint/plugins/backup/templates/backup_settings.jinja2 +++ b/src/octoprint/plugins/backup/templates/backup_settings.jinja2 @@ -45,7 +45,7 @@ - +  |  |  @@ -61,6 +61,17 @@
    • ยป
    + +

    + {{ _("Note:") }} + {% trans marker="" %} + OctoPrint currently only allows uploading backups of a maximum size of + {{ plugin_backup_max_upload_size_str }} via the UI. Backups larger than this can only be restored by command line, + or by adjusting the size by removing large contents (like timelapses) from the + zip prior to uploading. Backups exceeding this size limit are marked with a + {{ marker }} up there. + {% endtrans %} +

    {{ _('Create backup') }}

    diff --git a/src/octoprint/server/views.py b/src/octoprint/server/views.py index f5d0b5a28..201eeabe6 100644 --- a/src/octoprint/server/views.py +++ b/src/octoprint/server/views.py @@ -228,6 +228,19 @@ def recovery(): except Exception: _logger.exception("Error processing theming CSS, ignoring") + try: + from octoprint.plugins.backup import MAX_UPLOAD_SIZE + from octoprint.util import get_formatted_size + + render_kwargs.update( + { + "plugin_backup_max_upload_size": MAX_UPLOAD_SIZE, + "plugin_backup_max_upload_size_str": get_formatted_size(MAX_UPLOAD_SIZE), + } + ) + except Exception: + _logger.exception("Error adding backup upload size info, ignoring") + return render_template("recovery.jinja2", **render_kwargs) diff --git a/src/octoprint/static/js/recovery/recovery.js b/src/octoprint/static/js/recovery/recovery.js index efe453aa3..6f5bc671e 100644 --- a/src/octoprint/static/js/recovery/recovery.js +++ b/src/octoprint/static/js/recovery/recovery.js @@ -53,6 +53,10 @@ $(function () { self.restoreSupported = ko.observable(false); self.backups = ko.observableArray([]); self.excludeFromBackup = ko.observableArray([]); + self.backupMaxUploadSize = ko.observable(); + self.backupIsAboveUploadSize = function (data) { + return data.size > self.backupMaxUploadSize(); + }; // working dialog self.workDialog = $("#workdialog"); @@ -96,6 +100,7 @@ $(function () { OctoPrint.plugins.backup.get().done(function (resp) { self.backupSupported(true); self.restoreSupported(resp.restore_supported); + self.backupMaxUploadSize(resp.max_upload_size); var backups = resp.backups; backups.sort(function (a, b) { diff --git a/src/octoprint/templates/recovery.jinja2 b/src/octoprint/templates/recovery.jinja2 index a5c9a40e5..61ae022c7 100644 --- a/src/octoprint/templates/recovery.jinja2 +++ b/src/octoprint/templates/recovery.jinja2 @@ -132,7 +132,9 @@ - + + ! + @@ -141,6 +143,16 @@ +

    + {{ _("Note:") }} + {% trans marker="!" %} + OctoPrint currently only allows uploading backups of a maximum size of + {{ plugin_backup_max_upload_size_str }} via the UI. Backups larger than this can only be restored by command line, + or by adjusting the size by removing large contents (like timelapses) from the + zip prior to uploading. Backups exceeding this size limit are marked with a + {{ marker }} up there. + {% endtrans %} +

    {{ _('There are no backups yet.') }}

    From 55b08f6b5b102f5cb26aa496bfc59b1785f552d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Wed, 17 Feb 2021 14:05:40 +0100 Subject: [PATCH 27/45] =?UTF-8?q?=E2=9C=A8=20backup:=20allow=20retore=20of?= =?UTF-8?q?=20backups=20from=20newer=20patch=20versions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit E.g. backups from 1.6.3 can be applied on 1.6.2. However, 1.6.x still won't be possible to restore under 1.5.x or earlier. --- src/octoprint/plugins/backup/__init__.py | 4 +- src/octoprint/util/version.py | 60 ++++++++++++++++-------- tests/util/test_version.py | 57 ++++++++++++++++++++++ 3 files changed, 100 insertions(+), 21 deletions(-) create mode 100644 tests/util/test_version.py diff --git a/src/octoprint/plugins/backup/__init__.py b/src/octoprint/plugins/backup/__init__.py index 85453b664..9e204d223 100644 --- a/src/octoprint/plugins/backup/__init__.py +++ b/src/octoprint/plugins/backup/__init__.py @@ -1154,8 +1154,8 @@ class BackupPlugin( metadata_bytes = zip.read(metadata_zipinfo) metadata = json.loads(metadata_bytes) - backup_version = get_comparable_version(metadata["version"], base=True) - if backup_version > get_octoprint_version(base=True): + backup_version = get_comparable_version(metadata["version"], cut=1) + if backup_version > get_octoprint_version(cut=1): if callable(on_invalid_backup): on_invalid_backup( "Backup is from a newer version of OctoPrint and cannot be applied" diff --git a/src/octoprint/util/version.py b/src/octoprint/util/version.py index f14dec50f..19e46494f 100644 --- a/src/octoprint/util/version.py +++ b/src/octoprint/util/version.py @@ -18,9 +18,9 @@ def get_octoprint_version_string(): return __version__ -def get_octoprint_version(base=False): - octoprint_version_string = get_octoprint_version_string() - return get_comparable_version(octoprint_version_string, base=base) +def get_octoprint_version(cut=None, **kwargs): + octoprint_version_string = normalize_version(get_octoprint_version_string()) + return get_comparable_version(octoprint_version_string, cut=cut, **kwargs) def is_released_octoprint_version(version=None): @@ -129,11 +129,7 @@ def is_octoprint_compatible(*compatibility_entries, **kwargs): def get_python_version_string(): from platform import python_version - version_string = python_version() - - # Debian has the python version set to 2.7.15+ which is not PEP440 compliant (bug 914072) - if version_string.endswith("+"): - version_string = version_string[:-1] + version_string = normalize_version(python_version()) return version_string @@ -154,21 +150,27 @@ def is_python_compatible(compat, **kwargs): return python_version in s -def get_comparable_version(version_string, base=False): - if "-" in version_string: - version_string = version_string[: version_string.find("-")] +def get_comparable_version(version_string, cut=None, **kwargs): + """ + Args: + version_string: The version string for which to create a comparable version instance + cut: optional, how many version digits to remove (e.g., cut=1 will turn 1.2.3 into 1.2). + Defaults to ``None``, meaning no further action. Settings this to 0 will remove + anything up to the last digit, e.g. dev or rc information. - # Debian has the python version set to 2.7.15+ which is not PEP440 compliant (bug 914072) - if version_string.endswith("+"): - version_string = version_string[:-1] + Returns: + A comparable version + """ + if "base" in kwargs and kwargs.get("base", False) and cut is None: + cut = 0 + if cut is not None and (cut < 0 or not isinstance(cut, int)): + raise ValueError("level must be a positive integer") + + version_string = normalize_version(version_string) version = pkg_resources.parse_version(version_string) - # A leading v is common in github release tags and old setuptools doesn't remove it. - if version and isinstance(version, tuple) and version[0].lower() == "*v": - version = version[1:] - - if base: + if cut is not None: if isinstance(version, tuple): # old setuptools base_version = [] @@ -176,11 +178,17 @@ def get_comparable_version(version_string, base=False): if part.startswith("*"): break base_version.append(part) + if 0 < cut < len(base_version): + base_version = base_version[:-cut] base_version.append("*final") version = tuple(base_version) else: # new setuptools version = pkg_resources.parse_version(version.base_version) + if 0 < cut < len(version.release): + reduced = version.release[:-cut] + version = pkg_resources.parse_version(".".join(str(x) for x in reduced)) + return version @@ -193,3 +201,17 @@ def is_prerelease(version_string): else: # new setuptools return version.is_prerelease + + +def normalize_version(version): + if "-" in version: + version = version[: version.find("-")] + + # Debian has the python version set to 2.7.15+ which is not PEP440 compliant (bug 914072) + if version.endswith("+"): + version = version[:-1] + + if version[0].lower() == "v": + version = version[1:] + + return version.strip() diff --git a/tests/util/test_version.py b/tests/util/test_version.py new file mode 100644 index 000000000..59df747ea --- /dev/null +++ b/tests/util/test_version.py @@ -0,0 +1,57 @@ +# -*- coding: utf-8 -*- +from __future__ import absolute_import, division, print_function, unicode_literals + +__license__ = "GNU Affero General Public License http://www.gnu.org/licenses/agpl.html" +__copyright__ = "Copyright (C) 2021 The OctoPrint Project - Released under terms of the AGPLv3 License" + +import unittest + +import ddt +import pkg_resources + + +@ddt.ddt +class VersionUtilTest(unittest.TestCase): + @ddt.data( + ("1.6.0.dev303+g328853170.dirty", None, "1.6.0.dev303+g328853170.dirty"), + ("1.6.0.dev303+g328853170.dirty", 0, "1.6.0"), + ("1.6.0.dev303+g328853170.dirty", 1, "1.6"), + ("1.6.0", 0, "1.6.0"), + ("1.6.0", 23, "1.6.0"), + ("1.6.0", -1, ValueError), + ) + @ddt.unpack + def test_get_comparable_version(self, version, cut, expected): + from octoprint.util.version import get_comparable_version + + try: + actual = get_comparable_version(version, cut=cut) + except Exception as exc: + if isinstance(expected, type) and isinstance(exc, expected): + pass + else: + raise + else: + self.assertEqual(actual, pkg_resources.parse_version(expected)) + + def test_get_comparable_version_base(self): + from octoprint.util.version import get_comparable_version + + actual = get_comparable_version("1.6.0.dev303+g328853170.dirty", base=True) + self.assertEqual(actual, pkg_resources.parse_version("1.6.0")) + + @ddt.data( + ("1.6.0", "1.6.0"), + ("v1.6.0", "1.6.0"), + ("V1.6.0", "1.6.0"), + ("1.6.0+", "1.6.0"), + ("\t1.6.0 \r\n", "1.6.0"), + ("1.6.0-dev123", "1.6.0"), + ) + @ddt.unpack + def test_normalize_version(self, version, expected): + from octoprint.util.version import normalize_version + + actual = normalize_version(version) + + self.assertEqual(actual, expected) From 5d6a27b7515f056e255d19ad716fd401dda92d89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Wed, 17 Feb 2021 14:36:00 +0100 Subject: [PATCH 28/45] =?UTF-8?q?=F0=9F=91=B7=20Add=20a=20nightly=20merge?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Should keep `maintenance` and `devel` up to date. --- .github/workflows/nightly_merge.yml | 31 +++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .github/workflows/nightly_merge.yml diff --git a/.github/workflows/nightly_merge.yml b/.github/workflows/nightly_merge.yml new file mode 100644 index 000000000..520a42e3e --- /dev/null +++ b/.github/workflows/nightly_merge.yml @@ -0,0 +1,31 @@ +name: "Nightly merge" + +on: + schedule: + - cron: "0 0 * * *" + workflow_dispatch: + +jobs: + nightly-merge: + runs-on: ubuntu-latest + steps: + - name: โฌ‡ Checkout + uses: actions/checkout@v2 + + - name: ๐Ÿ”€ Merge master on maintenance + uses: robotology/gh-action-nightly-merge@v1.3.2 + with: + stable_branch: "master" + development_branch: "maintenance" + allow_ff: false + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: ๐Ÿ”€ Merge maintenance on devel + uses: robotology/gh-action-nightly-merge@v1.3.2 + with: + stable_branch: "master" + development_branch: "maintenance" + allow_ff: false + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 1637631ef72eea7f2d903ac4d4ad062d6ed7827f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Wed, 17 Feb 2021 14:41:11 +0100 Subject: [PATCH 29/45] =?UTF-8?q?=F0=9F=91=B7=20Make=20sure=20to=20fetch?= =?UTF-8?q?=20all=20history?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/nightly_merge.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/nightly_merge.yml b/.github/workflows/nightly_merge.yml index 520a42e3e..f9ddcb7a7 100644 --- a/.github/workflows/nightly_merge.yml +++ b/.github/workflows/nightly_merge.yml @@ -11,6 +11,8 @@ jobs: steps: - name: โฌ‡ Checkout uses: actions/checkout@v2 + with: + fetch-depth: 0 - name: ๐Ÿ”€ Merge master on maintenance uses: robotology/gh-action-nightly-merge@v1.3.2 From 4a58c848b8c91b21fe97dc4dee105c2191ecb5b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Wed, 17 Feb 2021 14:44:43 +0100 Subject: [PATCH 30/45] =?UTF-8?q?=F0=9F=8E=A8=20Let=20prettier=20do=20its?= =?UTF-8?q?=20job?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/nightly_merge.yml | 42 ++++++++++++++--------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/.github/workflows/nightly_merge.yml b/.github/workflows/nightly_merge.yml index f9ddcb7a7..5aeb5af3d 100644 --- a/.github/workflows/nightly_merge.yml +++ b/.github/workflows/nightly_merge.yml @@ -2,32 +2,32 @@ name: "Nightly merge" on: schedule: - - cron: "0 0 * * *" + - cron: "0 0 * * *" workflow_dispatch: jobs: nightly-merge: runs-on: ubuntu-latest steps: - - name: โฌ‡ Checkout - uses: actions/checkout@v2 - with: - fetch-depth: 0 + - name: โฌ‡ Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 - - name: ๐Ÿ”€ Merge master on maintenance - uses: robotology/gh-action-nightly-merge@v1.3.2 - with: - stable_branch: "master" - development_branch: "maintenance" - allow_ff: false - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: ๐Ÿ”€ Merge master on maintenance + uses: robotology/gh-action-nightly-merge@v1.3.2 + with: + stable_branch: "master" + development_branch: "maintenance" + allow_ff: false + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: ๐Ÿ”€ Merge maintenance on devel - uses: robotology/gh-action-nightly-merge@v1.3.2 - with: - stable_branch: "master" - development_branch: "maintenance" - allow_ff: false - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: ๐Ÿ”€ Merge maintenance on devel + uses: robotology/gh-action-nightly-merge@v1.3.2 + with: + stable_branch: "master" + development_branch: "maintenance" + allow_ff: false + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 559e5d8f8477677850918e88bdb431d32ce9d78b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Wed, 17 Feb 2021 14:51:11 +0100 Subject: [PATCH 31/45] =?UTF-8?q?=F0=9F=91=B7=20Disable=20nightly=20merge?= =?UTF-8?q?=20from=20maintenance=20to=20devel?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit That will need too much manual merging for now due to Py2&3 vs Py3. --- .github/workflows/nightly_merge.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/nightly_merge.yml b/.github/workflows/nightly_merge.yml index 5aeb5af3d..4d54ff64c 100644 --- a/.github/workflows/nightly_merge.yml +++ b/.github/workflows/nightly_merge.yml @@ -14,7 +14,7 @@ jobs: with: fetch-depth: 0 - - name: ๐Ÿ”€ Merge master on maintenance + - name: ๐Ÿ”€ Merge master into maintenance uses: robotology/gh-action-nightly-merge@v1.3.2 with: stable_branch: "master" @@ -23,11 +23,11 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: ๐Ÿ”€ Merge maintenance on devel - uses: robotology/gh-action-nightly-merge@v1.3.2 - with: - stable_branch: "master" - development_branch: "maintenance" - allow_ff: false - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + #- name: ๐Ÿ”€ Merge maintenance into devel + # uses: robotology/gh-action-nightly-merge@v1.3.2 + # with: + # stable_branch: "maintenance" + # development_branch: "devel" + # allow_ff: false + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 6cfbf33d08f12d649210ddcf23b2427ea8b98565 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Wed, 17 Feb 2021 15:11:09 +0100 Subject: [PATCH 32/45] =?UTF-8?q?=F0=9F=90=9B=20Fix=20get=5Fcomparable=5Fv?= =?UTF-8?q?ersion?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Apparently not all versions of pkg_resources have a release field on Version. So let's create that ourselves instead. --- src/octoprint/util/version.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/octoprint/util/version.py b/src/octoprint/util/version.py index 19e46494f..81a6beed0 100644 --- a/src/octoprint/util/version.py +++ b/src/octoprint/util/version.py @@ -185,9 +185,13 @@ def get_comparable_version(version_string, cut=None, **kwargs): else: # new setuptools version = pkg_resources.parse_version(version.base_version) - if 0 < cut < len(version.release): - reduced = version.release[:-cut] - version = pkg_resources.parse_version(".".join(str(x) for x in reduced)) + if cut is not None: + parts = version.base_version.split(".") + if 0 < cut < len(parts): + reduced = parts[:-cut] + version = pkg_resources.parse_version( + ".".join(str(x) for x in reduced) + ) return version From 14b462ae98bf63ee669edbd1deecd1a0f5b705d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Fri, 12 Feb 2021 10:24:52 +0100 Subject: [PATCH 33/45] :children_crossing: Bug issue form v2 --- .github/ISSUE_TEMPLATE/bug_report_v2.yml | 136 +++++++++++++++++++++++ 1 file changed, 136 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/bug_report_v2.yml diff --git a/.github/ISSUE_TEMPLATE/bug_report_v2.yml b/.github/ISSUE_TEMPLATE/bug_report_v2.yml new file mode 100644 index 000000000..784d39c09 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report_v2.yml @@ -0,0 +1,136 @@ +name: Bug report +about: Create a report to help improve OctoPrint +title: "" +issue_body: true +body: + - type: markdown + attributes: + value: > + **Thank you for wanting to report a bug in OctoPrint!** + + + If this is the first time you are doing this, please take a few moments to read + through the [Contribution Guidelines](https://github.com/OctoPrint/OctoPrint/blob/master/CONTRIBUTING.md). + Also check out [the FAQ](https://faq.octoprint.org) if your + problem is maybe already covered there. + + + You are about to report a bug in **OctoPrint**. Do not proceed if your issues + occurs with OctoPi, any third party OctoPrint plugins, unofficial or outdated + OctoPrint versions. If you are unsure of the difference between OctoPrint and + OctoPi, [read this FAQ entry](https://faq.octoprint.org/octoprint-vs-octopi). + + + Do also not seek support here ("I need help with ...", "I have a + question ...", "Can someone walk me through ..."), that belongs into the + [community forum at community.octoprint.org](https://community.octoprint.org) or on the [Discord server](https://discord.octoprint.org). + + + And finally, make sure any bug you want to report is still present with the **current** + OctoPrint version and that it does not vanish when you start OctoPrint + in [safe mode](https://docs.octoprint.org/en/master/features/safemode.html) either. + + + Thank you for your collaboration! + - type: textarea + attributes: + label: The problem + description: >- + Describe the issue you are experiencing here. Tell us what you were trying to do + step by step, and what happened that you did not expect. + + Provide a clear and concise description of what the problem is and include as many + details as possible. + placeholder: | + 1. ... + 2. ... + 3. ... + validations: + required: true + - type: dropdown + attributes: + label: Did the issue persist even in safe mode? + description: >- + Testing in safe mode is required to make sure the issue you are reporting is not + caused by a third party plugin. Please see [here](https://docs.octoprint.org/en/master/features/safemode.html) + on how to run OctoPrint in safe mode. + options: + - Yes, it did persist + - No, it did not persist (it's an issue with one of your installed plugins, don't report here) + - I cannot test this issue in safe mode (state why below) + validations: + required: true + - type: input + attributes: + label: If you could not test in safe mode, please state why + description: >- + Issues caused by a third party plugin are a major cause of bugs reported here, so we really need to + rule out that a plugin is at fault here. [Safe mode](https://docs.octoprint.org/en/master/features/safemode.html) is an easy way to do that. Only skip safe mode + if your particular problem *absolutely requires* third party plugins to be enabled. "It would take + too long" is **not** a reason to skip testing in safe mode, neither is "I do not know how to + enable it" as you can find info on that [here](https://docs.octoprint.org/en/master/features/safemode.html). + + If you really *cannot* test in safe mode, leave a short explanation as to why. + - type: markdown + attributes: + value: | + ## Environment + - type: input + attributes: + label: Version of OctoPrint + description: Can be found in the lower left corner of the web interface. + validations: + required: true + - type: input + attributes: + label: Operating system running OctoPrint + description: >- + OctoPi, Linux, Windows, MacOS, something else? With version please? OctoPi's + version can be found in `/etc/octopi_version` or in the lower left corner of the + web interface. + validations: + required: true + - type: input + attributes: + label: Printer model & used firmware incl. version + description: If applicable, always include if unsure + - type: input + attributes: + label: Browser and version of browser, operating system running browser + description: If applicable, always include if unsure + - type: markdown + attributes: + value: | + ## Logs and other files needed for analysis + - type: markdown + attributes: + value: >- + Please also be sure to upload the following files below: + + * `octoprint.log`: See [here](https://community.octoprint.org/t/where-can-i-find-octoprints-and-octopis-log-files/299) if you don't know where to find that. Just attach down below as-is. + * `serial.log` or the contents of your terminal tab, if applicable. Always + include if unsure. **Please note that you need to enable `serial.log` first**, + see [here](https://community.octoprint.org/t/where-can-i-find-octoprints-and-octopis-log-files/299) if you don't know how to do or where to find it. Just attach down below as-is. + * Your browser's JavaScript console, if you are reporting a problem with the + user interface. See [here](https://webmasters.stackexchange.com/questions/8525/how-to-open-the-javascript-console-in-different-browsers) on where to find that. + * If possible, screenshots or videos showing the problem, especially if you + are reporting a problem with the user interface! + * GCODE files with which to reproduce, if you are reporting an issue with + GCODE file analysis or printing behaviour. + + Please be aware that unless at least `octoprint.log` is included, your bug report + will not be processed. + - type: checkboxes + attributes: + label: Checklist of files to include below + options: + - label: octoprint.log + required: true + - label: serial.log or contents of your terminal tab (always include in cases of issues with printer communication) + - label: Contents of the JavaScript browser console (always include in cases of issues with the user interface) + - label: Screenshots and/or videos showing the problem (always include in case of issues with the user interface) + - label: GCODE file with which to reproduce (always include in case of issues with GCODE analysis or printing behaviour) + - type: markdown + attributes: + value: | + ## Additional information & file uploads From 27af9721e5bfb4d5d788cf79050c769e9a087d68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Wed, 17 Feb 2021 17:47:40 +0100 Subject: [PATCH 34/45] =?UTF-8?q?=F0=9F=93=9D=20Update=20title?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/ISSUE_TEMPLATE/bug_report_v2.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report_v2.yml b/.github/ISSUE_TEMPLATE/bug_report_v2.yml index 784d39c09..1e4093eae 100644 --- a/.github/ISSUE_TEMPLATE/bug_report_v2.yml +++ b/.github/ISSUE_TEMPLATE/bug_report_v2.yml @@ -1,5 +1,5 @@ -name: Bug report -about: Create a report to help improve OctoPrint +name: ๐Ÿ› Report a bug +about: Create a bug report to help improve OctoPrint title: "" issue_body: true body: From a628549ad32a8d4ce27510967e5befc1a9d73594 Mon Sep 17 00:00:00 2001 From: Levi Blaney Date: Sat, 20 Feb 2021 10:12:16 -0500 Subject: [PATCH 35/45] Fixes #3999 test fails to reload config file --- tests/settings/test_settings.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/settings/test_settings.py b/tests/settings/test_settings.py index a4815ecc1..c57521410 100644 --- a/tests/settings/test_settings.py +++ b/tests/settings/test_settings.py @@ -1,6 +1,8 @@ # -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function, unicode_literals +from time import sleep + """ Tests for OctoPrint's Settings class @@ -606,6 +608,9 @@ class TestSettings(unittest.TestCase): basedir, configfile = paths settings = octoprint.settings.Settings() + # Make sure the config files last modified time changes + sleep(0.3) + self.assertEqual("0.0.0.0", settings.get(["server", "host"])) # modify yaml file externally From 5335750939b271750e8943167ef4c100f8a8f207 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Mon, 22 Feb 2021 15:45:23 +0100 Subject: [PATCH 36/45] =?UTF-8?q?=F0=9F=91=B7=20New=20issue=20form=20yaml?= =?UTF-8?q?=20is=20live?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/ISSUE_TEMPLATE/bug_report.yml | 26 +++-- .github/ISSUE_TEMPLATE/bug_report_v2.yml | 136 ----------------------- 2 files changed, 15 insertions(+), 147 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE/bug_report_v2.yml diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index e0816d0f9..1e4093eae 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -1,9 +1,9 @@ -name: Bug report -about: Create a report to help improve OctoPrint +name: ๐Ÿ› Report a bug +about: Create a bug report to help improve OctoPrint title: "" issue_body: true -inputs: - - type: description +body: + - type: markdown attributes: value: > **Thank you for wanting to report a bug in OctoPrint!** @@ -35,7 +35,6 @@ inputs: - type: textarea attributes: label: The problem - required: true description: >- Describe the issue you are experiencing here. Tell us what you were trying to do step by step, and what happened that you did not expect. @@ -46,6 +45,8 @@ inputs: 1. ... 2. ... 3. ... + validations: + required: true - type: dropdown attributes: label: Did the issue persist even in safe mode? @@ -53,10 +54,11 @@ inputs: Testing in safe mode is required to make sure the issue you are reporting is not caused by a third party plugin. Please see [here](https://docs.octoprint.org/en/master/features/safemode.html) on how to run OctoPrint in safe mode. - choices: + options: - Yes, it did persist - No, it did not persist (it's an issue with one of your installed plugins, don't report here) - I cannot test this issue in safe mode (state why below) + validations: required: true - type: input attributes: @@ -69,7 +71,7 @@ inputs: enable it" as you can find info on that [here](https://docs.octoprint.org/en/master/features/safemode.html). If you really *cannot* test in safe mode, leave a short explanation as to why. - - type: description + - type: markdown attributes: value: | ## Environment @@ -77,6 +79,7 @@ inputs: attributes: label: Version of OctoPrint description: Can be found in the lower left corner of the web interface. + validations: required: true - type: input attributes: @@ -85,6 +88,7 @@ inputs: OctoPi, Linux, Windows, MacOS, something else? With version please? OctoPi's version can be found in `/etc/octopi_version` or in the lower left corner of the web interface. + validations: required: true - type: input attributes: @@ -94,11 +98,11 @@ inputs: attributes: label: Browser and version of browser, operating system running browser description: If applicable, always include if unsure - - type: description + - type: markdown attributes: value: | ## Logs and other files needed for analysis - - type: description + - type: markdown attributes: value: >- Please also be sure to upload the following files below: @@ -119,14 +123,14 @@ inputs: - type: checkboxes attributes: label: Checklist of files to include below - choices: + options: - label: octoprint.log required: true - label: serial.log or contents of your terminal tab (always include in cases of issues with printer communication) - label: Contents of the JavaScript browser console (always include in cases of issues with the user interface) - label: Screenshots and/or videos showing the problem (always include in case of issues with the user interface) - label: GCODE file with which to reproduce (always include in case of issues with GCODE analysis or printing behaviour) - - type: description + - type: markdown attributes: value: | ## Additional information & file uploads diff --git a/.github/ISSUE_TEMPLATE/bug_report_v2.yml b/.github/ISSUE_TEMPLATE/bug_report_v2.yml deleted file mode 100644 index 1e4093eae..000000000 --- a/.github/ISSUE_TEMPLATE/bug_report_v2.yml +++ /dev/null @@ -1,136 +0,0 @@ -name: ๐Ÿ› Report a bug -about: Create a bug report to help improve OctoPrint -title: "" -issue_body: true -body: - - type: markdown - attributes: - value: > - **Thank you for wanting to report a bug in OctoPrint!** - - - If this is the first time you are doing this, please take a few moments to read - through the [Contribution Guidelines](https://github.com/OctoPrint/OctoPrint/blob/master/CONTRIBUTING.md). - Also check out [the FAQ](https://faq.octoprint.org) if your - problem is maybe already covered there. - - - You are about to report a bug in **OctoPrint**. Do not proceed if your issues - occurs with OctoPi, any third party OctoPrint plugins, unofficial or outdated - OctoPrint versions. If you are unsure of the difference between OctoPrint and - OctoPi, [read this FAQ entry](https://faq.octoprint.org/octoprint-vs-octopi). - - - Do also not seek support here ("I need help with ...", "I have a - question ...", "Can someone walk me through ..."), that belongs into the - [community forum at community.octoprint.org](https://community.octoprint.org) or on the [Discord server](https://discord.octoprint.org). - - - And finally, make sure any bug you want to report is still present with the **current** - OctoPrint version and that it does not vanish when you start OctoPrint - in [safe mode](https://docs.octoprint.org/en/master/features/safemode.html) either. - - - Thank you for your collaboration! - - type: textarea - attributes: - label: The problem - description: >- - Describe the issue you are experiencing here. Tell us what you were trying to do - step by step, and what happened that you did not expect. - - Provide a clear and concise description of what the problem is and include as many - details as possible. - placeholder: | - 1. ... - 2. ... - 3. ... - validations: - required: true - - type: dropdown - attributes: - label: Did the issue persist even in safe mode? - description: >- - Testing in safe mode is required to make sure the issue you are reporting is not - caused by a third party plugin. Please see [here](https://docs.octoprint.org/en/master/features/safemode.html) - on how to run OctoPrint in safe mode. - options: - - Yes, it did persist - - No, it did not persist (it's an issue with one of your installed plugins, don't report here) - - I cannot test this issue in safe mode (state why below) - validations: - required: true - - type: input - attributes: - label: If you could not test in safe mode, please state why - description: >- - Issues caused by a third party plugin are a major cause of bugs reported here, so we really need to - rule out that a plugin is at fault here. [Safe mode](https://docs.octoprint.org/en/master/features/safemode.html) is an easy way to do that. Only skip safe mode - if your particular problem *absolutely requires* third party plugins to be enabled. "It would take - too long" is **not** a reason to skip testing in safe mode, neither is "I do not know how to - enable it" as you can find info on that [here](https://docs.octoprint.org/en/master/features/safemode.html). - - If you really *cannot* test in safe mode, leave a short explanation as to why. - - type: markdown - attributes: - value: | - ## Environment - - type: input - attributes: - label: Version of OctoPrint - description: Can be found in the lower left corner of the web interface. - validations: - required: true - - type: input - attributes: - label: Operating system running OctoPrint - description: >- - OctoPi, Linux, Windows, MacOS, something else? With version please? OctoPi's - version can be found in `/etc/octopi_version` or in the lower left corner of the - web interface. - validations: - required: true - - type: input - attributes: - label: Printer model & used firmware incl. version - description: If applicable, always include if unsure - - type: input - attributes: - label: Browser and version of browser, operating system running browser - description: If applicable, always include if unsure - - type: markdown - attributes: - value: | - ## Logs and other files needed for analysis - - type: markdown - attributes: - value: >- - Please also be sure to upload the following files below: - - * `octoprint.log`: See [here](https://community.octoprint.org/t/where-can-i-find-octoprints-and-octopis-log-files/299) if you don't know where to find that. Just attach down below as-is. - * `serial.log` or the contents of your terminal tab, if applicable. Always - include if unsure. **Please note that you need to enable `serial.log` first**, - see [here](https://community.octoprint.org/t/where-can-i-find-octoprints-and-octopis-log-files/299) if you don't know how to do or where to find it. Just attach down below as-is. - * Your browser's JavaScript console, if you are reporting a problem with the - user interface. See [here](https://webmasters.stackexchange.com/questions/8525/how-to-open-the-javascript-console-in-different-browsers) on where to find that. - * If possible, screenshots or videos showing the problem, especially if you - are reporting a problem with the user interface! - * GCODE files with which to reproduce, if you are reporting an issue with - GCODE file analysis or printing behaviour. - - Please be aware that unless at least `octoprint.log` is included, your bug report - will not be processed. - - type: checkboxes - attributes: - label: Checklist of files to include below - options: - - label: octoprint.log - required: true - - label: serial.log or contents of your terminal tab (always include in cases of issues with printer communication) - - label: Contents of the JavaScript browser console (always include in cases of issues with the user interface) - - label: Screenshots and/or videos showing the problem (always include in case of issues with the user interface) - - label: GCODE file with which to reproduce (always include in case of issues with GCODE analysis or printing behaviour) - - type: markdown - attributes: - value: | - ## Additional information & file uploads From 2fc287768bb097035cd26826362016c50d0701a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Mon, 22 Feb 2021 16:07:51 +0100 Subject: [PATCH 37/45] =?UTF-8?q?=F0=9F=9A=B8=20Migrate=20request=20templa?= =?UTF-8?q?te=20to=20forms?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Also add link to support.octoprint.org to issue selection. --- .github/ISSUE_TEMPLATE/config.yml | 7 ++-- .github/ISSUE_TEMPLATE/feature_request.md | 22 ------------- .github/ISSUE_TEMPLATE/feature_request.yml | 37 ++++++++++++++++++++++ 3 files changed, 42 insertions(+), 24 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE/feature_request.md create mode 100644 .github/ISSUE_TEMPLATE/feature_request.yml diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index eb9fb4bd9..ed748bff5 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -1,4 +1,7 @@ contact_links: - - name: Have questions or need support? + - name: ๐Ÿค” Have questions or need support? url: https://community.octoprint.org - about: Please get in touch on the OctoPrint Community Forum! + about: Please get in touch on the OctoPrint Community Forums! + - name: ๐Ÿ’ธ Want to donate? + url: https://support.octoprint.org + about: Please take a look at the various options to support OctoPrint's development financially! diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md deleted file mode 100644 index cd4966224..000000000 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ /dev/null @@ -1,22 +0,0 @@ ---- -name: Feature request -about: Suggest an idea for this project -title: '[Request]' - ---- - - - -**Is your feature request related to a problem? Please describe.** -A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] - -**Describe the solution you'd like** -A clear and concise description of what you want to happen. - -**Describe alternatives you've considered** -A clear and concise description of any alternative solutions or features you've considered. - -**Additional context** -Add any other context or screenshots about the feature request here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml new file mode 100644 index 000000000..f054080f7 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -0,0 +1,37 @@ +name: โœจ Request a feature +about: Request a new feature to implement in OctoPrint +title: "[Request]" +issue_body: true +body: + - type: markdown + attributes: + value: > + **Thank you for wanting to request a feature in OctoPrint!** + + + Before you go ahead with your request, please first consider if it wouldn't be + better suited for a plugin. As a general rule of thumb, any feature that is only + of interest to a small sub group should be moved into a plugin. Only such features + that are of interest to a majority of OctoPrint's users will be implemented as + part of the core itself. + + - type: textarea + attributes: + label: Is your feature request related to a problem? Please describe. + description: A clear and concise description of what the problem is. Eg, "I'm always frustrated when [...]". + - type: textarea + attributes: + label: Describe the solution you'd like + description: A clear and concise description of what you want to happen. Explain why it needs to be included in OctoPrint's core and can't become a plugin. + validations: + required: true + - type: textarea + attributes: + label: Describe alternatives you've considered + description: A clear and concise description of any alternative solutions or features you've considered. + - type: markdown + attributes: + value: > + **Additional context** + + Add any other context or screenshots about the feature request here. From 86aa5548c63222e9730422226fb6775c47bd6f65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Mon, 22 Feb 2021 16:47:05 +0100 Subject: [PATCH 38/45] =?UTF-8?q?=E2=9C=85=20Make=20test=20fix=20align=20w?= =?UTF-8?q?ith=20other=20such=20cases?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/settings/test_settings.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/settings/test_settings.py b/tests/settings/test_settings.py index c57521410..e2bd2ac52 100644 --- a/tests/settings/test_settings.py +++ b/tests/settings/test_settings.py @@ -1,8 +1,6 @@ # -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function, unicode_literals -from time import sleep - """ Tests for OctoPrint's Settings class @@ -609,7 +607,7 @@ class TestSettings(unittest.TestCase): settings = octoprint.settings.Settings() # Make sure the config files last modified time changes - sleep(0.3) + time.sleep(1.0) self.assertEqual("0.0.0.0", settings.get(["server", "host"])) From d0f6bf3e0634020130e6efa8b44a086bed6ecead Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Mon, 22 Feb 2021 18:53:45 +0100 Subject: [PATCH 39/45] =?UTF-8?q?=F0=9F=90=9B=20Allow=20numbers,=20but=20n?= =?UTF-8?q?ot=20at=20the=20start?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/octoprint/util/comm.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/octoprint/util/comm.py b/src/octoprint/util/comm.py index 2045c7e94..36921a7b6 100644 --- a/src/octoprint/util/comm.py +++ b/src/octoprint/util/comm.py @@ -182,7 +182,7 @@ Groups will be as follows: * ``value``: reported position value """ -regex_firmware_splitter = re.compile(r"\s*([A-Z_]+):\s*") +regex_firmware_splitter = re.compile(r"\s*([A-Z][A-Z0-9_]*):\s*") """Regex to use for splitting M115 responses.""" regex_resend_linenumber = re.compile(r"(N|N:)?(?P%s)" % regex_int_pattern) From e43f4ddb50352cbb65ad726b26f3add69a121950 Mon Sep 17 00:00:00 2001 From: cp2004 <31997505+cp2004@users.noreply.github.com> Date: Mon, 22 Feb 2021 18:34:15 +0000 Subject: [PATCH 40/45] :green_heart: Add more tests for firmware info splitting Part of #3916 --- tests/util/test_comm_helpers.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/util/test_comm_helpers.py b/tests/util/test_comm_helpers.py index 32926470f..4a0fb4e0e 100644 --- a/tests/util/test_comm_helpers.py +++ b/tests/util/test_comm_helpers.py @@ -376,6 +376,25 @@ class TestCommHelpers(unittest.TestCase): "UUID": "00000000-0000-0000-0000-000000000000", }, ), + # Test firmware name with time created + ( + "FIRMWARE_NAME:Marlin 2.0.7.2 (Nov 27 2020 14:30:11) SOURCE_CODE_URL:https://github.com/MarlinFirmware/Marlin PROTOCOL_VERSION:1.0 MACHINE_TYPE:Ender 5 Pro EXTRUDER_COUNT:1 UUID:cede2a2f-41a2-4748-9b12-c55c62f367ff", + { + "FIRMWARE_NAME": "Marlin 2.0.7.2 (Nov 27 2020 14:30:11)", + "SOURCE_CODE_URL": "https://github.com/MarlinFirmware/Marlin", + "PROTOCOL_VERSION": "1.0", + "MACHINE_TYPE": "Ender 5 Pro", + "EXTRUDER_COUNT": "1", + "UUID": "cede2a2f-41a2-4748-9b12-c55c62f367ff", + } + ), + # Test that keys beginning with _ or number are ignored + ( + "KEY1:VALUE1 _KEY2:INVALID 123:INVALID", + { + "KEY1": "VALUE1 _", "KEY2": "INVALID 123:INVALID" + } + ) ) @unpack def test_parse_firmware_line(self, line, expected): From bd3f7f8897a6ab6b20be0f137f177a099d8b3a59 Mon Sep 17 00:00:00 2001 From: cp2004 <31997505+cp2004@users.noreply.github.com> Date: Mon, 22 Feb 2021 18:46:24 +0000 Subject: [PATCH 41/45] :art: Make black happy again --- tests/util/test_comm_helpers.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/tests/util/test_comm_helpers.py b/tests/util/test_comm_helpers.py index 4a0fb4e0e..81b01f07b 100644 --- a/tests/util/test_comm_helpers.py +++ b/tests/util/test_comm_helpers.py @@ -386,15 +386,13 @@ class TestCommHelpers(unittest.TestCase): "MACHINE_TYPE": "Ender 5 Pro", "EXTRUDER_COUNT": "1", "UUID": "cede2a2f-41a2-4748-9b12-c55c62f367ff", - } + }, ), # Test that keys beginning with _ or number are ignored ( "KEY1:VALUE1 _KEY2:INVALID 123:INVALID", - { - "KEY1": "VALUE1 _", "KEY2": "INVALID 123:INVALID" - } - ) + {"KEY1": "VALUE1 _", "KEY2": "INVALID 123:INVALID"}, + ), ) @unpack def test_parse_firmware_line(self, line, expected): From fec2f9b83e3e17341f6cbbc2dd1afc96ade519c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Tue, 23 Feb 2021 11:32:36 +0100 Subject: [PATCH 42/45] =?UTF-8?q?=F0=9F=90=9B=20Further=20firmware=20line?= =?UTF-8?q?=20parser=20fixes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Something like _KEY should never get recognized as a key. --- src/octoprint/util/comm.py | 8 ++++++-- tests/util/test_comm_helpers.py | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/octoprint/util/comm.py b/src/octoprint/util/comm.py index 36921a7b6..e29f1b971 100644 --- a/src/octoprint/util/comm.py +++ b/src/octoprint/util/comm.py @@ -182,7 +182,7 @@ Groups will be as follows: * ``value``: reported position value """ -regex_firmware_splitter = re.compile(r"\s*([A-Z][A-Z0-9_]*):\s*") +regex_firmware_splitter = re.compile(r"(^|\s+)([A-Z][A-Z0-9_]*):") """Regex to use for splitting M115 responses.""" regex_resend_linenumber = re.compile(r"(N|N:)?(?P%s)" % regex_int_pattern) @@ -6091,6 +6091,10 @@ def parse_firmware_line(line): The result will be a dictionary mapping from the contained keys to the contained values. + Valid keys must only contain A-Z, 0-9 and _ and must start with a letter. See the + unit tests for valid and invalid examples. There sadly is no existing specification + of the key format, but this is the format extracted from real life logs. + Arguments: line (str): the line to parse @@ -6108,7 +6112,7 @@ def parse_firmware_line(line): split_line = regex_firmware_splitter.split(line.strip())[ 1: ] # first entry is empty start of trimmed string - for key, value in chunks(split_line, 2): + for _, key, value in chunks(split_line, 3): result[key] = value.strip() return result diff --git a/tests/util/test_comm_helpers.py b/tests/util/test_comm_helpers.py index 81b01f07b..1d1969b65 100644 --- a/tests/util/test_comm_helpers.py +++ b/tests/util/test_comm_helpers.py @@ -390,8 +390,8 @@ class TestCommHelpers(unittest.TestCase): ), # Test that keys beginning with _ or number are ignored ( - "KEY1:VALUE1 _KEY2:INVALID 123:INVALID", - {"KEY1": "VALUE1 _", "KEY2": "INVALID 123:INVALID"}, + "KEY1:VALUE1 _KEY2:INVALID 123:INVALID 1KEY:INVALID KEY2:VALUE2", + {"KEY1": "VALUE1 _KEY2:INVALID 123:INVALID 1KEY:INVALID", "KEY2": "VALUE2"}, ), ) @unpack From 0dc452e445b345d2a42d133467d0833a90af6b6b Mon Sep 17 00:00:00 2001 From: LazeMSS Date: Thu, 11 Feb 2021 12:58:25 +0100 Subject: [PATCH 43/45] =?UTF-8?q?=E2=9C=A8=20Add=20support=20for=20skippin?= =?UTF-8?q?g=20gcode=20in=20the=20gcode=20viewer?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/bundledplugins/gcodeviewer.rst | 1 + src/octoprint/plugins/gcodeviewer/__init__.py | 5 +++-- .../gcodeviewer/static/js/gcodeviewer.js | 19 +++++++++++++++++-- .../templates/gcodeviewer_settings.jinja2 | 11 +++++++++++ 4 files changed, 32 insertions(+), 4 deletions(-) diff --git a/docs/bundledplugins/gcodeviewer.rst b/docs/bundledplugins/gcodeviewer.rst index 704d04213..8af5f971c 100644 --- a/docs/bundledplugins/gcodeviewer.rst +++ b/docs/bundledplugins/gcodeviewer.rst @@ -27,6 +27,7 @@ The plugin supports the following configuration keys: * ``mobileSizeThreshold``: Whether to also enable tracking on unreleased OctoPrint versions (anything not stable releases or release candidates). Defaults to ``false``. * ``sizeThreshold``: Unique instance identifier, auto generated on first activation + * ``skipUntilthis``: If this string is provided the GCode Viewer will search for this string, and if found, skip all gcode up until this string. This can be used to skip prime nozzle gcode in the preview .. _sec-bundledplugins-gcodeviewer-sourcecode: diff --git a/src/octoprint/plugins/gcodeviewer/__init__.py b/src/octoprint/plugins/gcodeviewer/__init__.py index a7331b0ca..7622ee710 100644 --- a/src/octoprint/plugins/gcodeviewer/__init__.py +++ b/src/octoprint/plugins/gcodeviewer/__init__.py @@ -48,8 +48,9 @@ class GcodeviewerPlugin( def get_settings_defaults(self): return { "mobileSizeThreshold": 2 * 1024 * 1024, # 2MB - "sizeThreshold": 20 * 1024 * 1024, - } # 20MB + "sizeThreshold": 20 * 1024 * 1024, # 20MB + "skipUntilthis": None, + } def get_settings_version(self): return 1 diff --git a/src/octoprint/plugins/gcodeviewer/static/js/gcodeviewer.js b/src/octoprint/plugins/gcodeviewer/static/js/gcodeviewer.js index 6fb9ba4e3..261851798 100644 --- a/src/octoprint/plugins/gcodeviewer/static/js/gcodeviewer.js +++ b/src/octoprint/plugins/gcodeviewer/static/js/gcodeviewer.js @@ -475,6 +475,21 @@ $(function () { }; self.showGCodeViewer = function (response, rstatus) { + // Slice of the gcode + if (self.settings.settings.plugins.gcodeviewer.skipUntilthis() != "") { + var findThis = + self.settings.settings.plugins.gcodeviewer.skipUntilthis() + ""; + var indexPos = response.indexOf("\n" + findThis); + // Try windows newlines if not found + if (indexPos == -1) { + indexPos = response.indexOf("\r" + findThis); + } + if (indexPos != -1) { + // Slice and make sure we comment out any string left back after slicing - so if a user configures something like "G1" we dont end up with a snippet of gcode commands + // Yes it would be prettier to parse it line by line and remove the entire line, that is very slow and uses mem - this way we find the string, and remove it + response = ";" + response.slice(indexPos + findThis.length + 1); + } + } var par = { target: { result: response @@ -879,8 +894,8 @@ $(function () { self.resetOptions(); var current = loadFromLocalStorage(optionsLocalStorageKey); - if (current["centerViewport"] !== undefined) - self.renderer_centerViewport(current["centerViewport"]); + if (current["centerViewPort"] !== undefined) + self.renderer_centerViewport(current["centerViewPort"]); if (current["zoomOnModel"] !== undefined) self.renderer_zoomOnModel(current["zoomOnModel"]); if (current["showMoves"] !== undefined) diff --git a/src/octoprint/plugins/gcodeviewer/templates/gcodeviewer_settings.jinja2 b/src/octoprint/plugins/gcodeviewer/templates/gcodeviewer_settings.jinja2 index f61067956..b6e485083 100644 --- a/src/octoprint/plugins/gcodeviewer/templates/gcodeviewer_settings.jinja2 +++ b/src/octoprint/plugins/gcodeviewer/templates/gcodeviewer_settings.jinja2 @@ -19,4 +19,15 @@ +
    + +
    + +
    +
    + + {% trans %}If provided, the GCode Viewer will search for a line beginning with this string. If found, all GCode up to that point will be skipped. This can be used to skip "purge/nozzle wipe" GCode in the viewer. Note the search is case sensitive. Example: ; layer 1{% endtrans %} + +
    +
    From ac2e25f6d62a68872cd5139807312d49e6c19b23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Tue, 23 Feb 2021 16:23:55 +0100 Subject: [PATCH 44/45] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20skipUntilthis=20=3D>?= =?UTF-8?q?=20skipUntilThis?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Also made some comparisons a bit more resilient. --- docs/bundledplugins/gcodeviewer.rst | 2 +- src/octoprint/plugins/gcodeviewer/__init__.py | 2 +- .../plugins/gcodeviewer/static/js/gcodeviewer.js | 9 ++++----- .../gcodeviewer/templates/gcodeviewer_settings.jinja2 | 4 ++-- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/docs/bundledplugins/gcodeviewer.rst b/docs/bundledplugins/gcodeviewer.rst index 8af5f971c..b112a22c7 100644 --- a/docs/bundledplugins/gcodeviewer.rst +++ b/docs/bundledplugins/gcodeviewer.rst @@ -27,7 +27,7 @@ The plugin supports the following configuration keys: * ``mobileSizeThreshold``: Whether to also enable tracking on unreleased OctoPrint versions (anything not stable releases or release candidates). Defaults to ``false``. * ``sizeThreshold``: Unique instance identifier, auto generated on first activation - * ``skipUntilthis``: If this string is provided the GCode Viewer will search for this string, and if found, skip all gcode up until this string. This can be used to skip prime nozzle gcode in the preview + * ``skipUntilThis``: If this string is provided the GCode Viewer will search for this string, and if found, skip all gcode up until this string. This can be used to skip prime nozzle gcode in the preview .. _sec-bundledplugins-gcodeviewer-sourcecode: diff --git a/src/octoprint/plugins/gcodeviewer/__init__.py b/src/octoprint/plugins/gcodeviewer/__init__.py index 7622ee710..7bc359016 100644 --- a/src/octoprint/plugins/gcodeviewer/__init__.py +++ b/src/octoprint/plugins/gcodeviewer/__init__.py @@ -49,7 +49,7 @@ class GcodeviewerPlugin( return { "mobileSizeThreshold": 2 * 1024 * 1024, # 2MB "sizeThreshold": 20 * 1024 * 1024, # 20MB - "skipUntilthis": None, + "skipUntilThis": None, } def get_settings_version(self): diff --git a/src/octoprint/plugins/gcodeviewer/static/js/gcodeviewer.js b/src/octoprint/plugins/gcodeviewer/static/js/gcodeviewer.js index 261851798..5f194574a 100644 --- a/src/octoprint/plugins/gcodeviewer/static/js/gcodeviewer.js +++ b/src/octoprint/plugins/gcodeviewer/static/js/gcodeviewer.js @@ -476,15 +476,14 @@ $(function () { self.showGCodeViewer = function (response, rstatus) { // Slice of the gcode - if (self.settings.settings.plugins.gcodeviewer.skipUntilthis() != "") { - var findThis = - self.settings.settings.plugins.gcodeviewer.skipUntilthis() + ""; + var findThis = self.settings.settings.plugins.gcodeviewer.skipUntilThis(); + if (findThis && findThis !== "") { var indexPos = response.indexOf("\n" + findThis); // Try windows newlines if not found - if (indexPos == -1) { + if (indexPos === -1) { indexPos = response.indexOf("\r" + findThis); } - if (indexPos != -1) { + if (indexPos !== -1) { // Slice and make sure we comment out any string left back after slicing - so if a user configures something like "G1" we dont end up with a snippet of gcode commands // Yes it would be prettier to parse it line by line and remove the entire line, that is very slow and uses mem - this way we find the string, and remove it response = ";" + response.slice(indexPos + findThis.length + 1); diff --git a/src/octoprint/plugins/gcodeviewer/templates/gcodeviewer_settings.jinja2 b/src/octoprint/plugins/gcodeviewer/templates/gcodeviewer_settings.jinja2 index b6e485083..1520023a1 100644 --- a/src/octoprint/plugins/gcodeviewer/templates/gcodeviewer_settings.jinja2 +++ b/src/octoprint/plugins/gcodeviewer/templates/gcodeviewer_settings.jinja2 @@ -20,9 +20,9 @@
    - +
    - +
    From ca3b78d1400bda391cdde16066024bbdb2f6d2e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Thu, 25 Feb 2021 14:17:47 +0100 Subject: [PATCH 45/45] =?UTF-8?q?=F0=9F=8E=A8=20Clean=20up=20some=20py2=20?= =?UTF-8?q?leftovers=20&=20arm=20more=20codemods?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .pre-commit-config.yaml | 36 ++++++++++++++++----------- src/octoprint/server/util/watchdog.py | 3 +-- 2 files changed, 23 insertions(+), 16 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 37c9c1c5d..549db9c6f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,4 +1,4 @@ -exclude: ^(src/octoprint/vendor/|src/octoprint/static/js/lib|src/octoprint/static/vendor|tests/static/js/lib|tests/util/_files|docs/|scripts/|translations/|.*\.css|.*\.svg) +exclude: ^(src/octoprint/vendor/|src/octoprint/static/js/lib|src/octoprint/static/vendor|tests/static/js/lib|tests/util/_files|docs/|scripts/|translations/|versioneer.py|.*\.css|.*\.svg) repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v3.2.0 @@ -13,26 +13,34 @@ repos: - id: fix-encoding-pragma args: ["--remove"] - repo: https://github.com/OctoPrint/codemods - rev: devel + rev: 0.4.0 hooks: - - id: codemod_remove_future_imports - args: ["--ignore", "src/octoprint/vendor"] - stages: ["manual"] - - id: codemod_remove_builtins_imports - args: ["--ignore", "src/octoprint/vendor"] - stages: ["manual"] - id: codemod_detect_past_builtins_imports args: ["--ignore", "src/octoprint/vendor"] - stages: ["manual"] + - id: codemod_dict_comprehension_to_literal + args: ["--ignore", "src/octoprint/vendor"] - id: codemod_dict_to_literal args: ["--ignore", "src/octoprint/vendor"] - stages: ["manual"] - - id: codemod_set_to_literal - args: ["--ignore", "src/octoprint/vendor"] - stages: ["manual"] - id: codemod_not_in args: ["--ignore", "src/octoprint/vendor"] - stages: ["manual"] + - id: codemod_oserror_merge + args: ["--ignore", "src/octoprint/vendor"] + - id: codemod_py3_class_inheritance + args: ["--ignore", "src/octoprint/vendor"] + - id: codemod_py3_super + args: ["--ignore", "src/octoprint/vendor"] + - id: codemod_remove_builtins_imports + args: ["--ignore", "src/octoprint/vendor"] + - id: codemod_remove_float_conversion + args: ["--ignore", "src/octoprint/vendor"] + - id: codemod_remove_future_imports + args: ["--ignore", "src/octoprint/vendor"] + - id: codemod_set_to_literal + args: ["--ignore", "src/octoprint/vendor"] + - id: codemod_string_encoding + args: ["--ignore", "src/octoprint/vendor"] + - id: codemod_yield_from_generator + args: ["--ignore", "src/octoprint/vendor"] - repo: https://github.com/pre-commit/mirrors-isort rev: v5.5.4 hooks: diff --git a/src/octoprint/server/util/watchdog.py b/src/octoprint/server/util/watchdog.py index 934b47784..3d0aa85dc 100644 --- a/src/octoprint/server/util/watchdog.py +++ b/src/octoprint/server/util/watchdog.py @@ -43,8 +43,7 @@ class GcodeWatchdogHandler(watchdog.events.PatternMatchingEventHandler): """Recursively yield DirEntry objects for given directory.""" for entry in scandir(path): if entry.is_dir(follow_symlinks=False): - for entry in _recursive_scandir(entry.path): - yield entry + yield from _recursive_scandir(entry.path) else: yield entry