From aa38c9a6a9ec699cafdd3a05c7e13d764f5b8663 Mon Sep 17 00:00:00 2001 From: Adrien Brignon Date: Sat, 27 May 2023 17:47:23 +0200 Subject: [PATCH] feat: themes support --- Dockerfile | 2 +- README.md | 4 +- docs/getting-started.md | 6 + docs/setup/setting-up-buttons.md | 19 +- docs/setup/setting-up-documents.md | 2 +- mkdocs.yml | 14 +- mkdocs_exporter/page.py | 4 + mkdocs_exporter/plugin.py | 46 +- mkdocs_exporter/plugins/extras/config.py | 13 +- mkdocs_exporter/plugins/extras/plugin.py | 20 +- .../plugins/extras/preprocessor.py | 26 - mkdocs_exporter/plugins/pdf/config.py | 3 - mkdocs_exporter/plugins/pdf/plugin.py | 2 +- mkdocs_exporter/plugins/pdf/renderer.py | 10 +- mkdocs_exporter/preprocessor.py | 26 +- mkdocs_exporter/resources/css/__init__.py | 0 mkdocs_exporter/resources/css/readthedocs.css | 8 + mkdocs_exporter/resources/js/pagedjs.min.js | 781 +----------------- mkdocs_exporter/theme.py | 32 + mkdocs_exporter/themes/__init__.py | 0 mkdocs_exporter/themes/factory.py | 23 + mkdocs_exporter/themes/material/__init__.py | 0 .../icon.py => themes/material/icons.py} | 2 +- mkdocs_exporter/themes/material/theme.py | 44 + .../themes/readthedocs/__init__.py | 0 mkdocs_exporter/themes/readthedocs/theme.py | 43 + overrides/main.html | 5 - poetry.lock | 249 +++--- pyproject.toml | 5 +- 29 files changed, 385 insertions(+), 1004 deletions(-) delete mode 100644 mkdocs_exporter/plugins/extras/preprocessor.py create mode 100644 mkdocs_exporter/resources/css/__init__.py create mode 100644 mkdocs_exporter/resources/css/readthedocs.css create mode 100644 mkdocs_exporter/theme.py create mode 100644 mkdocs_exporter/themes/__init__.py create mode 100644 mkdocs_exporter/themes/factory.py create mode 100644 mkdocs_exporter/themes/material/__init__.py rename mkdocs_exporter/{plugins/extras/icon.py => themes/material/icons.py} (96%) create mode 100644 mkdocs_exporter/themes/material/theme.py create mode 100644 mkdocs_exporter/themes/readthedocs/__init__.py create mode 100644 mkdocs_exporter/themes/readthedocs/theme.py delete mode 100644 overrides/main.html diff --git a/Dockerfile b/Dockerfile index c60976e..655ad20 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,7 +21,7 @@ RUN apt-get update \ FROM base as builder -ENV POETRY_VERSION=1.4.2 \ +ENV POETRY_VERSION=1.5.0 \ PIP_NO_CACHE_DIR=1 \ PIP_DEFAULT_TIMEOUT=100 \ PIP_DISABLE_PIP_VERSION_CHECK=1 diff --git a/README.md b/README.md index 8b34d47..7c111eb 100644 --- a/README.md +++ b/README.md @@ -9,13 +9,13 @@ A highly-configurable plugin for [*MkDocs*](https://github.com/mkdocs/mkdocs) th - 🚀 **Fast** - PDF documents are generated concurrently! - 🎨 **Customizable** - full control over the resulting documents - - Compatible with [`mkdocs-material`](https://github.com/squidfunk/mkdocs-material) - Cover pages (supports [`macros`](https://github.com/fralau/mkdocs_macros_plugin) plugin) - Define custom scripts and stylesheets to customize your PDF documents - Define "buttons" at the top of your documentation pages ([example](https://adrienbrignon.github.io/mkdocs-exporter/setup/setting-up-buttons/)) + - Compatible with [`material`](https://github.com/squidfunk/mkdocs-material) and [`readthedocs`](https://www.mkdocs.org/user-guide/choosing-your-theme/#readthedocs) themes - ⭐ **Powerful** - it uses a headless browser and some awesome libraries under the hood to generate PDF files - [*Playwright*](https://github.com/microsoft/playwright-python) to automate browsers - - [*Paged.js*](https://github.com/pagedjs/pagedjs) polyfills are included by default ([Paged Media](https://www.w3.org/TR/css-page-3/) and [Generated Content](https://www.w3.org/TR/css-gcpm-3/) CSS modules) + - [*Paged.js*](https://github.com/pagedjs/pagedjs) polyfills are included ([Paged Media](https://www.w3.org/TR/css-page-3/) and [Generated Content](https://www.w3.org/TR/css-gcpm-3/) CSS modules) - [*Sass*](https://sass-lang.com/) support (via [`libsass`](https://github.com/sass/libsass-python)) for your stylesheets ## Prerequisites diff --git a/docs/getting-started.md b/docs/getting-started.md index a12cb69..4690cd2 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -15,7 +15,13 @@ hide: Try this out by clicking the download button at the top of this page (or you can directly head [here](./index.pdf){:target="_blank"}). +## Prerequisites +- Python `>= 3.7` +- MkDocs `>= 1.4` +- A compatible theme + - [`material`](https://github.com/squidfunk/mkdocs-material) (:material-star-shooting: *currently used by this documentation*) + - [`readthedocs`](https://www.mkdocs.org/user-guide/choosing-your-theme/#readthedocs) ## Installation diff --git a/docs/setup/setting-up-buttons.md b/docs/setup/setting-up-buttons.md index fdd15f7..e52fbc5 100644 --- a/docs/setup/setting-up-buttons.md +++ b/docs/setup/setting-up-buttons.md @@ -1,9 +1,10 @@ --- buttons: - title: I'm Feeling Lucky - href: https://www.youtube.com/watch?v=dQw4w9WgXcQ icon: material-star-outline - target: _blank + attributes: + href: https://www.youtube.com/watch?v=dQw4w9WgXcQ + target: _blank --- # Setting up buttons @@ -33,12 +34,17 @@ plugins: - title: Download as PDF icon: material-file-download-outline enabled: !!python/name:mkdocs_exporter.plugins.pdf.button.enabled - href: !!python/name:mkdocs_exporter.plugins.pdf.button.href - download: !!python/name:mkdocs_exporter.plugins.pdf.button.download + attributes: + href: !!python/name:mkdocs_exporter.plugins.pdf.button.href + download: !!python/name:mkdocs_exporter.plugins.pdf.button.download ``` The functions referenced in this configuration are provided by the **MkDocs Exporter** plugin. +!!! info + + Currently, icons are only available with the [MkDocs Material](https://github.com/squidfunk/mkdocs-material) theme. + ### Defining a dynamic button As you've seen in the previous example, you can use Python functions to resolve the attributes of a button dynamically. @@ -80,9 +86,10 @@ Here's the configuration used by this page: buttons: - title: {{ button.title }} - href: {{ button.href }} icon: {{ button.icon }} - target: {{ button.target }} + attributes: + href: {{ button.attributes.href }} + target: {{ button.attributes.target }} --- # {{ page.title }} diff --git a/docs/setup/setting-up-documents.md b/docs/setup/setting-up-documents.md index a45944b..82d45ea 100644 --- a/docs/setup/setting-up-documents.md +++ b/docs/setup/setting-up-documents.md @@ -14,7 +14,7 @@ plugins: **MkDocs Exporter** comes with various plugins in a single package. - This architecture was chosen to reduce code duplication and maintain a generic base that can be used + This architecture has been chosen to reduce code duplication and maintain a generic base that can be used to export your pages to formats other than PDF (although this is the only format currently supported). Basically, the `mkdocs/exporter` must always be registered first as it provides a common ground for diff --git a/mkdocs.yml b/mkdocs.yml index 483767a..0ff1baf 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -7,7 +7,6 @@ site_dir: dist theme: name: material - custom_dir: overrides icon: logo: material/file-document-arrow-right repo: fontawesome/brands/github @@ -51,8 +50,9 @@ plugins: - title: Download as PDF icon: material-file-download-outline enabled: !!python/name:mkdocs_exporter.plugins.pdf.button.enabled - href: !!python/name:mkdocs_exporter.plugins.pdf.button.href - download: !!python/name:mkdocs_exporter.plugins.pdf.button.download + attributes: + href: !!python/name:mkdocs_exporter.plugins.pdf.button.href + download: !!python/name:mkdocs_exporter.plugins.pdf.button.download - search: lang: en - awesome-pages @@ -63,8 +63,6 @@ plugins: - redirects: redirect_maps: 'index.md': 'getting-started.md' - - search: - separator: '[\s\-,:!=\[\]()"`/]+|\.(?!\d)|&[lg]t;|(?!\b)(?=[A-Z][a-z])' - minify: minify_html: true @@ -73,6 +71,12 @@ markdown_extensions: - attr_list - pymdownx.details - pymdownx.superfences + - mdx_truly_sane_lists: + truly_sane: true + nested_indent: 2 + - pymdownx.emoji: + emoji_index: !!python/name:materialx.emoji.twemoji + emoji_generator: !!python/name:materialx.emoji.to_svg extra_css: - assets/stylesheets/custom.css diff --git a/mkdocs_exporter/page.py b/mkdocs_exporter/page.py index 47779ac..b07bb4c 100644 --- a/mkdocs_exporter/page.py +++ b/mkdocs_exporter/page.py @@ -1,4 +1,5 @@ from typing import Optional +from mkdocs_exporter.theme import Theme from mkdocs.structure.pages import Page as BasePage @@ -15,4 +16,7 @@ def __init__(self, *args, **kwargs): self.formats: dict[str, str] """The documents that have been generated for this page (format as key, path to the file as value).""" + self.theme: Theme = None + """The theme of the page.""" + super().__init__(*args, **kwargs) diff --git a/mkdocs_exporter/plugin.py b/mkdocs_exporter/plugin.py index cac1e89..4f24931 100644 --- a/mkdocs_exporter/plugin.py +++ b/mkdocs_exporter/plugin.py @@ -1,28 +1,70 @@ from mkdocs.plugins import BasePlugin from mkdocs_exporter.page import Page from mkdocs.plugins import event_priority +from mkdocs.structure.files import File, Files from mkdocs_exporter.preprocessor import Preprocessor +from mkdocs_exporter.themes.factory import Factory as ThemeFactory class Plugin(BasePlugin): """The plugin.""" + def __init__(self) -> None: + """The constructor.""" + + self.files: list[File] = [] + + + def on_config(self, config: dict) -> None: + """Invoked when the configuration has been loaded.""" + + self.theme = ThemeFactory.create(config['theme']) + + + def on_pre_build(self, **kwargs) -> None: + """Invoked before the build process starts.""" + + self.files = [] + + def on_pre_page(self, page: Page, **kwargs) -> None: """Invoked after a page has been built.""" page.html = None page.formats = {} + page.theme = self.theme @event_priority(-100) - def on_post_page(self, html: str, **kwargs) -> str: + def on_post_page(self, html: str, page: Page, **kwargs) -> str: """Invoked after a page has been built (and after all other plugins).""" - preprocessor = Preprocessor() + preprocessor = Preprocessor(theme=page.theme) preprocessor.preprocess(html) preprocessor.remove('*[data-decompose=true]') preprocessor.teleport() return preprocessor.done() + + + def on_files(self, files: Files, **kwargs) -> Files: + """Invoked when files are ready to be manipulated.""" + + self.files.extend(files.css_files()) + + return files + + + @event_priority(100) + def on_post_build(self, **kwargs) -> None: + """Invoked when the build process is done.""" + + for file in self.files: + css = None + + with open(file.abs_dest_path, 'r') as reader: + css = self.theme.stylesheet(reader.read()) + with open(file.abs_dest_path, 'w+') as writer: + writer.write(css) diff --git a/mkdocs_exporter/plugins/extras/config.py b/mkdocs_exporter/plugins/extras/config.py index b82c8b5..16f4fe0 100644 --- a/mkdocs_exporter/plugins/extras/config.py +++ b/mkdocs_exporter/plugins/extras/config.py @@ -9,23 +9,14 @@ class ButtonConfig(BaseConfig): enabled = c.Type((bool, Callable), default=True) """Is the button enabled?""" - id = c.Optional(c.Type(str, Callable)) - """The button's identifier.""" - title = c.Type((str, Callable)) """The button's title.""" icon = c.Type((str, Callable)) """The button's icon (typically, an SVG element).""" - href = c.Type((str, Callable)) - """The button's 'href' attribute.""" - - download = c.Optional(c.Type((bool, str, Callable))) - """The button's 'download' attribute.""" - - target = c.Optional(c.Choice(('_blank', '_self', '_parent', '_top'))) - """The button's 'target' attribute.""" + attributes = c.Type((dict, Callable), default={}) + """Some extra attributes to add to the button.""" class Config(BaseConfig): diff --git a/mkdocs_exporter/plugins/extras/plugin.py b/mkdocs_exporter/plugins/extras/plugin.py index bbf429e..2885a0d 100644 --- a/mkdocs_exporter/plugins/extras/plugin.py +++ b/mkdocs_exporter/plugins/extras/plugin.py @@ -1,9 +1,10 @@ from typing import Optional +from collections import UserDict from mkdocs.plugins import BasePlugin from mkdocs_exporter.page import Page from mkdocs.plugins import event_priority +from mkdocs_exporter.preprocessor import Preprocessor from mkdocs_exporter.plugins.extras.config import Config -from mkdocs_exporter.plugins.extras.preprocessor import Preprocessor class Plugin(BasePlugin[Config]): @@ -14,15 +15,22 @@ class Plugin(BasePlugin[Config]): def on_post_page(self, html: str, page: Page, **kwargs) -> Optional[str]: """Invoked after a page has been built.""" - def resolve(value): - return value(page) if callable(value) else value + def resolve(object): + if callable(object): + return resolve(object(page)) + if isinstance(object, list): + return [resolve(v) for v in object] + if isinstance(object, (dict, UserDict)): + return {k: resolve(v) for k, v in object.items()} - preprocessor = Preprocessor() + return object + + preprocessor = Preprocessor(theme=page.theme) preprocessor.preprocess(html) for button in [*self.config.buttons, *page.meta.get('buttons', [])]: - if 'enabled' not in button or resolve(button['enabled']): - preprocessor.button(**{k: resolve(v) for k, v in button.items()}) + if resolve(button.get('enabled', True)): + preprocessor.button(**resolve(button)) return preprocessor.done() diff --git a/mkdocs_exporter/plugins/extras/preprocessor.py b/mkdocs_exporter/plugins/extras/preprocessor.py deleted file mode 100644 index 21320ba..0000000 --- a/mkdocs_exporter/plugins/extras/preprocessor.py +++ /dev/null @@ -1,26 +0,0 @@ -from __future__ import annotations - -from bs4 import BeautifulSoup -from mkdocs_exporter.plugins.extras.icon import get_svg_icon -from mkdocs_exporter.preprocessor import Preprocessor as BasePreprocessor - - -class Preprocessor(BasePreprocessor): - """An extended preprocessor.""" - - - def button(self, title: str, href: str, icon: str, **kwargs) -> Preprocessor: - """Adds a button at the top of the page.""" - - tags = self.html.find('nav', {'class': 'md-tags'}) - button = self.html.new_tag('a', title=title, href=href, **kwargs, attrs={'class': 'md-content__button md-icon'}) - svg = BeautifulSoup(get_svg_icon(icon) or get_svg_icon('material-progress-question'), 'lxml') - - button.append(svg) - - if tags: - tags.insert_after(button) - else: - self.html.find('article', {'class': 'md-content__inner'}).insert(0, button) - - return self diff --git a/mkdocs_exporter/plugins/pdf/config.py b/mkdocs_exporter/plugins/pdf/config.py index 3285a84..1fbcc75 100644 --- a/mkdocs_exporter/plugins/pdf/config.py +++ b/mkdocs_exporter/plugins/pdf/config.py @@ -32,6 +32,3 @@ class Config(BaseConfig): covers = c.SubConfig(CoversConfig) """The document's cover pages.""" - - polyfills = c.Type(bool, default=True) - """Should polyfills be imported?""" diff --git a/mkdocs_exporter/plugins/pdf/plugin.py b/mkdocs_exporter/plugins/pdf/plugin.py index 09d12c3..e4a4fb0 100644 --- a/mkdocs_exporter/plugins/pdf/plugin.py +++ b/mkdocs_exporter/plugins/pdf/plugin.py @@ -110,7 +110,7 @@ def on_post_page(self, html: str, page: Page, config: dict) -> Optional[str]: async def render(page: Page) -> None: logger.info('Rendering PDF for %s...', page.file.src_path) - pdf = await self.renderer.render(page, polyfills=self.config['polyfills']) + pdf = await self.renderer.render(page) fullpath = os.path.join(config['site_dir'], page.formats['pdf']) with open(fullpath, 'wb+') as file: diff --git a/mkdocs_exporter/plugins/pdf/renderer.py b/mkdocs_exporter/plugins/pdf/renderer.py index cc3f760..80e8b0b 100644 --- a/mkdocs_exporter/plugins/pdf/renderer.py +++ b/mkdocs_exporter/plugins/pdf/renderer.py @@ -46,20 +46,20 @@ def cover(self, template: str) -> Renderer: return f'
{content}
' + '\n' - async def render(self, page: Page, **kwargs) -> bytes: + async def render(self, page: Page) -> bytes: """Renders a page as a PDF document.""" if not self.browser.launched: await self.browser.launch() - preprocessor = Preprocessor() + preprocessor = Preprocessor(theme=page.theme) base = os.path.dirname(page.file.abs_dest_path) root = base.replace(unquote(page.url).rstrip('/'), '', 1).rstrip('/') preprocessor.preprocess(page.html) - preprocessor.remove(['.md-sidebar.md-sidebar--primary', '.md-sidebar.md-sidebar--secondary', 'header.md-header', '.md-container > nav', 'nav.md-tags']) preprocessor.remove_scripts() preprocessor.set_attribute('details:not([open])', 'open', 'open') + page.theme.preprocess(preprocessor) for stylesheet in self.stylesheets: with open(stylesheet, 'r') as file: @@ -68,9 +68,7 @@ async def render(self, page: Page, **kwargs) -> bytes: with open(script, 'r') as file: preprocessor.script(file.read()) - if kwargs.get('polyfills', True): - preprocessor.script(importlib_resources.files(js).joinpath('pagedjs.min.js').read_text()) - + preprocessor.script(importlib_resources.files(js).joinpath('pagedjs.min.js').read_text()) preprocessor.teleport() preprocessor.update_links(base, root) diff --git a/mkdocs_exporter/preprocessor.py b/mkdocs_exporter/preprocessor.py index 8064d6e..27a93a8 100644 --- a/mkdocs_exporter/preprocessor.py +++ b/mkdocs_exporter/preprocessor.py @@ -6,18 +6,33 @@ from urllib.parse import urlparse from bs4 import BeautifulSoup, Tag from typing import Any, Callable, Union +from mkdocs_exporter.theme import Theme from mkdocs_exporter.logging import logger class Preprocessor(): """The HTML preprocessor.""" - def __init__(self, html: str = None): + def __init__(self, html: str = None, **kwargs): """The constructor.""" + self.html = None + self.theme = None + + if 'theme' in kwargs: + self.set_theme(kwargs['theme']) + self.preprocess(html) + def set_theme(self, theme: Theme) -> Preprocessor: + """Sets the current theme.""" + + self.theme = theme + + return self + + def preprocess(self, html: str) -> Preprocessor: """Gives the preprocessor some HTML to work on.""" @@ -49,6 +64,15 @@ def teleport(self) -> Preprocessor: return self + def button(self, title: str, icon: str, attributes: dict = {}, **kwargs) -> Preprocessor: + """Adds a button at the top of the page.""" + + if kwargs.get('enabled', True) and self.theme: + self.theme.button(self, title, icon, attributes) + + return self + + def script(self, script: str = None, type: str = 'text/javascript', **kwargs) -> Preprocessor: """Appends a script to the document's body.""" diff --git a/mkdocs_exporter/resources/css/__init__.py b/mkdocs_exporter/resources/css/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/mkdocs_exporter/resources/css/readthedocs.css b/mkdocs_exporter/resources/css/readthedocs.css new file mode 100644 index 0000000..d2cb6e0 --- /dev/null +++ b/mkdocs_exporter/resources/css/readthedocs.css @@ -0,0 +1,8 @@ +html, body { + overflow-x: visible; +} + +.wy-nav-content { + padding: 0; + max-width: unset; +} diff --git a/mkdocs_exporter/resources/js/pagedjs.min.js b/mkdocs_exporter/resources/js/pagedjs.min.js index 40d2f2e..b0a1e71 100644 --- a/mkdocs_exporter/resources/js/pagedjs.min.js +++ b/mkdocs_exporter/resources/js/pagedjs.min.js @@ -1,781 +1,4 @@ /** - * @license Paged.js v0.4.1 | MIT | https://gitlab.coko.foundation/pagedjs/pagedjs/ + * @license Paged.js v0.4.2 | MIT | https://gitlab.coko.foundation/pagedjs/pagedjs */ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).PagedPolyfill=t()}(this,function(){"use strict";var e,t,r,n={exports:{}},a={exports:{}},i=function(){},o=i(),s=function(e){return e!==o&&null!==e},l=s,d=Object.keys,p=function(e){return d(l(e)?Object(e):e)},c=!function(){try{return Object.keys("primitive"),!0}catch(e){return!1}}()?p:Object.keys,u=s,m=function(e){if(!u(e))throw TypeError("Cannot use null or undefined");return e},h=c,g=m,f=Math.max,y=function(e,t){var r,n,a,i=f(arguments.length,2);for(n=1,e=Object(g(e)),a=function(n){try{e[n]=t[n]}catch(a){r||(r=a)}};n-1},z="function"==typeof w.contains&&!0===w.contains("dwa")&&!1===w.contains("foo")?String.prototype.contains:_,A=b,E=$,O=C,j=z;(r=a.exports=function(e,t){var r,n,a,i,o;return arguments.length<2||"string"!=typeof e?(i=t,t=e,e=null):i=arguments[2],null==e?(r=a=!0,n=!1):(r=j.call(e,"c"),n=j.call(e,"e"),a=j.call(e,"w")),o={value:t,configurable:r,enumerable:n,writable:a},i?A(E(i),o):o}).gs=function(e,t,r){var n,a,i,o;return"string"!=typeof e?(i=r,r=t,t=e,e=null):i=arguments[3],null==t?t=void 0:O(t)?null==r?r=void 0:O(r)||(i=r,r=void 0):(i=t,t=r=void 0),null==e?(n=!0,a=!1):(n=j.call(e,"c"),a=j.call(e,"e")),o={get:t,set:r,configurable:n,enumerable:a},i?A(E(i),o):o};var W,L,B,P,D,q,M,I,R,N,F,G,V,U,H,Y,K,Z,Q=function(e){if("function"!=typeof e)throw TypeError(e+" is not a function");return e};W=n,L=n.exports,N=a.exports,F=Q,G=Function.prototype.apply,V=Function.prototype.call,U=Object.create,H=Object.defineProperty,Y=Object.defineProperties,K=Object.prototype.hasOwnProperty,Z={configurable:!0,enumerable:!1,writable:!0},B=function(e,t){var r;return F(t),K.call(this,"__ee__")?r=this.__ee__:(r=Z.value=U(null),H(this,"__ee__",Z),Z.value=null),r[e]?"object"==typeof r[e]?r[e].push(t):r[e]=[r[e],t]:r[e]=t,this},P=function(e,t){var r,n;return F(t),n=this,B.call(this,e,r=function(){D.call(n,e,r),G.call(t,this,arguments)}),r.__eeOnceListener__=t,this},M={on:B,once:P,off:D=function(e,t){var r,n,a,i;if(F(t),!K.call(this,"__ee__")||!(r=this.__ee__)[e])return this;if("object"==typeof(n=r[e]))for(i=0;a=n[i];++i)(a===t||a.__eeOnceListener__===t)&&(2===n.length?r[e]=n[i?0:1]:n.splice(i,1));else(n===t||n.__eeOnceListener__===t)&&delete r[e];return this},emit:q=function(e){var t,r,n,a,i;if(K.call(this,"__ee__")&&(a=this.__ee__[e])){if("object"==typeof a){for(t=1,r=arguments.length,i=Array(r-1);t{e(a)}))}),Promise.all(r)}triggerSync(){var e=arguments,t=this.context,r=[];return this.hooks.forEach(function(n){var a=n.apply(t,e);r.push(a)}),r}list(){return this.hooks}clear(){return this.hooks=[]}}function ee(e){if(!e)return;let t;if(void 0!==e.getBoundingClientRect)t=e.getBoundingClientRect();else{let r=document.createRange();r.selectNode(e),t=r.getBoundingClientRect()}return t}function et(e){if(!e)return;let t;if(void 0!==e.getClientRects)t=e.getClientRects();else{let r=document.createRange();r.selectNode(e),t=r.getClientRects()}return t}function er(){var e=new Date().getTime();return"undefined"!=typeof performance&&"function"==typeof performance.now&&(e+=performance.now()),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var r=(e+16*Math.random())%16|0;return e=Math.floor(e/16),("x"===t?r:3&r|8).toString(16)})}function en(e,t){for(var r=0;r=1&&t<=31||127==t||0==a&&t>=48&&t<=57||1==a&&t>=48&&t<=57&&45==o){i+="\\"+t.toString(16)+" ";continue}if(0==a&&1==n&&45==t){i+="\\"+r.charAt(a);continue}if(46==t&&"#"==r.charAt(0)){i+="\\.";continue}if(t>=128||45==t||95==t||35==t||46==t||t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122){i+=r.charAt(a);continue}i+="\\"+r.charAt(a)}return i}function ei(){this.resolve=null,this.reject=null,this.id=er(),this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t}),Object.freeze(this)}let eo="undefined"!=typeof window&&("requestIdleCallback"in window?window.requestIdleCallback:window.requestAnimationFrame);function es(e){return e.value+(e.unit||"")}function el(e){return e&&1===e.nodeType}function ed(e){return e&&3===e.nodeType}function*ep(e,t){let r=e;for(;r;)if(yield r,r.childNodes.length)r=r.firstChild;else if(r.nextSibling){if(t&&r===t){r=void 0;break}r=r.nextSibling}else for(;r;){if(r=r.parentNode,t&&r===t){r=void 0;break}if(r&&r.nextSibling){r=r.nextSibling;break}}}function ec(e,t){if(t&&e===t)return;let r=ej(e);if(r)return r;if(e.parentNode)for(;e=e.parentNode;){if(t&&e===t)return;if(r=ej(e))return r}}function eu(e,t){if(t&&e===t)return;let r=ez(e);if(r)return r;if(e.parentNode)for(;e=e.parentNode;){if(t&&e===t)return;if(r=ez(e))return r}}function em(e,t){let r=ec(e,t);for(;r&&1!==r.nodeType;)r=ec(r,t);return r}function eh(e,t){let r=eu(e,t);for(;r&&1!==r.nodeType;)r=eu(r,t);return r}function eg(e,t){let r=em(e,t);for(;r&&r.dataset.undisplayed;)r=em(r,t);return r}function ef(e,t){let r=eh(e,t);for(;r&&r.dataset.undisplayed;)r=eh(r,t);return r}function ey(e){let t,r,n=[],a=[],i=document.createDocumentFragment();if("TR"===e.nodeName){let o=e.previousElementSibling,s=1;for(;o;){if(o.childElementCount>e.childElementCount){let l=Array.from(e.children);for(;e.firstChild;)e.firstChild.remove();let d=0;for(let p=0;ps){let u=c.cloneNode(!0);u.rowSpan=c.rowSpan-s,e.appendChild(u)}else{let m=l[d++];m&&e.appendChild(m)}}}o=o.previousElementSibling,s++}}let h=e;for(;h.parentNode&&1===h.parentNode.nodeType;)n.unshift(h.parentNode),h=h.parentNode;for(var g=0;g=this.maxChars){this.hooks&&this.hooks.layout.trigger(e,this);let x=e.querySelectorAll("img");if(x.length&&await this.waitForImages(x),(c=this.findBreakToken(e,t,n,m))&&(u=0,this.rebuildTableFromBreakToken(c,e)),c&&c.equals(m)){console.warn("Unable to layout item: ",o);let k=c.node&&ec(c.node);if(!k)return new eB(void 0,new eP("Unable to layout item",[o]));c=new eL(k)}}}return new eB(c)}breakAt(e,t=0){let r=new eL(e,t);return this.hooks.onBreakToken.triggerSync(r,void 0,e,this).forEach(e=>{void 0!==e&&(r=e)}),r}shouldBreak(e,t){var r;let n=eu(e,t),a=e.parentNode,i;return eb(e)&&a&&!n&&eb(a)&&(i=e.dataset.breakBefore===a.dataset.breakBefore),!i&&eb(e)||void 0!==(r=e)&&void 0!==r.dataset&&void 0!==r.dataset.previousBreakAfter&&("always"===r.dataset.previousBreakAfter||"page"===r.dataset.previousBreakAfter||"left"===r.dataset.previousBreakAfter||"right"===r.dataset.previousBreakAfter||"recto"===r.dataset.previousBreakAfter||"verso"===r.dataset.previousBreakAfter)||eS(e,n)}forceBreak(){this.forceRenderBreak=!0}getStart(e,t){let r,n=t&&t.node;return n||e.firstChild}append(e,t,r,n=!0,a=!0){let i=function e(t,r=!1){return t.cloneNode(r)}(e,!n);if(e.parentNode&&el(e.parentNode)){let o=ek(e.parentNode,t);if(o)o.appendChild(i);else if(a){let s=ey(e);(o=ek(e.parentNode,s))?(r&&ed(r.node)&&r.offset>0&&(i.textContent=i.textContent.substring(r.offset)),o.appendChild(i)):t.appendChild(i),t.appendChild(s)}else t.appendChild(i)}else t.appendChild(i);return i.dataset&&i.dataset.ref&&(t.indexOfRefs||(t.indexOfRefs={}),t.indexOfRefs[i.dataset.ref]=i),this.hooks.renderNode.triggerSync(i,e,this).forEach(e=>{void 0!==e&&(i=e)}),i}rebuildTableFromBreakToken(e,t){if(!e||!e.node)return;let r=e.node,n=el(r)?r.closest("td"):r.parentElement.closest("td");if(n){if(!ek(n,t,!0))return;for(;n=n.nextElementSibling;)this.append(n,t,null,!0)}}async waitForImages(e){await Promise.all(Array.from(e).map(async e=>this.awaitImageLoaded(e)))}async awaitImageLoaded(e){return new Promise(t=>{if(!0!==e.complete)e.onload=function(){let{width:r,height:n}=window.getComputedStyle(e);t(r,n)},e.onerror=function(r){let{width:n,height:a}=window.getComputedStyle(e);t(n,a,r)};else{let{width:r,height:n}=window.getComputedStyle(e);t(r,n)}})}avoidBreakInside(e,t){let r;if(e!==t){for(;e.parentNode&&(e=e.parentNode)!==t;)if("avoid"===window.getComputedStyle(e)["break-inside"]){r=e;break}return r}}createBreakToken(e,t,r){let n=e.startContainer,a=e.startOffset,i,o,s,l,d;if(el(n)){if(el(d=ew(n,a))){if(o=ek(d,t))i=ek(o,r),a=0;else{let p=eC(d);if(el(p)||(p=p.parentElement),o=ek(p,t),!d.nextSibling){let c=ek(o,r),u=document.createTreeWalker(c,NodeFilter.SHOW_ELEMENT),m=u.lastChild(),h=ek(m,t);if(!h)return}i=ek(o,r).nextSibling,a=0}}else(o=ek(n,t))||(o=ek(eC(n),t)),0===(l=e_(d,s=ek(o,r)))?(i=s,a=0):(i=ew(s,l),a=0)}else{if((o=ek(n.parentNode,t))||(o=ek(eC(n.parentNode),t)),-1===(l=e_(n,s=ek(o,r))))return;a+=(i=ew(s,l)).textContent.indexOf(n.textContent)}if(i)return new eL(i,a)}findBreakToken(e,t,r=this.bounds,n,a=!0){let i=this.findOverflow(e,r),o,s;if(this.hooks.onOverflow.triggerSync(i,e,r,this).forEach(e=>{void 0!==e&&(i=e)}),i){o=this.createBreakToken(i,e,t);if(this.hooks.onBreakToken.triggerSync(o,i,e,this).forEach(e=>{void 0!==e&&(o=e)}),o&&o.equals(n))return o;if(s=o&&o.node&&o.offset&&o.node.textContent?o.node.textContent.charAt(o.offset):void 0,o&&o.node&&a){let l=this.removeOverflow(i,s);this.hooks&&this.hooks.afterOverflowRemoved.trigger(l,e,this)}}return o}hasOverflow(e,t=this.bounds){let r=e&&e.parentNode,{width:n,height:a}=e.getBoundingClientRect(),i=r?r.scrollWidth:0,o=r?r.scrollHeight:0;return Math.max(Math.floor(n),i)>Math.round(t.width)||Math.max(Math.floor(a),o)>Math.round(t.height)}findOverflow(e,t=this.bounds,r=this.gap){if(!this.hasOverflow(e,t))return;let n=Math.floor(t.left),a=Math.round(t.right+r),i=Math.round(t.top),o=Math.round(t.bottom),s,l=ep(e.firstChild,e),d,p,c,u,m,h,g,f;for(;!p;)if(p=(d=l.next()).done,c=d.value,m=!1,h=!1,g=void 0,f=void 0,c){let y=ee(c),b=Math.round(y.left),S=Math.floor(y.right),v=Math.round(y.top),x=Math.floor(y.bottom);if(!s&&(b>=a||v>=o)){let k=!1,$=eO(c,"TD",e);if($&&"avoid"===window.getComputedStyle($)["break-inside"])g=$.parentElement;else if(el(c)){let C=window.getComputedStyle(c);k="none"!==C.getPropertyValue("float"),m="avoid"===C.getPropertyValue("break-inside"),g=(h="avoid"===c.dataset.breakBefore||"avoid"===c.dataset.previousBreakAfter)&&eu(c,e),f="BR"===c.tagName||"WBR"===c.tagName}let w;if(w="TR"===c.nodeName?c:eO(c,"TR",e)){let T=w.parentElement;["TBODY","THEAD"].includes(T.nodeName)&&"avoid"===window.getComputedStyle(T).getPropertyValue("break-inside")&&(g=T);let _=eO(w,"TABLE",e),z=_.querySelector("[colspan]");if(_&&z){let A=0;for(let E of Array.from(_.rows[0].cells))A+=parseInt(E.getAttribute("colspan")||"1");if(w.cells.length!==A){let O=w.previousElementSibling,j;for(;null!==O;){for(let W of(j=0,Array.from(O.cells)))j+=parseInt(W.getAttribute("colspan")||"1");if(j===A)break;O=O.previousElementSibling}j===A&&(g=O)}}}if(g){(s=document.createRange()).selectNode(g);break}if(!f&&!k&&el(c)||ed(c)&&c.textContent.trim().length){(s=document.createRange()).selectNode(c);break}}if(!s&&ed(c)&&c.textContent.trim().length&&!eE(c.parentNode)){let L=et(c),B;b=0,v=0;for(var P=0;P!=L.length;P++)(B=L[P]).width>0&&(!b||B.left>b)&&(b=B.left),B.height>0&&(!v||B.top>v)&&(v=B.top);if(b>=a||v>=o){s=document.createRange(),(u=this.textBreak(c,n,a,i,o))?s.setStart(c,u):s=void 0;break}}(m||S<=a&&x<=o)&&(d=ec(c,e))&&(l=ep(d,e))}if(s)return s.setEndAfter(e.lastChild),s}findEndToken(e,t){if(0===e.childNodes.length)return;let r=e.lastChild,n;for(;r&&r.lastChild;)if(e$(r)){if(e$(r.lastChild))r=r.lastChild;else{r=eC(r.lastChild);break}}else r=r.previousSibling;if(ed(r)){if(r.parentNode.dataset.ref){var a;let i;n=(i=(a=r).parentNode)?Array.prototype.indexOf.call(i.childNodes,a):0,r=r.parentNode}else r=r.previousSibling}let o=ek(r,t);n&&(o=o.childNodes[n]);let s=ec(o);return this.breakAt(s)}textBreak(e,t,r,n,a){let i=function* e(t){let r=t.nodeValue,n=r.length,a=0,i,o,s=t.parentElement&&"PRE"===t.parentElement.nodeName;for(;a=r||l>=a){h=p.startOffset;break}if(s>r||d>a){let g=ev(p),f,y,b;for(;!b&&(f=(y=g.next()).value,b=y.done,f);)if(o=Math.floor((m=ee(f)).left),l=Math.floor(m.top),o>=r||l>=a){h=f.startOffset,u=!0;break}}}return h}removeOverflow(e,t){let{startContainer:r}=e,n=e.extractContents();return this.hyphenateAtBreak(r,t),n}hyphenateAtBreak(e,t){if(ed(e)){let r=e.textContent,n=r[r.length-1];(t&&/^\w|\u00AD$/.test(n)&&/^\w|\u00AD$/.test(t)||!t&&/^\w|\u00AD$/.test(n))&&(e.parentNode.classList.add("pagedjs_hyphen"),e.textContent+=this.settings.hyphenGlyph||"‑")}}equalTokens(e,t){return!!e&&!!t&&(!e.node||!t.node||e.node===t.node)&&(!e.offset||!t.offset||e.offset===t.offset)}}J(eD.prototype);class eq{constructor(e,t,r,n,a){this.pagesArea=e,this.pageTemplate=t,this.blank=r,this.width=void 0,this.height=void 0,this.hooks=n,this.settings=a||{}}create(e,t){let r=document.importNode(this.pageTemplate.content,!0),n,a;t?(this.pagesArea.insertBefore(r,t.nextElementSibling),a=Array.prototype.indexOf.call(this.pagesArea.children,t.nextElementSibling),n=this.pagesArea.children[a]):(this.pagesArea.appendChild(r),n=this.pagesArea.lastChild);let i=n.querySelector(".pagedjs_pagebox"),o=n.querySelector(".pagedjs_page_content"),s=n.querySelector(".pagedjs_footnote_area"),l=o.getBoundingClientRect();return o.style.columnWidth=Math.round(l.width)+"px",o.style.columnGap="calc(var(--pagedjs-margin-right) + var(--pagedjs-margin-left) + var(--pagedjs-bleed-right) + var(--pagedjs-bleed-left) + var(--pagedjs-column-gap-offset))",this.width=Math.round(l.width),this.height=Math.round(l.height),this.element=n,this.pagebox=i,this.area=o,this.footnotesArea=s,n}createWrapper(){let e=document.createElement("div");return this.area.appendChild(e),this.wrapper=e,e}index(e){this.position=e;let t=this.element,r=e+1,n=`page-${r}`;this.id=n,t.dataset.pageNumber=r,t.setAttribute("id",n),this.name&&t.classList.add("pagedjs_"+this.name+"_page"),this.blank&&t.classList.add("pagedjs_blank_page"),0===e&&t.classList.add("pagedjs_first_page"),e%2!=1?(t.classList.remove("pagedjs_left_page"),t.classList.add("pagedjs_right_page")):(t.classList.remove("pagedjs_right_page"),t.classList.add("pagedjs_left_page"))}async layout(e,t,r){this.clear(),this.startToken=t;let n=this.settings;!n.maxChars&&r&&(n.maxChars=r),this.layoutMethod=new eD(this.area,this.hooks,n);let a=(await this.layoutMethod.renderTo(this.wrapper,e,t)).breakToken;return this.addListeners(e),this.endToken=a,a}async append(e,t){if(!this.layoutMethod)return this.layout(e,t);let r=(await this.layoutMethod.renderTo(this.wrapper,e,t)).breakToken;return this.endToken=r,r}getByParent(e,t){let r;for(var n=0;n{this.listening&&requestAnimationFrame(()=>{for(let a of n){let i=a.contentRect;i.height>r?(this.checkOverflowAfterResize(e),r=t.getBoundingClientRect().height):i.height -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-`;class eR{constructor(e,t,r){this.settings=r||{},this.hooks={},this.hooks.beforeParsed=new X(this),this.hooks.filter=new X(this),this.hooks.afterParsed=new X(this),this.hooks.beforePageLayout=new X(this),this.hooks.layout=new X(this),this.hooks.renderNode=new X(this),this.hooks.layoutNode=new X(this),this.hooks.onOverflow=new X(this),this.hooks.afterOverflowRemoved=new X(this),this.hooks.onBreakToken=new X,this.hooks.afterPageLayout=new X(this),this.hooks.finalizePage=new X(this),this.hooks.afterRendered=new X(this),this.pages=[],this.total=0,this.q=new class e{constructor(e){this._q=[],this.context=e,this.tick=requestAnimationFrame,this.running=!1,this.paused=!1}enqueue(){var e,t,r,n=[].shift.call(arguments),a=arguments;if(!n)throw Error("No Task Provided");return"function"==typeof n?(t=(e=new ei).promise,r={task:n,args:a,deferred:e,promise:t}):r={promise:n},this._q.push(r),!1!=this.paused||this.running||this.run(),r.promise}dequeue(){var e,t,r;return!this._q.length||this.paused?((e=new ei).deferred.resolve(),e.promise):(t=(e=this._q.shift()).task)?(r=t.apply(this.context,e.args))&&"function"==typeof r.then?r.then((function(){e.deferred.resolve.apply(this.context,arguments)}).bind(this),(function(){e.deferred.reject.apply(this.context,arguments)}).bind(this)):(e.deferred.resolve.apply(this.context,r),e.promise):e.promise?e.promise:void 0}dump(){for(;this._q.length;)this.dequeue()}run(){return this.running||(this.running=!0,this.defered=new ei),this.tick.call(window,()=>{this._q.length?this.dequeue().then((function(){this.run()}).bind(this)):(this.defered.resolve(),this.running=void 0)}),!0==this.paused&&(this.paused=!1),this.defered.promise}flush(){return this.running?this.running:this._q.length?(this.running=this.dequeue().then((function(){return this.running=void 0,this.flush()}).bind(this)),this.running):void 0}clear(){this._q=[]}length(){return this._q.length}pause(){this.paused=!0}stop(){this._q=[],this.running=!1,this.paused=!0}}(this),this.stopped=!1,this.rendered=!1,this.content=e,this.charsPerBreak=[],this.maxChars,e&&this.flow(e,t)}setup(e){this.pagesArea=document.createElement("div"),this.pagesArea.classList.add("pagedjs_pages"),e?e.appendChild(this.pagesArea):document.querySelector("body").appendChild(this.pagesArea),this.pageTemplate=document.createElement("template"),this.pageTemplate.innerHTML=eI}async flow(e,t){let r;await this.hooks.beforeParsed.trigger(e,this),r=new eM(e),this.hooks.filter.triggerSync(r),this.source=r,this.breakToken=void 0,this.pagesArea&&this.pageTemplate?(this.q.clear(),this.removePages()):this.setup(t),this.emit("rendering",r),await this.hooks.afterParsed.trigger(r,this),await this.loadFonts();let n=await this.render(r,this.breakToken);for(;n.canceled;)this.start(),n=await this.render(r,this.breakToken);return this.rendered=!0,this.pagesArea.style.setProperty("--pagedjs-page-count",this.total),await this.hooks.afterRendered.trigger(this.pages,this),this.emit("rendered",this.pages),this}async render(e,t){let r=this.layout(e,t),n=!1,a;for(;!n;)n=(a=await this.q.enqueue(()=>this.renderAsync(r))).done;return a}start(){this.rendered=!1,this.stopped=!1}stop(){this.stopped=!0}renderOnIdle(e){return new Promise(t=>{eo(async()=>{if(this.stopped)return t({done:!0,canceled:!0});let r=await e.next();this.stopped?t({done:!0,canceled:!0}):t(r)})})}async renderAsync(e){if(this.stopped)return{done:!0,canceled:!0};let t=await e.next();return this.stopped?{done:!0,canceled:!0}:t}async handleBreaks(e,t){let r=this.total+1,n=r%2==0?"left":"right",a=r%2==0?"verso":"recto",i,o,s;1!==r&&(e&&void 0!==e.dataset&&void 0!==e.dataset.previousBreakAfter&&(i=e.dataset.previousBreakAfter),e&&void 0!==e.dataset&&void 0!==e.dataset.breakBefore&&(o=e.dataset.breakBefore),t?s=this.addPage(!0):i&&("left"===i||"right"===i)&&i!==n?s=this.addPage(!0):i&&("verso"===i||"recto"===i)&&i!==a?s=this.addPage(!0):o&&("left"===o||"right"===o)&&o!==n?s=this.addPage(!0):o&&("verso"===o||"recto"===o)&&o!==a&&(s=this.addPage(!0)),s&&(await this.hooks.beforePageLayout.trigger(s,void 0,void 0,this),this.emit("page",s),await this.hooks.afterPageLayout.trigger(s.element,s,void 0,this),await this.hooks.finalizePage.trigger(s.element,s,void 0,this),this.emit("renderedPage",s)))}async *layout(e,t){let r=t||!1,n=[];for(;void 0!==r;){r&&r.node?await this.handleBreaks(r.node):await this.handleBreaks(e.firstChild);let a=this.addPage();if(await this.hooks.beforePageLayout.trigger(a,e,r,this),this.emit("page",a),r=await a.layout(e,r,this.maxChars)){let i=r.toJSON(!0);if(n.lastIndexOf(i)>-1){let o=new eP("Layout repeated",[r.node]);return console.error("Layout repeated at: ",r.node),o}n.push(i)}await this.hooks.afterPageLayout.trigger(a.element,a,r,this),await this.hooks.finalizePage.trigger(a.element,a,void 0,this),this.emit("renderedPage",a),this.recoredCharLength(a.wrapper.textContent.length),yield r}}recoredCharLength(e){0!==e&&(this.charsPerBreak.push(e),this.charsPerBreak.length>4&&this.charsPerBreak.shift(),this.maxChars=this.charsPerBreak.reduce((e,t)=>e+t,0)/this.charsPerBreak.length)}removePages(e=0){if(!(e>=this.pages.length)){for(let t=e;t0?this.pages.splice(e):this.pages=[],this.total=this.pages.length}}addPage(e){let t=this.pages[this.pages.length-1],r=new eq(this.pagesArea,this.pageTemplate,e,this.hooks,this.settings);return this.pages.push(r),r.create(void 0,t&&t.element),r.index(this.total),e||(r.onOverflow(e=>{if(console.warn("overflow on",r.id,e),this.rendered)return;let t=this.pages.indexOf(r)+1;this.stop(),this.breakToken=e,this.removePages(t),!0===this.rendered&&(this.rendered=!1,this.q.enqueue(async()=>{this.start(),await this.render(this.source,this.breakToken),this.rendered=!0}))}),r.onUnderflow(e=>{})),this.total=this.pages.length,r}async clonePage(e){let t=this.pages[this.pages.length-1],r=new eq(this.pagesArea,this.pageTemplate,!1,this.hooks);for(let n of(this.pages.push(r),r.create(void 0,t&&t.element),r.index(this.total),await this.hooks.beforePageLayout.trigger(r,void 0,void 0,this),this.emit("page",r),e.element.classList))"pagedjs_left_page"!==n&&"pagedjs_right_page"!==n&&r.element.classList.add(n);await this.hooks.afterPageLayout.trigger(r.element,r,void 0,this),await this.hooks.finalizePage.trigger(r.element,r,void 0,this),this.emit("renderedPage",r)}loadFonts(){let e=[];return(document.fonts||[]).forEach(t=>{if("loaded"!==t.status){let r=t.load().then(e=>t.family,e=>(console.warn("Failed to preload font-family:",t.family),t.family));e.push(r)}}),Promise.all(e).catch(e=>{console.warn(e)})}destroy(){this.pagesArea.remove(),this.pageTemplate.remove()}}J(eR.prototype);var e0={exports:{}},eN={};function eF(e){return{prev:null,next:null,data:e}}function e1(e,t,r){var n;return null!==eV?(n=eV,eV=eV.cursor,n.prev=t,n.next=r,n.cursor=e.cursor):n={prev:t,next:r,cursor:e.cursor},e.cursor=n,n}function eG(e){var t=e.cursor;e.cursor=t.cursor,t.prev=null,t.next=null,t.cursor=eV,eV=t}var eV=null,e2=function(){this.cursor=null,this.head=null,this.tail=null};e2.createItem=eF,e2.prototype.createItem=eF,e2.prototype.updateCursors=function(e,t,r,n){for(var a=this.cursor;null!==a;)a.prev===e&&(a.prev=t),a.next===r&&(a.next=n),a=a.cursor},e2.prototype.getSize=function(){for(var e=0,t=this.head;t;)e++,t=t.next;return e},e2.prototype.fromArray=function(e){var t=null;this.head=null;for(var r=0;r100&&(d=i-60+3,i=58);for(var p=o;p<=s;p++)p>=0&&p0&&n[p].length>d?"…":"")+n[p].substr(d,98)+(n[p].length>d+100-1?"…":""));return[r(o,a),Array(i+l+2).join("-")+"^",r(a,s)].filter(Boolean).join("\n")}var e4=function(e,t,r,n,a){var i=e3("SyntaxError",e);return i.source=t,i.offset=r,i.line=n,i.column=a,i.sourceFragment=function(e){return e7(i,isNaN(e)?0:e)},Object.defineProperty(i,"formattedMessage",{get:function(){return"Parse error: "+i.message+"\n"+e7(i,2)}}),i.parseError={offset:r,line:n,column:a},i},eY={EOF:0,Ident:1,Function:2,AtKeyword:3,Hash:4,String:5,BadString:6,Url:7,BadUrl:8,Delim:9,Number:10,Percentage:11,Dimension:12,WhiteSpace:13,CDO:14,CDC:15,Colon:16,Semicolon:17,Comma:18,LeftSquareBracket:19,RightSquareBracket:20,LeftParenthesis:21,RightParenthesis:22,LeftCurlyBracket:23,RightCurlyBracket:24,Comment:25},e6=Object.keys(eY).reduce(function(e,t){return e[eY[t]]=t,e},{}),eK={TYPE:eY,NAME:e6};function eZ(e){return e>=48&&e<=57}function e5(e){return e>=65&&e<=90}function eQ(e){return e>=97&&e<=122}function eJ(e){return e5(e)||eQ(e)}function eX(e){return e>=128}function te(e){return eJ(e)||eX(e)||95===e}function tt(e){return e>=0&&e<=8||11===e||e>=14&&e<=31||127===e}function tr(e){return 10===e||13===e||12===e}function tn(e){return tr(e)||32===e||9===e}function ta(e,t){return!(92!==e||tr(t)||0===t)}var ti=Array(128);ts.Eof=128,ts.WhiteSpace=130,ts.Digit=131,ts.NameStart=132,ts.NonPrintable=133;for(var to=0;to=65&&t<=70||t>=97&&t<=102},isUppercaseLetter:e5,isLowercaseLetter:eQ,isLetter:eJ,isNonAscii:eX,isNameStart:te,isName:function e(t){return te(t)||eZ(t)||45===t},isNonPrintable:tt,isNewline:tr,isWhiteSpace:tn,isValidEscape:ta,isIdentifierStart:function e(t,r,n){return 45===t?te(r)||45===r||ta(r,n):!!te(t)||92===t&&ta(t,r)},isNumberStart:function e(t,r,n){return 43===t||45===t?eZ(r)?2:46===r&&eZ(n)?3:0:46===t?eZ(r)?2:0:eZ(t)?1:0},isBOM:function e(t){return 65279===t||65534===t?1:0},charCodeCategory:ts},td=tl,tp=td.isDigit,tc=td.isHexDigit,tu=td.isUppercaseLetter,tm=td.isName,th=td.isWhiteSpace,tg=td.isValidEscape;function tf(e,t){return tt.length)return!1;for(var i=r;i=0&&th(t.charCodeAt(r));r--);return r+1},findWhiteSpaceEnd:function e(t,r){for(;r>24:tT},lookupOffset:function(e){return(e+=this.tokenIndex)0?e>24,this.source,i)){case 1:break loop;case 2:a++;break loop;default:this.balance[r]===a&&(a=r),i=16777215&this.offsetAndType[a]}}return a-this.tokenIndex},isBalanceEdge:function(e){return this.balance[this.tokenIndex]>24===t_;e++,t++);t>0&&this.skip(t)},skipSC:function(){for(;this.tokenType===t_||this.tokenType===t8;)this.next()},skip:function(e){var t=this.tokenIndex+e;t>24,this.tokenEnd=16777215&t):(this.tokenIndex=this.tokenCount,this.next())},next:function(){var e=this.tokenIndex+1;e>24,this.tokenEnd=16777215&e):(this.tokenIndex=this.tokenCount,this.eof=!0,this.tokenType=tT,this.tokenStart=this.tokenEnd=this.source.length)},forEachToken(e){for(var t=0,r=this.firstCharOffset;t>24;r=i,e(o,n,i,t)}},dump(){var e=Array(this.tokenCount);return this.forEachToken((t,r,n,a)=>{e[a]={idx:a,type:tC[t],chunk:this.source.substring(r,n),balance:this.balance[a]}}),e}};var tA=tz;function tE(e){return e}var tO=function(e,t){var r=tE,n=!1,a=!1;return"function"==typeof t?r=t:t&&(n=Boolean(t.forceBraces),a=Boolean(t.compact),"function"==typeof t.decorate&&(r=t.decorate)),function e(t,r,n,a){var i,o,s,l,d,p,c,u;switch(t.type){case"Group":i=(o=t,s=r,l=n,d=a,p=" "===o.combinator||d?o.combinator:" "+o.combinator+" ",c=o.terms.map(function(t){return e(t,s,l,d)}).join(p),(o.explicit||l)&&(c=(d||","===c[0]?"[":"[ ")+c+(d?"]":" ]")),c+(t.disallowEmpty?"!":""));break;case"Multiplier":return e(t.term,r,n,a)+r(0===(u=t).min&&0===u.max?"*":0===u.min&&1===u.max?"?":1===u.min&&0===u.max?u.comma?"#":"+":1===u.min&&1===u.max?"":(u.comma?"#":"")+(u.min===u.max?"{"+u.min+"}":"{"+u.min+","+(0!==u.max?u.max:"")+"}"),t);case"Type":i="<"+t.name+(t.opts?r(function e(t){if("Range"===t.type)return" ["+(null===t.min?"-∞":t.min)+","+(null===t.max?"∞":t.max)+"]";throw Error("Unknown node type `"+t.type+"`")}(t.opts),t.opts):"")+">";break;case"Property":i="<'"+t.name+"'>";break;case"Keyword":i=t.name;break;case"AtKeyword":i="@"+t.name;break;case"Function":i=t.name+"(";break;case"String":case"Token":i=t.value;break;case"Comma":i=",";break;default:throw Error("Unknown node type `"+t.type+"`")}return r(i,t)}(e,r,n,a)};let tj=eH,tW=tO,tL={offset:0,line:1,column:1};function tB(e,t){let r=e&&e.loc&&e.loc[t];return r?"line"in r?tP(r):r:null}function tP({offset:e,line:t,column:r},n){let a={offset:e,line:t,column:r};if(n){let i=n.split(/\n|\r\n?|\f/);a.offset+=n.length,a.line+=i.length-1,a.column=1===i.length?a.column+n.length:i.pop().length+1}return a}let tD=function(e,t){let r=tj("SyntaxReferenceError",e+(t?" `"+t+"`":""));return r.reference=t,r},tq=function(e,t,r,n){let a=tj("SyntaxMatchError",e),{css:i,mismatchOffset:o,mismatchLength:s,start:l,end:d}=function e(t,r){let n=t.tokens,a=t.longestMatch,i=a1?(c=tB(o||r,"end")||tP(tL,p),u=tP(c)):(c=tB(o,"start")||tP(tB(r,"start")||tL,p.slice(0,s)),u=tB(o,"end")||tP(c,p.substr(s,l))),{css:p,mismatchOffset:s,mismatchLength:l,start:c,end:u}}(n,r);return a.rawMessage=e,a.syntax=t?tW(t):"",a.css=i,a.mismatchOffset=o,a.mismatchLength=s,a.message=e+"\n syntax: "+a.syntax+"\n value: "+(i||"")+"\n --------"+Array(a.mismatchOffset+1).join("-")+"^",Object.assign(a,l),a.loc={source:r&&r.loc&&r.loc.source||"",start:l,end:d},a};var tM={SyntaxReferenceError:tD,SyntaxMatchError:tq},tI=Object.prototype.hasOwnProperty,tR=Object.create(null),t0=Object.create(null);function tN(e,t){return t=t||0,e.length-t>=2&&45===e.charCodeAt(t)&&45===e.charCodeAt(t+1)}function tF(e,t){if(t=t||0,e.length-t>=3&&45===e.charCodeAt(t)&&45!==e.charCodeAt(t+1)){var r=e.indexOf("-",t+2);if(-1!==r)return e.substring(t,r+1)}return""}var t1={keyword:function e(t){if(tI.call(tR,t))return tR[t];var r=t.toLowerCase();if(tI.call(tR,r))return tR[t]=tR[r];var n=tN(r,0),a=n?"":tF(r,0);return tR[t]=Object.freeze({basename:r.substr(a.length),name:r,vendor:a,prefix:a,custom:n})},property:function e(t){if(tI.call(t0,t))return t0[t];var r=t,n=t[0];"/"===n?n="/"===t[1]?"//":"/":"_"!==n&&"*"!==n&&"$"!==n&&"#"!==n&&"+"!==n&&"&"!==n&&(n="");var a=tN(r,n.length);if(!a&&(r=r.toLowerCase(),tI.call(t0,r)))return t0[t]=t0[r];var i=a?"":tF(r,n.length),o=r.substr(0,n.length+i.length);return t0[t]=Object.freeze({basename:r.substr(o.length),name:r.substr(n.length),hack:n,vendor:i,prefix:o,custom:a})},isCustomProperty:tN,vendorPrefix:tF},tG="undefined"!=typeof Uint32Array?Uint32Array:Array,tV=function e(t,r){return null===t||t.length=e.length){c>24,l[d]=h,l[h++]=d;h0)return 6;return 0}if(!rx(i)||++a>6)return 0}return a}function rE(e,t,r){if(!e)return 0;for(;r8(r(t),63);){if(++e>6)return 0;t++}return t}var rO=function e(t,r){var n=0;if(null===t||t.type!==rC||!rk(t.value,0,117)||null===(t=r(++n)))return 0;if(r8(t,43))return null===(t=r(++n))?0:t.type===rC?rE(rA(t,0,!0),++n,r):r8(t,63)?rE(1,++n,r):0;if(t.type===rT){if(!rz(t,43))return 0;var a=rA(t,1,!0);return 0===a?0:null===(t=r(++n))?n:t.type===r_||t.type===rT?rz(t,45)&&rA(t,1,!1)?n+1:0:rE(a,n,r)}return t.type===r_?rz(t,43)?rE(rA(t,1,!0),++n,r):0:0},rj=ro,rW=rj.isIdentifierStart,rL=rj.isHexDigit,rB=rj.isDigit,rP=rj.cmpStr,rD=rj.consumeNumber,rq=rj.TYPE,rM=["unset","initial","inherit"],rI=["calc(","-moz-calc(","-webkit-calc("];function rR(e,t){return te.max)return!0}return!1}function rG(e,t){var r=e.index,n=0;do if(n++,e.balance<=r)break;while(e=t(n));return n}function rV(e){return function(t,r,n){return null===t?0:t.type===rq.Function&&rN(t.value,rI)?rG(t,r):e(t,r,n)}}function r2(e){return function(t){return null===t||t.type!==e?0:1}}function rU(e){return function(t,r,n){if(null===t||t.type!==rq.Dimension)return 0;var a=rD(t.value,0);if(null!==e){var i=t.value.indexOf("\\",a),o=-1!==i&&rF(t.value,i)?t.value.substring(a,i):t.value.substr(a);if(!1===e.hasOwnProperty(o.toLowerCase()))return 0}return r1(n,t.value,a)?0:1}}function rH(e){return"function"!=typeof e&&(e=function(){return 0}),function(t,r,n){return null!==t&&t.type===rq.Number&&0===Number(t.value)?1:e(t,r,n)}}var r3="expression",r9={"ident-token":r2(rq.Ident),"function-token":r2(rq.Function),"at-keyword-token":r2(rq.AtKeyword),"hash-token":r2(rq.Hash),"string-token":r2(rq.String),"bad-string-token":r2(rq.BadString),"url-token":r2(rq.Url),"bad-url-token":r2(rq.BadUrl),"delim-token":r2(rq.Delim),"number-token":r2(rq.Number),"percentage-token":r2(rq.Percentage),"dimension-token":r2(rq.Dimension),"whitespace-token":r2(rq.WhiteSpace),"CDO-token":r2(rq.CDO),"CDC-token":r2(rq.CDC),"colon-token":r2(rq.Colon),"semicolon-token":r2(rq.Semicolon),"comma-token":r2(rq.Comma),"[-token":r2(rq.LeftSquareBracket),"]-token":r2(rq.RightSquareBracket),"(-token":r2(rq.LeftParenthesis),")-token":r2(rq.RightParenthesis),"{-token":r2(rq.LeftCurlyBracket),"}-token":r2(rq.RightCurlyBracket),string:r2(rq.String),ident:r2(rq.Ident),"custom-ident":function e(t){if(null===t||t.type!==rq.Ident)return 0;var r=t.value.toLowerCase();return rN(r,rM)||r0(r,"default")?0:1},"custom-property-name":function e(t){return null===t||t.type!==rq.Ident||45!==rR(t.value,0)||45!==rR(t.value,1)?0:1},"hex-color":function e(t){if(null===t||t.type!==rq.Hash)return 0;var r=t.value.length;if(4!==r&&5!==r&&7!==r&&9!==r)return 0;for(var n=1;nt.index||t.balancet.index||t.balance=128||0===rZ[r])break}return e.pos===t&&e.error("Expect a keyword"),e.substringToPos(t)}function rX(e){for(var t=e.pos;t57)break}return e.pos===t&&e.error("Expect a number"),e.substringToPos(t)}function ne(e){var t=null,r=null;return e.eat(123),t=rX(e),44===e.charCode()?(e.pos++,125!==e.charCode()&&(r=rX(e))):r=t,e.eat(125),{min:Number(t),max:r?Number(r):0}}function nt(e,t){var r=function e(t){var r=null,n=!1;switch(t.charCode()){case 42:t.pos++,r={min:0,max:0};break;case 43:t.pos++,r={min:1,max:0};break;case 63:t.pos++,r={min:0,max:1};break;case 35:t.pos++,n=!0,r=123===t.charCode()?ne(t):{min:1,max:0};break;case 123:r=ne(t);break;default:return null}return{type:"Multiplier",comma:n,min:r.min,max:r.max,term:null}}(e);return null!==r?(r.term=t,r):t}function nr(e){var t=e.peek();return""===t?null:{type:"Token",value:t}}function nn(e){for(var t,r=[],n={},a=null,i=e.pos;t=na(e);)"Spaces"!==t.type&&("Combinator"===t.type?((null===a||"Combinator"===a.type)&&(e.pos=i,e.error("Unexpected combinator")),n[t.value]=!0):null!==a&&"Combinator"!==a.type&&(n[" "]=!0,r.push({type:"Combinator",value:" "})),r.push(t),a=t,i=e.pos);return null!==a&&"Combinator"===a.type&&(e.pos-=i,e.error("Unexpected combinator")),{type:"Group",terms:r,combinator:function e(t,r){function n(e,t){return{type:"Group",terms:e,combinator:t,disallowEmpty:!1,explicit:!1}}for(r=Object.keys(r).sort(function(e,t){return r5[e]-r5[t]});r.length>0;){for(var a=r.shift(),i=0,o=0;i1&&(t.splice(o,i-o,n(t.slice(o,i),a)),i=o+1),o=-1))}-1!==o&&r.length&&t.splice(o,i-o,n(t.slice(o,i),a))}return a}(r,n)||" ",disallowEmpty:!1,explicit:!1}}function na(e){var t,r,n,a,i,o,s,l,d,p,c,u,m,h,g,f=e.charCode();if(f<128&&1===rZ[f])return(d=rJ(l=e),40===l.charCode())?(l.pos++,{type:"Function",name:d}):nt(l,{type:"Keyword",name:d});switch(f){case 93:case 42:case 43:case 63:case 35:case 33:break;case 91:return nt(e,((p=e).eat(91),c=nn(p),p.eat(93),c.explicit=!0,33===p.charCode()&&(p.pos++,c.disallowEmpty=!0),c));case 60:return 39===e.nextCharCode()?((u=e).eat(60),u.eat(39),m=rJ(u),u.eat(39),u.eat(62),nt(u,{type:"Property",name:m})):(t=e,s=null,t.eat(60),o=rJ(t),40===t.charCode()&&41===t.nextCharCode()&&(t.pos+=2,o+="()"),91===t.charCodeAt(t.findWsEnd(t.pos))&&(rQ(t),s=(n=null,a=null,i=1,((r=t).eat(91),45===r.charCode()&&(r.peek(),i=-1),-1==i&&8734===r.charCode()?r.peek():n=i*Number(rX(r)),rQ(r),r.eat(44),rQ(r),8734===r.charCode()?r.peek():(i=1,45===r.charCode()&&(r.peek(),i=-1),a=i*Number(rX(r))),r.eat(93),null===n&&null===a)?null:{type:"Range",min:n,max:a})),t.eat(62),nt(t,{type:"Type",name:o,opts:s}));case 124:return{type:"Combinator",value:e.substringToPos(124===e.nextCharCode()?e.pos+2:e.pos+1)};case 38:return e.pos++,e.eat(38),{type:"Combinator",value:"&&"};case 44:return e.pos++,{type:"Comma"};case 39:return nt(e,{type:"String",value:(-1===(g=(h=e).str.indexOf("'",h.pos+1))&&(h.pos=h.str.length,h.error("Expect an apostrophe")),h.substringToPos(g+1))});case 32:case 9:case 10:case 13:case 12:return{type:"Spaces",value:rQ(e)};case 64:if((f=e.nextCharCode())<128&&1===rZ[f])return e.pos++,{type:"AtKeyword",name:rJ(e)};return nr(e);case 123:if((f=e.nextCharCode())<48||f>57)return nr(e);break;default:return nr(e)}}function ni(e){var t=new rK(e),r=nn(t);return t.pos!==e.length&&t.error("Unexpected input"),1===r.terms.length&&"Group"===r.terms[0].type&&(r=r.terms[0]),r}ni("[a&&#|<'c'>*||e() f{2} /,(% g#{1,2} h{2,})]!");var no=ni,ns=function(){};function nl(e){return"function"==typeof e?e:ns}var nd=function(e,t,r){var n=ns,a=ns;if("function"==typeof t?n=t:t&&(n=nl(t.enter),a=nl(t.leave)),n===ns&&a===ns)throw Error("Neither `enter` nor `leave` walker handler is set or both aren't a function");!function e(t){switch(n.call(r,t),t.type){case"Group":t.terms.forEach(e);break;case"Multiplier":e(t.term);break;case"Type":case"Property":case"Keyword":case"AtKeyword":case"Function":case"String":case"Token":case"Comma":break;default:throw Error("Unknown type: "+t.type)}a.call(r,t)}(e)},np=ro,nc=new tA,nu={decorator:function(e){var t=null,r={len:0,node:null},n=[r],a="";return{children:e.children,node:function(r){var n=t;t=r,e.node.call(this,r),t=n},chunk:function(e){a+=e,r.node!==t?n.push({len:e.length,node:t}):r.len+=e.length},result:function(){return nm(a,n)}}}};function nm(e,t){var r=[],n=0,a=0,i=t?t[a].node:null;for(np(e,nc);!nc.eof;){if(t)for(;a2&&40===e.charCodeAt(e.length-2)&&41===e.charCodeAt(e.length-1)}function nx(e){return"Keyword"===e.type||"AtKeyword"===e.type||"Function"===e.type||"Type"===e.type&&nv(e.name)}var nk={MATCH:nf,MISMATCH:ny,DISALLOW_EMPTY:nb,buildMatchGraph:function(e,t){return"string"==typeof e&&(e=ng(e)),{type:"MatchGraph",match:function e(t){if("function"==typeof t)return{type:"Generic",fn:t};switch(t.type){case"Group":var r=function e(t,r,n){switch(t){case" ":for(var a=nf,i=r.length-1;i>=0;i--){var o=r[i];a=nS(o,a,ny)}return a;case"|":for(var a=ny,s=null,i=r.length-1;i>=0;i--){var o=r[i];if(nx(o)&&(null===s&&i>0&&nx(r[i-1])&&(a=nS({type:"Enum",map:s=Object.create(null)},nf,a)),null!==s)){var l=(nv(o.name)?o.name.slice(0,-1):o.name).toLowerCase();if(l in s==!1){s[l]=o;continue}}s=null,a=nS(o,nf,a)}return a;case"&&":if(r.length>5)return{type:"MatchOnce",terms:r,all:!0};for(var a=ny,i=r.length-1;i>=0;i--){var d,o=r[i];d=r.length>1?e(t,r.filter(function(e){return e!==o}),!1):nf,a=nS(o,d,a)}return a;case"||":if(r.length>5)return{type:"MatchOnce",terms:r,all:!1};for(var a=n?nf:ny,i=r.length-1;i>=0;i--){var d,o=r[i];d=r.length>1?e(t,r.filter(function(e){return e!==o}),!0):nf,a=nS(o,d,a)}return a}}(t.combinator,t.terms.map(e),!1);return t.disallowEmpty&&(r=nS(r,nb,ny)),r;case"Multiplier":return function t(r){var n=nf,a=e(r.term);if(0===r.max)a=nS(a,nb,ny),(n=nS(a,null,ny)).then=nS(nf,nf,n),r.comma&&(n.then.else=nS({type:"Comma",syntax:r},n,ny));else for(var i=r.min||1;i<=r.max;i++)r.comma&&n!==nf&&(n=nS({type:"Comma",syntax:r},n,ny)),n=nS(a,nS(nf,nf,n),ny);if(0===r.min)n=nS(nf,nf,n);else for(var i=0;i=65&&n<=90&&(n|=32),n!==a)return!1}return!0}function nj(e){var t;return null===e||e.type===n8.Comma||e.type===n8.Function||e.type===n8.LeftParenthesis||e.type===n8.LeftSquareBracket||e.type===n8.LeftCurlyBracket||(t=e).type===n8.Delim&&"?"!==t.value}function nW(e){return null===e||e.type===n8.RightParenthesis||e.type===n8.RightSquareBracket||e.type===n8.RightCurlyBracket||e.type===n8.Delim}function nL(e){function t(e){return null!==e&&("Type"===e.type||"Property"===e.type||"Keyword"===e.type)}var r=null;return null!==this.matched&&function n(a){if(Array.isArray(a.match)){for(var i=0;i=0}function nI(e){return Boolean(e)&&nM(e.offset)&&nM(e.line)&&nM(e.column)}function nR(e,t){var r,n,a=t.structure,i={type:String,loc:!0},o={type:'"'+e+'"'};for(var s in a)if(!1!==nq.call(a,s)){for(var l=[],d=i[s]=Array.isArray(a[s])?a[s].slice():[a[s]],p=0;p");else if(Array.isArray(c))l.push("List");else throw Error("Wrong value `"+c+"` in `"+e+"."+s+"` structure definition")}o[s]=l.join(" | ")}return{docs:o,check:(r=e,n=i,function e(t,a){if(!t||t.constructor!==Object)return a(t,"Type of node should be an Object");for(var i in t){var o=!0;if(!1!==nq.call(t,i)){if("type"===i)t.type!==r&&a(t,"Wrong node type `"+t.type+"`, expected `"+r+"`");else if("loc"===i){if(null===t.loc)continue;if(t.loc&&t.loc.constructor===Object){if("string"!=typeof t.loc.source)i+=".source";else if(nI(t.loc.start)){if(nI(t.loc.end))continue;i+=".end"}else i+=".start"}o=!1}else if(n.hasOwnProperty(i))for(var s=0,o=!1;!o&&sv&&(v=S)}function p(){u={syntax:r.syntax,opts:r.syntax.opts||null!==u&&u.opts||null,prev:u},x={type:2,syntax:r.syntax,token:x.token,prev:x}}function c(){x=2===x.type?x.prev:{type:3,syntax:u.syntax,token:x.token,prev:x},u=u.prev}var u=null,m=null,h=null,g=null,f=0,y=null,b=null,S=-1,v=0,x={type:nz,syntax:null,token:null,prev:null};for(a();null===y&&++f<15e3;)switch(r.type){case"Match":if(null===m){if(null!==b&&(S!==t.length-1||"\\0"!==b.value&&"\\9"!==b.value)){r=nT;break}y=nA;break}if((r=m.nextState)===n_){if(m.matchStack===x){r=nT;break}r=nw}for(;m.syntaxStack!==u;)c();m=m.prev;break;case"Mismatch":if(null!==g&&!1!==g)(null===h||S>h.tokenIndex)&&(h=g,g=!1);else if(null===h){y="Mismatch";break}r=h.nextState,m=h.thenStack,u=h.syntaxStack,x=h.matchStack,b=(S=h.tokenIndex)S){for(;S":"<'"+r.name+"'>"));if(!1!==g&&null!==b&&"Type"===r.type&&("custom-ident"===r.name&&b.type===n8.Ident||"length"===r.name&&"0"===b.value)){null===g&&(g=o(r,h)),r=nT;break}p(),r=z.match;break;case"Keyword":var C=r.name;if(null!==b){var A=b.value;if(-1!==A.indexOf("\\")&&(A=A.replace(/\\[09].*$/,"")),nO(A,C)){d(),r=nw;break}}r=nT;break;case"AtKeyword":case"Function":if(null!==b&&nO(b.value,r.name)){d(),r=nw;break}r=nT;break;case"Token":if(null!==b&&b.value===r.value){d(),r=nw;break}r=nT;break;case"Comma":null!==b&&b.type===n8.Comma?nj(x.token)?r=nT:(d(),r=nW(b)?nT:nw):r=nj(x.token)||nW(b)?nw:nT;break;case"String":for(var E="",T=S;T");function nK(e,t,r){var n={};for(var a in e)e[a].syntax&&(n[a]=r?e[a].syntax:nV(e[a].syntax,{compact:t}));return n}function nZ(e,t,r){return{matched:e,iterations:r,error:t,getTrace:n9.getTrace,isType:n9.isType,isProperty:n9.isProperty,isKeyword:n9.isKeyword}}function n5(e,t,r,n){var a,i=nU(r,e.syntax);return!function e(t){for(var r=0;r(r[n]=this.createDescriptor(t.descriptors[n],"AtruleDescriptor",n,e),r),{}):null})},addProperty_:function(e,t){t&&(this.properties[e]=this.createDescriptor(t,"Property",e))},addType_:function(e,t){t&&(this.types[e]=this.createDescriptor(t,"Type",e),t===n1["-ms-legacy-expression"]&&(this.valueCommonSyntax=n6))},checkAtruleName:function(e){if(!this.getAtrule(e))return new n0("Unknown at-rule","@"+e)},checkAtrulePrelude:function(e,t){let r=this.checkAtruleName(e);if(r)return r;var n=this.getAtrule(e);return!n.prelude&&t?SyntaxError("At-rule `@"+e+"` should not contain a prelude"):n.prelude&&!t?SyntaxError("At-rule `@"+e+"` should contain a prelude"):void 0},checkAtruleDescriptorName:function(e,t){let r=this.checkAtruleName(e);if(r)return r;var n=this.getAtrule(e),a=nF.keyword(t);return n.descriptors?n.descriptors[a.name]||n.descriptors[a.basename]?void 0:new n0("Unknown at-rule descriptor",t):SyntaxError("At-rule `@"+e+"` has no known descriptors")},checkPropertyName:function(e){return nF.property(e).custom?Error("Lexer matching doesn't applicable for custom properties"):this.getProperty(e)?void 0:new n0("Unknown property",e)},matchAtrulePrelude:function(e,t){var r=this.checkAtrulePrelude(e,t);return r?nZ(null,r):t?n5(this,this.getAtrule(e).prelude,t,!1):nZ(null,null)},matchAtruleDescriptor:function(e,t,r){var n=this.checkAtruleDescriptorName(e,t);if(n)return nZ(null,n);var a=this.getAtrule(e),i=nF.keyword(t);return n5(this,a.descriptors[i.name]||a.descriptors[i.basename],r,!1)},matchDeclaration:function(e){return"Declaration"!==e.type?nZ(null,Error("Not a Declaration node")):this.matchProperty(e.property,e.value)},matchProperty:function(e,t){var r=this.checkPropertyName(e);return r?nZ(null,r):n5(this,this.getProperty(e),t,!0)},matchType:function(e,t){var r=this.getType(e);return r?n5(this,r,t,!1):nZ(null,new n0("Unknown type",e))},match:function(e,t){return"string"==typeof e||e&&e.type?("string"!=typeof e&&e.match||(e=this.createDescriptor(e,"Type","anonymous")),n5(this,e,t,!1)):nZ(null,new n0("Bad syntax"))},findValueFragments:function(e,t,r,n){return n7.matchFragments(this,t,this.matchProperty(e,t),r,n)},findDeclarationValueFragments:function(e,t,r){return n7.matchFragments(this,e.value,this.matchDeclaration(e),t,r)},findAllFragments:function(e,t,r){var n=[];return this.syntax.walk(e,{visit:"Declaration",enter:(function(e){n.push.apply(n,this.findDeclarationValueFragments(e,t,r))}).bind(this)}),n},getAtrule:function(e,t=!0){var r=nF.keyword(e);return(r.vendor&&t?this.atrules[r.name]||this.atrules[r.basename]:this.atrules[r.name])||null},getAtrulePrelude:function(e,t=!0){let r=this.getAtrule(e,t);return r&&r.prelude||null},getAtruleDescriptor:function(e,t){return this.atrules.hasOwnProperty(e)&&this.atrules.declarators&&this.atrules[e].declarators[t]||null},getProperty:function(e,t=!0){var r=nF.property(e);return(r.vendor&&t?this.properties[r.name]||this.properties[r.basename]:this.properties[r.name])||null},getType:function(e){return this.types.hasOwnProperty(e)?this.types[e]:null},validate:function(){function e(n,a,i,o){if(i.hasOwnProperty(a))return i[a];i[a]=!1,null!==o.syntax&&n2(o.syntax,function(o){if("Type"===o.type||"Property"===o.type){var s="Type"===o.type?n.types:n.properties,l="Type"===o.type?t:r;(!s.hasOwnProperty(o.name)||e(n,o.name,l,s[o.name]))&&(i[a]=!0)}},this)}var t={},r={};for(var n in this.types)e(this,n,t,this.types[n]);for(var n in this.properties)e(this,n,r,this.properties[n]);return(t=Object.keys(t).filter(function(e){return t[e]}),r=Object.keys(r).filter(function(e){return r[e]}),t.length||r.length)?{types:t,properties:r}:null},dump:function(e,t){return{generic:this.generic,types:nK(this.types,!t,e),properties:nK(this.properties,!t,e),atrules:function e(t,r,n){let a={};for(let[i,o]of Object.entries(t))a[i]={prelude:o.prelude&&(n?o.prelude.syntax:nV(o.prelude.syntax,{compact:r})),descriptors:o.descriptors&&nK(o.descriptors,r,n)};return a}(this.atrules,!t,e)}},toString:function(){return JSON.stringify(this.dump())}};var nJ=tV,nX=ro.isBOM,ae=function(){this.lines=null,this.columns=null,this.linesAndColumnsComputed=!1};ae.prototype={setSource:function(e,t,r,n){this.source=e,this.startOffset=void 0===t?0:t,this.startLine=void 0===r?1:r,this.startColumn=void 0===n?1:n,this.linesAndColumnsComputed=!1},ensureLinesAndColumnsComputed:function(){this.linesAndColumnsComputed||(!function e(t,r){for(var n=r.length,a=nJ(t.lines,n),i=t.startLine,o=nJ(t.columns,n),s=t.startColumn,l=r.length>0?nX(r.charCodeAt(0)):0,d=l;d",needPositions:!1,onParseError:am,onParseErrorThrow:!1,parseAtrulePrelude:!0,parseRulePrelude:!0,parseValue:!0,parseCustomProperty:!1,readSequence:au,createList:function(){return new as},createSingleNodeList:function(e){return new as().appendData(e)},getFirstListNode:function(e){return e&&e.first()},getLastListNode:function(e){return e.last()},parseWithFallback:function(e,t){var r=this.scanner.tokenIndex;try{return e.call(this)}catch(n){if(this.onParseErrorThrow)throw n;var a=t.call(this,r);return this.onParseErrorThrow=!0,this.onParseError(n,a),this.onParseErrorThrow=!1,a}},lookupNonWSType:function(e){do{var t=this.scanner.lookupType(e++);if(t!==af)return t}while(0!==t);return 0},eat:function(e){if(this.scanner.tokenType!==e){var t=this.scanner.tokenStart,r=ag[e]+" is expected";switch(e){case ab:this.scanner.tokenType===aS||this.scanner.tokenType===av?(t=this.scanner.tokenEnd-1,r="Identifier is expected but function found"):r="Identifier is expected";break;case ax:this.scanner.isDelim(35)&&(this.scanner.next(),t++,r="Name is expected");break;case ak:this.scanner.tokenType===a$&&(t=this.scanner.tokenEnd,r="Percent sign is expected");break;default:this.scanner.source.charCodeAt(this.scanner.tokenStart)===e&&(t+=1)}this.error(r,t)}this.scanner.next()},consume:function(e){var t=this.scanner.getTokenValue();return this.eat(e),t},consumeFunctionName:function(){var e=this.scanner.source.substring(this.scanner.tokenStart,this.scanner.tokenEnd-1);return this.eat(aS),e},getLocation:function(e,t){return this.needPositions?this.locationMap.getLocationRange(e,t,this.filename):null},getLocationFromList:function(e){if(this.needPositions){var t=this.getFirstListNode(e),r=this.getLastListNode(e);return this.locationMap.getLocationRange(null!==t?t.loc.start.offset-this.locationMap.startOffset:this.scanner.tokenStart,null!==r?r.loc.end.offset-this.locationMap.startOffset:this.scanner.tokenStart,this.filename)}return null},error:function(e,t){var r=void 0!==t&&t",r.needPositions=Boolean(t.positions),r.onParseError="function"==typeof t.onParseError?t.onParseError:am,r.onParseErrorThrow=!1,r.parseAtrulePrelude=!("parseAtrulePrelude"in t)||Boolean(t.parseAtrulePrelude),r.parseRulePrelude=!("parseRulePrelude"in t)||Boolean(t.parseRulePrelude),r.parseValue=!("parseValue"in t)||Boolean(t.parseValue),r.parseCustomProperty="parseCustomProperty"in t&&Boolean(t.parseCustomProperty),!r.context.hasOwnProperty(a))throw Error("Unknown context `"+a+"`");return"function"==typeof i&&r.scanner.forEachToken((t,n,a)=>{if(t===ay){let o=r.getLocation(n,a),s=ac(e,a-2,a,"*/")?e.slice(n+2,a-2):e.slice(n+2,a);i(s,o)}}),n=r.context[a].call(r,t),r.scanner.eof||r.error(),n}},aT={},a_={},a8={},az="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");a8.encode=function(e){if(0<=e&&e>>=5)>0&&(r|=32),a+=aA.encode(r);while(i>0);return a},a_.decode=function e(t,r,n){var a,i,o,s,l=t.length,d=0,p=0;do{if(r>=l)throw Error("Expected more digits in base 64 VLQ value.");if(-1===(s=aA.decode(t.charCodeAt(r++))))throw Error("Invalid base64 digit: "+t.charAt(r-1));o=!!(32&s),s&=aE,d+=s<>1,(1&a)==1?-i:i),n.rest=r};var aO={};!function(e){e.getArg=function e(t,r,n){if(r in t)return t[r];if(3===arguments.length)return n;throw Error('"'+r+'" is a required argument.')};var t=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/,r=/^data:.+\,.+$/;function n(e){var r=e.match(t);return r?{scheme:r[1],auth:r[2],host:r[3],port:r[4],path:r[5]}:null}function a(e){var t="";return e.scheme&&(t+=e.scheme+":"),t+="//",e.auth&&(t+=e.auth+"@"),e.host&&(t+=e.host),e.port&&(t+=":"+e.port),e.path&&(t+=e.path),t}function i(t){var r=t,i=n(t);if(i){if(!i.path)return t;r=i.path}for(var o,s=e.isAbsolute(r),l=r.split(/\/+/),d=0,p=l.length-1;p>=0;p--)"."===(o=l[p])?l.splice(p,1):".."===o?d++:d>0&&(""===o?(l.splice(p+1,d),d=0):(l.splice(p,2),d--));return(""===(r=l.join("/"))&&(r=s?"/":"."),i)?(i.path=r,a(i)):r}function o(e,t){""===e&&(e="."),""===t&&(t=".");var o=n(t),s=n(e);if(s&&(e=s.path||"/"),o&&!o.scheme)return s&&(o.scheme=s.scheme),a(o);if(o||t.match(r))return t;if(s&&!s.host&&!s.path)return s.host=t,a(s);var l="/"===t.charAt(0)?t:i(e.replace(/\/+$/,"")+"/"+t);return s?(s.path=l,a(s)):l}e.urlParse=n,e.urlGenerate=a,e.normalize=i,e.join=o,e.isAbsolute=function(e){return"/"===e.charAt(0)||t.test(e)},e.relative=function e(t,r){""===t&&(t="."),t=t.replace(/\/$/,"");for(var n=0;0!==r.indexOf(t+"/");){var a=t.lastIndexOf("/");if(a<0||(t=t.slice(0,a)).match(/^([^\/]+:\/)?\/*$/))return r;++n}return Array(n+1).join("../")+r.substr(t.length+1)};var s=!("__proto__"in Object.create(null));function l(e){return e}function d(e){if(!e)return!1;var t=e.length;if(t<9||95!==e.charCodeAt(t-1)||95!==e.charCodeAt(t-2)||111!==e.charCodeAt(t-3)||116!==e.charCodeAt(t-4)||111!==e.charCodeAt(t-5)||114!==e.charCodeAt(t-6)||112!==e.charCodeAt(t-7)||95!==e.charCodeAt(t-8)||95!==e.charCodeAt(t-9))return!1;for(var r=t-10;r>=0;r--)if(36!==e.charCodeAt(r))return!1;return!0}function p(e,t){return e===t?0:null===e?1:null===t?-1:e>t?1:-1}e.toSetString=s?l:function e(t){return d(t)?"$"+t:t},e.fromSetString=s?l:function e(t){return d(t)?t.slice(1):t},e.compareByOriginalPositions=function e(t,r,n){var a=p(t.source,r.source);return 0!==a||0!=(a=t.originalLine-r.originalLine)||0!=(a=t.originalColumn-r.originalColumn)||n||0!=(a=t.generatedColumn-r.generatedColumn)||0!=(a=t.generatedLine-r.generatedLine)?a:p(t.name,r.name)},e.compareByGeneratedPositionsDeflated=function e(t,r,n){var a=t.generatedLine-r.generatedLine;return 0!==a||0!=(a=t.generatedColumn-r.generatedColumn)||n||0!==(a=p(t.source,r.source))||0!=(a=t.originalLine-r.originalLine)||0!=(a=t.originalColumn-r.originalColumn)?a:p(t.name,r.name)},e.compareByGeneratedPositionsInflated=function e(t,r){var n=t.generatedLine-r.generatedLine;return 0!==n||0!=(n=t.generatedColumn-r.generatedColumn)||0!==(n=p(t.source,r.source))||0!=(n=t.originalLine-r.originalLine)||0!=(n=t.originalColumn-r.originalColumn)?n:p(t.name,r.name)},e.parseSourceMapInput=function e(t){return JSON.parse(t.replace(/^\)]}'[^\n]*\n/,""))},e.computeSourceURL=function e(t,r,s){if(r=r||"",t&&("/"!==t[t.length-1]&&"/"!==r[0]&&(t+="/"),r=t+r),s){var l=n(s);if(!l)throw Error("sourceMapURL could not be parsed");if(l.path){var d=l.path.lastIndexOf("/");d>=0&&(l.path=l.path.substring(0,d+1))}r=o(a(l),r)}return i(r)}}(aO);var aj={},aW=aO,aL=Object.prototype.hasOwnProperty,aB="undefined"!=typeof Map;function aP(){this._array=[],this._set=aB?new Map:Object.create(null)}aP.fromArray=function e(t,r){for(var n=new aP,a=0,i=t.length;a=0)return r}else{var n=aW.toSetString(t);if(aL.call(this._set,n))return this._set[n]}throw Error('"'+t+'" is not in the set.')},aP.prototype.at=function e(t){if(t>=0&&ta||i==a&&s>=o||0>=aq.compareByGeneratedPositionsInflated(r,n))?(this._last=t,this._array.push(t)):(this._sorted=!1,this._array.push(t))},aM.prototype.toArray=function e(){return this._sorted||(this._array.sort(aq.compareByGeneratedPositionsInflated),this._sorted=!0),this._array},aD.MappingList=aM;var aI=a_,aR=aO,a0=aj.ArraySet,aN=aD.MappingList;function aF(e){e||(e={}),this._file=aR.getArg(e,"file",null),this._sourceRoot=aR.getArg(e,"sourceRoot",null),this._skipValidation=aR.getArg(e,"skipValidation",!1),this._sources=new a0,this._names=new a0,this._mappings=new aN,this._sourcesContents=null}aF.prototype._version=3,aF.fromSourceMap=function e(t){var r=t.sourceRoot,n=new aF({file:t.file,sourceRoot:r});return t.eachMapping(function(e){var t={generated:{line:e.generatedLine,column:e.generatedColumn}};null!=e.source&&(t.source=e.source,null!=r&&(t.source=aR.relative(r,t.source)),t.original={line:e.originalLine,column:e.originalColumn},null!=e.name&&(t.name=e.name)),n.addMapping(t)}),t.sources.forEach(function(e){var a=e;null!==r&&(a=aR.relative(r,e)),n._sources.has(a)||n._sources.add(a);var i=t.sourceContentFor(e);null!=i&&n.setSourceContent(e,i)}),n},aF.prototype.addMapping=function e(t){var r=aR.getArg(t,"generated"),n=aR.getArg(t,"original",null),a=aR.getArg(t,"source",null),i=aR.getArg(t,"name",null);this._skipValidation||this._validateMapping(r,n,a,i),null==a||(a=String(a),this._sources.has(a)||this._sources.add(a)),null==i||(i=String(i),this._names.has(i)||this._names.add(i)),this._mappings.add({generatedLine:r.line,generatedColumn:r.column,originalLine:null!=n&&n.line,originalColumn:null!=n&&n.column,source:a,name:i})},aF.prototype.setSourceContent=function e(t,r){var n=t;null!=this._sourceRoot&&(n=aR.relative(this._sourceRoot,n)),null!=r?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[aR.toSetString(n)]=r):this._sourcesContents&&(delete this._sourcesContents[aR.toSetString(n)],0===Object.keys(this._sourcesContents).length&&(this._sourcesContents=null))},aF.prototype.applySourceMap=function e(t,r,n){var a=r;if(null==r){if(null==t.file)throw Error('SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map\'s "file" property. Both were omitted.');a=t.file}var i=this._sourceRoot;null!=i&&(a=aR.relative(i,a));var o=new a0,s=new a0;this._mappings.unsortedForEach(function(e){if(e.source===a&&null!=e.originalLine){var r=t.originalPositionFor({line:e.originalLine,column:e.originalColumn});null!=r.source&&(e.source=r.source,null!=n&&(e.source=aR.join(n,e.source)),null!=i&&(e.source=aR.relative(i,e.source)),e.originalLine=r.line,e.originalColumn=r.column,null!=r.name&&(e.name=r.name))}var l=e.source;null==l||o.has(l)||o.add(l);var d=e.name;null==d||s.has(d)||s.add(d)},this),this._sources=o,this._names=s,t.sources.forEach(function(e){var r=t.sourceContentFor(e);null!=r&&(null!=n&&(e=aR.join(n,e)),null!=i&&(e=aR.relative(i,e)),this.setSourceContent(e,r))},this)},aF.prototype._validateMapping=function e(t,r,n,a){if(r&&"number"!=typeof r.line&&"number"!=typeof r.column)throw Error("original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.");if(!t||!("line"in t)||!("column"in t)||!(t.line>0)||!(t.column>=0)||r||n||a){if(!t||!("line"in t)||!("column"in t)||!r||!("line"in r)||!("column"in r)||!(t.line>0)||!(t.column>=0)||!(r.line>0)||!(r.column>=0)||!n)throw Error("Invalid mapping: "+JSON.stringify({generated:t,source:n,original:r,name:a}))}},aF.prototype._serializeMappings=function e(){for(var t,r,n,a,i=0,o=1,s=0,l=0,d=0,p=0,c="",u=this._mappings.toArray(),m=0,h=u.length;m0){if(!aR.compareByGeneratedPositionsInflated(r,u[m-1]))continue;t+=","}t+=aI.encode(r.generatedColumn-i),i=r.generatedColumn,null!=r.source&&(a=this._sources.indexOf(r.source),t+=aI.encode(a-p),p=a,t+=aI.encode(r.originalLine-1-l),l=r.originalLine-1,t+=aI.encode(r.originalColumn-s),s=r.originalColumn,null!=r.name&&(n=this._names.indexOf(r.name),t+=aI.encode(n-d),d=n)),c+=t}return c},aF.prototype._generateSourcesContent=function e(t,r){return t.map(function(e){if(!this._sourcesContents)return null;null!=r&&(e=aR.relative(r,e));var t=aR.toSetString(e);return Object.prototype.hasOwnProperty.call(this._sourcesContents,t)?this._sourcesContents[t]:null},this)},aF.prototype.toJSON=function e(){var t={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return null!=this._file&&(t.file=this._file),null!=this._sourceRoot&&(t.sourceRoot=this._sourceRoot),this._sourcesContents&&(t.sourcesContent=this._generateSourcesContent(t.sources,t.sourceRoot)),t},aF.prototype.toString=function e(){return JSON.stringify(this.toJSON())},aT.SourceMapGenerator=aF;var a1=aT.SourceMapGenerator,aG={Atrule:!0,Selector:!0,Declaration:!0},aV=function e(t){var r=new a1,n=1,a=0,i={line:1,column:0},o={line:0,column:0},s=!1,l={line:1,column:0},d={generated:l},p=t.node;t.node=function(e){if(e.loc&&e.loc.start&&aG.hasOwnProperty(e.type)){var t=e.loc.start.line,c=e.loc.start.column-1;(o.line!==t||o.column!==c)&&(o.line=t,o.column=c,i.line=n,i.column=a,s&&(s=!1,(i.line!==l.line||i.column!==l.column)&&r.addMapping(d)),s=!0,r.addMapping({source:e.loc.source,original:o,generated:i}))}p.call(this,e),s&&aG.hasOwnProperty(e.type)&&(l.line=n,l.column=a)};var c=t.chunk;t.chunk=function(e){for(var t=0;te||s(t,r,n),c=a4,u=a4,m=n,h={break:i,skip:o,root:e,stylesheet:null,atrule:null,atrulePrelude:null,rule:null,selector:null,block:null,declaration:null,function:null};if("function"==typeof t)c=t;else if(t&&(c=aY(t.enter),u=aY(t.leave),t.reverse&&(m=a),t.visit)){if(l.hasOwnProperty(t.visit))m=t.reverse?d[t.visit]:l[t.visit];else if(!r.hasOwnProperty(t.visit))throw Error("Bad value `"+t.visit+"` for `visit` option (should be: "+Object.keys(r).join(", ")+")");c=a6(c,t.visit),u=a6(u,t.visit)}if(c===a4&&u===a4)throw Error("Neither `enter` nor `leave` walker handler is set or both aren't a function");s(e)};return p.break=i,p.skip=o,p.find=function(e,t){var r=null;return p(e,function(e,n,a){if(t.call(this,e,n,a))return r=e,i}),r},p.findLast=function(e,t){var r=null;return p(e,{reverse:!0,enter:function(e,n,a){if(t.call(this,e,n,a))return r=e,i}}),r},p.findAll=function(e,t){var r=[];return p(e,function(e,n,a){t.call(this,e,n,a)&&r.push(e)}),r},p},aJ=eU,aX=function e(t){var r={};for(var n in t){var a=t[n];a&&(Array.isArray(a)||a instanceof aJ?a=a.map(e):a.constructor===Object&&(a=e(a))),r[n]=a}return r};let ie=Object.prototype.hasOwnProperty,it={generic:!0,types:io,atrules:{prelude:is,descriptors:is},properties:io,parseContext:function e(t,r){return Object.assign(t,r)},scope:function e(t,r){for(let n in r)ie.call(r,n)&&(ir(t[n])?e(t[n],ia(r[n])):t[n]=ia(r[n]));return t},atrule:["parse"],pseudo:["parse"],node:["name","structure","parse","generate","walkContext"]};function ir(e){return e&&e.constructor===Object}function ia(e){return ir(e)?Object.assign({},e):e}function ii(e,t){return"string"==typeof t&&/^\s*\|/.test(t)?"string"==typeof e?e+t:t.replace(/^\s*\|\s*/,""):t||null}function io(e,t){if("string"==typeof t)return ii(e,t);let r=Object.assign({},e);for(let n in t)ie.call(t,n)&&(r[n]=ii(ie.call(e,n)?e[n]:void 0,t[n]));return r}function is(e,t){let r=io(e,t);return!ir(r)||Object.keys(r).length?r:null}var il=eU,id=e4,ip=tA,ic=nQ,iu={SyntaxError:r4,parse:no,generate:tO,walk:nd},im=ro,ih=aw,ig=aH,iy=a9,ib=aQ,iS=aX,iv=t1,ix=(e,t)=>(function e(t,r,n){for(let a in n)if(!1!==ie.call(n,a)){if(!0===n[a])a in r&&ie.call(r,a)&&(t[a]=ia(r[a]));else if(n[a]){if("function"==typeof n[a]){let i=n[a];t[a]=i({},t[a]),t[a]=i(t[a]||{},r[a])}else if(ir(n[a])){let o={};for(let s in t[a])o[s]=e({},t[a][s],n[a]);for(let l in r[a])o[l]=e(o[l]||{},r[a][l],n[a]);t[a]=o}else if(Array.isArray(n[a])){let d={},p=n[a].reduce(function(e,t){return e[t]=!0,e},{});for(let[c,u]of Object.entries(t[a]||{}))d[c]={},u&&e(d[c],u,p);for(let m in r[a])ie.call(r[a],m)&&(d[m]||(d[m]={}),r[a]&&r[a][m]&&e(d[m],r[a][m],p));t[a]=d}}}return t})(e,t,it);eN.create=function(e){return function e(t){var r=ih(t),n=ib(t),a=ig(t),i=iy(n),o={List:il,SyntaxError:id,TokenStream:ip,Lexer:ic,vendorPrefix:iv.vendorPrefix,keyword:iv.keyword,property:iv.property,isCustomProperty:iv.isCustomProperty,definitionSyntax:iu,lexer:null,createLexer:function(e){return new ic(e,o,o.lexer.structure)},tokenize:im,parse:r,walk:n,generate:a,find:n.find,findLast:n.findLast,findAll:n.findAll,clone:iS,fromPlainObject:i.fromPlainObject,toPlainObject:i.toPlainObject,createSyntax:function(t){return e(ix({},t))},fork:function(r){var n=ix({},t);return e("function"==typeof r?r(n,Object.assign):ix(n,r))}};return o.lexer=new ic({generic:!0,types:t.types,atrules:t.atrules,properties:t.properties,node:t.node},o),o}(ix({},e))};let ik={atrules:{charset:{prelude:""},"font-face":{descriptors:{"unicode-range":{comment:"replaces , an old production name",syntax:"#"}}}},properties:{"-moz-background-clip":{comment:"deprecated syntax in old Firefox, https://developer.mozilla.org/en/docs/Web/CSS/background-clip",syntax:"padding | border"},"-moz-border-radius-bottomleft":{comment:"https://developer.mozilla.org/en-US/docs/Web/CSS/border-bottom-left-radius",syntax:"<'border-bottom-left-radius'>"},"-moz-border-radius-bottomright":{comment:"https://developer.mozilla.org/en-US/docs/Web/CSS/border-bottom-right-radius",syntax:"<'border-bottom-right-radius'>"},"-moz-border-radius-topleft":{comment:"https://developer.mozilla.org/en-US/docs/Web/CSS/border-top-left-radius",syntax:"<'border-top-left-radius'>"},"-moz-border-radius-topright":{comment:"https://developer.mozilla.org/en-US/docs/Web/CSS/border-bottom-right-radius",syntax:"<'border-bottom-right-radius'>"},"-moz-control-character-visibility":{comment:"firefox specific keywords, https://bugzilla.mozilla.org/show_bug.cgi?id=947588",syntax:"visible | hidden"},"-moz-osx-font-smoothing":{comment:"misssed old syntax https://developer.mozilla.org/en-US/docs/Web/CSS/font-smooth",syntax:"auto | grayscale"},"-moz-user-select":{comment:"https://developer.mozilla.org/en-US/docs/Web/CSS/user-select",syntax:"none | text | all | -moz-none"},"-ms-flex-align":{comment:"misssed old syntax implemented in IE, https://www.w3.org/TR/2012/WD-css3-flexbox-20120322/#flex-align",syntax:"start | end | center | baseline | stretch"},"-ms-flex-item-align":{comment:"misssed old syntax implemented in IE, https://www.w3.org/TR/2012/WD-css3-flexbox-20120322/#flex-align",syntax:"auto | start | end | center | baseline | stretch"},"-ms-flex-line-pack":{comment:"misssed old syntax implemented in IE, https://www.w3.org/TR/2012/WD-css3-flexbox-20120322/#flex-line-pack",syntax:"start | end | center | justify | distribute | stretch"},"-ms-flex-negative":{comment:"misssed old syntax implemented in IE; TODO: find references for comfirmation",syntax:"<'flex-shrink'>"},"-ms-flex-pack":{comment:"misssed old syntax implemented in IE, https://www.w3.org/TR/2012/WD-css3-flexbox-20120322/#flex-pack",syntax:"start | end | center | justify | distribute"},"-ms-flex-order":{comment:"misssed old syntax implemented in IE; https://msdn.microsoft.com/en-us/library/jj127303(v=vs.85).aspx",syntax:""},"-ms-flex-positive":{comment:"misssed old syntax implemented in IE; TODO: find references for comfirmation",syntax:"<'flex-grow'>"},"-ms-flex-preferred-size":{comment:"misssed old syntax implemented in IE; TODO: find references for comfirmation",syntax:"<'flex-basis'>"},"-ms-interpolation-mode":{comment:"https://msdn.microsoft.com/en-us/library/ff521095(v=vs.85).aspx",syntax:"nearest-neighbor | bicubic"},"-ms-grid-column-align":{comment:"add this property first since it uses as fallback for flexbox, https://msdn.microsoft.com/en-us/library/windows/apps/hh466338.aspx",syntax:"start | end | center | stretch"},"-ms-grid-row-align":{comment:"add this property first since it uses as fallback for flexbox, https://msdn.microsoft.com/en-us/library/windows/apps/hh466348.aspx",syntax:"start | end | center | stretch"},"-ms-hyphenate-limit-last":{comment:"misssed old syntax implemented in IE; https://www.w3.org/TR/css-text-4/#hyphenate-line-limits",syntax:"none | always | column | page | spread"},"-webkit-appearance":{comment:"webkit specific keywords",references:["http://css-infos.net/property/-webkit-appearance"],syntax:"none | button | button-bevel | caps-lock-indicator | caret | checkbox | default-button | inner-spin-button | listbox | listitem | media-controls-background | media-controls-fullscreen-background | media-current-time-display | media-enter-fullscreen-button | media-exit-fullscreen-button | media-fullscreen-button | media-mute-button | media-overlay-play-button | media-play-button | media-seek-back-button | media-seek-forward-button | media-slider | media-sliderthumb | media-time-remaining-display | media-toggle-closed-captions-button | media-volume-slider | media-volume-slider-container | media-volume-sliderthumb | menulist | menulist-button | menulist-text | menulist-textfield | meter | progress-bar | progress-bar-value | push-button | radio | scrollbarbutton-down | scrollbarbutton-left | scrollbarbutton-right | scrollbarbutton-up | scrollbargripper-horizontal | scrollbargripper-vertical | scrollbarthumb-horizontal | scrollbarthumb-vertical | scrollbartrack-horizontal | scrollbartrack-vertical | searchfield | searchfield-cancel-button | searchfield-decoration | searchfield-results-button | searchfield-results-decoration | slider-horizontal | slider-vertical | sliderthumb-horizontal | sliderthumb-vertical | square-button | textarea | textfield | -apple-pay-button"},"-webkit-background-clip":{comment:"https://developer.mozilla.org/en/docs/Web/CSS/background-clip",syntax:"[ | border | padding | content | text ]#"},"-webkit-column-break-after":{comment:"added, http://help.dottoro.com/lcrthhhv.php",syntax:"always | auto | avoid"},"-webkit-column-break-before":{comment:"added, http://help.dottoro.com/lcxquvkf.php",syntax:"always | auto | avoid"},"-webkit-column-break-inside":{comment:"added, http://help.dottoro.com/lclhnthl.php",syntax:"always | auto | avoid"},"-webkit-font-smoothing":{comment:"https://developer.mozilla.org/en-US/docs/Web/CSS/font-smooth",syntax:"auto | none | antialiased | subpixel-antialiased"},"-webkit-mask-box-image":{comment:"missed; https://developer.mozilla.org/en-US/docs/Web/CSS/-webkit-mask-box-image",syntax:"[ | | none ] [ {4} <-webkit-mask-box-repeat>{2} ]?"},"-webkit-print-color-adjust":{comment:"missed",references:["https://developer.mozilla.org/en/docs/Web/CSS/-webkit-print-color-adjust"],syntax:"economy | exact"},"-webkit-text-security":{comment:"missed; http://help.dottoro.com/lcbkewgt.php",syntax:"none | circle | disc | square"},"-webkit-user-drag":{comment:"missed; http://help.dottoro.com/lcbixvwm.php",syntax:"none | element | auto"},"-webkit-user-select":{comment:"auto is supported by old webkit, https://developer.mozilla.org/en-US/docs/Web/CSS/user-select",syntax:"auto | none | text | all"},"alignment-baseline":{comment:"added SVG property",references:["https://www.w3.org/TR/SVG/text.html#AlignmentBaselineProperty"],syntax:"auto | baseline | before-edge | text-before-edge | middle | central | after-edge | text-after-edge | ideographic | alphabetic | hanging | mathematical"},"baseline-shift":{comment:"added SVG property",references:["https://www.w3.org/TR/SVG/text.html#BaselineShiftProperty"],syntax:"baseline | sub | super | "},behavior:{comment:"added old IE property https://msdn.microsoft.com/en-us/library/ms530723(v=vs.85).aspx",syntax:"+"},"clip-rule":{comment:"added SVG property",references:["https://www.w3.org/TR/SVG/masking.html#ClipRuleProperty"],syntax:"nonzero | evenodd"},cue:{comment:"https://www.w3.org/TR/css3-speech/#property-index",syntax:"<'cue-before'> <'cue-after'>?"},"cue-after":{comment:"https://www.w3.org/TR/css3-speech/#property-index",syntax:" ? | none"},"cue-before":{comment:"https://www.w3.org/TR/css3-speech/#property-index",syntax:" ? | none"},cursor:{comment:"added legacy keywords: hand, -webkit-grab. -webkit-grabbing, -webkit-zoom-in, -webkit-zoom-out, -moz-grab, -moz-grabbing, -moz-zoom-in, -moz-zoom-out",references:["https://www.sitepoint.com/css3-cursor-styles/"],syntax:"[ [ [ ]? , ]* [ auto | default | none | context-menu | help | pointer | progress | wait | cell | crosshair | text | vertical-text | alias | copy | move | no-drop | not-allowed | e-resize | n-resize | ne-resize | nw-resize | s-resize | se-resize | sw-resize | w-resize | ew-resize | ns-resize | nesw-resize | nwse-resize | col-resize | row-resize | all-scroll | zoom-in | zoom-out | grab | grabbing | hand | -webkit-grab | -webkit-grabbing | -webkit-zoom-in | -webkit-zoom-out | -moz-grab | -moz-grabbing | -moz-zoom-in | -moz-zoom-out ] ]"},display:{comment:"extended with -ms-flexbox",syntax:"| <-non-standard-display>"},position:{comment:"extended with -webkit-sticky",syntax:"| -webkit-sticky"},"dominant-baseline":{comment:"added SVG property",references:["https://www.w3.org/TR/SVG/text.html#DominantBaselineProperty"],syntax:"auto | use-script | no-change | reset-size | ideographic | alphabetic | hanging | mathematical | central | middle | text-after-edge | text-before-edge"},"image-rendering":{comment:"extended with <-non-standard-image-rendering>, added SVG keywords optimizeSpeed and optimizeQuality",references:["https://developer.mozilla.org/en/docs/Web/CSS/image-rendering","https://www.w3.org/TR/SVG/painting.html#ImageRenderingProperty"],syntax:"| optimizeSpeed | optimizeQuality | <-non-standard-image-rendering>"},fill:{comment:"added SVG property",references:["https://www.w3.org/TR/SVG/painting.html#FillProperty"],syntax:""},"fill-opacity":{comment:"added SVG property",references:["https://www.w3.org/TR/SVG/painting.html#FillProperty"],syntax:""},"fill-rule":{comment:"added SVG property",references:["https://www.w3.org/TR/SVG/painting.html#FillProperty"],syntax:"nonzero | evenodd"},filter:{comment:"extend with IE legacy syntaxes",syntax:"| <-ms-filter-function-list>"},"glyph-orientation-horizontal":{comment:"added SVG property",references:["https://www.w3.org/TR/SVG/text.html#GlyphOrientationHorizontalProperty"],syntax:""},"glyph-orientation-vertical":{comment:"added SVG property",references:["https://www.w3.org/TR/SVG/text.html#GlyphOrientationVerticalProperty"],syntax:""},kerning:{comment:"added SVG property",references:["https://www.w3.org/TR/SVG/text.html#KerningProperty"],syntax:"auto | "},"letter-spacing":{comment:"fix syntax -> ",references:["https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/letter-spacing"],syntax:"normal | "},marker:{comment:"added SVG property",references:["https://www.w3.org/TR/SVG/painting.html#MarkerProperties"],syntax:"none | "},"marker-end":{comment:"added SVG property",references:["https://www.w3.org/TR/SVG/painting.html#MarkerProperties"],syntax:"none | "},"marker-mid":{comment:"added SVG property",references:["https://www.w3.org/TR/SVG/painting.html#MarkerProperties"],syntax:"none | "},"marker-start":{comment:"added SVG property",references:["https://www.w3.org/TR/SVG/painting.html#MarkerProperties"],syntax:"none | "},"max-width":{comment:"fix auto -> none (https://github.com/mdn/data/pull/431); extend by non-standard width keywords https://developer.mozilla.org/en-US/docs/Web/CSS/max-width",syntax:"none | | min-content | max-content | fit-content() | <-non-standard-width>"},width:{comment:"per spec fit-content should be a function, however browsers are supporting it as a keyword (https://github.com/csstree/stylelint-validator/issues/29)",syntax:"| fit-content | -moz-fit-content | -webkit-fit-content"},"min-width":{comment:"extend by non-standard width keywords https://developer.mozilla.org/en-US/docs/Web/CSS/width",syntax:"auto | | min-content | max-content | fit-content() | <-non-standard-width>"},overflow:{comment:"extend by vendor keywords https://developer.mozilla.org/en-US/docs/Web/CSS/overflow",syntax:"| <-non-standard-overflow>"},pause:{comment:"https://www.w3.org/TR/css3-speech/#property-index",syntax:"<'pause-before'> <'pause-after'>?"},"pause-after":{comment:"https://www.w3.org/TR/css3-speech/#property-index",syntax:"