'use strict';
var obsidian = require('obsidian');
var state = require('@codemirror/state');
var view = require('@codemirror/view');
var language = require('@codemirror/language');
// these aren't really private, but nor are they really useful to document
/**
* @private
*/
class LuxonError extends Error {}
/**
* @private
*/
class InvalidDateTimeError extends LuxonError {
constructor(reason) {
super(`Invalid DateTime: ${reason.toMessage()}`);
}
}
/**
* @private
*/
class InvalidIntervalError extends LuxonError {
constructor(reason) {
super(`Invalid Interval: ${reason.toMessage()}`);
}
}
/**
* @private
*/
class InvalidDurationError extends LuxonError {
constructor(reason) {
super(`Invalid Duration: ${reason.toMessage()}`);
}
}
/**
* @private
*/
class ConflictingSpecificationError extends LuxonError {}
/**
* @private
*/
class InvalidUnitError extends LuxonError {
constructor(unit) {
super(`Invalid unit ${unit}`);
}
}
/**
* @private
*/
class InvalidArgumentError extends LuxonError {}
/**
* @private
*/
class ZoneIsAbstractError extends LuxonError {
constructor() {
super("Zone is an abstract class");
}
}
/**
* @private
*/
const n$1 = "numeric",
s$2 = "short",
l$2 = "long";
const DATE_SHORT = {
year: n$1,
month: n$1,
day: n$1,
};
const DATE_MED = {
year: n$1,
month: s$2,
day: n$1,
};
const DATE_MED_WITH_WEEKDAY = {
year: n$1,
month: s$2,
day: n$1,
weekday: s$2,
};
const DATE_FULL = {
year: n$1,
month: l$2,
day: n$1,
};
const DATE_HUGE = {
year: n$1,
month: l$2,
day: n$1,
weekday: l$2,
};
const TIME_SIMPLE = {
hour: n$1,
minute: n$1,
};
const TIME_WITH_SECONDS = {
hour: n$1,
minute: n$1,
second: n$1,
};
const TIME_WITH_SHORT_OFFSET = {
hour: n$1,
minute: n$1,
second: n$1,
timeZoneName: s$2,
};
const TIME_WITH_LONG_OFFSET = {
hour: n$1,
minute: n$1,
second: n$1,
timeZoneName: l$2,
};
const TIME_24_SIMPLE = {
hour: n$1,
minute: n$1,
hourCycle: "h23",
};
const TIME_24_WITH_SECONDS = {
hour: n$1,
minute: n$1,
second: n$1,
hourCycle: "h23",
};
const TIME_24_WITH_SHORT_OFFSET = {
hour: n$1,
minute: n$1,
second: n$1,
hourCycle: "h23",
timeZoneName: s$2,
};
const TIME_24_WITH_LONG_OFFSET = {
hour: n$1,
minute: n$1,
second: n$1,
hourCycle: "h23",
timeZoneName: l$2,
};
const DATETIME_SHORT = {
year: n$1,
month: n$1,
day: n$1,
hour: n$1,
minute: n$1,
};
const DATETIME_SHORT_WITH_SECONDS = {
year: n$1,
month: n$1,
day: n$1,
hour: n$1,
minute: n$1,
second: n$1,
};
const DATETIME_MED = {
year: n$1,
month: s$2,
day: n$1,
hour: n$1,
minute: n$1,
};
const DATETIME_MED_WITH_SECONDS = {
year: n$1,
month: s$2,
day: n$1,
hour: n$1,
minute: n$1,
second: n$1,
};
const DATETIME_MED_WITH_WEEKDAY = {
year: n$1,
month: s$2,
day: n$1,
weekday: s$2,
hour: n$1,
minute: n$1,
};
const DATETIME_FULL = {
year: n$1,
month: l$2,
day: n$1,
hour: n$1,
minute: n$1,
timeZoneName: s$2,
};
const DATETIME_FULL_WITH_SECONDS = {
year: n$1,
month: l$2,
day: n$1,
hour: n$1,
minute: n$1,
second: n$1,
timeZoneName: s$2,
};
const DATETIME_HUGE = {
year: n$1,
month: l$2,
day: n$1,
weekday: l$2,
hour: n$1,
minute: n$1,
timeZoneName: l$2,
};
const DATETIME_HUGE_WITH_SECONDS = {
year: n$1,
month: l$2,
day: n$1,
weekday: l$2,
hour: n$1,
minute: n$1,
second: n$1,
timeZoneName: l$2,
};
/**
* @interface
*/
class Zone {
/**
* The type of zone
* @abstract
* @type {string}
*/
get type() {
throw new ZoneIsAbstractError();
}
/**
* The name of this zone.
* @abstract
* @type {string}
*/
get name() {
throw new ZoneIsAbstractError();
}
get ianaName() {
return this.name;
}
/**
* Returns whether the offset is known to be fixed for the whole year.
* @abstract
* @type {boolean}
*/
get isUniversal() {
throw new ZoneIsAbstractError();
}
/**
* Returns the offset's common name (such as EST) at the specified timestamp
* @abstract
* @param {number} ts - Epoch milliseconds for which to get the name
* @param {Object} opts - Options to affect the format
* @param {string} opts.format - What style of offset to return. Accepts 'long' or 'short'.
* @param {string} opts.locale - What locale to return the offset name in.
* @return {string}
*/
offsetName(ts, opts) {
throw new ZoneIsAbstractError();
}
/**
* Returns the offset's value as a string
* @abstract
* @param {number} ts - Epoch milliseconds for which to get the offset
* @param {string} format - What style of offset to return.
* Accepts 'narrow', 'short', or 'techie'. Returning '+6', '+06:00', or '+0600' respectively
* @return {string}
*/
formatOffset(ts, format) {
throw new ZoneIsAbstractError();
}
/**
* Return the offset in minutes for this zone at the specified timestamp.
* @abstract
* @param {number} ts - Epoch milliseconds for which to compute the offset
* @return {number}
*/
offset(ts) {
throw new ZoneIsAbstractError();
}
/**
* Return whether this Zone is equal to another zone
* @abstract
* @param {Zone} otherZone - the zone to compare
* @return {boolean}
*/
equals(otherZone) {
throw new ZoneIsAbstractError();
}
/**
* Return whether this Zone is valid.
* @abstract
* @type {boolean}
*/
get isValid() {
throw new ZoneIsAbstractError();
}
}
let singleton$1 = null;
/**
* Represents the local zone for this JavaScript environment.
* @implements {Zone}
*/
class SystemZone extends Zone {
/**
* Get a singleton instance of the local zone
* @return {SystemZone}
*/
static get instance() {
if (singleton$1 === null) {
singleton$1 = new SystemZone();
}
return singleton$1;
}
/** @override **/
get type() {
return "system";
}
/** @override **/
get name() {
return new Intl.DateTimeFormat().resolvedOptions().timeZone;
}
/** @override **/
get isUniversal() {
return false;
}
/** @override **/
offsetName(ts, { format, locale }) {
return parseZoneInfo(ts, format, locale);
}
/** @override **/
formatOffset(ts, format) {
return formatOffset(this.offset(ts), format);
}
/** @override **/
offset(ts) {
return -new Date(ts).getTimezoneOffset();
}
/** @override **/
equals(otherZone) {
return otherZone.type === "system";
}
/** @override **/
get isValid() {
return true;
}
}
let dtfCache = {};
function makeDTF(zone) {
if (!dtfCache[zone]) {
dtfCache[zone] = new Intl.DateTimeFormat("en-US", {
hour12: false,
timeZone: zone,
year: "numeric",
month: "2-digit",
day: "2-digit",
hour: "2-digit",
minute: "2-digit",
second: "2-digit",
era: "short",
});
}
return dtfCache[zone];
}
const typeToPos = {
year: 0,
month: 1,
day: 2,
era: 3,
hour: 4,
minute: 5,
second: 6,
};
function hackyOffset(dtf, date) {
const formatted = dtf.format(date).replace(/\u200E/g, ""),
parsed = /(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(formatted),
[, fMonth, fDay, fYear, fadOrBc, fHour, fMinute, fSecond] = parsed;
return [fYear, fMonth, fDay, fadOrBc, fHour, fMinute, fSecond];
}
function partsOffset(dtf, date) {
const formatted = dtf.formatToParts(date);
const filled = [];
for (let i = 0; i < formatted.length; i++) {
const { type, value } = formatted[i];
const pos = typeToPos[type];
if (type === "era") {
filled[pos] = value;
} else if (!isUndefined(pos)) {
filled[pos] = parseInt(value, 10);
}
}
return filled;
}
let ianaZoneCache = {};
/**
* A zone identified by an IANA identifier, like America/New_York
* @implements {Zone}
*/
class IANAZone extends Zone {
/**
* @param {string} name - Zone name
* @return {IANAZone}
*/
static cr
Obsidian dataview插件
需积分: 2 60 浏览量
2024-05-21
19:34:50
上传
评论
收藏 460KB ZIP 举报
YooPh
- 粉丝: 11
- 资源: 23
最新资源
- Servlet和JDBC实现三层架构
- Appium-Inspector-2024.6.1-win
- Screenshot_2024-06-14-21-22-39-202_net.csdn.csdnplus.jpg
- Appium-Server-GUI-windows-1.22.3-4
- 基于C语言+python实现的永磁同步电机矢量控制算法仿真+源码(毕业设计&课程设计&项目开发)
- APKPure_v3.20.05_apkpure.com.apk
- HKJC_AOSBS_PROD_L2.7R2Q_Build8172.apk
- jetson官网下载的官方资料
- 小游戏的java程序开发
- matlab GUI仿真资源.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈