mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-20 05:05:38 +00:00
86c59bf3c6
* CLICKHOUSE-4063: less manual html @ index.md * CLICKHOUSE-4063: recommend markdown="1" in README.md * CLICKHOUSE-4003: manually purge custom.css for now * CLICKHOUSE-4064: expand <details> before any print (including to pdf) * CLICKHOUSE-3927: rearrange interfaces/formats.md a bit * CLICKHOUSE-3306: add few http headers * Remove copy-paste introduced in #3392 * Hopefully better chinese fonts #3392 * get rid of tabs @ custom.css * Apply comments and patch from #3384 * Add jdbc.md to ToC and some translation, though it still looks badly incomplete * minor punctuation * Add some backlinks to official website from mirrors that just blindly take markdown sources * Do not make fonts extra light * find . -name '*.md' -type f | xargs -I{} perl -pi -e 's//g' {} * find . -name '*.md' -type f | xargs -I{} perl -pi -e 's/ sql/g' {} * Remove outdated stuff from roadmap.md * Not so light font on front page too * Refactor Chinese formats.md to match recent changes in other languages * Update some links on front page * Remove some outdated comment * Add twitter link to front page * More front page links tuning * Add Amsterdam meetup link * Smaller font to avoid second line * Add Amsterdam link to README.md * Proper docs nav translation * Back to 300 font-weight except Chinese * fix docs build * Update Amsterdam link * remove symlinks * more zh punctuation * apply lost comment by @zhang2014 * Apply comments by @zhang2014 from #3417 * Remove Beijing link * rm incorrect symlink * restore content of docs/zh/operations/table_engines/index.md * CLICKHOUSE-3751: stem terms while searching docs * CLICKHOUSE-3751: use English stemmer in non-English docs too * CLICKHOUSE-4135 fix
8986 lines
759 KiB
JavaScript
8986 lines
759 KiB
JavaScript
(function(e, a) { for(var i in a) e[i] = a[i]; }(window, /******/ (function(modules) { // webpackBootstrap
|
||
/******/ // The module cache
|
||
/******/ var installedModules = {};
|
||
/******/
|
||
/******/ // The require function
|
||
/******/ function __webpack_require__(moduleId) {
|
||
/******/
|
||
/******/ // Check if module is in cache
|
||
/******/ if(installedModules[moduleId]) {
|
||
/******/ return installedModules[moduleId].exports;
|
||
/******/ }
|
||
/******/ // Create a new module (and put it into the cache)
|
||
/******/ var module = installedModules[moduleId] = {
|
||
/******/ i: moduleId,
|
||
/******/ l: false,
|
||
/******/ exports: {}
|
||
/******/ };
|
||
/******/
|
||
/******/ // Execute the module function
|
||
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
||
/******/
|
||
/******/ // Flag the module as loaded
|
||
/******/ module.l = true;
|
||
/******/
|
||
/******/ // Return the exports of the module
|
||
/******/ return module.exports;
|
||
/******/ }
|
||
/******/
|
||
/******/
|
||
/******/ // expose the modules object (__webpack_modules__)
|
||
/******/ __webpack_require__.m = modules;
|
||
/******/
|
||
/******/ // expose the module cache
|
||
/******/ __webpack_require__.c = installedModules;
|
||
/******/
|
||
/******/ // define getter function for harmony exports
|
||
/******/ __webpack_require__.d = function(exports, name, getter) {
|
||
/******/ if(!__webpack_require__.o(exports, name)) {
|
||
/******/ Object.defineProperty(exports, name, {
|
||
/******/ configurable: false,
|
||
/******/ enumerable: true,
|
||
/******/ get: getter
|
||
/******/ });
|
||
/******/ }
|
||
/******/ };
|
||
/******/
|
||
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
||
/******/ __webpack_require__.n = function(module) {
|
||
/******/ var getter = module && module.__esModule ?
|
||
/******/ function getDefault() { return module['default']; } :
|
||
/******/ function getModuleExports() { return module; };
|
||
/******/ __webpack_require__.d(getter, 'a', getter);
|
||
/******/ return getter;
|
||
/******/ };
|
||
/******/
|
||
/******/ // Object.prototype.hasOwnProperty.call
|
||
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
||
/******/
|
||
/******/ // __webpack_public_path__
|
||
/******/ __webpack_require__.p = "";
|
||
/******/
|
||
/******/ // Load entry module and return exports
|
||
/******/ return __webpack_require__(__webpack_require__.s = 6);
|
||
/******/ })
|
||
/************************************************************************/
|
||
/******/ ([
|
||
/* 0 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
|
||
exports.__esModule = true;
|
||
/*
|
||
* Copyright (c) 2016-2018 Martin Donath <martin.donath@squidfunk.com>
|
||
*
|
||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||
* of this software and associated documentation files (the "Software"), to
|
||
* deal in the Software without restriction, including without limitation the
|
||
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||
* sell copies of the Software, and to permit persons to whom the Software is
|
||
* furnished to do so, subject to the following conditions:
|
||
*
|
||
* The above copyright notice and this permission notice shall be included in
|
||
* all copies or substantial portions of the Software.
|
||
*
|
||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||
* IN THE SOFTWARE.
|
||
*/
|
||
|
||
/* ----------------------------------------------------------------------------
|
||
* Module
|
||
* ------------------------------------------------------------------------- */
|
||
|
||
/* eslint-disable no-underscore-dangle */
|
||
exports.default = /* JSX */{
|
||
|
||
/**
|
||
* Create a native DOM node from JSX's intermediate representation
|
||
*
|
||
* @param {string} tag - Tag name
|
||
* @param {?Object} properties - Properties
|
||
* @param {Array<string | number | { __html: string } | Array<HTMLElement>>}
|
||
* children - Child nodes
|
||
* @return {HTMLElement} Native DOM node
|
||
*/
|
||
createElement: function createElement(tag, properties) {
|
||
var el = document.createElement(tag);
|
||
|
||
/* Set all properties */
|
||
if (properties) Array.prototype.forEach.call(Object.keys(properties), function (attr) {
|
||
el.setAttribute(attr, properties[attr]);
|
||
});
|
||
|
||
/* Iterate child nodes */
|
||
var iterateChildNodes = function iterateChildNodes(nodes) {
|
||
Array.prototype.forEach.call(nodes, function (node) {
|
||
|
||
/* Directly append text content */
|
||
if (typeof node === "string" || typeof node === "number") {
|
||
el.textContent += node;
|
||
|
||
/* Recurse, if we got an array */
|
||
} else if (Array.isArray(node)) {
|
||
iterateChildNodes(node);
|
||
|
||
/* Append raw HTML */
|
||
} else if (typeof node.__html !== "undefined") {
|
||
el.innerHTML += node.__html;
|
||
|
||
/* Append regular nodes */
|
||
} else if (node instanceof Node) {
|
||
el.appendChild(node);
|
||
}
|
||
});
|
||
};
|
||
|
||
/* Iterate child nodes and return element */
|
||
|
||
for (var _len = arguments.length, children = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
||
children[_key - 2] = arguments[_key];
|
||
}
|
||
|
||
iterateChildNodes(children);
|
||
return el;
|
||
}
|
||
};
|
||
module.exports = exports.default;
|
||
|
||
/***/ }),
|
||
/* 1 */
|
||
/***/ (function(module, exports) {
|
||
|
||
var g;
|
||
|
||
// This works in non-strict mode
|
||
g = (function() {
|
||
return this;
|
||
})();
|
||
|
||
try {
|
||
// This works if eval is allowed (see CSP)
|
||
g = g || Function("return this")() || (1,eval)("this");
|
||
} catch(e) {
|
||
// This works if the window reference is available
|
||
if(typeof window === "object")
|
||
g = window;
|
||
}
|
||
|
||
// g can still be undefined, but nothing to do about it...
|
||
// We return undefined, instead of nothing here, so it's
|
||
// easier to handle this case. if(!global) { ...}
|
||
|
||
module.exports = g;
|
||
|
||
|
||
/***/ }),
|
||
/* 2 */
|
||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||
|
||
"use strict";
|
||
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
|
||
var index = typeof fetch=='function' ? fetch.bind() : function(url, options) {
|
||
options = options || {};
|
||
return new Promise( function (resolve, reject) {
|
||
var request = new XMLHttpRequest();
|
||
|
||
request.open(options.method || 'get', url);
|
||
|
||
for (var i in options.headers) {
|
||
request.setRequestHeader(i, options.headers[i]);
|
||
}
|
||
|
||
request.withCredentials = options.credentials=='include';
|
||
|
||
request.onload = function () {
|
||
resolve(response());
|
||
};
|
||
|
||
request.onerror = reject;
|
||
|
||
request.send(options.body);
|
||
|
||
function response() {
|
||
var keys = [],
|
||
all = [],
|
||
headers = {},
|
||
header;
|
||
|
||
request.getAllResponseHeaders().replace(/^(.*?):\s*([\s\S]*?)$/gm, function (m, key, value) {
|
||
keys.push(key = key.toLowerCase());
|
||
all.push([key, value]);
|
||
header = headers[key];
|
||
headers[key] = header ? (header + "," + value) : value;
|
||
});
|
||
|
||
return {
|
||
ok: (request.status/200|0) == 1, // 200-299
|
||
status: request.status,
|
||
statusText: request.statusText,
|
||
url: request.responseURL,
|
||
clone: response,
|
||
text: function () { return Promise.resolve(request.responseText); },
|
||
json: function () { return Promise.resolve(request.responseText).then(JSON.parse); },
|
||
blob: function () { return Promise.resolve(new Blob([request.response])); },
|
||
headers: {
|
||
keys: function () { return keys; },
|
||
entries: function () { return all; },
|
||
get: function (n) { return headers[n.toLowerCase()]; },
|
||
has: function (n) { return n.toLowerCase() in headers; }
|
||
}
|
||
};
|
||
}
|
||
});
|
||
};
|
||
|
||
/* harmony default export */ __webpack_exports__["default"] = (index);
|
||
//# sourceMappingURL=unfetch.es.js.map
|
||
|
||
|
||
/***/ }),
|
||
/* 3 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
|
||
exports.__esModule = true;
|
||
|
||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||
|
||
/*
|
||
* Copyright (c) 2016-2018 Martin Donath <martin.donath@squidfunk.com>
|
||
*
|
||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||
* of this software and associated documentation files (the "Software"), to
|
||
* deal in the Software without restriction, including without limitation the
|
||
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||
* sell copies of the Software, and to permit persons to whom the Software is
|
||
* furnished to do so, subject to the following conditions:
|
||
*
|
||
* The above copyright notice and this permission notice shall be included in
|
||
* all copies or substantial portions of the Software.
|
||
*
|
||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||
* IN THE SOFTWARE.
|
||
*/
|
||
|
||
/* ----------------------------------------------------------------------------
|
||
* Class
|
||
* ------------------------------------------------------------------------- */
|
||
|
||
var Listener = function () {
|
||
|
||
/**
|
||
* Generic event listener
|
||
*
|
||
* @constructor
|
||
*
|
||
* @property {(Array<EventTarget>)} els_ - Event targets
|
||
* @property {Object} handler_- Event handlers
|
||
* @property {Array<string>} events_ - Event names
|
||
* @property {Function} update_ - Update handler
|
||
*
|
||
* @param {?(string|EventTarget|NodeList<EventTarget>)} els -
|
||
* Selector or Event targets
|
||
* @param {(string|Array<string>)} events - Event names
|
||
* @param {(Object|Function)} handler - Handler to be invoked
|
||
*/
|
||
function Listener(els, events, handler) {
|
||
var _this = this;
|
||
|
||
_classCallCheck(this, Listener);
|
||
|
||
this.els_ = Array.prototype.slice.call(typeof els === "string" ? document.querySelectorAll(els) : [].concat(els));
|
||
|
||
/* Set handler as function or directly as object */
|
||
this.handler_ = typeof handler === "function" ? { update: handler } : handler;
|
||
|
||
/* Initialize event names and update handler */
|
||
this.events_ = [].concat(events);
|
||
this.update_ = function (ev) {
|
||
return _this.handler_.update(ev);
|
||
};
|
||
}
|
||
|
||
/**
|
||
* Register listener for all relevant events
|
||
*/
|
||
|
||
|
||
Listener.prototype.listen = function listen() {
|
||
var _this2 = this;
|
||
|
||
this.els_.forEach(function (el) {
|
||
_this2.events_.forEach(function (event) {
|
||
el.addEventListener(event, _this2.update_, false);
|
||
});
|
||
});
|
||
|
||
/* Execute setup handler, if implemented */
|
||
if (typeof this.handler_.setup === "function") this.handler_.setup();
|
||
};
|
||
|
||
/**
|
||
* Unregister listener for all relevant events
|
||
*/
|
||
|
||
|
||
Listener.prototype.unlisten = function unlisten() {
|
||
var _this3 = this;
|
||
|
||
this.els_.forEach(function (el) {
|
||
_this3.events_.forEach(function (event) {
|
||
el.removeEventListener(event, _this3.update_);
|
||
});
|
||
});
|
||
|
||
/* Execute reset handler, if implemented */
|
||
if (typeof this.handler_.reset === "function") this.handler_.reset();
|
||
};
|
||
|
||
return Listener;
|
||
}();
|
||
|
||
exports.default = Listener;
|
||
|
||
/***/ }),
|
||
/* 4 */,
|
||
/* 5 */,
|
||
/* 6 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
/* WEBPACK VAR INJECTION */(function(JSX) {
|
||
|
||
exports.__esModule = true;
|
||
exports.app = undefined;
|
||
|
||
__webpack_require__(7);
|
||
|
||
__webpack_require__(8);
|
||
|
||
__webpack_require__(9);
|
||
|
||
__webpack_require__(10);
|
||
|
||
__webpack_require__(11);
|
||
|
||
__webpack_require__(12);
|
||
|
||
__webpack_require__(13);
|
||
|
||
var _promisePolyfill = __webpack_require__(14);
|
||
|
||
var _promisePolyfill2 = _interopRequireDefault(_promisePolyfill);
|
||
|
||
var _clipboard = __webpack_require__(19);
|
||
|
||
var _clipboard2 = _interopRequireDefault(_clipboard);
|
||
|
||
var _fastclick = __webpack_require__(20);
|
||
|
||
var _fastclick2 = _interopRequireDefault(_fastclick);
|
||
|
||
var _Material = __webpack_require__(21);
|
||
|
||
var _Material2 = _interopRequireDefault(_Material);
|
||
|
||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||
|
||
/*
|
||
* Copyright (c) 2016-2018 Martin Donath <martin.donath@squidfunk.com>
|
||
*
|
||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||
* of this software and associated documentation files (the "Software"), to
|
||
* deal in the Software without restriction, including without limitation the
|
||
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||
* sell copies of the Software, and to permit persons to whom the Software is
|
||
* furnished to do so, subject to the following conditions:
|
||
*
|
||
* The above copyright notice and this permission notice shall be included in
|
||
* all copies or substantial portions of the Software.
|
||
*
|
||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||
* IN THE SOFTWARE.
|
||
*/
|
||
|
||
window.Promise = window.Promise || _promisePolyfill2.default;
|
||
|
||
/* ----------------------------------------------------------------------------
|
||
* Dependencies
|
||
* ------------------------------------------------------------------------- */
|
||
|
||
/* ----------------------------------------------------------------------------
|
||
* Polyfills
|
||
* ------------------------------------------------------------------------- */
|
||
|
||
/* ----------------------------------------------------------------------------
|
||
* Functions
|
||
* ------------------------------------------------------------------------- */
|
||
|
||
/**
|
||
* Return the meta tag value for the given key
|
||
*
|
||
* @param {string} key - Meta name
|
||
*
|
||
* @return {string} Meta content value
|
||
*/
|
||
var translate = function translate(key) {
|
||
var meta = document.getElementsByName("lang:" + key)[0];
|
||
if (!(meta instanceof HTMLMetaElement)) throw new ReferenceError();
|
||
return meta.content;
|
||
};
|
||
|
||
/* ----------------------------------------------------------------------------
|
||
* Application
|
||
* ------------------------------------------------------------------------- */
|
||
|
||
/**
|
||
* Initialize Material for MkDocs
|
||
*
|
||
* @param {Object} config - Configuration
|
||
*/
|
||
function initialize(config) {
|
||
// eslint-disable-line func-style
|
||
|
||
/* Initialize Modernizr and FastClick */
|
||
new _Material2.default.Event.Listener(document, "DOMContentLoaded", function () {
|
||
if (!(document.body instanceof HTMLElement)) throw new ReferenceError();
|
||
|
||
/* Attach FastClick to mitigate 300ms delay on touch devices */
|
||
_fastclick2.default.attach(document.body);
|
||
|
||
/* Test for iOS */
|
||
Modernizr.addTest("ios", function () {
|
||
return !!navigator.userAgent.match(/(iPad|iPhone|iPod)/g);
|
||
});
|
||
|
||
/* Wrap all data tables for better overflow scrolling */
|
||
var tables = document.querySelectorAll("table:not([class])"); // TODO: this is JSX, we should rename the file
|
||
Array.prototype.forEach.call(tables, function (table) {
|
||
var wrap = JSX.createElement(
|
||
"div",
|
||
{ "class": "md-typeset__scrollwrap" },
|
||
JSX.createElement("div", { "class": "md-typeset__table" })
|
||
);
|
||
if (table.nextSibling) {
|
||
table.parentNode.insertBefore(wrap, table.nextSibling);
|
||
} else {
|
||
table.parentNode.appendChild(wrap);
|
||
}
|
||
wrap.children[0].appendChild(table);
|
||
});
|
||
|
||
/* Clipboard integration */
|
||
if (_clipboard2.default.isSupported()) {
|
||
var blocks = document.querySelectorAll(".codehilite > pre, pre > code");
|
||
Array.prototype.forEach.call(blocks, function (block, index) {
|
||
var id = "__code_" + index;
|
||
|
||
/* Create button with message container */
|
||
var button = JSX.createElement(
|
||
"button",
|
||
{ "class": "md-clipboard", title: translate("clipboard.copy"),
|
||
"data-clipboard-target": "#" + id + " pre, #" + id + " code" },
|
||
JSX.createElement("span", { "class": "md-clipboard__message" })
|
||
);
|
||
|
||
/* Link to block and insert button */
|
||
var parent = block.parentNode;
|
||
parent.id = id;
|
||
parent.insertBefore(button, block);
|
||
});
|
||
|
||
/* Initialize Clipboard listener */
|
||
var copy = new _clipboard2.default(".md-clipboard");
|
||
|
||
/* Success handler */
|
||
copy.on("success", function (action) {
|
||
var message = action.trigger.querySelector(".md-clipboard__message");
|
||
if (!(message instanceof HTMLElement)) throw new ReferenceError();
|
||
|
||
/* Clear selection and reset debounce logic */
|
||
action.clearSelection();
|
||
if (message.dataset.mdTimer) clearTimeout(parseInt(message.dataset.mdTimer, 10));
|
||
|
||
/* Set message indicating success and show it */
|
||
message.classList.add("md-clipboard__message--active");
|
||
message.innerHTML = translate("clipboard.copied");
|
||
|
||
/* Hide message after two seconds */
|
||
message.dataset.mdTimer = setTimeout(function () {
|
||
message.classList.remove("md-clipboard__message--active");
|
||
message.dataset.mdTimer = "";
|
||
}, 2000).toString();
|
||
});
|
||
}
|
||
|
||
/* Polyfill details/summary functionality */
|
||
if (!Modernizr.details) {
|
||
var _blocks = document.querySelectorAll("details > summary");
|
||
Array.prototype.forEach.call(_blocks, function (summary) {
|
||
summary.addEventListener("click", function (ev) {
|
||
var details = ev.target.parentNode;
|
||
if (details.hasAttribute("open")) {
|
||
details.removeAttribute("open");
|
||
} else {
|
||
details.setAttribute("open", "");
|
||
}
|
||
});
|
||
});
|
||
}
|
||
|
||
/* Open details after anchor jump */
|
||
var details = function details() {
|
||
if (document.location.hash) {
|
||
var el = document.getElementById(document.location.hash.substring(1));
|
||
if (!el) return;
|
||
|
||
/* Walk up as long as we're not in a details tag */
|
||
var parent = el.parentNode;
|
||
while (parent && !(parent instanceof HTMLDetailsElement)) {
|
||
parent = parent.parentNode;
|
||
} /* If there's a details tag, open it */
|
||
if (parent && !parent.open) {
|
||
parent.open = true;
|
||
|
||
/* Force reload, so the viewport repositions */
|
||
var loc = location.hash;
|
||
location.hash = " ";
|
||
location.hash = loc;
|
||
}
|
||
}
|
||
};
|
||
window.addEventListener("hashchange", details);
|
||
details();
|
||
|
||
/* Force 1px scroll offset to trigger overflow scrolling */
|
||
if (Modernizr.ios) {
|
||
var scrollable = document.querySelectorAll("[data-md-scrollfix]");
|
||
Array.prototype.forEach.call(scrollable, function (item) {
|
||
item.addEventListener("touchstart", function () {
|
||
var top = item.scrollTop;
|
||
|
||
/* We're at the top of the container */
|
||
if (top === 0) {
|
||
item.scrollTop = 1;
|
||
|
||
/* We're at the bottom of the container */
|
||
} else if (top + item.offsetHeight === item.scrollHeight) {
|
||
item.scrollTop = top - 1;
|
||
}
|
||
});
|
||
});
|
||
}
|
||
}).listen();
|
||
|
||
/* Component: header shadow toggle */
|
||
new _Material2.default.Event.Listener(window, ["scroll", "resize", "orientationchange"], new _Material2.default.Header.Shadow("[data-md-component=container]", "[data-md-component=header]")).listen();
|
||
|
||
/* Component: header title toggle */
|
||
new _Material2.default.Event.Listener(window, ["scroll", "resize", "orientationchange"], new _Material2.default.Header.Title("[data-md-component=title]", ".md-typeset h1")).listen();
|
||
|
||
/* Component: hero visibility toggle */
|
||
if (document.querySelector("[data-md-component=hero]")) new _Material2.default.Event.Listener(window, ["scroll", "resize", "orientationchange"], new _Material2.default.Tabs.Toggle("[data-md-component=hero]")).listen();
|
||
|
||
/* Component: tabs visibility toggle */
|
||
if (document.querySelector("[data-md-component=tabs]")) new _Material2.default.Event.Listener(window, ["scroll", "resize", "orientationchange"], new _Material2.default.Tabs.Toggle("[data-md-component=tabs]")).listen();
|
||
|
||
/* Component: sidebar with navigation */
|
||
new _Material2.default.Event.MatchMedia("(min-width: 1220px)", new _Material2.default.Event.Listener(window, ["scroll", "resize", "orientationchange"], new _Material2.default.Sidebar.Position("[data-md-component=navigation]", "[data-md-component=header]")));
|
||
|
||
/* Component: sidebar with table of contents (missing on 404 page) */
|
||
if (document.querySelector("[data-md-component=toc]")) new _Material2.default.Event.MatchMedia("(min-width: 960px)", new _Material2.default.Event.Listener(window, ["scroll", "resize", "orientationchange"], new _Material2.default.Sidebar.Position("[data-md-component=toc]", "[data-md-component=header]")));
|
||
|
||
/* Component: link blurring for table of contents */
|
||
new _Material2.default.Event.MatchMedia("(min-width: 960px)", new _Material2.default.Event.Listener(window, "scroll", new _Material2.default.Nav.Blur("[data-md-component=toc] [href]")));
|
||
|
||
/* Component: collapsible elements for navigation */
|
||
var collapsibles = document.querySelectorAll("[data-md-component=collapsible]");
|
||
Array.prototype.forEach.call(collapsibles, function (collapse) {
|
||
new _Material2.default.Event.MatchMedia("(min-width: 1220px)", new _Material2.default.Event.Listener(collapse.previousElementSibling, "click", new _Material2.default.Nav.Collapse(collapse)));
|
||
});
|
||
|
||
/* Component: active pane monitor for iOS scrolling fixes */
|
||
new _Material2.default.Event.MatchMedia("(max-width: 1219px)", new _Material2.default.Event.Listener("[data-md-component=navigation] [data-md-toggle]", "change", new _Material2.default.Nav.Scrolling("[data-md-component=navigation] nav")));
|
||
|
||
/* Initialize search, if available */
|
||
if (document.querySelector("[data-md-component=search]")) {
|
||
|
||
/* Component: search body lock for mobile */
|
||
new _Material2.default.Event.MatchMedia("(max-width: 959px)", new _Material2.default.Event.Listener("[data-md-toggle=search]", "change", new _Material2.default.Search.Lock("[data-md-toggle=search]")));
|
||
|
||
/* Component: search results */
|
||
new _Material2.default.Event.Listener("[data-md-component=query]", ["focus", "keyup", "change"], new _Material2.default.Search.Result("[data-md-component=result]", function () {
|
||
return fetch(config.url.base + "/" + (config.version < "0.17" ? "mkdocs" : "search") + "/search_index.json", {
|
||
credentials: "same-origin"
|
||
}).then(function (response) {
|
||
return response.json();
|
||
}).then(function (data) {
|
||
return data.docs.map(function (doc) {
|
||
doc.location = config.url.base + "/" + doc.location;
|
||
return doc;
|
||
});
|
||
});
|
||
})).listen();
|
||
|
||
/* Listener: focus input after form reset */
|
||
new _Material2.default.Event.Listener("[data-md-component=reset]", "click", function () {
|
||
setTimeout(function () {
|
||
var query = document.querySelector("[data-md-component=query]");
|
||
if (!(query instanceof HTMLInputElement)) throw new ReferenceError();
|
||
query.focus();
|
||
}, 10);
|
||
}).listen();
|
||
|
||
/* Listener: focus input after opening search */
|
||
new _Material2.default.Event.Listener("[data-md-toggle=search]", "change", function (ev) {
|
||
setTimeout(function (toggle) {
|
||
if (!(toggle instanceof HTMLInputElement)) throw new ReferenceError();
|
||
if (toggle.checked) {
|
||
var query = document.querySelector("[data-md-component=query]");
|
||
if (!(query instanceof HTMLInputElement)) throw new ReferenceError();
|
||
query.focus();
|
||
}
|
||
}, 400, ev.target);
|
||
}).listen();
|
||
|
||
/* Listener: open search on focus */
|
||
new _Material2.default.Event.MatchMedia("(min-width: 960px)", new _Material2.default.Event.Listener("[data-md-component=query]", "focus", function () {
|
||
var toggle = document.querySelector("[data-md-toggle=search]");
|
||
if (!(toggle instanceof HTMLInputElement)) throw new ReferenceError();
|
||
if (!toggle.checked) {
|
||
toggle.checked = true;
|
||
toggle.dispatchEvent(new CustomEvent("change"));
|
||
}
|
||
}));
|
||
|
||
/* Listener: keyboard handlers */ // eslint-disable-next-line complexity
|
||
new _Material2.default.Event.Listener(window, "keydown", function (ev) {
|
||
// TODO: split up into component to reduce complexity
|
||
var toggle = document.querySelector("[data-md-toggle=search]");
|
||
if (!(toggle instanceof HTMLInputElement)) throw new ReferenceError();
|
||
var query = document.querySelector("[data-md-component=query]");
|
||
if (!(query instanceof HTMLInputElement)) throw new ReferenceError();
|
||
|
||
/* Abort if meta key (macOS) or ctrl key (Windows) is pressed */
|
||
if (ev.metaKey || ev.ctrlKey) return;
|
||
|
||
/* Search is open */
|
||
if (toggle.checked) {
|
||
|
||
/* Enter: prevent form submission */
|
||
if (ev.keyCode === 13) {
|
||
if (query === document.activeElement) {
|
||
ev.preventDefault();
|
||
|
||
/* Go to current active/focused link */
|
||
var focus = document.querySelector("[data-md-component=search] [href][data-md-state=active]");
|
||
if (focus instanceof HTMLLinkElement) {
|
||
window.location = focus.getAttribute("href");
|
||
|
||
/* Close search */
|
||
toggle.checked = false;
|
||
toggle.dispatchEvent(new CustomEvent("change"));
|
||
query.blur();
|
||
}
|
||
}
|
||
|
||
/* Escape or Tab: close search */
|
||
} else if (ev.keyCode === 9 || ev.keyCode === 27) {
|
||
toggle.checked = false;
|
||
toggle.dispatchEvent(new CustomEvent("change"));
|
||
query.blur();
|
||
|
||
/* Horizontal arrows and backspace: focus input */
|
||
} else if ([8, 37, 39].indexOf(ev.keyCode) !== -1) {
|
||
if (query !== document.activeElement) query.focus();
|
||
|
||
/* Vertical arrows: select previous or next search result */
|
||
} else if ([38, 40].indexOf(ev.keyCode) !== -1) {
|
||
var key = ev.keyCode;
|
||
|
||
/* Retrieve all results */
|
||
var links = Array.prototype.slice.call(document.querySelectorAll("[data-md-component=query], [data-md-component=search] [href]"));
|
||
|
||
/* Retrieve current active/focused result */
|
||
var _focus = links.find(function (link) {
|
||
if (!(link instanceof HTMLElement)) throw new ReferenceError();
|
||
return link.dataset.mdState === "active";
|
||
});
|
||
if (_focus) _focus.dataset.mdState = "";
|
||
|
||
/* Calculate index depending on direction, add length to form ring */
|
||
var index = Math.max(0, (links.indexOf(_focus) + links.length + (key === 38 ? -1 : +1)) % links.length);
|
||
|
||
/* Set active state and focus */
|
||
if (links[index]) {
|
||
links[index].dataset.mdState = "active";
|
||
links[index].focus();
|
||
}
|
||
|
||
/* Prevent scrolling of page */
|
||
ev.preventDefault();
|
||
ev.stopPropagation();
|
||
|
||
/* Return false prevents the cursor position from changing */
|
||
return false;
|
||
}
|
||
|
||
/* Search is closed and we're not inside a form */
|
||
} else if (document.activeElement && !document.activeElement.form) {
|
||
|
||
/* F/S: Open search if not in input field */
|
||
if (ev.keyCode === 70 || ev.keyCode === 83) {
|
||
query.focus();
|
||
ev.preventDefault();
|
||
}
|
||
}
|
||
}).listen();
|
||
|
||
/* Listener: focus query if in search is open and character is typed */
|
||
new _Material2.default.Event.Listener(window, "keypress", function () {
|
||
var toggle = document.querySelector("[data-md-toggle=search]");
|
||
if (!(toggle instanceof HTMLInputElement)) throw new ReferenceError();
|
||
if (toggle.checked) {
|
||
var query = document.querySelector("[data-md-component=query]");
|
||
if (!(query instanceof HTMLInputElement)) throw new ReferenceError();
|
||
if (query !== document.activeElement) query.focus();
|
||
}
|
||
}).listen();
|
||
}
|
||
|
||
/* Listener: handle tabbing context for better accessibility */
|
||
new _Material2.default.Event.Listener(document.body, "keydown", function (ev) {
|
||
if (ev.keyCode === 9) {
|
||
var labels = document.querySelectorAll("[data-md-component=navigation] .md-nav__link[for]:not([tabindex])");
|
||
Array.prototype.forEach.call(labels, function (label) {
|
||
if (label.offsetHeight) label.tabIndex = 0;
|
||
});
|
||
}
|
||
}).listen();
|
||
|
||
/* Listener: reset tabbing behavior */
|
||
new _Material2.default.Event.Listener(document.body, "mousedown", function () {
|
||
var labels = document.querySelectorAll("[data-md-component=navigation] .md-nav__link[tabindex]");
|
||
Array.prototype.forEach.call(labels, function (label) {
|
||
label.removeAttribute("tabIndex");
|
||
});
|
||
}).listen();
|
||
|
||
document.body.addEventListener("click", function () {
|
||
if (document.body.dataset.mdState === "tabbing") document.body.dataset.mdState = "";
|
||
});
|
||
|
||
/* Listener: close drawer when anchor links are clicked */
|
||
new _Material2.default.Event.MatchMedia("(max-width: 959px)", new _Material2.default.Event.Listener("[data-md-component=navigation] [href^='#']", "click", function () {
|
||
var toggle = document.querySelector("[data-md-toggle=drawer]");
|
||
if (!(toggle instanceof HTMLInputElement)) throw new ReferenceError();
|
||
if (toggle.checked) {
|
||
toggle.checked = false;
|
||
toggle.dispatchEvent(new CustomEvent("change"));
|
||
}
|
||
}))
|
||
|
||
/* Retrieve facts for the given repository type */
|
||
;(function () {
|
||
var el = document.querySelector("[data-md-source]");
|
||
if (!el) return _promisePolyfill2.default.resolve([]);else if (!(el instanceof HTMLAnchorElement)) throw new ReferenceError();
|
||
switch (el.dataset.mdSource) {
|
||
case "github":
|
||
return new _Material2.default.Source.Adapter.GitHub(el).fetch();
|
||
default:
|
||
return _promisePolyfill2.default.resolve([]);
|
||
}
|
||
|
||
/* Render repository information */
|
||
})().then(function (facts) {
|
||
var sources = document.querySelectorAll("[data-md-source]");
|
||
Array.prototype.forEach.call(sources, function (source) {
|
||
new _Material2.default.Source.Repository(source).initialize(facts);
|
||
});
|
||
});
|
||
}
|
||
|
||
/* ----------------------------------------------------------------------------
|
||
* Exports
|
||
* ------------------------------------------------------------------------- */
|
||
|
||
/* Provide this for downward compatibility for now */
|
||
var app = {
|
||
initialize: initialize
|
||
};
|
||
|
||
exports.app = app;
|
||
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0)))
|
||
|
||
/***/ }),
|
||
/* 7 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
module.exports = __webpack_require__.p + "assets/images/icons/bitbucket.svg";
|
||
|
||
/***/ }),
|
||
/* 8 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
module.exports = __webpack_require__.p + "assets/images/icons/github.svg";
|
||
|
||
/***/ }),
|
||
/* 9 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
module.exports = __webpack_require__.p + "assets/images/icons/gitlab.svg";
|
||
|
||
/***/ }),
|
||
/* 10 */
|
||
/***/ (function(module, exports) {
|
||
|
||
// removed by extract-text-webpack-plugin
|
||
|
||
/***/ }),
|
||
/* 11 */
|
||
/***/ (function(module, exports) {
|
||
|
||
// removed by extract-text-webpack-plugin
|
||
|
||
/***/ }),
|
||
/* 12 */
|
||
/***/ (function(module, exports) {
|
||
|
||
// Polyfill for creating CustomEvents on IE9/10/11
|
||
|
||
// code pulled from:
|
||
// https://github.com/d4tocchini/customevent-polyfill
|
||
// https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent#Polyfill
|
||
|
||
(function() {
|
||
if (typeof window === 'undefined') {
|
||
return;
|
||
}
|
||
|
||
try {
|
||
var ce = new window.CustomEvent('test', { cancelable: true });
|
||
ce.preventDefault();
|
||
if (ce.defaultPrevented !== true) {
|
||
// IE has problems with .preventDefault() on custom events
|
||
// http://stackoverflow.com/questions/23349191
|
||
throw new Error('Could not prevent default');
|
||
}
|
||
} catch (e) {
|
||
var CustomEvent = function(event, params) {
|
||
var evt, origPrevent;
|
||
params = params || {
|
||
bubbles: false,
|
||
cancelable: false,
|
||
detail: undefined
|
||
};
|
||
|
||
evt = document.createEvent('CustomEvent');
|
||
evt.initCustomEvent(
|
||
event,
|
||
params.bubbles,
|
||
params.cancelable,
|
||
params.detail
|
||
);
|
||
origPrevent = evt.preventDefault;
|
||
evt.preventDefault = function() {
|
||
origPrevent.call(this);
|
||
try {
|
||
Object.defineProperty(this, 'defaultPrevented', {
|
||
get: function() {
|
||
return true;
|
||
}
|
||
});
|
||
} catch (e) {
|
||
this.defaultPrevented = true;
|
||
}
|
||
};
|
||
return evt;
|
||
};
|
||
|
||
CustomEvent.prototype = window.Event.prototype;
|
||
window.CustomEvent = CustomEvent; // expose definition to window
|
||
}
|
||
})();
|
||
|
||
|
||
/***/ }),
|
||
/* 13 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
if (!window.fetch) window.fetch = __webpack_require__(2).default || __webpack_require__(2);
|
||
|
||
|
||
/***/ }),
|
||
/* 14 */
|
||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||
|
||
"use strict";
|
||
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
|
||
/* WEBPACK VAR INJECTION */(function(setImmediate) {/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__finally__ = __webpack_require__(18);
|
||
|
||
|
||
// Store setTimeout reference so promise-polyfill will be unaffected by
|
||
// other code modifying setTimeout (like sinon.useFakeTimers())
|
||
var setTimeoutFunc = setTimeout;
|
||
|
||
function noop() {}
|
||
|
||
// Polyfill for Function.prototype.bind
|
||
function bind(fn, thisArg) {
|
||
return function() {
|
||
fn.apply(thisArg, arguments);
|
||
};
|
||
}
|
||
|
||
function Promise(fn) {
|
||
if (!(this instanceof Promise))
|
||
throw new TypeError('Promises must be constructed via new');
|
||
if (typeof fn !== 'function') throw new TypeError('not a function');
|
||
this._state = 0;
|
||
this._handled = false;
|
||
this._value = undefined;
|
||
this._deferreds = [];
|
||
|
||
doResolve(fn, this);
|
||
}
|
||
|
||
function handle(self, deferred) {
|
||
while (self._state === 3) {
|
||
self = self._value;
|
||
}
|
||
if (self._state === 0) {
|
||
self._deferreds.push(deferred);
|
||
return;
|
||
}
|
||
self._handled = true;
|
||
Promise._immediateFn(function() {
|
||
var cb = self._state === 1 ? deferred.onFulfilled : deferred.onRejected;
|
||
if (cb === null) {
|
||
(self._state === 1 ? resolve : reject)(deferred.promise, self._value);
|
||
return;
|
||
}
|
||
var ret;
|
||
try {
|
||
ret = cb(self._value);
|
||
} catch (e) {
|
||
reject(deferred.promise, e);
|
||
return;
|
||
}
|
||
resolve(deferred.promise, ret);
|
||
});
|
||
}
|
||
|
||
function resolve(self, newValue) {
|
||
try {
|
||
// Promise Resolution Procedure: https://github.com/promises-aplus/promises-spec#the-promise-resolution-procedure
|
||
if (newValue === self)
|
||
throw new TypeError('A promise cannot be resolved with itself.');
|
||
if (
|
||
newValue &&
|
||
(typeof newValue === 'object' || typeof newValue === 'function')
|
||
) {
|
||
var then = newValue.then;
|
||
if (newValue instanceof Promise) {
|
||
self._state = 3;
|
||
self._value = newValue;
|
||
finale(self);
|
||
return;
|
||
} else if (typeof then === 'function') {
|
||
doResolve(bind(then, newValue), self);
|
||
return;
|
||
}
|
||
}
|
||
self._state = 1;
|
||
self._value = newValue;
|
||
finale(self);
|
||
} catch (e) {
|
||
reject(self, e);
|
||
}
|
||
}
|
||
|
||
function reject(self, newValue) {
|
||
self._state = 2;
|
||
self._value = newValue;
|
||
finale(self);
|
||
}
|
||
|
||
function finale(self) {
|
||
if (self._state === 2 && self._deferreds.length === 0) {
|
||
Promise._immediateFn(function() {
|
||
if (!self._handled) {
|
||
Promise._unhandledRejectionFn(self._value);
|
||
}
|
||
});
|
||
}
|
||
|
||
for (var i = 0, len = self._deferreds.length; i < len; i++) {
|
||
handle(self, self._deferreds[i]);
|
||
}
|
||
self._deferreds = null;
|
||
}
|
||
|
||
function Handler(onFulfilled, onRejected, promise) {
|
||
this.onFulfilled = typeof onFulfilled === 'function' ? onFulfilled : null;
|
||
this.onRejected = typeof onRejected === 'function' ? onRejected : null;
|
||
this.promise = promise;
|
||
}
|
||
|
||
/**
|
||
* Take a potentially misbehaving resolver function and make sure
|
||
* onFulfilled and onRejected are only called once.
|
||
*
|
||
* Makes no guarantees about asynchrony.
|
||
*/
|
||
function doResolve(fn, self) {
|
||
var done = false;
|
||
try {
|
||
fn(
|
||
function(value) {
|
||
if (done) return;
|
||
done = true;
|
||
resolve(self, value);
|
||
},
|
||
function(reason) {
|
||
if (done) return;
|
||
done = true;
|
||
reject(self, reason);
|
||
}
|
||
);
|
||
} catch (ex) {
|
||
if (done) return;
|
||
done = true;
|
||
reject(self, ex);
|
||
}
|
||
}
|
||
|
||
Promise.prototype['catch'] = function(onRejected) {
|
||
return this.then(null, onRejected);
|
||
};
|
||
|
||
Promise.prototype.then = function(onFulfilled, onRejected) {
|
||
var prom = new this.constructor(noop);
|
||
|
||
handle(this, new Handler(onFulfilled, onRejected, prom));
|
||
return prom;
|
||
};
|
||
|
||
Promise.prototype['finally'] = __WEBPACK_IMPORTED_MODULE_0__finally__["a" /* default */];
|
||
|
||
Promise.all = function(arr) {
|
||
return new Promise(function(resolve, reject) {
|
||
if (!arr || typeof arr.length === 'undefined')
|
||
throw new TypeError('Promise.all accepts an array');
|
||
var args = Array.prototype.slice.call(arr);
|
||
if (args.length === 0) return resolve([]);
|
||
var remaining = args.length;
|
||
|
||
function res(i, val) {
|
||
try {
|
||
if (val && (typeof val === 'object' || typeof val === 'function')) {
|
||
var then = val.then;
|
||
if (typeof then === 'function') {
|
||
then.call(
|
||
val,
|
||
function(val) {
|
||
res(i, val);
|
||
},
|
||
reject
|
||
);
|
||
return;
|
||
}
|
||
}
|
||
args[i] = val;
|
||
if (--remaining === 0) {
|
||
resolve(args);
|
||
}
|
||
} catch (ex) {
|
||
reject(ex);
|
||
}
|
||
}
|
||
|
||
for (var i = 0; i < args.length; i++) {
|
||
res(i, args[i]);
|
||
}
|
||
});
|
||
};
|
||
|
||
Promise.resolve = function(value) {
|
||
if (value && typeof value === 'object' && value.constructor === Promise) {
|
||
return value;
|
||
}
|
||
|
||
return new Promise(function(resolve) {
|
||
resolve(value);
|
||
});
|
||
};
|
||
|
||
Promise.reject = function(value) {
|
||
return new Promise(function(resolve, reject) {
|
||
reject(value);
|
||
});
|
||
};
|
||
|
||
Promise.race = function(values) {
|
||
return new Promise(function(resolve, reject) {
|
||
for (var i = 0, len = values.length; i < len; i++) {
|
||
values[i].then(resolve, reject);
|
||
}
|
||
});
|
||
};
|
||
|
||
// Use polyfill for setImmediate for performance gains
|
||
Promise._immediateFn =
|
||
(typeof setImmediate === 'function' &&
|
||
function(fn) {
|
||
setImmediate(fn);
|
||
}) ||
|
||
function(fn) {
|
||
setTimeoutFunc(fn, 0);
|
||
};
|
||
|
||
Promise._unhandledRejectionFn = function _unhandledRejectionFn(err) {
|
||
if (typeof console !== 'undefined' && console) {
|
||
console.warn('Possible Unhandled Promise Rejection:', err); // eslint-disable-line no-console
|
||
}
|
||
};
|
||
|
||
/* harmony default export */ __webpack_exports__["default"] = (Promise);
|
||
|
||
/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(15).setImmediate))
|
||
|
||
/***/ }),
|
||
/* 15 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
/* WEBPACK VAR INJECTION */(function(global) {var apply = Function.prototype.apply;
|
||
|
||
// DOM APIs, for completeness
|
||
|
||
exports.setTimeout = function() {
|
||
return new Timeout(apply.call(setTimeout, window, arguments), clearTimeout);
|
||
};
|
||
exports.setInterval = function() {
|
||
return new Timeout(apply.call(setInterval, window, arguments), clearInterval);
|
||
};
|
||
exports.clearTimeout =
|
||
exports.clearInterval = function(timeout) {
|
||
if (timeout) {
|
||
timeout.close();
|
||
}
|
||
};
|
||
|
||
function Timeout(id, clearFn) {
|
||
this._id = id;
|
||
this._clearFn = clearFn;
|
||
}
|
||
Timeout.prototype.unref = Timeout.prototype.ref = function() {};
|
||
Timeout.prototype.close = function() {
|
||
this._clearFn.call(window, this._id);
|
||
};
|
||
|
||
// Does not start the time, just sets up the members needed.
|
||
exports.enroll = function(item, msecs) {
|
||
clearTimeout(item._idleTimeoutId);
|
||
item._idleTimeout = msecs;
|
||
};
|
||
|
||
exports.unenroll = function(item) {
|
||
clearTimeout(item._idleTimeoutId);
|
||
item._idleTimeout = -1;
|
||
};
|
||
|
||
exports._unrefActive = exports.active = function(item) {
|
||
clearTimeout(item._idleTimeoutId);
|
||
|
||
var msecs = item._idleTimeout;
|
||
if (msecs >= 0) {
|
||
item._idleTimeoutId = setTimeout(function onTimeout() {
|
||
if (item._onTimeout)
|
||
item._onTimeout();
|
||
}, msecs);
|
||
}
|
||
};
|
||
|
||
// setimmediate attaches itself to the global object
|
||
__webpack_require__(16);
|
||
// On some exotic environments, it's not clear which object `setimmeidate` was
|
||
// able to install onto. Search each possibility in the same order as the
|
||
// `setimmediate` library.
|
||
exports.setImmediate = (typeof self !== "undefined" && self.setImmediate) ||
|
||
(typeof global !== "undefined" && global.setImmediate) ||
|
||
(this && this.setImmediate);
|
||
exports.clearImmediate = (typeof self !== "undefined" && self.clearImmediate) ||
|
||
(typeof global !== "undefined" && global.clearImmediate) ||
|
||
(this && this.clearImmediate);
|
||
|
||
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)))
|
||
|
||
/***/ }),
|
||
/* 16 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
/* WEBPACK VAR INJECTION */(function(global, process) {(function (global, undefined) {
|
||
"use strict";
|
||
|
||
if (global.setImmediate) {
|
||
return;
|
||
}
|
||
|
||
var nextHandle = 1; // Spec says greater than zero
|
||
var tasksByHandle = {};
|
||
var currentlyRunningATask = false;
|
||
var doc = global.document;
|
||
var registerImmediate;
|
||
|
||
function setImmediate(callback) {
|
||
// Callback can either be a function or a string
|
||
if (typeof callback !== "function") {
|
||
callback = new Function("" + callback);
|
||
}
|
||
// Copy function arguments
|
||
var args = new Array(arguments.length - 1);
|
||
for (var i = 0; i < args.length; i++) {
|
||
args[i] = arguments[i + 1];
|
||
}
|
||
// Store and register the task
|
||
var task = { callback: callback, args: args };
|
||
tasksByHandle[nextHandle] = task;
|
||
registerImmediate(nextHandle);
|
||
return nextHandle++;
|
||
}
|
||
|
||
function clearImmediate(handle) {
|
||
delete tasksByHandle[handle];
|
||
}
|
||
|
||
function run(task) {
|
||
var callback = task.callback;
|
||
var args = task.args;
|
||
switch (args.length) {
|
||
case 0:
|
||
callback();
|
||
break;
|
||
case 1:
|
||
callback(args[0]);
|
||
break;
|
||
case 2:
|
||
callback(args[0], args[1]);
|
||
break;
|
||
case 3:
|
||
callback(args[0], args[1], args[2]);
|
||
break;
|
||
default:
|
||
callback.apply(undefined, args);
|
||
break;
|
||
}
|
||
}
|
||
|
||
function runIfPresent(handle) {
|
||
// From the spec: "Wait until any invocations of this algorithm started before this one have completed."
|
||
// So if we're currently running a task, we'll need to delay this invocation.
|
||
if (currentlyRunningATask) {
|
||
// Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a
|
||
// "too much recursion" error.
|
||
setTimeout(runIfPresent, 0, handle);
|
||
} else {
|
||
var task = tasksByHandle[handle];
|
||
if (task) {
|
||
currentlyRunningATask = true;
|
||
try {
|
||
run(task);
|
||
} finally {
|
||
clearImmediate(handle);
|
||
currentlyRunningATask = false;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
function installNextTickImplementation() {
|
||
registerImmediate = function(handle) {
|
||
process.nextTick(function () { runIfPresent(handle); });
|
||
};
|
||
}
|
||
|
||
function canUsePostMessage() {
|
||
// The test against `importScripts` prevents this implementation from being installed inside a web worker,
|
||
// where `global.postMessage` means something completely different and can't be used for this purpose.
|
||
if (global.postMessage && !global.importScripts) {
|
||
var postMessageIsAsynchronous = true;
|
||
var oldOnMessage = global.onmessage;
|
||
global.onmessage = function() {
|
||
postMessageIsAsynchronous = false;
|
||
};
|
||
global.postMessage("", "*");
|
||
global.onmessage = oldOnMessage;
|
||
return postMessageIsAsynchronous;
|
||
}
|
||
}
|
||
|
||
function installPostMessageImplementation() {
|
||
// Installs an event handler on `global` for the `message` event: see
|
||
// * https://developer.mozilla.org/en/DOM/window.postMessage
|
||
// * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages
|
||
|
||
var messagePrefix = "setImmediate$" + Math.random() + "$";
|
||
var onGlobalMessage = function(event) {
|
||
if (event.source === global &&
|
||
typeof event.data === "string" &&
|
||
event.data.indexOf(messagePrefix) === 0) {
|
||
runIfPresent(+event.data.slice(messagePrefix.length));
|
||
}
|
||
};
|
||
|
||
if (global.addEventListener) {
|
||
global.addEventListener("message", onGlobalMessage, false);
|
||
} else {
|
||
global.attachEvent("onmessage", onGlobalMessage);
|
||
}
|
||
|
||
registerImmediate = function(handle) {
|
||
global.postMessage(messagePrefix + handle, "*");
|
||
};
|
||
}
|
||
|
||
function installMessageChannelImplementation() {
|
||
var channel = new MessageChannel();
|
||
channel.port1.onmessage = function(event) {
|
||
var handle = event.data;
|
||
runIfPresent(handle);
|
||
};
|
||
|
||
registerImmediate = function(handle) {
|
||
channel.port2.postMessage(handle);
|
||
};
|
||
}
|
||
|
||
function installReadyStateChangeImplementation() {
|
||
var html = doc.documentElement;
|
||
registerImmediate = function(handle) {
|
||
// Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted
|
||
// into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.
|
||
var script = doc.createElement("script");
|
||
script.onreadystatechange = function () {
|
||
runIfPresent(handle);
|
||
script.onreadystatechange = null;
|
||
html.removeChild(script);
|
||
script = null;
|
||
};
|
||
html.appendChild(script);
|
||
};
|
||
}
|
||
|
||
function installSetTimeoutImplementation() {
|
||
registerImmediate = function(handle) {
|
||
setTimeout(runIfPresent, 0, handle);
|
||
};
|
||
}
|
||
|
||
// If supported, we should attach to the prototype of global, since that is where setTimeout et al. live.
|
||
var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global);
|
||
attachTo = attachTo && attachTo.setTimeout ? attachTo : global;
|
||
|
||
// Don't get fooled by e.g. browserify environments.
|
||
if ({}.toString.call(global.process) === "[object process]") {
|
||
// For Node.js before 0.9
|
||
installNextTickImplementation();
|
||
|
||
} else if (canUsePostMessage()) {
|
||
// For non-IE10 modern browsers
|
||
installPostMessageImplementation();
|
||
|
||
} else if (global.MessageChannel) {
|
||
// For web workers, where supported
|
||
installMessageChannelImplementation();
|
||
|
||
} else if (doc && "onreadystatechange" in doc.createElement("script")) {
|
||
// For IE 6–8
|
||
installReadyStateChangeImplementation();
|
||
|
||
} else {
|
||
// For older browsers
|
||
installSetTimeoutImplementation();
|
||
}
|
||
|
||
attachTo.setImmediate = setImmediate;
|
||
attachTo.clearImmediate = clearImmediate;
|
||
}(typeof self === "undefined" ? typeof global === "undefined" ? this : global : self));
|
||
|
||
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1), __webpack_require__(17)))
|
||
|
||
/***/ }),
|
||
/* 17 */
|
||
/***/ (function(module, exports) {
|
||
|
||
// shim for using process in browser
|
||
var process = module.exports = {};
|
||
|
||
// cached from whatever global is present so that test runners that stub it
|
||
// don't break things. But we need to wrap it in a try catch in case it is
|
||
// wrapped in strict mode code which doesn't define any globals. It's inside a
|
||
// function because try/catches deoptimize in certain engines.
|
||
|
||
var cachedSetTimeout;
|
||
var cachedClearTimeout;
|
||
|
||
function defaultSetTimout() {
|
||
throw new Error('setTimeout has not been defined');
|
||
}
|
||
function defaultClearTimeout () {
|
||
throw new Error('clearTimeout has not been defined');
|
||
}
|
||
(function () {
|
||
try {
|
||
if (typeof setTimeout === 'function') {
|
||
cachedSetTimeout = setTimeout;
|
||
} else {
|
||
cachedSetTimeout = defaultSetTimout;
|
||
}
|
||
} catch (e) {
|
||
cachedSetTimeout = defaultSetTimout;
|
||
}
|
||
try {
|
||
if (typeof clearTimeout === 'function') {
|
||
cachedClearTimeout = clearTimeout;
|
||
} else {
|
||
cachedClearTimeout = defaultClearTimeout;
|
||
}
|
||
} catch (e) {
|
||
cachedClearTimeout = defaultClearTimeout;
|
||
}
|
||
} ())
|
||
function runTimeout(fun) {
|
||
if (cachedSetTimeout === setTimeout) {
|
||
//normal enviroments in sane situations
|
||
return setTimeout(fun, 0);
|
||
}
|
||
// if setTimeout wasn't available but was latter defined
|
||
if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
|
||
cachedSetTimeout = setTimeout;
|
||
return setTimeout(fun, 0);
|
||
}
|
||
try {
|
||
// when when somebody has screwed with setTimeout but no I.E. maddness
|
||
return cachedSetTimeout(fun, 0);
|
||
} catch(e){
|
||
try {
|
||
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
|
||
return cachedSetTimeout.call(null, fun, 0);
|
||
} catch(e){
|
||
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
|
||
return cachedSetTimeout.call(this, fun, 0);
|
||
}
|
||
}
|
||
|
||
|
||
}
|
||
function runClearTimeout(marker) {
|
||
if (cachedClearTimeout === clearTimeout) {
|
||
//normal enviroments in sane situations
|
||
return clearTimeout(marker);
|
||
}
|
||
// if clearTimeout wasn't available but was latter defined
|
||
if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
|
||
cachedClearTimeout = clearTimeout;
|
||
return clearTimeout(marker);
|
||
}
|
||
try {
|
||
// when when somebody has screwed with setTimeout but no I.E. maddness
|
||
return cachedClearTimeout(marker);
|
||
} catch (e){
|
||
try {
|
||
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
|
||
return cachedClearTimeout.call(null, marker);
|
||
} catch (e){
|
||
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
|
||
// Some versions of I.E. have different rules for clearTimeout vs setTimeout
|
||
return cachedClearTimeout.call(this, marker);
|
||
}
|
||
}
|
||
|
||
|
||
|
||
}
|
||
var queue = [];
|
||
var draining = false;
|
||
var currentQueue;
|
||
var queueIndex = -1;
|
||
|
||
function cleanUpNextTick() {
|
||
if (!draining || !currentQueue) {
|
||
return;
|
||
}
|
||
draining = false;
|
||
if (currentQueue.length) {
|
||
queue = currentQueue.concat(queue);
|
||
} else {
|
||
queueIndex = -1;
|
||
}
|
||
if (queue.length) {
|
||
drainQueue();
|
||
}
|
||
}
|
||
|
||
function drainQueue() {
|
||
if (draining) {
|
||
return;
|
||
}
|
||
var timeout = runTimeout(cleanUpNextTick);
|
||
draining = true;
|
||
|
||
var len = queue.length;
|
||
while(len) {
|
||
currentQueue = queue;
|
||
queue = [];
|
||
while (++queueIndex < len) {
|
||
if (currentQueue) {
|
||
currentQueue[queueIndex].run();
|
||
}
|
||
}
|
||
queueIndex = -1;
|
||
len = queue.length;
|
||
}
|
||
currentQueue = null;
|
||
draining = false;
|
||
runClearTimeout(timeout);
|
||
}
|
||
|
||
process.nextTick = function (fun) {
|
||
var args = new Array(arguments.length - 1);
|
||
if (arguments.length > 1) {
|
||
for (var i = 1; i < arguments.length; i++) {
|
||
args[i - 1] = arguments[i];
|
||
}
|
||
}
|
||
queue.push(new Item(fun, args));
|
||
if (queue.length === 1 && !draining) {
|
||
runTimeout(drainQueue);
|
||
}
|
||
};
|
||
|
||
// v8 likes predictible objects
|
||
function Item(fun, array) {
|
||
this.fun = fun;
|
||
this.array = array;
|
||
}
|
||
Item.prototype.run = function () {
|
||
this.fun.apply(null, this.array);
|
||
};
|
||
process.title = 'browser';
|
||
process.browser = true;
|
||
process.env = {};
|
||
process.argv = [];
|
||
process.version = ''; // empty string to avoid regexp issues
|
||
process.versions = {};
|
||
|
||
function noop() {}
|
||
|
||
process.on = noop;
|
||
process.addListener = noop;
|
||
process.once = noop;
|
||
process.off = noop;
|
||
process.removeListener = noop;
|
||
process.removeAllListeners = noop;
|
||
process.emit = noop;
|
||
process.prependListener = noop;
|
||
process.prependOnceListener = noop;
|
||
|
||
process.listeners = function (name) { return [] }
|
||
|
||
process.binding = function (name) {
|
||
throw new Error('process.binding is not supported');
|
||
};
|
||
|
||
process.cwd = function () { return '/' };
|
||
process.chdir = function (dir) {
|
||
throw new Error('process.chdir is not supported');
|
||
};
|
||
process.umask = function() { return 0; };
|
||
|
||
|
||
/***/ }),
|
||
/* 18 */
|
||
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
||
|
||
"use strict";
|
||
/* harmony default export */ __webpack_exports__["a"] = (function(callback) {
|
||
var constructor = this.constructor;
|
||
return this.then(
|
||
function(value) {
|
||
return constructor.resolve(callback()).then(function() {
|
||
return value;
|
||
});
|
||
},
|
||
function(reason) {
|
||
return constructor.resolve(callback()).then(function() {
|
||
return constructor.reject(reason);
|
||
});
|
||
}
|
||
);
|
||
});
|
||
|
||
|
||
/***/ }),
|
||
/* 19 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
/*!
|
||
* clipboard.js v2.0.0
|
||
* https://zenorocha.github.io/clipboard.js
|
||
*
|
||
* Licensed MIT © Zeno Rocha
|
||
*/
|
||
(function webpackUniversalModuleDefinition(root, factory) {
|
||
if(true)
|
||
module.exports = factory();
|
||
else if(typeof define === 'function' && define.amd)
|
||
define([], factory);
|
||
else if(typeof exports === 'object')
|
||
exports["ClipboardJS"] = factory();
|
||
else
|
||
root["ClipboardJS"] = factory();
|
||
})(this, function() {
|
||
return /******/ (function(modules) { // webpackBootstrap
|
||
/******/ // The module cache
|
||
/******/ var installedModules = {};
|
||
/******/
|
||
/******/ // The require function
|
||
/******/ function __webpack_require__(moduleId) {
|
||
/******/
|
||
/******/ // Check if module is in cache
|
||
/******/ if(installedModules[moduleId]) {
|
||
/******/ return installedModules[moduleId].exports;
|
||
/******/ }
|
||
/******/ // Create a new module (and put it into the cache)
|
||
/******/ var module = installedModules[moduleId] = {
|
||
/******/ i: moduleId,
|
||
/******/ l: false,
|
||
/******/ exports: {}
|
||
/******/ };
|
||
/******/
|
||
/******/ // Execute the module function
|
||
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
||
/******/
|
||
/******/ // Flag the module as loaded
|
||
/******/ module.l = true;
|
||
/******/
|
||
/******/ // Return the exports of the module
|
||
/******/ return module.exports;
|
||
/******/ }
|
||
/******/
|
||
/******/
|
||
/******/ // expose the modules object (__webpack_modules__)
|
||
/******/ __webpack_require__.m = modules;
|
||
/******/
|
||
/******/ // expose the module cache
|
||
/******/ __webpack_require__.c = installedModules;
|
||
/******/
|
||
/******/ // identity function for calling harmony imports with the correct context
|
||
/******/ __webpack_require__.i = function(value) { return value; };
|
||
/******/
|
||
/******/ // define getter function for harmony exports
|
||
/******/ __webpack_require__.d = function(exports, name, getter) {
|
||
/******/ if(!__webpack_require__.o(exports, name)) {
|
||
/******/ Object.defineProperty(exports, name, {
|
||
/******/ configurable: false,
|
||
/******/ enumerable: true,
|
||
/******/ get: getter
|
||
/******/ });
|
||
/******/ }
|
||
/******/ };
|
||
/******/
|
||
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
||
/******/ __webpack_require__.n = function(module) {
|
||
/******/ var getter = module && module.__esModule ?
|
||
/******/ function getDefault() { return module['default']; } :
|
||
/******/ function getModuleExports() { return module; };
|
||
/******/ __webpack_require__.d(getter, 'a', getter);
|
||
/******/ return getter;
|
||
/******/ };
|
||
/******/
|
||
/******/ // Object.prototype.hasOwnProperty.call
|
||
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
||
/******/
|
||
/******/ // __webpack_public_path__
|
||
/******/ __webpack_require__.p = "";
|
||
/******/
|
||
/******/ // Load entry module and return exports
|
||
/******/ return __webpack_require__(__webpack_require__.s = 3);
|
||
/******/ })
|
||
/************************************************************************/
|
||
/******/ ([
|
||
/* 0 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {
|
||
if (true) {
|
||
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, __webpack_require__(7)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
|
||
__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
|
||
(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
|
||
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
||
} else if (typeof exports !== "undefined") {
|
||
factory(module, require('select'));
|
||
} else {
|
||
var mod = {
|
||
exports: {}
|
||
};
|
||
factory(mod, global.select);
|
||
global.clipboardAction = mod.exports;
|
||
}
|
||
})(this, function (module, _select) {
|
||
'use strict';
|
||
|
||
var _select2 = _interopRequireDefault(_select);
|
||
|
||
function _interopRequireDefault(obj) {
|
||
return obj && obj.__esModule ? obj : {
|
||
default: obj
|
||
};
|
||
}
|
||
|
||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
|
||
return typeof obj;
|
||
} : function (obj) {
|
||
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
||
};
|
||
|
||
function _classCallCheck(instance, Constructor) {
|
||
if (!(instance instanceof Constructor)) {
|
||
throw new TypeError("Cannot call a class as a function");
|
||
}
|
||
}
|
||
|
||
var _createClass = function () {
|
||
function defineProperties(target, props) {
|
||
for (var i = 0; i < props.length; i++) {
|
||
var descriptor = props[i];
|
||
descriptor.enumerable = descriptor.enumerable || false;
|
||
descriptor.configurable = true;
|
||
if ("value" in descriptor) descriptor.writable = true;
|
||
Object.defineProperty(target, descriptor.key, descriptor);
|
||
}
|
||
}
|
||
|
||
return function (Constructor, protoProps, staticProps) {
|
||
if (protoProps) defineProperties(Constructor.prototype, protoProps);
|
||
if (staticProps) defineProperties(Constructor, staticProps);
|
||
return Constructor;
|
||
};
|
||
}();
|
||
|
||
var ClipboardAction = function () {
|
||
/**
|
||
* @param {Object} options
|
||
*/
|
||
function ClipboardAction(options) {
|
||
_classCallCheck(this, ClipboardAction);
|
||
|
||
this.resolveOptions(options);
|
||
this.initSelection();
|
||
}
|
||
|
||
/**
|
||
* Defines base properties passed from constructor.
|
||
* @param {Object} options
|
||
*/
|
||
|
||
|
||
_createClass(ClipboardAction, [{
|
||
key: 'resolveOptions',
|
||
value: function resolveOptions() {
|
||
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
||
|
||
this.action = options.action;
|
||
this.container = options.container;
|
||
this.emitter = options.emitter;
|
||
this.target = options.target;
|
||
this.text = options.text;
|
||
this.trigger = options.trigger;
|
||
|
||
this.selectedText = '';
|
||
}
|
||
}, {
|
||
key: 'initSelection',
|
||
value: function initSelection() {
|
||
if (this.text) {
|
||
this.selectFake();
|
||
} else if (this.target) {
|
||
this.selectTarget();
|
||
}
|
||
}
|
||
}, {
|
||
key: 'selectFake',
|
||
value: function selectFake() {
|
||
var _this = this;
|
||
|
||
var isRTL = document.documentElement.getAttribute('dir') == 'rtl';
|
||
|
||
this.removeFake();
|
||
|
||
this.fakeHandlerCallback = function () {
|
||
return _this.removeFake();
|
||
};
|
||
this.fakeHandler = this.container.addEventListener('click', this.fakeHandlerCallback) || true;
|
||
|
||
this.fakeElem = document.createElement('textarea');
|
||
// Prevent zooming on iOS
|
||
this.fakeElem.style.fontSize = '12pt';
|
||
// Reset box model
|
||
this.fakeElem.style.border = '0';
|
||
this.fakeElem.style.padding = '0';
|
||
this.fakeElem.style.margin = '0';
|
||
// Move element out of screen horizontally
|
||
this.fakeElem.style.position = 'absolute';
|
||
this.fakeElem.style[isRTL ? 'right' : 'left'] = '-9999px';
|
||
// Move element to the same position vertically
|
||
var yPosition = window.pageYOffset || document.documentElement.scrollTop;
|
||
this.fakeElem.style.top = yPosition + 'px';
|
||
|
||
this.fakeElem.setAttribute('readonly', '');
|
||
this.fakeElem.value = this.text;
|
||
|
||
this.container.appendChild(this.fakeElem);
|
||
|
||
this.selectedText = (0, _select2.default)(this.fakeElem);
|
||
this.copyText();
|
||
}
|
||
}, {
|
||
key: 'removeFake',
|
||
value: function removeFake() {
|
||
if (this.fakeHandler) {
|
||
this.container.removeEventListener('click', this.fakeHandlerCallback);
|
||
this.fakeHandler = null;
|
||
this.fakeHandlerCallback = null;
|
||
}
|
||
|
||
if (this.fakeElem) {
|
||
this.container.removeChild(this.fakeElem);
|
||
this.fakeElem = null;
|
||
}
|
||
}
|
||
}, {
|
||
key: 'selectTarget',
|
||
value: function selectTarget() {
|
||
this.selectedText = (0, _select2.default)(this.target);
|
||
this.copyText();
|
||
}
|
||
}, {
|
||
key: 'copyText',
|
||
value: function copyText() {
|
||
var succeeded = void 0;
|
||
|
||
try {
|
||
succeeded = document.execCommand(this.action);
|
||
} catch (err) {
|
||
succeeded = false;
|
||
}
|
||
|
||
this.handleResult(succeeded);
|
||
}
|
||
}, {
|
||
key: 'handleResult',
|
||
value: function handleResult(succeeded) {
|
||
this.emitter.emit(succeeded ? 'success' : 'error', {
|
||
action: this.action,
|
||
text: this.selectedText,
|
||
trigger: this.trigger,
|
||
clearSelection: this.clearSelection.bind(this)
|
||
});
|
||
}
|
||
}, {
|
||
key: 'clearSelection',
|
||
value: function clearSelection() {
|
||
if (this.trigger) {
|
||
this.trigger.focus();
|
||
}
|
||
|
||
window.getSelection().removeAllRanges();
|
||
}
|
||
}, {
|
||
key: 'destroy',
|
||
value: function destroy() {
|
||
this.removeFake();
|
||
}
|
||
}, {
|
||
key: 'action',
|
||
set: function set() {
|
||
var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'copy';
|
||
|
||
this._action = action;
|
||
|
||
if (this._action !== 'copy' && this._action !== 'cut') {
|
||
throw new Error('Invalid "action" value, use either "copy" or "cut"');
|
||
}
|
||
},
|
||
get: function get() {
|
||
return this._action;
|
||
}
|
||
}, {
|
||
key: 'target',
|
||
set: function set(target) {
|
||
if (target !== undefined) {
|
||
if (target && (typeof target === 'undefined' ? 'undefined' : _typeof(target)) === 'object' && target.nodeType === 1) {
|
||
if (this.action === 'copy' && target.hasAttribute('disabled')) {
|
||
throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');
|
||
}
|
||
|
||
if (this.action === 'cut' && (target.hasAttribute('readonly') || target.hasAttribute('disabled'))) {
|
||
throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');
|
||
}
|
||
|
||
this._target = target;
|
||
} else {
|
||
throw new Error('Invalid "target" value, use a valid Element');
|
||
}
|
||
}
|
||
},
|
||
get: function get() {
|
||
return this._target;
|
||
}
|
||
}]);
|
||
|
||
return ClipboardAction;
|
||
}();
|
||
|
||
module.exports = ClipboardAction;
|
||
});
|
||
|
||
/***/ }),
|
||
/* 1 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var is = __webpack_require__(6);
|
||
var delegate = __webpack_require__(5);
|
||
|
||
/**
|
||
* Validates all params and calls the right
|
||
* listener function based on its target type.
|
||
*
|
||
* @param {String|HTMLElement|HTMLCollection|NodeList} target
|
||
* @param {String} type
|
||
* @param {Function} callback
|
||
* @return {Object}
|
||
*/
|
||
function listen(target, type, callback) {
|
||
if (!target && !type && !callback) {
|
||
throw new Error('Missing required arguments');
|
||
}
|
||
|
||
if (!is.string(type)) {
|
||
throw new TypeError('Second argument must be a String');
|
||
}
|
||
|
||
if (!is.fn(callback)) {
|
||
throw new TypeError('Third argument must be a Function');
|
||
}
|
||
|
||
if (is.node(target)) {
|
||
return listenNode(target, type, callback);
|
||
}
|
||
else if (is.nodeList(target)) {
|
||
return listenNodeList(target, type, callback);
|
||
}
|
||
else if (is.string(target)) {
|
||
return listenSelector(target, type, callback);
|
||
}
|
||
else {
|
||
throw new TypeError('First argument must be a String, HTMLElement, HTMLCollection, or NodeList');
|
||
}
|
||
}
|
||
|
||
/**
|
||
* Adds an event listener to a HTML element
|
||
* and returns a remove listener function.
|
||
*
|
||
* @param {HTMLElement} node
|
||
* @param {String} type
|
||
* @param {Function} callback
|
||
* @return {Object}
|
||
*/
|
||
function listenNode(node, type, callback) {
|
||
node.addEventListener(type, callback);
|
||
|
||
return {
|
||
destroy: function() {
|
||
node.removeEventListener(type, callback);
|
||
}
|
||
}
|
||
}
|
||
|
||
/**
|
||
* Add an event listener to a list of HTML elements
|
||
* and returns a remove listener function.
|
||
*
|
||
* @param {NodeList|HTMLCollection} nodeList
|
||
* @param {String} type
|
||
* @param {Function} callback
|
||
* @return {Object}
|
||
*/
|
||
function listenNodeList(nodeList, type, callback) {
|
||
Array.prototype.forEach.call(nodeList, function(node) {
|
||
node.addEventListener(type, callback);
|
||
});
|
||
|
||
return {
|
||
destroy: function() {
|
||
Array.prototype.forEach.call(nodeList, function(node) {
|
||
node.removeEventListener(type, callback);
|
||
});
|
||
}
|
||
}
|
||
}
|
||
|
||
/**
|
||
* Add an event listener to a selector
|
||
* and returns a remove listener function.
|
||
*
|
||
* @param {String} selector
|
||
* @param {String} type
|
||
* @param {Function} callback
|
||
* @return {Object}
|
||
*/
|
||
function listenSelector(selector, type, callback) {
|
||
return delegate(document.body, selector, type, callback);
|
||
}
|
||
|
||
module.exports = listen;
|
||
|
||
|
||
/***/ }),
|
||
/* 2 */
|
||
/***/ (function(module, exports) {
|
||
|
||
function E () {
|
||
// Keep this empty so it's easier to inherit from
|
||
// (via https://github.com/lipsmack from https://github.com/scottcorgan/tiny-emitter/issues/3)
|
||
}
|
||
|
||
E.prototype = {
|
||
on: function (name, callback, ctx) {
|
||
var e = this.e || (this.e = {});
|
||
|
||
(e[name] || (e[name] = [])).push({
|
||
fn: callback,
|
||
ctx: ctx
|
||
});
|
||
|
||
return this;
|
||
},
|
||
|
||
once: function (name, callback, ctx) {
|
||
var self = this;
|
||
function listener () {
|
||
self.off(name, listener);
|
||
callback.apply(ctx, arguments);
|
||
};
|
||
|
||
listener._ = callback
|
||
return this.on(name, listener, ctx);
|
||
},
|
||
|
||
emit: function (name) {
|
||
var data = [].slice.call(arguments, 1);
|
||
var evtArr = ((this.e || (this.e = {}))[name] || []).slice();
|
||
var i = 0;
|
||
var len = evtArr.length;
|
||
|
||
for (i; i < len; i++) {
|
||
evtArr[i].fn.apply(evtArr[i].ctx, data);
|
||
}
|
||
|
||
return this;
|
||
},
|
||
|
||
off: function (name, callback) {
|
||
var e = this.e || (this.e = {});
|
||
var evts = e[name];
|
||
var liveEvents = [];
|
||
|
||
if (evts && callback) {
|
||
for (var i = 0, len = evts.length; i < len; i++) {
|
||
if (evts[i].fn !== callback && evts[i].fn._ !== callback)
|
||
liveEvents.push(evts[i]);
|
||
}
|
||
}
|
||
|
||
// Remove event from queue to prevent memory leak
|
||
// Suggested by https://github.com/lazd
|
||
// Ref: https://github.com/scottcorgan/tiny-emitter/commit/c6ebfaa9bc973b33d110a84a307742b7cf94c953#commitcomment-5024910
|
||
|
||
(liveEvents.length)
|
||
? e[name] = liveEvents
|
||
: delete e[name];
|
||
|
||
return this;
|
||
}
|
||
};
|
||
|
||
module.exports = E;
|
||
|
||
|
||
/***/ }),
|
||
/* 3 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {
|
||
if (true) {
|
||
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, __webpack_require__(0), __webpack_require__(2), __webpack_require__(1)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
|
||
__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
|
||
(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
|
||
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
||
} else if (typeof exports !== "undefined") {
|
||
factory(module, require('./clipboard-action'), require('tiny-emitter'), require('good-listener'));
|
||
} else {
|
||
var mod = {
|
||
exports: {}
|
||
};
|
||
factory(mod, global.clipboardAction, global.tinyEmitter, global.goodListener);
|
||
global.clipboard = mod.exports;
|
||
}
|
||
})(this, function (module, _clipboardAction, _tinyEmitter, _goodListener) {
|
||
'use strict';
|
||
|
||
var _clipboardAction2 = _interopRequireDefault(_clipboardAction);
|
||
|
||
var _tinyEmitter2 = _interopRequireDefault(_tinyEmitter);
|
||
|
||
var _goodListener2 = _interopRequireDefault(_goodListener);
|
||
|
||
function _interopRequireDefault(obj) {
|
||
return obj && obj.__esModule ? obj : {
|
||
default: obj
|
||
};
|
||
}
|
||
|
||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
|
||
return typeof obj;
|
||
} : function (obj) {
|
||
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
||
};
|
||
|
||
function _classCallCheck(instance, Constructor) {
|
||
if (!(instance instanceof Constructor)) {
|
||
throw new TypeError("Cannot call a class as a function");
|
||
}
|
||
}
|
||
|
||
var _createClass = function () {
|
||
function defineProperties(target, props) {
|
||
for (var i = 0; i < props.length; i++) {
|
||
var descriptor = props[i];
|
||
descriptor.enumerable = descriptor.enumerable || false;
|
||
descriptor.configurable = true;
|
||
if ("value" in descriptor) descriptor.writable = true;
|
||
Object.defineProperty(target, descriptor.key, descriptor);
|
||
}
|
||
}
|
||
|
||
return function (Constructor, protoProps, staticProps) {
|
||
if (protoProps) defineProperties(Constructor.prototype, protoProps);
|
||
if (staticProps) defineProperties(Constructor, staticProps);
|
||
return Constructor;
|
||
};
|
||
}();
|
||
|
||
function _possibleConstructorReturn(self, call) {
|
||
if (!self) {
|
||
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
||
}
|
||
|
||
return call && (typeof call === "object" || typeof call === "function") ? call : self;
|
||
}
|
||
|
||
function _inherits(subClass, superClass) {
|
||
if (typeof superClass !== "function" && superClass !== null) {
|
||
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
|
||
}
|
||
|
||
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
||
constructor: {
|
||
value: subClass,
|
||
enumerable: false,
|
||
writable: true,
|
||
configurable: true
|
||
}
|
||
});
|
||
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
|
||
}
|
||
|
||
var Clipboard = function (_Emitter) {
|
||
_inherits(Clipboard, _Emitter);
|
||
|
||
/**
|
||
* @param {String|HTMLElement|HTMLCollection|NodeList} trigger
|
||
* @param {Object} options
|
||
*/
|
||
function Clipboard(trigger, options) {
|
||
_classCallCheck(this, Clipboard);
|
||
|
||
var _this = _possibleConstructorReturn(this, (Clipboard.__proto__ || Object.getPrototypeOf(Clipboard)).call(this));
|
||
|
||
_this.resolveOptions(options);
|
||
_this.listenClick(trigger);
|
||
return _this;
|
||
}
|
||
|
||
/**
|
||
* Defines if attributes would be resolved using internal setter functions
|
||
* or custom functions that were passed in the constructor.
|
||
* @param {Object} options
|
||
*/
|
||
|
||
|
||
_createClass(Clipboard, [{
|
||
key: 'resolveOptions',
|
||
value: function resolveOptions() {
|
||
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
||
|
||
this.action = typeof options.action === 'function' ? options.action : this.defaultAction;
|
||
this.target = typeof options.target === 'function' ? options.target : this.defaultTarget;
|
||
this.text = typeof options.text === 'function' ? options.text : this.defaultText;
|
||
this.container = _typeof(options.container) === 'object' ? options.container : document.body;
|
||
}
|
||
}, {
|
||
key: 'listenClick',
|
||
value: function listenClick(trigger) {
|
||
var _this2 = this;
|
||
|
||
this.listener = (0, _goodListener2.default)(trigger, 'click', function (e) {
|
||
return _this2.onClick(e);
|
||
});
|
||
}
|
||
}, {
|
||
key: 'onClick',
|
||
value: function onClick(e) {
|
||
var trigger = e.delegateTarget || e.currentTarget;
|
||
|
||
if (this.clipboardAction) {
|
||
this.clipboardAction = null;
|
||
}
|
||
|
||
this.clipboardAction = new _clipboardAction2.default({
|
||
action: this.action(trigger),
|
||
target: this.target(trigger),
|
||
text: this.text(trigger),
|
||
container: this.container,
|
||
trigger: trigger,
|
||
emitter: this
|
||
});
|
||
}
|
||
}, {
|
||
key: 'defaultAction',
|
||
value: function defaultAction(trigger) {
|
||
return getAttributeValue('action', trigger);
|
||
}
|
||
}, {
|
||
key: 'defaultTarget',
|
||
value: function defaultTarget(trigger) {
|
||
var selector = getAttributeValue('target', trigger);
|
||
|
||
if (selector) {
|
||
return document.querySelector(selector);
|
||
}
|
||
}
|
||
}, {
|
||
key: 'defaultText',
|
||
value: function defaultText(trigger) {
|
||
return getAttributeValue('text', trigger);
|
||
}
|
||
}, {
|
||
key: 'destroy',
|
||
value: function destroy() {
|
||
this.listener.destroy();
|
||
|
||
if (this.clipboardAction) {
|
||
this.clipboardAction.destroy();
|
||
this.clipboardAction = null;
|
||
}
|
||
}
|
||
}], [{
|
||
key: 'isSupported',
|
||
value: function isSupported() {
|
||
var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ['copy', 'cut'];
|
||
|
||
var actions = typeof action === 'string' ? [action] : action;
|
||
var support = !!document.queryCommandSupported;
|
||
|
||
actions.forEach(function (action) {
|
||
support = support && !!document.queryCommandSupported(action);
|
||
});
|
||
|
||
return support;
|
||
}
|
||
}]);
|
||
|
||
return Clipboard;
|
||
}(_tinyEmitter2.default);
|
||
|
||
/**
|
||
* Helper function to retrieve attribute value.
|
||
* @param {String} suffix
|
||
* @param {Element} element
|
||
*/
|
||
function getAttributeValue(suffix, element) {
|
||
var attribute = 'data-clipboard-' + suffix;
|
||
|
||
if (!element.hasAttribute(attribute)) {
|
||
return;
|
||
}
|
||
|
||
return element.getAttribute(attribute);
|
||
}
|
||
|
||
module.exports = Clipboard;
|
||
});
|
||
|
||
/***/ }),
|
||
/* 4 */
|
||
/***/ (function(module, exports) {
|
||
|
||
var DOCUMENT_NODE_TYPE = 9;
|
||
|
||
/**
|
||
* A polyfill for Element.matches()
|
||
*/
|
||
if (typeof Element !== 'undefined' && !Element.prototype.matches) {
|
||
var proto = Element.prototype;
|
||
|
||
proto.matches = proto.matchesSelector ||
|
||
proto.mozMatchesSelector ||
|
||
proto.msMatchesSelector ||
|
||
proto.oMatchesSelector ||
|
||
proto.webkitMatchesSelector;
|
||
}
|
||
|
||
/**
|
||
* Finds the closest parent that matches a selector.
|
||
*
|
||
* @param {Element} element
|
||
* @param {String} selector
|
||
* @return {Function}
|
||
*/
|
||
function closest (element, selector) {
|
||
while (element && element.nodeType !== DOCUMENT_NODE_TYPE) {
|
||
if (typeof element.matches === 'function' &&
|
||
element.matches(selector)) {
|
||
return element;
|
||
}
|
||
element = element.parentNode;
|
||
}
|
||
}
|
||
|
||
module.exports = closest;
|
||
|
||
|
||
/***/ }),
|
||
/* 5 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var closest = __webpack_require__(4);
|
||
|
||
/**
|
||
* Delegates event to a selector.
|
||
*
|
||
* @param {Element} element
|
||
* @param {String} selector
|
||
* @param {String} type
|
||
* @param {Function} callback
|
||
* @param {Boolean} useCapture
|
||
* @return {Object}
|
||
*/
|
||
function _delegate(element, selector, type, callback, useCapture) {
|
||
var listenerFn = listener.apply(this, arguments);
|
||
|
||
element.addEventListener(type, listenerFn, useCapture);
|
||
|
||
return {
|
||
destroy: function() {
|
||
element.removeEventListener(type, listenerFn, useCapture);
|
||
}
|
||
}
|
||
}
|
||
|
||
/**
|
||
* Delegates event to a selector.
|
||
*
|
||
* @param {Element|String|Array} [elements]
|
||
* @param {String} selector
|
||
* @param {String} type
|
||
* @param {Function} callback
|
||
* @param {Boolean} useCapture
|
||
* @return {Object}
|
||
*/
|
||
function delegate(elements, selector, type, callback, useCapture) {
|
||
// Handle the regular Element usage
|
||
if (typeof elements.addEventListener === 'function') {
|
||
return _delegate.apply(null, arguments);
|
||
}
|
||
|
||
// Handle Element-less usage, it defaults to global delegation
|
||
if (typeof type === 'function') {
|
||
// Use `document` as the first parameter, then apply arguments
|
||
// This is a short way to .unshift `arguments` without running into deoptimizations
|
||
return _delegate.bind(null, document).apply(null, arguments);
|
||
}
|
||
|
||
// Handle Selector-based usage
|
||
if (typeof elements === 'string') {
|
||
elements = document.querySelectorAll(elements);
|
||
}
|
||
|
||
// Handle Array-like based usage
|
||
return Array.prototype.map.call(elements, function (element) {
|
||
return _delegate(element, selector, type, callback, useCapture);
|
||
});
|
||
}
|
||
|
||
/**
|
||
* Finds closest match and invokes callback.
|
||
*
|
||
* @param {Element} element
|
||
* @param {String} selector
|
||
* @param {String} type
|
||
* @param {Function} callback
|
||
* @return {Function}
|
||
*/
|
||
function listener(element, selector, type, callback) {
|
||
return function(e) {
|
||
e.delegateTarget = closest(e.target, selector);
|
||
|
||
if (e.delegateTarget) {
|
||
callback.call(element, e);
|
||
}
|
||
}
|
||
}
|
||
|
||
module.exports = delegate;
|
||
|
||
|
||
/***/ }),
|
||
/* 6 */
|
||
/***/ (function(module, exports) {
|
||
|
||
/**
|
||
* Check if argument is a HTML element.
|
||
*
|
||
* @param {Object} value
|
||
* @return {Boolean}
|
||
*/
|
||
exports.node = function(value) {
|
||
return value !== undefined
|
||
&& value instanceof HTMLElement
|
||
&& value.nodeType === 1;
|
||
};
|
||
|
||
/**
|
||
* Check if argument is a list of HTML elements.
|
||
*
|
||
* @param {Object} value
|
||
* @return {Boolean}
|
||
*/
|
||
exports.nodeList = function(value) {
|
||
var type = Object.prototype.toString.call(value);
|
||
|
||
return value !== undefined
|
||
&& (type === '[object NodeList]' || type === '[object HTMLCollection]')
|
||
&& ('length' in value)
|
||
&& (value.length === 0 || exports.node(value[0]));
|
||
};
|
||
|
||
/**
|
||
* Check if argument is a string.
|
||
*
|
||
* @param {Object} value
|
||
* @return {Boolean}
|
||
*/
|
||
exports.string = function(value) {
|
||
return typeof value === 'string'
|
||
|| value instanceof String;
|
||
};
|
||
|
||
/**
|
||
* Check if argument is a function.
|
||
*
|
||
* @param {Object} value
|
||
* @return {Boolean}
|
||
*/
|
||
exports.fn = function(value) {
|
||
var type = Object.prototype.toString.call(value);
|
||
|
||
return type === '[object Function]';
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 7 */
|
||
/***/ (function(module, exports) {
|
||
|
||
function select(element) {
|
||
var selectedText;
|
||
|
||
if (element.nodeName === 'SELECT') {
|
||
element.focus();
|
||
|
||
selectedText = element.value;
|
||
}
|
||
else if (element.nodeName === 'INPUT' || element.nodeName === 'TEXTAREA') {
|
||
var isReadOnly = element.hasAttribute('readonly');
|
||
|
||
if (!isReadOnly) {
|
||
element.setAttribute('readonly', '');
|
||
}
|
||
|
||
element.select();
|
||
element.setSelectionRange(0, element.value.length);
|
||
|
||
if (!isReadOnly) {
|
||
element.removeAttribute('readonly');
|
||
}
|
||
|
||
selectedText = element.value;
|
||
}
|
||
else {
|
||
if (element.hasAttribute('contenteditable')) {
|
||
element.focus();
|
||
}
|
||
|
||
var selection = window.getSelection();
|
||
var range = document.createRange();
|
||
|
||
range.selectNodeContents(element);
|
||
selection.removeAllRanges();
|
||
selection.addRange(range);
|
||
|
||
selectedText = selection.toString();
|
||
}
|
||
|
||
return selectedText;
|
||
}
|
||
|
||
module.exports = select;
|
||
|
||
|
||
/***/ })
|
||
/******/ ]);
|
||
});
|
||
|
||
/***/ }),
|
||
/* 20 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var __WEBPACK_AMD_DEFINE_RESULT__;;(function () {
|
||
'use strict';
|
||
|
||
/**
|
||
* @preserve FastClick: polyfill to remove click delays on browsers with touch UIs.
|
||
*
|
||
* @codingstandard ftlabs-jsv2
|
||
* @copyright The Financial Times Limited [All Rights Reserved]
|
||
* @license MIT License (see LICENSE.txt)
|
||
*/
|
||
|
||
/*jslint browser:true, node:true*/
|
||
/*global define, Event, Node*/
|
||
|
||
|
||
/**
|
||
* Instantiate fast-clicking listeners on the specified layer.
|
||
*
|
||
* @constructor
|
||
* @param {Element} layer The layer to listen on
|
||
* @param {Object} [options={}] The options to override the defaults
|
||
*/
|
||
function FastClick(layer, options) {
|
||
var oldOnClick;
|
||
|
||
options = options || {};
|
||
|
||
/**
|
||
* Whether a click is currently being tracked.
|
||
*
|
||
* @type boolean
|
||
*/
|
||
this.trackingClick = false;
|
||
|
||
|
||
/**
|
||
* Timestamp for when click tracking started.
|
||
*
|
||
* @type number
|
||
*/
|
||
this.trackingClickStart = 0;
|
||
|
||
|
||
/**
|
||
* The element being tracked for a click.
|
||
*
|
||
* @type EventTarget
|
||
*/
|
||
this.targetElement = null;
|
||
|
||
|
||
/**
|
||
* X-coordinate of touch start event.
|
||
*
|
||
* @type number
|
||
*/
|
||
this.touchStartX = 0;
|
||
|
||
|
||
/**
|
||
* Y-coordinate of touch start event.
|
||
*
|
||
* @type number
|
||
*/
|
||
this.touchStartY = 0;
|
||
|
||
|
||
/**
|
||
* ID of the last touch, retrieved from Touch.identifier.
|
||
*
|
||
* @type number
|
||
*/
|
||
this.lastTouchIdentifier = 0;
|
||
|
||
|
||
/**
|
||
* Touchmove boundary, beyond which a click will be cancelled.
|
||
*
|
||
* @type number
|
||
*/
|
||
this.touchBoundary = options.touchBoundary || 10;
|
||
|
||
|
||
/**
|
||
* The FastClick layer.
|
||
*
|
||
* @type Element
|
||
*/
|
||
this.layer = layer;
|
||
|
||
/**
|
||
* The minimum time between tap(touchstart and touchend) events
|
||
*
|
||
* @type number
|
||
*/
|
||
this.tapDelay = options.tapDelay || 200;
|
||
|
||
/**
|
||
* The maximum time for a tap
|
||
*
|
||
* @type number
|
||
*/
|
||
this.tapTimeout = options.tapTimeout || 700;
|
||
|
||
if (FastClick.notNeeded(layer)) {
|
||
return;
|
||
}
|
||
|
||
// Some old versions of Android don't have Function.prototype.bind
|
||
function bind(method, context) {
|
||
return function() { return method.apply(context, arguments); };
|
||
}
|
||
|
||
|
||
var methods = ['onMouse', 'onClick', 'onTouchStart', 'onTouchMove', 'onTouchEnd', 'onTouchCancel'];
|
||
var context = this;
|
||
for (var i = 0, l = methods.length; i < l; i++) {
|
||
context[methods[i]] = bind(context[methods[i]], context);
|
||
}
|
||
|
||
// Set up event handlers as required
|
||
if (deviceIsAndroid) {
|
||
layer.addEventListener('mouseover', this.onMouse, true);
|
||
layer.addEventListener('mousedown', this.onMouse, true);
|
||
layer.addEventListener('mouseup', this.onMouse, true);
|
||
}
|
||
|
||
layer.addEventListener('click', this.onClick, true);
|
||
layer.addEventListener('touchstart', this.onTouchStart, false);
|
||
layer.addEventListener('touchmove', this.onTouchMove, false);
|
||
layer.addEventListener('touchend', this.onTouchEnd, false);
|
||
layer.addEventListener('touchcancel', this.onTouchCancel, false);
|
||
|
||
// Hack is required for browsers that don't support Event#stopImmediatePropagation (e.g. Android 2)
|
||
// which is how FastClick normally stops click events bubbling to callbacks registered on the FastClick
|
||
// layer when they are cancelled.
|
||
if (!Event.prototype.stopImmediatePropagation) {
|
||
layer.removeEventListener = function(type, callback, capture) {
|
||
var rmv = Node.prototype.removeEventListener;
|
||
if (type === 'click') {
|
||
rmv.call(layer, type, callback.hijacked || callback, capture);
|
||
} else {
|
||
rmv.call(layer, type, callback, capture);
|
||
}
|
||
};
|
||
|
||
layer.addEventListener = function(type, callback, capture) {
|
||
var adv = Node.prototype.addEventListener;
|
||
if (type === 'click') {
|
||
adv.call(layer, type, callback.hijacked || (callback.hijacked = function(event) {
|
||
if (!event.propagationStopped) {
|
||
callback(event);
|
||
}
|
||
}), capture);
|
||
} else {
|
||
adv.call(layer, type, callback, capture);
|
||
}
|
||
};
|
||
}
|
||
|
||
// If a handler is already declared in the element's onclick attribute, it will be fired before
|
||
// FastClick's onClick handler. Fix this by pulling out the user-defined handler function and
|
||
// adding it as listener.
|
||
if (typeof layer.onclick === 'function') {
|
||
|
||
// Android browser on at least 3.2 requires a new reference to the function in layer.onclick
|
||
// - the old one won't work if passed to addEventListener directly.
|
||
oldOnClick = layer.onclick;
|
||
layer.addEventListener('click', function(event) {
|
||
oldOnClick(event);
|
||
}, false);
|
||
layer.onclick = null;
|
||
}
|
||
}
|
||
|
||
/**
|
||
* Windows Phone 8.1 fakes user agent string to look like Android and iPhone.
|
||
*
|
||
* @type boolean
|
||
*/
|
||
var deviceIsWindowsPhone = navigator.userAgent.indexOf("Windows Phone") >= 0;
|
||
|
||
/**
|
||
* Android requires exceptions.
|
||
*
|
||
* @type boolean
|
||
*/
|
||
var deviceIsAndroid = navigator.userAgent.indexOf('Android') > 0 && !deviceIsWindowsPhone;
|
||
|
||
|
||
/**
|
||
* iOS requires exceptions.
|
||
*
|
||
* @type boolean
|
||
*/
|
||
var deviceIsIOS = /iP(ad|hone|od)/.test(navigator.userAgent) && !deviceIsWindowsPhone;
|
||
|
||
|
||
/**
|
||
* iOS 4 requires an exception for select elements.
|
||
*
|
||
* @type boolean
|
||
*/
|
||
var deviceIsIOS4 = deviceIsIOS && (/OS 4_\d(_\d)?/).test(navigator.userAgent);
|
||
|
||
|
||
/**
|
||
* iOS 6.0-7.* requires the target element to be manually derived
|
||
*
|
||
* @type boolean
|
||
*/
|
||
var deviceIsIOSWithBadTarget = deviceIsIOS && (/OS [6-7]_\d/).test(navigator.userAgent);
|
||
|
||
/**
|
||
* BlackBerry requires exceptions.
|
||
*
|
||
* @type boolean
|
||
*/
|
||
var deviceIsBlackBerry10 = navigator.userAgent.indexOf('BB10') > 0;
|
||
|
||
/**
|
||
* Determine whether a given element requires a native click.
|
||
*
|
||
* @param {EventTarget|Element} target Target DOM element
|
||
* @returns {boolean} Returns true if the element needs a native click
|
||
*/
|
||
FastClick.prototype.needsClick = function(target) {
|
||
switch (target.nodeName.toLowerCase()) {
|
||
|
||
// Don't send a synthetic click to disabled inputs (issue #62)
|
||
case 'button':
|
||
case 'select':
|
||
case 'textarea':
|
||
if (target.disabled) {
|
||
return true;
|
||
}
|
||
|
||
break;
|
||
case 'input':
|
||
|
||
// File inputs need real clicks on iOS 6 due to a browser bug (issue #68)
|
||
if ((deviceIsIOS && target.type === 'file') || target.disabled) {
|
||
return true;
|
||
}
|
||
|
||
break;
|
||
case 'label':
|
||
case 'iframe': // iOS8 homescreen apps can prevent events bubbling into frames
|
||
case 'video':
|
||
return true;
|
||
}
|
||
|
||
return (/\bneedsclick\b/).test(target.className);
|
||
};
|
||
|
||
|
||
/**
|
||
* Determine whether a given element requires a call to focus to simulate click into element.
|
||
*
|
||
* @param {EventTarget|Element} target Target DOM element
|
||
* @returns {boolean} Returns true if the element requires a call to focus to simulate native click.
|
||
*/
|
||
FastClick.prototype.needsFocus = function(target) {
|
||
switch (target.nodeName.toLowerCase()) {
|
||
case 'textarea':
|
||
return true;
|
||
case 'select':
|
||
return !deviceIsAndroid;
|
||
case 'input':
|
||
switch (target.type) {
|
||
case 'button':
|
||
case 'checkbox':
|
||
case 'file':
|
||
case 'image':
|
||
case 'radio':
|
||
case 'submit':
|
||
return false;
|
||
}
|
||
|
||
// No point in attempting to focus disabled inputs
|
||
return !target.disabled && !target.readOnly;
|
||
default:
|
||
return (/\bneedsfocus\b/).test(target.className);
|
||
}
|
||
};
|
||
|
||
|
||
/**
|
||
* Send a click event to the specified element.
|
||
*
|
||
* @param {EventTarget|Element} targetElement
|
||
* @param {Event} event
|
||
*/
|
||
FastClick.prototype.sendClick = function(targetElement, event) {
|
||
var clickEvent, touch;
|
||
|
||
// On some Android devices activeElement needs to be blurred otherwise the synthetic click will have no effect (#24)
|
||
if (document.activeElement && document.activeElement !== targetElement) {
|
||
document.activeElement.blur();
|
||
}
|
||
|
||
touch = event.changedTouches[0];
|
||
|
||
// Synthesise a click event, with an extra attribute so it can be tracked
|
||
clickEvent = document.createEvent('MouseEvents');
|
||
clickEvent.initMouseEvent(this.determineEventType(targetElement), true, true, window, 1, touch.screenX, touch.screenY, touch.clientX, touch.clientY, false, false, false, false, 0, null);
|
||
clickEvent.forwardedTouchEvent = true;
|
||
targetElement.dispatchEvent(clickEvent);
|
||
};
|
||
|
||
FastClick.prototype.determineEventType = function(targetElement) {
|
||
|
||
//Issue #159: Android Chrome Select Box does not open with a synthetic click event
|
||
if (deviceIsAndroid && targetElement.tagName.toLowerCase() === 'select') {
|
||
return 'mousedown';
|
||
}
|
||
|
||
return 'click';
|
||
};
|
||
|
||
|
||
/**
|
||
* @param {EventTarget|Element} targetElement
|
||
*/
|
||
FastClick.prototype.focus = function(targetElement) {
|
||
var length;
|
||
|
||
// Issue #160: on iOS 7, some input elements (e.g. date datetime month) throw a vague TypeError on setSelectionRange. These elements don't have an integer value for the selectionStart and selectionEnd properties, but unfortunately that can't be used for detection because accessing the properties also throws a TypeError. Just check the type instead. Filed as Apple bug #15122724.
|
||
if (deviceIsIOS && targetElement.setSelectionRange && targetElement.type.indexOf('date') !== 0 && targetElement.type !== 'time' && targetElement.type !== 'month') {
|
||
length = targetElement.value.length;
|
||
targetElement.setSelectionRange(length, length);
|
||
} else {
|
||
targetElement.focus();
|
||
}
|
||
};
|
||
|
||
|
||
/**
|
||
* Check whether the given target element is a child of a scrollable layer and if so, set a flag on it.
|
||
*
|
||
* @param {EventTarget|Element} targetElement
|
||
*/
|
||
FastClick.prototype.updateScrollParent = function(targetElement) {
|
||
var scrollParent, parentElement;
|
||
|
||
scrollParent = targetElement.fastClickScrollParent;
|
||
|
||
// Attempt to discover whether the target element is contained within a scrollable layer. Re-check if the
|
||
// target element was moved to another parent.
|
||
if (!scrollParent || !scrollParent.contains(targetElement)) {
|
||
parentElement = targetElement;
|
||
do {
|
||
if (parentElement.scrollHeight > parentElement.offsetHeight) {
|
||
scrollParent = parentElement;
|
||
targetElement.fastClickScrollParent = parentElement;
|
||
break;
|
||
}
|
||
|
||
parentElement = parentElement.parentElement;
|
||
} while (parentElement);
|
||
}
|
||
|
||
// Always update the scroll top tracker if possible.
|
||
if (scrollParent) {
|
||
scrollParent.fastClickLastScrollTop = scrollParent.scrollTop;
|
||
}
|
||
};
|
||
|
||
|
||
/**
|
||
* @param {EventTarget} targetElement
|
||
* @returns {Element|EventTarget}
|
||
*/
|
||
FastClick.prototype.getTargetElementFromEventTarget = function(eventTarget) {
|
||
|
||
// On some older browsers (notably Safari on iOS 4.1 - see issue #56) the event target may be a text node.
|
||
if (eventTarget.nodeType === Node.TEXT_NODE) {
|
||
return eventTarget.parentNode;
|
||
}
|
||
|
||
return eventTarget;
|
||
};
|
||
|
||
|
||
/**
|
||
* On touch start, record the position and scroll offset.
|
||
*
|
||
* @param {Event} event
|
||
* @returns {boolean}
|
||
*/
|
||
FastClick.prototype.onTouchStart = function(event) {
|
||
var targetElement, touch, selection;
|
||
|
||
// Ignore multiple touches, otherwise pinch-to-zoom is prevented if both fingers are on the FastClick element (issue #111).
|
||
if (event.targetTouches.length > 1) {
|
||
return true;
|
||
}
|
||
|
||
targetElement = this.getTargetElementFromEventTarget(event.target);
|
||
touch = event.targetTouches[0];
|
||
|
||
if (deviceIsIOS) {
|
||
|
||
// Only trusted events will deselect text on iOS (issue #49)
|
||
selection = window.getSelection();
|
||
if (selection.rangeCount && !selection.isCollapsed) {
|
||
return true;
|
||
}
|
||
|
||
if (!deviceIsIOS4) {
|
||
|
||
// Weird things happen on iOS when an alert or confirm dialog is opened from a click event callback (issue #23):
|
||
// when the user next taps anywhere else on the page, new touchstart and touchend events are dispatched
|
||
// with the same identifier as the touch event that previously triggered the click that triggered the alert.
|
||
// Sadly, there is an issue on iOS 4 that causes some normal touch events to have the same identifier as an
|
||
// immediately preceeding touch event (issue #52), so this fix is unavailable on that platform.
|
||
// Issue 120: touch.identifier is 0 when Chrome dev tools 'Emulate touch events' is set with an iOS device UA string,
|
||
// which causes all touch events to be ignored. As this block only applies to iOS, and iOS identifiers are always long,
|
||
// random integers, it's safe to to continue if the identifier is 0 here.
|
||
if (touch.identifier && touch.identifier === this.lastTouchIdentifier) {
|
||
event.preventDefault();
|
||
return false;
|
||
}
|
||
|
||
this.lastTouchIdentifier = touch.identifier;
|
||
|
||
// If the target element is a child of a scrollable layer (using -webkit-overflow-scrolling: touch) and:
|
||
// 1) the user does a fling scroll on the scrollable layer
|
||
// 2) the user stops the fling scroll with another tap
|
||
// then the event.target of the last 'touchend' event will be the element that was under the user's finger
|
||
// when the fling scroll was started, causing FastClick to send a click event to that layer - unless a check
|
||
// is made to ensure that a parent layer was not scrolled before sending a synthetic click (issue #42).
|
||
this.updateScrollParent(targetElement);
|
||
}
|
||
}
|
||
|
||
this.trackingClick = true;
|
||
this.trackingClickStart = event.timeStamp;
|
||
this.targetElement = targetElement;
|
||
|
||
this.touchStartX = touch.pageX;
|
||
this.touchStartY = touch.pageY;
|
||
|
||
// Prevent phantom clicks on fast double-tap (issue #36)
|
||
if ((event.timeStamp - this.lastClickTime) < this.tapDelay) {
|
||
event.preventDefault();
|
||
}
|
||
|
||
return true;
|
||
};
|
||
|
||
|
||
/**
|
||
* Based on a touchmove event object, check whether the touch has moved past a boundary since it started.
|
||
*
|
||
* @param {Event} event
|
||
* @returns {boolean}
|
||
*/
|
||
FastClick.prototype.touchHasMoved = function(event) {
|
||
var touch = event.changedTouches[0], boundary = this.touchBoundary;
|
||
|
||
if (Math.abs(touch.pageX - this.touchStartX) > boundary || Math.abs(touch.pageY - this.touchStartY) > boundary) {
|
||
return true;
|
||
}
|
||
|
||
return false;
|
||
};
|
||
|
||
|
||
/**
|
||
* Update the last position.
|
||
*
|
||
* @param {Event} event
|
||
* @returns {boolean}
|
||
*/
|
||
FastClick.prototype.onTouchMove = function(event) {
|
||
if (!this.trackingClick) {
|
||
return true;
|
||
}
|
||
|
||
// If the touch has moved, cancel the click tracking
|
||
if (this.targetElement !== this.getTargetElementFromEventTarget(event.target) || this.touchHasMoved(event)) {
|
||
this.trackingClick = false;
|
||
this.targetElement = null;
|
||
}
|
||
|
||
return true;
|
||
};
|
||
|
||
|
||
/**
|
||
* Attempt to find the labelled control for the given label element.
|
||
*
|
||
* @param {EventTarget|HTMLLabelElement} labelElement
|
||
* @returns {Element|null}
|
||
*/
|
||
FastClick.prototype.findControl = function(labelElement) {
|
||
|
||
// Fast path for newer browsers supporting the HTML5 control attribute
|
||
if (labelElement.control !== undefined) {
|
||
return labelElement.control;
|
||
}
|
||
|
||
// All browsers under test that support touch events also support the HTML5 htmlFor attribute
|
||
if (labelElement.htmlFor) {
|
||
return document.getElementById(labelElement.htmlFor);
|
||
}
|
||
|
||
// If no for attribute exists, attempt to retrieve the first labellable descendant element
|
||
// the list of which is defined here: http://www.w3.org/TR/html5/forms.html#category-label
|
||
return labelElement.querySelector('button, input:not([type=hidden]), keygen, meter, output, progress, select, textarea');
|
||
};
|
||
|
||
|
||
/**
|
||
* On touch end, determine whether to send a click event at once.
|
||
*
|
||
* @param {Event} event
|
||
* @returns {boolean}
|
||
*/
|
||
FastClick.prototype.onTouchEnd = function(event) {
|
||
var forElement, trackingClickStart, targetTagName, scrollParent, touch, targetElement = this.targetElement;
|
||
|
||
if (!this.trackingClick) {
|
||
return true;
|
||
}
|
||
|
||
// Prevent phantom clicks on fast double-tap (issue #36)
|
||
if ((event.timeStamp - this.lastClickTime) < this.tapDelay) {
|
||
this.cancelNextClick = true;
|
||
return true;
|
||
}
|
||
|
||
if ((event.timeStamp - this.trackingClickStart) > this.tapTimeout) {
|
||
return true;
|
||
}
|
||
|
||
// Reset to prevent wrong click cancel on input (issue #156).
|
||
this.cancelNextClick = false;
|
||
|
||
this.lastClickTime = event.timeStamp;
|
||
|
||
trackingClickStart = this.trackingClickStart;
|
||
this.trackingClick = false;
|
||
this.trackingClickStart = 0;
|
||
|
||
// On some iOS devices, the targetElement supplied with the event is invalid if the layer
|
||
// is performing a transition or scroll, and has to be re-detected manually. Note that
|
||
// for this to function correctly, it must be called *after* the event target is checked!
|
||
// See issue #57; also filed as rdar://13048589 .
|
||
if (deviceIsIOSWithBadTarget) {
|
||
touch = event.changedTouches[0];
|
||
|
||
// In certain cases arguments of elementFromPoint can be negative, so prevent setting targetElement to null
|
||
targetElement = document.elementFromPoint(touch.pageX - window.pageXOffset, touch.pageY - window.pageYOffset) || targetElement;
|
||
targetElement.fastClickScrollParent = this.targetElement.fastClickScrollParent;
|
||
}
|
||
|
||
targetTagName = targetElement.tagName.toLowerCase();
|
||
if (targetTagName === 'label') {
|
||
forElement = this.findControl(targetElement);
|
||
if (forElement) {
|
||
this.focus(targetElement);
|
||
if (deviceIsAndroid) {
|
||
return false;
|
||
}
|
||
|
||
targetElement = forElement;
|
||
}
|
||
} else if (this.needsFocus(targetElement)) {
|
||
|
||
// Case 1: If the touch started a while ago (best guess is 100ms based on tests for issue #36) then focus will be triggered anyway. Return early and unset the target element reference so that the subsequent click will be allowed through.
|
||
// Case 2: Without this exception for input elements tapped when the document is contained in an iframe, then any inputted text won't be visible even though the value attribute is updated as the user types (issue #37).
|
||
if ((event.timeStamp - trackingClickStart) > 100 || (deviceIsIOS && window.top !== window && targetTagName === 'input')) {
|
||
this.targetElement = null;
|
||
return false;
|
||
}
|
||
|
||
this.focus(targetElement);
|
||
this.sendClick(targetElement, event);
|
||
|
||
// Select elements need the event to go through on iOS 4, otherwise the selector menu won't open.
|
||
// Also this breaks opening selects when VoiceOver is active on iOS6, iOS7 (and possibly others)
|
||
if (!deviceIsIOS || targetTagName !== 'select') {
|
||
this.targetElement = null;
|
||
event.preventDefault();
|
||
}
|
||
|
||
return false;
|
||
}
|
||
|
||
if (deviceIsIOS && !deviceIsIOS4) {
|
||
|
||
// Don't send a synthetic click event if the target element is contained within a parent layer that was scrolled
|
||
// and this tap is being used to stop the scrolling (usually initiated by a fling - issue #42).
|
||
scrollParent = targetElement.fastClickScrollParent;
|
||
if (scrollParent && scrollParent.fastClickLastScrollTop !== scrollParent.scrollTop) {
|
||
return true;
|
||
}
|
||
}
|
||
|
||
// Prevent the actual click from going though - unless the target node is marked as requiring
|
||
// real clicks or if it is in the whitelist in which case only non-programmatic clicks are permitted.
|
||
if (!this.needsClick(targetElement)) {
|
||
event.preventDefault();
|
||
this.sendClick(targetElement, event);
|
||
}
|
||
|
||
return false;
|
||
};
|
||
|
||
|
||
/**
|
||
* On touch cancel, stop tracking the click.
|
||
*
|
||
* @returns {void}
|
||
*/
|
||
FastClick.prototype.onTouchCancel = function() {
|
||
this.trackingClick = false;
|
||
this.targetElement = null;
|
||
};
|
||
|
||
|
||
/**
|
||
* Determine mouse events which should be permitted.
|
||
*
|
||
* @param {Event} event
|
||
* @returns {boolean}
|
||
*/
|
||
FastClick.prototype.onMouse = function(event) {
|
||
|
||
// If a target element was never set (because a touch event was never fired) allow the event
|
||
if (!this.targetElement) {
|
||
return true;
|
||
}
|
||
|
||
if (event.forwardedTouchEvent) {
|
||
return true;
|
||
}
|
||
|
||
// Programmatically generated events targeting a specific element should be permitted
|
||
if (!event.cancelable) {
|
||
return true;
|
||
}
|
||
|
||
// Derive and check the target element to see whether the mouse event needs to be permitted;
|
||
// unless explicitly enabled, prevent non-touch click events from triggering actions,
|
||
// to prevent ghost/doubleclicks.
|
||
if (!this.needsClick(this.targetElement) || this.cancelNextClick) {
|
||
|
||
// Prevent any user-added listeners declared on FastClick element from being fired.
|
||
if (event.stopImmediatePropagation) {
|
||
event.stopImmediatePropagation();
|
||
} else {
|
||
|
||
// Part of the hack for browsers that don't support Event#stopImmediatePropagation (e.g. Android 2)
|
||
event.propagationStopped = true;
|
||
}
|
||
|
||
// Cancel the event
|
||
event.stopPropagation();
|
||
event.preventDefault();
|
||
|
||
return false;
|
||
}
|
||
|
||
// If the mouse event is permitted, return true for the action to go through.
|
||
return true;
|
||
};
|
||
|
||
|
||
/**
|
||
* On actual clicks, determine whether this is a touch-generated click, a click action occurring
|
||
* naturally after a delay after a touch (which needs to be cancelled to avoid duplication), or
|
||
* an actual click which should be permitted.
|
||
*
|
||
* @param {Event} event
|
||
* @returns {boolean}
|
||
*/
|
||
FastClick.prototype.onClick = function(event) {
|
||
var permitted;
|
||
|
||
// It's possible for another FastClick-like library delivered with third-party code to fire a click event before FastClick does (issue #44). In that case, set the click-tracking flag back to false and return early. This will cause onTouchEnd to return early.
|
||
if (this.trackingClick) {
|
||
this.targetElement = null;
|
||
this.trackingClick = false;
|
||
return true;
|
||
}
|
||
|
||
// Very odd behaviour on iOS (issue #18): if a submit element is present inside a form and the user hits enter in the iOS simulator or clicks the Go button on the pop-up OS keyboard the a kind of 'fake' click event will be triggered with the submit-type input element as the target.
|
||
if (event.target.type === 'submit' && event.detail === 0) {
|
||
return true;
|
||
}
|
||
|
||
permitted = this.onMouse(event);
|
||
|
||
// Only unset targetElement if the click is not permitted. This will ensure that the check for !targetElement in onMouse fails and the browser's click doesn't go through.
|
||
if (!permitted) {
|
||
this.targetElement = null;
|
||
}
|
||
|
||
// If clicks are permitted, return true for the action to go through.
|
||
return permitted;
|
||
};
|
||
|
||
|
||
/**
|
||
* Remove all FastClick's event listeners.
|
||
*
|
||
* @returns {void}
|
||
*/
|
||
FastClick.prototype.destroy = function() {
|
||
var layer = this.layer;
|
||
|
||
if (deviceIsAndroid) {
|
||
layer.removeEventListener('mouseover', this.onMouse, true);
|
||
layer.removeEventListener('mousedown', this.onMouse, true);
|
||
layer.removeEventListener('mouseup', this.onMouse, true);
|
||
}
|
||
|
||
layer.removeEventListener('click', this.onClick, true);
|
||
layer.removeEventListener('touchstart', this.onTouchStart, false);
|
||
layer.removeEventListener('touchmove', this.onTouchMove, false);
|
||
layer.removeEventListener('touchend', this.onTouchEnd, false);
|
||
layer.removeEventListener('touchcancel', this.onTouchCancel, false);
|
||
};
|
||
|
||
|
||
/**
|
||
* Check whether FastClick is needed.
|
||
*
|
||
* @param {Element} layer The layer to listen on
|
||
*/
|
||
FastClick.notNeeded = function(layer) {
|
||
var metaViewport;
|
||
var chromeVersion;
|
||
var blackberryVersion;
|
||
var firefoxVersion;
|
||
|
||
// Devices that don't support touch don't need FastClick
|
||
if (typeof window.ontouchstart === 'undefined') {
|
||
return true;
|
||
}
|
||
|
||
// Chrome version - zero for other browsers
|
||
chromeVersion = +(/Chrome\/([0-9]+)/.exec(navigator.userAgent) || [,0])[1];
|
||
|
||
if (chromeVersion) {
|
||
|
||
if (deviceIsAndroid) {
|
||
metaViewport = document.querySelector('meta[name=viewport]');
|
||
|
||
if (metaViewport) {
|
||
// Chrome on Android with user-scalable="no" doesn't need FastClick (issue #89)
|
||
if (metaViewport.content.indexOf('user-scalable=no') !== -1) {
|
||
return true;
|
||
}
|
||
// Chrome 32 and above with width=device-width or less don't need FastClick
|
||
if (chromeVersion > 31 && document.documentElement.scrollWidth <= window.outerWidth) {
|
||
return true;
|
||
}
|
||
}
|
||
|
||
// Chrome desktop doesn't need FastClick (issue #15)
|
||
} else {
|
||
return true;
|
||
}
|
||
}
|
||
|
||
if (deviceIsBlackBerry10) {
|
||
blackberryVersion = navigator.userAgent.match(/Version\/([0-9]*)\.([0-9]*)/);
|
||
|
||
// BlackBerry 10.3+ does not require Fastclick library.
|
||
// https://github.com/ftlabs/fastclick/issues/251
|
||
if (blackberryVersion[1] >= 10 && blackberryVersion[2] >= 3) {
|
||
metaViewport = document.querySelector('meta[name=viewport]');
|
||
|
||
if (metaViewport) {
|
||
// user-scalable=no eliminates click delay.
|
||
if (metaViewport.content.indexOf('user-scalable=no') !== -1) {
|
||
return true;
|
||
}
|
||
// width=device-width (or less than device-width) eliminates click delay.
|
||
if (document.documentElement.scrollWidth <= window.outerWidth) {
|
||
return true;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
// IE10 with -ms-touch-action: none or manipulation, which disables double-tap-to-zoom (issue #97)
|
||
if (layer.style.msTouchAction === 'none' || layer.style.touchAction === 'manipulation') {
|
||
return true;
|
||
}
|
||
|
||
// Firefox version - zero for other browsers
|
||
firefoxVersion = +(/Firefox\/([0-9]+)/.exec(navigator.userAgent) || [,0])[1];
|
||
|
||
if (firefoxVersion >= 27) {
|
||
// Firefox 27+ does not have tap delay if the content is not zoomable - https://bugzilla.mozilla.org/show_bug.cgi?id=922896
|
||
|
||
metaViewport = document.querySelector('meta[name=viewport]');
|
||
if (metaViewport && (metaViewport.content.indexOf('user-scalable=no') !== -1 || document.documentElement.scrollWidth <= window.outerWidth)) {
|
||
return true;
|
||
}
|
||
}
|
||
|
||
// IE11: prefixed -ms-touch-action is no longer supported and it's recomended to use non-prefixed version
|
||
// http://msdn.microsoft.com/en-us/library/windows/apps/Hh767313.aspx
|
||
if (layer.style.touchAction === 'none' || layer.style.touchAction === 'manipulation') {
|
||
return true;
|
||
}
|
||
|
||
return false;
|
||
};
|
||
|
||
|
||
/**
|
||
* Factory method for creating a FastClick object
|
||
*
|
||
* @param {Element} layer The layer to listen on
|
||
* @param {Object} [options={}] The options to override the defaults
|
||
*/
|
||
FastClick.attach = function(layer, options) {
|
||
return new FastClick(layer, options);
|
||
};
|
||
|
||
|
||
if (true) {
|
||
|
||
// AMD. Register as an anonymous module.
|
||
!(__WEBPACK_AMD_DEFINE_RESULT__ = (function() {
|
||
return FastClick;
|
||
}).call(exports, __webpack_require__, exports, module),
|
||
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
||
} else if (typeof module !== 'undefined' && module.exports) {
|
||
module.exports = FastClick.attach;
|
||
module.exports.FastClick = FastClick;
|
||
} else {
|
||
window.FastClick = FastClick;
|
||
}
|
||
}());
|
||
|
||
|
||
/***/ }),
|
||
/* 21 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
|
||
exports.__esModule = true;
|
||
|
||
var _Event = __webpack_require__(22);
|
||
|
||
var _Event2 = _interopRequireDefault(_Event);
|
||
|
||
var _Header = __webpack_require__(24);
|
||
|
||
var _Header2 = _interopRequireDefault(_Header);
|
||
|
||
var _Nav = __webpack_require__(27);
|
||
|
||
var _Nav2 = _interopRequireDefault(_Nav);
|
||
|
||
var _Search = __webpack_require__(31);
|
||
|
||
var _Search2 = _interopRequireDefault(_Search);
|
||
|
||
var _Sidebar = __webpack_require__(37);
|
||
|
||
var _Sidebar2 = _interopRequireDefault(_Sidebar);
|
||
|
||
var _Source = __webpack_require__(39);
|
||
|
||
var _Source2 = _interopRequireDefault(_Source);
|
||
|
||
var _Tabs = __webpack_require__(45);
|
||
|
||
var _Tabs2 = _interopRequireDefault(_Tabs);
|
||
|
||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||
|
||
/* ----------------------------------------------------------------------------
|
||
* Module
|
||
* ------------------------------------------------------------------------- */
|
||
|
||
exports.default = {
|
||
Event: _Event2.default,
|
||
Header: _Header2.default,
|
||
Nav: _Nav2.default,
|
||
Search: _Search2.default,
|
||
Sidebar: _Sidebar2.default,
|
||
Source: _Source2.default,
|
||
Tabs: _Tabs2.default
|
||
}; /*
|
||
* Copyright (c) 2016-2018 Martin Donath <martin.donath@squidfunk.com>
|
||
*
|
||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||
* of this software and associated documentation files (the "Software"), to
|
||
* deal in the Software without restriction, including without limitation the
|
||
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||
* sell copies of the Software, and to permit persons to whom the Software is
|
||
* furnished to do so, subject to the following conditions:
|
||
*
|
||
* The above copyright notice and this permission notice shall be included in
|
||
* all copies or substantial portions of the Software.
|
||
*
|
||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||
* IN THE SOFTWARE.
|
||
*/
|
||
|
||
/***/ }),
|
||
/* 22 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
|
||
exports.__esModule = true;
|
||
|
||
var _Listener = __webpack_require__(3);
|
||
|
||
var _Listener2 = _interopRequireDefault(_Listener);
|
||
|
||
var _MatchMedia = __webpack_require__(23);
|
||
|
||
var _MatchMedia2 = _interopRequireDefault(_MatchMedia);
|
||
|
||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||
|
||
/* ----------------------------------------------------------------------------
|
||
* Module
|
||
* ------------------------------------------------------------------------- */
|
||
|
||
/*
|
||
* Copyright (c) 2016-2018 Martin Donath <martin.donath@squidfunk.com>
|
||
*
|
||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||
* of this software and associated documentation files (the "Software"), to
|
||
* deal in the Software without restriction, including without limitation the
|
||
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||
* sell copies of the Software, and to permit persons to whom the Software is
|
||
* furnished to do so, subject to the following conditions:
|
||
*
|
||
* The above copyright notice and this permission notice shall be included in
|
||
* all copies or substantial portions of the Software.
|
||
*
|
||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||
* IN THE SOFTWARE.
|
||
*/
|
||
|
||
exports.default = {
|
||
Listener: _Listener2.default,
|
||
MatchMedia: _MatchMedia2.default
|
||
};
|
||
|
||
/***/ }),
|
||
/* 23 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
|
||
exports.__esModule = true;
|
||
|
||
var _Listener = __webpack_require__(3);
|
||
|
||
var _Listener2 = _interopRequireDefault(_Listener);
|
||
|
||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||
|
||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } /*
|
||
* Copyright (c) 2016-2018 Martin Donath <martin.donath@squidfunk.com>
|
||
*
|
||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||
* of this software and associated documentation files (the "Software"), to
|
||
* deal in the Software without restriction, including without limitation the
|
||
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||
* sell copies of the Software, and to permit persons to whom the Software is
|
||
* furnished to do so, subject to the following conditions:
|
||
*
|
||
* The above copyright notice and this permission notice shall be included in
|
||
* all copies or substantial portions of the Software.
|
||
*
|
||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||
* IN THE SOFTWARE.
|
||
*/
|
||
|
||
// eslint-disable-line no-unused-vars
|
||
|
||
/* ----------------------------------------------------------------------------
|
||
* Class
|
||
* ------------------------------------------------------------------------- */
|
||
|
||
var MatchMedia =
|
||
|
||
/**
|
||
* Media query listener
|
||
*
|
||
* This class listens for state changes of media queries and automatically
|
||
* switches the given listeners on or off.
|
||
*
|
||
* @constructor
|
||
*
|
||
* @property {Function} handler_ - Media query event handler
|
||
*
|
||
* @param {string} query - Media query to test for
|
||
* @param {Listener} listener - Event listener
|
||
*/
|
||
function MatchMedia(query, listener) {
|
||
_classCallCheck(this, MatchMedia);
|
||
|
||
this.handler_ = function (mq) {
|
||
if (mq.matches) listener.listen();else listener.unlisten();
|
||
};
|
||
|
||
/* Initialize media query listener */
|
||
var media = window.matchMedia(query);
|
||
media.addListener(this.handler_);
|
||
|
||
/* Always check at initialization */
|
||
this.handler_(media);
|
||
};
|
||
|
||
exports.default = MatchMedia;
|
||
|
||
/***/ }),
|
||
/* 24 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
|
||
exports.__esModule = true;
|
||
|
||
var _Shadow = __webpack_require__(25);
|
||
|
||
var _Shadow2 = _interopRequireDefault(_Shadow);
|
||
|
||
var _Title = __webpack_require__(26);
|
||
|
||
var _Title2 = _interopRequireDefault(_Title);
|
||
|
||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||
|
||
/* ----------------------------------------------------------------------------
|
||
* Module
|
||
* ------------------------------------------------------------------------- */
|
||
|
||
/*
|
||
* Copyright (c) 2016-2018 Martin Donath <martin.donath@squidfunk.com>
|
||
*
|
||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||
* of this software and associated documentation files (the "Software"), to
|
||
* deal in the Software without restriction, including without limitation the
|
||
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||
* sell copies of the Software, and to permit persons to whom the Software is
|
||
* furnished to do so, subject to the following conditions:
|
||
*
|
||
* The above copyright notice and this permission notice shall be included in
|
||
* all copies or substantial portions of the Software.
|
||
*
|
||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||
* IN THE SOFTWARE.
|
||
*/
|
||
|
||
exports.default = {
|
||
Shadow: _Shadow2.default,
|
||
Title: _Title2.default
|
||
};
|
||
|
||
/***/ }),
|
||
/* 25 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
|
||
exports.__esModule = true;
|
||
|
||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||
|
||
/*
|
||
* Copyright (c) 2016-2018 Martin Donath <martin.donath@squidfunk.com>
|
||
*
|
||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||
* of this software and associated documentation files (the "Software"), to
|
||
* deal in the Software without restriction, including without limitation the
|
||
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||
* sell copies of the Software, and to permit persons to whom the Software is
|
||
* furnished to do so, subject to the following conditions:
|
||
*
|
||
* The above copyright notice and this permission notice shall be included in
|
||
* all copies or substantial portions of the Software.
|
||
*
|
||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||
* IN THE SOFTWARE.
|
||
*/
|
||
|
||
/* ----------------------------------------------------------------------------
|
||
* Class
|
||
* ------------------------------------------------------------------------- */
|
||
|
||
var Shadow = function () {
|
||
|
||
/**
|
||
* Show or hide header shadow depending on page y-offset
|
||
*
|
||
* @constructor
|
||
*
|
||
* @property {HTMLElement} el_ - Content container
|
||
* @property {HTMLElement} header_ - Header
|
||
* @property {number} height_ - Offset height of previous nodes
|
||
* @property {boolean} active_ - Header shadow state
|
||
*
|
||
* @param {(string|HTMLElement)} el - Selector or HTML element
|
||
* @param {(string|HTMLElement)} header - Selector or HTML element
|
||
*/
|
||
function Shadow(el, header) {
|
||
_classCallCheck(this, Shadow);
|
||
|
||
var ref = typeof el === "string" ? document.querySelector(el) : el;
|
||
if (!(ref instanceof HTMLElement) || !(ref.parentNode instanceof HTMLElement)) throw new ReferenceError();
|
||
this.el_ = ref.parentNode;
|
||
|
||
/* Retrieve header */
|
||
ref = typeof header === "string" ? document.querySelector(header) : header;
|
||
if (!(ref instanceof HTMLElement)) throw new ReferenceError();
|
||
this.header_ = ref;
|
||
|
||
/* Initialize height and state */
|
||
this.height_ = 0;
|
||
this.active_ = false;
|
||
}
|
||
|
||
/**
|
||
* Calculate total height of previous nodes
|
||
*/
|
||
|
||
|
||
Shadow.prototype.setup = function setup() {
|
||
var current = this.el_;
|
||
while (current = current.previousElementSibling) {
|
||
if (!(current instanceof HTMLElement)) throw new ReferenceError();
|
||
this.height_ += current.offsetHeight;
|
||
}
|
||
this.update();
|
||
};
|
||
|
||
/**
|
||
* Update shadow state
|
||
*
|
||
* @param {Event} ev - Event
|
||
*/
|
||
|
||
|
||
Shadow.prototype.update = function update(ev) {
|
||
if (ev && (ev.type === "resize" || ev.type === "orientationchange")) {
|
||
this.height_ = 0;
|
||
this.setup();
|
||
} else {
|
||
var active = window.pageYOffset >= this.height_;
|
||
if (active !== this.active_) this.header_.dataset.mdState = (this.active_ = active) ? "shadow" : "";
|
||
}
|
||
};
|
||
|
||
/**
|
||
* Reset shadow state
|
||
*/
|
||
|
||
|
||
Shadow.prototype.reset = function reset() {
|
||
this.header_.dataset.mdState = "";
|
||
this.height_ = 0;
|
||
this.active_ = false;
|
||
};
|
||
|
||
return Shadow;
|
||
}();
|
||
|
||
exports.default = Shadow;
|
||
|
||
/***/ }),
|
||
/* 26 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
|
||
exports.__esModule = true;
|
||
|
||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||
|
||
/*
|
||
* Copyright (c) 2016-2018 Martin Donath <martin.donath@squidfunk.com>
|
||
*
|
||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||
* of this software and associated documentation files (the "Software"), to
|
||
* deal in the Software without restriction, including without limitation the
|
||
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||
* sell copies of the Software, and to permit persons to whom the Software is
|
||
* furnished to do so, subject to the following conditions:
|
||
*
|
||
* The above copyright notice and this permission notice shall be included in
|
||
* all copies or substantial portions of the Software.
|
||
*
|
||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||
* IN THE SOFTWARE.
|
||
*/
|
||
|
||
/* ----------------------------------------------------------------------------
|
||
* Class
|
||
* ------------------------------------------------------------------------- */
|
||
|
||
var Title = function () {
|
||
|
||
/**
|
||
* Swap header title topics when header is scrolled past
|
||
*
|
||
* @constructor
|
||
*
|
||
* @property {HTMLElement} el_ - Element
|
||
* @property {HTMLElement} header_ - Header
|
||
* @property {boolean} active_ - Title state
|
||
*
|
||
* @param {(string|HTMLElement)} el - Selector or HTML element
|
||
* @param {(string|HTMLHeadingElement)} header - Selector or HTML element
|
||
*/
|
||
function Title(el, header) {
|
||
_classCallCheck(this, Title);
|
||
|
||
var ref = typeof el === "string" ? document.querySelector(el) : el;
|
||
if (!(ref instanceof HTMLElement)) throw new ReferenceError();
|
||
this.el_ = ref;
|
||
|
||
/* Retrieve header */
|
||
ref = typeof header === "string" ? document.querySelector(header) : header;
|
||
if (!(ref instanceof HTMLHeadingElement)) throw new ReferenceError();
|
||
this.header_ = ref;
|
||
|
||
/* Initialize state */
|
||
this.active_ = false;
|
||
}
|
||
|
||
/**
|
||
* Setup title state
|
||
*/
|
||
|
||
|
||
Title.prototype.setup = function setup() {
|
||
var _this = this;
|
||
|
||
Array.prototype.forEach.call(this.el_.children, function (node) {
|
||
// TODO: use childNodes here for IE?
|
||
node.style.width = _this.el_.offsetWidth - 20 + "px";
|
||
});
|
||
};
|
||
|
||
/**
|
||
* Update title state
|
||
*
|
||
* @param {Event} ev - Event
|
||
*/
|
||
|
||
|
||
Title.prototype.update = function update(ev) {
|
||
var _this2 = this;
|
||
|
||
var active = window.pageYOffset >= this.header_.offsetTop;
|
||
if (active !== this.active_) this.el_.dataset.mdState = (this.active_ = active) ? "active" : "";
|
||
|
||
/* Hack: induce ellipsis on topics */
|
||
if (ev.type === "resize" || ev.type === "orientationchange") {
|
||
Array.prototype.forEach.call(this.el_.children, function (node) {
|
||
node.style.width = _this2.el_.offsetWidth - 20 + "px";
|
||
});
|
||
}
|
||
};
|
||
|
||
/**
|
||
* Reset title state
|
||
*/
|
||
|
||
|
||
Title.prototype.reset = function reset() {
|
||
this.el_.dataset.mdState = "";
|
||
this.el_.style.width = "";
|
||
this.active_ = false;
|
||
};
|
||
|
||
return Title;
|
||
}();
|
||
|
||
exports.default = Title;
|
||
|
||
/***/ }),
|
||
/* 27 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
|
||
exports.__esModule = true;
|
||
|
||
var _Blur = __webpack_require__(28);
|
||
|
||
var _Blur2 = _interopRequireDefault(_Blur);
|
||
|
||
var _Collapse = __webpack_require__(29);
|
||
|
||
var _Collapse2 = _interopRequireDefault(_Collapse);
|
||
|
||
var _Scrolling = __webpack_require__(30);
|
||
|
||
var _Scrolling2 = _interopRequireDefault(_Scrolling);
|
||
|
||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||
|
||
/* ----------------------------------------------------------------------------
|
||
* Module
|
||
* ------------------------------------------------------------------------- */
|
||
|
||
exports.default = {
|
||
Blur: _Blur2.default,
|
||
Collapse: _Collapse2.default,
|
||
Scrolling: _Scrolling2.default
|
||
}; /*
|
||
* Copyright (c) 2016-2018 Martin Donath <martin.donath@squidfunk.com>
|
||
*
|
||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||
* of this software and associated documentation files (the "Software"), to
|
||
* deal in the Software without restriction, including without limitation the
|
||
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||
* sell copies of the Software, and to permit persons to whom the Software is
|
||
* furnished to do so, subject to the following conditions:
|
||
*
|
||
* The above copyright notice and this permission notice shall be included in
|
||
* all copies or substantial portions of the Software.
|
||
*
|
||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||
* IN THE SOFTWARE.
|
||
*/
|
||
|
||
/***/ }),
|
||
/* 28 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
|
||
exports.__esModule = true;
|
||
|
||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||
|
||
/*
|
||
* Copyright (c) 2016-2018 Martin Donath <martin.donath@squidfunk.com>
|
||
*
|
||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||
* of this software and associated documentation files (the "Software"), to
|
||
* deal in the Software without restriction, including without limitation the
|
||
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||
* sell copies of the Software, and to permit persons to whom the Software is
|
||
* furnished to do so, subject to the following conditions:
|
||
*
|
||
* The above copyright notice and this permission notice shall be included in
|
||
* all copies or substantial portions of the Software.
|
||
*
|
||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||
* IN THE SOFTWARE.
|
||
*/
|
||
|
||
/* ----------------------------------------------------------------------------
|
||
* Class
|
||
* ------------------------------------------------------------------------- */
|
||
|
||
var Blur = function () {
|
||
|
||
/**
|
||
* Blur links within the table of contents above current page y-offset
|
||
*
|
||
* @constructor
|
||
*
|
||
* @property {NodeList<HTMLElement>} els_ - Table of contents links
|
||
* @property {Array<HTMLElement>} anchors_ - Referenced anchor nodes
|
||
* @property {number} index_ - Current link index
|
||
* @property {number} offset_ - Current page y-offset
|
||
* @property {boolean} dir_ - Scroll direction change
|
||
*
|
||
* @param {(string|NodeList<HTMLElement>)} els - Selector or HTML elements
|
||
*/
|
||
function Blur(els) {
|
||
_classCallCheck(this, Blur);
|
||
|
||
this.els_ = typeof els === "string" ? document.querySelectorAll(els) : els;
|
||
|
||
/* Initialize index and page y-offset */
|
||
this.index_ = 0;
|
||
this.offset_ = window.pageYOffset;
|
||
|
||
/* Necessary state to correctly reset the index */
|
||
this.dir_ = false;
|
||
|
||
/* Index anchor node offsets for fast lookup */
|
||
this.anchors_ = [].reduce.call(this.els_, function (anchors, el) {
|
||
return anchors.concat(document.getElementById(el.hash.substring(1)) || []);
|
||
}, []);
|
||
}
|
||
|
||
/**
|
||
* Initialize blur states
|
||
*/
|
||
|
||
|
||
Blur.prototype.setup = function setup() {
|
||
this.update();
|
||
};
|
||
|
||
/**
|
||
* Update blur states
|
||
*
|
||
* Deduct the static offset of the header (56px) and sidebar offset (24px),
|
||
* see _permalinks.scss for more information.
|
||
*/
|
||
|
||
|
||
Blur.prototype.update = function update() {
|
||
var offset = window.pageYOffset;
|
||
var dir = this.offset_ - offset < 0;
|
||
|
||
/* Hack: reset index if direction changed to catch very fast scrolling,
|
||
because otherwise we would have to register a timer and that sucks */
|
||
if (this.dir_ !== dir) this.index_ = dir ? this.index_ = 0 : this.index_ = this.els_.length - 1;
|
||
|
||
/* Exit when there are no anchors */
|
||
if (this.anchors_.length === 0) return;
|
||
|
||
/* Scroll direction is down */
|
||
if (this.offset_ <= offset) {
|
||
for (var i = this.index_ + 1; i < this.els_.length; i++) {
|
||
if (this.anchors_[i].offsetTop - (56 + 24) <= offset) {
|
||
if (i > 0) this.els_[i - 1].dataset.mdState = "blur";
|
||
this.index_ = i;
|
||
} else {
|
||
break;
|
||
}
|
||
}
|
||
|
||
/* Scroll direction is up */
|
||
} else {
|
||
for (var _i = this.index_; _i >= 0; _i--) {
|
||
if (this.anchors_[_i].offsetTop - (56 + 24) > offset) {
|
||
if (_i > 0) this.els_[_i - 1].dataset.mdState = "";
|
||
} else {
|
||
this.index_ = _i;
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
|
||
/* Remember current offset and direction for next iteration */
|
||
this.offset_ = offset;
|
||
this.dir_ = dir;
|
||
};
|
||
|
||
/**
|
||
* Reset blur states
|
||
*/
|
||
|
||
|
||
Blur.prototype.reset = function reset() {
|
||
Array.prototype.forEach.call(this.els_, function (el) {
|
||
el.dataset.mdState = "";
|
||
});
|
||
|
||
/* Reset index and page y-offset */
|
||
this.index_ = 0;
|
||
this.offset_ = window.pageYOffset;
|
||
};
|
||
|
||
return Blur;
|
||
}();
|
||
|
||
exports.default = Blur;
|
||
|
||
/***/ }),
|
||
/* 29 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
|
||
exports.__esModule = true;
|
||
|
||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||
|
||
/*
|
||
* Copyright (c) 2016-2018 Martin Donath <martin.donath@squidfunk.com>
|
||
*
|
||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||
* of this software and associated documentation files (the "Software"), to
|
||
* deal in the Software without restriction, including without limitation the
|
||
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||
* sell copies of the Software, and to permit persons to whom the Software is
|
||
* furnished to do so, subject to the following conditions:
|
||
*
|
||
* The above copyright notice and this permission notice shall be included in
|
||
* all copies or substantial portions of the Software.
|
||
*
|
||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||
* IN THE SOFTWARE.
|
||
*/
|
||
|
||
/* ----------------------------------------------------------------------------
|
||
* Class
|
||
* ------------------------------------------------------------------------- */
|
||
|
||
var Collapse = function () {
|
||
|
||
/**
|
||
* Expand or collapse navigation on toggle
|
||
*
|
||
* @constructor
|
||
*
|
||
* @property {HTMLElement} el_ - Navigation list
|
||
*
|
||
* @param {(string|HTMLElement)} el - Selector or HTML element
|
||
*/
|
||
function Collapse(el) {
|
||
_classCallCheck(this, Collapse);
|
||
|
||
var ref = typeof el === "string" ? document.querySelector(el) : el;
|
||
if (!(ref instanceof HTMLElement)) throw new ReferenceError();
|
||
this.el_ = ref;
|
||
}
|
||
|
||
/**
|
||
* Initialize overflow and display for accessibility
|
||
*/
|
||
|
||
|
||
Collapse.prototype.setup = function setup() {
|
||
var current = this.el_.getBoundingClientRect().height;
|
||
|
||
/* Hidden links should not be focusable, so hide them when the navigation
|
||
is collapsed and set overflow so the outline is not cut off */
|
||
this.el_.style.display = current ? "block" : "none";
|
||
this.el_.style.overflow = current ? "visible" : "hidden";
|
||
};
|
||
|
||
/**
|
||
* Animate expand and collapse smoothly
|
||
*
|
||
* Internet Explorer 11 is very slow at recognizing changes on the dataset
|
||
* which results in the menu not expanding or collapsing properly. THerefore,
|
||
* for reasons of compatibility, the attribute accessors are used.
|
||
*/
|
||
|
||
|
||
Collapse.prototype.update = function update() {
|
||
var _this = this;
|
||
|
||
var current = this.el_.getBoundingClientRect().height;
|
||
|
||
/* Reset overflow to CSS defaults */
|
||
this.el_.style.display = "block";
|
||
this.el_.style.overflow = "";
|
||
|
||
/* Expanded, so collapse */
|
||
if (current) {
|
||
this.el_.style.maxHeight = current + "px";
|
||
requestAnimationFrame(function () {
|
||
_this.el_.setAttribute("data-md-state", "animate");
|
||
_this.el_.style.maxHeight = "0px";
|
||
});
|
||
|
||
/* Collapsed, so expand */
|
||
} else {
|
||
this.el_.setAttribute("data-md-state", "expand");
|
||
this.el_.style.maxHeight = "";
|
||
|
||
/* Read height and unset pseudo-toggled state */
|
||
var height = this.el_.getBoundingClientRect().height;
|
||
this.el_.removeAttribute("data-md-state");
|
||
|
||
/* Set initial state and animate */
|
||
this.el_.style.maxHeight = "0px";
|
||
requestAnimationFrame(function () {
|
||
_this.el_.setAttribute("data-md-state", "animate");
|
||
_this.el_.style.maxHeight = height + "px";
|
||
});
|
||
}
|
||
|
||
/* Remove state on end of transition */
|
||
var end = function end(ev) {
|
||
var target = ev.target;
|
||
if (!(target instanceof HTMLElement)) throw new ReferenceError();
|
||
|
||
/* Reset height and state */
|
||
target.removeAttribute("data-md-state");
|
||
target.style.maxHeight = "";
|
||
|
||
/* Hidden links should not be focusable, so hide them when the navigation
|
||
is collapsed and set overflow so the outline is not cut off */
|
||
target.style.display = current ? "none" : "block";
|
||
target.style.overflow = current ? "hidden" : "visible";
|
||
|
||
/* Only fire once, so directly remove event listener */
|
||
target.removeEventListener("transitionend", end);
|
||
};
|
||
this.el_.addEventListener("transitionend", end, false);
|
||
};
|
||
|
||
/**
|
||
* Reset height and pseudo-toggled state
|
||
*/
|
||
|
||
|
||
Collapse.prototype.reset = function reset() {
|
||
this.el_.dataset.mdState = "";
|
||
this.el_.style.maxHeight = "";
|
||
this.el_.style.display = "";
|
||
this.el_.style.overflow = "";
|
||
};
|
||
|
||
return Collapse;
|
||
}();
|
||
|
||
exports.default = Collapse;
|
||
|
||
/***/ }),
|
||
/* 30 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
|
||
exports.__esModule = true;
|
||
|
||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||
|
||
/*
|
||
* Copyright (c) 2016-2018 Martin Donath <martin.donath@squidfunk.com>
|
||
*
|
||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||
* of this software and associated documentation files (the "Software"), to
|
||
* deal in the Software without restriction, including without limitation the
|
||
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||
* sell copies of the Software, and to permit persons to whom the Software is
|
||
* furnished to do so, subject to the following conditions:
|
||
*
|
||
* The above copyright notice and this permission notice shall be included in
|
||
* all copies or substantial portions of the Software.
|
||
*
|
||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||
* IN THE SOFTWARE.
|
||
*/
|
||
|
||
/* ----------------------------------------------------------------------------
|
||
* Class
|
||
* ------------------------------------------------------------------------- */
|
||
|
||
var Scrolling = function () {
|
||
|
||
/**
|
||
* Set overflow scrolling on the current active pane (for iOS)
|
||
*
|
||
* @constructor
|
||
*
|
||
* @property {HTMLElement} el_ - Primary navigation
|
||
*
|
||
* @param {(string|HTMLElement)} el - Selector or HTML element
|
||
*/
|
||
function Scrolling(el) {
|
||
_classCallCheck(this, Scrolling);
|
||
|
||
var ref = typeof el === "string" ? document.querySelector(el) : el;
|
||
if (!(ref instanceof HTMLElement)) throw new ReferenceError();
|
||
this.el_ = ref;
|
||
}
|
||
|
||
/**
|
||
* Setup panes
|
||
*/
|
||
|
||
|
||
Scrolling.prototype.setup = function setup() {
|
||
|
||
/* Initially set overflow scrolling on main pane */
|
||
var main = this.el_.children[this.el_.children.length - 1];
|
||
main.style.webkitOverflowScrolling = "touch";
|
||
|
||
/* Find all toggles and check which one is active */
|
||
var toggles = this.el_.querySelectorAll("[data-md-toggle]");
|
||
Array.prototype.forEach.call(toggles, function (toggle) {
|
||
if (!(toggle instanceof HTMLInputElement)) throw new ReferenceError();
|
||
if (toggle.checked) {
|
||
|
||
/* Find corresponding navigational pane */
|
||
var pane = toggle.nextElementSibling;
|
||
if (!(pane instanceof HTMLElement)) throw new ReferenceError();
|
||
while (pane.tagName !== "NAV" && pane.nextElementSibling) {
|
||
pane = pane.nextElementSibling;
|
||
} /* Check references */
|
||
if (!(toggle.parentNode instanceof HTMLElement) || !(toggle.parentNode.parentNode instanceof HTMLElement)) throw new ReferenceError();
|
||
|
||
/* Find current and parent list elements */
|
||
var parent = toggle.parentNode.parentNode;
|
||
var target = pane.children[pane.children.length - 1];
|
||
|
||
/* Always reset all lists when transitioning */
|
||
parent.style.webkitOverflowScrolling = "";
|
||
target.style.webkitOverflowScrolling = "touch";
|
||
}
|
||
});
|
||
};
|
||
|
||
/**
|
||
* Update active panes
|
||
*
|
||
* @param {Event} ev - Change event
|
||
*/
|
||
|
||
|
||
Scrolling.prototype.update = function update(ev) {
|
||
var target = ev.target;
|
||
if (!(target instanceof HTMLElement)) throw new ReferenceError();
|
||
|
||
/* Find corresponding navigational pane */
|
||
var pane = target.nextElementSibling;
|
||
if (!(pane instanceof HTMLElement)) throw new ReferenceError();
|
||
while (pane.tagName !== "NAV" && pane.nextElementSibling) {
|
||
pane = pane.nextElementSibling;
|
||
} /* Check references */
|
||
if (!(target.parentNode instanceof HTMLElement) || !(target.parentNode.parentNode instanceof HTMLElement)) throw new ReferenceError();
|
||
|
||
/* Find parent and active panes */
|
||
var parent = target.parentNode.parentNode;
|
||
var active = pane.children[pane.children.length - 1];
|
||
|
||
/* Always reset all lists when transitioning */
|
||
parent.style.webkitOverflowScrolling = "";
|
||
active.style.webkitOverflowScrolling = "";
|
||
|
||
/* Set overflow scrolling on parent pane */
|
||
if (!target.checked) {
|
||
var end = function end() {
|
||
if (pane instanceof HTMLElement) {
|
||
parent.style.webkitOverflowScrolling = "touch";
|
||
pane.removeEventListener("transitionend", end);
|
||
}
|
||
};
|
||
pane.addEventListener("transitionend", end, false);
|
||
}
|
||
|
||
/* Set overflow scrolling on active pane */
|
||
if (target.checked) {
|
||
var _end = function _end() {
|
||
if (pane instanceof HTMLElement) {
|
||
active.style.webkitOverflowScrolling = "touch";
|
||
pane.removeEventListener("transitionend", _end);
|
||
}
|
||
};
|
||
pane.addEventListener("transitionend", _end, false);
|
||
}
|
||
};
|
||
|
||
/**
|
||
* Reset panes
|
||
*/
|
||
|
||
|
||
Scrolling.prototype.reset = function reset() {
|
||
|
||
/* Reset overflow scrolling on main pane */
|
||
this.el_.children[1].style.webkitOverflowScrolling = "";
|
||
|
||
/* Find all toggles and check which one is active */
|
||
var toggles = this.el_.querySelectorAll("[data-md-toggle]");
|
||
Array.prototype.forEach.call(toggles, function (toggle) {
|
||
if (!(toggle instanceof HTMLInputElement)) throw new ReferenceError();
|
||
if (toggle.checked) {
|
||
|
||
/* Find corresponding navigational pane */
|
||
var pane = toggle.nextElementSibling;
|
||
if (!(pane instanceof HTMLElement)) throw new ReferenceError();
|
||
while (pane.tagName !== "NAV" && pane.nextElementSibling) {
|
||
pane = pane.nextElementSibling;
|
||
} /* Check references */
|
||
if (!(toggle.parentNode instanceof HTMLElement) || !(toggle.parentNode.parentNode instanceof HTMLElement)) throw new ReferenceError();
|
||
|
||
/* Find parent and active panes */
|
||
var parent = toggle.parentNode.parentNode;
|
||
var active = pane.children[pane.children.length - 1];
|
||
|
||
/* Always reset all lists when transitioning */
|
||
parent.style.webkitOverflowScrolling = "";
|
||
active.style.webkitOverflowScrolling = "";
|
||
}
|
||
});
|
||
};
|
||
|
||
return Scrolling;
|
||
}();
|
||
|
||
exports.default = Scrolling;
|
||
|
||
/***/ }),
|
||
/* 31 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
|
||
exports.__esModule = true;
|
||
|
||
var _Lock = __webpack_require__(32);
|
||
|
||
var _Lock2 = _interopRequireDefault(_Lock);
|
||
|
||
var _Result = __webpack_require__(33);
|
||
|
||
var _Result2 = _interopRequireDefault(_Result);
|
||
|
||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||
|
||
/* ----------------------------------------------------------------------------
|
||
* Module
|
||
* ------------------------------------------------------------------------- */
|
||
|
||
/*
|
||
* Copyright (c) 2016-2018 Martin Donath <martin.donath@squidfunk.com>
|
||
*
|
||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||
* of this software and associated documentation files (the "Software"), to
|
||
* deal in the Software without restriction, including without limitation the
|
||
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||
* sell copies of the Software, and to permit persons to whom the Software is
|
||
* furnished to do so, subject to the following conditions:
|
||
*
|
||
* The above copyright notice and this permission notice shall be included in
|
||
* all copies or substantial portions of the Software.
|
||
*
|
||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||
* IN THE SOFTWARE.
|
||
*/
|
||
|
||
exports.default = {
|
||
Lock: _Lock2.default,
|
||
Result: _Result2.default
|
||
};
|
||
|
||
/***/ }),
|
||
/* 32 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
|
||
exports.__esModule = true;
|
||
|
||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||
|
||
/*
|
||
* Copyright (c) 2016-2018 Martin Donath <martin.donath@squidfunk.com>
|
||
*
|
||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||
* of this software and associated documentation files (the "Software"), to
|
||
* deal in the Software without restriction, including without limitation the
|
||
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||
* sell copies of the Software, and to permit persons to whom the Software is
|
||
* furnished to do so, subject to the following conditions:
|
||
*
|
||
* The above copyright notice and this permission notice shall be included in
|
||
* all copies or substantial portions of the Software.
|
||
*
|
||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||
* IN THE SOFTWARE.
|
||
*/
|
||
|
||
/* ----------------------------------------------------------------------------
|
||
* Class
|
||
* ------------------------------------------------------------------------- */
|
||
|
||
var Lock = function () {
|
||
|
||
/**
|
||
* Lock body for full-screen search modal
|
||
*
|
||
* @constructor
|
||
*
|
||
* @property {HTMLInputElement} el_ - Lock toggle
|
||
* @property {HTMLElement} lock_ - Element to lock (document body)
|
||
* @property {number} offset_ - Current page y-offset
|
||
*
|
||
* @param {(string|HTMLElement)} el - Selector or HTML element
|
||
*/
|
||
function Lock(el) {
|
||
_classCallCheck(this, Lock);
|
||
|
||
var ref = typeof el === "string" ? document.querySelector(el) : el;
|
||
if (!(ref instanceof HTMLInputElement)) throw new ReferenceError();
|
||
this.el_ = ref;
|
||
|
||
/* Retrieve element to lock (= body) */
|
||
if (!document.body) throw new ReferenceError();
|
||
this.lock_ = document.body;
|
||
}
|
||
|
||
/**
|
||
* Setup locked state
|
||
*/
|
||
|
||
|
||
Lock.prototype.setup = function setup() {
|
||
this.update();
|
||
};
|
||
|
||
/**
|
||
* Update locked state
|
||
*/
|
||
|
||
|
||
Lock.prototype.update = function update() {
|
||
var _this = this;
|
||
|
||
/* Entering search mode */
|
||
if (this.el_.checked) {
|
||
this.offset_ = window.pageYOffset;
|
||
|
||
/* Scroll to top after transition, to omit flickering */
|
||
setTimeout(function () {
|
||
window.scrollTo(0, 0);
|
||
|
||
/* Lock body after finishing transition */
|
||
if (_this.el_.checked) {
|
||
_this.lock_.dataset.mdState = "lock";
|
||
}
|
||
}, 400);
|
||
|
||
/* Exiting search mode */
|
||
} else {
|
||
this.lock_.dataset.mdState = "";
|
||
|
||
/* Scroll to former position, but wait for 100ms to prevent flashes on
|
||
iOS. A short timeout seems to do the trick */
|
||
setTimeout(function () {
|
||
if (typeof _this.offset_ !== "undefined") window.scrollTo(0, _this.offset_);
|
||
}, 100);
|
||
}
|
||
};
|
||
|
||
/**
|
||
* Reset locked state and page y-offset
|
||
*/
|
||
|
||
|
||
Lock.prototype.reset = function reset() {
|
||
if (this.lock_.dataset.mdState === "lock") window.scrollTo(0, this.offset_);
|
||
this.lock_.dataset.mdState = "";
|
||
};
|
||
|
||
return Lock;
|
||
}();
|
||
|
||
exports.default = Lock;
|
||
|
||
/***/ }),
|
||
/* 33 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
/* WEBPACK VAR INJECTION */(function(JSX) {
|
||
|
||
exports.__esModule = true;
|
||
|
||
var _escapeStringRegexp = __webpack_require__(34);
|
||
|
||
var _escapeStringRegexp2 = _interopRequireDefault(_escapeStringRegexp);
|
||
|
||
var _exposeLoaderLunrLunr = __webpack_require__(35);
|
||
|
||
var _exposeLoaderLunrLunr2 = _interopRequireDefault(_exposeLoaderLunrLunr);
|
||
|
||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||
|
||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } /*
|
||
* Copyright (c) 2016-2018 Martin Donath <martin.donath@squidfunk.com>
|
||
*
|
||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||
* of this software and associated documentation files (the "Software"), to
|
||
* deal in the Software without restriction, including without limitation the
|
||
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||
* sell copies of the Software, and to permit persons to whom the Software is
|
||
* furnished to do so, subject to the following conditions:
|
||
*
|
||
* The above copyright notice and this permission notice shall be included in
|
||
* all copies or substantial portions of the Software.
|
||
*
|
||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||
* IN THE SOFTWARE.
|
||
*/
|
||
|
||
/* ----------------------------------------------------------------------------
|
||
* Functions
|
||
* ------------------------------------------------------------------------- */
|
||
|
||
/**
|
||
* Truncate a string after the given number of character
|
||
*
|
||
* This is not a reasonable approach, since the summaries kind of suck. It
|
||
* would be better to create something more intelligent, highlighting the
|
||
* search occurrences and making a better summary out of it.
|
||
*
|
||
* @param {string} string - String to be truncated
|
||
* @param {number} n - Number of characters
|
||
* @return {string} Truncated string
|
||
*/
|
||
var truncate = function truncate(string, n) {
|
||
var i = n;
|
||
if (string.length > i) {
|
||
while (string[i] !== " " && --i > 0) {}
|
||
return string.substring(0, i) + "...";
|
||
}
|
||
return string;
|
||
};
|
||
|
||
/**
|
||
* Return the meta tag value for the given key
|
||
*
|
||
* @param {string} key - Meta name
|
||
*
|
||
* @return {string} Meta content value
|
||
*/
|
||
var translate = function translate(key) {
|
||
var meta = document.getElementsByName("lang:" + key)[0];
|
||
if (!(meta instanceof HTMLMetaElement)) throw new ReferenceError();
|
||
return meta.content;
|
||
};
|
||
|
||
/* ----------------------------------------------------------------------------
|
||
* Class
|
||
* ------------------------------------------------------------------------- */
|
||
|
||
var Result = function () {
|
||
|
||
/**
|
||
* Perform search and update results on keyboard events
|
||
*
|
||
* @constructor
|
||
*
|
||
* @property {HTMLElement} el_ - Search result container
|
||
* @property {(Array<Object>|Function)} data_ - Raw document data
|
||
* @property {Object} docs_ - Indexed documents
|
||
* @property {HTMLElement} meta_ - Search meta information
|
||
* @property {HTMLElement} list_ - Search result list
|
||
* @property {Array<string>} lang_ - Search languages
|
||
* @property {Object} message_ - Search result messages
|
||
* @property {Object} index_ - Search index
|
||
* @property {Array<Function>} stack_ - Search result stack
|
||
* @property {string} value_ - Last input value
|
||
*
|
||
* @param {(string|HTMLElement)} el - Selector or HTML element
|
||
* @param {(Array<Object>|Function)} data - Function providing data or array
|
||
*/
|
||
function Result(el, data) {
|
||
_classCallCheck(this, Result);
|
||
|
||
var ref = typeof el === "string" ? document.querySelector(el) : el;
|
||
if (!(ref instanceof HTMLElement)) throw new ReferenceError();
|
||
this.el_ = ref;
|
||
|
||
/* Retrieve metadata and list element */
|
||
|
||
var _Array$prototype$slic = Array.prototype.slice.call(this.el_.children),
|
||
meta = _Array$prototype$slic[0],
|
||
list = _Array$prototype$slic[1];
|
||
|
||
/* Set data, metadata and list elements */
|
||
|
||
|
||
this.data_ = data;
|
||
this.meta_ = meta;
|
||
this.list_ = list;
|
||
|
||
/* Load messages for metadata display */
|
||
this.message_ = {
|
||
placeholder: this.meta_.textContent,
|
||
none: translate("search.result.none"),
|
||
one: translate("search.result.one"),
|
||
other: translate("search.result.other")
|
||
|
||
/* Override tokenizer separator, if given */
|
||
};var tokenizer = translate("search.tokenizer");
|
||
if (tokenizer.length) _exposeLoaderLunrLunr2.default.tokenizer.separator = tokenizer;
|
||
|
||
/* Load search languages */
|
||
this.lang_ = translate("search.language").split(",").filter(Boolean).map(function (lang) {
|
||
return lang.trim();
|
||
});
|
||
}
|
||
|
||
/**
|
||
* Update search results
|
||
*
|
||
* @param {Event} ev - Input or focus event
|
||
*/
|
||
|
||
|
||
Result.prototype.update = function update(ev) {
|
||
var _this = this;
|
||
|
||
/* Initialize index, if this has not be done yet */
|
||
if (ev.type === "focus" && !this.index_) {
|
||
|
||
/* Initialize index */
|
||
var init = function init(data) {
|
||
|
||
/* Preprocess and index sections and documents */
|
||
_this.docs_ = data.reduce(function (docs, doc) {
|
||
var _doc$location$split = doc.location.split("#"),
|
||
path = _doc$location$split[0],
|
||
hash = _doc$location$split[1];
|
||
|
||
/* Associate section with parent document */
|
||
|
||
|
||
if (hash) {
|
||
doc.parent = docs.get(path);
|
||
|
||
/* Override page title with document title if first section */
|
||
if (doc.parent && !doc.parent.done) {
|
||
doc.parent.title = doc.title;
|
||
doc.parent.text = doc.text;
|
||
doc.parent.done = true;
|
||
}
|
||
}
|
||
|
||
/* Some cleanup on the text */
|
||
doc.text = doc.text.replace(/\n/g, " ") /* Remove newlines */
|
||
.replace(/\s+/g, " ") /* Compact whitespace */
|
||
.replace(/\s+([,.:;!?])/g, /* Correct punctuation */
|
||
function (_, char) {
|
||
return char;
|
||
});
|
||
|
||
/* Index sections and documents, but skip top-level headline */
|
||
if (!doc.parent || doc.parent.title !== doc.title) docs.set(doc.location, doc);
|
||
return docs;
|
||
}, new Map());
|
||
|
||
/* eslint-disable no-invalid-this */
|
||
var docs = _this.docs_,
|
||
lang = _this.lang_;
|
||
|
||
/* Create stack and index */
|
||
_this.stack_ = [];
|
||
_this.index_ = (0, _exposeLoaderLunrLunr2.default)(function () {
|
||
var _pipeline,
|
||
_this2 = this;
|
||
|
||
var filters = {
|
||
"search.pipeline.trimmer": _exposeLoaderLunrLunr2.default.trimmer,
|
||
"search.pipeline.stopwords": _exposeLoaderLunrLunr2.default.stopWordFilter
|
||
|
||
/* Disable stop words filter and trimmer, if desired */
|
||
};var pipeline = Object.keys(filters).reduce(function (result, name) {
|
||
if (!translate(name).match(/^false$/i)) result.push(filters[name]);
|
||
return result;
|
||
}, []);
|
||
|
||
/* Remove stemmer, as it cripples search experience */
|
||
this.pipeline.reset();
|
||
if (pipeline) (_pipeline = this.pipeline).add.apply(_pipeline, pipeline);
|
||
|
||
/* Set up alternate search languages */
|
||
if (lang.length === 1 && lang[0] !== "en" && _exposeLoaderLunrLunr2.default[lang[0]]) {
|
||
this.use(_exposeLoaderLunrLunr2.default[lang[0]]);
|
||
} else if (lang.length > 1) {
|
||
this.use(_exposeLoaderLunrLunr2.default.multiLanguage.apply(_exposeLoaderLunrLunr2.default, lang));
|
||
}
|
||
|
||
/* Index fields */
|
||
this.field("title", { boost: 10 });
|
||
this.field("text");
|
||
this.ref("location");
|
||
|
||
/* Index documents */
|
||
docs.forEach(function (doc) {
|
||
return _this2.add(doc);
|
||
});
|
||
});
|
||
|
||
/* Register event handler for lazy rendering */
|
||
var container = _this.el_.parentNode;
|
||
if (!(container instanceof HTMLElement)) throw new ReferenceError();
|
||
container.addEventListener("scroll", function () {
|
||
while (_this.stack_.length && container.scrollTop + container.offsetHeight >= container.scrollHeight - 16) {
|
||
_this.stack_.splice(0, 10).forEach(function (render) {
|
||
return render();
|
||
});
|
||
}
|
||
});
|
||
};
|
||
/* eslint-enable no-invalid-this */
|
||
|
||
/* Initialize index after short timeout to account for transition */
|
||
setTimeout(function () {
|
||
return typeof _this.data_ === "function" ? _this.data_().then(init) : init(_this.data_);
|
||
}, 250);
|
||
|
||
/* Execute search on new input event */
|
||
} else if (ev.type === "focus" || ev.type === "keyup") {
|
||
var target = ev.target;
|
||
if (!(target instanceof HTMLInputElement)) throw new ReferenceError();
|
||
|
||
/* Abort early, if index is not build or input hasn't changed */
|
||
if (!this.index_ || target.value === this.value_) return;
|
||
|
||
/* Clear current list */
|
||
while (this.list_.firstChild) {
|
||
this.list_.removeChild(this.list_.firstChild);
|
||
} /* Abort early, if search input is empty */
|
||
this.value_ = target.value;
|
||
if (this.value_.length === 0) {
|
||
this.meta_.textContent = this.message_.placeholder;
|
||
return;
|
||
}
|
||
|
||
/* Perform search on index and group sections by document */
|
||
var result = this.index_
|
||
|
||
/* Append trailing wildcard to all terms for prefix querying */
|
||
.query(function (query) {
|
||
_this.value_.toLowerCase().split(" ").filter(Boolean).forEach(function (term) {
|
||
term = _exposeLoaderLunrLunr2.default.stemmer(new _exposeLoaderLunrLunr2.default.Token(term)).toString();
|
||
for (var lang in _this.lang_) {
|
||
lang = _this.lang_[lang];
|
||
if (typeof(_exposeLoaderLunrLunr2.default[lang]) !== 'undefined' && typeof(_exposeLoaderLunrLunr2.default[lang].stemmer) !== 'undefined') {
|
||
term = _exposeLoaderLunrLunr2.default[lang].stemmer(new _exposeLoaderLunrLunr2.default.Token(term)).toString();
|
||
}
|
||
}
|
||
query.term(term, { wildcard: _exposeLoaderLunrLunr2.default.Query.wildcard.TRAILING | _exposeLoaderLunrLunr2.default.Query.wildcard.LEADING });
|
||
});
|
||
})
|
||
|
||
/* Process query results */
|
||
.reduce(function (items, item) {
|
||
var doc = _this.docs_.get(item.ref);
|
||
if (doc.parent) {
|
||
var ref = doc.parent.location;
|
||
items.set(ref, (items.get(ref) || []).concat(item));
|
||
} else {
|
||
var _ref = doc.location;
|
||
items.set(_ref, items.get(_ref) || []);
|
||
}
|
||
return items;
|
||
}, new Map());
|
||
|
||
/* Assemble regular expressions for matching */
|
||
var query = (0, _escapeStringRegexp2.default)(this.value_.trim()).replace(new RegExp(_exposeLoaderLunrLunr2.default.tokenizer.separator, "img"), "|");
|
||
var match = new RegExp("(^|" + _exposeLoaderLunrLunr2.default.tokenizer.separator + ")(" + query + ")", "img");
|
||
var highlight = function highlight(_, separator, token) {
|
||
return separator + "<em>" + token + "</em>";
|
||
};
|
||
|
||
/* Reset stack and render results */
|
||
this.stack_ = [];
|
||
result.forEach(function (items, ref) {
|
||
var _stack_;
|
||
|
||
var doc = _this.docs_.get(ref);
|
||
|
||
/* Render article */
|
||
var article = JSX.createElement(
|
||
"li",
|
||
{ "class": "md-search-result__item" },
|
||
JSX.createElement(
|
||
"a",
|
||
{ href: doc.location, title: doc.title,
|
||
"class": "md-search-result__link", tabindex: "-1" },
|
||
JSX.createElement(
|
||
"article",
|
||
{ "class": "md-search-result__article md-search-result__article--document" },
|
||
JSX.createElement(
|
||
"h1",
|
||
{ "class": "md-search-result__title" },
|
||
{ __html: doc.title.replace(match, highlight) }
|
||
),
|
||
doc.text.length ? JSX.createElement(
|
||
"p",
|
||
{ "class": "md-search-result__teaser" },
|
||
{ __html: doc.text.replace(match, highlight) }
|
||
) : {}
|
||
)
|
||
)
|
||
);
|
||
|
||
/* Render sections for article */
|
||
var sections = items.map(function (item) {
|
||
return function () {
|
||
var section = _this.docs_.get(item.ref);
|
||
article.appendChild(JSX.createElement(
|
||
"a",
|
||
{ href: section.location, title: section.title,
|
||
"class": "md-search-result__link", "data-md-rel": "anchor",
|
||
tabindex: "-1" },
|
||
JSX.createElement(
|
||
"article",
|
||
{ "class": "md-search-result__article" },
|
||
JSX.createElement(
|
||
"h1",
|
||
{ "class": "md-search-result__title" },
|
||
{ __html: section.title.replace(match, highlight) }
|
||
),
|
||
section.text.length ? JSX.createElement(
|
||
"p",
|
||
{ "class": "md-search-result__teaser" },
|
||
{ __html: truncate(section.text.replace(match, highlight), 400)
|
||
}
|
||
) : {}
|
||
)
|
||
));
|
||
};
|
||
});
|
||
|
||
/* Push articles and section renderers onto stack */
|
||
(_stack_ = _this.stack_).push.apply(_stack_, [function () {
|
||
return _this.list_.appendChild(article);
|
||
}].concat(sections));
|
||
});
|
||
|
||
/* Gradually add results as long as the height of the container grows */
|
||
var container = this.el_.parentNode;
|
||
if (!(container instanceof HTMLElement)) throw new ReferenceError();
|
||
while (this.stack_.length && container.offsetHeight >= container.scrollHeight - 16) {
|
||
this.stack_.shift()();
|
||
} /* Bind click handlers for anchors */
|
||
var anchors = this.list_.querySelectorAll("[data-md-rel=anchor]");
|
||
Array.prototype.forEach.call(anchors, function (anchor) {
|
||
["click", "keydown"].forEach(function (action) {
|
||
anchor.addEventListener(action, function (ev2) {
|
||
if (action === "keydown" && ev2.keyCode !== 13) return;
|
||
|
||
/* Close search */
|
||
var toggle = document.querySelector("[data-md-toggle=search]");
|
||
if (!(toggle instanceof HTMLInputElement)) throw new ReferenceError();
|
||
if (toggle.checked) {
|
||
toggle.checked = false;
|
||
toggle.dispatchEvent(new CustomEvent("change"));
|
||
}
|
||
|
||
/* Hack: prevent default, as the navigation needs to be delayed due
|
||
to the search body lock on mobile */
|
||
ev2.preventDefault();
|
||
setTimeout(function () {
|
||
document.location.href = anchor.href;
|
||
}, 100);
|
||
});
|
||
});
|
||
});
|
||
|
||
/* Update search metadata */
|
||
switch (result.size) {
|
||
case 0:
|
||
this.meta_.textContent = this.message_.none;
|
||
break;
|
||
case 1:
|
||
this.meta_.textContent = this.message_.one;
|
||
break;
|
||
default:
|
||
this.meta_.textContent = this.message_.other.replace("#", result.size);
|
||
}
|
||
}
|
||
};
|
||
|
||
return Result;
|
||
}();
|
||
|
||
exports.default = Result;
|
||
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0)))
|
||
|
||
/***/ }),
|
||
/* 34 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
|
||
var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g;
|
||
|
||
module.exports = function (str) {
|
||
if (typeof str !== 'string') {
|
||
throw new TypeError('Expected a string');
|
||
}
|
||
|
||
return str.replace(matchOperatorsRe, '\\$&');
|
||
};
|
||
|
||
|
||
/***/ }),
|
||
/* 35 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
/* WEBPACK VAR INJECTION */(function(global) {module.exports = global["lunr"] = __webpack_require__(36);
|
||
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)))
|
||
|
||
/***/ }),
|
||
/* 36 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
|
||
* lunr - http://lunrjs.com - A bit like Solr, but much smaller and not as bright - 2.1.5
|
||
* Copyright (C) 2017 Oliver Nightingale
|
||
* @license MIT
|
||
*/
|
||
|
||
;(function(){
|
||
|
||
/**
|
||
* A convenience function for configuring and constructing
|
||
* a new lunr Index.
|
||
*
|
||
* A lunr.Builder instance is created and the pipeline setup
|
||
* with a trimmer, stop word filter and stemmer.
|
||
*
|
||
* This builder object is yielded to the configuration function
|
||
* that is passed as a parameter, allowing the list of fields
|
||
* and other builder parameters to be customised.
|
||
*
|
||
* All documents _must_ be added within the passed config function.
|
||
*
|
||
* @example
|
||
* var idx = lunr(function () {
|
||
* this.field('title')
|
||
* this.field('body')
|
||
* this.ref('id')
|
||
*
|
||
* documents.forEach(function (doc) {
|
||
* this.add(doc)
|
||
* }, this)
|
||
* })
|
||
*
|
||
* @see {@link lunr.Builder}
|
||
* @see {@link lunr.Pipeline}
|
||
* @see {@link lunr.trimmer}
|
||
* @see {@link lunr.stopWordFilter}
|
||
* @see {@link lunr.stemmer}
|
||
* @namespace {function} lunr
|
||
*/
|
||
var lunr = function (config) {
|
||
var builder = new lunr.Builder
|
||
|
||
builder.pipeline.add(
|
||
lunr.trimmer,
|
||
lunr.stopWordFilter,
|
||
lunr.stemmer
|
||
)
|
||
|
||
builder.searchPipeline.add(
|
||
lunr.stemmer
|
||
)
|
||
|
||
config.call(builder, builder)
|
||
return builder.build()
|
||
}
|
||
|
||
lunr.version = "2.1.5"
|
||
/*!
|
||
* lunr.utils
|
||
* Copyright (C) 2017 Oliver Nightingale
|
||
*/
|
||
|
||
/**
|
||
* A namespace containing utils for the rest of the lunr library
|
||
*/
|
||
lunr.utils = {}
|
||
|
||
/**
|
||
* Print a warning message to the console.
|
||
*
|
||
* @param {String} message The message to be printed.
|
||
* @memberOf Utils
|
||
*/
|
||
lunr.utils.warn = (function (global) {
|
||
/* eslint-disable no-console */
|
||
return function (message) {
|
||
if (global.console && console.warn) {
|
||
console.warn(message)
|
||
}
|
||
}
|
||
/* eslint-enable no-console */
|
||
})(this)
|
||
|
||
/**
|
||
* Convert an object to a string.
|
||
*
|
||
* In the case of `null` and `undefined` the function returns
|
||
* the empty string, in all other cases the result of calling
|
||
* `toString` on the passed object is returned.
|
||
*
|
||
* @param {Any} obj The object to convert to a string.
|
||
* @return {String} string representation of the passed object.
|
||
* @memberOf Utils
|
||
*/
|
||
lunr.utils.asString = function (obj) {
|
||
if (obj === void 0 || obj === null) {
|
||
return ""
|
||
} else {
|
||
return obj.toString()
|
||
}
|
||
}
|
||
lunr.FieldRef = function (docRef, fieldName, stringValue) {
|
||
this.docRef = docRef
|
||
this.fieldName = fieldName
|
||
this._stringValue = stringValue
|
||
}
|
||
|
||
lunr.FieldRef.joiner = "/"
|
||
|
||
lunr.FieldRef.fromString = function (s) {
|
||
var n = s.indexOf(lunr.FieldRef.joiner)
|
||
|
||
if (n === -1) {
|
||
throw "malformed field ref string"
|
||
}
|
||
|
||
var fieldRef = s.slice(0, n),
|
||
docRef = s.slice(n + 1)
|
||
|
||
return new lunr.FieldRef (docRef, fieldRef, s)
|
||
}
|
||
|
||
lunr.FieldRef.prototype.toString = function () {
|
||
if (this._stringValue == undefined) {
|
||
this._stringValue = this.fieldName + lunr.FieldRef.joiner + this.docRef
|
||
}
|
||
|
||
return this._stringValue
|
||
}
|
||
/**
|
||
* A function to calculate the inverse document frequency for
|
||
* a posting. This is shared between the builder and the index
|
||
*
|
||
* @private
|
||
* @param {object} posting - The posting for a given term
|
||
* @param {number} documentCount - The total number of documents.
|
||
*/
|
||
lunr.idf = function (posting, documentCount) {
|
||
var documentsWithTerm = 0
|
||
|
||
for (var fieldName in posting) {
|
||
if (fieldName == '_index') continue // Ignore the term index, its not a field
|
||
documentsWithTerm += Object.keys(posting[fieldName]).length
|
||
}
|
||
|
||
var x = (documentCount - documentsWithTerm + 0.5) / (documentsWithTerm + 0.5)
|
||
|
||
return Math.log(1 + Math.abs(x))
|
||
}
|
||
|
||
/**
|
||
* A token wraps a string representation of a token
|
||
* as it is passed through the text processing pipeline.
|
||
*
|
||
* @constructor
|
||
* @param {string} [str=''] - The string token being wrapped.
|
||
* @param {object} [metadata={}] - Metadata associated with this token.
|
||
*/
|
||
lunr.Token = function (str, metadata) {
|
||
this.str = str || ""
|
||
this.metadata = metadata || {}
|
||
}
|
||
|
||
/**
|
||
* Returns the token string that is being wrapped by this object.
|
||
*
|
||
* @returns {string}
|
||
*/
|
||
lunr.Token.prototype.toString = function () {
|
||
return this.str
|
||
}
|
||
|
||
/**
|
||
* A token update function is used when updating or optionally
|
||
* when cloning a token.
|
||
*
|
||
* @callback lunr.Token~updateFunction
|
||
* @param {string} str - The string representation of the token.
|
||
* @param {Object} metadata - All metadata associated with this token.
|
||
*/
|
||
|
||
/**
|
||
* Applies the given function to the wrapped string token.
|
||
*
|
||
* @example
|
||
* token.update(function (str, metadata) {
|
||
* return str.toUpperCase()
|
||
* })
|
||
*
|
||
* @param {lunr.Token~updateFunction} fn - A function to apply to the token string.
|
||
* @returns {lunr.Token}
|
||
*/
|
||
lunr.Token.prototype.update = function (fn) {
|
||
this.str = fn(this.str, this.metadata)
|
||
return this
|
||
}
|
||
|
||
/**
|
||
* Creates a clone of this token. Optionally a function can be
|
||
* applied to the cloned token.
|
||
*
|
||
* @param {lunr.Token~updateFunction} [fn] - An optional function to apply to the cloned token.
|
||
* @returns {lunr.Token}
|
||
*/
|
||
lunr.Token.prototype.clone = function (fn) {
|
||
fn = fn || function (s) { return s }
|
||
return new lunr.Token (fn(this.str, this.metadata), this.metadata)
|
||
}
|
||
/*!
|
||
* lunr.tokenizer
|
||
* Copyright (C) 2017 Oliver Nightingale
|
||
*/
|
||
|
||
/**
|
||
* A function for splitting a string into tokens ready to be inserted into
|
||
* the search index. Uses `lunr.tokenizer.separator` to split strings, change
|
||
* the value of this property to change how strings are split into tokens.
|
||
*
|
||
* This tokenizer will convert its parameter to a string by calling `toString` and
|
||
* then will split this string on the character in `lunr.tokenizer.separator`.
|
||
* Arrays will have their elements converted to strings and wrapped in a lunr.Token.
|
||
*
|
||
* @static
|
||
* @param {?(string|object|object[])} obj - The object to convert into tokens
|
||
* @returns {lunr.Token[]}
|
||
*/
|
||
lunr.tokenizer = function (obj) {
|
||
if (obj == null || obj == undefined) {
|
||
return []
|
||
}
|
||
|
||
if (Array.isArray(obj)) {
|
||
return obj.map(function (t) {
|
||
return new lunr.Token(lunr.utils.asString(t).toLowerCase())
|
||
})
|
||
}
|
||
|
||
var str = obj.toString().trim().toLowerCase(),
|
||
len = str.length,
|
||
tokens = []
|
||
|
||
for (var sliceEnd = 0, sliceStart = 0; sliceEnd <= len; sliceEnd++) {
|
||
var char = str.charAt(sliceEnd),
|
||
sliceLength = sliceEnd - sliceStart
|
||
|
||
if ((char.match(lunr.tokenizer.separator) || sliceEnd == len)) {
|
||
|
||
if (sliceLength > 0) {
|
||
tokens.push(
|
||
new lunr.Token (str.slice(sliceStart, sliceEnd), {
|
||
position: [sliceStart, sliceLength],
|
||
index: tokens.length
|
||
})
|
||
)
|
||
}
|
||
|
||
sliceStart = sliceEnd + 1
|
||
}
|
||
|
||
}
|
||
|
||
return tokens
|
||
}
|
||
|
||
/**
|
||
* The separator used to split a string into tokens. Override this property to change the behaviour of
|
||
* `lunr.tokenizer` behaviour when tokenizing strings. By default this splits on whitespace and hyphens.
|
||
*
|
||
* @static
|
||
* @see lunr.tokenizer
|
||
*/
|
||
lunr.tokenizer.separator = /[\s\-]+/
|
||
/*!
|
||
* lunr.Pipeline
|
||
* Copyright (C) 2017 Oliver Nightingale
|
||
*/
|
||
|
||
/**
|
||
* lunr.Pipelines maintain an ordered list of functions to be applied to all
|
||
* tokens in documents entering the search index and queries being ran against
|
||
* the index.
|
||
*
|
||
* An instance of lunr.Index created with the lunr shortcut will contain a
|
||
* pipeline with a stop word filter and an English language stemmer. Extra
|
||
* functions can be added before or after either of these functions or these
|
||
* default functions can be removed.
|
||
*
|
||
* When run the pipeline will call each function in turn, passing a token, the
|
||
* index of that token in the original list of all tokens and finally a list of
|
||
* all the original tokens.
|
||
*
|
||
* The output of functions in the pipeline will be passed to the next function
|
||
* in the pipeline. To exclude a token from entering the index the function
|
||
* should return undefined, the rest of the pipeline will not be called with
|
||
* this token.
|
||
*
|
||
* For serialisation of pipelines to work, all functions used in an instance of
|
||
* a pipeline should be registered with lunr.Pipeline. Registered functions can
|
||
* then be loaded. If trying to load a serialised pipeline that uses functions
|
||
* that are not registered an error will be thrown.
|
||
*
|
||
* If not planning on serialising the pipeline then registering pipeline functions
|
||
* is not necessary.
|
||
*
|
||
* @constructor
|
||
*/
|
||
lunr.Pipeline = function () {
|
||
this._stack = []
|
||
}
|
||
|
||
lunr.Pipeline.registeredFunctions = Object.create(null)
|
||
|
||
/**
|
||
* A pipeline function maps lunr.Token to lunr.Token. A lunr.Token contains the token
|
||
* string as well as all known metadata. A pipeline function can mutate the token string
|
||
* or mutate (or add) metadata for a given token.
|
||
*
|
||
* A pipeline function can indicate that the passed token should be discarded by returning
|
||
* null. This token will not be passed to any downstream pipeline functions and will not be
|
||
* added to the index.
|
||
*
|
||
* Multiple tokens can be returned by returning an array of tokens. Each token will be passed
|
||
* to any downstream pipeline functions and all will returned tokens will be added to the index.
|
||
*
|
||
* Any number of pipeline functions may be chained together using a lunr.Pipeline.
|
||
*
|
||
* @interface lunr.PipelineFunction
|
||
* @param {lunr.Token} token - A token from the document being processed.
|
||
* @param {number} i - The index of this token in the complete list of tokens for this document/field.
|
||
* @param {lunr.Token[]} tokens - All tokens for this document/field.
|
||
* @returns {(?lunr.Token|lunr.Token[])}
|
||
*/
|
||
|
||
/**
|
||
* Register a function with the pipeline.
|
||
*
|
||
* Functions that are used in the pipeline should be registered if the pipeline
|
||
* needs to be serialised, or a serialised pipeline needs to be loaded.
|
||
*
|
||
* Registering a function does not add it to a pipeline, functions must still be
|
||
* added to instances of the pipeline for them to be used when running a pipeline.
|
||
*
|
||
* @param {lunr.PipelineFunction} fn - The function to check for.
|
||
* @param {String} label - The label to register this function with
|
||
*/
|
||
lunr.Pipeline.registerFunction = function (fn, label) {
|
||
if (label in this.registeredFunctions) {
|
||
lunr.utils.warn('Overwriting existing registered function: ' + label)
|
||
}
|
||
|
||
fn.label = label
|
||
lunr.Pipeline.registeredFunctions[fn.label] = fn
|
||
}
|
||
|
||
/**
|
||
* Warns if the function is not registered as a Pipeline function.
|
||
*
|
||
* @param {lunr.PipelineFunction} fn - The function to check for.
|
||
* @private
|
||
*/
|
||
lunr.Pipeline.warnIfFunctionNotRegistered = function (fn) {
|
||
var isRegistered = fn.label && (fn.label in this.registeredFunctions)
|
||
|
||
if (!isRegistered) {
|
||
lunr.utils.warn('Function is not registered with pipeline. This may cause problems when serialising the index.\n', fn)
|
||
}
|
||
}
|
||
|
||
/**
|
||
* Loads a previously serialised pipeline.
|
||
*
|
||
* All functions to be loaded must already be registered with lunr.Pipeline.
|
||
* If any function from the serialised data has not been registered then an
|
||
* error will be thrown.
|
||
*
|
||
* @param {Object} serialised - The serialised pipeline to load.
|
||
* @returns {lunr.Pipeline}
|
||
*/
|
||
lunr.Pipeline.load = function (serialised) {
|
||
var pipeline = new lunr.Pipeline
|
||
|
||
serialised.forEach(function (fnName) {
|
||
var fn = lunr.Pipeline.registeredFunctions[fnName]
|
||
|
||
if (fn) {
|
||
pipeline.add(fn)
|
||
} else {
|
||
throw new Error('Cannot load unregistered function: ' + fnName)
|
||
}
|
||
})
|
||
|
||
return pipeline
|
||
}
|
||
|
||
/**
|
||
* Adds new functions to the end of the pipeline.
|
||
*
|
||
* Logs a warning if the function has not been registered.
|
||
*
|
||
* @param {lunr.PipelineFunction[]} functions - Any number of functions to add to the pipeline.
|
||
*/
|
||
lunr.Pipeline.prototype.add = function () {
|
||
var fns = Array.prototype.slice.call(arguments)
|
||
|
||
fns.forEach(function (fn) {
|
||
lunr.Pipeline.warnIfFunctionNotRegistered(fn)
|
||
this._stack.push(fn)
|
||
}, this)
|
||
}
|
||
|
||
/**
|
||
* Adds a single function after a function that already exists in the
|
||
* pipeline.
|
||
*
|
||
* Logs a warning if the function has not been registered.
|
||
*
|
||
* @param {lunr.PipelineFunction} existingFn - A function that already exists in the pipeline.
|
||
* @param {lunr.PipelineFunction} newFn - The new function to add to the pipeline.
|
||
*/
|
||
lunr.Pipeline.prototype.after = function (existingFn, newFn) {
|
||
lunr.Pipeline.warnIfFunctionNotRegistered(newFn)
|
||
|
||
var pos = this._stack.indexOf(existingFn)
|
||
if (pos == -1) {
|
||
throw new Error('Cannot find existingFn')
|
||
}
|
||
|
||
pos = pos + 1
|
||
this._stack.splice(pos, 0, newFn)
|
||
}
|
||
|
||
/**
|
||
* Adds a single function before a function that already exists in the
|
||
* pipeline.
|
||
*
|
||
* Logs a warning if the function has not been registered.
|
||
*
|
||
* @param {lunr.PipelineFunction} existingFn - A function that already exists in the pipeline.
|
||
* @param {lunr.PipelineFunction} newFn - The new function to add to the pipeline.
|
||
*/
|
||
lunr.Pipeline.prototype.before = function (existingFn, newFn) {
|
||
lunr.Pipeline.warnIfFunctionNotRegistered(newFn)
|
||
|
||
var pos = this._stack.indexOf(existingFn)
|
||
if (pos == -1) {
|
||
throw new Error('Cannot find existingFn')
|
||
}
|
||
|
||
this._stack.splice(pos, 0, newFn)
|
||
}
|
||
|
||
/**
|
||
* Removes a function from the pipeline.
|
||
*
|
||
* @param {lunr.PipelineFunction} fn The function to remove from the pipeline.
|
||
*/
|
||
lunr.Pipeline.prototype.remove = function (fn) {
|
||
var pos = this._stack.indexOf(fn)
|
||
if (pos == -1) {
|
||
return
|
||
}
|
||
|
||
this._stack.splice(pos, 1)
|
||
}
|
||
|
||
/**
|
||
* Runs the current list of functions that make up the pipeline against the
|
||
* passed tokens.
|
||
*
|
||
* @param {Array} tokens The tokens to run through the pipeline.
|
||
* @returns {Array}
|
||
*/
|
||
lunr.Pipeline.prototype.run = function (tokens) {
|
||
var stackLength = this._stack.length
|
||
|
||
for (var i = 0; i < stackLength; i++) {
|
||
var fn = this._stack[i]
|
||
|
||
tokens = tokens.reduce(function (memo, token, j) {
|
||
var result = fn(token, j, tokens)
|
||
|
||
if (result === void 0 || result === '') return memo
|
||
|
||
return memo.concat(result)
|
||
}, [])
|
||
}
|
||
|
||
return tokens
|
||
}
|
||
|
||
/**
|
||
* Convenience method for passing a string through a pipeline and getting
|
||
* strings out. This method takes care of wrapping the passed string in a
|
||
* token and mapping the resulting tokens back to strings.
|
||
*
|
||
* @param {string} str - The string to pass through the pipeline.
|
||
* @returns {string[]}
|
||
*/
|
||
lunr.Pipeline.prototype.runString = function (str) {
|
||
var token = new lunr.Token (str)
|
||
|
||
return this.run([token]).map(function (t) {
|
||
return t.toString()
|
||
})
|
||
}
|
||
|
||
/**
|
||
* Resets the pipeline by removing any existing processors.
|
||
*
|
||
*/
|
||
lunr.Pipeline.prototype.reset = function () {
|
||
this._stack = []
|
||
}
|
||
|
||
/**
|
||
* Returns a representation of the pipeline ready for serialisation.
|
||
*
|
||
* Logs a warning if the function has not been registered.
|
||
*
|
||
* @returns {Array}
|
||
*/
|
||
lunr.Pipeline.prototype.toJSON = function () {
|
||
return this._stack.map(function (fn) {
|
||
lunr.Pipeline.warnIfFunctionNotRegistered(fn)
|
||
|
||
return fn.label
|
||
})
|
||
}
|
||
/*!
|
||
* lunr.Vector
|
||
* Copyright (C) 2017 Oliver Nightingale
|
||
*/
|
||
|
||
/**
|
||
* A vector is used to construct the vector space of documents and queries. These
|
||
* vectors support operations to determine the similarity between two documents or
|
||
* a document and a query.
|
||
*
|
||
* Normally no parameters are required for initializing a vector, but in the case of
|
||
* loading a previously dumped vector the raw elements can be provided to the constructor.
|
||
*
|
||
* For performance reasons vectors are implemented with a flat array, where an elements
|
||
* index is immediately followed by its value. E.g. [index, value, index, value]. This
|
||
* allows the underlying array to be as sparse as possible and still offer decent
|
||
* performance when being used for vector calculations.
|
||
*
|
||
* @constructor
|
||
* @param {Number[]} [elements] - The flat list of element index and element value pairs.
|
||
*/
|
||
lunr.Vector = function (elements) {
|
||
this._magnitude = 0
|
||
this.elements = elements || []
|
||
}
|
||
|
||
|
||
/**
|
||
* Calculates the position within the vector to insert a given index.
|
||
*
|
||
* This is used internally by insert and upsert. If there are duplicate indexes then
|
||
* the position is returned as if the value for that index were to be updated, but it
|
||
* is the callers responsibility to check whether there is a duplicate at that index
|
||
*
|
||
* @param {Number} insertIdx - The index at which the element should be inserted.
|
||
* @returns {Number}
|
||
*/
|
||
lunr.Vector.prototype.positionForIndex = function (index) {
|
||
// For an empty vector the tuple can be inserted at the beginning
|
||
if (this.elements.length == 0) {
|
||
return 0
|
||
}
|
||
|
||
var start = 0,
|
||
end = this.elements.length / 2,
|
||
sliceLength = end - start,
|
||
pivotPoint = Math.floor(sliceLength / 2),
|
||
pivotIndex = this.elements[pivotPoint * 2]
|
||
|
||
while (sliceLength > 1) {
|
||
if (pivotIndex < index) {
|
||
start = pivotPoint
|
||
}
|
||
|
||
if (pivotIndex > index) {
|
||
end = pivotPoint
|
||
}
|
||
|
||
if (pivotIndex == index) {
|
||
break
|
||
}
|
||
|
||
sliceLength = end - start
|
||
pivotPoint = start + Math.floor(sliceLength / 2)
|
||
pivotIndex = this.elements[pivotPoint * 2]
|
||
}
|
||
|
||
if (pivotIndex == index) {
|
||
return pivotPoint * 2
|
||
}
|
||
|
||
if (pivotIndex > index) {
|
||
return pivotPoint * 2
|
||
}
|
||
|
||
if (pivotIndex < index) {
|
||
return (pivotPoint + 1) * 2
|
||
}
|
||
}
|
||
|
||
/**
|
||
* Inserts an element at an index within the vector.
|
||
*
|
||
* Does not allow duplicates, will throw an error if there is already an entry
|
||
* for this index.
|
||
*
|
||
* @param {Number} insertIdx - The index at which the element should be inserted.
|
||
* @param {Number} val - The value to be inserted into the vector.
|
||
*/
|
||
lunr.Vector.prototype.insert = function (insertIdx, val) {
|
||
this.upsert(insertIdx, val, function () {
|
||
throw "duplicate index"
|
||
})
|
||
}
|
||
|
||
/**
|
||
* Inserts or updates an existing index within the vector.
|
||
*
|
||
* @param {Number} insertIdx - The index at which the element should be inserted.
|
||
* @param {Number} val - The value to be inserted into the vector.
|
||
* @param {function} fn - A function that is called for updates, the existing value and the
|
||
* requested value are passed as arguments
|
||
*/
|
||
lunr.Vector.prototype.upsert = function (insertIdx, val, fn) {
|
||
this._magnitude = 0
|
||
var position = this.positionForIndex(insertIdx)
|
||
|
||
if (this.elements[position] == insertIdx) {
|
||
this.elements[position + 1] = fn(this.elements[position + 1], val)
|
||
} else {
|
||
this.elements.splice(position, 0, insertIdx, val)
|
||
}
|
||
}
|
||
|
||
/**
|
||
* Calculates the magnitude of this vector.
|
||
*
|
||
* @returns {Number}
|
||
*/
|
||
lunr.Vector.prototype.magnitude = function () {
|
||
if (this._magnitude) return this._magnitude
|
||
|
||
var sumOfSquares = 0,
|
||
elementsLength = this.elements.length
|
||
|
||
for (var i = 1; i < elementsLength; i += 2) {
|
||
var val = this.elements[i]
|
||
sumOfSquares += val * val
|
||
}
|
||
|
||
return this._magnitude = Math.sqrt(sumOfSquares)
|
||
}
|
||
|
||
/**
|
||
* Calculates the dot product of this vector and another vector.
|
||
*
|
||
* @param {lunr.Vector} otherVector - The vector to compute the dot product with.
|
||
* @returns {Number}
|
||
*/
|
||
lunr.Vector.prototype.dot = function (otherVector) {
|
||
var dotProduct = 0,
|
||
a = this.elements, b = otherVector.elements,
|
||
aLen = a.length, bLen = b.length,
|
||
aVal = 0, bVal = 0,
|
||
i = 0, j = 0
|
||
|
||
while (i < aLen && j < bLen) {
|
||
aVal = a[i], bVal = b[j]
|
||
if (aVal < bVal) {
|
||
i += 2
|
||
} else if (aVal > bVal) {
|
||
j += 2
|
||
} else if (aVal == bVal) {
|
||
dotProduct += a[i + 1] * b[j + 1]
|
||
i += 2
|
||
j += 2
|
||
}
|
||
}
|
||
|
||
return dotProduct
|
||
}
|
||
|
||
/**
|
||
* Calculates the cosine similarity between this vector and another
|
||
* vector.
|
||
*
|
||
* @param {lunr.Vector} otherVector - The other vector to calculate the
|
||
* similarity with.
|
||
* @returns {Number}
|
||
*/
|
||
lunr.Vector.prototype.similarity = function (otherVector) {
|
||
return this.dot(otherVector) / (this.magnitude() * otherVector.magnitude())
|
||
}
|
||
|
||
/**
|
||
* Converts the vector to an array of the elements within the vector.
|
||
*
|
||
* @returns {Number[]}
|
||
*/
|
||
lunr.Vector.prototype.toArray = function () {
|
||
var output = new Array (this.elements.length / 2)
|
||
|
||
for (var i = 1, j = 0; i < this.elements.length; i += 2, j++) {
|
||
output[j] = this.elements[i]
|
||
}
|
||
|
||
return output
|
||
}
|
||
|
||
/**
|
||
* A JSON serializable representation of the vector.
|
||
*
|
||
* @returns {Number[]}
|
||
*/
|
||
lunr.Vector.prototype.toJSON = function () {
|
||
return this.elements
|
||
}
|
||
/* eslint-disable */
|
||
/*!
|
||
* lunr.stemmer
|
||
* Copyright (C) 2017 Oliver Nightingale
|
||
* Includes code from - http://tartarus.org/~martin/PorterStemmer/js.txt
|
||
*/
|
||
|
||
/**
|
||
* lunr.stemmer is an english language stemmer, this is a JavaScript
|
||
* implementation of the PorterStemmer taken from http://tartarus.org/~martin
|
||
*
|
||
* @static
|
||
* @implements {lunr.PipelineFunction}
|
||
* @param {lunr.Token} token - The string to stem
|
||
* @returns {lunr.Token}
|
||
* @see {@link lunr.Pipeline}
|
||
*/
|
||
lunr.stemmer = (function(){
|
||
var step2list = {
|
||
"ational" : "ate",
|
||
"tional" : "tion",
|
||
"enci" : "ence",
|
||
"anci" : "ance",
|
||
"izer" : "ize",
|
||
"bli" : "ble",
|
||
"alli" : "al",
|
||
"entli" : "ent",
|
||
"eli" : "e",
|
||
"ousli" : "ous",
|
||
"ization" : "ize",
|
||
"ation" : "ate",
|
||
"ator" : "ate",
|
||
"alism" : "al",
|
||
"iveness" : "ive",
|
||
"fulness" : "ful",
|
||
"ousness" : "ous",
|
||
"aliti" : "al",
|
||
"iviti" : "ive",
|
||
"biliti" : "ble",
|
||
"logi" : "log"
|
||
},
|
||
|
||
step3list = {
|
||
"icate" : "ic",
|
||
"ative" : "",
|
||
"alize" : "al",
|
||
"iciti" : "ic",
|
||
"ical" : "ic",
|
||
"ful" : "",
|
||
"ness" : ""
|
||
},
|
||
|
||
c = "[^aeiou]", // consonant
|
||
v = "[aeiouy]", // vowel
|
||
C = c + "[^aeiouy]*", // consonant sequence
|
||
V = v + "[aeiou]*", // vowel sequence
|
||
|
||
mgr0 = "^(" + C + ")?" + V + C, // [C]VC... is m>0
|
||
meq1 = "^(" + C + ")?" + V + C + "(" + V + ")?$", // [C]VC[V] is m=1
|
||
mgr1 = "^(" + C + ")?" + V + C + V + C, // [C]VCVC... is m>1
|
||
s_v = "^(" + C + ")?" + v; // vowel in stem
|
||
|
||
var re_mgr0 = new RegExp(mgr0);
|
||
var re_mgr1 = new RegExp(mgr1);
|
||
var re_meq1 = new RegExp(meq1);
|
||
var re_s_v = new RegExp(s_v);
|
||
|
||
var re_1a = /^(.+?)(ss|i)es$/;
|
||
var re2_1a = /^(.+?)([^s])s$/;
|
||
var re_1b = /^(.+?)eed$/;
|
||
var re2_1b = /^(.+?)(ed|ing)$/;
|
||
var re_1b_2 = /.$/;
|
||
var re2_1b_2 = /(at|bl|iz)$/;
|
||
var re3_1b_2 = new RegExp("([^aeiouylsz])\\1$");
|
||
var re4_1b_2 = new RegExp("^" + C + v + "[^aeiouwxy]$");
|
||
|
||
var re_1c = /^(.+?[^aeiou])y$/;
|
||
var re_2 = /^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/;
|
||
|
||
var re_3 = /^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/;
|
||
|
||
var re_4 = /^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/;
|
||
var re2_4 = /^(.+?)(s|t)(ion)$/;
|
||
|
||
var re_5 = /^(.+?)e$/;
|
||
var re_5_1 = /ll$/;
|
||
var re3_5 = new RegExp("^" + C + v + "[^aeiouwxy]$");
|
||
|
||
var porterStemmer = function porterStemmer(w) {
|
||
var stem,
|
||
suffix,
|
||
firstch,
|
||
re,
|
||
re2,
|
||
re3,
|
||
re4;
|
||
|
||
if (w.length < 3) { return w; }
|
||
|
||
firstch = w.substr(0,1);
|
||
if (firstch == "y") {
|
||
w = firstch.toUpperCase() + w.substr(1);
|
||
}
|
||
|
||
// Step 1a
|
||
re = re_1a
|
||
re2 = re2_1a;
|
||
|
||
if (re.test(w)) { w = w.replace(re,"$1$2"); }
|
||
else if (re2.test(w)) { w = w.replace(re2,"$1$2"); }
|
||
|
||
// Step 1b
|
||
re = re_1b;
|
||
re2 = re2_1b;
|
||
if (re.test(w)) {
|
||
var fp = re.exec(w);
|
||
re = re_mgr0;
|
||
if (re.test(fp[1])) {
|
||
re = re_1b_2;
|
||
w = w.replace(re,"");
|
||
}
|
||
} else if (re2.test(w)) {
|
||
var fp = re2.exec(w);
|
||
stem = fp[1];
|
||
re2 = re_s_v;
|
||
if (re2.test(stem)) {
|
||
w = stem;
|
||
re2 = re2_1b_2;
|
||
re3 = re3_1b_2;
|
||
re4 = re4_1b_2;
|
||
if (re2.test(w)) { w = w + "e"; }
|
||
else if (re3.test(w)) { re = re_1b_2; w = w.replace(re,""); }
|
||
else if (re4.test(w)) { w = w + "e"; }
|
||
}
|
||
}
|
||
|
||
// Step 1c - replace suffix y or Y by i if preceded by a non-vowel which is not the first letter of the word (so cry -> cri, by -> by, say -> say)
|
||
re = re_1c;
|
||
if (re.test(w)) {
|
||
var fp = re.exec(w);
|
||
stem = fp[1];
|
||
w = stem + "i";
|
||
}
|
||
|
||
// Step 2
|
||
re = re_2;
|
||
if (re.test(w)) {
|
||
var fp = re.exec(w);
|
||
stem = fp[1];
|
||
suffix = fp[2];
|
||
re = re_mgr0;
|
||
if (re.test(stem)) {
|
||
w = stem + step2list[suffix];
|
||
}
|
||
}
|
||
|
||
// Step 3
|
||
re = re_3;
|
||
if (re.test(w)) {
|
||
var fp = re.exec(w);
|
||
stem = fp[1];
|
||
suffix = fp[2];
|
||
re = re_mgr0;
|
||
if (re.test(stem)) {
|
||
w = stem + step3list[suffix];
|
||
}
|
||
}
|
||
|
||
// Step 4
|
||
re = re_4;
|
||
re2 = re2_4;
|
||
if (re.test(w)) {
|
||
var fp = re.exec(w);
|
||
stem = fp[1];
|
||
re = re_mgr1;
|
||
if (re.test(stem)) {
|
||
w = stem;
|
||
}
|
||
} else if (re2.test(w)) {
|
||
var fp = re2.exec(w);
|
||
stem = fp[1] + fp[2];
|
||
re2 = re_mgr1;
|
||
if (re2.test(stem)) {
|
||
w = stem;
|
||
}
|
||
}
|
||
|
||
// Step 5
|
||
re = re_5;
|
||
if (re.test(w)) {
|
||
var fp = re.exec(w);
|
||
stem = fp[1];
|
||
re = re_mgr1;
|
||
re2 = re_meq1;
|
||
re3 = re3_5;
|
||
if (re.test(stem) || (re2.test(stem) && !(re3.test(stem)))) {
|
||
w = stem;
|
||
}
|
||
}
|
||
|
||
re = re_5_1;
|
||
re2 = re_mgr1;
|
||
if (re.test(w) && re2.test(w)) {
|
||
re = re_1b_2;
|
||
w = w.replace(re,"");
|
||
}
|
||
|
||
// and turn initial Y back to y
|
||
|
||
if (firstch == "y") {
|
||
w = firstch.toLowerCase() + w.substr(1);
|
||
}
|
||
|
||
return w;
|
||
};
|
||
|
||
return function (token) {
|
||
return token.update(porterStemmer);
|
||
}
|
||
})();
|
||
|
||
lunr.Pipeline.registerFunction(lunr.stemmer, 'stemmer')
|
||
/*!
|
||
* lunr.stopWordFilter
|
||
* Copyright (C) 2017 Oliver Nightingale
|
||
*/
|
||
|
||
/**
|
||
* lunr.generateStopWordFilter builds a stopWordFilter function from the provided
|
||
* list of stop words.
|
||
*
|
||
* The built in lunr.stopWordFilter is built using this generator and can be used
|
||
* to generate custom stopWordFilters for applications or non English languages.
|
||
*
|
||
* @param {Array} token The token to pass through the filter
|
||
* @returns {lunr.PipelineFunction}
|
||
* @see lunr.Pipeline
|
||
* @see lunr.stopWordFilter
|
||
*/
|
||
lunr.generateStopWordFilter = function (stopWords) {
|
||
var words = stopWords.reduce(function (memo, stopWord) {
|
||
memo[stopWord] = stopWord
|
||
return memo
|
||
}, {})
|
||
|
||
return function (token) {
|
||
if (token && words[token.toString()] !== token.toString()) return token
|
||
}
|
||
}
|
||
|
||
/**
|
||
* lunr.stopWordFilter is an English language stop word list filter, any words
|
||
* contained in the list will not be passed through the filter.
|
||
*
|
||
* This is intended to be used in the Pipeline. If the token does not pass the
|
||
* filter then undefined will be returned.
|
||
*
|
||
* @implements {lunr.PipelineFunction}
|
||
* @params {lunr.Token} token - A token to check for being a stop word.
|
||
* @returns {lunr.Token}
|
||
* @see {@link lunr.Pipeline}
|
||
*/
|
||
lunr.stopWordFilter = lunr.generateStopWordFilter([
|
||
'a',
|
||
'able',
|
||
'about',
|
||
'across',
|
||
'after',
|
||
'all',
|
||
'almost',
|
||
'also',
|
||
'am',
|
||
'among',
|
||
'an',
|
||
'and',
|
||
'any',
|
||
'are',
|
||
'as',
|
||
'at',
|
||
'be',
|
||
'because',
|
||
'been',
|
||
'but',
|
||
'by',
|
||
'can',
|
||
'cannot',
|
||
'could',
|
||
'dear',
|
||
'did',
|
||
'do',
|
||
'does',
|
||
'either',
|
||
'else',
|
||
'ever',
|
||
'every',
|
||
'for',
|
||
'from',
|
||
'get',
|
||
'got',
|
||
'had',
|
||
'has',
|
||
'have',
|
||
'he',
|
||
'her',
|
||
'hers',
|
||
'him',
|
||
'his',
|
||
'how',
|
||
'however',
|
||
'i',
|
||
'if',
|
||
'in',
|
||
'into',
|
||
'is',
|
||
'it',
|
||
'its',
|
||
'just',
|
||
'least',
|
||
'let',
|
||
'like',
|
||
'likely',
|
||
'may',
|
||
'me',
|
||
'might',
|
||
'most',
|
||
'must',
|
||
'my',
|
||
'neither',
|
||
'no',
|
||
'nor',
|
||
'not',
|
||
'of',
|
||
'off',
|
||
'often',
|
||
'on',
|
||
'only',
|
||
'or',
|
||
'other',
|
||
'our',
|
||
'own',
|
||
'rather',
|
||
'said',
|
||
'say',
|
||
'says',
|
||
'she',
|
||
'should',
|
||
'since',
|
||
'so',
|
||
'some',
|
||
'than',
|
||
'that',
|
||
'the',
|
||
'their',
|
||
'them',
|
||
'then',
|
||
'there',
|
||
'these',
|
||
'they',
|
||
'this',
|
||
'tis',
|
||
'to',
|
||
'too',
|
||
'twas',
|
||
'us',
|
||
'wants',
|
||
'was',
|
||
'we',
|
||
'were',
|
||
'what',
|
||
'when',
|
||
'where',
|
||
'which',
|
||
'while',
|
||
'who',
|
||
'whom',
|
||
'why',
|
||
'will',
|
||
'with',
|
||
'would',
|
||
'yet',
|
||
'you',
|
||
'your'
|
||
])
|
||
|
||
lunr.Pipeline.registerFunction(lunr.stopWordFilter, 'stopWordFilter')
|
||
/*!
|
||
* lunr.trimmer
|
||
* Copyright (C) 2017 Oliver Nightingale
|
||
*/
|
||
|
||
/**
|
||
* lunr.trimmer is a pipeline function for trimming non word
|
||
* characters from the beginning and end of tokens before they
|
||
* enter the index.
|
||
*
|
||
* This implementation may not work correctly for non latin
|
||
* characters and should either be removed or adapted for use
|
||
* with languages with non-latin characters.
|
||
*
|
||
* @static
|
||
* @implements {lunr.PipelineFunction}
|
||
* @param {lunr.Token} token The token to pass through the filter
|
||
* @returns {lunr.Token}
|
||
* @see lunr.Pipeline
|
||
*/
|
||
lunr.trimmer = function (token) {
|
||
return token.update(function (s) {
|
||
return s.replace(/^\W+/, '').replace(/\W+$/, '')
|
||
})
|
||
}
|
||
|
||
lunr.Pipeline.registerFunction(lunr.trimmer, 'trimmer')
|
||
/*!
|
||
* lunr.TokenSet
|
||
* Copyright (C) 2017 Oliver Nightingale
|
||
*/
|
||
|
||
/**
|
||
* A token set is used to store the unique list of all tokens
|
||
* within an index. Token sets are also used to represent an
|
||
* incoming query to the index, this query token set and index
|
||
* token set are then intersected to find which tokens to look
|
||
* up in the inverted index.
|
||
*
|
||
* A token set can hold multiple tokens, as in the case of the
|
||
* index token set, or it can hold a single token as in the
|
||
* case of a simple query token set.
|
||
*
|
||
* Additionally token sets are used to perform wildcard matching.
|
||
* Leading, contained and trailing wildcards are supported, and
|
||
* from this edit distance matching can also be provided.
|
||
*
|
||
* Token sets are implemented as a minimal finite state automata,
|
||
* where both common prefixes and suffixes are shared between tokens.
|
||
* This helps to reduce the space used for storing the token set.
|
||
*
|
||
* @constructor
|
||
*/
|
||
lunr.TokenSet = function () {
|
||
this.final = false
|
||
this.edges = {}
|
||
this.id = lunr.TokenSet._nextId
|
||
lunr.TokenSet._nextId += 1
|
||
}
|
||
|
||
/**
|
||
* Keeps track of the next, auto increment, identifier to assign
|
||
* to a new tokenSet.
|
||
*
|
||
* TokenSets require a unique identifier to be correctly minimised.
|
||
*
|
||
* @private
|
||
*/
|
||
lunr.TokenSet._nextId = 1
|
||
|
||
/**
|
||
* Creates a TokenSet instance from the given sorted array of words.
|
||
*
|
||
* @param {String[]} arr - A sorted array of strings to create the set from.
|
||
* @returns {lunr.TokenSet}
|
||
* @throws Will throw an error if the input array is not sorted.
|
||
*/
|
||
lunr.TokenSet.fromArray = function (arr) {
|
||
var builder = new lunr.TokenSet.Builder
|
||
|
||
for (var i = 0, len = arr.length; i < len; i++) {
|
||
builder.insert(arr[i])
|
||
}
|
||
|
||
builder.finish()
|
||
return builder.root
|
||
}
|
||
|
||
/**
|
||
* Creates a token set from a query clause.
|
||
*
|
||
* @private
|
||
* @param {Object} clause - A single clause from lunr.Query.
|
||
* @param {string} clause.term - The query clause term.
|
||
* @param {number} [clause.editDistance] - The optional edit distance for the term.
|
||
* @returns {lunr.TokenSet}
|
||
*/
|
||
lunr.TokenSet.fromClause = function (clause) {
|
||
if ('editDistance' in clause) {
|
||
return lunr.TokenSet.fromFuzzyString(clause.term, clause.editDistance)
|
||
} else {
|
||
return lunr.TokenSet.fromString(clause.term)
|
||
}
|
||
}
|
||
|
||
/**
|
||
* Creates a token set representing a single string with a specified
|
||
* edit distance.
|
||
*
|
||
* Insertions, deletions, substitutions and transpositions are each
|
||
* treated as an edit distance of 1.
|
||
*
|
||
* Increasing the allowed edit distance will have a dramatic impact
|
||
* on the performance of both creating and intersecting these TokenSets.
|
||
* It is advised to keep the edit distance less than 3.
|
||
*
|
||
* @param {string} str - The string to create the token set from.
|
||
* @param {number} editDistance - The allowed edit distance to match.
|
||
* @returns {lunr.Vector}
|
||
*/
|
||
lunr.TokenSet.fromFuzzyString = function (str, editDistance) {
|
||
var root = new lunr.TokenSet
|
||
|
||
var stack = [{
|
||
node: root,
|
||
editsRemaining: editDistance,
|
||
str: str
|
||
}]
|
||
|
||
while (stack.length) {
|
||
var frame = stack.pop()
|
||
|
||
// no edit
|
||
if (frame.str.length > 0) {
|
||
var char = frame.str.charAt(0),
|
||
noEditNode
|
||
|
||
if (char in frame.node.edges) {
|
||
noEditNode = frame.node.edges[char]
|
||
} else {
|
||
noEditNode = new lunr.TokenSet
|
||
frame.node.edges[char] = noEditNode
|
||
}
|
||
|
||
if (frame.str.length == 1) {
|
||
noEditNode.final = true
|
||
} else {
|
||
stack.push({
|
||
node: noEditNode,
|
||
editsRemaining: frame.editsRemaining,
|
||
str: frame.str.slice(1)
|
||
})
|
||
}
|
||
}
|
||
|
||
// deletion
|
||
// can only do a deletion if we have enough edits remaining
|
||
// and if there are characters left to delete in the string
|
||
if (frame.editsRemaining > 0 && frame.str.length > 1) {
|
||
var char = frame.str.charAt(1),
|
||
deletionNode
|
||
|
||
if (char in frame.node.edges) {
|
||
deletionNode = frame.node.edges[char]
|
||
} else {
|
||
deletionNode = new lunr.TokenSet
|
||
frame.node.edges[char] = deletionNode
|
||
}
|
||
|
||
if (frame.str.length <= 2) {
|
||
deletionNode.final = true
|
||
} else {
|
||
stack.push({
|
||
node: deletionNode,
|
||
editsRemaining: frame.editsRemaining - 1,
|
||
str: frame.str.slice(2)
|
||
})
|
||
}
|
||
}
|
||
|
||
// deletion
|
||
// just removing the last character from the str
|
||
if (frame.editsRemaining > 0 && frame.str.length == 1) {
|
||
frame.node.final = true
|
||
}
|
||
|
||
// substitution
|
||
// can only do a substitution if we have enough edits remaining
|
||
// and if there are characters left to substitute
|
||
if (frame.editsRemaining > 0 && frame.str.length >= 1) {
|
||
if ("*" in frame.node.edges) {
|
||
var substitutionNode = frame.node.edges["*"]
|
||
} else {
|
||
var substitutionNode = new lunr.TokenSet
|
||
frame.node.edges["*"] = substitutionNode
|
||
}
|
||
|
||
if (frame.str.length == 1) {
|
||
substitutionNode.final = true
|
||
} else {
|
||
stack.push({
|
||
node: substitutionNode,
|
||
editsRemaining: frame.editsRemaining - 1,
|
||
str: frame.str.slice(1)
|
||
})
|
||
}
|
||
}
|
||
|
||
// insertion
|
||
// can only do insertion if there are edits remaining
|
||
if (frame.editsRemaining > 0) {
|
||
if ("*" in frame.node.edges) {
|
||
var insertionNode = frame.node.edges["*"]
|
||
} else {
|
||
var insertionNode = new lunr.TokenSet
|
||
frame.node.edges["*"] = insertionNode
|
||
}
|
||
|
||
if (frame.str.length == 0) {
|
||
insertionNode.final = true
|
||
} else {
|
||
stack.push({
|
||
node: insertionNode,
|
||
editsRemaining: frame.editsRemaining - 1,
|
||
str: frame.str
|
||
})
|
||
}
|
||
}
|
||
|
||
// transposition
|
||
// can only do a transposition if there are edits remaining
|
||
// and there are enough characters to transpose
|
||
if (frame.editsRemaining > 0 && frame.str.length > 1) {
|
||
var charA = frame.str.charAt(0),
|
||
charB = frame.str.charAt(1),
|
||
transposeNode
|
||
|
||
if (charB in frame.node.edges) {
|
||
transposeNode = frame.node.edges[charB]
|
||
} else {
|
||
transposeNode = new lunr.TokenSet
|
||
frame.node.edges[charB] = transposeNode
|
||
}
|
||
|
||
if (frame.str.length == 1) {
|
||
transposeNode.final = true
|
||
} else {
|
||
stack.push({
|
||
node: transposeNode,
|
||
editsRemaining: frame.editsRemaining - 1,
|
||
str: charA + frame.str.slice(2)
|
||
})
|
||
}
|
||
}
|
||
}
|
||
|
||
return root
|
||
}
|
||
|
||
/**
|
||
* Creates a TokenSet from a string.
|
||
*
|
||
* The string may contain one or more wildcard characters (*)
|
||
* that will allow wildcard matching when intersecting with
|
||
* another TokenSet.
|
||
*
|
||
* @param {string} str - The string to create a TokenSet from.
|
||
* @returns {lunr.TokenSet}
|
||
*/
|
||
lunr.TokenSet.fromString = function (str) {
|
||
var node = new lunr.TokenSet,
|
||
root = node,
|
||
wildcardFound = false
|
||
|
||
/*
|
||
* Iterates through all characters within the passed string
|
||
* appending a node for each character.
|
||
*
|
||
* As soon as a wildcard character is found then a self
|
||
* referencing edge is introduced to continually match
|
||
* any number of any characters.
|
||
*/
|
||
for (var i = 0, len = str.length; i < len; i++) {
|
||
var char = str[i],
|
||
final = (i == len - 1)
|
||
|
||
if (char == "*") {
|
||
wildcardFound = true
|
||
node.edges[char] = node
|
||
node.final = final
|
||
|
||
} else {
|
||
var next = new lunr.TokenSet
|
||
next.final = final
|
||
|
||
node.edges[char] = next
|
||
node = next
|
||
|
||
// TODO: is this needed anymore?
|
||
if (wildcardFound) {
|
||
node.edges["*"] = root
|
||
}
|
||
}
|
||
}
|
||
|
||
return root
|
||
}
|
||
|
||
/**
|
||
* Converts this TokenSet into an array of strings
|
||
* contained within the TokenSet.
|
||
*
|
||
* @returns {string[]}
|
||
*/
|
||
lunr.TokenSet.prototype.toArray = function () {
|
||
var words = []
|
||
|
||
var stack = [{
|
||
prefix: "",
|
||
node: this
|
||
}]
|
||
|
||
while (stack.length) {
|
||
var frame = stack.pop(),
|
||
edges = Object.keys(frame.node.edges),
|
||
len = edges.length
|
||
|
||
if (frame.node.final) {
|
||
frame.prefix.charAt(0)
|
||
words.push(frame.prefix)
|
||
}
|
||
|
||
for (var i = 0; i < len; i++) {
|
||
var edge = edges[i]
|
||
|
||
stack.push({
|
||
prefix: frame.prefix.concat(edge),
|
||
node: frame.node.edges[edge]
|
||
})
|
||
}
|
||
}
|
||
|
||
return words
|
||
}
|
||
|
||
/**
|
||
* Generates a string representation of a TokenSet.
|
||
*
|
||
* This is intended to allow TokenSets to be used as keys
|
||
* in objects, largely to aid the construction and minimisation
|
||
* of a TokenSet. As such it is not designed to be a human
|
||
* friendly representation of the TokenSet.
|
||
*
|
||
* @returns {string}
|
||
*/
|
||
lunr.TokenSet.prototype.toString = function () {
|
||
// NOTE: Using Object.keys here as this.edges is very likely
|
||
// to enter 'hash-mode' with many keys being added
|
||
//
|
||
// avoiding a for-in loop here as it leads to the function
|
||
// being de-optimised (at least in V8). From some simple
|
||
// benchmarks the performance is comparable, but allowing
|
||
// V8 to optimize may mean easy performance wins in the future.
|
||
|
||
if (this._str) {
|
||
return this._str
|
||
}
|
||
|
||
var str = this.final ? '1' : '0',
|
||
labels = Object.keys(this.edges).sort(),
|
||
len = labels.length
|
||
|
||
for (var i = 0; i < len; i++) {
|
||
var label = labels[i],
|
||
node = this.edges[label]
|
||
|
||
str = str + label + node.id
|
||
}
|
||
|
||
return str
|
||
}
|
||
|
||
/**
|
||
* Returns a new TokenSet that is the intersection of
|
||
* this TokenSet and the passed TokenSet.
|
||
*
|
||
* This intersection will take into account any wildcards
|
||
* contained within the TokenSet.
|
||
*
|
||
* @param {lunr.TokenSet} b - An other TokenSet to intersect with.
|
||
* @returns {lunr.TokenSet}
|
||
*/
|
||
lunr.TokenSet.prototype.intersect = function (b) {
|
||
var output = new lunr.TokenSet,
|
||
frame = undefined
|
||
|
||
var stack = [{
|
||
qNode: b,
|
||
output: output,
|
||
node: this
|
||
}]
|
||
|
||
while (stack.length) {
|
||
frame = stack.pop()
|
||
|
||
// NOTE: As with the #toString method, we are using
|
||
// Object.keys and a for loop instead of a for-in loop
|
||
// as both of these objects enter 'hash' mode, causing
|
||
// the function to be de-optimised in V8
|
||
var qEdges = Object.keys(frame.qNode.edges),
|
||
qLen = qEdges.length,
|
||
nEdges = Object.keys(frame.node.edges),
|
||
nLen = nEdges.length
|
||
|
||
for (var q = 0; q < qLen; q++) {
|
||
var qEdge = qEdges[q]
|
||
|
||
for (var n = 0; n < nLen; n++) {
|
||
var nEdge = nEdges[n]
|
||
|
||
if (nEdge == qEdge || qEdge == '*') {
|
||
var node = frame.node.edges[nEdge],
|
||
qNode = frame.qNode.edges[qEdge],
|
||
final = node.final && qNode.final,
|
||
next = undefined
|
||
|
||
if (nEdge in frame.output.edges) {
|
||
// an edge already exists for this character
|
||
// no need to create a new node, just set the finality
|
||
// bit unless this node is already final
|
||
next = frame.output.edges[nEdge]
|
||
next.final = next.final || final
|
||
|
||
} else {
|
||
// no edge exists yet, must create one
|
||
// set the finality bit and insert it
|
||
// into the output
|
||
next = new lunr.TokenSet
|
||
next.final = final
|
||
frame.output.edges[nEdge] = next
|
||
}
|
||
|
||
stack.push({
|
||
qNode: qNode,
|
||
output: next,
|
||
node: node
|
||
})
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
return output
|
||
}
|
||
lunr.TokenSet.Builder = function () {
|
||
this.previousWord = ""
|
||
this.root = new lunr.TokenSet
|
||
this.uncheckedNodes = []
|
||
this.minimizedNodes = {}
|
||
}
|
||
|
||
lunr.TokenSet.Builder.prototype.insert = function (word) {
|
||
var node,
|
||
commonPrefix = 0
|
||
|
||
if (word < this.previousWord) {
|
||
throw new Error ("Out of order word insertion")
|
||
}
|
||
|
||
for (var i = 0; i < word.length && i < this.previousWord.length; i++) {
|
||
if (word[i] != this.previousWord[i]) break
|
||
commonPrefix++
|
||
}
|
||
|
||
this.minimize(commonPrefix)
|
||
|
||
if (this.uncheckedNodes.length == 0) {
|
||
node = this.root
|
||
} else {
|
||
node = this.uncheckedNodes[this.uncheckedNodes.length - 1].child
|
||
}
|
||
|
||
for (var i = commonPrefix; i < word.length; i++) {
|
||
var nextNode = new lunr.TokenSet,
|
||
char = word[i]
|
||
|
||
node.edges[char] = nextNode
|
||
|
||
this.uncheckedNodes.push({
|
||
parent: node,
|
||
char: char,
|
||
child: nextNode
|
||
})
|
||
|
||
node = nextNode
|
||
}
|
||
|
||
node.final = true
|
||
this.previousWord = word
|
||
}
|
||
|
||
lunr.TokenSet.Builder.prototype.finish = function () {
|
||
this.minimize(0)
|
||
}
|
||
|
||
lunr.TokenSet.Builder.prototype.minimize = function (downTo) {
|
||
for (var i = this.uncheckedNodes.length - 1; i >= downTo; i--) {
|
||
var node = this.uncheckedNodes[i],
|
||
childKey = node.child.toString()
|
||
|
||
if (childKey in this.minimizedNodes) {
|
||
node.parent.edges[node.char] = this.minimizedNodes[childKey]
|
||
} else {
|
||
// Cache the key for this node since
|
||
// we know it can't change anymore
|
||
node.child._str = childKey
|
||
|
||
this.minimizedNodes[childKey] = node.child
|
||
}
|
||
|
||
this.uncheckedNodes.pop()
|
||
}
|
||
}
|
||
/*!
|
||
* lunr.Index
|
||
* Copyright (C) 2017 Oliver Nightingale
|
||
*/
|
||
|
||
/**
|
||
* An index contains the built index of all documents and provides a query interface
|
||
* to the index.
|
||
*
|
||
* Usually instances of lunr.Index will not be created using this constructor, instead
|
||
* lunr.Builder should be used to construct new indexes, or lunr.Index.load should be
|
||
* used to load previously built and serialized indexes.
|
||
*
|
||
* @constructor
|
||
* @param {Object} attrs - The attributes of the built search index.
|
||
* @param {Object} attrs.invertedIndex - An index of term/field to document reference.
|
||
* @param {Object<string, lunr.Vector>} attrs.documentVectors - Document vectors keyed by document reference.
|
||
* @param {lunr.TokenSet} attrs.tokenSet - An set of all corpus tokens.
|
||
* @param {string[]} attrs.fields - The names of indexed document fields.
|
||
* @param {lunr.Pipeline} attrs.pipeline - The pipeline to use for search terms.
|
||
*/
|
||
lunr.Index = function (attrs) {
|
||
this.invertedIndex = attrs.invertedIndex
|
||
this.fieldVectors = attrs.fieldVectors
|
||
this.tokenSet = attrs.tokenSet
|
||
this.fields = attrs.fields
|
||
this.pipeline = attrs.pipeline
|
||
}
|
||
|
||
/**
|
||
* A result contains details of a document matching a search query.
|
||
* @typedef {Object} lunr.Index~Result
|
||
* @property {string} ref - The reference of the document this result represents.
|
||
* @property {number} score - A number between 0 and 1 representing how similar this document is to the query.
|
||
* @property {lunr.MatchData} matchData - Contains metadata about this match including which term(s) caused the match.
|
||
*/
|
||
|
||
/**
|
||
* Although lunr provides the ability to create queries using lunr.Query, it also provides a simple
|
||
* query language which itself is parsed into an instance of lunr.Query.
|
||
*
|
||
* For programmatically building queries it is advised to directly use lunr.Query, the query language
|
||
* is best used for human entered text rather than program generated text.
|
||
*
|
||
* At its simplest queries can just be a single term, e.g. `hello`, multiple terms are also supported
|
||
* and will be combined with OR, e.g `hello world` will match documents that contain either 'hello'
|
||
* or 'world', though those that contain both will rank higher in the results.
|
||
*
|
||
* Wildcards can be included in terms to match one or more unspecified characters, these wildcards can
|
||
* be inserted anywhere within the term, and more than one wildcard can exist in a single term. Adding
|
||
* wildcards will increase the number of documents that will be found but can also have a negative
|
||
* impact on query performance, especially with wildcards at the beginning of a term.
|
||
*
|
||
* Terms can be restricted to specific fields, e.g. `title:hello`, only documents with the term
|
||
* hello in the title field will match this query. Using a field not present in the index will lead
|
||
* to an error being thrown.
|
||
*
|
||
* Modifiers can also be added to terms, lunr supports edit distance and boost modifiers on terms. A term
|
||
* boost will make documents matching that term score higher, e.g. `foo^5`. Edit distance is also supported
|
||
* to provide fuzzy matching, e.g. 'hello~2' will match documents with hello with an edit distance of 2.
|
||
* Avoid large values for edit distance to improve query performance.
|
||
*
|
||
* To escape special characters the backslash character '\' can be used, this allows searches to include
|
||
* characters that would normally be considered modifiers, e.g. `foo\~2` will search for a term "foo~2" instead
|
||
* of attempting to apply a boost of 2 to the search term "foo".
|
||
*
|
||
* @typedef {string} lunr.Index~QueryString
|
||
* @example <caption>Simple single term query</caption>
|
||
* hello
|
||
* @example <caption>Multiple term query</caption>
|
||
* hello world
|
||
* @example <caption>term scoped to a field</caption>
|
||
* title:hello
|
||
* @example <caption>term with a boost of 10</caption>
|
||
* hello^10
|
||
* @example <caption>term with an edit distance of 2</caption>
|
||
* hello~2
|
||
*/
|
||
|
||
/**
|
||
* Performs a search against the index using lunr query syntax.
|
||
*
|
||
* Results will be returned sorted by their score, the most relevant results
|
||
* will be returned first.
|
||
*
|
||
* For more programmatic querying use lunr.Index#query.
|
||
*
|
||
* @param {lunr.Index~QueryString} queryString - A string containing a lunr query.
|
||
* @throws {lunr.QueryParseError} If the passed query string cannot be parsed.
|
||
* @returns {lunr.Index~Result[]}
|
||
*/
|
||
lunr.Index.prototype.search = function (queryString) {
|
||
return this.query(function (query) {
|
||
var parser = new lunr.QueryParser(queryString, query)
|
||
parser.parse()
|
||
})
|
||
}
|
||
|
||
/**
|
||
* A query builder callback provides a query object to be used to express
|
||
* the query to perform on the index.
|
||
*
|
||
* @callback lunr.Index~queryBuilder
|
||
* @param {lunr.Query} query - The query object to build up.
|
||
* @this lunr.Query
|
||
*/
|
||
|
||
/**
|
||
* Performs a query against the index using the yielded lunr.Query object.
|
||
*
|
||
* If performing programmatic queries against the index, this method is preferred
|
||
* over lunr.Index#search so as to avoid the additional query parsing overhead.
|
||
*
|
||
* A query object is yielded to the supplied function which should be used to
|
||
* express the query to be run against the index.
|
||
*
|
||
* Note that although this function takes a callback parameter it is _not_ an
|
||
* asynchronous operation, the callback is just yielded a query object to be
|
||
* customized.
|
||
*
|
||
* @param {lunr.Index~queryBuilder} fn - A function that is used to build the query.
|
||
* @returns {lunr.Index~Result[]}
|
||
*/
|
||
lunr.Index.prototype.query = function (fn) {
|
||
// for each query clause
|
||
// * process terms
|
||
// * expand terms from token set
|
||
// * find matching documents and metadata
|
||
// * get document vectors
|
||
// * score documents
|
||
|
||
var query = new lunr.Query(this.fields),
|
||
matchingFields = Object.create(null),
|
||
queryVectors = Object.create(null),
|
||
termFieldCache = Object.create(null)
|
||
|
||
fn.call(query, query)
|
||
|
||
for (var i = 0; i < query.clauses.length; i++) {
|
||
/*
|
||
* Unless the pipeline has been disabled for this term, which is
|
||
* the case for terms with wildcards, we need to pass the clause
|
||
* term through the search pipeline. A pipeline returns an array
|
||
* of processed terms. Pipeline functions may expand the passed
|
||
* term, which means we may end up performing multiple index lookups
|
||
* for a single query term.
|
||
*/
|
||
var clause = query.clauses[i],
|
||
terms = null
|
||
|
||
if (clause.usePipeline) {
|
||
terms = this.pipeline.runString(clause.term)
|
||
} else {
|
||
terms = [clause.term]
|
||
}
|
||
|
||
for (var m = 0; m < terms.length; m++) {
|
||
var term = terms[m]
|
||
|
||
/*
|
||
* Each term returned from the pipeline needs to use the same query
|
||
* clause object, e.g. the same boost and or edit distance. The
|
||
* simplest way to do this is to re-use the clause object but mutate
|
||
* its term property.
|
||
*/
|
||
clause.term = term
|
||
|
||
/*
|
||
* From the term in the clause we create a token set which will then
|
||
* be used to intersect the indexes token set to get a list of terms
|
||
* to lookup in the inverted index
|
||
*/
|
||
var termTokenSet = lunr.TokenSet.fromClause(clause),
|
||
expandedTerms = this.tokenSet.intersect(termTokenSet).toArray()
|
||
|
||
for (var j = 0; j < expandedTerms.length; j++) {
|
||
/*
|
||
* For each term get the posting and termIndex, this is required for
|
||
* building the query vector.
|
||
*/
|
||
var expandedTerm = expandedTerms[j],
|
||
posting = this.invertedIndex[expandedTerm],
|
||
termIndex = posting._index
|
||
|
||
for (var k = 0; k < clause.fields.length; k++) {
|
||
/*
|
||
* For each field that this query term is scoped by (by default
|
||
* all fields are in scope) we need to get all the document refs
|
||
* that have this term in that field.
|
||
*
|
||
* The posting is the entry in the invertedIndex for the matching
|
||
* term from above.
|
||
*/
|
||
var field = clause.fields[k],
|
||
fieldPosting = posting[field],
|
||
matchingDocumentRefs = Object.keys(fieldPosting),
|
||
termField = expandedTerm + "/" + field
|
||
|
||
/*
|
||
* To support field level boosts a query vector is created per
|
||
* field. This vector is populated using the termIndex found for
|
||
* the term and a unit value with the appropriate boost applied.
|
||
*
|
||
* If the query vector for this field does not exist yet it needs
|
||
* to be created.
|
||
*/
|
||
if (queryVectors[field] === undefined) {
|
||
queryVectors[field] = new lunr.Vector
|
||
}
|
||
|
||
/*
|
||
* Using upsert because there could already be an entry in the vector
|
||
* for the term we are working with. In that case we just add the scores
|
||
* together.
|
||
*/
|
||
queryVectors[field].upsert(termIndex, 1 * clause.boost, function (a, b) { return a + b })
|
||
|
||
/**
|
||
* If we've already seen this term, field combo then we've already collected
|
||
* the matching documents and metadata, no need to go through all that again
|
||
*/
|
||
if (termFieldCache[termField]) {
|
||
continue
|
||
}
|
||
|
||
for (var l = 0; l < matchingDocumentRefs.length; l++) {
|
||
/*
|
||
* All metadata for this term/field/document triple
|
||
* are then extracted and collected into an instance
|
||
* of lunr.MatchData ready to be returned in the query
|
||
* results
|
||
*/
|
||
var matchingDocumentRef = matchingDocumentRefs[l],
|
||
matchingFieldRef = new lunr.FieldRef (matchingDocumentRef, field),
|
||
metadata = fieldPosting[matchingDocumentRef],
|
||
fieldMatch
|
||
|
||
if ((fieldMatch = matchingFields[matchingFieldRef]) === undefined) {
|
||
matchingFields[matchingFieldRef] = new lunr.MatchData (expandedTerm, field, metadata)
|
||
} else {
|
||
fieldMatch.add(expandedTerm, field, metadata)
|
||
}
|
||
|
||
}
|
||
|
||
termFieldCache[termField] = true
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
var matchingFieldRefs = Object.keys(matchingFields),
|
||
results = [],
|
||
matches = Object.create(null)
|
||
|
||
for (var i = 0; i < matchingFieldRefs.length; i++) {
|
||
/*
|
||
* Currently we have document fields that match the query, but we
|
||
* need to return documents. The matchData and scores are combined
|
||
* from multiple fields belonging to the same document.
|
||
*
|
||
* Scores are calculated by field, using the query vectors created
|
||
* above, and combined into a final document score using addition.
|
||
*/
|
||
var fieldRef = lunr.FieldRef.fromString(matchingFieldRefs[i]),
|
||
docRef = fieldRef.docRef,
|
||
fieldVector = this.fieldVectors[fieldRef],
|
||
score = queryVectors[fieldRef.fieldName].similarity(fieldVector),
|
||
docMatch
|
||
|
||
if ((docMatch = matches[docRef]) !== undefined) {
|
||
docMatch.score += score
|
||
docMatch.matchData.combine(matchingFields[fieldRef])
|
||
} else {
|
||
var match = {
|
||
ref: docRef,
|
||
score: score,
|
||
matchData: matchingFields[fieldRef]
|
||
}
|
||
matches[docRef] = match
|
||
results.push(match)
|
||
}
|
||
}
|
||
|
||
/*
|
||
* Sort the results objects by score, highest first.
|
||
*/
|
||
return results.sort(function (a, b) {
|
||
return b.score - a.score
|
||
})
|
||
}
|
||
|
||
/**
|
||
* Prepares the index for JSON serialization.
|
||
*
|
||
* The schema for this JSON blob will be described in a
|
||
* separate JSON schema file.
|
||
*
|
||
* @returns {Object}
|
||
*/
|
||
lunr.Index.prototype.toJSON = function () {
|
||
var invertedIndex = Object.keys(this.invertedIndex)
|
||
.sort()
|
||
.map(function (term) {
|
||
return [term, this.invertedIndex[term]]
|
||
}, this)
|
||
|
||
var fieldVectors = Object.keys(this.fieldVectors)
|
||
.map(function (ref) {
|
||
return [ref, this.fieldVectors[ref].toJSON()]
|
||
}, this)
|
||
|
||
return {
|
||
version: lunr.version,
|
||
fields: this.fields,
|
||
fieldVectors: fieldVectors,
|
||
invertedIndex: invertedIndex,
|
||
pipeline: this.pipeline.toJSON()
|
||
}
|
||
}
|
||
|
||
/**
|
||
* Loads a previously serialized lunr.Index
|
||
*
|
||
* @param {Object} serializedIndex - A previously serialized lunr.Index
|
||
* @returns {lunr.Index}
|
||
*/
|
||
lunr.Index.load = function (serializedIndex) {
|
||
var attrs = {},
|
||
fieldVectors = {},
|
||
serializedVectors = serializedIndex.fieldVectors,
|
||
invertedIndex = {},
|
||
serializedInvertedIndex = serializedIndex.invertedIndex,
|
||
tokenSetBuilder = new lunr.TokenSet.Builder,
|
||
pipeline = lunr.Pipeline.load(serializedIndex.pipeline)
|
||
|
||
if (serializedIndex.version != lunr.version) {
|
||
lunr.utils.warn("Version mismatch when loading serialised index. Current version of lunr '" + lunr.version + "' does not match serialized index '" + serializedIndex.version + "'")
|
||
}
|
||
|
||
for (var i = 0; i < serializedVectors.length; i++) {
|
||
var tuple = serializedVectors[i],
|
||
ref = tuple[0],
|
||
elements = tuple[1]
|
||
|
||
fieldVectors[ref] = new lunr.Vector(elements)
|
||
}
|
||
|
||
for (var i = 0; i < serializedInvertedIndex.length; i++) {
|
||
var tuple = serializedInvertedIndex[i],
|
||
term = tuple[0],
|
||
posting = tuple[1]
|
||
|
||
tokenSetBuilder.insert(term)
|
||
invertedIndex[term] = posting
|
||
}
|
||
|
||
tokenSetBuilder.finish()
|
||
|
||
attrs.fields = serializedIndex.fields
|
||
|
||
attrs.fieldVectors = fieldVectors
|
||
attrs.invertedIndex = invertedIndex
|
||
attrs.tokenSet = tokenSetBuilder.root
|
||
attrs.pipeline = pipeline
|
||
|
||
return new lunr.Index(attrs)
|
||
}
|
||
/*!
|
||
* lunr.Builder
|
||
* Copyright (C) 2017 Oliver Nightingale
|
||
*/
|
||
|
||
/**
|
||
* lunr.Builder performs indexing on a set of documents and
|
||
* returns instances of lunr.Index ready for querying.
|
||
*
|
||
* All configuration of the index is done via the builder, the
|
||
* fields to index, the document reference, the text processing
|
||
* pipeline and document scoring parameters are all set on the
|
||
* builder before indexing.
|
||
*
|
||
* @constructor
|
||
* @property {string} _ref - Internal reference to the document reference field.
|
||
* @property {string[]} _fields - Internal reference to the document fields to index.
|
||
* @property {object} invertedIndex - The inverted index maps terms to document fields.
|
||
* @property {object} documentTermFrequencies - Keeps track of document term frequencies.
|
||
* @property {object} documentLengths - Keeps track of the length of documents added to the index.
|
||
* @property {lunr.tokenizer} tokenizer - Function for splitting strings into tokens for indexing.
|
||
* @property {lunr.Pipeline} pipeline - The pipeline performs text processing on tokens before indexing.
|
||
* @property {lunr.Pipeline} searchPipeline - A pipeline for processing search terms before querying the index.
|
||
* @property {number} documentCount - Keeps track of the total number of documents indexed.
|
||
* @property {number} _b - A parameter to control field length normalization, setting this to 0 disabled normalization, 1 fully normalizes field lengths, the default value is 0.75.
|
||
* @property {number} _k1 - A parameter to control how quickly an increase in term frequency results in term frequency saturation, the default value is 1.2.
|
||
* @property {number} termIndex - A counter incremented for each unique term, used to identify a terms position in the vector space.
|
||
* @property {array} metadataWhitelist - A list of metadata keys that have been whitelisted for entry in the index.
|
||
*/
|
||
lunr.Builder = function () {
|
||
this._ref = "id"
|
||
this._fields = []
|
||
this.invertedIndex = Object.create(null)
|
||
this.fieldTermFrequencies = {}
|
||
this.fieldLengths = {}
|
||
this.tokenizer = lunr.tokenizer
|
||
this.pipeline = new lunr.Pipeline
|
||
this.searchPipeline = new lunr.Pipeline
|
||
this.documentCount = 0
|
||
this._b = 0.75
|
||
this._k1 = 1.2
|
||
this.termIndex = 0
|
||
this.metadataWhitelist = []
|
||
}
|
||
|
||
/**
|
||
* Sets the document field used as the document reference. Every document must have this field.
|
||
* The type of this field in the document should be a string, if it is not a string it will be
|
||
* coerced into a string by calling toString.
|
||
*
|
||
* The default ref is 'id'.
|
||
*
|
||
* The ref should _not_ be changed during indexing, it should be set before any documents are
|
||
* added to the index. Changing it during indexing can lead to inconsistent results.
|
||
*
|
||
* @param {string} ref - The name of the reference field in the document.
|
||
*/
|
||
lunr.Builder.prototype.ref = function (ref) {
|
||
this._ref = ref
|
||
}
|
||
|
||
/**
|
||
* Adds a field to the list of document fields that will be indexed. Every document being
|
||
* indexed should have this field. Null values for this field in indexed documents will
|
||
* not cause errors but will limit the chance of that document being retrieved by searches.
|
||
*
|
||
* All fields should be added before adding documents to the index. Adding fields after
|
||
* a document has been indexed will have no effect on already indexed documents.
|
||
*
|
||
* @param {string} field - The name of a field to index in all documents.
|
||
*/
|
||
lunr.Builder.prototype.field = function (field) {
|
||
this._fields.push(field)
|
||
}
|
||
|
||
/**
|
||
* A parameter to tune the amount of field length normalisation that is applied when
|
||
* calculating relevance scores. A value of 0 will completely disable any normalisation
|
||
* and a value of 1 will fully normalise field lengths. The default is 0.75. Values of b
|
||
* will be clamped to the range 0 - 1.
|
||
*
|
||
* @param {number} number - The value to set for this tuning parameter.
|
||
*/
|
||
lunr.Builder.prototype.b = function (number) {
|
||
if (number < 0) {
|
||
this._b = 0
|
||
} else if (number > 1) {
|
||
this._b = 1
|
||
} else {
|
||
this._b = number
|
||
}
|
||
}
|
||
|
||
/**
|
||
* A parameter that controls the speed at which a rise in term frequency results in term
|
||
* frequency saturation. The default value is 1.2. Setting this to a higher value will give
|
||
* slower saturation levels, a lower value will result in quicker saturation.
|
||
*
|
||
* @param {number} number - The value to set for this tuning parameter.
|
||
*/
|
||
lunr.Builder.prototype.k1 = function (number) {
|
||
this._k1 = number
|
||
}
|
||
|
||
/**
|
||
* Adds a document to the index.
|
||
*
|
||
* Before adding fields to the index the index should have been fully setup, with the document
|
||
* ref and all fields to index already having been specified.
|
||
*
|
||
* The document must have a field name as specified by the ref (by default this is 'id') and
|
||
* it should have all fields defined for indexing, though null or undefined values will not
|
||
* cause errors.
|
||
*
|
||
* @param {object} doc - The document to add to the index.
|
||
*/
|
||
lunr.Builder.prototype.add = function (doc) {
|
||
var docRef = doc[this._ref]
|
||
|
||
this.documentCount += 1
|
||
|
||
for (var i = 0; i < this._fields.length; i++) {
|
||
var fieldName = this._fields[i],
|
||
field = doc[fieldName],
|
||
tokens = this.tokenizer(field),
|
||
terms = this.pipeline.run(tokens),
|
||
fieldRef = new lunr.FieldRef (docRef, fieldName),
|
||
fieldTerms = Object.create(null)
|
||
|
||
this.fieldTermFrequencies[fieldRef] = fieldTerms
|
||
this.fieldLengths[fieldRef] = 0
|
||
|
||
// store the length of this field for this document
|
||
this.fieldLengths[fieldRef] += terms.length
|
||
|
||
// calculate term frequencies for this field
|
||
for (var j = 0; j < terms.length; j++) {
|
||
var term = terms[j]
|
||
|
||
if (fieldTerms[term] == undefined) {
|
||
fieldTerms[term] = 0
|
||
}
|
||
|
||
fieldTerms[term] += 1
|
||
|
||
// add to inverted index
|
||
// create an initial posting if one doesn't exist
|
||
if (this.invertedIndex[term] == undefined) {
|
||
var posting = Object.create(null)
|
||
posting["_index"] = this.termIndex
|
||
this.termIndex += 1
|
||
|
||
for (var k = 0; k < this._fields.length; k++) {
|
||
posting[this._fields[k]] = Object.create(null)
|
||
}
|
||
|
||
this.invertedIndex[term] = posting
|
||
}
|
||
|
||
// add an entry for this term/fieldName/docRef to the invertedIndex
|
||
if (this.invertedIndex[term][fieldName][docRef] == undefined) {
|
||
this.invertedIndex[term][fieldName][docRef] = Object.create(null)
|
||
}
|
||
|
||
// store all whitelisted metadata about this token in the
|
||
// inverted index
|
||
for (var l = 0; l < this.metadataWhitelist.length; l++) {
|
||
var metadataKey = this.metadataWhitelist[l],
|
||
metadata = term.metadata[metadataKey]
|
||
|
||
if (this.invertedIndex[term][fieldName][docRef][metadataKey] == undefined) {
|
||
this.invertedIndex[term][fieldName][docRef][metadataKey] = []
|
||
}
|
||
|
||
this.invertedIndex[term][fieldName][docRef][metadataKey].push(metadata)
|
||
}
|
||
}
|
||
|
||
}
|
||
}
|
||
|
||
/**
|
||
* Calculates the average document length for this index
|
||
*
|
||
* @private
|
||
*/
|
||
lunr.Builder.prototype.calculateAverageFieldLengths = function () {
|
||
|
||
var fieldRefs = Object.keys(this.fieldLengths),
|
||
numberOfFields = fieldRefs.length,
|
||
accumulator = {},
|
||
documentsWithField = {}
|
||
|
||
for (var i = 0; i < numberOfFields; i++) {
|
||
var fieldRef = lunr.FieldRef.fromString(fieldRefs[i]),
|
||
field = fieldRef.fieldName
|
||
|
||
documentsWithField[field] || (documentsWithField[field] = 0)
|
||
documentsWithField[field] += 1
|
||
|
||
accumulator[field] || (accumulator[field] = 0)
|
||
accumulator[field] += this.fieldLengths[fieldRef]
|
||
}
|
||
|
||
for (var i = 0; i < this._fields.length; i++) {
|
||
var field = this._fields[i]
|
||
accumulator[field] = accumulator[field] / documentsWithField[field]
|
||
}
|
||
|
||
this.averageFieldLength = accumulator
|
||
}
|
||
|
||
/**
|
||
* Builds a vector space model of every document using lunr.Vector
|
||
*
|
||
* @private
|
||
*/
|
||
lunr.Builder.prototype.createFieldVectors = function () {
|
||
var fieldVectors = {},
|
||
fieldRefs = Object.keys(this.fieldTermFrequencies),
|
||
fieldRefsLength = fieldRefs.length,
|
||
termIdfCache = Object.create(null)
|
||
|
||
for (var i = 0; i < fieldRefsLength; i++) {
|
||
var fieldRef = lunr.FieldRef.fromString(fieldRefs[i]),
|
||
field = fieldRef.fieldName,
|
||
fieldLength = this.fieldLengths[fieldRef],
|
||
fieldVector = new lunr.Vector,
|
||
termFrequencies = this.fieldTermFrequencies[fieldRef],
|
||
terms = Object.keys(termFrequencies),
|
||
termsLength = terms.length
|
||
|
||
for (var j = 0; j < termsLength; j++) {
|
||
var term = terms[j],
|
||
tf = termFrequencies[term],
|
||
termIndex = this.invertedIndex[term]._index,
|
||
idf, score, scoreWithPrecision
|
||
|
||
if (termIdfCache[term] === undefined) {
|
||
idf = lunr.idf(this.invertedIndex[term], this.documentCount)
|
||
termIdfCache[term] = idf
|
||
} else {
|
||
idf = termIdfCache[term]
|
||
}
|
||
|
||
score = idf * ((this._k1 + 1) * tf) / (this._k1 * (1 - this._b + this._b * (fieldLength / this.averageFieldLength[field])) + tf)
|
||
scoreWithPrecision = Math.round(score * 1000) / 1000
|
||
// Converts 1.23456789 to 1.234.
|
||
// Reducing the precision so that the vectors take up less
|
||
// space when serialised. Doing it now so that they behave
|
||
// the same before and after serialisation. Also, this is
|
||
// the fastest approach to reducing a number's precision in
|
||
// JavaScript.
|
||
|
||
fieldVector.insert(termIndex, scoreWithPrecision)
|
||
}
|
||
|
||
fieldVectors[fieldRef] = fieldVector
|
||
}
|
||
|
||
this.fieldVectors = fieldVectors
|
||
}
|
||
|
||
/**
|
||
* Creates a token set of all tokens in the index using lunr.TokenSet
|
||
*
|
||
* @private
|
||
*/
|
||
lunr.Builder.prototype.createTokenSet = function () {
|
||
this.tokenSet = lunr.TokenSet.fromArray(
|
||
Object.keys(this.invertedIndex).sort()
|
||
)
|
||
}
|
||
|
||
/**
|
||
* Builds the index, creating an instance of lunr.Index.
|
||
*
|
||
* This completes the indexing process and should only be called
|
||
* once all documents have been added to the index.
|
||
*
|
||
* @returns {lunr.Index}
|
||
*/
|
||
lunr.Builder.prototype.build = function () {
|
||
this.calculateAverageFieldLengths()
|
||
this.createFieldVectors()
|
||
this.createTokenSet()
|
||
|
||
return new lunr.Index({
|
||
invertedIndex: this.invertedIndex,
|
||
fieldVectors: this.fieldVectors,
|
||
tokenSet: this.tokenSet,
|
||
fields: this._fields,
|
||
pipeline: this.searchPipeline
|
||
})
|
||
}
|
||
|
||
/**
|
||
* Applies a plugin to the index builder.
|
||
*
|
||
* A plugin is a function that is called with the index builder as its context.
|
||
* Plugins can be used to customise or extend the behaviour of the index
|
||
* in some way. A plugin is just a function, that encapsulated the custom
|
||
* behaviour that should be applied when building the index.
|
||
*
|
||
* The plugin function will be called with the index builder as its argument, additional
|
||
* arguments can also be passed when calling use. The function will be called
|
||
* with the index builder as its context.
|
||
*
|
||
* @param {Function} plugin The plugin to apply.
|
||
*/
|
||
lunr.Builder.prototype.use = function (fn) {
|
||
var args = Array.prototype.slice.call(arguments, 1)
|
||
args.unshift(this)
|
||
fn.apply(this, args)
|
||
}
|
||
/**
|
||
* Contains and collects metadata about a matching document.
|
||
* A single instance of lunr.MatchData is returned as part of every
|
||
* lunr.Index~Result.
|
||
*
|
||
* @constructor
|
||
* @param {string} term - The term this match data is associated with
|
||
* @param {string} field - The field in which the term was found
|
||
* @param {object} metadata - The metadata recorded about this term in this field
|
||
* @property {object} metadata - A cloned collection of metadata associated with this document.
|
||
* @see {@link lunr.Index~Result}
|
||
*/
|
||
lunr.MatchData = function (term, field, metadata) {
|
||
var clonedMetadata = Object.create(null),
|
||
metadataKeys = Object.keys(metadata)
|
||
|
||
// Cloning the metadata to prevent the original
|
||
// being mutated during match data combination.
|
||
// Metadata is kept in an array within the inverted
|
||
// index so cloning the data can be done with
|
||
// Array#slice
|
||
for (var i = 0; i < metadataKeys.length; i++) {
|
||
var key = metadataKeys[i]
|
||
clonedMetadata[key] = metadata[key].slice()
|
||
}
|
||
|
||
this.metadata = Object.create(null)
|
||
this.metadata[term] = Object.create(null)
|
||
this.metadata[term][field] = clonedMetadata
|
||
}
|
||
|
||
/**
|
||
* An instance of lunr.MatchData will be created for every term that matches a
|
||
* document. However only one instance is required in a lunr.Index~Result. This
|
||
* method combines metadata from another instance of lunr.MatchData with this
|
||
* objects metadata.
|
||
*
|
||
* @param {lunr.MatchData} otherMatchData - Another instance of match data to merge with this one.
|
||
* @see {@link lunr.Index~Result}
|
||
*/
|
||
lunr.MatchData.prototype.combine = function (otherMatchData) {
|
||
var terms = Object.keys(otherMatchData.metadata)
|
||
|
||
for (var i = 0; i < terms.length; i++) {
|
||
var term = terms[i],
|
||
fields = Object.keys(otherMatchData.metadata[term])
|
||
|
||
if (this.metadata[term] == undefined) {
|
||
this.metadata[term] = Object.create(null)
|
||
}
|
||
|
||
for (var j = 0; j < fields.length; j++) {
|
||
var field = fields[j],
|
||
keys = Object.keys(otherMatchData.metadata[term][field])
|
||
|
||
if (this.metadata[term][field] == undefined) {
|
||
this.metadata[term][field] = Object.create(null)
|
||
}
|
||
|
||
for (var k = 0; k < keys.length; k++) {
|
||
var key = keys[k]
|
||
|
||
if (this.metadata[term][field][key] == undefined) {
|
||
this.metadata[term][field][key] = otherMatchData.metadata[term][field][key]
|
||
} else {
|
||
this.metadata[term][field][key] = this.metadata[term][field][key].concat(otherMatchData.metadata[term][field][key])
|
||
}
|
||
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
/**
|
||
* Add metadata for a term/field pair to this instance of match data.
|
||
*
|
||
* @param {string} term - The term this match data is associated with
|
||
* @param {string} field - The field in which the term was found
|
||
* @param {object} metadata - The metadata recorded about this term in this field
|
||
*/
|
||
lunr.MatchData.prototype.add = function (term, field, metadata) {
|
||
if (!(term in this.metadata)) {
|
||
this.metadata[term] = Object.create(null)
|
||
this.metadata[term][field] = metadata
|
||
return
|
||
}
|
||
|
||
if (!(field in this.metadata[term])) {
|
||
this.metadata[term][field] = metadata
|
||
return
|
||
}
|
||
|
||
var metadataKeys = Object.keys(metadata)
|
||
|
||
for (var i = 0; i < metadataKeys.length; i++) {
|
||
var key = metadataKeys[i]
|
||
|
||
if (key in this.metadata[term][field]) {
|
||
this.metadata[term][field][key] = this.metadata[term][field][key].concat(metadata[key])
|
||
} else {
|
||
this.metadata[term][field][key] = metadata[key]
|
||
}
|
||
}
|
||
}
|
||
/**
|
||
* A lunr.Query provides a programmatic way of defining queries to be performed
|
||
* against a {@link lunr.Index}.
|
||
*
|
||
* Prefer constructing a lunr.Query using the {@link lunr.Index#query} method
|
||
* so the query object is pre-initialized with the right index fields.
|
||
*
|
||
* @constructor
|
||
* @property {lunr.Query~Clause[]} clauses - An array of query clauses.
|
||
* @property {string[]} allFields - An array of all available fields in a lunr.Index.
|
||
*/
|
||
lunr.Query = function (allFields) {
|
||
this.clauses = []
|
||
this.allFields = allFields
|
||
}
|
||
|
||
/**
|
||
* Constants for indicating what kind of automatic wildcard insertion will be used when constructing a query clause.
|
||
*
|
||
* This allows wildcards to be added to the beginning and end of a term without having to manually do any string
|
||
* concatenation.
|
||
*
|
||
* The wildcard constants can be bitwise combined to select both leading and trailing wildcards.
|
||
*
|
||
* @constant
|
||
* @default
|
||
* @property {number} wildcard.NONE - The term will have no wildcards inserted, this is the default behaviour
|
||
* @property {number} wildcard.LEADING - Prepend the term with a wildcard, unless a leading wildcard already exists
|
||
* @property {number} wildcard.TRAILING - Append a wildcard to the term, unless a trailing wildcard already exists
|
||
* @see lunr.Query~Clause
|
||
* @see lunr.Query#clause
|
||
* @see lunr.Query#term
|
||
* @example <caption>query term with trailing wildcard</caption>
|
||
* query.term('foo', { wildcard: lunr.Query.wildcard.TRAILING })
|
||
* @example <caption>query term with leading and trailing wildcard</caption>
|
||
* query.term('foo', {
|
||
* wildcard: lunr.Query.wildcard.LEADING | lunr.Query.wildcard.TRAILING
|
||
* })
|
||
*/
|
||
lunr.Query.wildcard = new String ("*")
|
||
lunr.Query.wildcard.NONE = 0
|
||
lunr.Query.wildcard.LEADING = 1
|
||
lunr.Query.wildcard.TRAILING = 2
|
||
|
||
/**
|
||
* A single clause in a {@link lunr.Query} contains a term and details on how to
|
||
* match that term against a {@link lunr.Index}.
|
||
*
|
||
* @typedef {Object} lunr.Query~Clause
|
||
* @property {string[]} fields - The fields in an index this clause should be matched against.
|
||
* @property {number} [boost=1] - Any boost that should be applied when matching this clause.
|
||
* @property {number} [editDistance] - Whether the term should have fuzzy matching applied, and how fuzzy the match should be.
|
||
* @property {boolean} [usePipeline] - Whether the term should be passed through the search pipeline.
|
||
* @property {number} [wildcard=0] - Whether the term should have wildcards appended or prepended.
|
||
*/
|
||
|
||
/**
|
||
* Adds a {@link lunr.Query~Clause} to this query.
|
||
*
|
||
* Unless the clause contains the fields to be matched all fields will be matched. In addition
|
||
* a default boost of 1 is applied to the clause.
|
||
*
|
||
* @param {lunr.Query~Clause} clause - The clause to add to this query.
|
||
* @see lunr.Query~Clause
|
||
* @returns {lunr.Query}
|
||
*/
|
||
lunr.Query.prototype.clause = function (clause) {
|
||
if (!('fields' in clause)) {
|
||
clause.fields = this.allFields
|
||
}
|
||
|
||
if (!('boost' in clause)) {
|
||
clause.boost = 1
|
||
}
|
||
|
||
if (!('usePipeline' in clause)) {
|
||
clause.usePipeline = true
|
||
}
|
||
|
||
if (!('wildcard' in clause)) {
|
||
clause.wildcard = lunr.Query.wildcard.NONE
|
||
}
|
||
|
||
if ((clause.wildcard & lunr.Query.wildcard.LEADING) && (clause.term.charAt(0) != lunr.Query.wildcard)) {
|
||
clause.term = "*" + clause.term
|
||
}
|
||
|
||
if ((clause.wildcard & lunr.Query.wildcard.TRAILING) && (clause.term.slice(-1) != lunr.Query.wildcard)) {
|
||
clause.term = "" + clause.term + "*"
|
||
}
|
||
|
||
this.clauses.push(clause)
|
||
|
||
return this
|
||
}
|
||
|
||
/**
|
||
* Adds a term to the current query, under the covers this will create a {@link lunr.Query~Clause}
|
||
* to the list of clauses that make up this query.
|
||
*
|
||
* @param {string} term - The term to add to the query.
|
||
* @param {Object} [options] - Any additional properties to add to the query clause.
|
||
* @returns {lunr.Query}
|
||
* @see lunr.Query#clause
|
||
* @see lunr.Query~Clause
|
||
* @example <caption>adding a single term to a query</caption>
|
||
* query.term("foo")
|
||
* @example <caption>adding a single term to a query and specifying search fields, term boost and automatic trailing wildcard</caption>
|
||
* query.term("foo", {
|
||
* fields: ["title"],
|
||
* boost: 10,
|
||
* wildcard: lunr.Query.wildcard.TRAILING
|
||
* })
|
||
*/
|
||
lunr.Query.prototype.term = function (term, options) {
|
||
var clause = options || {}
|
||
clause.term = term
|
||
|
||
this.clause(clause)
|
||
|
||
return this
|
||
}
|
||
lunr.QueryParseError = function (message, start, end) {
|
||
this.name = "QueryParseError"
|
||
this.message = message
|
||
this.start = start
|
||
this.end = end
|
||
}
|
||
|
||
lunr.QueryParseError.prototype = new Error
|
||
lunr.QueryLexer = function (str) {
|
||
this.lexemes = []
|
||
this.str = str
|
||
this.length = str.length
|
||
this.pos = 0
|
||
this.start = 0
|
||
this.escapeCharPositions = []
|
||
}
|
||
|
||
lunr.QueryLexer.prototype.run = function () {
|
||
var state = lunr.QueryLexer.lexText
|
||
|
||
while (state) {
|
||
state = state(this)
|
||
}
|
||
}
|
||
|
||
lunr.QueryLexer.prototype.sliceString = function () {
|
||
var subSlices = [],
|
||
sliceStart = this.start,
|
||
sliceEnd = this.pos
|
||
|
||
for (var i = 0; i < this.escapeCharPositions.length; i++) {
|
||
sliceEnd = this.escapeCharPositions[i]
|
||
subSlices.push(this.str.slice(sliceStart, sliceEnd))
|
||
sliceStart = sliceEnd + 1
|
||
}
|
||
|
||
subSlices.push(this.str.slice(sliceStart, this.pos))
|
||
this.escapeCharPositions.length = 0
|
||
|
||
return subSlices.join('')
|
||
}
|
||
|
||
lunr.QueryLexer.prototype.emit = function (type) {
|
||
this.lexemes.push({
|
||
type: type,
|
||
str: this.sliceString(),
|
||
start: this.start,
|
||
end: this.pos
|
||
})
|
||
|
||
this.start = this.pos
|
||
}
|
||
|
||
lunr.QueryLexer.prototype.escapeCharacter = function () {
|
||
this.escapeCharPositions.push(this.pos - 1)
|
||
this.pos += 1
|
||
}
|
||
|
||
lunr.QueryLexer.prototype.next = function () {
|
||
if (this.pos >= this.length) {
|
||
return lunr.QueryLexer.EOS
|
||
}
|
||
|
||
var char = this.str.charAt(this.pos)
|
||
this.pos += 1
|
||
return char
|
||
}
|
||
|
||
lunr.QueryLexer.prototype.width = function () {
|
||
return this.pos - this.start
|
||
}
|
||
|
||
lunr.QueryLexer.prototype.ignore = function () {
|
||
if (this.start == this.pos) {
|
||
this.pos += 1
|
||
}
|
||
|
||
this.start = this.pos
|
||
}
|
||
|
||
lunr.QueryLexer.prototype.backup = function () {
|
||
this.pos -= 1
|
||
}
|
||
|
||
lunr.QueryLexer.prototype.acceptDigitRun = function () {
|
||
var char, charCode
|
||
|
||
do {
|
||
char = this.next()
|
||
charCode = char.charCodeAt(0)
|
||
} while (charCode > 47 && charCode < 58)
|
||
|
||
if (char != lunr.QueryLexer.EOS) {
|
||
this.backup()
|
||
}
|
||
}
|
||
|
||
lunr.QueryLexer.prototype.more = function () {
|
||
return this.pos < this.length
|
||
}
|
||
|
||
lunr.QueryLexer.EOS = 'EOS'
|
||
lunr.QueryLexer.FIELD = 'FIELD'
|
||
lunr.QueryLexer.TERM = 'TERM'
|
||
lunr.QueryLexer.EDIT_DISTANCE = 'EDIT_DISTANCE'
|
||
lunr.QueryLexer.BOOST = 'BOOST'
|
||
|
||
lunr.QueryLexer.lexField = function (lexer) {
|
||
lexer.backup()
|
||
lexer.emit(lunr.QueryLexer.FIELD)
|
||
lexer.ignore()
|
||
return lunr.QueryLexer.lexText
|
||
}
|
||
|
||
lunr.QueryLexer.lexTerm = function (lexer) {
|
||
if (lexer.width() > 1) {
|
||
lexer.backup()
|
||
lexer.emit(lunr.QueryLexer.TERM)
|
||
}
|
||
|
||
lexer.ignore()
|
||
|
||
if (lexer.more()) {
|
||
return lunr.QueryLexer.lexText
|
||
}
|
||
}
|
||
|
||
lunr.QueryLexer.lexEditDistance = function (lexer) {
|
||
lexer.ignore()
|
||
lexer.acceptDigitRun()
|
||
lexer.emit(lunr.QueryLexer.EDIT_DISTANCE)
|
||
return lunr.QueryLexer.lexText
|
||
}
|
||
|
||
lunr.QueryLexer.lexBoost = function (lexer) {
|
||
lexer.ignore()
|
||
lexer.acceptDigitRun()
|
||
lexer.emit(lunr.QueryLexer.BOOST)
|
||
return lunr.QueryLexer.lexText
|
||
}
|
||
|
||
lunr.QueryLexer.lexEOS = function (lexer) {
|
||
if (lexer.width() > 0) {
|
||
lexer.emit(lunr.QueryLexer.TERM)
|
||
}
|
||
}
|
||
|
||
// This matches the separator used when tokenising fields
|
||
// within a document. These should match otherwise it is
|
||
// not possible to search for some tokens within a document.
|
||
//
|
||
// It is possible for the user to change the separator on the
|
||
// tokenizer so it _might_ clash with any other of the special
|
||
// characters already used within the search string, e.g. :.
|
||
//
|
||
// This means that it is possible to change the separator in
|
||
// such a way that makes some words unsearchable using a search
|
||
// string.
|
||
lunr.QueryLexer.termSeparator = lunr.tokenizer.separator
|
||
|
||
lunr.QueryLexer.lexText = function (lexer) {
|
||
while (true) {
|
||
var char = lexer.next()
|
||
|
||
if (char == lunr.QueryLexer.EOS) {
|
||
return lunr.QueryLexer.lexEOS
|
||
}
|
||
|
||
// Escape character is '\'
|
||
if (char.charCodeAt(0) == 92) {
|
||
lexer.escapeCharacter()
|
||
continue
|
||
}
|
||
|
||
if (char == ":") {
|
||
return lunr.QueryLexer.lexField
|
||
}
|
||
|
||
if (char == "~") {
|
||
lexer.backup()
|
||
if (lexer.width() > 0) {
|
||
lexer.emit(lunr.QueryLexer.TERM)
|
||
}
|
||
return lunr.QueryLexer.lexEditDistance
|
||
}
|
||
|
||
if (char == "^") {
|
||
lexer.backup()
|
||
if (lexer.width() > 0) {
|
||
lexer.emit(lunr.QueryLexer.TERM)
|
||
}
|
||
return lunr.QueryLexer.lexBoost
|
||
}
|
||
|
||
if (char.match(lunr.QueryLexer.termSeparator)) {
|
||
return lunr.QueryLexer.lexTerm
|
||
}
|
||
}
|
||
}
|
||
|
||
lunr.QueryParser = function (str, query) {
|
||
this.lexer = new lunr.QueryLexer (str)
|
||
this.query = query
|
||
this.currentClause = {}
|
||
this.lexemeIdx = 0
|
||
}
|
||
|
||
lunr.QueryParser.prototype.parse = function () {
|
||
this.lexer.run()
|
||
this.lexemes = this.lexer.lexemes
|
||
|
||
var state = lunr.QueryParser.parseFieldOrTerm
|
||
|
||
while (state) {
|
||
state = state(this)
|
||
}
|
||
|
||
return this.query
|
||
}
|
||
|
||
lunr.QueryParser.prototype.peekLexeme = function () {
|
||
return this.lexemes[this.lexemeIdx]
|
||
}
|
||
|
||
lunr.QueryParser.prototype.consumeLexeme = function () {
|
||
var lexeme = this.peekLexeme()
|
||
this.lexemeIdx += 1
|
||
return lexeme
|
||
}
|
||
|
||
lunr.QueryParser.prototype.nextClause = function () {
|
||
var completedClause = this.currentClause
|
||
this.query.clause(completedClause)
|
||
this.currentClause = {}
|
||
}
|
||
|
||
lunr.QueryParser.parseFieldOrTerm = function (parser) {
|
||
var lexeme = parser.peekLexeme()
|
||
|
||
if (lexeme == undefined) {
|
||
return
|
||
}
|
||
|
||
switch (lexeme.type) {
|
||
case lunr.QueryLexer.FIELD:
|
||
return lunr.QueryParser.parseField
|
||
case lunr.QueryLexer.TERM:
|
||
return lunr.QueryParser.parseTerm
|
||
default:
|
||
var errorMessage = "expected either a field or a term, found " + lexeme.type
|
||
|
||
if (lexeme.str.length >= 1) {
|
||
errorMessage += " with value '" + lexeme.str + "'"
|
||
}
|
||
|
||
throw new lunr.QueryParseError (errorMessage, lexeme.start, lexeme.end)
|
||
}
|
||
}
|
||
|
||
lunr.QueryParser.parseField = function (parser) {
|
||
var lexeme = parser.consumeLexeme()
|
||
|
||
if (lexeme == undefined) {
|
||
return
|
||
}
|
||
|
||
if (parser.query.allFields.indexOf(lexeme.str) == -1) {
|
||
var possibleFields = parser.query.allFields.map(function (f) { return "'" + f + "'" }).join(', '),
|
||
errorMessage = "unrecognised field '" + lexeme.str + "', possible fields: " + possibleFields
|
||
|
||
throw new lunr.QueryParseError (errorMessage, lexeme.start, lexeme.end)
|
||
}
|
||
|
||
parser.currentClause.fields = [lexeme.str]
|
||
|
||
var nextLexeme = parser.peekLexeme()
|
||
|
||
if (nextLexeme == undefined) {
|
||
var errorMessage = "expecting term, found nothing"
|
||
throw new lunr.QueryParseError (errorMessage, lexeme.start, lexeme.end)
|
||
}
|
||
|
||
switch (nextLexeme.type) {
|
||
case lunr.QueryLexer.TERM:
|
||
return lunr.QueryParser.parseTerm
|
||
default:
|
||
var errorMessage = "expecting term, found '" + nextLexeme.type + "'"
|
||
throw new lunr.QueryParseError (errorMessage, nextLexeme.start, nextLexeme.end)
|
||
}
|
||
}
|
||
|
||
lunr.QueryParser.parseTerm = function (parser) {
|
||
var lexeme = parser.consumeLexeme()
|
||
|
||
if (lexeme == undefined) {
|
||
return
|
||
}
|
||
|
||
parser.currentClause.term = lexeme.str.toLowerCase()
|
||
|
||
if (lexeme.str.indexOf("*") != -1) {
|
||
parser.currentClause.usePipeline = false
|
||
}
|
||
|
||
var nextLexeme = parser.peekLexeme()
|
||
|
||
if (nextLexeme == undefined) {
|
||
parser.nextClause()
|
||
return
|
||
}
|
||
|
||
switch (nextLexeme.type) {
|
||
case lunr.QueryLexer.TERM:
|
||
parser.nextClause()
|
||
return lunr.QueryParser.parseTerm
|
||
case lunr.QueryLexer.FIELD:
|
||
parser.nextClause()
|
||
return lunr.QueryParser.parseField
|
||
case lunr.QueryLexer.EDIT_DISTANCE:
|
||
return lunr.QueryParser.parseEditDistance
|
||
case lunr.QueryLexer.BOOST:
|
||
return lunr.QueryParser.parseBoost
|
||
default:
|
||
var errorMessage = "Unexpected lexeme type '" + nextLexeme.type + "'"
|
||
throw new lunr.QueryParseError (errorMessage, nextLexeme.start, nextLexeme.end)
|
||
}
|
||
}
|
||
|
||
lunr.QueryParser.parseEditDistance = function (parser) {
|
||
var lexeme = parser.consumeLexeme()
|
||
|
||
if (lexeme == undefined) {
|
||
return
|
||
}
|
||
|
||
var editDistance = parseInt(lexeme.str, 10)
|
||
|
||
if (isNaN(editDistance)) {
|
||
var errorMessage = "edit distance must be numeric"
|
||
throw new lunr.QueryParseError (errorMessage, lexeme.start, lexeme.end)
|
||
}
|
||
|
||
parser.currentClause.editDistance = editDistance
|
||
|
||
var nextLexeme = parser.peekLexeme()
|
||
|
||
if (nextLexeme == undefined) {
|
||
parser.nextClause()
|
||
return
|
||
}
|
||
|
||
switch (nextLexeme.type) {
|
||
case lunr.QueryLexer.TERM:
|
||
parser.nextClause()
|
||
return lunr.QueryParser.parseTerm
|
||
case lunr.QueryLexer.FIELD:
|
||
parser.nextClause()
|
||
return lunr.QueryParser.parseField
|
||
case lunr.QueryLexer.EDIT_DISTANCE:
|
||
return lunr.QueryParser.parseEditDistance
|
||
case lunr.QueryLexer.BOOST:
|
||
return lunr.QueryParser.parseBoost
|
||
default:
|
||
var errorMessage = "Unexpected lexeme type '" + nextLexeme.type + "'"
|
||
throw new lunr.QueryParseError (errorMessage, nextLexeme.start, nextLexeme.end)
|
||
}
|
||
}
|
||
|
||
lunr.QueryParser.parseBoost = function (parser) {
|
||
var lexeme = parser.consumeLexeme()
|
||
|
||
if (lexeme == undefined) {
|
||
return
|
||
}
|
||
|
||
var boost = parseInt(lexeme.str, 10)
|
||
|
||
if (isNaN(boost)) {
|
||
var errorMessage = "boost must be numeric"
|
||
throw new lunr.QueryParseError (errorMessage, lexeme.start, lexeme.end)
|
||
}
|
||
|
||
parser.currentClause.boost = boost
|
||
|
||
var nextLexeme = parser.peekLexeme()
|
||
|
||
if (nextLexeme == undefined) {
|
||
parser.nextClause()
|
||
return
|
||
}
|
||
|
||
switch (nextLexeme.type) {
|
||
case lunr.QueryLexer.TERM:
|
||
parser.nextClause()
|
||
return lunr.QueryParser.parseTerm
|
||
case lunr.QueryLexer.FIELD:
|
||
parser.nextClause()
|
||
return lunr.QueryParser.parseField
|
||
case lunr.QueryLexer.EDIT_DISTANCE:
|
||
return lunr.QueryParser.parseEditDistance
|
||
case lunr.QueryLexer.BOOST:
|
||
return lunr.QueryParser.parseBoost
|
||
default:
|
||
var errorMessage = "Unexpected lexeme type '" + nextLexeme.type + "'"
|
||
throw new lunr.QueryParseError (errorMessage, nextLexeme.start, nextLexeme.end)
|
||
}
|
||
}
|
||
|
||
/**
|
||
* export the module via AMD, CommonJS or as a browser global
|
||
* Export code from https://github.com/umdjs/umd/blob/master/returnExports.js
|
||
*/
|
||
;(function (root, factory) {
|
||
if (true) {
|
||
// AMD. Register as an anonymous module.
|
||
!(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
|
||
__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
|
||
(__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) :
|
||
__WEBPACK_AMD_DEFINE_FACTORY__),
|
||
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))
|
||
} else if (typeof exports === 'object') {
|
||
/**
|
||
* Node. Does not work with strict CommonJS, but
|
||
* only CommonJS-like enviroments that support module.exports,
|
||
* like Node.
|
||
*/
|
||
module.exports = factory()
|
||
} else {
|
||
// Browser globals (root is window)
|
||
root.lunr = factory()
|
||
}
|
||
}(this, function () {
|
||
/**
|
||
* Just return a value to define the module export.
|
||
* This example returns an object, but the module
|
||
* can return a function as the exported value.
|
||
*/
|
||
return lunr
|
||
}))
|
||
})();
|
||
|
||
|
||
/***/ }),
|
||
/* 37 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
|
||
exports.__esModule = true;
|
||
|
||
var _Position = __webpack_require__(38);
|
||
|
||
var _Position2 = _interopRequireDefault(_Position);
|
||
|
||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||
|
||
/* ----------------------------------------------------------------------------
|
||
* Module
|
||
* ------------------------------------------------------------------------- */
|
||
|
||
exports.default = {
|
||
Position: _Position2.default
|
||
}; /*
|
||
* Copyright (c) 2016-2018 Martin Donath <martin.donath@squidfunk.com>
|
||
*
|
||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||
* of this software and associated documentation files (the "Software"), to
|
||
* deal in the Software without restriction, including without limitation the
|
||
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||
* sell copies of the Software, and to permit persons to whom the Software is
|
||
* furnished to do so, subject to the following conditions:
|
||
*
|
||
* The above copyright notice and this permission notice shall be included in
|
||
* all copies or substantial portions of the Software.
|
||
*
|
||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||
* IN THE SOFTWARE.
|
||
*/
|
||
|
||
/***/ }),
|
||
/* 38 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
|
||
exports.__esModule = true;
|
||
|
||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||
|
||
/*
|
||
* Copyright (c) 2016-2018 Martin Donath <martin.donath@squidfunk.com>
|
||
*
|
||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||
* of this software and associated documentation files (the "Software"), to
|
||
* deal in the Software without restriction, including without limitation the
|
||
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||
* sell copies of the Software, and to permit persons to whom the Software is
|
||
* furnished to do so, subject to the following conditions:
|
||
*
|
||
* The above copyright notice and this permission notice shall be included in
|
||
* all copies or substantial portions of the Software.
|
||
*
|
||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||
* IN THE SOFTWARE.
|
||
*/
|
||
|
||
/* ----------------------------------------------------------------------------
|
||
* Class
|
||
* ------------------------------------------------------------------------- */
|
||
|
||
var Position = function () {
|
||
|
||
/**
|
||
* Set sidebars to locked state and limit height to parent node
|
||
*
|
||
* @constructor
|
||
*
|
||
* @property {HTMLElement} el_ - Sidebar
|
||
* @property {HTMLElement} parent_ - Sidebar container
|
||
* @property {HTMLElement} header_ - Header
|
||
* @property {number} height_ - Current sidebar height
|
||
* @property {number} offset_ - Current page y-offset
|
||
* @property {boolean} pad_ - Pad when header is fixed
|
||
*
|
||
* @param {(string|HTMLElement)} el - Selector or HTML element
|
||
* @param {(string|HTMLElement)} header - Selector or HTML element
|
||
*/
|
||
function Position(el, header) {
|
||
_classCallCheck(this, Position);
|
||
|
||
var ref = typeof el === "string" ? document.querySelector(el) : el;
|
||
if (!(ref instanceof HTMLElement) || !(ref.parentNode instanceof HTMLElement)) throw new ReferenceError();
|
||
this.el_ = ref;
|
||
this.parent_ = ref.parentNode;
|
||
|
||
/* Retrieve header */
|
||
ref = typeof header === "string" ? document.querySelector(header) : header;
|
||
if (!(ref instanceof HTMLElement)) throw new ReferenceError();
|
||
this.header_ = ref;
|
||
|
||
/* Initialize current height and test whether header is fixed */
|
||
this.height_ = 0;
|
||
this.pad_ = window.getComputedStyle(this.header_).position === "fixed";
|
||
}
|
||
|
||
/**
|
||
* Initialize sidebar state
|
||
*/
|
||
|
||
|
||
Position.prototype.setup = function setup() {
|
||
var top = Array.prototype.reduce.call(this.parent_.children, function (offset, child) {
|
||
return Math.max(offset, child.offsetTop);
|
||
}, 0);
|
||
|
||
/* Set lock offset for element with largest top offset */
|
||
this.offset_ = top - (this.pad_ ? this.header_.offsetHeight : 0);
|
||
this.update();
|
||
};
|
||
|
||
/**
|
||
* Update locked state and height
|
||
*
|
||
* The inner height of the window (= the visible area) is the maximum
|
||
* possible height for the stretching sidebar. This height must be deducted
|
||
* by the height of the fixed header (56px). Depending on the page y-offset,
|
||
* the top offset of the sidebar must be taken into account, as well as the
|
||
* case where the window is scrolled beyond the sidebar container.
|
||
*
|
||
* @param {Event?} ev - Event
|
||
*/
|
||
|
||
|
||
Position.prototype.update = function update(ev) {
|
||
var offset = window.pageYOffset;
|
||
var visible = window.innerHeight;
|
||
|
||
/* Update offset, in case window is resized */
|
||
if (ev && ev.type === "resize") this.setup();
|
||
|
||
/* Set bounds of sidebar container - must be calculated on every run, as
|
||
the height of the content might change due to loading images etc. */
|
||
var bounds = {
|
||
top: this.pad_ ? this.header_.offsetHeight : 0,
|
||
bottom: this.parent_.offsetTop + this.parent_.offsetHeight
|
||
|
||
/* Calculate new offset and height */
|
||
};var height = visible - bounds.top - Math.max(0, this.offset_ - offset) - Math.max(0, offset + visible - bounds.bottom);
|
||
|
||
/* If height changed, update element */
|
||
if (height !== this.height_) this.el_.style.height = (this.height_ = height) + "px";
|
||
|
||
/* Sidebar should be locked, as we're below parent offset */
|
||
if (offset >= this.offset_) {
|
||
if (this.el_.dataset.mdState !== "lock") this.el_.dataset.mdState = "lock";
|
||
|
||
/* Sidebar should be unlocked, if locked */
|
||
} else if (this.el_.dataset.mdState === "lock") {
|
||
this.el_.dataset.mdState = "";
|
||
}
|
||
};
|
||
|
||
/**
|
||
* Reset locked state and height
|
||
*/
|
||
|
||
|
||
Position.prototype.reset = function reset() {
|
||
this.el_.dataset.mdState = "";
|
||
this.el_.style.height = "";
|
||
this.height_ = 0;
|
||
};
|
||
|
||
return Position;
|
||
}();
|
||
|
||
exports.default = Position;
|
||
|
||
/***/ }),
|
||
/* 39 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
|
||
exports.__esModule = true;
|
||
|
||
var _Adapter = __webpack_require__(40);
|
||
|
||
var _Adapter2 = _interopRequireDefault(_Adapter);
|
||
|
||
var _Repository = __webpack_require__(44);
|
||
|
||
var _Repository2 = _interopRequireDefault(_Repository);
|
||
|
||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||
|
||
/* ----------------------------------------------------------------------------
|
||
* Module
|
||
* ------------------------------------------------------------------------- */
|
||
|
||
/*
|
||
* Copyright (c) 2016-2018 Martin Donath <martin.donath@squidfunk.com>
|
||
*
|
||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||
* of this software and associated documentation files (the "Software"), to
|
||
* deal in the Software without restriction, including without limitation the
|
||
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||
* sell copies of the Software, and to permit persons to whom the Software is
|
||
* furnished to do so, subject to the following conditions:
|
||
*
|
||
* The above copyright notice and this permission notice shall be included in
|
||
* all copies or substantial portions of the Software.
|
||
*
|
||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||
* IN THE SOFTWARE.
|
||
*/
|
||
|
||
exports.default = {
|
||
Adapter: _Adapter2.default,
|
||
Repository: _Repository2.default
|
||
};
|
||
|
||
/***/ }),
|
||
/* 40 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
|
||
exports.__esModule = true;
|
||
|
||
var _GitHub = __webpack_require__(41);
|
||
|
||
var _GitHub2 = _interopRequireDefault(_GitHub);
|
||
|
||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||
|
||
/* ----------------------------------------------------------------------------
|
||
* Module
|
||
* ------------------------------------------------------------------------- */
|
||
|
||
exports.default = {
|
||
GitHub: _GitHub2.default
|
||
}; /*
|
||
* Copyright (c) 2016-2018 Martin Donath <martin.donath@squidfunk.com>
|
||
*
|
||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||
* of this software and associated documentation files (the "Software"), to
|
||
* deal in the Software without restriction, including without limitation the
|
||
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||
* sell copies of the Software, and to permit persons to whom the Software is
|
||
* furnished to do so, subject to the following conditions:
|
||
*
|
||
* The above copyright notice and this permission notice shall be included in
|
||
* all copies or substantial portions of the Software.
|
||
*
|
||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||
* IN THE SOFTWARE.
|
||
*/
|
||
|
||
/***/ }),
|
||
/* 41 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
|
||
exports.__esModule = true;
|
||
|
||
var _Abstract2 = __webpack_require__(42);
|
||
|
||
var _Abstract3 = _interopRequireDefault(_Abstract2);
|
||
|
||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||
|
||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||
|
||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
||
|
||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /*
|
||
* Copyright (c) 2016-2018 Martin Donath <martin.donath@squidfunk.com>
|
||
*
|
||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||
* of this software and associated documentation files (the "Software"), to
|
||
* deal in the Software without restriction, including without limitation the
|
||
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||
* sell copies of the Software, and to permit persons to whom the Software is
|
||
* furnished to do so, subject to the following conditions:
|
||
*
|
||
* The above copyright notice and this permission notice shall be included in
|
||
* all copies or substantial portions of the Software.
|
||
*
|
||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||
* IN THE SOFTWARE.
|
||
*/
|
||
|
||
/* ----------------------------------------------------------------------------
|
||
* Class
|
||
* ------------------------------------------------------------------------- */
|
||
|
||
var GitHub = function (_Abstract) {
|
||
_inherits(GitHub, _Abstract);
|
||
|
||
/**
|
||
* Retrieve repository information from GitHub
|
||
*
|
||
* @constructor
|
||
*
|
||
* @property {string} name_ - Name of the repository
|
||
*
|
||
* @param {(string|HTMLAnchorElement)} el - Selector or HTML element
|
||
*/
|
||
function GitHub(el) {
|
||
_classCallCheck(this, GitHub);
|
||
|
||
/* Extract user (and repository name) from URL, as we have to query for all
|
||
repositories, to omit 404 errors for private repositories */
|
||
var _this = _possibleConstructorReturn(this, _Abstract.call(this, el));
|
||
|
||
var matches = /^.+github\.com\/([^/]+)\/?([^/]+)?.*$/.exec(_this.base_);
|
||
if (matches && matches.length === 3) {
|
||
var user = matches[1],
|
||
name = matches[2];
|
||
|
||
/* Initialize base URL and repository name */
|
||
|
||
_this.base_ = "https://api.github.com/users/" + user + "/repos";
|
||
_this.name_ = name;
|
||
}
|
||
return _this;
|
||
}
|
||
|
||
/**
|
||
* Fetch relevant repository information from GitHub
|
||
*
|
||
* @return {Promise<Array<string>>} Promise returning an array of facts
|
||
*/
|
||
|
||
|
||
GitHub.prototype.fetch_ = function fetch_() {
|
||
var _this2 = this;
|
||
|
||
var paginate = function paginate() {
|
||
var page = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
||
|
||
return fetch(_this2.base_ + "?per_page=30&page=" + page).then(function (response) {
|
||
return response.json();
|
||
}).then(function (data) {
|
||
if (!(data instanceof Array)) throw new TypeError();
|
||
|
||
/* Display number of stars and forks, if repository is given */
|
||
if (_this2.name_) {
|
||
var repo = data.find(function (item) {
|
||
return item.name === _this2.name_;
|
||
});
|
||
if (!repo && data.length === 30) return paginate(page + 1);
|
||
|
||
/* If we found a repo, extract the facts */
|
||
return repo ? [_this2.format_(repo.stargazers_count) + " Stars", _this2.format_(repo.forks_count) + " Forks"] : [];
|
||
|
||
/* Display number of repositories, otherwise */
|
||
} else {
|
||
return [data.length + " Repositories"];
|
||
}
|
||
});
|
||
};
|
||
|
||
/* Paginate through repos */
|
||
return paginate();
|
||
};
|
||
|
||
return GitHub;
|
||
}(_Abstract3.default);
|
||
|
||
exports.default = GitHub;
|
||
|
||
/***/ }),
|
||
/* 42 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
|
||
exports.__esModule = true;
|
||
|
||
var _jsCookie = __webpack_require__(43);
|
||
|
||
var _jsCookie2 = _interopRequireDefault(_jsCookie);
|
||
|
||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||
|
||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } /*
|
||
* Copyright (c) 2016-2018 Martin Donath <martin.donath@squidfunk.com>
|
||
*
|
||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||
* of this software and associated documentation files (the "Software"), to
|
||
* deal in the Software without restriction, including without limitation the
|
||
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||
* sell copies of the Software, and to permit persons to whom the Software is
|
||
* furnished to do so, subject to the following conditions:
|
||
*
|
||
* The above copyright notice and this permission notice shall be included in
|
||
* all copies or substantial portions of the Software.
|
||
*
|
||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||
* IN THE SOFTWARE.
|
||
*/
|
||
|
||
/* ----------------------------------------------------------------------------
|
||
* Class
|
||
* ------------------------------------------------------------------------- */
|
||
|
||
var Abstract = function () {
|
||
|
||
/**
|
||
* Retrieve repository information
|
||
*
|
||
* @constructor
|
||
*
|
||
* @property {HTMLAnchorElement} el_ - Link to repository
|
||
* @property {string} base_ - API base URL
|
||
* @property {number} salt_ - Unique identifier
|
||
*
|
||
* @param {(string|HTMLAnchorElement)} el - Selector or HTML element
|
||
*/
|
||
function Abstract(el) {
|
||
_classCallCheck(this, Abstract);
|
||
|
||
var ref = typeof el === "string" ? document.querySelector(el) : el;
|
||
if (!(ref instanceof HTMLAnchorElement)) throw new ReferenceError();
|
||
this.el_ = ref;
|
||
|
||
/* Retrieve base URL */
|
||
this.base_ = this.el_.href;
|
||
this.salt_ = this.hash_(this.base_);
|
||
}
|
||
|
||
/**
|
||
* Retrieve data from Cookie or fetch from respective API
|
||
*
|
||
* @return {Promise<Array<string>>} Promise that returns an array of facts
|
||
*/
|
||
|
||
|
||
Abstract.prototype.fetch = function fetch() {
|
||
var _this = this;
|
||
|
||
return new Promise(function (resolve) {
|
||
var cached = _jsCookie2.default.getJSON(_this.salt_ + ".cache-source");
|
||
if (typeof cached !== "undefined") {
|
||
resolve(cached);
|
||
|
||
/* If the data is not cached in a cookie, invoke fetch and set
|
||
a cookie that automatically expires in 15 minutes */
|
||
} else {
|
||
_this.fetch_().then(function (data) {
|
||
_jsCookie2.default.set(_this.salt_ + ".cache-source", data, { expires: 1 / 96 });
|
||
resolve(data);
|
||
});
|
||
}
|
||
});
|
||
};
|
||
|
||
/**
|
||
* Abstract private function that fetches relevant repository information
|
||
*
|
||
* @abstract
|
||
*/
|
||
|
||
|
||
Abstract.prototype.fetch_ = function fetch_() {
|
||
throw new Error("fetch_(): Not implemented");
|
||
};
|
||
|
||
/**
|
||
* Format a number with suffix
|
||
*
|
||
* @param {number} number - Number to format
|
||
* @return {string} Formatted number
|
||
*/
|
||
|
||
|
||
Abstract.prototype.format_ = function format_(number) {
|
||
if (number > 10000) return (number / 1000).toFixed(0) + "k";else if (number > 1000) return (number / 1000).toFixed(1) + "k";
|
||
return "" + number;
|
||
};
|
||
|
||
/**
|
||
* Simple hash function
|
||
*
|
||
* Taken from http://stackoverflow.com/a/7616484/1065584
|
||
*
|
||
* @param {string} str - Input string
|
||
* @return {number} Hashed string
|
||
*/
|
||
|
||
|
||
Abstract.prototype.hash_ = function hash_(str) {
|
||
var hash = 0;
|
||
if (str.length === 0) return hash;
|
||
for (var i = 0, len = str.length; i < len; i++) {
|
||
hash = (hash << 5) - hash + str.charCodeAt(i);
|
||
hash |= 0; // Convert to 32bit integer
|
||
}
|
||
return hash;
|
||
};
|
||
|
||
return Abstract;
|
||
}();
|
||
|
||
exports.default = Abstract;
|
||
|
||
/***/ }),
|
||
/* 43 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
|
||
* JavaScript Cookie v2.2.0
|
||
* https://github.com/js-cookie/js-cookie
|
||
*
|
||
* Copyright 2006, 2015 Klaus Hartl & Fagner Brack
|
||
* Released under the MIT license
|
||
*/
|
||
;(function (factory) {
|
||
var registeredInModuleLoader = false;
|
||
if (true) {
|
||
!(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
|
||
__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
|
||
(__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) :
|
||
__WEBPACK_AMD_DEFINE_FACTORY__),
|
||
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
||
registeredInModuleLoader = true;
|
||
}
|
||
if (true) {
|
||
module.exports = factory();
|
||
registeredInModuleLoader = true;
|
||
}
|
||
if (!registeredInModuleLoader) {
|
||
var OldCookies = window.Cookies;
|
||
var api = window.Cookies = factory();
|
||
api.noConflict = function () {
|
||
window.Cookies = OldCookies;
|
||
return api;
|
||
};
|
||
}
|
||
}(function () {
|
||
function extend () {
|
||
var i = 0;
|
||
var result = {};
|
||
for (; i < arguments.length; i++) {
|
||
var attributes = arguments[ i ];
|
||
for (var key in attributes) {
|
||
result[key] = attributes[key];
|
||
}
|
||
}
|
||
return result;
|
||
}
|
||
|
||
function init (converter) {
|
||
function api (key, value, attributes) {
|
||
var result;
|
||
if (typeof document === 'undefined') {
|
||
return;
|
||
}
|
||
|
||
// Write
|
||
|
||
if (arguments.length > 1) {
|
||
attributes = extend({
|
||
path: '/'
|
||
}, api.defaults, attributes);
|
||
|
||
if (typeof attributes.expires === 'number') {
|
||
var expires = new Date();
|
||
expires.setMilliseconds(expires.getMilliseconds() + attributes.expires * 864e+5);
|
||
attributes.expires = expires;
|
||
}
|
||
|
||
// We're using "expires" because "max-age" is not supported by IE
|
||
attributes.expires = attributes.expires ? attributes.expires.toUTCString() : '';
|
||
|
||
try {
|
||
result = JSON.stringify(value);
|
||
if (/^[\{\[]/.test(result)) {
|
||
value = result;
|
||
}
|
||
} catch (e) {}
|
||
|
||
if (!converter.write) {
|
||
value = encodeURIComponent(String(value))
|
||
.replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g, decodeURIComponent);
|
||
} else {
|
||
value = converter.write(value, key);
|
||
}
|
||
|
||
key = encodeURIComponent(String(key));
|
||
key = key.replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent);
|
||
key = key.replace(/[\(\)]/g, escape);
|
||
|
||
var stringifiedAttributes = '';
|
||
|
||
for (var attributeName in attributes) {
|
||
if (!attributes[attributeName]) {
|
||
continue;
|
||
}
|
||
stringifiedAttributes += '; ' + attributeName;
|
||
if (attributes[attributeName] === true) {
|
||
continue;
|
||
}
|
||
stringifiedAttributes += '=' + attributes[attributeName];
|
||
}
|
||
return (document.cookie = key + '=' + value + stringifiedAttributes);
|
||
}
|
||
|
||
// Read
|
||
|
||
if (!key) {
|
||
result = {};
|
||
}
|
||
|
||
// To prevent the for loop in the first place assign an empty array
|
||
// in case there are no cookies at all. Also prevents odd result when
|
||
// calling "get()"
|
||
var cookies = document.cookie ? document.cookie.split('; ') : [];
|
||
var rdecode = /(%[0-9A-Z]{2})+/g;
|
||
var i = 0;
|
||
|
||
for (; i < cookies.length; i++) {
|
||
var parts = cookies[i].split('=');
|
||
var cookie = parts.slice(1).join('=');
|
||
|
||
if (!this.json && cookie.charAt(0) === '"') {
|
||
cookie = cookie.slice(1, -1);
|
||
}
|
||
|
||
try {
|
||
var name = parts[0].replace(rdecode, decodeURIComponent);
|
||
cookie = converter.read ?
|
||
converter.read(cookie, name) : converter(cookie, name) ||
|
||
cookie.replace(rdecode, decodeURIComponent);
|
||
|
||
if (this.json) {
|
||
try {
|
||
cookie = JSON.parse(cookie);
|
||
} catch (e) {}
|
||
}
|
||
|
||
if (key === name) {
|
||
result = cookie;
|
||
break;
|
||
}
|
||
|
||
if (!key) {
|
||
result[name] = cookie;
|
||
}
|
||
} catch (e) {}
|
||
}
|
||
|
||
return result;
|
||
}
|
||
|
||
api.set = api;
|
||
api.get = function (key) {
|
||
return api.call(api, key);
|
||
};
|
||
api.getJSON = function () {
|
||
return api.apply({
|
||
json: true
|
||
}, [].slice.call(arguments));
|
||
};
|
||
api.defaults = {};
|
||
|
||
api.remove = function (key, attributes) {
|
||
api(key, '', extend(attributes, {
|
||
expires: -1
|
||
}));
|
||
};
|
||
|
||
api.withConverter = init;
|
||
|
||
return api;
|
||
}
|
||
|
||
return init(function () {});
|
||
}));
|
||
|
||
|
||
/***/ }),
|
||
/* 44 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
/* WEBPACK VAR INJECTION */(function(JSX) {
|
||
|
||
exports.__esModule = true;
|
||
|
||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||
|
||
/*
|
||
* Copyright (c) 2016-2018 Martin Donath <martin.donath@squidfunk.com>
|
||
*
|
||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||
* of this software and associated documentation files (the "Software"), to
|
||
* deal in the Software without restriction, including without limitation the
|
||
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||
* sell copies of the Software, and to permit persons to whom the Software is
|
||
* furnished to do so, subject to the following conditions:
|
||
*
|
||
* The above copyright notice and this permission notice shall be included in
|
||
* all copies or substantial portions of the Software.
|
||
*
|
||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||
* IN THE SOFTWARE.
|
||
*/
|
||
|
||
/* ----------------------------------------------------------------------------
|
||
* Class
|
||
* ------------------------------------------------------------------------- */
|
||
|
||
var Repository = function () {
|
||
|
||
/**
|
||
* Render repository information
|
||
*
|
||
* @constructor
|
||
*
|
||
* @property {HTMLElement} el_ - Repository information
|
||
*
|
||
* @param {(string|HTMLElement)} el - Selector or HTML element
|
||
*/
|
||
function Repository(el) {
|
||
_classCallCheck(this, Repository);
|
||
|
||
var ref = typeof el === "string" ? document.querySelector(el) : el;
|
||
if (!(ref instanceof HTMLElement)) throw new ReferenceError();
|
||
this.el_ = ref;
|
||
}
|
||
|
||
/**
|
||
* Initialize the repository
|
||
*
|
||
* @param {Array<string>} facts - Facts to be rendered
|
||
*/
|
||
|
||
|
||
Repository.prototype.initialize = function initialize(facts) {
|
||
if (facts.length && this.el_.children.length) this.el_.children[this.el_.children.length - 1].appendChild(JSX.createElement(
|
||
"ul",
|
||
{ "class": "md-source__facts" },
|
||
facts.map(function (fact) {
|
||
return JSX.createElement(
|
||
"li",
|
||
{ "class": "md-source__fact" },
|
||
fact
|
||
);
|
||
})
|
||
));
|
||
|
||
/* Finish rendering with animation */
|
||
this.el_.dataset.mdState = "done";
|
||
};
|
||
|
||
return Repository;
|
||
}();
|
||
|
||
exports.default = Repository;
|
||
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0)))
|
||
|
||
/***/ }),
|
||
/* 45 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
|
||
exports.__esModule = true;
|
||
|
||
var _Toggle = __webpack_require__(46);
|
||
|
||
var _Toggle2 = _interopRequireDefault(_Toggle);
|
||
|
||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||
|
||
/* ----------------------------------------------------------------------------
|
||
* Module
|
||
* ------------------------------------------------------------------------- */
|
||
|
||
exports.default = {
|
||
Toggle: _Toggle2.default
|
||
}; /*
|
||
* Copyright (c) 2016-2018 Martin Donath <martin.donath@squidfunk.com>
|
||
*
|
||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||
* of this software and associated documentation files (the "Software"), to
|
||
* deal in the Software without restriction, including without limitation the
|
||
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||
* sell copies of the Software, and to permit persons to whom the Software is
|
||
* furnished to do so, subject to the following conditions:
|
||
*
|
||
* The above copyright notice and this permission notice shall be included in
|
||
* all copies or substantial portions of the Software.
|
||
*
|
||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||
* IN THE SOFTWARE.
|
||
*/
|
||
|
||
/***/ }),
|
||
/* 46 */
|
||
/***/ (function(module, exports, __webpack_require__) {
|
||
|
||
"use strict";
|
||
|
||
|
||
exports.__esModule = true;
|
||
|
||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||
|
||
/*
|
||
* Copyright (c) 2016-2018 Martin Donath <martin.donath@squidfunk.com>
|
||
*
|
||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||
* of this software and associated documentation files (the "Software"), to
|
||
* deal in the Software without restriction, including without limitation the
|
||
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||
* sell copies of the Software, and to permit persons to whom the Software is
|
||
* furnished to do so, subject to the following conditions:
|
||
*
|
||
* The above copyright notice and this permission notice shall be included in
|
||
* all copies or substantial portions of the Software.
|
||
*
|
||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||
* IN THE SOFTWARE.
|
||
*/
|
||
|
||
/* ----------------------------------------------------------------------------
|
||
* Class
|
||
* ------------------------------------------------------------------------- */
|
||
|
||
var Toggle = function () {
|
||
|
||
/**
|
||
* Toggle tabs visibility depending on page y-offset
|
||
*
|
||
* @constructor
|
||
*
|
||
* @property {HTMLElement} el_ - Content container
|
||
* @property {number} offset_ - Toggle page-y offset
|
||
* @property {boolean} active_ - Tabs visibility
|
||
*
|
||
* @param {(string|HTMLElement)} el - Selector or HTML element
|
||
*/
|
||
function Toggle(el) {
|
||
_classCallCheck(this, Toggle);
|
||
|
||
var ref = typeof el === "string" ? document.querySelector(el) : el;
|
||
if (!(ref instanceof Node)) throw new ReferenceError();
|
||
this.el_ = ref;
|
||
|
||
/* Initialize offset and state */
|
||
this.active_ = false;
|
||
}
|
||
|
||
/**
|
||
* Update visibility
|
||
*/
|
||
|
||
|
||
Toggle.prototype.update = function update() {
|
||
var active = window.pageYOffset >= this.el_.children[0].offsetTop + (5 - 48); // TODO: quick hack to enable same handling for hero
|
||
if (active !== this.active_) this.el_.dataset.mdState = (this.active_ = active) ? "hidden" : "";
|
||
};
|
||
|
||
/**
|
||
* Reset visibility
|
||
*/
|
||
|
||
|
||
Toggle.prototype.reset = function reset() {
|
||
this.el_.dataset.mdState = "";
|
||
this.active_ = false;
|
||
};
|
||
|
||
return Toggle;
|
||
}();
|
||
|
||
exports.default = Toggle;
|
||
|
||
/***/ })
|
||
/******/ ])));
|
||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vd2VicGFjay9ib290c3RyYXAgYTNkZDgwN2QiLCJ3ZWJwYW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4gICAgICAgIGlmIChjdXJyZW50bHlSdW5uaW5nQVRhc2spIHtcbiAgICAgICAgICAgIC8vIERlbGF5IGJ5IGRvaW5nIGEgc2V0VGltZW91dC4gc2V0SW1tZWRpYXRlIHdhcyB0cmllZCBpbnN0ZWFkLCBidXQgaW4gRmlyZWZveCA3IGl0IGdlbmVyYXRlZCBhXG4gICAgICAgICAgICAvLyBcInRvbyBtdWNoIHJlY3Vyc2lvblwiIGVycm9yLlxuICAgICAgICAgICAgc2V0VGltZW91dChydW5JZlByZXNlbnQsIDAsIGhhbmRsZSk7XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICB2YXIgdGFzayA9IHRhc2tzQnlIYW5kbGVbaGFuZGxlXTtcbiAgICAgICAgICAgIGlmICh0YXNrKSB7XG4gICAgICAgICAgICAgICAgY3VycmVudGx5UnVubmluZ0FUYXNrID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICB0cnkge1xuICAgICAgICAgICAgICAgICAgICBydW4odGFzayk7XG4gICAgICAgICAgICAgICAgfSBmaW5hbGx5IHtcbiAgICAgICAgICAgICAgICAgICAgY2xlYXJJbW1lZGlhdGUoaGFuZGxlKTtcbiAgICAgICAgICAgICAgICAgICAgY3VycmVudGx5UnVubmluZ0FUYXNrID0gZmFsc2U7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgfVxuXG4gICAgZnVuY3Rpb24gaW5zdGFsbE5leHRUaWNrSW1wbGVtZW50YXRpb24oKSB7XG4gICAgICAgIHJlZ2lzdGVySW1tZWRpYXRlID0gZnVuY3Rpb24oaGFuZGxlKSB7XG4gICAgICAgICAgICBwcm9jZXNzLm5leHRUaWNrKGZ1bmN0aW9uICgpIHsgcnVuSWZQcmVzZW50KGhhbmRsZSk7IH0pO1xuICAgICAgICB9O1xuICAgIH1cblxuICAgIGZ1bmN0aW9uIGNhblVzZVBvc3RNZXNzYWdlKCkge1xuICAgICAgICAvLyBUaGUgdGVz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uXG4gICAgICAgICAgICB0aGlzLnJlc29sdmVPcHRpb25zKG9wdGlvbnMpO1xuICAgICAgICAgICAgdGhpcy5pbml0U2VsZWN0aW9uKCk7XG4gICAgICAgIH1cblxuICAgICAgICAvKipcbiAgICAgICAgICogRGVmaW5lcyBiYXNlIHByb3BlcnRpZXMgcGFzc2VkIGZyb20gY29uc3RydWN0b3IuXG4gICAgICAgICAqIEBwYXJhbSB7T2JqZWN0fSBvcHRpb25zXG4gICAgICAgICAqL1xuXG5cbiAgICAgICAgX2NyZWF0ZUNsYXNzKENsaXBib2FyZEFjdGlvbiwgW3tcbiAgICAgICAgICAgIGtleTogJ3Jlc29sdmVPcHRpb25zJyxcbiAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiByZXNvbHZlT3B0aW9ucygpIHtcbiAgICAgICAgICAgICAgICB2YXIgb3B0aW9ucyA9IGFyZ3VtZW50cy5sZW5ndGggPiAwICYmIGFyZ3VtZW50c1swXSAhPT0gdW5kZWZpbmVkID8gYXJndW1lbnRzWzBdIDoge307XG5cbiAgICAgICAgICAgICAgICB0aGlzLmFjdGlvbiA9IG9wdGlvbnMuYWN0aW9uO1xuICAgICAgICAgICAgICAgIHRoaXMuY29udGFpbmVyID0gb3B0aW9ucy5jb250YWluZXI7XG4gICAgICAgICAgICAgICAgdGhpcy5lbWl0dGVyID0gb3B0aW9ucy5lbWl0dGVyO1xuICAgICAgICAgICAgICAgIHRoaXMudGFyZ2V0ID0gb3B0aW9ucy50YXJnZXQ7XG4gICAgICAgICAgICAgICAgdGhpcy50ZXh0ID0gb3B0aW9ucy50ZXh0O1xuICAgICAgICAgICAgICAgIHRoaXMudHJpZ2dlciA9IG9wdGlvbnMudHJpZ2dlcjtcblxuICAgICAgICAgICAgICAgIHRoaXMuc2VsZWN0ZWRUZXh0ID0gJyc7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0sIHtcbiAgICAgICAgICAgIGtleTogJ2luaXRTZWxlY3Rpb24nLFxuICAgICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uIGluaXRTZWxlY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgaWYgKHRoaXMudGV4dCkge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLnNlbGVjdEZha2UoKTtcbiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKHRoaXMudGFyZ2V0KSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuc2VsZWN0VGFyZ2V0KCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9LCB7XG4gICAgICAgICAgICBrZXk6ICdzZWxlY3RGYWtlJyxcbiAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiBzZWxlY3RGYWtlKCkge1xuICAgICAgICAgICAgICAgIHZhciBfdGhpcyA9IHRoaXM7XG5cbiAgICAgICAgICAgICAgICB2YXIgaXNSVEwgPSBkb2N1bWVudC5kb2N1bWVudEVsZW1lbnQuZ2V0QXR0cmlidXRlKCdkaXInKSA9PSAncnRsJztcblxuICAgICAgICAgICAgICAgIHRoaXMucmVtb3ZlRmFrZSgpO1xuXG4gICAgICAgICAgICAgICAgdGhpcy5mYWtlSGFuZGxlckNhbGxiYWNrID0gZnVuY3Rpb24gKCkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gX3RoaXMucmVtb3ZlRmFrZSgpO1xuICAgICAgICAgICAgICAgIH07XG4gICAgICAgICAgICAgICAgdGhpcy5mYWtlSGFuZGxlciA9IHRoaXMuY29udGFpbmVyLmFkZEV2ZW50TGlzdGVuZXIoJ2NsaWNrJywgdGhpcy5mYWtlSGFuZGxlckNhbGxiYWNrKSB8fCB0cnVlO1xuXG4gICAgICAgICAgICAgICAgdGhpcy5mYWtlRWxlbSA9IGRvY3VtZW50LmNyZWF0ZUVsZW1lbnQoJ3RleHRhcmVhJyk7XG4gICAgICAgICAgICAgICAgLy8gUHJldmVudCB6b29taW5nIG9uIGlPU1xuICAgICAgICAgICAgICAgIHRoaXMuZmFrZUVsZW0uc3R5bGUuZm9udFNpemUgPSAnMTJwdCc7XG4gICAgICAgICAgICAgICAgLy8gUmVzZXQgYm94IG1vZGVsXG4gICAgICAgICAgICAgICAgdGhpcy5mYWtlRWxlbS5zdHlsZS5ib3JkZXIgPSAnMCc7XG4gICAgICAgICAgICAgICAgdGhpcy5mYWtlRWxlbS5zdHlsZS5wYWRkaW5nID0gJzAnO1xuICAgICAgICAgICAgICAgIHRoaXMuZmFrZUVsZW0uc3R5bGUubWFyZ2luID0gJzAnO1xuICAgICAgICAgICAgICAgIC8vIE1vdmUgZWxlbWVudCBvdXQgb2Ygc2NyZWVuIGhvcml6b250YWxseVxuICAgICAgICAgICAgICAgIHRoaXMuZmFrZUVsZW0uc3R5bGUucG9zaXRpb24gPSAnYWJzb2x1dGUnO1xuICAgICAgICAgICAgICAgIHRoaXMuZmFrZUVsZW0uc3R5bGVbaXNSVEwgPyAncmlnaHQnIDogJ2xlZnQnXSA9ICctOTk5OXB4JztcbiAgICAgICAgICAgICAgICAvLyBNb3ZlIGVsZW1lbnQgdG8gdGhlIHNhbWUgcG9zaXRpb24gdmVydGljYWxseVxuICAgICAgICAgICAgICAgIHZhciB5UG9zaXRpb24gPSB3aW5kb3cucGFnZVlPZmZzZXQgfHwgZG9jdW1lbnQuZG9jdW1lbnRFbGVtZW50LnNjcm9sbFRvcDtcbiAgICAgICAgICAgICAgICB0aGlzLmZha2VFbGVtLnN0eWxlLnRvcCA9IHlQb3NpdGlvbiArICdweCc7XG5cbiAgICAgICAgICAgICAgICB0aGlzLmZha2VFbGVtLnNldEF0dHJpYnV0ZSgncmVhZG9ubHknLCAnJyk7XG4gICAgICAgICAgICAgICAgdGhpcy5mYWtlRWxlbS52YWx1ZSA9IHRoaXMudGV4dDtcblxuICAgICAgICAgICAgICAgIHRoaXMuY29udGFpbmVyLmFwcGVuZENoaWxkKHRoaXMuZmFrZUVsZW0pO1xuXG4gICAgICAgICAgICAgICAgdGhpcy5zZWxlY3RlZFRleHQgPSAoMCwgX3NlbGVjdDIuZGVmYXVsdCkodGhpcy5mYWtlRWxlbSk7XG4gICAgICAgICAgICAgICAgdGhpcy5jb3B5VGV4dCgpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9LCB7XG4gICAgICAgICAgICBrZXk6ICdyZW1vdmVGYWtlJyxcbiAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiByZW1vdmVGYWtlKCkge1xuICAgICAgICAgICAgICAgIGlmICh0aGlzLmZha2VIYW5kbGVyKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuY29udGFpbmVyLnJlbW92ZUV2ZW50TGlzdGVuZXIoJ2NsaWNrJywgdGhpcy5mYWtlSGFuZGxlckNhbGxiYWNrKTtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5mYWtlSGFuZGxlciA9IG51bGw7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuZmFrZUhhbmRsZXJDYWxsYmFjayA9IG51bGw7XG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgaWYgKHRoaXMuZmFrZUVsZW0pIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5jb250YWluZXIucmVtb3ZlQ2hpbGQodGhpcy5mYWtlRWxlbSk7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuZmFrZUVsZW0gPSBudWxsO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfSwge1xuICAgICAgICAgICAga2V5OiAnc2VsZWN0VGFyZ2V0JyxcbiAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiBzZWxlY3RUYXJnZXQoKSB7XG4gICAgICAgICAgICAgICAgdGhpcy5zZWxlY3RlZFRleHQgPSAoMCwgX3NlbGVjdDIuZGVmYXVsdCkodGhpcy50YXJnZXQpO1xuICAgICAgICAgICAgICAgIHRoaXMuY29weVRleHQoKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSwge1xuICAgICAgICAgICAga2V5OiAnY29weVRleHQnLFxuICAgICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uIGNvcHlUZXh0KCkge1xuICAgICAgICAgICAgICAgIHZhciBzdWNjZWVkZWQgPSB2b2lkIDA7XG5cbiAgICAgICAgICAgICAgICB0cnkge1xuICAgICAgICAgICAgICAgICAgICBzdWNjZWVkZWQgPSBkb2N1bWVudC5leGVjQ29tbWFuZCh0aGlzLmFjdGlvbik7XG4gICAgICAgICAgICAgICAgfSBjYXRjaCAoZXJyKSB7XG4gICAgICAgICAgICAgICAgICAgIHN1Y2NlZWRlZCA9IGZhbHNlO1xuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIHRoaXMuaGFuZGxlUmVzdWx0KHN1Y2NlZWRlZCk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0sIHtcbiAgICAgICAgICAgIGtleTogJ2hhbmRsZVJlc3VsdCcsXG4gICAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gaGFuZGxlUmVzdWx0KHN1Y2NlZWRlZCkge1xuICAgICAgICAgICAgICAgIHRoaXMuZW1pdHRlci5lbWl0KHN1Y2NlZWRlZCA/ICdzdWNjZXNzJyA6ICdlcnJvcicsIHtcbiAgICAgICAgICAgICAgICAgICAgYWN0aW9uOiB0aGlzLmFjdGlvbixcbiAgICAgICAgICAgICAgICAgICAgdGV4dDogdGhpcy5zZWxlY3RlZFRleHQsXG4gICAgICAgICAgICAgICAgICAgIHRyaWdnZXI6IHRoaXMudHJpZ2dlcixcbiAgICAgICAgICAgICAgICAgICAgY2xlYXJTZWxlY3Rpb246IHRoaXMuY2xlYXJTZWxlY3Rpb24uYmluZCh0aGlzKVxuICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgfVxuICAgICAgICB9LCB7XG4gICAgICAgICAgICBrZXk6ICdjbGVhclNlbGVjdGlvbicsXG4gICAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gY2xlYXJTZWxlY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgaWYgKHRoaXMudHJpZ2dlcikge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLnRyaWdnZXIuZm9jdXMoKTtcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICB3aW5kb3cuZ2V0U2VsZWN0aW9uKCkucmVtb3ZlQWxsUmFuZ2VzKCk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0sIHtcbiAgICAgICAgICAgIGtleTogJ2Rlc3Ryb3knLFxuICAgICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uIGRlc3Ryb3koKSB7XG4gICAgICAgICAgICAgICAgdGhpcy5yZW1vdmVGYWtlKCk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0sIHtcbiAgICAgICAgICAgIGtleTogJ2FjdGlvbicsXG4gICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uIHNldCgpIHtcbiAgICAgICAgICAgICAgICB2YXIgYWN0aW9uID0gYXJndW1lbnRzLmxlbmd0aCA+IDAgJiYgYXJndW1lbnRzWzBdICE9PSB1bmRlZmluZWQgPyBhcmd1bWVudHNbMF0gOiAnY29weSc7XG5cbiAgICAgICAgICAgICAgICB0aGlzLl9hY3Rpb24gPSBhY3Rpb247XG5cbiAgICAgICAgICAgICAgICBpZiAodGhpcy5fYWN0aW9uICE9PSAnY29weScgJiYgdGhpcy5fYWN0aW9uICE9PSAnY3V0Jykge1xuICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoJ0ludmFsaWQgXCJhY3Rpb25cIiB2YWx1ZSwgdXNlIGVpdGhlciBcImNvcHlcIiBvciBcImN1dFwiJyk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIGdldDogZnVuY3Rpb24gZ2V0KCkge1xuICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLl9hY3Rpb247XG4gICAgICAgICAgICB9XG4gICAgICAgIH0sIHtcbiAgICAgICAgICAgIGtleTogJ3RhcmdldCc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MuY29udGFpbmVyIDogZG9jdW1lbnQuYm9keTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSwge1xuICAgICAgICAgICAga2V5OiAnbGlzdGVuQ2xpY2snLFxuICAgICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uIGxpc3RlbkNsaWNrKHRyaWdnZXIpIHtcbiAgICAgICAgICAgICAgICB2YXIgX3RoaXMyID0gdGhpcztcblxuICAgICAgICAgICAgICAgIHRoaXMubGlzdGVuZXIgPSAoMCwgX2dvb2RMaXN0ZW5lcjIuZGVmYXVsdCkodHJpZ2dlciwgJ2NsaWNrJywgZnVuY3Rpb24gKGUpIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIF90aGlzMi5vbkNsaWNrKGUpO1xuICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgfVxuICAgICAgICB9LCB7XG4gICAgICAgICAgICBrZXk6ICdvbkNsaWNrJyxcbiAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiBvbkNsaWNrKGUpIHtcbiAgICAgICAgICAgICAgICB2YXIgdHJpZ2dlciA9IGUuZGVsZWdhdGVUYXJnZXQgfHwgZS5jdXJyZW50VGFyZ2V0O1xuXG4gICAgICAgICAgICAgICAgaWYgKHRoaXMuY2xpcGJvYXJkQWN0aW9uKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuY2xpcGJvYXJkQWN0aW9uID0gbnVsbDtcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICB0aGlzLmNsaXBib2FyZEFjdGlvbiA9IG5ldyBfY2xpcGJvYXJkQWN0aW9uMi5kZWZhdWx0KHtcbiAgICAgICAgICAgICAgICAgICAgYWN0aW9uOiB0aGlzLmFjdGlvbih0cmlnZ2VyKSxcbiAgICAgICAgICAgICAgICAgICAgdGFyZ2V0OiB0aGlzLnRhcmdldCh0cmlnZ2VyKSxcbiAgICAgICAgICAgICAgICAgICAgdGV4dDogdGhpcy50ZXh0KHRyaWdnZXIpLFxuICAgICAgICAgICAgICAgICAgICBjb250YWluZXI6IHRoaXMuY29udGFpbmVyLFxuICAgICAgICAgICAgICAgICAgICB0cmlnZ2VyOiB0cmlnZ2VyLFxuICAgICAgICAgICAgICAgICAgICBlbWl0dGVyOiB0aGlzXG4gICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0sIHtcbiAgICAgICAgICAgIGtleTogJ2RlZmF1bHRBY3Rpb24nLFxuICAgICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uIGRlZmF1bHRBY3Rpb24odHJpZ2dlcikge1xuICAgICAgICAgICAgICAgIHJldHVybiBnZXRBdHRyaWJ1dGVWYWx1ZSgnYWN0aW9uJywgdHJpZ2dlcik7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0sIHtcbiAgICAgICAgICAgIGtleTogJ2RlZmF1bHRUYXJnZXQnLFxuICAgICAgICAgICAgdmFsdWU6IGZ1bmN0aW9uIGRlZmF1bHRUYXJnZXQodHJpZ2dlcikge1xuICAgICAgICAgICAgICAgIHZhciBzZWxlY3RvciA9IGdldEF0dHJpYnV0ZVZhbHVlKCd0YXJnZXQnLCB0cmlnZ2VyKTtcblxuICAgICAgICAgICAgICAgIGlmIChzZWxlY3Rvcikge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gZG9jdW1lbnQucXVlcnlTZWxlY3RvcihzZWxlY3Rvcik7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9LCB7XG4gICAgICAgICAgICBrZXk6ICdkZWZhdWx0VGV4dCcsXG4gICAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gZGVmYXVsdFRleHQodHJpZ2dlcikge1xuICAgICAgICAgICAgICAgIHJldHVybiBnZXRBdHRyaWJ1dGVWYWx1ZSgndGV4dCcsIHRyaWdnZXIpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9LCB7XG4gICAgICAgICAgICBrZXk6ICdkZXN0cm95JyxcbiAgICAgICAgICAgIHZhbHVlOiBmdW5jdGlvbiBkZXN0cm95KCkge1xuICAgICAgICAgICAgICAgIHRoaXMubGlzdGVuZXIuZGVzdHJveSgpO1xuXG4gICAgICAgICAgICAgICAgaWYgKHRoaXMuY2xpcGJvYXJkQWN0aW9uKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuY2xpcGJvYXJkQWN0aW9uLmRlc3Ryb3koKTtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5jbGlwYm9hcmRBY3Rpb24gPSBudWxsO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfV0sIFt7XG4gICAgICAgICAgICBrZXk6ICdpc1N1cHBvcnRlZCcsXG4gICAgICAgICAgICB2YWx1ZTogZnVuY3Rpb24gaXNTdXBwb3J0ZWQoKSB7XG4gICAgICAgICAgICAgICAgdmFyIGFjdGlvbiA9IGFyZ3VtZW50cy5sZW5ndGggPiAwICYmIGFyZ3VtZW50c1swXSAhPT0gdW5kZWZpbmVkID8gYXJndW1lbnRzWzBdIDogWydjb3B5JywgJ2N1dCddO1xuXG4gICAgICAgICAgICAgICAgdmFyIGFjdGlvbnMgPSB0eXBlb2YgYWN0aW9uID09PSAnc3RyaW5nJyA/IFthY3Rpb25dIDogYWN0aW9uO1xuICAgICAgICAgICAgICAgIHZhciBzdXBwb3J0ID0gISFkb2N1bWVudC5xdWVyeUNvbW1hbmRTdXBwb3J0ZWQ7XG5cbiAgICAgICAgICAgICAgICBhY3Rpb25zLmZvckVhY2goZnVuY3Rpb24gKGFjdGlvbikge1xuICAgICAgICAgICAgICAgICAgICBzdXBwb3J0ID0gc3VwcG9ydCAmJiAhIWRvY3VtZW50LnF1ZXJ5Q29tbWFuZFN1cHBvcnRlZChhY3Rpb24pO1xuICAgICAgICAgICAgICAgIH0pO1xuXG4gICAgICAgICAgICAgICAgcmV0dXJuIHN1cHBvcnQ7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1dKTtcblxuICAg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4gICAgICAgICAgICAgIGRvYy5wYXJlbnQudGV4dCAgPSBkb2MudGV4dFxuICAgICAgICAgICAgICBkb2MucGFyZW50LmRvbmUgID0gdHJ1ZVxuICAgICAgICAgICAgfVxuICAgICAgICAgIH1cblxuICAgICAgICAgIC8qIFNvbWUgY2xlYW51cCBvbiB0aGUgdGV4dCAqL1xuICAgICAgICAgIGRvYy50ZXh0ID0gZG9jLnRleHRcbiAgICAgICAgICAgIC5yZXBsYWNlKC9cXG4vZywgXCIgXCIpICAgICAgICAgICAgICAgLyogUmVtb3ZlIG5ld2xpbmVzICovXG4gICAgICAgICAgICAucmVwbGFjZSgvXFxzKy9nLCBcIiBcIikgICAgICAgICAgICAgIC8qIENvbXBhY3Qgd2hpdGVzcGFjZSAqL1xuICAgICAgICAgICAgLnJlcGxhY2UoL1xccysoWywuOjshP10pL2csICAgICAgICAgLyogQ29ycmVjdCBwdW5jdHVhdGlvbiAqL1xuICAgICAgICAgICAgICAoXywgY2hhcikgPT4gY2hhcilcblxuICAgICAgICAgIC8qIEluZGV4IHNlY3Rpb25zIGFuZCBkb2N1bWVudHMsIGJ1dCBza2lwIHRvcC1sZXZlbCBoZWFkbGluZSAqL1xuICAgICAgICAgIGlmICghZG9jLnBhcmVudCB8fCBkb2MucGFyZW50LnRpdGxlICE9PSBkb2MudGl0bGUpXG4gICAgICAgICAgICBkb2NzLnNldChkb2MubG9jYXRpb24sIGRvYylcbiAgICAgICAgICByZXR1cm4gZG9jc1xuICAgICAgICB9LCBuZXcgTWFwKVxuXG4gICAgICAgIC8qIGVzbGludC1kaXNhYmxlIG5vLWludmFsaWQtdGhpcyAqL1xuICAgICAgICBjb25zdCBkb2NzID0gdGhpcy5kb2NzXyxcbiAgICAgICAgICAgICAgbGFuZyA9IHRoaXMubGFuZ19cblxuICAgICAgICAvKiBDcmVhdGUgc3RhY2sgYW5kIGluZGV4ICovXG4gICAgICAgIHRoaXMuc3RhY2tfID0gW11cbiAgICAgICAgdGhpcy5pbmRleF8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EpIHtcbiAgICAgICAgICAgIHRoaXMudXNlKGx1bnIubXVsdGlMYW5ndWFnZSguLi5sYW5nKSlcbiAgICAgICAgICB9XG5cbiAgICAgICAgICAvKiBJbmRleCBmaWVsZHMgKi9cbiAgICAgICAgICB0aGlzLmZpZWxkKFwidGl0bGVcIiwgeyBib29zdDogMTAgfSlcbiAgICAgICAgICB0aGlzLmZpZWxkKFwidGV4dFwiKVxuICAgICAgICAgIHRoaXMucmVmKFwibG9jYXRpb25cIilcblxuICAgICAgICAgIC8qIEluZGV4IGRvY3VtZW50cyAqL1xuICAgICAgICAgIGRvY3MuZm9yRWFjaChkb2MgPT4gdGhpcy5hZGQoZG9jKSlcbiAgICAgICAgfSlcblxuICAgICAgICAvKiBSZWdpc3RlciBldmVudCBoYW5kbGVyIGZvciBsYXp5IHJlbmRlcmluZyAqL1xuICAgICAgICBjb25zdCBjb250YWluZXIgPSB0aGlzLmVsXy5wYXJlbnROb2RlXG4gICAgICAgIGlmICghKGNvbnRhaW5lciBpbnN0YW5jZW9mIEhUTUxFbGVtZW50KSlcbiAgICAgICAgICB0aHJvdyBuZXcgUmVmZXJlbmNlRXJyb3JcbiAgICAgICAgY29udGFpbmVyLmFkZEV2ZW50TGlzdGVuZXIoXCJzY3JvbGxcIiwgKCkgPT4ge1xuICAgICAgICAgIHdoaWxlICh0aGlzLnN0YWNrXy5sZW5ndGggJiYgY29udGFpbmVyLnNjcm9sbFRvcCArXG4gICAgICAgICAgICAgIGNvbnRhaW5lci5vZmZzZXRIZWlnaHQgPj0gY29udGFpbmVyLnNjcm9sbEhlaWdodCAtIDE2KVxuICAgICAgICAgICAgdGhpcy5zdGFja18uc3BsaWNlKDAsIDEwKS5mb3JFYWNoKHJlbmRlciA9PiByZW5kZXIoKSlcbiAgICAgICAgfSlcbiAgICAgIH1cbiAgICAgIC8qIGVzbGludC1lbmFibGUgbm8taW52YWxpZC10aGlzICovXG5cbiAgICAgIC8qIEluaXRpYWxpemUgaW5kZXggYWZ0Z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1xuICAgICAgICB0aGlzLm1ldGFfLnRleHRDb250ZW50ID0gdGhpcy5tZXNzYWdlXy5wbGFjZWhvbGRlclxuICAgICAgICByZXR1cm5cbiAgICAgIH1cblxuICAgICAgLyogUGVyZm9ybSBzZWFyY2ggb24gaW5kZXggYW5kIGdyb3VwIHNlY3Rpb25zIGJ5IGRvY3VtZW50ICovXG4gICAgICBjb25zdCByZXN1bHQgPSB0aGlzLmluZGV4X1xuXG4gICAgICAgIC8qIEFwcGVuZCB0cmFpbGluZyB3aWxkY2FyZCB0byBhbGwgdGVybXMgZm9yIHByZWZpeCBxdWVyeWluZyAqL1xuICAgICAgICAucXVlcnkocXVlcnkgPT4ge1xuICAgICAgICAgIHRoaXMudmFsdWVfLnRvTG93ZXJDYXNlKCkuc3BsaXQoXCIgXCIpXG4gICAgICAgICAgICAuZmlsdGVyKEJvb2xlYW4pXG4gICAgICAgICAgICAuZm9yRWFjaCh0ZXJtID0+IHtcbiAgICAgICAgICAgICAgcXVlcnkudGVybSh0ZXJtLCB7IHdpbGRjYXJkOiBsdW5yLlF1ZXJ5LndpbGRjYXJkLlRSQUlMSU5HIH0pXG4gICAgICAgICAgICB9KVxuICAgICAgICB9KVxuXG4gICAgICAgIC8qIFByb2Nlc3MgcXVlcnkgcmVzdWx0cyAqL1xuICAgICAgICAucmVkdWNlKChpdGVtcywgaXRlbSkgPT4ge1xuICAgICAgICAgIGNvbnN0IGRvYyA9IHRoaXMuZG9jc18uZ2V0KGl0ZW0ucmVmKVxuICAgICAgICAgIGlmIChkb2MucGFyZW50KSB7XG4gICAgICAgICAgICBjb25zdCByZWYgPSBkb2MucGFyZW50LmxvY2F0aW9uXG4gICAgICAgICAgICBpdGVtcy5zZXQocmVmLCAoaXRlbXMuZ2V0KHJlZikgfHwgW10pLmNvbmNhdChpdGVtKSlcbiAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgY29uc3QgcmVmID0gZG9jLmxvY2F0aW9uXG4gICAgICAgICAgICBpdGVt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ICAgICAgICAgICAgPGFydGljbGUgY2xhc3M9XCJtZC1zZWFyY2gtcmVzdWx0X19hcnRpY2xlXG4gICAgICAgICAgICAgICAgICAgIG1kLXNlYXJjaC1yZXN1bHRfX2FydGljbGUtLWRvY3VtZW50XCI+XG4gICAgICAgICAgICAgICAgPGgxIGNsYXNzPVwibWQtc2VhcmNoLXJlc3VsdF9fdGl0bGVcIj5cbiAgICAgICAgICAgICAgICAgIHt7IF9faHRtbDogZG9jLnRpdGxlLnJlcGxhY2UobWF0Y2gsIGhpZ2hsaWdodCkgfX1cbiAgICAgICAgICAgICAgICA8L2gxPlxuICAgICAgICAgICAgICAgIHtkb2MudGV4dC5sZW5ndGggP1xuICAgICAgICAgICAgICAgICAgPHAgY2xhc3M9XCJtZC1zZWFyY2gtcmVzdWx0X190ZWFzZXJcIj5cbiAgICAgICAgICAgICAgICAgICAge3sgX19odG1sOiBkb2MudGV4dC5yZXBsYWNlKG1hdGNoLCBoaWdobGlnaHQpIH19XG4gICAgICAgICAgICAgICAgICA8L3A+IDoge319XG4gICAgICAgICAgICAgIDwvYXJ0aWNsZT5cbiAgICAgICAgICAgIDwvYT5cbiAgICAgICAgICA8L2xpPlxuICAgICAgICApXG5cbiAgICAgICAgLyogUmVuZGVyIHNlY3Rpb25zIGZvciBhcnRpY2xlICovXG4gICAgICAgIGNvbnN0IHNlY3Rpb25zID0gaXRlbXMubWFwKGl0ZW0gPT4ge1xuICAgICAgICAgIHJldHVybiAoKSA9PiB7XG4gICAgICAgICAgICBjb25zdCBzZWN0aW9uID0gdGhpcy5kb2NzXy5nZXQoaXRlbS5yZWYpXG4gICAgICAgICAgICBhcnRpY2xlLmFwcGVuZENoaWxkKFxuICAgICAgICAgICAgICA8YSBocmVmPXtzZWN0aW9uLmxvY2F0aW9ufSB0aXRsZT17c2VjdGlvbi50aXRsZX1cbiAgICAgICAgICAgICAgICBjbGFzcz1cIm1kLXNlYXJjaC1yZXN1bHRfX2xpbmtcIiBkYXRhLW1kLXJlbD1cImFuY2hvclwiXG4gICAgICAgICAgICAgICAgdGFiaW5kZXg9XCItMVwiPlxuICAgICAgICAgICAgICAgIDxhcnRpY2xlIGNsYXNzPVwibWQtc2VhcmNoLXJlc3VsdF9fYXJ0aWNsZVwiPlxuICAgICAgICAgICAgICAgICAgPGgxIGNsYXNzPVwibWQtc2VhcmNoLXJlc3VsdF9fdGl0bGVcIj5cbiAgICAgICAgICAgICAgICAgICAge3sgX19odG1sOiBzZWN0aW9uLnRpdGxlLnJlcGxhY2UobWF0Y2gsIGhpZ2hsaWdodCkgfX1cbiAgICAgICAgICAgICAgICAgIDwvaDE+XG4gICAgICAgICAgICAgICAgICB7c2VjdGlvbi50ZXh0Lmxlbmd0aCA/XG4gICAgICAgICAgICAgICAgICAgIDxwIGNsYXNzPVwibWQtc2VhcmNoLXJlc3VsdF9fdGVhc2VyXCI+XG4gICAgICAgICAgICAgICAgICAgICAge3sgX19odG1sOiB0cnVuY2F0ZShcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlY3Rpb24udGV4dC5yZXBsYWNlKG1hdGNoLCBoaWdobGlnaHQpLCA0MDApXG4gICAgICAgICAgICAgICAgICAgICAgfX1cbiAgICAgICAgICAgICAgICAgICAgPC9wPiA6IHt9fVxuICAgICAgICAgICAgICAgIDwvYXJ0aWNsZT5cbiAgICAgICAgICAgICAgPC9hPlxuICAgICAgICAgICAgKVxuICAgICAgICAgIH1cbiAgICAgICAgfSlcblxuICAgICAgICAvKiBQdXNoIGFydGljbGVzIGFuZCBzZWN0aW9uIHJlbmRlcmVycyBvbnRvIHN0YWNrICovXG4gICAgICAgIHRoaXMuc3RhY2tfLnB1c2goKCkgPT4gdGhpcy5saXN0Xy5hcHBlbmRDaGlsZChhcnRpY2xlKSwgLi4uc2VjdGlvbnMpXG4gICAgICB9KVxuXG4gICAgICAvKiBHcmFkdWFsbHkgYWRkIHJlc3VsdHMgYXMgbG9uZyBhcyB0aGUgaGVpZ2h0IG9mIHRoZSBjb250YWluZXI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hyb3cgbmV3IFJlZmVyZW5jZUVycm9yXG4gICAgICAgICAgICBpZiAodG9nZ2xlLmNoZWNrZWQpIHtcbiAgICAgICAgICAgICAgdG9nZ2xlLmNoZWNrZWQgPSBmYWxzZVxuICAgICAgICAgICAgICB0b2dnbGUuZGlzcGF0Y2hFdmVudChuZXcgQ3VzdG9tRXZlbnQoXCJjaGFuZ2VcIikpXG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIC8qIEhhY2s6IHByZXZlbnQgZGVmYXVsdCwgYXMgdGhlIG5hdmlnYXRpb24gbmVlZHMgdG8gYmUgZGVsYXllZCBkdWVcbiAgICAgICAgICAgICAgIHRvIHRoZSBzZWFyY2ggYm9keSBsb2NrIG9uIG1vYmlsZSAqL1xuICAgICAgICAgICAgZXYyLnByZXZlbnREZWZhdWx0KClcbiAgICAgICAgICAgIHNldFRpbWVvdXQoKCkgPT4ge1xuICAgICAgICAgICAgICBkb2N1bWVudC5sb2NhdGlvbi5ocmVmID0gYW5jaG9yLmhyZWZcbiAgICAgICAgICAgIH0sIDEwMClcbiAgICAgICAgICB9KVxuICAgICAgICB9KVxuICAgICAgfSlcblxuICAgICAgLyogVXBkYXRlIHNlYXJjaCBtZXRhZGF0YSAqL1xuICAgICAgc3dpdGNoIChyZXN1bHQuc2l6ZSkge1xuICAgICAgICBjYXNlIDA6XG4gICAgICAgICAgdGhpcy5tZXRhXy50ZXh0Q29udGVudCA9IHRoaXMubWVzc2FnZV8ubm9uZVxuICAgICAgICAgIGJyZWFrXG4gICAgICAgIGNhc2UgMTpcbiAgICAgICAgICB0aGlzLm1ldGFfLnRleHRDb250ZW50ID0gdGhpcy5tZXNzYWdlXy5vbmVcbiAgICAgICAgICBicmVha1xuICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgIHRoaXMubWV0YV8udGV4dENvbnRlbnQgPVxuICAgICAgICAgICAgdGhpcy5tZXNzYWdlXy5vdGhlci5yZXBsYWNlKFwiI1wiLCByZXN1bHQuc2l6ZS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