|
|
|
|
/*
|
|
|
|
|
THIS IS A GENERATED/BUNDLED FILE BY ROLLUP
|
|
|
|
|
if you want to view the source visit the plugins github repository
|
|
|
|
|
https://github.com/joethei/obsidian-rss
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
|
|
var obsidian = require('obsidian');
|
|
|
|
|
|
|
|
|
|
/*! *****************************************************************************
|
|
|
|
|
Copyright (c) Microsoft Corporation.
|
|
|
|
|
|
|
|
|
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
|
|
|
purpose with or without fee is hereby granted.
|
|
|
|
|
|
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
|
|
|
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
|
|
|
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
|
|
|
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
|
|
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
|
|
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
|
|
|
PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
|
***************************************************************************** */
|
|
|
|
|
|
|
|
|
|
function __awaiter(thisArg, _arguments, P, generator) {
|
|
|
|
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
|
|
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
|
|
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
|
|
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
|
|
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
|
|
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* : to get namespaced element
|
|
|
|
|
* . to get nested element
|
|
|
|
|
* @param element
|
|
|
|
|
* @param name
|
|
|
|
|
*/
|
|
|
|
|
function getElementByName(element, name) {
|
|
|
|
|
let value;
|
|
|
|
|
if (typeof element.getElementsByTagName !== 'function') {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (name.contains(":")) {
|
|
|
|
|
const [namespace, tag] = name.split(":");
|
|
|
|
|
const namespaceUri = element.lookupNamespaceURI(namespace);
|
|
|
|
|
if (element.getElementsByTagNameNS(namespaceUri, tag).length > 0) {
|
|
|
|
|
value = element.getElementsByTagNameNS(namespaceUri, tag)[0].childNodes[0];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (name.contains(".")) {
|
|
|
|
|
const [prefix, tag] = name.split(".");
|
|
|
|
|
if (element.getElementsByTagName(prefix).length > 0) {
|
|
|
|
|
const nodes = Array.from(element.getElementsByTagName(prefix)[0].childNodes);
|
|
|
|
|
nodes.forEach((node) => {
|
|
|
|
|
if (node.nodeName == tag) {
|
|
|
|
|
value = node;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
if (element.getElementsByTagName(name).length > 0) {
|
|
|
|
|
if (element.getElementsByTagName(name)[0].childNodes.length == 0) {
|
|
|
|
|
value = element.getElementsByTagName(name)[0];
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
const node = element.getElementsByTagName(name)[0].childNodes[0];
|
|
|
|
|
if (node !== undefined)
|
|
|
|
|
value = node;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return value;
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* # to get attribute
|
|
|
|
|
* @param element
|
|
|
|
|
* @param names possible names
|
|
|
|
|
*/
|
|
|
|
|
function getContent(element, names) {
|
|
|
|
|
let value;
|
|
|
|
|
names.forEach((name) => {
|
|
|
|
|
if (name.contains("#")) {
|
|
|
|
|
const [elementName, attr] = name.split("#");
|
|
|
|
|
const data = getElementByName(element, elementName);
|
|
|
|
|
if (data) {
|
|
|
|
|
if (data.nodeName == elementName) {
|
|
|
|
|
//@ts-ignore
|
|
|
|
|
value = data.getAttr(attr);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
const data = getElementByName(element, name);
|
|
|
|
|
if (data) {
|
|
|
|
|
//@ts-ignore
|
|
|
|
|
if (data.nodeValue) {
|
|
|
|
|
value = data.nodeValue;
|
|
|
|
|
}
|
|
|
|
|
//@ts-ignore
|
|
|
|
|
if (data.innerHTML) {
|
|
|
|
|
//@ts-ignore
|
|
|
|
|
value = data.innerHTML;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
if (value === undefined) {
|
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
return value;
|
|
|
|
|
}
|
|
|
|
|
function buildItem(element) {
|
|
|
|
|
return {
|
|
|
|
|
title: getContent(element, ["title"]),
|
|
|
|
|
description: getContent(element, ["description"]),
|
|
|
|
|
content: getContent(element, ["description", "content", "content:encoded", "summary"]),
|
|
|
|
|
category: getContent(element, ["category"]),
|
|
|
|
|
link: getContent(element, ["link", "link#href"]),
|
|
|
|
|
creator: getContent(element, ["creator", "dc:creator", "author", "author.name"]),
|
|
|
|
|
pubDate: getContent(element, ["pubDate", "published", "updated", "dc:date"]),
|
|
|
|
|
folder: null,
|
|
|
|
|
feed: null,
|
|
|
|
|
read: null,
|
|
|
|
|
favorite: null,
|
|
|
|
|
created: null,
|
|
|
|
|
tags: [],
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
function getAllItems(doc) {
|
|
|
|
|
const items = [];
|
|
|
|
|
if (doc.getElementsByTagName("item")) {
|
|
|
|
|
for (const elementsByTagNameKey in doc.getElementsByTagName("item")) {
|
|
|
|
|
const entry = doc.getElementsByTagName("item")[elementsByTagNameKey];
|
|
|
|
|
items.push(entry);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (doc.getElementsByTagName("entry")) {
|
|
|
|
|
for (const elementsByTagNameKey in doc.getElementsByTagName("entry")) {
|
|
|
|
|
const entry = doc.getElementsByTagName("entry")[elementsByTagNameKey];
|
|
|
|
|
items.push(entry);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return items;
|
|
|
|
|
}
|
|
|
|
|
function getFeedItems(feed) {
|
|
|
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
|
|
|
const rawData = yield obsidian.request({ url: feed.url });
|
|
|
|
|
const data = new window.DOMParser().parseFromString(rawData, "text/xml");
|
|
|
|
|
const items = [];
|
|
|
|
|
const rawItems = getAllItems(data);
|
|
|
|
|
rawItems.forEach((rawItem) => {
|
|
|
|
|
const item = buildItem(rawItem);
|
|
|
|
|
if (item.title !== undefined && item.title.length !== 0) {
|
|
|
|
|
item.folder = feed.folder;
|
|
|
|
|
item.feed = feed.name;
|
|
|
|
|
item.read = false;
|
|
|
|
|
item.favorite = false;
|
|
|
|
|
item.created = false;
|
|
|
|
|
items.push(item);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
const image = getContent(data, ["image", "image.url", "icon"]);
|
|
|
|
|
const content = {
|
|
|
|
|
title: getContent(data, ["title"]),
|
|
|
|
|
subtitle: getContent(data, ["subtitle"]),
|
|
|
|
|
link: getContent(data, ["link"]),
|
|
|
|
|
//we don't want any leading or trailing slashes in image urls(i.e. reddit does that)
|
|
|
|
|
image: image ? image.replace(/^\/|\/$/g, '') : null,
|
|
|
|
|
description: getContent(data, ["description"]),
|
|
|
|
|
items: items,
|
|
|
|
|
folder: feed.folder,
|
|
|
|
|
name: feed.name
|
|
|
|
|
};
|
|
|
|
|
return Promise.resolve(content);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const VIEW_ID = "RSS_FEED";
|
|
|
|
|
const FILE_NAME_REGEX = /["\/<>:|?]/gm;
|
|
|
|
|
const TAG_REGEX = /([\p{Letter}\p{Emoji_Presentation}\p{Number}\/_-]+)/u;
|
|
|
|
|
const NUMBER_REGEX = /^[0-9]*$/gm;
|
|
|
|
|
//TODO: remove once api definition has been updated
|
|
|
|
|
/**
|
|
|
|
|
* taken from @licat(https://discord.com/channels/686053708261228577/840286264964022302/899037833552093184)
|
|
|
|
|
* @param html
|
|
|
|
|
*/
|
|
|
|
|
function sanitizeHTMLToDom(html) {
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
return window.DOMPurify.sanitize(html, {
|
|
|
|
|
ALLOW_UNKNOWN_PROTOCOLS: true,
|
|
|
|
|
RETURN_DOM_FRAGMENT: true,
|
|
|
|
|
RETURN_DOM_IMPORT: true,
|
|
|
|
|
FORBID_TAGS: ['style'],
|
|
|
|
|
ADD_TAGS: ['iframe'],
|
|
|
|
|
ADD_ATTR: ['frameborder', 'allowfullscreen', 'allow', 'aria-label-position'],
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
//taken from: https://stackoverflow.com/a/43467144/5589264
|
|
|
|
|
function isValidHttpUrl(string) {
|
|
|
|
|
let url;
|
|
|
|
|
try {
|
|
|
|
|
url = new URL(string);
|
|
|
|
|
}
|
|
|
|
|
catch (_) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return url.protocol === "http:" || url.protocol === "https:";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class BaseModal extends obsidian.Modal {
|
|
|
|
|
//taken from github.com/valentine195/obsidian-admonition
|
|
|
|
|
setValidationError(textInput, message) {
|
|
|
|
|
textInput.inputEl.addClass("is-invalid");
|
|
|
|
|
if (message) {
|
|
|
|
|
textInput.inputEl.parentElement.addClasses([
|
|
|
|
|
"has-invalid-message",
|
|
|
|
|
"unset-align-items"
|
|
|
|
|
]);
|
|
|
|
|
textInput.inputEl.parentElement.parentElement.addClass(".unset-align-items");
|
|
|
|
|
let mDiv = textInput.inputEl.parentElement.querySelector(".invalid-feedback");
|
|
|
|
|
if (!mDiv) {
|
|
|
|
|
mDiv = createDiv({ cls: "invalid-feedback" });
|
|
|
|
|
}
|
|
|
|
|
mDiv.innerText = message;
|
|
|
|
|
mDiv.insertAfter(textInput.inputEl);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
removeValidationError(textInput) {
|
|
|
|
|
textInput.inputEl.removeClass("is-invalid");
|
|
|
|
|
textInput.inputEl.parentElement.removeClasses([
|
|
|
|
|
"has-invalid-message",
|
|
|
|
|
"unset-align-items"
|
|
|
|
|
]);
|
|
|
|
|
textInput.inputEl.parentElement.parentElement.removeClass(".unset-align-items");
|
|
|
|
|
if (textInput.inputEl.parentElement.querySelector(".invalid-feedback")) {
|
|
|
|
|
textInput.inputEl.parentElement.removeChild(textInput.inputEl.parentElement.querySelector(".invalid-feedback"));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class FeedModal extends BaseModal {
|
|
|
|
|
constructor(plugin, feed) {
|
|
|
|
|
super(plugin.app);
|
|
|
|
|
this.saved = false;
|
|
|
|
|
if (feed) {
|
|
|
|
|
this.name = feed.name;
|
|
|
|
|
this.url = feed.url;
|
|
|
|
|
this.folder = feed.folder;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
display() {
|
|
|
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
|
|
|
const { contentEl } = this;
|
|
|
|
|
contentEl.empty();
|
|
|
|
|
let nameText;
|
|
|
|
|
const name = new obsidian.Setting(contentEl)
|
|
|
|
|
.setName("Name")
|
|
|
|
|
.setDesc("Name of feed")
|
|
|
|
|
.addText((text) => {
|
|
|
|
|
nameText = text;
|
|
|
|
|
text.setValue(this.name)
|
|
|
|
|
.onChange((value) => {
|
|
|
|
|
this.removeValidationError(text);
|
|
|
|
|
this.name = value;
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
name.controlEl.addClass("rss-setting-input");
|
|
|
|
|
let urlText;
|
|
|
|
|
const url = new obsidian.Setting(contentEl)
|
|
|
|
|
.setName("url")
|
|
|
|
|
.setDesc("url of feed")
|
|
|
|
|
.addText((text) => {
|
|
|
|
|
urlText = text;
|
|
|
|
|
text.setValue(this.url)
|
|
|
|
|
.onChange((value) => __awaiter(this, void 0, void 0, function* () {
|
|
|
|
|
this.removeValidationError(text);
|
|
|
|
|
this.url = value;
|
|
|
|
|
}));
|
|
|
|
|
});
|
|
|
|
|
url.controlEl.addClass("rss-setting-input");
|
|
|
|
|
new obsidian.Setting(contentEl)
|
|
|
|
|
.setName("Folder")
|
|
|
|
|
.addText((text) => {
|
|
|
|
|
text.setValue(this.folder)
|
|
|
|
|
.onChange((value) => {
|
|
|
|
|
this.folder = value;
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
const footerEl = contentEl.createDiv();
|
|
|
|
|
const footerButtons = new obsidian.Setting(footerEl);
|
|
|
|
|
footerButtons.addButton((b) => {
|
|
|
|
|
b.setTooltip("Save")
|
|
|
|
|
.setIcon("checkmark")
|
|
|
|
|
.onClick(() => __awaiter(this, void 0, void 0, function* () {
|
|
|
|
|
let error = false;
|
|
|
|
|
if (!nameText.getValue().length) {
|
|
|
|
|
this.setValidationError(nameText, "you need to specify a name");
|
|
|
|
|
error = true;
|
|
|
|
|
}
|
|
|
|
|
if (!urlText.getValue().length) {
|
|
|
|
|
this.setValidationError(urlText, "you need to specify a url");
|
|
|
|
|
error = true;
|
|
|
|
|
}
|
|
|
|
|
if (!isValidHttpUrl(urlText.getValue())) {
|
|
|
|
|
this.setValidationError(urlText, "This url is not valid");
|
|
|
|
|
error = true;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
const items = yield getFeedItems({ name: "test", url: urlText.getValue(), folder: "" });
|
|
|
|
|
if (items.items.length == 0) {
|
|
|
|
|
this.setValidationError(urlText, "this feed does not have any entries");
|
|
|
|
|
error = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (error) {
|
|
|
|
|
new obsidian.Notice("please fix errors before saving.");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
this.saved = true;
|
|
|
|
|
this.close();
|
|
|
|
|
}));
|
|
|
|
|
return b;
|
|
|
|
|
});
|
|
|
|
|
footerButtons.addExtraButton((b) => {
|
|
|
|
|
b.setIcon("cross")
|
|
|
|
|
.setTooltip("Cancel")
|
|
|
|
|
.onClick(() => {
|
|
|
|
|
this.saved = false;
|
|
|
|
|
this.close();
|
|
|
|
|
});
|
|
|
|
|
return b;
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
onOpen() {
|
|
|
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
|
|
|
yield this.display();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
|
|
|
|
|
|
|
|
function createCommonjsModule(fn) {
|
|
|
|
|
var module = { exports: {} };
|
|
|
|
|
return fn(module, module.exports), module.exports;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* lodash (Custom Build) <https://lodash.com/>
|
|
|
|
|
* Build: `lodash modularize exports="npm" -o ./`
|
|
|
|
|
* Copyright jQuery Foundation and other contributors <https://jquery.org/>
|
|
|
|
|
* Released under MIT license <https://lodash.com/license>
|
|
|
|
|
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
|
|
|
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
var lodash_groupby = createCommonjsModule(function (module, exports) {
|
|
|
|
|
/** Used as the size to enable large array optimizations. */
|
|
|
|
|
var LARGE_ARRAY_SIZE = 200;
|
|
|
|
|
|
|
|
|
|
/** Used as the `TypeError` message for "Functions" methods. */
|
|
|
|
|
var FUNC_ERROR_TEXT = 'Expected a function';
|
|
|
|
|
|
|
|
|
|
/** Used to stand-in for `undefined` hash values. */
|
|
|
|
|
var HASH_UNDEFINED = '__lodash_hash_undefined__';
|
|
|
|
|
|
|
|
|
|
/** Used to compose bitmasks for comparison styles. */
|
|
|
|
|
var UNORDERED_COMPARE_FLAG = 1,
|
|
|
|
|
PARTIAL_COMPARE_FLAG = 2;
|
|
|
|
|
|
|
|
|
|
/** Used as references for various `Number` constants. */
|
|
|
|
|
var INFINITY = 1 / 0,
|
|
|
|
|
MAX_SAFE_INTEGER = 9007199254740991;
|
|
|
|
|
|
|
|
|
|
/** `Object#toString` result references. */
|
|
|
|
|
var argsTag = '[object Arguments]',
|
|
|
|
|
arrayTag = '[object Array]',
|
|
|
|
|
boolTag = '[object Boolean]',
|
|
|
|
|
dateTag = '[object Date]',
|
|
|
|
|
errorTag = '[object Error]',
|
|
|
|
|
funcTag = '[object Function]',
|
|
|
|
|
genTag = '[object GeneratorFunction]',
|
|
|
|
|
mapTag = '[object Map]',
|
|
|
|
|
numberTag = '[object Number]',
|
|
|
|
|
objectTag = '[object Object]',
|
|
|
|
|
promiseTag = '[object Promise]',
|
|
|
|
|
regexpTag = '[object RegExp]',
|
|
|
|
|
setTag = '[object Set]',
|
|
|
|
|
stringTag = '[object String]',
|
|
|
|
|
symbolTag = '[object Symbol]',
|
|
|
|
|
weakMapTag = '[object WeakMap]';
|
|
|
|
|
|
|
|
|
|
var arrayBufferTag = '[object ArrayBuffer]',
|
|
|
|
|
dataViewTag = '[object DataView]',
|
|
|
|
|
float32Tag = '[object Float32Array]',
|
|
|
|
|
float64Tag = '[object Float64Array]',
|
|
|
|
|
int8Tag = '[object Int8Array]',
|
|
|
|
|
int16Tag = '[object Int16Array]',
|
|
|
|
|
int32Tag = '[object Int32Array]',
|
|
|
|
|
uint8Tag = '[object Uint8Array]',
|
|
|
|
|
uint8ClampedTag = '[object Uint8ClampedArray]',
|
|
|
|
|
uint16Tag = '[object Uint16Array]',
|
|
|
|
|
uint32Tag = '[object Uint32Array]';
|
|
|
|
|
|
|
|
|
|
/** Used to match property names within property paths. */
|
|
|
|
|
var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
|
|
|
|
|
reIsPlainProp = /^\w*$/,
|
|
|
|
|
reLeadingDot = /^\./,
|
|
|
|
|
rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Used to match `RegExp`
|
|
|
|
|
* [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
|
|
|
|
|
*/
|
|
|
|
|
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
|
|
|
|
|
|
|
|
|
|
/** Used to match backslashes in property paths. */
|
|
|
|
|
var reEscapeChar = /\\(\\)?/g;
|
|
|
|
|
|
|
|
|
|
/** Used to detect host constructors (Safari). */
|
|
|
|
|
var reIsHostCtor = /^\[object .+?Constructor\]$/;
|
|
|
|
|
|
|
|
|
|
/** Used to detect unsigned integer values. */
|
|
|
|
|
var reIsUint = /^(?:0|[1-9]\d*)$/;
|
|
|
|
|
|
|
|
|
|
/** Used to identify `toStringTag` values of typed arrays. */
|
|
|
|
|
var typedArrayTags = {};
|
|
|
|
|
typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
|
|
|
|
|
typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
|
|
|
|
|
typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
|
|
|
|
|
typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
|
|
|
|
|
typedArrayTags[uint32Tag] = true;
|
|
|
|
|
typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
|
|
|
|
|
typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
|
|
|
|
|
typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
|
|
|
|
|
typedArrayTags[errorTag] = typedArrayTags[funcTag] =
|
|
|
|
|
typedArrayTags[mapTag] = typedArrayTags[numberTag] =
|
|
|
|
|
typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
|
|
|
|
|
typedArrayTags[setTag] = typedArrayTags[stringTag] =
|
|
|
|
|
typedArrayTags[weakMapTag] = false;
|
|
|
|
|
|
|
|
|
|
/** Detect free variable `global` from Node.js. */
|
|
|
|
|
var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
|
|
|
|
|
|
|
|
|
|
/** Detect free variable `self`. */
|
|
|
|
|
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
|
|
|
|
|
|
|
|
|
|
/** Used as a reference to the global object. */
|
|
|
|
|
var root = freeGlobal || freeSelf || Function('return this')();
|
|
|
|
|
|
|
|
|
|
/** Detect free variable `exports`. */
|
|
|
|
|
var freeExports = exports && !exports.nodeType && exports;
|
|
|
|
|
|
|
|
|
|
/** Detect free variable `module`. */
|
|
|
|
|
var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
|
|
|
|
|
|
|
|
|
|
/** Detect the popular CommonJS extension `module.exports`. */
|
|
|
|
|
var moduleExports = freeModule && freeModule.exports === freeExports;
|
|
|
|
|
|
|
|
|
|
/** Detect free variable `process` from Node.js. */
|
|
|
|
|
var freeProcess = moduleExports && freeGlobal.process;
|
|
|
|
|
|
|
|
|
|
/** Used to access faster Node.js helpers. */
|
|
|
|
|
var nodeUtil = (function() {
|
|
|
|
|
try {
|
|
|
|
|
return freeProcess && freeProcess.binding('util');
|
|
|
|
|
} catch (e) {}
|
|
|
|
|
}());
|
|
|
|
|
|
|
|
|
|
/* Node.js helper references. */
|
|
|
|
|
var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* A specialized version of `baseAggregator` for arrays.
|
|
|
|
|
*
|
|
|
|
|
* @private
|
|
|
|
|
* @param {Array} [array] The array to iterate over.
|
|
|
|
|
* @param {Function} setter The function to set `accumulator` values.
|
|
|
|
|
* @param {Function} iteratee The iteratee to transform keys.
|
|
|
|
|
* @param {Object} accumulator The initial aggregated object.
|
|
|
|
|
* @returns {Function} Returns `accumulator`.
|
|
|
|
|
*/
|
|
|
|
|
function arrayAggregator(array, setter, iteratee, accumulator) {
|
|
|
|
|
var index = -1,
|
|
|
|
|
length = array ? array.length : 0;
|
|
|
|
|
|
|
|
|
|
while (++index < length) {
|
|
|
|
|
var value = array[index];
|
|
|
|
|
setter(accumulator, value, iteratee(value), array);
|
|
|
|
|
}
|
|
|
|
|
return accumulator;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* A specialized version of `_.some` for arrays without support for iteratee
|
|
|
|
|
* shorthands.
|
|
|
|
|
*
|
|
|
|
|
* @private
|
|
|
|
|
* @param {Array} [array] The array to iterate over.
|
|
|
|
|
* @param {Function} predicate The function invoked per iteration.
|
|
|
|
|
* @returns {boolean} Returns `true` if any element passes the predicate check,
|
|
|
|
|
* else `false`.
|
|
|
|
|
*/
|
|
|
|
|
function arraySome(array, predicate) {
|
|
|
|
|
var index = -1,
|
|
|
|
|
length = array ? array.length : 0;
|
|
|
|
|
|
|
|
|
|
while (++index < length) {
|
|
|
|
|
if (predicate(array[index], index, array)) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The base implementation of `_.property` without support for deep paths.
|
|
|
|
|
*
|
|
|
|
|
* @private
|
|
|
|
|
* @param {string} key The key of the property to get.
|
|
|
|
|
* @returns {Function} Returns the new accessor function.
|
|
|
|
|
*/
|
|
|
|
|
function baseProperty(key) {
|
|
|
|
|
return function(object) {
|
|
|
|
|
return object == null ? undefined : object[key];
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The base implementation of `_.times` without support for iteratee shorthands
|
|
|
|
|
* or max array length checks.
|
|
|
|
|
*
|
|
|
|
|
* @private
|
|
|
|
|
* @param {number} n The number of times to invoke `iteratee`.
|
|
|
|
|
* @param {Function} iteratee The function invoked per iteration.
|
|
|
|
|
* @returns {Array} Returns the array of results.
|
|
|
|
|
*/
|
|
|
|
|
function baseTimes(n, iteratee) {
|
|
|
|
|
var index = -1,
|
|
|
|
|
result = Array(n);
|
|
|
|
|
|
|
|
|
|
while (++index < n) {
|
|
|
|
|
result[index] = iteratee(index);
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The base implementation of `_.unary` without support for storing metadata.
|
|
|
|
|
*
|
|
|
|
|
* @private
|
|
|
|
|
* @param {Function} func The function to cap arguments for.
|
|
|
|
|
* @returns {Function} Returns the new capped function.
|
|
|
|
|
*/
|
|
|
|
|
function baseUnary(func) {
|
|
|
|
|
return function(value) {
|
|
|
|
|
return func(value);
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Gets the value at `key` of `object`.
|
|
|
|
|
*
|
|
|
|
|
* @private
|
|
|
|
|
* @param {Object} [object] The object to query.
|
|
|
|
|
* @param {string} key The key of the property to get.
|
|
|
|
|
* @returns {*} Returns the property value.
|
|
|
|
|
*/
|
|
|
|
|
function getValue(object, key) {
|
|
|
|
|
return object == null ? undefined : object[key];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Checks if `value` is a host object in IE < 9.
|
|
|
|
|
*
|
|
|
|
|
* @private
|
|
|
|
|
* @param {*} value The value to check.
|
|
|
|
|
* @returns {boolean} Returns `true` if `value` is a host object, else `false`.
|
|
|
|
|
*/
|
|
|
|
|
function isHostObject(value) {
|
|
|
|
|
// Many host objects are `Object` objects that can coerce to strings
|
|
|
|
|
// despite having improperly defined `toString` methods.
|
|
|
|
|
var result = false;
|
|
|
|
|
if (value != null && typeof value.toString != 'function') {
|
|
|
|
|
try {
|
|
|
|
|
result = !!(value + '');
|
|
|
|
|
} catch (e) {}
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Converts `map` to its key-value pairs.
|
|
|
|
|
*
|
|
|
|
|
* @private
|
|
|
|
|
* @param {Object} map The map to convert.
|
|
|
|
|
* @returns {Array} Returns the key-value pairs.
|
|
|
|
|
*/
|
|
|
|
|
function mapToArray(map) {
|
|
|
|
|
var index = -1,
|
|
|
|
|
result = Array(map.size);
|
|
|
|
|
|
|
|
|
|
map.forEach(function(value, key) {
|
|
|
|
|
result[++index] = [key, value];
|
|
|
|
|
});
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Creates a unary function that invokes `func` with its argument transformed.
|
|
|
|
|
*
|
|
|
|
|
* @private
|
|
|
|
|
* @param {Function} func The function to wrap.
|
|
|
|
|
* @param {Function} transform The argument transform.
|
|
|
|
|
* @returns {Function} Returns the new function.
|
|
|
|
|
*/
|
|
|
|
|
function overArg(func, transform) {
|
|
|
|
|
return function(arg) {
|
|
|
|
|
return func(transform(arg));
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Converts `set` to an array of its values.
|
|
|
|
|
*
|
|
|
|
|
* @private
|
|
|
|
|
* @param {Object} set The set to convert.
|
|
|
|
|
* @returns {Array} Returns the values.
|
|
|
|
|
*/
|
|
|
|
|
function setToArray(set) {
|
|
|
|
|
var index = -1,
|
|
|
|
|
result = Array(set.size);
|
|
|
|
|
|
|
|
|
|
set.forEach(function(value) {
|
|
|
|
|
result[++index] = value;
|
|
|
|
|
});
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** Used for built-in method references. */
|
|
|
|
|
var arrayProto = Array.prototype,
|
|
|
|
|
funcProto = Function.prototype,
|
|
|
|
|
objectProto = Object.prototype;
|
|
|
|
|
|
|
|
|
|
/** Used to detect overreaching core-js shims. */
|
|
|
|
|
var coreJsData = root['__core-js_shared__'];
|
|
|
|
|
|
|
|
|
|
/** Used to detect methods masquerading as native. */
|
|
|
|
|
var maskSrcKey = (function() {
|
|
|
|
|
var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
|
|
|
|
|
return uid ? ('Symbol(src)_1.' + uid) : '';
|
|
|
|
|
}());
|
|
|
|
|
|
|
|
|
|
/** Used to resolve the decompiled source of functions. */
|
|
|
|
|
var funcToString = funcProto.toString;
|
|
|
|
|
|
|
|
|
|
/** Used to check objects for own properties. */
|
|
|
|
|
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Used to resolve the
|
|
|
|
|
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
|
|
|
* of values.
|
|
|
|
|
*/
|
|
|
|
|
var objectToString = objectProto.toString;
|
|
|
|
|
|
|
|
|
|
/** Used to detect if a method is native. */
|
|
|
|
|
var reIsNative = RegExp('^' +
|
|
|
|
|
funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
|
|
|
|
|
.replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
/** Built-in value references. */
|
|
|
|
|
var Symbol = root.Symbol,
|
|
|
|
|
Uint8Array = root.Uint8Array,
|
|
|
|
|
propertyIsEnumerable = objectProto.propertyIsEnumerable,
|
|
|
|
|
splice = arrayProto.splice;
|
|
|
|
|
|
|
|
|
|
/* Built-in method references for those with the same name as other `lodash` methods. */
|
|
|
|
|
var nativeKeys = overArg(Object.keys, Object);
|
|
|
|
|
|
|
|
|
|
/* Built-in method references that are verified to be native. */
|
|
|
|
|
var DataView = getNative(root, 'DataView'),
|
|
|
|
|
Map = getNative(root, 'Map'),
|
|
|
|
|
Promise = getNative(root, 'Promise'),
|
|
|
|
|
Set = getNative(root, 'Set'),
|
|
|
|
|
WeakMap = getNative(root, 'WeakMap'),
|
|
|
|
|
nativeCreate = getNative(Object, 'create');
|
|
|
|
|
|
|
|
|
|
/** Used to detect maps, sets, and weakmaps. */
|
|
|
|
|
var dataViewCtorString = toSource(DataView),
|
|
|
|
|
mapCtorString = toSource(Map),
|
|
|
|
|
promiseCtorString = toSource(Promise),
|
|
|
|
|
setCtorString = toSource(Set),
|
|
|
|
|
weakMapCtorString = toSource(WeakMap);
|
|
|
|
|
|
|
|
|
|
/** Used to convert symbols to primitives and strings. */
|
|
|
|
|
var symbolProto = Symbol ? Symbol.prototype : undefined,
|
|
|
|
|
symbolValueOf = symbolProto ? symbolProto.valueOf : undefined,
|
|
|
|
|
symbolToString = symbolProto ? symbolProto.toString : undefined;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Creates a hash object.
|
|
|
|
|
*
|
|
|
|
|
* @private
|
|
|
|
|
* @constructor
|
|
|
|
|
* @param {Array} [entries] The key-value pairs to cache.
|
|
|
|
|
*/
|
|
|
|
|
function Hash(entries) {
|
|
|
|
|
var index = -1,
|
|
|
|
|
length = entries ? entries.length : 0;
|
|
|
|
|
|
|
|
|
|
this.clear();
|
|
|
|
|
while (++index < length) {
|
|
|
|
|
var entry = entries[index];
|
|
|
|
|
this.set(entry[0], entry[1]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Removes all key-value entries from the hash.
|
|
|
|
|
*
|
|
|
|
|
* @private
|
|
|
|
|
* @name clear
|
|
|
|
|
* @memberOf Hash
|
|
|
|
|
*/
|
|
|
|
|
function hashClear() {
|
|
|
|
|
this.__data__ = nativeCreate ? nativeCreate(null) : {};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Removes `key` and its value from the hash.
|
|
|
|
|
*
|
|
|
|
|
* @private
|
|
|
|
|
* @name delete
|
|
|
|
|
* @memberOf Hash
|
|
|
|
|
* @param {Object} hash The hash to modify.
|
|
|
|
|
* @param {string} key The key of the value to remove.
|
|
|
|
|
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
|
|
|
*/
|
|
|
|
|
function hashDelete(key) {
|
|
|
|
|
return this.has(key) && delete this.__data__[key];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Gets the hash value for `key`.
|
|
|
|
|
*
|
|
|
|
|
* @private
|
|
|
|
|
* @name get
|
|
|
|
|
* @memberOf Hash
|
|
|
|
|
* @param {string} key The key of the value to get.
|
|
|
|
|
* @returns {*} Returns the entry value.
|
|
|
|
|
*/
|
|
|
|
|
function hashGet(key) {
|
|
|
|
|
var data = this.__data__;
|
|
|
|
|
if (nativeCreate) {
|
|
|
|
|
var result = data[key];
|
|
|
|
|
return result === HASH_UNDEFINED ? undefined : result;
|
|
|
|
|
}
|
|
|
|
|
return hasOwnProperty.call(data, key) ? data[key] : undefined;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Checks if a hash value for `key` exists.
|
|
|
|
|
*
|
|
|
|
|
* @private
|
|
|
|
|
* @name has
|
|
|
|
|
* @memberOf Hash
|
|
|
|
|
* @param {string} key The key of the entry to check.
|
|
|
|
|
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
|
|
|
*/
|
|
|
|
|
function hashHas(key) {
|
|
|
|
|
var data = this.__data__;
|
|
|
|
|
return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Sets the hash `key` to `value`.
|
|
|
|
|
*
|
|
|
|
|
* @private
|
|
|
|
|
* @name set
|
|
|
|
|
* @memberOf Hash
|
|
|
|
|
* @param {string} key The key of the value to set.
|
|
|
|
|
* @param {*} value The value to set.
|
|
|
|
|
* @returns {Object} Returns the hash instance.
|
|
|
|
|
*/
|
|
|
|
|
function hashSet(key, value) {
|
|
|
|
|
var data = this.__data__;
|
|
|
|
|
data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
|
|
|
|
|
return this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Add methods to `Hash`.
|
|
|
|
|
Hash.prototype.clear = hashClear;
|
|
|
|
|
Hash.prototype['delete'] = hashDelete;
|
|
|
|
|
Hash.prototype.get = hashGet;
|
|
|
|
|
Hash.prototype.has = hashHas;
|
|
|
|
|
Hash.prototype.set = hashSet;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Creates an list cache object.
|
|
|
|
|
*
|
|
|
|
|
* @private
|
|
|
|
|
* @constructor
|
|
|
|
|
* @param {Array} [entries] The key-value pairs to cache.
|
|
|
|
|
*/
|
|
|
|
|
function ListCache(entries) {
|
|
|
|
|
var index = -1,
|
|
|
|
|
length = entries ? entries.length : 0;
|
|
|
|
|
|
|
|
|
|
this.clear();
|
|
|
|
|
while (++index < length) {
|
|
|
|
|
var entry = entries[index];
|
|
|
|
|
this.set(entry[0], entry[1]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Removes all key-value entries from the list cache.
|
|
|
|
|
*
|
|
|
|
|
* @private
|
|
|
|
|
* @name clear
|
|
|
|
|
* @memberOf ListCache
|
|
|
|
|
*/
|
|
|
|
|
function listCacheClear() {
|
|
|
|
|
this.__data__ = [];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Removes `key` and its value from the list cache.
|
|
|
|
|
*
|
|
|
|
|
* @private
|
|
|
|
|
* @name delete
|
|
|
|
|
* @memberOf ListCache
|
|
|
|
|
* @param {string} key The key of the value to remove.
|
|
|
|
|
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
|
|
|
*/
|
|
|
|
|
function listCacheDelete(key) {
|
|
|
|
|
var data = this.__data__,
|
|
|
|
|
index = assocIndexOf(data, key);
|
|
|
|
|
|
|
|
|
|
if (index < 0) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
var lastIndex = data.length - 1;
|
|
|
|
|
if (index == lastIndex) {
|
|
|
|
|
data.pop();
|
|
|
|
|
} else {
|
|
|
|
|
splice.call(data, index, 1);
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Gets the list cache value for `key`.
|
|
|
|
|
*
|
|
|
|
|
* @private
|
|
|
|
|
* @name get
|
|
|
|
|
* @memberOf ListCache
|
|
|
|
|
* @param {string} key The key of the value to get.
|
|
|
|
|
* @returns {*} Returns the entry value.
|
|
|
|
|
*/
|
|
|
|
|
function listCacheGet(key) {
|
|
|
|
|
var data = this.__data__,
|
|
|
|
|
index = assocIndexOf(data, key);
|
|
|
|
|
|
|
|
|
|
return index < 0 ? undefined : data[index][1];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Checks if a list cache value for `key` exists.
|
|
|
|
|
*
|
|
|
|
|
* @private
|
|
|
|
|
* @name has
|
|
|
|
|
* @memberOf ListCache
|
|
|
|
|
* @param {string} key The key of the entry to check.
|
|
|
|
|
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
|
|
|
*/
|
|
|
|
|
function listCacheHas(key) {
|
|
|
|
|
return assocIndexOf(this.__data__, key) > -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Sets the list cache `key` to `value`.
|
|
|
|
|
*
|
|
|
|
|
* @private
|
|
|
|
|
* @name set
|
|
|
|
|
* @memberOf ListCache
|
|
|
|
|
* @param {string} key The key of the value to set.
|
|
|
|
|
* @param {*} value The value to set.
|
|
|
|
|
* @returns {Object} Returns the list cache instance.
|
|
|
|
|
*/
|
|
|
|
|
function listCacheSet(key, value) {
|
|
|
|
|
var data = this.__data__,
|
|
|
|
|
index = assocIndexOf(data, key);
|
|
|
|
|
|
|
|
|
|
if (index < 0) {
|
|
|
|
|
data.push([key, value]);
|
|
|
|
|
} else {
|
|
|
|
|
data[index][1] = value;
|
|
|
|
|
}
|
|
|
|
|
return this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Add methods to `ListCache`.
|
|
|
|
|
ListCache.prototype.clear = listCacheClear;
|
|
|
|
|
ListCache.prototype['delete'] = listCacheDelete;
|
|
|
|
|
ListCache.prototype.get = listCacheGet;
|
|
|
|
|
ListCache.prototype.has = listCacheHas;
|
|
|
|
|
ListCache.prototype.set = listCacheSet;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Creates a map cache object to store key-value pairs.
|
|
|
|
|
*
|
|
|
|
|
* @private
|
|
|
|
|
* @constructor
|
|
|
|
|
* @param {Array} [entries] The key-value pairs to cache.
|
|
|
|
|
*/
|
|
|
|
|
function MapCache(entries) {
|
|
|
|
|
var index = -1,
|
|
|
|
|
length = entries ? entries.length : 0;
|
|
|
|
|
|
|
|
|
|
this.clear();
|
|
|
|
|
while (++index < length) {
|
|
|
|
|
var entry = entries[index];
|
|
|
|
|
this.set(entry[0], entry[1]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Removes all key-value entries from the map.
|
|
|
|
|
*
|
|
|
|
|
* @private
|
|
|
|
|
* @name clear
|
|
|
|
|
* @memberOf MapCache
|
|
|
|
|
*/
|
|
|
|
|
function mapCacheClear() {
|
|
|
|
|
this.__data__ = {
|
|
|
|
|
'hash': new Hash,
|
|
|
|
|
'map': new (Map || ListCache),
|
|
|
|
|
'string': new Hash
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Removes `key` and its value from the map.
|
|
|
|
|
*
|
|
|
|
|
* @private
|
|
|
|
|
* @name delete
|
|
|
|
|
* @memberOf MapCache
|
|
|
|
|
* @param {string} key The key of the value to remove.
|
|
|
|
|
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
|
|
|
*/
|
|
|
|
|
function mapCacheDelete(key) {
|
|
|
|
|
return getMapData(this, key)['delete'](key);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Gets the map value for `key`.
|
|
|
|
|
*
|
|
|
|
|
* @private
|
|
|
|
|
* @name get
|
|
|
|
|
* @memberOf MapCache
|
|
|
|
|
* @param {string} key The key of the value to get.
|
|
|
|
|
* @returns {*} Returns the entry value.
|
|
|
|
|
*/
|
|
|
|
|
function mapCacheGet(key) {
|
|
|
|
|
return getMapData(this, key).get(key);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Checks if a map value for `key` exists.
|
|
|
|
|
*
|
|
|
|
|
* @private
|
|
|
|
|
* @name has
|
|
|
|
|
* @memberOf MapCache
|
|
|
|
|
* @param {string} key The key of the entry to check.
|
|
|
|
|
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
|
|
|
*/
|
|
|
|
|
function mapCacheHas(key) {
|
|
|
|
|
return getMapData(this, key).has(key);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Sets the map `key` to `value`.
|
|
|
|
|
*
|
|
|
|
|
* @private
|
|
|
|
|
* @name set
|
|
|
|
|
* @memberOf MapCache
|
|
|
|
|
* @param {string} key The key of the value to set.
|
|
|
|
|
* @param {*} value The value to set.
|
|
|
|
|
* @returns {Object} Returns the map cache instance.
|
|
|
|
|
*/
|
|
|
|
|
function mapCacheSet(key, value) {
|
|
|
|
|
getMapData(this, key).set(key, value);
|
|
|
|
|
return this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Add methods to `MapCache`.
|
|
|
|
|
MapCache.prototype.clear = mapCacheClear;
|
|
|
|
|
MapCache.prototype['delete'] = mapCacheDelete;
|
|
|
|
|
MapCache.prototype.get = mapCacheGet;
|
|
|
|
|
MapCache.prototype.has = mapCacheHas;
|
|
|
|
|
MapCache.prototype.set = mapCacheSet;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
|
* Creates an array cache object to store unique values.
|
|
|
|
|
*
|
|
|
|
|
* @private
|
|
|
|
|
* @constructor
|
|
|
|
|
* @param {Array} [values] The values to cache.
|
|
|
|
|
*/
|
|
|
|
|
function SetCache(values) {
|
|
|
|
|
var index = -1,
|
|
|
|
|
length = values ? values.length : 0;
|
|
|
|
|
|
|
|
|
|
this.__data__ = new MapCache;
|
|
|
|
|
while (++index < length) {
|
|
|
|
|
this.add(values[index]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Adds `value` to the array cache.
|
|
|
|
|
*
|
|
|
|
|
* @private
|
|
|
|
|
* @name add
|
|
|
|
|
* @memberOf SetCache
|
|
|
|
|
* @alias push
|
|
|
|
|
* @param {*} value The value to cache.
|
|
|
|
|
* @returns {Object} Returns the cache instance.
|
|
|
|
|
*/
|
|
|
|
|
function setCacheAdd(value) {
|
|
|
|
|
this.__data__.set(value, HASH_UNDEFINED);
|
|
|
|
|
return this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Checks if `value` is in the array cache.
|
|
|
|
|
*
|
|
|
|
|
* @private
|
|
|
|
|
* @name has
|
|
|
|
|
* @memberOf SetCache
|
|
|
|
|
* @param {*} value The value to search for.
|
|
|
|
|
* @returns {number} Returns `true` if `value` is found, else `false`.
|
|
|
|
|
*/
|
|
|
|
|
function setCacheHas(value) {
|
|
|
|
|
return this.__data__.has(value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Add methods to `SetCache`.
|
|
|
|
|
SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
|
|
|
|
|
SetCache.prototype.has = setCacheHas;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Creates a stack cache object to store key-value pairs.
|
|
|
|
|
*
|
|
|
|
|
* @private
|
|
|
|
|
* @constructor
|
|
|
|
|
* @param {Array} [entries] The key-value pairs to cache.
|
|
|
|
|
*/
|
|
|
|
|
function Stack(entries) {
|
|
|
|
|
this.__data__ = new ListCache(entries);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Removes all key-value entries from the stack.
|
|
|
|
|
*
|
|
|
|
|
* @private
|
|
|
|
|
* @name clear
|
|
|
|
|
* @memberOf Stack
|
|
|
|
|
*/
|
|
|
|
|
function stackClear() {
|
|
|
|
|
this.__data__ = new ListCache;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Removes `key` and its value from the stack.
|
|
|
|
|
*
|
|
|
|
|
* @private
|
|
|
|
|
* @name delete
|
|
|
|
|
* @memberOf Stack
|
|
|
|
|
* @param {string} key The key of the value to remove.
|
|
|
|
|
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
|
|
|
*/
|
|
|
|
|
function stackDelete(key) {
|
|
|
|
|
return this.__data__['delete'](key);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Gets the stack value for `key`.
|
|
|
|
|
*
|
|
|
|
|
* @private
|
|
|
|
|
* @name get
|
|
|
|
|
* @memberOf Stack
|
|
|
|
|
* @param {string} key The key of the value to get.
|
|
|
|
|
* @returns {*} Returns the entry value.
|
|
|
|
|
*/
|
|
|
|
|
function stackGet(key) {
|
|
|
|
|
return this.__data__.get(key);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Checks if a stack value for `key` exists.
|
|
|
|
|
*
|
|
|
|
|
* @private
|
|
|
|
|
* @name has
|
|
|
|
|
* @memberOf Stack
|
|
|
|
|
* @param {string} key The key of the entry to check.
|
|
|
|
|
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
|
|
|
*/
|
|
|
|
|
function stackHas(key) {
|
|
|
|
|
return this.__data__.has(key);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Sets the stack `key` to `value`.
|
|
|
|
|
*
|
|
|
|
|
* @private
|
|
|
|
|
* @name set
|
|
|
|
|
* @memberOf Stack
|
|
|
|
|
* @param {string} key The key of the value to set.
|
|
|
|
|
* @param {*} value The value to set.
|
|
|
|
|
* @returns {Object} Returns the stack cache instance.
|
|
|
|
|
*/
|
|
|
|
|
function stackSet(key, value) {
|
|
|
|
|
var cache = this.__data__;
|
|
|
|
|
if (cache instanceof ListCache) {
|
|
|
|
|
var pairs = cache.__data__;
|
|
|
|
|
if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
|
|
|
|
|
pairs.push([key, value]);
|
|
|
|
|
return this;
|
|
|
|
|
}
|
|
|
|
|
cache = this.__data__ = new MapCache(pairs);
|
|
|
|
|
}
|
|
|
|
|
cache.set(key, value);
|
|
|
|
|
return this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Add methods to `Stack`.
|
|
|
|
|
Stack.prototype.clear = stackClear;
|
|
|
|
|
Stack.prototype['delete'] = stackDelete;
|
|
|
|
|
Stack.prototype.get = stackGet;
|
|
|
|
|
Stack.prototype.has = stackHas;
|
|
|
|
|
Stack.prototype.set = stackSet;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Creates an array of the enumerable property names of the array-like `value`.
|
|
|
|
|
*
|
|
|
|
|
* @private
|
|
|
|
|
* @param {*} value The value to query.
|
|
|
|
|
* @param {boolean} inherited Specify returning inherited property names.
|
|
|
|
|
* @returns {Array} Returns the array of property names.
|
|
|
|
|
*/
|
|
|
|
|
function arrayLikeKeys(value, inherited) {
|
|
|
|
|
// Safari 8.1 makes `arguments.callee` enumerable in strict mode.
|
|
|
|
|
// Safari 9 makes `arguments.length` enumerable in strict mode.
|
|
|
|
|
var result = (isArray(value) || isArguments(value))
|
|
|
|
|
? baseTimes(value.length, String)
|
|
|
|
|
: [];
|
|
|
|
|
|
|
|
|
|
var length = result.length,
|
|
|
|
|
skipIndexes = !!length;
|
|
|
|
|
|
|
|
|
|
for (var key in value) {
|
|
|
|
|
if ((inherited || hasOwnProperty.call(value, key)) &&
|
|
|
|
|
!(skipIndexes && (key == 'length' || isIndex(key, length)))) {
|
|
|
|
|
result.push(key);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Gets the index at which the `key` is found in `array` of key-value pairs.
|
|
|
|
|
*
|
|
|
|
|
* @private
|
|
|
|
|
* @param {Array} array The array to inspect.
|
|
|
|
|
* @param {*} key The key to search for.
|
|
|
|
|
* @returns {number} Returns the index of the matched value, else `-1`.
|
|
|
|
|
*/
|
|
|
|
|
function assocIndexOf(array, key) {
|
|
|
|
|
var length = array.length;
|
|
|
|
|
while (length--) {
|
|
|
|
|
if (eq(array[length][0], key)) {
|
|
|
|
|
return length;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Aggregates elements of `collection` on `accumulator` with keys transformed
|
|
|
|
|
* by `iteratee` and values set by `setter`.
|
|
|
|
|
*
|
|
|
|
|
* @private
|
|
|
|
|
* @param {Array|Object} collection The collection to iterate over.
|
|
|
|
|
* @param {Function} setter The function to set `accumulator` values.
|
|
|
|
|
* @param {Function} iteratee The iteratee to transform keys.
|
|
|
|
|
* @param {Object} accumulator The initial aggregated object.
|
|
|
|
|
* @returns {Function} Returns `accumulator`.
|
|
|
|
|
*/
|
|
|
|
|
function baseAggregator(collection, setter, iteratee, accumulator) {
|
|
|
|
|
baseEach(collection, function(value, key, collection) {
|
|
|
|
|
setter(accumulator, value, iteratee(value), collection);
|
|
|
|
|
});
|
|
|
|
|
return accumulator;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The base implementation of `_.forEach` without support for iteratee shorthands.
|
|
|
|
|
*
|
|
|
|
|
* @private
|
|
|
|
|
* @param {Array|Object} collection The collection to iterate over.
|
|
|
|
|
* @param {Function} iteratee The function invoked per iteration.
|
|
|
|
|
* @returns {Array|Object} Returns `collection`.
|
|
|
|
|
*/
|
|
|
|
|
var baseEach = createBaseEach(baseForOwn);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The base implementation of `baseForOwn` which iterates over `object`
|
|
|
|
|
* properties returned by `keysFunc` and invokes `iteratee` for each property.
|
|
|
|
|
* Iteratee functions may exit iteration early by explicitly returning `false`.
|
|
|
|
|
*
|
|
|
|
|
* @private
|
|
|
|
|
* @param {Object} object The object to iterate over.
|
|
|
|
|
* @param {Function} iteratee The function invoked per iteration.
|
|
|
|
|
* @param {Function} keysFunc The function to get the keys of `object`.
|
|
|
|
|
* @returns {Object} Returns `object`.
|
|
|
|
|
*/
|
|
|
|
|
var baseFor = createBaseFor();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The base implementation of `_.forOwn` without support for iteratee shorthands.
|
|
|
|
|
*
|
|
|
|
|
* @private
|
|
|
|
|
* @param {Object} object The object to iterate over.
|
|
|
|
|
* @param {Function} iteratee The function invoked per iteration.
|
|
|
|
|
* @returns {Object} Returns `object`.
|
|
|
|
|
*/
|
|
|
|
|
function baseForOwn(object, iteratee) {
|
|
|
|
|
return object && baseFor(object, iteratee, keys);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The base implementation of `_.get` without support for default values.
|
|
|
|
|
*
|
|
|
|
|
* @private
|
|
|
|
|
* @param {Object} object The object to query.
|
|
|
|
|
* @param {Array|string} path The path of the property to get.
|
|
|
|
|
* @returns {*} Returns the resolved value.
|
|
|
|
|
*/
|
|
|
|
|
function baseGet(object, path) {
|
|
|
|
|
path = isKey(path, object) ? [path] : castPath(path);
|
|
|
|
|
|
|
|
|
|
var index = 0,
|
|
|
|
|
length = path.length;
|
|
|
|
|
|
|
|
|
|
while (object != null && index < length) {
|
|
|
|
|
object = object[toKey(path[index++])];
|
|
|
|
|
}
|
|
|
|
|
return (index && index == length) ? object : undefined;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The base implementation of `getTag`.
|
|
|
|
|
*
|
|
|
|
|
* @private
|
|
|
|
|
* @param {*} value The value to query.
|
|
|
|
|
* @returns {string} Returns the `toStringTag`.
|
|
|
|
|
*/
|
|
|
|
|
function baseGetTag(value) {
|
|
|
|
|
return objectToString.call(value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The base implementation of `_.hasIn` without support for deep paths.
|
|
|
|
|
*
|
|
|
|
|
* @private
|
|
|
|
|
* @param {Object} [object] The object to query.
|
|
|
|
|
* @param {Array|string} key The key to check.
|
|
|
|
|
* @returns {boolean} Returns `true` if `key` exists, else `false`.
|
|
|
|
|
*/
|
|
|
|
|
function baseHasIn(object, key) {
|
|
|
|
|
return object != null && key in Object(object);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The base implementation of `_.isEqual` which supports partial comparisons
|
|
|
|
|
* and tracks traversed objects.
|
|
|
|
|
*
|
|
|
|
|
* @private
|
|
|
|
|
* @param {*} value The value to compare.
|
|
|
|
|
* @param {*} other The other value to compare.
|
|
|
|
|
* @param {Function} [customizer] The function to customize comparisons.
|
|
|
|
|
* @param {boolean} [bitmask] The bitmask of comparison flags.
|
|
|
|
|
* The bitmask may be composed of the following flags:
|
|
|
|
|
* 1 - Unordered comparison
|
|
|
|
|
* 2 - Partial comparison
|
|
|
|
|
* @param {Object} [stack] Tracks traversed `value` and `other` objects.
|
|
|
|
|
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
|
|
|
|
|
*/
|
|
|
|
|
function baseIsEqual(value, other, customizer, bitmask, stack) {
|
|
|
|
|
if (value === other) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
if (value == null || other == null || (!isObject(value) && !isObjectLike(other))) {
|
|
|
|
|
return value !== value && other !== other;
|
|
|
|
|
}
|
|
|
|
|
return baseIsEqualDeep(value, other, baseIsEqual, customizer, bitmask, stack);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* A specialized version of `baseIsEqual` for arrays and objects which performs
|
|
|
|
|
* deep comparisons and tracks traversed objects enabling objects with circular
|
|
|
|
|
* references to be compared.
|
|
|
|
|
*
|
|
|
|
|
* @private
|
|
|
|
|
* @param {Object} object The object to compare.
|
|
|
|
|
* @param {Object} other The other object to compare.
|
|
|
|
|
* @param {Function} equalFunc The function to determine equivalents of values.
|
|
|
|
|
* @param {Function} [customizer] The function to customize comparisons.
|
|
|
|
|
* @param {number} [bitmask] The bitmask of comparison flags. See `baseIsEqual`
|
|
|
|
|
* for more details.
|
|
|
|
|
* @param {Object} [stack] Tracks traversed `object` and `other` objects.
|
|
|
|
|
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
|
|
|
|
|
*/
|
|
|
|
|
function baseIsEqualDeep(object, other, equalFunc, customizer, bitmask, stack) {
|
|
|
|
|
var objIsArr = isArray(object),
|
|
|
|
|
othIsArr = isArray(other),
|
|
|
|
|
objTag = arrayTag,
|
|
|
|
|
othTag = arrayTag;
|
|
|
|
|
|
|
|
|
|
if (!objIsArr) {
|
|
|
|
|
objTag = getTag(object);
|
|
|
|
|
objTag = objTag == argsTag ? objectTag : objTag;
|
|
|
|
|
}
|
|
|
|
|
if (!othIsArr) {
|
|
|
|
|
othTag = getTag(other);
|
|
|
|
|
othTag = othTag == argsTag ? objectTag : othTag;
|
|
|
|
|
}
|
|
|
|
|
var objIsObj = objTag == objectTag && !isHostObject(object),
|
|
|
|
|
othIsObj = othTag == objectTag && !isHostObject(other),
|
|
|
|
|
isSameTag = objTag == othTag;
|
|
|
|
|
|
|
|
|
|
if (isSameTag && !objIsObj) {
|
|
|
|
|
stack || (stack = new Stack);
|
|
|
|
|
return (objIsArr || isTypedArray(object))
|
|
|
|
|
? equalArrays(object, other, equalFunc, customizer, bitmask, stack)
|
|
|
|
|
: equalByTag(object, other, objTag, equalFunc, customizer, bitmask, stack);
|
|
|
|
|
}
|
|
|
|
|
if (!(bitmask & PARTIAL_COMPARE_FLAG)) {
|
|
|
|
|
var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
|
|
|
|
|
othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
|
|
|
|
|
|
|
|
|
|
if (objIsWrapped || othIsWrapped) {
|
|
|
|
|
var objUnwrapped = objIsWrapped ? object.value() : object,
|
|
|
|
|
othUnwrapped = othIsWrapped ? other.value() : other;
|
|
|
|
|
|
|
|
|
|
stack || (stack = new Stack);
|
|
|
|
|
return equalFunc(objUnwrapped, othUnwrapped, customizer, bitmask, stack);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (!isSameTag) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
stack || (stack = new Stack);
|
|
|
|
|
return equalObjects(object, other, equalFunc, customizer, bitmask, stack);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The base implementation of `_.isMatch` without support for iteratee shorthands.
|
|
|
|
|
*
|
|
|
|
|
* @private
|
|
|
|
|
* @param {Object} object The object to inspect.
|
|
|
|
|
* @param {Object} source The object of property values to match.
|
|
|
|
|
* @param {Array} matchData The property names, values, and compare flags to match.
|
|
|
|
|
* @param {Function} [customizer] The function to customize comparisons.
|
|
|
|
|
* @returns {boolean} Returns `true` if `object` is a match, else `false`.
|
|
|
|
|
*/
|
|
|
|
|
function baseIsMatch(object, source, matchData, customizer) {
|
|
|
|
|
var index = matchData.length,
|
|
|
|
|
length = index,
|
|
|
|
|
noCustomizer = !customizer;
|
|
|
|
|
|
|
|
|
|
if (object == null) {
|
|
|
|
|
return !length;
|
|
|
|
|
}
|
|
|
|
|
object = Object(object);
|
|
|
|
|
while (index--) {
|
|
|
|
|
var data = matchData[index];
|
|
|
|
|
if ((noCustomizer && data[2])
|
|
|
|
|
? data[1] !== object[data[0]]
|
|
|
|
|
: !(data[0] in object)
|
|
|
|
|
) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
while (++index < length) {
|
|
|
|
|
data = matchData[index];
|
|
|
|
|
var key = data[0],
|
|
|
|
|
objValue = object[key],
|
|
|
|
|
srcValue = data[1];
|
|
|
|
|
|
|
|
|
|
if (noCustomizer && data[2]) {
|
|
|
|
|
if (objValue === undefined && !(key in object)) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
var stack = new Stack;
|
|
|
|
|
if (customizer) {
|
|
|
|
|
var result = customizer(objValue, srcValue, key, object, source, stack);
|
|
|
|
|
}
|
|
|
|
|
if (!(result === undefined
|
|
|
|
|
? baseIsEqual(srcValue, objValue, customizer, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG, stack)
|
|
|
|
|
: result
|
|
|
|
|
)) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The base implementation of `_.isNative` without bad shim checks.
|
|
|
|
|
*
|
|
|
|
|
* @private
|
|
|
|
|
* @param {*} value The value to check.
|
|
|
|
|
* @returns {boolean} Returns `true` if `value` is a native function,
|
|
|
|
|
* else `false`.
|
|
|
|
|
*/
|
|
|
|
|
function baseIsNative(value) {
|
|
|
|
|
if (!isObject(value) || isMasked(value)) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor;
|
|
|
|
|
return pattern.test(toSource(value));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The base implementation of `_.isTypedArray` without Node.js optimizations.
|
|
|
|
|
*
|
|
|
|
|
* @private
|
|
|
|
|
* @param {*} value The value to check.
|
|
|
|
|
* @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
|
|
|
|
|
*/
|
|
|
|
|
function baseIsTypedArray(value) {
|
|
|
|
|
return isObjectLike(value) &&
|
|
|
|
|
isLength(value.length) && !!typedArrayTags[objectToString.call(value)];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The base implementation of `_.iteratee`.
|
|
|
|
|
*
|
|
|
|
|
* @private
|
|
|
|
|
* @param {*} [value=_.identity] The value to convert to an iteratee.
|
|
|
|
|
* @returns {Function} Returns the iteratee.
|
|
|
|
|
*/
|
|
|
|
|
function baseIteratee(value) {
|
|
|
|
|
// Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
|
|
|
|
|
// See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
|
|
|
|
|
if (typeof value == 'function') {
|
|
|
|
|
return value;
|
|
|
|
|
}
|
|
|
|
|
if (value == null) {
|
|
|
|
|
return identity;
|
|
|
|
|
}
|
|
|
|
|
if (typeof value == 'object') {
|
|
|
|
|
return isArray(value)
|
|
|
|
|
? baseMatchesProperty(value[0], value[1])
|
|
|
|
|
: baseMatches(value);
|
|
|
|
|
}
|
|
|
|
|
return property(value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
|
|
|
|
|
*
|
|
|
|
|
* @private
|
|
|
|
|
* @param {Object} object The object to query.
|
|
|
|
|
* @returns {Array} Returns the array of property names.
|
|
|
|
|
*/
|
|
|
|
|
function baseKeys(object) {
|
|
|
|
|
if (!isPrototype(object)) {
|
|
|
|
|
return nativeKeys(object);
|
|
|
|
|
}
|
|
|
|
|
var result = [];
|
|
|
|
|
for (var key in Object(object)) {
|
|
|
|
|
if (hasOwnProperty.call(object, key) && key != 'constructor') {
|
|
|
|
|
result.push(key);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The base implementation of `_.matches` which doesn't clone `source`.
|
|
|
|
|
*
|
|
|
|
|
* @private
|
|
|
|
|
* @param {Object} source The object of property values to match.
|
|
|
|
|
* @returns {Function} Returns the new spec function.
|
|
|
|
|
*/
|
|
|
|
|
function baseMatches(source) {
|
|
|
|
|
var matchData = getMatchData(source);
|
|
|
|
|
if (matchData.length == 1 && matchData[0][2]) {
|
|
|
|
|
return matchesStrictComparable(matchData[0][0], matchData[0][1]);
|
|
|
|
|
}
|
|
|
|
|
return function(object) {
|
|
|
|
|
return object === source || baseIsMatch(object, source, matchData);
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
|
|
|
|
|
*
|
|
|
|
|
* @private
|
|
|
|
|
* @param {string} path The path of the property to get.
|
|
|
|
|
* @param {*} srcValue The value to match.
|
|
|
|
|
* @returns {Function} Returns the new spec function.
|
|
|
|
|
*/
|
|
|
|
|
function baseMatchesProperty(path, srcValue) {
|
|
|
|
|
if (isKey(path) && isStrictComparable(srcValue)) {
|
|
|
|
|
return matchesStrictComparable(toKey(path), srcValue);
|
|
|
|
|
}
|
|
|
|
|
return function(object) {
|
|
|
|
|
var objValue = get(object, path);
|
|
|
|
|
return (objValue === undefined && objValue === srcValue)
|
|
|
|
|
? hasIn(object, path)
|
|
|
|
|
: baseIsEqual(srcValue, objValue, undefined, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG);
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* A specialized version of `baseProperty` which supports deep paths.
|
|
|
|
|
*
|
|
|
|
|
* @private
|
|
|
|
|
* @param {Array|string} path The path of the property to get.
|
|
|
|
|
* @returns {Function} Returns the new accessor function.
|
|
|
|
|
*/
|
|
|
|
|
function basePropertyDeep(path) {
|
|
|
|
|
return function(object) {
|
|
|
|
|
return baseGet(object, path);
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The base implementation of `_.toString` which doesn't convert nullish
|
|
|
|
|
* values to empty strings.
|
|
|
|
|
*
|
|
|
|
|
* @private
|
|
|
|
|
* @param {*} value The value to process.
|
|
|
|
|
* @returns {string} Returns the string.
|
|
|
|
|
*/
|
|
|
|
|
function baseToString(value) {
|
|
|
|
|
// Exit early for strings to avoid a performance hit in some environments.
|
|
|
|
|
if (typeof value == 'string') {
|
|
|
|
|
return value;
|
|
|
|
|
}
|
|
|
|
|
if (isSymbol(value)) {
|
|
|
|
|
return symbolToString ? symbolToString.call(value) : '';
|
|
|
|
|
}
|
|
|
|
|
var result = (value + '');
|
|
|
|
|
return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Casts `value` to a path array if it's not one.
|
|
|
|
|
*
|
|
|
|
|
* @private
|
|
|
|
|
* @param {*} value The value to inspect.
|
|
|
|
|
* @returns {Array} Returns the cast property path array.
|
|
|
|
|
*/
|
|
|
|
|
function castPath(value) {
|
|
|
|
|
return isArray(value) ? value : stringToPath(value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Creates a function like `_.groupBy`.
|
|
|
|
|
*
|
|
|
|
|
* @private
|
|
|
|
|
* @param {Function} setter The function to set accumulator values.
|
|
|
|
|
* @param {Function} [initializer] The accumulator object initializer.
|
|
|
|
|
* @returns {Function} Returns the new aggregator function.
|
|
|
|
|
*/
|
|
|
|
|
function createAggregator(setter, initializer) {
|
|
|
|
|
return function(collection, iteratee) {
|
|
|
|
|
var func = isArray(collection) ? arrayAggregator : baseAggregator,
|
|
|
|
|
accumulator = initializer ? initializer() : {};
|
|
|
|
|
|
|
|
|
|
return func(collection, setter, baseIteratee(iteratee), accumulator);
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Creates a `baseEach` or `baseEachRight` function.
|
|
|
|
|
*
|
|
|
|
|
* @private
|
|
|
|
|
* @param {Function} eachFunc The function to iterate over a collection.
|
|
|
|
|
* @param {boolean} [fromRight] Specify iterating from right to left.
|
|
|
|
|
* @returns {Function} Returns the new base function.
|
|
|
|
|
*/
|
|
|
|
|
function createBaseEach(eachFunc, fromRight) {
|
|
|
|
|
return function(collection, iteratee) {
|
|
|
|
|
if (collection == null) {
|
|
|
|
|
return collection;
|
|
|
|
|
}
|
|
|
|
|
if (!isArrayLike(collection)) {
|
|
|
|
|
return eachFunc(collection, iteratee);
|
|
|
|
|
}
|
|
|
|
|
var length = collection.length,
|
|
|
|
|
index = fromRight ? length : -1,
|
|
|
|
|
iterable = Object(collection);
|
|
|
|
|
|
|
|
|
|
while ((fromRight ? index-- : ++index < length)) {
|
|
|
|
|
if (iteratee(iterable[index], index, iterable) === false) {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return collection;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Creates a base function for methods like `_.forIn` and `_.forOwn`.
|
|
|
|
|
*
|
|
|
|
|
* @private
|
|
|
|
|
* @param {boolean} [fromRight] Specify iterating from right to left.
|
|
|
|
|
* @returns {Function} Returns the new base function.
|
|
|
|
|
*/
|
|
|
|
|
function createBaseFor(fromRight) {
|
|
|
|
|
return function(object, iteratee, keysFunc) {
|
|
|
|
|
var index = -1,
|
|
|
|
|
iterable = Object(object),
|
|
|
|
|
props = keysFunc(object),
|
|
|
|
|
length = props.length;
|
|
|
|
|
|
|
|
|
|
while (length--) {
|
|
|
|
|
var key = props[fromRight ? length : ++index];
|
|
|
|
|
if (iteratee(iterable[key], key, iterable) === false) {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return object;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* A specialized version of `baseIsEqualDeep` for arrays with support for
|
|
|
|
|
* partial deep comparisons.
|
|
|
|
|
*
|
|
|
|
|
* @private
|
|
|
|
|
* @param {Array} array The array to compare.
|
|
|
|
|
* @param {Array} other The other array to compare.
|
|
|
|
|
* @param {Function} equalFunc The function to determine equivalents of values.
|
|
|
|
|
* @param {Function} customizer The function to customize comparisons.
|
|
|
|
|
* @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual`
|
|
|
|
|
* for more details.
|
|
|
|
|
* @param {Object} stack Tracks traversed `array` and `other` objects.
|
|
|
|
|
* @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
|
|
|
|
|
*/
|
|
|
|
|
function equalArrays(array, other, equalFunc, customizer, bitmask, stack) {
|
|
|
|
|
var isPartial = bitmask & PARTIAL_COMPARE_FLAG,
|
|
|
|
|
arrLength = array.length,
|
|
|
|
|
othLength = other.length;
|
|
|
|
|
|
|
|
|
|
if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
// Assume cyclic values are equal.
|
|
|
|
|
var stacked = stack.get(array);
|
|
|
|
|
if (stacked && stack.get(other)) {
|
|
|
|
|
return stacked == other;
|
|
|
|
|
}
|
|
|
|
|
var index = -1,
|
|
|
|
|
result = true,
|
|
|
|
|
seen = (bitmask & UNORDERED_COMPARE_FLAG) ? new SetCache : undefined;
|
|
|
|
|
|
|
|
|
|
stack.set(array, other);
|
|
|
|
|
stack.set(other, array);
|
|
|
|
|
|
|
|
|
|
// Ignore non-index properties.
|
|
|
|
|
while (++index < arrLength) {
|
|
|
|
|
var arrValue = array[index],
|
|
|
|
|
othValue = other[index];
|
|
|
|
|
|
|
|
|
|
if (customizer) {
|
|
|
|
|
var compared = isPartial
|
|
|
|
|
? customizer(othValue, arrValue, index, other, array, stack)
|
|
|
|
|
: customizer(arrValue, othValue, index, array, other, stack);
|
|
|
|
|
}
|
|
|
|
|
if (compared !== undefined) {
|
|
|
|
|
if (compared) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
result = false;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
// Recursively compare arrays (susceptible to call stack limits).
|
|
|
|
|
if (seen) {
|
|
|
|
|
if (!arraySome(other, function(othValue, othIndex) {
|
|
|
|
|
if (!seen.has(othIndex) &&
|
|
|
|
|
(arrValue === othValue || equalFunc(arrValue, othValue, customizer, bitmask, stack))) {
|
|
|
|
|
return seen.add(othIndex);
|
|
|
|
|
}
|
|
|
|
|
})) {
|
|
|
|
|
result = false;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
} else if (!(
|
|
|
|
|
arrValue === othValue ||
|
|
|
|
|
equalFunc(arrValue, othValue, customizer, bitmask, stack)
|
|
|
|
|
)) {
|
|
|
|
|
result = false;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
stack['delete'](array);
|
|
|
|
|
stack['delete'](other);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* A specialized version of `baseIsEqualDeep` for comparing objects of
|
|
|
|
|
* the same `toStringTag`.
|
|
|
|
|
*
|
|
|
|
|
* **Note:** This function only supports comparing values with tags of
|
|
|
|
|
* `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
|
|
|
|
|
*
|
|
|
|
|
* @private
|
|
|
|
|
* @param {Object} object The object to compare.
|
|
|
|
|
* @param {Object} other The other object to compare.
|
|
|
|
|
* @param {string} tag The `toStringTag` of the objects to compare.
|
|
|
|
|
* @param {Function} equalFunc The function to determine equivalents of values.
|
|
|
|
|
* @param {Function} customizer The function to customize comparisons.
|
|
|
|
|
* @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual`
|
|
|
|
|
* for more details.
|
|
|
|
|
* @param {Object} stack Tracks traversed `object` and `other` objects.
|
|
|
|
|
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
|
|
|
|
|
*/
|
|
|
|
|
function equalByTag(object, other, tag, equalFunc, customizer, bitmask, stack) {
|
|
|
|
|
switch (tag) {
|
|
|
|
|
case dataViewTag:
|
|
|
|
|
if ((object.byteLength != other.byteLength) ||
|
|
|
|
|
(object.byteOffset != other.byteOffset)) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
object = object.buffer;
|
|
|
|
|
other = other.buffer;
|
|
|
|
|
|
|
|
|
|
case arrayBufferTag:
|
|
|
|
|
if ((object.byteLength != other.byteLength) ||
|
|
|
|
|
!equalFunc(new Uint8Array(object), new Uint8Array(other))) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
case boolTag:
|
|
|
|
|
case dateTag:
|
|
|
|
|
case numberTag:
|
|
|
|
|
// Coerce booleans to `1` or `0` and dates to milliseconds.
|
|
|
|
|
// Invalid dates are coerced to `NaN`.
|
|
|
|
|
return eq(+object, +other);
|
|
|
|
|
|
|
|
|
|
case errorTag:
|
|
|
|
|
return object.name == other.name && object.message == other.message;
|
|
|
|
|
|
|
|
|
|
case regexpTag:
|
|
|
|
|
case stringTag:
|
|
|
|
|
// Coerce regexes to strings and treat strings, primitives and objects,
|
|
|
|
|
// as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
|
|
|
|
|
// for more details.
|
|
|
|
|
return object == (other + '');
|
|
|
|
|
|
|
|
|
|
case mapTag:
|
|
|
|
|
var convert = mapToArray;
|
|
|
|
|
|
|
|
|
|
case setTag:
|
|
|
|
|
var isPartial = bitmask & PARTIAL_COMPARE_FLAG;
|
|
|
|
|
convert || (convert = setToArray);
|
|
|
|
|
|
|
|
|
|
if (object.size != other.size && !isPartial) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
// Assume cyclic values are equal.
|
|
|
|
|
var stacked = stack.get(object);
|
|
|
|
|
if (stacked) {
|
|
|
|
|
return stacked == other;
|
|
|
|
|
}
|
|
|
|
|
bitmask |= UNORDERED_COMPARE_FLAG;
|
|
|
|
|
|
|
|
|
|
// Recursively compare objects (susceptible to call stack limits).
|
|
|
|
|
stack.set(object, other);
|
|
|
|
|
var result = equalArrays(convert(object), convert(other), equalFunc, customizer, bitmask, stack);
|
|
|
|
|
stack['delete'](object);
|
|
|
|
|
return result;
|
|
|
|
|
|
|
|
|
|
case symbolTag:
|
|
|
|
|
if (symbolValueOf) {
|
|
|
|
|
return symbolValueOf.call(object) == symbolValueOf.call(other);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* A specialized version of `baseIsEqualDeep` for objects with support for
|
|
|
|
|
* partial deep comparisons.
|
|
|
|
|
*
|
|
|
|
|
* @private
|
|
|
|
|
* @param {Object} object The object to compare.
|
|
|
|
|
* @param {Object} other The other object to compare.
|
|
|
|
|
* @param {Function} equalFunc The function to determine equivalents of values.
|
|
|
|
|
* @param {Function} customizer The function to customize comparisons.
|
|
|
|
|
* @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual`
|
|
|
|
|
* for more details.
|
|
|
|
|
* @param {Object} stack Tracks traversed `object` and `other` objects.
|
|
|
|
|
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
|
|
|
|
|
*/
|
|
|
|
|
function equalObjects(object, other, equalFunc, customizer, bitmask, stack) {
|
|
|
|
|
var isPartial = bitmask & PARTIAL_COMPARE_FLAG,
|
|
|
|
|
objProps = keys(object),
|
|
|
|
|
objLength = objProps.length,
|
|
|
|
|
othProps = keys(other),
|
|
|
|
|
othLength = othProps.length;
|
|
|
|
|
|
|
|
|
|
if (objLength != othLength && !isPartial) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
var index = objLength;
|
|
|
|
|
while (index--) {
|
|
|
|
|
var key = objProps[index];
|
|
|
|
|
if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// Assume cyclic values are equal.
|
|
|
|
|
var stacked = stack.get(object);
|
|
|
|
|
if (stacked && stack.get(other)) {
|
|
|
|
|
return stacked == other;
|
|
|
|
|
}
|
|
|
|
|
var result = true;
|
|
|
|
|
stack.set(object, other);
|
|
|
|
|
stack.set(other, object);
|
|
|
|
|
|
|
|
|
|
var skipCtor = isPartial;
|
|
|
|
|
while (++index < objLength) {
|
|
|
|
|
key = objProps[index];
|
|
|
|
|
var objValue = object[key],
|
|
|
|
|
othValue = other[key];
|
|
|
|
|
|
|
|
|
|
if (customizer) {
|
|
|
|
|
var compared = isPartial
|
|
|
|
|
? customizer(othValue, objValue, key, other, object, stack)
|
|
|
|
|
: customizer(objValue, othValue, key, object, other, stack);
|
|
|
|
|
}
|
|
|
|
|
// Recursively compare objects (susceptible to call stack limits).
|
|
|
|
|
if (!(compared === undefined
|
|
|
|
|
? (objValue === othValue || equalFunc(objValue, othValue, customizer, bitmask, stack))
|
|
|
|
|
: compared
|
|
|
|
|
)) {
|
|
|
|
|
result = false;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
skipCtor || (skipCtor = key == 'constructor');
|
|
|
|
|
}
|
|
|
|
|
if (result && !skipCtor) {
|
|
|
|
|
var objCtor = object.constructor,
|
|
|
|
|
othCtor = other.constructor;
|
|
|
|
|
|
|
|
|
|
// Non `Object` object instances with different constructors are not equal.
|
|
|
|
|
if (objCtor != othCtor &&
|
|
|
|
|
('constructor' in object && 'constructor' in other) &&
|
|
|
|
|
!(typeof objCtor == 'function' && objCtor instanceof objCtor &&
|
|
|
|
|
typeof othCtor == 'function' && othCtor instanceof othCtor)) {
|
|
|
|
|
result = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
stack['delete'](object);
|
|
|
|
|
stack['delete'](other);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Gets the data for `map`.
|
|
|
|
|
*
|
|
|
|
|
* @private
|
|
|
|
|
* @param {Object} map The map to query.
|
|
|
|
|
* @param {string} key The reference key.
|
|
|
|
|
* @returns {*} Returns the map data.
|
|
|
|
|
*/
|
|
|
|
|
function getMapData(map, key) {
|
|
|
|
|
var data = map.__data__;
|
|
|
|
|
return isKeyable(key)
|
|
|
|
|
? data[typeof key == 'string' ? 'string' : 'hash']
|
|
|
|
|
: data.map;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Gets the property names, values, and compare flags of `object`.
|
|
|
|
|
*
|
|
|
|
|
* @private
|
|
|
|
|
* @param {Object} object The object to query.
|
|
|
|
|
* @returns {Array} Returns the match data of `object`.
|
|
|
|
|
*/
|
|
|
|
|
function getMatchData(object) {
|
|
|
|
|
var result = keys(object),
|
|
|
|
|
length = result.length;
|
|
|
|
|
|
|
|
|
|
while (length--) {
|
|
|
|
|
var key = result[length],
|
|
|
|
|
value = object[key];
|
|
|
|
|
|
|
|
|
|
result[length] = [key, value, isStrictComparable(value)];
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Gets the native function at `key` of `object`.
|
|
|
|
|
*
|
|
|
|
|
* @private
|
|
|
|
|
* @param {Object} object The object to query.
|
|
|
|
|
* @param {string} key The key of the method to get.
|
|
|
|
|
* @returns {*} Returns the function if it's native, else `undefined`.
|
|
|
|
|
*/
|
|
|
|
|
function getNative(object, key) {
|
|
|
|
|
var value = getValue(object, key);
|
|
|
|
|
return baseIsNative(value) ? value : undefined;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Gets the `toStringTag` of `value`.
|
|
|
|
|
*
|
|
|
|
|
* @private
|
|
|
|
|
* @param {*} value The value to query.
|
|
|
|
|
* @returns {string} Returns the `toStringTag`.
|
|
|
|
|
*/
|
|
|
|
|
var getTag = baseGetTag;
|
|
|
|
|
|
|
|
|
|
// Fallback for data views, maps, sets, and weak maps in IE 11,
|
|
|
|
|
// for data views in Edge < 14, and promises in Node.js.
|
|
|
|
|
if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
|
|
|
|
|
(Map && getTag(new Map) != mapTag) ||
|
|
|
|
|
(Promise && getTag(Promise.resolve()) != promiseTag) ||
|
|
|
|
|
(Set && getTag(new Set) != setTag) ||
|
|
|
|
|
(WeakMap && getTag(new WeakMap) != weakMapTag)) {
|
|
|
|
|
getTag = function(value) {
|
|
|
|
|
var result = objectToString.call(value),
|
|
|
|
|
Ctor = result == objectTag ? value.constructor : undefined,
|
|
|
|
|
ctorString = Ctor ? toSource(Ctor) : undefined;
|
|
|
|
|
|
|
|
|
|
if (ctorString) {
|
|
|
|
|
switch (ctorString) {
|
|
|
|
|
case dataViewCtorString: return dataViewTag;
|
|
|
|
|
case mapCtorString: return mapTag;
|
|
|
|
|
case promiseCtorString: return promiseTag;
|
|
|
|
|
case setCtorString: return setTag;
|
|
|
|
|
case weakMapCtorString: return weakMapTag;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Checks if `path` exists on `object`.
|
|
|
|
|
*
|
|
|
|
|
* @private
|
|
|
|
|
* @param {Object} object The object to query.
|
|
|
|
|
* @param {Array|string} path The path to check.
|
|
|
|
|
* @param {Function} hasFunc The function to check properties.
|
|
|
|
|
* @returns {boolean} Returns `true` if `path` exists, else `false`.
|
|
|
|
|
*/
|
|
|
|
|
function hasPath(object, path, hasFunc) {
|
|
|
|
|
path = isKey(path, object) ? [path] : castPath(path);
|
|
|
|
|
|
|
|
|
|
var result,
|
|
|
|
|
index = -1,
|
|
|
|
|
length = path.length;
|
|
|
|
|
|
|
|
|
|
while (++index < length) {
|
|
|
|
|
var key = toKey(path[index]);
|
|
|
|
|
if (!(result = object != null && hasFunc(object, key))) {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
object = object[key];
|
|
|
|
|
}
|
|
|
|
|
if (result) {
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
var length = object ? object.length : 0;
|
|
|
|
|
return !!length && isLength(length) && isIndex(key, length) &&
|
|
|
|
|
(isArray(object) || isArguments(object));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Checks if `value` is a valid array-like index.
|
|
|
|
|
*
|
|
|
|
|
* @private
|
|
|
|
|
* @param {*} value The value to check.
|
|
|
|
|
* @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
|
|
|
|
|
* @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
|
|
|
|
|
*/
|
|
|
|
|
function isIndex(value, length) {
|
|
|
|
|
length = length == null ? MAX_SAFE_INTEGER : length;
|
|
|
|
|
return !!length &&
|
|
|
|
|
(typeof value == 'number' || reIsUint.test(value)) &&
|
|
|
|
|
(value > -1 && value % 1 == 0 && value < length);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Checks if `value` is a property name and not a property path.
|
|
|
|
|
*
|
|
|
|
|
* @private
|
|
|
|
|
* @param {*} value The value to check.
|
|
|
|
|
* @param {Object} [object] The object to query keys on.
|
|
|
|
|
* @returns {boolean} Returns `true` if `value` is a property name, else `false`.
|
|
|
|
|
*/
|
|
|
|
|
function isKey(value, object) {
|
|
|
|
|
if (isArray(value)) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
var type = typeof value;
|
|
|
|
|
if (type == 'number' || type == 'symbol' || type == 'boolean' ||
|
|
|
|
|
value == null || isSymbol(value)) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
|
|
|
|
|
(object != null && value in Object(object));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Checks if `value` is suitable for use as unique object key.
|
|
|
|
|
*
|
|
|
|
|
* @private
|
|
|
|
|
* @param {*} value The value to check.
|
|
|
|
|
* @returns {boolean} Returns `true` if `value` is suitable, else `false`.
|
|
|
|
|
*/
|
|
|
|
|
function isKeyable(value) {
|
|
|
|
|
var type = typeof value;
|
|
|
|
|
return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
|
|
|
|
|
? (value !== '__proto__')
|
|
|
|
|
: (value === null);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Checks if `func` has its source masked.
|
|
|
|
|
*
|
|
|
|
|
* @private
|
|
|
|
|
* @param {Function} func The function to check.
|
|
|
|
|
* @returns {boolean} Returns `true` if `func` is masked, else `false`.
|
|
|
|
|
*/
|
|
|
|
|
function isMasked(func) {
|
|
|
|
|
return !!maskSrcKey && (maskSrcKey in func);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Checks if `value` is likely a prototype object.
|
|
|
|
|
*
|
|
|
|
|
* @private
|
|
|
|
|
* @param {*} value The value to check.
|
|
|
|
|
* @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
|
|
|
|
|
*/
|
|
|
|
|
function isPrototype(value) {
|
|
|
|
|
var Ctor = value && value.constructor,
|
|
|
|
|
proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
|
|
|
|
|
|
|
|
|
|
return value === proto;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
|
|
|
|
|
*
|
|
|
|
|
* @private
|
|
|
|
|
* @param {*} value The value to check.
|
|
|
|
|
* @returns {boolean} Returns `true` if `value` if suitable for strict
|
|
|
|
|
* equality comparisons, else `false`.
|
|
|
|
|
*/
|
|
|
|
|
function isStrictComparable(value) {
|
|
|
|
|
return value === value && !isObject(value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* A specialized version of `matchesProperty` for source values suitable
|
|
|
|
|
* for strict equality comparisons, i.e. `===`.
|
|
|
|
|
*
|
|
|
|
|
* @private
|
|
|
|
|
* @param {string} key The key of the property to get.
|
|
|
|
|
* @param {*} srcValue The value to match.
|
|
|
|
|
* @returns {Function} Returns the new spec function.
|
|
|
|
|
*/
|
|
|
|
|
function matchesStrictComparable(key, srcValue) {
|
|
|
|
|
return function(object) {
|
|
|
|
|
if (object == null) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return object[key] === srcValue &&
|
|
|
|
|
(srcValue !== undefined || (key in Object(object)));
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Converts `string` to a property path array.
|
|
|
|
|
*
|
|
|
|
|
* @private
|
|
|
|
|
* @param {string} string The string to convert.
|
|
|
|
|
* @returns {Array} Returns the property path array.
|
|
|
|
|
*/
|
|
|
|
|
var stringToPath = memoize(function(string) {
|
|
|
|
|
string = toString(string);
|
|
|
|
|
|
|
|
|
|
var result = [];
|
|
|
|
|
if (reLeadingDot.test(string)) {
|
|
|
|
|
result.push('');
|
|
|
|
|
}
|
|
|
|
|
string.replace(rePropName, function(match, number, quote, string) {
|
|
|
|
|
result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match));
|
|
|
|
|
});
|
|
|
|
|
return result;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Converts `value` to a string key if it's not a string or symbol.
|
|
|
|
|
*
|
|
|
|
|
* @private
|
|
|
|
|
* @param {*} value The value to inspect.
|
|
|
|
|
* @returns {string|symbol} Returns the key.
|
|
|
|
|
*/
|
|
|
|
|
function toKey(value) {
|
|
|
|
|
if (typeof value == 'string' || isSymbol(value)) {
|
|
|
|
|
return value;
|
|
|
|
|
}
|
|
|
|
|
var result = (value + '');
|
|
|
|
|
return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Converts `func` to its source code.
|
|
|
|
|
*
|
|
|
|
|
* @private
|
|
|
|
|
* @param {Function} func The function to process.
|
|
|
|
|
* @returns {string} Returns the source code.
|
|
|
|
|
*/
|
|
|
|
|
function toSource(func) {
|
|
|
|
|
if (func != null) {
|
|
|
|
|
try {
|
|
|
|
|
return funcToString.call(func);
|
|
|
|
|
} catch (e) {}
|
|
|
|
|
try {
|
|
|
|
|
return (func + '');
|
|
|
|
|
} catch (e) {}
|
|
|
|
|
}
|
|
|
|
|
return '';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Creates an object composed of keys generated from the results of running
|
|
|
|
|
* each element of `collection` thru `iteratee`. The order of grouped values
|
|
|
|
|
* is determined by the order they occur in `collection`. The corresponding
|
|
|
|
|
* value of each key is an array of elements responsible for generating the
|
|
|
|
|
* key. The iteratee is invoked with one argument: (value).
|
|
|
|
|
*
|
|
|
|
|
* @static
|
|
|
|
|
* @memberOf _
|
|
|
|
|
* @since 0.1.0
|
|
|
|
|
* @category Collection
|
|
|
|
|
* @param {Array|Object} collection The collection to iterate over.
|
|
|
|
|
* @param {Function} [iteratee=_.identity]
|
|
|
|
|
* The iteratee to transform keys.
|
|
|
|
|
* @returns {Object} Returns the composed aggregate object.
|
|
|
|
|
* @example
|
|
|
|
|
*
|
|
|
|
|
* _.groupBy([6.1, 4.2, 6.3], Math.floor);
|
|
|
|
|
* // => { '4': [4.2], '6': [6.1, 6.3] }
|
|
|
|
|
*
|
|
|
|
|
* // The `_.property` iteratee shorthand.
|
|
|
|
|
* _.groupBy(['one', 'two', 'three'], 'length');
|
|
|
|
|
* // => { '3': ['one', 'two'], '5': ['three'] }
|
|
|
|
|
*/
|
|
|
|
|
var groupBy = createAggregator(function(result, value, key) {
|
|
|
|
|
if (hasOwnProperty.call(result, key)) {
|
|
|
|
|
result[key].push(value);
|
|
|
|
|
} else {
|
|
|
|
|
result[key] = [value];
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Creates a function that memoizes the result of `func`. If `resolver` is
|
|
|
|
|
* provided, it determines the cache key for storing the result based on the
|
|
|
|
|
* arguments provided to the memoized function. By default, the first argument
|
|
|
|
|
* provided to the memoized function is used as the map cache key. The `func`
|
|
|
|
|
* is invoked with the `this` binding of the memoized function.
|
|
|
|
|
*
|
|
|
|
|
* **Note:** The cache is exposed as the `cache` property on the memoized
|
|
|
|
|
* function. Its creation may be customized by replacing the `_.memoize.Cache`
|
|
|
|
|
* constructor with one whose instances implement the
|
|
|
|
|
* [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
|
|
|
|
|
* method interface of `delete`, `get`, `has`, and `set`.
|
|
|
|
|
*
|
|
|
|
|
* @static
|
|
|
|
|
* @memberOf _
|
|
|
|
|
* @since 0.1.0
|
|
|
|
|
* @category Function
|
|
|
|
|
* @param {Function} func The function to have its output memoized.
|
|
|
|
|
* @param {Function} [resolver] The function to resolve the cache key.
|
|
|
|
|
* @returns {Function} Returns the new memoized function.
|
|
|
|
|
* @example
|
|
|
|
|
*
|
|
|
|
|
* var object = { 'a': 1, 'b': 2 };
|
|
|
|
|
* var other = { 'c': 3, 'd': 4 };
|
|
|
|
|
*
|
|
|
|
|
* var values = _.memoize(_.values);
|
|
|
|
|
* values(object);
|
|
|
|
|
* // => [1, 2]
|
|
|
|
|
*
|
|
|
|
|
* values(other);
|
|
|
|
|
* // => [3, 4]
|
|
|
|
|
*
|
|
|
|
|
* object.a = 2;
|
|
|
|
|
* values(object);
|
|
|
|
|
* // => [1, 2]
|
|
|
|
|
*
|
|
|
|
|
* // Modify the result cache.
|
|
|
|
|
* values.cache.set(object, ['a', 'b']);
|
|
|
|
|
* values(object);
|
|
|
|
|
* // => ['a', 'b']
|
|
|
|
|
*
|
|
|
|
|
* // Replace `_.memoize.Cache`.
|
|
|
|
|
* _.memoize.Cache = WeakMap;
|
|
|
|
|
*/
|
|
|
|
|
function memoize(func, resolver) {
|
|
|
|
|
if (typeof func != 'function' || (resolver && typeof resolver != 'function')) {
|
|
|
|
|
throw new TypeError(FUNC_ERROR_TEXT);
|
|
|
|
|
}
|
|
|
|
|
var memoized = function() {
|
|
|
|
|
var args = arguments,
|
|
|
|
|
key = resolver ? resolver.apply(this, args) : args[0],
|
|
|
|
|
cache = memoized.cache;
|
|
|
|
|
|
|
|
|
|
if (cache.has(key)) {
|
|
|
|
|
return cache.get(key);
|
|
|
|
|
}
|
|
|
|
|
var result = func.apply(this, args);
|
|
|
|
|
memoized.cache = cache.set(key, result);
|
|
|
|
|
return result;
|
|
|
|
|
};
|
|
|
|
|
memoized.cache = new (memoize.Cache || MapCache);
|
|
|
|
|
return memoized;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Assign cache to `_.memoize`.
|
|
|
|
|
memoize.Cache = MapCache;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Performs a
|
|
|
|
|
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
|
|
|
|
* comparison between two values to determine if they are equivalent.
|
|
|
|
|
*
|
|
|
|
|
* @static
|
|
|
|
|
* @memberOf _
|
|
|
|
|
* @since 4.0.0
|
|
|
|
|
* @category Lang
|
|
|
|
|
* @param {*} value The value to compare.
|
|
|
|
|
* @param {*} other The other value to compare.
|
|
|
|
|
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
|
|
|
|
|
* @example
|
|
|
|
|
*
|
|
|
|
|
* var object = { 'a': 1 };
|
|
|
|
|
* var other = { 'a': 1 };
|
|
|
|
|
*
|
|
|
|
|
* _.eq(object, object);
|
|
|
|
|
* // => true
|
|
|
|
|
*
|
|
|
|
|
* _.eq(object, other);
|
|
|
|
|
* // => false
|
|
|
|
|
*
|
|
|
|
|
* _.eq('a', 'a');
|
|
|
|
|
* // => true
|
|
|
|
|
*
|
|
|
|
|
* _.eq('a', Object('a'));
|
|
|
|
|
* // => false
|
|
|
|
|
*
|
|
|
|
|
* _.eq(NaN, NaN);
|
|
|
|
|
* // => true
|
|
|
|
|
*/
|
|
|
|
|
function eq(value, other) {
|
|
|
|
|
return value === other || (value !== value && other !== other);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Checks if `value` is likely an `arguments` object.
|
|
|
|
|
*
|
|
|
|
|
* @static
|
|
|
|
|
* @memberOf _
|
|
|
|
|
* @since 0.1.0
|
|
|
|
|
* @category Lang
|
|
|
|
|
* @param {*} value The value to check.
|
|
|
|
|
* @returns {boolean} Returns `true` if `value` is an `arguments` object,
|
|
|
|
|
* else `false`.
|
|
|
|
|
* @example
|
|
|
|
|
*
|
|
|
|
|
* _.isArguments(function() { return arguments; }());
|
|
|
|
|
* // => true
|
|
|
|
|
*
|
|
|
|
|
* _.isArguments([1, 2, 3]);
|
|
|
|
|
* // => false
|
|
|
|
|
*/
|
|
|
|
|
function isArguments(value) {
|
|
|
|
|
// Safari 8.1 makes `arguments.callee` enumerable in strict mode.
|
|
|
|
|
return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') &&
|
|
|
|
|
(!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Checks if `value` is classified as an `Array` object.
|
|
|
|
|
*
|
|
|
|
|
* @static
|
|
|
|
|
* @memberOf _
|
|
|
|
|
* @since 0.1.0
|
|
|
|
|
* @category Lang
|
|
|
|
|
* @param {*} value The value to check.
|
|
|
|
|
* @returns {boolean} Returns `true` if `value` is an array, else `false`.
|
|
|
|
|
* @example
|
|
|
|
|
*
|
|
|
|
|
* _.isArray([1, 2, 3]);
|
|
|
|
|
* // => true
|
|
|
|
|
*
|
|
|
|
|
* _.isArray(document.body.children);
|
|
|
|
|
* // => false
|
|
|
|
|
*
|
|
|
|
|
* _.isArray('abc');
|
|
|
|
|
* // => false
|
|
|
|
|
*
|
|
|
|
|
* _.isArray(_.noop);
|
|
|
|
|
* // => false
|
|
|
|
|
*/
|
|
|
|
|
var isArray = Array.isArray;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Checks if `value` is array-like. A value is considered array-like if it's
|
|
|
|
|
* not a function and has a `value.length` that's an integer greater than or
|
|
|
|
|
* equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
|
|
|
|
|
*
|
|
|
|
|
* @static
|
|
|
|
|
* @memberOf _
|
|
|
|
|
* @since 4.0.0
|
|
|
|
|
* @category Lang
|
|
|
|
|
* @param {*} value The value to check.
|
|
|
|
|
* @returns {boolean} Returns `true` if `value` is array-like, else `false`.
|
|
|
|
|
* @example
|
|
|
|
|
*
|
|
|
|
|
* _.isArrayLike([1, 2, 3]);
|
|
|
|
|
* // => true
|
|
|
|
|
*
|
|
|
|
|
* _.isArrayLike(document.body.children);
|
|
|
|
|
* // => true
|
|
|
|
|
*
|
|
|
|
|
* _.isArrayLike('abc');
|
|
|
|
|
* // => true
|
|
|
|
|
*
|
|
|
|
|
* _.isArrayLike(_.noop);
|
|
|
|
|
* // => false
|
|
|
|
|
*/
|
|
|
|
|
function isArrayLike(value) {
|
|
|
|
|
return value != null && isLength(value.length) && !isFunction(value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* This method is like `_.isArrayLike` except that it also checks if `value`
|
|
|
|
|
* is an object.
|
|
|
|
|
*
|
|
|
|
|
* @static
|
|
|
|
|
* @memberOf _
|
|
|
|
|
* @since 4.0.0
|
|
|
|
|
* @category Lang
|
|
|
|
|
* @param {*} value The value to check.
|
|
|
|
|
* @returns {boolean} Returns `true` if `value` is an array-like object,
|
|
|
|
|
* else `false`.
|
|
|
|
|
* @example
|
|
|
|
|
*
|
|
|
|
|
* _.isArrayLikeObject([1, 2, 3]);
|
|
|
|
|
* // => true
|
|
|
|
|
*
|
|
|
|
|
* _.isArrayLikeObject(document.body.children);
|
|
|
|
|
* // => true
|
|
|
|
|
*
|
|
|
|
|
* _.isArrayLikeObject('abc');
|
|
|
|
|
* // => false
|
|
|
|
|
*
|
|
|
|
|
* _.isArrayLikeObject(_.noop);
|
|
|
|
|
* // => false
|
|
|
|
|
*/
|
|
|
|
|
function isArrayLikeObject(value) {
|
|
|
|
|
return isObjectLike(value) && isArrayLike(value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Checks if `value` is classified as a `Function` object.
|
|
|
|
|
*
|
|
|
|
|
* @static
|
|
|
|
|
* @memberOf _
|
|
|
|
|
* @since 0.1.0
|
|
|
|
|
* @category Lang
|
|
|
|
|
* @param {*} value The value to check.
|
|
|
|
|
* @returns {boolean} Returns `true` if `value` is a function, else `false`.
|
|
|
|
|
* @example
|
|
|
|
|
*
|
|
|
|
|
* _.isFunction(_);
|
|
|
|
|
* // => true
|
|
|
|
|
*
|
|
|
|
|
* _.isFunction(/abc/);
|
|
|
|
|
* // => false
|
|
|
|
|
*/
|
|
|
|
|
function isFunction(value) {
|
|
|
|
|
// The use of `Object#toString` avoids issues with the `typeof` operator
|
|
|
|
|
// in Safari 8-9 which returns 'object' for typed array and other constructors.
|
|
|
|
|
var tag = isObject(value) ? objectToString.call(value) : '';
|
|
|
|
|
return tag == funcTag || tag == genTag;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Checks if `value` is a valid array-like length.
|
|
|
|
|
*
|
|
|
|
|
* **Note:** This method is loosely based on
|
|
|
|
|
* [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
|
|
|
|
|
*
|
|
|
|
|
* @static
|
|
|
|
|
* @memberOf _
|
|
|
|
|
* @since 4.0.0
|
|
|
|
|
* @category Lang
|
|
|
|
|
* @param {*} value The value to check.
|
|
|
|
|
* @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
|
|
|
|
|
* @example
|
|
|
|
|
*
|
|
|
|
|
* _.isLength(3);
|
|
|
|
|
* // => true
|
|
|
|
|
*
|
|
|
|
|
* _.isLength(Number.MIN_VALUE);
|
|
|
|
|
* // => false
|
|
|
|
|
*
|
|
|
|
|
* _.isLength(Infinity);
|
|
|
|
|
* // => false
|
|
|
|
|
*
|
|
|
|
|
* _.isLength('3');
|
|
|
|
|
* // => false
|
|
|
|
|
*/
|
|
|
|
|
function isLength(value) {
|
|
|
|
|
return typeof value == 'number' &&
|
|
|
|
|
value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Checks if `value` is the
|
|
|
|
|
* [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
|
|
|
|
|
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
|
|
|
|
|
*
|
|
|
|
|
* @static
|
|
|
|
|
* @memberOf _
|
|
|
|
|
* @since 0.1.0
|
|
|
|
|
* @category Lang
|
|
|
|
|
* @param {*} value The value to check.
|
|
|
|
|
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
|
|
|
|
|
* @example
|
|
|
|
|
*
|
|
|
|
|
* _.isObject({});
|
|
|
|
|
* // => true
|
|
|
|
|
*
|
|
|
|
|
* _.isObject([1, 2, 3]);
|
|
|
|
|
* // => true
|
|
|
|
|
*
|
|
|
|
|
* _.isObject(_.noop);
|
|
|
|
|
* // => true
|
|
|
|
|
*
|
|
|
|
|
* _.isObject(null);
|
|
|
|
|
* // => false
|
|
|
|
|
*/
|
|
|
|
|
function isObject(value) {
|
|
|
|
|
var type = typeof value;
|
|
|
|
|
return !!value && (type == 'object' || type == 'function');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Checks if `value` is object-like. A value is object-like if it's not `null`
|
|
|
|
|
* and has a `typeof` result of "object".
|
|
|
|
|
*
|
|
|
|
|
* @static
|
|
|
|
|
* @memberOf _
|
|
|
|
|
* @since 4.0.0
|
|
|
|
|
* @category Lang
|
|
|
|
|
* @param {*} value The value to check.
|
|
|
|
|
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
|
|
|
|
|
* @example
|
|
|
|
|
*
|
|
|
|
|
* _.isObjectLike({});
|
|
|
|
|
* // => true
|
|
|
|
|
*
|
|
|
|
|
* _.isObjectLike([1, 2, 3]);
|
|
|
|
|
* // => true
|
|
|
|
|
*
|
|
|
|
|
* _.isObjectLike(_.noop);
|
|
|
|
|
* // => false
|
|
|
|
|
*
|
|
|
|
|
* _.isObjectLike(null);
|
|
|
|
|
* // => false
|
|
|
|
|
*/
|
|
|
|
|
function isObjectLike(value) {
|
|
|
|
|
return !!value && typeof value == 'object';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Checks if `value` is classified as a `Symbol` primitive or object.
|
|
|
|
|
*
|
|
|
|
|
* @static
|
|
|
|
|
* @memberOf _
|
|
|
|
|
* @since 4.0.0
|
|
|
|
|
* @category Lang
|
|
|
|
|
* @param {*} value The value to check.
|
|
|
|
|
* @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
|
|
|
|
|
* @example
|
|
|
|
|
*
|
|
|
|
|
* _.isSymbol(Symbol.iterator);
|
|
|
|
|
* // => true
|
|
|
|
|
*
|
|
|
|
|
* _.isSymbol('abc');
|
|
|
|
|
* // => false
|
|
|
|
|
*/
|
|
|
|
|
function isSymbol(value) {
|
|
|
|
|
return typeof value == 'symbol' ||
|
|
|
|
|
(isObjectLike(value) && objectToString.call(value) == symbolTag);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Checks if `value` is classified as a typed array.
|
|
|
|
|
*
|
|
|
|
|
* @static
|
|
|
|
|
* @memberOf _
|
|
|
|
|
* @since 3.0.0
|
|
|
|
|
* @category Lang
|
|
|
|
|
* @param {*} value The value to check.
|
|
|
|
|
* @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
|
|
|
|
|
* @example
|
|
|
|
|
*
|
|
|
|
|
* _.isTypedArray(new Uint8Array);
|
|
|
|
|
* // => true
|
|
|
|
|
*
|
|
|
|
|
* _.isTypedArray([]);
|
|
|
|
|
* // => false
|
|
|
|
|
*/
|
|
|
|
|
var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Converts `value` to a string. An empty string is returned for `null`
|
|
|
|
|
* and `undefined` values. The sign of `-0` is preserved.
|
|
|
|
|
*
|
|
|
|
|
* @static
|
|
|
|
|
* @memberOf _
|
|
|
|
|
* @since 4.0.0
|
|
|
|
|
* @category Lang
|
|
|
|
|
* @param {*} value The value to process.
|
|
|
|
|
* @returns {string} Returns the string.
|
|
|
|
|
* @example
|
|
|
|
|
*
|
|
|
|
|
* _.toString(null);
|
|
|
|
|
* // => ''
|
|
|
|
|
*
|
|
|
|
|
* _.toString(-0);
|
|
|
|
|
* // => '-0'
|
|
|
|
|
*
|
|
|
|
|
* _.toString([1, 2, 3]);
|
|
|
|
|
* // => '1,2,3'
|
|
|
|
|
*/
|
|
|
|
|
function toString(value) {
|
|
|
|
|
return value == null ? '' : baseToString(value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Gets the value at `path` of `object`. If the resolved value is
|
|
|
|
|
* `undefined`, the `defaultValue` is returned in its place.
|
|
|
|
|
*
|
|
|
|
|
* @static
|
|
|
|
|
* @memberOf _
|
|
|
|
|
* @since 3.7.0
|
|
|
|
|
* @category Object
|
|
|
|
|
* @param {Object} object The object to query.
|
|
|
|
|
* @param {Array|string} path The path of the property to get.
|
|
|
|
|
* @param {*} [defaultValue] The value returned for `undefined` resolved values.
|
|
|
|
|
* @returns {*} Returns the resolved value.
|
|
|
|
|
* @example
|
|
|
|
|
*
|
|
|
|
|
* var object = { 'a': [{ 'b': { 'c': 3 } }] };
|
|
|
|
|
*
|
|
|
|
|
* _.get(object, 'a[0].b.c');
|
|
|
|
|
* // => 3
|
|
|
|
|
*
|
|
|
|
|
* _.get(object, ['a', '0', 'b', 'c']);
|
|
|
|
|
* // => 3
|
|
|
|
|
*
|
|
|
|
|
* _.get(object, 'a.b.c', 'default');
|
|
|
|
|
* // => 'default'
|
|
|
|
|
*/
|
|
|
|
|
function get(object, path, defaultValue) {
|
|
|
|
|
var result = object == null ? undefined : baseGet(object, path);
|
|
|
|
|
return result === undefined ? defaultValue : result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Checks if `path` is a direct or inherited property of `object`.
|
|
|
|
|
*
|
|
|
|
|
* @static
|
|
|
|
|
* @memberOf _
|
|
|
|
|
* @since 4.0.0
|
|
|
|
|
* @category Object
|
|
|
|
|
* @param {Object} object The object to query.
|
|
|
|
|
* @param {Array|string} path The path to check.
|
|
|
|
|
* @returns {boolean} Returns `true` if `path` exists, else `false`.
|
|
|
|
|
* @example
|
|
|
|
|
*
|
|
|
|
|
* var object = _.create({ 'a': _.create({ 'b': 2 }) });
|
|
|
|
|
*
|
|
|
|
|
* _.hasIn(object, 'a');
|
|
|
|
|
* // => true
|
|
|
|
|
*
|
|
|
|
|
* _.hasIn(object, 'a.b');
|
|
|
|
|
* // => true
|
|
|
|
|
*
|
|
|
|
|
* _.hasIn(object, ['a', 'b']);
|
|
|
|
|
* // => true
|
|
|
|
|
*
|
|
|
|
|
* _.hasIn(object, 'b');
|
|
|
|
|
* // => false
|
|
|
|
|
*/
|
|
|
|
|
function hasIn(object, path) {
|
|
|
|
|
return object != null && hasPath(object, path, baseHasIn);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Creates an array of the own enumerable property names of `object`.
|
|
|
|
|
*
|
|
|
|
|
* **Note:** Non-object values are coerced to objects. See the
|
|
|
|
|
* [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
|
|
|
|
|
* for more details.
|
|
|
|
|
*
|
|
|
|
|
* @static
|
|
|
|
|
* @since 0.1.0
|
|
|
|
|
* @memberOf _
|
|
|
|
|
* @category Object
|
|
|
|
|
* @param {Object} object The object to query.
|
|
|
|
|
* @returns {Array} Returns the array of property names.
|
|
|
|
|
* @example
|
|
|
|
|
*
|
|
|
|
|
* function Foo() {
|
|
|
|
|
* this.a = 1;
|
|
|
|
|
* this.b = 2;
|
|
|
|
|
* }
|
|
|
|
|
*
|
|
|
|
|
* Foo.prototype.c = 3;
|
|
|
|
|
*
|
|
|
|
|
* _.keys(new Foo);
|
|
|
|
|
* // => ['a', 'b'] (iteration order is not guaranteed)
|
|
|
|
|
*
|
|
|
|
|
* _.keys('hi');
|
|
|
|
|
* // => ['0', '1']
|
|
|
|
|
*/
|
|
|
|
|
function keys(object) {
|
|
|
|
|
return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* This method returns the first argument it receives.
|
|
|
|
|
*
|
|
|
|
|
* @static
|
|
|
|
|
* @since 0.1.0
|
|
|
|
|
* @memberOf _
|
|
|
|
|
* @category Util
|
|
|
|
|
* @param {*} value Any value.
|
|
|
|
|
* @returns {*} Returns `value`.
|
|
|
|
|
* @example
|
|
|
|
|
*
|
|
|
|
|
* var object = { 'a': 1 };
|
|
|
|
|
*
|
|
|
|
|
* console.log(_.identity(object) === object);
|
|
|
|
|
* // => true
|
|
|
|
|
*/
|
|
|
|
|
function identity(value) {
|
|
|
|
|
return value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Creates a function that returns the value at `path` of a given object.
|
|
|
|
|
*
|
|
|
|
|
* @static
|
|
|
|
|
* @memberOf _
|
|
|
|
|
* @since 2.4.0
|
|
|
|
|
* @category Util
|
|
|
|
|
* @param {Array|string} path The path of the property to get.
|
|
|
|
|
* @returns {Function} Returns the new accessor function.
|
|
|
|
|
* @example
|
|
|
|
|
*
|
|
|
|
|
* var objects = [
|
|
|
|
|
* { 'a': { 'b': 2 } },
|
|
|
|
|
* { 'a': { 'b': 1 } }
|
|
|
|
|
* ];
|
|
|
|
|
*
|
|
|
|
|
* _.map(objects, _.property('a.b'));
|
|
|
|
|
* // => [2, 1]
|
|
|
|
|
*
|
|
|
|
|
* _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
|
|
|
|
|
* // => [1, 2]
|
|
|
|
|
*/
|
|
|
|
|
function property(path) {
|
|
|
|
|
return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
module.exports = groupBy;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
var top = 'top';
|
|
|
|
|
var bottom = 'bottom';
|
|
|
|
|
var right = 'right';
|
|
|
|
|
var left = 'left';
|
|
|
|
|
var auto = 'auto';
|
|
|
|
|
var basePlacements = [top, bottom, right, left];
|
|
|
|
|
var start = 'start';
|
|
|
|
|
var end = 'end';
|
|
|
|
|
var clippingParents = 'clippingParents';
|
|
|
|
|
var viewport = 'viewport';
|
|
|
|
|
var popper = 'popper';
|
|
|
|
|
var reference = 'reference';
|
|
|
|
|
var variationPlacements = /*#__PURE__*/basePlacements.reduce(function (acc, placement) {
|
|
|
|
|
return acc.concat([placement + "-" + start, placement + "-" + end]);
|
|
|
|
|
}, []);
|
|
|
|
|
var placements = /*#__PURE__*/[].concat(basePlacements, [auto]).reduce(function (acc, placement) {
|
|
|
|
|
return acc.concat([placement, placement + "-" + start, placement + "-" + end]);
|
|
|
|
|
}, []); // modifiers that need to read the DOM
|
|
|
|
|
|
|
|
|
|
var beforeRead = 'beforeRead';
|
|
|
|
|
var read = 'read';
|
|
|
|
|
var afterRead = 'afterRead'; // pure-logic modifiers
|
|
|
|
|
|
|
|
|
|
var beforeMain = 'beforeMain';
|
|
|
|
|
var main = 'main';
|
|
|
|
|
var afterMain = 'afterMain'; // modifier with the purpose to write to the DOM (or write into a framework state)
|
|
|
|
|
|
|
|
|
|
var beforeWrite = 'beforeWrite';
|
|
|
|
|
var write = 'write';
|
|
|
|
|
var afterWrite = 'afterWrite';
|
|
|
|
|
var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite];
|
|
|
|
|
|
|
|
|
|
function getNodeName(element) {
|
|
|
|
|
return element ? (element.nodeName || '').toLowerCase() : null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function getWindow(node) {
|
|
|
|
|
if (node == null) {
|
|
|
|
|
return window;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (node.toString() !== '[object Window]') {
|
|
|
|
|
var ownerDocument = node.ownerDocument;
|
|
|
|
|
return ownerDocument ? ownerDocument.defaultView || window : window;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return node;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function isElement(node) {
|
|
|
|
|
var OwnElement = getWindow(node).Element;
|
|
|
|
|
return node instanceof OwnElement || node instanceof Element;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function isHTMLElement(node) {
|
|
|
|
|
var OwnElement = getWindow(node).HTMLElement;
|
|
|
|
|
return node instanceof OwnElement || node instanceof HTMLElement;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function isShadowRoot(node) {
|
|
|
|
|
// IE 11 has no ShadowRoot
|
|
|
|
|
if (typeof ShadowRoot === 'undefined') {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var OwnElement = getWindow(node).ShadowRoot;
|
|
|
|
|
return node instanceof OwnElement || node instanceof ShadowRoot;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// and applies them to the HTMLElements such as popper and arrow
|
|
|
|
|
|
|
|
|
|
function applyStyles(_ref) {
|
|
|
|
|
var state = _ref.state;
|
|
|
|
|
Object.keys(state.elements).forEach(function (name) {
|
|
|
|
|
var style = state.styles[name] || {};
|
|
|
|
|
var attributes = state.attributes[name] || {};
|
|
|
|
|
var element = state.elements[name]; // arrow is optional + virtual elements
|
|
|
|
|
|
|
|
|
|
if (!isHTMLElement(element) || !getNodeName(element)) {
|
|
|
|
|
return;
|
|
|
|
|
} // Flow doesn't support to extend this property, but it's the most
|
|
|
|
|
// effective way to apply styles to an HTMLElement
|
|
|
|
|
// $FlowFixMe[cannot-write]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Object.assign(element.style, style);
|
|
|
|
|
Object.keys(attributes).forEach(function (name) {
|
|
|
|
|
var value = attributes[name];
|
|
|
|
|
|
|
|
|
|
if (value === false) {
|
|
|
|
|
element.removeAttribute(name);
|
|
|
|
|
} else {
|
|
|
|
|
element.setAttribute(name, value === true ? '' : value);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function effect$2(_ref2) {
|
|
|
|
|
var state = _ref2.state;
|
|
|
|
|
var initialStyles = {
|
|
|
|
|
popper: {
|
|
|
|
|
position: state.options.strategy,
|
|
|
|
|
left: '0',
|
|
|
|
|
top: '0',
|
|
|
|
|
margin: '0'
|
|
|
|
|
},
|
|
|
|
|
arrow: {
|
|
|
|
|
position: 'absolute'
|
|
|
|
|
},
|
|
|
|
|
reference: {}
|
|
|
|
|
};
|
|
|
|
|
Object.assign(state.elements.popper.style, initialStyles.popper);
|
|
|
|
|
state.styles = initialStyles;
|
|
|
|
|
|
|
|
|
|
if (state.elements.arrow) {
|
|
|
|
|
Object.assign(state.elements.arrow.style, initialStyles.arrow);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return function () {
|
|
|
|
|
Object.keys(state.elements).forEach(function (name) {
|
|
|
|
|
var element = state.elements[name];
|
|
|
|
|
var attributes = state.attributes[name] || {};
|
|
|
|
|
var styleProperties = Object.keys(state.styles.hasOwnProperty(name) ? state.styles[name] : initialStyles[name]); // Set all values to an empty string to unset them
|
|
|
|
|
|
|
|
|
|
var style = styleProperties.reduce(function (style, property) {
|
|
|
|
|
style[property] = '';
|
|
|
|
|
return style;
|
|
|
|
|
}, {}); // arrow is optional + virtual elements
|
|
|
|
|
|
|
|
|
|
if (!isHTMLElement(element) || !getNodeName(element)) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Object.assign(element.style, style);
|
|
|
|
|
Object.keys(attributes).forEach(function (attribute) {
|
|
|
|
|
element.removeAttribute(attribute);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
} // eslint-disable-next-line import/no-unused-modules
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var applyStyles$1 = {
|
|
|
|
|
name: 'applyStyles',
|
|
|
|
|
enabled: true,
|
|
|
|
|
phase: 'write',
|
|
|
|
|
fn: applyStyles,
|
|
|
|
|
effect: effect$2,
|
|
|
|
|
requires: ['computeStyles']
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
function getBasePlacement(placement) {
|
|
|
|
|
return placement.split('-')[0];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// import { isHTMLElement } from './instanceOf';
|
|
|
|
|
function getBoundingClientRect(element, // eslint-disable-next-line unused-imports/no-unused-vars
|
|
|
|
|
includeScale) {
|
|
|
|
|
|
|
|
|
|
var rect = element.getBoundingClientRect();
|
|
|
|
|
var scaleX = 1;
|
|
|
|
|
var scaleY = 1; // FIXME:
|
|
|
|
|
// `offsetWidth` returns an integer while `getBoundingClientRect`
|
|
|
|
|
// returns a float. This results in `scaleX` or `scaleY` being
|
|
|
|
|
// non-1 when it should be for elements that aren't a full pixel in
|
|
|
|
|
// width or height.
|
|
|
|
|
// if (isHTMLElement(element) && includeScale) {
|
|
|
|
|
// const offsetHeight = element.offsetHeight;
|
|
|
|
|
// const offsetWidth = element.offsetWidth;
|
|
|
|
|
// // Do not attempt to divide by 0, otherwise we get `Infinity` as scale
|
|
|
|
|
// // Fallback to 1 in case both values are `0`
|
|
|
|
|
// if (offsetWidth > 0) {
|
|
|
|
|
// scaleX = rect.width / offsetWidth || 1;
|
|
|
|
|
// }
|
|
|
|
|
// if (offsetHeight > 0) {
|
|
|
|
|
// scaleY = rect.height / offsetHeight || 1;
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
width: rect.width / scaleX,
|
|
|
|
|
height: rect.height / scaleY,
|
|
|
|
|
top: rect.top / scaleY,
|
|
|
|
|
right: rect.right / scaleX,
|
|
|
|
|
bottom: rect.bottom / scaleY,
|
|
|
|
|
left: rect.left / scaleX,
|
|
|
|
|
x: rect.left / scaleX,
|
|
|
|
|
y: rect.top / scaleY
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// means it doesn't take into account transforms.
|
|
|
|
|
|
|
|
|
|
function getLayoutRect(element) {
|
|
|
|
|
var clientRect = getBoundingClientRect(element); // Use the clientRect sizes if it's not been transformed.
|
|
|
|
|
// Fixes https://github.com/popperjs/popper-core/issues/1223
|
|
|
|
|
|
|
|
|
|
var width = element.offsetWidth;
|
|
|
|
|
var height = element.offsetHeight;
|
|
|
|
|
|
|
|
|
|
if (Math.abs(clientRect.width - width) <= 1) {
|
|
|
|
|
width = clientRect.width;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (Math.abs(clientRect.height - height) <= 1) {
|
|
|
|
|
height = clientRect.height;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
x: element.offsetLeft,
|
|
|
|
|
y: element.offsetTop,
|
|
|
|
|
width: width,
|
|
|
|
|
height: height
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function contains(parent, child) {
|
|
|
|
|
var rootNode = child.getRootNode && child.getRootNode(); // First, attempt with faster native method
|
|
|
|
|
|
|
|
|
|
if (parent.contains(child)) {
|
|
|
|
|
return true;
|
|
|
|
|
} // then fallback to custom implementation with Shadow DOM support
|
|
|
|
|
else if (rootNode && isShadowRoot(rootNode)) {
|
|
|
|
|
var next = child;
|
|
|
|
|
|
|
|
|
|
do {
|
|
|
|
|
if (next && parent.isSameNode(next)) {
|
|
|
|
|
return true;
|
|
|
|
|
} // $FlowFixMe[prop-missing]: need a better way to handle this...
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
next = next.parentNode || next.host;
|
|
|
|
|
} while (next);
|
|
|
|
|
} // Give up, the result is false
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function getComputedStyle(element) {
|
|
|
|
|
return getWindow(element).getComputedStyle(element);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function isTableElement(element) {
|
|
|
|
|
return ['table', 'td', 'th'].indexOf(getNodeName(element)) >= 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function getDocumentElement(element) {
|
|
|
|
|
// $FlowFixMe[incompatible-return]: assume body is always available
|
|
|
|
|
return ((isElement(element) ? element.ownerDocument : // $FlowFixMe[prop-missing]
|
|
|
|
|
element.document) || window.document).documentElement;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function getParentNode(element) {
|
|
|
|
|
if (getNodeName(element) === 'html') {
|
|
|
|
|
return element;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (// this is a quicker (but less type safe) way to save quite some bytes from the bundle
|
|
|
|
|
// $FlowFixMe[incompatible-return]
|
|
|
|
|
// $FlowFixMe[prop-missing]
|
|
|
|
|
element.assignedSlot || // step into the shadow DOM of the parent of a slotted node
|
|
|
|
|
element.parentNode || ( // DOM Element detected
|
|
|
|
|
isShadowRoot(element) ? element.host : null) || // ShadowRoot detected
|
|
|
|
|
// $FlowFixMe[incompatible-call]: HTMLElement is a Node
|
|
|
|
|
getDocumentElement(element) // fallback
|
|
|
|
|
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function getTrueOffsetParent(element) {
|
|
|
|
|
if (!isHTMLElement(element) || // https://github.com/popperjs/popper-core/issues/837
|
|
|
|
|
getComputedStyle(element).position === 'fixed') {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return element.offsetParent;
|
|
|
|
|
} // `.offsetParent` reports `null` for fixed elements, while absolute elements
|
|
|
|
|
// return the containing block
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function getContainingBlock(element) {
|
|
|
|
|
var isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') !== -1;
|
|
|
|
|
var isIE = navigator.userAgent.indexOf('Trident') !== -1;
|
|
|
|
|
|
|
|
|
|
if (isIE && isHTMLElement(element)) {
|
|
|
|
|
// In IE 9, 10 and 11 fixed elements containing block is always established by the viewport
|
|
|
|
|
var elementCss = getComputedStyle(element);
|
|
|
|
|
|
|
|
|
|
if (elementCss.position === 'fixed') {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var currentNode = getParentNode(element);
|
|
|
|
|
|
|
|
|
|
while (isHTMLElement(currentNode) && ['html', 'body'].indexOf(getNodeName(currentNode)) < 0) {
|
|
|
|
|
var css = getComputedStyle(currentNode); // This is non-exhaustive but covers the most common CSS properties that
|
|
|
|
|
// create a containing block.
|
|
|
|
|
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
|
|
|
|
|
|
|
|
|
|
if (css.transform !== 'none' || css.perspective !== 'none' || css.contain === 'paint' || ['transform', 'perspective'].indexOf(css.willChange) !== -1 || isFirefox && css.willChange === 'filter' || isFirefox && css.filter && css.filter !== 'none') {
|
|
|
|
|
return currentNode;
|
|
|
|
|
} else {
|
|
|
|
|
currentNode = currentNode.parentNode;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
} // Gets the closest ancestor positioned element. Handles some edge cases,
|
|
|
|
|
// such as table ancestors and cross browser bugs.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function getOffsetParent(element) {
|
|
|
|
|
var window = getWindow(element);
|
|
|
|
|
var offsetParent = getTrueOffsetParent(element);
|
|
|
|
|
|
|
|
|
|
while (offsetParent && isTableElement(offsetParent) && getComputedStyle(offsetParent).position === 'static') {
|
|
|
|
|
offsetParent = getTrueOffsetParent(offsetParent);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static')) {
|
|
|
|
|
return window;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return offsetParent || getContainingBlock(element) || window;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function getMainAxisFromPlacement(placement) {
|
|
|
|
|
return ['top', 'bottom'].indexOf(placement) >= 0 ? 'x' : 'y';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var max = Math.max;
|
|
|
|
|
var min = Math.min;
|
|
|
|
|
var round = Math.round;
|
|
|
|
|
|
|
|
|
|
function within(min$1, value, max$1) {
|
|
|
|
|
return max(min$1, min(value, max$1));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function getFreshSideObject() {
|
|
|
|
|
return {
|
|
|
|
|
top: 0,
|
|
|
|
|
right: 0,
|
|
|
|
|
bottom: 0,
|
|
|
|
|
left: 0
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function mergePaddingObject(paddingObject) {
|
|
|
|
|
return Object.assign({}, getFreshSideObject(), paddingObject);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function expandToHashMap(value, keys) {
|
|
|
|
|
return keys.reduce(function (hashMap, key) {
|
|
|
|
|
hashMap[key] = value;
|
|
|
|
|
return hashMap;
|
|
|
|
|
}, {});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var toPaddingObject = function toPaddingObject(padding, state) {
|
|
|
|
|
padding = typeof padding === 'function' ? padding(Object.assign({}, state.rects, {
|
|
|
|
|
placement: state.placement
|
|
|
|
|
})) : padding;
|
|
|
|
|
return mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
function arrow(_ref) {
|
|
|
|
|
var _state$modifiersData$;
|
|
|
|
|
|
|
|
|
|
var state = _ref.state,
|
|
|
|
|
name = _ref.name,
|
|
|
|
|
options = _ref.options;
|
|
|
|
|
var arrowElement = state.elements.arrow;
|
|
|
|
|
var popperOffsets = state.modifiersData.popperOffsets;
|
|
|
|
|
var basePlacement = getBasePlacement(state.placement);
|
|
|
|
|
var axis = getMainAxisFromPlacement(basePlacement);
|
|
|
|
|
var isVertical = [left, right].indexOf(basePlacement) >= 0;
|
|
|
|
|
var len = isVertical ? 'height' : 'width';
|
|
|
|
|
|
|
|
|
|
if (!arrowElement || !popperOffsets) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var paddingObject = toPaddingObject(options.padding, state);
|
|
|
|
|
var arrowRect = getLayoutRect(arrowElement);
|
|
|
|
|
var minProp = axis === 'y' ? top : left;
|
|
|
|
|
var maxProp = axis === 'y' ? bottom : right;
|
|
|
|
|
var endDiff = state.rects.reference[len] + state.rects.reference[axis] - popperOffsets[axis] - state.rects.popper[len];
|
|
|
|
|
var startDiff = popperOffsets[axis] - state.rects.reference[axis];
|
|
|
|
|
var arrowOffsetParent = getOffsetParent(arrowElement);
|
|
|
|
|
var clientSize = arrowOffsetParent ? axis === 'y' ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;
|
|
|
|
|
var centerToReference = endDiff / 2 - startDiff / 2; // Make sure the arrow doesn't overflow the popper if the center point is
|
|
|
|
|
// outside of the popper bounds
|
|
|
|
|
|
|
|
|
|
var min = paddingObject[minProp];
|
|
|
|
|
var max = clientSize - arrowRect[len] - paddingObject[maxProp];
|
|
|
|
|
var center = clientSize / 2 - arrowRect[len] / 2 + centerToReference;
|
|
|
|
|
var offset = within(min, center, max); // Prevents breaking syntax highlighting...
|
|
|
|
|
|
|
|
|
|
var axisProp = axis;
|
|
|
|
|
state.modifiersData[name] = (_state$modifiersData$ = {}, _state$modifiersData$[axisProp] = offset, _state$modifiersData$.centerOffset = offset - center, _state$modifiersData$);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function effect$1(_ref2) {
|
|
|
|
|
var state = _ref2.state,
|
|
|
|
|
options = _ref2.options;
|
|
|
|
|
var _options$element = options.element,
|
|
|
|
|
arrowElement = _options$element === void 0 ? '[data-popper-arrow]' : _options$element;
|
|
|
|
|
|
|
|
|
|
if (arrowElement == null) {
|
|
|
|
|
return;
|
|
|
|
|
} // CSS selector
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (typeof arrowElement === 'string') {
|
|
|
|
|
arrowElement = state.elements.popper.querySelector(arrowElement);
|
|
|
|
|
|
|
|
|
|
if (!arrowElement) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (process.env.NODE_ENV !== "production") {
|
|
|
|
|
if (!isHTMLElement(arrowElement)) {
|
|
|
|
|
console.error(['Popper: "arrow" element must be an HTMLElement (not an SVGElement).', 'To use an SVG arrow, wrap it in an HTMLElement that will be used as', 'the arrow.'].join(' '));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!contains(state.elements.popper, arrowElement)) {
|
|
|
|
|
if (process.env.NODE_ENV !== "production") {
|
|
|
|
|
console.error(['Popper: "arrow" modifier\'s `element` must be a child of the popper', 'element.'].join(' '));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
state.elements.arrow = arrowElement;
|
|
|
|
|
} // eslint-disable-next-line import/no-unused-modules
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var arrow$1 = {
|
|
|
|
|
name: 'arrow',
|
|
|
|
|
enabled: true,
|
|
|
|
|
phase: 'main',
|
|
|
|
|
fn: arrow,
|
|
|
|
|
effect: effect$1,
|
|
|
|
|
requires: ['popperOffsets'],
|
|
|
|
|
requiresIfExists: ['preventOverflow']
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
function getVariation(placement) {
|
|
|
|
|
return placement.split('-')[1];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var unsetSides = {
|
|
|
|
|
top: 'auto',
|
|
|
|
|
right: 'auto',
|
|
|
|
|
bottom: 'auto',
|
|
|
|
|
left: 'auto'
|
|
|
|
|
}; // Round the offsets to the nearest suitable subpixel based on the DPR.
|
|
|
|
|
// Zooming can change the DPR, but it seems to report a value that will
|
|
|
|
|
// cleanly divide the values into the appropriate subpixels.
|
|
|
|
|
|
|
|
|
|
function roundOffsetsByDPR(_ref) {
|
|
|
|
|
var x = _ref.x,
|
|
|
|
|
y = _ref.y;
|
|
|
|
|
var win = window;
|
|
|
|
|
var dpr = win.devicePixelRatio || 1;
|
|
|
|
|
return {
|
|
|
|
|
x: round(round(x * dpr) / dpr) || 0,
|
|
|
|
|
y: round(round(y * dpr) / dpr) || 0
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function mapToStyles(_ref2) {
|
|
|
|
|
var _Object$assign2;
|
|
|
|
|
|
|
|
|
|
var popper = _ref2.popper,
|
|
|
|
|
popperRect = _ref2.popperRect,
|
|
|
|
|
placement = _ref2.placement,
|
|
|
|
|
variation = _ref2.variation,
|
|
|
|
|
offsets = _ref2.offsets,
|
|
|
|
|
position = _ref2.position,
|
|
|
|
|
gpuAcceleration = _ref2.gpuAcceleration,
|
|
|
|
|
adaptive = _ref2.adaptive,
|
|
|
|
|
roundOffsets = _ref2.roundOffsets;
|
|
|
|
|
|
|
|
|
|
var _ref3 = roundOffsets === true ? roundOffsetsByDPR(offsets) : typeof roundOffsets === 'function' ? roundOffsets(offsets) : offsets,
|
|
|
|
|
_ref3$x = _ref3.x,
|
|
|
|
|
x = _ref3$x === void 0 ? 0 : _ref3$x,
|
|
|
|
|
_ref3$y = _ref3.y,
|
|
|
|
|
y = _ref3$y === void 0 ? 0 : _ref3$y;
|
|
|
|
|
|
|
|
|
|
var hasX = offsets.hasOwnProperty('x');
|
|
|
|
|
var hasY = offsets.hasOwnProperty('y');
|
|
|
|
|
var sideX = left;
|
|
|
|
|
var sideY = top;
|
|
|
|
|
var win = window;
|
|
|
|
|
|
|
|
|
|
if (adaptive) {
|
|
|
|
|
var offsetParent = getOffsetParent(popper);
|
|
|
|
|
var heightProp = 'clientHeight';
|
|
|
|
|
var widthProp = 'clientWidth';
|
|
|
|
|
|
|
|
|
|
if (offsetParent === getWindow(popper)) {
|
|
|
|
|
offsetParent = getDocumentElement(popper);
|
|
|
|
|
|
|
|
|
|
if (getComputedStyle(offsetParent).position !== 'static' && position === 'absolute') {
|
|
|
|
|
heightProp = 'scrollHeight';
|
|
|
|
|
widthProp = 'scrollWidth';
|
|
|
|
|
}
|
|
|
|
|
} // $FlowFixMe[incompatible-cast]: force type refinement, we compare offsetParent with window above, but Flow doesn't detect it
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
offsetParent = offsetParent;
|
|
|
|
|
|
|
|
|
|
if (placement === top || (placement === left || placement === right) && variation === end) {
|
|
|
|
|
sideY = bottom; // $FlowFixMe[prop-missing]
|
|
|
|
|
|
|
|
|
|
y -= offsetParent[heightProp] - popperRect.height;
|
|
|
|
|
y *= gpuAcceleration ? 1 : -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (placement === left || (placement === top || placement === bottom) && variation === end) {
|
|
|
|
|
sideX = right; // $FlowFixMe[prop-missing]
|
|
|
|
|
|
|
|
|
|
x -= offsetParent[widthProp] - popperRect.width;
|
|
|
|
|
x *= gpuAcceleration ? 1 : -1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var commonStyles = Object.assign({
|
|
|
|
|
position: position
|
|
|
|
|
}, adaptive && unsetSides);
|
|
|
|
|
|
|
|
|
|
if (gpuAcceleration) {
|
|
|
|
|
var _Object$assign;
|
|
|
|
|
|
|
|
|
|
return Object.assign({}, commonStyles, (_Object$assign = {}, _Object$assign[sideY] = hasY ? '0' : '', _Object$assign[sideX] = hasX ? '0' : '', _Object$assign.transform = (win.devicePixelRatio || 1) <= 1 ? "translate(" + x + "px, " + y + "px)" : "translate3d(" + x + "px, " + y + "px, 0)", _Object$assign));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : '', _Object$assign2[sideX] = hasX ? x + "px" : '', _Object$assign2.transform = '', _Object$assign2));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function computeStyles(_ref4) {
|
|
|
|
|
var state = _ref4.state,
|
|
|
|
|
options = _ref4.options;
|
|
|
|
|
var _options$gpuAccelerat = options.gpuAcceleration,
|
|
|
|
|
gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat,
|
|
|
|
|
_options$adaptive = options.adaptive,
|
|
|
|
|
adaptive = _options$adaptive === void 0 ? true : _options$adaptive,
|
|
|
|
|
_options$roundOffsets = options.roundOffsets,
|
|
|
|
|
roundOffsets = _options$roundOffsets === void 0 ? true : _options$roundOffsets;
|
|
|
|
|
|
|
|
|
|
if (process.env.NODE_ENV !== "production") {
|
|
|
|
|
var transitionProperty = getComputedStyle(state.elements.popper).transitionProperty || '';
|
|
|
|
|
|
|
|
|
|
if (adaptive && ['transform', 'top', 'right', 'bottom', 'left'].some(function (property) {
|
|
|
|
|
return transitionProperty.indexOf(property) >= 0;
|
|
|
|
|
})) {
|
|
|
|
|
console.warn(['Popper: Detected CSS transitions on at least one of the following', 'CSS properties: "transform", "top", "right", "bottom", "left".', '\n\n', 'Disable the "computeStyles" modifier\'s `adaptive` option to allow', 'for smooth transitions, or remove these properties from the CSS', 'transition declaration on the popper element if only transitioning', 'opacity or background-color for example.', '\n\n', 'We recommend using the popper element as a wrapper around an inner', 'element that can have any CSS property transitioned for animations.'].join(' '));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var commonStyles = {
|
|
|
|
|
placement: getBasePlacement(state.placement),
|
|
|
|
|
variation: getVariation(state.placement),
|
|
|
|
|
popper: state.elements.popper,
|
|
|
|
|
popperRect: state.rects.popper,
|
|
|
|
|
gpuAcceleration: gpuAcceleration
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
if (state.modifiersData.popperOffsets != null) {
|
|
|
|
|
state.styles.popper = Object.assign({}, state.styles.popper, mapToStyles(Object.assign({}, commonStyles, {
|
|
|
|
|
offsets: state.modifiersData.popperOffsets,
|
|
|
|
|
position: state.options.strategy,
|
|
|
|
|
adaptive: adaptive,
|
|
|
|
|
roundOffsets: roundOffsets
|
|
|
|
|
})));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (state.modifiersData.arrow != null) {
|
|
|
|
|
state.styles.arrow = Object.assign({}, state.styles.arrow, mapToStyles(Object.assign({}, commonStyles, {
|
|
|
|
|
offsets: state.modifiersData.arrow,
|
|
|
|
|
position: 'absolute',
|
|
|
|
|
adaptive: false,
|
|
|
|
|
roundOffsets: roundOffsets
|
|
|
|
|
})));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
state.attributes.popper = Object.assign({}, state.attributes.popper, {
|
|
|
|
|
'data-popper-placement': state.placement
|
|
|
|
|
});
|
|
|
|
|
} // eslint-disable-next-line import/no-unused-modules
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var computeStyles$1 = {
|
|
|
|
|
name: 'computeStyles',
|
|
|
|
|
enabled: true,
|
|
|
|
|
phase: 'beforeWrite',
|
|
|
|
|
fn: computeStyles,
|
|
|
|
|
data: {}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var passive = {
|
|
|
|
|
passive: true
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
function effect(_ref) {
|
|
|
|
|
var state = _ref.state,
|
|
|
|
|
instance = _ref.instance,
|
|
|
|
|
options = _ref.options;
|
|
|
|
|
var _options$scroll = options.scroll,
|
|
|
|
|
scroll = _options$scroll === void 0 ? true : _options$scroll,
|
|
|
|
|
_options$resize = options.resize,
|
|
|
|
|
resize = _options$resize === void 0 ? true : _options$resize;
|
|
|
|
|
var window = getWindow(state.elements.popper);
|
|
|
|
|
var scrollParents = [].concat(state.scrollParents.reference, state.scrollParents.popper);
|
|
|
|
|
|
|
|
|
|
if (scroll) {
|
|
|
|
|
scrollParents.forEach(function (scrollParent) {
|
|
|
|
|
scrollParent.addEventListener('scroll', instance.update, passive);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (resize) {
|
|
|
|
|
window.addEventListener('resize', instance.update, passive);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return function () {
|
|
|
|
|
if (scroll) {
|
|
|
|
|
scrollParents.forEach(function (scrollParent) {
|
|
|
|
|
scrollParent.removeEventListener('scroll', instance.update, passive);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (resize) {
|
|
|
|
|
window.removeEventListener('resize', instance.update, passive);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
} // eslint-disable-next-line import/no-unused-modules
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var eventListeners = {
|
|
|
|
|
name: 'eventListeners',
|
|
|
|
|
enabled: true,
|
|
|
|
|
phase: 'write',
|
|
|
|
|
fn: function fn() {},
|
|
|
|
|
effect: effect,
|
|
|
|
|
data: {}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var hash$1 = {
|
|
|
|
|
left: 'right',
|
|
|
|
|
right: 'left',
|
|
|
|
|
bottom: 'top',
|
|
|
|
|
top: 'bottom'
|
|
|
|
|
};
|
|
|
|
|
function getOppositePlacement(placement) {
|
|
|
|
|
return placement.replace(/left|right|bottom|top/g, function (matched) {
|
|
|
|
|
return hash$1[matched];
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var hash = {
|
|
|
|
|
start: 'end',
|
|
|
|
|
end: 'start'
|
|
|
|
|
};
|
|
|
|
|
function getOppositeVariationPlacement(placement) {
|
|
|
|
|
return placement.replace(/start|end/g, function (matched) {
|
|
|
|
|
return hash[matched];
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function getWindowScroll(node) {
|
|
|
|
|
var win = getWindow(node);
|
|
|
|
|
var scrollLeft = win.pageXOffset;
|
|
|
|
|
var scrollTop = win.pageYOffset;
|
|
|
|
|
return {
|
|
|
|
|
scrollLeft: scrollLeft,
|
|
|
|
|
scrollTop: scrollTop
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function getWindowScrollBarX(element) {
|
|
|
|
|
// If <html> has a CSS width greater than the viewport, then this will be
|
|
|
|
|
// incorrect for RTL.
|
|
|
|
|
// Popper 1 is broken in this case and never had a bug report so let's assume
|
|
|
|
|
// it's not an issue. I don't think anyone ever specifies width on <html>
|
|
|
|
|
// anyway.
|
|
|
|
|
// Browsers where the left scrollbar doesn't cause an issue report `0` for
|
|
|
|
|
// this (e.g. Edge 2019, IE11, Safari)
|
|
|
|
|
return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function getViewportRect(element) {
|
|
|
|
|
var win = getWindow(element);
|
|
|
|
|
var html = getDocumentElement(element);
|
|
|
|
|
var visualViewport = win.visualViewport;
|
|
|
|
|
var width = html.clientWidth;
|
|
|
|
|
var height = html.clientHeight;
|
|
|
|
|
var x = 0;
|
|
|
|
|
var y = 0; // NB: This isn't supported on iOS <= 12. If the keyboard is open, the popper
|
|
|
|
|
// can be obscured underneath it.
|
|
|
|
|
// Also, `html.clientHeight` adds the bottom bar height in Safari iOS, even
|
|
|
|
|
// if it isn't open, so if this isn't available, the popper will be detected
|
|
|
|
|
// to overflow the bottom of the screen too early.
|
|
|
|
|
|
|
|
|
|
if (visualViewport) {
|
|
|
|
|
width = visualViewport.width;
|
|
|
|
|
height = visualViewport.height; // Uses Layout Viewport (like Chrome; Safari does not currently)
|
|
|
|
|
// In Chrome, it returns a value very close to 0 (+/-) but contains rounding
|
|
|
|
|
// errors due to floating point numbers, so we need to check precision.
|
|
|
|
|
// Safari returns a number <= 0, usually < -1 when pinch-zoomed
|
|
|
|
|
// Feature detection fails in mobile emulation mode in Chrome.
|
|
|
|
|
// Math.abs(win.innerWidth / visualViewport.scale - visualViewport.width) <
|
|
|
|
|
// 0.001
|
|
|
|
|
// Fallback here: "Not Safari" userAgent
|
|
|
|
|
|
|
|
|
|
if (!/^((?!chrome|android).)*safari/i.test(navigator.userAgent)) {
|
|
|
|
|
x = visualViewport.offsetLeft;
|
|
|
|
|
y = visualViewport.offsetTop;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
width: width,
|
|
|
|
|
height: height,
|
|
|
|
|
x: x + getWindowScrollBarX(element),
|
|
|
|
|
y: y
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// of the `<html>` and `<body>` rect bounds if horizontally scrollable
|
|
|
|
|
|
|
|
|
|
function getDocumentRect(element) {
|
|
|
|
|
var _element$ownerDocumen;
|
|
|
|
|
|
|
|
|
|
var html = getDocumentElement(element);
|
|
|
|
|
var winScroll = getWindowScroll(element);
|
|
|
|
|
var body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
|
|
|
|
|
var width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
|
|
|
|
|
var height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
|
|
|
|
|
var x = -winScroll.scrollLeft + getWindowScrollBarX(element);
|
|
|
|
|
var y = -winScroll.scrollTop;
|
|
|
|
|
|
|
|
|
|
if (getComputedStyle(body || html).direction === 'rtl') {
|
|
|
|
|
x += max(html.clientWidth, body ? body.clientWidth : 0) - width;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
width: width,
|
|
|
|
|
height: height,
|
|
|
|
|
x: x,
|
|
|
|
|
y: y
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function isScrollParent(element) {
|
|
|
|
|
// Firefox wants us to check `-x` and `-y` variations as well
|
|
|
|
|
var _getComputedStyle = getComputedStyle(element),
|
|
|
|
|
overflow = _getComputedStyle.overflow,
|
|
|
|
|
overflowX = _getComputedStyle.overflowX,
|
|
|
|
|
overflowY = _getComputedStyle.overflowY;
|
|
|
|
|
|
|
|
|
|
return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function getScrollParent(node) {
|
|
|
|
|
if (['html', 'body', '#document'].indexOf(getNodeName(node)) >= 0) {
|
|
|
|
|
// $FlowFixMe[incompatible-return]: assume body is always available
|
|
|
|
|
return node.ownerDocument.body;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (isHTMLElement(node) && isScrollParent(node)) {
|
|
|
|
|
return node;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return getScrollParent(getParentNode(node));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
given a DOM element, return the list of all scroll parents, up the list of ancesors
|
|
|
|
|
until we get to the top window object. This list is what we attach scroll listeners
|
|
|
|
|
to, because if any of these parent elements scroll, we'll need to re-calculate the
|
|
|
|
|
reference element's position.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
function listScrollParents(element, list) {
|
|
|
|
|
var _element$ownerDocumen;
|
|
|
|
|
|
|
|
|
|
if (list === void 0) {
|
|
|
|
|
list = [];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var scrollParent = getScrollParent(element);
|
|
|
|
|
var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body);
|
|
|
|
|
var win = getWindow(scrollParent);
|
|
|
|
|
var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;
|
|
|
|
|
var updatedList = list.concat(target);
|
|
|
|
|
return isBody ? updatedList : // $FlowFixMe[incompatible-call]: isBody tells us target will be an HTMLElement here
|
|
|
|
|
updatedList.concat(listScrollParents(getParentNode(target)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function rectToClientRect(rect) {
|
|
|
|
|
return Object.assign({}, rect, {
|
|
|
|
|
left: rect.x,
|
|
|
|
|
top: rect.y,
|
|
|
|
|
right: rect.x + rect.width,
|
|
|
|
|
bottom: rect.y + rect.height
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function getInnerBoundingClientRect(element) {
|
|
|
|
|
var rect = getBoundingClientRect(element);
|
|
|
|
|
rect.top = rect.top + element.clientTop;
|
|
|
|
|
rect.left = rect.left + element.clientLeft;
|
|
|
|
|
rect.bottom = rect.top + element.clientHeight;
|
|
|
|
|
rect.right = rect.left + element.clientWidth;
|
|
|
|
|
rect.width = element.clientWidth;
|
|
|
|
|
rect.height = element.clientHeight;
|
|
|
|
|
rect.x = rect.left;
|
|
|
|
|
rect.y = rect.top;
|
|
|
|
|
return rect;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function getClientRectFromMixedType(element, clippingParent) {
|
|
|
|
|
return clippingParent === viewport ? rectToClientRect(getViewportRect(element)) : isHTMLElement(clippingParent) ? getInnerBoundingClientRect(clippingParent) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
|
|
|
|
|
} // A "clipping parent" is an overflowable container with the characteristic of
|
|
|
|
|
// clipping (or hiding) overflowing elements with a position different from
|
|
|
|
|
// `initial`
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function getClippingParents(element) {
|
|
|
|
|
var clippingParents = listScrollParents(getParentNode(element));
|
|
|
|
|
var canEscapeClipping = ['absolute', 'fixed'].indexOf(getComputedStyle(element).position) >= 0;
|
|
|
|
|
var clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;
|
|
|
|
|
|
|
|
|
|
if (!isElement(clipperElement)) {
|
|
|
|
|
return [];
|
|
|
|
|
} // $FlowFixMe[incompatible-return]: https://github.com/facebook/flow/issues/1414
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return clippingParents.filter(function (clippingParent) {
|
|
|
|
|
return isElement(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== 'body';
|
|
|
|
|
});
|
|
|
|
|
} // Gets the maximum area that the element is visible in due to any number of
|
|
|
|
|
// clipping parents
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function getClippingRect(element, boundary, rootBoundary) {
|
|
|
|
|
var mainClippingParents = boundary === 'clippingParents' ? getClippingParents(element) : [].concat(boundary);
|
|
|
|
|
var clippingParents = [].concat(mainClippingParents, [rootBoundary]);
|
|
|
|
|
var firstClippingParent = clippingParents[0];
|
|
|
|
|
var clippingRect = clippingParents.reduce(function (accRect, clippingParent) {
|
|
|
|
|
var rect = getClientRectFromMixedType(element, clippingParent);
|
|
|
|
|
accRect.top = max(rect.top, accRect.top);
|
|
|
|
|
accRect.right = min(rect.right, accRect.right);
|
|
|
|
|
accRect.bottom = min(rect.bottom, accRect.bottom);
|
|
|
|
|
accRect.left = max(rect.left, accRect.left);
|
|
|
|
|
return accRect;
|
|
|
|
|
}, getClientRectFromMixedType(element, firstClippingParent));
|
|
|
|
|
clippingRect.width = clippingRect.right - clippingRect.left;
|
|
|
|
|
clippingRect.height = clippingRect.bottom - clippingRect.top;
|
|
|
|
|
clippingRect.x = clippingRect.left;
|
|
|
|
|
clippingRect.y = clippingRect.top;
|
|
|
|
|
return clippingRect;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function computeOffsets(_ref) {
|
|
|
|
|
var reference = _ref.reference,
|
|
|
|
|
element = _ref.element,
|
|
|
|
|
placement = _ref.placement;
|
|
|
|
|
var basePlacement = placement ? getBasePlacement(placement) : null;
|
|
|
|
|
var variation = placement ? getVariation(placement) : null;
|
|
|
|
|
var commonX = reference.x + reference.width / 2 - element.width / 2;
|
|
|
|
|
var commonY = reference.y + reference.height / 2 - element.height / 2;
|
|
|
|
|
var offsets;
|
|
|
|
|
|
|
|
|
|
switch (basePlacement) {
|
|
|
|
|
case top:
|
|
|
|
|
offsets = {
|
|
|
|
|
x: commonX,
|
|
|
|
|
y: reference.y - element.height
|
|
|
|
|
};
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case bottom:
|
|
|
|
|
offsets = {
|
|
|
|
|
x: commonX,
|
|
|
|
|
y: reference.y + reference.height
|
|
|
|
|
};
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case right:
|
|
|
|
|
offsets = {
|
|
|
|
|
x: reference.x + reference.width,
|
|
|
|
|
y: commonY
|
|
|
|
|
};
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case left:
|
|
|
|
|
offsets = {
|
|
|
|
|
x: reference.x - element.width,
|
|
|
|
|
y: commonY
|
|
|
|
|
};
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
offsets = {
|
|
|
|
|
x: reference.x,
|
|
|
|
|
y: reference.y
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var mainAxis = basePlacement ? getMainAxisFromPlacement(basePlacement) : null;
|
|
|
|
|
|
|
|
|
|
if (mainAxis != null) {
|
|
|
|
|
var len = mainAxis === 'y' ? 'height' : 'width';
|
|
|
|
|
|
|
|
|
|
switch (variation) {
|
|
|
|
|
case start:
|
|
|
|
|
offsets[mainAxis] = offsets[mainAxis] - (reference[len] / 2 - element[len] / 2);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case end:
|
|
|
|
|
offsets[mainAxis] = offsets[mainAxis] + (reference[len] / 2 - element[len] / 2);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return offsets;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function detectOverflow(state, options) {
|
|
|
|
|
if (options === void 0) {
|
|
|
|
|
options = {};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var _options = options,
|
|
|
|
|
_options$placement = _options.placement,
|
|
|
|
|
placement = _options$placement === void 0 ? state.placement : _options$placement,
|
|
|
|
|
_options$boundary = _options.boundary,
|
|
|
|
|
boundary = _options$boundary === void 0 ? clippingParents : _options$boundary,
|
|
|
|
|
_options$rootBoundary = _options.rootBoundary,
|
|
|
|
|
rootBoundary = _options$rootBoundary === void 0 ? viewport : _options$rootBoundary,
|
|
|
|
|
_options$elementConte = _options.elementContext,
|
|
|
|
|
elementContext = _options$elementConte === void 0 ? popper : _options$elementConte,
|
|
|
|
|
_options$altBoundary = _options.altBoundary,
|
|
|
|
|
altBoundary = _options$altBoundary === void 0 ? false : _options$altBoundary,
|
|
|
|
|
_options$padding = _options.padding,
|
|
|
|
|
padding = _options$padding === void 0 ? 0 : _options$padding;
|
|
|
|
|
var paddingObject = mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));
|
|
|
|
|
var altContext = elementContext === popper ? reference : popper;
|
|
|
|
|
var popperRect = state.rects.popper;
|
|
|
|
|
var element = state.elements[altBoundary ? altContext : elementContext];
|
|
|
|
|
var clippingClientRect = getClippingRect(isElement(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary);
|
|
|
|
|
var referenceClientRect = getBoundingClientRect(state.elements.reference);
|
|
|
|
|
var popperOffsets = computeOffsets({
|
|
|
|
|
reference: referenceClientRect,
|
|
|
|
|
element: popperRect,
|
|
|
|
|
strategy: 'absolute',
|
|
|
|
|
placement: placement
|
|
|
|
|
});
|
|
|
|
|
var popperClientRect = rectToClientRect(Object.assign({}, popperRect, popperOffsets));
|
|
|
|
|
var elementClientRect = elementContext === popper ? popperClientRect : referenceClientRect; // positive = overflowing the clipping rect
|
|
|
|
|
// 0 or negative = within the clipping rect
|
|
|
|
|
|
|
|
|
|
var overflowOffsets = {
|
|
|
|
|
top: clippingClientRect.top - elementClientRect.top + paddingObject.top,
|
|
|
|
|
bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,
|
|
|
|
|
left: clippingClientRect.left - elementClientRect.left + paddingObject.left,
|
|
|
|
|
right: elementClientRect.right - clippingClientRect.right + paddingObject.right
|
|
|
|
|
};
|
|
|
|
|
var offsetData = state.modifiersData.offset; // Offsets can be applied only to the popper element
|
|
|
|
|
|
|
|
|
|
if (elementContext === popper && offsetData) {
|
|
|
|
|
var offset = offsetData[placement];
|
|
|
|
|
Object.keys(overflowOffsets).forEach(function (key) {
|
|
|
|
|
var multiply = [right, bottom].indexOf(key) >= 0 ? 1 : -1;
|
|
|
|
|
var axis = [top, bottom].indexOf(key) >= 0 ? 'y' : 'x';
|
|
|
|
|
overflowOffsets[key] += offset[axis] * multiply;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return overflowOffsets;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function computeAutoPlacement(state, options) {
|
|
|
|
|
if (options === void 0) {
|
|
|
|
|
options = {};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var _options = options,
|
|
|
|
|
placement = _options.placement,
|
|
|
|
|
boundary = _options.boundary,
|
|
|
|
|
rootBoundary = _options.rootBoundary,
|
|
|
|
|
padding = _options.padding,
|
|
|
|
|
flipVariations = _options.flipVariations,
|
|
|
|
|
_options$allowedAutoP = _options.allowedAutoPlacements,
|
|
|
|
|
allowedAutoPlacements = _options$allowedAutoP === void 0 ? placements : _options$allowedAutoP;
|
|
|
|
|
var variation = getVariation(placement);
|
|
|
|
|
var placements$1 = variation ? flipVariations ? variationPlacements : variationPlacements.filter(function (placement) {
|
|
|
|
|
return getVariation(placement) === variation;
|
|
|
|
|
}) : basePlacements;
|
|
|
|
|
var allowedPlacements = placements$1.filter(function (placement) {
|
|
|
|
|
return allowedAutoPlacements.indexOf(placement) >= 0;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if (allowedPlacements.length === 0) {
|
|
|
|
|
allowedPlacements = placements$1;
|
|
|
|
|
|
|
|
|
|
if (process.env.NODE_ENV !== "production") {
|
|
|
|
|
console.error(['Popper: The `allowedAutoPlacements` option did not allow any', 'placements. Ensure the `placement` option matches the variation', 'of the allowed placements.', 'For example, "auto" cannot be used to allow "bottom-start".', 'Use "auto-start" instead.'].join(' '));
|
|
|
|
|
}
|
|
|
|
|
} // $FlowFixMe[incompatible-type]: Flow seems to have problems with two array unions...
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var overflows = allowedPlacements.reduce(function (acc, placement) {
|
|
|
|
|
acc[placement] = detectOverflow(state, {
|
|
|
|
|
placement: placement,
|
|
|
|
|
boundary: boundary,
|
|
|
|
|
rootBoundary: rootBoundary,
|
|
|
|
|
padding: padding
|
|
|
|
|
})[getBasePlacement(placement)];
|
|
|
|
|
return acc;
|
|
|
|
|
}, {});
|
|
|
|
|
return Object.keys(overflows).sort(function (a, b) {
|
|
|
|
|
return overflows[a] - overflows[b];
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function getExpandedFallbackPlacements(placement) {
|
|
|
|
|
if (getBasePlacement(placement) === auto) {
|
|
|
|
|
return [];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var oppositePlacement = getOppositePlacement(placement);
|
|
|
|
|
return [getOppositeVariationPlacement(placement), oppositePlacement, getOppositeVariationPlacement(oppositePlacement)];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function flip(_ref) {
|
|
|
|
|
var state = _ref.state,
|
|
|
|
|
options = _ref.options,
|
|
|
|
|
name = _ref.name;
|
|
|
|
|
|
|
|
|
|
if (state.modifiersData[name]._skip) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var _options$mainAxis = options.mainAxis,
|
|
|
|
|
checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis,
|
|
|
|
|
_options$altAxis = options.altAxis,
|
|
|
|
|
checkAltAxis = _options$altAxis === void 0 ? true : _options$altAxis,
|
|
|
|
|
specifiedFallbackPlacements = options.fallbackPlacements,
|
|
|
|
|
padding = options.padding,
|
|
|
|
|
boundary = options.boundary,
|
|
|
|
|
rootBoundary = options.rootBoundary,
|
|
|
|
|
altBoundary = options.altBoundary,
|
|
|
|
|
_options$flipVariatio = options.flipVariations,
|
|
|
|
|
flipVariations = _options$flipVariatio === void 0 ? true : _options$flipVariatio,
|
|
|
|
|
allowedAutoPlacements = options.allowedAutoPlacements;
|
|
|
|
|
var preferredPlacement = state.options.placement;
|
|
|
|
|
var basePlacement = getBasePlacement(preferredPlacement);
|
|
|
|
|
var isBasePlacement = basePlacement === preferredPlacement;
|
|
|
|
|
var fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipVariations ? [getOppositePlacement(preferredPlacement)] : getExpandedFallbackPlacements(preferredPlacement));
|
|
|
|
|
var placements = [preferredPlacement].concat(fallbackPlacements).reduce(function (acc, placement) {
|
|
|
|
|
return acc.concat(getBasePlacement(placement) === auto ? computeAutoPlacement(state, {
|
|
|
|
|
placement: placement,
|
|
|
|
|
boundary: boundary,
|
|
|
|
|
rootBoundary: rootBoundary,
|
|
|
|
|
padding: padding,
|
|
|
|
|
flipVariations: flipVariations,
|
|
|
|
|
allowedAutoPlacements: allowedAutoPlacements
|
|
|
|
|
}) : placement);
|
|
|
|
|
}, []);
|
|
|
|
|
var referenceRect = state.rects.reference;
|
|
|
|
|
var popperRect = state.rects.popper;
|
|
|
|
|
var checksMap = new Map();
|
|
|
|
|
var makeFallbackChecks = true;
|
|
|
|
|
var firstFittingPlacement = placements[0];
|
|
|
|
|
|
|
|
|
|
for (var i = 0; i < placements.length; i++) {
|
|
|
|
|
var placement = placements[i];
|
|
|
|
|
|
|
|
|
|
var _basePlacement = getBasePlacement(placement);
|
|
|
|
|
|
|
|
|
|
var isStartVariation = getVariation(placement) === start;
|
|
|
|
|
var isVertical = [top, bottom].indexOf(_basePlacement) >= 0;
|
|
|
|
|
var len = isVertical ? 'width' : 'height';
|
|
|
|
|
var overflow = detectOverflow(state, {
|
|
|
|
|
placement: placement,
|
|
|
|
|
boundary: boundary,
|
|
|
|
|
rootBoundary: rootBoundary,
|
|
|
|
|
altBoundary: altBoundary,
|
|
|
|
|
padding: padding
|
|
|
|
|
});
|
|
|
|
|
var mainVariationSide = isVertical ? isStartVariation ? right : left : isStartVariation ? bottom : top;
|
|
|
|
|
|
|
|
|
|
if (referenceRect[len] > popperRect[len]) {
|
|
|
|
|
mainVariationSide = getOppositePlacement(mainVariationSide);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var altVariationSide = getOppositePlacement(mainVariationSide);
|
|
|
|
|
var checks = [];
|
|
|
|
|
|
|
|
|
|
if (checkMainAxis) {
|
|
|
|
|
checks.push(overflow[_basePlacement] <= 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (checkAltAxis) {
|
|
|
|
|
checks.push(overflow[mainVariationSide] <= 0, overflow[altVariationSide] <= 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (checks.every(function (check) {
|
|
|
|
|
return check;
|
|
|
|
|
})) {
|
|
|
|
|
firstFittingPlacement = placement;
|
|
|
|
|
makeFallbackChecks = false;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
checksMap.set(placement, checks);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (makeFallbackChecks) {
|
|
|
|
|
// `2` may be desired in some cases – research later
|
|
|
|
|
var numberOfChecks = flipVariations ? 3 : 1;
|
|
|
|
|
|
|
|
|
|
var _loop = function _loop(_i) {
|
|
|
|
|
var fittingPlacement = placements.find(function (placement) {
|
|
|
|
|
var checks = checksMap.get(placement);
|
|
|
|
|
|
|
|
|
|
if (checks) {
|
|
|
|
|
return checks.slice(0, _i).every(function (check) {
|
|
|
|
|
return check;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if (fittingPlacement) {
|
|
|
|
|
firstFittingPlacement = fittingPlacement;
|
|
|
|
|
return "break";
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
for (var _i = numberOfChecks; _i > 0; _i--) {
|
|
|
|
|
var _ret = _loop(_i);
|
|
|
|
|
|
|
|
|
|
if (_ret === "break") break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (state.placement !== firstFittingPlacement) {
|
|
|
|
|
state.modifiersData[name]._skip = true;
|
|
|
|
|
state.placement = firstFittingPlacement;
|
|
|
|
|
state.reset = true;
|
|
|
|
|
}
|
|
|
|
|
} // eslint-disable-next-line import/no-unused-modules
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var flip$1 = {
|
|
|
|
|
name: 'flip',
|
|
|
|
|
enabled: true,
|
|
|
|
|
phase: 'main',
|
|
|
|
|
fn: flip,
|
|
|
|
|
requiresIfExists: ['offset'],
|
|
|
|
|
data: {
|
|
|
|
|
_skip: false
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
function getSideOffsets(overflow, rect, preventedOffsets) {
|
|
|
|
|
if (preventedOffsets === void 0) {
|
|
|
|
|
preventedOffsets = {
|
|
|
|
|
x: 0,
|
|
|
|
|
y: 0
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
top: overflow.top - rect.height - preventedOffsets.y,
|
|
|
|
|
right: overflow.right - rect.width + preventedOffsets.x,
|
|
|
|
|
bottom: overflow.bottom - rect.height + preventedOffsets.y,
|
|
|
|
|
left: overflow.left - rect.width - preventedOffsets.x
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function isAnySideFullyClipped(overflow) {
|
|
|
|
|
return [top, right, bottom, left].some(function (side) {
|
|
|
|
|
return overflow[side] >= 0;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function hide(_ref) {
|
|
|
|
|
var state = _ref.state,
|
|
|
|
|
name = _ref.name;
|
|
|
|
|
var referenceRect = state.rects.reference;
|
|
|
|
|
var popperRect = state.rects.popper;
|
|
|
|
|
var preventedOffsets = state.modifiersData.preventOverflow;
|
|
|
|
|
var referenceOverflow = detectOverflow(state, {
|
|
|
|
|
elementContext: 'reference'
|
|
|
|
|
});
|
|
|
|
|
var popperAltOverflow = detectOverflow(state, {
|
|
|
|
|
altBoundary: true
|
|
|
|
|
});
|
|
|
|
|
var referenceClippingOffsets = getSideOffsets(referenceOverflow, referenceRect);
|
|
|
|
|
var popperEscapeOffsets = getSideOffsets(popperAltOverflow, popperRect, preventedOffsets);
|
|
|
|
|
var isReferenceHidden = isAnySideFullyClipped(referenceClippingOffsets);
|
|
|
|
|
var hasPopperEscaped = isAnySideFullyClipped(popperEscapeOffsets);
|
|
|
|
|
state.modifiersData[name] = {
|
|
|
|
|
referenceClippingOffsets: referenceClippingOffsets,
|
|
|
|
|
popperEscapeOffsets: popperEscapeOffsets,
|
|
|
|
|
isReferenceHidden: isReferenceHidden,
|
|
|
|
|
hasPopperEscaped: hasPopperEscaped
|
|
|
|
|
};
|
|
|
|
|
state.attributes.popper = Object.assign({}, state.attributes.popper, {
|
|
|
|
|
'data-popper-reference-hidden': isReferenceHidden,
|
|
|
|
|
'data-popper-escaped': hasPopperEscaped
|
|
|
|
|
});
|
|
|
|
|
} // eslint-disable-next-line import/no-unused-modules
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var hide$1 = {
|
|
|
|
|
name: 'hide',
|
|
|
|
|
enabled: true,
|
|
|
|
|
phase: 'main',
|
|
|
|
|
requiresIfExists: ['preventOverflow'],
|
|
|
|
|
fn: hide
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
function distanceAndSkiddingToXY(placement, rects, offset) {
|
|
|
|
|
var basePlacement = getBasePlacement(placement);
|
|
|
|
|
var invertDistance = [left, top].indexOf(basePlacement) >= 0 ? -1 : 1;
|
|
|
|
|
|
|
|
|
|
var _ref = typeof offset === 'function' ? offset(Object.assign({}, rects, {
|
|
|
|
|
placement: placement
|
|
|
|
|
})) : offset,
|
|
|
|
|
skidding = _ref[0],
|
|
|
|
|
distance = _ref[1];
|
|
|
|
|
|
|
|
|
|
skidding = skidding || 0;
|
|
|
|
|
distance = (distance || 0) * invertDistance;
|
|
|
|
|
return [left, right].indexOf(basePlacement) >= 0 ? {
|
|
|
|
|
x: distance,
|
|
|
|
|
y: skidding
|
|
|
|
|
} : {
|
|
|
|
|
x: skidding,
|
|
|
|
|
y: distance
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function offset(_ref2) {
|
|
|
|
|
var state = _ref2.state,
|
|
|
|
|
options = _ref2.options,
|
|
|
|
|
name = _ref2.name;
|
|
|
|
|
var _options$offset = options.offset,
|
|
|
|
|
offset = _options$offset === void 0 ? [0, 0] : _options$offset;
|
|
|
|
|
var data = placements.reduce(function (acc, placement) {
|
|
|
|
|
acc[placement] = distanceAndSkiddingToXY(placement, state.rects, offset);
|
|
|
|
|
return acc;
|
|
|
|
|
}, {});
|
|
|
|
|
var _data$state$placement = data[state.placement],
|
|
|
|
|
x = _data$state$placement.x,
|
|
|
|
|
y = _data$state$placement.y;
|
|
|
|
|
|
|
|
|
|
if (state.modifiersData.popperOffsets != null) {
|
|
|
|
|
state.modifiersData.popperOffsets.x += x;
|
|
|
|
|
state.modifiersData.popperOffsets.y += y;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
state.modifiersData[name] = data;
|
|
|
|
|
} // eslint-disable-next-line import/no-unused-modules
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var offset$1 = {
|
|
|
|
|
name: 'offset',
|
|
|
|
|
enabled: true,
|
|
|
|
|
phase: 'main',
|
|
|
|
|
requires: ['popperOffsets'],
|
|
|
|
|
fn: offset
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
function popperOffsets(_ref) {
|
|
|
|
|
var state = _ref.state,
|
|
|
|
|
name = _ref.name;
|
|
|
|
|
// Offsets are the actual position the popper needs to have to be
|
|
|
|
|
// properly positioned near its reference element
|
|
|
|
|
// This is the most basic placement, and will be adjusted by
|
|
|
|
|
// the modifiers in the next step
|
|
|
|
|
state.modifiersData[name] = computeOffsets({
|
|
|
|
|
reference: state.rects.reference,
|
|
|
|
|
element: state.rects.popper,
|
|
|
|
|
strategy: 'absolute',
|
|
|
|
|
placement: state.placement
|
|
|
|
|
});
|
|
|
|
|
} // eslint-disable-next-line import/no-unused-modules
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var popperOffsets$1 = {
|
|
|
|
|
name: 'popperOffsets',
|
|
|
|
|
enabled: true,
|
|
|
|
|
phase: 'read',
|
|
|
|
|
fn: popperOffsets,
|
|
|
|
|
data: {}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
function getAltAxis(axis) {
|
|
|
|
|
return axis === 'x' ? 'y' : 'x';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function preventOverflow(_ref) {
|
|
|
|
|
var state = _ref.state,
|
|
|
|
|
options = _ref.options,
|
|
|
|
|
name = _ref.name;
|
|
|
|
|
var _options$mainAxis = options.mainAxis,
|
|
|
|
|
checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis,
|
|
|
|
|
_options$altAxis = options.altAxis,
|
|
|
|
|
checkAltAxis = _options$altAxis === void 0 ? false : _options$altAxis,
|
|
|
|
|
boundary = options.boundary,
|
|
|
|
|
rootBoundary = options.rootBoundary,
|
|
|
|
|
altBoundary = options.altBoundary,
|
|
|
|
|
padding = options.padding,
|
|
|
|
|
_options$tether = options.tether,
|
|
|
|
|
tether = _options$tether === void 0 ? true : _options$tether,
|
|
|
|
|
_options$tetherOffset = options.tetherOffset,
|
|
|
|
|
tetherOffset = _options$tetherOffset === void 0 ? 0 : _options$tetherOffset;
|
|
|
|
|
var overflow = detectOverflow(state, {
|
|
|
|
|
boundary: boundary,
|
|
|
|
|
rootBoundary: rootBoundary,
|
|
|
|
|
padding: padding,
|
|
|
|
|
altBoundary: altBoundary
|
|
|
|
|
});
|
|
|
|
|
var basePlacement = getBasePlacement(state.placement);
|
|
|
|
|
var variation = getVariation(state.placement);
|
|
|
|
|
var isBasePlacement = !variation;
|
|
|
|
|
var mainAxis = getMainAxisFromPlacement(basePlacement);
|
|
|
|
|
var altAxis = getAltAxis(mainAxis);
|
|
|
|
|
var popperOffsets = state.modifiersData.popperOffsets;
|
|
|
|
|
var referenceRect = state.rects.reference;
|
|
|
|
|
var popperRect = state.rects.popper;
|
|
|
|
|
var tetherOffsetValue = typeof tetherOffset === 'function' ? tetherOffset(Object.assign({}, state.rects, {
|
|
|
|
|
placement: state.placement
|
|
|
|
|
})) : tetherOffset;
|
|
|
|
|
var data = {
|
|
|
|
|
x: 0,
|
|
|
|
|
y: 0
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
if (!popperOffsets) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (checkMainAxis || checkAltAxis) {
|
|
|
|
|
var mainSide = mainAxis === 'y' ? top : left;
|
|
|
|
|
var altSide = mainAxis === 'y' ? bottom : right;
|
|
|
|
|
var len = mainAxis === 'y' ? 'height' : 'width';
|
|
|
|
|
var offset = popperOffsets[mainAxis];
|
|
|
|
|
var min$1 = popperOffsets[mainAxis] + overflow[mainSide];
|
|
|
|
|
var max$1 = popperOffsets[mainAxis] - overflow[altSide];
|
|
|
|
|
var additive = tether ? -popperRect[len] / 2 : 0;
|
|
|
|
|
var minLen = variation === start ? referenceRect[len] : popperRect[len];
|
|
|
|
|
var maxLen = variation === start ? -popperRect[len] : -referenceRect[len]; // We need to include the arrow in the calculation so the arrow doesn't go
|
|
|
|
|
// outside the reference bounds
|
|
|
|
|
|
|
|
|
|
var arrowElement = state.elements.arrow;
|
|
|
|
|
var arrowRect = tether && arrowElement ? getLayoutRect(arrowElement) : {
|
|
|
|
|
width: 0,
|
|
|
|
|
height: 0
|
|
|
|
|
};
|
|
|
|
|
var arrowPaddingObject = state.modifiersData['arrow#persistent'] ? state.modifiersData['arrow#persistent'].padding : getFreshSideObject();
|
|
|
|
|
var arrowPaddingMin = arrowPaddingObject[mainSide];
|
|
|
|
|
var arrowPaddingMax = arrowPaddingObject[altSide]; // If the reference length is smaller than the arrow length, we don't want
|
|
|
|
|
// to include its full size in the calculation. If the reference is small
|
|
|
|
|
// and near the edge of a boundary, the popper can overflow even if the
|
|
|
|
|
// reference is not overflowing as well (e.g. virtual elements with no
|
|
|
|
|
// width or height)
|
|
|
|
|
|
|
|
|
|
var arrowLen = within(0, referenceRect[len], arrowRect[len]);
|
|
|
|
|
var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - tetherOffsetValue : minLen - arrowLen - arrowPaddingMin - tetherOffsetValue;
|
|
|
|
|
var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + tetherOffsetValue : maxLen + arrowLen + arrowPaddingMax + tetherOffsetValue;
|
|
|
|
|
var arrowOffsetParent = state.elements.arrow && getOffsetParent(state.elements.arrow);
|
|
|
|
|
var clientOffset = arrowOffsetParent ? mainAxis === 'y' ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0;
|
|
|
|
|
var offsetModifierValue = state.modifiersData.offset ? state.modifiersData.offset[state.placement][mainAxis] : 0;
|
|
|
|
|
var tetherMin = popperOffsets[mainAxis] + minOffset - offsetModifierValue - clientOffset;
|
|
|
|
|
var tetherMax = popperOffsets[mainAxis] + maxOffset - offsetModifierValue;
|
|
|
|
|
|
|
|
|
|
if (checkMainAxis) {
|
|
|
|
|
var preventedOffset = within(tether ? min(min$1, tetherMin) : min$1, offset, tether ? max(max$1, tetherMax) : max$1);
|
|
|
|
|
popperOffsets[mainAxis] = preventedOffset;
|
|
|
|
|
data[mainAxis] = preventedOffset - offset;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (checkAltAxis) {
|
|
|
|
|
var _mainSide = mainAxis === 'x' ? top : left;
|
|
|
|
|
|
|
|
|
|
var _altSide = mainAxis === 'x' ? bottom : right;
|
|
|
|
|
|
|
|
|
|
var _offset = popperOffsets[altAxis];
|
|
|
|
|
|
|
|
|
|
var _min = _offset + overflow[_mainSide];
|
|
|
|
|
|
|
|
|
|
var _max = _offset - overflow[_altSide];
|
|
|
|
|
|
|
|
|
|
var _preventedOffset = within(tether ? min(_min, tetherMin) : _min, _offset, tether ? max(_max, tetherMax) : _max);
|
|
|
|
|
|
|
|
|
|
popperOffsets[altAxis] = _preventedOffset;
|
|
|
|
|
data[altAxis] = _preventedOffset - _offset;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
state.modifiersData[name] = data;
|
|
|
|
|
} // eslint-disable-next-line import/no-unused-modules
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var preventOverflow$1 = {
|
|
|
|
|
name: 'preventOverflow',
|
|
|
|
|
enabled: true,
|
|
|
|
|
phase: 'main',
|
|
|
|
|
fn: preventOverflow,
|
|
|
|
|
requiresIfExists: ['offset']
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
function getHTMLElementScroll(element) {
|
|
|
|
|
return {
|
|
|
|
|
scrollLeft: element.scrollLeft,
|
|
|
|
|
scrollTop: element.scrollTop
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function getNodeScroll(node) {
|
|
|
|
|
if (node === getWindow(node) || !isHTMLElement(node)) {
|
|
|
|
|
return getWindowScroll(node);
|
|
|
|
|
} else {
|
|
|
|
|
return getHTMLElementScroll(node);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function isElementScaled(element) {
|
|
|
|
|
var rect = element.getBoundingClientRect();
|
|
|
|
|
var scaleX = rect.width / element.offsetWidth || 1;
|
|
|
|
|
var scaleY = rect.height / element.offsetHeight || 1;
|
|
|
|
|
return scaleX !== 1 || scaleY !== 1;
|
|
|
|
|
} // Returns the composite rect of an element relative to its offsetParent.
|
|
|
|
|
// Composite means it takes into account transforms as well as layout.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
|
|
|
|
|
if (isFixed === void 0) {
|
|
|
|
|
isFixed = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var isOffsetParentAnElement = isHTMLElement(offsetParent);
|
|
|
|
|
isHTMLElement(offsetParent) && isElementScaled(offsetParent);
|
|
|
|
|
var documentElement = getDocumentElement(offsetParent);
|
|
|
|
|
var rect = getBoundingClientRect(elementOrVirtualElement);
|
|
|
|
|
var scroll = {
|
|
|
|
|
scrollLeft: 0,
|
|
|
|
|
scrollTop: 0
|
|
|
|
|
};
|
|
|
|
|
var offsets = {
|
|
|
|
|
x: 0,
|
|
|
|
|
y: 0
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
|
|
|
|
if (getNodeName(offsetParent) !== 'body' || // https://github.com/popperjs/popper-core/issues/1078
|
|
|
|
|
isScrollParent(documentElement)) {
|
|
|
|
|
scroll = getNodeScroll(offsetParent);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (isHTMLElement(offsetParent)) {
|
|
|
|
|
offsets = getBoundingClientRect(offsetParent);
|
|
|
|
|
offsets.x += offsetParent.clientLeft;
|
|
|
|
|
offsets.y += offsetParent.clientTop;
|
|
|
|
|
} else if (documentElement) {
|
|
|
|
|
offsets.x = getWindowScrollBarX(documentElement);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
x: rect.left + scroll.scrollLeft - offsets.x,
|
|
|
|
|
y: rect.top + scroll.scrollTop - offsets.y,
|
|
|
|
|
width: rect.width,
|
|
|
|
|
height: rect.height
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function order(modifiers) {
|
|
|
|
|
var map = new Map();
|
|
|
|
|
var visited = new Set();
|
|
|
|
|
var result = [];
|
|
|
|
|
modifiers.forEach(function (modifier) {
|
|
|
|
|
map.set(modifier.name, modifier);
|
|
|
|
|
}); // On visiting object, check for its dependencies and visit them recursively
|
|
|
|
|
|
|
|
|
|
function sort(modifier) {
|
|
|
|
|
visited.add(modifier.name);
|
|
|
|
|
var requires = [].concat(modifier.requires || [], modifier.requiresIfExists || []);
|
|
|
|
|
requires.forEach(function (dep) {
|
|
|
|
|
if (!visited.has(dep)) {
|
|
|
|
|
var depModifier = map.get(dep);
|
|
|
|
|
|
|
|
|
|
if (depModifier) {
|
|
|
|
|
sort(depModifier);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
result.push(modifier);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
modifiers.forEach(function (modifier) {
|
|
|
|
|
if (!visited.has(modifier.name)) {
|
|
|
|
|
// check for visited object
|
|
|
|
|
sort(modifier);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function orderModifiers(modifiers) {
|
|
|
|
|
// order based on dependencies
|
|
|
|
|
var orderedModifiers = order(modifiers); // order based on phase
|
|
|
|
|
|
|
|
|
|
return modifierPhases.reduce(function (acc, phase) {
|
|
|
|
|
return acc.concat(orderedModifiers.filter(function (modifier) {
|
|
|
|
|
return modifier.phase === phase;
|
|
|
|
|
}));
|
|
|
|
|
}, []);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function debounce(fn) {
|
|
|
|
|
var pending;
|
|
|
|
|
return function () {
|
|
|
|
|
if (!pending) {
|
|
|
|
|
pending = new Promise(function (resolve) {
|
|
|
|
|
Promise.resolve().then(function () {
|
|
|
|
|
pending = undefined;
|
|
|
|
|
resolve(fn());
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return pending;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function format(str) {
|
|
|
|
|
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
|
|
|
args[_key - 1] = arguments[_key];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return [].concat(args).reduce(function (p, c) {
|
|
|
|
|
return p.replace(/%s/, c);
|
|
|
|
|
}, str);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var INVALID_MODIFIER_ERROR = 'Popper: modifier "%s" provided an invalid %s property, expected %s but got %s';
|
|
|
|
|
var MISSING_DEPENDENCY_ERROR = 'Popper: modifier "%s" requires "%s", but "%s" modifier is not available';
|
|
|
|
|
var VALID_PROPERTIES = ['name', 'enabled', 'phase', 'fn', 'effect', 'requires', 'options'];
|
|
|
|
|
function validateModifiers(modifiers) {
|
|
|
|
|
modifiers.forEach(function (modifier) {
|
|
|
|
|
[].concat(Object.keys(modifier), VALID_PROPERTIES) // IE11-compatible replacement for `new Set(iterable)`
|
|
|
|
|
.filter(function (value, index, self) {
|
|
|
|
|
return self.indexOf(value) === index;
|
|
|
|
|
}).forEach(function (key) {
|
|
|
|
|
switch (key) {
|
|
|
|
|
case 'name':
|
|
|
|
|
if (typeof modifier.name !== 'string') {
|
|
|
|
|
console.error(format(INVALID_MODIFIER_ERROR, String(modifier.name), '"name"', '"string"', "\"" + String(modifier.name) + "\""));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'enabled':
|
|
|
|
|
if (typeof modifier.enabled !== 'boolean') {
|
|
|
|
|
console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"enabled"', '"boolean"', "\"" + String(modifier.enabled) + "\""));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'phase':
|
|
|
|
|
if (modifierPhases.indexOf(modifier.phase) < 0) {
|
|
|
|
|
console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"phase"', "either " + modifierPhases.join(', '), "\"" + String(modifier.phase) + "\""));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'fn':
|
|
|
|
|
if (typeof modifier.fn !== 'function') {
|
|
|
|
|
console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"fn"', '"function"', "\"" + String(modifier.fn) + "\""));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'effect':
|
|
|
|
|
if (modifier.effect != null && typeof modifier.effect !== 'function') {
|
|
|
|
|
console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"effect"', '"function"', "\"" + String(modifier.fn) + "\""));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'requires':
|
|
|
|
|
if (modifier.requires != null && !Array.isArray(modifier.requires)) {
|
|
|
|
|
console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"requires"', '"array"', "\"" + String(modifier.requires) + "\""));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'requiresIfExists':
|
|
|
|
|
if (!Array.isArray(modifier.requiresIfExists)) {
|
|
|
|
|
console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"requiresIfExists"', '"array"', "\"" + String(modifier.requiresIfExists) + "\""));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'options':
|
|
|
|
|
case 'data':
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
console.error("PopperJS: an invalid property has been provided to the \"" + modifier.name + "\" modifier, valid properties are " + VALID_PROPERTIES.map(function (s) {
|
|
|
|
|
return "\"" + s + "\"";
|
|
|
|
|
}).join(', ') + "; but \"" + key + "\" was provided.");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
modifier.requires && modifier.requires.forEach(function (requirement) {
|
|
|
|
|
if (modifiers.find(function (mod) {
|
|
|
|
|
return mod.name === requirement;
|
|
|
|
|
}) == null) {
|
|
|
|
|
console.error(format(MISSING_DEPENDENCY_ERROR, String(modifier.name), requirement, requirement));
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function uniqueBy(arr, fn) {
|
|
|
|
|
var identifiers = new Set();
|
|
|
|
|
return arr.filter(function (item) {
|
|
|
|
|
var identifier = fn(item);
|
|
|
|
|
|
|
|
|
|
if (!identifiers.has(identifier)) {
|
|
|
|
|
identifiers.add(identifier);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function mergeByName(modifiers) {
|
|
|
|
|
var merged = modifiers.reduce(function (merged, current) {
|
|
|
|
|
var existing = merged[current.name];
|
|
|
|
|
merged[current.name] = existing ? Object.assign({}, existing, current, {
|
|
|
|
|
options: Object.assign({}, existing.options, current.options),
|
|
|
|
|
data: Object.assign({}, existing.data, current.data)
|
|
|
|
|
}) : current;
|
|
|
|
|
return merged;
|
|
|
|
|
}, {}); // IE11 does not support Object.values
|
|
|
|
|
|
|
|
|
|
return Object.keys(merged).map(function (key) {
|
|
|
|
|
return merged[key];
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var INVALID_ELEMENT_ERROR = 'Popper: Invalid reference or popper argument provided. They must be either a DOM element or virtual element.';
|
|
|
|
|
var INFINITE_LOOP_ERROR = 'Popper: An infinite loop in the modifiers cycle has been detected! The cycle has been interrupted to prevent a browser crash.';
|
|
|
|
|
var DEFAULT_OPTIONS = {
|
|
|
|
|
placement: 'bottom',
|
|
|
|
|
modifiers: [],
|
|
|
|
|
strategy: 'absolute'
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
function areValidElements() {
|
|
|
|
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
|
|
|
args[_key] = arguments[_key];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return !args.some(function (element) {
|
|
|
|
|
return !(element && typeof element.getBoundingClientRect === 'function');
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function popperGenerator(generatorOptions) {
|
|
|
|
|
if (generatorOptions === void 0) {
|
|
|
|
|
generatorOptions = {};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var _generatorOptions = generatorOptions,
|
|
|
|
|
_generatorOptions$def = _generatorOptions.defaultModifiers,
|
|
|
|
|
defaultModifiers = _generatorOptions$def === void 0 ? [] : _generatorOptions$def,
|
|
|
|
|
_generatorOptions$def2 = _generatorOptions.defaultOptions,
|
|
|
|
|
defaultOptions = _generatorOptions$def2 === void 0 ? DEFAULT_OPTIONS : _generatorOptions$def2;
|
|
|
|
|
return function createPopper(reference, popper, options) {
|
|
|
|
|
if (options === void 0) {
|
|
|
|
|
options = defaultOptions;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var state = {
|
|
|
|
|
placement: 'bottom',
|
|
|
|
|
orderedModifiers: [],
|
|
|
|
|
options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions),
|
|
|
|
|
modifiersData: {},
|
|
|
|
|
elements: {
|
|
|
|
|
reference: reference,
|
|
|
|
|
popper: popper
|
|
|
|
|
},
|
|
|
|
|
attributes: {},
|
|
|
|
|
styles: {}
|
|
|
|
|
};
|
|
|
|
|
var effectCleanupFns = [];
|
|
|
|
|
var isDestroyed = false;
|
|
|
|
|
var instance = {
|
|
|
|
|
state: state,
|
|
|
|
|
setOptions: function setOptions(setOptionsAction) {
|
|
|
|
|
var options = typeof setOptionsAction === 'function' ? setOptionsAction(state.options) : setOptionsAction;
|
|
|
|
|
cleanupModifierEffects();
|
|
|
|
|
state.options = Object.assign({}, defaultOptions, state.options, options);
|
|
|
|
|
state.scrollParents = {
|
|
|
|
|
reference: isElement(reference) ? listScrollParents(reference) : reference.contextElement ? listScrollParents(reference.contextElement) : [],
|
|
|
|
|
popper: listScrollParents(popper)
|
|
|
|
|
}; // Orders the modifiers based on their dependencies and `phase`
|
|
|
|
|
// properties
|
|
|
|
|
|
|
|
|
|
var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers, state.options.modifiers))); // Strip out disabled modifiers
|
|
|
|
|
|
|
|
|
|
state.orderedModifiers = orderedModifiers.filter(function (m) {
|
|
|
|
|
return m.enabled;
|
|
|
|
|
}); // Validate the provided modifiers so that the consumer will get warned
|
|
|
|
|
// if one of the modifiers is invalid for any reason
|
|
|
|
|
|
|
|
|
|
if (process.env.NODE_ENV !== "production") {
|
|
|
|
|
var modifiers = uniqueBy([].concat(orderedModifiers, state.options.modifiers), function (_ref) {
|
|
|
|
|
var name = _ref.name;
|
|
|
|
|
return name;
|
|
|
|
|
});
|
|
|
|
|
validateModifiers(modifiers);
|
|
|
|
|
|
|
|
|
|
if (getBasePlacement(state.options.placement) === auto) {
|
|
|
|
|
var flipModifier = state.orderedModifiers.find(function (_ref2) {
|
|
|
|
|
var name = _ref2.name;
|
|
|
|
|
return name === 'flip';
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if (!flipModifier) {
|
|
|
|
|
console.error(['Popper: "auto" placements require the "flip" modifier be', 'present and enabled to work.'].join(' '));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var _getComputedStyle = getComputedStyle(popper),
|
|
|
|
|
marginTop = _getComputedStyle.marginTop,
|
|
|
|
|
marginRight = _getComputedStyle.marginRight,
|
|
|
|
|
marginBottom = _getComputedStyle.marginBottom,
|
|
|
|
|
marginLeft = _getComputedStyle.marginLeft; // We no longer take into account `margins` on the popper, and it can
|
|
|
|
|
// cause bugs with positioning, so we'll warn the consumer
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ([marginTop, marginRight, marginBottom, marginLeft].some(function (margin) {
|
|
|
|
|
return parseFloat(margin);
|
|
|
|
|
})) {
|
|
|
|
|
console.warn(['Popper: CSS "margin" styles cannot be used to apply padding', 'between the popper and its reference element or boundary.', 'To replicate margin, use the `offset` modifier, as well as', 'the `padding` option in the `preventOverflow` and `flip`', 'modifiers.'].join(' '));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
runModifierEffects();
|
|
|
|
|
return instance.update();
|
|
|
|
|
},
|
|
|
|
|
// Sync update – it will always be executed, even if not necessary. This
|
|
|
|
|
// is useful for low frequency updates where sync behavior simplifies the
|
|
|
|
|
// logic.
|
|
|
|
|
// For high frequency updates (e.g. `resize` and `scroll` events), always
|
|
|
|
|
// prefer the async Popper#update method
|
|
|
|
|
forceUpdate: function forceUpdate() {
|
|
|
|
|
if (isDestroyed) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var _state$elements = state.elements,
|
|
|
|
|
reference = _state$elements.reference,
|
|
|
|
|
popper = _state$elements.popper; // Don't proceed if `reference` or `popper` are not valid elements
|
|
|
|
|
// anymore
|
|
|
|
|
|
|
|
|
|
if (!areValidElements(reference, popper)) {
|
|
|
|
|
if (process.env.NODE_ENV !== "production") {
|
|
|
|
|
console.error(INVALID_ELEMENT_ERROR);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
} // Store the reference and popper rects to be read by modifiers
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
state.rects = {
|
|
|
|
|
reference: getCompositeRect(reference, getOffsetParent(popper), state.options.strategy === 'fixed'),
|
|
|
|
|
popper: getLayoutRect(popper)
|
|
|
|
|
}; // Modifiers have the ability to reset the current update cycle. The
|
|
|
|
|
// most common use case for this is the `flip` modifier changing the
|
|
|
|
|
// placement, which then needs to re-run all the modifiers, because the
|
|
|
|
|
// logic was previously ran for the previous placement and is therefore
|
|
|
|
|
// stale/incorrect
|
|
|
|
|
|
|
|
|
|
state.reset = false;
|
|
|
|
|
state.placement = state.options.placement; // On each update cycle, the `modifiersData` property for each modifier
|
|
|
|
|
// is filled with the initial data specified by the modifier. This means
|
|
|
|
|
// it doesn't persist and is fresh on each update.
|
|
|
|
|
// To ensure persistent data, use `${name}#persistent`
|
|
|
|
|
|
|
|
|
|
state.orderedModifiers.forEach(function (modifier) {
|
|
|
|
|
return state.modifiersData[modifier.name] = Object.assign({}, modifier.data);
|
|
|
|
|
});
|
|
|
|
|
var __debug_loops__ = 0;
|
|
|
|
|
|
|
|
|
|
for (var index = 0; index < state.orderedModifiers.length; index++) {
|
|
|
|
|
if (process.env.NODE_ENV !== "production") {
|
|
|
|
|
__debug_loops__ += 1;
|
|
|
|
|
|
|
|
|
|
if (__debug_loops__ > 100) {
|
|
|
|
|
console.error(INFINITE_LOOP_ERROR);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (state.reset === true) {
|
|
|
|
|
state.reset = false;
|
|
|
|
|
index = -1;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var _state$orderedModifie = state.orderedModifiers[index],
|
|
|
|
|
fn = _state$orderedModifie.fn,
|
|
|
|
|
_state$orderedModifie2 = _state$orderedModifie.options,
|
|
|
|
|
_options = _state$orderedModifie2 === void 0 ? {} : _state$orderedModifie2,
|
|
|
|
|
name = _state$orderedModifie.name;
|
|
|
|
|
|
|
|
|
|
if (typeof fn === 'function') {
|
|
|
|
|
state = fn({
|
|
|
|
|
state: state,
|
|
|
|
|
options: _options,
|
|
|
|
|
name: name,
|
|
|
|
|
instance: instance
|
|
|
|
|
}) || state;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
// Async and optimistically optimized update – it will not be executed if
|
|
|
|
|
// not necessary (debounced to run at most once-per-tick)
|
|
|
|
|
update: debounce(function () {
|
|
|
|
|
return new Promise(function (resolve) {
|
|
|
|
|
instance.forceUpdate();
|
|
|
|
|
resolve(state);
|
|
|
|
|
});
|
|
|
|
|
}),
|
|
|
|
|
destroy: function destroy() {
|
|
|
|
|
cleanupModifierEffects();
|
|
|
|
|
isDestroyed = true;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
if (!areValidElements(reference, popper)) {
|
|
|
|
|
if (process.env.NODE_ENV !== "production") {
|
|
|
|
|
console.error(INVALID_ELEMENT_ERROR);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return instance;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
instance.setOptions(options).then(function (state) {
|
|
|
|
|
if (!isDestroyed && options.onFirstUpdate) {
|
|
|
|
|
options.onFirstUpdate(state);
|
|
|
|
|
}
|
|
|
|
|
}); // Modifiers have the ability to execute arbitrary code before the first
|
|
|
|
|
// update cycle runs. They will be executed in the same order as the update
|
|
|
|
|
// cycle. This is useful when a modifier adds some persistent data that
|
|
|
|
|
// other modifiers need to use, but the modifier is run after the dependent
|
|
|
|
|
// one.
|
|
|
|
|
|
|
|
|
|
function runModifierEffects() {
|
|
|
|
|
state.orderedModifiers.forEach(function (_ref3) {
|
|
|
|
|
var name = _ref3.name,
|
|
|
|
|
_ref3$options = _ref3.options,
|
|
|
|
|
options = _ref3$options === void 0 ? {} : _ref3$options,
|
|
|
|
|
effect = _ref3.effect;
|
|
|
|
|
|
|
|
|
|
if (typeof effect === 'function') {
|
|
|
|
|
var cleanupFn = effect({
|
|
|
|
|
state: state,
|
|
|
|
|
name: name,
|
|
|
|
|
instance: instance,
|
|
|
|
|
options: options
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
var noopFn = function noopFn() {};
|
|
|
|
|
|
|
|
|
|
effectCleanupFns.push(cleanupFn || noopFn);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function cleanupModifierEffects() {
|
|
|
|
|
effectCleanupFns.forEach(function (fn) {
|
|
|
|
|
return fn();
|
|
|
|
|
});
|
|
|
|
|
effectCleanupFns = [];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return instance;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var defaultModifiers = [eventListeners, popperOffsets$1, computeStyles$1, applyStyles$1, offset$1, flip$1, preventOverflow$1, arrow$1, hide$1];
|
|
|
|
|
var createPopper = /*#__PURE__*/popperGenerator({
|
|
|
|
|
defaultModifiers: defaultModifiers
|
|
|
|
|
}); // eslint-disable-next-line import/no-unused-modules
|
|
|
|
|
|
|
|
|
|
// Credits go to Liam's Periodic Notes Plugin: https://github.com/liamcain/obsidian-periodic-notes
|
|
|
|
|
const wrapAround = (value, size) => {
|
|
|
|
|
return ((value % size) + size) % size;
|
|
|
|
|
};
|
|
|
|
|
class Suggest {
|
|
|
|
|
constructor(owner, containerEl, scope) {
|
|
|
|
|
this.owner = owner;
|
|
|
|
|
this.containerEl = containerEl;
|
|
|
|
|
containerEl.on("click", ".suggestion-item", this.onSuggestionClick.bind(this));
|
|
|
|
|
containerEl.on("mousemove", ".suggestion-item", this.onSuggestionMouseover.bind(this));
|
|
|
|
|
scope.register([], "ArrowUp", (event) => {
|
|
|
|
|
if (!event.isComposing) {
|
|
|
|
|
this.setSelectedItem(this.selectedItem - 1, true);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
scope.register([], "ArrowDown", (event) => {
|
|
|
|
|
if (!event.isComposing) {
|
|
|
|
|
this.setSelectedItem(this.selectedItem + 1, true);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
scope.register([], "Enter", (event) => {
|
|
|
|
|
if (!event.isComposing) {
|
|
|
|
|
this.useSelectedItem(event);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
onSuggestionClick(event, el) {
|
|
|
|
|
event.preventDefault();
|
|
|
|
|
const item = this.suggestions.indexOf(el);
|
|
|
|
|
this.setSelectedItem(item, false);
|
|
|
|
|
this.useSelectedItem(event);
|
|
|
|
|
}
|
|
|
|
|
onSuggestionMouseover(_event, el) {
|
|
|
|
|
const item = this.suggestions.indexOf(el);
|
|
|
|
|
this.setSelectedItem(item, false);
|
|
|
|
|
}
|
|
|
|
|
setSuggestions(values) {
|
|
|
|
|
this.containerEl.empty();
|
|
|
|
|
const suggestionEls = [];
|
|
|
|
|
values.forEach((value) => {
|
|
|
|
|
const suggestionEl = this.containerEl.createDiv("suggestion-item");
|
|
|
|
|
this.owner.renderSuggestion(value, suggestionEl);
|
|
|
|
|
suggestionEls.push(suggestionEl);
|
|
|
|
|
});
|
|
|
|
|
this.values = values;
|
|
|
|
|
this.suggestions = suggestionEls;
|
|
|
|
|
this.setSelectedItem(0, false);
|
|
|
|
|
}
|
|
|
|
|
useSelectedItem(event) {
|
|
|
|
|
const currentValue = this.values[this.selectedItem];
|
|
|
|
|
if (currentValue) {
|
|
|
|
|
this.owner.selectSuggestion(currentValue, event);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
setSelectedItem(selectedIndex, scrollIntoView) {
|
|
|
|
|
const normalizedIndex = wrapAround(selectedIndex, this.suggestions.length);
|
|
|
|
|
const prevSelectedSuggestion = this.suggestions[this.selectedItem];
|
|
|
|
|
const selectedSuggestion = this.suggestions[normalizedIndex];
|
|
|
|
|
prevSelectedSuggestion === null || prevSelectedSuggestion === void 0 ? void 0 : prevSelectedSuggestion.removeClass("is-selected");
|
|
|
|
|
selectedSuggestion === null || selectedSuggestion === void 0 ? void 0 : selectedSuggestion.addClass("is-selected");
|
|
|
|
|
this.selectedItem = normalizedIndex;
|
|
|
|
|
if (scrollIntoView) {
|
|
|
|
|
selectedSuggestion.scrollIntoView(false);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
class TextInputSuggest {
|
|
|
|
|
constructor(app, inputEl) {
|
|
|
|
|
this.app = app;
|
|
|
|
|
this.inputEl = inputEl;
|
|
|
|
|
this.scope = new obsidian.Scope();
|
|
|
|
|
this.suggestEl = createDiv("suggestion-container");
|
|
|
|
|
const suggestion = this.suggestEl.createDiv("suggestion");
|
|
|
|
|
this.suggest = new Suggest(this, suggestion, this.scope);
|
|
|
|
|
this.scope.register([], "Escape", this.close.bind(this));
|
|
|
|
|
this.inputEl.addEventListener("input", this.onInputChanged.bind(this));
|
|
|
|
|
this.inputEl.addEventListener("focus", this.onInputChanged.bind(this));
|
|
|
|
|
this.inputEl.addEventListener("blur", this.close.bind(this));
|
|
|
|
|
this.suggestEl.on("mousedown", ".suggestion-container", (event) => {
|
|
|
|
|
event.preventDefault();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
onInputChanged() {
|
|
|
|
|
const inputStr = this.inputEl.value;
|
|
|
|
|
const suggestions = this.getSuggestions(inputStr);
|
|
|
|
|
if (!suggestions) {
|
|
|
|
|
this.close();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (suggestions.length > 0) {
|
|
|
|
|
this.suggest.setSuggestions(suggestions);
|
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
|
|
|
this.open(this.app.dom.appContainerEl, this.inputEl);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
this.close();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
open(container, inputEl) {
|
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
|
|
|
this.app.keymap.pushScope(this.scope);
|
|
|
|
|
container.appendChild(this.suggestEl);
|
|
|
|
|
this.popper = createPopper(inputEl, this.suggestEl, {
|
|
|
|
|
placement: "bottom-start",
|
|
|
|
|
modifiers: [
|
|
|
|
|
{
|
|
|
|
|
name: "sameWidth",
|
|
|
|
|
enabled: true,
|
|
|
|
|
fn: ({ state, instance }) => {
|
|
|
|
|
// Note: positioning needs to be calculated twice -
|
|
|
|
|
// first pass - positioning it according to the width of the popper
|
|
|
|
|
// second pass - position it with the width bound to the reference element
|
|
|
|
|
// we need to early exit to avoid an infinite loop
|
|
|
|
|
const targetWidth = `${state.rects.reference.width}px`;
|
|
|
|
|
if (state.styles.popper.width === targetWidth) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
state.styles.popper.width = targetWidth;
|
|
|
|
|
instance.update();
|
|
|
|
|
},
|
|
|
|
|
phase: "beforeWrite",
|
|
|
|
|
requires: ["computeStyles"],
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
close() {
|
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
|
|
|
this.app.keymap.popScope(this.scope);
|
|
|
|
|
this.suggest.setSuggestions([]);
|
|
|
|
|
if (this.popper)
|
|
|
|
|
this.popper.destroy();
|
|
|
|
|
this.suggestEl.detach();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Credits go to Liam's Periodic Notes Plugin: https://github.com/liamcain/obsidian-periodic-notes
|
|
|
|
|
class FolderSuggest extends TextInputSuggest {
|
|
|
|
|
getSuggestions(inputStr) {
|
|
|
|
|
const abstractFiles = this.app.vault.getAllLoadedFiles();
|
|
|
|
|
const folders = [];
|
|
|
|
|
const lowerCaseInputStr = inputStr.toLowerCase();
|
|
|
|
|
abstractFiles.forEach((folder) => {
|
|
|
|
|
if (folder instanceof obsidian.TFolder &&
|
|
|
|
|
folder.path.toLowerCase().contains(lowerCaseInputStr)) {
|
|
|
|
|
folders.push(folder);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
return folders;
|
|
|
|
|
}
|
|
|
|
|
renderSuggestion(file, el) {
|
|
|
|
|
el.setText(file.path);
|
|
|
|
|
}
|
|
|
|
|
selectSuggestion(file) {
|
|
|
|
|
this.inputEl.value = file.path;
|
|
|
|
|
this.inputEl.trigger("input");
|
|
|
|
|
this.close();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var FilterType;
|
|
|
|
|
(function (FilterType) {
|
|
|
|
|
FilterType["TAGS"] = "all articles with tags";
|
|
|
|
|
FilterType["UNREAD"] = "All unread articles(from folders)";
|
|
|
|
|
FilterType["READ"] = "All read articles(from folders)";
|
|
|
|
|
FilterType["FAVORITES"] = "Favorites(from folders)";
|
|
|
|
|
})(FilterType || (FilterType = {}));
|
|
|
|
|
var SortOrder;
|
|
|
|
|
(function (SortOrder) {
|
|
|
|
|
SortOrder["DATE_NEWEST"] = "Publication date (new to old)";
|
|
|
|
|
SortOrder["DATE_OLDEST"] = "Publication date (old to new)";
|
|
|
|
|
SortOrder["ALPHABET_NORMAL"] = "Name (A to Z)";
|
|
|
|
|
SortOrder["ALPHABET_INVERTED"] = "Name (Z to A)";
|
|
|
|
|
})(SortOrder || (SortOrder = {}));
|
|
|
|
|
class FilteredFolderModal extends BaseModal {
|
|
|
|
|
constructor(plugin, folder) {
|
|
|
|
|
super(plugin.app);
|
|
|
|
|
this.filterContent = "";
|
|
|
|
|
this.saved = false;
|
|
|
|
|
if (folder) {
|
|
|
|
|
this.name = folder.name;
|
|
|
|
|
this.filterType = folder.filterType;
|
|
|
|
|
this.filterContent = folder.filterContent;
|
|
|
|
|
this.sortOrder = folder.sortOrder;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
display() {
|
|
|
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
|
|
|
const { contentEl } = this;
|
|
|
|
|
contentEl.empty();
|
|
|
|
|
let nameText;
|
|
|
|
|
const name = new obsidian.Setting(contentEl)
|
|
|
|
|
.setName("Name")
|
|
|
|
|
.addText((text) => {
|
|
|
|
|
nameText = text;
|
|
|
|
|
text.setValue(this.name)
|
|
|
|
|
.onChange((value) => {
|
|
|
|
|
this.removeValidationError(text);
|
|
|
|
|
this.name = value;
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
name.controlEl.addClass("rss-setting-input");
|
|
|
|
|
const type = new obsidian.Setting(contentEl)
|
|
|
|
|
.setName("Type")
|
|
|
|
|
.setDesc("type of filter")
|
|
|
|
|
.addDropdown((dropdown) => {
|
|
|
|
|
for (const option in FilterType) {
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
dropdown.addOption(option, FilterType[option]);
|
|
|
|
|
}
|
|
|
|
|
dropdown
|
|
|
|
|
.setValue(this.filterType)
|
|
|
|
|
.onChange((value) => __awaiter(this, void 0, void 0, function* () {
|
|
|
|
|
this.filterType = value;
|
|
|
|
|
}));
|
|
|
|
|
});
|
|
|
|
|
type.controlEl.addClass("rss-setting-input");
|
|
|
|
|
new obsidian.Setting(contentEl)
|
|
|
|
|
.setName("Filter")
|
|
|
|
|
.setDesc("Folders/Tags to filter on, split by ,")
|
|
|
|
|
.addText((text) => {
|
|
|
|
|
text
|
|
|
|
|
.setValue(this.filterContent)
|
|
|
|
|
.onChange((value) => {
|
|
|
|
|
this.filterContent = value;
|
|
|
|
|
this.removeValidationError(text);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
const sorting = new obsidian.Setting(contentEl)
|
|
|
|
|
.setName("Order by")
|
|
|
|
|
.addDropdown((dropdown) => {
|
|
|
|
|
for (const order in SortOrder) {
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
dropdown.addOption(order, SortOrder[order]);
|
|
|
|
|
}
|
|
|
|
|
dropdown
|
|
|
|
|
.setValue(this.sortOrder)
|
|
|
|
|
.onChange((value) => __awaiter(this, void 0, void 0, function* () {
|
|
|
|
|
this.sortOrder = value;
|
|
|
|
|
}));
|
|
|
|
|
});
|
|
|
|
|
sorting.controlEl.addClass("rss-setting-input");
|
|
|
|
|
const footerEl = contentEl.createDiv();
|
|
|
|
|
const footerButtons = new obsidian.Setting(footerEl);
|
|
|
|
|
footerButtons.addButton((b) => {
|
|
|
|
|
b.setTooltip("Save")
|
|
|
|
|
.setIcon("checkmark")
|
|
|
|
|
.onClick(() => __awaiter(this, void 0, void 0, function* () {
|
|
|
|
|
let error = false;
|
|
|
|
|
if (!nameText.getValue().length) {
|
|
|
|
|
this.setValidationError(nameText, "you need to specify a name");
|
|
|
|
|
error = true;
|
|
|
|
|
}
|
|
|
|
|
if (error) {
|
|
|
|
|
new obsidian.Notice("please fix errors before saving.");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
this.saved = true;
|
|
|
|
|
this.close();
|
|
|
|
|
}));
|
|
|
|
|
return b;
|
|
|
|
|
});
|
|
|
|
|
footerButtons.addExtraButton((b) => {
|
|
|
|
|
b.setIcon("cross")
|
|
|
|
|
.setTooltip("Cancel")
|
|
|
|
|
.onClick(() => {
|
|
|
|
|
this.saved = false;
|
|
|
|
|
this.close();
|
|
|
|
|
});
|
|
|
|
|
return b;
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
onOpen() {
|
|
|
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
|
|
|
yield this.display();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const DEFAULT_SETTINGS = Object.freeze({
|
|
|
|
|
feeds: [],
|
|
|
|
|
updateTime: 60,
|
|
|
|
|
filtered: [{
|
|
|
|
|
name: "Favorites",
|
|
|
|
|
filterType: "FAVORITES",
|
|
|
|
|
filterContent: "",
|
|
|
|
|
sortOrder: "ALPHABET_NORMAL"
|
|
|
|
|
}],
|
|
|
|
|
saveLocation: 'default',
|
|
|
|
|
saveLocationFolder: '',
|
|
|
|
|
items: [],
|
|
|
|
|
dateFormat: "YYYY-MM-DDTHH:MM:SS",
|
|
|
|
|
template: "---\n" +
|
|
|
|
|
"link: {{link}}\n" +
|
|
|
|
|
"author: {{author}}\n" +
|
|
|
|
|
"published: {{published}}\n" +
|
|
|
|
|
"tags: [{{tags:,}}]\n" +
|
|
|
|
|
"---\n" +
|
|
|
|
|
"{{title}}\n" +
|
|
|
|
|
"{{content}}",
|
|
|
|
|
pasteTemplate: "## {{title}}\n" +
|
|
|
|
|
"{{content}}",
|
|
|
|
|
askForFilename: true
|
|
|
|
|
});
|
|
|
|
|
class RSSReaderSettingsTab extends obsidian.PluginSettingTab {
|
|
|
|
|
constructor(app, plugin) {
|
|
|
|
|
super(app, plugin);
|
|
|
|
|
this.plugin = plugin;
|
|
|
|
|
}
|
|
|
|
|
display() {
|
|
|
|
|
const { containerEl } = this;
|
|
|
|
|
containerEl.empty();
|
|
|
|
|
containerEl.createEl('h2', { text: 'RSS Reader Settings' });
|
|
|
|
|
new obsidian.Setting(containerEl)
|
|
|
|
|
.setName("New file template")
|
|
|
|
|
.setDesc('When creating a note from a article this gets processed. ' +
|
|
|
|
|
'Available variables are: {{title}}, {{link}}, {{author}}, {{published}}, {{created}}, {{content}}, {{description}}, {{folder}}, {{feed}}, {{filename}, {{tags}}, {{#tags}}')
|
|
|
|
|
.addTextArea((textArea) => {
|
|
|
|
|
textArea
|
|
|
|
|
.setValue(this.plugin.settings.template)
|
|
|
|
|
.setPlaceholder(DEFAULT_SETTINGS.template)
|
|
|
|
|
.onChange((value) => __awaiter(this, void 0, void 0, function* () {
|
|
|
|
|
yield this.plugin.writeSettings(() => ({
|
|
|
|
|
template: value
|
|
|
|
|
}));
|
|
|
|
|
}));
|
|
|
|
|
textArea.inputEl.setAttr("rows", 8);
|
|
|
|
|
});
|
|
|
|
|
new obsidian.Setting(containerEl)
|
|
|
|
|
.setName("paste article template")
|
|
|
|
|
.setDesc('When pasting/copying an article this gets processed. ' +
|
|
|
|
|
'Available variables are: {{title}}, {{link}}, {{author}}, {{published}}, {{content}}, {{description}}, {{folder}}, {{feed}}, {{tags}}, {{#tags}}')
|
|
|
|
|
.addTextArea((textArea) => {
|
|
|
|
|
textArea
|
|
|
|
|
.setValue(this.plugin.settings.pasteTemplate)
|
|
|
|
|
.setPlaceholder(DEFAULT_SETTINGS.pasteTemplate)
|
|
|
|
|
.onChange((value) => __awaiter(this, void 0, void 0, function* () {
|
|
|
|
|
yield this.plugin.writeSettings(() => ({
|
|
|
|
|
pasteTemplate: value
|
|
|
|
|
}));
|
|
|
|
|
}));
|
|
|
|
|
textArea.inputEl.setAttr("rows", 8);
|
|
|
|
|
});
|
|
|
|
|
new obsidian.Setting(containerEl)
|
|
|
|
|
.setName("Default location for new notes")
|
|
|
|
|
.setDesc("")
|
|
|
|
|
.addDropdown((dropdown) => __awaiter(this, void 0, void 0, function* () {
|
|
|
|
|
dropdown
|
|
|
|
|
.addOption("default", "In the default folder")
|
|
|
|
|
.addOption("custom", "In the folder specified below")
|
|
|
|
|
.setValue(this.plugin.settings.saveLocation)
|
|
|
|
|
.onChange((value) => __awaiter(this, void 0, void 0, function* () {
|
|
|
|
|
yield this.plugin.writeSettings(() => ({ saveLocation: value }));
|
|
|
|
|
this.display();
|
|
|
|
|
}));
|
|
|
|
|
}));
|
|
|
|
|
if (this.plugin.settings.saveLocation == "custom") {
|
|
|
|
|
new obsidian.Setting(containerEl)
|
|
|
|
|
.setName("Folder to create new articles in")
|
|
|
|
|
.setDesc("newly created articles will appear in this folder")
|
|
|
|
|
.addSearch((search) => __awaiter(this, void 0, void 0, function* () {
|
|
|
|
|
new FolderSuggest(this.app, search.inputEl);
|
|
|
|
|
search
|
|
|
|
|
.setValue(this.plugin.settings.saveLocationFolder)
|
|
|
|
|
.setPlaceholder(DEFAULT_SETTINGS.saveLocationFolder)
|
|
|
|
|
.onChange((value) => __awaiter(this, void 0, void 0, function* () {
|
|
|
|
|
yield this.plugin.writeSettings(() => ({ saveLocationFolder: value }));
|
|
|
|
|
}));
|
|
|
|
|
}));
|
|
|
|
|
}
|
|
|
|
|
const refresh = new obsidian.Setting(containerEl)
|
|
|
|
|
.setName("Refresh time")
|
|
|
|
|
.setDesc("How often should the feeds be refreshed, in minutes, use 0 to disable")
|
|
|
|
|
.addText((text) => {
|
|
|
|
|
text
|
|
|
|
|
.setPlaceholder(String(DEFAULT_SETTINGS.updateTime))
|
|
|
|
|
.setValue(String(this.plugin.settings.updateTime))
|
|
|
|
|
.onChange((value) => __awaiter(this, void 0, void 0, function* () {
|
|
|
|
|
if (value.length === 0) {
|
|
|
|
|
new obsidian.Notice("please specify a value");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (Number(value) < 0) {
|
|
|
|
|
new obsidian.Notice("please specify a bigger value");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
yield this.plugin.writeSettings(() => ({ updateTime: Number(value) }));
|
|
|
|
|
}));
|
|
|
|
|
text.inputEl.setAttr("type", "number");
|
|
|
|
|
text.inputEl.setAttr("min", "1");
|
|
|
|
|
//we don't want decimal numbers.
|
|
|
|
|
text.inputEl.setAttr("onkeypress", "return event.charCode >= 48 && event.charCode <= 57");
|
|
|
|
|
});
|
|
|
|
|
refresh.addExtraButton((button) => {
|
|
|
|
|
button
|
|
|
|
|
.setIcon('reset')
|
|
|
|
|
.setTooltip('restore default')
|
|
|
|
|
.onClick(() => __awaiter(this, void 0, void 0, function* () {
|
|
|
|
|
yield this.plugin.writeSettings(() => ({
|
|
|
|
|
updateTime: DEFAULT_SETTINGS.updateTime
|
|
|
|
|
}));
|
|
|
|
|
this.display();
|
|
|
|
|
}));
|
|
|
|
|
});
|
|
|
|
|
let dateFormatSampleEl;
|
|
|
|
|
const dateFormat = new obsidian.Setting(containerEl)
|
|
|
|
|
.setName("Date format")
|
|
|
|
|
.setDesc("")
|
|
|
|
|
.addMomentFormat((format) => {
|
|
|
|
|
dateFormatSampleEl = format
|
|
|
|
|
.setDefaultFormat(DEFAULT_SETTINGS.dateFormat)
|
|
|
|
|
.setPlaceholder(DEFAULT_SETTINGS.dateFormat)
|
|
|
|
|
.setValue(this.plugin.settings.dateFormat)
|
|
|
|
|
.onChange((value) => __awaiter(this, void 0, void 0, function* () {
|
|
|
|
|
yield this.plugin.writeSettings(() => ({ dateFormat: value }));
|
|
|
|
|
}));
|
|
|
|
|
});
|
|
|
|
|
const referenceLink = dateFormat.descEl.createEl("a");
|
|
|
|
|
referenceLink.setAttr("href", "https://momentjs.com/docs/#/displaying/format/");
|
|
|
|
|
referenceLink.setText("Syntax Reference");
|
|
|
|
|
const text = dateFormat.descEl.createDiv("text");
|
|
|
|
|
text.setText("Your current syntax looks like this: ");
|
|
|
|
|
const sampleEl = text.createSpan("sample");
|
|
|
|
|
dateFormatSampleEl.setSampleEl(sampleEl);
|
|
|
|
|
dateFormat.addExtraButton((button) => {
|
|
|
|
|
button
|
|
|
|
|
.setIcon('reset')
|
|
|
|
|
.setTooltip('restore default')
|
|
|
|
|
.onClick(() => __awaiter(this, void 0, void 0, function* () {
|
|
|
|
|
yield this.plugin.writeSettings(() => ({
|
|
|
|
|
dateFormat: DEFAULT_SETTINGS.dateFormat
|
|
|
|
|
}));
|
|
|
|
|
this.display();
|
|
|
|
|
}));
|
|
|
|
|
});
|
|
|
|
|
new obsidian.Setting(containerEl)
|
|
|
|
|
.setName("Ask for filename")
|
|
|
|
|
.setDesc("Disable to use title as filename(with invalid symbols removed)")
|
|
|
|
|
.addToggle((toggle) => {
|
|
|
|
|
return toggle
|
|
|
|
|
.setValue(this.plugin.settings.askForFilename)
|
|
|
|
|
.onChange((value) => __awaiter(this, void 0, void 0, function* () {
|
|
|
|
|
yield this.plugin.writeSettings(() => ({
|
|
|
|
|
askForFilename: value
|
|
|
|
|
}));
|
|
|
|
|
}));
|
|
|
|
|
});
|
|
|
|
|
containerEl.createEl("h3", { text: "Filtered Folders" });
|
|
|
|
|
new obsidian.Setting(containerEl)
|
|
|
|
|
.setName("Add New")
|
|
|
|
|
.setDesc("Add new filtered folder")
|
|
|
|
|
.addButton((button) => {
|
|
|
|
|
return button
|
|
|
|
|
.setTooltip("add new filtered folder")
|
|
|
|
|
.setIcon("create-new")
|
|
|
|
|
.onClick(() => __awaiter(this, void 0, void 0, function* () {
|
|
|
|
|
const modal = new FilteredFolderModal(this.plugin);
|
|
|
|
|
modal.onClose = () => __awaiter(this, void 0, void 0, function* () {
|
|
|
|
|
if (modal.saved) {
|
|
|
|
|
if (this.plugin.settings.filtered.some(folder => folder.name === modal.name)) {
|
|
|
|
|
new obsidian.Notice("you already have a filter configured with that name");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
yield this.plugin.writeFiltered(() => (this.plugin.settings.filtered.concat({
|
|
|
|
|
name: modal.name,
|
|
|
|
|
filterType: modal.filterType,
|
|
|
|
|
filterContent: modal.filterContent,
|
|
|
|
|
sortOrder: modal.sortOrder
|
|
|
|
|
})));
|
|
|
|
|
this.display();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
modal.open();
|
|
|
|
|
}));
|
|
|
|
|
});
|
|
|
|
|
const filterContainer = containerEl.createDiv("filter-container");
|
|
|
|
|
const filtersDiv = filterContainer.createDiv("filters");
|
|
|
|
|
for (const id in this.plugin.settings.filtered) {
|
|
|
|
|
const filter = this.plugin.settings.filtered[id];
|
|
|
|
|
const setting = new obsidian.Setting(filtersDiv);
|
|
|
|
|
setting.setName(filter.name);
|
|
|
|
|
setting.setDesc(filter.filterType + (filter.filterContent.length > 0) ? (" from " + filter.filterContent) : "");
|
|
|
|
|
setting
|
|
|
|
|
.addExtraButton((b) => {
|
|
|
|
|
b.setIcon("pencil")
|
|
|
|
|
.setTooltip("Edit")
|
|
|
|
|
.onClick(() => {
|
|
|
|
|
const modal = new FilteredFolderModal(this.plugin, filter);
|
|
|
|
|
const oldFilter = filter;
|
|
|
|
|
modal.onClose = () => __awaiter(this, void 0, void 0, function* () {
|
|
|
|
|
if (modal.saved) {
|
|
|
|
|
const filters = this.plugin.settings.filtered;
|
|
|
|
|
filters.remove(oldFilter);
|
|
|
|
|
filters.push({ name: modal.name, filterType: modal.filterType, filterContent: modal.filterContent, sortOrder: modal.sortOrder });
|
|
|
|
|
yield this.plugin.writeFiltered(() => (filters));
|
|
|
|
|
this.display();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
modal.open();
|
|
|
|
|
});
|
|
|
|
|
})
|
|
|
|
|
.addExtraButton((b) => {
|
|
|
|
|
b.setIcon("trash")
|
|
|
|
|
.setTooltip("Delete")
|
|
|
|
|
.onClick(() => __awaiter(this, void 0, void 0, function* () {
|
|
|
|
|
const filters = this.plugin.settings.filtered;
|
|
|
|
|
filters.remove(filter);
|
|
|
|
|
yield this.plugin.writeFiltered(() => (filters));
|
|
|
|
|
this.display();
|
|
|
|
|
}));
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
containerEl.createEl("h3", { text: "Feeds" });
|
|
|
|
|
new obsidian.Setting(containerEl)
|
|
|
|
|
.setName("Add New")
|
|
|
|
|
.setDesc("Add a new Feed")
|
|
|
|
|
.addButton((button) => {
|
|
|
|
|
return button
|
|
|
|
|
.setTooltip("add new Feed")
|
|
|
|
|
.setIcon("create-new")
|
|
|
|
|
.onClick(() => __awaiter(this, void 0, void 0, function* () {
|
|
|
|
|
const modal = new FeedModal(this.plugin);
|
|
|
|
|
modal.onClose = () => __awaiter(this, void 0, void 0, function* () {
|
|
|
|
|
if (modal.saved) {
|
|
|
|
|
if (this.plugin.settings.feeds.some(item => item.url === modal.url)) {
|
|
|
|
|
new obsidian.Notice("you already have a feed configured with that url");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
yield this.plugin.writeFeeds(() => (this.plugin.settings.feeds.concat({
|
|
|
|
|
name: modal.name,
|
|
|
|
|
url: modal.url,
|
|
|
|
|
folder: modal.folder
|
|
|
|
|
})));
|
|
|
|
|
this.display();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
modal.open();
|
|
|
|
|
}));
|
|
|
|
|
});
|
|
|
|
|
const additionalContainer = containerEl.createDiv("feed-container");
|
|
|
|
|
const feedsDiv = additionalContainer.createDiv("feeds");
|
|
|
|
|
const sorted = lodash_groupby(this.plugin.settings.feeds, "folder");
|
|
|
|
|
for (const [, feeds] of Object.entries(sorted)) {
|
|
|
|
|
for (const id in feeds) {
|
|
|
|
|
const feed = feeds[id];
|
|
|
|
|
const setting = new obsidian.Setting(feedsDiv);
|
|
|
|
|
setting.setName((feed.folder ? feed.folder : "No Folder") + " - " + feed.name);
|
|
|
|
|
setting.setDesc(feed.url);
|
|
|
|
|
setting
|
|
|
|
|
.addExtraButton((b) => {
|
|
|
|
|
b.setIcon("pencil")
|
|
|
|
|
.setTooltip("Edit")
|
|
|
|
|
.onClick(() => {
|
|
|
|
|
const modal = new FeedModal(this.plugin, feed);
|
|
|
|
|
const oldFeed = feed;
|
|
|
|
|
modal.onClose = () => __awaiter(this, void 0, void 0, function* () {
|
|
|
|
|
if (modal.saved) {
|
|
|
|
|
const feeds = this.plugin.settings.feeds;
|
|
|
|
|
feeds.remove(oldFeed);
|
|
|
|
|
feeds.push({ name: modal.name, url: modal.url, folder: modal.folder });
|
|
|
|
|
yield this.plugin.writeFeeds(() => (feeds));
|
|
|
|
|
this.display();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
modal.open();
|
|
|
|
|
});
|
|
|
|
|
})
|
|
|
|
|
.addExtraButton((b) => {
|
|
|
|
|
b.setIcon("trash")
|
|
|
|
|
.setTooltip("Delete")
|
|
|
|
|
.onClick(() => __awaiter(this, void 0, void 0, function* () {
|
|
|
|
|
const feeds = this.plugin.settings.feeds;
|
|
|
|
|
feeds.remove(feed);
|
|
|
|
|
yield this.plugin.writeFeeds(() => (feeds));
|
|
|
|
|
this.display();
|
|
|
|
|
}));
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function noop() { }
|
|
|
|
|
function run(fn) {
|
|
|
|
|
return fn();
|
|
|
|
|
}
|
|
|
|
|
function blank_object() {
|
|
|
|
|
return Object.create(null);
|
|
|
|
|
}
|
|
|
|
|
function run_all(fns) {
|
|
|
|
|
fns.forEach(run);
|
|
|
|
|
}
|
|
|
|
|
function is_function(thing) {
|
|
|
|
|
return typeof thing === 'function';
|
|
|
|
|
}
|
|
|
|
|
function safe_not_equal(a, b) {
|
|
|
|
|
return a != a ? b == b : a !== b || ((a && typeof a === 'object') || typeof a === 'function');
|
|
|
|
|
}
|
|
|
|
|
let src_url_equal_anchor;
|
|
|
|
|
function src_url_equal(element_src, url) {
|
|
|
|
|
if (!src_url_equal_anchor) {
|
|
|
|
|
src_url_equal_anchor = document.createElement('a');
|
|
|
|
|
}
|
|
|
|
|
src_url_equal_anchor.href = url;
|
|
|
|
|
return element_src === src_url_equal_anchor.href;
|
|
|
|
|
}
|
|
|
|
|
function is_empty(obj) {
|
|
|
|
|
return Object.keys(obj).length === 0;
|
|
|
|
|
}
|
|
|
|
|
function subscribe(store, ...callbacks) {
|
|
|
|
|
if (store == null) {
|
|
|
|
|
return noop;
|
|
|
|
|
}
|
|
|
|
|
const unsub = store.subscribe(...callbacks);
|
|
|
|
|
return unsub.unsubscribe ? () => unsub.unsubscribe() : unsub;
|
|
|
|
|
}
|
|
|
|
|
function component_subscribe(component, store, callback) {
|
|
|
|
|
component.$$.on_destroy.push(subscribe(store, callback));
|
|
|
|
|
}
|
|
|
|
|
function action_destroyer(action_result) {
|
|
|
|
|
return action_result && is_function(action_result.destroy) ? action_result.destroy : noop;
|
|
|
|
|
}
|
|
|
|
|
function append(target, node) {
|
|
|
|
|
target.appendChild(node);
|
|
|
|
|
}
|
|
|
|
|
function insert(target, node, anchor) {
|
|
|
|
|
target.insertBefore(node, anchor || null);
|
|
|
|
|
}
|
|
|
|
|
function detach(node) {
|
|
|
|
|
node.parentNode.removeChild(node);
|
|
|
|
|
}
|
|
|
|
|
function destroy_each(iterations, detaching) {
|
|
|
|
|
for (let i = 0; i < iterations.length; i += 1) {
|
|
|
|
|
if (iterations[i])
|
|
|
|
|
iterations[i].d(detaching);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
function element(name) {
|
|
|
|
|
return document.createElement(name);
|
|
|
|
|
}
|
|
|
|
|
function text(data) {
|
|
|
|
|
return document.createTextNode(data);
|
|
|
|
|
}
|
|
|
|
|
function space() {
|
|
|
|
|
return text(' ');
|
|
|
|
|
}
|
|
|
|
|
function empty() {
|
|
|
|
|
return text('');
|
|
|
|
|
}
|
|
|
|
|
function listen(node, event, handler, options) {
|
|
|
|
|
node.addEventListener(event, handler, options);
|
|
|
|
|
return () => node.removeEventListener(event, handler, options);
|
|
|
|
|
}
|
|
|
|
|
function attr(node, attribute, value) {
|
|
|
|
|
if (value == null)
|
|
|
|
|
node.removeAttribute(attribute);
|
|
|
|
|
else if (node.getAttribute(attribute) !== value)
|
|
|
|
|
node.setAttribute(attribute, value);
|
|
|
|
|
}
|
|
|
|
|
function children(element) {
|
|
|
|
|
return Array.from(element.childNodes);
|
|
|
|
|
}
|
|
|
|
|
function set_data(text, data) {
|
|
|
|
|
data = '' + data;
|
|
|
|
|
if (text.wholeText !== data)
|
|
|
|
|
text.data = data;
|
|
|
|
|
}
|
|
|
|
|
function set_style(node, key, value, important) {
|
|
|
|
|
node.style.setProperty(key, value, important ? 'important' : '');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let current_component;
|
|
|
|
|
function set_current_component(component) {
|
|
|
|
|
current_component = component;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const dirty_components = [];
|
|
|
|
|
const binding_callbacks = [];
|
|
|
|
|
const render_callbacks = [];
|
|
|
|
|
const flush_callbacks = [];
|
|
|
|
|
const resolved_promise = Promise.resolve();
|
|
|
|
|
let update_scheduled = false;
|
|
|
|
|
function schedule_update() {
|
|
|
|
|
if (!update_scheduled) {
|
|
|
|
|
update_scheduled = true;
|
|
|
|
|
resolved_promise.then(flush);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
function add_render_callback(fn) {
|
|
|
|
|
render_callbacks.push(fn);
|
|
|
|
|
}
|
|
|
|
|
let flushing = false;
|
|
|
|
|
const seen_callbacks = new Set();
|
|
|
|
|
function flush() {
|
|
|
|
|
if (flushing)
|
|
|
|
|
return;
|
|
|
|
|
flushing = true;
|
|
|
|
|
do {
|
|
|
|
|
// first, call beforeUpdate functions
|
|
|
|
|
// and update components
|
|
|
|
|
for (let i = 0; i < dirty_components.length; i += 1) {
|
|
|
|
|
const component = dirty_components[i];
|
|
|
|
|
set_current_component(component);
|
|
|
|
|
update(component.$$);
|
|
|
|
|
}
|
|
|
|
|
set_current_component(null);
|
|
|
|
|
dirty_components.length = 0;
|
|
|
|
|
while (binding_callbacks.length)
|
|
|
|
|
binding_callbacks.pop()();
|
|
|
|
|
// then, once components are updated, call
|
|
|
|
|
// afterUpdate functions. This may cause
|
|
|
|
|
// subsequent updates...
|
|
|
|
|
for (let i = 0; i < render_callbacks.length; i += 1) {
|
|
|
|
|
const callback = render_callbacks[i];
|
|
|
|
|
if (!seen_callbacks.has(callback)) {
|
|
|
|
|
// ...so guard against infinite loops
|
|
|
|
|
seen_callbacks.add(callback);
|
|
|
|
|
callback();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
render_callbacks.length = 0;
|
|
|
|
|
} while (dirty_components.length);
|
|
|
|
|
while (flush_callbacks.length) {
|
|
|
|
|
flush_callbacks.pop()();
|
|
|
|
|
}
|
|
|
|
|
update_scheduled = false;
|
|
|
|
|
flushing = false;
|
|
|
|
|
seen_callbacks.clear();
|
|
|
|
|
}
|
|
|
|
|
function update($$) {
|
|
|
|
|
if ($$.fragment !== null) {
|
|
|
|
|
$$.update();
|
|
|
|
|
run_all($$.before_update);
|
|
|
|
|
const dirty = $$.dirty;
|
|
|
|
|
$$.dirty = [-1];
|
|
|
|
|
$$.fragment && $$.fragment.p($$.ctx, dirty);
|
|
|
|
|
$$.after_update.forEach(add_render_callback);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
const outroing = new Set();
|
|
|
|
|
let outros;
|
|
|
|
|
function group_outros() {
|
|
|
|
|
outros = {
|
|
|
|
|
r: 0,
|
|
|
|
|
c: [],
|
|
|
|
|
p: outros // parent group
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
function check_outros() {
|
|
|
|
|
if (!outros.r) {
|
|
|
|
|
run_all(outros.c);
|
|
|
|
|
}
|
|
|
|
|
outros = outros.p;
|
|
|
|
|
}
|
|
|
|
|
function transition_in(block, local) {
|
|
|
|
|
if (block && block.i) {
|
|
|
|
|
outroing.delete(block);
|
|
|
|
|
block.i(local);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
function transition_out(block, local, detach, callback) {
|
|
|
|
|
if (block && block.o) {
|
|
|
|
|
if (outroing.has(block))
|
|
|
|
|
return;
|
|
|
|
|
outroing.add(block);
|
|
|
|
|
outros.c.push(() => {
|
|
|
|
|
outroing.delete(block);
|
|
|
|
|
if (callback) {
|
|
|
|
|
if (detach)
|
|
|
|
|
block.d(1);
|
|
|
|
|
callback();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
block.o(local);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
function create_component(block) {
|
|
|
|
|
block && block.c();
|
|
|
|
|
}
|
|
|
|
|
function mount_component(component, target, anchor, customElement) {
|
|
|
|
|
const { fragment, on_mount, on_destroy, after_update } = component.$$;
|
|
|
|
|
fragment && fragment.m(target, anchor);
|
|
|
|
|
if (!customElement) {
|
|
|
|
|
// onMount happens before the initial afterUpdate
|
|
|
|
|
add_render_callback(() => {
|
|
|
|
|
const new_on_destroy = on_mount.map(run).filter(is_function);
|
|
|
|
|
if (on_destroy) {
|
|
|
|
|
on_destroy.push(...new_on_destroy);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
// Edge case - component was destroyed immediately,
|
|
|
|
|
// most likely as a result of a binding initialising
|
|
|
|
|
run_all(new_on_destroy);
|
|
|
|
|
}
|
|
|
|
|
component.$$.on_mount = [];
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
after_update.forEach(add_render_callback);
|
|
|
|
|
}
|
|
|
|
|
function destroy_component(component, detaching) {
|
|
|
|
|
const $$ = component.$$;
|
|
|
|
|
if ($$.fragment !== null) {
|
|
|
|
|
run_all($$.on_destroy);
|
|
|
|
|
$$.fragment && $$.fragment.d(detaching);
|
|
|
|
|
// TODO null out other refs, including component.$$ (but need to
|
|
|
|
|
// preserve final state?)
|
|
|
|
|
$$.on_destroy = $$.fragment = null;
|
|
|
|
|
$$.ctx = [];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
function make_dirty(component, i) {
|
|
|
|
|
if (component.$$.dirty[0] === -1) {
|
|
|
|
|
dirty_components.push(component);
|
|
|
|
|
schedule_update();
|
|
|
|
|
component.$$.dirty.fill(0);
|
|
|
|
|
}
|
|
|
|
|
component.$$.dirty[(i / 31) | 0] |= (1 << (i % 31));
|
|
|
|
|
}
|
|
|
|
|
function init(component, options, instance, create_fragment, not_equal, props, append_styles, dirty = [-1]) {
|
|
|
|
|
const parent_component = current_component;
|
|
|
|
|
set_current_component(component);
|
|
|
|
|
const $$ = component.$$ = {
|
|
|
|
|
fragment: null,
|
|
|
|
|
ctx: null,
|
|
|
|
|
// state
|
|
|
|
|
props,
|
|
|
|
|
update: noop,
|
|
|
|
|
not_equal,
|
|
|
|
|
bound: blank_object(),
|
|
|
|
|
// lifecycle
|
|
|
|
|
on_mount: [],
|
|
|
|
|
on_destroy: [],
|
|
|
|
|
on_disconnect: [],
|
|
|
|
|
before_update: [],
|
|
|
|
|
after_update: [],
|
|
|
|
|
context: new Map(options.context || (parent_component ? parent_component.$$.context : [])),
|
|
|
|
|
// everything else
|
|
|
|
|
callbacks: blank_object(),
|
|
|
|
|
dirty,
|
|
|
|
|
skip_bound: false,
|
|
|
|
|
root: options.target || parent_component.$$.root
|
|
|
|
|
};
|
|
|
|
|
append_styles && append_styles($$.root);
|
|
|
|
|
let ready = false;
|
|
|
|
|
$$.ctx = instance
|
|
|
|
|
? instance(component, options.props || {}, (i, ret, ...rest) => {
|
|
|
|
|
const value = rest.length ? rest[0] : ret;
|
|
|
|
|
if ($$.ctx && not_equal($$.ctx[i], $$.ctx[i] = value)) {
|
|
|
|
|
if (!$$.skip_bound && $$.bound[i])
|
|
|
|
|
$$.bound[i](value);
|
|
|
|
|
if (ready)
|
|
|
|
|
make_dirty(component, i);
|
|
|
|
|
}
|
|
|
|
|
return ret;
|
|
|
|
|
})
|
|
|
|
|
: [];
|
|
|
|
|
$$.update();
|
|
|
|
|
ready = true;
|
|
|
|
|
run_all($$.before_update);
|
|
|
|
|
// `false` as a special case of no DOM component
|
|
|
|
|
$$.fragment = create_fragment ? create_fragment($$.ctx) : false;
|
|
|
|
|
if (options.target) {
|
|
|
|
|
if (options.hydrate) {
|
|
|
|
|
const nodes = children(options.target);
|
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
|
|
|
$$.fragment && $$.fragment.l(nodes);
|
|
|
|
|
nodes.forEach(detach);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
|
|
|
$$.fragment && $$.fragment.c();
|
|
|
|
|
}
|
|
|
|
|
if (options.intro)
|
|
|
|
|
transition_in(component.$$.fragment);
|
|
|
|
|
mount_component(component, options.target, options.anchor, options.customElement);
|
|
|
|
|
flush();
|
|
|
|
|
}
|
|
|
|
|
set_current_component(parent_component);
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* Base class for Svelte components. Used when dev=false.
|
|
|
|
|
*/
|
|
|
|
|
class SvelteComponent {
|
|
|
|
|
$destroy() {
|
|
|
|
|
destroy_component(this, 1);
|
|
|
|
|
this.$destroy = noop;
|
|
|
|
|
}
|
|
|
|
|
$on(type, callback) {
|
|
|
|
|
const callbacks = (this.$$.callbacks[type] || (this.$$.callbacks[type] = []));
|
|
|
|
|
callbacks.push(callback);
|
|
|
|
|
return () => {
|
|
|
|
|
const index = callbacks.indexOf(callback);
|
|
|
|
|
if (index !== -1)
|
|
|
|
|
callbacks.splice(index, 1);
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
$set($$props) {
|
|
|
|
|
if (this.$$set && !is_empty($$props)) {
|
|
|
|
|
this.$$.skip_bound = true;
|
|
|
|
|
this.$$set($$props);
|
|
|
|
|
this.$$.skip_bound = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const subscriber_queue = [];
|
|
|
|
|
/**
|
|
|
|
|
* Create a `Writable` store that allows both updating and reading by subscription.
|
|
|
|
|
* @param {*=}value initial value
|
|
|
|
|
* @param {StartStopNotifier=}start start and stop notifications for subscriptions
|
|
|
|
|
*/
|
|
|
|
|
function writable(value, start = noop) {
|
|
|
|
|
let stop;
|
|
|
|
|
const subscribers = new Set();
|
|
|
|
|
function set(new_value) {
|
|
|
|
|
if (safe_not_equal(value, new_value)) {
|
|
|
|
|
value = new_value;
|
|
|
|
|
if (stop) { // store is ready
|
|
|
|
|
const run_queue = !subscriber_queue.length;
|
|
|
|
|
for (const subscriber of subscribers) {
|
|
|
|
|
subscriber[1]();
|
|
|
|
|
subscriber_queue.push(subscriber, value);
|
|
|
|
|
}
|
|
|
|
|
if (run_queue) {
|
|
|
|
|
for (let i = 0; i < subscriber_queue.length; i += 2) {
|
|
|
|
|
subscriber_queue[i][0](subscriber_queue[i + 1]);
|
|
|
|
|
}
|
|
|
|
|
subscriber_queue.length = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
function update(fn) {
|
|
|
|
|
set(fn(value));
|
|
|
|
|
}
|
|
|
|
|
function subscribe(run, invalidate = noop) {
|
|
|
|
|
const subscriber = [run, invalidate];
|
|
|
|
|
subscribers.add(subscriber);
|
|
|
|
|
if (subscribers.size === 1) {
|
|
|
|
|
stop = start(set) || noop;
|
|
|
|
|
}
|
|
|
|
|
run(value);
|
|
|
|
|
return () => {
|
|
|
|
|
subscribers.delete(subscriber);
|
|
|
|
|
if (subscribers.size === 0) {
|
|
|
|
|
stop();
|
|
|
|
|
stop = null;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
return { set, update, subscribe };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const configuredFeedsStore = writable([]);
|
|
|
|
|
const filteredStore = writable([]);
|
|
|
|
|
const settingsStore = writable(DEFAULT_SETTINGS);
|
|
|
|
|
const feedsStore = writable([]);
|
|
|
|
|
const sortedFeedsStore = writable();
|
|
|
|
|
const filteredItemsStore = writable();
|
|
|
|
|
|
|
|
|
|
/* src/view/IconComponent.svelte generated by Svelte v3.44.2 */
|
|
|
|
|
|
|
|
|
|
function create_if_block$4(ctx) {
|
|
|
|
|
let span;
|
|
|
|
|
let icon_action;
|
|
|
|
|
let mounted;
|
|
|
|
|
let dispose;
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
c() {
|
|
|
|
|
span = element("span");
|
|
|
|
|
},
|
|
|
|
|
m(target, anchor) {
|
|
|
|
|
insert(target, span, anchor);
|
|
|
|
|
|
|
|
|
|
if (!mounted) {
|
|
|
|
|
dispose = action_destroyer(icon_action = /*icon*/ ctx[1].call(null, span, /*iconName*/ ctx[0]));
|
|
|
|
|
mounted = true;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
p(ctx, dirty) {
|
|
|
|
|
if (icon_action && is_function(icon_action.update) && dirty & /*iconName*/ 1) icon_action.update.call(null, /*iconName*/ ctx[0]);
|
|
|
|
|
},
|
|
|
|
|
d(detaching) {
|
|
|
|
|
if (detaching) detach(span);
|
|
|
|
|
mounted = false;
|
|
|
|
|
dispose();
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function create_fragment$4(ctx) {
|
|
|
|
|
let if_block_anchor;
|
|
|
|
|
let if_block = /*iconName*/ ctx[0].length > 0 && create_if_block$4(ctx);
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
c() {
|
|
|
|
|
if (if_block) if_block.c();
|
|
|
|
|
if_block_anchor = empty();
|
|
|
|
|
},
|
|
|
|
|
m(target, anchor) {
|
|
|
|
|
if (if_block) if_block.m(target, anchor);
|
|
|
|
|
insert(target, if_block_anchor, anchor);
|
|
|
|
|
},
|
|
|
|
|
p(ctx, [dirty]) {
|
|
|
|
|
if (/*iconName*/ ctx[0].length > 0) {
|
|
|
|
|
if (if_block) {
|
|
|
|
|
if_block.p(ctx, dirty);
|
|
|
|
|
} else {
|
|
|
|
|
if_block = create_if_block$4(ctx);
|
|
|
|
|
if_block.c();
|
|
|
|
|
if_block.m(if_block_anchor.parentNode, if_block_anchor);
|
|
|
|
|
}
|
|
|
|
|
} else if (if_block) {
|
|
|
|
|
if_block.d(1);
|
|
|
|
|
if_block = null;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
i: noop,
|
|
|
|
|
o: noop,
|
|
|
|
|
d(detaching) {
|
|
|
|
|
if (if_block) if_block.d(detaching);
|
|
|
|
|
if (detaching) detach(if_block_anchor);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function instance$4($$self, $$props, $$invalidate) {
|
|
|
|
|
let { iconName = "" } = $$props;
|
|
|
|
|
|
|
|
|
|
const icon = (node, icon) => {
|
|
|
|
|
obsidian.setIcon(node, icon);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
$$self.$$set = $$props => {
|
|
|
|
|
if ('iconName' in $$props) $$invalidate(0, iconName = $$props.iconName);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return [iconName, icon];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class IconComponent extends SvelteComponent {
|
|
|
|
|
constructor(options) {
|
|
|
|
|
super();
|
|
|
|
|
init(this, options, instance$4, create_fragment$4, safe_not_equal, { iconName: 0 });
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//slightly modified version from https://github.com/zsviczian/obsidian-excalidraw-plugin
|
|
|
|
|
class TextInputPrompt extends BaseModal {
|
|
|
|
|
constructor(app, promptText, hint, defaultValue, placeholder) {
|
|
|
|
|
super(app);
|
|
|
|
|
this.promptText = promptText;
|
|
|
|
|
this.hint = hint;
|
|
|
|
|
this.defaultValue = defaultValue;
|
|
|
|
|
this.placeholder = placeholder;
|
|
|
|
|
}
|
|
|
|
|
onOpen() {
|
|
|
|
|
this.titleEl.setText(this.promptText);
|
|
|
|
|
this.createForm();
|
|
|
|
|
}
|
|
|
|
|
onClose() {
|
|
|
|
|
this.contentEl.empty();
|
|
|
|
|
}
|
|
|
|
|
createForm() {
|
|
|
|
|
const div = this.contentEl.createDiv();
|
|
|
|
|
const text = new obsidian.Setting(div).setName(this.promptText).setDesc(this.hint).addText((textComponent) => {
|
|
|
|
|
textComponent
|
|
|
|
|
.setValue(this.defaultValue)
|
|
|
|
|
.setPlaceholder(this.placeholder)
|
|
|
|
|
.onChange(() => {
|
|
|
|
|
this.removeValidationError(textComponent);
|
|
|
|
|
})
|
|
|
|
|
.inputEl.setAttribute("size", "50");
|
|
|
|
|
this.textComponent = textComponent;
|
|
|
|
|
});
|
|
|
|
|
text.controlEl.addClass("rss-setting-input");
|
|
|
|
|
new obsidian.Setting(div).addButton((b) => {
|
|
|
|
|
b
|
|
|
|
|
.setButtonText("Save")
|
|
|
|
|
.onClick(() => __awaiter(this, void 0, void 0, function* () {
|
|
|
|
|
this.resolve(this.textComponent);
|
|
|
|
|
}));
|
|
|
|
|
return b;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
openAndGetValue(resolve) {
|
|
|
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
|
|
|
this.resolve = resolve;
|
|
|
|
|
yield this.open();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var feather = createCommonjsModule(function (module, exports) {
|
|
|
|
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
|
|
|
module.exports = factory();
|
|
|
|
|
})(typeof self !== 'undefined' ? self : commonjsGlobal, 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;
|
|
|
|
|
/******/
|
|
|
|
|
/******/ // 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
|
|
|
|
|
/******/ });
|
|
|
|
|
/******/ }
|
|
|
|
|
/******/ };
|
|
|
|
|
/******/
|
|
|
|
|
/******/ // define __esModule on exports
|
|
|
|
|
/******/ __webpack_require__.r = function(exports) {
|
|
|
|
|
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
|
|
/******/ };
|
|
|
|
|
/******/
|
|
|
|
|
/******/ // 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 = 0);
|
|
|
|
|
/******/ })
|
|
|
|
|
/************************************************************************/
|
|
|
|
|
/******/ ({
|
|
|
|
|
|
|
|
|
|
/***/ "./dist/icons.json":
|
|
|
|
|
/*!*************************!*\
|
|
|
|
|
!*** ./dist/icons.json ***!
|
|
|
|
|
\*************************/
|
|
|
|
|
/*! exports provided: activity, airplay, alert-circle, alert-octagon, alert-triangle, align-center, align-justify, align-left, align-right, anchor, aperture, archive, arrow-down-circle, arrow-down-left, arrow-down-right, arrow-down, arrow-left-circle, arrow-left, arrow-right-circle, arrow-right, arrow-up-circle, arrow-up-left, arrow-up-right, arrow-up, at-sign, award, bar-chart-2, bar-chart, battery-charging, battery, bell-off, bell, bluetooth, bold, book-open, book, bookmark, box, briefcase, calendar, camera-off, camera, cast, check-circle, check-square, check, chevron-down, chevron-left, chevron-right, chevron-up, chevrons-down, chevrons-left, chevrons-right, chevrons-up, chrome, circle, clipboard, clock, cloud-drizzle, cloud-lightning, cloud-off, cloud-rain, cloud-snow, cloud, code, codepen, codesandbox, coffee, columns, command, compass, copy, corner-down-left, corner-down-right, corner-left-down, corner-left-up, corner-right-down, corner-right-up, corner-up-left, corner-up-right, cpu, credit-card, crop, crosshair, database, delete, disc, divide-circle, divide-square, divide, dollar-sign, download-cloud, download, dribbble, droplet, edit-2, edit-3, edit, external-link, eye-off, eye, facebook, fast-forward, feather, figma, file-minus, file-plus, file-text, file, film, filter, flag, folder-minus, folder-plus, folder, framer, frown, gift, git-branch, git-commit, git-merge, git-pull-request, github, gitlab, globe, grid, hard-drive, hash, headphones, heart, help-circle, hexagon, home, image, inbox, info, instagram, italic, key, layers, layout, life-buoy, link-2, link, linkedin, list, loader, lock, log-in, log-out, mail, map-pin, map, maximize-2, maximize, meh, menu, message-circle, message-square, mic-off, mic, minimize-2, minimize, minus-circle, minus-square, minus, monitor, moon, more-horizontal, more-vertical, mouse-pointer, move, music, navigation-2, navigation, octagon, package, paperclip, pause-circle, pause, pen-tool, percent, phone-call, phone-forwarded, phone-incoming, phone-missed, phone-off, phone-outgoing, phone, pie-chart, play-circle, play, plus-circle, plus-square, plus, pocket, power, printer, radio, refresh-ccw, refresh-cw, repeat, rewind, rotate-ccw, rotate-cw, rss, save, scissors, search, send, server, settings, share-2, share, shield-off, shield, shopping-bag, shopping-cart, shuffle, sidebar, skip-back, skip-forward, slack, slash, sliders, smartphone, smile, speaker, square, star, stop-circle, sun, sunrise, sunset, tablet, tag, target, terminal, thermometer, thumbs-down, thumbs-up, toggle-left, toggle-right, tool, trash-2, trash, trello, trending-down, trending-up, triangle, truck, tv, twitch, twitter, type, umbrella, underline, unlock, upload-cloud, upload, user-check, user-minus, user-plus, user-x, user, users, video-off, video, voicemail, volume-1, volume-2, volume-x, volume, watch, wifi-off, wifi, wind, x-circle, x-octagon, x-square, x, youtube, zap-off, zap, zoom-in, zoom-out, default */
|
|
|
|
|
/***/ (function(module) {
|
|
|
|
|
|
|
|
|
|
module.exports = {"activity":"<polyline points=\"22 12 18 12 15 21 9 3 6 12 2 12\"></polyline>","airplay":"<path d=\"M5 17H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2h-1\"></path><polygon points=\"12 15 17 21 7 21 12 15\"></polygon>","alert-circle":"<circle cx=\"12\" cy=\"12\" r=\"10\"></circle><line x1=\"12\" y1=\"8\" x2=\"12\" y2=\"12\"></line><line x1=\"12\" y1=\"16\" x2=\"12.01\" y2=\"16\"></line>","alert-octagon":"<polygon points=\"7.86 2 16.14 2 22 7.86 22 16.14 16.14 22 7.86 22 2 16.14 2 7.86 7.86 2\"></polygon><line x1=\"12\" y1=\"8\" x2=\"12\" y2=\"12\"></line><line x1=\"12\" y1=\"16\" x2=\"12.01\" y2=\"16\"></line>","alert-triangle":"<path d=\"M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z\"></path><line x1=\"12\" y1=\"9\" x2=\"12\" y2=\"13\"></line><line x1=\"12\" y1=\"17\" x2=\"12.01\" y2=\"17\"></line>","align-center":"<line x1=\"18\" y1=\"10\" x2=\"6\" y2=\"10\"></line><line x1=\"21\" y1=\"6\" x2=\"3\" y2=\"6\"></line><line x1=\"21\" y1=\"14\" x2=\"3\" y2=\"14\"></line><line x1=\"18\" y1=\"18\" x2=\"6\" y2=\"18\"></line>","align-justify":"<line x1=\"21\" y1=\"10\" x2=\"3\" y2=\"10\"></line><line x1=\"21\" y1=\"6\" x2=\"3\" y2=\"6\"></line><line x1=\"21\" y1=\"14\" x2=\"3\" y2=\"14\"></line><line x1=\"21\" y1=\"18\" x2=\"3\" y2=\"18\"></line>","align-left":"<line x1=\"17\" y1=\"10\" x2=\"3\" y2=\"10\"></line><line x1=\"21\" y1=\"6\" x2=\"3\" y2=\"6\"></line><line x1=\"21\" y1=\"14\" x2=\"3\" y2=\"14\"></line><line x1=\"17\" y1=\"18\" x2=\"3\" y2=\"18\"></line>","align-right":"<line x1=\"21\" y1=\"10\" x2=\"7\" y2=\"10\"></line><line x1=\"21\" y1=\"6\" x2=\"3\" y2=\"6\"></line><line x1=\"21\" y1=\"14\" x2=\"3\" y2=\"14\"></line><line x1=\"21\" y1=\"18\" x2=\"7\" y2=\"18\"></line>","anchor":"<circle cx=\"12\" cy=\"5\" r=\"3\"></circle><line x1=\"12\" y1=\"22\" x2=\"12\" y2=\"8\"></line><path d=\"M5 12H2a10 10 0 0 0 20 0h-3\"></path>","aperture":"<circle cx=\"12\" cy=\"12\" r=\"10\"></circle><line x1=\"14.31\" y1=\"8\" x2=\"20.05\" y2=\"17.94\"></line><line x1=\"9.69\" y1=\"8\" x2=\"21.17\" y2=\"8\"></line><line x1=\"7.38\" y1=\"12\" x2=\"13.12\" y2=\"2.06\"></line><line x1=\"9.69\" y1=\"16\" x2=\"3.95\" y2=\"6.06\"></line><line x1=\"14.31\" y1=\"16\" x2=\"2.83\" y2=\"16\"></line><line x1=\"16.62\" y1=\"12\" x2=\"10.88\" y2=\"21.94\"></line>","archive":"<polyline points=\"21 8 21 21 3 21 3 8\"></polyline><rect x=\"1\" y=\"3\" width=\"22\" height=\"5\"></rect><line x1=\"10\" y1=\"12\" x2=\"14\" y2=\"12\"></line>","arrow-down-circle":"<circle cx=\"12\" cy=\"12\" r=\"10\"></circle><polyline points=\"8 12 12 16 16 12\"></polyline><line x1=\"12\" y1=\"8\" x2=\"12\" y2=\"16\"></line>","arrow-down-left":"<line x1=\"17\" y1=\"7\" x2=\"7\" y2=\"17\"></line><polyline points=\"17 17 7 17 7 7\"></polyline>","arrow-down-right":"<line x1=\"7\" y1=\"7\" x2=\"17\" y2=\"17\"></line><polyline points=\"17 7 17 17 7 17\"></polyline>","arrow-down":"<line x1=\"12\" y1=\"5\" x2=\"12\" y2=\"19\"></line><polyline points=\"19 12 12 19 5 12\"></polyline>","arrow-left-circle":"<circle cx=\"12\" cy=\"12\" r=\"10\"></circle><polyline points=\"12 8 8 12 12 16\"></polyline><line x1=\"16\" y1=\"12\" x2=\"8\" y2=\"12\"></line>","arrow-left":"<line x1=\"19\" y1=\"12\" x2=\"5\" y2=\"12\"></line><polyline points=\"12 19 5 12 12 5\"></polyline>","arrow-right-circle":"<circle cx=\"12\" cy=\"12\" r=\"10\"></circle><polyline points=\"12 16 16 12 12 8\"></polyline><line x1=\"8\" y1=\"12\" x2=\"16\" y2=\"12\"></line>","arrow-right":"<line x1=\"5\" y1=\"12\" x2=\"19\" y2=\"12\"></line><polyline points=\"12 5 19 12 12 19\"></polyline>","arrow-up-circle":"<circle cx=\"12\" cy=\"12\" r=\"10\"></circle><polyline points=\"16 12 12 8 8 12\"></polyline><line x1=\"12\" y1=\"16\" x2=\"12\" y2=\"8\"></line>","arrow-up-left":"<line x1=\"17\" y1=\"17\" x2=\"7\" y2=\"7\"></line><polyline points=\"7 17 7 7 17 7\"></polyline>","arrow-up-right":"<line x1=\"7\" y1=\"17\" x2=\"17\" y2=\"7\"></line><polyline points=\"7 7 17 7 17 17\"></polyline>","arrow-up":"<line x1=\"12\" y1=\"19\" x2=\"12\" y2=\"5\"></line
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ "./node_modules/classnames/dedupe.js":
|
|
|
|
|
/*!*******************************************!*\
|
|
|
|
|
!*** ./node_modules/classnames/dedupe.js ***!
|
|
|
|
|
\*******************************************/
|
|
|
|
|
/*! no static exports found */
|
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
|
|
|
|
|
Copyright (c) 2016 Jed Watson.
|
|
|
|
|
Licensed under the MIT License (MIT), see
|
|
|
|
|
http://jedwatson.github.io/classnames
|
|
|
|
|
*/
|
|
|
|
|
/* global define */
|
|
|
|
|
|
|
|
|
|
(function () {
|
|
|
|
|
|
|
|
|
|
var classNames = (function () {
|
|
|
|
|
// don't inherit from Object so we can skip hasOwnProperty check later
|
|
|
|
|
// http://stackoverflow.com/questions/15518328/creating-js-object-with-object-createnull#answer-21079232
|
|
|
|
|
function StorageObject() {}
|
|
|
|
|
StorageObject.prototype = Object.create(null);
|
|
|
|
|
|
|
|
|
|
function _parseArray (resultSet, array) {
|
|
|
|
|
var length = array.length;
|
|
|
|
|
|
|
|
|
|
for (var i = 0; i < length; ++i) {
|
|
|
|
|
_parse(resultSet, array[i]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var hasOwn = {}.hasOwnProperty;
|
|
|
|
|
|
|
|
|
|
function _parseNumber (resultSet, num) {
|
|
|
|
|
resultSet[num] = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function _parseObject (resultSet, object) {
|
|
|
|
|
for (var k in object) {
|
|
|
|
|
if (hasOwn.call(object, k)) {
|
|
|
|
|
// set value to false instead of deleting it to avoid changing object structure
|
|
|
|
|
// https://www.smashingmagazine.com/2012/11/writing-fast-memory-efficient-javascript/#de-referencing-misconceptions
|
|
|
|
|
resultSet[k] = !!object[k];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var SPACE = /\s+/;
|
|
|
|
|
function _parseString (resultSet, str) {
|
|
|
|
|
var array = str.split(SPACE);
|
|
|
|
|
var length = array.length;
|
|
|
|
|
|
|
|
|
|
for (var i = 0; i < length; ++i) {
|
|
|
|
|
resultSet[array[i]] = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function _parse (resultSet, arg) {
|
|
|
|
|
if (!arg) return;
|
|
|
|
|
var argType = typeof arg;
|
|
|
|
|
|
|
|
|
|
// 'foo bar'
|
|
|
|
|
if (argType === 'string') {
|
|
|
|
|
_parseString(resultSet, arg);
|
|
|
|
|
|
|
|
|
|
// ['foo', 'bar', ...]
|
|
|
|
|
} else if (Array.isArray(arg)) {
|
|
|
|
|
_parseArray(resultSet, arg);
|
|
|
|
|
|
|
|
|
|
// { 'foo': true, ... }
|
|
|
|
|
} else if (argType === 'object') {
|
|
|
|
|
_parseObject(resultSet, arg);
|
|
|
|
|
|
|
|
|
|
// '130'
|
|
|
|
|
} else if (argType === 'number') {
|
|
|
|
|
_parseNumber(resultSet, arg);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function _classNames () {
|
|
|
|
|
// don't leak arguments
|
|
|
|
|
// https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#32-leaking-arguments
|
|
|
|
|
var len = arguments.length;
|
|
|
|
|
var args = Array(len);
|
|
|
|
|
for (var i = 0; i < len; i++) {
|
|
|
|
|
args[i] = arguments[i];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var classSet = new StorageObject();
|
|
|
|
|
_parseArray(classSet, args);
|
|
|
|
|
|
|
|
|
|
var list = [];
|
|
|
|
|
|
|
|
|
|
for (var k in classSet) {
|
|
|
|
|
if (classSet[k]) {
|
|
|
|
|
list.push(k);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return list.join(' ');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return _classNames;
|
|
|
|
|
})();
|
|
|
|
|
|
|
|
|
|
if (typeof module !== 'undefined' && module.exports) {
|
|
|
|
|
module.exports = classNames;
|
|
|
|
|
} else {
|
|
|
|
|
// register as 'classnames', consistent with npm package name
|
|
|
|
|
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () {
|
|
|
|
|
return classNames;
|
|
|
|
|
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
|
|
|
|
|
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
|
|
|
|
}
|
|
|
|
|
}());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ "./node_modules/core-js/es/array/from.js":
|
|
|
|
|
/*!***********************************************!*\
|
|
|
|
|
!*** ./node_modules/core-js/es/array/from.js ***!
|
|
|
|
|
\***********************************************/
|
|
|
|
|
/*! no static exports found */
|
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
__webpack_require__(/*! ../../modules/es.string.iterator */ "./node_modules/core-js/modules/es.string.iterator.js");
|
|
|
|
|
__webpack_require__(/*! ../../modules/es.array.from */ "./node_modules/core-js/modules/es.array.from.js");
|
|
|
|
|
var path = __webpack_require__(/*! ../../internals/path */ "./node_modules/core-js/internals/path.js");
|
|
|
|
|
|
|
|
|
|
module.exports = path.Array.from;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ "./node_modules/core-js/internals/a-function.js":
|
|
|
|
|
/*!******************************************************!*\
|
|
|
|
|
!*** ./node_modules/core-js/internals/a-function.js ***!
|
|
|
|
|
\******************************************************/
|
|
|
|
|
/*! no static exports found */
|
|
|
|
|
/***/ (function(module, exports) {
|
|
|
|
|
|
|
|
|
|
module.exports = function (it) {
|
|
|
|
|
if (typeof it != 'function') {
|
|
|
|
|
throw TypeError(String(it) + ' is not a function');
|
|
|
|
|
} return it;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ "./node_modules/core-js/internals/an-object.js":
|
|
|
|
|
/*!*****************************************************!*\
|
|
|
|
|
!*** ./node_modules/core-js/internals/an-object.js ***!
|
|
|
|
|
\*****************************************************/
|
|
|
|
|
/*! no static exports found */
|
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
var isObject = __webpack_require__(/*! ../internals/is-object */ "./node_modules/core-js/internals/is-object.js");
|
|
|
|
|
|
|
|
|
|
module.exports = function (it) {
|
|
|
|
|
if (!isObject(it)) {
|
|
|
|
|
throw TypeError(String(it) + ' is not an object');
|
|
|
|
|
} return it;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ "./node_modules/core-js/internals/array-from.js":
|
|
|
|
|
/*!******************************************************!*\
|
|
|
|
|
!*** ./node_modules/core-js/internals/array-from.js ***!
|
|
|
|
|
\******************************************************/
|
|
|
|
|
/*! no static exports found */
|
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
var bind = __webpack_require__(/*! ../internals/bind-context */ "./node_modules/core-js/internals/bind-context.js");
|
|
|
|
|
var toObject = __webpack_require__(/*! ../internals/to-object */ "./node_modules/core-js/internals/to-object.js");
|
|
|
|
|
var callWithSafeIterationClosing = __webpack_require__(/*! ../internals/call-with-safe-iteration-closing */ "./node_modules/core-js/internals/call-with-safe-iteration-closing.js");
|
|
|
|
|
var isArrayIteratorMethod = __webpack_require__(/*! ../internals/is-array-iterator-method */ "./node_modules/core-js/internals/is-array-iterator-method.js");
|
|
|
|
|
var toLength = __webpack_require__(/*! ../internals/to-length */ "./node_modules/core-js/internals/to-length.js");
|
|
|
|
|
var createProperty = __webpack_require__(/*! ../internals/create-property */ "./node_modules/core-js/internals/create-property.js");
|
|
|
|
|
var getIteratorMethod = __webpack_require__(/*! ../internals/get-iterator-method */ "./node_modules/core-js/internals/get-iterator-method.js");
|
|
|
|
|
|
|
|
|
|
// `Array.from` method
|
|
|
|
|
// https://tc39.github.io/ecma262/#sec-array.from
|
|
|
|
|
module.exports = function from(arrayLike /* , mapfn = undefined, thisArg = undefined */) {
|
|
|
|
|
var O = toObject(arrayLike);
|
|
|
|
|
var C = typeof this == 'function' ? this : Array;
|
|
|
|
|
var argumentsLength = arguments.length;
|
|
|
|
|
var mapfn = argumentsLength > 1 ? arguments[1] : undefined;
|
|
|
|
|
var mapping = mapfn !== undefined;
|
|
|
|
|
var index = 0;
|
|
|
|
|
var iteratorMethod = getIteratorMethod(O);
|
|
|
|
|
var length, result, step, iterator;
|
|
|
|
|
if (mapping) mapfn = bind(mapfn, argumentsLength > 2 ? arguments[2] : undefined, 2);
|
|
|
|
|
// if the target is not iterable or it's an array with the default iterator - use a simple case
|
|
|
|
|
if (iteratorMethod != undefined && !(C == Array && isArrayIteratorMethod(iteratorMethod))) {
|
|
|
|
|
iterator = iteratorMethod.call(O);
|
|
|
|
|
result = new C();
|
|
|
|
|
for (;!(step = iterator.next()).done; index++) {
|
|
|
|
|
createProperty(result, index, mapping
|
|
|
|
|
? callWithSafeIterationClosing(iterator, mapfn, [step.value, index], true)
|
|
|
|
|
: step.value
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
length = toLength(O.length);
|
|
|
|
|
result = new C(length);
|
|
|
|
|
for (;length > index; index++) {
|
|
|
|
|
createProperty(result, index, mapping ? mapfn(O[index], index) : O[index]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
result.length = index;
|
|
|
|
|
return result;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ "./node_modules/core-js/internals/array-includes.js":
|
|
|
|
|
/*!**********************************************************!*\
|
|
|
|
|
!*** ./node_modules/core-js/internals/array-includes.js ***!
|
|
|
|
|
\**********************************************************/
|
|
|
|
|
/*! no static exports found */
|
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
var toIndexedObject = __webpack_require__(/*! ../internals/to-indexed-object */ "./node_modules/core-js/internals/to-indexed-object.js");
|
|
|
|
|
var toLength = __webpack_require__(/*! ../internals/to-length */ "./node_modules/core-js/internals/to-length.js");
|
|
|
|
|
var toAbsoluteIndex = __webpack_require__(/*! ../internals/to-absolute-index */ "./node_modules/core-js/internals/to-absolute-index.js");
|
|
|
|
|
|
|
|
|
|
// `Array.prototype.{ indexOf, includes }` methods implementation
|
|
|
|
|
// false -> Array#indexOf
|
|
|
|
|
// https://tc39.github.io/ecma262/#sec-array.prototype.indexof
|
|
|
|
|
// true -> Array#includes
|
|
|
|
|
// https://tc39.github.io/ecma262/#sec-array.prototype.includes
|
|
|
|
|
module.exports = function (IS_INCLUDES) {
|
|
|
|
|
return function ($this, el, fromIndex) {
|
|
|
|
|
var O = toIndexedObject($this);
|
|
|
|
|
var length = toLength(O.length);
|
|
|
|
|
var index = toAbsoluteIndex(fromIndex, length);
|
|
|
|
|
var value;
|
|
|
|
|
// Array#includes uses SameValueZero equality algorithm
|
|
|
|
|
// eslint-disable-next-line no-self-compare
|
|
|
|
|
if (IS_INCLUDES && el != el) while (length > index) {
|
|
|
|
|
value = O[index++];
|
|
|
|
|
// eslint-disable-next-line no-self-compare
|
|
|
|
|
if (value != value) return true;
|
|
|
|
|
// Array#indexOf ignores holes, Array#includes - not
|
|
|
|
|
} else for (;length > index; index++) if (IS_INCLUDES || index in O) {
|
|
|
|
|
if (O[index] === el) return IS_INCLUDES || index || 0;
|
|
|
|
|
} return !IS_INCLUDES && -1;
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ "./node_modules/core-js/internals/bind-context.js":
|
|
|
|
|
/*!********************************************************!*\
|
|
|
|
|
!*** ./node_modules/core-js/internals/bind-context.js ***!
|
|
|
|
|
\********************************************************/
|
|
|
|
|
/*! no static exports found */
|
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
var aFunction = __webpack_require__(/*! ../internals/a-function */ "./node_modules/core-js/internals/a-function.js");
|
|
|
|
|
|
|
|
|
|
// optional / simple context binding
|
|
|
|
|
module.exports = function (fn, that, length) {
|
|
|
|
|
aFunction(fn);
|
|
|
|
|
if (that === undefined) return fn;
|
|
|
|
|
switch (length) {
|
|
|
|
|
case 0: return function () {
|
|
|
|
|
return fn.call(that);
|
|
|
|
|
};
|
|
|
|
|
case 1: return function (a) {
|
|
|
|
|
return fn.call(that, a);
|
|
|
|
|
};
|
|
|
|
|
case 2: return function (a, b) {
|
|
|
|
|
return fn.call(that, a, b);
|
|
|
|
|
};
|
|
|
|
|
case 3: return function (a, b, c) {
|
|
|
|
|
return fn.call(that, a, b, c);
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
return function (/* ...args */) {
|
|
|
|
|
return fn.apply(that, arguments);
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ "./node_modules/core-js/internals/call-with-safe-iteration-closing.js":
|
|
|
|
|
/*!****************************************************************************!*\
|
|
|
|
|
!*** ./node_modules/core-js/internals/call-with-safe-iteration-closing.js ***!
|
|
|
|
|
\****************************************************************************/
|
|
|
|
|
/*! no static exports found */
|
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
var anObject = __webpack_require__(/*! ../internals/an-object */ "./node_modules/core-js/internals/an-object.js");
|
|
|
|
|
|
|
|
|
|
// call something on iterator step with safe closing on error
|
|
|
|
|
module.exports = function (iterator, fn, value, ENTRIES) {
|
|
|
|
|
try {
|
|
|
|
|
return ENTRIES ? fn(anObject(value)[0], value[1]) : fn(value);
|
|
|
|
|
// 7.4.6 IteratorClose(iterator, completion)
|
|
|
|
|
} catch (error) {
|
|
|
|
|
var returnMethod = iterator['return'];
|
|
|
|
|
if (returnMethod !== undefined) anObject(returnMethod.call(iterator));
|
|
|
|
|
throw error;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ "./node_modules/core-js/internals/check-correctness-of-iteration.js":
|
|
|
|
|
/*!**************************************************************************!*\
|
|
|
|
|
!*** ./node_modules/core-js/internals/check-correctness-of-iteration.js ***!
|
|
|
|
|
\**************************************************************************/
|
|
|
|
|
/*! no static exports found */
|
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
var wellKnownSymbol = __webpack_require__(/*! ../internals/well-known-symbol */ "./node_modules/core-js/internals/well-known-symbol.js");
|
|
|
|
|
|
|
|
|
|
var ITERATOR = wellKnownSymbol('iterator');
|
|
|
|
|
var SAFE_CLOSING = false;
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
var called = 0;
|
|
|
|
|
var iteratorWithReturn = {
|
|
|
|
|
next: function () {
|
|
|
|
|
return { done: !!called++ };
|
|
|
|
|
},
|
|
|
|
|
'return': function () {
|
|
|
|
|
SAFE_CLOSING = true;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
iteratorWithReturn[ITERATOR] = function () {
|
|
|
|
|
return this;
|
|
|
|
|
};
|
|
|
|
|
// eslint-disable-next-line no-throw-literal
|
|
|
|
|
Array.from(iteratorWithReturn, function () { throw 2; });
|
|
|
|
|
} catch (error) { /* empty */ }
|
|
|
|
|
|
|
|
|
|
module.exports = function (exec, SKIP_CLOSING) {
|
|
|
|
|
if (!SKIP_CLOSING && !SAFE_CLOSING) return false;
|
|
|
|
|
var ITERATION_SUPPORT = false;
|
|
|
|
|
try {
|
|
|
|
|
var object = {};
|
|
|
|
|
object[ITERATOR] = function () {
|
|
|
|
|
return {
|
|
|
|
|
next: function () {
|
|
|
|
|
return { done: ITERATION_SUPPORT = true };
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
exec(object);
|
|
|
|
|
} catch (error) { /* empty */ }
|
|
|
|
|
return ITERATION_SUPPORT;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ "./node_modules/core-js/internals/classof-raw.js":
|
|
|
|
|
/*!*******************************************************!*\
|
|
|
|
|
!*** ./node_modules/core-js/internals/classof-raw.js ***!
|
|
|
|
|
\*******************************************************/
|
|
|
|
|
/*! no static exports found */
|
|
|
|
|
/***/ (function(module, exports) {
|
|
|
|
|
|
|
|
|
|
var toString = {}.toString;
|
|
|
|
|
|
|
|
|
|
module.exports = function (it) {
|
|
|
|
|
return toString.call(it).slice(8, -1);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ "./node_modules/core-js/internals/classof.js":
|
|
|
|
|
/*!***************************************************!*\
|
|
|
|
|
!*** ./node_modules/core-js/internals/classof.js ***!
|
|
|
|
|
\***************************************************/
|
|
|
|
|
/*! no static exports found */
|
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
var classofRaw = __webpack_require__(/*! ../internals/classof-raw */ "./node_modules/core-js/internals/classof-raw.js");
|
|
|
|
|
var wellKnownSymbol = __webpack_require__(/*! ../internals/well-known-symbol */ "./node_modules/core-js/internals/well-known-symbol.js");
|
|
|
|
|
|
|
|
|
|
var TO_STRING_TAG = wellKnownSymbol('toStringTag');
|
|
|
|
|
// ES3 wrong here
|
|
|
|
|
var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments';
|
|
|
|
|
|
|
|
|
|
// fallback for IE11 Script Access Denied error
|
|
|
|
|
var tryGet = function (it, key) {
|
|
|
|
|
try {
|
|
|
|
|
return it[key];
|
|
|
|
|
} catch (error) { /* empty */ }
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// getting tag from ES6+ `Object.prototype.toString`
|
|
|
|
|
module.exports = function (it) {
|
|
|
|
|
var O, tag, result;
|
|
|
|
|
return it === undefined ? 'Undefined' : it === null ? 'Null'
|
|
|
|
|
// @@toStringTag case
|
|
|
|
|
: typeof (tag = tryGet(O = Object(it), TO_STRING_TAG)) == 'string' ? tag
|
|
|
|
|
// builtinTag case
|
|
|
|
|
: CORRECT_ARGUMENTS ? classofRaw(O)
|
|
|
|
|
// ES3 arguments fallback
|
|
|
|
|
: (result = classofRaw(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : result;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ "./node_modules/core-js/internals/copy-constructor-properties.js":
|
|
|
|
|
/*!***********************************************************************!*\
|
|
|
|
|
!*** ./node_modules/core-js/internals/copy-constructor-properties.js ***!
|
|
|
|
|
\***********************************************************************/
|
|
|
|
|
/*! no static exports found */
|
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
var has = __webpack_require__(/*! ../internals/has */ "./node_modules/core-js/internals/has.js");
|
|
|
|
|
var ownKeys = __webpack_require__(/*! ../internals/own-keys */ "./node_modules/core-js/internals/own-keys.js");
|
|
|
|
|
var getOwnPropertyDescriptorModule = __webpack_require__(/*! ../internals/object-get-own-property-descriptor */ "./node_modules/core-js/internals/object-get-own-property-descriptor.js");
|
|
|
|
|
var definePropertyModule = __webpack_require__(/*! ../internals/object-define-property */ "./node_modules/core-js/internals/object-define-property.js");
|
|
|
|
|
|
|
|
|
|
module.exports = function (target, source) {
|
|
|
|
|
var keys = ownKeys(source);
|
|
|
|
|
var defineProperty = definePropertyModule.f;
|
|
|
|
|
var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
|
|
|
|
|
for (var i = 0; i < keys.length; i++) {
|
|
|
|
|
var key = keys[i];
|
|
|
|
|
if (!has(target, key)) defineProperty(target, key, getOwnPropertyDescriptor(source, key));
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ "./node_modules/core-js/internals/correct-prototype-getter.js":
|
|
|
|
|
/*!********************************************************************!*\
|
|
|
|
|
!*** ./node_modules/core-js/internals/correct-prototype-getter.js ***!
|
|
|
|
|
\********************************************************************/
|
|
|
|
|
/*! no static exports found */
|
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
var fails = __webpack_require__(/*! ../internals/fails */ "./node_modules/core-js/internals/fails.js");
|
|
|
|
|
|
|
|
|
|
module.exports = !fails(function () {
|
|
|
|
|
function F() { /* empty */ }
|
|
|
|
|
F.prototype.constructor = null;
|
|
|
|
|
return Object.getPrototypeOf(new F()) !== F.prototype;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ "./node_modules/core-js/internals/create-iterator-constructor.js":
|
|
|
|
|
/*!***********************************************************************!*\
|
|
|
|
|
!*** ./node_modules/core-js/internals/create-iterator-constructor.js ***!
|
|
|
|
|
\***********************************************************************/
|
|
|
|
|
/*! no static exports found */
|
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
var IteratorPrototype = __webpack_require__(/*! ../internals/iterators-core */ "./node_modules/core-js/internals/iterators-core.js").IteratorPrototype;
|
|
|
|
|
var create = __webpack_require__(/*! ../internals/object-create */ "./node_modules/core-js/internals/object-create.js");
|
|
|
|
|
var createPropertyDescriptor = __webpack_require__(/*! ../internals/create-property-descriptor */ "./node_modules/core-js/internals/create-property-descriptor.js");
|
|
|
|
|
var setToStringTag = __webpack_require__(/*! ../internals/set-to-string-tag */ "./node_modules/core-js/internals/set-to-string-tag.js");
|
|
|
|
|
var Iterators = __webpack_require__(/*! ../internals/iterators */ "./node_modules/core-js/internals/iterators.js");
|
|
|
|
|
|
|
|
|
|
var returnThis = function () { return this; };
|
|
|
|
|
|
|
|
|
|
module.exports = function (IteratorConstructor, NAME, next) {
|
|
|
|
|
var TO_STRING_TAG = NAME + ' Iterator';
|
|
|
|
|
IteratorConstructor.prototype = create(IteratorPrototype, { next: createPropertyDescriptor(1, next) });
|
|
|
|
|
setToStringTag(IteratorConstructor, TO_STRING_TAG, false, true);
|
|
|
|
|
Iterators[TO_STRING_TAG] = returnThis;
|
|
|
|
|
return IteratorConstructor;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ "./node_modules/core-js/internals/create-property-descriptor.js":
|
|
|
|
|
/*!**********************************************************************!*\
|
|
|
|
|
!*** ./node_modules/core-js/internals/create-property-descriptor.js ***!
|
|
|
|
|
\**********************************************************************/
|
|
|
|
|
/*! no static exports found */
|
|
|
|
|
/***/ (function(module, exports) {
|
|
|
|
|
|
|
|
|
|
module.exports = function (bitmap, value) {
|
|
|
|
|
return {
|
|
|
|
|
enumerable: !(bitmap & 1),
|
|
|
|
|
configurable: !(bitmap & 2),
|
|
|
|
|
writable: !(bitmap & 4),
|
|
|
|
|
value: value
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ "./node_modules/core-js/internals/create-property.js":
|
|
|
|
|
/*!***********************************************************!*\
|
|
|
|
|
!*** ./node_modules/core-js/internals/create-property.js ***!
|
|
|
|
|
\***********************************************************/
|
|
|
|
|
/*! no static exports found */
|
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
var toPrimitive = __webpack_require__(/*! ../internals/to-primitive */ "./node_modules/core-js/internals/to-primitive.js");
|
|
|
|
|
var definePropertyModule = __webpack_require__(/*! ../internals/object-define-property */ "./node_modules/core-js/internals/object-define-property.js");
|
|
|
|
|
var createPropertyDescriptor = __webpack_require__(/*! ../internals/create-property-descriptor */ "./node_modules/core-js/internals/create-property-descriptor.js");
|
|
|
|
|
|
|
|
|
|
module.exports = function (object, key, value) {
|
|
|
|
|
var propertyKey = toPrimitive(key);
|
|
|
|
|
if (propertyKey in object) definePropertyModule.f(object, propertyKey, createPropertyDescriptor(0, value));
|
|
|
|
|
else object[propertyKey] = value;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ "./node_modules/core-js/internals/define-iterator.js":
|
|
|
|
|
/*!***********************************************************!*\
|
|
|
|
|
!*** ./node_modules/core-js/internals/define-iterator.js ***!
|
|
|
|
|
\***********************************************************/
|
|
|
|
|
/*! no static exports found */
|
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
var $ = __webpack_require__(/*! ../internals/export */ "./node_modules/core-js/internals/export.js");
|
|
|
|
|
var createIteratorConstructor = __webpack_require__(/*! ../internals/create-iterator-constructor */ "./node_modules/core-js/internals/create-iterator-constructor.js");
|
|
|
|
|
var getPrototypeOf = __webpack_require__(/*! ../internals/object-get-prototype-of */ "./node_modules/core-js/internals/object-get-prototype-of.js");
|
|
|
|
|
var setPrototypeOf = __webpack_require__(/*! ../internals/object-set-prototype-of */ "./node_modules/core-js/internals/object-set-prototype-of.js");
|
|
|
|
|
var setToStringTag = __webpack_require__(/*! ../internals/set-to-string-tag */ "./node_modules/core-js/internals/set-to-string-tag.js");
|
|
|
|
|
var hide = __webpack_require__(/*! ../internals/hide */ "./node_modules/core-js/internals/hide.js");
|
|
|
|
|
var redefine = __webpack_require__(/*! ../internals/redefine */ "./node_modules/core-js/internals/redefine.js");
|
|
|
|
|
var wellKnownSymbol = __webpack_require__(/*! ../internals/well-known-symbol */ "./node_modules/core-js/internals/well-known-symbol.js");
|
|
|
|
|
var IS_PURE = __webpack_require__(/*! ../internals/is-pure */ "./node_modules/core-js/internals/is-pure.js");
|
|
|
|
|
var Iterators = __webpack_require__(/*! ../internals/iterators */ "./node_modules/core-js/internals/iterators.js");
|
|
|
|
|
var IteratorsCore = __webpack_require__(/*! ../internals/iterators-core */ "./node_modules/core-js/internals/iterators-core.js");
|
|
|
|
|
|
|
|
|
|
var IteratorPrototype = IteratorsCore.IteratorPrototype;
|
|
|
|
|
var BUGGY_SAFARI_ITERATORS = IteratorsCore.BUGGY_SAFARI_ITERATORS;
|
|
|
|
|
var ITERATOR = wellKnownSymbol('iterator');
|
|
|
|
|
var KEYS = 'keys';
|
|
|
|
|
var VALUES = 'values';
|
|
|
|
|
var ENTRIES = 'entries';
|
|
|
|
|
|
|
|
|
|
var returnThis = function () { return this; };
|
|
|
|
|
|
|
|
|
|
module.exports = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) {
|
|
|
|
|
createIteratorConstructor(IteratorConstructor, NAME, next);
|
|
|
|
|
|
|
|
|
|
var getIterationMethod = function (KIND) {
|
|
|
|
|
if (KIND === DEFAULT && defaultIterator) return defaultIterator;
|
|
|
|
|
if (!BUGGY_SAFARI_ITERATORS && KIND in IterablePrototype) return IterablePrototype[KIND];
|
|
|
|
|
switch (KIND) {
|
|
|
|
|
case KEYS: return function keys() { return new IteratorConstructor(this, KIND); };
|
|
|
|
|
case VALUES: return function values() { return new IteratorConstructor(this, KIND); };
|
|
|
|
|
case ENTRIES: return function entries() { return new IteratorConstructor(this, KIND); };
|
|
|
|
|
} return function () { return new IteratorConstructor(this); };
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var TO_STRING_TAG = NAME + ' Iterator';
|
|
|
|
|
var INCORRECT_VALUES_NAME = false;
|
|
|
|
|
var IterablePrototype = Iterable.prototype;
|
|
|
|
|
var nativeIterator = IterablePrototype[ITERATOR]
|
|
|
|
|
|| IterablePrototype['@@iterator']
|
|
|
|
|
|| DEFAULT && IterablePrototype[DEFAULT];
|
|
|
|
|
var defaultIterator = !BUGGY_SAFARI_ITERATORS && nativeIterator || getIterationMethod(DEFAULT);
|
|
|
|
|
var anyNativeIterator = NAME == 'Array' ? IterablePrototype.entries || nativeIterator : nativeIterator;
|
|
|
|
|
var CurrentIteratorPrototype, methods, KEY;
|
|
|
|
|
|
|
|
|
|
// fix native
|
|
|
|
|
if (anyNativeIterator) {
|
|
|
|
|
CurrentIteratorPrototype = getPrototypeOf(anyNativeIterator.call(new Iterable()));
|
|
|
|
|
if (IteratorPrototype !== Object.prototype && CurrentIteratorPrototype.next) {
|
|
|
|
|
if (!IS_PURE && getPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype) {
|
|
|
|
|
if (setPrototypeOf) {
|
|
|
|
|
setPrototypeOf(CurrentIteratorPrototype, IteratorPrototype);
|
|
|
|
|
} else if (typeof CurrentIteratorPrototype[ITERATOR] != 'function') {
|
|
|
|
|
hide(CurrentIteratorPrototype, ITERATOR, returnThis);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// Set @@toStringTag to native iterators
|
|
|
|
|
setToStringTag(CurrentIteratorPrototype, TO_STRING_TAG, true, true);
|
|
|
|
|
if (IS_PURE) Iterators[TO_STRING_TAG] = returnThis;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// fix Array#{values, @@iterator}.name in V8 / FF
|
|
|
|
|
if (DEFAULT == VALUES && nativeIterator && nativeIterator.name !== VALUES) {
|
|
|
|
|
INCORRECT_VALUES_NAME = true;
|
|
|
|
|
defaultIterator = function values() { return nativeIterator.call(this); };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// define iterator
|
|
|
|
|
if ((!IS_PURE || FORCED) && IterablePrototype[ITERATOR] !== defaultIterator) {
|
|
|
|
|
hide(IterablePrototype, ITERATOR, defaultIterator);
|
|
|
|
|
}
|
|
|
|
|
Iterators[NAME] = defaultIterator;
|
|
|
|
|
|
|
|
|
|
// export additional methods
|
|
|
|
|
if (DEFAULT) {
|
|
|
|
|
methods = {
|
|
|
|
|
values: getIterationMethod(VALUES),
|
|
|
|
|
keys: IS_SET ? defaultIterator : getIterationMethod(KEYS),
|
|
|
|
|
entries: getIterationMethod(ENTRIES)
|
|
|
|
|
};
|
|
|
|
|
if (FORCED) for (KEY in methods) {
|
|
|
|
|
if (BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) {
|
|
|
|
|
redefine(IterablePrototype, KEY, methods[KEY]);
|
|
|
|
|
}
|
|
|
|
|
} else $({ target: NAME, proto: true, forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME }, methods);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return methods;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ "./node_modules/core-js/internals/descriptors.js":
|
|
|
|
|
/*!*******************************************************!*\
|
|
|
|
|
!*** ./node_modules/core-js/internals/descriptors.js ***!
|
|
|
|
|
\*******************************************************/
|
|
|
|
|
/*! no static exports found */
|
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
var fails = __webpack_require__(/*! ../internals/fails */ "./node_modules/core-js/internals/fails.js");
|
|
|
|
|
|
|
|
|
|
// Thank's IE8 for his funny defineProperty
|
|
|
|
|
module.exports = !fails(function () {
|
|
|
|
|
return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ "./node_modules/core-js/internals/document-create-element.js":
|
|
|
|
|
/*!*******************************************************************!*\
|
|
|
|
|
!*** ./node_modules/core-js/internals/document-create-element.js ***!
|
|
|
|
|
\*******************************************************************/
|
|
|
|
|
/*! no static exports found */
|
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
var global = __webpack_require__(/*! ../internals/global */ "./node_modules/core-js/internals/global.js");
|
|
|
|
|
var isObject = __webpack_require__(/*! ../internals/is-object */ "./node_modules/core-js/internals/is-object.js");
|
|
|
|
|
|
|
|
|
|
var document = global.document;
|
|
|
|
|
// typeof document.createElement is 'object' in old IE
|
|
|
|
|
var exist = isObject(document) && isObject(document.createElement);
|
|
|
|
|
|
|
|
|
|
module.exports = function (it) {
|
|
|
|
|
return exist ? document.createElement(it) : {};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ "./node_modules/core-js/internals/enum-bug-keys.js":
|
|
|
|
|
/*!*********************************************************!*\
|
|
|
|
|
!*** ./node_modules/core-js/internals/enum-bug-keys.js ***!
|
|
|
|
|
\*********************************************************/
|
|
|
|
|
/*! no static exports found */
|
|
|
|
|
/***/ (function(module, exports) {
|
|
|
|
|
|
|
|
|
|
// IE8- don't enum bug keys
|
|
|
|
|
module.exports = [
|
|
|
|
|
'constructor',
|
|
|
|
|
'hasOwnProperty',
|
|
|
|
|
'isPrototypeOf',
|
|
|
|
|
'propertyIsEnumerable',
|
|
|
|
|
'toLocaleString',
|
|
|
|
|
'toString',
|
|
|
|
|
'valueOf'
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ "./node_modules/core-js/internals/export.js":
|
|
|
|
|
/*!**************************************************!*\
|
|
|
|
|
!*** ./node_modules/core-js/internals/export.js ***!
|
|
|
|
|
\**************************************************/
|
|
|
|
|
/*! no static exports found */
|
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
var global = __webpack_require__(/*! ../internals/global */ "./node_modules/core-js/internals/global.js");
|
|
|
|
|
var getOwnPropertyDescriptor = __webpack_require__(/*! ../internals/object-get-own-property-descriptor */ "./node_modules/core-js/internals/object-get-own-property-descriptor.js").f;
|
|
|
|
|
var hide = __webpack_require__(/*! ../internals/hide */ "./node_modules/core-js/internals/hide.js");
|
|
|
|
|
var redefine = __webpack_require__(/*! ../internals/redefine */ "./node_modules/core-js/internals/redefine.js");
|
|
|
|
|
var setGlobal = __webpack_require__(/*! ../internals/set-global */ "./node_modules/core-js/internals/set-global.js");
|
|
|
|
|
var copyConstructorProperties = __webpack_require__(/*! ../internals/copy-constructor-properties */ "./node_modules/core-js/internals/copy-constructor-properties.js");
|
|
|
|
|
var isForced = __webpack_require__(/*! ../internals/is-forced */ "./node_modules/core-js/internals/is-forced.js");
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
options.target - name of the target object
|
|
|
|
|
options.global - target is the global object
|
|
|
|
|
options.stat - export as static methods of target
|
|
|
|
|
options.proto - export as prototype methods of target
|
|
|
|
|
options.real - real prototype method for the `pure` version
|
|
|
|
|
options.forced - export even if the native feature is available
|
|
|
|
|
options.bind - bind methods to the target, required for the `pure` version
|
|
|
|
|
options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
|
|
|
|
|
options.unsafe - use the simple assignment of property instead of delete + defineProperty
|
|
|
|
|
options.sham - add a flag to not completely full polyfills
|
|
|
|
|
options.enumerable - export as enumerable property
|
|
|
|
|
options.noTargetGet - prevent calling a getter on target
|
|
|
|
|
*/
|
|
|
|
|
module.exports = function (options, source) {
|
|
|
|
|
var TARGET = options.target;
|
|
|
|
|
var GLOBAL = options.global;
|
|
|
|
|
var STATIC = options.stat;
|
|
|
|
|
var FORCED, target, key, targetProperty, sourceProperty, descriptor;
|
|
|
|
|
if (GLOBAL) {
|
|
|
|
|
target = global;
|
|
|
|
|
} else if (STATIC) {
|
|
|
|
|
target = global[TARGET] || setGlobal(TARGET, {});
|
|
|
|
|
} else {
|
|
|
|
|
target = (global[TARGET] || {}).prototype;
|
|
|
|
|
}
|
|
|
|
|
if (target) for (key in source) {
|
|
|
|
|
sourceProperty = source[key];
|
|
|
|
|
if (options.noTargetGet) {
|
|
|
|
|
descriptor = getOwnPropertyDescriptor(target, key);
|
|
|
|
|
targetProperty = descriptor && descriptor.value;
|
|
|
|
|
} else targetProperty = target[key];
|
|
|
|
|
FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
|
|
|
|
|
// contained in target
|
|
|
|
|
if (!FORCED && targetProperty !== undefined) {
|
|
|
|
|
if (typeof sourceProperty === typeof targetProperty) continue;
|
|
|
|
|
copyConstructorProperties(sourceProperty, targetProperty);
|
|
|
|
|
}
|
|
|
|
|
// add a flag to not completely full polyfills
|
|
|
|
|
if (options.sham || (targetProperty && targetProperty.sham)) {
|
|
|
|
|
hide(sourceProperty, 'sham', true);
|
|
|
|
|
}
|
|
|
|
|
// extend global
|
|
|
|
|
redefine(target, key, sourceProperty, options);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ "./node_modules/core-js/internals/fails.js":
|
|
|
|
|
/*!*************************************************!*\
|
|
|
|
|
!*** ./node_modules/core-js/internals/fails.js ***!
|
|
|
|
|
\*************************************************/
|
|
|
|
|
/*! no static exports found */
|
|
|
|
|
/***/ (function(module, exports) {
|
|
|
|
|
|
|
|
|
|
module.exports = function (exec) {
|
|
|
|
|
try {
|
|
|
|
|
return !!exec();
|
|
|
|
|
} catch (error) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ "./node_modules/core-js/internals/function-to-string.js":
|
|
|
|
|
/*!**************************************************************!*\
|
|
|
|
|
!*** ./node_modules/core-js/internals/function-to-string.js ***!
|
|
|
|
|
\**************************************************************/
|
|
|
|
|
/*! no static exports found */
|
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
var shared = __webpack_require__(/*! ../internals/shared */ "./node_modules/core-js/internals/shared.js");
|
|
|
|
|
|
|
|
|
|
module.exports = shared('native-function-to-string', Function.toString);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ "./node_modules/core-js/internals/get-iterator-method.js":
|
|
|
|
|
/*!***************************************************************!*\
|
|
|
|
|
!*** ./node_modules/core-js/internals/get-iterator-method.js ***!
|
|
|
|
|
\***************************************************************/
|
|
|
|
|
/*! no static exports found */
|
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
var classof = __webpack_require__(/*! ../internals/classof */ "./node_modules/core-js/internals/classof.js");
|
|
|
|
|
var Iterators = __webpack_require__(/*! ../internals/iterators */ "./node_modules/core-js/internals/iterators.js");
|
|
|
|
|
var wellKnownSymbol = __webpack_require__(/*! ../internals/well-known-symbol */ "./node_modules/core-js/internals/well-known-symbol.js");
|
|
|
|
|
|
|
|
|
|
var ITERATOR = wellKnownSymbol('iterator');
|
|
|
|
|
|
|
|
|
|
module.exports = function (it) {
|
|
|
|
|
if (it != undefined) return it[ITERATOR]
|
|
|
|
|
|| it['@@iterator']
|
|
|
|
|
|| Iterators[classof(it)];
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ "./node_modules/core-js/internals/global.js":
|
|
|
|
|
/*!**************************************************!*\
|
|
|
|
|
!*** ./node_modules/core-js/internals/global.js ***!
|
|
|
|
|
\**************************************************/
|
|
|
|
|
/*! no static exports found */
|
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
/* WEBPACK VAR INJECTION */(function(global) {var O = 'object';
|
|
|
|
|
var check = function (it) {
|
|
|
|
|
return it && it.Math == Math && it;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
|
|
|
|
|
module.exports =
|
|
|
|
|
// eslint-disable-next-line no-undef
|
|
|
|
|
check(typeof globalThis == O && globalThis) ||
|
|
|
|
|
check(typeof window == O && window) ||
|
|
|
|
|
check(typeof self == O && self) ||
|
|
|
|
|
check(typeof global == O && global) ||
|
|
|
|
|
// eslint-disable-next-line no-new-func
|
|
|
|
|
Function('return this')();
|
|
|
|
|
|
|
|
|
|
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")));
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ "./node_modules/core-js/internals/has.js":
|
|
|
|
|
/*!***********************************************!*\
|
|
|
|
|
!*** ./node_modules/core-js/internals/has.js ***!
|
|
|
|
|
\***********************************************/
|
|
|
|
|
/*! no static exports found */
|
|
|
|
|
/***/ (function(module, exports) {
|
|
|
|
|
|
|
|
|
|
var hasOwnProperty = {}.hasOwnProperty;
|
|
|
|
|
|
|
|
|
|
module.exports = function (it, key) {
|
|
|
|
|
return hasOwnProperty.call(it, key);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ "./node_modules/core-js/internals/hidden-keys.js":
|
|
|
|
|
/*!*******************************************************!*\
|
|
|
|
|
!*** ./node_modules/core-js/internals/hidden-keys.js ***!
|
|
|
|
|
\*******************************************************/
|
|
|
|
|
/*! no static exports found */
|
|
|
|
|
/***/ (function(module, exports) {
|
|
|
|
|
|
|
|
|
|
module.exports = {};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ "./node_modules/core-js/internals/hide.js":
|
|
|
|
|
/*!************************************************!*\
|
|
|
|
|
!*** ./node_modules/core-js/internals/hide.js ***!
|
|
|
|
|
\************************************************/
|
|
|
|
|
/*! no static exports found */
|
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
var DESCRIPTORS = __webpack_require__(/*! ../internals/descriptors */ "./node_modules/core-js/internals/descriptors.js");
|
|
|
|
|
var definePropertyModule = __webpack_require__(/*! ../internals/object-define-property */ "./node_modules/core-js/internals/object-define-property.js");
|
|
|
|
|
var createPropertyDescriptor = __webpack_require__(/*! ../internals/create-property-descriptor */ "./node_modules/core-js/internals/create-property-descriptor.js");
|
|
|
|
|
|
|
|
|
|
module.exports = DESCRIPTORS ? function (object, key, value) {
|
|
|
|
|
return definePropertyModule.f(object, key, createPropertyDescriptor(1, value));
|
|
|
|
|
} : function (object, key, value) {
|
|
|
|
|
object[key] = value;
|
|
|
|
|
return object;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ "./node_modules/core-js/internals/html.js":
|
|
|
|
|
/*!************************************************!*\
|
|
|
|
|
!*** ./node_modules/core-js/internals/html.js ***!
|
|
|
|
|
\************************************************/
|
|
|
|
|
/*! no static exports found */
|
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
var global = __webpack_require__(/*! ../internals/global */ "./node_modules/core-js/internals/global.js");
|
|
|
|
|
|
|
|
|
|
var document = global.document;
|
|
|
|
|
|
|
|
|
|
module.exports = document && document.documentElement;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ "./node_modules/core-js/internals/ie8-dom-define.js":
|
|
|
|
|
/*!**********************************************************!*\
|
|
|
|
|
!*** ./node_modules/core-js/internals/ie8-dom-define.js ***!
|
|
|
|
|
\**********************************************************/
|
|
|
|
|
/*! no static exports found */
|
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
var DESCRIPTORS = __webpack_require__(/*! ../internals/descriptors */ "./node_modules/core-js/internals/descriptors.js");
|
|
|
|
|
var fails = __webpack_require__(/*! ../internals/fails */ "./node_modules/core-js/internals/fails.js");
|
|
|
|
|
var createElement = __webpack_require__(/*! ../internals/document-create-element */ "./node_modules/core-js/internals/document-create-element.js");
|
|
|
|
|
|
|
|
|
|
// Thank's IE8 for his funny defineProperty
|
|
|
|
|
module.exports = !DESCRIPTORS && !fails(function () {
|
|
|
|
|
return Object.defineProperty(createElement('div'), 'a', {
|
|
|
|
|
get: function () { return 7; }
|
|
|
|
|
}).a != 7;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ "./node_modules/core-js/internals/indexed-object.js":
|
|
|
|
|
/*!**********************************************************!*\
|
|
|
|
|
!*** ./node_modules/core-js/internals/indexed-object.js ***!
|
|
|
|
|
\**********************************************************/
|
|
|
|
|
/*! no static exports found */
|
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
// fallback for non-array-like ES3 and non-enumerable old V8 strings
|
|
|
|
|
var fails = __webpack_require__(/*! ../internals/fails */ "./node_modules/core-js/internals/fails.js");
|
|
|
|
|
var classof = __webpack_require__(/*! ../internals/classof-raw */ "./node_modules/core-js/internals/classof-raw.js");
|
|
|
|
|
|
|
|
|
|
var split = ''.split;
|
|
|
|
|
|
|
|
|
|
module.exports = fails(function () {
|
|
|
|
|
// throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
|
|
|
|
|
// eslint-disable-next-line no-prototype-builtins
|
|
|
|
|
return !Object('z').propertyIsEnumerable(0);
|
|
|
|
|
}) ? function (it) {
|
|
|
|
|
return classof(it) == 'String' ? split.call(it, '') : Object(it);
|
|
|
|
|
} : Object;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ "./node_modules/core-js/internals/internal-state.js":
|
|
|
|
|
/*!**********************************************************!*\
|
|
|
|
|
!*** ./node_modules/core-js/internals/internal-state.js ***!
|
|
|
|
|
\**********************************************************/
|
|
|
|
|
/*! no static exports found */
|
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
var NATIVE_WEAK_MAP = __webpack_require__(/*! ../internals/native-weak-map */ "./node_modules/core-js/internals/native-weak-map.js");
|
|
|
|
|
var global = __webpack_require__(/*! ../internals/global */ "./node_modules/core-js/internals/global.js");
|
|
|
|
|
var isObject = __webpack_require__(/*! ../internals/is-object */ "./node_modules/core-js/internals/is-object.js");
|
|
|
|
|
var hide = __webpack_require__(/*! ../internals/hide */ "./node_modules/core-js/internals/hide.js");
|
|
|
|
|
var objectHas = __webpack_require__(/*! ../internals/has */ "./node_modules/core-js/internals/has.js");
|
|
|
|
|
var sharedKey = __webpack_require__(/*! ../internals/shared-key */ "./node_modules/core-js/internals/shared-key.js");
|
|
|
|
|
var hiddenKeys = __webpack_require__(/*! ../internals/hidden-keys */ "./node_modules/core-js/internals/hidden-keys.js");
|
|
|
|
|
|
|
|
|
|
var WeakMap = global.WeakMap;
|
|
|
|
|
var set, get, has;
|
|
|
|
|
|
|
|
|
|
var enforce = function (it) {
|
|
|
|
|
return has(it) ? get(it) : set(it, {});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var getterFor = function (TYPE) {
|
|
|
|
|
return function (it) {
|
|
|
|
|
var state;
|
|
|
|
|
if (!isObject(it) || (state = get(it)).type !== TYPE) {
|
|
|
|
|
throw TypeError('Incompatible receiver, ' + TYPE + ' required');
|
|
|
|
|
} return state;
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
if (NATIVE_WEAK_MAP) {
|
|
|
|
|
var store = new WeakMap();
|
|
|
|
|
var wmget = store.get;
|
|
|
|
|
var wmhas = store.has;
|
|
|
|
|
var wmset = store.set;
|
|
|
|
|
set = function (it, metadata) {
|
|
|
|
|
wmset.call(store, it, metadata);
|
|
|
|
|
return metadata;
|
|
|
|
|
};
|
|
|
|
|
get = function (it) {
|
|
|
|
|
return wmget.call(store, it) || {};
|
|
|
|
|
};
|
|
|
|
|
has = function (it) {
|
|
|
|
|
return wmhas.call(store, it);
|
|
|
|
|
};
|
|
|
|
|
} else {
|
|
|
|
|
var STATE = sharedKey('state');
|
|
|
|
|
hiddenKeys[STATE] = true;
|
|
|
|
|
set = function (it, metadata) {
|
|
|
|
|
hide(it, STATE, metadata);
|
|
|
|
|
return metadata;
|
|
|
|
|
};
|
|
|
|
|
get = function (it) {
|
|
|
|
|
return objectHas(it, STATE) ? it[STATE] : {};
|
|
|
|
|
};
|
|
|
|
|
has = function (it) {
|
|
|
|
|
return objectHas(it, STATE);
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
|
set: set,
|
|
|
|
|
get: get,
|
|
|
|
|
has: has,
|
|
|
|
|
enforce: enforce,
|
|
|
|
|
getterFor: getterFor
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ "./node_modules/core-js/internals/is-array-iterator-method.js":
|
|
|
|
|
/*!********************************************************************!*\
|
|
|
|
|
!*** ./node_modules/core-js/internals/is-array-iterator-method.js ***!
|
|
|
|
|
\********************************************************************/
|
|
|
|
|
/*! no static exports found */
|
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
var wellKnownSymbol = __webpack_require__(/*! ../internals/well-known-symbol */ "./node_modules/core-js/internals/well-known-symbol.js");
|
|
|
|
|
var Iterators = __webpack_require__(/*! ../internals/iterators */ "./node_modules/core-js/internals/iterators.js");
|
|
|
|
|
|
|
|
|
|
var ITERATOR = wellKnownSymbol('iterator');
|
|
|
|
|
var ArrayPrototype = Array.prototype;
|
|
|
|
|
|
|
|
|
|
// check on default Array iterator
|
|
|
|
|
module.exports = function (it) {
|
|
|
|
|
return it !== undefined && (Iterators.Array === it || ArrayPrototype[ITERATOR] === it);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ "./node_modules/core-js/internals/is-forced.js":
|
|
|
|
|
/*!*****************************************************!*\
|
|
|
|
|
!*** ./node_modules/core-js/internals/is-forced.js ***!
|
|
|
|
|
\*****************************************************/
|
|
|
|
|
/*! no static exports found */
|
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
var fails = __webpack_require__(/*! ../internals/fails */ "./node_modules/core-js/internals/fails.js");
|
|
|
|
|
|
|
|
|
|
var replacement = /#|\.prototype\./;
|
|
|
|
|
|
|
|
|
|
var isForced = function (feature, detection) {
|
|
|
|
|
var value = data[normalize(feature)];
|
|
|
|
|
return value == POLYFILL ? true
|
|
|
|
|
: value == NATIVE ? false
|
|
|
|
|
: typeof detection == 'function' ? fails(detection)
|
|
|
|
|
: !!detection;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var normalize = isForced.normalize = function (string) {
|
|
|
|
|
return String(string).replace(replacement, '.').toLowerCase();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var data = isForced.data = {};
|
|
|
|
|
var NATIVE = isForced.NATIVE = 'N';
|
|
|
|
|
var POLYFILL = isForced.POLYFILL = 'P';
|
|
|
|
|
|
|
|
|
|
module.exports = isForced;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ "./node_modules/core-js/internals/is-object.js":
|
|
|
|
|
/*!*****************************************************!*\
|
|
|
|
|
!*** ./node_modules/core-js/internals/is-object.js ***!
|
|
|
|
|
\*****************************************************/
|
|
|
|
|
/*! no static exports found */
|
|
|
|
|
/***/ (function(module, exports) {
|
|
|
|
|
|
|
|
|
|
module.exports = function (it) {
|
|
|
|
|
return typeof it === 'object' ? it !== null : typeof it === 'function';
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ "./node_modules/core-js/internals/is-pure.js":
|
|
|
|
|
/*!***************************************************!*\
|
|
|
|
|
!*** ./node_modules/core-js/internals/is-pure.js ***!
|
|
|
|
|
\***************************************************/
|
|
|
|
|
/*! no static exports found */
|
|
|
|
|
/***/ (function(module, exports) {
|
|
|
|
|
|
|
|
|
|
module.exports = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ "./node_modules/core-js/internals/iterators-core.js":
|
|
|
|
|
/*!**********************************************************!*\
|
|
|
|
|
!*** ./node_modules/core-js/internals/iterators-core.js ***!
|
|
|
|
|
\**********************************************************/
|
|
|
|
|
/*! no static exports found */
|
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
var getPrototypeOf = __webpack_require__(/*! ../internals/object-get-prototype-of */ "./node_modules/core-js/internals/object-get-prototype-of.js");
|
|
|
|
|
var hide = __webpack_require__(/*! ../internals/hide */ "./node_modules/core-js/internals/hide.js");
|
|
|
|
|
var has = __webpack_require__(/*! ../internals/has */ "./node_modules/core-js/internals/has.js");
|
|
|
|
|
var wellKnownSymbol = __webpack_require__(/*! ../internals/well-known-symbol */ "./node_modules/core-js/internals/well-known-symbol.js");
|
|
|
|
|
var IS_PURE = __webpack_require__(/*! ../internals/is-pure */ "./node_modules/core-js/internals/is-pure.js");
|
|
|
|
|
|
|
|
|
|
var ITERATOR = wellKnownSymbol('iterator');
|
|
|
|
|
var BUGGY_SAFARI_ITERATORS = false;
|
|
|
|
|
|
|
|
|
|
var returnThis = function () { return this; };
|
|
|
|
|
|
|
|
|
|
// `%IteratorPrototype%` object
|
|
|
|
|
// https://tc39.github.io/ecma262/#sec-%iteratorprototype%-object
|
|
|
|
|
var IteratorPrototype, PrototypeOfArrayIteratorPrototype, arrayIterator;
|
|
|
|
|
|
|
|
|
|
if ([].keys) {
|
|
|
|
|
arrayIterator = [].keys();
|
|
|
|
|
// Safari 8 has buggy iterators w/o `next`
|
|
|
|
|
if (!('next' in arrayIterator)) BUGGY_SAFARI_ITERATORS = true;
|
|
|
|
|
else {
|
|
|
|
|
PrototypeOfArrayIteratorPrototype = getPrototypeOf(getPrototypeOf(arrayIterator));
|
|
|
|
|
if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype = PrototypeOfArrayIteratorPrototype;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (IteratorPrototype == undefined) IteratorPrototype = {};
|
|
|
|
|
|
|
|
|
|
// 25.1.2.1.1 %IteratorPrototype%[@@iterator]()
|
|
|
|
|
if (!IS_PURE && !has(IteratorPrototype, ITERATOR)) hide(IteratorPrototype, ITERATOR, returnThis);
|
|
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
|
IteratorPrototype: IteratorPrototype,
|
|
|
|
|
BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ "./node_modules/core-js/internals/iterators.js":
|
|
|
|
|
/*!*****************************************************!*\
|
|
|
|
|
!*** ./node_modules/core-js/internals/iterators.js ***!
|
|
|
|
|
\*****************************************************/
|
|
|
|
|
/*! no static exports found */
|
|
|
|
|
/***/ (function(module, exports) {
|
|
|
|
|
|
|
|
|
|
module.exports = {};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ "./node_modules/core-js/internals/native-symbol.js":
|
|
|
|
|
/*!*********************************************************!*\
|
|
|
|
|
!*** ./node_modules/core-js/internals/native-symbol.js ***!
|
|
|
|
|
\*********************************************************/
|
|
|
|
|
/*! no static exports found */
|
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
var fails = __webpack_require__(/*! ../internals/fails */ "./node_modules/core-js/internals/fails.js");
|
|
|
|
|
|
|
|
|
|
module.exports = !!Object.getOwnPropertySymbols && !fails(function () {
|
|
|
|
|
// Chrome 38 Symbol has incorrect toString conversion
|
|
|
|
|
// eslint-disable-next-line no-undef
|
|
|
|
|
return !String(Symbol());
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ "./node_modules/core-js/internals/native-weak-map.js":
|
|
|
|
|
/*!***********************************************************!*\
|
|
|
|
|
!*** ./node_modules/core-js/internals/native-weak-map.js ***!
|
|
|
|
|
\***********************************************************/
|
|
|
|
|
/*! no static exports found */
|
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
var global = __webpack_require__(/*! ../internals/global */ "./node_modules/core-js/internals/global.js");
|
|
|
|
|
var nativeFunctionToString = __webpack_require__(/*! ../internals/function-to-string */ "./node_modules/core-js/internals/function-to-string.js");
|
|
|
|
|
|
|
|
|
|
var WeakMap = global.WeakMap;
|
|
|
|
|
|
|
|
|
|
module.exports = typeof WeakMap === 'function' && /native code/.test(nativeFunctionToString.call(WeakMap));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ "./node_modules/core-js/internals/object-create.js":
|
|
|
|
|
/*!*********************************************************!*\
|
|
|
|
|
!*** ./node_modules/core-js/internals/object-create.js ***!
|
|
|
|
|
\*********************************************************/
|
|
|
|
|
/*! no static exports found */
|
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
var anObject = __webpack_require__(/*! ../internals/an-object */ "./node_modules/core-js/internals/an-object.js");
|
|
|
|
|
var defineProperties = __webpack_require__(/*! ../internals/object-define-properties */ "./node_modules/core-js/internals/object-define-properties.js");
|
|
|
|
|
var enumBugKeys = __webpack_require__(/*! ../internals/enum-bug-keys */ "./node_modules/core-js/internals/enum-bug-keys.js");
|
|
|
|
|
var hiddenKeys = __webpack_require__(/*! ../internals/hidden-keys */ "./node_modules/core-js/internals/hidden-keys.js");
|
|
|
|
|
var html = __webpack_require__(/*! ../internals/html */ "./node_modules/core-js/internals/html.js");
|
|
|
|
|
var documentCreateElement = __webpack_require__(/*! ../internals/document-create-element */ "./node_modules/core-js/internals/document-create-element.js");
|
|
|
|
|
var sharedKey = __webpack_require__(/*! ../internals/shared-key */ "./node_modules/core-js/internals/shared-key.js");
|
|
|
|
|
var IE_PROTO = sharedKey('IE_PROTO');
|
|
|
|
|
|
|
|
|
|
var PROTOTYPE = 'prototype';
|
|
|
|
|
var Empty = function () { /* empty */ };
|
|
|
|
|
|
|
|
|
|
// Create object with fake `null` prototype: use iframe Object with cleared prototype
|
|
|
|
|
var createDict = function () {
|
|
|
|
|
// Thrash, waste and sodomy: IE GC bug
|
|
|
|
|
var iframe = documentCreateElement('iframe');
|
|
|
|
|
var length = enumBugKeys.length;
|
|
|
|
|
var lt = '<';
|
|
|
|
|
var script = 'script';
|
|
|
|
|
var gt = '>';
|
|
|
|
|
var js = 'java' + script + ':';
|
|
|
|
|
var iframeDocument;
|
|
|
|
|
iframe.style.display = 'none';
|
|
|
|
|
html.appendChild(iframe);
|
|
|
|
|
iframe.src = String(js);
|
|
|
|
|
iframeDocument = iframe.contentWindow.document;
|
|
|
|
|
iframeDocument.open();
|
|
|
|
|
iframeDocument.write(lt + script + gt + 'document.F=Object' + lt + '/' + script + gt);
|
|
|
|
|
iframeDocument.close();
|
|
|
|
|
createDict = iframeDocument.F;
|
|
|
|
|
while (length--) delete createDict[PROTOTYPE][enumBugKeys[length]];
|
|
|
|
|
return createDict();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])
|
|
|
|
|
module.exports = Object.create || function create(O, Properties) {
|
|
|
|
|
var result;
|
|
|
|
|
if (O !== null) {
|
|
|
|
|
Empty[PROTOTYPE] = anObject(O);
|
|
|
|
|
result = new Empty();
|
|
|
|
|
Empty[PROTOTYPE] = null;
|
|
|
|
|
// add "__proto__" for Object.getPrototypeOf polyfill
|
|
|
|
|
result[IE_PROTO] = O;
|
|
|
|
|
} else result = createDict();
|
|
|
|
|
return Properties === undefined ? result : defineProperties(result, Properties);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
hiddenKeys[IE_PROTO] = true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ "./node_modules/core-js/internals/object-define-properties.js":
|
|
|
|
|
/*!********************************************************************!*\
|
|
|
|
|
!*** ./node_modules/core-js/internals/object-define-properties.js ***!
|
|
|
|
|
\********************************************************************/
|
|
|
|
|
/*! no static exports found */
|
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
var DESCRIPTORS = __webpack_require__(/*! ../internals/descriptors */ "./node_modules/core-js/internals/descriptors.js");
|
|
|
|
|
var definePropertyModule = __webpack_require__(/*! ../internals/object-define-property */ "./node_modules/core-js/internals/object-define-property.js");
|
|
|
|
|
var anObject = __webpack_require__(/*! ../internals/an-object */ "./node_modules/core-js/internals/an-object.js");
|
|
|
|
|
var objectKeys = __webpack_require__(/*! ../internals/object-keys */ "./node_modules/core-js/internals/object-keys.js");
|
|
|
|
|
|
|
|
|
|
module.exports = DESCRIPTORS ? Object.defineProperties : function defineProperties(O, Properties) {
|
|
|
|
|
anObject(O);
|
|
|
|
|
var keys = objectKeys(Properties);
|
|
|
|
|
var length = keys.length;
|
|
|
|
|
var i = 0;
|
|
|
|
|
var key;
|
|
|
|
|
while (length > i) definePropertyModule.f(O, key = keys[i++], Properties[key]);
|
|
|
|
|
return O;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ "./node_modules/core-js/internals/object-define-property.js":
|
|
|
|
|
/*!******************************************************************!*\
|
|
|
|
|
!*** ./node_modules/core-js/internals/object-define-property.js ***!
|
|
|
|
|
\******************************************************************/
|
|
|
|
|
/*! no static exports found */
|
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
var DESCRIPTORS = __webpack_require__(/*! ../internals/descriptors */ "./node_modules/core-js/internals/descriptors.js");
|
|
|
|
|
var IE8_DOM_DEFINE = __webpack_require__(/*! ../internals/ie8-dom-define */ "./node_modules/core-js/internals/ie8-dom-define.js");
|
|
|
|
|
var anObject = __webpack_require__(/*! ../internals/an-object */ "./node_modules/core-js/internals/an-object.js");
|
|
|
|
|
var toPrimitive = __webpack_require__(/*! ../internals/to-primitive */ "./node_modules/core-js/internals/to-primitive.js");
|
|
|
|
|
|
|
|
|
|
var nativeDefineProperty = Object.defineProperty;
|
|
|
|
|
|
|
|
|
|
exports.f = DESCRIPTORS ? nativeDefineProperty : function defineProperty(O, P, Attributes) {
|
|
|
|
|
anObject(O);
|
|
|
|
|
P = toPrimitive(P, true);
|
|
|
|
|
anObject(Attributes);
|
|
|
|
|
if (IE8_DOM_DEFINE) try {
|
|
|
|
|
return nativeDefineProperty(O, P, Attributes);
|
|
|
|
|
} catch (error) { /* empty */ }
|
|
|
|
|
if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported');
|
|
|
|
|
if ('value' in Attributes) O[P] = Attributes.value;
|
|
|
|
|
return O;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ "./node_modules/core-js/internals/object-get-own-property-descriptor.js":
|
|
|
|
|
/*!******************************************************************************!*\
|
|
|
|
|
!*** ./node_modules/core-js/internals/object-get-own-property-descriptor.js ***!
|
|
|
|
|
\******************************************************************************/
|
|
|
|
|
/*! no static exports found */
|
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
var DESCRIPTORS = __webpack_require__(/*! ../internals/descriptors */ "./node_modules/core-js/internals/descriptors.js");
|
|
|
|
|
var propertyIsEnumerableModule = __webpack_require__(/*! ../internals/object-property-is-enumerable */ "./node_modules/core-js/internals/object-property-is-enumerable.js");
|
|
|
|
|
var createPropertyDescriptor = __webpack_require__(/*! ../internals/create-property-descriptor */ "./node_modules/core-js/internals/create-property-descriptor.js");
|
|
|
|
|
var toIndexedObject = __webpack_require__(/*! ../internals/to-indexed-object */ "./node_modules/core-js/internals/to-indexed-object.js");
|
|
|
|
|
var toPrimitive = __webpack_require__(/*! ../internals/to-primitive */ "./node_modules/core-js/internals/to-primitive.js");
|
|
|
|
|
var has = __webpack_require__(/*! ../internals/has */ "./node_modules/core-js/internals/has.js");
|
|
|
|
|
var IE8_DOM_DEFINE = __webpack_require__(/*! ../internals/ie8-dom-define */ "./node_modules/core-js/internals/ie8-dom-define.js");
|
|
|
|
|
|
|
|
|
|
var nativeGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
|
|
|
|
|
|
|
|
|
exports.f = DESCRIPTORS ? nativeGetOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
|
|
|
|
|
O = toIndexedObject(O);
|
|
|
|
|
P = toPrimitive(P, true);
|
|
|
|
|
if (IE8_DOM_DEFINE) try {
|
|
|
|
|
return nativeGetOwnPropertyDescriptor(O, P);
|
|
|
|
|
} catch (error) { /* empty */ }
|
|
|
|
|
if (has(O, P)) return createPropertyDescriptor(!propertyIsEnumerableModule.f.call(O, P), O[P]);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ "./node_modules/core-js/internals/object-get-own-property-names.js":
|
|
|
|
|
/*!*************************************************************************!*\
|
|
|
|
|
!*** ./node_modules/core-js/internals/object-get-own-property-names.js ***!
|
|
|
|
|
\*************************************************************************/
|
|
|
|
|
/*! no static exports found */
|
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
// 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O)
|
|
|
|
|
var internalObjectKeys = __webpack_require__(/*! ../internals/object-keys-internal */ "./node_modules/core-js/internals/object-keys-internal.js");
|
|
|
|
|
var enumBugKeys = __webpack_require__(/*! ../internals/enum-bug-keys */ "./node_modules/core-js/internals/enum-bug-keys.js");
|
|
|
|
|
|
|
|
|
|
var hiddenKeys = enumBugKeys.concat('length', 'prototype');
|
|
|
|
|
|
|
|
|
|
exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
|
|
|
|
|
return internalObjectKeys(O, hiddenKeys);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ "./node_modules/core-js/internals/object-get-own-property-symbols.js":
|
|
|
|
|
/*!***************************************************************************!*\
|
|
|
|
|
!*** ./node_modules/core-js/internals/object-get-own-property-symbols.js ***!
|
|
|
|
|
\***************************************************************************/
|
|
|
|
|
/*! no static exports found */
|
|
|
|
|
/***/ (function(module, exports) {
|
|
|
|
|
|
|
|
|
|
exports.f = Object.getOwnPropertySymbols;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ "./node_modules/core-js/internals/object-get-prototype-of.js":
|
|
|
|
|
/*!*******************************************************************!*\
|
|
|
|
|
!*** ./node_modules/core-js/internals/object-get-prototype-of.js ***!
|
|
|
|
|
\*******************************************************************/
|
|
|
|
|
/*! no static exports found */
|
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
var has = __webpack_require__(/*! ../internals/has */ "./node_modules/core-js/internals/has.js");
|
|
|
|
|
var toObject = __webpack_require__(/*! ../internals/to-object */ "./node_modules/core-js/internals/to-object.js");
|
|
|
|
|
var sharedKey = __webpack_require__(/*! ../internals/shared-key */ "./node_modules/core-js/internals/shared-key.js");
|
|
|
|
|
var CORRECT_PROTOTYPE_GETTER = __webpack_require__(/*! ../internals/correct-prototype-getter */ "./node_modules/core-js/internals/correct-prototype-getter.js");
|
|
|
|
|
|
|
|
|
|
var IE_PROTO = sharedKey('IE_PROTO');
|
|
|
|
|
var ObjectPrototype = Object.prototype;
|
|
|
|
|
|
|
|
|
|
// 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O)
|
|
|
|
|
module.exports = CORRECT_PROTOTYPE_GETTER ? Object.getPrototypeOf : function (O) {
|
|
|
|
|
O = toObject(O);
|
|
|
|
|
if (has(O, IE_PROTO)) return O[IE_PROTO];
|
|
|
|
|
if (typeof O.constructor == 'function' && O instanceof O.constructor) {
|
|
|
|
|
return O.constructor.prototype;
|
|
|
|
|
} return O instanceof Object ? ObjectPrototype : null;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ "./node_modules/core-js/internals/object-keys-internal.js":
|
|
|
|
|
/*!****************************************************************!*\
|
|
|
|
|
!*** ./node_modules/core-js/internals/object-keys-internal.js ***!
|
|
|
|
|
\****************************************************************/
|
|
|
|
|
/*! no static exports found */
|
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
var has = __webpack_require__(/*! ../internals/has */ "./node_modules/core-js/internals/has.js");
|
|
|
|
|
var toIndexedObject = __webpack_require__(/*! ../internals/to-indexed-object */ "./node_modules/core-js/internals/to-indexed-object.js");
|
|
|
|
|
var arrayIncludes = __webpack_require__(/*! ../internals/array-includes */ "./node_modules/core-js/internals/array-includes.js");
|
|
|
|
|
var hiddenKeys = __webpack_require__(/*! ../internals/hidden-keys */ "./node_modules/core-js/internals/hidden-keys.js");
|
|
|
|
|
|
|
|
|
|
var arrayIndexOf = arrayIncludes(false);
|
|
|
|
|
|
|
|
|
|
module.exports = function (object, names) {
|
|
|
|
|
var O = toIndexedObject(object);
|
|
|
|
|
var i = 0;
|
|
|
|
|
var result = [];
|
|
|
|
|
var key;
|
|
|
|
|
for (key in O) !has(hiddenKeys, key) && has(O, key) && result.push(key);
|
|
|
|
|
// Don't enum bug & hidden keys
|
|
|
|
|
while (names.length > i) if (has(O, key = names[i++])) {
|
|
|
|
|
~arrayIndexOf(result, key) || result.push(key);
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ "./node_modules/core-js/internals/object-keys.js":
|
|
|
|
|
/*!*******************************************************!*\
|
|
|
|
|
!*** ./node_modules/core-js/internals/object-keys.js ***!
|
|
|
|
|
\*******************************************************/
|
|
|
|
|
/*! no static exports found */
|
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
var internalObjectKeys = __webpack_require__(/*! ../internals/object-keys-internal */ "./node_modules/core-js/internals/object-keys-internal.js");
|
|
|
|
|
var enumBugKeys = __webpack_require__(/*! ../internals/enum-bug-keys */ "./node_modules/core-js/internals/enum-bug-keys.js");
|
|
|
|
|
|
|
|
|
|
// 19.1.2.14 / 15.2.3.14 Object.keys(O)
|
|
|
|
|
module.exports = Object.keys || function keys(O) {
|
|
|
|
|
return internalObjectKeys(O, enumBugKeys);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ "./node_modules/core-js/internals/object-property-is-enumerable.js":
|
|
|
|
|
/*!*************************************************************************!*\
|
|
|
|
|
!*** ./node_modules/core-js/internals/object-property-is-enumerable.js ***!
|
|
|
|
|
\*************************************************************************/
|
|
|
|
|
/*! no static exports found */
|
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
var nativePropertyIsEnumerable = {}.propertyIsEnumerable;
|
|
|
|
|
var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
|
|
|
|
|
|
|
|
|
// Nashorn ~ JDK8 bug
|
|
|
|
|
var NASHORN_BUG = getOwnPropertyDescriptor && !nativePropertyIsEnumerable.call({ 1: 2 }, 1);
|
|
|
|
|
|
|
|
|
|
exports.f = NASHORN_BUG ? function propertyIsEnumerable(V) {
|
|
|
|
|
var descriptor = getOwnPropertyDescriptor(this, V);
|
|
|
|
|
return !!descriptor && descriptor.enumerable;
|
|
|
|
|
} : nativePropertyIsEnumerable;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ "./node_modules/core-js/internals/object-set-prototype-of.js":
|
|
|
|
|
/*!*******************************************************************!*\
|
|
|
|
|
!*** ./node_modules/core-js/internals/object-set-prototype-of.js ***!
|
|
|
|
|
\*******************************************************************/
|
|
|
|
|
/*! no static exports found */
|
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
var validateSetPrototypeOfArguments = __webpack_require__(/*! ../internals/validate-set-prototype-of-arguments */ "./node_modules/core-js/internals/validate-set-prototype-of-arguments.js");
|
|
|
|
|
|
|
|
|
|
// Works with __proto__ only. Old v8 can't work with null proto objects.
|
|
|
|
|
/* eslint-disable no-proto */
|
|
|
|
|
module.exports = Object.setPrototypeOf || ('__proto__' in {} ? function () {
|
|
|
|
|
var correctSetter = false;
|
|
|
|
|
var test = {};
|
|
|
|
|
var setter;
|
|
|
|
|
try {
|
|
|
|
|
setter = Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set;
|
|
|
|
|
setter.call(test, []);
|
|
|
|
|
correctSetter = test instanceof Array;
|
|
|
|
|
} catch (error) { /* empty */ }
|
|
|
|
|
return function setPrototypeOf(O, proto) {
|
|
|
|
|
validateSetPrototypeOfArguments(O, proto);
|
|
|
|
|
if (correctSetter) setter.call(O, proto);
|
|
|
|
|
else O.__proto__ = proto;
|
|
|
|
|
return O;
|
|
|
|
|
};
|
|
|
|
|
}() : undefined);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ "./node_modules/core-js/internals/own-keys.js":
|
|
|
|
|
/*!****************************************************!*\
|
|
|
|
|
!*** ./node_modules/core-js/internals/own-keys.js ***!
|
|
|
|
|
\****************************************************/
|
|
|
|
|
/*! no static exports found */
|
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
var global = __webpack_require__(/*! ../internals/global */ "./node_modules/core-js/internals/global.js");
|
|
|
|
|
var getOwnPropertyNamesModule = __webpack_require__(/*! ../internals/object-get-own-property-names */ "./node_modules/core-js/internals/object-get-own-property-names.js");
|
|
|
|
|
var getOwnPropertySymbolsModule = __webpack_require__(/*! ../internals/object-get-own-property-symbols */ "./node_modules/core-js/internals/object-get-own-property-symbols.js");
|
|
|
|
|
var anObject = __webpack_require__(/*! ../internals/an-object */ "./node_modules/core-js/internals/an-object.js");
|
|
|
|
|
|
|
|
|
|
var Reflect = global.Reflect;
|
|
|
|
|
|
|
|
|
|
// all object keys, includes non-enumerable and symbols
|
|
|
|
|
module.exports = Reflect && Reflect.ownKeys || function ownKeys(it) {
|
|
|
|
|
var keys = getOwnPropertyNamesModule.f(anObject(it));
|
|
|
|
|
var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
|
|
|
|
|
return getOwnPropertySymbols ? keys.concat(getOwnPropertySymbols(it)) : keys;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ "./node_modules/core-js/internals/path.js":
|
|
|
|
|
/*!************************************************!*\
|
|
|
|
|
!*** ./node_modules/core-js/internals/path.js ***!
|
|
|
|
|
\************************************************/
|
|
|
|
|
/*! no static exports found */
|
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
module.exports = __webpack_require__(/*! ../internals/global */ "./node_modules/core-js/internals/global.js");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ "./node_modules/core-js/internals/redefine.js":
|
|
|
|
|
/*!****************************************************!*\
|
|
|
|
|
!*** ./node_modules/core-js/internals/redefine.js ***!
|
|
|
|
|
\****************************************************/
|
|
|
|
|
/*! no static exports found */
|
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
var global = __webpack_require__(/*! ../internals/global */ "./node_modules/core-js/internals/global.js");
|
|
|
|
|
var shared = __webpack_require__(/*! ../internals/shared */ "./node_modules/core-js/internals/shared.js");
|
|
|
|
|
var hide = __webpack_require__(/*! ../internals/hide */ "./node_modules/core-js/internals/hide.js");
|
|
|
|
|
var has = __webpack_require__(/*! ../internals/has */ "./node_modules/core-js/internals/has.js");
|
|
|
|
|
var setGlobal = __webpack_require__(/*! ../internals/set-global */ "./node_modules/core-js/internals/set-global.js");
|
|
|
|
|
var nativeFunctionToString = __webpack_require__(/*! ../internals/function-to-string */ "./node_modules/core-js/internals/function-to-string.js");
|
|
|
|
|
var InternalStateModule = __webpack_require__(/*! ../internals/internal-state */ "./node_modules/core-js/internals/internal-state.js");
|
|
|
|
|
|
|
|
|
|
var getInternalState = InternalStateModule.get;
|
|
|
|
|
var enforceInternalState = InternalStateModule.enforce;
|
|
|
|
|
var TEMPLATE = String(nativeFunctionToString).split('toString');
|
|
|
|
|
|
|
|
|
|
shared('inspectSource', function (it) {
|
|
|
|
|
return nativeFunctionToString.call(it);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
(module.exports = function (O, key, value, options) {
|
|
|
|
|
var unsafe = options ? !!options.unsafe : false;
|
|
|
|
|
var simple = options ? !!options.enumerable : false;
|
|
|
|
|
var noTargetGet = options ? !!options.noTargetGet : false;
|
|
|
|
|
if (typeof value == 'function') {
|
|
|
|
|
if (typeof key == 'string' && !has(value, 'name')) hide(value, 'name', key);
|
|
|
|
|
enforceInternalState(value).source = TEMPLATE.join(typeof key == 'string' ? key : '');
|
|
|
|
|
}
|
|
|
|
|
if (O === global) {
|
|
|
|
|
if (simple) O[key] = value;
|
|
|
|
|
else setGlobal(key, value);
|
|
|
|
|
return;
|
|
|
|
|
} else if (!unsafe) {
|
|
|
|
|
delete O[key];
|
|
|
|
|
} else if (!noTargetGet && O[key]) {
|
|
|
|
|
simple = true;
|
|
|
|
|
}
|
|
|
|
|
if (simple) O[key] = value;
|
|
|
|
|
else hide(O, key, value);
|
|
|
|
|
// add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
|
|
|
|
|
})(Function.prototype, 'toString', function toString() {
|
|
|
|
|
return typeof this == 'function' && getInternalState(this).source || nativeFunctionToString.call(this);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ "./node_modules/core-js/internals/require-object-coercible.js":
|
|
|
|
|
/*!********************************************************************!*\
|
|
|
|
|
!*** ./node_modules/core-js/internals/require-object-coercible.js ***!
|
|
|
|
|
\********************************************************************/
|
|
|
|
|
/*! no static exports found */
|
|
|
|
|
/***/ (function(module, exports) {
|
|
|
|
|
|
|
|
|
|
// `RequireObjectCoercible` abstract operation
|
|
|
|
|
// https://tc39.github.io/ecma262/#sec-requireobjectcoercible
|
|
|
|
|
module.exports = function (it) {
|
|
|
|
|
if (it == undefined) throw TypeError("Can't call method on " + it);
|
|
|
|
|
return it;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ "./node_modules/core-js/internals/set-global.js":
|
|
|
|
|
/*!******************************************************!*\
|
|
|
|
|
!*** ./node_modules/core-js/internals/set-global.js ***!
|
|
|
|
|
\******************************************************/
|
|
|
|
|
/*! no static exports found */
|
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
var global = __webpack_require__(/*! ../internals/global */ "./node_modules/core-js/internals/global.js");
|
|
|
|
|
var hide = __webpack_require__(/*! ../internals/hide */ "./node_modules/core-js/internals/hide.js");
|
|
|
|
|
|
|
|
|
|
module.exports = function (key, value) {
|
|
|
|
|
try {
|
|
|
|
|
hide(global, key, value);
|
|
|
|
|
} catch (error) {
|
|
|
|
|
global[key] = value;
|
|
|
|
|
} return value;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ "./node_modules/core-js/internals/set-to-string-tag.js":
|
|
|
|
|
/*!*************************************************************!*\
|
|
|
|
|
!*** ./node_modules/core-js/internals/set-to-string-tag.js ***!
|
|
|
|
|
\*************************************************************/
|
|
|
|
|
/*! no static exports found */
|
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
var defineProperty = __webpack_require__(/*! ../internals/object-define-property */ "./node_modules/core-js/internals/object-define-property.js").f;
|
|
|
|
|
var has = __webpack_require__(/*! ../internals/has */ "./node_modules/core-js/internals/has.js");
|
|
|
|
|
var wellKnownSymbol = __webpack_require__(/*! ../internals/well-known-symbol */ "./node_modules/core-js/internals/well-known-symbol.js");
|
|
|
|
|
|
|
|
|
|
var TO_STRING_TAG = wellKnownSymbol('toStringTag');
|
|
|
|
|
|
|
|
|
|
module.exports = function (it, TAG, STATIC) {
|
|
|
|
|
if (it && !has(it = STATIC ? it : it.prototype, TO_STRING_TAG)) {
|
|
|
|
|
defineProperty(it, TO_STRING_TAG, { configurable: true, value: TAG });
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ "./node_modules/core-js/internals/shared-key.js":
|
|
|
|
|
/*!******************************************************!*\
|
|
|
|
|
!*** ./node_modules/core-js/internals/shared-key.js ***!
|
|
|
|
|
\******************************************************/
|
|
|
|
|
/*! no static exports found */
|
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
var shared = __webpack_require__(/*! ../internals/shared */ "./node_modules/core-js/internals/shared.js");
|
|
|
|
|
var uid = __webpack_require__(/*! ../internals/uid */ "./node_modules/core-js/internals/uid.js");
|
|
|
|
|
|
|
|
|
|
var keys = shared('keys');
|
|
|
|
|
|
|
|
|
|
module.exports = function (key) {
|
|
|
|
|
return keys[key] || (keys[key] = uid(key));
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ "./node_modules/core-js/internals/shared.js":
|
|
|
|
|
/*!**************************************************!*\
|
|
|
|
|
!*** ./node_modules/core-js/internals/shared.js ***!
|
|
|
|
|
\**************************************************/
|
|
|
|
|
/*! no static exports found */
|
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
var global = __webpack_require__(/*! ../internals/global */ "./node_modules/core-js/internals/global.js");
|
|
|
|
|
var setGlobal = __webpack_require__(/*! ../internals/set-global */ "./node_modules/core-js/internals/set-global.js");
|
|
|
|
|
var IS_PURE = __webpack_require__(/*! ../internals/is-pure */ "./node_modules/core-js/internals/is-pure.js");
|
|
|
|
|
|
|
|
|
|
var SHARED = '__core-js_shared__';
|
|
|
|
|
var store = global[SHARED] || setGlobal(SHARED, {});
|
|
|
|
|
|
|
|
|
|
(module.exports = function (key, value) {
|
|
|
|
|
return store[key] || (store[key] = value !== undefined ? value : {});
|
|
|
|
|
})('versions', []).push({
|
|
|
|
|
version: '3.1.3',
|
|
|
|
|
mode: IS_PURE ? 'pure' : 'global',
|
|
|
|
|
copyright: '© 2019 Denis Pushkarev (zloirock.ru)'
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ "./node_modules/core-js/internals/string-at.js":
|
|
|
|
|
/*!*****************************************************!*\
|
|
|
|
|
!*** ./node_modules/core-js/internals/string-at.js ***!
|
|
|
|
|
\*****************************************************/
|
|
|
|
|
/*! no static exports found */
|
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
var toInteger = __webpack_require__(/*! ../internals/to-integer */ "./node_modules/core-js/internals/to-integer.js");
|
|
|
|
|
var requireObjectCoercible = __webpack_require__(/*! ../internals/require-object-coercible */ "./node_modules/core-js/internals/require-object-coercible.js");
|
|
|
|
|
|
|
|
|
|
// CONVERT_TO_STRING: true -> String#at
|
|
|
|
|
// CONVERT_TO_STRING: false -> String#codePointAt
|
|
|
|
|
module.exports = function (that, pos, CONVERT_TO_STRING) {
|
|
|
|
|
var S = String(requireObjectCoercible(that));
|
|
|
|
|
var position = toInteger(pos);
|
|
|
|
|
var size = S.length;
|
|
|
|
|
var first, second;
|
|
|
|
|
if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined;
|
|
|
|
|
first = S.charCodeAt(position);
|
|
|
|
|
return first < 0xD800 || first > 0xDBFF || position + 1 === size
|
|
|
|
|
|| (second = S.charCodeAt(position + 1)) < 0xDC00 || second > 0xDFFF
|
|
|
|
|
? CONVERT_TO_STRING ? S.charAt(position) : first
|
|
|
|
|
: CONVERT_TO_STRING ? S.slice(position, position + 2) : (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ "./node_modules/core-js/internals/to-absolute-index.js":
|
|
|
|
|
/*!*************************************************************!*\
|
|
|
|
|
!*** ./node_modules/core-js/internals/to-absolute-index.js ***!
|
|
|
|
|
\*************************************************************/
|
|
|
|
|
/*! no static exports found */
|
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
var toInteger = __webpack_require__(/*! ../internals/to-integer */ "./node_modules/core-js/internals/to-integer.js");
|
|
|
|
|
|
|
|
|
|
var max = Math.max;
|
|
|
|
|
var min = Math.min;
|
|
|
|
|
|
|
|
|
|
// Helper for a popular repeating case of the spec:
|
|
|
|
|
// Let integer be ? ToInteger(index).
|
|
|
|
|
// If integer < 0, let result be max((length + integer), 0); else let result be min(length, length).
|
|
|
|
|
module.exports = function (index, length) {
|
|
|
|
|
var integer = toInteger(index);
|
|
|
|
|
return integer < 0 ? max(integer + length, 0) : min(integer, length);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ "./node_modules/core-js/internals/to-indexed-object.js":
|
|
|
|
|
/*!*************************************************************!*\
|
|
|
|
|
!*** ./node_modules/core-js/internals/to-indexed-object.js ***!
|
|
|
|
|
\*************************************************************/
|
|
|
|
|
/*! no static exports found */
|
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
// toObject with fallback for non-array-like ES3 strings
|
|
|
|
|
var IndexedObject = __webpack_require__(/*! ../internals/indexed-object */ "./node_modules/core-js/internals/indexed-object.js");
|
|
|
|
|
var requireObjectCoercible = __webpack_require__(/*! ../internals/require-object-coercible */ "./node_modules/core-js/internals/require-object-coercible.js");
|
|
|
|
|
|
|
|
|
|
module.exports = function (it) {
|
|
|
|
|
return IndexedObject(requireObjectCoercible(it));
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ "./node_modules/core-js/internals/to-integer.js":
|
|
|
|
|
/*!******************************************************!*\
|
|
|
|
|
!*** ./node_modules/core-js/internals/to-integer.js ***!
|
|
|
|
|
\******************************************************/
|
|
|
|
|
/*! no static exports found */
|
|
|
|
|
/***/ (function(module, exports) {
|
|
|
|
|
|
|
|
|
|
var ceil = Math.ceil;
|
|
|
|
|
var floor = Math.floor;
|
|
|
|
|
|
|
|
|
|
// `ToInteger` abstract operation
|
|
|
|
|
// https://tc39.github.io/ecma262/#sec-tointeger
|
|
|
|
|
module.exports = function (argument) {
|
|
|
|
|
return isNaN(argument = +argument) ? 0 : (argument > 0 ? floor : ceil)(argument);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ "./node_modules/core-js/internals/to-length.js":
|
|
|
|
|
/*!*****************************************************!*\
|
|
|
|
|
!*** ./node_modules/core-js/internals/to-length.js ***!
|
|
|
|
|
\*****************************************************/
|
|
|
|
|
/*! no static exports found */
|
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
var toInteger = __webpack_require__(/*! ../internals/to-integer */ "./node_modules/core-js/internals/to-integer.js");
|
|
|
|
|
|
|
|
|
|
var min = Math.min;
|
|
|
|
|
|
|
|
|
|
// `ToLength` abstract operation
|
|
|
|
|
// https://tc39.github.io/ecma262/#sec-tolength
|
|
|
|
|
module.exports = function (argument) {
|
|
|
|
|
return argument > 0 ? min(toInteger(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ "./node_modules/core-js/internals/to-object.js":
|
|
|
|
|
/*!*****************************************************!*\
|
|
|
|
|
!*** ./node_modules/core-js/internals/to-object.js ***!
|
|
|
|
|
\*****************************************************/
|
|
|
|
|
/*! no static exports found */
|
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
var requireObjectCoercible = __webpack_require__(/*! ../internals/require-object-coercible */ "./node_modules/core-js/internals/require-object-coercible.js");
|
|
|
|
|
|
|
|
|
|
// `ToObject` abstract operation
|
|
|
|
|
// https://tc39.github.io/ecma262/#sec-toobject
|
|
|
|
|
module.exports = function (argument) {
|
|
|
|
|
return Object(requireObjectCoercible(argument));
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ "./node_modules/core-js/internals/to-primitive.js":
|
|
|
|
|
/*!********************************************************!*\
|
|
|
|
|
!*** ./node_modules/core-js/internals/to-primitive.js ***!
|
|
|
|
|
\********************************************************/
|
|
|
|
|
/*! no static exports found */
|
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
var isObject = __webpack_require__(/*! ../internals/is-object */ "./node_modules/core-js/internals/is-object.js");
|
|
|
|
|
|
|
|
|
|
// 7.1.1 ToPrimitive(input [, PreferredType])
|
|
|
|
|
// instead of the ES6 spec version, we didn't implement @@toPrimitive case
|
|
|
|
|
// and the second argument - flag - preferred type is a string
|
|
|
|
|
module.exports = function (it, S) {
|
|
|
|
|
if (!isObject(it)) return it;
|
|
|
|
|
var fn, val;
|
|
|
|
|
if (S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;
|
|
|
|
|
if (typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it))) return val;
|
|
|
|
|
if (!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;
|
|
|
|
|
throw TypeError("Can't convert object to primitive value");
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ "./node_modules/core-js/internals/uid.js":
|
|
|
|
|
/*!***********************************************!*\
|
|
|
|
|
!*** ./node_modules/core-js/internals/uid.js ***!
|
|
|
|
|
\***********************************************/
|
|
|
|
|
/*! no static exports found */
|
|
|
|
|
/***/ (function(module, exports) {
|
|
|
|
|
|
|
|
|
|
var id = 0;
|
|
|
|
|
var postfix = Math.random();
|
|
|
|
|
|
|
|
|
|
module.exports = function (key) {
|
|
|
|
|
return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + postfix).toString(36));
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ "./node_modules/core-js/internals/validate-set-prototype-of-arguments.js":
|
|
|
|
|
/*!*******************************************************************************!*\
|
|
|
|
|
!*** ./node_modules/core-js/internals/validate-set-prototype-of-arguments.js ***!
|
|
|
|
|
\*******************************************************************************/
|
|
|
|
|
/*! no static exports found */
|
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
var isObject = __webpack_require__(/*! ../internals/is-object */ "./node_modules/core-js/internals/is-object.js");
|
|
|
|
|
var anObject = __webpack_require__(/*! ../internals/an-object */ "./node_modules/core-js/internals/an-object.js");
|
|
|
|
|
|
|
|
|
|
module.exports = function (O, proto) {
|
|
|
|
|
anObject(O);
|
|
|
|
|
if (!isObject(proto) && proto !== null) {
|
|
|
|
|
throw TypeError("Can't set " + String(proto) + ' as a prototype');
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ "./node_modules/core-js/internals/well-known-symbol.js":
|
|
|
|
|
/*!*************************************************************!*\
|
|
|
|
|
!*** ./node_modules/core-js/internals/well-known-symbol.js ***!
|
|
|
|
|
\*************************************************************/
|
|
|
|
|
/*! no static exports found */
|
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
var global = __webpack_require__(/*! ../internals/global */ "./node_modules/core-js/internals/global.js");
|
|
|
|
|
var shared = __webpack_require__(/*! ../internals/shared */ "./node_modules/core-js/internals/shared.js");
|
|
|
|
|
var uid = __webpack_require__(/*! ../internals/uid */ "./node_modules/core-js/internals/uid.js");
|
|
|
|
|
var NATIVE_SYMBOL = __webpack_require__(/*! ../internals/native-symbol */ "./node_modules/core-js/internals/native-symbol.js");
|
|
|
|
|
|
|
|
|
|
var Symbol = global.Symbol;
|
|
|
|
|
var store = shared('wks');
|
|
|
|
|
|
|
|
|
|
module.exports = function (name) {
|
|
|
|
|
return store[name] || (store[name] = NATIVE_SYMBOL && Symbol[name]
|
|
|
|
|
|| (NATIVE_SYMBOL ? Symbol : uid)('Symbol.' + name));
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ "./node_modules/core-js/modules/es.array.from.js":
|
|
|
|
|
/*!*******************************************************!*\
|
|
|
|
|
!*** ./node_modules/core-js/modules/es.array.from.js ***!
|
|
|
|
|
\*******************************************************/
|
|
|
|
|
/*! no static exports found */
|
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
var $ = __webpack_require__(/*! ../internals/export */ "./node_modules/core-js/internals/export.js");
|
|
|
|
|
var from = __webpack_require__(/*! ../internals/array-from */ "./node_modules/core-js/internals/array-from.js");
|
|
|
|
|
var checkCorrectnessOfIteration = __webpack_require__(/*! ../internals/check-correctness-of-iteration */ "./node_modules/core-js/internals/check-correctness-of-iteration.js");
|
|
|
|
|
|
|
|
|
|
var INCORRECT_ITERATION = !checkCorrectnessOfIteration(function (iterable) {
|
|
|
|
|
Array.from(iterable);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// `Array.from` method
|
|
|
|
|
// https://tc39.github.io/ecma262/#sec-array.from
|
|
|
|
|
$({ target: 'Array', stat: true, forced: INCORRECT_ITERATION }, {
|
|
|
|
|
from: from
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ "./node_modules/core-js/modules/es.string.iterator.js":
|
|
|
|
|
/*!************************************************************!*\
|
|
|
|
|
!*** ./node_modules/core-js/modules/es.string.iterator.js ***!
|
|
|
|
|
\************************************************************/
|
|
|
|
|
/*! no static exports found */
|
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
var codePointAt = __webpack_require__(/*! ../internals/string-at */ "./node_modules/core-js/internals/string-at.js");
|
|
|
|
|
var InternalStateModule = __webpack_require__(/*! ../internals/internal-state */ "./node_modules/core-js/internals/internal-state.js");
|
|
|
|
|
var defineIterator = __webpack_require__(/*! ../internals/define-iterator */ "./node_modules/core-js/internals/define-iterator.js");
|
|
|
|
|
|
|
|
|
|
var STRING_ITERATOR = 'String Iterator';
|
|
|
|
|
var setInternalState = InternalStateModule.set;
|
|
|
|
|
var getInternalState = InternalStateModule.getterFor(STRING_ITERATOR);
|
|
|
|
|
|
|
|
|
|
// `String.prototype[@@iterator]` method
|
|
|
|
|
// https://tc39.github.io/ecma262/#sec-string.prototype-@@iterator
|
|
|
|
|
defineIterator(String, 'String', function (iterated) {
|
|
|
|
|
setInternalState(this, {
|
|
|
|
|
type: STRING_ITERATOR,
|
|
|
|
|
string: String(iterated),
|
|
|
|
|
index: 0
|
|
|
|
|
});
|
|
|
|
|
// `%StringIteratorPrototype%.next` method
|
|
|
|
|
// https://tc39.github.io/ecma262/#sec-%stringiteratorprototype%.next
|
|
|
|
|
}, function next() {
|
|
|
|
|
var state = getInternalState(this);
|
|
|
|
|
var string = state.string;
|
|
|
|
|
var index = state.index;
|
|
|
|
|
var point;
|
|
|
|
|
if (index >= string.length) return { value: undefined, done: true };
|
|
|
|
|
point = codePointAt(string, index, true);
|
|
|
|
|
state.index += point.length;
|
|
|
|
|
return { value: point, done: false };
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ "./node_modules/webpack/buildin/global.js":
|
|
|
|
|
/*!***********************************!*\
|
|
|
|
|
!*** (webpack)/buildin/global.js ***!
|
|
|
|
|
\***********************************/
|
|
|
|
|
/*! no static exports found */
|
|
|
|
|
/***/ (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;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ "./src/default-attrs.json":
|
|
|
|
|
/*!********************************!*\
|
|
|
|
|
!*** ./src/default-attrs.json ***!
|
|
|
|
|
\********************************/
|
|
|
|
|
/*! exports provided: xmlns, width, height, viewBox, fill, stroke, stroke-width, stroke-linecap, stroke-linejoin, default */
|
|
|
|
|
/***/ (function(module) {
|
|
|
|
|
|
|
|
|
|
module.exports = {"xmlns":"http://www.w3.org/2000/svg","width":24,"height":24,"viewBox":"0 0 24 24","fill":"none","stroke":"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"};
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ "./src/icon.js":
|
|
|
|
|
/*!*********************!*\
|
|
|
|
|
!*** ./src/icon.js ***!
|
|
|
|
|
\*********************/
|
|
|
|
|
/*! no static exports found */
|
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
|
|
|
value: true
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
|
|
|
|
|
|
|
|
|
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 _dedupe = __webpack_require__(/*! classnames/dedupe */ "./node_modules/classnames/dedupe.js");
|
|
|
|
|
|
|
|
|
|
var _dedupe2 = _interopRequireDefault(_dedupe);
|
|
|
|
|
|
|
|
|
|
var _defaultAttrs = __webpack_require__(/*! ./default-attrs.json */ "./src/default-attrs.json");
|
|
|
|
|
|
|
|
|
|
var _defaultAttrs2 = _interopRequireDefault(_defaultAttrs);
|
|
|
|
|
|
|
|
|
|
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"); } }
|
|
|
|
|
|
|
|
|
|
var Icon = function () {
|
|
|
|
|
function Icon(name, contents) {
|
|
|
|
|
var tags = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
|
|
|
|
|
|
|
|
_classCallCheck(this, Icon);
|
|
|
|
|
|
|
|
|
|
this.name = name;
|
|
|
|
|
this.contents = contents;
|
|
|
|
|
this.tags = tags;
|
|
|
|
|
this.attrs = _extends({}, _defaultAttrs2.default, { class: 'feather feather-' + name });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Create an SVG string.
|
|
|
|
|
* @param {Object} attrs
|
|
|
|
|
* @returns {string}
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_createClass(Icon, [{
|
|
|
|
|
key: 'toSvg',
|
|
|
|
|
value: function toSvg() {
|
|
|
|
|
var attrs = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
|
|
|
|
|
|
|
|
var combinedAttrs = _extends({}, this.attrs, attrs, { class: (0, _dedupe2.default)(this.attrs.class, attrs.class) });
|
|
|
|
|
|
|
|
|
|
return '<svg ' + attrsToString(combinedAttrs) + '>' + this.contents + '</svg>';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Return string representation of an `Icon`.
|
|
|
|
|
*
|
|
|
|
|
* Added for backward compatibility. If old code expects `feather.icons.<name>`
|
|
|
|
|
* to be a string, `toString()` will get implicitly called.
|
|
|
|
|
*
|
|
|
|
|
* @returns {string}
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
}, {
|
|
|
|
|
key: 'toString',
|
|
|
|
|
value: function toString() {
|
|
|
|
|
return this.contents;
|
|
|
|
|
}
|
|
|
|
|
}]);
|
|
|
|
|
|
|
|
|
|
return Icon;
|
|
|
|
|
}();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Convert attributes object to string of HTML attributes.
|
|
|
|
|
* @param {Object} attrs
|
|
|
|
|
* @returns {string}
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function attrsToString(attrs) {
|
|
|
|
|
return Object.keys(attrs).map(function (key) {
|
|
|
|
|
return key + '="' + attrs[key] + '"';
|
|
|
|
|
}).join(' ');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
exports.default = Icon;
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ "./src/icons.js":
|
|
|
|
|
/*!**********************!*\
|
|
|
|
|
!*** ./src/icons.js ***!
|
|
|
|
|
\**********************/
|
|
|
|
|
/*! no static exports found */
|
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
|
|
|
value: true
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
var _icon = __webpack_require__(/*! ./icon */ "./src/icon.js");
|
|
|
|
|
|
|
|
|
|
var _icon2 = _interopRequireDefault(_icon);
|
|
|
|
|
|
|
|
|
|
var _icons = __webpack_require__(/*! ../dist/icons.json */ "./dist/icons.json");
|
|
|
|
|
|
|
|
|
|
var _icons2 = _interopRequireDefault(_icons);
|
|
|
|
|
|
|
|
|
|
var _tags = __webpack_require__(/*! ./tags.json */ "./src/tags.json");
|
|
|
|
|
|
|
|
|
|
var _tags2 = _interopRequireDefault(_tags);
|
|
|
|
|
|
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
|
|
|
|
|
|
|
|
exports.default = Object.keys(_icons2.default).map(function (key) {
|
|
|
|
|
return new _icon2.default(key, _icons2.default[key], _tags2.default[key]);
|
|
|
|
|
}).reduce(function (object, icon) {
|
|
|
|
|
object[icon.name] = icon;
|
|
|
|
|
return object;
|
|
|
|
|
}, {});
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ "./src/index.js":
|
|
|
|
|
/*!**********************!*\
|
|
|
|
|
!*** ./src/index.js ***!
|
|
|
|
|
\**********************/
|
|
|
|
|
/*! no static exports found */
|
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var _icons = __webpack_require__(/*! ./icons */ "./src/icons.js");
|
|
|
|
|
|
|
|
|
|
var _icons2 = _interopRequireDefault(_icons);
|
|
|
|
|
|
|
|
|
|
var _toSvg = __webpack_require__(/*! ./to-svg */ "./src/to-svg.js");
|
|
|
|
|
|
|
|
|
|
var _toSvg2 = _interopRequireDefault(_toSvg);
|
|
|
|
|
|
|
|
|
|
var _replace = __webpack_require__(/*! ./replace */ "./src/replace.js");
|
|
|
|
|
|
|
|
|
|
var _replace2 = _interopRequireDefault(_replace);
|
|
|
|
|
|
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
|
|
|
|
|
|
|
|
module.exports = { icons: _icons2.default, toSvg: _toSvg2.default, replace: _replace2.default };
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ "./src/replace.js":
|
|
|
|
|
/*!************************!*\
|
|
|
|
|
!*** ./src/replace.js ***!
|
|
|
|
|
\************************/
|
|
|
|
|
/*! no static exports found */
|
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
|
|
|
value: true
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; /* eslint-env browser */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var _dedupe = __webpack_require__(/*! classnames/dedupe */ "./node_modules/classnames/dedupe.js");
|
|
|
|
|
|
|
|
|
|
var _dedupe2 = _interopRequireDefault(_dedupe);
|
|
|
|
|
|
|
|
|
|
var _icons = __webpack_require__(/*! ./icons */ "./src/icons.js");
|
|
|
|
|
|
|
|
|
|
var _icons2 = _interopRequireDefault(_icons);
|
|
|
|
|
|
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Replace all HTML elements that have a `data-feather` attribute with SVG markup
|
|
|
|
|
* corresponding to the element's `data-feather` attribute value.
|
|
|
|
|
* @param {Object} attrs
|
|
|
|
|
*/
|
|
|
|
|
function replace() {
|
|
|
|
|
var attrs = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
|
|
|
|
|
|
|
|
if (typeof document === 'undefined') {
|
|
|
|
|
throw new Error('`feather.replace()` only works in a browser environment.');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var elementsToReplace = document.querySelectorAll('[data-feather]');
|
|
|
|
|
|
|
|
|
|
Array.from(elementsToReplace).forEach(function (element) {
|
|
|
|
|
return replaceElement(element, attrs);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Replace a single HTML element with SVG markup
|
|
|
|
|
* corresponding to the element's `data-feather` attribute value.
|
|
|
|
|
* @param {HTMLElement} element
|
|
|
|
|
* @param {Object} attrs
|
|
|
|
|
*/
|
|
|
|
|
function replaceElement(element) {
|
|
|
|
|
var attrs = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
|
|
|
|
|
|
|
|
var elementAttrs = getAttrs(element);
|
|
|
|
|
var name = elementAttrs['data-feather'];
|
|
|
|
|
delete elementAttrs['data-feather'];
|
|
|
|
|
|
|
|
|
|
var svgString = _icons2.default[name].toSvg(_extends({}, attrs, elementAttrs, { class: (0, _dedupe2.default)(attrs.class, elementAttrs.class) }));
|
|
|
|
|
var svgDocument = new DOMParser().parseFromString(svgString, 'image/svg+xml');
|
|
|
|
|
var svgElement = svgDocument.querySelector('svg');
|
|
|
|
|
|
|
|
|
|
element.parentNode.replaceChild(svgElement, element);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get the attributes of an HTML element.
|
|
|
|
|
* @param {HTMLElement} element
|
|
|
|
|
* @returns {Object}
|
|
|
|
|
*/
|
|
|
|
|
function getAttrs(element) {
|
|
|
|
|
return Array.from(element.attributes).reduce(function (attrs, attr) {
|
|
|
|
|
attrs[attr.name] = attr.value;
|
|
|
|
|
return attrs;
|
|
|
|
|
}, {});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
exports.default = replace;
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ "./src/tags.json":
|
|
|
|
|
/*!***********************!*\
|
|
|
|
|
!*** ./src/tags.json ***!
|
|
|
|
|
\***********************/
|
|
|
|
|
/*! exports provided: activity, airplay, alert-circle, alert-octagon, alert-triangle, align-center, align-justify, align-left, align-right, anchor, archive, at-sign, award, aperture, bar-chart, bar-chart-2, battery, battery-charging, bell, bell-off, bluetooth, book-open, book, bookmark, box, briefcase, calendar, camera, cast, circle, clipboard, clock, cloud-drizzle, cloud-lightning, cloud-rain, cloud-snow, cloud, codepen, codesandbox, code, coffee, columns, command, compass, copy, corner-down-left, corner-down-right, corner-left-down, corner-left-up, corner-right-down, corner-right-up, corner-up-left, corner-up-right, cpu, credit-card, crop, crosshair, database, delete, disc, dollar-sign, droplet, edit, edit-2, edit-3, eye, eye-off, external-link, facebook, fast-forward, figma, file-minus, file-plus, file-text, film, filter, flag, folder-minus, folder-plus, folder, framer, frown, gift, git-branch, git-commit, git-merge, git-pull-request, github, gitlab, globe, hard-drive, hash, headphones, heart, help-circle, hexagon, home, image, inbox, instagram, key, layers, layout, life-bouy, link, link-2, linkedin, list, lock, log-in, log-out, mail, map-pin, map, maximize, maximize-2, meh, menu, message-circle, message-square, mic-off, mic, minimize, minimize-2, minus, monitor, moon, more-horizontal, more-vertical, mouse-pointer, move, music, navigation, navigation-2, octagon, package, paperclip, pause, pause-circle, pen-tool, percent, phone-call, phone-forwarded, phone-incoming, phone-missed, phone-off, phone-outgoing, phone, play, pie-chart, play-circle, plus, plus-circle, plus-square, pocket, power, printer, radio, refresh-cw, refresh-ccw, repeat, rewind, rotate-ccw, rotate-cw, rss, save, scissors, search, send, settings, share-2, shield, shield-off, shopping-bag, shopping-cart, shuffle, skip-back, skip-forward, slack, slash, sliders, smartphone, smile, speaker, star, stop-circle, sun, sunrise, sunset, tablet, tag, target, terminal, thermometer, thumbs-down, thumbs-up, toggle-left, toggle-right, tool, trash, trash-2, triangle, truck, tv, twitch, twitter, type, umbrella, unlock, user-check, user-minus, user-plus, user-x, user, users, video-off, video, voicemail, volume, volume-1, volume-2, volume-x, watch, wifi-off, wifi, wind, x-circle, x-octagon, x-square, x, youtube, zap-off, zap, zoom-in, zoom-out, default */
|
|
|
|
|
/***/ (function(module) {
|
|
|
|
|
|
|
|
|
|
module.exports = {"activity":["pulse","health","action","motion"],"airplay":["stream","cast","mirroring"],"alert-circle":["warning","alert","danger"],"alert-octagon":["warning","alert","danger"],"alert-triangle":["warning","alert","danger"],"align-center":["text alignment","center"],"align-justify":["text alignment","justified"],"align-left":["text alignment","left"],"align-right":["text alignment","right"],"anchor":[],"archive":["index","box"],"at-sign":["mention","at","email","message"],"award":["achievement","badge"],"aperture":["camera","photo"],"bar-chart":["statistics","diagram","graph"],"bar-chart-2":["statistics","diagram","graph"],"battery":["power","electricity"],"battery-charging":["power","electricity"],"bell":["alarm","notification","sound"],"bell-off":["alarm","notification","silent"],"bluetooth":["wireless"],"book-open":["read","library"],"book":["read","dictionary","booklet","magazine","library"],"bookmark":["read","clip","marker","tag"],"box":["cube"],"briefcase":["work","bag","baggage","folder"],"calendar":["date"],"camera":["photo"],"cast":["chromecast","airplay"],"circle":["off","zero","record"],"clipboard":["copy"],"clock":["time","watch","alarm"],"cloud-drizzle":["weather","shower"],"cloud-lightning":["weather","bolt"],"cloud-rain":["weather"],"cloud-snow":["weather","blizzard"],"cloud":["weather"],"codepen":["logo"],"codesandbox":["logo"],"code":["source","programming"],"coffee":["drink","cup","mug","tea","cafe","hot","beverage"],"columns":["layout"],"command":["keyboard","cmd","terminal","prompt"],"compass":["navigation","safari","travel","direction"],"copy":["clone","duplicate"],"corner-down-left":["arrow","return"],"corner-down-right":["arrow"],"corner-left-down":["arrow"],"corner-left-up":["arrow"],"corner-right-down":["arrow"],"corner-right-up":["arrow"],"corner-up-left":["arrow"],"corner-up-right":["arrow"],"cpu":["processor","technology"],"credit-card":["purchase","payment","cc"],"crop":["photo","image"],"crosshair":["aim","target"],"database":["storage","memory"],"delete":["remove"],"disc":["album","cd","dvd","music"],"dollar-sign":["currency","money","payment"],"droplet":["water"],"edit":["pencil","change"],"edit-2":["pencil","change"],"edit-3":["pencil","change"],"eye":["view","watch"],"eye-off":["view","watch","hide","hidden"],"external-link":["outbound"],"facebook":["logo","social"],"fast-forward":["music"],"figma":["logo","design","tool"],"file-minus":["delete","remove","erase"],"file-plus":["add","create","new"],"file-text":["data","txt","pdf"],"film":["movie","video"],"filter":["funnel","hopper"],"flag":["report"],"folder-minus":["directory"],"folder-plus":["directory"],"folder":["directory"],"framer":["logo","design","tool"],"frown":["emoji","face","bad","sad","emotion"],"gift":["present","box","birthday","party"],"git-branch":["code","version control"],"git-commit":["code","version control"],"git-merge":["code","version control"],"git-pull-request":["code","version control"],"github":["logo","version control"],"gitlab":["logo","version control"],"globe":["world","browser","language","translate"],"hard-drive":["computer","server","memory","data"],"hash":["hashtag","number","pound"],"headphones":["music","audio","sound"],"heart":["like","love","emotion"],"help-circle":["question mark"],"hexagon":["shape","node.js","logo"],"home":["house","living"],"image":["picture"],"inbox":["email"],"instagram":["logo","camera"],"key":["password","login","authentication","secure"],"layers":["stack"],"layout":["window","webpage"],"life-bouy":["help","life ring","support"],"link":["chain","url"],"link-2":["chain","url"],"linkedin":["logo","social media"],"list":["options"],"lock":["security","password","secure"],"log-in":["sign in","arrow","enter"],"log-out":["sign out","arrow","exit"],"mail":["email","message"],"map-pin":["location","navigation","travel","marker"],"map":["location","navigation","travel"],"maximize":["fullscreen"],"maximize-2":["fullscreen","arrows","expand"],"meh":["emoji","face","neutral","emotion"],"menu":["bars","navigation","hamburger"],"message-circle":["comment","chat"],"mess
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ "./src/to-svg.js":
|
|
|
|
|
/*!***********************!*\
|
|
|
|
|
!*** ./src/to-svg.js ***!
|
|
|
|
|
\***********************/
|
|
|
|
|
/*! no static exports found */
|
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
|
|
|
value: true
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
var _icons = __webpack_require__(/*! ./icons */ "./src/icons.js");
|
|
|
|
|
|
|
|
|
|
var _icons2 = _interopRequireDefault(_icons);
|
|
|
|
|
|
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Create an SVG string.
|
|
|
|
|
* @deprecated
|
|
|
|
|
* @param {string} name
|
|
|
|
|
* @param {Object} attrs
|
|
|
|
|
* @returns {string}
|
|
|
|
|
*/
|
|
|
|
|
function toSvg(name) {
|
|
|
|
|
var attrs = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
|
|
|
|
|
|
|
|
console.warn('feather.toSvg() is deprecated. Please use feather.icons[name].toSvg() instead.');
|
|
|
|
|
|
|
|
|
|
if (!name) {
|
|
|
|
|
throw new Error('The required `key` (icon name) parameter is missing.');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!_icons2.default[name]) {
|
|
|
|
|
throw new Error('No icon matching \'' + name + '\'. See the complete list of icons at https://feathericons.com');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return _icons2.default[name].toSvg(attrs);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
exports.default = toSvg;
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ 0:
|
|
|
|
|
/*!**************************************************!*\
|
|
|
|
|
!*** multi core-js/es/array/from ./src/index.js ***!
|
|
|
|
|
\**************************************************/
|
|
|
|
|
/*! no static exports found */
|
|
|
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
__webpack_require__(/*! core-js/es/array/from */"./node_modules/core-js/es/array/from.js");
|
|
|
|
|
module.exports = __webpack_require__(/*! /home/travis/build/feathericons/feather/src/index.js */"./src/index.js");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ })
|
|
|
|
|
|
|
|
|
|
/******/ });
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* This module contains various utility functions commonly used in Obsidian plugins.
|
|
|
|
|
* @module obsidian-community-lib
|
|
|
|
|
*/
|
|
|
|
|
/**
|
|
|
|
|
* Adds a specific Feather Icon to Obsidian.
|
|
|
|
|
*
|
|
|
|
|
* @param name official Name of the Icon (https://feathericons.com/)
|
|
|
|
|
* @param attr SVG Attributes for the Icon. The default should work for most usecases.
|
|
|
|
|
* @returns {string} Icon name
|
|
|
|
|
*/
|
|
|
|
|
function addFeatherIcon(name, attr = { viewBox: "0 0 24 24", width: "100", height: "100" }) {
|
|
|
|
|
if (feather.icons[name]) {
|
|
|
|
|
const iconName = `feather-${name}`;
|
|
|
|
|
obsidian.addIcon(iconName, feather.icons[name].toSvg(attr));
|
|
|
|
|
return iconName;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
throw Error(`This Icon (${name}) doesn't exist in the Feather Library.`);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* Copy `content` to the users clipboard.
|
|
|
|
|
*
|
|
|
|
|
* @param {string} content The content to be copied to clipboard.
|
|
|
|
|
* @param {() => any} success The callback to run when text is successfully copied. Default throws a new `Notice`
|
|
|
|
|
* @param {(reason?) => any} failure The callback to run when text was not able to be copied. Default throws a new `Notice`, and console logs the error.`
|
|
|
|
|
*/
|
|
|
|
|
async function copy(content, success = () => new obsidian.Notice("Copied to clipboard"), failure = (reason) => {
|
|
|
|
|
new obsidian.Notice("Could not copy to clipboard");
|
|
|
|
|
console.log({ reason });
|
|
|
|
|
}) {
|
|
|
|
|
await navigator.clipboard.writeText(content).then(success, failure);
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* Check if `noteName` is the name of a note that exists in the vault.
|
|
|
|
|
* @param {App} app
|
|
|
|
|
* @param {string} noteName Basename of the note to search for.
|
|
|
|
|
* @param {string} [sourcePath=""] Optional file path to start searching from. Default is the current file.
|
|
|
|
|
* @returns boolean
|
|
|
|
|
*/
|
|
|
|
|
const isInVault = (app, noteName, sourcePath = "") => !!app.metadataCache.getFirstLinkpathDest(noteName, sourcePath);
|
|
|
|
|
|
|
|
|
|
function createNewNote(plugin, item) {
|
|
|
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
|
|
|
const activeFile = plugin.app.workspace.getActiveFile();
|
|
|
|
|
let dir = plugin.app.fileManager.getNewFileParent(activeFile ? activeFile.path : "").path;
|
|
|
|
|
if (plugin.settings.saveLocation === "custom") {
|
|
|
|
|
dir = plugin.settings.saveLocationFolder;
|
|
|
|
|
}
|
|
|
|
|
//make sure there are no slashes in the title.
|
|
|
|
|
const title = item.title.replace(/[\/\\:]/g, ' ');
|
|
|
|
|
const inputPrompt = new TextInputPrompt(plugin.app, "Please specify a file name", "cannot contain: * \" \\ / < > : | ?", title, title);
|
|
|
|
|
if (plugin.settings.askForFilename) {
|
|
|
|
|
yield inputPrompt
|
|
|
|
|
.openAndGetValue((text) => __awaiter(this, void 0, void 0, function* () {
|
|
|
|
|
const value = text.getValue();
|
|
|
|
|
if (value.match(FILE_NAME_REGEX)) {
|
|
|
|
|
inputPrompt.setValidationError(text, "that filename is not valid");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
const filePath = obsidian.normalizePath([dir, `${value}.md`].join('/'));
|
|
|
|
|
if (isInVault(plugin.app, filePath, '')) {
|
|
|
|
|
inputPrompt.setValidationError(text, "there is already a note with that name");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
inputPrompt.close();
|
|
|
|
|
yield createNewFile(plugin, item, filePath, value);
|
|
|
|
|
}));
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
const replacedTitle = item.title.replace(FILE_NAME_REGEX, '');
|
|
|
|
|
const filePath = obsidian.normalizePath([dir, `${replacedTitle}.md`].join('/'));
|
|
|
|
|
yield createNewFile(plugin, item, filePath, item.title);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
function createNewFile(plugin, item, path, title) {
|
|
|
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
|
|
|
if (isInVault(plugin.app, path, '')) {
|
|
|
|
|
new obsidian.Notice("there is already a note with that name");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
const appliedTemplate = applyTemplate(item, plugin.settings.template, plugin.settings, title);
|
|
|
|
|
const file = yield plugin.app.vault.create(path, appliedTemplate);
|
|
|
|
|
yield plugin.app.workspace.activeLeaf.openFile(file, {
|
|
|
|
|
state: { mode: 'edit' },
|
|
|
|
|
});
|
|
|
|
|
item.created = true;
|
|
|
|
|
const items = plugin.settings.items;
|
|
|
|
|
yield plugin.writeFeedContent(() => {
|
|
|
|
|
return items;
|
|
|
|
|
});
|
|
|
|
|
new obsidian.Notice("Created note from article");
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
function pasteToNote(plugin, item) {
|
|
|
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
|
|
|
const file = plugin.app.workspace.getActiveFile();
|
|
|
|
|
if (file === null) {
|
|
|
|
|
new obsidian.Notice("no file active");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
const view = plugin.app.workspace.getActiveViewOfType(obsidian.MarkdownView);
|
|
|
|
|
if (view) {
|
|
|
|
|
const appliedTemplate = applyTemplate(item, plugin.settings.pasteTemplate, plugin.settings);
|
|
|
|
|
const editor = view.editor;
|
|
|
|
|
editor.replaceRange(appliedTemplate, editor.getCursor());
|
|
|
|
|
item.created = true;
|
|
|
|
|
const items = plugin.settings.items;
|
|
|
|
|
yield plugin.writeFeedContent(() => {
|
|
|
|
|
return items;
|
|
|
|
|
});
|
|
|
|
|
new obsidian.Notice("inserted article into note");
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
function applyTemplate(item, template, settings, filename) {
|
|
|
|
|
const content = obsidian.htmlToMarkdown(item.content);
|
|
|
|
|
let result = replaceAll(template, "{{title}}", item.title);
|
|
|
|
|
result = replaceAll(result, "{{link}}", item.link);
|
|
|
|
|
result = replaceAll(result, "{{author}}", item.creator);
|
|
|
|
|
result = replaceAll(result, "{{content}}", content);
|
|
|
|
|
result = replaceAll(result, "{{published}}", window.moment(item.pubDate).format(settings.dateFormat));
|
|
|
|
|
result = replaceAll(result, "{{feed}}", item.feed);
|
|
|
|
|
result = replaceAll(result, "{{folder}}", item.folder);
|
|
|
|
|
result = replaceAll(result, "{{description}}", item.description);
|
|
|
|
|
result = result.replace(/({{tags:).*(}})/g, function (k) {
|
|
|
|
|
const value = k.split(":")[1];
|
|
|
|
|
const separator = value.substring(0, value.indexOf("}"));
|
|
|
|
|
return item.tags.join(separator);
|
|
|
|
|
});
|
|
|
|
|
result = result.replace(/({{#tags:).*(}})/g, function (k) {
|
|
|
|
|
const value = k.split(":")[1];
|
|
|
|
|
const separator = value.substring(0, value.indexOf("}"));
|
|
|
|
|
return item.tags.map(i => '#' + i).join(separator);
|
|
|
|
|
});
|
|
|
|
|
result = replaceAll(result, "{{tags}}", item.tags.join(", "));
|
|
|
|
|
result = replaceAll(result, "{{#tags}}", item.tags.map(i => '#' + i).join(", "));
|
|
|
|
|
if (filename) {
|
|
|
|
|
result = replaceAll(result, "{{filename}}", filename);
|
|
|
|
|
result = replaceAll(result, "{{created}}", window.moment().format(settings.dateFormat));
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
function openInBrowser(item) {
|
|
|
|
|
if (typeof item.link === "string") {
|
|
|
|
|
window.open(item.link, '_blank');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//taken from: https://stackoverflow.com/a/1144788/5589264
|
|
|
|
|
function escapeRegExp(string) {
|
|
|
|
|
return string.replace(/[.*+\-?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string
|
|
|
|
|
}
|
|
|
|
|
function replaceAll(str, find, replace) {
|
|
|
|
|
return str.replace(new RegExp(escapeRegExp(find), 'g'), replace);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class TagModal extends BaseModal {
|
|
|
|
|
constructor(plugin, tags) {
|
|
|
|
|
super(plugin.app);
|
|
|
|
|
this.plugin = plugin;
|
|
|
|
|
this.tags = tags;
|
|
|
|
|
}
|
|
|
|
|
display() {
|
|
|
|
|
const { contentEl } = this;
|
|
|
|
|
contentEl.empty();
|
|
|
|
|
contentEl.createEl("h1", { text: "Edit Tags" });
|
|
|
|
|
const tagDiv = contentEl.createDiv("tags");
|
|
|
|
|
for (const tag in this.tags) {
|
|
|
|
|
const setting = new obsidian.Setting(tagDiv);
|
|
|
|
|
setting.setName(this.tags[tag]);
|
|
|
|
|
setting.addExtraButton((b) => {
|
|
|
|
|
b
|
|
|
|
|
.setIcon("trash")
|
|
|
|
|
.setTooltip("Delete")
|
|
|
|
|
.onClick(() => {
|
|
|
|
|
this.tags = this.tags.filter(e => e !== this.tags[tag]);
|
|
|
|
|
console.log("new tags " + this.tags);
|
|
|
|
|
this.display();
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
const buttonEl = contentEl.createSpan("actionButtons");
|
|
|
|
|
const buttons = new obsidian.Setting(buttonEl).addButton((btn) => btn.setButtonText("new").onClick(() => __awaiter(this, void 0, void 0, function* () {
|
|
|
|
|
const input = yield new TextInputPrompt(this.app, "Tag", "new tag name", "", "tag name");
|
|
|
|
|
let textInput;
|
|
|
|
|
input.openAndGetValue((value => {
|
|
|
|
|
textInput = value;
|
|
|
|
|
if (!value.getValue().match(TAG_REGEX) || value.getValue().match(NUMBER_REGEX) || value.getValue().contains(" ") || value.getValue().contains('#')) {
|
|
|
|
|
input.setValidationError(textInput, "This is not a valid tag");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
this.tags.push(value.getValue());
|
|
|
|
|
this.display();
|
|
|
|
|
input.close();
|
|
|
|
|
}));
|
|
|
|
|
})));
|
|
|
|
|
buttons.addExtraButton((btn) => btn.setTooltip("Save").setIcon("checkmark").onClick(() => __awaiter(this, void 0, void 0, function* () {
|
|
|
|
|
this.close();
|
|
|
|
|
})));
|
|
|
|
|
}
|
|
|
|
|
onClose() {
|
|
|
|
|
const { contentEl } = this;
|
|
|
|
|
contentEl.empty();
|
|
|
|
|
}
|
|
|
|
|
onOpen() {
|
|
|
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
|
|
|
yield this.display();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class Action {
|
|
|
|
|
constructor(name, icon, processor) {
|
|
|
|
|
this.name = name;
|
|
|
|
|
this.icon = icon;
|
|
|
|
|
this.processor = processor;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
Action.CREATE_NOTE = new Action("create new note", "create-new", (plugin, item) => {
|
|
|
|
|
return createNewNote(plugin, item);
|
|
|
|
|
});
|
|
|
|
|
Action.PASTE = new Action("paste to current note", "paste", (plugin, item) => {
|
|
|
|
|
return pasteToNote(plugin, item);
|
|
|
|
|
});
|
|
|
|
|
Action.COPY = new Action("copy to clipboard", "feather-clipboard", ((_, item) => {
|
|
|
|
|
return copy(obsidian.htmlToMarkdown(item.content));
|
|
|
|
|
}));
|
|
|
|
|
Action.OPEN = new Action("open in browser", "open-elsewhere-glyph", ((_, item) => {
|
|
|
|
|
openInBrowser(item);
|
|
|
|
|
return Promise.resolve();
|
|
|
|
|
}));
|
|
|
|
|
Action.TAGS = new Action("edit tags", "tag-glyph", (((plugin, item) => {
|
|
|
|
|
const modal = new TagModal(plugin, item.tags);
|
|
|
|
|
modal.onClose = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
|
|
item.tags = modal.tags;
|
|
|
|
|
const items = plugin.settings.items;
|
|
|
|
|
yield plugin.writeFeedContent(() => {
|
|
|
|
|
return items;
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
modal.open();
|
|
|
|
|
return Promise.resolve();
|
|
|
|
|
})));
|
|
|
|
|
Action.actions = Array.of(Action.TAGS, Action.CREATE_NOTE, Action.PASTE, Action.COPY, Action.OPEN);
|
|
|
|
|
|
|
|
|
|
class ItemModal extends obsidian.Modal {
|
|
|
|
|
constructor(plugin, item) {
|
|
|
|
|
super(plugin.app);
|
|
|
|
|
this.plugin = plugin;
|
|
|
|
|
this.item = item;
|
|
|
|
|
item.read = true;
|
|
|
|
|
const items = this.plugin.settings.items;
|
|
|
|
|
this.plugin.writeFeedContent(() => {
|
|
|
|
|
return items;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
display() {
|
|
|
|
|
const { contentEl } = this;
|
|
|
|
|
contentEl.empty();
|
|
|
|
|
const topButtons = contentEl.createSpan('topButtons');
|
|
|
|
|
const title = contentEl.createEl('h1', 'rss-title');
|
|
|
|
|
title.setText(this.item.title);
|
|
|
|
|
const subtitle = contentEl.createEl("h3", "rss-subtitle");
|
|
|
|
|
if (this.item.creator) {
|
|
|
|
|
subtitle.appendText(this.item.creator);
|
|
|
|
|
}
|
|
|
|
|
if (this.item.pubDate) {
|
|
|
|
|
subtitle.appendText(" - " + window.moment(this.item.pubDate).format(this.plugin.settings.dateFormat));
|
|
|
|
|
}
|
|
|
|
|
const tagEl = contentEl.createSpan("tags");
|
|
|
|
|
this.item.tags.forEach((tag) => {
|
|
|
|
|
const tagA = tagEl.createEl("a");
|
|
|
|
|
tagA.setText(tag);
|
|
|
|
|
tagA.addClass("tag", "rss-tag");
|
|
|
|
|
});
|
|
|
|
|
const readButton = new obsidian.ButtonComponent(topButtons)
|
|
|
|
|
.setIcon(this.item.read ? 'feather-eye-off' : 'feather-eye')
|
|
|
|
|
.setTooltip(this.item.read ? 'Mark as unread' : 'mark as read')
|
|
|
|
|
.onClick(() => __awaiter(this, void 0, void 0, function* () {
|
|
|
|
|
if (this.item.read) {
|
|
|
|
|
readButton.setIcon('feather-eye');
|
|
|
|
|
this.item.read = false;
|
|
|
|
|
new obsidian.Notice("marked item as unread");
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
this.item.read = true;
|
|
|
|
|
readButton.setIcon('feather-eye-off');
|
|
|
|
|
new obsidian.Notice("marked item as read");
|
|
|
|
|
}
|
|
|
|
|
const items = this.plugin.settings.items;
|
|
|
|
|
yield this.plugin.writeFeedContent(() => {
|
|
|
|
|
return items;
|
|
|
|
|
});
|
|
|
|
|
}));
|
|
|
|
|
const favoriteButton = new obsidian.ButtonComponent(topButtons)
|
|
|
|
|
.setIcon(this.item.favorite ? 'star-glyph' : 'star')
|
|
|
|
|
.setTooltip(this.item.favorite ? 'remove from favorites' : 'mark as favorite')
|
|
|
|
|
.onClick(() => __awaiter(this, void 0, void 0, function* () {
|
|
|
|
|
if (this.item.favorite) {
|
|
|
|
|
favoriteButton.setIcon('star');
|
|
|
|
|
this.item.favorite = false;
|
|
|
|
|
new obsidian.Notice("removed item from favorites");
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
favoriteButton.setIcon('star-glyph');
|
|
|
|
|
this.item.favorite = true;
|
|
|
|
|
new obsidian.Notice("added item to favorites");
|
|
|
|
|
}
|
|
|
|
|
const items = this.plugin.settings.items;
|
|
|
|
|
yield this.plugin.writeFeedContent(() => {
|
|
|
|
|
return items;
|
|
|
|
|
});
|
|
|
|
|
}));
|
|
|
|
|
Action.actions.forEach((action) => {
|
|
|
|
|
new obsidian.ButtonComponent(topButtons)
|
|
|
|
|
.setIcon(action.icon)
|
|
|
|
|
.setTooltip(action.name)
|
|
|
|
|
.onClick(() => __awaiter(this, void 0, void 0, function* () {
|
|
|
|
|
yield action.processor(this.plugin, this.item);
|
|
|
|
|
}));
|
|
|
|
|
});
|
|
|
|
|
const content = contentEl.createDiv('rss-content');
|
|
|
|
|
content.addClass("scrollable-content");
|
|
|
|
|
if (this.item.content) {
|
|
|
|
|
content.append(sanitizeHTMLToDom(this.item.content));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
onClose() {
|
|
|
|
|
const { contentEl } = this;
|
|
|
|
|
contentEl.empty();
|
|
|
|
|
}
|
|
|
|
|
onOpen() {
|
|
|
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
|
|
|
yield this.display();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* src/view/HtmlTooltip.svelte generated by Svelte v3.44.2 */
|
|
|
|
|
|
|
|
|
|
function create_if_block$3(ctx) {
|
|
|
|
|
let span;
|
|
|
|
|
let html_action;
|
|
|
|
|
let mounted;
|
|
|
|
|
let dispose;
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
c() {
|
|
|
|
|
span = element("span");
|
|
|
|
|
attr(span, "class", "tooltiptext");
|
|
|
|
|
},
|
|
|
|
|
m(target, anchor) {
|
|
|
|
|
insert(target, span, anchor);
|
|
|
|
|
|
|
|
|
|
if (!mounted) {
|
|
|
|
|
dispose = action_destroyer(html_action = /*html*/ ctx[1].call(null, span, /*content*/ ctx[0]));
|
|
|
|
|
mounted = true;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
p(ctx, dirty) {
|
|
|
|
|
if (html_action && is_function(html_action.update) && dirty & /*content*/ 1) html_action.update.call(null, /*content*/ ctx[0]);
|
|
|
|
|
},
|
|
|
|
|
d(detaching) {
|
|
|
|
|
if (detaching) detach(span);
|
|
|
|
|
mounted = false;
|
|
|
|
|
dispose();
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function create_fragment$3(ctx) {
|
|
|
|
|
let if_block_anchor;
|
|
|
|
|
let if_block = /*content*/ ctx[0].length > 0 && create_if_block$3(ctx);
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
c() {
|
|
|
|
|
if (if_block) if_block.c();
|
|
|
|
|
if_block_anchor = empty();
|
|
|
|
|
},
|
|
|
|
|
m(target, anchor) {
|
|
|
|
|
if (if_block) if_block.m(target, anchor);
|
|
|
|
|
insert(target, if_block_anchor, anchor);
|
|
|
|
|
},
|
|
|
|
|
p(ctx, [dirty]) {
|
|
|
|
|
if (/*content*/ ctx[0].length > 0) {
|
|
|
|
|
if (if_block) {
|
|
|
|
|
if_block.p(ctx, dirty);
|
|
|
|
|
} else {
|
|
|
|
|
if_block = create_if_block$3(ctx);
|
|
|
|
|
if_block.c();
|
|
|
|
|
if_block.m(if_block_anchor.parentNode, if_block_anchor);
|
|
|
|
|
}
|
|
|
|
|
} else if (if_block) {
|
|
|
|
|
if_block.d(1);
|
|
|
|
|
if_block = null;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
i: noop,
|
|
|
|
|
o: noop,
|
|
|
|
|
d(detaching) {
|
|
|
|
|
if (if_block) if_block.d(detaching);
|
|
|
|
|
if (detaching) detach(if_block_anchor);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function instance$3($$self, $$props, $$invalidate) {
|
|
|
|
|
let { content = "" } = $$props;
|
|
|
|
|
|
|
|
|
|
const html = (node, content) => {
|
|
|
|
|
node.append(sanitizeHTMLToDom(content));
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
$$self.$$set = $$props => {
|
|
|
|
|
if ('content' in $$props) $$invalidate(0, content = $$props.content);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return [content, html];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class HtmlTooltip extends SvelteComponent {
|
|
|
|
|
constructor(options) {
|
|
|
|
|
super();
|
|
|
|
|
init(this, options, instance$3, create_fragment$3, safe_not_equal, { content: 0 });
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* src/view/ItemView.svelte generated by Svelte v3.44.2 */
|
|
|
|
|
|
|
|
|
|
function get_each_context$2(ctx, list, i) {
|
|
|
|
|
const child_ctx = ctx.slice();
|
|
|
|
|
child_ctx[6] = list[i];
|
|
|
|
|
return child_ctx;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// (46:0) {#if item}
|
|
|
|
|
function create_if_block$2(ctx) {
|
|
|
|
|
let div1;
|
|
|
|
|
let div0;
|
|
|
|
|
let t0;
|
|
|
|
|
let t1;
|
|
|
|
|
let a;
|
|
|
|
|
let t2_value = /*item*/ ctx[1].title + "";
|
|
|
|
|
let t2;
|
|
|
|
|
let t3;
|
|
|
|
|
let span;
|
|
|
|
|
let div0_class_value;
|
|
|
|
|
let t4;
|
|
|
|
|
let current;
|
|
|
|
|
let mounted;
|
|
|
|
|
let dispose;
|
|
|
|
|
let if_block0 = /*item*/ ctx[1].favorite && create_if_block_4$1();
|
|
|
|
|
let if_block1 = /*item*/ ctx[1].created && create_if_block_3$1();
|
|
|
|
|
let each_value = /*item*/ ctx[1].tags;
|
|
|
|
|
let each_blocks = [];
|
|
|
|
|
|
|
|
|
|
for (let i = 0; i < each_value.length; i += 1) {
|
|
|
|
|
each_blocks[i] = create_each_block$2(get_each_context$2(ctx, each_value, i));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let if_block2 = /*hover*/ ctx[2] && create_if_block_1$2(ctx);
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
c() {
|
|
|
|
|
div1 = element("div");
|
|
|
|
|
div0 = element("div");
|
|
|
|
|
if (if_block0) if_block0.c();
|
|
|
|
|
t0 = space();
|
|
|
|
|
if (if_block1) if_block1.c();
|
|
|
|
|
t1 = space();
|
|
|
|
|
a = element("a");
|
|
|
|
|
t2 = text(t2_value);
|
|
|
|
|
t3 = space();
|
|
|
|
|
span = element("span");
|
|
|
|
|
|
|
|
|
|
for (let i = 0; i < each_blocks.length; i += 1) {
|
|
|
|
|
each_blocks[i].c();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
t4 = space();
|
|
|
|
|
if (if_block2) if_block2.c();
|
|
|
|
|
attr(div0, "class", div0_class_value = "rss-feed-item " + (/*item*/ ctx[1].read ? 'rss-read' : 'rss-not-read'));
|
|
|
|
|
attr(div1, "class", "is-clickable rss-tooltip");
|
|
|
|
|
set_style(div1, "margin-left", "20px");
|
|
|
|
|
},
|
|
|
|
|
m(target, anchor) {
|
|
|
|
|
insert(target, div1, anchor);
|
|
|
|
|
append(div1, div0);
|
|
|
|
|
if (if_block0) if_block0.m(div0, null);
|
|
|
|
|
append(div0, t0);
|
|
|
|
|
if (if_block1) if_block1.m(div0, null);
|
|
|
|
|
append(div0, t1);
|
|
|
|
|
append(div0, a);
|
|
|
|
|
append(a, t2);
|
|
|
|
|
append(div0, t3);
|
|
|
|
|
append(div0, span);
|
|
|
|
|
|
|
|
|
|
for (let i = 0; i < each_blocks.length; i += 1) {
|
|
|
|
|
each_blocks[i].m(span, null);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
append(div1, t4);
|
|
|
|
|
if (if_block2) if_block2.m(div1, null);
|
|
|
|
|
current = true;
|
|
|
|
|
|
|
|
|
|
if (!mounted) {
|
|
|
|
|
dispose = [
|
|
|
|
|
listen(a, "click", /*click_handler*/ ctx[5]),
|
|
|
|
|
listen(a, "contextmenu", /*openMenu*/ ctx[4]),
|
|
|
|
|
listen(a, "mouseover", /*toggleHover*/ ctx[3]),
|
|
|
|
|
listen(a, "mouseleave", /*toggleHover*/ ctx[3])
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
mounted = true;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
p(ctx, dirty) {
|
|
|
|
|
if (/*item*/ ctx[1].favorite) {
|
|
|
|
|
if (if_block0) {
|
|
|
|
|
if (dirty & /*item*/ 2) {
|
|
|
|
|
transition_in(if_block0, 1);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if_block0 = create_if_block_4$1();
|
|
|
|
|
if_block0.c();
|
|
|
|
|
transition_in(if_block0, 1);
|
|
|
|
|
if_block0.m(div0, t0);
|
|
|
|
|
}
|
|
|
|
|
} else if (if_block0) {
|
|
|
|
|
group_outros();
|
|
|
|
|
|
|
|
|
|
transition_out(if_block0, 1, 1, () => {
|
|
|
|
|
if_block0 = null;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
check_outros();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (/*item*/ ctx[1].created) {
|
|
|
|
|
if (if_block1) {
|
|
|
|
|
if (dirty & /*item*/ 2) {
|
|
|
|
|
transition_in(if_block1, 1);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if_block1 = create_if_block_3$1();
|
|
|
|
|
if_block1.c();
|
|
|
|
|
transition_in(if_block1, 1);
|
|
|
|
|
if_block1.m(div0, t1);
|
|
|
|
|
}
|
|
|
|
|
} else if (if_block1) {
|
|
|
|
|
group_outros();
|
|
|
|
|
|
|
|
|
|
transition_out(if_block1, 1, 1, () => {
|
|
|
|
|
if_block1 = null;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
check_outros();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ((!current || dirty & /*item*/ 2) && t2_value !== (t2_value = /*item*/ ctx[1].title + "")) set_data(t2, t2_value);
|
|
|
|
|
|
|
|
|
|
if (dirty & /*item*/ 2) {
|
|
|
|
|
each_value = /*item*/ ctx[1].tags;
|
|
|
|
|
let i;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < each_value.length; i += 1) {
|
|
|
|
|
const child_ctx = get_each_context$2(ctx, each_value, i);
|
|
|
|
|
|
|
|
|
|
if (each_blocks[i]) {
|
|
|
|
|
each_blocks[i].p(child_ctx, dirty);
|
|
|
|
|
} else {
|
|
|
|
|
each_blocks[i] = create_each_block$2(child_ctx);
|
|
|
|
|
each_blocks[i].c();
|
|
|
|
|
each_blocks[i].m(span, null);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (; i < each_blocks.length; i += 1) {
|
|
|
|
|
each_blocks[i].d(1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
each_blocks.length = each_value.length;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!current || dirty & /*item*/ 2 && div0_class_value !== (div0_class_value = "rss-feed-item " + (/*item*/ ctx[1].read ? 'rss-read' : 'rss-not-read'))) {
|
|
|
|
|
attr(div0, "class", div0_class_value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (/*hover*/ ctx[2]) {
|
|
|
|
|
if (if_block2) {
|
|
|
|
|
if_block2.p(ctx, dirty);
|
|
|
|
|
|
|
|
|
|
if (dirty & /*hover*/ 4) {
|
|
|
|
|
transition_in(if_block2, 1);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if_block2 = create_if_block_1$2(ctx);
|
|
|
|
|
if_block2.c();
|
|
|
|
|
transition_in(if_block2, 1);
|
|
|
|
|
if_block2.m(div1, null);
|
|
|
|
|
}
|
|
|
|
|
} else if (if_block2) {
|
|
|
|
|
group_outros();
|
|
|
|
|
|
|
|
|
|
transition_out(if_block2, 1, 1, () => {
|
|
|
|
|
if_block2 = null;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
check_outros();
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
i(local) {
|
|
|
|
|
if (current) return;
|
|
|
|
|
transition_in(if_block0);
|
|
|
|
|
transition_in(if_block1);
|
|
|
|
|
transition_in(if_block2);
|
|
|
|
|
current = true;
|
|
|
|
|
},
|
|
|
|
|
o(local) {
|
|
|
|
|
transition_out(if_block0);
|
|
|
|
|
transition_out(if_block1);
|
|
|
|
|
transition_out(if_block2);
|
|
|
|
|
current = false;
|
|
|
|
|
},
|
|
|
|
|
d(detaching) {
|
|
|
|
|
if (detaching) detach(div1);
|
|
|
|
|
if (if_block0) if_block0.d();
|
|
|
|
|
if (if_block1) if_block1.d();
|
|
|
|
|
destroy_each(each_blocks, detaching);
|
|
|
|
|
if (if_block2) if_block2.d();
|
|
|
|
|
mounted = false;
|
|
|
|
|
run_all(dispose);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// (49:12) {#if (item.favorite)}
|
|
|
|
|
function create_if_block_4$1(ctx) {
|
|
|
|
|
let iconcomponent;
|
|
|
|
|
let current;
|
|
|
|
|
iconcomponent = new IconComponent({ props: { iconName: "star" } });
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
c() {
|
|
|
|
|
create_component(iconcomponent.$$.fragment);
|
|
|
|
|
},
|
|
|
|
|
m(target, anchor) {
|
|
|
|
|
mount_component(iconcomponent, target, anchor);
|
|
|
|
|
current = true;
|
|
|
|
|
},
|
|
|
|
|
i(local) {
|
|
|
|
|
if (current) return;
|
|
|
|
|
transition_in(iconcomponent.$$.fragment, local);
|
|
|
|
|
current = true;
|
|
|
|
|
},
|
|
|
|
|
o(local) {
|
|
|
|
|
transition_out(iconcomponent.$$.fragment, local);
|
|
|
|
|
current = false;
|
|
|
|
|
},
|
|
|
|
|
d(detaching) {
|
|
|
|
|
destroy_component(iconcomponent, detaching);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// (52:12) {#if (item.created)}
|
|
|
|
|
function create_if_block_3$1(ctx) {
|
|
|
|
|
let iconcomponent;
|
|
|
|
|
let current;
|
|
|
|
|
iconcomponent = new IconComponent({ props: { iconName: "document" } });
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
c() {
|
|
|
|
|
create_component(iconcomponent.$$.fragment);
|
|
|
|
|
},
|
|
|
|
|
m(target, anchor) {
|
|
|
|
|
mount_component(iconcomponent, target, anchor);
|
|
|
|
|
current = true;
|
|
|
|
|
},
|
|
|
|
|
i(local) {
|
|
|
|
|
if (current) return;
|
|
|
|
|
transition_in(iconcomponent.$$.fragment, local);
|
|
|
|
|
current = true;
|
|
|
|
|
},
|
|
|
|
|
o(local) {
|
|
|
|
|
transition_out(iconcomponent.$$.fragment, local);
|
|
|
|
|
current = false;
|
|
|
|
|
},
|
|
|
|
|
d(detaching) {
|
|
|
|
|
destroy_component(iconcomponent, detaching);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// (66:12) {#each item.tags as tag}
|
|
|
|
|
function create_each_block$2(ctx) {
|
|
|
|
|
let t0;
|
|
|
|
|
let a;
|
|
|
|
|
let t1_value = /*tag*/ ctx[6] + "";
|
|
|
|
|
let t1;
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
c() {
|
|
|
|
|
t0 = text(" ");
|
|
|
|
|
a = element("a");
|
|
|
|
|
t1 = text(t1_value);
|
|
|
|
|
attr(a, "class", "tag rss-tag");
|
|
|
|
|
},
|
|
|
|
|
m(target, anchor) {
|
|
|
|
|
insert(target, t0, anchor);
|
|
|
|
|
insert(target, a, anchor);
|
|
|
|
|
append(a, t1);
|
|
|
|
|
},
|
|
|
|
|
p(ctx, dirty) {
|
|
|
|
|
if (dirty & /*item*/ 2 && t1_value !== (t1_value = /*tag*/ ctx[6] + "")) set_data(t1, t1_value);
|
|
|
|
|
},
|
|
|
|
|
d(detaching) {
|
|
|
|
|
if (detaching) detach(t0);
|
|
|
|
|
if (detaching) detach(a);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// (71:8) {#if (hover)}
|
|
|
|
|
function create_if_block_1$2(ctx) {
|
|
|
|
|
let if_block_anchor;
|
|
|
|
|
let current;
|
|
|
|
|
let if_block = /*item*/ ctx[1].description !== /*item*/ ctx[1].content && create_if_block_2$2(ctx);
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
c() {
|
|
|
|
|
if (if_block) if_block.c();
|
|
|
|
|
if_block_anchor = empty();
|
|
|
|
|
},
|
|
|
|
|
m(target, anchor) {
|
|
|
|
|
if (if_block) if_block.m(target, anchor);
|
|
|
|
|
insert(target, if_block_anchor, anchor);
|
|
|
|
|
current = true;
|
|
|
|
|
},
|
|
|
|
|
p(ctx, dirty) {
|
|
|
|
|
if (/*item*/ ctx[1].description !== /*item*/ ctx[1].content) {
|
|
|
|
|
if (if_block) {
|
|
|
|
|
if_block.p(ctx, dirty);
|
|
|
|
|
|
|
|
|
|
if (dirty & /*item*/ 2) {
|
|
|
|
|
transition_in(if_block, 1);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if_block = create_if_block_2$2(ctx);
|
|
|
|
|
if_block.c();
|
|
|
|
|
transition_in(if_block, 1);
|
|
|
|
|
if_block.m(if_block_anchor.parentNode, if_block_anchor);
|
|
|
|
|
}
|
|
|
|
|
} else if (if_block) {
|
|
|
|
|
group_outros();
|
|
|
|
|
|
|
|
|
|
transition_out(if_block, 1, 1, () => {
|
|
|
|
|
if_block = null;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
check_outros();
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
i(local) {
|
|
|
|
|
if (current) return;
|
|
|
|
|
transition_in(if_block);
|
|
|
|
|
current = true;
|
|
|
|
|
},
|
|
|
|
|
o(local) {
|
|
|
|
|
transition_out(if_block);
|
|
|
|
|
current = false;
|
|
|
|
|
},
|
|
|
|
|
d(detaching) {
|
|
|
|
|
if (if_block) if_block.d(detaching);
|
|
|
|
|
if (detaching) detach(if_block_anchor);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// (72:12) {#if (item.description !== item.content)}
|
|
|
|
|
function create_if_block_2$2(ctx) {
|
|
|
|
|
let htmltooltip;
|
|
|
|
|
let current;
|
|
|
|
|
|
|
|
|
|
htmltooltip = new HtmlTooltip({
|
|
|
|
|
props: { content: /*item*/ ctx[1].description }
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
c() {
|
|
|
|
|
create_component(htmltooltip.$$.fragment);
|
|
|
|
|
},
|
|
|
|
|
m(target, anchor) {
|
|
|
|
|
mount_component(htmltooltip, target, anchor);
|
|
|
|
|
current = true;
|
|
|
|
|
},
|
|
|
|
|
p(ctx, dirty) {
|
|
|
|
|
const htmltooltip_changes = {};
|
|
|
|
|
if (dirty & /*item*/ 2) htmltooltip_changes.content = /*item*/ ctx[1].description;
|
|
|
|
|
htmltooltip.$set(htmltooltip_changes);
|
|
|
|
|
},
|
|
|
|
|
i(local) {
|
|
|
|
|
if (current) return;
|
|
|
|
|
transition_in(htmltooltip.$$.fragment, local);
|
|
|
|
|
current = true;
|
|
|
|
|
},
|
|
|
|
|
o(local) {
|
|
|
|
|
transition_out(htmltooltip.$$.fragment, local);
|
|
|
|
|
current = false;
|
|
|
|
|
},
|
|
|
|
|
d(detaching) {
|
|
|
|
|
destroy_component(htmltooltip, detaching);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function create_fragment$2(ctx) {
|
|
|
|
|
let if_block_anchor;
|
|
|
|
|
let current;
|
|
|
|
|
let if_block = /*item*/ ctx[1] && create_if_block$2(ctx);
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
c() {
|
|
|
|
|
if (if_block) if_block.c();
|
|
|
|
|
if_block_anchor = empty();
|
|
|
|
|
},
|
|
|
|
|
m(target, anchor) {
|
|
|
|
|
if (if_block) if_block.m(target, anchor);
|
|
|
|
|
insert(target, if_block_anchor, anchor);
|
|
|
|
|
current = true;
|
|
|
|
|
},
|
|
|
|
|
p(ctx, [dirty]) {
|
|
|
|
|
if (/*item*/ ctx[1]) {
|
|
|
|
|
if (if_block) {
|
|
|
|
|
if_block.p(ctx, dirty);
|
|
|
|
|
|
|
|
|
|
if (dirty & /*item*/ 2) {
|
|
|
|
|
transition_in(if_block, 1);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if_block = create_if_block$2(ctx);
|
|
|
|
|
if_block.c();
|
|
|
|
|
transition_in(if_block, 1);
|
|
|
|
|
if_block.m(if_block_anchor.parentNode, if_block_anchor);
|
|
|
|
|
}
|
|
|
|
|
} else if (if_block) {
|
|
|
|
|
group_outros();
|
|
|
|
|
|
|
|
|
|
transition_out(if_block, 1, 1, () => {
|
|
|
|
|
if_block = null;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
check_outros();
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
i(local) {
|
|
|
|
|
if (current) return;
|
|
|
|
|
transition_in(if_block);
|
|
|
|
|
current = true;
|
|
|
|
|
},
|
|
|
|
|
o(local) {
|
|
|
|
|
transition_out(if_block);
|
|
|
|
|
current = false;
|
|
|
|
|
},
|
|
|
|
|
d(detaching) {
|
|
|
|
|
if (if_block) if_block.d(detaching);
|
|
|
|
|
if (detaching) detach(if_block_anchor);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function instance$2($$self, $$props, $$invalidate) {
|
|
|
|
|
let { plugin = null } = $$props;
|
|
|
|
|
let { item = null } = $$props;
|
|
|
|
|
let hover = false;
|
|
|
|
|
|
|
|
|
|
function toggleHover() {
|
|
|
|
|
$$invalidate(2, hover = !hover);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function openMenu(e) {
|
|
|
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
|
|
|
if (e.ctrlKey && e.altKey) {
|
|
|
|
|
openInBrowser(item);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (e.ctrlKey) {
|
|
|
|
|
yield createNewNote(plugin, item);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (e.altKey) {
|
|
|
|
|
yield pasteToNote(plugin, item);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const menu = new obsidian.Menu(plugin.app);
|
|
|
|
|
|
|
|
|
|
Action.actions.forEach(action => {
|
|
|
|
|
menu.addItem(menuItem => {
|
|
|
|
|
menuItem.setIcon(action.icon).setTitle(action.name).onClick(() => __awaiter(this, void 0, void 0, function* () {
|
|
|
|
|
yield action.processor(plugin, item);
|
|
|
|
|
}));
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
menu.showAtPosition({ x: e.x, y: e.y });
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const click_handler = () => {
|
|
|
|
|
new ItemModal(plugin, item).open();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
$$self.$$set = $$props => {
|
|
|
|
|
if ('plugin' in $$props) $$invalidate(0, plugin = $$props.plugin);
|
|
|
|
|
if ('item' in $$props) $$invalidate(1, item = $$props.item);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return [plugin, item, hover, toggleHover, openMenu, click_handler];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class ItemView extends SvelteComponent {
|
|
|
|
|
constructor(options) {
|
|
|
|
|
super();
|
|
|
|
|
init(this, options, instance$2, create_fragment$2, safe_not_equal, { plugin: 0, item: 1 });
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* src/view/FeedView.svelte generated by Svelte v3.44.2 */
|
|
|
|
|
|
|
|
|
|
function get_each_context$1(ctx, list, i) {
|
|
|
|
|
const child_ctx = ctx.slice();
|
|
|
|
|
child_ctx[5] = list[i];
|
|
|
|
|
return child_ctx;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// (16:0) {:else}
|
|
|
|
|
function create_else_block(ctx) {
|
|
|
|
|
let div3;
|
|
|
|
|
let div1;
|
|
|
|
|
let div0;
|
|
|
|
|
let iconcomponent;
|
|
|
|
|
let t0;
|
|
|
|
|
let span;
|
|
|
|
|
let t1_value = /*feed*/ ctx[0].name + "";
|
|
|
|
|
let t1;
|
|
|
|
|
let t2;
|
|
|
|
|
let div1_class_value;
|
|
|
|
|
let t3;
|
|
|
|
|
let div2;
|
|
|
|
|
let show_if = !/*foldedState*/ ctx[2].get(/*feed*/ ctx[0].name);
|
|
|
|
|
let current;
|
|
|
|
|
let mounted;
|
|
|
|
|
let dispose;
|
|
|
|
|
iconcomponent = new IconComponent({ props: { iconName: "right-triangle" } });
|
|
|
|
|
let if_block0 = /*feed*/ ctx[0].image && create_if_block_2$1(ctx);
|
|
|
|
|
let if_block1 = show_if && create_if_block_1$1(ctx);
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
c() {
|
|
|
|
|
div3 = element("div");
|
|
|
|
|
div1 = element("div");
|
|
|
|
|
div0 = element("div");
|
|
|
|
|
create_component(iconcomponent.$$.fragment);
|
|
|
|
|
t0 = space();
|
|
|
|
|
span = element("span");
|
|
|
|
|
t1 = text(t1_value);
|
|
|
|
|
t2 = space();
|
|
|
|
|
if (if_block0) if_block0.c();
|
|
|
|
|
t3 = space();
|
|
|
|
|
div2 = element("div");
|
|
|
|
|
if (if_block1) if_block1.c();
|
|
|
|
|
attr(div0, "class", "rss-feed-title");
|
|
|
|
|
set_style(div0, "overflow", "hidden");
|
|
|
|
|
|
|
|
|
|
attr(div1, "class", div1_class_value = /*foldedState*/ ctx[2].get(/*feed*/ ctx[0].name)
|
|
|
|
|
? 'is-collapsed'
|
|
|
|
|
: '');
|
|
|
|
|
|
|
|
|
|
attr(div2, "class", "rss-feed-items");
|
|
|
|
|
attr(div3, "class", "rss-feed");
|
|
|
|
|
set_style(div3, "margin-left", "20px");
|
|
|
|
|
},
|
|
|
|
|
m(target, anchor) {
|
|
|
|
|
insert(target, div3, anchor);
|
|
|
|
|
append(div3, div1);
|
|
|
|
|
append(div1, div0);
|
|
|
|
|
mount_component(iconcomponent, div0, null);
|
|
|
|
|
append(div0, t0);
|
|
|
|
|
append(div0, span);
|
|
|
|
|
append(span, t1);
|
|
|
|
|
append(span, t2);
|
|
|
|
|
if (if_block0) if_block0.m(span, null);
|
|
|
|
|
append(div3, t3);
|
|
|
|
|
append(div3, div2);
|
|
|
|
|
if (if_block1) if_block1.m(div2, null);
|
|
|
|
|
current = true;
|
|
|
|
|
|
|
|
|
|
if (!mounted) {
|
|
|
|
|
dispose = listen(div1, "click", /*click_handler*/ ctx[4]);
|
|
|
|
|
mounted = true;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
p(ctx, dirty) {
|
|
|
|
|
if ((!current || dirty & /*feed*/ 1) && t1_value !== (t1_value = /*feed*/ ctx[0].name + "")) set_data(t1, t1_value);
|
|
|
|
|
|
|
|
|
|
if (/*feed*/ ctx[0].image) {
|
|
|
|
|
if (if_block0) {
|
|
|
|
|
if_block0.p(ctx, dirty);
|
|
|
|
|
} else {
|
|
|
|
|
if_block0 = create_if_block_2$1(ctx);
|
|
|
|
|
if_block0.c();
|
|
|
|
|
if_block0.m(span, null);
|
|
|
|
|
}
|
|
|
|
|
} else if (if_block0) {
|
|
|
|
|
if_block0.d(1);
|
|
|
|
|
if_block0 = null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!current || dirty & /*foldedState, feed*/ 5 && div1_class_value !== (div1_class_value = /*foldedState*/ ctx[2].get(/*feed*/ ctx[0].name)
|
|
|
|
|
? 'is-collapsed'
|
|
|
|
|
: '')) {
|
|
|
|
|
attr(div1, "class", div1_class_value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (dirty & /*foldedState, feed*/ 5) show_if = !/*foldedState*/ ctx[2].get(/*feed*/ ctx[0].name);
|
|
|
|
|
|
|
|
|
|
if (show_if) {
|
|
|
|
|
if (if_block1) {
|
|
|
|
|
if_block1.p(ctx, dirty);
|
|
|
|
|
|
|
|
|
|
if (dirty & /*foldedState, feed*/ 5) {
|
|
|
|
|
transition_in(if_block1, 1);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if_block1 = create_if_block_1$1(ctx);
|
|
|
|
|
if_block1.c();
|
|
|
|
|
transition_in(if_block1, 1);
|
|
|
|
|
if_block1.m(div2, null);
|
|
|
|
|
}
|
|
|
|
|
} else if (if_block1) {
|
|
|
|
|
group_outros();
|
|
|
|
|
|
|
|
|
|
transition_out(if_block1, 1, 1, () => {
|
|
|
|
|
if_block1 = null;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
check_outros();
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
i(local) {
|
|
|
|
|
if (current) return;
|
|
|
|
|
transition_in(iconcomponent.$$.fragment, local);
|
|
|
|
|
transition_in(if_block1);
|
|
|
|
|
current = true;
|
|
|
|
|
},
|
|
|
|
|
o(local) {
|
|
|
|
|
transition_out(iconcomponent.$$.fragment, local);
|
|
|
|
|
transition_out(if_block1);
|
|
|
|
|
current = false;
|
|
|
|
|
},
|
|
|
|
|
d(detaching) {
|
|
|
|
|
if (detaching) detach(div3);
|
|
|
|
|
destroy_component(iconcomponent);
|
|
|
|
|
if (if_block0) if_block0.d();
|
|
|
|
|
if (if_block1) if_block1.d();
|
|
|
|
|
mounted = false;
|
|
|
|
|
dispose();
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// (14:0) {#if !feed}
|
|
|
|
|
function create_if_block$1(ctx) {
|
|
|
|
|
let p;
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
c() {
|
|
|
|
|
p = element("p");
|
|
|
|
|
p.textContent = "...loading";
|
|
|
|
|
},
|
|
|
|
|
m(target, anchor) {
|
|
|
|
|
insert(target, p, anchor);
|
|
|
|
|
},
|
|
|
|
|
p: noop,
|
|
|
|
|
i: noop,
|
|
|
|
|
o: noop,
|
|
|
|
|
d(detaching) {
|
|
|
|
|
if (detaching) detach(p);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// (24:20) {#if (feed.image)}
|
|
|
|
|
function create_if_block_2$1(ctx) {
|
|
|
|
|
let img;
|
|
|
|
|
let img_src_value;
|
|
|
|
|
let img_alt_value;
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
c() {
|
|
|
|
|
img = element("img");
|
|
|
|
|
if (!src_url_equal(img.src, img_src_value = /*feed*/ ctx[0].image)) attr(img, "src", img_src_value);
|
|
|
|
|
attr(img, "alt", img_alt_value = /*feed*/ ctx[0].title);
|
|
|
|
|
set_style(img, "height", "1em");
|
|
|
|
|
},
|
|
|
|
|
m(target, anchor) {
|
|
|
|
|
insert(target, img, anchor);
|
|
|
|
|
},
|
|
|
|
|
p(ctx, dirty) {
|
|
|
|
|
if (dirty & /*feed*/ 1 && !src_url_equal(img.src, img_src_value = /*feed*/ ctx[0].image)) {
|
|
|
|
|
attr(img, "src", img_src_value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (dirty & /*feed*/ 1 && img_alt_value !== (img_alt_value = /*feed*/ ctx[0].title)) {
|
|
|
|
|
attr(img, "alt", img_alt_value);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
d(detaching) {
|
|
|
|
|
if (detaching) detach(img);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// (32:12) {#if !foldedState.get(feed.name)}
|
|
|
|
|
function create_if_block_1$1(ctx) {
|
|
|
|
|
let each_1_anchor;
|
|
|
|
|
let current;
|
|
|
|
|
let each_value = /*feed*/ ctx[0].items;
|
|
|
|
|
let each_blocks = [];
|
|
|
|
|
|
|
|
|
|
for (let i = 0; i < each_value.length; i += 1) {
|
|
|
|
|
each_blocks[i] = create_each_block$1(get_each_context$1(ctx, each_value, i));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const out = i => transition_out(each_blocks[i], 1, 1, () => {
|
|
|
|
|
each_blocks[i] = null;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
c() {
|
|
|
|
|
for (let i = 0; i < each_blocks.length; i += 1) {
|
|
|
|
|
each_blocks[i].c();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
each_1_anchor = empty();
|
|
|
|
|
},
|
|
|
|
|
m(target, anchor) {
|
|
|
|
|
for (let i = 0; i < each_blocks.length; i += 1) {
|
|
|
|
|
each_blocks[i].m(target, anchor);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
insert(target, each_1_anchor, anchor);
|
|
|
|
|
current = true;
|
|
|
|
|
},
|
|
|
|
|
p(ctx, dirty) {
|
|
|
|
|
if (dirty & /*feed, plugin*/ 3) {
|
|
|
|
|
each_value = /*feed*/ ctx[0].items;
|
|
|
|
|
let i;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < each_value.length; i += 1) {
|
|
|
|
|
const child_ctx = get_each_context$1(ctx, each_value, i);
|
|
|
|
|
|
|
|
|
|
if (each_blocks[i]) {
|
|
|
|
|
each_blocks[i].p(child_ctx, dirty);
|
|
|
|
|
transition_in(each_blocks[i], 1);
|
|
|
|
|
} else {
|
|
|
|
|
each_blocks[i] = create_each_block$1(child_ctx);
|
|
|
|
|
each_blocks[i].c();
|
|
|
|
|
transition_in(each_blocks[i], 1);
|
|
|
|
|
each_blocks[i].m(each_1_anchor.parentNode, each_1_anchor);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
group_outros();
|
|
|
|
|
|
|
|
|
|
for (i = each_value.length; i < each_blocks.length; i += 1) {
|
|
|
|
|
out(i);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
check_outros();
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
i(local) {
|
|
|
|
|
if (current) return;
|
|
|
|
|
|
|
|
|
|
for (let i = 0; i < each_value.length; i += 1) {
|
|
|
|
|
transition_in(each_blocks[i]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
current = true;
|
|
|
|
|
},
|
|
|
|
|
o(local) {
|
|
|
|
|
each_blocks = each_blocks.filter(Boolean);
|
|
|
|
|
|
|
|
|
|
for (let i = 0; i < each_blocks.length; i += 1) {
|
|
|
|
|
transition_out(each_blocks[i]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
current = false;
|
|
|
|
|
},
|
|
|
|
|
d(detaching) {
|
|
|
|
|
destroy_each(each_blocks, detaching);
|
|
|
|
|
if (detaching) detach(each_1_anchor);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// (33:16) {#each feed.items as item}
|
|
|
|
|
function create_each_block$1(ctx) {
|
|
|
|
|
let itemview;
|
|
|
|
|
let current;
|
|
|
|
|
|
|
|
|
|
itemview = new ItemView({
|
|
|
|
|
props: {
|
|
|
|
|
item: /*item*/ ctx[5],
|
|
|
|
|
plugin: /*plugin*/ ctx[1]
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
c() {
|
|
|
|
|
create_component(itemview.$$.fragment);
|
|
|
|
|
},
|
|
|
|
|
m(target, anchor) {
|
|
|
|
|
mount_component(itemview, target, anchor);
|
|
|
|
|
current = true;
|
|
|
|
|
},
|
|
|
|
|
p(ctx, dirty) {
|
|
|
|
|
const itemview_changes = {};
|
|
|
|
|
if (dirty & /*feed*/ 1) itemview_changes.item = /*item*/ ctx[5];
|
|
|
|
|
if (dirty & /*plugin*/ 2) itemview_changes.plugin = /*plugin*/ ctx[1];
|
|
|
|
|
itemview.$set(itemview_changes);
|
|
|
|
|
},
|
|
|
|
|
i(local) {
|
|
|
|
|
if (current) return;
|
|
|
|
|
transition_in(itemview.$$.fragment, local);
|
|
|
|
|
current = true;
|
|
|
|
|
},
|
|
|
|
|
o(local) {
|
|
|
|
|
transition_out(itemview.$$.fragment, local);
|
|
|
|
|
current = false;
|
|
|
|
|
},
|
|
|
|
|
d(detaching) {
|
|
|
|
|
destroy_component(itemview, detaching);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function create_fragment$1(ctx) {
|
|
|
|
|
let current_block_type_index;
|
|
|
|
|
let if_block;
|
|
|
|
|
let if_block_anchor;
|
|
|
|
|
let current;
|
|
|
|
|
const if_block_creators = [create_if_block$1, create_else_block];
|
|
|
|
|
const if_blocks = [];
|
|
|
|
|
|
|
|
|
|
function select_block_type(ctx, dirty) {
|
|
|
|
|
if (!/*feed*/ ctx[0]) return 0;
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
current_block_type_index = select_block_type(ctx);
|
|
|
|
|
if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
c() {
|
|
|
|
|
if_block.c();
|
|
|
|
|
if_block_anchor = empty();
|
|
|
|
|
},
|
|
|
|
|
m(target, anchor) {
|
|
|
|
|
if_blocks[current_block_type_index].m(target, anchor);
|
|
|
|
|
insert(target, if_block_anchor, anchor);
|
|
|
|
|
current = true;
|
|
|
|
|
},
|
|
|
|
|
p(ctx, [dirty]) {
|
|
|
|
|
let previous_block_index = current_block_type_index;
|
|
|
|
|
current_block_type_index = select_block_type(ctx);
|
|
|
|
|
|
|
|
|
|
if (current_block_type_index === previous_block_index) {
|
|
|
|
|
if_blocks[current_block_type_index].p(ctx, dirty);
|
|
|
|
|
} else {
|
|
|
|
|
group_outros();
|
|
|
|
|
|
|
|
|
|
transition_out(if_blocks[previous_block_index], 1, 1, () => {
|
|
|
|
|
if_blocks[previous_block_index] = null;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
check_outros();
|
|
|
|
|
if_block = if_blocks[current_block_type_index];
|
|
|
|
|
|
|
|
|
|
if (!if_block) {
|
|
|
|
|
if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);
|
|
|
|
|
if_block.c();
|
|
|
|
|
} else {
|
|
|
|
|
if_block.p(ctx, dirty);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
transition_in(if_block, 1);
|
|
|
|
|
if_block.m(if_block_anchor.parentNode, if_block_anchor);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
i(local) {
|
|
|
|
|
if (current) return;
|
|
|
|
|
transition_in(if_block);
|
|
|
|
|
current = true;
|
|
|
|
|
},
|
|
|
|
|
o(local) {
|
|
|
|
|
transition_out(if_block);
|
|
|
|
|
current = false;
|
|
|
|
|
},
|
|
|
|
|
d(detaching) {
|
|
|
|
|
if_blocks[current_block_type_index].d(detaching);
|
|
|
|
|
if (detaching) detach(if_block_anchor);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function instance$1($$self, $$props, $$invalidate) {
|
|
|
|
|
let { feed = null } = $$props;
|
|
|
|
|
let { plugin } = $$props;
|
|
|
|
|
let foldedState = new Map();
|
|
|
|
|
|
|
|
|
|
function toggleFold(feed) {
|
|
|
|
|
foldedState.set(feed, !foldedState.get(feed));
|
|
|
|
|
$$invalidate(2, foldedState);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const click_handler = () => toggleFold(feed.name);
|
|
|
|
|
|
|
|
|
|
$$self.$$set = $$props => {
|
|
|
|
|
if ('feed' in $$props) $$invalidate(0, feed = $$props.feed);
|
|
|
|
|
if ('plugin' in $$props) $$invalidate(1, plugin = $$props.plugin);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return [feed, plugin, foldedState, toggleFold, click_handler];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class FeedView extends SvelteComponent {
|
|
|
|
|
constructor(options) {
|
|
|
|
|
super();
|
|
|
|
|
init(this, options, instance$1, create_fragment$1, safe_not_equal, { feed: 0, plugin: 1 });
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* src/view/FolderView.svelte generated by Svelte v3.44.2 */
|
|
|
|
|
|
|
|
|
|
function get_each_context(ctx, list, i) {
|
|
|
|
|
const child_ctx = ctx.slice();
|
|
|
|
|
child_ctx[9] = list[i];
|
|
|
|
|
return child_ctx;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function get_each_context_1(ctx, list, i) {
|
|
|
|
|
const child_ctx = ctx.slice();
|
|
|
|
|
child_ctx[12] = list[i];
|
|
|
|
|
return child_ctx;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function get_each_context_2(ctx, list, i) {
|
|
|
|
|
const child_ctx = ctx.slice();
|
|
|
|
|
child_ctx[15] = list[i][0];
|
|
|
|
|
child_ctx[9] = list[i][1];
|
|
|
|
|
return child_ctx;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function get_each_context_3(ctx, list, i) {
|
|
|
|
|
const child_ctx = ctx.slice();
|
|
|
|
|
child_ctx[18] = list[i];
|
|
|
|
|
return child_ctx;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// (14:0) {#if $filteredItemsStore}
|
|
|
|
|
function create_if_block_4(ctx) {
|
|
|
|
|
let div1;
|
|
|
|
|
let div0;
|
|
|
|
|
let iconcomponent;
|
|
|
|
|
let t0;
|
|
|
|
|
let span;
|
|
|
|
|
let div0_class_value;
|
|
|
|
|
let t2;
|
|
|
|
|
let show_if = !/*foldedState*/ ctx[1].get('rss-filters');
|
|
|
|
|
let current;
|
|
|
|
|
let mounted;
|
|
|
|
|
let dispose;
|
|
|
|
|
iconcomponent = new IconComponent({ props: { iconName: "right-triangle" } });
|
|
|
|
|
let if_block = show_if && create_if_block_5(ctx);
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
c() {
|
|
|
|
|
div1 = element("div");
|
|
|
|
|
div0 = element("div");
|
|
|
|
|
create_component(iconcomponent.$$.fragment);
|
|
|
|
|
t0 = space();
|
|
|
|
|
span = element("span");
|
|
|
|
|
span.textContent = "Filtered Folders";
|
|
|
|
|
t2 = space();
|
|
|
|
|
if (if_block) if_block.c();
|
|
|
|
|
|
|
|
|
|
attr(div0, "class", div0_class_value = /*foldedState*/ ctx[1].get('rss-filters')
|
|
|
|
|
? 'is-collapsed'
|
|
|
|
|
: '');
|
|
|
|
|
|
|
|
|
|
attr(div1, "class", "rss-filtered-folders");
|
|
|
|
|
},
|
|
|
|
|
m(target, anchor) {
|
|
|
|
|
insert(target, div1, anchor);
|
|
|
|
|
append(div1, div0);
|
|
|
|
|
mount_component(iconcomponent, div0, null);
|
|
|
|
|
append(div0, t0);
|
|
|
|
|
append(div0, span);
|
|
|
|
|
append(div1, t2);
|
|
|
|
|
if (if_block) if_block.m(div1, null);
|
|
|
|
|
current = true;
|
|
|
|
|
|
|
|
|
|
if (!mounted) {
|
|
|
|
|
dispose = listen(div0, "click", /*click_handler*/ ctx[5]);
|
|
|
|
|
mounted = true;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
p(ctx, dirty) {
|
|
|
|
|
if (!current || dirty & /*foldedState*/ 2 && div0_class_value !== (div0_class_value = /*foldedState*/ ctx[1].get('rss-filters')
|
|
|
|
|
? 'is-collapsed'
|
|
|
|
|
: '')) {
|
|
|
|
|
attr(div0, "class", div0_class_value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (dirty & /*foldedState*/ 2) show_if = !/*foldedState*/ ctx[1].get('rss-filters');
|
|
|
|
|
|
|
|
|
|
if (show_if) {
|
|
|
|
|
if (if_block) {
|
|
|
|
|
if_block.p(ctx, dirty);
|
|
|
|
|
|
|
|
|
|
if (dirty & /*foldedState*/ 2) {
|
|
|
|
|
transition_in(if_block, 1);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if_block = create_if_block_5(ctx);
|
|
|
|
|
if_block.c();
|
|
|
|
|
transition_in(if_block, 1);
|
|
|
|
|
if_block.m(div1, null);
|
|
|
|
|
}
|
|
|
|
|
} else if (if_block) {
|
|
|
|
|
group_outros();
|
|
|
|
|
|
|
|
|
|
transition_out(if_block, 1, 1, () => {
|
|
|
|
|
if_block = null;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
check_outros();
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
i(local) {
|
|
|
|
|
if (current) return;
|
|
|
|
|
transition_in(iconcomponent.$$.fragment, local);
|
|
|
|
|
transition_in(if_block);
|
|
|
|
|
current = true;
|
|
|
|
|
},
|
|
|
|
|
o(local) {
|
|
|
|
|
transition_out(iconcomponent.$$.fragment, local);
|
|
|
|
|
transition_out(if_block);
|
|
|
|
|
current = false;
|
|
|
|
|
},
|
|
|
|
|
d(detaching) {
|
|
|
|
|
if (detaching) detach(div1);
|
|
|
|
|
destroy_component(iconcomponent);
|
|
|
|
|
if (if_block) if_block.d();
|
|
|
|
|
mounted = false;
|
|
|
|
|
dispose();
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// (22:8) {#if (!foldedState.get('rss-filters'))}
|
|
|
|
|
function create_if_block_5(ctx) {
|
|
|
|
|
let each_1_anchor;
|
|
|
|
|
let current;
|
|
|
|
|
let each_value_2 = Object.entries(/*$filteredItemsStore*/ ctx[2]);
|
|
|
|
|
let each_blocks = [];
|
|
|
|
|
|
|
|
|
|
for (let i = 0; i < each_value_2.length; i += 1) {
|
|
|
|
|
each_blocks[i] = create_each_block_2(get_each_context_2(ctx, each_value_2, i));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const out = i => transition_out(each_blocks[i], 1, 1, () => {
|
|
|
|
|
each_blocks[i] = null;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
c() {
|
|
|
|
|
for (let i = 0; i < each_blocks.length; i += 1) {
|
|
|
|
|
each_blocks[i].c();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
each_1_anchor = empty();
|
|
|
|
|
},
|
|
|
|
|
m(target, anchor) {
|
|
|
|
|
for (let i = 0; i < each_blocks.length; i += 1) {
|
|
|
|
|
each_blocks[i].m(target, anchor);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
insert(target, each_1_anchor, anchor);
|
|
|
|
|
current = true;
|
|
|
|
|
},
|
|
|
|
|
p(ctx, dirty) {
|
|
|
|
|
if (dirty & /*Object, $filteredItemsStore, plugin, foldedState, toggleFold*/ 23) {
|
|
|
|
|
each_value_2 = Object.entries(/*$filteredItemsStore*/ ctx[2]);
|
|
|
|
|
let i;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < each_value_2.length; i += 1) {
|
|
|
|
|
const child_ctx = get_each_context_2(ctx, each_value_2, i);
|
|
|
|
|
|
|
|
|
|
if (each_blocks[i]) {
|
|
|
|
|
each_blocks[i].p(child_ctx, dirty);
|
|
|
|
|
transition_in(each_blocks[i], 1);
|
|
|
|
|
} else {
|
|
|
|
|
each_blocks[i] = create_each_block_2(child_ctx);
|
|
|
|
|
each_blocks[i].c();
|
|
|
|
|
transition_in(each_blocks[i], 1);
|
|
|
|
|
each_blocks[i].m(each_1_anchor.parentNode, each_1_anchor);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
group_outros();
|
|
|
|
|
|
|
|
|
|
for (i = each_value_2.length; i < each_blocks.length; i += 1) {
|
|
|
|
|
out(i);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
check_outros();
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
i(local) {
|
|
|
|
|
if (current) return;
|
|
|
|
|
|
|
|
|
|
for (let i = 0; i < each_value_2.length; i += 1) {
|
|
|
|
|
transition_in(each_blocks[i]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
current = true;
|
|
|
|
|
},
|
|
|
|
|
o(local) {
|
|
|
|
|
each_blocks = each_blocks.filter(Boolean);
|
|
|
|
|
|
|
|
|
|
for (let i = 0; i < each_blocks.length; i += 1) {
|
|
|
|
|
transition_out(each_blocks[i]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
current = false;
|
|
|
|
|
},
|
|
|
|
|
d(detaching) {
|
|
|
|
|
destroy_each(each_blocks, detaching);
|
|
|
|
|
if (detaching) detach(each_1_anchor);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// (30:16) {#if (!foldedState.get('rss-filter' + folder.filter.name))}
|
|
|
|
|
function create_if_block_6(ctx) {
|
|
|
|
|
let div;
|
|
|
|
|
let t;
|
|
|
|
|
let current;
|
|
|
|
|
let each_value_3 = /*folder*/ ctx[9].items.items;
|
|
|
|
|
let each_blocks = [];
|
|
|
|
|
|
|
|
|
|
for (let i = 0; i < each_value_3.length; i += 1) {
|
|
|
|
|
each_blocks[i] = create_each_block_3(get_each_context_3(ctx, each_value_3, i));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const out = i => transition_out(each_blocks[i], 1, 1, () => {
|
|
|
|
|
each_blocks[i] = null;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
c() {
|
|
|
|
|
div = element("div");
|
|
|
|
|
|
|
|
|
|
for (let i = 0; i < each_blocks.length; i += 1) {
|
|
|
|
|
each_blocks[i].c();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
t = space();
|
|
|
|
|
set_style(div, "margin-left", "20px");
|
|
|
|
|
},
|
|
|
|
|
m(target, anchor) {
|
|
|
|
|
insert(target, div, anchor);
|
|
|
|
|
|
|
|
|
|
for (let i = 0; i < each_blocks.length; i += 1) {
|
|
|
|
|
each_blocks[i].m(div, null);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
append(div, t);
|
|
|
|
|
current = true;
|
|
|
|
|
},
|
|
|
|
|
p(ctx, dirty) {
|
|
|
|
|
if (dirty & /*Object, $filteredItemsStore, plugin*/ 5) {
|
|
|
|
|
each_value_3 = /*folder*/ ctx[9].items.items;
|
|
|
|
|
let i;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < each_value_3.length; i += 1) {
|
|
|
|
|
const child_ctx = get_each_context_3(ctx, each_value_3, i);
|
|
|
|
|
|
|
|
|
|
if (each_blocks[i]) {
|
|
|
|
|
each_blocks[i].p(child_ctx, dirty);
|
|
|
|
|
transition_in(each_blocks[i], 1);
|
|
|
|
|
} else {
|
|
|
|
|
each_blocks[i] = create_each_block_3(child_ctx);
|
|
|
|
|
each_blocks[i].c();
|
|
|
|
|
transition_in(each_blocks[i], 1);
|
|
|
|
|
each_blocks[i].m(div, t);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
group_outros();
|
|
|
|
|
|
|
|
|
|
for (i = each_value_3.length; i < each_blocks.length; i += 1) {
|
|
|
|
|
out(i);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
check_outros();
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
i(local) {
|
|
|
|
|
if (current) return;
|
|
|
|
|
|
|
|
|
|
for (let i = 0; i < each_value_3.length; i += 1) {
|
|
|
|
|
transition_in(each_blocks[i]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
current = true;
|
|
|
|
|
},
|
|
|
|
|
o(local) {
|
|
|
|
|
each_blocks = each_blocks.filter(Boolean);
|
|
|
|
|
|
|
|
|
|
for (let i = 0; i < each_blocks.length; i += 1) {
|
|
|
|
|
transition_out(each_blocks[i]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
current = false;
|
|
|
|
|
},
|
|
|
|
|
d(detaching) {
|
|
|
|
|
if (detaching) detach(div);
|
|
|
|
|
destroy_each(each_blocks, detaching);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// (32:24) {#each folder.items.items as item}
|
|
|
|
|
function create_each_block_3(ctx) {
|
|
|
|
|
let itemview;
|
|
|
|
|
let current;
|
|
|
|
|
|
|
|
|
|
itemview = new ItemView({
|
|
|
|
|
props: {
|
|
|
|
|
item: /*item*/ ctx[18],
|
|
|
|
|
plugin: /*plugin*/ ctx[0]
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
c() {
|
|
|
|
|
create_component(itemview.$$.fragment);
|
|
|
|
|
},
|
|
|
|
|
m(target, anchor) {
|
|
|
|
|
mount_component(itemview, target, anchor);
|
|
|
|
|
current = true;
|
|
|
|
|
},
|
|
|
|
|
p(ctx, dirty) {
|
|
|
|
|
const itemview_changes = {};
|
|
|
|
|
if (dirty & /*$filteredItemsStore*/ 4) itemview_changes.item = /*item*/ ctx[18];
|
|
|
|
|
if (dirty & /*plugin*/ 1) itemview_changes.plugin = /*plugin*/ ctx[0];
|
|
|
|
|
itemview.$set(itemview_changes);
|
|
|
|
|
},
|
|
|
|
|
i(local) {
|
|
|
|
|
if (current) return;
|
|
|
|
|
transition_in(itemview.$$.fragment, local);
|
|
|
|
|
current = true;
|
|
|
|
|
},
|
|
|
|
|
o(local) {
|
|
|
|
|
transition_out(itemview.$$.fragment, local);
|
|
|
|
|
current = false;
|
|
|
|
|
},
|
|
|
|
|
d(detaching) {
|
|
|
|
|
destroy_component(itemview, detaching);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// (23:12) {#each Object.entries($filteredItemsStore) as [key, folder]}
|
|
|
|
|
function create_each_block_2(ctx) {
|
|
|
|
|
let div;
|
|
|
|
|
let iconcomponent;
|
|
|
|
|
let t0;
|
|
|
|
|
let span;
|
|
|
|
|
let t1_value = /*folder*/ ctx[9].filter.name + "";
|
|
|
|
|
let t1;
|
|
|
|
|
let div_class_value;
|
|
|
|
|
let t2;
|
|
|
|
|
let show_if = !/*foldedState*/ ctx[1].get('rss-filter' + /*folder*/ ctx[9].filter.name);
|
|
|
|
|
let if_block_anchor;
|
|
|
|
|
let current;
|
|
|
|
|
let mounted;
|
|
|
|
|
let dispose;
|
|
|
|
|
iconcomponent = new IconComponent({ props: { iconName: "right-triangle" } });
|
|
|
|
|
|
|
|
|
|
function click_handler_1() {
|
|
|
|
|
return /*click_handler_1*/ ctx[6](/*folder*/ ctx[9]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let if_block = show_if && create_if_block_6(ctx);
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
c() {
|
|
|
|
|
div = element("div");
|
|
|
|
|
create_component(iconcomponent.$$.fragment);
|
|
|
|
|
t0 = space();
|
|
|
|
|
span = element("span");
|
|
|
|
|
t1 = text(t1_value);
|
|
|
|
|
t2 = space();
|
|
|
|
|
if (if_block) if_block.c();
|
|
|
|
|
if_block_anchor = empty();
|
|
|
|
|
|
|
|
|
|
attr(div, "class", div_class_value = /*foldedState*/ ctx[1].get('rss-filter' + /*folder*/ ctx[9].filter.name)
|
|
|
|
|
? 'is-collapsed'
|
|
|
|
|
: '');
|
|
|
|
|
|
|
|
|
|
set_style(div, "margin-left", "20px");
|
|
|
|
|
},
|
|
|
|
|
m(target, anchor) {
|
|
|
|
|
insert(target, div, anchor);
|
|
|
|
|
mount_component(iconcomponent, div, null);
|
|
|
|
|
append(div, t0);
|
|
|
|
|
append(div, span);
|
|
|
|
|
append(span, t1);
|
|
|
|
|
insert(target, t2, anchor);
|
|
|
|
|
if (if_block) if_block.m(target, anchor);
|
|
|
|
|
insert(target, if_block_anchor, anchor);
|
|
|
|
|
current = true;
|
|
|
|
|
|
|
|
|
|
if (!mounted) {
|
|
|
|
|
dispose = listen(div, "click", click_handler_1);
|
|
|
|
|
mounted = true;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
p(new_ctx, dirty) {
|
|
|
|
|
ctx = new_ctx;
|
|
|
|
|
if ((!current || dirty & /*$filteredItemsStore*/ 4) && t1_value !== (t1_value = /*folder*/ ctx[9].filter.name + "")) set_data(t1, t1_value);
|
|
|
|
|
|
|
|
|
|
if (!current || dirty & /*foldedState, $filteredItemsStore*/ 6 && div_class_value !== (div_class_value = /*foldedState*/ ctx[1].get('rss-filter' + /*folder*/ ctx[9].filter.name)
|
|
|
|
|
? 'is-collapsed'
|
|
|
|
|
: '')) {
|
|
|
|
|
attr(div, "class", div_class_value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (dirty & /*foldedState, $filteredItemsStore*/ 6) show_if = !/*foldedState*/ ctx[1].get('rss-filter' + /*folder*/ ctx[9].filter.name);
|
|
|
|
|
|
|
|
|
|
if (show_if) {
|
|
|
|
|
if (if_block) {
|
|
|
|
|
if_block.p(ctx, dirty);
|
|
|
|
|
|
|
|
|
|
if (dirty & /*foldedState, $filteredItemsStore*/ 6) {
|
|
|
|
|
transition_in(if_block, 1);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if_block = create_if_block_6(ctx);
|
|
|
|
|
if_block.c();
|
|
|
|
|
transition_in(if_block, 1);
|
|
|
|
|
if_block.m(if_block_anchor.parentNode, if_block_anchor);
|
|
|
|
|
}
|
|
|
|
|
} else if (if_block) {
|
|
|
|
|
group_outros();
|
|
|
|
|
|
|
|
|
|
transition_out(if_block, 1, 1, () => {
|
|
|
|
|
if_block = null;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
check_outros();
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
i(local) {
|
|
|
|
|
if (current) return;
|
|
|
|
|
transition_in(iconcomponent.$$.fragment, local);
|
|
|
|
|
transition_in(if_block);
|
|
|
|
|
current = true;
|
|
|
|
|
},
|
|
|
|
|
o(local) {
|
|
|
|
|
transition_out(iconcomponent.$$.fragment, local);
|
|
|
|
|
transition_out(if_block);
|
|
|
|
|
current = false;
|
|
|
|
|
},
|
|
|
|
|
d(detaching) {
|
|
|
|
|
if (detaching) detach(div);
|
|
|
|
|
destroy_component(iconcomponent);
|
|
|
|
|
if (detaching) detach(t2);
|
|
|
|
|
if (if_block) if_block.d(detaching);
|
|
|
|
|
if (detaching) detach(if_block_anchor);
|
|
|
|
|
mounted = false;
|
|
|
|
|
dispose();
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// (43:0) {#if !$sortedFeedsStore}
|
|
|
|
|
function create_if_block_3(ctx) {
|
|
|
|
|
let h1;
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
c() {
|
|
|
|
|
h1 = element("h1");
|
|
|
|
|
h1.textContent = "No feeds configured";
|
|
|
|
|
},
|
|
|
|
|
m(target, anchor) {
|
|
|
|
|
insert(target, h1, anchor);
|
|
|
|
|
},
|
|
|
|
|
d(detaching) {
|
|
|
|
|
if (detaching) detach(h1);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// (47:0) {#if $sortedFeedsStore}
|
|
|
|
|
function create_if_block(ctx) {
|
|
|
|
|
let div1;
|
|
|
|
|
let div0;
|
|
|
|
|
let iconcomponent;
|
|
|
|
|
let t0;
|
|
|
|
|
let span;
|
|
|
|
|
let div0_class_value;
|
|
|
|
|
let t2;
|
|
|
|
|
let show_if = !/*foldedState*/ ctx[1].get('rss-folders');
|
|
|
|
|
let current;
|
|
|
|
|
let mounted;
|
|
|
|
|
let dispose;
|
|
|
|
|
iconcomponent = new IconComponent({ props: { iconName: "right-triangle" } });
|
|
|
|
|
let if_block = show_if && create_if_block_1(ctx);
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
c() {
|
|
|
|
|
div1 = element("div");
|
|
|
|
|
div0 = element("div");
|
|
|
|
|
create_component(iconcomponent.$$.fragment);
|
|
|
|
|
t0 = space();
|
|
|
|
|
span = element("span");
|
|
|
|
|
span.textContent = "Folders";
|
|
|
|
|
t2 = space();
|
|
|
|
|
if (if_block) if_block.c();
|
|
|
|
|
|
|
|
|
|
attr(div0, "class", div0_class_value = /*foldedState*/ ctx[1].get('rss-folders')
|
|
|
|
|
? 'is-collapsed'
|
|
|
|
|
: '');
|
|
|
|
|
|
|
|
|
|
attr(div1, "class", "rss-feeds-folders");
|
|
|
|
|
},
|
|
|
|
|
m(target, anchor) {
|
|
|
|
|
insert(target, div1, anchor);
|
|
|
|
|
append(div1, div0);
|
|
|
|
|
mount_component(iconcomponent, div0, null);
|
|
|
|
|
append(div0, t0);
|
|
|
|
|
append(div0, span);
|
|
|
|
|
append(div1, t2);
|
|
|
|
|
if (if_block) if_block.m(div1, null);
|
|
|
|
|
current = true;
|
|
|
|
|
|
|
|
|
|
if (!mounted) {
|
|
|
|
|
dispose = listen(div0, "click", /*click_handler_2*/ ctx[7]);
|
|
|
|
|
mounted = true;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
p(ctx, dirty) {
|
|
|
|
|
if (!current || dirty & /*foldedState*/ 2 && div0_class_value !== (div0_class_value = /*foldedState*/ ctx[1].get('rss-folders')
|
|
|
|
|
? 'is-collapsed'
|
|
|
|
|
: '')) {
|
|
|
|
|
attr(div0, "class", div0_class_value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (dirty & /*foldedState*/ 2) show_if = !/*foldedState*/ ctx[1].get('rss-folders');
|
|
|
|
|
|
|
|
|
|
if (show_if) {
|
|
|
|
|
if (if_block) {
|
|
|
|
|
if_block.p(ctx, dirty);
|
|
|
|
|
|
|
|
|
|
if (dirty & /*foldedState*/ 2) {
|
|
|
|
|
transition_in(if_block, 1);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if_block = create_if_block_1(ctx);
|
|
|
|
|
if_block.c();
|
|
|
|
|
transition_in(if_block, 1);
|
|
|
|
|
if_block.m(div1, null);
|
|
|
|
|
}
|
|
|
|
|
} else if (if_block) {
|
|
|
|
|
group_outros();
|
|
|
|
|
|
|
|
|
|
transition_out(if_block, 1, 1, () => {
|
|
|
|
|
if_block = null;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
check_outros();
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
i(local) {
|
|
|
|
|
if (current) return;
|
|
|
|
|
transition_in(iconcomponent.$$.fragment, local);
|
|
|
|
|
transition_in(if_block);
|
|
|
|
|
current = true;
|
|
|
|
|
},
|
|
|
|
|
o(local) {
|
|
|
|
|
transition_out(iconcomponent.$$.fragment, local);
|
|
|
|
|
transition_out(if_block);
|
|
|
|
|
current = false;
|
|
|
|
|
},
|
|
|
|
|
d(detaching) {
|
|
|
|
|
if (detaching) detach(div1);
|
|
|
|
|
destroy_component(iconcomponent);
|
|
|
|
|
if (if_block) if_block.d();
|
|
|
|
|
mounted = false;
|
|
|
|
|
dispose();
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// (55:8) {#if (!foldedState.get('rss-folders'))}
|
|
|
|
|
function create_if_block_1(ctx) {
|
|
|
|
|
let each_1_anchor;
|
|
|
|
|
let current;
|
|
|
|
|
let each_value = Object.keys(/*$sortedFeedsStore*/ ctx[3]);
|
|
|
|
|
let each_blocks = [];
|
|
|
|
|
|
|
|
|
|
for (let i = 0; i < each_value.length; i += 1) {
|
|
|
|
|
each_blocks[i] = create_each_block(get_each_context(ctx, each_value, i));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const out = i => transition_out(each_blocks[i], 1, 1, () => {
|
|
|
|
|
each_blocks[i] = null;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
c() {
|
|
|
|
|
for (let i = 0; i < each_blocks.length; i += 1) {
|
|
|
|
|
each_blocks[i].c();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
each_1_anchor = empty();
|
|
|
|
|
},
|
|
|
|
|
m(target, anchor) {
|
|
|
|
|
for (let i = 0; i < each_blocks.length; i += 1) {
|
|
|
|
|
each_blocks[i].m(target, anchor);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
insert(target, each_1_anchor, anchor);
|
|
|
|
|
current = true;
|
|
|
|
|
},
|
|
|
|
|
p(ctx, dirty) {
|
|
|
|
|
if (dirty & /*$sortedFeedsStore, Object, plugin, foldedState, toggleFold*/ 27) {
|
|
|
|
|
each_value = Object.keys(/*$sortedFeedsStore*/ ctx[3]);
|
|
|
|
|
let i;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < each_value.length; i += 1) {
|
|
|
|
|
const child_ctx = get_each_context(ctx, each_value, i);
|
|
|
|
|
|
|
|
|
|
if (each_blocks[i]) {
|
|
|
|
|
each_blocks[i].p(child_ctx, dirty);
|
|
|
|
|
transition_in(each_blocks[i], 1);
|
|
|
|
|
} else {
|
|
|
|
|
each_blocks[i] = create_each_block(child_ctx);
|
|
|
|
|
each_blocks[i].c();
|
|
|
|
|
transition_in(each_blocks[i], 1);
|
|
|
|
|
each_blocks[i].m(each_1_anchor.parentNode, each_1_anchor);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
group_outros();
|
|
|
|
|
|
|
|
|
|
for (i = each_value.length; i < each_blocks.length; i += 1) {
|
|
|
|
|
out(i);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
check_outros();
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
i(local) {
|
|
|
|
|
if (current) return;
|
|
|
|
|
|
|
|
|
|
for (let i = 0; i < each_value.length; i += 1) {
|
|
|
|
|
transition_in(each_blocks[i]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
current = true;
|
|
|
|
|
},
|
|
|
|
|
o(local) {
|
|
|
|
|
each_blocks = each_blocks.filter(Boolean);
|
|
|
|
|
|
|
|
|
|
for (let i = 0; i < each_blocks.length; i += 1) {
|
|
|
|
|
transition_out(each_blocks[i]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
current = false;
|
|
|
|
|
},
|
|
|
|
|
d(detaching) {
|
|
|
|
|
destroy_each(each_blocks, detaching);
|
|
|
|
|
if (detaching) detach(each_1_anchor);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// (65:20) {#if (!foldedState.get(folder))}
|
|
|
|
|
function create_if_block_2(ctx) {
|
|
|
|
|
let each_1_anchor;
|
|
|
|
|
let current;
|
|
|
|
|
let each_value_1 = /*$sortedFeedsStore*/ ctx[3][/*folder*/ ctx[9]];
|
|
|
|
|
let each_blocks = [];
|
|
|
|
|
|
|
|
|
|
for (let i = 0; i < each_value_1.length; i += 1) {
|
|
|
|
|
each_blocks[i] = create_each_block_1(get_each_context_1(ctx, each_value_1, i));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const out = i => transition_out(each_blocks[i], 1, 1, () => {
|
|
|
|
|
each_blocks[i] = null;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
c() {
|
|
|
|
|
for (let i = 0; i < each_blocks.length; i += 1) {
|
|
|
|
|
each_blocks[i].c();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
each_1_anchor = empty();
|
|
|
|
|
},
|
|
|
|
|
m(target, anchor) {
|
|
|
|
|
for (let i = 0; i < each_blocks.length; i += 1) {
|
|
|
|
|
each_blocks[i].m(target, anchor);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
insert(target, each_1_anchor, anchor);
|
|
|
|
|
current = true;
|
|
|
|
|
},
|
|
|
|
|
p(ctx, dirty) {
|
|
|
|
|
if (dirty & /*$sortedFeedsStore, Object, plugin*/ 9) {
|
|
|
|
|
each_value_1 = /*$sortedFeedsStore*/ ctx[3][/*folder*/ ctx[9]];
|
|
|
|
|
let i;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < each_value_1.length; i += 1) {
|
|
|
|
|
const child_ctx = get_each_context_1(ctx, each_value_1, i);
|
|
|
|
|
|
|
|
|
|
if (each_blocks[i]) {
|
|
|
|
|
each_blocks[i].p(child_ctx, dirty);
|
|
|
|
|
transition_in(each_blocks[i], 1);
|
|
|
|
|
} else {
|
|
|
|
|
each_blocks[i] = create_each_block_1(child_ctx);
|
|
|
|
|
each_blocks[i].c();
|
|
|
|
|
transition_in(each_blocks[i], 1);
|
|
|
|
|
each_blocks[i].m(each_1_anchor.parentNode, each_1_anchor);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
group_outros();
|
|
|
|
|
|
|
|
|
|
for (i = each_value_1.length; i < each_blocks.length; i += 1) {
|
|
|
|
|
out(i);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
check_outros();
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
i(local) {
|
|
|
|
|
if (current) return;
|
|
|
|
|
|
|
|
|
|
for (let i = 0; i < each_value_1.length; i += 1) {
|
|
|
|
|
transition_in(each_blocks[i]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
current = true;
|
|
|
|
|
},
|
|
|
|
|
o(local) {
|
|
|
|
|
each_blocks = each_blocks.filter(Boolean);
|
|
|
|
|
|
|
|
|
|
for (let i = 0; i < each_blocks.length; i += 1) {
|
|
|
|
|
transition_out(each_blocks[i]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
current = false;
|
|
|
|
|
},
|
|
|
|
|
d(detaching) {
|
|
|
|
|
destroy_each(each_blocks, detaching);
|
|
|
|
|
if (detaching) detach(each_1_anchor);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// (66:24) {#each $sortedFeedsStore[folder] as feed}
|
|
|
|
|
function create_each_block_1(ctx) {
|
|
|
|
|
let feedview;
|
|
|
|
|
let current;
|
|
|
|
|
|
|
|
|
|
feedview = new FeedView({
|
|
|
|
|
props: {
|
|
|
|
|
feed: /*feed*/ ctx[12],
|
|
|
|
|
plugin: /*plugin*/ ctx[0]
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
c() {
|
|
|
|
|
create_component(feedview.$$.fragment);
|
|
|
|
|
},
|
|
|
|
|
m(target, anchor) {
|
|
|
|
|
mount_component(feedview, target, anchor);
|
|
|
|
|
current = true;
|
|
|
|
|
},
|
|
|
|
|
p(ctx, dirty) {
|
|
|
|
|
const feedview_changes = {};
|
|
|
|
|
if (dirty & /*$sortedFeedsStore*/ 8) feedview_changes.feed = /*feed*/ ctx[12];
|
|
|
|
|
if (dirty & /*plugin*/ 1) feedview_changes.plugin = /*plugin*/ ctx[0];
|
|
|
|
|
feedview.$set(feedview_changes);
|
|
|
|
|
},
|
|
|
|
|
i(local) {
|
|
|
|
|
if (current) return;
|
|
|
|
|
transition_in(feedview.$$.fragment, local);
|
|
|
|
|
current = true;
|
|
|
|
|
},
|
|
|
|
|
o(local) {
|
|
|
|
|
transition_out(feedview.$$.fragment, local);
|
|
|
|
|
current = false;
|
|
|
|
|
},
|
|
|
|
|
d(detaching) {
|
|
|
|
|
destroy_component(feedview, detaching);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// (56:12) {#each Object.keys($sortedFeedsStore) as folder}
|
|
|
|
|
function create_each_block(ctx) {
|
|
|
|
|
let div1;
|
|
|
|
|
let div0;
|
|
|
|
|
let iconcomponent;
|
|
|
|
|
let t0;
|
|
|
|
|
let span;
|
|
|
|
|
|
|
|
|
|
let t1_value = (/*folder*/ ctx[9] !== "undefined"
|
|
|
|
|
? /*folder*/ ctx[9]
|
|
|
|
|
: 'No Folder') + "";
|
|
|
|
|
|
|
|
|
|
let t1;
|
|
|
|
|
let div0_class_value;
|
|
|
|
|
let t2;
|
|
|
|
|
let show_if = !/*foldedState*/ ctx[1].get(/*folder*/ ctx[9]);
|
|
|
|
|
let t3;
|
|
|
|
|
let current;
|
|
|
|
|
let mounted;
|
|
|
|
|
let dispose;
|
|
|
|
|
iconcomponent = new IconComponent({ props: { iconName: "right-triangle" } });
|
|
|
|
|
|
|
|
|
|
function click_handler_3() {
|
|
|
|
|
return /*click_handler_3*/ ctx[8](/*folder*/ ctx[9]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let if_block = show_if && create_if_block_2(ctx);
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
c() {
|
|
|
|
|
div1 = element("div");
|
|
|
|
|
div0 = element("div");
|
|
|
|
|
create_component(iconcomponent.$$.fragment);
|
|
|
|
|
t0 = space();
|
|
|
|
|
span = element("span");
|
|
|
|
|
t1 = text(t1_value);
|
|
|
|
|
t2 = space();
|
|
|
|
|
if (if_block) if_block.c();
|
|
|
|
|
t3 = space();
|
|
|
|
|
|
|
|
|
|
attr(div0, "class", div0_class_value = /*foldedState*/ ctx[1].get(/*folder*/ ctx[9])
|
|
|
|
|
? 'is-collapsed'
|
|
|
|
|
: '');
|
|
|
|
|
|
|
|
|
|
attr(div1, "class", "rss-folder");
|
|
|
|
|
set_style(div1, "margin-left", "20px");
|
|
|
|
|
},
|
|
|
|
|
m(target, anchor) {
|
|
|
|
|
insert(target, div1, anchor);
|
|
|
|
|
append(div1, div0);
|
|
|
|
|
mount_component(iconcomponent, div0, null);
|
|
|
|
|
append(div0, t0);
|
|
|
|
|
append(div0, span);
|
|
|
|
|
append(span, t1);
|
|
|
|
|
append(div1, t2);
|
|
|
|
|
if (if_block) if_block.m(div1, null);
|
|
|
|
|
append(div1, t3);
|
|
|
|
|
current = true;
|
|
|
|
|
|
|
|
|
|
if (!mounted) {
|
|
|
|
|
dispose = listen(div0, "click", click_handler_3);
|
|
|
|
|
mounted = true;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
p(new_ctx, dirty) {
|
|
|
|
|
ctx = new_ctx;
|
|
|
|
|
|
|
|
|
|
if ((!current || dirty & /*$sortedFeedsStore*/ 8) && t1_value !== (t1_value = (/*folder*/ ctx[9] !== "undefined"
|
|
|
|
|
? /*folder*/ ctx[9]
|
|
|
|
|
: 'No Folder') + "")) set_data(t1, t1_value);
|
|
|
|
|
|
|
|
|
|
if (!current || dirty & /*foldedState, $sortedFeedsStore*/ 10 && div0_class_value !== (div0_class_value = /*foldedState*/ ctx[1].get(/*folder*/ ctx[9])
|
|
|
|
|
? 'is-collapsed'
|
|
|
|
|
: '')) {
|
|
|
|
|
attr(div0, "class", div0_class_value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (dirty & /*foldedState, $sortedFeedsStore*/ 10) show_if = !/*foldedState*/ ctx[1].get(/*folder*/ ctx[9]);
|
|
|
|
|
|
|
|
|
|
if (show_if) {
|
|
|
|
|
if (if_block) {
|
|
|
|
|
if_block.p(ctx, dirty);
|
|
|
|
|
|
|
|
|
|
if (dirty & /*foldedState, $sortedFeedsStore*/ 10) {
|
|
|
|
|
transition_in(if_block, 1);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if_block = create_if_block_2(ctx);
|
|
|
|
|
if_block.c();
|
|
|
|
|
transition_in(if_block, 1);
|
|
|
|
|
if_block.m(div1, t3);
|
|
|
|
|
}
|
|
|
|
|
} else if (if_block) {
|
|
|
|
|
group_outros();
|
|
|
|
|
|
|
|
|
|
transition_out(if_block, 1, 1, () => {
|
|
|
|
|
if_block = null;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
check_outros();
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
i(local) {
|
|
|
|
|
if (current) return;
|
|
|
|
|
transition_in(iconcomponent.$$.fragment, local);
|
|
|
|
|
transition_in(if_block);
|
|
|
|
|
current = true;
|
|
|
|
|
},
|
|
|
|
|
o(local) {
|
|
|
|
|
transition_out(iconcomponent.$$.fragment, local);
|
|
|
|
|
transition_out(if_block);
|
|
|
|
|
current = false;
|
|
|
|
|
},
|
|
|
|
|
d(detaching) {
|
|
|
|
|
if (detaching) detach(div1);
|
|
|
|
|
destroy_component(iconcomponent);
|
|
|
|
|
if (if_block) if_block.d();
|
|
|
|
|
mounted = false;
|
|
|
|
|
dispose();
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function create_fragment(ctx) {
|
|
|
|
|
let t0;
|
|
|
|
|
let t1;
|
|
|
|
|
let if_block2_anchor;
|
|
|
|
|
let current;
|
|
|
|
|
let if_block0 = /*$filteredItemsStore*/ ctx[2] && create_if_block_4(ctx);
|
|
|
|
|
let if_block1 = !/*$sortedFeedsStore*/ ctx[3] && create_if_block_3();
|
|
|
|
|
let if_block2 = /*$sortedFeedsStore*/ ctx[3] && create_if_block(ctx);
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
c() {
|
|
|
|
|
if (if_block0) if_block0.c();
|
|
|
|
|
t0 = space();
|
|
|
|
|
if (if_block1) if_block1.c();
|
|
|
|
|
t1 = space();
|
|
|
|
|
if (if_block2) if_block2.c();
|
|
|
|
|
if_block2_anchor = empty();
|
|
|
|
|
},
|
|
|
|
|
m(target, anchor) {
|
|
|
|
|
if (if_block0) if_block0.m(target, anchor);
|
|
|
|
|
insert(target, t0, anchor);
|
|
|
|
|
if (if_block1) if_block1.m(target, anchor);
|
|
|
|
|
insert(target, t1, anchor);
|
|
|
|
|
if (if_block2) if_block2.m(target, anchor);
|
|
|
|
|
insert(target, if_block2_anchor, anchor);
|
|
|
|
|
current = true;
|
|
|
|
|
},
|
|
|
|
|
p(ctx, [dirty]) {
|
|
|
|
|
if (/*$filteredItemsStore*/ ctx[2]) {
|
|
|
|
|
if (if_block0) {
|
|
|
|
|
if_block0.p(ctx, dirty);
|
|
|
|
|
|
|
|
|
|
if (dirty & /*$filteredItemsStore*/ 4) {
|
|
|
|
|
transition_in(if_block0, 1);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if_block0 = create_if_block_4(ctx);
|
|
|
|
|
if_block0.c();
|
|
|
|
|
transition_in(if_block0, 1);
|
|
|
|
|
if_block0.m(t0.parentNode, t0);
|
|
|
|
|
}
|
|
|
|
|
} else if (if_block0) {
|
|
|
|
|
group_outros();
|
|
|
|
|
|
|
|
|
|
transition_out(if_block0, 1, 1, () => {
|
|
|
|
|
if_block0 = null;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
check_outros();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!/*$sortedFeedsStore*/ ctx[3]) {
|
|
|
|
|
if (if_block1) ; else {
|
|
|
|
|
if_block1 = create_if_block_3();
|
|
|
|
|
if_block1.c();
|
|
|
|
|
if_block1.m(t1.parentNode, t1);
|
|
|
|
|
}
|
|
|
|
|
} else if (if_block1) {
|
|
|
|
|
if_block1.d(1);
|
|
|
|
|
if_block1 = null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (/*$sortedFeedsStore*/ ctx[3]) {
|
|
|
|
|
if (if_block2) {
|
|
|
|
|
if_block2.p(ctx, dirty);
|
|
|
|
|
|
|
|
|
|
if (dirty & /*$sortedFeedsStore*/ 8) {
|
|
|
|
|
transition_in(if_block2, 1);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if_block2 = create_if_block(ctx);
|
|
|
|
|
if_block2.c();
|
|
|
|
|
transition_in(if_block2, 1);
|
|
|
|
|
if_block2.m(if_block2_anchor.parentNode, if_block2_anchor);
|
|
|
|
|
}
|
|
|
|
|
} else if (if_block2) {
|
|
|
|
|
group_outros();
|
|
|
|
|
|
|
|
|
|
transition_out(if_block2, 1, 1, () => {
|
|
|
|
|
if_block2 = null;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
check_outros();
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
i(local) {
|
|
|
|
|
if (current) return;
|
|
|
|
|
transition_in(if_block0);
|
|
|
|
|
transition_in(if_block2);
|
|
|
|
|
current = true;
|
|
|
|
|
},
|
|
|
|
|
o(local) {
|
|
|
|
|
transition_out(if_block0);
|
|
|
|
|
transition_out(if_block2);
|
|
|
|
|
current = false;
|
|
|
|
|
},
|
|
|
|
|
d(detaching) {
|
|
|
|
|
if (if_block0) if_block0.d(detaching);
|
|
|
|
|
if (detaching) detach(t0);
|
|
|
|
|
if (if_block1) if_block1.d(detaching);
|
|
|
|
|
if (detaching) detach(t1);
|
|
|
|
|
if (if_block2) if_block2.d(detaching);
|
|
|
|
|
if (detaching) detach(if_block2_anchor);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function instance($$self, $$props, $$invalidate) {
|
|
|
|
|
let $filteredItemsStore;
|
|
|
|
|
let $sortedFeedsStore;
|
|
|
|
|
component_subscribe($$self, filteredItemsStore, $$value => $$invalidate(2, $filteredItemsStore = $$value));
|
|
|
|
|
component_subscribe($$self, sortedFeedsStore, $$value => $$invalidate(3, $sortedFeedsStore = $$value));
|
|
|
|
|
let { plugin } = $$props;
|
|
|
|
|
let foldedState = new Map();
|
|
|
|
|
|
|
|
|
|
function toggleFold(folder) {
|
|
|
|
|
foldedState.set(folder, !foldedState.get(folder));
|
|
|
|
|
$$invalidate(1, foldedState);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const click_handler = () => toggleFold('rss-filters');
|
|
|
|
|
const click_handler_1 = folder => toggleFold('rss-filter' + folder.filter.name);
|
|
|
|
|
const click_handler_2 = () => toggleFold('rss-folders');
|
|
|
|
|
const click_handler_3 = folder => toggleFold(folder);
|
|
|
|
|
|
|
|
|
|
$$self.$$set = $$props => {
|
|
|
|
|
if ('plugin' in $$props) $$invalidate(0, plugin = $$props.plugin);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return [
|
|
|
|
|
plugin,
|
|
|
|
|
foldedState,
|
|
|
|
|
$filteredItemsStore,
|
|
|
|
|
$sortedFeedsStore,
|
|
|
|
|
toggleFold,
|
|
|
|
|
click_handler,
|
|
|
|
|
click_handler_1,
|
|
|
|
|
click_handler_2,
|
|
|
|
|
click_handler_3
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class FolderView extends SvelteComponent {
|
|
|
|
|
constructor(options) {
|
|
|
|
|
super();
|
|
|
|
|
init(this, options, instance, create_fragment, safe_not_equal, { plugin: 0 });
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class ViewLoader extends obsidian.ItemView {
|
|
|
|
|
constructor(leaf, plugin) {
|
|
|
|
|
super(leaf);
|
|
|
|
|
this.plugin = plugin;
|
|
|
|
|
}
|
|
|
|
|
getDisplayText() {
|
|
|
|
|
return "RSS Feeds";
|
|
|
|
|
}
|
|
|
|
|
getViewType() {
|
|
|
|
|
return VIEW_ID;
|
|
|
|
|
}
|
|
|
|
|
getIcon() {
|
|
|
|
|
return "feather-rss";
|
|
|
|
|
}
|
|
|
|
|
onOpen() {
|
|
|
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
|
|
|
this.feed = new FolderView({
|
|
|
|
|
target: this.contentEl,
|
|
|
|
|
props: {
|
|
|
|
|
plugin: this.plugin
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
onClose() {
|
|
|
|
|
if (this.feed) {
|
|
|
|
|
this.feed.$destroy();
|
|
|
|
|
}
|
|
|
|
|
return Promise.resolve();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class RssReaderPlugin extends obsidian.Plugin {
|
|
|
|
|
onload() {
|
|
|
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
|
|
|
console.log('loading plugin rss reader');
|
|
|
|
|
addFeatherIcon("rss");
|
|
|
|
|
addFeatherIcon("eye");
|
|
|
|
|
addFeatherIcon("eye-off");
|
|
|
|
|
addFeatherIcon("star");
|
|
|
|
|
addFeatherIcon("clipboard");
|
|
|
|
|
//update settings whenever store contents change.
|
|
|
|
|
this.register(settingsStore.subscribe((value) => {
|
|
|
|
|
this.settings = value;
|
|
|
|
|
}));
|
|
|
|
|
yield this.loadSettings();
|
|
|
|
|
this.addCommand({
|
|
|
|
|
id: "rss-open",
|
|
|
|
|
name: "Open",
|
|
|
|
|
checkCallback: (checking) => {
|
|
|
|
|
if (checking) {
|
|
|
|
|
return (this.app.workspace.getLeavesOfType(VIEW_ID).length === 0);
|
|
|
|
|
}
|
|
|
|
|
this.initLeaf();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
/* parser not fully implemented
|
|
|
|
|
this.addCommand({
|
|
|
|
|
id: "rss-import",
|
|
|
|
|
name: "Import OPML",
|
|
|
|
|
callback: () => {
|
|
|
|
|
new ImportModal(this.app, this).open();
|
|
|
|
|
}
|
|
|
|
|
});*/
|
|
|
|
|
this.addCommand({
|
|
|
|
|
id: 'rss-refresh',
|
|
|
|
|
name: 'Refresh feeds',
|
|
|
|
|
callback: () => __awaiter(this, void 0, void 0, function* () {
|
|
|
|
|
yield this.updateFeeds();
|
|
|
|
|
})
|
|
|
|
|
});
|
|
|
|
|
this.registerView(VIEW_ID, (leaf) => new ViewLoader(leaf, this));
|
|
|
|
|
this.addSettingTab(new RSSReaderSettingsTab(this.app, this));
|
|
|
|
|
let interval;
|
|
|
|
|
if (this.settings.updateTime !== 0) {
|
|
|
|
|
interval = window.setInterval(() => __awaiter(this, void 0, void 0, function* () {
|
|
|
|
|
yield this.updateFeeds();
|
|
|
|
|
}), this.settings.updateTime * 60 * 1000);
|
|
|
|
|
this.registerInterval(interval);
|
|
|
|
|
}
|
|
|
|
|
//reset update timer on settings change.
|
|
|
|
|
settingsStore.subscribe((settings) => {
|
|
|
|
|
if (interval !== undefined)
|
|
|
|
|
clearInterval(interval);
|
|
|
|
|
if (settings.updateTime != 0) {
|
|
|
|
|
interval = window.setInterval(() => __awaiter(this, void 0, void 0, function* () {
|
|
|
|
|
yield this.updateFeeds();
|
|
|
|
|
}), settings.updateTime * 60 * 1000);
|
|
|
|
|
this.registerInterval(interval);
|
|
|
|
|
}
|
|
|
|
|
this.settings = settings;
|
|
|
|
|
this.saveSettings();
|
|
|
|
|
});
|
|
|
|
|
feedsStore.subscribe((feeds) => {
|
|
|
|
|
//keep sorted store sorted when the items change.
|
|
|
|
|
const sorted = lodash_groupby(feeds, "folder");
|
|
|
|
|
sortedFeedsStore.update(() => sorted);
|
|
|
|
|
let items = [];
|
|
|
|
|
for (const feed in Object.keys(feeds)) {
|
|
|
|
|
items = items.concat(feeds[feed].items);
|
|
|
|
|
}
|
|
|
|
|
this.filterItems(items);
|
|
|
|
|
});
|
|
|
|
|
this.app.workspace.onLayoutReady(() => __awaiter(this, void 0, void 0, function* () {
|
|
|
|
|
yield this.updateFeeds();
|
|
|
|
|
yield this.migrateData();
|
|
|
|
|
yield this.initLeaf();
|
|
|
|
|
}));
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
filterItems(items) {
|
|
|
|
|
const filtered = new Array();
|
|
|
|
|
for (const filter of this.settings.filtered) {
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
const filterType = FilterType[filter.filterType];
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
const sortOrder = SortOrder[filter.sortOrder];
|
|
|
|
|
let filteredItems;
|
|
|
|
|
if (filterType == FilterType.READ) {
|
|
|
|
|
filteredItems = items.filter((item) => {
|
|
|
|
|
return item.read && (filter.filterContent.split(",").contains(item.folder) || filter.filterContent.length == 0);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
if (filterType == FilterType.FAVORITES) {
|
|
|
|
|
filteredItems = items.filter((item) => {
|
|
|
|
|
return item.favorite && (filter.filterContent.split(",").contains(item.folder) || filter.filterContent.length == 0);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
if (filterType == FilterType.UNREAD) {
|
|
|
|
|
filteredItems = items.filter((item) => {
|
|
|
|
|
return !item.read && (filter.filterContent.split(",").contains(item.folder) || filter.filterContent.length == 0);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
if (filterType == FilterType.TAGS) {
|
|
|
|
|
filteredItems = items.filter((item) => {
|
|
|
|
|
return item.tags.some((tag) => filter.filterContent.split(",").contains(tag));
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
const sortedItems = this.sortItems(filteredItems, sortOrder);
|
|
|
|
|
filtered.push({ filter: filter, items: { items: sortedItems } });
|
|
|
|
|
}
|
|
|
|
|
filteredItemsStore.update(() => filtered);
|
|
|
|
|
}
|
|
|
|
|
sortItems(items, sortOrder) {
|
|
|
|
|
if (sortOrder === SortOrder.ALPHABET_NORMAL) {
|
|
|
|
|
return items.sort((a, b) => a.title.localeCompare(b.title));
|
|
|
|
|
}
|
|
|
|
|
if (sortOrder === SortOrder.ALPHABET_INVERTED) {
|
|
|
|
|
return items.sort((a, b) => b.title.localeCompare(a.title));
|
|
|
|
|
}
|
|
|
|
|
if (sortOrder === SortOrder.DATE_NEWEST) {
|
|
|
|
|
//@ts-ignore
|
|
|
|
|
return items.sort((a, b) => window.moment(b.pubDate) - window.moment(a.pubDate));
|
|
|
|
|
}
|
|
|
|
|
if (sortOrder === SortOrder.DATE_OLDEST) {
|
|
|
|
|
//@ts-ignore
|
|
|
|
|
return items.sort((a, b) => window.moment(a.pubDate) - window.moment(b.pubDate));
|
|
|
|
|
}
|
|
|
|
|
return items;
|
|
|
|
|
}
|
|
|
|
|
updateFeeds() {
|
|
|
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
|
|
|
let result = [];
|
|
|
|
|
for (const feed of this.settings.feeds) {
|
|
|
|
|
const items = yield getFeedItems(feed);
|
|
|
|
|
result.push(items);
|
|
|
|
|
}
|
|
|
|
|
result = Object.assign({}, result, this.settings.items);
|
|
|
|
|
yield this.writeFeedContent(() => result);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
onunload() {
|
|
|
|
|
console.log('unloading plugin rss reader');
|
|
|
|
|
this.app.workspace
|
|
|
|
|
.getLeavesOfType(VIEW_ID)
|
|
|
|
|
.forEach((leaf) => leaf.detach());
|
|
|
|
|
}
|
|
|
|
|
initLeaf() {
|
|
|
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
|
|
|
if (this.app.workspace.getLeavesOfType(VIEW_ID).length > 0) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
yield this.app.workspace.getRightLeaf(false).setViewState({
|
|
|
|
|
type: VIEW_ID,
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
//migrate from old settings pre 0.6.0
|
|
|
|
|
migrateData() {
|
|
|
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
|
|
|
const configPath = this.app.vault.configDir + "/plugins/rss-reader/data.json";
|
|
|
|
|
const config = JSON.parse(yield this.app.vault.adapter.read(configPath));
|
|
|
|
|
if (config.read === undefined)
|
|
|
|
|
return;
|
|
|
|
|
new obsidian.Notice("RSS Reader: migrating data");
|
|
|
|
|
for (const content of Object.values(config.items)) {
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
for (const item of content.items) {
|
|
|
|
|
if (config.read.items.some((readItem) => {
|
|
|
|
|
return item.title == readItem.title && item.link == readItem.link && item.content == readItem.content;
|
|
|
|
|
})) {
|
|
|
|
|
item.read = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
for (const item of content.items) {
|
|
|
|
|
if (config.favorites.items.some((favItem) => {
|
|
|
|
|
return item.title == favItem.title && item.link == favItem.link && item.content == favItem.content;
|
|
|
|
|
})) {
|
|
|
|
|
item.favorite = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
delete config.read;
|
|
|
|
|
delete config.favorites;
|
|
|
|
|
yield this.app.vault.adapter.write(configPath, JSON.stringify(config));
|
|
|
|
|
yield this.loadSettings();
|
|
|
|
|
new obsidian.Notice("RSS Reader: data has been migrated");
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
loadSettings() {
|
|
|
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
|
|
|
this.settings = Object.assign({}, DEFAULT_SETTINGS, yield this.loadData());
|
|
|
|
|
settingsStore.set(this.settings);
|
|
|
|
|
configuredFeedsStore.set(this.settings.feeds);
|
|
|
|
|
feedsStore.set(this.settings.items);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
saveSettings() {
|
|
|
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
|
|
|
yield this.saveData(this.settings);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
writeFeeds(changeOpts) {
|
|
|
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
|
|
|
yield configuredFeedsStore.update((old) => (Object.assign(Object.assign({}, old), changeOpts(old))));
|
|
|
|
|
yield this.writeSettings((old) => ({
|
|
|
|
|
feeds: changeOpts(old.feeds)
|
|
|
|
|
}));
|
|
|
|
|
yield this.updateFeeds();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
writeFeedContent(changeOpts) {
|
|
|
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
|
|
|
yield feedsStore.update((old) => (Object.assign(Object.assign({}, old), changeOpts(old))));
|
|
|
|
|
yield this.writeSettings((old) => ({
|
|
|
|
|
items: changeOpts(old.items)
|
|
|
|
|
}));
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
writeFiltered(changeOpts) {
|
|
|
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
|
|
|
yield filteredStore.update((old) => (Object.assign(Object.assign({}, old), changeOpts(old))));
|
|
|
|
|
yield this.writeSettings((old) => ({
|
|
|
|
|
filtered: changeOpts(old.filtered)
|
|
|
|
|
}));
|
|
|
|
|
yield this.updateFeeds();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
writeSettings(changeOpts) {
|
|
|
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
|
|
|
yield settingsStore.update((old) => (Object.assign(Object.assign({}, old), changeOpts(old))));
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
module.exports = RssReaderPlugin;
|
|
|
|
|
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWFpbi5qcyIsInNvdXJjZXMiOlsibm9kZV9tb2R1bGVzL3RzbGliL3RzbGliLmVzNi5qcyIsInNyYy9wYXJzZXIvcnNzUGFyc2VyLnRzIiwic3JjL2NvbnN0cy50cyIsInNyYy9tb2RhbHMvQmFzZU1vZGFsLnRzIiwic3JjL21vZGFscy9GZWVkTW9kYWwudHMiLCJub2RlX21vZHVsZXMvbG9kYXNoLmdyb3VwYnkvaW5kZXguanMiLCJub2RlX21vZHVsZXMvQHBvcHBlcmpzL2NvcmUvbGliL2VudW1zLmpzIiwibm9kZV9tb2R1bGVzL0Bwb3BwZXJqcy9jb3JlL2xpYi9kb20tdXRpbHMvZ2V0Tm9kZU5hbWUuanMiLCJub2RlX21vZHVsZXMvQHBvcHBlcmpzL2NvcmUvbGliL2RvbS11dGlscy9nZXRXaW5kb3cuanMiLCJub2RlX21vZHVsZXMvQHBvcHBlcmpzL2NvcmUvbGliL2RvbS11dGlscy9pbnN0YW5jZU9mLmpzIiwibm9kZV9tb2R1bGVzL0Bwb3BwZXJqcy9jb3JlL2xpYi9tb2RpZmllcnMvYXBwbHlTdHlsZXMuanMiLCJub2RlX21vZHVsZXMvQHBvcHBlcmpzL2NvcmUvbGliL3V0aWxzL2dldEJhc2VQbGFjZW1lbnQuanMiLCJub2RlX21vZHVsZXMvQHBvcHBlcmpzL2NvcmUvbGliL2RvbS11dGlscy9nZXRCb3VuZGluZ0NsaWVudFJlY3QuanMiLCJub2RlX21vZHVsZXMvQHBvcHBlcmpzL2NvcmUvbGliL2RvbS11dGlscy9nZXRMYXlvdXRSZWN0LmpzIiwibm9kZV9tb2R1bGVzL0Bwb3BwZXJqcy9jb3JlL2xpYi9kb20tdXRpbHMvY29udGFpbnMuanMiLCJub2RlX21vZHVsZXMvQHBvcHBlcmpzL2NvcmUvbGliL2RvbS11dGlscy9nZXRDb21wdXRlZFN0eWxlLmpzIiwibm9kZV9tb2R1bGVzL0Bwb3BwZXJqcy9jb3JlL2xpYi9kb20tdXRpbHMvaXNUYWJsZUVsZW1lbnQuanMiLCJub2RlX21vZHVsZXMvQHBvcHBlcmpzL2NvcmUvbGliL2RvbS11dGlscy9nZXREb2N1bWVudEVsZW1lbnQuanMiLCJub2RlX21vZHVsZXMvQHBvcHBlcmpzL2NvcmUvbGliL2RvbS11dGlscy9nZXRQYXJlbnROb2RlLmpzIiwibm9kZV9tb2R1bGVzL0Bwb3BwZXJqcy9jb3JlL2xpYi9kb20tdXRpbHMvZ2V0T2Zmc2V0UGFyZW50LmpzIiwibm9kZV9tb2R1bGVzL0Bwb3BwZXJqcy9jb3JlL2xpYi91dGlscy9nZXRNYWluQXhpc0Zyb21QbGFjZW1lbnQuanMiLCJub2RlX21vZHVsZXMvQHBvcHBlcmpzL2NvcmUvbGliL3V0aWxzL21hdGguanMiLCJub2RlX21vZHVsZXMvQHBvcHBlcmpzL2NvcmUvbGliL3V0aWxzL3dpdGhpbi5qcyIsIm5vZGVfbW9kdWxlcy9AcG9wcGVyanMvY29yZS9saWIvdXRpbHMvZ2V0RnJlc2hTaWRlT2JqZWN0LmpzIiwibm9kZV9tb2R1bGVzL0Bwb3BwZXJqcy9jb3JlL2xpYi91dGlscy9tZXJnZVBhZGRpbmdPYmplY3QuanMiLCJub2RlX21vZHVsZXMvQHBvcHBlcmpzL2NvcmUvbGliL3V0aWxzL2V4cGFuZFRvSGFzaE1hcC5qcyIsIm5vZGVfbW9kdWxlcy9AcG9wcGVyanMvY29yZS9saWIvbW9kaWZpZXJzL2Fycm93LmpzIiwibm9kZV9tb2R1bGVzL0Bwb3BwZXJqcy9jb3JlL2xpYi91dGlscy9nZXRWYXJpYXRpb24uanMiLCJub2RlX21vZHVsZXMvQHBvcHBlcmpzL2NvcmUvbGliL21vZGlmaWVycy9jb21wdXRlU3R5bGVzLmpzIiwibm9kZV9tb2R1bGVzL0Bwb3BwZXJqcy9jb3JlL2xpYi9tb2RpZmllcnMvZXZlbnRMaXN0ZW5lcnMuanMiLCJub2RlX21vZHVsZXMvQHBvcHBlcmpzL2NvcmUvbGliL3V0aWxzL2dldE9wcG9zaXRlUGxhY2VtZW50LmpzIiwibm9kZV9tb2R1bGVzL0Bwb3BwZXJqcy9jb3JlL2xpYi91dGlscy9nZXRPcHBvc2l0ZVZhcmlhdGlvblBsYWNlbWVudC5qcyIsIm5vZGVfbW9kdWxlcy9AcG9wcGVyanMvY29yZS9saWIvZG9tLXV0aWxzL2dldFdpbmRvd1Njcm9sbC5qcyIsIm5vZGVfbW9kdWxlcy9AcG9wcGVyanMvY29yZS9saWIvZG9tLXV0aWxzL2dldFdpbmRvd1Njcm9sbEJhclguanMiLCJub2RlX21vZHVsZXMvQHBvcHBlcmpzL2NvcmUvbGliL2RvbS11dGlscy9nZXRWaWV3cG9ydFJlY3QuanMiLCJub2RlX21vZHVsZXMvQHBvcHBlcmpzL2NvcmUvbGliL2RvbS11dGlscy9nZXREb2N1bWVudFJlY3QuanMiLCJub2RlX21vZHVsZXMvQHBvcHBlcmpzL2NvcmUvbGliL2RvbS11dGlscy9pc1Njcm9sbFBhcmVudC5qcyIsIm5vZGVfbW9kdWxlcy9AcG9wcGVyanMvY29yZS9saWIvZG9tLXV0aWxzL2dldFNjcm9sbFBhcmVudC5qcyIsIm5vZGVfbW9kdWxlcy9AcG9wcGVyanMvY29yZS9saWIvZG9tLXV0aWxzL2xpc3RTY3JvbGxQYXJlbnRzLmpzIiwibm9kZV9tb2R1bGVzL0Bwb3BwZXJqcy9jb3JlL2xpYi91dGlscy9yZWN0VG9DbGllbnRSZWN0LmpzIiwibm9kZV9tb2R1bGVzL0Bwb3BwZXJqcy9jb3JlL2xpYi9kb20tdXRpbHMvZ2V0Q2xpcHBpbmdSZWN0LmpzIiwibm9kZV9tb2R1bGVzL0Bwb3BwZXJqcy9jb3JlL2xpYi91dGlscy9jb21wdXRlT2Zmc2V0cy5qcyIsIm5vZGVfbW9kdWxlcy9AcG9wcGVyanMvY29yZS9saWIvdXRpbHMvZGV0ZWN0T3ZlcmZsb3cuanMiLCJub2RlX21vZHVsZXMvQHBvcHBlcmpzL2NvcmUvbGliL3V0aWxzL2NvbXB1dGVBdXRvUGxhY2VtZW50LmpzIiwibm9kZV9tb2R1bGVzL0Bwb3BwZXJqcy9jb3JlL2xpYi9tb2RpZmllcnMvZmxpcC5qcyIsIm5vZGVfbW9kdWxlcy9AcG9wcGVyanMvY29yZS9saWIvbW9kaWZpZXJzL2hpZGUuanMiLCJub2RlX21vZHVsZXMvQHBvcHBlcmpzL2NvcmUvbGliL21vZGlmaWVycy9vZmZzZXQuanMiLCJub2RlX21vZHVsZXMvQHBvcHBlcmpzL2NvcmUvbGliL21vZGlmaWVycy9wb3BwZXJPZmZzZXRzLmpzIiwibm9kZV9tb2R1bGVzL0Bwb3BwZXJqcy9jb3JlL2xpYi91dGlscy9nZXRBbHRBeGlzLmpzIiwibm9kZV9tb2R1bGVzL0Bwb3BwZXJqcy9jb3JlL2xpYi9tb2RpZmllcnMvcHJldmVudE92ZXJmbG93LmpzIiwibm9kZV9tb2R1bGVzL0Bwb3BwZXJqcy9jb3JlL2xpYi9kb20tdXRpbHMvZ2V0SFRNTEVsZW1lbnRTY3JvbGwuanMiLCJub2RlX21vZHVsZXMvQHBvcHBlcmpzL2NvcmUvbGliL2RvbS11dGlscy9nZXROb2RlU2Nyb2xsLmpzIiwibm9kZV9tb2R1bGVzL0Bwb3BwZXJqcy9jb3JlL2xpYi9kb20tdXRpbHMvZ2V
|