All Downloads are FREE. Search and download functionalities are using the official Maven repository.

web-interface.assets.5455bc3c74e053ffe3a7730e257d56a9.js.map Maven / Gradle / Ivy

There is a newer version: 6.1.4
Show newest version
{"version":3,"sources":["webpack://graylog-web-interface/5455bc3c74e053ffe3a7730e257d56a9.js"],"sourcesContent":["\"no use strict\";\n!(function(window) {\nif (typeof window.window != \"undefined\" && window.document)\n    return;\nif (window.require && window.define)\n    return;\n\nif (!window.console) {\n    window.console = function() {\n        var msgs = Array.prototype.slice.call(arguments, 0);\n        postMessage({type: \"log\", data: msgs});\n    };\n    window.console.error =\n    window.console.warn = \n    window.console.log =\n    window.console.trace = window.console;\n}\nwindow.window = window;\nwindow.ace = window;\n\nwindow.onerror = function(message, file, line, col, err) {\n    postMessage({type: \"error\", data: {\n        message: message,\n        data: err && err.data,\n        file: file,\n        line: line, \n        col: col,\n        stack: err && err.stack\n    }});\n};\n\nwindow.normalizeModule = function(parentId, moduleName) {\n    // normalize plugin requires\n    if (moduleName.indexOf(\"!\") !== -1) {\n        var chunks = moduleName.split(\"!\");\n        return window.normalizeModule(parentId, chunks[0]) + \"!\" + window.normalizeModule(parentId, chunks[1]);\n    }\n    // normalize relative requires\n    if (moduleName.charAt(0) == \".\") {\n        var base = parentId.split(\"/\").slice(0, -1).join(\"/\");\n        moduleName = (base ? base + \"/\" : \"\") + moduleName;\n        \n        while (moduleName.indexOf(\".\") !== -1 && previous != moduleName) {\n            var previous = moduleName;\n            moduleName = moduleName.replace(/^\\.\\//, \"\").replace(/\\/\\.\\//, \"/\").replace(/[^\\/]+\\/\\.\\.\\//, \"\");\n        }\n    }\n    \n    return moduleName;\n};\n\nwindow.require = function require(parentId, id) {\n    if (!id) {\n        id = parentId;\n        parentId = null;\n    }\n    if (!id.charAt)\n        throw new Error(\"worker.js require() accepts only (parentId, id) as arguments\");\n\n    id = window.normalizeModule(parentId, id);\n\n    var module = window.require.modules[id];\n    if (module) {\n        if (!module.initialized) {\n            module.initialized = true;\n            module.exports = module.factory().exports;\n        }\n        return module.exports;\n    }\n   \n    if (!window.require.tlns)\n        return console.log(\"unable to load \" + id);\n    \n    var path = resolveModuleId(id, window.require.tlns);\n    if (path.slice(-3) != \".js\") path += \".js\";\n    \n    window.require.id = id;\n    window.require.modules[id] = {}; // prevent infinite loop on broken modules\n    importScripts(path);\n    return window.require(parentId, id);\n};\nfunction resolveModuleId(id, paths) {\n    var testPath = id, tail = \"\";\n    while (testPath) {\n        var alias = paths[testPath];\n        if (typeof alias == \"string\") {\n            return alias + tail;\n        } else if (alias) {\n            return  alias.location.replace(/\\/*$/, \"/\") + (tail || alias.main || alias.name);\n        } else if (alias === false) {\n            return \"\";\n        }\n        var i = testPath.lastIndexOf(\"/\");\n        if (i === -1) break;\n        tail = testPath.substr(i) + tail;\n        testPath = testPath.slice(0, i);\n    }\n    return id;\n}\nwindow.require.modules = {};\nwindow.require.tlns = {};\n\nwindow.define = function(id, deps, factory) {\n    if (arguments.length == 2) {\n        factory = deps;\n        if (typeof id != \"string\") {\n            deps = id;\n            id = window.require.id;\n        }\n    } else if (arguments.length == 1) {\n        factory = id;\n        deps = [];\n        id = window.require.id;\n    }\n    \n    if (typeof factory != \"function\") {\n        window.require.modules[id] = {\n            exports: factory,\n            initialized: true\n        };\n        return;\n    }\n\n    if (!deps.length)\n        // If there is no dependencies, we inject \"require\", \"exports\" and\n        // \"module\" as dependencies, to provide CommonJS compatibility.\n        deps = [\"require\", \"exports\", \"module\"];\n\n    var req = function(childId) {\n        return window.require(id, childId);\n    };\n\n    window.require.modules[id] = {\n        exports: {},\n        factory: function() {\n            var module = this;\n            var returnExports = factory.apply(this, deps.slice(0, factory.length).map(function(dep) {\n                switch (dep) {\n                    // Because \"require\", \"exports\" and \"module\" aren't actual\n                    // dependencies, we must handle them seperately.\n                    case \"require\": return req;\n                    case \"exports\": return module.exports;\n                    case \"module\":  return module;\n                    // But for all other dependencies, we can just go ahead and\n                    // require them.\n                    default:        return req(dep);\n                }\n            }));\n            if (returnExports)\n                module.exports = returnExports;\n            return module;\n        }\n    };\n};\nwindow.define.amd = {};\nwindow.require.tlns = {};\nwindow.initBaseUrls  = function initBaseUrls(topLevelNamespaces) {\n    for (var i in topLevelNamespaces)\n        this.require.tlns[i] = topLevelNamespaces[i];\n};\n\nwindow.initSender = function initSender() {\n\n    var EventEmitter = window.require(\"ace/lib/event_emitter\").EventEmitter;\n    var oop = window.require(\"ace/lib/oop\");\n    \n    var Sender = function() {};\n    \n    (function() {\n        \n        oop.implement(this, EventEmitter);\n                \n        this.callback = function(data, callbackId) {\n            postMessage({\n                type: \"call\",\n                id: callbackId,\n                data: data\n            });\n        };\n    \n        this.emit = function(name, data) {\n            postMessage({\n                type: \"event\",\n                name: name,\n                data: data\n            });\n        };\n        \n    }).call(Sender.prototype);\n    \n    return new Sender();\n};\n\nvar main = window.main = null;\nvar sender = window.sender = null;\n\nwindow.onmessage = function(e) {\n    var msg = e.data;\n    if (msg.event && sender) {\n        sender._signal(msg.event, msg.data);\n    }\n    else if (msg.command) {\n        if (main[msg.command])\n            main[msg.command].apply(main, msg.args);\n        else if (window[msg.command])\n            window[msg.command].apply(window, msg.args);\n        else\n            throw new Error(\"Unknown command:\" + msg.command);\n    }\n    else if (msg.init) {\n        window.initBaseUrls(msg.tlns);\n        sender = window.sender = window.initSender();\n        var clazz = this.require(msg.module)[msg.classname];\n        main = window.main = new clazz(sender);\n    }\n};\n})(this);\n\nace.define(\"ace/lib/oop\",[], function(require, exports, module){\"use strict\";\nexports.inherits = function (ctor, superCtor) {\n    ctor.super_ = superCtor;\n    ctor.prototype = Object.create(superCtor.prototype, {\n        constructor: {\n            value: ctor,\n            enumerable: false,\n            writable: true,\n            configurable: true\n        }\n    });\n};\nexports.mixin = function (obj, mixin) {\n    for (var key in mixin) {\n        obj[key] = mixin[key];\n    }\n    return obj;\n};\nexports.implement = function (proto, mixin) {\n    exports.mixin(proto, mixin);\n};\n\n});\n\nace.define(\"ace/lib/deep_copy\",[], function(require, exports, module){exports.deepCopy = function deepCopy(obj) {\n    if (typeof obj !== \"object\" || !obj)\n        return obj;\n    var copy;\n    if (Array.isArray(obj)) {\n        copy = [];\n        for (var key = 0; key < obj.length; key++) {\n            copy[key] = deepCopy(obj[key]);\n        }\n        return copy;\n    }\n    if (Object.prototype.toString.call(obj) !== \"[object Object]\")\n        return obj;\n    copy = {};\n    for (var key in obj)\n        copy[key] = deepCopy(obj[key]);\n    return copy;\n};\n\n});\n\nace.define(\"ace/lib/lang\",[], function(require, exports, module){\"use strict\";\nexports.last = function (a) {\n    return a[a.length - 1];\n};\nexports.stringReverse = function (string) {\n    return string.split(\"\").reverse().join(\"\");\n};\nexports.stringRepeat = function (string, count) {\n    var result = '';\n    while (count > 0) {\n        if (count & 1)\n            result += string;\n        if (count >>= 1)\n            string += string;\n    }\n    return result;\n};\nvar trimBeginRegexp = /^\\s\\s*/;\nvar trimEndRegexp = /\\s\\s*$/;\nexports.stringTrimLeft = function (string) {\n    return string.replace(trimBeginRegexp, '');\n};\nexports.stringTrimRight = function (string) {\n    return string.replace(trimEndRegexp, '');\n};\nexports.copyObject = function (obj) {\n    var copy = {};\n    for (var key in obj) {\n        copy[key] = obj[key];\n    }\n    return copy;\n};\nexports.copyArray = function (array) {\n    var copy = [];\n    for (var i = 0, l = array.length; i < l; i++) {\n        if (array[i] && typeof array[i] == \"object\")\n            copy[i] = this.copyObject(array[i]);\n        else\n            copy[i] = array[i];\n    }\n    return copy;\n};\nexports.deepCopy = require(\"./deep_copy\").deepCopy;\nexports.arrayToMap = function (arr) {\n    var map = {};\n    for (var i = 0; i < arr.length; i++) {\n        map[arr[i]] = 1;\n    }\n    return map;\n};\nexports.createMap = function (props) {\n    var map = Object.create(null);\n    for (var i in props) {\n        map[i] = props[i];\n    }\n    return map;\n};\nexports.arrayRemove = function (array, value) {\n    for (var i = 0; i <= array.length; i++) {\n        if (value === array[i]) {\n            array.splice(i, 1);\n        }\n    }\n};\nexports.escapeRegExp = function (str) {\n    return str.replace(/([.*+?^${}()|[\\]\\/\\\\])/g, '\\\\$1');\n};\nexports.escapeHTML = function (str) {\n    return (\"\" + str).replace(/&/g, \"&\").replace(/\"/g, \""\").replace(/'/g, \"'\").replace(/= 0 && position.row < docLines.length &&\n        position.column >= 0 && position.column <= docLines[position.row].length;\n}\nfunction validateDelta(docLines, delta) {\n    if (delta.action != \"insert\" && delta.action != \"remove\")\n        throwDeltaError(delta, \"delta.action must be 'insert' or 'remove'\");\n    if (!(delta.lines instanceof Array))\n        throwDeltaError(delta, \"delta.lines must be an Array\");\n    if (!delta.start || !delta.end)\n        throwDeltaError(delta, \"delta.start/end must be an present\");\n    var start = delta.start;\n    if (!positionInDocument(docLines, delta.start))\n        throwDeltaError(delta, \"delta.start must be contained in document\");\n    var end = delta.end;\n    if (delta.action == \"remove\" && !positionInDocument(docLines, end))\n        throwDeltaError(delta, \"delta.end must contained in document for 'remove' actions\");\n    var numRangeRows = end.row - start.row;\n    var numRangeLastLineChars = (end.column - (numRangeRows == 0 ? start.column : 0));\n    if (numRangeRows != delta.lines.length - 1 || delta.lines[numRangeRows].length != numRangeLastLineChars)\n        throwDeltaError(delta, \"delta.range must match delta lines\");\n}\nexports.applyDelta = function (docLines, delta, doNotValidate) {\n    var row = delta.start.row;\n    var startColumn = delta.start.column;\n    var line = docLines[row] || \"\";\n    switch (delta.action) {\n        case \"insert\":\n            var lines = delta.lines;\n            if (lines.length === 1) {\n                docLines[row] = line.substring(0, startColumn) + delta.lines[0] + line.substring(startColumn);\n            }\n            else {\n                var args = [row, 1].concat(delta.lines);\n                docLines.splice.apply(docLines, args);\n                docLines[row] = line.substring(0, startColumn) + docLines[row];\n                docLines[row + delta.lines.length - 1] += line.substring(startColumn);\n            }\n            break;\n        case \"remove\":\n            var endColumn = delta.end.column;\n            var endRow = delta.end.row;\n            if (row === endRow) {\n                docLines[row] = line.substring(0, startColumn) + line.substring(endColumn);\n            }\n            else {\n                docLines.splice(row, endRow - row + 1, line.substring(0, startColumn) + docLines[endRow].substring(endColumn));\n            }\n            break;\n    }\n};\n\n});\n\nace.define(\"ace/lib/event_emitter\",[], function(require, exports, module){\"use strict\";\nvar EventEmitter = {};\nvar stopPropagation = function () { this.propagationStopped = true; };\nvar preventDefault = function () { this.defaultPrevented = true; };\nEventEmitter._emit =\n    EventEmitter._dispatchEvent = function (eventName, e) {\n        this._eventRegistry || (this._eventRegistry = {});\n        this._defaultHandlers || (this._defaultHandlers = {});\n        var listeners = this._eventRegistry[eventName] || [];\n        var defaultHandler = this._defaultHandlers[eventName];\n        if (!listeners.length && !defaultHandler)\n            return;\n        if (typeof e != \"object\" || !e)\n            e = {};\n        if (!e.type)\n            e.type = eventName;\n        if (!e.stopPropagation)\n            e.stopPropagation = stopPropagation;\n        if (!e.preventDefault)\n            e.preventDefault = preventDefault;\n        listeners = listeners.slice();\n        for (var i = 0; i < listeners.length; i++) {\n            listeners[i](e, this);\n            if (e.propagationStopped)\n                break;\n        }\n        if (defaultHandler && !e.defaultPrevented)\n            return defaultHandler(e, this);\n    };\nEventEmitter._signal = function (eventName, e) {\n    var listeners = (this._eventRegistry || {})[eventName];\n    if (!listeners)\n        return;\n    listeners = listeners.slice();\n    for (var i = 0; i < listeners.length; i++)\n        listeners[i](e, this);\n};\nEventEmitter.once = function (eventName, callback) {\n    var _self = this;\n    this.on(eventName, function newCallback() {\n        _self.off(eventName, newCallback);\n        callback.apply(null, arguments);\n    });\n    if (!callback) {\n        return new Promise(function (resolve) {\n            callback = resolve;\n        });\n    }\n};\nEventEmitter.setDefaultHandler = function (eventName, callback) {\n    var handlers = this._defaultHandlers;\n    if (!handlers)\n        handlers = this._defaultHandlers = { _disabled_: {} };\n    if (handlers[eventName]) {\n        var old = handlers[eventName];\n        var disabled = handlers._disabled_[eventName];\n        if (!disabled)\n            handlers._disabled_[eventName] = disabled = [];\n        disabled.push(old);\n        var i = disabled.indexOf(callback);\n        if (i != -1)\n            disabled.splice(i, 1);\n    }\n    handlers[eventName] = callback;\n};\nEventEmitter.removeDefaultHandler = function (eventName, callback) {\n    var handlers = this._defaultHandlers;\n    if (!handlers)\n        return;\n    var disabled = handlers._disabled_[eventName];\n    if (handlers[eventName] == callback) {\n        if (disabled)\n            this.setDefaultHandler(eventName, disabled.pop());\n    }\n    else if (disabled) {\n        var i = disabled.indexOf(callback);\n        if (i != -1)\n            disabled.splice(i, 1);\n    }\n};\nEventEmitter.on =\n    EventEmitter.addEventListener = function (eventName, callback, capturing) {\n        this._eventRegistry = this._eventRegistry || {};\n        var listeners = this._eventRegistry[eventName];\n        if (!listeners)\n            listeners = this._eventRegistry[eventName] = [];\n        if (listeners.indexOf(callback) == -1)\n            listeners[capturing ? \"unshift\" : \"push\"](callback);\n        return callback;\n    };\nEventEmitter.off =\n    EventEmitter.removeListener =\n        EventEmitter.removeEventListener = function (eventName, callback) {\n            this._eventRegistry = this._eventRegistry || {};\n            var listeners = this._eventRegistry[eventName];\n            if (!listeners)\n                return;\n            var index = listeners.indexOf(callback);\n            if (index !== -1)\n                listeners.splice(index, 1);\n        };\nEventEmitter.removeAllListeners = function (eventName) {\n    if (!eventName)\n        this._eventRegistry = this._defaultHandlers = undefined;\n    if (this._eventRegistry)\n        this._eventRegistry[eventName] = undefined;\n    if (this._defaultHandlers)\n        this._defaultHandlers[eventName] = undefined;\n};\nexports.EventEmitter = EventEmitter;\n\n});\n\nace.define(\"ace/range\",[], function(require, exports, module){\"use strict\";\nvar comparePoints = function (p1, p2) {\n    return p1.row - p2.row || p1.column - p2.column;\n};\nvar Range = /** @class */ (function () {\n    function Range(startRow, startColumn, endRow, endColumn) {\n        this.start = {\n            row: startRow,\n            column: startColumn\n        };\n        this.end = {\n            row: endRow,\n            column: endColumn\n        };\n    }\n    Range.prototype.isEqual = function (range) {\n        return this.start.row === range.start.row &&\n            this.end.row === range.end.row &&\n            this.start.column === range.start.column &&\n            this.end.column === range.end.column;\n    };\n    Range.prototype.toString = function () {\n        return (\"Range: [\" + this.start.row + \"/\" + this.start.column +\n            \"] -> [\" + this.end.row + \"/\" + this.end.column + \"]\");\n    };\n    Range.prototype.contains = function (row, column) {\n        return this.compare(row, column) == 0;\n    };\n    Range.prototype.compareRange = function (range) {\n        var cmp, end = range.end, start = range.start;\n        cmp = this.compare(end.row, end.column);\n        if (cmp == 1) {\n            cmp = this.compare(start.row, start.column);\n            if (cmp == 1) {\n                return 2;\n            }\n            else if (cmp == 0) {\n                return 1;\n            }\n            else {\n                return 0;\n            }\n        }\n        else if (cmp == -1) {\n            return -2;\n        }\n        else {\n            cmp = this.compare(start.row, start.column);\n            if (cmp == -1) {\n                return -1;\n            }\n            else if (cmp == 1) {\n                return 42;\n            }\n            else {\n                return 0;\n            }\n        }\n    };\n    Range.prototype.comparePoint = function (p) {\n        return this.compare(p.row, p.column);\n    };\n    Range.prototype.containsRange = function (range) {\n        return this.comparePoint(range.start) == 0 && this.comparePoint(range.end) == 0;\n    };\n    Range.prototype.intersects = function (range) {\n        var cmp = this.compareRange(range);\n        return (cmp == -1 || cmp == 0 || cmp == 1);\n    };\n    Range.prototype.isEnd = function (row, column) {\n        return this.end.row == row && this.end.column == column;\n    };\n    Range.prototype.isStart = function (row, column) {\n        return this.start.row == row && this.start.column == column;\n    };\n    Range.prototype.setStart = function (row, column) {\n        if (typeof row == \"object\") {\n            this.start.column = row.column;\n            this.start.row = row.row;\n        }\n        else {\n            this.start.row = row;\n            this.start.column = column;\n        }\n    };\n    Range.prototype.setEnd = function (row, column) {\n        if (typeof row == \"object\") {\n            this.end.column = row.column;\n            this.end.row = row.row;\n        }\n        else {\n            this.end.row = row;\n            this.end.column = column;\n        }\n    };\n    Range.prototype.inside = function (row, column) {\n        if (this.compare(row, column) == 0) {\n            if (this.isEnd(row, column) || this.isStart(row, column)) {\n                return false;\n            }\n            else {\n                return true;\n            }\n        }\n        return false;\n    };\n    Range.prototype.insideStart = function (row, column) {\n        if (this.compare(row, column) == 0) {\n            if (this.isEnd(row, column)) {\n                return false;\n            }\n            else {\n                return true;\n            }\n        }\n        return false;\n    };\n    Range.prototype.insideEnd = function (row, column) {\n        if (this.compare(row, column) == 0) {\n            if (this.isStart(row, column)) {\n                return false;\n            }\n            else {\n                return true;\n            }\n        }\n        return false;\n    };\n    Range.prototype.compare = function (row, column) {\n        if (!this.isMultiLine()) {\n            if (row === this.start.row) {\n                return column < this.start.column ? -1 : (column > this.end.column ? 1 : 0);\n            }\n        }\n        if (row < this.start.row)\n            return -1;\n        if (row > this.end.row)\n            return 1;\n        if (this.start.row === row)\n            return column >= this.start.column ? 0 : -1;\n        if (this.end.row === row)\n            return column <= this.end.column ? 0 : 1;\n        return 0;\n    };\n    Range.prototype.compareStart = function (row, column) {\n        if (this.start.row == row && this.start.column == column) {\n            return -1;\n        }\n        else {\n            return this.compare(row, column);\n        }\n    };\n    Range.prototype.compareEnd = function (row, column) {\n        if (this.end.row == row && this.end.column == column) {\n            return 1;\n        }\n        else {\n            return this.compare(row, column);\n        }\n    };\n    Range.prototype.compareInside = function (row, column) {\n        if (this.end.row == row && this.end.column == column) {\n            return 1;\n        }\n        else if (this.start.row == row && this.start.column == column) {\n            return -1;\n        }\n        else {\n            return this.compare(row, column);\n        }\n    };\n    Range.prototype.clipRows = function (firstRow, lastRow) {\n        if (this.end.row > lastRow)\n            var end = { row: lastRow + 1, column: 0 };\n        else if (this.end.row < firstRow)\n            var end = { row: firstRow, column: 0 };\n        if (this.start.row > lastRow)\n            var start = { row: lastRow + 1, column: 0 };\n        else if (this.start.row < firstRow)\n            var start = { row: firstRow, column: 0 };\n        return Range.fromPoints(start || this.start, end || this.end);\n    };\n    Range.prototype.extend = function (row, column) {\n        var cmp = this.compare(row, column);\n        if (cmp == 0)\n            return this;\n        else if (cmp == -1)\n            var start = { row: row, column: column };\n        else\n            var end = { row: row, column: column };\n        return Range.fromPoints(start || this.start, end || this.end);\n    };\n    Range.prototype.isEmpty = function () {\n        return (this.start.row === this.end.row && this.start.column === this.end.column);\n    };\n    Range.prototype.isMultiLine = function () {\n        return (this.start.row !== this.end.row);\n    };\n    Range.prototype.clone = function () {\n        return Range.fromPoints(this.start, this.end);\n    };\n    Range.prototype.collapseRows = function () {\n        if (this.end.column == 0)\n            return new Range(this.start.row, 0, Math.max(this.start.row, this.end.row - 1), 0);\n        else\n            return new Range(this.start.row, 0, this.end.row, 0);\n    };\n    Range.prototype.toScreenRange = function (session) {\n        var screenPosStart = session.documentToScreenPosition(this.start);\n        var screenPosEnd = session.documentToScreenPosition(this.end);\n        return new Range(screenPosStart.row, screenPosStart.column, screenPosEnd.row, screenPosEnd.column);\n    };\n    Range.prototype.moveBy = function (row, column) {\n        this.start.row += row;\n        this.start.column += column;\n        this.end.row += row;\n        this.end.column += column;\n    };\n    return Range;\n}());\nRange.fromPoints = function (start, end) {\n    return new Range(start.row, start.column, end.row, end.column);\n};\nRange.comparePoints = comparePoints;\nRange.comparePoints = function (p1, p2) {\n    return p1.row - p2.row || p1.column - p2.column;\n};\nexports.Range = Range;\n\n});\n\nace.define(\"ace/anchor\",[], function(require, exports, module){\"use strict\";\nvar oop = require(\"./lib/oop\");\nvar EventEmitter = require(\"./lib/event_emitter\").EventEmitter;\nvar Anchor = /** @class */ (function () {\n    function Anchor(doc, row, column) {\n        this.$onChange = this.onChange.bind(this);\n        this.attach(doc);\n        if (typeof column == \"undefined\")\n            this.setPosition(row.row, row.column);\n        else\n            this.setPosition(row, column);\n    }\n    Anchor.prototype.getPosition = function () {\n        return this.$clipPositionToDocument(this.row, this.column);\n    };\n    Anchor.prototype.getDocument = function () {\n        return this.document;\n    };\n    Anchor.prototype.onChange = function (delta) {\n        if (delta.start.row == delta.end.row && delta.start.row != this.row)\n            return;\n        if (delta.start.row > this.row)\n            return;\n        var point = $getTransformedPoint(delta, { row: this.row, column: this.column }, this.$insertRight);\n        this.setPosition(point.row, point.column, true);\n    };\n    Anchor.prototype.setPosition = function (row, column, noClip) {\n        var pos;\n        if (noClip) {\n            pos = {\n                row: row,\n                column: column\n            };\n        }\n        else {\n            pos = this.$clipPositionToDocument(row, column);\n        }\n        if (this.row == pos.row && this.column == pos.column)\n            return;\n        var old = {\n            row: this.row,\n            column: this.column\n        };\n        this.row = pos.row;\n        this.column = pos.column;\n        this._signal(\"change\", {\n            old: old,\n            value: pos\n        });\n    };\n    Anchor.prototype.detach = function () {\n        this.document.off(\"change\", this.$onChange);\n    };\n    Anchor.prototype.attach = function (doc) {\n        this.document = doc || this.document;\n        this.document.on(\"change\", this.$onChange);\n    };\n    Anchor.prototype.$clipPositionToDocument = function (row, column) {\n        var pos = {};\n        if (row >= this.document.getLength()) {\n            pos.row = Math.max(0, this.document.getLength() - 1);\n            pos.column = this.document.getLine(pos.row).length;\n        }\n        else if (row < 0) {\n            pos.row = 0;\n            pos.column = 0;\n        }\n        else {\n            pos.row = row;\n            pos.column = Math.min(this.document.getLine(pos.row).length, Math.max(0, column));\n        }\n        if (column < 0)\n            pos.column = 0;\n        return pos;\n    };\n    return Anchor;\n}());\nAnchor.prototype.$insertRight = false;\noop.implement(Anchor.prototype, EventEmitter);\nfunction $pointsInOrder(point1, point2, equalPointsInOrder) {\n    var bColIsAfter = equalPointsInOrder ? point1.column <= point2.column : point1.column < point2.column;\n    return (point1.row < point2.row) || (point1.row == point2.row && bColIsAfter);\n}\nfunction $getTransformedPoint(delta, point, moveIfEqual) {\n    var deltaIsInsert = delta.action == \"insert\";\n    var deltaRowShift = (deltaIsInsert ? 1 : -1) * (delta.end.row - delta.start.row);\n    var deltaColShift = (deltaIsInsert ? 1 : -1) * (delta.end.column - delta.start.column);\n    var deltaStart = delta.start;\n    var deltaEnd = deltaIsInsert ? deltaStart : delta.end; // Collapse insert range.\n    if ($pointsInOrder(point, deltaStart, moveIfEqual)) {\n        return {\n            row: point.row,\n            column: point.column\n        };\n    }\n    if ($pointsInOrder(deltaEnd, point, !moveIfEqual)) {\n        return {\n            row: point.row + deltaRowShift,\n            column: point.column + (point.row == deltaEnd.row ? deltaColShift : 0)\n        };\n    }\n    return {\n        row: deltaStart.row,\n        column: deltaStart.column\n    };\n}\nexports.Anchor = Anchor;\n\n});\n\nace.define(\"ace/document\",[], function(require, exports, module){\"use strict\";\nvar oop = require(\"./lib/oop\");\nvar applyDelta = require(\"./apply_delta\").applyDelta;\nvar EventEmitter = require(\"./lib/event_emitter\").EventEmitter;\nvar Range = require(\"./range\").Range;\nvar Anchor = require(\"./anchor\").Anchor;\nvar Document = /** @class */ (function () {\n    function Document(textOrLines) {\n        this.$lines = [\"\"];\n        if (textOrLines.length === 0) {\n            this.$lines = [\"\"];\n        }\n        else if (Array.isArray(textOrLines)) {\n            this.insertMergedLines({ row: 0, column: 0 }, textOrLines);\n        }\n        else {\n            this.insert({ row: 0, column: 0 }, textOrLines);\n        }\n    }\n    Document.prototype.setValue = function (text) {\n        var len = this.getLength() - 1;\n        this.remove(new Range(0, 0, len, this.getLine(len).length));\n        this.insert({ row: 0, column: 0 }, text || \"\");\n    };\n    Document.prototype.getValue = function () {\n        return this.getAllLines().join(this.getNewLineCharacter());\n    };\n    Document.prototype.createAnchor = function (row, column) {\n        return new Anchor(this, row, column);\n    };\n    Document.prototype.$detectNewLine = function (text) {\n        var match = text.match(/^.*?(\\r\\n|\\r|\\n)/m);\n        this.$autoNewLine = match ? match[1] : \"\\n\";\n        this._signal(\"changeNewLineMode\");\n    };\n    Document.prototype.getNewLineCharacter = function () {\n        switch (this.$newLineMode) {\n            case \"windows\":\n                return \"\\r\\n\";\n            case \"unix\":\n                return \"\\n\";\n            default:\n                return this.$autoNewLine || \"\\n\";\n        }\n    };\n    Document.prototype.setNewLineMode = function (newLineMode) {\n        if (this.$newLineMode === newLineMode)\n            return;\n        this.$newLineMode = newLineMode;\n        this._signal(\"changeNewLineMode\");\n    };\n    Document.prototype.getNewLineMode = function () {\n        return this.$newLineMode;\n    };\n    Document.prototype.isNewLine = function (text) {\n        return (text == \"\\r\\n\" || text == \"\\r\" || text == \"\\n\");\n    };\n    Document.prototype.getLine = function (row) {\n        return this.$lines[row] || \"\";\n    };\n    Document.prototype.getLines = function (firstRow, lastRow) {\n        return this.$lines.slice(firstRow, lastRow + 1);\n    };\n    Document.prototype.getAllLines = function () {\n        return this.getLines(0, this.getLength());\n    };\n    Document.prototype.getLength = function () {\n        return this.$lines.length;\n    };\n    Document.prototype.getTextRange = function (range) {\n        return this.getLinesForRange(range).join(this.getNewLineCharacter());\n    };\n    Document.prototype.getLinesForRange = function (range) {\n        var lines;\n        if (range.start.row === range.end.row) {\n            lines = [this.getLine(range.start.row).substring(range.start.column, range.end.column)];\n        }\n        else {\n            lines = this.getLines(range.start.row, range.end.row);\n            lines[0] = (lines[0] || \"\").substring(range.start.column);\n            var l = lines.length - 1;\n            if (range.end.row - range.start.row == l)\n                lines[l] = lines[l].substring(0, range.end.column);\n        }\n        return lines;\n    };\n    Document.prototype.insertLines = function (row, lines) {\n        console.warn(\"Use of document.insertLines is deprecated. Use the insertFullLines method instead.\");\n        return this.insertFullLines(row, lines);\n    };\n    Document.prototype.removeLines = function (firstRow, lastRow) {\n        console.warn(\"Use of document.removeLines is deprecated. Use the removeFullLines method instead.\");\n        return this.removeFullLines(firstRow, lastRow);\n    };\n    Document.prototype.insertNewLine = function (position) {\n        console.warn(\"Use of document.insertNewLine is deprecated. Use insertMergedLines(position, ['', '']) instead.\");\n        return this.insertMergedLines(position, [\"\", \"\"]);\n    };\n    Document.prototype.insert = function (position, text) {\n        if (this.getLength() <= 1)\n            this.$detectNewLine(text);\n        return this.insertMergedLines(position, this.$split(text));\n    };\n    Document.prototype.insertInLine = function (position, text) {\n        var start = this.clippedPos(position.row, position.column);\n        var end = this.pos(position.row, position.column + text.length);\n        this.applyDelta({\n            start: start,\n            end: end,\n            action: \"insert\",\n            lines: [text]\n        }, true);\n        return this.clonePos(end);\n    };\n    Document.prototype.clippedPos = function (row, column) {\n        var length = this.getLength();\n        if (row === undefined) {\n            row = length;\n        }\n        else if (row < 0) {\n            row = 0;\n        }\n        else if (row >= length) {\n            row = length - 1;\n            column = undefined;\n        }\n        var line = this.getLine(row);\n        if (column == undefined)\n            column = line.length;\n        column = Math.min(Math.max(column, 0), line.length);\n        return { row: row, column: column };\n    };\n    Document.prototype.clonePos = function (pos) {\n        return { row: pos.row, column: pos.column };\n    };\n    Document.prototype.pos = function (row, column) {\n        return { row: row, column: column };\n    };\n    Document.prototype.$clipPosition = function (position) {\n        var length = this.getLength();\n        if (position.row >= length) {\n            position.row = Math.max(0, length - 1);\n            position.column = this.getLine(length - 1).length;\n        }\n        else {\n            position.row = Math.max(0, position.row);\n            position.column = Math.min(Math.max(position.column, 0), this.getLine(position.row).length);\n        }\n        return position;\n    };\n    Document.prototype.insertFullLines = function (row, lines) {\n        row = Math.min(Math.max(row, 0), this.getLength());\n        var column = 0;\n        if (row < this.getLength()) {\n            lines = lines.concat([\"\"]);\n            column = 0;\n        }\n        else {\n            lines = [\"\"].concat(lines);\n            row--;\n            column = this.$lines[row].length;\n        }\n        this.insertMergedLines({ row: row, column: column }, lines);\n    };\n    Document.prototype.insertMergedLines = function (position, lines) {\n        var start = this.clippedPos(position.row, position.column);\n        var end = {\n            row: start.row + lines.length - 1,\n            column: (lines.length == 1 ? start.column : 0) + lines[lines.length - 1].length\n        };\n        this.applyDelta({\n            start: start,\n            end: end,\n            action: \"insert\",\n            lines: lines\n        });\n        return this.clonePos(end);\n    };\n    Document.prototype.remove = function (range) {\n        var start = this.clippedPos(range.start.row, range.start.column);\n        var end = this.clippedPos(range.end.row, range.end.column);\n        this.applyDelta({\n            start: start,\n            end: end,\n            action: \"remove\",\n            lines: this.getLinesForRange({ start: start, end: end })\n        });\n        return this.clonePos(start);\n    };\n    Document.prototype.removeInLine = function (row, startColumn, endColumn) {\n        var start = this.clippedPos(row, startColumn);\n        var end = this.clippedPos(row, endColumn);\n        this.applyDelta({\n            start: start,\n            end: end,\n            action: \"remove\",\n            lines: this.getLinesForRange({ start: start, end: end })\n        }, true);\n        return this.clonePos(start);\n    };\n    Document.prototype.removeFullLines = function (firstRow, lastRow) {\n        firstRow = Math.min(Math.max(0, firstRow), this.getLength() - 1);\n        lastRow = Math.min(Math.max(0, lastRow), this.getLength() - 1);\n        var deleteFirstNewLine = lastRow == this.getLength() - 1 && firstRow > 0;\n        var deleteLastNewLine = lastRow < this.getLength() - 1;\n        var startRow = (deleteFirstNewLine ? firstRow - 1 : firstRow);\n        var startCol = (deleteFirstNewLine ? this.getLine(startRow).length : 0);\n        var endRow = (deleteLastNewLine ? lastRow + 1 : lastRow);\n        var endCol = (deleteLastNewLine ? 0 : this.getLine(endRow).length);\n        var range = new Range(startRow, startCol, endRow, endCol);\n        var deletedLines = this.$lines.slice(firstRow, lastRow + 1);\n        this.applyDelta({\n            start: range.start,\n            end: range.end,\n            action: \"remove\",\n            lines: this.getLinesForRange(range)\n        });\n        return deletedLines;\n    };\n    Document.prototype.removeNewLine = function (row) {\n        if (row < this.getLength() - 1 && row >= 0) {\n            this.applyDelta({\n                start: this.pos(row, this.getLine(row).length),\n                end: this.pos(row + 1, 0),\n                action: \"remove\",\n                lines: [\"\", \"\"]\n            });\n        }\n    };\n    Document.prototype.replace = function (range, text) {\n        if (!(range instanceof Range))\n            range = Range.fromPoints(range.start, range.end);\n        if (text.length === 0 && range.isEmpty())\n            return range.start;\n        if (text == this.getTextRange(range))\n            return range.end;\n        this.remove(range);\n        var end;\n        if (text) {\n            end = this.insert(range.start, text);\n        }\n        else {\n            end = range.start;\n        }\n        return end;\n    };\n    Document.prototype.applyDeltas = function (deltas) {\n        for (var i = 0; i < deltas.length; i++) {\n            this.applyDelta(deltas[i]);\n        }\n    };\n    Document.prototype.revertDeltas = function (deltas) {\n        for (var i = deltas.length - 1; i >= 0; i--) {\n            this.revertDelta(deltas[i]);\n        }\n    };\n    Document.prototype.applyDelta = function (delta, doNotValidate) {\n        var isInsert = delta.action == \"insert\";\n        if (isInsert ? delta.lines.length <= 1 && !delta.lines[0]\n            : !Range.comparePoints(delta.start, delta.end)) {\n            return;\n        }\n        if (isInsert && delta.lines.length > 20000) {\n            this.$splitAndapplyLargeDelta(delta, 20000);\n        }\n        else {\n            applyDelta(this.$lines, delta, doNotValidate);\n            this._signal(\"change\", delta);\n        }\n    };\n    Document.prototype.$safeApplyDelta = function (delta) {\n        var docLength = this.$lines.length;\n        if (delta.action == \"remove\" && delta.start.row < docLength && delta.end.row < docLength\n            || delta.action == \"insert\" && delta.start.row <= docLength) {\n            this.applyDelta(delta);\n        }\n    };\n    Document.prototype.$splitAndapplyLargeDelta = function (delta, MAX) {\n        var lines = delta.lines;\n        var l = lines.length - MAX + 1;\n        var row = delta.start.row;\n        var column = delta.start.column;\n        for (var from = 0, to = 0; from < l; from = to) {\n            to += MAX - 1;\n            var chunk = lines.slice(from, to);\n            chunk.push(\"\");\n            this.applyDelta({\n                start: this.pos(row + from, column),\n                end: this.pos(row + to, column = 0),\n                action: delta.action,\n                lines: chunk\n            }, true);\n        }\n        delta.lines = lines.slice(from);\n        delta.start.row = row + from;\n        delta.start.column = column;\n        this.applyDelta(delta, true);\n    };\n    Document.prototype.revertDelta = function (delta) {\n        this.$safeApplyDelta({\n            start: this.clonePos(delta.start),\n            end: this.clonePos(delta.end),\n            action: (delta.action == \"insert\" ? \"remove\" : \"insert\"),\n            lines: delta.lines.slice()\n        });\n    };\n    Document.prototype.indexToPosition = function (index, startRow) {\n        var lines = this.$lines || this.getAllLines();\n        var newlineLength = this.getNewLineCharacter().length;\n        for (var i = startRow || 0, l = lines.length; i < l; i++) {\n            index -= lines[i].length + newlineLength;\n            if (index < 0)\n                return { row: i, column: index + lines[i].length + newlineLength };\n        }\n        return { row: l - 1, column: index + lines[l - 1].length + newlineLength };\n    };\n    Document.prototype.positionToIndex = function (pos, startRow) {\n        var lines = this.$lines || this.getAllLines();\n        var newlineLength = this.getNewLineCharacter().length;\n        var index = 0;\n        var row = Math.min(pos.row, lines.length);\n        for (var i = startRow || 0; i < row; ++i)\n            index += lines[i].length + newlineLength;\n        return index + pos.column;\n    };\n    Document.prototype.$split = function (text) {\n        return text.split(/\\r\\n|\\r|\\n/);\n    };\n    return Document;\n}());\nDocument.prototype.$autoNewLine = \"\";\nDocument.prototype.$newLineMode = \"auto\";\noop.implement(Document.prototype, EventEmitter);\nexports.Document = Document;\n\n});\n\nace.define(\"ace/worker/mirror\",[], function(require, exports, module) {\n\"use strict\";\n\nvar Document = require(\"../document\").Document;\nvar lang = require(\"../lib/lang\");\n    \nvar Mirror = exports.Mirror = function(sender) {\n    this.sender = sender;\n    var doc = this.doc = new Document(\"\");\n    \n    var deferredUpdate = this.deferredUpdate = lang.delayedCall(this.onUpdate.bind(this));\n    \n    var _self = this;\n    sender.on(\"change\", function(e) {\n        var data = e.data;\n        if (data[0].start) {\n            doc.applyDeltas(data);\n        } else {\n            for (var i = 0; i < data.length; i += 2) {\n                var d, err; \n                if (Array.isArray(data[i+1])) {\n                    d = {action: \"insert\", start: data[i], lines: data[i+1]};\n                } else {\n                    d = {action: \"remove\", start: data[i], end: data[i+1]};\n                }\n                \n                if ((d.action == \"insert\" ? d.start : d.end).row >= doc.$lines.length) {\n                    err = new Error(\"Invalid delta\");\n                    err.data = {\n                        path: _self.$path,\n                        linesLength: doc.$lines.length,\n                        start: d.start,\n                        end: d.end\n                    };\n                    throw err;\n                }\n\n                doc.applyDelta(d, true);\n            }\n        }\n        if (_self.$timeout)\n            return deferredUpdate.schedule(_self.$timeout);\n        _self.onUpdate();\n    });\n};\n\n(function() {\n    \n    this.$timeout = 500;\n    \n    this.setTimeout = function(timeout) {\n        this.$timeout = timeout;\n    };\n    \n    this.setValue = function(value) {\n        this.doc.setValue(value);\n        this.deferredUpdate.schedule(this.$timeout);\n    };\n    \n    this.getValue = function(callbackId) {\n        this.sender.callback(this.doc.getValue(), callbackId);\n    };\n    \n    this.onUpdate = function() {\n    };\n    \n    this.isPending = function() {\n        return this.deferredUpdate.isPending();\n    };\n    \n}).call(Mirror.prototype);\n\n});\n\nace.define(\"ace/mode/css/csslint\",[], function(require, exports, module) {\n\nvar CSSLint = (function(){\n  var module = module || {},\n      exports = exports || {};\nvar parserlib = (function () {\nvar require;\nrequire=(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c=\"function\"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error(\"Cannot find module '\"+i+\"'\");throw a.code=\"MODULE_NOT_FOUND\",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u=\"function\"==typeof require&&require,i=0;i\") {\n        this.type = \"child\";\n    } else if (text === \"+\") {\n        this.type = \"adjacent-sibling\";\n    } else if (text === \"~\") {\n        this.type = \"sibling\";\n    }\n\n}\n\nCombinator.prototype = new SyntaxUnit();\nCombinator.prototype.constructor = Combinator;\n\n\n},{\"../util/SyntaxUnit\":26,\"./Parser\":6}],3:[function(require,module,exports){\n\"use strict\";\n\nmodule.exports = Matcher;\n\nvar StringReader = require(\"../util/StringReader\");\nvar SyntaxError = require(\"../util/SyntaxError\");\nfunction Matcher(matchFunc, toString) {\n    this.match = function(expression) {\n        var result;\n        expression.mark();\n        result = matchFunc(expression);\n        if (result) {\n            expression.drop();\n        } else {\n            expression.restore();\n        }\n        return result;\n    };\n    this.toString = typeof toString === \"function\" ? toString : function() {\n        return toString;\n    };\n}\nMatcher.prec = {\n    MOD:    5,\n    SEQ:    4,\n    ANDAND: 3,\n    OROR:   2,\n    ALT:    1\n};\nMatcher.parse = function(str) {\n    var reader, eat, expr, oror, andand, seq, mod, term, result;\n    reader = new StringReader(str);\n    eat = function(matcher) {\n        var result = reader.readMatch(matcher);\n        if (result === null) {\n            throw new SyntaxError(\n                \"Expected \" + matcher, reader.getLine(), reader.getCol());\n        }\n        return result;\n    };\n    expr = function() {\n        var m = [ oror() ];\n        while (reader.readMatch(\" | \") !== null) {\n            m.push(oror());\n        }\n        return m.length === 1 ? m[0] : Matcher.alt.apply(Matcher, m);\n    };\n    oror = function() {\n        var m = [ andand() ];\n        while (reader.readMatch(\" || \") !== null) {\n            m.push(andand());\n        }\n        return m.length === 1 ? m[0] : Matcher.oror.apply(Matcher, m);\n    };\n    andand = function() {\n        var m = [ seq() ];\n        while (reader.readMatch(\" && \") !== null) {\n            m.push(seq());\n        }\n        return m.length === 1 ? m[0] : Matcher.andand.apply(Matcher, m);\n    };\n    seq = function() {\n        var m = [ mod() ];\n        while (reader.readMatch(/^ (?![&|\\]])/) !== null) {\n            m.push(mod());\n        }\n        return m.length === 1 ? m[0] : Matcher.seq.apply(Matcher, m);\n    };\n    mod = function() {\n        var m = term();\n        if (reader.readMatch(\"?\") !== null) {\n            return m.question();\n        } else if (reader.readMatch(\"*\") !== null) {\n            return m.star();\n        } else if (reader.readMatch(\"+\") !== null) {\n            return m.plus();\n        } else if (reader.readMatch(\"#\") !== null) {\n            return m.hash();\n        } else if (reader.readMatch(/^\\{\\s*/) !== null) {\n            var min = eat(/^\\d+/);\n            eat(/^\\s*,\\s*/);\n            var max = eat(/^\\d+/);\n            eat(/^\\s*\\}/);\n            return m.braces(Number(min), Number(max));\n        }\n        return m;\n    };\n    term = function() {\n        if (reader.readMatch(\"[ \") !== null) {\n            var m = expr();\n            eat(\" ]\");\n            return m;\n        }\n        return Matcher.fromType(eat(/^[^ ?*+#{]+/));\n    };\n    result = expr();\n    if (!reader.eof()) {\n        throw new SyntaxError(\n            \"Expected end of string\", reader.getLine(), reader.getCol());\n    }\n    return result;\n};\nMatcher.cast = function(m) {\n    if (m instanceof Matcher) {\n        return m;\n    }\n    return Matcher.parse(m);\n};\nMatcher.fromType = function(type) {\n    var ValidationTypes = require(\"./ValidationTypes\");\n    return new Matcher(function(expression) {\n        return expression.hasNext() && ValidationTypes.isType(expression, type);\n    }, type);\n};\nMatcher.seq = function() {\n    var ms = Array.prototype.slice.call(arguments).map(Matcher.cast);\n    if (ms.length === 1) {\n        return ms[0];\n    }\n    return new Matcher(function(expression) {\n        var i, result = true;\n        for (i = 0; result && i < ms.length; i++) {\n            result = ms[i].match(expression);\n        }\n        return result;\n    }, function(prec) {\n        var p = Matcher.prec.SEQ;\n        var s = ms.map(function(m) {\n            return m.toString(p);\n        }).join(\" \");\n        if (prec > p) {\n            s = \"[ \" + s + \" ]\";\n        }\n        return s;\n    });\n};\nMatcher.alt = function() {\n    var ms = Array.prototype.slice.call(arguments).map(Matcher.cast);\n    if (ms.length === 1) {\n        return ms[0];\n    }\n    return new Matcher(function(expression) {\n        var i, result = false;\n        for (i = 0; !result && i < ms.length; i++) {\n            result = ms[i].match(expression);\n        }\n        return result;\n    }, function(prec) {\n        var p = Matcher.prec.ALT;\n        var s = ms.map(function(m) {\n            return m.toString(p);\n        }).join(\" | \");\n        if (prec > p) {\n            s = \"[ \" + s + \" ]\";\n        }\n        return s;\n    });\n};\nMatcher.many = function(required) {\n    var ms = Array.prototype.slice.call(arguments, 1).reduce(function(acc, v) {\n        if (v.expand) {\n            var ValidationTypes = require(\"./ValidationTypes\");\n            acc.push.apply(acc, ValidationTypes.complex[v.expand].options);\n        } else {\n            acc.push(Matcher.cast(v));\n        }\n        return acc;\n    }, []);\n\n    if (required === true) {\n        required = ms.map(function() {\n            return true;\n        });\n    }\n\n    var result = new Matcher(function(expression) {\n        var seen = [], max = 0, pass = 0;\n        var success = function(matchCount) {\n            if (pass === 0) {\n                max = Math.max(matchCount, max);\n                return matchCount === ms.length;\n            } else {\n                return matchCount === max;\n            }\n        };\n        var tryMatch = function(matchCount) {\n            for (var i = 0; i < ms.length; i++) {\n                if (seen[i]) {\n                    continue;\n                }\n                expression.mark();\n                if (ms[i].match(expression)) {\n                    seen[i] = true;\n                    if (tryMatch(matchCount + (required === false || required[i] ? 1 : 0))) {\n                        expression.drop();\n                        return true;\n                    }\n                    expression.restore();\n                    seen[i] = false;\n                } else {\n                    expression.drop();\n                }\n            }\n            return success(matchCount);\n        };\n        if (!tryMatch(0)) {\n            pass++;\n            tryMatch(0);\n        }\n\n        if (required === false) {\n            return max > 0;\n        }\n        for (var i = 0; i < ms.length; i++) {\n            if (required[i] && !seen[i]) {\n                return false;\n            }\n        }\n        return true;\n    }, function(prec) {\n        var p = required === false ? Matcher.prec.OROR : Matcher.prec.ANDAND;\n        var s = ms.map(function(m, i) {\n            if (required !== false && !required[i]) {\n                return m.toString(Matcher.prec.MOD) + \"?\";\n            }\n            return m.toString(p);\n        }).join(required === false ? \" || \" : \" && \");\n        if (prec > p) {\n            s = \"[ \" + s + \" ]\";\n        }\n        return s;\n    });\n    result.options = ms;\n    return result;\n};\nMatcher.andand = function() {\n    var args = Array.prototype.slice.call(arguments);\n    args.unshift(true);\n    return Matcher.many.apply(Matcher, args);\n};\nMatcher.oror = function() {\n    var args = Array.prototype.slice.call(arguments);\n    args.unshift(false);\n    return Matcher.many.apply(Matcher, args);\n};\nMatcher.prototype = {\n    constructor: Matcher,\n    match: function() {\n        throw new Error(\"unimplemented\");\n    },\n    toString: function() {\n        throw new Error(\"unimplemented\");\n    },\n    func: function() {\n        return this.match.bind(this);\n    },\n    then: function(m) {\n        return Matcher.seq(this, m);\n    },\n    or: function(m) {\n        return Matcher.alt(this, m);\n    },\n    andand: function(m) {\n        return Matcher.many(true, this, m);\n    },\n    oror: function(m) {\n        return Matcher.many(false, this, m);\n    },\n    star: function() {\n        return this.braces(0, Infinity, \"*\");\n    },\n    plus: function() {\n        return this.braces(1, Infinity, \"+\");\n    },\n    question: function() {\n        return this.braces(0, 1, \"?\");\n    },\n    hash: function() {\n        return this.braces(1, Infinity, \"#\", Matcher.cast(\",\"));\n    },\n    braces: function(min, max, marker, optSep) {\n        var m1 = this, m2 = optSep ? optSep.then(this) : this;\n        if (!marker) {\n            marker = \"{\" + min + \",\" + max + \"}\";\n        }\n        return new Matcher(function(expression) {\n            var result = true, i;\n            for (i = 0; i < max; i++) {\n                if (i > 0 && optSep) {\n                    result = m2.match(expression);\n                } else {\n                    result = m1.match(expression);\n                }\n                if (!result) {\n                    break;\n                }\n            }\n            return i >= min;\n        }, function() {\n            return m1.toString(Matcher.prec.MOD) + marker;\n        });\n    }\n};\n\n},{\"../util/StringReader\":24,\"../util/SyntaxError\":25,\"./ValidationTypes\":21}],4:[function(require,module,exports){\n\"use strict\";\n\nmodule.exports = MediaFeature;\n\nvar SyntaxUnit = require(\"../util/SyntaxUnit\");\n\nvar Parser = require(\"./Parser\");\nfunction MediaFeature(name, value) {\n\n    SyntaxUnit.call(this, \"(\" + name + (value !== null ? \":\" + value : \"\") + \")\", name.startLine, name.startCol, Parser.MEDIA_FEATURE_TYPE);\n    this.name = name;\n    this.value = value;\n}\n\nMediaFeature.prototype = new SyntaxUnit();\nMediaFeature.prototype.constructor = MediaFeature;\n\n\n},{\"../util/SyntaxUnit\":26,\"./Parser\":6}],5:[function(require,module,exports){\n\"use strict\";\n\nmodule.exports = MediaQuery;\n\nvar SyntaxUnit = require(\"../util/SyntaxUnit\");\n\nvar Parser = require(\"./Parser\");\nfunction MediaQuery(modifier, mediaType, features, line, col) {\n\n    SyntaxUnit.call(this, (modifier ? modifier + \" \" : \"\") + (mediaType ? mediaType : \"\") + (mediaType && features.length > 0 ? \" and \" : \"\") + features.join(\" and \"), line, col, Parser.MEDIA_QUERY_TYPE);\n    this.modifier = modifier;\n    this.mediaType = mediaType;\n    this.features = features;\n\n}\n\nMediaQuery.prototype = new SyntaxUnit();\nMediaQuery.prototype.constructor = MediaQuery;\n\n\n},{\"../util/SyntaxUnit\":26,\"./Parser\":6}],6:[function(require,module,exports){\n\"use strict\";\n\nmodule.exports = Parser;\n\nvar EventTarget = require(\"../util/EventTarget\");\nvar SyntaxError = require(\"../util/SyntaxError\");\nvar SyntaxUnit = require(\"../util/SyntaxUnit\");\n\nvar Combinator = require(\"./Combinator\");\nvar MediaFeature = require(\"./MediaFeature\");\nvar MediaQuery = require(\"./MediaQuery\");\nvar PropertyName = require(\"./PropertyName\");\nvar PropertyValue = require(\"./PropertyValue\");\nvar PropertyValuePart = require(\"./PropertyValuePart\");\nvar Selector = require(\"./Selector\");\nvar SelectorPart = require(\"./SelectorPart\");\nvar SelectorSubPart = require(\"./SelectorSubPart\");\nvar TokenStream = require(\"./TokenStream\");\nvar Tokens = require(\"./Tokens\");\nvar Validation = require(\"./Validation\");\nfunction Parser(options) {\n    EventTarget.call(this);\n\n\n    this.options = options || {};\n\n    this._tokenStream = null;\n}\nParser.DEFAULT_TYPE = 0;\nParser.COMBINATOR_TYPE = 1;\nParser.MEDIA_FEATURE_TYPE = 2;\nParser.MEDIA_QUERY_TYPE = 3;\nParser.PROPERTY_NAME_TYPE = 4;\nParser.PROPERTY_VALUE_TYPE = 5;\nParser.PROPERTY_VALUE_PART_TYPE = 6;\nParser.SELECTOR_TYPE = 7;\nParser.SELECTOR_PART_TYPE = 8;\nParser.SELECTOR_SUB_PART_TYPE = 9;\n\nParser.prototype = function() {\n\n    var proto = new EventTarget(),  // new prototype\n        prop,\n        additions =  {\n            __proto__: null,\n            constructor: Parser,\n            DEFAULT_TYPE : 0,\n            COMBINATOR_TYPE : 1,\n            MEDIA_FEATURE_TYPE : 2,\n            MEDIA_QUERY_TYPE : 3,\n            PROPERTY_NAME_TYPE : 4,\n            PROPERTY_VALUE_TYPE : 5,\n            PROPERTY_VALUE_PART_TYPE : 6,\n            SELECTOR_TYPE : 7,\n            SELECTOR_PART_TYPE : 8,\n            SELECTOR_SUB_PART_TYPE : 9,\n\n            _stylesheet: function() {\n\n                var tokenStream = this._tokenStream,\n                    count,\n                    token,\n                    tt;\n\n                this.fire(\"startstylesheet\");\n                this._charset();\n\n                this._skipCruft();\n                while (tokenStream.peek() === Tokens.IMPORT_SYM) {\n                    this._import();\n                    this._skipCruft();\n                }\n                while (tokenStream.peek() === Tokens.NAMESPACE_SYM) {\n                    this._namespace();\n                    this._skipCruft();\n                }\n                tt = tokenStream.peek();\n                while (tt > Tokens.EOF) {\n\n                    try {\n\n                        switch (tt) {\n                            case Tokens.MEDIA_SYM:\n                                this._media();\n                                this._skipCruft();\n                                break;\n                            case Tokens.PAGE_SYM:\n                                this._page();\n                                this._skipCruft();\n                                break;\n                            case Tokens.FONT_FACE_SYM:\n                                this._font_face();\n                                this._skipCruft();\n                                break;\n                            case Tokens.KEYFRAMES_SYM:\n                                this._keyframes();\n                                this._skipCruft();\n                                break;\n                            case Tokens.VIEWPORT_SYM:\n                                this._viewport();\n                                this._skipCruft();\n                                break;\n                            case Tokens.DOCUMENT_SYM:\n                                this._document();\n                                this._skipCruft();\n                                break;\n                            case Tokens.SUPPORTS_SYM:\n                                this._supports();\n                                this._skipCruft();\n                                break;\n                            case Tokens.UNKNOWN_SYM:  // unknown @ rule\n                                tokenStream.get();\n                                if (!this.options.strict) {\n                                    this.fire({\n                                        type:       \"error\",\n                                        error:      null,\n                                        message:    \"Unknown @ rule: \" + tokenStream.LT(0).value + \".\",\n                                        line:       tokenStream.LT(0).startLine,\n                                        col:        tokenStream.LT(0).startCol\n                                    });\n                                    count = 0;\n                                    while (tokenStream.advance([Tokens.LBRACE, Tokens.RBRACE]) === Tokens.LBRACE) {\n                                        count++;    // keep track of nesting depth\n                                    }\n\n                                    while (count) {\n                                        tokenStream.advance([Tokens.RBRACE]);\n                                        count--;\n                                    }\n\n                                } else {\n                                    throw new SyntaxError(\"Unknown @ rule.\", tokenStream.LT(0).startLine, tokenStream.LT(0).startCol);\n                                }\n                                break;\n                            case Tokens.S:\n                                this._readWhitespace();\n                                break;\n                            default:\n                                if (!this._ruleset()) {\n                                    switch (tt) {\n                                        case Tokens.CHARSET_SYM:\n                                            token = tokenStream.LT(1);\n                                            this._charset(false);\n                                            throw new SyntaxError(\"@charset not allowed here.\", token.startLine, token.startCol);\n                                        case Tokens.IMPORT_SYM:\n                                            token = tokenStream.LT(1);\n                                            this._import(false);\n                                            throw new SyntaxError(\"@import not allowed here.\", token.startLine, token.startCol);\n                                        case Tokens.NAMESPACE_SYM:\n                                            token = tokenStream.LT(1);\n                                            this._namespace(false);\n                                            throw new SyntaxError(\"@namespace not allowed here.\", token.startLine, token.startCol);\n                                        default:\n                                            tokenStream.get();  // get the last token\n                                            this._unexpectedToken(tokenStream.token());\n                                    }\n\n                                }\n                        }\n                    } catch (ex) {\n                        if (ex instanceof SyntaxError && !this.options.strict) {\n                            this.fire({\n                                type:       \"error\",\n                                error:      ex,\n                                message:    ex.message,\n                                line:       ex.line,\n                                col:        ex.col\n                            });\n                        } else {\n                            throw ex;\n                        }\n                    }\n\n                    tt = tokenStream.peek();\n                }\n\n                if (tt !== Tokens.EOF) {\n                    this._unexpectedToken(tokenStream.token());\n                }\n\n                this.fire(\"endstylesheet\");\n            },\n\n            _charset: function(emit) {\n                var tokenStream = this._tokenStream,\n                    charset,\n                    token,\n                    line,\n                    col;\n\n                if (tokenStream.match(Tokens.CHARSET_SYM)) {\n                    line = tokenStream.token().startLine;\n                    col = tokenStream.token().startCol;\n\n                    this._readWhitespace();\n                    tokenStream.mustMatch(Tokens.STRING);\n\n                    token = tokenStream.token();\n                    charset = token.value;\n\n                    this._readWhitespace();\n                    tokenStream.mustMatch(Tokens.SEMICOLON);\n\n                    if (emit !== false) {\n                        this.fire({\n                            type:   \"charset\",\n                            charset:charset,\n                            line:   line,\n                            col:    col\n                        });\n                    }\n                }\n            },\n\n            _import: function(emit) {\n\n                var tokenStream = this._tokenStream,\n                    uri,\n                    importToken,\n                    mediaList   = [];\n                tokenStream.mustMatch(Tokens.IMPORT_SYM);\n                importToken = tokenStream.token();\n                this._readWhitespace();\n\n                tokenStream.mustMatch([Tokens.STRING, Tokens.URI]);\n                uri = tokenStream.token().value.replace(/^(?:url\\()?[\"']?([^\"']+?)[\"']?\\)?$/, \"$1\");\n\n                this._readWhitespace();\n\n                mediaList = this._media_query_list();\n                tokenStream.mustMatch(Tokens.SEMICOLON);\n                this._readWhitespace();\n\n                if (emit !== false) {\n                    this.fire({\n                        type:   \"import\",\n                        uri:    uri,\n                        media:  mediaList,\n                        line:   importToken.startLine,\n                        col:    importToken.startCol\n                    });\n                }\n\n            },\n\n            _namespace: function(emit) {\n\n                var tokenStream = this._tokenStream,\n                    line,\n                    col,\n                    prefix,\n                    uri;\n                tokenStream.mustMatch(Tokens.NAMESPACE_SYM);\n                line = tokenStream.token().startLine;\n                col = tokenStream.token().startCol;\n                this._readWhitespace();\n                if (tokenStream.match(Tokens.IDENT)) {\n                    prefix = tokenStream.token().value;\n                    this._readWhitespace();\n                }\n\n                tokenStream.mustMatch([Tokens.STRING, Tokens.URI]);\n                uri = tokenStream.token().value.replace(/(?:url\\()?[\"']([^\"']+)[\"']\\)?/, \"$1\");\n\n                this._readWhitespace();\n                tokenStream.mustMatch(Tokens.SEMICOLON);\n                this._readWhitespace();\n\n                if (emit !== false) {\n                    this.fire({\n                        type:   \"namespace\",\n                        prefix: prefix,\n                        uri:    uri,\n                        line:   line,\n                        col:    col\n                    });\n                }\n\n            },\n\n            _supports: function(emit) {\n                var tokenStream = this._tokenStream,\n                    line,\n                    col;\n\n                if (tokenStream.match(Tokens.SUPPORTS_SYM)) {\n                    line = tokenStream.token().startLine;\n                    col = tokenStream.token().startCol;\n\n                    this._readWhitespace();\n                    this._supports_condition();\n                    this._readWhitespace();\n\n                    tokenStream.mustMatch(Tokens.LBRACE);\n                    this._readWhitespace();\n\n                    if (emit !== false) {\n                        this.fire({\n                            type:   \"startsupports\",\n                            line:   line,\n                            col:    col\n                        });\n                    }\n\n                    while (true) {\n                        if (!this._ruleset()) {\n                            break;\n                        }\n                    }\n\n                    tokenStream.mustMatch(Tokens.RBRACE);\n                    this._readWhitespace();\n\n                    this.fire({\n                        type:   \"endsupports\",\n                        line:   line,\n                        col:    col\n                    });\n                }\n            },\n\n            _supports_condition: function() {\n                var tokenStream = this._tokenStream,\n                    ident;\n\n                if (tokenStream.match(Tokens.IDENT)) {\n                    ident = tokenStream.token().value.toLowerCase();\n\n                    if (ident === \"not\") {\n                        tokenStream.mustMatch(Tokens.S);\n                        this._supports_condition_in_parens();\n                    } else {\n                        tokenStream.unget();\n                    }\n                } else {\n                    this._supports_condition_in_parens();\n                    this._readWhitespace();\n\n                    while (tokenStream.peek() === Tokens.IDENT) {\n                        ident = tokenStream.LT(1).value.toLowerCase();\n                        if (ident === \"and\" || ident === \"or\") {\n                            tokenStream.mustMatch(Tokens.IDENT);\n                            this._readWhitespace();\n                            this._supports_condition_in_parens();\n                            this._readWhitespace();\n                        }\n                    }\n                }\n            },\n\n            _supports_condition_in_parens: function() {\n                var tokenStream = this._tokenStream,\n                    ident;\n\n                if (tokenStream.match(Tokens.LPAREN)) {\n                    this._readWhitespace();\n                    if (tokenStream.match(Tokens.IDENT)) {\n                        ident = tokenStream.token().value.toLowerCase();\n                        if (ident === \"not\") {\n                            this._readWhitespace();\n                            this._supports_condition();\n                            this._readWhitespace();\n                            tokenStream.mustMatch(Tokens.RPAREN);\n                        } else {\n                            tokenStream.unget();\n                            this._supports_declaration_condition(false);\n                        }\n                    } else {\n                        this._supports_condition();\n                        this._readWhitespace();\n                        tokenStream.mustMatch(Tokens.RPAREN);\n                    }\n                } else {\n                    this._supports_declaration_condition();\n                }\n            },\n\n            _supports_declaration_condition: function(requireStartParen) {\n                var tokenStream = this._tokenStream;\n\n                if (requireStartParen !== false) {\n                    tokenStream.mustMatch(Tokens.LPAREN);\n                }\n                this._readWhitespace();\n                this._declaration();\n                tokenStream.mustMatch(Tokens.RPAREN);\n            },\n\n            _media: function() {\n                var tokenStream     = this._tokenStream,\n                    line,\n                    col,\n                    mediaList;  // = [];\n                tokenStream.mustMatch(Tokens.MEDIA_SYM);\n                line = tokenStream.token().startLine;\n                col = tokenStream.token().startCol;\n\n                this._readWhitespace();\n\n                mediaList = this._media_query_list();\n\n                tokenStream.mustMatch(Tokens.LBRACE);\n                this._readWhitespace();\n\n                this.fire({\n                    type:   \"startmedia\",\n                    media:  mediaList,\n                    line:   line,\n                    col:    col\n                });\n\n                while (true) {\n                    if (tokenStream.peek() === Tokens.PAGE_SYM) {\n                        this._page();\n                    } else if (tokenStream.peek() === Tokens.FONT_FACE_SYM) {\n                        this._font_face();\n                    } else if (tokenStream.peek() === Tokens.VIEWPORT_SYM) {\n                        this._viewport();\n                    } else if (tokenStream.peek() === Tokens.DOCUMENT_SYM) {\n                        this._document();\n                    } else if (tokenStream.peek() === Tokens.SUPPORTS_SYM) {\n                        this._supports();\n                    } else if (tokenStream.peek() === Tokens.MEDIA_SYM) {\n                        this._media();\n                    } else if (!this._ruleset()) {\n                        break;\n                    }\n                }\n\n                tokenStream.mustMatch(Tokens.RBRACE);\n                this._readWhitespace();\n\n                this.fire({\n                    type:   \"endmedia\",\n                    media:  mediaList,\n                    line:   line,\n                    col:    col\n                });\n            },\n            _media_query_list: function() {\n                var tokenStream = this._tokenStream,\n                    mediaList   = [];\n\n\n                this._readWhitespace();\n\n                if (tokenStream.peek() === Tokens.IDENT || tokenStream.peek() === Tokens.LPAREN) {\n                    mediaList.push(this._media_query());\n                }\n\n                while (tokenStream.match(Tokens.COMMA)) {\n                    this._readWhitespace();\n                    mediaList.push(this._media_query());\n                }\n\n                return mediaList;\n            },\n            _media_query: function() {\n                var tokenStream = this._tokenStream,\n                    type        = null,\n                    ident       = null,\n                    token       = null,\n                    expressions = [];\n\n                if (tokenStream.match(Tokens.IDENT)) {\n                    ident = tokenStream.token().value.toLowerCase();\n                    if (ident !== \"only\" && ident !== \"not\") {\n                        tokenStream.unget();\n                        ident = null;\n                    } else {\n                        token = tokenStream.token();\n                    }\n                }\n\n                this._readWhitespace();\n\n                if (tokenStream.peek() === Tokens.IDENT) {\n                    type = this._media_type();\n                    if (token === null) {\n                        token = tokenStream.token();\n                    }\n                } else if (tokenStream.peek() === Tokens.LPAREN) {\n                    if (token === null) {\n                        token = tokenStream.LT(1);\n                    }\n                    expressions.push(this._media_expression());\n                }\n\n                if (type === null && expressions.length === 0) {\n                    return null;\n                } else {\n                    this._readWhitespace();\n                    while (tokenStream.match(Tokens.IDENT)) {\n                        if (tokenStream.token().value.toLowerCase() !== \"and\") {\n                            this._unexpectedToken(tokenStream.token());\n                        }\n\n                        this._readWhitespace();\n                        expressions.push(this._media_expression());\n                    }\n                }\n\n                return new MediaQuery(ident, type, expressions, token.startLine, token.startCol);\n            },\n            _media_type: function() {\n                return this._media_feature();\n            },\n            _media_expression: function() {\n                var tokenStream = this._tokenStream,\n                    feature     = null,\n                    token,\n                    expression  = null;\n\n                tokenStream.mustMatch(Tokens.LPAREN);\n                this._readWhitespace();\n\n                feature = this._media_feature();\n                this._readWhitespace();\n\n                if (tokenStream.match(Tokens.COLON)) {\n                    this._readWhitespace();\n                    token = tokenStream.LT(1);\n                    expression = this._expression();\n                }\n\n                tokenStream.mustMatch(Tokens.RPAREN);\n                this._readWhitespace();\n\n                return new MediaFeature(feature, expression ? new SyntaxUnit(expression, token.startLine, token.startCol) : null);\n            },\n            _media_feature: function() {\n                var tokenStream = this._tokenStream;\n\n                this._readWhitespace();\n\n                tokenStream.mustMatch(Tokens.IDENT);\n\n                return SyntaxUnit.fromToken(tokenStream.token());\n            },\n            _page: function() {\n                var tokenStream = this._tokenStream,\n                    line,\n                    col,\n                    identifier  = null,\n                    pseudoPage  = null;\n                tokenStream.mustMatch(Tokens.PAGE_SYM);\n                line = tokenStream.token().startLine;\n                col = tokenStream.token().startCol;\n\n                this._readWhitespace();\n\n                if (tokenStream.match(Tokens.IDENT)) {\n                    identifier = tokenStream.token().value;\n                    if (identifier.toLowerCase() === \"auto\") {\n                        this._unexpectedToken(tokenStream.token());\n                    }\n                }\n                if (tokenStream.peek() === Tokens.COLON) {\n                    pseudoPage = this._pseudo_page();\n                }\n\n                this._readWhitespace();\n\n                this.fire({\n                    type:   \"startpage\",\n                    id:     identifier,\n                    pseudo: pseudoPage,\n                    line:   line,\n                    col:    col\n                });\n\n                this._readDeclarations(true, true);\n\n                this.fire({\n                    type:   \"endpage\",\n                    id:     identifier,\n                    pseudo: pseudoPage,\n                    line:   line,\n                    col:    col\n                });\n\n            },\n            _margin: function() {\n                var tokenStream = this._tokenStream,\n                    line,\n                    col,\n                    marginSym   = this._margin_sym();\n\n                if (marginSym) {\n                    line = tokenStream.token().startLine;\n                    col = tokenStream.token().startCol;\n\n                    this.fire({\n                        type: \"startpagemargin\",\n                        margin: marginSym,\n                        line:   line,\n                        col:    col\n                    });\n\n                    this._readDeclarations(true);\n\n                    this.fire({\n                        type: \"endpagemargin\",\n                        margin: marginSym,\n                        line:   line,\n                        col:    col\n                    });\n                    return true;\n                } else {\n                    return false;\n                }\n            },\n            _margin_sym: function() {\n\n                var tokenStream = this._tokenStream;\n\n                if (tokenStream.match([Tokens.TOPLEFTCORNER_SYM, Tokens.TOPLEFT_SYM,\n                    Tokens.TOPCENTER_SYM, Tokens.TOPRIGHT_SYM, Tokens.TOPRIGHTCORNER_SYM,\n                    Tokens.BOTTOMLEFTCORNER_SYM, Tokens.BOTTOMLEFT_SYM,\n                    Tokens.BOTTOMCENTER_SYM, Tokens.BOTTOMRIGHT_SYM,\n                    Tokens.BOTTOMRIGHTCORNER_SYM, Tokens.LEFTTOP_SYM,\n                    Tokens.LEFTMIDDLE_SYM, Tokens.LEFTBOTTOM_SYM, Tokens.RIGHTTOP_SYM,\n                    Tokens.RIGHTMIDDLE_SYM, Tokens.RIGHTBOTTOM_SYM])) {\n                    return SyntaxUnit.fromToken(tokenStream.token());\n                } else {\n                    return null;\n                }\n\n            },\n\n            _pseudo_page: function() {\n\n                var tokenStream = this._tokenStream;\n\n                tokenStream.mustMatch(Tokens.COLON);\n                tokenStream.mustMatch(Tokens.IDENT);\n\n                return tokenStream.token().value;\n            },\n\n            _font_face: function() {\n                var tokenStream = this._tokenStream,\n                    line,\n                    col;\n                tokenStream.mustMatch(Tokens.FONT_FACE_SYM);\n                line = tokenStream.token().startLine;\n                col = tokenStream.token().startCol;\n\n                this._readWhitespace();\n\n                this.fire({\n                    type:   \"startfontface\",\n                    line:   line,\n                    col:    col\n                });\n\n                this._readDeclarations(true);\n\n                this.fire({\n                    type:   \"endfontface\",\n                    line:   line,\n                    col:    col\n                });\n            },\n\n            _viewport: function() {\n                var tokenStream = this._tokenStream,\n                    line,\n                    col;\n\n                tokenStream.mustMatch(Tokens.VIEWPORT_SYM);\n                line = tokenStream.token().startLine;\n                col = tokenStream.token().startCol;\n\n                this._readWhitespace();\n\n                this.fire({\n                    type:   \"startviewport\",\n                    line:   line,\n                    col:    col\n                });\n\n                this._readDeclarations(true);\n\n                this.fire({\n                    type:   \"endviewport\",\n                    line:   line,\n                    col:    col\n                });\n\n            },\n\n            _document: function() {\n\n                var tokenStream = this._tokenStream,\n                    token,\n                    functions = [],\n                    prefix = \"\";\n\n                tokenStream.mustMatch(Tokens.DOCUMENT_SYM);\n                token = tokenStream.token();\n                if (/^@-([^-]+)-/.test(token.value)) {\n                    prefix = RegExp.$1;\n                }\n\n                this._readWhitespace();\n                functions.push(this._document_function());\n\n                while (tokenStream.match(Tokens.COMMA)) {\n                    this._readWhitespace();\n                    functions.push(this._document_function());\n                }\n\n                tokenStream.mustMatch(Tokens.LBRACE);\n                this._readWhitespace();\n\n                this.fire({\n                    type:      \"startdocument\",\n                    functions: functions,\n                    prefix:    prefix,\n                    line:      token.startLine,\n                    col:       token.startCol\n                });\n\n                var ok = true;\n                while (ok) {\n                    switch (tokenStream.peek()) {\n                        case Tokens.PAGE_SYM:\n                            this._page();\n                            break;\n                        case Tokens.FONT_FACE_SYM:\n                            this._font_face();\n                            break;\n                        case Tokens.VIEWPORT_SYM:\n                            this._viewport();\n                            break;\n                        case Tokens.MEDIA_SYM:\n                            this._media();\n                            break;\n                        case Tokens.KEYFRAMES_SYM:\n                            this._keyframes();\n                            break;\n                        case Tokens.DOCUMENT_SYM:\n                            this._document();\n                            break;\n                        default:\n                            ok = Boolean(this._ruleset());\n                    }\n                }\n\n                tokenStream.mustMatch(Tokens.RBRACE);\n                token = tokenStream.token();\n                this._readWhitespace();\n\n                this.fire({\n                    type:      \"enddocument\",\n                    functions: functions,\n                    prefix:    prefix,\n                    line:      token.startLine,\n                    col:       token.startCol\n                });\n            },\n\n            _document_function: function() {\n\n                var tokenStream = this._tokenStream,\n                    value;\n\n                if (tokenStream.match(Tokens.URI)) {\n                    value = tokenStream.token().value;\n                    this._readWhitespace();\n                } else {\n                    value = this._function();\n                }\n\n                return value;\n            },\n\n            _operator: function(inFunction) {\n\n                var tokenStream = this._tokenStream,\n                    token       = null;\n\n                if (tokenStream.match([Tokens.SLASH, Tokens.COMMA]) ||\n                    inFunction && tokenStream.match([Tokens.PLUS, Tokens.STAR, Tokens.MINUS])) {\n                    token =  tokenStream.token();\n                    this._readWhitespace();\n                }\n                return token ? PropertyValuePart.fromToken(token) : null;\n\n            },\n\n            _combinator: function() {\n\n                var tokenStream = this._tokenStream,\n                    value       = null,\n                    token;\n\n                if (tokenStream.match([Tokens.PLUS, Tokens.GREATER, Tokens.TILDE])) {\n                    token = tokenStream.token();\n                    value = new Combinator(token.value, token.startLine, token.startCol);\n                    this._readWhitespace();\n                }\n\n                return value;\n            },\n\n            _unary_operator: function() {\n\n                var tokenStream = this._tokenStream;\n\n                if (tokenStream.match([Tokens.MINUS, Tokens.PLUS])) {\n                    return tokenStream.token().value;\n                } else {\n                    return null;\n                }\n            },\n\n            _property: function() {\n\n                var tokenStream  = this._tokenStream,\n                    value        = null,\n                    hack         = null,\n                    propertyName = \"\",\n                    token,\n                    line,\n                    col;\n                if (tokenStream.peek() === Tokens.STAR && this.options.starHack) {\n                    tokenStream.get();\n                    token = tokenStream.token();\n                    hack = token.value;\n                    line = token.startLine;\n                    col = token.startCol;\n                }\n                if (tokenStream.peek() === Tokens.MINUS) {\n                    tokenStream.get();\n                    token = tokenStream.token();\n                    propertyName = token.value;\n                    line = token.startLine;\n                    col = token.startCol;\n                }\n\n                if (tokenStream.match(Tokens.IDENT)) {\n                    token = tokenStream.token();\n                    propertyName += token.value;\n                    if (propertyName.charAt(0) === \"_\" && this.options.underscoreHack) {\n                        hack = \"_\";\n                        propertyName = propertyName.substring(1);\n                    }\n\n                    value = new PropertyName(propertyName, hack, line || token.startLine, col || token.startCol);\n                    this._readWhitespace();\n                } else {\n                    var tt = tokenStream.peek();\n                    if (tt !== Tokens.EOF && tt !== Tokens.RBRACE) {\n                        this._unexpectedToken(tokenStream.LT(1));\n                    }\n                }\n\n                return value;\n            },\n            _ruleset: function() {\n\n                var tokenStream = this._tokenStream,\n                    tt,\n                    selectors;\n                try {\n                    selectors = this._selectors_group();\n                } catch (ex) {\n                    if (ex instanceof SyntaxError && !this.options.strict) {\n                        this.fire({\n                            type:       \"error\",\n                            error:      ex,\n                            message:    ex.message,\n                            line:       ex.line,\n                            col:        ex.col\n                        });\n                        tt = tokenStream.advance([Tokens.RBRACE]);\n                        if (tt === Tokens.RBRACE) {\n                        } else {\n                            throw ex;\n                        }\n\n                    } else {\n                        throw ex;\n                    }\n                    return true;\n                }\n                if (selectors) {\n\n                    this.fire({\n                        type:       \"startrule\",\n                        selectors:  selectors,\n                        line:       selectors[0].line,\n                        col:        selectors[0].col\n                    });\n\n                    this._readDeclarations(true);\n\n                    this.fire({\n                        type:       \"endrule\",\n                        selectors:  selectors,\n                        line:       selectors[0].line,\n                        col:        selectors[0].col\n                    });\n\n                }\n\n                return selectors;\n\n            },\n            _selectors_group: function() {\n                var tokenStream = this._tokenStream,\n                    selectors   = [],\n                    selector;\n\n                selector = this._selector();\n                if (selector !== null) {\n\n                    selectors.push(selector);\n                    while (tokenStream.match(Tokens.COMMA)) {\n                        this._readWhitespace();\n                        selector = this._selector();\n                        if (selector !== null) {\n                            selectors.push(selector);\n                        } else {\n                            this._unexpectedToken(tokenStream.LT(1));\n                        }\n                    }\n                }\n\n                return selectors.length ? selectors : null;\n            },\n            _selector: function() {\n\n                var tokenStream = this._tokenStream,\n                    selector    = [],\n                    nextSelector = null,\n                    combinator  = null,\n                    ws          = null;\n                nextSelector = this._simple_selector_sequence();\n                if (nextSelector === null) {\n                    return null;\n                }\n\n                selector.push(nextSelector);\n\n                do {\n                    combinator = this._combinator();\n\n                    if (combinator !== null) {\n                        selector.push(combinator);\n                        nextSelector = this._simple_selector_sequence();\n                        if (nextSelector === null) {\n                            this._unexpectedToken(tokenStream.LT(1));\n                        } else {\n                            selector.push(nextSelector);\n                        }\n                    } else {\n                        if (this._readWhitespace()) {\n                            ws = new Combinator(tokenStream.token().value, tokenStream.token().startLine, tokenStream.token().startCol);\n                            combinator = this._combinator();\n                            nextSelector = this._simple_selector_sequence();\n                            if (nextSelector === null) {\n                                if (combinator !== null) {\n                                    this._unexpectedToken(tokenStream.LT(1));\n                                }\n                            } else {\n\n                                if (combinator !== null) {\n                                    selector.push(combinator);\n                                } else {\n                                    selector.push(ws);\n                                }\n\n                                selector.push(nextSelector);\n                            }\n                        } else {\n                            break;\n                        }\n\n                    }\n                } while (true);\n\n                return new Selector(selector, selector[0].line, selector[0].col);\n            },\n            _simple_selector_sequence: function() {\n\n                var tokenStream = this._tokenStream,\n                    elementName = null,\n                    modifiers   = [],\n                    selectorText = \"\",\n                    components  = [\n                        function() {\n                            return tokenStream.match(Tokens.HASH) ?\n                                    new SelectorSubPart(tokenStream.token().value, \"id\", tokenStream.token().startLine, tokenStream.token().startCol) :\n                                    null;\n                        },\n                        this._class,\n                        this._attrib,\n                        this._pseudo,\n                        this._negation\n                    ],\n                    i           = 0,\n                    len         = components.length,\n                    component   = null,\n                    line,\n                    col;\n                line = tokenStream.LT(1).startLine;\n                col = tokenStream.LT(1).startCol;\n\n                elementName = this._type_selector();\n                if (!elementName) {\n                    elementName = this._universal();\n                }\n\n                if (elementName !== null) {\n                    selectorText += elementName;\n                }\n\n                while (true) {\n                    if (tokenStream.peek() === Tokens.S) {\n                        break;\n                    }\n                    while (i < len && component === null) {\n                        component = components[i++].call(this);\n                    }\n\n                    if (component === null) {\n                        if (selectorText === \"\") {\n                            return null;\n                        } else {\n                            break;\n                        }\n                    } else {\n                        i = 0;\n                        modifiers.push(component);\n                        selectorText += component.toString();\n                        component = null;\n                    }\n                }\n\n\n                return selectorText !== \"\" ?\n                        new SelectorPart(elementName, modifiers, selectorText, line, col) :\n                        null;\n            },\n            _type_selector: function() {\n\n                var tokenStream = this._tokenStream,\n                    ns          = this._namespace_prefix(),\n                    elementName = this._element_name();\n\n                if (!elementName) {\n                    if (ns) {\n                        tokenStream.unget();\n                        if (ns.length > 1) {\n                            tokenStream.unget();\n                        }\n                    }\n\n                    return null;\n                } else {\n                    if (ns) {\n                        elementName.text = ns + elementName.text;\n                        elementName.col -= ns.length;\n                    }\n                    return elementName;\n                }\n            },\n            _class: function() {\n\n                var tokenStream = this._tokenStream,\n                    token;\n\n                if (tokenStream.match(Tokens.DOT)) {\n                    tokenStream.mustMatch(Tokens.IDENT);\n                    token = tokenStream.token();\n                    return new SelectorSubPart(\".\" + token.value, \"class\", token.startLine, token.startCol - 1);\n                } else {\n                    return null;\n                }\n\n            },\n            _element_name: function() {\n\n                var tokenStream = this._tokenStream,\n                    token;\n\n                if (tokenStream.match(Tokens.IDENT)) {\n                    token = tokenStream.token();\n                    return new SelectorSubPart(token.value, \"elementName\", token.startLine, token.startCol);\n\n                } else {\n                    return null;\n                }\n            },\n            _namespace_prefix: function() {\n                var tokenStream = this._tokenStream,\n                    value       = \"\";\n                if (tokenStream.LA(1) === Tokens.PIPE || tokenStream.LA(2) === Tokens.PIPE) {\n\n                    if (tokenStream.match([Tokens.IDENT, Tokens.STAR])) {\n                        value += tokenStream.token().value;\n                    }\n\n                    tokenStream.mustMatch(Tokens.PIPE);\n                    value += \"|\";\n\n                }\n\n                return value.length ? value : null;\n            },\n            _universal: function() {\n                var tokenStream = this._tokenStream,\n                    value       = \"\",\n                    ns;\n\n                ns = this._namespace_prefix();\n                if (ns) {\n                    value += ns;\n                }\n\n                if (tokenStream.match(Tokens.STAR)) {\n                    value += \"*\";\n                }\n\n                return value.length ? value : null;\n\n            },\n            _attrib: function() {\n\n                var tokenStream = this._tokenStream,\n                    value       = null,\n                    ns,\n                    token;\n\n                if (tokenStream.match(Tokens.LBRACKET)) {\n                    token = tokenStream.token();\n                    value = token.value;\n                    value += this._readWhitespace();\n\n                    ns = this._namespace_prefix();\n\n                    if (ns) {\n                        value += ns;\n                    }\n\n                    tokenStream.mustMatch(Tokens.IDENT);\n                    value += tokenStream.token().value;\n                    value += this._readWhitespace();\n\n                    if (tokenStream.match([Tokens.PREFIXMATCH, Tokens.SUFFIXMATCH, Tokens.SUBSTRINGMATCH,\n                        Tokens.EQUALS, Tokens.INCLUDES, Tokens.DASHMATCH])) {\n\n                        value += tokenStream.token().value;\n                        value += this._readWhitespace();\n\n                        tokenStream.mustMatch([Tokens.IDENT, Tokens.STRING]);\n                        value += tokenStream.token().value;\n                        value += this._readWhitespace();\n                    }\n\n                    tokenStream.mustMatch(Tokens.RBRACKET);\n\n                    return new SelectorSubPart(value + \"]\", \"attribute\", token.startLine, token.startCol);\n                } else {\n                    return null;\n                }\n            },\n            _pseudo: function() {\n\n                var tokenStream = this._tokenStream,\n                    pseudo      = null,\n                    colons      = \":\",\n                    line,\n                    col;\n\n                if (tokenStream.match(Tokens.COLON)) {\n\n                    if (tokenStream.match(Tokens.COLON)) {\n                        colons += \":\";\n                    }\n\n                    if (tokenStream.match(Tokens.IDENT)) {\n                        pseudo = tokenStream.token().value;\n                        line = tokenStream.token().startLine;\n                        col = tokenStream.token().startCol - colons.length;\n                    } else if (tokenStream.peek() === Tokens.FUNCTION) {\n                        line = tokenStream.LT(1).startLine;\n                        col = tokenStream.LT(1).startCol - colons.length;\n                        pseudo = this._functional_pseudo();\n                    }\n\n                    if (pseudo) {\n                        pseudo = new SelectorSubPart(colons + pseudo, \"pseudo\", line, col);\n                    } else {\n                        var startLine = tokenStream.LT(1).startLine,\n                            startCol  = tokenStream.LT(0).startCol;\n                        throw new SyntaxError(\"Expected a `FUNCTION` or `IDENT` after colon at line \" + startLine + \", col \" + startCol + \".\", startLine, startCol);\n                    }\n                }\n\n                return pseudo;\n            },\n            _functional_pseudo: function() {\n\n                var tokenStream = this._tokenStream,\n                    value = null;\n\n                if (tokenStream.match(Tokens.FUNCTION)) {\n                    value = tokenStream.token().value;\n                    value += this._readWhitespace();\n                    value += this._expression();\n                    tokenStream.mustMatch(Tokens.RPAREN);\n                    value += \")\";\n                }\n\n                return value;\n            },\n            _expression: function() {\n\n                var tokenStream = this._tokenStream,\n                    value       = \"\";\n\n                while (tokenStream.match([Tokens.PLUS, Tokens.MINUS, Tokens.DIMENSION,\n                    Tokens.NUMBER, Tokens.STRING, Tokens.IDENT, Tokens.LENGTH,\n                    Tokens.FREQ, Tokens.ANGLE, Tokens.TIME,\n                    Tokens.RESOLUTION, Tokens.SLASH])) {\n\n                    value += tokenStream.token().value;\n                    value += this._readWhitespace();\n                }\n\n                return value.length ? value : null;\n\n            },\n            _negation: function() {\n\n                var tokenStream = this._tokenStream,\n                    line,\n                    col,\n                    value       = \"\",\n                    arg,\n                    subpart     = null;\n\n                if (tokenStream.match(Tokens.NOT)) {\n                    value = tokenStream.token().value;\n                    line = tokenStream.token().startLine;\n                    col = tokenStream.token().startCol;\n                    value += this._readWhitespace();\n                    arg = this._negation_arg();\n                    value += arg;\n                    value += this._readWhitespace();\n                    tokenStream.match(Tokens.RPAREN);\n                    value += tokenStream.token().value;\n\n                    subpart = new SelectorSubPart(value, \"not\", line, col);\n                    subpart.args.push(arg);\n                }\n\n                return subpart;\n            },\n            _negation_arg: function() {\n\n                var tokenStream = this._tokenStream,\n                    args        = [\n                        this._type_selector,\n                        this._universal,\n                        function() {\n                            return tokenStream.match(Tokens.HASH) ?\n                                    new SelectorSubPart(tokenStream.token().value, \"id\", tokenStream.token().startLine, tokenStream.token().startCol) :\n                                    null;\n                        },\n                        this._class,\n                        this._attrib,\n                        this._pseudo\n                    ],\n                    arg         = null,\n                    i           = 0,\n                    len         = args.length,\n                    line,\n                    col,\n                    part;\n\n                line = tokenStream.LT(1).startLine;\n                col = tokenStream.LT(1).startCol;\n\n                while (i < len && arg === null) {\n\n                    arg = args[i].call(this);\n                    i++;\n                }\n                if (arg === null) {\n                    this._unexpectedToken(tokenStream.LT(1));\n                }\n                if (arg.type === \"elementName\") {\n                    part = new SelectorPart(arg, [], arg.toString(), line, col);\n                } else {\n                    part = new SelectorPart(null, [arg], arg.toString(), line, col);\n                }\n\n                return part;\n            },\n\n            _declaration: function() {\n\n                var tokenStream  = this._tokenStream,\n                    property     = null,\n                    expr         = null,\n                    prio         = null,\n                    invalid      = null,\n                    propertyName = \"\";\n\n                property = this._property();\n                if (property !== null) {\n\n                    tokenStream.mustMatch(Tokens.COLON);\n                    this._readWhitespace();\n\n                    expr = this._expr();\n                    if (!expr || expr.length === 0) {\n                        this._unexpectedToken(tokenStream.LT(1));\n                    }\n\n                    prio = this._prio();\n                    propertyName = property.toString();\n                    if (this.options.starHack && property.hack === \"*\" ||\n                            this.options.underscoreHack && property.hack === \"_\") {\n\n                        propertyName = property.text;\n                    }\n\n                    try {\n                        this._validateProperty(propertyName, expr);\n                    } catch (ex) {\n                        invalid = ex;\n                    }\n\n                    this.fire({\n                        type:       \"property\",\n                        property:   property,\n                        value:      expr,\n                        important:  prio,\n                        line:       property.line,\n                        col:        property.col,\n                        invalid:    invalid\n                    });\n\n                    return true;\n                } else {\n                    return false;\n                }\n            },\n\n            _prio: function() {\n\n                var tokenStream = this._tokenStream,\n                    result      = tokenStream.match(Tokens.IMPORTANT_SYM);\n\n                this._readWhitespace();\n                return result;\n            },\n\n            _expr: function(inFunction) {\n\n                var values      = [],\n                    value       = null,\n                    operator    = null;\n\n                value = this._term(inFunction);\n                if (value !== null) {\n\n                    values.push(value);\n\n                    do {\n                        operator = this._operator(inFunction);\n                        if (operator) {\n                            values.push(operator);\n                        } /*else {\n                            values.push(new PropertyValue(valueParts, valueParts[0].line, valueParts[0].col));\n                            valueParts = [];\n                        }*/\n\n                        value = this._term(inFunction);\n\n                        if (value === null) {\n                            break;\n                        } else {\n                            values.push(value);\n                        }\n                    } while (true);\n                }\n\n                return values.length > 0 ? new PropertyValue(values, values[0].line, values[0].col) : null;\n            },\n\n            _term: function(inFunction) {\n\n                var tokenStream = this._tokenStream,\n                    unary       = null,\n                    value       = null,\n                    endChar     = null,\n                    part        = null,\n                    token,\n                    line,\n                    col;\n                unary = this._unary_operator();\n                if (unary !== null) {\n                    line = tokenStream.token().startLine;\n                    col = tokenStream.token().startCol;\n                }\n                if (tokenStream.peek() === Tokens.IE_FUNCTION && this.options.ieFilters) {\n\n                    value = this._ie_function();\n                    if (unary === null) {\n                        line = tokenStream.token().startLine;\n                        col = tokenStream.token().startCol;\n                    }\n                } else if (inFunction && tokenStream.match([Tokens.LPAREN, Tokens.LBRACE, Tokens.LBRACKET])) {\n\n                    token = tokenStream.token();\n                    endChar = token.endChar;\n                    value = token.value + this._expr(inFunction).text;\n                    if (unary === null) {\n                        line = tokenStream.token().startLine;\n                        col = tokenStream.token().startCol;\n                    }\n                    tokenStream.mustMatch(Tokens.type(endChar));\n                    value += endChar;\n                    this._readWhitespace();\n                } else if (tokenStream.match([Tokens.NUMBER, Tokens.PERCENTAGE, Tokens.LENGTH,\n                    Tokens.ANGLE, Tokens.TIME,\n                    Tokens.FREQ, Tokens.STRING, Tokens.IDENT, Tokens.URI, Tokens.UNICODE_RANGE])) {\n\n                    value = tokenStream.token().value;\n                    if (unary === null) {\n                        line = tokenStream.token().startLine;\n                        col = tokenStream.token().startCol;\n                        part = PropertyValuePart.fromToken(tokenStream.token());\n                    }\n                    this._readWhitespace();\n                } else {\n                    token = this._hexcolor();\n                    if (token === null) {\n                        if (unary === null) {\n                            line = tokenStream.LT(1).startLine;\n                            col = tokenStream.LT(1).startCol;\n                        }\n                        if (value === null) {\n                            if (tokenStream.LA(3) === Tokens.EQUALS && this.options.ieFilters) {\n                                value = this._ie_function();\n                            } else {\n                                value = this._function();\n                            }\n                        }\n\n                    } else {\n                        value = token.value;\n                        if (unary === null) {\n                            line = token.startLine;\n                            col = token.startCol;\n                        }\n                    }\n\n                }\n\n                return part !== null ? part : value !== null ?\n                        new PropertyValuePart(unary !== null ? unary + value : value, line, col) :\n                        null;\n\n            },\n\n            _function: function() {\n\n                var tokenStream = this._tokenStream,\n                    functionText = null,\n                    expr        = null,\n                    lt;\n\n                if (tokenStream.match(Tokens.FUNCTION)) {\n                    functionText = tokenStream.token().value;\n                    this._readWhitespace();\n                    expr = this._expr(true);\n                    functionText += expr;\n                    if (this.options.ieFilters && tokenStream.peek() === Tokens.EQUALS) {\n                        do {\n\n                            if (this._readWhitespace()) {\n                                functionText += tokenStream.token().value;\n                            }\n                            if (tokenStream.LA(0) === Tokens.COMMA) {\n                                functionText += tokenStream.token().value;\n                            }\n\n                            tokenStream.match(Tokens.IDENT);\n                            functionText += tokenStream.token().value;\n\n                            tokenStream.match(Tokens.EQUALS);\n                            functionText += tokenStream.token().value;\n                            lt = tokenStream.peek();\n                            while (lt !== Tokens.COMMA && lt !== Tokens.S && lt !== Tokens.RPAREN) {\n                                tokenStream.get();\n                                functionText += tokenStream.token().value;\n                                lt = tokenStream.peek();\n                            }\n                        } while (tokenStream.match([Tokens.COMMA, Tokens.S]));\n                    }\n\n                    tokenStream.match(Tokens.RPAREN);\n                    functionText += \")\";\n                    this._readWhitespace();\n                }\n\n                return functionText;\n            },\n\n            _ie_function: function() {\n\n                var tokenStream = this._tokenStream,\n                    functionText = null,\n                    lt;\n                if (tokenStream.match([Tokens.IE_FUNCTION, Tokens.FUNCTION])) {\n                    functionText = tokenStream.token().value;\n\n                    do {\n\n                        if (this._readWhitespace()) {\n                            functionText += tokenStream.token().value;\n                        }\n                        if (tokenStream.LA(0) === Tokens.COMMA) {\n                            functionText += tokenStream.token().value;\n                        }\n\n                        tokenStream.match(Tokens.IDENT);\n                        functionText += tokenStream.token().value;\n\n                        tokenStream.match(Tokens.EQUALS);\n                        functionText += tokenStream.token().value;\n                        lt = tokenStream.peek();\n                        while (lt !== Tokens.COMMA && lt !== Tokens.S && lt !== Tokens.RPAREN) {\n                            tokenStream.get();\n                            functionText += tokenStream.token().value;\n                            lt = tokenStream.peek();\n                        }\n                    } while (tokenStream.match([Tokens.COMMA, Tokens.S]));\n\n                    tokenStream.match(Tokens.RPAREN);\n                    functionText += \")\";\n                    this._readWhitespace();\n                }\n\n                return functionText;\n            },\n\n            _hexcolor: function() {\n\n                var tokenStream = this._tokenStream,\n                    token = null,\n                    color;\n\n                if (tokenStream.match(Tokens.HASH)) {\n\n                    token = tokenStream.token();\n                    color = token.value;\n                    if (!/#[a-f0-9]{3,6}/i.test(color)) {\n                        throw new SyntaxError(\"Expected a hex color but found '\" + color + \"' at line \" + token.startLine + \", col \" + token.startCol + \".\", token.startLine, token.startCol);\n                    }\n                    this._readWhitespace();\n                }\n\n                return token;\n            },\n\n            _keyframes: function() {\n                var tokenStream = this._tokenStream,\n                    token,\n                    tt,\n                    name,\n                    prefix = \"\";\n\n                tokenStream.mustMatch(Tokens.KEYFRAMES_SYM);\n                token = tokenStream.token();\n                if (/^@-([^-]+)-/.test(token.value)) {\n                    prefix = RegExp.$1;\n                }\n\n                this._readWhitespace();\n                name = this._keyframe_name();\n\n                this._readWhitespace();\n                tokenStream.mustMatch(Tokens.LBRACE);\n\n                this.fire({\n                    type:   \"startkeyframes\",\n                    name:   name,\n                    prefix: prefix,\n                    line:   token.startLine,\n                    col:    token.startCol\n                });\n\n                this._readWhitespace();\n                tt = tokenStream.peek();\n                while (tt === Tokens.IDENT || tt === Tokens.PERCENTAGE) {\n                    this._keyframe_rule();\n                    this._readWhitespace();\n                    tt = tokenStream.peek();\n                }\n\n                this.fire({\n                    type:   \"endkeyframes\",\n                    name:   name,\n                    prefix: prefix,\n                    line:   token.startLine,\n                    col:    token.startCol\n                });\n\n                this._readWhitespace();\n                tokenStream.mustMatch(Tokens.RBRACE);\n                this._readWhitespace();\n\n            },\n\n            _keyframe_name: function() {\n                var tokenStream = this._tokenStream;\n\n                tokenStream.mustMatch([Tokens.IDENT, Tokens.STRING]);\n                return SyntaxUnit.fromToken(tokenStream.token());\n            },\n\n            _keyframe_rule: function() {\n                var keyList = this._key_list();\n\n                this.fire({\n                    type:   \"startkeyframerule\",\n                    keys:   keyList,\n                    line:   keyList[0].line,\n                    col:    keyList[0].col\n                });\n\n                this._readDeclarations(true);\n\n                this.fire({\n                    type:   \"endkeyframerule\",\n                    keys:   keyList,\n                    line:   keyList[0].line,\n                    col:    keyList[0].col\n                });\n\n            },\n\n            _key_list: function() {\n                var tokenStream = this._tokenStream,\n                    keyList = [];\n                keyList.push(this._key());\n\n                this._readWhitespace();\n\n                while (tokenStream.match(Tokens.COMMA)) {\n                    this._readWhitespace();\n                    keyList.push(this._key());\n                    this._readWhitespace();\n                }\n\n                return keyList;\n            },\n\n            _key: function() {\n\n                var tokenStream = this._tokenStream,\n                    token;\n\n                if (tokenStream.match(Tokens.PERCENTAGE)) {\n                    return SyntaxUnit.fromToken(tokenStream.token());\n                } else if (tokenStream.match(Tokens.IDENT)) {\n                    token = tokenStream.token();\n\n                    if (/from|to/i.test(token.value)) {\n                        return SyntaxUnit.fromToken(token);\n                    }\n\n                    tokenStream.unget();\n                }\n                this._unexpectedToken(tokenStream.LT(1));\n            },\n            _skipCruft: function() {\n                while (this._tokenStream.match([Tokens.S, Tokens.CDO, Tokens.CDC])) {\n                }\n            },\n            _readDeclarations: function(checkStart, readMargins) {\n                var tokenStream = this._tokenStream,\n                    tt;\n\n\n                this._readWhitespace();\n\n                if (checkStart) {\n                    tokenStream.mustMatch(Tokens.LBRACE);\n                }\n\n                this._readWhitespace();\n\n                try {\n\n                    while (true) {\n\n                        if (tokenStream.match(Tokens.SEMICOLON) || (readMargins && this._margin())) {\n                        } else if (this._declaration()) {\n                            if (!tokenStream.match(Tokens.SEMICOLON)) {\n                                break;\n                            }\n                        } else {\n                            break;\n                        }\n                        this._readWhitespace();\n                    }\n\n                    tokenStream.mustMatch(Tokens.RBRACE);\n                    this._readWhitespace();\n\n                } catch (ex) {\n                    if (ex instanceof SyntaxError && !this.options.strict) {\n                        this.fire({\n                            type:       \"error\",\n                            error:      ex,\n                            message:    ex.message,\n                            line:       ex.line,\n                            col:        ex.col\n                        });\n                        tt = tokenStream.advance([Tokens.SEMICOLON, Tokens.RBRACE]);\n                        if (tt === Tokens.SEMICOLON) {\n                            this._readDeclarations(false, readMargins);\n                        } else if (tt !== Tokens.EOF && tt !== Tokens.RBRACE) {\n                            throw ex;\n                        }\n\n                    } else {\n                        throw ex;\n                    }\n                }\n\n            },\n            _readWhitespace: function() {\n\n                var tokenStream = this._tokenStream,\n                    ws = \"\";\n\n                while (tokenStream.match(Tokens.S)) {\n                    ws += tokenStream.token().value;\n                }\n\n                return ws;\n            },\n            _unexpectedToken: function(token) {\n                throw new SyntaxError(\"Unexpected token '\" + token.value + \"' at line \" + token.startLine + \", col \" + token.startCol + \".\", token.startLine, token.startCol);\n            },\n            _verifyEnd: function() {\n                if (this._tokenStream.LA(1) !== Tokens.EOF) {\n                    this._unexpectedToken(this._tokenStream.LT(1));\n                }\n            },\n            _validateProperty: function(property, value) {\n                Validation.validate(property, value);\n            },\n\n            parse: function(input) {\n                this._tokenStream = new TokenStream(input, Tokens);\n                this._stylesheet();\n            },\n\n            parseStyleSheet: function(input) {\n                return this.parse(input);\n            },\n\n            parseMediaQuery: function(input) {\n                this._tokenStream = new TokenStream(input, Tokens);\n                var result = this._media_query();\n                this._verifyEnd();\n                return result;\n            },\n            parsePropertyValue: function(input) {\n\n                this._tokenStream = new TokenStream(input, Tokens);\n                this._readWhitespace();\n\n                var result = this._expr();\n                this._readWhitespace();\n                this._verifyEnd();\n                return result;\n            },\n            parseRule: function(input) {\n                this._tokenStream = new TokenStream(input, Tokens);\n                this._readWhitespace();\n\n                var result = this._ruleset();\n                this._readWhitespace();\n                this._verifyEnd();\n                return result;\n            },\n            parseSelector: function(input) {\n\n                this._tokenStream = new TokenStream(input, Tokens);\n                this._readWhitespace();\n\n                var result = this._selector();\n                this._readWhitespace();\n                this._verifyEnd();\n                return result;\n            },\n            parseStyleAttribute: function(input) {\n                input += \"}\";   // for error recovery in _readDeclarations()\n                this._tokenStream = new TokenStream(input, Tokens);\n                this._readDeclarations();\n            }\n        };\n    for (prop in additions) {\n        if (Object.prototype.hasOwnProperty.call(additions, prop)) {\n            proto[prop] = additions[prop];\n        }\n    }\n\n    return proto;\n}();\n\n},{\"../util/EventTarget\":23,\"../util/SyntaxError\":25,\"../util/SyntaxUnit\":26,\"./Combinator\":2,\"./MediaFeature\":4,\"./MediaQuery\":5,\"./PropertyName\":8,\"./PropertyValue\":9,\"./PropertyValuePart\":11,\"./Selector\":13,\"./SelectorPart\":14,\"./SelectorSubPart\":15,\"./TokenStream\":17,\"./Tokens\":18,\"./Validation\":19}],7:[function(require,module,exports){\n\n\"use strict\";\n\nvar Properties = module.exports = {\n    __proto__: null,\n    \"align-items\"                       : \"flex-start | flex-end | center | baseline | stretch\",\n    \"align-content\"                     : \"flex-start | flex-end | center | space-between | space-around | stretch\",\n    \"align-self\"                        : \"auto | flex-start | flex-end | center | baseline | stretch\",\n    \"all\"                               : \"initial | inherit | unset\",\n    \"-webkit-align-items\"               : \"flex-start | flex-end | center | baseline | stretch\",\n    \"-webkit-align-content\"             : \"flex-start | flex-end | center | space-between | space-around | stretch\",\n    \"-webkit-align-self\"                : \"auto | flex-start | flex-end | center | baseline | stretch\",\n    \"alignment-adjust\"                  : \"auto | baseline | before-edge | text-before-edge | middle | central | after-edge | text-after-edge | ideographic | alphabetic | hanging | mathematical |  | \",\n    \"alignment-baseline\"                : \"auto | baseline | use-script | before-edge | text-before-edge | after-edge | text-after-edge | central | middle | ideographic | alphabetic | hanging | mathematical\",\n    \"animation\"                         : 1,\n    \"animation-delay\"                   : \"




© 2015 - 2024 Weber Informatics LLC | Privacy Policy