You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

5243 lines
918 KiB

3 years ago
'use strict';
var obsidian = require('obsidian');
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
var obsidian__default = /*#__PURE__*/_interopDefaultLegacy(obsidian);
/******************************************************************************
3 years ago
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.
***************************************************************************** */
/* global Reflect, Promise */
var extendStatics = function(d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
function __extends(d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
}
2 years ago
var __assign = function() {
__assign = Object.assign || function __assign(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
3 years ago
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());
});
}
function __generator(thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (g && (g = 0, op[0] && (_ = 0)), _) try {
3 years ago
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
}
2 years ago
function __spreadArray(to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
3 years ago
}
3 years ago
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
3 years ago
function createCommonjsModule(fn, basedir, module) {
return module = {
path: basedir,
exports: {},
require: function (path, base) {
return commonjsRequire(path, (base === undefined || base === null) ? module.path : base);
}
}, fn(module, module.exports), module.exports;
}
3 years ago
function commonjsRequire () {
throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');
}
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, table, 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 */
3 years ago
/***/ (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
3 years ago
/***/ }),
/***/ "./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, chevron-down, chevron-up, 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 */
3 years ago
/***/ (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"],"chevron-down":["expand"],"chevron-up":["collapse"],"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","h
3 years ago
/***/ }),
/***/ "./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);
3 years ago
}
3 years ago
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/runner/work/feather/feather/src/index.js */"./src/index.js");
3 years ago
/***/ })
/******/ });
});
});
/**
* This module contains various utility functions commonly used in Obsidian plugins.
* @module obsidian-community-lib
*/
/**
* Strip '.md' off the end of a note name to get its basename.
*
* Works with the edgecase where a note has '.md' in its basename: `Obsidian.md.md`, for example.
* @param {string} noteName with or without '.md' on the end.
* @returns {string} noteName without '.md'
*/
const stripMD = (noteName) => {
2 years ago
if (noteName.match(/\.MD$|\.md$/m)) {
return noteName.split(/\.MD$|\.md$/m).slice(0, -1).join(".md");
3 years ago
}
else
return noteName;
};
3 years ago
var main = createCommonjsModule(function (module, exports) {
Object.defineProperty(exports, '__esModule', { value: true });
const DEFAULT_DAILY_NOTE_FORMAT = "YYYY-MM-DD";
const DEFAULT_WEEKLY_NOTE_FORMAT = "gggg-[W]ww";
const DEFAULT_MONTHLY_NOTE_FORMAT = "YYYY-MM";
const DEFAULT_QUARTERLY_NOTE_FORMAT = "YYYY-[Q]Q";
const DEFAULT_YEARLY_NOTE_FORMAT = "YYYY";
function shouldUsePeriodicNotesSettings(periodicity) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const periodicNotes = window.app.plugins.getPlugin("periodic-notes");
return periodicNotes && periodicNotes.settings?.[periodicity]?.enabled;
}
/**
* Read the user settings for the `daily-notes` plugin
* to keep behavior of creating a new note in-sync.
*/
function getDailyNoteSettings() {
try {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const { internalPlugins, plugins } = window.app;
if (shouldUsePeriodicNotesSettings("daily")) {
const { format, folder, template } = plugins.getPlugin("periodic-notes")?.settings?.daily || {};
return {
format: format || DEFAULT_DAILY_NOTE_FORMAT,
folder: folder?.trim() || "",
template: template?.trim() || "",
};
}
const { folder, format, template } = internalPlugins.getPluginById("daily-notes")?.instance?.options || {};
return {
format: format || DEFAULT_DAILY_NOTE_FORMAT,
folder: folder?.trim() || "",
template: template?.trim() || "",
};
}
catch (err) {
console.info("No custom daily note settings found!", err);
}
}
/**
* Read the user settings for the `weekly-notes` plugin
* to keep behavior of creating a new note in-sync.
*/
function getWeeklyNoteSettings() {
try {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const pluginManager = window.app.plugins;
const calendarSettings = pluginManager.getPlugin("calendar")?.options;
const periodicNotesSettings = pluginManager.getPlugin("periodic-notes")?.settings?.weekly;
if (shouldUsePeriodicNotesSettings("weekly")) {
return {
format: periodicNotesSettings.format || DEFAULT_WEEKLY_NOTE_FORMAT,
folder: periodicNotesSettings.folder?.trim() || "",
template: periodicNotesSettings.template?.trim() || "",
};
}
const settings = calendarSettings || {};
return {
format: settings.weeklyNoteFormat || DEFAULT_WEEKLY_NOTE_FORMAT,
folder: settings.weeklyNoteFolder?.trim() || "",
template: settings.weeklyNoteTemplate?.trim() || "",
};
}
catch (err) {
console.info("No custom weekly note settings found!", err);
}
}
/**
* Read the user settings for the `periodic-notes` plugin
* to keep behavior of creating a new note in-sync.
*/
function getMonthlyNoteSettings() {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const pluginManager = window.app.plugins;
try {
const settings = (shouldUsePeriodicNotesSettings("monthly") &&
pluginManager.getPlugin("periodic-notes")?.settings?.monthly) ||
{};
return {
format: settings.format || DEFAULT_MONTHLY_NOTE_FORMAT,
folder: settings.folder?.trim() || "",
template: settings.template?.trim() || "",
};
}
catch (err) {
console.info("No custom monthly note settings found!", err);
}
}
/**
* Read the user settings for the `periodic-notes` plugin
* to keep behavior of creating a new note in-sync.
*/
function getQuarterlyNoteSettings() {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const pluginManager = window.app.plugins;
try {
const settings = (shouldUsePeriodicNotesSettings("quarterly") &&
pluginManager.getPlugin("periodic-notes")?.settings?.quarterly) ||
{};
return {
format: settings.format || DEFAULT_QUARTERLY_NOTE_FORMAT,
folder: settings.folder?.trim() || "",
template: settings.template?.trim() || "",
};
}
catch (err) {
console.info("No custom quarterly note settings found!", err);
}
}
/**
* Read the user settings for the `periodic-notes` plugin
* to keep behavior of creating a new note in-sync.
*/
function getYearlyNoteSettings() {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const pluginManager = window.app.plugins;
try {
const settings = (shouldUsePeriodicNotesSettings("yearly") &&
pluginManager.getPlugin("periodic-notes")?.settings?.yearly) ||
{};
return {
format: settings.format || DEFAULT_YEARLY_NOTE_FORMAT,
folder: settings.folder?.trim() || "",
template: settings.template?.trim() || "",
};
}
catch (err) {
console.info("No custom yearly note settings found!", err);
}
}
// Credit: @creationix/path.js
function join(...partSegments) {
// Split the inputs into a list of path commands.
let parts = [];
for (let i = 0, l = partSegments.length; i < l; i++) {
parts = parts.concat(partSegments[i].split("/"));
}
// Interpret the path commands to get the new resolved path.
const newParts = [];
for (let i = 0, l = parts.length; i < l; i++) {
const part = parts[i];
// Remove leading and trailing slashes
// Also remove "." segments
if (!part || part === ".")
continue;
// Push new path segments.
else
newParts.push(part);
}
// Preserve the initial slash if there was one.
if (parts[0] === "")
newParts.unshift("");
// Turn back into a single string path.
return newParts.join("/");
}
function basename(fullPath) {
let base = fullPath.substring(fullPath.lastIndexOf("/") + 1);
if (base.lastIndexOf(".") != -1)
base = base.substring(0, base.lastIndexOf("."));
return base;
}
async function ensureFolderExists(path) {
const dirs = path.replace(/\\/g, "/").split("/");
dirs.pop(); // remove basename
if (dirs.length) {
const dir = join(...dirs);
if (!window.app.vault.getAbstractFileByPath(dir)) {
await window.app.vault.createFolder(dir);
}
}
}
async function getNotePath(directory, filename) {
if (!filename.endsWith(".md")) {
filename += ".md";
}
const path = obsidian__default["default"].normalizePath(join(directory, filename));
await ensureFolderExists(path);
return path;
}
async function getTemplateInfo(template) {
const { metadataCache, vault } = window.app;
const templatePath = obsidian__default["default"].normalizePath(template);
if (templatePath === "/") {
return Promise.resolve(["", null]);
}
try {
const templateFile = metadataCache.getFirstLinkpathDest(templatePath, "");
const contents = await vault.cachedRead(templateFile);
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const IFoldInfo = window.app.foldManager.load(templateFile);
return [contents, IFoldInfo];
}
catch (err) {
console.error(`Failed to read the daily note template '${templatePath}'`, err);
new obsidian__default["default"].Notice("Failed to read the daily note template");
return ["", null];
}
}
/**
* dateUID is a way of weekly identifying daily/weekly/monthly notes.
* They are prefixed with the granularity to avoid ambiguity.
*/
function getDateUID(date, granularity = "day") {
const ts = date.clone().startOf(granularity).format();
return `${granularity}-${ts}`;
}
function removeEscapedCharacters(format) {
return format.replace(/\[[^\]]*\]/g, ""); // remove everything within brackets
}
/**
* XXX: When parsing dates that contain both week numbers and months,
* Moment choses to ignore the week numbers. For the week dateUID, we
* want the opposite behavior. Strip the MMM from the format to patch.
*/
function isFormatAmbiguous(format, granularity) {
if (granularity === "week") {
const cleanFormat = removeEscapedCharacters(format);
return (/w{1,2}/i.test(cleanFormat) &&
(/M{1,4}/.test(cleanFormat) || /D{1,4}/.test(cleanFormat)));
}
return false;
}
function getDateFromFile(file, granularity) {
return getDateFromFilename(file.basename, granularity);
}
function getDateFromPath(path, granularity) {
return getDateFromFilename(basename(path), granularity);
}
function getDateFromFilename(filename, granularity) {
const getSettings = {
day: getDailyNoteSettings,
week: getWeeklyNoteSettings,
month: getMonthlyNoteSettings,
quarter: getQuarterlyNoteSettings,
year: getYearlyNoteSettings,
};
const format = getSettings[granularity]().format.split("/").pop();
const noteDate = window.moment(filename, format, true);
if (!noteDate.isValid()) {
return null;
}
if (isFormatAmbiguous(format, granularity)) {
if (granularity === "week") {
const cleanFormat = removeEscapedCharacters(format);
if (/w{1,2}/i.test(cleanFormat)) {
return window.moment(filename,
// If format contains week, remove day & month formatting
format.replace(/M{1,4}/g, "").replace(/D{1,4}/g, ""), false);
}
}
}
return noteDate;
}
class DailyNotesFolderMissingError extends Error {
}
/**
* This function mimics the behavior of the daily-notes plugin
* so it will replace {{date}}, {{title}}, and {{time}} with the
* formatted timestamp.
*
* Note: it has an added bonus that it's not 'today' specific.
*/
async function createDailyNote(date) {
const app = window.app;
const { vault } = app;
const moment = window.moment;
const { template, format, folder } = getDailyNoteSettings();
const [templateContents, IFoldInfo] = await getTemplateInfo(template);
const filename = date.format(format);
const normalizedPath = await getNotePath(folder, filename);
try {
const createdFile = await vault.create(normalizedPath, templateContents
.replace(/{{\s*date\s*}}/gi, filename)
.replace(/{{\s*time\s*}}/gi, moment().format("HH:mm"))
.replace(/{{\s*title\s*}}/gi, filename)
.replace(/{{\s*(date|time)\s*(([+-]\d+)([yqmwdhs]))?\s*(:.+?)?}}/gi, (_, _timeOrDate, calc, timeDelta, unit, momentFormat) => {
const now = moment();
const currentDate = date.clone().set({
hour: now.get("hour"),
minute: now.get("minute"),
second: now.get("second"),
});
if (calc) {
currentDate.add(parseInt(timeDelta, 10), unit);
}
if (momentFormat) {
return currentDate.format(momentFormat.substring(1).trim());
}
return currentDate.format(format);
})
.replace(/{{\s*yesterday\s*}}/gi, date.clone().subtract(1, "day").format(format))
.replace(/{{\s*tomorrow\s*}}/gi, date.clone().add(1, "d").format(format)));
// eslint-disable-next-line @typescript-eslint/no-explicit-any
app.foldManager.save(createdFile, IFoldInfo);
return createdFile;
}
catch (err) {
console.error(`Failed to create file: '${normalizedPath}'`, err);
new obsidian__default["default"].Notice("Unable to create new file.");
}
}
function getDailyNote(date, dailyNotes) {
return dailyNotes[getDateUID(date, "day")] ?? null;
}
function getAllDailyNotes() {
/**
* Find all daily notes in the daily note folder
*/
const { vault } = window.app;
const { folder } = getDailyNoteSettings();
const dailyNotesFolder = vault.getAbstractFileByPath(obsidian__default["default"].normalizePath(folder));
if (!dailyNotesFolder) {
throw new DailyNotesFolderMissingError("Failed to find daily notes folder");
}
const dailyNotes = {};
obsidian__default["default"].Vault.recurseChildren(dailyNotesFolder, (note) => {
if (note instanceof obsidian__default["default"].TFile) {
const date = getDateFromFile(note, "day");
if (date) {
const dateString = getDateUID(date, "day");
dailyNotes[dateString] = note;
}
}
});
return dailyNotes;
}
class WeeklyNotesFolderMissingError extends Error {
}
function getDaysOfWeek() {
const { moment } = window;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
let weekStart = moment.localeData()._week.dow;
const daysOfWeek = [
"sunday",
"monday",
"tuesday",
"wednesday",
"thursday",
"friday",
"saturday",
];
while (weekStart) {
daysOfWeek.push(daysOfWeek.shift());
weekStart--;
}
return daysOfWeek;
}
function getDayOfWeekNumericalValue(dayOfWeekName) {
return getDaysOfWeek().indexOf(dayOfWeekName.toLowerCase());
}
async function createWeeklyNote(date) {
const { vault } = window.app;
const { template, format, folder } = getWeeklyNoteSettings();
const [templateContents, IFoldInfo] = await getTemplateInfo(template);
const filename = date.format(format);
const normalizedPath = await getNotePath(folder, filename);
try {
const createdFile = await vault.create(normalizedPath, templateContents
.replace(/{{\s*(date|time)\s*(([+-]\d+)([yqmwdhs]))?\s*(:.+?)?}}/gi, (_, _timeOrDate, calc, timeDelta, unit, momentFormat) => {
const now = window.moment();
const currentDate = date.clone().set({
hour: now.get("hour"),
minute: now.get("minute"),
second: now.get("second"),
});
if (calc) {
currentDate.add(parseInt(timeDelta, 10), unit);
}
if (momentFormat) {
return currentDate.format(momentFormat.substring(1).trim());
}
return currentDate.format(format);
})
.replace(/{{\s*title\s*}}/gi, filename)
.replace(/{{\s*time\s*}}/gi, window.moment().format("HH:mm"))
.replace(/{{\s*(sunday|monday|tuesday|wednesday|thursday|friday|saturday)\s*:(.*?)}}/gi, (_, dayOfWeek, momentFormat) => {
const day = getDayOfWeekNumericalValue(dayOfWeek);
return date.weekday(day).format(momentFormat.trim());
}));
// eslint-disable-next-line @typescript-eslint/no-explicit-any
window.app.foldManager.save(createdFile, IFoldInfo);
return createdFile;
}
catch (err) {
console.error(`Failed to create file: '${normalizedPath}'`, err);
new obsidian__default["default"].Notice("Unable to create new file.");
}
}
function getWeeklyNote(date, weeklyNotes) {
return weeklyNotes[getDateUID(date, "week")] ?? null;
}
function getAllWeeklyNotes() {
const weeklyNotes = {};
if (!appHasWeeklyNotesPluginLoaded()) {
return weeklyNotes;
}
const { vault } = window.app;
const { folder } = getWeeklyNoteSettings();
const weeklyNotesFolder = vault.getAbstractFileByPath(obsidian__default["default"].normalizePath(folder));
if (!weeklyNotesFolder) {
throw new WeeklyNotesFolderMissingError("Failed to find weekly notes folder");
}
obsidian__default["default"].Vault.recurseChildren(weeklyNotesFolder, (note) => {
if (note instanceof obsidian__default["default"].TFile) {
const date = getDateFromFile(note, "week");
if (date) {
const dateString = getDateUID(date, "week");
weeklyNotes[dateString] = note;
}
}
});
return weeklyNotes;
}
class MonthlyNotesFolderMissingError extends Error {
}
/**
* This function mimics the behavior of the daily-notes plugin
* so it will replace {{date}}, {{title}}, and {{time}} with the
* formatted timestamp.
*
* Note: it has an added bonus that it's not 'today' specific.
*/
async function createMonthlyNote(date) {
const { vault } = window.app;
const { template, format, folder } = getMonthlyNoteSettings();
const [templateContents, IFoldInfo] = await getTemplateInfo(template);
const filename = date.format(format);
const normalizedPath = await getNotePath(folder, filename);
try {
const createdFile = await vault.create(normalizedPath, templateContents
.replace(/{{\s*(date|time)\s*(([+-]\d+)([yqmwdhs]))?\s*(:.+?)?}}/gi, (_, _timeOrDate, calc, timeDelta, unit, momentFormat) => {
const now = window.moment();
const currentDate = date.clone().set({
hour: now.get("hour"),
minute: now.get("minute"),
second: now.get("second"),
});
if (calc) {
currentDate.add(parseInt(timeDelta, 10), unit);
}
if (momentFormat) {
return currentDate.format(momentFormat.substring(1).trim());
}
return currentDate.format(format);
})
.replace(/{{\s*date\s*}}/gi, filename)
.replace(/{{\s*time\s*}}/gi, window.moment().format("HH:mm"))
.replace(/{{\s*title\s*}}/gi, filename));
// eslint-disable-next-line @typescript-eslint/no-explicit-any
window.app.foldManager.save(createdFile, IFoldInfo);
return createdFile;
}
catch (err) {
console.error(`Failed to create file: '${normalizedPath}'`, err);
new obsidian__default["default"].Notice("Unable to create new file.");
}
}
function getMonthlyNote(date, monthlyNotes) {
return monthlyNotes[getDateUID(date, "month")] ?? null;
}
function getAllMonthlyNotes() {
const monthlyNotes = {};
if (!appHasMonthlyNotesPluginLoaded()) {
return monthlyNotes;
}
const { vault } = window.app;
const { folder } = getMonthlyNoteSettings();
const monthlyNotesFolder = vault.getAbstractFileByPath(obsidian__default["default"].normalizePath(folder));
if (!monthlyNotesFolder) {
throw new MonthlyNotesFolderMissingError("Failed to find monthly notes folder");
}
obsidian__default["default"].Vault.recurseChildren(monthlyNotesFolder, (note) => {
if (note instanceof obsidian__default["default"].TFile) {
const date = getDateFromFile(note, "month");
if (date) {
const dateString = getDateUID(date, "month");
monthlyNotes[dateString] = note;
}
}
});
return monthlyNotes;
}
class QuarterlyNotesFolderMissingError extends Error {
}
/**
* This function mimics the behavior of the daily-notes plugin
* so it will replace {{date}}, {{title}}, and {{time}} with the
* formatted timestamp.
*
* Note: it has an added bonus that it's not 'today' specific.
*/
async function createQuarterlyNote(date) {
const { vault } = window.app;
const { template, format, folder } = getQuarterlyNoteSettings();
const [templateContents, IFoldInfo] = await getTemplateInfo(template);
const filename = date.format(format);
const normalizedPath = await getNotePath(folder, filename);
try {
const createdFile = await vault.create(normalizedPath, templateContents
.replace(/{{\s*(date|time)\s*(([+-]\d+)([yqmwdhs]))?\s*(:.+?)?}}/gi, (_, _timeOrDate, calc, timeDelta, unit, momentFormat) => {
const now = window.moment();
const currentDate = date.clone().set({
hour: now.get("hour"),
minute: now.get("minute"),
second: now.get("second"),
});
if (calc) {
currentDate.add(parseInt(timeDelta, 10), unit);
}
if (momentFormat) {
return currentDate.format(momentFormat.substring(1).trim());
}
return currentDate.format(format);
})
.replace(/{{\s*date\s*}}/gi, filename)
.replace(/{{\s*time\s*}}/gi, window.moment().format("HH:mm"))
.replace(/{{\s*title\s*}}/gi, filename));
// eslint-disable-next-line @typescript-eslint/no-explicit-any
window.app.foldManager.save(createdFile, IFoldInfo);
return createdFile;
}
catch (err) {
console.error(`Failed to create file: '${normalizedPath}'`, err);
new obsidian__default["default"].Notice("Unable to create new file.");
}
}
function getQuarterlyNote(date, quarterly) {
return quarterly[getDateUID(date, "quarter")] ?? null;
}
function getAllQuarterlyNotes() {
const quarterly = {};
if (!appHasQuarterlyNotesPluginLoaded()) {
return quarterly;
}
const { vault } = window.app;
const { folder } = getQuarterlyNoteSettings();
const quarterlyFolder = vault.getAbstractFileByPath(obsidian__default["default"].normalizePath(folder));
if (!quarterlyFolder) {
throw new QuarterlyNotesFolderMissingError("Failed to find quarterly notes folder");
}
obsidian__default["default"].Vault.recurseChildren(quarterlyFolder, (note) => {
if (note instanceof obsidian__default["default"].TFile) {
const date = getDateFromFile(note, "quarter");
if (date) {
const dateString = getDateUID(date, "quarter");
quarterly[dateString] = note;
}
}
});
return quarterly;
}
class YearlyNotesFolderMissingError extends Error {
}
/**
* This function mimics the behavior of the daily-notes plugin
* so it will replace {{date}}, {{title}}, and {{time}} with the
* formatted timestamp.
*
* Note: it has an added bonus that it's not 'today' specific.
*/
async function createYearlyNote(date) {
const { vault } = window.app;
const { template, format, folder } = getYearlyNoteSettings();
const [templateContents, IFoldInfo] = await getTemplateInfo(template);
const filename = date.format(format);
const normalizedPath = await getNotePath(folder, filename);
try {
const createdFile = await vault.create(normalizedPath, templateContents
.replace(/{{\s*(date|time)\s*(([+-]\d+)([yqmwdhs]))?\s*(:.+?)?}}/gi, (_, _timeOrDate, calc, timeDelta, unit, momentFormat) => {
const now = window.moment();
const currentDate = date.clone().set({
hour: now.get("hour"),
minute: now.get("minute"),
second: now.get("second"),
});
if (calc) {
currentDate.add(parseInt(timeDelta, 10), unit);
}
if (momentFormat) {
return currentDate.format(momentFormat.substring(1).trim());
}
return currentDate.format(format);
})
.replace(/{{\s*date\s*}}/gi, filename)
.replace(/{{\s*time\s*}}/gi, window.moment().format("HH:mm"))
.replace(/{{\s*title\s*}}/gi, filename));
// eslint-disable-next-line @typescript-eslint/no-explicit-any
window.app.foldManager.save(createdFile, IFoldInfo);
return createdFile;
}
catch (err) {
console.error(`Failed to create file: '${normalizedPath}'`, err);
new obsidian__default["default"].Notice("Unable to create new file.");
}
}
function getYearlyNote(date, yearlyNotes) {
return yearlyNotes[getDateUID(date, "year")] ?? null;
}
function getAllYearlyNotes() {
const yearlyNotes = {};
if (!appHasYearlyNotesPluginLoaded()) {
return yearlyNotes;
}
const { vault } = window.app;
const { folder } = getYearlyNoteSettings();
const yearlyNotesFolder = vault.getAbstractFileByPath(obsidian__default["default"].normalizePath(folder));
if (!yearlyNotesFolder) {
throw new YearlyNotesFolderMissingError("Failed to find yearly notes folder");
}
obsidian__default["default"].Vault.recurseChildren(yearlyNotesFolder, (note) => {
if (note instanceof obsidian__default["default"].TFile) {
const date = getDateFromFile(note, "year");
if (date) {
const dateString = getDateUID(date, "year");
yearlyNotes[dateString] = note;
}
}
});
return yearlyNotes;
}
function appHasDailyNotesPluginLoaded() {
const { app } = window;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const dailyNotesPlugin = app.internalPlugins.plugins["daily-notes"];
if (dailyNotesPlugin && dailyNotesPlugin.enabled) {
return true;
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const periodicNotes = app.plugins.getPlugin("periodic-notes");
return periodicNotes && periodicNotes.settings?.daily?.enabled;
}
/**
* XXX: "Weekly Notes" live in either the Calendar plugin or the periodic-notes plugin.
* Check both until the weekly notes feature is removed from the Calendar plugin.
*/
function appHasWeeklyNotesPluginLoaded() {
const { app } = window;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
if (app.plugins.getPlugin("calendar")) {
return true;
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const periodicNotes = app.plugins.getPlugin("periodic-notes");
return periodicNotes && periodicNotes.settings?.weekly?.enabled;
}
function appHasMonthlyNotesPluginLoaded() {
const { app } = window;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const periodicNotes = app.plugins.getPlugin("periodic-notes");
return periodicNotes && periodicNotes.settings?.monthly?.enabled;
}
function appHasQuarterlyNotesPluginLoaded() {
const { app } = window;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const periodicNotes = app.plugins.getPlugin("periodic-notes");
return periodicNotes && periodicNotes.settings?.quarterly?.enabled;
}
function appHasYearlyNotesPluginLoaded() {
const { app } = window;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const periodicNotes = app.plugins.getPlugin("periodic-notes");
return periodicNotes && periodicNotes.settings?.yearly?.enabled;
}
function getPeriodicNoteSettings(granularity) {
const getSettings = {
day: getDailyNoteSettings,
week: getWeeklyNoteSettings,
month: getMonthlyNoteSettings,
quarter: getQuarterlyNoteSettings,
year: getYearlyNoteSettings,
}[granularity];
return getSettings();
}
function createPeriodicNote(granularity, date) {
const createFn = {
day: createDailyNote,
month: createMonthlyNote,
week: createWeeklyNote,
};
return createFn[granularity](date);
}
exports.DEFAULT_DAILY_NOTE_FORMAT = DEFAULT_DAILY_NOTE_FORMAT;
exports.DEFAULT_MONTHLY_NOTE_FORMAT = DEFAULT_MONTHLY_NOTE_FORMAT;
exports.DEFAULT_QUARTERLY_NOTE_FORMAT = DEFAULT_QUARTERLY_NOTE_FORMAT;
exports.DEFAULT_WEEKLY_NOTE_FORMAT = DEFAULT_WEEKLY_NOTE_FORMAT;
exports.DEFAULT_YEARLY_NOTE_FORMAT = DEFAULT_YEARLY_NOTE_FORMAT;
exports.appHasDailyNotesPluginLoaded = appHasDailyNotesPluginLoaded;
exports.appHasMonthlyNotesPluginLoaded = appHasMonthlyNotesPluginLoaded;
exports.appHasQuarterlyNotesPluginLoaded = appHasQuarterlyNotesPluginLoaded;
exports.appHasWeeklyNotesPluginLoaded = appHasWeeklyNotesPluginLoaded;
exports.appHasYearlyNotesPluginLoaded = appHasYearlyNotesPluginLoaded;
exports.createDailyNote = createDailyNote;
exports.createMonthlyNote = createMonthlyNote;
exports.createPeriodicNote = createPeriodicNote;
exports.createQuarterlyNote = createQuarterlyNote;
exports.createWeeklyNote = createWeeklyNote;
exports.createYearlyNote = createYearlyNote;
exports.getAllDailyNotes = getAllDailyNotes;
exports.getAllMonthlyNotes = getAllMonthlyNotes;
exports.getAllQuarterlyNotes = getAllQuarterlyNotes;
exports.getAllWeeklyNotes = getAllWeeklyNotes;
exports.getAllYearlyNotes = getAllYearlyNotes;
exports.getDailyNote = getDailyNote;
exports.getDailyNoteSettings = getDailyNoteSettings;
exports.getDateFromFile = getDateFromFile;
exports.getDateFromPath = getDateFromPath;
exports.getDateUID = getDateUID;
exports.getMonthlyNote = getMonthlyNote;
exports.getMonthlyNoteSettings = getMonthlyNoteSettings;
exports.getPeriodicNoteSettings = getPeriodicNoteSettings;
exports.getQuarterlyNote = getQuarterlyNote;
exports.getQuarterlyNoteSettings = getQuarterlyNoteSettings;
exports.getTemplateInfo = getTemplateInfo;
exports.getWeeklyNote = getWeeklyNote;
exports.getWeeklyNoteSettings = getWeeklyNoteSettings;
exports.getYearlyNote = getYearlyNote;
exports.getYearlyNoteSettings = getYearlyNoteSettings;
});
2 years ago
var BlockUtils = /** @class */ (function () {
function BlockUtils() {
}
BlockUtils.getBlock = function (editor, file) {
var _a, _b;
var cursor = editor.getCursor("to");
var fileCache = app.metadataCache.getFileCache(file);
var currentBlock = (_a = fileCache === null || fileCache === void 0 ? void 0 : fileCache.sections) === null || _a === void 0 ? void 0 : _a.find(function (section) {
return section.position.start.line <= cursor.line &&
section.position.end.line >= cursor.line;
});
if (currentBlock.type == "list") {
currentBlock = (_b = fileCache.listItems) === null || _b === void 0 ? void 0 : _b.find(function (list) {
if (list.position.start.line <= cursor.line &&
list.position.end.line >= cursor.line) {
return list;
}
});
}
return currentBlock;
};
BlockUtils.getIdOfBlock = function (editor, block) {
var blockId = block.id;
if (blockId) {
return blockId;
}
// Add a block id
var sectionEnd = block.position.end;
var pos = {
ch: sectionEnd.col,
line: sectionEnd.line,
};
var newId = Math.random().toString(36).substring(2, 8);
var spacer = BlockUtils.shouldInsertAfter(block) ? "\n\n" : " ";
editor.replaceRange(spacer + "^" + newId, pos);
return newId;
};
BlockUtils.shouldInsertAfter = function (block) {
if (block.type) {
return [
"blockquote",
"code",
"table",
"heading",
"comment",
"footnoteDefinition",
].includes(block.type);
}
};
BlockUtils.getBlockId = function () {
var view = app.workspace.getActiveViewOfType(obsidian.MarkdownView);
if (view) {
var editor = view.editor;
var file = view.file;
var block = this.getBlock(editor, file);
if (block)
return this.getIdOfBlock(editor, block);
}
};
return BlockUtils;
}());
var DEFAULT_SETTINGS = {
openFileOnWrite: true,
openDailyInNewPane: false,
openFileOnWriteInNewPane: false,
openFileWithoutWriteInNewPane: false,
idField: "id",
useUID: false,
addFilepathWhenUsingUID: false,
allowEval: false,
};
3 years ago
//! All of these methods are taken from https://www.npmjs.com/package/obsidian-daily-notes-interface.
function join() {
var partSegments = [];
for (var _i = 0; _i < arguments.length; _i++) {
partSegments[_i] = arguments[_i];
}
// Split the inputs into a list of path commands.
var parts = [];
for (var i = 0, l = partSegments.length; i < l; i++) {
parts = parts.concat(partSegments[i].split("/"));
}
// Interpret the path commands to get the new resolved path.
var newParts = [];
for (var i = 0, l = parts.length; i < l; i++) {
var part = parts[i];
// Remove leading and trailing slashes
// Also remove "." segments
if (!part || part === ".")
continue;
// Push new path segments.
else
newParts.push(part);
}
// Preserve the initial slash if there was one.
if (parts[0] === "")
newParts.unshift("");
// Turn back into a single string path.
return newParts.join("/");
}
function getNotePath(directory, filename) {
return __awaiter(this, void 0, void 0, function () {
var path;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
if (!filename.endsWith(".md")) {
filename += ".md";
}
path = obsidian.normalizePath(join(directory, filename));
return [4 /*yield*/, ensureFolderExists(path)];
case 1:
_a.sent();
return [2 /*return*/, path];
}
});
});
}
function ensureFolderExists(path) {
return __awaiter(this, void 0, void 0, function () {
var dirs, dir;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
dirs = path.replace(/\\/g, "/").split("/");
dirs.pop(); // remove basename
if (!dirs.length) return [3 /*break*/, 2];
dir = join.apply(void 0, dirs);
if (!!window.app.vault.getAbstractFileByPath(dir)) return [3 /*break*/, 2];
return [4 /*yield*/, window.app.vault.createFolder(dir)];
case 1:
_a.sent();
_a.label = 2;
case 2: return [2 /*return*/];
}
});
});
}
function getDailyNotePath(date) {
return __awaiter(this, void 0, void 0, function () {
var _a, format, folder, filename, normalizedPath;
return __generator(this, function (_b) {
switch (_b.label) {
case 0:
_a = main.getDailyNoteSettings(), format = _a.format, folder = _a.folder;
filename = date.format(format);
return [4 /*yield*/, getNotePath(folder, filename)];
case 1:
normalizedPath = _b.sent();
return [2 /*return*/, normalizedPath];
}
});
});
}
3 years ago
var EnterDataModal = /** @class */ (function (_super) {
__extends(EnterDataModal, _super);
function EnterDataModal(plugin, file) {
var _this = _super.call(this, plugin.app) || this;
3 years ago
_this.file = file;
3 years ago
//null if for normal write mode, its not associated with a special mode like "append" or "prepend"
_this.modes = [null, "overwrite", "append", "prepend"];
_this.plugin = plugin;
_this.setPlaceholder("Type your data to be written to the file or leave it empty to just open it");
return _this;
}
EnterDataModal.prototype.getSuggestions = function (query) {
var _this = this;
if (query == "")
query = null;
var suggestions = [];
var _loop_1 = function (mode) {
if (!(mode === "overwrite" && !query)) {
var display = void 0;
if (query) {
if (mode) {
display = "Write \"" + query + "\" in " + mode + " mode";
}
else {
display = "Write \"" + query + "\"";
}
}
else {
if (mode) {
display = "Open in " + mode + " mode";
}
else {
display = "Open";
}
}
suggestions.push({
data: query,
display: display,
mode: mode,
func: function () {
if (_this.file) {
_this.plugin.tools.copyURI({
3 years ago
filepath: _this.file,
data: query,
2 years ago
mode: mode,
3 years ago
});
}
else {
_this.plugin.tools.copyURI({
3 years ago
daily: "true",
data: query,
2 years ago
mode: mode,
3 years ago
});
}
2 years ago
},
3 years ago
});
}
};
for (var _i = 0, _a = this.modes; _i < _a.length; _i++) {
var mode = _a[_i];
_loop_1(mode);
}
return suggestions;
};
EnterDataModal.prototype.renderSuggestion = function (value, el) {
el.innerText = value.display;
};
EnterDataModal.prototype.onChooseSuggestion = function (item, _) {
item.func();
};
return EnterDataModal;
}(obsidian.SuggestModal));
var FileModal = /** @class */ (function (_super) {
__extends(FileModal, _super);
function FileModal(plugin, placeHolder, allowNoFile) {
if (allowNoFile === void 0) { allowNoFile = true; }
var _this = _super.call(this, plugin.app) || this;
_this.placeHolder = placeHolder;
_this.allowNoFile = allowNoFile;
_this.plugin = plugin;
_this.setPlaceholder(_this.placeHolder);
return _this;
}
FileModal.prototype.getItems = function () {
var specialItems = [];
if (this.allowNoFile) {
2 years ago
specialItems.push({
display: "<Don't specify a file>",
source: undefined,
});
3 years ago
}
var file = this.app.workspace.getActiveFile();
if (file) {
specialItems.push({ display: "<Current file>", source: file.path });
}
2 years ago
return __spreadArray(__spreadArray([], specialItems), this.app.vault.getFiles().map(function (e) {
return { display: e.path, source: e.path };
}));
3 years ago
};
FileModal.prototype.getItemText = function (item) {
return item.display;
};
2 years ago
FileModal.prototype.onChooseItem = function (item, evt) { };
3 years ago
return FileModal;
}(obsidian.FuzzySuggestModal));
function getViewStateFromMode(parameters) {
2 years ago
return parameters.viewmode
? {
state: {
mode: parameters.viewmode,
source: parameters.viewmode == "source",
},
}
: undefined;
}
function copyText(text) {
return navigator.clipboard.writeText(text);
}
function getAlternativeFilePath(file) {
var _a;
var dir = (_a = file.parent) === null || _a === void 0 ? void 0 : _a.path;
var formattedDir = dir === "/" ? "" : dir;
var name = file.name;
for (var index = 1; index < 100; index++) {
var base = stripMD(name);
2 years ago
var alternative = formattedDir +
(formattedDir == "" ? "" : "/") +
base +
(" " + index + ".md");
var exists = app.vault.getAbstractFileByPath(alternative) !== null;
if (!exists) {
return alternative;
}
3 years ago
}
}
function getFileUri(file) {
var url = new URL(app.vault.getResourcePath(file));
url.host = "localhosthostlocal";
url.protocol = "file";
url.search = "";
url.pathname = decodeURIComponent(url.pathname);
var res = url.toString().replace("/localhosthostlocal/", "/");
return res;
}
function getEndAndBeginningOfHeading(file, heading) {
var _a, _b;
var cache = app.metadataCache.getFileCache(file);
var sections = cache.sections;
var foundHeading = (_a = cache.headings) === null || _a === void 0 ? void 0 : _a.find(function (e) { return e.heading === heading; });
if (foundHeading) {
2 years ago
var foundSectionIndex = sections.findIndex(function (section) {
return section.type === "heading" &&
section.position.start.line === foundHeading.position.start.line;
});
var restSections = sections.slice(foundSectionIndex + 1);
var nextHeadingIndex = restSections === null || restSections === void 0 ? void 0 : restSections.findIndex(function (e) { return e.type === "heading"; });
2 years ago
var lastSection = (_b = restSections[(nextHeadingIndex !== -1
? nextHeadingIndex
: restSections.length) - 1]) !== null && _b !== void 0 ? _b : sections[foundSectionIndex];
var lastLine = lastSection.position.end.line + 1;
2 years ago
return {
lastLine: lastLine,
firstLine: sections[foundSectionIndex].position.end.line + 1,
};
}
else {
new obsidian.Notice("Can't find heading");
}
}
var Handlers = /** @class */ (function () {
function Handlers(plugin) {
this.plugin = plugin;
}
Object.defineProperty(Handlers.prototype, "tools", {
get: function () {
return this.plugin.tools;
},
enumerable: false,
configurable: true
});
Handlers.prototype.handlePluginManagement = function (parameters) {
if (parameters["enable-plugin"]) {
var pluginId = parameters["enable-plugin"];
app.plugins.enablePluginAndSave(pluginId);
new obsidian.Notice("Enabled " + pluginId);
}
else if (parameters["disable-plugin"]) {
var pluginId = parameters["disable-plugin"];
app.plugins.disablePluginAndSave(pluginId);
new obsidian.Notice("Disabled " + pluginId);
3 years ago
}
};
Handlers.prototype.handleFrontmatterKey = function (parameters) {
var _a;
var key = parameters.frontmatterkey;
var frontmatter = app.metadataCache.getCache((_a = parameters.filepath) !== null && _a !== void 0 ? _a : app.workspace.getActiveFile().path).frontmatter;
var res;
if (key.startsWith("[") && key.endsWith("]")) {
var list = key.substring(1, key.length - 1).split(",");
var cache = frontmatter;
var _loop_1 = function (item) {
if (cache instanceof Array) {
var index = parseInt(item);
if (Number.isNaN(index)) {
cache = cache.find(function (e) { return e == item; });
}
cache = cache[parseInt(item)];
}
else {
cache = cache[item];
}
};
for (var _i = 0, list_1 = list; _i < list_1.length; _i++) {
var item = list_1[_i];
_loop_1(item);
}
res = cache;
3 years ago
}
else {
res = frontmatter[key];
3 years ago
}
copyText(res);
3 years ago
};
Handlers.prototype.handleWorkspace = function (parameters) {
2 years ago
var workspaces = app.internalPlugins.getEnabledPluginById("workspaces");
if (!workspaces) {
2 years ago
new obsidian.Notice("Workspaces plugin is not enabled");
this.plugin.failure(parameters);
3 years ago
}
2 years ago
else {
if (parameters.saveworkspace == "true") {
2 years ago
var active = workspaces.activeWorkspace;
workspaces.saveWorkspace(active);
new obsidian.Notice("Saved current workspace to " + active);
3 years ago
}
if (parameters.workspace != undefined) {
2 years ago
workspaces.loadWorkspace(parameters.workspace);
}
this.plugin.success(parameters);
}
3 years ago
};
Handlers.prototype.handleCommand = function (parameters) {
3 years ago
return __awaiter(this, void 0, void 0, function () {
var file, view, editor, data, lines, rawCommands, command;
3 years ago
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
if (!parameters.filepath) return [3 /*break*/, 7];
if (!parameters.mode) return [3 /*break*/, 2];
if (parameters.mode == "new") {
file = app.metadataCache.getFirstLinkpathDest(parameters.filepath, "/");
if (file instanceof obsidian.TFile) {
parameters.filepath = getAlternativeFilePath(file);
}
}
2 years ago
return [4 /*yield*/, this.plugin.open({
file: parameters.filepath,
mode: "source",
parameters: parameters,
})];
3 years ago
case 1:
_a.sent();
view = app.workspace.getActiveViewOfType(obsidian.MarkdownView);
if (view) {
editor = view.editor;
data = editor.getValue();
if (parameters.mode === "append") {
editor.setValue(data + "\n");
lines = editor.lineCount();
editor.setCursor({ ch: 0, line: lines });
3 years ago
}
else if (parameters.mode === "prepend") {
editor.setValue("\n" + data);
editor.setCursor({ ch: 0, line: 0 });
2 years ago
}
else if (parameters.mode === "overwrite") {
editor.setValue("");
}
}
return [3 /*break*/, 7];
case 2:
if (!parameters.line) return [3 /*break*/, 5];
2 years ago
return [4 /*yield*/, this.plugin.open({
file: parameters.filepath,
mode: "source",
parameters: parameters,
})];
case 3:
_a.sent();
return [4 /*yield*/, this.plugin.setCursorInLine(parameters)];
case 4:
_a.sent();
return [3 /*break*/, 7];
case 5: return [4 /*yield*/, this.plugin.open({
2 years ago
file: parameters.filepath,
setting: this.plugin.settings.openFileWithoutWriteInNewPane,
parameters: parameters,
})];
case 6:
_a.sent();
_a.label = 7;
case 7:
if (parameters.commandid) {
app.commands.executeCommandById(parameters.commandid);
}
else if (parameters.commandname) {
rawCommands = app.commands.commands;
for (command in rawCommands) {
if (rawCommands[command].name === parameters.commandname) {
if (rawCommands[command].callback) {
rawCommands[command].callback();
}
else {
rawCommands[command].checkCallback(false);
}
break;
3 years ago
}
3 years ago
}
}
this.plugin.success(parameters);
return [2 /*return*/];
}
});
});
};
Handlers.prototype.handleEval = function (parameters) {
return __awaiter(this, void 0, void 0, function () {
var file, view, editor, data, lines, eval2;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
if (!parameters.filepath) return [3 /*break*/, 7];
if (!parameters.mode) return [3 /*break*/, 2];
if (parameters.mode == "new") {
file = app.metadataCache.getFirstLinkpathDest(parameters.filepath, "/");
if (file instanceof obsidian.TFile) {
parameters.filepath = getAlternativeFilePath(file);
3 years ago
}
}
2 years ago
return [4 /*yield*/, this.plugin.open({
file: parameters.filepath,
mode: "source",
parameters: parameters,
})];
case 1:
_a.sent();
view = app.workspace.getActiveViewOfType(obsidian.MarkdownView);
if (view) {
editor = view.editor;
data = editor.getValue();
if (parameters.mode === "append") {
editor.setValue(data + "\n");
lines = editor.lineCount();
editor.setCursor({ ch: 0, line: lines });
}
else if (parameters.mode === "prepend") {
editor.setValue("\n" + data);
editor.setCursor({ ch: 0, line: 0 });
}
else if (parameters.mode === "overwrite") {
editor.setValue("");
}
}
return [3 /*break*/, 7];
case 2:
if (!parameters.line) return [3 /*break*/, 5];
2 years ago
return [4 /*yield*/, this.plugin.open({
file: parameters.filepath,
mode: "source",
parameters: parameters,
})];
case 3:
_a.sent();
return [4 /*yield*/, this.plugin.setCursorInLine(parameters)];
case 4:
_a.sent();
return [3 /*break*/, 7];
case 5: return [4 /*yield*/, this.plugin.open({
2 years ago
file: parameters.filepath,
setting: this.plugin.settings.openFileWithoutWriteInNewPane,
parameters: parameters,
})];
case 6:
_a.sent();
_a.label = 7;
case 7:
if (this.plugin.settings.allowEval) {
eval2 = eval;
eval2(parameters.eval);
this.plugin.success(parameters);
}
else {
new obsidian.Notice("Eval is not allowed. Please enable it in the settings.");
this.plugin.failure(parameters);
}
return [2 /*return*/];
}
});
});
};
Handlers.prototype.handleDoesFileExist = function (parameters) {
return __awaiter(this, void 0, void 0, function () {
var exists;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, app.vault.adapter.exists(parameters.filepath)];
case 1:
exists = _a.sent();
copyText((exists ? 1 : 0).toString());
this.plugin.success(parameters);
3 years ago
return [2 /*return*/];
}
});
});
};
Handlers.prototype.handleSearchAndReplace = function (parameters) {
3 years ago
return __awaiter(this, void 0, void 0, function () {
var file, abstractFile, data, _a, pattern, flags, regex;
3 years ago
return __generator(this, function (_b) {
switch (_b.label) {
case 0:
if (parameters.filepath) {
abstractFile = app.vault.getAbstractFileByPath(parameters.filepath);
if (abstractFile instanceof obsidian.TFile) {
file = abstractFile;
}
}
else {
file = app.workspace.getActiveFile();
}
if (!file) return [3 /*break*/, 3];
return [4 /*yield*/, app.vault.read(file)];
3 years ago
case 1:
data = _b.sent();
if (parameters.searchregex) {
try {
_a = parameters.searchregex.match(/(\/?)(.+)\1([a-z]*)/i), pattern = _a[2], flags = _a[3];
regex = new RegExp(pattern, flags);
data = data.replace(regex, parameters.replace);
this.plugin.success(parameters);
}
catch (error) {
new obsidian.Notice("Can't parse " + parameters.searchregex + " as RegEx");
this.plugin.failure(parameters);
}
}
else {
data = data.replaceAll(parameters.search, parameters.replace);
this.plugin.success(parameters);
}
return [4 /*yield*/, this.plugin.writeAndOpenFile(file.path, data, parameters)];
case 2:
_b.sent();
return [3 /*break*/, 4];
case 3:
new obsidian.Notice("Cannot find file");
this.plugin.failure(parameters);
_b.label = 4;
case 4: return [2 /*return*/];
3 years ago
}
});
});
};
Handlers.prototype.handleSearch = function (parameters) {
return __awaiter(this, void 0, void 0, function () {
var view, search;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
if (!parameters.filepath) return [3 /*break*/, 2];
2 years ago
return [4 /*yield*/, this.plugin.open({
file: parameters.filepath,
parameters: parameters,
})];
case 1:
_a.sent();
_a.label = 2;
case 2:
view = app.workspace.getActiveViewOfType(obsidian.FileView);
view.currentMode.showSearch();
search = view.currentMode.search;
search.searchInputEl.value = parameters.search;
search.searchInputEl.dispatchEvent(new Event("input"));
return [2 /*return*/];
}
});
});
3 years ago
};
Handlers.prototype.handleWrite = function (parameters, createdDailyNote) {
var _a;
if (createdDailyNote === void 0) { createdDailyNote = false; }
return __awaiter(this, void 0, void 0, function () {
var file, outFile, path;
return __generator(this, function (_b) {
switch (_b.label) {
case 0:
if (parameters.filepath) {
file = app.vault.getAbstractFileByPath(parameters.filepath);
}
else {
file = app.workspace.getActiveFile();
}
if (!(parameters.filepath || file)) return [3 /*break*/, 21];
outFile = void 0;
path = (_a = parameters.filepath) !== null && _a !== void 0 ? _a : file.path;
if (!(parameters.mode === "overwrite")) return [3 /*break*/, 2];
return [4 /*yield*/, this.plugin.writeAndOpenFile(path, parameters.data, parameters)];
case 1:
outFile = _b.sent();
this.plugin.success(parameters);
return [3 /*break*/, 20];
case 2:
if (!(parameters.mode === "prepend")) return [3 /*break*/, 7];
if (!(file instanceof obsidian.TFile)) return [3 /*break*/, 4];
return [4 /*yield*/, this.plugin.prepend(file, parameters)];
case 3:
outFile = _b.sent();
return [3 /*break*/, 6];
case 4: return [4 /*yield*/, this.plugin.prepend(path, parameters)];
case 5:
outFile = _b.sent();
_b.label = 6;
case 6:
this.plugin.success(parameters);
return [3 /*break*/, 20];
case 7:
if (!(parameters.mode === "append")) return [3 /*break*/, 12];
if (!(file instanceof obsidian.TFile)) return [3 /*break*/, 9];
return [4 /*yield*/, this.plugin.append(file, parameters)];
case 8:
outFile = _b.sent();
return [3 /*break*/, 11];
case 9: return [4 /*yield*/, this.plugin.append(path, parameters)];
case 10:
outFile = _b.sent();
_b.label = 11;
case 11:
this.plugin.success(parameters);
return [3 /*break*/, 20];
case 12:
if (!(parameters.mode === "new")) return [3 /*break*/, 17];
if (!(file instanceof obsidian.TFile)) return [3 /*break*/, 14];
return [4 /*yield*/, this.plugin.writeAndOpenFile(getAlternativeFilePath(file), parameters.data, parameters)];
case 13:
outFile = _b.sent();
this.plugin.hookSuccess(parameters, outFile);
return [3 /*break*/, 16];
case 14: return [4 /*yield*/, this.plugin.writeAndOpenFile(path, parameters.data, parameters)];
case 15:
outFile = _b.sent();
this.plugin.hookSuccess(parameters, outFile);
_b.label = 16;
case 16: return [3 /*break*/, 20];
case 17:
if (!(!createdDailyNote && file instanceof obsidian.TFile)) return [3 /*break*/, 18];
new obsidian.Notice("File already exists");
this.plugin.openExistingFileAndSetCursor(file.path, parameters);
this.plugin.failure(parameters);
return [3 /*break*/, 20];
case 18: return [4 /*yield*/, this.plugin.writeAndOpenFile(path, parameters.data, parameters)];
case 19:
outFile = _b.sent();
this.plugin.success(parameters);
_b.label = 20;
case 20:
if (parameters.uid) {
this.tools.writeUIDToFile(outFile, parameters.uid);
}
return [3 /*break*/, 22];
case 21:
new obsidian.Notice("Cannot find file");
this.plugin.failure(parameters);
_b.label = 22;
case 22: return [2 /*return*/];
}
});
});
3 years ago
};
Handlers.prototype.handleOpen = function (parameters) {
return __awaiter(this, void 0, void 0, function () {
2 years ago
var view, cache, heading, view, cache, block, view;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
2 years ago
if (!(parameters.heading != undefined)) return [3 /*break*/, 2];
return [4 /*yield*/, this.plugin.open({
file: parameters.filepath + "#" + parameters.heading,
setting: this.plugin.settings.openFileWithoutWriteInNewPane,
parameters: parameters,
supportPopover: false,
})];
2 years ago
case 1:
_a.sent();
view = app.workspace.getActiveViewOfType(obsidian.MarkdownView);
if (!view)
return [2 /*return*/];
cache = app.metadataCache.getFileCache(view.file);
heading = cache.headings.find(function (e) { return e.heading === parameters.heading; });
view.editor.focus();
2 years ago
view.editor.setCursor({
line: heading.position.start.line + 1,
ch: 0,
});
return [3 /*break*/, 7];
2 years ago
case 2:
if (!(parameters.block != undefined)) return [3 /*break*/, 4];
return [4 /*yield*/, this.plugin.open({
file: parameters.filepath + "#^" + parameters.block,
setting: this.plugin.settings.openFileWithoutWriteInNewPane,
parameters: parameters,
supportPopover: false,
})];
2 years ago
case 3:
_a.sent();
view = app.workspace.getActiveViewOfType(obsidian.MarkdownView);
if (!view)
return [2 /*return*/];
cache = app.metadataCache.getFileCache(view.file);
block = cache.blocks[parameters.block];
view.editor.focus();
view.editor.setCursor({ line: block.position.start.line, ch: 0 });
return [3 /*break*/, 7];
2 years ago
case 4: return [4 /*yield*/, this.plugin.open({
file: parameters.filepath,
setting: this.plugin.settings.openFileWithoutWriteInNewPane,
parameters: parameters,
})];
case 5:
_a.sent();
if (!(parameters.line != undefined)) return [3 /*break*/, 7];
return [4 /*yield*/, this.plugin.setCursorInLine(parameters)];
2 years ago
case 6:
_a.sent();
_a.label = 7;
case 7:
if (!(parameters.mode != undefined)) return [3 /*break*/, 9];
return [4 /*yield*/, this.plugin.setCursor(parameters)];
2 years ago
case 8:
_a.sent();
_a.label = 9;
case 9:
if (parameters.uid) {
view = app.workspace.getActiveViewOfType(obsidian.MarkdownView);
this.tools.writeUIDToFile(view.file, parameters.uid);
}
this.plugin.success(parameters);
return [2 /*return*/];
}
});
});
3 years ago
};
Handlers.prototype.handleCopyFileURI = function (withoutData, file) {
3 years ago
var _this = this;
var view = app.workspace.getActiveViewOfType(obsidian.FileView);
if (!view && !file)
return;
if (view instanceof obsidian.MarkdownView) {
var pos = view.editor.getCursor();
var cache = app.metadataCache.getFileCache(view.file);
if (cache.headings) {
for (var _i = 0, _a = cache.headings; _i < _a.length; _i++) {
var heading = _a[_i];
2 years ago
if (heading.position.start.line <= pos.line &&
heading.position.end.line >= pos.line) {
this.tools.copyURI({
filepath: view.file.path,
2 years ago
heading: heading.heading,
});
return;
}
}
}
if (cache.blocks) {
for (var _b = 0, _c = Object.keys(cache.blocks); _b < _c.length; _b++) {
var blockID = _c[_b];
var block = cache.blocks[blockID];
2 years ago
if (block.position.start.line <= pos.line &&
block.position.end.line >= pos.line) {
this.tools.copyURI({
filepath: view.file.path,
2 years ago
block: blockID,
});
return;
2 years ago
}
}
}
}
if (withoutData) {
var file2 = file !== null && file !== void 0 ? file : app.workspace.getActiveFile();
if (!file2) {
new obsidian.Notice("No file opened");
return;
}
this.tools.copyURI({
filepath: file2.path,
});
2 years ago
}
else {
var fileModal = new FileModal(this.plugin, "Choose a file", false);
fileModal.open();
fileModal.onChooseItem = function (item, _) {
new EnterDataModal(_this.plugin, item.source).open();
};
2 years ago
}
};
Handlers.prototype.handleOpenSettings = function (parameters) {
if (app.setting.containerEl.parentElement === null) {
app.setting.open();
3 years ago
}
if (parameters.settingid == "plugin-browser") {
app.setting.openTabById("community-plugins");
app.setting.activeTab.containerEl.find(".mod-cta").click();
3 years ago
}
else if (parameters.settingid == "theme-browser") {
app.setting.openTabById("appearance");
app.setting.activeTab.containerEl.find(".mod-cta").click();
3 years ago
}
else {
app.setting.openTabById(parameters.settingid);
2 years ago
}
if (parameters.settingsection) {
var elements = app.setting.tabContentContainer.querySelectorAll("*");
var heading = Array.prototype.find.call(elements, function (e) { return e.textContent == parameters.settingsection; });
if (heading) {
heading.scrollIntoView();
}
2 years ago
}
this.plugin.success(parameters);
2 years ago
};
Handlers.prototype.handleUpdatePlugins = function (parameters) {
3 years ago
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
parameters.settingid = "community-plugins";
this.handleOpenSettings(parameters);
app.setting.activeTab.containerEl.findAll(".mod-cta").last().click();
new obsidian.Notice("Waiting 10 seconds");
return [4 /*yield*/, new Promise(function (resolve) { return setTimeout(resolve, 10 * 1000); })];
3 years ago
case 1:
_a.sent();
if (Object.keys(app.plugins.updates).length !== 0) {
2 years ago
app.setting.activeTab.containerEl
.findAll(".mod-cta")
.last()
.click();
3 years ago
}
this.plugin.success(parameters);
3 years ago
return [2 /*return*/];
}
});
});
};
2 years ago
Handlers.prototype.handleBookmarks = function (parameters) {
return __awaiter(this, void 0, void 0, function () {
var bookmarksPlugin, bookmarks, bookmark, openMode;
return __generator(this, function (_a) {
bookmarksPlugin = app.internalPlugins.getEnabledPluginById("bookmarks");
bookmarks = bookmarksPlugin.getBookmarks();
bookmark = bookmarks.find(function (b) { return b.title == parameters.bookmark; });
if (parameters.openmode == "true" || parameters.openmode == "false") {
openMode = parameters.openmode == "true";
}
else {
openMode = parameters.openmode;
}
bookmarksPlugin.openBookmark(bookmark, openMode);
return [2 /*return*/];
});
});
};
return Handlers;
}());
var CommandModal = /** @class */ (function (_super) {
__extends(CommandModal, _super);
function CommandModal(plugin, file) {
var _this = _super.call(this, plugin.app) || this;
_this.plugin = plugin;
_this.file = file;
return _this;
}
CommandModal.prototype.getItems = function () {
var rawCommands = this.app.commands.commands;
var commands = Object.keys(rawCommands).map(function (e) {
return { id: rawCommands[e].id, name: rawCommands[e].name };
});
return commands;
};
CommandModal.prototype.getItemText = function (item) {
return item.name;
};
CommandModal.prototype.onChooseItem = function (item, _) {
this.plugin.tools.copyURI({
filepath: this.file,
2 years ago
commandid: item.id,
});
};
return CommandModal;
}(obsidian.FuzzySuggestModal));
var ReplaceModal = /** @class */ (function (_super) {
__extends(ReplaceModal, _super);
function ReplaceModal(plugin, search, filepath) {
var _this = _super.call(this, plugin.app) || this;
_this.search = search;
_this.filepath = filepath;
_this.emptyText = "Empty text (replace with nothing)";
_this.plugin = plugin;
_this.setPlaceholder("Replacement text");
return _this;
}
ReplaceModal.prototype.getSuggestions = function (query) {
if (query === "") {
query = this.emptyText;
}
return [query];
};
ReplaceModal.prototype.renderSuggestion = function (value, el) {
el.innerText = value;
};
ReplaceModal.prototype.onChooseSuggestion = function (item, _) {
if (this.search.isRegEx) {
this.plugin.tools.copyURI({
filepath: this.filepath,
searchregex: this.search.source,
2 years ago
replace: item == this.emptyText ? "" : item,
});
}
else {
this.plugin.tools.copyURI({
filepath: this.filepath,
search: this.search.source,
2 years ago
replace: item == this.emptyText ? "" : item,
3 years ago
});
}
};
return ReplaceModal;
}(obsidian.SuggestModal));
var SearchModal = /** @class */ (function (_super) {
__extends(SearchModal, _super);
function SearchModal(plugin) {
var _this = _super.call(this, plugin.app) || this;
_this.plugin = plugin;
_this.setPlaceholder("Searched text. RegEx is supported");
return _this;
}
SearchModal.prototype.getSuggestions = function (query) {
if (query === "") {
query = "...";
}
var regex;
try {
regex = new RegExp(query);
}
catch (error) { }
return [
{
source: query,
isRegEx: false,
2 years ago
display: query,
},
{
source: query,
display: regex ? "As RegEx: " + query : "Can't parse RegEx",
2 years ago
isRegEx: true,
},
];
};
SearchModal.prototype.renderSuggestion = function (value, el) {
el.innerText = value.display;
};
2 years ago
SearchModal.prototype.onChooseSuggestion = function (item, _) { };
return SearchModal;
}(obsidian.SuggestModal));
var SettingsTab = /** @class */ (function (_super) {
__extends(SettingsTab, _super);
function SettingsTab(app, plugin) {
var _this = _super.call(this, app, plugin) || this;
_this.plugin = plugin;
return _this;
}
SettingsTab.prototype.display = function () {
var _this = this;
var containerEl = this.containerEl;
containerEl.empty();
containerEl.createEl("h2", { text: this.plugin.manifest.name });
2 years ago
new obsidian.Setting(containerEl).setName("Open file on write").addToggle(function (cb) {
return cb
.setValue(_this.plugin.settings.openFileOnWrite)
.onChange(function (value) {
_this.plugin.settings.openFileOnWrite = value;
_this.plugin.saveSettings();
});
});
new obsidian.Setting(containerEl)
.setName("Open file on write in a new pane")
.setDisabled(this.plugin.settings.openFileOnWrite)
2 years ago
.addToggle(function (cb) {
return cb
.setValue(_this.plugin.settings.openFileOnWriteInNewPane)
.onChange(function (value) {
_this.plugin.settings.openFileOnWriteInNewPane = value;
_this.plugin.saveSettings();
});
});
new obsidian.Setting(containerEl)
.setName("Open daily note in a new pane")
2 years ago
.addToggle(function (cb) {
return cb
.setValue(_this.plugin.settings.openDailyInNewPane)
.onChange(function (value) {
_this.plugin.settings.openDailyInNewPane = value;
_this.plugin.saveSettings();
});
});
new obsidian.Setting(containerEl)
.setName("Open file without write in new pane")
2 years ago
.addToggle(function (cb) {
return cb
.setValue(_this.plugin.settings.openFileWithoutWriteInNewPane)
.onChange(function (value) {
_this.plugin.settings.openFileWithoutWriteInNewPane =
value;
_this.plugin.saveSettings();
});
});
new obsidian.Setting(containerEl)
.setName("Use UID instead of file paths")
2 years ago
.addToggle(function (cb) {
return cb.setValue(_this.plugin.settings.useUID).onChange(function (value) {
_this.plugin.settings.useUID = value;
_this.plugin.saveSettings();
_this.display();
});
});
if (this.plugin.settings.useUID) {
new obsidian.Setting(containerEl)
.setName("Add filepath parameter")
.setDesc("When using UID instead of file paths, you can still add the filepath parameter to know what this URI is about. It's NOT actually used.")
2 years ago
.addToggle(function (cb) {
return cb
.setValue(_this.plugin.settings.addFilepathWhenUsingUID)
.onChange(function (value) {
_this.plugin.settings.addFilepathWhenUsingUID =
value;
_this.plugin.saveSettings();
});
});
}
new obsidian.Setting(containerEl)
.setName("UID field in frontmatter")
2 years ago
.addText(function (cb) {
return cb.setValue(_this.plugin.settings.idField).onChange(function (value) {
_this.plugin.settings.idField = value;
_this.plugin.saveSettings();
});
});
new obsidian.Setting(containerEl)
.setName("Allow executing arbitrary code via eval")
.setDesc("⚠️ This can be dangerous as it allows executing arbitrary code. Only enable this if you trust the source of the URIs you are using and know what you are doing. ⚠️")
2 years ago
.addToggle(function (cb) {
return cb
.setValue(_this.plugin.settings.allowEval)
.onChange(function (value) {
_this.plugin.settings.allowEval = value;
_this.plugin.saveSettings();
});
});
new obsidian.Setting(containerEl)
2 years ago
.setName("Donate")
.setDesc("If you like this Plugin, consider donating to support continued development.")
.addButton(function (bt) {
2 years ago
bt.buttonEl.outerHTML =
"<a href='https://ko-fi.com/F1F195IQ5' target='_blank'><img height='36' style='border:0px;height:36px;' src='https://cdn.ko-fi.com/cdn/kofi3.png?v=3' border='0' alt='Buy Me a Coffee at ko-fi.com' /></a>";
3 years ago
});
};
return SettingsTab;
}(obsidian.PluginSettingTab));
// Unique ID creation requires a high quality random # generator. In the browser we therefore
// require the crypto API and do not support built-in fallback to lower quality random number
// generators (like Math.random()).
var getRandomValues;
var rnds8 = new Uint8Array(16);
function rng() {
// lazy load so that environments that need to polyfill have a chance to do so
if (!getRandomValues) {
// getRandomValues needs to be invoked in a context where "this" is a Crypto implementation. Also,
// find the complete implementation of crypto (msCrypto) on IE11.
getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || typeof msCrypto !== 'undefined' && typeof msCrypto.getRandomValues === 'function' && msCrypto.getRandomValues.bind(msCrypto);
if (!getRandomValues) {
throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
}
}
return getRandomValues(rnds8);
}
var REGEX = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
function validate(uuid) {
return typeof uuid === 'string' && REGEX.test(uuid);
}
/**
* Convert array of 16 byte values to UUID string format of the form:
* XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
*/
var byteToHex = [];
for (var i = 0; i < 256; ++i) {
byteToHex.push((i + 0x100).toString(16).substr(1));
}
function stringify(arr) {
var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
// Note: Be careful editing this code! It's been tuned for performance
// and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
var uuid = (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase(); // Consistency check for valid UUID. If this throws, it's likely due to one
// of the following:
// - One or more input array values don't map to a hex octet (leading to
// "undefined" in the uuid)
// - Invalid input values for the RFC `version` or `variant` fields
if (!validate(uuid)) {
throw TypeError('Stringified UUID is invalid');
}
return uuid;
}
function v4(options, buf, offset) {
options = options || {};
var rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
rnds[6] = rnds[6] & 0x0f | 0x40;
rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
if (buf) {
offset = offset || 0;
for (var i = 0; i < 16; ++i) {
buf[offset + i] = rnds[i];
}
return buf;
}
return stringify(rnds);
}
/**
* These methods depend on the plugins settings in contrast to the utils.ts file, which's functions are independent of the plugins settings.
*/
var Tools = /** @class */ (function () {
function Tools(plugin) {
this.plugin = plugin;
}
Object.defineProperty(Tools.prototype, "settings", {
get: function () {
return this.plugin.settings;
},
enumerable: false,
configurable: true
});
Tools.prototype.writeUIDToFile = function (file, uid) {
var _a;
3 years ago
return __awaiter(this, void 0, void 0, function () {
var frontmatter, fileContent, isYamlEmpty, splitContent, newFileContent;
3 years ago
return __generator(this, function (_b) {
switch (_b.label) {
case 0:
frontmatter = (_a = app.metadataCache.getFileCache(file)) === null || _a === void 0 ? void 0 : _a.frontmatter;
return [4 /*yield*/, app.vault.read(file)];
3 years ago
case 1:
fileContent = _b.sent();
2 years ago
isYamlEmpty = (!frontmatter || frontmatter.length === 0) &&
!fileContent.match(/^-{3}\s*\n*\r*-{3}/);
splitContent = fileContent.split("\n");
if (isYamlEmpty) {
splitContent.unshift("---");
splitContent.unshift(this.plugin.settings.idField + ": " + uid);
splitContent.unshift("---");
3 years ago
}
else {
splitContent.splice(1, 0, this.plugin.settings.idField + ": " + uid);
3 years ago
}
newFileContent = splitContent.join("\n");
return [4 /*yield*/, app.vault.modify(file, newFileContent)];
3 years ago
case 2:
_b.sent();
return [2 /*return*/, uid];
3 years ago
}
});
});
};
Tools.prototype.getUIDFromFile = function (file) {
2 years ago
return __awaiter(this, void 0, void 0, function () {
var cache, i, uid;
2 years ago
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
i = 0;
_a.label = 1;
2 years ago
case 1:
if (!(i <= 20)) return [3 /*break*/, 4];
cache = app.metadataCache.getFileCache(file);
if (cache !== undefined)
return [3 /*break*/, 4];
return [4 /*yield*/, new Promise(function (resolve) { return setTimeout(resolve, 150); })];
2 years ago
case 2:
_a.sent();
_a.label = 3;
case 3:
i++;
return [3 /*break*/, 1];
case 4:
uid = obsidian.parseFrontMatterEntry(cache.frontmatter, this.plugin.settings.idField);
2 years ago
if (uid != undefined) {
if (uid instanceof Array) {
return [2 /*return*/, uid[0]];
}
else {
return [2 /*return*/, uid];
}
}
return [4 /*yield*/, this.writeUIDToFile(file, v4())];
case 5: return [2 /*return*/, _a.sent()];
2 years ago
}
});
});
};
Tools.prototype.generateURI = function (parameters, doubleEncode) {
3 years ago
return __awaiter(this, void 0, void 0, function () {
var prefix, suffix, file, _a, parameter;
2 years ago
return __generator(this, function (_b) {
switch (_b.label) {
3 years ago
case 0:
prefix = "obsidian://advanced-uri?vault=" + encodeURIComponent(app.vault.getName());
suffix = "";
file = app.vault.getAbstractFileByPath(parameters.filepath);
if (!(this.settings.useUID && file instanceof obsidian.TFile)) return [3 /*break*/, 2];
if (!this.settings.addFilepathWhenUsingUID)
parameters.filepath = undefined;
_a = parameters;
return [4 /*yield*/, this.getUIDFromFile(file)];
3 years ago
case 1:
_a.uid = _b.sent();
_b.label = 2;
3 years ago
case 2:
for (parameter in parameters) {
if (parameters[parameter] != undefined) {
2 years ago
suffix =
suffix +
("&" + parameter + "=" + encodeURIComponent(parameters[parameter]));
}
}
if (doubleEncode) {
return [2 /*return*/, prefix + encodeURI(suffix)];
}
else {
return [2 /*return*/, prefix + suffix];
3 years ago
}
3 years ago
}
});
});
};
Tools.prototype.copyURI = function (parameters) {
3 years ago
return __awaiter(this, void 0, void 0, function () {
var uri;
3 years ago
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.generateURI(parameters, true)];
3 years ago
case 1:
uri = _a.sent();
return [4 /*yield*/, copyText(uri)];
3 years ago
case 2:
_a.sent();
new obsidian.Notice("Advanced URI copied to your clipboard");
return [2 /*return*/];
}
});
});
};
return Tools;
}());
var AdvancedURI = /** @class */ (function (_super) {
__extends(AdvancedURI, _super);
function AdvancedURI() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.handlers = new Handlers(_this);
_this.tools = new Tools(_this);
return _this;
}
AdvancedURI.prototype.onload = function () {
return __awaiter(this, void 0, void 0, function () {
var _this = this;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.loadSettings()];
case 1:
3 years ago
_a.sent();
this.addSettingTab(new SettingsTab(this.app, this));
this.addCommand({
id: "copy-uri-current-file",
name: "copy URI for file with options",
2 years ago
callback: function () { return _this.handlers.handleCopyFileURI(false); },
});
this.addCommand({
id: "copy-uri-current-file-simple",
name: "copy URI for current file",
2 years ago
callback: function () { return _this.handlers.handleCopyFileURI(true); },
});
this.addCommand({
id: "copy-uri-daily",
name: "copy URI for daily note",
2 years ago
callback: function () { return new EnterDataModal(_this).open(); },
});
this.addCommand({
id: "copy-uri-search-and-replace",
name: "copy URI for search and replace",
callback: function () {
var fileModal = new FileModal(_this, "Used file for search and replace");
fileModal.open();
fileModal.onChooseItem = function (filePath) {
var searchModal = new SearchModal(_this);
searchModal.open();
searchModal.onChooseSuggestion = function (item) {
new ReplaceModal(_this, item, filePath === null || filePath === void 0 ? void 0 : filePath.source).open();
};
};
},
});
this.addCommand({
id: "copy-uri-command",
name: "copy URI for command",
callback: function () {
var fileModal = new FileModal(_this, "Select a file to be opened before executing the command");
fileModal.open();
fileModal.onChooseItem = function (item) {
new CommandModal(_this, item === null || item === void 0 ? void 0 : item.source).open();
};
2 years ago
},
});
this.addCommand({
id: "copy-uri-block",
name: "copy URI for current block",
checkCallback: function (checking) {
var view = _this.app.workspace.getActiveViewOfType(obsidian.MarkdownView);
if (checking)
return view != undefined;
var id = BlockUtils.getBlockId();
if (id) {
_this.tools.copyURI({
filepath: view.file.path,
2 years ago
block: id,
});
}
2 years ago
},
});
this.registerObsidianProtocolHandler("advanced-uri", function (e) { return __awaiter(_this, void 0, void 0, function () {
var parameters, createdDailyNote, parameter, res, file, parentFolder, parentFolderPath, index, extension, moment_1, allDailyNotes, dailyNote, _a, _b;
var _this = this;
var _c, _d, _e;
return __generator(this, function (_f) {
switch (_f.label) {
case 0:
parameters = e;
createdDailyNote = false;
for (parameter in parameters) {
parameters[parameter] = decodeURIComponent(parameters[parameter]);
}
this.lastParameters = __assign({}, parameters);
if (parameters.uid) {
res = (_c = this.getFileFromUID(parameters.uid)) === null || _c === void 0 ? void 0 : _c.path;
if (res != undefined) {
parameters.filepath = res;
parameters.uid = undefined;
}
}
else if (parameters.filename) {
file = this.app.metadataCache.getFirstLinkpathDest(parameters.filename, "");
if (!file) {
2 years ago
file = this.app.vault
.getMarkdownFiles()
.find(function (file) {
var _a;
return (_a = obsidian.parseFrontMatterAliases(_this.app.metadataCache.getFileCache(file)
.frontmatter)) === null || _a === void 0 ? void 0 : _a.includes(parameters.filename);
});
}
parentFolder = this.app.fileManager.getNewFileParent((_d = this.app.workspace.activeLeaf.view.file) === null || _d === void 0 ? void 0 : _d.path);
2 years ago
parentFolderPath = parentFolder.isRoot()
? ""
: parentFolder.path + "/";
parameters.filepath =
(_e = file === null || file === void 0 ? void 0 : file.path) !== null && _e !== void 0 ? _e : parentFolderPath + obsidian.normalizePath(parameters.filename);
}
if (!parameters.filepath) return [3 /*break*/, 1];
parameters.filepath = obsidian.normalizePath(parameters.filepath);
index = parameters.filepath.lastIndexOf(".");
extension = parameters.filepath.substring(index < 0 ? parameters.filepath.length : index);
if (extension === "") {
parameters.filepath = parameters.filepath + ".md";
}
return [3 /*break*/, 7];
case 1:
if (!(parameters.daily === "true")) return [3 /*break*/, 7];
if (!main.appHasDailyNotesPluginLoaded()) {
new obsidian.Notice("Daily notes plugin is not loaded");
return [2 /*return*/];
}
moment_1 = window.moment(Date.now());
allDailyNotes = main.getAllDailyNotes();
dailyNote = main.getDailyNote(moment_1, allDailyNotes);
if (!!dailyNote) return [3 /*break*/, 6];
if (!(parameters.exists === "true")) return [3 /*break*/, 3];
_a = parameters;
return [4 /*yield*/, getDailyNotePath(moment_1)];
case 2:
_a.filepath = _f.sent();
return [3 /*break*/, 6];
case 3: return [4 /*yield*/, main.createDailyNote(moment_1)];
case 4:
dailyNote = _f.sent();
// delay to let Obsidian index and generate CachedMetadata
return [4 /*yield*/, new Promise(function (r) { return setTimeout(r, 500); })];
case 5:
// delay to let Obsidian index and generate CachedMetadata
_f.sent();
createdDailyNote = true;
_f.label = 6;
case 6:
if (dailyNote !== undefined) {
parameters.filepath = dailyNote.path;
}
_f.label = 7;
case 7:
if (!(parameters.clipboard === "true")) return [3 /*break*/, 9];
_b = parameters;
return [4 /*yield*/, navigator.clipboard.readText()];
case 8:
_b.data = _f.sent();
_f.label = 9;
case 9:
if (parameters["enable-plugin"] || parameters["disable-plugin"]) {
this.handlers.handlePluginManagement(parameters);
}
else if (parameters.frontmatterkey) {
this.handlers.handleFrontmatterKey(parameters);
}
2 years ago
else if (parameters.workspace ||
parameters.saveworkspace == "true") {
this.handlers.handleWorkspace(parameters);
}
else if (parameters.commandname || parameters.commandid) {
this.handlers.handleCommand(parameters);
}
2 years ago
else if (parameters.bookmark) {
this.handlers.handleBookmarks(parameters);
}
else if (parameters.eval) {
this.handlers.handleEval(parameters);
}
else if (parameters.filepath && parameters.exists === "true") {
this.handlers.handleDoesFileExist(parameters);
}
else if (parameters.data) {
this.handlers.handleWrite(parameters, createdDailyNote);
}
else if (parameters.filepath && parameters.heading) {
this.handlers.handleOpen(parameters);
}
else if (parameters.filepath && parameters.block) {
this.handlers.handleOpen(parameters);
}
2 years ago
else if ((parameters.search || parameters.searchregex) &&
parameters.replace != undefined) {
this.handlers.handleSearchAndReplace(parameters);
}
else if (parameters.search) {
this.handlers.handleSearch(parameters);
}
else if (parameters.filepath) {
this.handlers.handleOpen(parameters);
}
else if (parameters.settingid) {
this.handlers.handleOpenSettings(parameters);
}
else if (parameters.updateplugins) {
this.handlers.handleUpdatePlugins(parameters);
}
return [2 /*return*/];
}
});
}); });
this.registerObsidianProtocolHandler("hook-get-advanced-uri", function (e) { return __awaiter(_this, void 0, void 0, function () {
var parameters, parameter, activeLeaf, file;
return __generator(this, function (_a) {
parameters = e;
for (parameter in parameters) {
parameters[parameter] = decodeURIComponent(parameters[parameter]);
}
activeLeaf = this.app.workspace.activeLeaf;
file = activeLeaf.view.file;
if (activeLeaf && file) {
this.hookSuccess(parameters, file);
}
else {
2 years ago
this.failure(parameters, {
errorMessage: "No file opened",
});
}
return [2 /*return*/];
});
}); });
2 years ago
this.registerEvent(this.app.workspace.on("file-menu", function (menu, file, source) {
console.log(source);
2 years ago
if (!(source === "more-options" ||
source === "tab-header" ||
source == "file-explorer-context-menu")) {
return;
}
if (!(file instanceof obsidian.TFile)) {
return;
}
menu.addItem(function (item) {
2 years ago
item.setTitle("Copy Advanced URI")
.setIcon("link")
.setSection("info")
2 years ago
.onClick(function (_) {
return _this.handlers.handleCopyFileURI(true, file);
});
});
}));
return [2 /*return*/];
}
});
});
};
AdvancedURI.prototype.hookSuccess = function (parameters, file) {
return __awaiter(this, void 0, void 0, function () {
var options;
var _a;
return __generator(this, function (_b) {
switch (_b.label) {
case 0:
if (!parameters["x-success"])
3 years ago
return [2 /*return*/];
_a = {
title: stripMD(file.name)
};
return [4 /*yield*/, this.tools.generateURI({ filepath: file.path }, false)];
case 1:
options = (_a.advanceduri = _b.sent(),
_a.urlkey = "advanceduri",
_a.fileuri = getFileUri(file),
_a);
this.success(parameters, options);
3 years ago
return [2 /*return*/];
}
});
});
};
AdvancedURI.prototype.success = function (parameters, options) {
if (parameters["x-success"]) {
var url = new URL(parameters["x-success"]);
for (var param in options) {
url.searchParams.set(param, options[param]);
}
window.open(url.toString());
}
};
AdvancedURI.prototype.failure = function (parameters, options) {
if (parameters["x-error"]) {
var url = new URL(parameters["x-error"]);
for (var param in options) {
url.searchParams.set(param, options[param]);
}
window.open(url.toString());
}
};
AdvancedURI.prototype.getFileFromUID = function (uid) {
var _this = this;
var files = this.app.vault.getFiles();
var idKey = this.settings.idField;
2 years ago
return files.find(function (file) {
var _a;
2 years ago
var fieldValue = obsidian.parseFrontMatterEntry((_a = _this.app.metadataCache.getFileCache(file)) === null || _a === void 0 ? void 0 : _a.frontmatter, idKey);
if (fieldValue instanceof Array) {
return fieldValue.contains(uid);
}
else {
return fieldValue == uid;
}
2 years ago
});
};
3 years ago
AdvancedURI.prototype.append = function (file, parameters) {
var _a;
return __awaiter(this, void 0, void 0, function () {
var path, dataToWrite, line, data, lines, fileData;
return __generator(this, function (_b) {
switch (_b.label) {
case 0:
if (!parameters.heading) return [3 /*break*/, 3];
if (!(file instanceof obsidian.TFile)) return [3 /*break*/, 2];
path = file.path;
line = (_a = getEndAndBeginningOfHeading(file, parameters.heading)) === null || _a === void 0 ? void 0 : _a.lastLine;
3 years ago
if (line === undefined)
return [2 /*return*/];
return [4 /*yield*/, this.app.vault.read(file)];
case 1:
data = _b.sent();
lines = data.split("\n");
lines.splice.apply(lines, __spreadArray([line, 0], parameters.data.split("\n")));
dataToWrite = lines.join("\n");
_b.label = 2;
case 2: return [3 /*break*/, 7];
case 3:
fileData = void 0;
if (!(file instanceof obsidian.TFile)) return [3 /*break*/, 5];
return [4 /*yield*/, this.app.vault.read(file)];
case 4:
fileData = _b.sent();
path = file.path;
return [3 /*break*/, 6];
case 5:
path = file;
fileData = "";
_b.label = 6;
case 6:
dataToWrite = fileData + "\n" + parameters.data;
_b.label = 7;
3 years ago
case 7: return [2 /*return*/, this.writeAndOpenFile(path, dataToWrite, parameters)];
3 years ago
}
});
});
};
AdvancedURI.prototype.prepend = function (file, parameters) {
var _a;
return __awaiter(this, void 0, void 0, function () {
3 years ago
var path, dataToWrite, line, data, lines, fileData, cache, line, first, last;
3 years ago
return __generator(this, function (_b) {
switch (_b.label) {
case 0:
if (!parameters.heading) return [3 /*break*/, 3];
if (!(file instanceof obsidian.TFile)) return [3 /*break*/, 2];
path = file.path;
line = (_a = getEndAndBeginningOfHeading(file, parameters.heading)) === null || _a === void 0 ? void 0 : _a.firstLine;
3 years ago
if (line === undefined)
return [2 /*return*/];
return [4 /*yield*/, this.app.vault.read(file)];
case 1:
data = _b.sent();
lines = data.split("\n");
lines.splice.apply(lines, __spreadArray([line, 0], parameters.data.split("\n")));
dataToWrite = lines.join("\n");
_b.label = 2;
3 years ago
case 2: return [3 /*break*/, 6];
3 years ago
case 3:
if (!(file instanceof obsidian.TFile)) return [3 /*break*/, 5];
return [4 /*yield*/, this.app.vault.read(file)];
case 4:
fileData = _b.sent();
3 years ago
cache = this.app.metadataCache.getFileCache(file);
if (cache.frontmatter) {
line = cache.frontmatter.position.end.line;
2 years ago
first = fileData
.split("\n")
.slice(0, line + 1)
.join("\n");
last = fileData
.split("\n")
.slice(line + 1)
.join("\n");
3 years ago
dataToWrite = first + "\n" + parameters.data + "\n" + last;
}
else {
dataToWrite = parameters.data + "\n" + fileData;
}
3 years ago
path = file.path;
return [3 /*break*/, 6];
case 5:
path = file;
3 years ago
dataToWrite = parameters.data;
3 years ago
_b.label = 6;
3 years ago
case 6: return [2 /*return*/, this.writeAndOpenFile(path, dataToWrite, parameters)];
3 years ago
}
});
});
};
AdvancedURI.prototype.writeAndOpenFile = function (outputFileName, text, parameters) {
return __awaiter(this, void 0, void 0, function () {
2 years ago
var file, parts, dir, base64regex;
3 years ago
return __generator(this, function (_a) {
switch (_a.label) {
3 years ago
case 0:
file = this.app.vault.getAbstractFileByPath(outputFileName);
if (!(file instanceof obsidian.TFile)) return [3 /*break*/, 2];
return [4 /*yield*/, this.app.vault.modify(file, text)];
3 years ago
case 1:
_a.sent();
2 years ago
return [3 /*break*/, 8];
3 years ago
case 2:
parts = outputFileName.split("/");
dir = parts.slice(0, parts.length - 1).join("/");
2 years ago
if (!(parts.length > 1 &&
!(this.app.vault.getAbstractFileByPath(dir) instanceof obsidian.TFolder))) return [3 /*break*/, 4];
3 years ago
return [4 /*yield*/, this.app.vault.createFolder(dir)];
case 3:
_a.sent();
_a.label = 4;
2 years ago
case 4:
base64regex = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;
if (!base64regex.test(text)) return [3 /*break*/, 6];
2 years ago
return [4 /*yield*/, this.app.vault.createBinary(outputFileName, obsidian.base64ToArrayBuffer(text))];
3 years ago
case 5:
_a.sent();
2 years ago
return [3 /*break*/, 8];
case 6: return [4 /*yield*/, this.app.vault.create(outputFileName, text)];
case 7:
_a.sent();
_a.label = 8;
case 8:
2 years ago
this.openExistingFileAndSetCursor(outputFileName, parameters);
return [2 /*return*/, this.app.vault.getAbstractFileByPath(outputFileName)];
}
});
});
};
AdvancedURI.prototype.openExistingFileAndSetCursor = function (file, parameters) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
if (parameters.openmode == "silent")
return [2 /*return*/];
if (!this.settings.openFileOnWrite) return [3 /*break*/, 3];
2 years ago
return [4 /*yield*/, this.open({
file: file,
setting: this.settings.openFileOnWriteInNewPane,
parameters: parameters,
})];
2 years ago
case 1:
_a.sent();
if (!(parameters.line != undefined)) return [3 /*break*/, 3];
return [4 /*yield*/, this.setCursorInLine(parameters)];
case 2:
_a.sent();
_a.label = 3;
case 3: return [2 /*return*/];
3 years ago
}
});
});
};
2 years ago
AdvancedURI.prototype.open = function (_a) {
var file = _a.file, setting = _a.setting, parameters = _a.parameters, supportPopover = _a.supportPopover, mode = _a.mode;
2 years ago
return __awaiter(this, void 0, void 0, function () {
var hoverEditor, leaf_1, tfile, openMode, fileIsAlreadyOpened_1;
var _this = this;
return __generator(this, function (_b) {
if (parameters.openmode == "popover" && (supportPopover !== null && supportPopover !== void 0 ? supportPopover : true)) {
hoverEditor = this.app.plugins.plugins["obsidian-hover-editor"];
if (!hoverEditor) {
new obsidian.Notice("Cannot find Hover Editor plugin. Please file an issue.");
this.failure(parameters);
}
leaf_1 = hoverEditor.spawnPopover(undefined, function () {
_this.app.workspace.setActiveLeaf(leaf_1, { focus: true });
});
tfile = file instanceof obsidian.TFile
? file
: this.app.vault.getAbstractFileByPath(file);
leaf_1.openFile(tfile);
2 years ago
}
else {
2 years ago
openMode = setting;
if (parameters.newpane !== undefined) {
openMode = parameters.newpane == "true";
}
if (parameters.openmode !== undefined) {
if (parameters.openmode == "true" ||
parameters.openmode == "false") {
openMode = parameters.openmode == "true";
}
else if (parameters.openmode == "popover") {
openMode = false;
}
else {
openMode = parameters.openmode;
}
}
if (openMode == "silent") {
return [2 /*return*/];
}
fileIsAlreadyOpened_1 = false;
if (isBoolean(openMode)) {
app.workspace.iterateAllLeaves(function (leaf) {
var _a;
if (((_a = leaf.view.file) === null || _a === void 0 ? void 0 : _a.path) === parameters.filepath) {
if (fileIsAlreadyOpened_1 && leaf.width == 0)
return;
fileIsAlreadyOpened_1 = true;
app.workspace.setActiveLeaf(leaf, { focus: true });
}
});
}
return [2 /*return*/, this.app.workspace.openLinkText(file instanceof obsidian.TFile ? file.path : file, "/", fileIsAlreadyOpened_1 ? false : openMode, mode != undefined
? { state: { mode: mode } }
: getViewStateFromMode(parameters))];
2 years ago
}
2 years ago
return [2 /*return*/];
});
});
3 years ago
};
AdvancedURI.prototype.setCursor = function (parameters) {
3 years ago
return __awaiter(this, void 0, void 0, function () {
var view, mode, editor, viewState, lastLine, lastLineLength;
3 years ago
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
view = this.app.workspace.getActiveViewOfType(obsidian.MarkdownView);
if (!view)
return [2 /*return*/];
mode = parameters.mode;
3 years ago
editor = view.editor;
viewState = view.leaf.getViewState();
viewState.state.mode = "source";
if (!(mode === "append")) return [3 /*break*/, 2];
lastLine = editor.lastLine();
lastLineLength = editor.getLine(lastLine).length;
return [4 /*yield*/, view.leaf.setViewState(viewState, { focus: true })];
case 1:
_a.sent();
editor.setCursor({ ch: lastLineLength, line: lastLine });
return [3 /*break*/, 4];
case 2:
if (!(mode === "prepend")) return [3 /*break*/, 4];
return [4 /*yield*/, view.leaf.setViewState(viewState, { focus: true })];
case 3:
_a.sent();
editor.setCursor({ ch: 0, line: 0 });
_a.label = 4;
case 4: return [4 /*yield*/, new Promise(function (resolve) { return setTimeout(resolve, 10); })];
case 5:
_a.sent();
if (!(parameters.viewmode == "preview")) return [3 /*break*/, 7];
viewState.state.mode = "preview";
return [4 /*yield*/, view.leaf.setViewState(viewState)];
case 6:
_a.sent();
_a.label = 7;
case 7: return [2 /*return*/];
3 years ago
}
});
});
};
AdvancedURI.prototype.setCursorInLine = function (parameters) {
return __awaiter(this, void 0, void 0, function () {
var rawLine, view, viewState, line;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
rawLine = parameters.line;
view = this.app.workspace.getActiveViewOfType(obsidian.MarkdownView);
if (!view)
return [2 /*return*/];
viewState = view.leaf.getViewState();
viewState.state.mode = "source";
return [4 /*yield*/, view.leaf.setViewState(viewState)];
case 1:
_a.sent();
line = Math.min(rawLine - 1, view.editor.lineCount() - 1);
view.editor.focus();
view.editor.setCursor({
line: line,
ch: view.editor.getLine(line).length,
});
return [4 /*yield*/, new Promise(function (resolve) { return setTimeout(resolve, 10); })];
case 2:
_a.sent();
if (!(parameters.viewmode == "preview")) return [3 /*break*/, 4];
viewState.state.mode = "preview";
return [4 /*yield*/, view.leaf.setViewState(viewState)];
case 3:
_a.sent();
_a.label = 4;
case 4: return [2 /*return*/];
}
});
2 years ago
});
};
3 years ago
AdvancedURI.prototype.loadSettings = function () {
return __awaiter(this, void 0, void 0, function () {
var _a, _b, _c, _d;
return __generator(this, function (_e) {
switch (_e.label) {
case 0:
_a = this;
_c = (_b = Object).assign;
_d = [DEFAULT_SETTINGS];
return [4 /*yield*/, this.loadData()];
case 1:
_a.settings = _c.apply(_b, _d.concat([_e.sent()]));
return [2 /*return*/];
}
});
});
};
AdvancedURI.prototype.saveSettings = function () {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.saveData(this.settings)];
case 1:
_a.sent();
return [2 /*return*/];
}
});
});
};
return AdvancedURI;
}(obsidian.Plugin));
module.exports = AdvancedURI;
2 years ago
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWFpbi5qcyIsInNvdXJjZXMiOlsibm9kZV9tb2R1bGVzL3RzbGliL3RzbGliLmVzNi5qcyIsIm5vZGVfbW9kdWxlcy9mZWF0aGVyLWljb25zL2Rpc3QvZmVhdGhlci5qcyIsIm5vZGVfbW9kdWxlcy9vYnNpZGlhbi1jb21tdW5pdHktbGliL2Rpc3QvdXRpbHMuanMiLCJub2RlX21vZHVsZXMvb2JzaWRpYW4tZGFpbHktbm90ZXMtaW50ZXJmYWNlL2Rpc3QvbWFpbi5qcyIsInNyYy9ibG9ja191dGlscy50cyIsInNyYy9jb25zdGFudHMudHMiLCJzcmMvZGFpbHlfbm90ZV91dGlscy50cyIsInNyYy9tb2RhbHMvZW50ZXJfZGF0YV9tb2RhbC50cyIsInNyYy9tb2RhbHMvZmlsZV9tb2RhbC50cyIsInNyYy91dGlscy50cyIsInNyYy9oYW5kbGVycy50cyIsInNyYy9tb2RhbHMvY29tbWFuZF9tb2RhbC50cyIsInNyYy9tb2RhbHMvcmVwbGFjZV9tb2RhbC50cyIsInNyYy9tb2RhbHMvc2VhcmNoX21vZGFsLnRzIiwic3JjL3NldHRpbmdzLnRzIiwibm9kZV9tb2R1bGVzL3V1aWQvZGlzdC9lc20tYnJvd3Nlci9ybmcuanMiLCJub2RlX21vZHVsZXMvdXVpZC9kaXN0L2VzbS1icm93c2VyL3JlZ2V4LmpzIiwibm9kZV9tb2R1bGVzL3V1aWQvZGlzdC9lc20tYnJvd3Nlci92YWxpZGF0ZS5qcyIsIm5vZGVfbW9kdWxlcy91dWlkL2Rpc3QvZXNtLWJyb3dzZXIvc3RyaW5naWZ5LmpzIiwibm9kZV9tb2R1bGVzL3V1aWQvZGlzdC9lc20tYnJvd3Nlci92NC5qcyIsInNyYy90b29scy50cyIsInNyYy9tYWluLnRzIl0sInNvdXJjZXNDb250ZW50IjpbIi8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKipcclxuQ29weXJpZ2h0IChjKSBNaWNyb3NvZnQgQ29ycG9yYXRpb24uXHJcblxyXG5QZXJtaXNzaW9uIHRvIHVzZSwgY29weSwgbW9kaWZ5LCBhbmQvb3IgZGlzdHJpYnV0ZSB0aGlzIHNvZnR3YXJlIGZvciBhbnlcclxucHVycG9zZSB3aXRoIG9yIHdpdGhvdXQgZmVlIGlzIGhlcmVieSBncmFudGVkLlxyXG5cclxuVEhFIFNPRlRXQVJFIElTIFBST1ZJREVEIFwiQVMgSVNcIiBBTkQgVEhFIEFVVEhPUiBESVNDTEFJTVMgQUxMIFdBUlJBTlRJRVMgV0lUSFxyXG5SRUdBUkQgVE8gVEhJUyBTT0ZUV0FSRSBJTkNMVURJTkcgQUxMIElNUExJRUQgV0FSUkFOVElFUyBPRiBNRVJDSEFOVEFCSUxJVFlcclxuQU5EIEZJVE5FU1MuIElOIE5PIEVWRU5UIFNIQUxMIFRIRSBBVVRIT1IgQkUgTElBQkxFIEZPUiBBTlkgU1BFQ0lBTCwgRElSRUNULFxyXG5JTkRJUkVDVCwgT1IgQ09OU0VRVUVOVElBTCBEQU1BR0VTIE9SIEFOWSBEQU1BR0VTIFdIQVRTT0VWRVIgUkVTVUxUSU5HIEZST01cclxuTE9TUyBPRiBVU0UsIERBVEEgT1IgUFJPRklUUywgV0hFVEhFUiBJTiBBTiBBQ1RJT04gT0YgQ09OVFJBQ1QsIE5FR0xJR0VOQ0UgT1JcclxuT1RIRVIgVE9SVElPVVMgQUNUSU9OLCBBUklTSU5HIE9VVCBPRiBPUiBJTiBDT05ORUNUSU9OIFdJVEggVEhFIFVTRSBPUlxyXG5QRVJGT1JNQU5DRSBPRiBUSElTIFNPRlRXQVJFLlxyXG4qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiAqL1xyXG4vKiBnbG9iYWwgUmVmbGVjdCwgUHJvbWlzZSAqL1xyXG5cclxudmFyIGV4dGVuZFN0YXRpY3MgPSBmdW5jdGlvbihkLCBiKSB7XHJcbiAgICBleHRlbmRTdGF0aWNzID0gT2JqZWN0LnNldFByb3RvdHlwZU9mIHx8XHJcbiAgICAgICAgKHsgX19wcm90b19fOiBbXSB9IGluc3RhbmNlb2YgQXJyYXkgJiYgZnVuY3Rpb24gKGQsIGIpIHsgZC5fX3Byb3RvX18gPSBiOyB9KSB8fFxyXG4gICAgICAgIGZ1bmN0aW9uIChkLCBiKSB7IGZvciAodmFyIHAgaW4gYikgaWYgKE9iamVjdC5wcm90b3R5cGUuaGFzT3duUHJvcGVydHkuY2FsbChiLCBwKSkgZFtwXSA9IGJbcF07IH07XHJcbiAgICByZXR1cm4gZXh0ZW5kU3RhdGljcyhkLCBiKTtcclxufTtcclxuXHJcbmV4cG9ydCBmdW5jdGlvbiBfX2V4dGVuZHMoZCwgYikge1xyXG4gICAgaWYgKHR5cGVvZiBiICE9PSBcImZ1bmN0aW9uXCIgJiYgYiAhPT0gbnVsbClcclxuICAgICAgICB0aHJvdyBuZXcgVHlwZUVycm9yKFwiQ2xhc3MgZXh0ZW5kcyB2YWx1ZSBcIiArIFN0cmluZyhiKSArIFwiIGlzIG5vdCBhIGNvbnN0cnVjdG9yIG9yIG51bGxcIik7XHJcbiAgICBleHRlbmRTdGF0aWNzKGQsIGIpO1xyXG4gICAgZnVuY3Rpb24gX18oKSB7IHRoaXMuY29uc3RydWN0b3IgPSBkOyB9XHJcbiAgICBkLnByb3RvdHlwZSA9IGIgPT09IG51bGwgPyBPYmplY3QuY3JlYXRlKGIpIDogKF9fLnByb3RvdHlwZSA9IGIucHJvdG90eXBlLCBuZXcgX18oKSk7XHJcbn1cclxuXHJcbmV4cG9ydCB2YXIgX19hc3NpZ24gPSBmdW5jdGlvbigpIHtcclxuICAgIF9fYXNzaWduID0gT2JqZWN0LmFzc2lnbiB8fCBmdW5jdGlvbiBfX2Fzc2lnbih0KSB7XHJcbiAgICAgICAgZm9yICh2YXIgcywgaSA9IDEsIG4gPSBhcmd1bWVudHMubGVuZ3RoOyBpIDwgbjsgaSsrKSB7XHJcbiAgICAgICAgICAgIHMgPSBhcmd1bWVudHNbaV07XHJcbiAgICAgICAgICAgIGZvciAodmFyIHAgaW4gcykgaWYgKE9iamVjdC5wcm90b3R5cGUuaGFzT3duUHJvcGVydHkuY2FsbChzLCBwKSkgdFtwXSA9IHNbcF07XHJcbiAgICAgICAgfVxyXG4gICAgICAgIHJldHVybiB0O1xyXG4gICAgfVxyXG4gICAgcmV0dXJuIF9fYXNzaWduLmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7XHJcbn1cclxuXHJcbmV4cG9ydCBmdW5jdGlvbiBfX3Jlc3QocywgZSkge1xyXG4gICAgdmFyIHQgPSB7fTtcclxuICAgIGZvciAodmFyIHAgaW4gcykgaWYgKE9iamVjdC5wcm90b3R5cGUuaGFzT3duUHJvcGVydHkuY2FsbChzLCBwKSAmJiBlLmluZGV4T2YocCkgPCAwKVxyXG4gICAgICAgIHRbcF0gPSBzW3BdO1xyXG4gICAgaWYgKHMgIT0gbnVsbCAmJiB0eXBlb2YgT2JqZWN0LmdldE93blByb3BlcnR5U3ltYm9scyA9PT0gXCJmdW5jdGlvblwiKVxyXG4gICAgICAgIGZvciAodmFyIGk