8546 lines
368 KiB
JavaScript
8546 lines
368 KiB
JavaScript
/*
|
|
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
|
|
if you want to view the source, please visit the github repository of this plugin
|
|
*/
|
|
|
|
var __create = Object.create;
|
|
var __defProp = Object.defineProperty;
|
|
var __defProps = Object.defineProperties;
|
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
var __getProtoOf = Object.getPrototypeOf;
|
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
var __spreadValues = (a, b) => {
|
|
for (var prop in b || (b = {}))
|
|
if (__hasOwnProp.call(b, prop))
|
|
__defNormalProp(a, prop, b[prop]);
|
|
if (__getOwnPropSymbols)
|
|
for (var prop of __getOwnPropSymbols(b)) {
|
|
if (__propIsEnum.call(b, prop))
|
|
__defNormalProp(a, prop, b[prop]);
|
|
}
|
|
return a;
|
|
};
|
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
var __export = (target, all) => {
|
|
__markAsModule(target);
|
|
for (var name in all)
|
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
};
|
|
var __reExport = (target, module2, desc) => {
|
|
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
for (let key of __getOwnPropNames(module2))
|
|
if (!__hasOwnProp.call(target, key) && key !== "default")
|
|
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
}
|
|
return target;
|
|
};
|
|
var __toModule = (module2) => {
|
|
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
};
|
|
var __publicField = (obj, key, value) => {
|
|
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
return value;
|
|
};
|
|
var __async = (__this, __arguments, generator) => {
|
|
return new Promise((resolve, reject) => {
|
|
var fulfilled = (value) => {
|
|
try {
|
|
step(generator.next(value));
|
|
} catch (e) {
|
|
reject(e);
|
|
}
|
|
};
|
|
var rejected = (value) => {
|
|
try {
|
|
step(generator.throw(value));
|
|
} catch (e) {
|
|
reject(e);
|
|
}
|
|
};
|
|
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
});
|
|
};
|
|
|
|
// src/main.ts
|
|
__export(exports, {
|
|
default: () => LatexSuitePlugin
|
|
});
|
|
var import_obsidian8 = __toModule(require("obsidian"));
|
|
|
|
// src/settings/file_watch.ts
|
|
var import_obsidian = __toModule(require("obsidian"));
|
|
|
|
// node_modules/valibot/dist/index.js
|
|
var ValiError = class extends Error {
|
|
constructor(issues) {
|
|
super(issues[0].message);
|
|
__publicField(this, "issues");
|
|
this.name = "ValiError";
|
|
this.issues = issues;
|
|
}
|
|
};
|
|
var BrandSymbol = Symbol("brand");
|
|
function errorMessage(message) {
|
|
return typeof message === "function" ? message() : message;
|
|
}
|
|
function defaultArgs(arg1, arg2) {
|
|
return Array.isArray(arg1) ? [void 0, arg1] : [arg1, arg2];
|
|
}
|
|
function parseResult(typed, output, issues) {
|
|
return { typed, output, issues };
|
|
}
|
|
function restAndDefaultArgs(arg1, arg2, arg3) {
|
|
if (!arg1 || typeof arg1 === "object" && !Array.isArray(arg1)) {
|
|
const [error2, pipe2] = defaultArgs(arg2, arg3);
|
|
return [arg1, error2, pipe2];
|
|
}
|
|
const [error, pipe] = defaultArgs(arg1, arg2);
|
|
return [void 0, error, pipe];
|
|
}
|
|
function pipeIssue(info, issue) {
|
|
return {
|
|
reason: info == null ? void 0 : info.reason,
|
|
validation: issue.validation,
|
|
origin: (info == null ? void 0 : info.origin) || "value",
|
|
message: issue.message,
|
|
input: issue.input,
|
|
requirement: issue == null ? void 0 : issue.requirement,
|
|
path: issue.path,
|
|
abortEarly: info == null ? void 0 : info.abortEarly,
|
|
abortPipeEarly: info == null ? void 0 : info.abortPipeEarly,
|
|
skipPipe: info == null ? void 0 : info.skipPipe
|
|
};
|
|
}
|
|
function pipeInfo(info, reason) {
|
|
return {
|
|
reason,
|
|
origin: info == null ? void 0 : info.origin,
|
|
abortEarly: info == null ? void 0 : info.abortEarly,
|
|
abortPipeEarly: info == null ? void 0 : info.abortPipeEarly,
|
|
skipPipe: info == null ? void 0 : info.skipPipe
|
|
};
|
|
}
|
|
function pipeResult(input, pipe, parseInfo, reason, issues) {
|
|
let info;
|
|
let output = input;
|
|
if ((pipe == null ? void 0 : pipe.length) && !(parseInfo == null ? void 0 : parseInfo.skipPipe)) {
|
|
for (const action of pipe) {
|
|
const result = action._parse(output);
|
|
if (result.issues) {
|
|
info = info || pipeInfo(parseInfo, reason);
|
|
for (const issueInfo of result.issues) {
|
|
const issue = pipeIssue(info, issueInfo);
|
|
issues ? issues.push(issue) : issues = [issue];
|
|
}
|
|
if (info.abortEarly || info.abortPipeEarly) {
|
|
break;
|
|
}
|
|
} else {
|
|
output = result.output;
|
|
}
|
|
}
|
|
}
|
|
return parseResult(true, output, issues);
|
|
}
|
|
function schemaIssue(info, reason, validation, message, input, issues) {
|
|
return {
|
|
typed: false,
|
|
output: input,
|
|
issues: [
|
|
{
|
|
reason,
|
|
validation,
|
|
origin: (info == null ? void 0 : info.origin) || "value",
|
|
message: errorMessage(message),
|
|
input,
|
|
issues,
|
|
abortEarly: info == null ? void 0 : info.abortEarly,
|
|
abortPipeEarly: info == null ? void 0 : info.abortPipeEarly,
|
|
skipPipe: info == null ? void 0 : info.skipPipe
|
|
}
|
|
]
|
|
};
|
|
}
|
|
function getDefault(schema) {
|
|
return typeof schema.default === "function" ? schema.default() : schema.default;
|
|
}
|
|
function instance(class_, arg2, arg3) {
|
|
const [message = "Invalid type", pipe] = defaultArgs(arg2, arg3);
|
|
return {
|
|
type: "instance",
|
|
async: false,
|
|
class: class_,
|
|
message,
|
|
pipe,
|
|
_parse(input, info) {
|
|
if (!(input instanceof this.class)) {
|
|
return schemaIssue(info, "type", "instance", this.message, input);
|
|
}
|
|
return pipeResult(input, this.pipe, info, "instance");
|
|
}
|
|
};
|
|
}
|
|
function number(arg1, arg2) {
|
|
const [message = "Invalid type", pipe] = defaultArgs(arg1, arg2);
|
|
return {
|
|
type: "number",
|
|
async: false,
|
|
message,
|
|
pipe,
|
|
_parse(input, info) {
|
|
if (typeof input !== "number" || isNaN(input)) {
|
|
return schemaIssue(info, "type", "number", this.message, input);
|
|
}
|
|
return pipeResult(input, this.pipe, info, "number");
|
|
}
|
|
};
|
|
}
|
|
function object(entries, arg2, arg3, arg4) {
|
|
const [rest, message = "Invalid type", pipe] = restAndDefaultArgs(arg2, arg3, arg4);
|
|
let cachedEntries;
|
|
return {
|
|
type: "object",
|
|
async: false,
|
|
entries,
|
|
rest,
|
|
message,
|
|
pipe,
|
|
_parse(input, info) {
|
|
if (!input || typeof input !== "object") {
|
|
return schemaIssue(info, "type", "object", this.message, input);
|
|
}
|
|
cachedEntries = cachedEntries || Object.entries(this.entries);
|
|
let typed = true;
|
|
let issues;
|
|
const output = {};
|
|
for (const [key, schema] of cachedEntries) {
|
|
const value2 = input[key];
|
|
const result = schema._parse(value2, info);
|
|
if (result.issues) {
|
|
const pathItem = {
|
|
type: "object",
|
|
input,
|
|
key,
|
|
value: value2
|
|
};
|
|
for (const issue of result.issues) {
|
|
if (issue.path) {
|
|
issue.path.unshift(pathItem);
|
|
} else {
|
|
issue.path = [pathItem];
|
|
}
|
|
issues == null ? void 0 : issues.push(issue);
|
|
}
|
|
if (!issues) {
|
|
issues = result.issues;
|
|
}
|
|
if (info == null ? void 0 : info.abortEarly) {
|
|
typed = false;
|
|
break;
|
|
}
|
|
}
|
|
if (!result.typed) {
|
|
typed = false;
|
|
}
|
|
if (result.output !== void 0 || key in input) {
|
|
output[key] = result.output;
|
|
}
|
|
}
|
|
if (this.rest && !((info == null ? void 0 : info.abortEarly) && issues)) {
|
|
for (const key in input) {
|
|
if (!(key in this.entries)) {
|
|
const value2 = input[key];
|
|
const result = this.rest._parse(value2, info);
|
|
if (result.issues) {
|
|
const pathItem = {
|
|
type: "object",
|
|
input,
|
|
key,
|
|
value: value2
|
|
};
|
|
for (const issue of result.issues) {
|
|
if (issue.path) {
|
|
issue.path.unshift(pathItem);
|
|
} else {
|
|
issue.path = [pathItem];
|
|
}
|
|
issues == null ? void 0 : issues.push(issue);
|
|
}
|
|
if (!issues) {
|
|
issues = result.issues;
|
|
}
|
|
if (info == null ? void 0 : info.abortEarly) {
|
|
typed = false;
|
|
break;
|
|
}
|
|
}
|
|
if (!result.typed) {
|
|
typed = false;
|
|
}
|
|
output[key] = result.output;
|
|
}
|
|
}
|
|
}
|
|
if (typed) {
|
|
return pipeResult(output, this.pipe, info, "object", issues);
|
|
}
|
|
return parseResult(false, output, issues);
|
|
}
|
|
};
|
|
}
|
|
function optional(wrapped, default_) {
|
|
return {
|
|
type: "optional",
|
|
async: false,
|
|
wrapped,
|
|
default: default_,
|
|
_parse(input, info) {
|
|
if (input === void 0) {
|
|
const override = getDefault(this);
|
|
if (override === void 0) {
|
|
return parseResult(true, input);
|
|
}
|
|
input = override;
|
|
}
|
|
return this.wrapped._parse(input, info);
|
|
}
|
|
};
|
|
}
|
|
function string(arg1, arg2) {
|
|
const [message = "Invalid type", pipe] = defaultArgs(arg1, arg2);
|
|
return {
|
|
type: "string",
|
|
async: false,
|
|
message,
|
|
pipe,
|
|
_parse(input, info) {
|
|
if (typeof input !== "string") {
|
|
return schemaIssue(info, "type", "string", this.message, input);
|
|
}
|
|
return pipeResult(input, this.pipe, info, "string");
|
|
}
|
|
};
|
|
}
|
|
function special(check, arg2, arg3) {
|
|
const [message = "Invalid type", pipe] = defaultArgs(arg2, arg3);
|
|
return {
|
|
type: "special",
|
|
async: false,
|
|
check,
|
|
message,
|
|
pipe,
|
|
_parse(input, info) {
|
|
if (!this.check(input)) {
|
|
return schemaIssue(info, "type", "special", this.message, input);
|
|
}
|
|
return pipeResult(input, this.pipe, info, "special");
|
|
}
|
|
};
|
|
}
|
|
function union(options, message = "Invalid type") {
|
|
return {
|
|
type: "union",
|
|
async: false,
|
|
options,
|
|
message,
|
|
_parse(input, info) {
|
|
let issues;
|
|
let output;
|
|
for (const schema of this.options) {
|
|
const result = schema._parse(input, info);
|
|
if (result.issues) {
|
|
if (issues) {
|
|
for (const issue of result.issues) {
|
|
issues.push(issue);
|
|
}
|
|
} else {
|
|
issues = result.issues;
|
|
}
|
|
} else {
|
|
output = [result.output];
|
|
break;
|
|
}
|
|
}
|
|
if (output) {
|
|
return parseResult(true, output[0]);
|
|
}
|
|
return schemaIssue(info, "type", "union", this.message, input, issues);
|
|
}
|
|
};
|
|
}
|
|
function parse(schema, input, info) {
|
|
const result = schema._parse(input, info);
|
|
if (result.issues) {
|
|
throw new ValiError(result.issues);
|
|
}
|
|
return result.output;
|
|
}
|
|
|
|
// node_modules/js-base64/base64.mjs
|
|
var _hasbtoa = typeof btoa === "function";
|
|
var _hasBuffer = typeof Buffer === "function";
|
|
var _TD = typeof TextDecoder === "function" ? new TextDecoder() : void 0;
|
|
var _TE = typeof TextEncoder === "function" ? new TextEncoder() : void 0;
|
|
var b64ch = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
|
|
var b64chs = Array.prototype.slice.call(b64ch);
|
|
var b64tab = ((a) => {
|
|
let tab = {};
|
|
a.forEach((c, i) => tab[c] = i);
|
|
return tab;
|
|
})(b64chs);
|
|
var _fromCC = String.fromCharCode.bind(String);
|
|
var _U8Afrom = typeof Uint8Array.from === "function" ? Uint8Array.from.bind(Uint8Array) : (it) => new Uint8Array(Array.prototype.slice.call(it, 0));
|
|
var _mkUriSafe = (src) => src.replace(/=/g, "").replace(/[+\/]/g, (m0) => m0 == "+" ? "-" : "_");
|
|
var btoaPolyfill = (bin) => {
|
|
let u32, c0, c1, c2, asc = "";
|
|
const pad = bin.length % 3;
|
|
for (let i = 0; i < bin.length; ) {
|
|
if ((c0 = bin.charCodeAt(i++)) > 255 || (c1 = bin.charCodeAt(i++)) > 255 || (c2 = bin.charCodeAt(i++)) > 255)
|
|
throw new TypeError("invalid character found");
|
|
u32 = c0 << 16 | c1 << 8 | c2;
|
|
asc += b64chs[u32 >> 18 & 63] + b64chs[u32 >> 12 & 63] + b64chs[u32 >> 6 & 63] + b64chs[u32 & 63];
|
|
}
|
|
return pad ? asc.slice(0, pad - 3) + "===".substring(pad) : asc;
|
|
};
|
|
var _btoa = _hasbtoa ? (bin) => btoa(bin) : _hasBuffer ? (bin) => Buffer.from(bin, "binary").toString("base64") : btoaPolyfill;
|
|
var _fromUint8Array = _hasBuffer ? (u8a) => Buffer.from(u8a).toString("base64") : (u8a) => {
|
|
const maxargs = 4096;
|
|
let strs = [];
|
|
for (let i = 0, l = u8a.length; i < l; i += maxargs) {
|
|
strs.push(_fromCC.apply(null, u8a.subarray(i, i + maxargs)));
|
|
}
|
|
return _btoa(strs.join(""));
|
|
};
|
|
var cb_utob = (c) => {
|
|
if (c.length < 2) {
|
|
var cc = c.charCodeAt(0);
|
|
return cc < 128 ? c : cc < 2048 ? _fromCC(192 | cc >>> 6) + _fromCC(128 | cc & 63) : _fromCC(224 | cc >>> 12 & 15) + _fromCC(128 | cc >>> 6 & 63) + _fromCC(128 | cc & 63);
|
|
} else {
|
|
var cc = 65536 + (c.charCodeAt(0) - 55296) * 1024 + (c.charCodeAt(1) - 56320);
|
|
return _fromCC(240 | cc >>> 18 & 7) + _fromCC(128 | cc >>> 12 & 63) + _fromCC(128 | cc >>> 6 & 63) + _fromCC(128 | cc & 63);
|
|
}
|
|
};
|
|
var re_utob = /[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g;
|
|
var utob = (u) => u.replace(re_utob, cb_utob);
|
|
var _encode = _hasBuffer ? (s) => Buffer.from(s, "utf8").toString("base64") : _TE ? (s) => _fromUint8Array(_TE.encode(s)) : (s) => _btoa(utob(s));
|
|
var encode = (src, urlsafe = false) => urlsafe ? _mkUriSafe(_encode(src)) : _encode(src);
|
|
|
|
// src/snippets/snippets.ts
|
|
var VISUAL_SNIPPET_MAGIC_SELECTION_PLACEHOLDER = "${VISUAL}";
|
|
var Snippet = class {
|
|
constructor(type, trigger, replacement, options, priority, description, excludedEnvironments) {
|
|
this.type = type;
|
|
this.data = { trigger, replacement };
|
|
this.options = options;
|
|
this.priority = priority;
|
|
this.description = description;
|
|
this.excludedEnvironments = excludedEnvironments != null ? excludedEnvironments : [];
|
|
}
|
|
get trigger() {
|
|
return this.data.trigger;
|
|
}
|
|
get replacement() {
|
|
return this.data.replacement;
|
|
}
|
|
toString() {
|
|
return serializeSnippetLike({
|
|
type: this.type,
|
|
trigger: this.trigger,
|
|
replacement: this.replacement,
|
|
options: this.options,
|
|
priority: this.priority,
|
|
description: this.description,
|
|
excludedEnvironments: this.excludedEnvironments
|
|
});
|
|
}
|
|
};
|
|
var VisualSnippet = class extends Snippet {
|
|
constructor({ trigger, replacement, options, priority, description, excludedEnvironments }) {
|
|
super("visual", trigger, replacement, options, priority, description, excludedEnvironments);
|
|
}
|
|
process(effectiveLine, range, sel) {
|
|
const hasSelection = !!sel;
|
|
if (!hasSelection) {
|
|
return null;
|
|
}
|
|
if (!effectiveLine.endsWith(this.trigger)) {
|
|
return null;
|
|
}
|
|
const triggerPos = range.from;
|
|
let replacement;
|
|
if (typeof this.replacement === "string") {
|
|
replacement = this.replacement.replace(VISUAL_SNIPPET_MAGIC_SELECTION_PLACEHOLDER, sel);
|
|
} else {
|
|
replacement = this.replacement(sel);
|
|
if (typeof replacement !== "string") {
|
|
return null;
|
|
}
|
|
}
|
|
return { triggerPos, replacement };
|
|
}
|
|
};
|
|
var RegexSnippet = class extends Snippet {
|
|
constructor({ trigger, replacement, options, priority, description, excludedEnvironments }) {
|
|
super("regex", trigger, replacement, options, priority, description, excludedEnvironments);
|
|
}
|
|
process(effectiveLine, range, sel) {
|
|
const hasSelection = !!sel;
|
|
if (hasSelection) {
|
|
return null;
|
|
}
|
|
const result = this.trigger.exec(effectiveLine);
|
|
if (result === null) {
|
|
return null;
|
|
}
|
|
const triggerPos = result.index;
|
|
let replacement;
|
|
if (typeof this.replacement === "string") {
|
|
const nCaptureGroups = result.length - 1;
|
|
replacement = Array.from({ length: nCaptureGroups }).map((_, i) => i + 1).reduce((replacement2, i) => replacement2.replaceAll(`[[${i - 1}]]`, result[i]), this.replacement);
|
|
} else {
|
|
replacement = this.replacement(result);
|
|
if (typeof replacement !== "string") {
|
|
return null;
|
|
}
|
|
}
|
|
return { triggerPos, replacement };
|
|
}
|
|
};
|
|
var StringSnippet = class extends Snippet {
|
|
constructor({ trigger, replacement, options, priority, description, excludedEnvironments: excludeIn }) {
|
|
super("string", trigger, replacement, options, priority, description, excludeIn);
|
|
}
|
|
process(effectiveLine, range, sel) {
|
|
const hasSelection = !!sel;
|
|
if (hasSelection) {
|
|
return null;
|
|
}
|
|
if (!effectiveLine.endsWith(this.trigger)) {
|
|
return null;
|
|
}
|
|
const triggerPos = effectiveLine.length - this.trigger.length;
|
|
const replacement = typeof this.replacement === "string" ? this.replacement : this.replacement(this.trigger);
|
|
if (typeof replacement !== "string") {
|
|
return null;
|
|
}
|
|
return { triggerPos, replacement };
|
|
}
|
|
};
|
|
function replacer(k, v) {
|
|
if (typeof v === "function") {
|
|
return "[[Function]]";
|
|
}
|
|
if (v instanceof RegExp) {
|
|
return `[[RegExp]]: ${v.toString()}`;
|
|
}
|
|
return v;
|
|
}
|
|
function serializeSnippetLike(snippetLike) {
|
|
return JSON.stringify(snippetLike, replacer, 2);
|
|
}
|
|
|
|
// src/snippets/options.ts
|
|
var Options = class {
|
|
constructor() {
|
|
this.mode = new Mode();
|
|
this.automatic = false;
|
|
this.regex = false;
|
|
this.onWordBoundary = false;
|
|
this.visual = false;
|
|
}
|
|
static fromSource(source) {
|
|
const options = new Options();
|
|
options.mode = Mode.fromSource(source);
|
|
for (const flag_char of source) {
|
|
switch (flag_char) {
|
|
case "A":
|
|
options.automatic = true;
|
|
break;
|
|
case "r":
|
|
options.regex = true;
|
|
break;
|
|
case "w":
|
|
options.onWordBoundary = true;
|
|
break;
|
|
case "v":
|
|
options.visual = true;
|
|
break;
|
|
}
|
|
}
|
|
return options;
|
|
}
|
|
};
|
|
var Mode = class {
|
|
inEquation() {
|
|
return this.inlineMath || this.blockMath;
|
|
}
|
|
inMath() {
|
|
return this.inlineMath || this.blockMath || this.codeMath;
|
|
}
|
|
strictlyInMath() {
|
|
return this.inMath() && !this.textEnv;
|
|
}
|
|
constructor() {
|
|
this.text = false;
|
|
this.blockMath = false;
|
|
this.inlineMath = false;
|
|
this.code = false;
|
|
this.textEnv = false;
|
|
}
|
|
invert() {
|
|
this.text = !this.text;
|
|
this.blockMath = !this.blockMath;
|
|
this.inlineMath = !this.inlineMath;
|
|
this.codeMath = !this.codeMath;
|
|
this.code = !this.code;
|
|
this.textEnv = !this.textEnv;
|
|
}
|
|
static fromSource(source) {
|
|
const mode = new Mode();
|
|
for (const flag_char of source) {
|
|
switch (flag_char) {
|
|
case "m":
|
|
mode.blockMath = true;
|
|
mode.inlineMath = true;
|
|
break;
|
|
case "n":
|
|
mode.inlineMath = true;
|
|
break;
|
|
case "M":
|
|
mode.blockMath = true;
|
|
break;
|
|
case "t":
|
|
mode.text = true;
|
|
break;
|
|
case "c":
|
|
mode.code = true;
|
|
break;
|
|
}
|
|
}
|
|
if (!(mode.text || mode.inlineMath || mode.blockMath || mode.codeMath || mode.code || mode.textEnv)) {
|
|
mode.invert();
|
|
return mode;
|
|
}
|
|
return mode;
|
|
}
|
|
};
|
|
|
|
// src/snippets/sort.ts
|
|
function sortSnippets(snippets2) {
|
|
return snippets2.map((snippet, i) => [getPriority(snippet), getTriggerLength(snippet), i]).sort(schwartzianSnippetCompare).map(([p, t2, i]) => snippets2[i]);
|
|
}
|
|
function schwartzianSnippetCompare(a, b) {
|
|
return comparePriority(a[0], b[0]) || compareTriggerLength(a[1], b[1]);
|
|
}
|
|
function compareTriggerLength(a, b) {
|
|
if (a < b) {
|
|
return 1;
|
|
}
|
|
if (a > b) {
|
|
return -1;
|
|
}
|
|
return 0;
|
|
}
|
|
function comparePriority(a, b) {
|
|
if (a < b) {
|
|
return 1;
|
|
}
|
|
if (a > b) {
|
|
return -1;
|
|
}
|
|
return 0;
|
|
}
|
|
function getPriority(snippet) {
|
|
return snippet.priority || 0;
|
|
}
|
|
function getTriggerLength(snippet) {
|
|
return typeof snippet.trigger === "string" ? snippet.trigger.length : snippet.trigger.source.length;
|
|
}
|
|
|
|
// src/snippets/environment.ts
|
|
var EXCLUSIONS = {
|
|
"([A-Za-z])(\\d)": { openSymbol: "\\pu{", closeSymbol: "}" },
|
|
"->": { openSymbol: "\\ce{", closeSymbol: "}" }
|
|
};
|
|
|
|
// src/snippets/parse_snippets.ts
|
|
function parseSnippets(snippetsStr, snippetVariables) {
|
|
return __async(this, null, function* () {
|
|
let rawSnippets;
|
|
try {
|
|
try {
|
|
rawSnippets = yield importModuleDefault(`data:text/javascript;base64,${encode(snippetsStr)}`);
|
|
} catch (e) {
|
|
rawSnippets = yield importModuleDefault(`data:text/javascript;base64,${encode(`export default ${snippetsStr}`)}`);
|
|
}
|
|
} catch (e) {
|
|
throw "Invalid snippet format.";
|
|
}
|
|
let parsedSnippets;
|
|
try {
|
|
rawSnippets = validateRawSnippets(rawSnippets);
|
|
parsedSnippets = rawSnippets.map((raw) => {
|
|
try {
|
|
return parseSnippet(raw, snippetVariables);
|
|
} catch (e) {
|
|
throw `${e}
|
|
Erroring snippet:
|
|
${serializeSnippetLike(raw)}`;
|
|
}
|
|
});
|
|
} catch (e) {
|
|
throw `Invalid snippet format: ${e}`;
|
|
}
|
|
parsedSnippets = sortSnippets(parsedSnippets);
|
|
return parsedSnippets;
|
|
});
|
|
}
|
|
function importModuleDefault(module2) {
|
|
return __async(this, null, function* () {
|
|
let data;
|
|
try {
|
|
data = yield import(module2);
|
|
} catch (e) {
|
|
throw `failed to import module ${module2}`;
|
|
}
|
|
if (!("default" in data)) {
|
|
throw `No default export provided for module ${module2}`;
|
|
}
|
|
return data.default;
|
|
});
|
|
}
|
|
var RawSnippetSchema = object({
|
|
trigger: union([string(), instance(RegExp)]),
|
|
replacement: union([string(), special((x) => typeof x === "function")]),
|
|
options: string(),
|
|
flags: optional(string()),
|
|
priority: optional(number()),
|
|
description: optional(string())
|
|
});
|
|
function validateRawSnippets(snippets2) {
|
|
if (!Array.isArray(snippets2)) {
|
|
throw "Expected snippets to be an array";
|
|
}
|
|
return snippets2.map((raw) => {
|
|
try {
|
|
return parse(RawSnippetSchema, raw);
|
|
} catch (e) {
|
|
throw `Value does not resemble snippet.
|
|
Erroring snippet:
|
|
${serializeSnippetLike(raw)}`;
|
|
}
|
|
});
|
|
}
|
|
function parseSnippet(raw, snippetVariables) {
|
|
var _a;
|
|
const { replacement, priority, description } = raw;
|
|
const options = Options.fromSource(raw.options);
|
|
let trigger;
|
|
let excludedEnvironments;
|
|
if (options.regex || raw.trigger instanceof RegExp) {
|
|
let triggerStr;
|
|
let flags = (_a = raw.flags) != null ? _a : "";
|
|
if (raw.trigger instanceof RegExp) {
|
|
triggerStr = raw.trigger.source;
|
|
flags = `${raw.trigger.flags}${flags}`;
|
|
} else {
|
|
triggerStr = raw.trigger;
|
|
}
|
|
flags = filterFlags(flags);
|
|
triggerStr = insertSnippetVariables(triggerStr, snippetVariables);
|
|
excludedEnvironments = getExcludedEnvironments(triggerStr);
|
|
triggerStr = `${triggerStr}$`;
|
|
trigger = new RegExp(triggerStr, flags);
|
|
options.regex = true;
|
|
const normalised = { trigger, replacement, options, priority, description, excludedEnvironments };
|
|
return new RegexSnippet(normalised);
|
|
} else {
|
|
let trigger2 = raw.trigger;
|
|
trigger2 = insertSnippetVariables(trigger2, snippetVariables);
|
|
excludedEnvironments = getExcludedEnvironments(trigger2);
|
|
if (typeof replacement === "string" && replacement.includes(VISUAL_SNIPPET_MAGIC_SELECTION_PLACEHOLDER)) {
|
|
options.visual = true;
|
|
}
|
|
const normalised = { trigger: trigger2, replacement, options, priority, description, excludedEnvironments };
|
|
if (options.visual) {
|
|
return new VisualSnippet(normalised);
|
|
} else {
|
|
return new StringSnippet(normalised);
|
|
}
|
|
}
|
|
}
|
|
function filterFlags(flags) {
|
|
const validFlags = [
|
|
"i",
|
|
"m",
|
|
"s",
|
|
"u",
|
|
"v"
|
|
];
|
|
return Array.from(new Set(flags.split(""))).filter((flag) => validFlags.includes(flag)).join("");
|
|
}
|
|
function insertSnippetVariables(trigger, variables) {
|
|
for (const [variable, replacement] of Object.entries(variables)) {
|
|
trigger = trigger.replace(variable, replacement);
|
|
}
|
|
return trigger;
|
|
}
|
|
function getExcludedEnvironments(trigger) {
|
|
const result = [];
|
|
if (EXCLUSIONS.hasOwnProperty(trigger)) {
|
|
result.push(EXCLUSIONS[trigger]);
|
|
}
|
|
return result;
|
|
}
|
|
|
|
// src/settings/file_watch.ts
|
|
function isInFolder(file, dir) {
|
|
let cur = file.parent;
|
|
let cnt = 0;
|
|
while (cur && !cur.isRoot() && cnt < 100) {
|
|
if (cur.path === dir.path)
|
|
return true;
|
|
cur = cur.parent;
|
|
cnt++;
|
|
}
|
|
return false;
|
|
}
|
|
function fileIsInSnippetsFolder(plugin, file) {
|
|
const snippetDir = plugin.app.vault.getAbstractFileByPath(plugin.settings.snippetsFileLocation);
|
|
const isFolder = snippetDir instanceof import_obsidian.TFolder;
|
|
return isFolder && isInFolder(file, snippetDir);
|
|
}
|
|
var onFileChange = (plugin, file) => __async(void 0, null, function* () {
|
|
if (!plugin.settings.loadSnippetsFromFile)
|
|
return;
|
|
if (!(file instanceof import_obsidian.TFile))
|
|
return;
|
|
if (file.path === plugin.settings.snippetsFileLocation || fileIsInSnippetsFolder(plugin, file)) {
|
|
try {
|
|
yield refreshSnippetsFromFileOrFolder(plugin);
|
|
} catch (e) {
|
|
new import_obsidian.Notice("Failed to load snippets.", 5e3);
|
|
}
|
|
}
|
|
});
|
|
var onFileCreate = (plugin, file) => {
|
|
if (!plugin.settings.loadSnippetsFromFile)
|
|
return;
|
|
if (file instanceof import_obsidian.TFile && fileIsInSnippetsFolder(plugin, file)) {
|
|
refreshSnippetsFromFileOrFolder(plugin);
|
|
}
|
|
};
|
|
var onFileDelete = (plugin, file) => {
|
|
if (!plugin.settings.loadSnippetsFromFile)
|
|
return;
|
|
const snippetDir = plugin.app.vault.getAbstractFileByPath(plugin.settings.snippetsFileLocation);
|
|
const isFolder = snippetDir instanceof import_obsidian.TFolder;
|
|
if (file instanceof import_obsidian.TFile && (isFolder && file.path.contains(snippetDir.path))) {
|
|
refreshSnippetsFromFileOrFolder(plugin);
|
|
}
|
|
};
|
|
function getSnippetsFromFile(vault, file, snippetVariables) {
|
|
return __async(this, null, function* () {
|
|
const content = yield vault.cachedRead(file);
|
|
let snippets2 = [];
|
|
try {
|
|
snippets2 = yield parseSnippets(content, snippetVariables);
|
|
} catch (e) {
|
|
new import_obsidian.Notice(`Failed to load snippet file ${file.name}`);
|
|
console.log(`Failed to load snippet file ${file.path}:`, e);
|
|
}
|
|
return snippets2;
|
|
});
|
|
}
|
|
function getSnippetsWithinFolder(vault, folder, snippetVariables) {
|
|
return __async(this, null, function* () {
|
|
const snippets2 = [];
|
|
for (const fileOrFolder of folder.children) {
|
|
if (fileOrFolder instanceof import_obsidian.TFile) {
|
|
snippets2.push(...yield getSnippetsFromFile(vault, fileOrFolder, snippetVariables));
|
|
} else if (fileOrFolder instanceof import_obsidian.TFolder) {
|
|
const folderSnippets = yield getSnippetsWithinFolder(vault, fileOrFolder, snippetVariables);
|
|
snippets2.push(...folderSnippets);
|
|
}
|
|
}
|
|
return snippets2;
|
|
});
|
|
}
|
|
function getSnippetsWithinFileOrFolder(vault, path, snippetVariables) {
|
|
return __async(this, null, function* () {
|
|
let snippets2;
|
|
const fileOrFolder = vault.getAbstractFileByPath(path);
|
|
if (fileOrFolder instanceof import_obsidian.TFolder) {
|
|
snippets2 = yield getSnippetsWithinFolder(vault, fileOrFolder, snippetVariables);
|
|
} else if (fileOrFolder instanceof import_obsidian.TFile) {
|
|
snippets2 = yield getSnippetsFromFile(vault, fileOrFolder, snippetVariables);
|
|
} else {
|
|
return [];
|
|
}
|
|
snippets2 = sortSnippets(snippets2);
|
|
return snippets2;
|
|
});
|
|
}
|
|
var refreshSnippetsFromFileOrFolder = (0, import_obsidian.debounce)((plugin) => __async(void 0, null, function* () {
|
|
if (!plugin.settings.loadSnippetsFromFile)
|
|
return;
|
|
plugin.processSettings();
|
|
new import_obsidian.Notice("Successfully reloaded snippets.", 5e3);
|
|
}), 500, true);
|
|
|
|
// src/snippets/snippet_variables.ts
|
|
function getSnippetVariables(snippetVarsStr) {
|
|
let vars = {};
|
|
try {
|
|
vars = JSON.parse(snippetVarsStr);
|
|
} catch (e) {
|
|
console.log(e);
|
|
}
|
|
return vars;
|
|
}
|
|
|
|
// _wzccwyr5f:/home/runner/work/obsidian-latex-suite/obsidian-latex-suite/src/default_snippets.js
|
|
var default_snippets_default = '[\n // Math mode\n {trigger: "mk", replacement: "$$0$", options: "tA"},\n {trigger: "dm", replacement: "$$\\n$0\\n$$", options: "tAw"},\n {trigger: "beg", replacement: "\\\\begin{$0}\\n$1\\n\\\\end{$0}", options: "mA"},\n\n\n // Dashes\n // {trigger: "--", replacement: "\u2013", options: "tA"},\n // {trigger: "\u2013-", replacement: "\u2014", options: "tA"},\n // {trigger: "\u2014-", replacement: "---", options: "tA"},\n\n\n // Greek letters\n {trigger: "@a", replacement: "\\\\alpha", options: "mA"},\n {trigger: "@A", replacement: "\\\\alpha", options: "mA"},\n {trigger: "@b", replacement: "\\\\beta", options: "mA"},\n {trigger: "@B", replacement: "\\\\beta", options: "mA"},\n {trigger: "@c", replacement: "\\\\chi", options: "mA"},\n {trigger: "@C", replacement: "\\\\chi", options: "mA"},\n {trigger: "@g", replacement: "\\\\gamma", options: "mA"},\n {trigger: "@G", replacement: "\\\\Gamma", options: "mA"},\n {trigger: "@d", replacement: "\\\\delta", options: "mA"},\n {trigger: "@D", replacement: "\\\\Delta", options: "mA"},\n {trigger: "@e", replacement: "\\\\epsilon", options: "mA"},\n {trigger: "@E", replacement: "\\\\epsilon", options: "mA"},\n {trigger: ":e", replacement: "\\\\varepsilon", options: "mA"},\n {trigger: ":E", replacement: "\\\\varepsilon", options: "mA"},\n {trigger: "@z", replacement: "\\\\zeta", options: "mA"},\n {trigger: "@Z", replacement: "\\\\zeta", options: "mA"},\n {trigger: "@t", replacement: "\\\\theta", options: "mA"},\n {trigger: "@T", replacement: "\\\\Theta", options: "mA"},\n {trigger: "@k", replacement: "\\\\kappa", options: "mA"},\n {trigger: "@K", replacement: "\\\\kappa", options: "mA"},\n {trigger: "@l", replacement: "\\\\lambda", options: "mA"},\n {trigger: "@L", replacement: "\\\\Lambda", options: "mA"},\n {trigger: "@m", replacement: "\\\\mu", options: "mA"},\n {trigger: "@M", replacement: "\\\\mu", options: "mA"},\n {trigger: "@r", replacement: "\\\\rho", options: "mA"},\n {trigger: "@R", replacement: "\\\\rho", options: "mA"},\n {trigger: "@s", replacement: "\\\\sigma", options: "mA"},\n {trigger: "@S", replacement: "\\\\Sigma", options: "mA"},\n {trigger: "ome", replacement: "\\\\omega", options: "mA"},\n {trigger: "@o", replacement: "\\\\omega", options: "mA"},\n {trigger: "@O", replacement: "\\\\Omega", options: "mA"},\n {trigger: "@u", replacement: "\\\\upsilon", options: "mA"},\n {trigger: "@U", replacement: "\\\\Upsilon", options: "mA"},\n {trigger: "([^\\\\\\\\])(${GREEK}|${SYMBOL})", replacement: "[[0]]\\\\[[1]]", options: "rmA", description: "Add backslash before greek letters and symbols"},\n\n\n // Insert space after greek letters and symbols, etc\n {trigger: "\\\\\\\\(${GREEK}|${SYMBOL}|${SHORT_SYMBOL})([A-Za-z])", replacement: "\\\\[[0]] [[1]]", options: "rmA"},\n {trigger: "\\\\\\\\(${GREEK}|${SYMBOL}) sr", replacement: "\\\\[[0]]^{2}", options: "rmA"},\n {trigger: "\\\\\\\\(${GREEK}|${SYMBOL}) cb", replacement: "\\\\[[0]]^{3}", options: "rmA"},\n {trigger: "\\\\\\\\(${GREEK}|${SYMBOL}) rd", replacement: "\\\\[[0]]^{$0}$1", options: "rmA"},\n {trigger: "\\\\\\\\(${GREEK}|${SYMBOL}) hat", replacement: "\\\\hat{\\\\[[0]]}", options: "rmA"},\n {trigger: "\\\\\\\\(${GREEK}|${SYMBOL}) dot", replacement: "\\\\dot{\\\\[[0]]}", options: "rmA"},\n {trigger: "\\\\\\\\(${GREEK}|${SYMBOL}) bar", replacement: "\\\\bar{\\\\[[0]]}", options: "rmA"},\n {trigger: "\\\\\\\\(${GREEK}|${SYMBOL}) vec", replacement: "\\\\vec{\\\\[[0]]}", options: "rmA"},\n {trigger: "\\\\\\\\(${GREEK}|${SYMBOL}) tilde", replacement: "\\\\tilde{\\\\[[0]]}", options: "rmA"},\n {trigger: "\\\\\\\\(${GREEK}|${SYMBOL}) und", replacement: "\\\\underline{\\\\[[0]]}", options: "rmA"},\n {trigger: "\\\\\\\\(${GREEK}),\\\\.", replacement: "\\\\boldsymbol{\\\\[[0]]}", options: "rmA"},\n {trigger: "\\\\\\\\(${GREEK})\\\\.,", replacement: "\\\\boldsymbol{\\\\[[0]]}", options: "rmA"},\n\n\n // Operations\n {trigger: "te", replacement: "\\\\text{$0}", options: "m"},\n {trigger: "text", replacement: "\\\\text{$0}", options: "mA"},\n {trigger: "bf", replacement: "\\\\mathbf{$0}", options: "mA"},\n {trigger: "sr", replacement: "^{2}", options: "mA"},\n {trigger: "cb", replacement: "^{3}", options: "mA"},\n {trigger: "rd", replacement: "^{$0}$1", options: "mA"},\n {trigger: "_", replacement: "_{$0}$1", options: "mA"},\n {trigger: "sts", replacement: "_\\\\text{$0}", options: "rmA"},\n {trigger: "sq", replacement: "\\\\sqrt{ $0 }$1", options: "mA"},\n {trigger: "//", replacement: "\\\\frac{$0}{$1}$2", options: "mA"},\n {trigger: "ee", replacement: "e^{ $0 }$1", options: "mA"},\n {trigger: "rm", replacement: "\\\\mathrm{$0}$1", options: "mA"},\n {trigger: "conj", replacement: "^{*}", options: "mA"},\n {trigger: "trace", replacement: "\\\\mathrm{Tr}", options: "mA"},\n {trigger: "det", replacement: "\\\\det", options: "mA"},\n {trigger: "re", replacement: "\\\\mathrm{Re}", options: "mA"},\n {trigger: "im", replacement: "\\\\mathrm{Im}", options: "mA"},\n\n {trigger: "([a-zA-Z]),\\\\.", replacement: "\\\\mathbf{[[0]]}", options: "rmA"},\n {trigger: "([a-zA-Z])\\\\.,", replacement: "\\\\mathbf{[[0]]}", options: "rmA"},\n {trigger: "([A-Za-z])(\\\\d)", replacement: "[[0]]_{[[1]]}", options: "rmA", description: "Auto letter subscript", priority: -1},\n {trigger: "([A-Za-z])_(\\\\d\\\\d)", replacement: "[[0]]_{[[1]]}", options: "rmA"},\n {trigger: "\\\\hat{([A-Za-z])}(\\\\d)", replacement: "hat{[[0]]}_{[[1]]}", options: "rmA"},\n {trigger: "\\\\\\\\mathbf{([A-Za-z])}(\\\\d)", replacement: "\\\\mathbf{[[0]]}_{[[1]]}", options: "rmA"},\n {trigger: "\\\\\\\\vec{([A-Za-z])}(\\\\d)", replacement: "\\\\vec{[[0]]}_{[[1]]}", options: "rmA"},\n {trigger: "([a-zA-Z])bar", replacement: "\\\\bar{[[0]]}", options: "rmA"},\n {trigger: "([a-zA-Z])hat", replacement: "\\\\hat{[[0]]}", options: "rmA"},\n {trigger: "([a-zA-Z])ddot", replacement: "\\\\ddot{[[0]]}", options: "rmA", priority: 3},\n {trigger: "([a-zA-Z])dot", replacement: "\\\\dot{[[0]]}", options: "rmA", priority: 1},\n {trigger: "([a-zA-Z])vec", replacement: "\\\\vec{[[0]]}", options: "rmA"},\n {trigger: "([a-zA-Z])tilde", replacement: "\\\\tilde{[[0]]}", options: "rmA"},\n {trigger: "([a-zA-Z])und", replacement: "\\\\underline{[[0]]}", options: "rmA"},\n {trigger: "bar", replacement: "\\\\bar{$0}$1", options: "mA"},\n {trigger: "hat", replacement: "\\\\hat{$0}$1", options: "mA"},\n {trigger: "dot", replacement: "\\\\dot{$0}$1", options: "mA"},\n {trigger: "ddot", replacement: "\\\\ddot{$0}$1", options: "mA", priority: 2},\n {trigger: "cdot", replacement: "\\\\cdot", options: "mA", priority: 2},\n {trigger: "vec", replacement: "\\\\vec{$0}$1", options: "mA"},\n {trigger: "tilde", replacement: "\\\\tilde{$0}$1", options: "mA"},\n {trigger: "und", replacement: "\\\\underline{$0}$1", options: "mA"},\n\n {trigger: "([^\\\\\\\\])(arcsin|arccos|arctan|arccot|arccsc|arcsec|sin|cos|tan|cot|csc|sec)", replacement: "[[0]]\\\\[[1]]", options: "rmA"},\n {trigger: "\\\\\\\\(arcsin|arccos|arctan|arccot|arccsc|arcsec|sin|cos|tan|cot|csc|sec)([A-Za-gi-z])", replacement: "\\\\[[0]] [[1]]", options: "rmA"}, // Insert space after trig funcs. Skips letter "h" to allow sinh, cosh, etc.\n {trigger: "\\\\\\\\(arcsinh|arccosh|arctanh|arccoth|arcsch|arcsech|sinh|cosh|tanh|coth|csch|sech)([A-Za-z])", replacement: "\\\\[[0]] [[1]]", options: "rmA"}, // Insert space after trig funcs\n {trigger: "\\\\\\\\(neq|geq|leq|gg|ll|sim)([0-9]+)", replacement: "\\\\[[0]] [[1]]", options: "rmA"}, // Insert space after inequality symbols\n\n\n // Visual operations\n {trigger: "U", replacement: "\\\\underbrace{ ${VISUAL} }_{ $0 }", options: "mA"},\n {trigger: "O", replacement: "\\\\overbrace{ ${VISUAL} }^{ $0 }", options: "mA"},\n {trigger: "B", replacement: "\\\\underset{ $0 }{ ${VISUAL} }", options: "mA"},\n {trigger: "C", replacement: "\\\\cancel{ ${VISUAL} }", options: "mA"},\n {trigger: "K", replacement: "\\\\cancelto{ $0 }{ ${VISUAL} }", options: "mA"},\n {trigger: "S", replacement: "\\\\sqrt{ ${VISUAL} }", options: "mA"},\n\n\n // Symbols\n {trigger: "ooo", replacement: "\\\\infty", options: "mA"},\n {trigger: "sum", replacement: "\\\\sum", options: "mA"},\n {trigger: "prod", replacement: "\\\\prod", options: "mA"},\n {trigger: "lim", replacement: "\\\\lim_{ ${0:n} \\\\to ${1:\\\\infty} } $2", options: "mA"},\n {trigger: "([^\\\\\\\\])pm", replacement: "[[0]]\\\\pm", options: "rm"},\n {trigger: "([^\\\\\\\\])mp", replacement: "[[0]]\\\\mp", options: "rm"},\n {trigger: "+-", replacement: "\\\\pm", options: "mA"},\n {trigger: "-+", replacement: "\\\\mp", options: "mA"},\n {trigger: "...", replacement: "\\\\dots", options: "mA"},\n {trigger: "<->", replacement: "\\\\leftrightarrow ", options: "mA"},\n {trigger: "->", replacement: "\\\\to", options: "mA"},\n {trigger: "!>", replacement: "\\\\mapsto", options: "mA"},\n {trigger: "invs", replacement: "^{-1}", options: "mA"},\n {trigger: "\\\\\\\\\\\\", replacement: "\\\\setminus", options: "mA"},\n {trigger: "||", replacement: "\\\\mid", options: "mA"},\n {trigger: "and", replacement: "\\\\cap", options: "mA"},\n {trigger: "orr", replacement: "\\\\cup", options: "mA"},\n {trigger: "inn", replacement: "\\\\in", options: "mA"},\n {trigger: "notin", replacement: "\\\\not\\\\in", options: "mA"},\n {trigger: "\\\\subset eq", replacement: "\\\\subseteq", options: "mA"},\n {trigger: "eset", replacement: "\\\\emptyset", options: "mA"},\n {trigger: "set", replacement: "\\\\{ $0 \\\\}$1", options: "mA"},\n {trigger: "=>", replacement: "\\\\implies", options: "mA"},\n {trigger: "=<", replacement: "\\\\impliedby", options: "mA"},\n {trigger: "iff", replacement: "\\\\iff", options: "mA"},\n {trigger: "e\\\\xi sts", replacement: "\\\\exists", options: "mA", priority: 1},\n {trigger: "===", replacement: "\\\\equiv", options: "mA"},\n {trigger: "Sq", replacement: "\\\\square", options: "mA"},\n {trigger: "!=", replacement: "\\\\neq", options: "mA"},\n {trigger: ">=", replacement: "\\\\geq", options: "mA"},\n {trigger: "<=", replacement: "\\\\leq", options: "mA"},\n {trigger: ">>", replacement: "\\\\gg", options: "mA"},\n {trigger: "<<", replacement: "\\\\ll", options: "mA"},\n {trigger: "~~", replacement: "\\\\sim", options: "mA"},\n {trigger: "\\\\sim ~", replacement: "\\\\approx", options: "mA"},\n {trigger: "prop", replacement: "\\\\propto", options: "mA"},\n {trigger: "nabl", replacement: "\\\\nabla", options: "mA"},\n {trigger: "del", replacement: "\\\\nabla", options: "mA"},\n {trigger: "xx", replacement: "\\\\times", options: "mA"},\n {trigger: "**", replacement: "\\\\cdot", options: "mA"},\n {trigger: "para", replacement: "\\\\parallel", options: "mA"},\n\n {trigger: "xnn", replacement: "x_{n}", options: "mA"},\n {trigger: "xii", replacement: "x_{i}", options: "mA"},\n {trigger: "xjj", replacement: "x_{j}", options: "mA"},\n {trigger: "xp1", replacement: "x_{n+1}", options: "mA"},\n {trigger: "ynn", replacement: "y_{n}", options: "mA"},\n {trigger: "yii", replacement: "y_{i}", options: "mA"},\n {trigger: "yjj", replacement: "y_{j}", options: "mA"},\n\n {trigger: "mcal", replacement: "\\\\mathcal{$0}$1", options: "mA"},\n {trigger: "mbb", replacement: "\\\\mathbb{$0}$1", options: "mA"},\n {trigger: "ell", replacement: "\\\\ell", options: "mA"},\n {trigger: "lll", replacement: "\\\\ell", options: "mA"},\n {trigger: "LL", replacement: "\\\\mathcal{L}", options: "mA"},\n {trigger: "HH", replacement: "\\\\mathcal{H}", options: "mA"},\n {trigger: "CC", replacement: "\\\\mathbb{C}", options: "mA"},\n {trigger: "RR", replacement: "\\\\mathbb{R}", options: "mA"},\n {trigger: "ZZ", replacement: "\\\\mathbb{Z}", options: "mA"},\n {trigger: "NN", replacement: "\\\\mathbb{N}", options: "mA"},\n {trigger: "II", replacement: "\\\\mathbb{1}", options: "mA"},\n {trigger: "\\\\mathbb{1}I", replacement: "\\\\hat{\\\\mathbb{1}}", options: "mA"},\n {trigger: "AA", replacement: "\\\\mathcal{A}", options: "mA"},\n {trigger: "BB", replacement: "\\\\mathbf{B}", options: "mA"},\n {trigger: "EE", replacement: "\\\\mathbf{E}", options: "mA"},\n\n\n // Unit vectors\n {trigger: ":i", replacement: "\\\\mathbf{i}", options: "mA"},\n {trigger: ":j", replacement: "\\\\mathbf{j}", options: "mA"},\n {trigger: ":k", replacement: "\\\\mathbf{k}", options: "mA"},\n {trigger: ":x", replacement: "\\\\hat{\\\\mathbf{x}}", options: "mA"},\n {trigger: ":y", replacement: "\\\\hat{\\\\mathbf{y}}", options: "mA"},\n {trigger: ":z", replacement: "\\\\hat{\\\\mathbf{z}}", options: "mA"},\n\n\n // Derivatives\n {trigger: "par", replacement: "\\\\frac{ \\\\partial ${0:y} }{ \\\\partial ${1:x} } $2", options: "m"},\n {trigger: "pa2", replacement: "\\\\frac{ \\\\partial^{2} ${0:y} }{ \\\\partial ${1:x}^{2} } $2", options: "mA"},\n {trigger: "pa3", replacement: "\\\\frac{ \\\\partial^{3} ${0:y} }{ \\\\partial ${1:x}^{3} } $2", options: "mA"},\n {trigger: "pa([A-Za-z])([A-Za-z])", replacement: "\\\\frac{ \\\\partial [[0]] }{ \\\\partial [[1]] } ", options: "rm"},\n {trigger: "pa([A-Za-z])([A-Za-z])([A-Za-z])", replacement: "\\\\frac{ \\\\partial^{2} [[0]] }{ \\\\partial [[1]] \\\\partial [[2]] } ", options: "rm"},\n {trigger: "pa([A-Za-z])([A-Za-z])2", replacement: "\\\\frac{ \\\\partial^{2} [[0]] }{ \\\\partial [[1]]^{2} } ", options: "rmA"},\n {trigger: "de([A-Za-z])([A-Za-z])", replacement: "\\\\frac{ d[[0]] }{ d[[1]] } ", options: "rm"},\n {trigger: "de([A-Za-z])([A-Za-z])2", replacement: "\\\\frac{ d^{2}[[0]] }{ d[[1]]^{2} } ", options: "rmA"},\n {trigger: "ddt", replacement: "\\\\frac{d}{dt} ", options: "mA"},\n\n\n // Integrals\n {trigger: "oinf", replacement: "\\\\int_{0}^{\\\\infty} $0 \\\\, d${1:x} $2", options: "mA"},\n {trigger: "infi", replacement: "\\\\int_{-\\\\infty}^{\\\\infty} $0 \\\\, d${1:x} $2", options: "mA"},\n {trigger: "dint", replacement: "\\\\int_{${0:0}}^{${1:\\\\infty}} $2 \\\\, d${3:x} $4", options: "mA"},\n {trigger: "oint", replacement: "\\\\oint", options: "mA"},\n {trigger: "iiint", replacement: "\\\\iiint", options: "mA"},\n {trigger: "iint", replacement: "\\\\iint", options: "mA"},\n {trigger: "int", replacement: "\\\\int $0 \\\\, d${1:x} $2", options: "mA"},\n\n\n // Physics\n {trigger: "kbt", replacement: "k_{B}T", options: "mA"},\n\n\n // Quantum mechanics\n {trigger: "hba", replacement: "\\\\hbar", options: "mA"},\n {trigger: "dag", replacement: "^{\\\\dagger}", options: "mA"},\n {trigger: "o+", replacement: "\\\\oplus ", options: "mA"},\n {trigger: "ox", replacement: "\\\\otimes ", options: "mA"},\n {trigger: "ot\\\\mathrm{Im}es", replacement: "\\\\otimes ", options: "mA"}, // Handle conflict with "im" snippet\n {trigger: "bra", replacement: "\\\\bra{$0} $1", options: "mA"},\n {trigger: "ket", replacement: "\\\\ket{$0} $1", options: "mA"},\n {trigger: "brk", replacement: "\\\\braket{ $0 | $1 } $2", options: "mA"},\n {trigger: "\\\\\\\\bra{([^|]+)\\\\|", replacement: "\\\\braket{ [[0]] | $0 ", options: "rmA", description: "Convert bra into braket"},\n {trigger: "\\\\\\\\bra{(.+)}([^ ]+)>", replacement: "\\\\braket{ [[0]] | $0 ", options: "rmA", description: "Convert bra into braket (alternate)"},\n {trigger: "outp", replacement: "\\\\ket{${0:\\\\psi}} \\\\bra{${0:\\\\psi}} $1", options: "mA"},\n\n\n // Chemistry\n {trigger: "pu", replacement: "\\\\pu{ $0 }", options: "mA"},\n {trigger: "msun", replacement: "M_{\\\\odot}", options: "mA"},\n {trigger: "solm", replacement: "M_{\\\\odot}", options: "mA"},\n {trigger: "cee", replacement: "\\\\ce{ $0 }", options: "mA"},\n {trigger: "iso", replacement: "{}^{${0:4}}_{${1:2}}${2:He}", options: "mA"},\n {trigger: "hel4", replacement: "{}^{4}_{2}He ", options: "mA"},\n {trigger: "hel3", replacement: "{}^{3}_{2}He ", options: "mA"},\n\n\n // Environments\n {trigger: "pmat", replacement: "\\\\begin{pmatrix}\\n$0\\n\\\\end{pmatrix}", options: "MA"},\n {trigger: "bmat", replacement: "\\\\begin{bmatrix}\\n$0\\n\\\\end{bmatrix}", options: "MA"},\n {trigger: "Bmat", replacement: "\\\\begin{Bmatrix}\\n$0\\n\\\\end{Bmatrix}", options: "MA"},\n {trigger: "vmat", replacement: "\\\\begin{vmatrix}\\n$0\\n\\\\end{vmatrix}", options: "MA"},\n {trigger: "Vmat", replacement: "\\\\begin{Vmatrix}\\n$0\\n\\\\end{Vmatrix}", options: "MA"},\n {trigger: "matrix", replacement: "\\\\begin{matrix}\\n$0\\n\\\\end{matrix}", options: "MA"},\n {trigger: "pmat", replacement: "\\\\begin{pmatrix}$0\\\\end{pmatrix}", options: "nA"},\n {trigger: "bmat", replacement: "\\\\begin{bmatrix}$0\\\\end{bmatrix}", options: "nA"},\n {trigger: "Bmat", replacement: "\\\\begin{Bmatrix}$0\\\\end{Bmatrix}", options: "nA"},\n {trigger: "vmat", replacement: "\\\\begin{vmatrix}$0\\\\end{vmatrix}", options: "nA"},\n {trigger: "Vmat", replacement: "\\\\begin{Vmatrix}$0\\\\end{Vmatrix}", options: "nA"},\n {trigger: "matrix", replacement: "\\\\begin{matrix}$0\\\\end{matrix}", options: "nA"},\n {trigger: "case", replacement: "\\\\begin{cases}\\n$0\\n\\\\end{cases}", options: "mA"},\n {trigger: "align", replacement: "\\\\begin{align}\\n$0\\n\\\\end{align}", options: "mA"},\n {trigger: "array", replacement: "\\\\begin{array}\\n$0\\n\\\\end{array}", options: "mA"},\n\n\n // Brackets\n {trigger: "avg", replacement: "\\\\langle $0 \\\\rangle $1", options: "mA"},\n {trigger: "norm", replacement: "\\\\lvert $0 \\\\rvert $1", options: "mA", priority: 1},\n {trigger: "Norm", replacement: "\\\\lVert $0 \\\\rVert $1", options: "mA", priority: 1},\n {trigger: "ceil", replacement: "\\\\lceil $0 \\\\rceil $1", options: "mA"},\n {trigger: "floor", replacement: "\\\\lfloor $0 \\\\rfloor $1", options: "mA"},\n {trigger: "mod", replacement: "|$0|$1", options: "mA"},\n {trigger: "(", replacement: "(${VISUAL})", options: "mA"},\n {trigger: "[", replacement: "[${VISUAL}]", options: "mA"},\n {trigger: "{", replacement: "{${VISUAL}}", options: "mA"},\n {trigger: "(", replacement: "($0)$1", options: "mA"},\n {trigger: "{", replacement: "{$0}$1", options: "mA"},\n {trigger: "[", replacement: "[$0]$1", options: "mA"},\n {trigger: "lr(", replacement: "\\\\left( $0 \\\\right) $1", options: "mA"},\n {trigger: "lr|", replacement: "\\\\left| $0 \\\\right| $1", options: "mA"},\n {trigger: "lr{", replacement: "\\\\left\\\\{ $0 \\\\right\\\\} $1", options: "mA"},\n {trigger: "lr[", replacement: "\\\\left[ $0 \\\\right] $1", options: "mA"},\n {trigger: "lra", replacement: "\\\\left< $0 \\\\right> $1", options: "mA"},\n\n\n // Misc\n {trigger: "tayl", replacement: "${0:f}(${1:x} + ${2:h}) = ${0:f}(${1:x}) + ${0:f}\'(${1:x})${2:h} + ${0:f}\'\'(${1:x}) \\\\frac{${2:h}^{2}}{2!} + \\\\dots$3", options: "mA"},\n {trigger: /iden(\\d)/, replacement: (match) => {\n const n = match[1];\n\n let arr = [];\n for (let j = 0; j < n; j++) {\n arr[j] = [];\n for (let i = 0; i < n; i++) {\n arr[j][i] = (i === j) ? 1 : 0;\n }\n }\n\n let output = arr.map(el => el.join(" & ")).join(" \\\\\\\\\\n");\n output = `\\\\begin{pmatrix}\\n${output}\\n\\\\end{pmatrix}`;\n return output;\n }, options: "mA", description: "N x N identity matrix"},\n]\n';
|
|
|
|
// src/utils/default_snippets.ts
|
|
var DEFAULT_SNIPPETS = default_snippets_default;
|
|
|
|
// src/settings/settings.ts
|
|
var DEFAULT_SETTINGS = {
|
|
snippets: DEFAULT_SNIPPETS,
|
|
snippetsEnabled: true,
|
|
snippetsTrigger: "Tab",
|
|
removeSnippetWhitespace: true,
|
|
loadSnippetsFromFile: false,
|
|
snippetsFileLocation: "",
|
|
concealEnabled: false,
|
|
colorPairedBracketsEnabled: true,
|
|
highlightCursorBracketsEnabled: true,
|
|
mathPreviewEnabled: true,
|
|
mathPreviewPositionIsAbove: true,
|
|
autofractionEnabled: true,
|
|
autofractionSymbol: "\\frac",
|
|
autofractionBreakingChars: "+-= ",
|
|
matrixShortcutsEnabled: true,
|
|
taboutEnabled: true,
|
|
autoEnlargeBrackets: true,
|
|
wordDelimiters: "., +-\\n :;!?\\/{}[]()=~$",
|
|
autofractionExcludedEnvs: `[
|
|
["^{", "}"],
|
|
["\\\\pu{", "}"]
|
|
]`,
|
|
matrixShortcutsEnvNames: "pmatrix, cases, align, bmatrix, Bmatrix, vmatrix, Vmatrix, array, matrix",
|
|
autoEnlargeBracketsTriggers: "sum, int, frac, prod, bigcup, bigcap",
|
|
forceMathLanguages: "math",
|
|
snippetVariables: `{
|
|
"\${GREEK}": "alpha|beta|gamma|Gamma|delta|Delta|epsilon|varepsilon|zeta|eta|theta|Theta|iota|kappa|lambda|Lambda|mu|nu|omicron|xi|Xi|pi|Pi|rho|sigma|Sigma|tau|upsilon|Upsilon|varphi|phi|Phi|chi|psi|Psi|omega|Omega",
|
|
"\${SYMBOL}": "hbar|ell|nabla|infty|dots|leftrightarrow|mapsto|setminus|mid|bigcap|bigcup|cap|cup|land|lor|subseteq|subset|implies|impliedby|iff|exists|forall|equiv|square|neq|geq|leq|gg|ll|sim|simeq|approx|propto|cdot|oplus|otimes|times|star|perp|det|exp|ln|log|partial",
|
|
"\${SHORT_SYMBOL}": "to|pm|mp"
|
|
}`
|
|
};
|
|
function processLatexSuiteSettings(snippets2, settings) {
|
|
function strToArray(str) {
|
|
return str.replace(/\s/g, "").split(",");
|
|
}
|
|
function getAutofractionExcludedEnvs(envsStr) {
|
|
let envs = [];
|
|
try {
|
|
const envsJSON = JSON.parse(envsStr);
|
|
envs = envsJSON.map(function(env) {
|
|
return { openSymbol: env[0], closeSymbol: env[1] };
|
|
});
|
|
} catch (e) {
|
|
console.log(e);
|
|
}
|
|
return envs;
|
|
}
|
|
return __spreadProps(__spreadValues({}, settings), {
|
|
snippets: snippets2,
|
|
autofractionExcludedEnvs: getAutofractionExcludedEnvs(settings.autofractionExcludedEnvs),
|
|
matrixShortcutsEnvNames: strToArray(settings.matrixShortcutsEnvNames),
|
|
autoEnlargeBracketsTriggers: strToArray(settings.autoEnlargeBracketsTriggers),
|
|
forceMathLanguages: strToArray(settings.forceMathLanguages),
|
|
snippetVariables: getSnippetVariables(settings.snippetVariables)
|
|
});
|
|
}
|
|
|
|
// src/settings/settings_tab.ts
|
|
var import_obsidian4 = __toModule(require("obsidian"));
|
|
var import_view4 = __toModule(require("@codemirror/view"));
|
|
var import_state3 = __toModule(require("@codemirror/state"));
|
|
|
|
// src/settings/ui/snippets_editor/extensions.ts
|
|
var import_view3 = __toModule(require("@codemirror/view"));
|
|
var import_state2 = __toModule(require("@codemirror/state"));
|
|
|
|
// node_modules/@lezer/common/dist/index.js
|
|
var DefaultBufferLength = 1024;
|
|
var nextPropID = 0;
|
|
var Range = class {
|
|
constructor(from, to) {
|
|
this.from = from;
|
|
this.to = to;
|
|
}
|
|
};
|
|
var NodeProp = class {
|
|
constructor(config2 = {}) {
|
|
this.id = nextPropID++;
|
|
this.perNode = !!config2.perNode;
|
|
this.deserialize = config2.deserialize || (() => {
|
|
throw new Error("This node type doesn't define a deserialize function");
|
|
});
|
|
}
|
|
add(match) {
|
|
if (this.perNode)
|
|
throw new RangeError("Can't add per-node props to node types");
|
|
if (typeof match != "function")
|
|
match = NodeType.match(match);
|
|
return (type) => {
|
|
let result = match(type);
|
|
return result === void 0 ? null : [this, result];
|
|
};
|
|
}
|
|
};
|
|
NodeProp.closedBy = new NodeProp({ deserialize: (str) => str.split(" ") });
|
|
NodeProp.openedBy = new NodeProp({ deserialize: (str) => str.split(" ") });
|
|
NodeProp.group = new NodeProp({ deserialize: (str) => str.split(" ") });
|
|
NodeProp.contextHash = new NodeProp({ perNode: true });
|
|
NodeProp.lookAhead = new NodeProp({ perNode: true });
|
|
NodeProp.mounted = new NodeProp({ perNode: true });
|
|
var MountedTree = class {
|
|
constructor(tree, overlay, parser2) {
|
|
this.tree = tree;
|
|
this.overlay = overlay;
|
|
this.parser = parser2;
|
|
}
|
|
static get(tree) {
|
|
return tree && tree.props && tree.props[NodeProp.mounted.id];
|
|
}
|
|
};
|
|
var noProps = Object.create(null);
|
|
var NodeType = class {
|
|
constructor(name, props, id2, flags = 0) {
|
|
this.name = name;
|
|
this.props = props;
|
|
this.id = id2;
|
|
this.flags = flags;
|
|
}
|
|
static define(spec) {
|
|
let props = spec.props && spec.props.length ? Object.create(null) : noProps;
|
|
let flags = (spec.top ? 1 : 0) | (spec.skipped ? 2 : 0) | (spec.error ? 4 : 0) | (spec.name == null ? 8 : 0);
|
|
let type = new NodeType(spec.name || "", props, spec.id, flags);
|
|
if (spec.props)
|
|
for (let src of spec.props) {
|
|
if (!Array.isArray(src))
|
|
src = src(type);
|
|
if (src) {
|
|
if (src[0].perNode)
|
|
throw new RangeError("Can't store a per-node prop on a node type");
|
|
props[src[0].id] = src[1];
|
|
}
|
|
}
|
|
return type;
|
|
}
|
|
prop(prop) {
|
|
return this.props[prop.id];
|
|
}
|
|
get isTop() {
|
|
return (this.flags & 1) > 0;
|
|
}
|
|
get isSkipped() {
|
|
return (this.flags & 2) > 0;
|
|
}
|
|
get isError() {
|
|
return (this.flags & 4) > 0;
|
|
}
|
|
get isAnonymous() {
|
|
return (this.flags & 8) > 0;
|
|
}
|
|
is(name) {
|
|
if (typeof name == "string") {
|
|
if (this.name == name)
|
|
return true;
|
|
let group = this.prop(NodeProp.group);
|
|
return group ? group.indexOf(name) > -1 : false;
|
|
}
|
|
return this.id == name;
|
|
}
|
|
static match(map) {
|
|
let direct = Object.create(null);
|
|
for (let prop in map)
|
|
for (let name of prop.split(" "))
|
|
direct[name] = map[prop];
|
|
return (node) => {
|
|
for (let groups = node.prop(NodeProp.group), i = -1; i < (groups ? groups.length : 0); i++) {
|
|
let found = direct[i < 0 ? node.name : groups[i]];
|
|
if (found)
|
|
return found;
|
|
}
|
|
};
|
|
}
|
|
};
|
|
NodeType.none = new NodeType("", Object.create(null), 0, 8);
|
|
var NodeSet = class {
|
|
constructor(types) {
|
|
this.types = types;
|
|
for (let i = 0; i < types.length; i++)
|
|
if (types[i].id != i)
|
|
throw new RangeError("Node type ids should correspond to array positions when creating a node set");
|
|
}
|
|
extend(...props) {
|
|
let newTypes = [];
|
|
for (let type of this.types) {
|
|
let newProps = null;
|
|
for (let source of props) {
|
|
let add = source(type);
|
|
if (add) {
|
|
if (!newProps)
|
|
newProps = Object.assign({}, type.props);
|
|
newProps[add[0].id] = add[1];
|
|
}
|
|
}
|
|
newTypes.push(newProps ? new NodeType(type.name, newProps, type.id, type.flags) : type);
|
|
}
|
|
return new NodeSet(newTypes);
|
|
}
|
|
};
|
|
var CachedNode = new WeakMap();
|
|
var CachedInnerNode = new WeakMap();
|
|
var IterMode;
|
|
(function(IterMode2) {
|
|
IterMode2[IterMode2["ExcludeBuffers"] = 1] = "ExcludeBuffers";
|
|
IterMode2[IterMode2["IncludeAnonymous"] = 2] = "IncludeAnonymous";
|
|
IterMode2[IterMode2["IgnoreMounts"] = 4] = "IgnoreMounts";
|
|
IterMode2[IterMode2["IgnoreOverlays"] = 8] = "IgnoreOverlays";
|
|
})(IterMode || (IterMode = {}));
|
|
var Tree = class {
|
|
constructor(type, children, positions, length, props) {
|
|
this.type = type;
|
|
this.children = children;
|
|
this.positions = positions;
|
|
this.length = length;
|
|
this.props = null;
|
|
if (props && props.length) {
|
|
this.props = Object.create(null);
|
|
for (let [prop, value] of props)
|
|
this.props[typeof prop == "number" ? prop : prop.id] = value;
|
|
}
|
|
}
|
|
toString() {
|
|
let mounted = MountedTree.get(this);
|
|
if (mounted && !mounted.overlay)
|
|
return mounted.tree.toString();
|
|
let children = "";
|
|
for (let ch of this.children) {
|
|
let str = ch.toString();
|
|
if (str) {
|
|
if (children)
|
|
children += ",";
|
|
children += str;
|
|
}
|
|
}
|
|
return !this.type.name ? children : (/\W/.test(this.type.name) && !this.type.isError ? JSON.stringify(this.type.name) : this.type.name) + (children.length ? "(" + children + ")" : "");
|
|
}
|
|
cursor(mode = 0) {
|
|
return new TreeCursor(this.topNode, mode);
|
|
}
|
|
cursorAt(pos, side = 0, mode = 0) {
|
|
let scope = CachedNode.get(this) || this.topNode;
|
|
let cursor = new TreeCursor(scope);
|
|
cursor.moveTo(pos, side);
|
|
CachedNode.set(this, cursor._tree);
|
|
return cursor;
|
|
}
|
|
get topNode() {
|
|
return new TreeNode(this, 0, 0, null);
|
|
}
|
|
resolve(pos, side = 0) {
|
|
let node = resolveNode(CachedNode.get(this) || this.topNode, pos, side, false);
|
|
CachedNode.set(this, node);
|
|
return node;
|
|
}
|
|
resolveInner(pos, side = 0) {
|
|
let node = resolveNode(CachedInnerNode.get(this) || this.topNode, pos, side, true);
|
|
CachedInnerNode.set(this, node);
|
|
return node;
|
|
}
|
|
resolveStack(pos, side = 0) {
|
|
return stackIterator(this, pos, side);
|
|
}
|
|
iterate(spec) {
|
|
let { enter, leave, from = 0, to = this.length } = spec;
|
|
let mode = spec.mode || 0, anon = (mode & IterMode.IncludeAnonymous) > 0;
|
|
for (let c = this.cursor(mode | IterMode.IncludeAnonymous); ; ) {
|
|
let entered = false;
|
|
if (c.from <= to && c.to >= from && (!anon && c.type.isAnonymous || enter(c) !== false)) {
|
|
if (c.firstChild())
|
|
continue;
|
|
entered = true;
|
|
}
|
|
for (; ; ) {
|
|
if (entered && leave && (anon || !c.type.isAnonymous))
|
|
leave(c);
|
|
if (c.nextSibling())
|
|
break;
|
|
if (!c.parent())
|
|
return;
|
|
entered = true;
|
|
}
|
|
}
|
|
}
|
|
prop(prop) {
|
|
return !prop.perNode ? this.type.prop(prop) : this.props ? this.props[prop.id] : void 0;
|
|
}
|
|
get propValues() {
|
|
let result = [];
|
|
if (this.props)
|
|
for (let id2 in this.props)
|
|
result.push([+id2, this.props[id2]]);
|
|
return result;
|
|
}
|
|
balance(config2 = {}) {
|
|
return this.children.length <= 8 ? this : balanceRange(NodeType.none, this.children, this.positions, 0, this.children.length, 0, this.length, (children, positions, length) => new Tree(this.type, children, positions, length, this.propValues), config2.makeTree || ((children, positions, length) => new Tree(NodeType.none, children, positions, length)));
|
|
}
|
|
static build(data) {
|
|
return buildTree(data);
|
|
}
|
|
};
|
|
Tree.empty = new Tree(NodeType.none, [], [], 0);
|
|
var FlatBufferCursor = class {
|
|
constructor(buffer, index) {
|
|
this.buffer = buffer;
|
|
this.index = index;
|
|
}
|
|
get id() {
|
|
return this.buffer[this.index - 4];
|
|
}
|
|
get start() {
|
|
return this.buffer[this.index - 3];
|
|
}
|
|
get end() {
|
|
return this.buffer[this.index - 2];
|
|
}
|
|
get size() {
|
|
return this.buffer[this.index - 1];
|
|
}
|
|
get pos() {
|
|
return this.index;
|
|
}
|
|
next() {
|
|
this.index -= 4;
|
|
}
|
|
fork() {
|
|
return new FlatBufferCursor(this.buffer, this.index);
|
|
}
|
|
};
|
|
var TreeBuffer = class {
|
|
constructor(buffer, length, set) {
|
|
this.buffer = buffer;
|
|
this.length = length;
|
|
this.set = set;
|
|
}
|
|
get type() {
|
|
return NodeType.none;
|
|
}
|
|
toString() {
|
|
let result = [];
|
|
for (let index = 0; index < this.buffer.length; ) {
|
|
result.push(this.childString(index));
|
|
index = this.buffer[index + 3];
|
|
}
|
|
return result.join(",");
|
|
}
|
|
childString(index) {
|
|
let id2 = this.buffer[index], endIndex = this.buffer[index + 3];
|
|
let type = this.set.types[id2], result = type.name;
|
|
if (/\W/.test(result) && !type.isError)
|
|
result = JSON.stringify(result);
|
|
index += 4;
|
|
if (endIndex == index)
|
|
return result;
|
|
let children = [];
|
|
while (index < endIndex) {
|
|
children.push(this.childString(index));
|
|
index = this.buffer[index + 3];
|
|
}
|
|
return result + "(" + children.join(",") + ")";
|
|
}
|
|
findChild(startIndex, endIndex, dir, pos, side) {
|
|
let { buffer } = this, pick = -1;
|
|
for (let i = startIndex; i != endIndex; i = buffer[i + 3]) {
|
|
if (checkSide(side, pos, buffer[i + 1], buffer[i + 2])) {
|
|
pick = i;
|
|
if (dir > 0)
|
|
break;
|
|
}
|
|
}
|
|
return pick;
|
|
}
|
|
slice(startI, endI, from) {
|
|
let b = this.buffer;
|
|
let copy = new Uint16Array(endI - startI), len = 0;
|
|
for (let i = startI, j = 0; i < endI; ) {
|
|
copy[j++] = b[i++];
|
|
copy[j++] = b[i++] - from;
|
|
let to = copy[j++] = b[i++] - from;
|
|
copy[j++] = b[i++] - startI;
|
|
len = Math.max(len, to);
|
|
}
|
|
return new TreeBuffer(copy, len, this.set);
|
|
}
|
|
};
|
|
function checkSide(side, pos, from, to) {
|
|
switch (side) {
|
|
case -2:
|
|
return from < pos;
|
|
case -1:
|
|
return to >= pos && from < pos;
|
|
case 0:
|
|
return from < pos && to > pos;
|
|
case 1:
|
|
return from <= pos && to > pos;
|
|
case 2:
|
|
return to > pos;
|
|
case 4:
|
|
return true;
|
|
}
|
|
}
|
|
function resolveNode(node, pos, side, overlays) {
|
|
var _a;
|
|
while (node.from == node.to || (side < 1 ? node.from >= pos : node.from > pos) || (side > -1 ? node.to <= pos : node.to < pos)) {
|
|
let parent = !overlays && node instanceof TreeNode && node.index < 0 ? null : node.parent;
|
|
if (!parent)
|
|
return node;
|
|
node = parent;
|
|
}
|
|
let mode = overlays ? 0 : IterMode.IgnoreOverlays;
|
|
if (overlays)
|
|
for (let scan = node, parent = scan.parent; parent; scan = parent, parent = scan.parent) {
|
|
if (scan instanceof TreeNode && scan.index < 0 && ((_a = parent.enter(pos, side, mode)) === null || _a === void 0 ? void 0 : _a.from) != scan.from)
|
|
node = parent;
|
|
}
|
|
for (; ; ) {
|
|
let inner = node.enter(pos, side, mode);
|
|
if (!inner)
|
|
return node;
|
|
node = inner;
|
|
}
|
|
}
|
|
var BaseNode = class {
|
|
cursor(mode = 0) {
|
|
return new TreeCursor(this, mode);
|
|
}
|
|
getChild(type, before = null, after = null) {
|
|
let r = getChildren(this, type, before, after);
|
|
return r.length ? r[0] : null;
|
|
}
|
|
getChildren(type, before = null, after = null) {
|
|
return getChildren(this, type, before, after);
|
|
}
|
|
resolve(pos, side = 0) {
|
|
return resolveNode(this, pos, side, false);
|
|
}
|
|
resolveInner(pos, side = 0) {
|
|
return resolveNode(this, pos, side, true);
|
|
}
|
|
matchContext(context) {
|
|
return matchNodeContext(this, context);
|
|
}
|
|
enterUnfinishedNodesBefore(pos) {
|
|
let scan = this.childBefore(pos), node = this;
|
|
while (scan) {
|
|
let last = scan.lastChild;
|
|
if (!last || last.to != scan.to)
|
|
break;
|
|
if (last.type.isError && last.from == last.to) {
|
|
node = scan;
|
|
scan = last.prevSibling;
|
|
} else {
|
|
scan = last;
|
|
}
|
|
}
|
|
return node;
|
|
}
|
|
get node() {
|
|
return this;
|
|
}
|
|
get next() {
|
|
return this.parent;
|
|
}
|
|
};
|
|
var TreeNode = class extends BaseNode {
|
|
constructor(_tree, from, index, _parent) {
|
|
super();
|
|
this._tree = _tree;
|
|
this.from = from;
|
|
this.index = index;
|
|
this._parent = _parent;
|
|
}
|
|
get type() {
|
|
return this._tree.type;
|
|
}
|
|
get name() {
|
|
return this._tree.type.name;
|
|
}
|
|
get to() {
|
|
return this.from + this._tree.length;
|
|
}
|
|
nextChild(i, dir, pos, side, mode = 0) {
|
|
for (let parent = this; ; ) {
|
|
for (let { children, positions } = parent._tree, e = dir > 0 ? children.length : -1; i != e; i += dir) {
|
|
let next = children[i], start2 = positions[i] + parent.from;
|
|
if (!checkSide(side, pos, start2, start2 + next.length))
|
|
continue;
|
|
if (next instanceof TreeBuffer) {
|
|
if (mode & IterMode.ExcludeBuffers)
|
|
continue;
|
|
let index = next.findChild(0, next.buffer.length, dir, pos - start2, side);
|
|
if (index > -1)
|
|
return new BufferNode(new BufferContext(parent, next, i, start2), null, index);
|
|
} else if (mode & IterMode.IncludeAnonymous || (!next.type.isAnonymous || hasChild(next))) {
|
|
let mounted;
|
|
if (!(mode & IterMode.IgnoreMounts) && (mounted = MountedTree.get(next)) && !mounted.overlay)
|
|
return new TreeNode(mounted.tree, start2, i, parent);
|
|
let inner = new TreeNode(next, start2, i, parent);
|
|
return mode & IterMode.IncludeAnonymous || !inner.type.isAnonymous ? inner : inner.nextChild(dir < 0 ? next.children.length - 1 : 0, dir, pos, side);
|
|
}
|
|
}
|
|
if (mode & IterMode.IncludeAnonymous || !parent.type.isAnonymous)
|
|
return null;
|
|
if (parent.index >= 0)
|
|
i = parent.index + dir;
|
|
else
|
|
i = dir < 0 ? -1 : parent._parent._tree.children.length;
|
|
parent = parent._parent;
|
|
if (!parent)
|
|
return null;
|
|
}
|
|
}
|
|
get firstChild() {
|
|
return this.nextChild(0, 1, 0, 4);
|
|
}
|
|
get lastChild() {
|
|
return this.nextChild(this._tree.children.length - 1, -1, 0, 4);
|
|
}
|
|
childAfter(pos) {
|
|
return this.nextChild(0, 1, pos, 2);
|
|
}
|
|
childBefore(pos) {
|
|
return this.nextChild(this._tree.children.length - 1, -1, pos, -2);
|
|
}
|
|
enter(pos, side, mode = 0) {
|
|
let mounted;
|
|
if (!(mode & IterMode.IgnoreOverlays) && (mounted = MountedTree.get(this._tree)) && mounted.overlay) {
|
|
let rPos = pos - this.from;
|
|
for (let { from, to } of mounted.overlay) {
|
|
if ((side > 0 ? from <= rPos : from < rPos) && (side < 0 ? to >= rPos : to > rPos))
|
|
return new TreeNode(mounted.tree, mounted.overlay[0].from + this.from, -1, this);
|
|
}
|
|
}
|
|
return this.nextChild(0, 1, pos, side, mode);
|
|
}
|
|
nextSignificantParent() {
|
|
let val = this;
|
|
while (val.type.isAnonymous && val._parent)
|
|
val = val._parent;
|
|
return val;
|
|
}
|
|
get parent() {
|
|
return this._parent ? this._parent.nextSignificantParent() : null;
|
|
}
|
|
get nextSibling() {
|
|
return this._parent && this.index >= 0 ? this._parent.nextChild(this.index + 1, 1, 0, 4) : null;
|
|
}
|
|
get prevSibling() {
|
|
return this._parent && this.index >= 0 ? this._parent.nextChild(this.index - 1, -1, 0, 4) : null;
|
|
}
|
|
get tree() {
|
|
return this._tree;
|
|
}
|
|
toTree() {
|
|
return this._tree;
|
|
}
|
|
toString() {
|
|
return this._tree.toString();
|
|
}
|
|
};
|
|
function getChildren(node, type, before, after) {
|
|
let cur = node.cursor(), result = [];
|
|
if (!cur.firstChild())
|
|
return result;
|
|
if (before != null) {
|
|
while (!cur.type.is(before))
|
|
if (!cur.nextSibling())
|
|
return result;
|
|
}
|
|
for (; ; ) {
|
|
if (after != null && cur.type.is(after))
|
|
return result;
|
|
if (cur.type.is(type))
|
|
result.push(cur.node);
|
|
if (!cur.nextSibling())
|
|
return after == null ? result : [];
|
|
}
|
|
}
|
|
function matchNodeContext(node, context, i = context.length - 1) {
|
|
for (let p = node.parent; i >= 0; p = p.parent) {
|
|
if (!p)
|
|
return false;
|
|
if (!p.type.isAnonymous) {
|
|
if (context[i] && context[i] != p.name)
|
|
return false;
|
|
i--;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
var BufferContext = class {
|
|
constructor(parent, buffer, index, start2) {
|
|
this.parent = parent;
|
|
this.buffer = buffer;
|
|
this.index = index;
|
|
this.start = start2;
|
|
}
|
|
};
|
|
var BufferNode = class extends BaseNode {
|
|
get name() {
|
|
return this.type.name;
|
|
}
|
|
get from() {
|
|
return this.context.start + this.context.buffer.buffer[this.index + 1];
|
|
}
|
|
get to() {
|
|
return this.context.start + this.context.buffer.buffer[this.index + 2];
|
|
}
|
|
constructor(context, _parent, index) {
|
|
super();
|
|
this.context = context;
|
|
this._parent = _parent;
|
|
this.index = index;
|
|
this.type = context.buffer.set.types[context.buffer.buffer[index]];
|
|
}
|
|
child(dir, pos, side) {
|
|
let { buffer } = this.context;
|
|
let index = buffer.findChild(this.index + 4, buffer.buffer[this.index + 3], dir, pos - this.context.start, side);
|
|
return index < 0 ? null : new BufferNode(this.context, this, index);
|
|
}
|
|
get firstChild() {
|
|
return this.child(1, 0, 4);
|
|
}
|
|
get lastChild() {
|
|
return this.child(-1, 0, 4);
|
|
}
|
|
childAfter(pos) {
|
|
return this.child(1, pos, 2);
|
|
}
|
|
childBefore(pos) {
|
|
return this.child(-1, pos, -2);
|
|
}
|
|
enter(pos, side, mode = 0) {
|
|
if (mode & IterMode.ExcludeBuffers)
|
|
return null;
|
|
let { buffer } = this.context;
|
|
let index = buffer.findChild(this.index + 4, buffer.buffer[this.index + 3], side > 0 ? 1 : -1, pos - this.context.start, side);
|
|
return index < 0 ? null : new BufferNode(this.context, this, index);
|
|
}
|
|
get parent() {
|
|
return this._parent || this.context.parent.nextSignificantParent();
|
|
}
|
|
externalSibling(dir) {
|
|
return this._parent ? null : this.context.parent.nextChild(this.context.index + dir, dir, 0, 4);
|
|
}
|
|
get nextSibling() {
|
|
let { buffer } = this.context;
|
|
let after = buffer.buffer[this.index + 3];
|
|
if (after < (this._parent ? buffer.buffer[this._parent.index + 3] : buffer.buffer.length))
|
|
return new BufferNode(this.context, this._parent, after);
|
|
return this.externalSibling(1);
|
|
}
|
|
get prevSibling() {
|
|
let { buffer } = this.context;
|
|
let parentStart = this._parent ? this._parent.index + 4 : 0;
|
|
if (this.index == parentStart)
|
|
return this.externalSibling(-1);
|
|
return new BufferNode(this.context, this._parent, buffer.findChild(parentStart, this.index, -1, 0, 4));
|
|
}
|
|
get tree() {
|
|
return null;
|
|
}
|
|
toTree() {
|
|
let children = [], positions = [];
|
|
let { buffer } = this.context;
|
|
let startI = this.index + 4, endI = buffer.buffer[this.index + 3];
|
|
if (endI > startI) {
|
|
let from = buffer.buffer[this.index + 1];
|
|
children.push(buffer.slice(startI, endI, from));
|
|
positions.push(0);
|
|
}
|
|
return new Tree(this.type, children, positions, this.to - this.from);
|
|
}
|
|
toString() {
|
|
return this.context.buffer.childString(this.index);
|
|
}
|
|
};
|
|
function iterStack(heads) {
|
|
if (!heads.length)
|
|
return null;
|
|
if (heads.length == 1)
|
|
return heads[0];
|
|
let pick = 0, picked = heads[0];
|
|
for (let i = 1; i < heads.length; i++) {
|
|
let node = heads[i];
|
|
if (node.from > picked.from || node.to < picked.to) {
|
|
picked = node;
|
|
pick = i;
|
|
}
|
|
}
|
|
let next = picked instanceof TreeNode && picked.index < 0 ? null : picked.parent;
|
|
let newHeads = heads.slice();
|
|
if (next)
|
|
newHeads[pick] = next;
|
|
else
|
|
newHeads.splice(pick, 1);
|
|
return new StackIterator(newHeads, picked);
|
|
}
|
|
var StackIterator = class {
|
|
constructor(heads, node) {
|
|
this.heads = heads;
|
|
this.node = node;
|
|
}
|
|
get next() {
|
|
return iterStack(this.heads);
|
|
}
|
|
};
|
|
function stackIterator(tree, pos, side) {
|
|
let inner = tree.resolveInner(pos, side), layers = null;
|
|
for (let scan = inner instanceof TreeNode ? inner : inner.context.parent; scan; scan = scan.parent) {
|
|
if (scan.index < 0) {
|
|
let parent = scan.parent;
|
|
(layers || (layers = [inner])).push(parent.resolve(pos, side));
|
|
scan = parent;
|
|
} else {
|
|
let mount = MountedTree.get(scan.tree);
|
|
if (mount && mount.overlay && mount.overlay[0].from <= pos && mount.overlay[mount.overlay.length - 1].to >= pos) {
|
|
let root = new TreeNode(mount.tree, mount.overlay[0].from + scan.from, 0, null);
|
|
(layers || (layers = [inner])).push(resolveNode(root, pos, side, false));
|
|
}
|
|
}
|
|
}
|
|
return layers ? iterStack(layers) : inner;
|
|
}
|
|
var TreeCursor = class {
|
|
get name() {
|
|
return this.type.name;
|
|
}
|
|
constructor(node, mode = 0) {
|
|
this.mode = mode;
|
|
this.buffer = null;
|
|
this.stack = [];
|
|
this.index = 0;
|
|
this.bufferNode = null;
|
|
if (node instanceof TreeNode) {
|
|
this.yieldNode(node);
|
|
} else {
|
|
this._tree = node.context.parent;
|
|
this.buffer = node.context;
|
|
for (let n = node._parent; n; n = n._parent)
|
|
this.stack.unshift(n.index);
|
|
this.bufferNode = node;
|
|
this.yieldBuf(node.index);
|
|
}
|
|
}
|
|
yieldNode(node) {
|
|
if (!node)
|
|
return false;
|
|
this._tree = node;
|
|
this.type = node.type;
|
|
this.from = node.from;
|
|
this.to = node.to;
|
|
return true;
|
|
}
|
|
yieldBuf(index, type) {
|
|
this.index = index;
|
|
let { start: start2, buffer } = this.buffer;
|
|
this.type = type || buffer.set.types[buffer.buffer[index]];
|
|
this.from = start2 + buffer.buffer[index + 1];
|
|
this.to = start2 + buffer.buffer[index + 2];
|
|
return true;
|
|
}
|
|
yield(node) {
|
|
if (!node)
|
|
return false;
|
|
if (node instanceof TreeNode) {
|
|
this.buffer = null;
|
|
return this.yieldNode(node);
|
|
}
|
|
this.buffer = node.context;
|
|
return this.yieldBuf(node.index, node.type);
|
|
}
|
|
toString() {
|
|
return this.buffer ? this.buffer.buffer.childString(this.index) : this._tree.toString();
|
|
}
|
|
enterChild(dir, pos, side) {
|
|
if (!this.buffer)
|
|
return this.yield(this._tree.nextChild(dir < 0 ? this._tree._tree.children.length - 1 : 0, dir, pos, side, this.mode));
|
|
let { buffer } = this.buffer;
|
|
let index = buffer.findChild(this.index + 4, buffer.buffer[this.index + 3], dir, pos - this.buffer.start, side);
|
|
if (index < 0)
|
|
return false;
|
|
this.stack.push(this.index);
|
|
return this.yieldBuf(index);
|
|
}
|
|
firstChild() {
|
|
return this.enterChild(1, 0, 4);
|
|
}
|
|
lastChild() {
|
|
return this.enterChild(-1, 0, 4);
|
|
}
|
|
childAfter(pos) {
|
|
return this.enterChild(1, pos, 2);
|
|
}
|
|
childBefore(pos) {
|
|
return this.enterChild(-1, pos, -2);
|
|
}
|
|
enter(pos, side, mode = this.mode) {
|
|
if (!this.buffer)
|
|
return this.yield(this._tree.enter(pos, side, mode));
|
|
return mode & IterMode.ExcludeBuffers ? false : this.enterChild(1, pos, side);
|
|
}
|
|
parent() {
|
|
if (!this.buffer)
|
|
return this.yieldNode(this.mode & IterMode.IncludeAnonymous ? this._tree._parent : this._tree.parent);
|
|
if (this.stack.length)
|
|
return this.yieldBuf(this.stack.pop());
|
|
let parent = this.mode & IterMode.IncludeAnonymous ? this.buffer.parent : this.buffer.parent.nextSignificantParent();
|
|
this.buffer = null;
|
|
return this.yieldNode(parent);
|
|
}
|
|
sibling(dir) {
|
|
if (!this.buffer)
|
|
return !this._tree._parent ? false : this.yield(this._tree.index < 0 ? null : this._tree._parent.nextChild(this._tree.index + dir, dir, 0, 4, this.mode));
|
|
let { buffer } = this.buffer, d = this.stack.length - 1;
|
|
if (dir < 0) {
|
|
let parentStart = d < 0 ? 0 : this.stack[d] + 4;
|
|
if (this.index != parentStart)
|
|
return this.yieldBuf(buffer.findChild(parentStart, this.index, -1, 0, 4));
|
|
} else {
|
|
let after = buffer.buffer[this.index + 3];
|
|
if (after < (d < 0 ? buffer.buffer.length : buffer.buffer[this.stack[d] + 3]))
|
|
return this.yieldBuf(after);
|
|
}
|
|
return d < 0 ? this.yield(this.buffer.parent.nextChild(this.buffer.index + dir, dir, 0, 4, this.mode)) : false;
|
|
}
|
|
nextSibling() {
|
|
return this.sibling(1);
|
|
}
|
|
prevSibling() {
|
|
return this.sibling(-1);
|
|
}
|
|
atLastNode(dir) {
|
|
let index, parent, { buffer } = this;
|
|
if (buffer) {
|
|
if (dir > 0) {
|
|
if (this.index < buffer.buffer.buffer.length)
|
|
return false;
|
|
} else {
|
|
for (let i = 0; i < this.index; i++)
|
|
if (buffer.buffer.buffer[i + 3] < this.index)
|
|
return false;
|
|
}
|
|
({ index, parent } = buffer);
|
|
} else {
|
|
({ index, _parent: parent } = this._tree);
|
|
}
|
|
for (; parent; { index, _parent: parent } = parent) {
|
|
if (index > -1)
|
|
for (let i = index + dir, e = dir < 0 ? -1 : parent._tree.children.length; i != e; i += dir) {
|
|
let child = parent._tree.children[i];
|
|
if (this.mode & IterMode.IncludeAnonymous || child instanceof TreeBuffer || !child.type.isAnonymous || hasChild(child))
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
move(dir, enter) {
|
|
if (enter && this.enterChild(dir, 0, 4))
|
|
return true;
|
|
for (; ; ) {
|
|
if (this.sibling(dir))
|
|
return true;
|
|
if (this.atLastNode(dir) || !this.parent())
|
|
return false;
|
|
}
|
|
}
|
|
next(enter = true) {
|
|
return this.move(1, enter);
|
|
}
|
|
prev(enter = true) {
|
|
return this.move(-1, enter);
|
|
}
|
|
moveTo(pos, side = 0) {
|
|
while (this.from == this.to || (side < 1 ? this.from >= pos : this.from > pos) || (side > -1 ? this.to <= pos : this.to < pos))
|
|
if (!this.parent())
|
|
break;
|
|
while (this.enterChild(1, pos, side)) {
|
|
}
|
|
return this;
|
|
}
|
|
get node() {
|
|
if (!this.buffer)
|
|
return this._tree;
|
|
let cache2 = this.bufferNode, result = null, depth = 0;
|
|
if (cache2 && cache2.context == this.buffer) {
|
|
scan:
|
|
for (let index = this.index, d = this.stack.length; d >= 0; ) {
|
|
for (let c = cache2; c; c = c._parent)
|
|
if (c.index == index) {
|
|
if (index == this.index)
|
|
return c;
|
|
result = c;
|
|
depth = d + 1;
|
|
break scan;
|
|
}
|
|
index = this.stack[--d];
|
|
}
|
|
}
|
|
for (let i = depth; i < this.stack.length; i++)
|
|
result = new BufferNode(this.buffer, result, this.stack[i]);
|
|
return this.bufferNode = new BufferNode(this.buffer, result, this.index);
|
|
}
|
|
get tree() {
|
|
return this.buffer ? null : this._tree._tree;
|
|
}
|
|
iterate(enter, leave) {
|
|
for (let depth = 0; ; ) {
|
|
let mustLeave = false;
|
|
if (this.type.isAnonymous || enter(this) !== false) {
|
|
if (this.firstChild()) {
|
|
depth++;
|
|
continue;
|
|
}
|
|
if (!this.type.isAnonymous)
|
|
mustLeave = true;
|
|
}
|
|
for (; ; ) {
|
|
if (mustLeave && leave)
|
|
leave(this);
|
|
mustLeave = this.type.isAnonymous;
|
|
if (this.nextSibling())
|
|
break;
|
|
if (!depth)
|
|
return;
|
|
this.parent();
|
|
depth--;
|
|
mustLeave = true;
|
|
}
|
|
}
|
|
}
|
|
matchContext(context) {
|
|
if (!this.buffer)
|
|
return matchNodeContext(this.node, context);
|
|
let { buffer } = this.buffer, { types } = buffer.set;
|
|
for (let i = context.length - 1, d = this.stack.length - 1; i >= 0; d--) {
|
|
if (d < 0)
|
|
return matchNodeContext(this.node, context, i);
|
|
let type = types[buffer.buffer[this.stack[d]]];
|
|
if (!type.isAnonymous) {
|
|
if (context[i] && context[i] != type.name)
|
|
return false;
|
|
i--;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
};
|
|
function hasChild(tree) {
|
|
return tree.children.some((ch) => ch instanceof TreeBuffer || !ch.type.isAnonymous || hasChild(ch));
|
|
}
|
|
function buildTree(data) {
|
|
var _a;
|
|
let { buffer, nodeSet, maxBufferLength = DefaultBufferLength, reused = [], minRepeatType = nodeSet.types.length } = data;
|
|
let cursor = Array.isArray(buffer) ? new FlatBufferCursor(buffer, buffer.length) : buffer;
|
|
let types = nodeSet.types;
|
|
let contextHash = 0, lookAhead = 0;
|
|
function takeNode(parentStart, minPos, children2, positions2, inRepeat) {
|
|
let { id: id2, start: start2, end: end2, size } = cursor;
|
|
let lookAheadAtStart = lookAhead;
|
|
while (size < 0) {
|
|
cursor.next();
|
|
if (size == -1) {
|
|
let node2 = reused[id2];
|
|
children2.push(node2);
|
|
positions2.push(start2 - parentStart);
|
|
return;
|
|
} else if (size == -3) {
|
|
contextHash = id2;
|
|
return;
|
|
} else if (size == -4) {
|
|
lookAhead = id2;
|
|
return;
|
|
} else {
|
|
throw new RangeError(`Unrecognized record size: ${size}`);
|
|
}
|
|
}
|
|
let type = types[id2], node, buffer2;
|
|
let startPos = start2 - parentStart;
|
|
if (end2 - start2 <= maxBufferLength && (buffer2 = findBufferSize(cursor.pos - minPos, inRepeat))) {
|
|
let data2 = new Uint16Array(buffer2.size - buffer2.skip);
|
|
let endPos = cursor.pos - buffer2.size, index = data2.length;
|
|
while (cursor.pos > endPos)
|
|
index = copyToBuffer(buffer2.start, data2, index);
|
|
node = new TreeBuffer(data2, end2 - buffer2.start, nodeSet);
|
|
startPos = buffer2.start - parentStart;
|
|
} else {
|
|
let endPos = cursor.pos - size;
|
|
cursor.next();
|
|
let localChildren = [], localPositions = [];
|
|
let localInRepeat = id2 >= minRepeatType ? id2 : -1;
|
|
let lastGroup = 0, lastEnd = end2;
|
|
while (cursor.pos > endPos) {
|
|
if (localInRepeat >= 0 && cursor.id == localInRepeat && cursor.size >= 0) {
|
|
if (cursor.end <= lastEnd - maxBufferLength) {
|
|
makeRepeatLeaf(localChildren, localPositions, start2, lastGroup, cursor.end, lastEnd, localInRepeat, lookAheadAtStart);
|
|
lastGroup = localChildren.length;
|
|
lastEnd = cursor.end;
|
|
}
|
|
cursor.next();
|
|
} else {
|
|
takeNode(start2, endPos, localChildren, localPositions, localInRepeat);
|
|
}
|
|
}
|
|
if (localInRepeat >= 0 && lastGroup > 0 && lastGroup < localChildren.length)
|
|
makeRepeatLeaf(localChildren, localPositions, start2, lastGroup, start2, lastEnd, localInRepeat, lookAheadAtStart);
|
|
localChildren.reverse();
|
|
localPositions.reverse();
|
|
if (localInRepeat > -1 && lastGroup > 0) {
|
|
let make = makeBalanced(type);
|
|
node = balanceRange(type, localChildren, localPositions, 0, localChildren.length, 0, end2 - start2, make, make);
|
|
} else {
|
|
node = makeTree(type, localChildren, localPositions, end2 - start2, lookAheadAtStart - end2);
|
|
}
|
|
}
|
|
children2.push(node);
|
|
positions2.push(startPos);
|
|
}
|
|
function makeBalanced(type) {
|
|
return (children2, positions2, length2) => {
|
|
let lookAhead2 = 0, lastI = children2.length - 1, last, lookAheadProp;
|
|
if (lastI >= 0 && (last = children2[lastI]) instanceof Tree) {
|
|
if (!lastI && last.type == type && last.length == length2)
|
|
return last;
|
|
if (lookAheadProp = last.prop(NodeProp.lookAhead))
|
|
lookAhead2 = positions2[lastI] + last.length + lookAheadProp;
|
|
}
|
|
return makeTree(type, children2, positions2, length2, lookAhead2);
|
|
};
|
|
}
|
|
function makeRepeatLeaf(children2, positions2, base, i, from, to, type, lookAhead2) {
|
|
let localChildren = [], localPositions = [];
|
|
while (children2.length > i) {
|
|
localChildren.push(children2.pop());
|
|
localPositions.push(positions2.pop() + base - from);
|
|
}
|
|
children2.push(makeTree(nodeSet.types[type], localChildren, localPositions, to - from, lookAhead2 - to));
|
|
positions2.push(from - base);
|
|
}
|
|
function makeTree(type, children2, positions2, length2, lookAhead2 = 0, props) {
|
|
if (contextHash) {
|
|
let pair2 = [NodeProp.contextHash, contextHash];
|
|
props = props ? [pair2].concat(props) : [pair2];
|
|
}
|
|
if (lookAhead2 > 25) {
|
|
let pair2 = [NodeProp.lookAhead, lookAhead2];
|
|
props = props ? [pair2].concat(props) : [pair2];
|
|
}
|
|
return new Tree(type, children2, positions2, length2, props);
|
|
}
|
|
function findBufferSize(maxSize, inRepeat) {
|
|
let fork = cursor.fork();
|
|
let size = 0, start2 = 0, skip = 0, minStart = fork.end - maxBufferLength;
|
|
let result = { size: 0, start: 0, skip: 0 };
|
|
scan:
|
|
for (let minPos = fork.pos - maxSize; fork.pos > minPos; ) {
|
|
let nodeSize2 = fork.size;
|
|
if (fork.id == inRepeat && nodeSize2 >= 0) {
|
|
result.size = size;
|
|
result.start = start2;
|
|
result.skip = skip;
|
|
skip += 4;
|
|
size += 4;
|
|
fork.next();
|
|
continue;
|
|
}
|
|
let startPos = fork.pos - nodeSize2;
|
|
if (nodeSize2 < 0 || startPos < minPos || fork.start < minStart)
|
|
break;
|
|
let localSkipped = fork.id >= minRepeatType ? 4 : 0;
|
|
let nodeStart = fork.start;
|
|
fork.next();
|
|
while (fork.pos > startPos) {
|
|
if (fork.size < 0) {
|
|
if (fork.size == -3)
|
|
localSkipped += 4;
|
|
else
|
|
break scan;
|
|
} else if (fork.id >= minRepeatType) {
|
|
localSkipped += 4;
|
|
}
|
|
fork.next();
|
|
}
|
|
start2 = nodeStart;
|
|
size += nodeSize2;
|
|
skip += localSkipped;
|
|
}
|
|
if (inRepeat < 0 || size == maxSize) {
|
|
result.size = size;
|
|
result.start = start2;
|
|
result.skip = skip;
|
|
}
|
|
return result.size > 4 ? result : void 0;
|
|
}
|
|
function copyToBuffer(bufferStart, buffer2, index) {
|
|
let { id: id2, start: start2, end: end2, size } = cursor;
|
|
cursor.next();
|
|
if (size >= 0 && id2 < minRepeatType) {
|
|
let startIndex = index;
|
|
if (size > 4) {
|
|
let endPos = cursor.pos - (size - 4);
|
|
while (cursor.pos > endPos)
|
|
index = copyToBuffer(bufferStart, buffer2, index);
|
|
}
|
|
buffer2[--index] = startIndex;
|
|
buffer2[--index] = end2 - bufferStart;
|
|
buffer2[--index] = start2 - bufferStart;
|
|
buffer2[--index] = id2;
|
|
} else if (size == -3) {
|
|
contextHash = id2;
|
|
} else if (size == -4) {
|
|
lookAhead = id2;
|
|
}
|
|
return index;
|
|
}
|
|
let children = [], positions = [];
|
|
while (cursor.pos > 0)
|
|
takeNode(data.start || 0, data.bufferStart || 0, children, positions, -1);
|
|
let length = (_a = data.length) !== null && _a !== void 0 ? _a : children.length ? positions[0] + children[0].length : 0;
|
|
return new Tree(types[data.topID], children.reverse(), positions.reverse(), length);
|
|
}
|
|
var nodeSizeCache = new WeakMap();
|
|
function nodeSize(balanceType, node) {
|
|
if (!balanceType.isAnonymous || node instanceof TreeBuffer || node.type != balanceType)
|
|
return 1;
|
|
let size = nodeSizeCache.get(node);
|
|
if (size == null) {
|
|
size = 1;
|
|
for (let child of node.children) {
|
|
if (child.type != balanceType || !(child instanceof Tree)) {
|
|
size = 1;
|
|
break;
|
|
}
|
|
size += nodeSize(balanceType, child);
|
|
}
|
|
nodeSizeCache.set(node, size);
|
|
}
|
|
return size;
|
|
}
|
|
function balanceRange(balanceType, children, positions, from, to, start2, length, mkTop, mkTree) {
|
|
let total = 0;
|
|
for (let i = from; i < to; i++)
|
|
total += nodeSize(balanceType, children[i]);
|
|
let maxChild = Math.ceil(total * 1.5 / 8);
|
|
let localChildren = [], localPositions = [];
|
|
function divide(children2, positions2, from2, to2, offset2) {
|
|
for (let i = from2; i < to2; ) {
|
|
let groupFrom = i, groupStart = positions2[i], groupSize = nodeSize(balanceType, children2[i]);
|
|
i++;
|
|
for (; i < to2; i++) {
|
|
let nextSize = nodeSize(balanceType, children2[i]);
|
|
if (groupSize + nextSize >= maxChild)
|
|
break;
|
|
groupSize += nextSize;
|
|
}
|
|
if (i == groupFrom + 1) {
|
|
if (groupSize > maxChild) {
|
|
let only = children2[groupFrom];
|
|
divide(only.children, only.positions, 0, only.children.length, positions2[groupFrom] + offset2);
|
|
continue;
|
|
}
|
|
localChildren.push(children2[groupFrom]);
|
|
} else {
|
|
let length2 = positions2[i - 1] + children2[i - 1].length - groupStart;
|
|
localChildren.push(balanceRange(balanceType, children2, positions2, groupFrom, i, groupStart, length2, null, mkTree));
|
|
}
|
|
localPositions.push(groupStart + offset2 - start2);
|
|
}
|
|
}
|
|
divide(children, positions, from, to, 0);
|
|
return (mkTop || mkTree)(localChildren, localPositions, length);
|
|
}
|
|
var NodeWeakMap = class {
|
|
constructor() {
|
|
this.map = new WeakMap();
|
|
}
|
|
setBuffer(buffer, index, value) {
|
|
let inner = this.map.get(buffer);
|
|
if (!inner)
|
|
this.map.set(buffer, inner = new Map());
|
|
inner.set(index, value);
|
|
}
|
|
getBuffer(buffer, index) {
|
|
let inner = this.map.get(buffer);
|
|
return inner && inner.get(index);
|
|
}
|
|
set(node, value) {
|
|
if (node instanceof BufferNode)
|
|
this.setBuffer(node.context.buffer, node.index, value);
|
|
else if (node instanceof TreeNode)
|
|
this.map.set(node.tree, value);
|
|
}
|
|
get(node) {
|
|
return node instanceof BufferNode ? this.getBuffer(node.context.buffer, node.index) : node instanceof TreeNode ? this.map.get(node.tree) : void 0;
|
|
}
|
|
cursorSet(cursor, value) {
|
|
if (cursor.buffer)
|
|
this.setBuffer(cursor.buffer.buffer, cursor.index, value);
|
|
else
|
|
this.map.set(cursor.tree, value);
|
|
}
|
|
cursorGet(cursor) {
|
|
return cursor.buffer ? this.getBuffer(cursor.buffer.buffer, cursor.index) : this.map.get(cursor.tree);
|
|
}
|
|
};
|
|
var Parser = class {
|
|
startParse(input, fragments, ranges) {
|
|
if (typeof input == "string")
|
|
input = new StringInput(input);
|
|
ranges = !ranges ? [new Range(0, input.length)] : ranges.length ? ranges.map((r) => new Range(r.from, r.to)) : [new Range(0, 0)];
|
|
return this.createParse(input, fragments || [], ranges);
|
|
}
|
|
parse(input, fragments, ranges) {
|
|
let parse2 = this.startParse(input, fragments, ranges);
|
|
for (; ; ) {
|
|
let done = parse2.advance();
|
|
if (done)
|
|
return done;
|
|
}
|
|
}
|
|
};
|
|
var StringInput = class {
|
|
constructor(string2) {
|
|
this.string = string2;
|
|
}
|
|
get length() {
|
|
return this.string.length;
|
|
}
|
|
chunk(from) {
|
|
return this.string.slice(from);
|
|
}
|
|
get lineChunks() {
|
|
return false;
|
|
}
|
|
read(from, to) {
|
|
return this.string.slice(from, to);
|
|
}
|
|
};
|
|
var stoppedInner = new NodeProp({ perNode: true });
|
|
|
|
// node_modules/@lezer/lr/dist/index.js
|
|
var Stack = class {
|
|
constructor(p, stack, state, reducePos, pos, score, buffer, bufferBase, curContext, lookAhead = 0, parent) {
|
|
this.p = p;
|
|
this.stack = stack;
|
|
this.state = state;
|
|
this.reducePos = reducePos;
|
|
this.pos = pos;
|
|
this.score = score;
|
|
this.buffer = buffer;
|
|
this.bufferBase = bufferBase;
|
|
this.curContext = curContext;
|
|
this.lookAhead = lookAhead;
|
|
this.parent = parent;
|
|
}
|
|
toString() {
|
|
return `[${this.stack.filter((_, i) => i % 3 == 0).concat(this.state)}]@${this.pos}${this.score ? "!" + this.score : ""}`;
|
|
}
|
|
static start(p, state, pos = 0) {
|
|
let cx = p.parser.context;
|
|
return new Stack(p, [], state, pos, pos, 0, [], 0, cx ? new StackContext(cx, cx.start) : null, 0, null);
|
|
}
|
|
get context() {
|
|
return this.curContext ? this.curContext.context : null;
|
|
}
|
|
pushState(state, start2) {
|
|
this.stack.push(this.state, start2, this.bufferBase + this.buffer.length);
|
|
this.state = state;
|
|
}
|
|
reduce(action) {
|
|
let depth = action >> 19, type = action & 65535;
|
|
let { parser: parser2 } = this.p;
|
|
let dPrec = parser2.dynamicPrecedence(type);
|
|
if (dPrec)
|
|
this.score += dPrec;
|
|
if (depth == 0) {
|
|
this.pushState(parser2.getGoto(this.state, type, true), this.reducePos);
|
|
if (type < parser2.minRepeatTerm)
|
|
this.storeNode(type, this.reducePos, this.reducePos, 4, true);
|
|
this.reduceContext(type, this.reducePos);
|
|
return;
|
|
}
|
|
let base = this.stack.length - (depth - 1) * 3 - (action & 262144 ? 6 : 0);
|
|
let start2 = this.stack[base - 2];
|
|
let bufferBase = this.stack[base - 1], count = this.bufferBase + this.buffer.length - bufferBase;
|
|
if (type < parser2.minRepeatTerm || action & 131072) {
|
|
let pos = parser2.stateFlag(this.state, 1) ? this.pos : this.reducePos;
|
|
this.storeNode(type, start2, pos, count + 4, true);
|
|
}
|
|
if (action & 262144) {
|
|
this.state = this.stack[base];
|
|
} else {
|
|
let baseStateID = this.stack[base - 3];
|
|
this.state = parser2.getGoto(baseStateID, type, true);
|
|
}
|
|
while (this.stack.length > base)
|
|
this.stack.pop();
|
|
this.reduceContext(type, start2);
|
|
}
|
|
storeNode(term, start2, end2, size = 4, isReduce = false) {
|
|
if (term == 0 && (!this.stack.length || this.stack[this.stack.length - 1] < this.buffer.length + this.bufferBase)) {
|
|
let cur = this, top2 = this.buffer.length;
|
|
if (top2 == 0 && cur.parent) {
|
|
top2 = cur.bufferBase - cur.parent.bufferBase;
|
|
cur = cur.parent;
|
|
}
|
|
if (top2 > 0 && cur.buffer[top2 - 4] == 0 && cur.buffer[top2 - 1] > -1) {
|
|
if (start2 == end2)
|
|
return;
|
|
if (cur.buffer[top2 - 2] >= start2) {
|
|
cur.buffer[top2 - 2] = end2;
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
if (!isReduce || this.pos == end2) {
|
|
this.buffer.push(term, start2, end2, size);
|
|
} else {
|
|
let index = this.buffer.length;
|
|
if (index > 0 && this.buffer[index - 4] != 0)
|
|
while (index > 0 && this.buffer[index - 2] > end2) {
|
|
this.buffer[index] = this.buffer[index - 4];
|
|
this.buffer[index + 1] = this.buffer[index - 3];
|
|
this.buffer[index + 2] = this.buffer[index - 2];
|
|
this.buffer[index + 3] = this.buffer[index - 1];
|
|
index -= 4;
|
|
if (size > 4)
|
|
size -= 4;
|
|
}
|
|
this.buffer[index] = term;
|
|
this.buffer[index + 1] = start2;
|
|
this.buffer[index + 2] = end2;
|
|
this.buffer[index + 3] = size;
|
|
}
|
|
}
|
|
shift(action, next, nextEnd) {
|
|
let start2 = this.pos;
|
|
if (action & 131072) {
|
|
this.pushState(action & 65535, this.pos);
|
|
} else if ((action & 262144) == 0) {
|
|
let nextState = action, { parser: parser2 } = this.p;
|
|
if (nextEnd > this.pos || next <= parser2.maxNode) {
|
|
this.pos = nextEnd;
|
|
if (!parser2.stateFlag(nextState, 1))
|
|
this.reducePos = nextEnd;
|
|
}
|
|
this.pushState(nextState, start2);
|
|
this.shiftContext(next, start2);
|
|
if (next <= parser2.maxNode)
|
|
this.buffer.push(next, start2, nextEnd, 4);
|
|
} else {
|
|
this.pos = nextEnd;
|
|
this.shiftContext(next, start2);
|
|
if (next <= this.p.parser.maxNode)
|
|
this.buffer.push(next, start2, nextEnd, 4);
|
|
}
|
|
}
|
|
apply(action, next, nextEnd) {
|
|
if (action & 65536)
|
|
this.reduce(action);
|
|
else
|
|
this.shift(action, next, nextEnd);
|
|
}
|
|
useNode(value, next) {
|
|
let index = this.p.reused.length - 1;
|
|
if (index < 0 || this.p.reused[index] != value) {
|
|
this.p.reused.push(value);
|
|
index++;
|
|
}
|
|
let start2 = this.pos;
|
|
this.reducePos = this.pos = start2 + value.length;
|
|
this.pushState(next, start2);
|
|
this.buffer.push(index, start2, this.reducePos, -1);
|
|
if (this.curContext)
|
|
this.updateContext(this.curContext.tracker.reuse(this.curContext.context, value, this, this.p.stream.reset(this.pos - value.length)));
|
|
}
|
|
split() {
|
|
let parent = this;
|
|
let off = parent.buffer.length;
|
|
while (off > 0 && parent.buffer[off - 2] > parent.reducePos)
|
|
off -= 4;
|
|
let buffer = parent.buffer.slice(off), base = parent.bufferBase + off;
|
|
while (parent && base == parent.bufferBase)
|
|
parent = parent.parent;
|
|
return new Stack(this.p, this.stack.slice(), this.state, this.reducePos, this.pos, this.score, buffer, base, this.curContext, this.lookAhead, parent);
|
|
}
|
|
recoverByDelete(next, nextEnd) {
|
|
let isNode = next <= this.p.parser.maxNode;
|
|
if (isNode)
|
|
this.storeNode(next, this.pos, nextEnd, 4);
|
|
this.storeNode(0, this.pos, nextEnd, isNode ? 8 : 4);
|
|
this.pos = this.reducePos = nextEnd;
|
|
this.score -= 190;
|
|
}
|
|
canShift(term) {
|
|
for (let sim = new SimulatedStack(this); ; ) {
|
|
let action = this.p.parser.stateSlot(sim.state, 4) || this.p.parser.hasAction(sim.state, term);
|
|
if ((action & 65536) == 0)
|
|
return true;
|
|
if (action == 0)
|
|
return false;
|
|
sim.reduce(action);
|
|
}
|
|
}
|
|
recoverByInsert(next) {
|
|
if (this.stack.length >= 300)
|
|
return [];
|
|
let nextStates = this.p.parser.nextStates(this.state);
|
|
if (nextStates.length > 4 << 1 || this.stack.length >= 120) {
|
|
let best = [];
|
|
for (let i = 0, s; i < nextStates.length; i += 2) {
|
|
if ((s = nextStates[i + 1]) != this.state && this.p.parser.hasAction(s, next))
|
|
best.push(nextStates[i], s);
|
|
}
|
|
if (this.stack.length < 120)
|
|
for (let i = 0; best.length < 4 << 1 && i < nextStates.length; i += 2) {
|
|
let s = nextStates[i + 1];
|
|
if (!best.some((v, i2) => i2 & 1 && v == s))
|
|
best.push(nextStates[i], s);
|
|
}
|
|
nextStates = best;
|
|
}
|
|
let result = [];
|
|
for (let i = 0; i < nextStates.length && result.length < 4; i += 2) {
|
|
let s = nextStates[i + 1];
|
|
if (s == this.state)
|
|
continue;
|
|
let stack = this.split();
|
|
stack.pushState(s, this.pos);
|
|
stack.storeNode(0, stack.pos, stack.pos, 4, true);
|
|
stack.shiftContext(nextStates[i], this.pos);
|
|
stack.score -= 200;
|
|
result.push(stack);
|
|
}
|
|
return result;
|
|
}
|
|
forceReduce() {
|
|
let reduce = this.p.parser.stateSlot(this.state, 5);
|
|
if ((reduce & 65536) == 0)
|
|
return false;
|
|
let { parser: parser2 } = this.p;
|
|
if (!parser2.validAction(this.state, reduce)) {
|
|
let depth = reduce >> 19, term = reduce & 65535;
|
|
let target = this.stack.length - depth * 3;
|
|
if (target < 0 || parser2.getGoto(this.stack[target], term, false) < 0)
|
|
return false;
|
|
this.storeNode(0, this.reducePos, this.reducePos, 4, true);
|
|
this.score -= 100;
|
|
}
|
|
this.reducePos = this.pos;
|
|
this.reduce(reduce);
|
|
return true;
|
|
}
|
|
forceAll() {
|
|
while (!this.p.parser.stateFlag(this.state, 2)) {
|
|
if (!this.forceReduce()) {
|
|
this.storeNode(0, this.pos, this.pos, 4, true);
|
|
break;
|
|
}
|
|
}
|
|
return this;
|
|
}
|
|
get deadEnd() {
|
|
if (this.stack.length != 3)
|
|
return false;
|
|
let { parser: parser2 } = this.p;
|
|
return parser2.data[parser2.stateSlot(this.state, 1)] == 65535 && !parser2.stateSlot(this.state, 4);
|
|
}
|
|
restart() {
|
|
this.state = this.stack[0];
|
|
this.stack.length = 0;
|
|
}
|
|
sameState(other) {
|
|
if (this.state != other.state || this.stack.length != other.stack.length)
|
|
return false;
|
|
for (let i = 0; i < this.stack.length; i += 3)
|
|
if (this.stack[i] != other.stack[i])
|
|
return false;
|
|
return true;
|
|
}
|
|
get parser() {
|
|
return this.p.parser;
|
|
}
|
|
dialectEnabled(dialectID) {
|
|
return this.p.parser.dialect.flags[dialectID];
|
|
}
|
|
shiftContext(term, start2) {
|
|
if (this.curContext)
|
|
this.updateContext(this.curContext.tracker.shift(this.curContext.context, term, this, this.p.stream.reset(start2)));
|
|
}
|
|
reduceContext(term, start2) {
|
|
if (this.curContext)
|
|
this.updateContext(this.curContext.tracker.reduce(this.curContext.context, term, this, this.p.stream.reset(start2)));
|
|
}
|
|
emitContext() {
|
|
let last = this.buffer.length - 1;
|
|
if (last < 0 || this.buffer[last] != -3)
|
|
this.buffer.push(this.curContext.hash, this.reducePos, this.reducePos, -3);
|
|
}
|
|
emitLookAhead() {
|
|
let last = this.buffer.length - 1;
|
|
if (last < 0 || this.buffer[last] != -4)
|
|
this.buffer.push(this.lookAhead, this.reducePos, this.reducePos, -4);
|
|
}
|
|
updateContext(context) {
|
|
if (context != this.curContext.context) {
|
|
let newCx = new StackContext(this.curContext.tracker, context);
|
|
if (newCx.hash != this.curContext.hash)
|
|
this.emitContext();
|
|
this.curContext = newCx;
|
|
}
|
|
}
|
|
setLookAhead(lookAhead) {
|
|
if (lookAhead > this.lookAhead) {
|
|
this.emitLookAhead();
|
|
this.lookAhead = lookAhead;
|
|
}
|
|
}
|
|
close() {
|
|
if (this.curContext && this.curContext.tracker.strict)
|
|
this.emitContext();
|
|
if (this.lookAhead > 0)
|
|
this.emitLookAhead();
|
|
}
|
|
};
|
|
var StackContext = class {
|
|
constructor(tracker, context) {
|
|
this.tracker = tracker;
|
|
this.context = context;
|
|
this.hash = tracker.strict ? tracker.hash(context) : 0;
|
|
}
|
|
};
|
|
var Recover;
|
|
(function(Recover2) {
|
|
Recover2[Recover2["Insert"] = 200] = "Insert";
|
|
Recover2[Recover2["Delete"] = 190] = "Delete";
|
|
Recover2[Recover2["Reduce"] = 100] = "Reduce";
|
|
Recover2[Recover2["MaxNext"] = 4] = "MaxNext";
|
|
Recover2[Recover2["MaxInsertStackDepth"] = 300] = "MaxInsertStackDepth";
|
|
Recover2[Recover2["DampenInsertStackDepth"] = 120] = "DampenInsertStackDepth";
|
|
})(Recover || (Recover = {}));
|
|
var SimulatedStack = class {
|
|
constructor(start2) {
|
|
this.start = start2;
|
|
this.state = start2.state;
|
|
this.stack = start2.stack;
|
|
this.base = this.stack.length;
|
|
}
|
|
reduce(action) {
|
|
let term = action & 65535, depth = action >> 19;
|
|
if (depth == 0) {
|
|
if (this.stack == this.start.stack)
|
|
this.stack = this.stack.slice();
|
|
this.stack.push(this.state, 0, 0);
|
|
this.base += 3;
|
|
} else {
|
|
this.base -= (depth - 1) * 3;
|
|
}
|
|
let goto = this.start.p.parser.getGoto(this.stack[this.base - 3], term, true);
|
|
this.state = goto;
|
|
}
|
|
};
|
|
var StackBufferCursor = class {
|
|
constructor(stack, pos, index) {
|
|
this.stack = stack;
|
|
this.pos = pos;
|
|
this.index = index;
|
|
this.buffer = stack.buffer;
|
|
if (this.index == 0)
|
|
this.maybeNext();
|
|
}
|
|
static create(stack, pos = stack.bufferBase + stack.buffer.length) {
|
|
return new StackBufferCursor(stack, pos, pos - stack.bufferBase);
|
|
}
|
|
maybeNext() {
|
|
let next = this.stack.parent;
|
|
if (next != null) {
|
|
this.index = this.stack.bufferBase - next.bufferBase;
|
|
this.stack = next;
|
|
this.buffer = next.buffer;
|
|
}
|
|
}
|
|
get id() {
|
|
return this.buffer[this.index - 4];
|
|
}
|
|
get start() {
|
|
return this.buffer[this.index - 3];
|
|
}
|
|
get end() {
|
|
return this.buffer[this.index - 2];
|
|
}
|
|
get size() {
|
|
return this.buffer[this.index - 1];
|
|
}
|
|
next() {
|
|
this.index -= 4;
|
|
this.pos -= 4;
|
|
if (this.index == 0)
|
|
this.maybeNext();
|
|
}
|
|
fork() {
|
|
return new StackBufferCursor(this.stack, this.pos, this.index);
|
|
}
|
|
};
|
|
var CachedToken = class {
|
|
constructor() {
|
|
this.start = -1;
|
|
this.value = -1;
|
|
this.end = -1;
|
|
this.extended = -1;
|
|
this.lookAhead = 0;
|
|
this.mask = 0;
|
|
this.context = 0;
|
|
}
|
|
};
|
|
var nullToken = new CachedToken();
|
|
var InputStream = class {
|
|
constructor(input, ranges) {
|
|
this.input = input;
|
|
this.ranges = ranges;
|
|
this.chunk = "";
|
|
this.chunkOff = 0;
|
|
this.chunk2 = "";
|
|
this.chunk2Pos = 0;
|
|
this.next = -1;
|
|
this.token = nullToken;
|
|
this.rangeIndex = 0;
|
|
this.pos = this.chunkPos = ranges[0].from;
|
|
this.range = ranges[0];
|
|
this.end = ranges[ranges.length - 1].to;
|
|
this.readNext();
|
|
}
|
|
resolveOffset(offset2, assoc) {
|
|
let range = this.range, index = this.rangeIndex;
|
|
let pos = this.pos + offset2;
|
|
while (pos < range.from) {
|
|
if (!index)
|
|
return null;
|
|
let next = this.ranges[--index];
|
|
pos -= range.from - next.to;
|
|
range = next;
|
|
}
|
|
while (assoc < 0 ? pos > range.to : pos >= range.to) {
|
|
if (index == this.ranges.length - 1)
|
|
return null;
|
|
let next = this.ranges[++index];
|
|
pos += next.from - range.to;
|
|
range = next;
|
|
}
|
|
return pos;
|
|
}
|
|
peek(offset2) {
|
|
let idx = this.chunkOff + offset2, pos, result;
|
|
if (idx >= 0 && idx < this.chunk.length) {
|
|
pos = this.pos + offset2;
|
|
result = this.chunk.charCodeAt(idx);
|
|
} else {
|
|
let resolved = this.resolveOffset(offset2, 1);
|
|
if (resolved == null)
|
|
return -1;
|
|
pos = resolved;
|
|
if (pos >= this.chunk2Pos && pos < this.chunk2Pos + this.chunk2.length) {
|
|
result = this.chunk2.charCodeAt(pos - this.chunk2Pos);
|
|
} else {
|
|
let i = this.rangeIndex, range = this.range;
|
|
while (range.to <= pos)
|
|
range = this.ranges[++i];
|
|
this.chunk2 = this.input.chunk(this.chunk2Pos = pos);
|
|
if (pos + this.chunk2.length > range.to)
|
|
this.chunk2 = this.chunk2.slice(0, range.to - pos);
|
|
result = this.chunk2.charCodeAt(0);
|
|
}
|
|
}
|
|
if (pos >= this.token.lookAhead)
|
|
this.token.lookAhead = pos + 1;
|
|
return result;
|
|
}
|
|
acceptToken(token, endOffset = 0) {
|
|
let end2 = endOffset ? this.resolveOffset(endOffset, -1) : this.pos;
|
|
if (end2 == null || end2 < this.token.start)
|
|
throw new RangeError("Token end out of bounds");
|
|
this.token.value = token;
|
|
this.token.end = end2;
|
|
}
|
|
getChunk() {
|
|
if (this.pos >= this.chunk2Pos && this.pos < this.chunk2Pos + this.chunk2.length) {
|
|
let { chunk, chunkPos } = this;
|
|
this.chunk = this.chunk2;
|
|
this.chunkPos = this.chunk2Pos;
|
|
this.chunk2 = chunk;
|
|
this.chunk2Pos = chunkPos;
|
|
this.chunkOff = this.pos - this.chunkPos;
|
|
} else {
|
|
this.chunk2 = this.chunk;
|
|
this.chunk2Pos = this.chunkPos;
|
|
let nextChunk = this.input.chunk(this.pos);
|
|
let end2 = this.pos + nextChunk.length;
|
|
this.chunk = end2 > this.range.to ? nextChunk.slice(0, this.range.to - this.pos) : nextChunk;
|
|
this.chunkPos = this.pos;
|
|
this.chunkOff = 0;
|
|
}
|
|
}
|
|
readNext() {
|
|
if (this.chunkOff >= this.chunk.length) {
|
|
this.getChunk();
|
|
if (this.chunkOff == this.chunk.length)
|
|
return this.next = -1;
|
|
}
|
|
return this.next = this.chunk.charCodeAt(this.chunkOff);
|
|
}
|
|
advance(n = 1) {
|
|
this.chunkOff += n;
|
|
while (this.pos + n >= this.range.to) {
|
|
if (this.rangeIndex == this.ranges.length - 1)
|
|
return this.setDone();
|
|
n -= this.range.to - this.pos;
|
|
this.range = this.ranges[++this.rangeIndex];
|
|
this.pos = this.range.from;
|
|
}
|
|
this.pos += n;
|
|
if (this.pos >= this.token.lookAhead)
|
|
this.token.lookAhead = this.pos + 1;
|
|
return this.readNext();
|
|
}
|
|
setDone() {
|
|
this.pos = this.chunkPos = this.end;
|
|
this.range = this.ranges[this.rangeIndex = this.ranges.length - 1];
|
|
this.chunk = "";
|
|
return this.next = -1;
|
|
}
|
|
reset(pos, token) {
|
|
if (token) {
|
|
this.token = token;
|
|
token.start = pos;
|
|
token.lookAhead = pos + 1;
|
|
token.value = token.extended = -1;
|
|
} else {
|
|
this.token = nullToken;
|
|
}
|
|
if (this.pos != pos) {
|
|
this.pos = pos;
|
|
if (pos == this.end) {
|
|
this.setDone();
|
|
return this;
|
|
}
|
|
while (pos < this.range.from)
|
|
this.range = this.ranges[--this.rangeIndex];
|
|
while (pos >= this.range.to)
|
|
this.range = this.ranges[++this.rangeIndex];
|
|
if (pos >= this.chunkPos && pos < this.chunkPos + this.chunk.length) {
|
|
this.chunkOff = pos - this.chunkPos;
|
|
} else {
|
|
this.chunk = "";
|
|
this.chunkOff = 0;
|
|
}
|
|
this.readNext();
|
|
}
|
|
return this;
|
|
}
|
|
read(from, to) {
|
|
if (from >= this.chunkPos && to <= this.chunkPos + this.chunk.length)
|
|
return this.chunk.slice(from - this.chunkPos, to - this.chunkPos);
|
|
if (from >= this.chunk2Pos && to <= this.chunk2Pos + this.chunk2.length)
|
|
return this.chunk2.slice(from - this.chunk2Pos, to - this.chunk2Pos);
|
|
if (from >= this.range.from && to <= this.range.to)
|
|
return this.input.read(from, to);
|
|
let result = "";
|
|
for (let r of this.ranges) {
|
|
if (r.from >= to)
|
|
break;
|
|
if (r.to > from)
|
|
result += this.input.read(Math.max(r.from, from), Math.min(r.to, to));
|
|
}
|
|
return result;
|
|
}
|
|
};
|
|
var TokenGroup = class {
|
|
constructor(data, id2) {
|
|
this.data = data;
|
|
this.id = id2;
|
|
}
|
|
token(input, stack) {
|
|
readToken(this.data, input, stack, this.id);
|
|
}
|
|
};
|
|
TokenGroup.prototype.contextual = TokenGroup.prototype.fallback = TokenGroup.prototype.extend = false;
|
|
var ExternalTokenizer = class {
|
|
constructor(token, options = {}) {
|
|
this.token = token;
|
|
this.contextual = !!options.contextual;
|
|
this.fallback = !!options.fallback;
|
|
this.extend = !!options.extend;
|
|
}
|
|
};
|
|
function readToken(data, input, stack, group) {
|
|
let state = 0, groupMask = 1 << group, { parser: parser2 } = stack.p, { dialect } = parser2;
|
|
scan:
|
|
for (; ; ) {
|
|
if ((groupMask & data[state]) == 0)
|
|
break;
|
|
let accEnd = data[state + 1];
|
|
for (let i = state + 3; i < accEnd; i += 2)
|
|
if ((data[i + 1] & groupMask) > 0) {
|
|
let term = data[i];
|
|
if (dialect.allows(term) && (input.token.value == -1 || input.token.value == term || parser2.overrides(term, input.token.value))) {
|
|
input.acceptToken(term);
|
|
break;
|
|
}
|
|
}
|
|
let next = input.next, low = 0, high = data[state + 2];
|
|
if (input.next < 0 && high > low && data[accEnd + high * 3 - 3] == 65535) {
|
|
state = data[accEnd + high * 3 - 1];
|
|
continue scan;
|
|
}
|
|
for (; low < high; ) {
|
|
let mid = low + high >> 1;
|
|
let index = accEnd + mid + (mid << 1);
|
|
let from = data[index], to = data[index + 1];
|
|
if (next < from)
|
|
high = mid;
|
|
else if (next >= to)
|
|
low = mid + 1;
|
|
else {
|
|
state = data[index + 2];
|
|
input.advance();
|
|
continue scan;
|
|
}
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
function decodeArray(input, Type = Uint16Array) {
|
|
if (typeof input != "string")
|
|
return input;
|
|
let array = null;
|
|
for (let pos = 0, out = 0; pos < input.length; ) {
|
|
let value = 0;
|
|
for (; ; ) {
|
|
let next = input.charCodeAt(pos++), stop = false;
|
|
if (next == 126) {
|
|
value = 65535;
|
|
break;
|
|
}
|
|
if (next >= 92)
|
|
next--;
|
|
if (next >= 34)
|
|
next--;
|
|
let digit = next - 32;
|
|
if (digit >= 46) {
|
|
digit -= 46;
|
|
stop = true;
|
|
}
|
|
value += digit;
|
|
if (stop)
|
|
break;
|
|
value *= 46;
|
|
}
|
|
if (array)
|
|
array[out++] = value;
|
|
else
|
|
array = new Type(value);
|
|
}
|
|
return array;
|
|
}
|
|
var verbose = typeof process != "undefined" && process.env && /\bparse\b/.test(process.env.LOG);
|
|
var stackIDs = null;
|
|
var Safety;
|
|
(function(Safety2) {
|
|
Safety2[Safety2["Margin"] = 25] = "Margin";
|
|
})(Safety || (Safety = {}));
|
|
function cutAt(tree, pos, side) {
|
|
let cursor = tree.cursor(IterMode.IncludeAnonymous);
|
|
cursor.moveTo(pos);
|
|
for (; ; ) {
|
|
if (!(side < 0 ? cursor.childBefore(pos) : cursor.childAfter(pos)))
|
|
for (; ; ) {
|
|
if ((side < 0 ? cursor.to < pos : cursor.from > pos) && !cursor.type.isError)
|
|
return side < 0 ? Math.max(0, Math.min(cursor.to - 1, pos - 25)) : Math.min(tree.length, Math.max(cursor.from + 1, pos + 25));
|
|
if (side < 0 ? cursor.prevSibling() : cursor.nextSibling())
|
|
break;
|
|
if (!cursor.parent())
|
|
return side < 0 ? 0 : tree.length;
|
|
}
|
|
}
|
|
}
|
|
var FragmentCursor = class {
|
|
constructor(fragments, nodeSet) {
|
|
this.fragments = fragments;
|
|
this.nodeSet = nodeSet;
|
|
this.i = 0;
|
|
this.fragment = null;
|
|
this.safeFrom = -1;
|
|
this.safeTo = -1;
|
|
this.trees = [];
|
|
this.start = [];
|
|
this.index = [];
|
|
this.nextFragment();
|
|
}
|
|
nextFragment() {
|
|
let fr = this.fragment = this.i == this.fragments.length ? null : this.fragments[this.i++];
|
|
if (fr) {
|
|
this.safeFrom = fr.openStart ? cutAt(fr.tree, fr.from + fr.offset, 1) - fr.offset : fr.from;
|
|
this.safeTo = fr.openEnd ? cutAt(fr.tree, fr.to + fr.offset, -1) - fr.offset : fr.to;
|
|
while (this.trees.length) {
|
|
this.trees.pop();
|
|
this.start.pop();
|
|
this.index.pop();
|
|
}
|
|
this.trees.push(fr.tree);
|
|
this.start.push(-fr.offset);
|
|
this.index.push(0);
|
|
this.nextStart = this.safeFrom;
|
|
} else {
|
|
this.nextStart = 1e9;
|
|
}
|
|
}
|
|
nodeAt(pos) {
|
|
if (pos < this.nextStart)
|
|
return null;
|
|
while (this.fragment && this.safeTo <= pos)
|
|
this.nextFragment();
|
|
if (!this.fragment)
|
|
return null;
|
|
for (; ; ) {
|
|
let last = this.trees.length - 1;
|
|
if (last < 0) {
|
|
this.nextFragment();
|
|
return null;
|
|
}
|
|
let top2 = this.trees[last], index = this.index[last];
|
|
if (index == top2.children.length) {
|
|
this.trees.pop();
|
|
this.start.pop();
|
|
this.index.pop();
|
|
continue;
|
|
}
|
|
let next = top2.children[index];
|
|
let start2 = this.start[last] + top2.positions[index];
|
|
if (start2 > pos) {
|
|
this.nextStart = start2;
|
|
return null;
|
|
}
|
|
if (next instanceof Tree) {
|
|
if (start2 == pos) {
|
|
if (start2 < this.safeFrom)
|
|
return null;
|
|
let end2 = start2 + next.length;
|
|
if (end2 <= this.safeTo) {
|
|
let lookAhead = next.prop(NodeProp.lookAhead);
|
|
if (!lookAhead || end2 + lookAhead < this.fragment.to)
|
|
return next;
|
|
}
|
|
}
|
|
this.index[last]++;
|
|
if (start2 + next.length >= Math.max(this.safeFrom, pos)) {
|
|
this.trees.push(next);
|
|
this.start.push(start2);
|
|
this.index.push(0);
|
|
}
|
|
} else {
|
|
this.index[last]++;
|
|
this.nextStart = start2 + next.length;
|
|
}
|
|
}
|
|
}
|
|
};
|
|
var TokenCache = class {
|
|
constructor(parser2, stream) {
|
|
this.stream = stream;
|
|
this.tokens = [];
|
|
this.mainToken = null;
|
|
this.actions = [];
|
|
this.tokens = parser2.tokenizers.map((_) => new CachedToken());
|
|
}
|
|
getActions(stack) {
|
|
let actionIndex = 0;
|
|
let main2 = null;
|
|
let { parser: parser2 } = stack.p, { tokenizers } = parser2;
|
|
let mask = parser2.stateSlot(stack.state, 3);
|
|
let context = stack.curContext ? stack.curContext.hash : 0;
|
|
let lookAhead = 0;
|
|
for (let i = 0; i < tokenizers.length; i++) {
|
|
if ((1 << i & mask) == 0)
|
|
continue;
|
|
let tokenizer = tokenizers[i], token = this.tokens[i];
|
|
if (main2 && !tokenizer.fallback)
|
|
continue;
|
|
if (tokenizer.contextual || token.start != stack.pos || token.mask != mask || token.context != context) {
|
|
this.updateCachedToken(token, tokenizer, stack);
|
|
token.mask = mask;
|
|
token.context = context;
|
|
}
|
|
if (token.lookAhead > token.end + 25)
|
|
lookAhead = Math.max(token.lookAhead, lookAhead);
|
|
if (token.value != 0) {
|
|
let startIndex = actionIndex;
|
|
if (token.extended > -1)
|
|
actionIndex = this.addActions(stack, token.extended, token.end, actionIndex);
|
|
actionIndex = this.addActions(stack, token.value, token.end, actionIndex);
|
|
if (!tokenizer.extend) {
|
|
main2 = token;
|
|
if (actionIndex > startIndex)
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
while (this.actions.length > actionIndex)
|
|
this.actions.pop();
|
|
if (lookAhead)
|
|
stack.setLookAhead(lookAhead);
|
|
if (!main2 && stack.pos == this.stream.end) {
|
|
main2 = new CachedToken();
|
|
main2.value = stack.p.parser.eofTerm;
|
|
main2.start = main2.end = stack.pos;
|
|
actionIndex = this.addActions(stack, main2.value, main2.end, actionIndex);
|
|
}
|
|
this.mainToken = main2;
|
|
return this.actions;
|
|
}
|
|
getMainToken(stack) {
|
|
if (this.mainToken)
|
|
return this.mainToken;
|
|
let main2 = new CachedToken(), { pos, p } = stack;
|
|
main2.start = pos;
|
|
main2.end = Math.min(pos + 1, p.stream.end);
|
|
main2.value = pos == p.stream.end ? p.parser.eofTerm : 0;
|
|
return main2;
|
|
}
|
|
updateCachedToken(token, tokenizer, stack) {
|
|
tokenizer.token(this.stream.reset(stack.pos, token), stack);
|
|
if (token.value > -1) {
|
|
let { parser: parser2 } = stack.p;
|
|
for (let i = 0; i < parser2.specialized.length; i++)
|
|
if (parser2.specialized[i] == token.value) {
|
|
let result = parser2.specializers[i](this.stream.read(token.start, token.end), stack);
|
|
if (result >= 0 && stack.p.parser.dialect.allows(result >> 1)) {
|
|
if ((result & 1) == 0)
|
|
token.value = result >> 1;
|
|
else
|
|
token.extended = result >> 1;
|
|
break;
|
|
}
|
|
}
|
|
} else {
|
|
token.value = 0;
|
|
token.end = Math.min(stack.p.stream.end, stack.pos + 1);
|
|
}
|
|
}
|
|
putAction(action, token, end2, index) {
|
|
for (let i = 0; i < index; i += 3)
|
|
if (this.actions[i] == action)
|
|
return index;
|
|
this.actions[index++] = action;
|
|
this.actions[index++] = token;
|
|
this.actions[index++] = end2;
|
|
return index;
|
|
}
|
|
addActions(stack, token, end2, index) {
|
|
let { state } = stack, { parser: parser2 } = stack.p, { data } = parser2;
|
|
for (let set = 0; set < 2; set++) {
|
|
for (let i = parser2.stateSlot(state, set ? 2 : 1); ; i += 3) {
|
|
if (data[i] == 65535) {
|
|
if (data[i + 1] == 1) {
|
|
i = pair(data, i + 2);
|
|
} else {
|
|
if (index == 0 && data[i + 1] == 2)
|
|
index = this.putAction(pair(data, i + 2), token, end2, index);
|
|
break;
|
|
}
|
|
}
|
|
if (data[i] == token)
|
|
index = this.putAction(pair(data, i + 1), token, end2, index);
|
|
}
|
|
}
|
|
return index;
|
|
}
|
|
};
|
|
var Rec;
|
|
(function(Rec2) {
|
|
Rec2[Rec2["Distance"] = 5] = "Distance";
|
|
Rec2[Rec2["MaxRemainingPerStep"] = 3] = "MaxRemainingPerStep";
|
|
Rec2[Rec2["MinBufferLengthPrune"] = 500] = "MinBufferLengthPrune";
|
|
Rec2[Rec2["ForceReduceLimit"] = 10] = "ForceReduceLimit";
|
|
Rec2[Rec2["CutDepth"] = 15e3] = "CutDepth";
|
|
Rec2[Rec2["CutTo"] = 9e3] = "CutTo";
|
|
})(Rec || (Rec = {}));
|
|
var Parse = class {
|
|
constructor(parser2, input, fragments, ranges) {
|
|
this.parser = parser2;
|
|
this.input = input;
|
|
this.ranges = ranges;
|
|
this.recovering = 0;
|
|
this.nextStackID = 9812;
|
|
this.minStackPos = 0;
|
|
this.reused = [];
|
|
this.stoppedAt = null;
|
|
this.stream = new InputStream(input, ranges);
|
|
this.tokens = new TokenCache(parser2, this.stream);
|
|
this.topTerm = parser2.top[1];
|
|
let { from } = ranges[0];
|
|
this.stacks = [Stack.start(this, parser2.top[0], from)];
|
|
this.fragments = fragments.length && this.stream.end - from > parser2.bufferLength * 4 ? new FragmentCursor(fragments, parser2.nodeSet) : null;
|
|
}
|
|
get parsedPos() {
|
|
return this.minStackPos;
|
|
}
|
|
advance() {
|
|
let stacks = this.stacks, pos = this.minStackPos;
|
|
let newStacks = this.stacks = [];
|
|
let stopped, stoppedTokens;
|
|
for (let i = 0; i < stacks.length; i++) {
|
|
let stack = stacks[i];
|
|
for (; ; ) {
|
|
this.tokens.mainToken = null;
|
|
if (stack.pos > pos) {
|
|
newStacks.push(stack);
|
|
} else if (this.advanceStack(stack, newStacks, stacks)) {
|
|
continue;
|
|
} else {
|
|
if (!stopped) {
|
|
stopped = [];
|
|
stoppedTokens = [];
|
|
}
|
|
stopped.push(stack);
|
|
let tok = this.tokens.getMainToken(stack);
|
|
stoppedTokens.push(tok.value, tok.end);
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
if (!newStacks.length) {
|
|
let finished = stopped && findFinished(stopped);
|
|
if (finished)
|
|
return this.stackToTree(finished);
|
|
if (this.parser.strict) {
|
|
if (verbose && stopped)
|
|
console.log("Stuck with token " + (this.tokens.mainToken ? this.parser.getName(this.tokens.mainToken.value) : "none"));
|
|
throw new SyntaxError("No parse at " + pos);
|
|
}
|
|
if (!this.recovering)
|
|
this.recovering = 5;
|
|
}
|
|
if (this.recovering && stopped) {
|
|
let finished = this.stoppedAt != null && stopped[0].pos > this.stoppedAt ? stopped[0] : this.runRecovery(stopped, stoppedTokens, newStacks);
|
|
if (finished)
|
|
return this.stackToTree(finished.forceAll());
|
|
}
|
|
if (this.recovering) {
|
|
let maxRemaining = this.recovering == 1 ? 1 : this.recovering * 3;
|
|
if (newStacks.length > maxRemaining) {
|
|
newStacks.sort((a, b) => b.score - a.score);
|
|
while (newStacks.length > maxRemaining)
|
|
newStacks.pop();
|
|
}
|
|
if (newStacks.some((s) => s.reducePos > pos))
|
|
this.recovering--;
|
|
} else if (newStacks.length > 1) {
|
|
outer:
|
|
for (let i = 0; i < newStacks.length - 1; i++) {
|
|
let stack = newStacks[i];
|
|
for (let j = i + 1; j < newStacks.length; j++) {
|
|
let other = newStacks[j];
|
|
if (stack.sameState(other) || stack.buffer.length > 500 && other.buffer.length > 500) {
|
|
if ((stack.score - other.score || stack.buffer.length - other.buffer.length) > 0) {
|
|
newStacks.splice(j--, 1);
|
|
} else {
|
|
newStacks.splice(i--, 1);
|
|
continue outer;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
this.minStackPos = newStacks[0].pos;
|
|
for (let i = 1; i < newStacks.length; i++)
|
|
if (newStacks[i].pos < this.minStackPos)
|
|
this.minStackPos = newStacks[i].pos;
|
|
return null;
|
|
}
|
|
stopAt(pos) {
|
|
if (this.stoppedAt != null && this.stoppedAt < pos)
|
|
throw new RangeError("Can't move stoppedAt forward");
|
|
this.stoppedAt = pos;
|
|
}
|
|
advanceStack(stack, stacks, split) {
|
|
let start2 = stack.pos, { parser: parser2 } = this;
|
|
let base = verbose ? this.stackID(stack) + " -> " : "";
|
|
if (this.stoppedAt != null && start2 > this.stoppedAt)
|
|
return stack.forceReduce() ? stack : null;
|
|
if (this.fragments) {
|
|
let strictCx = stack.curContext && stack.curContext.tracker.strict, cxHash = strictCx ? stack.curContext.hash : 0;
|
|
for (let cached = this.fragments.nodeAt(start2); cached; ) {
|
|
let match = this.parser.nodeSet.types[cached.type.id] == cached.type ? parser2.getGoto(stack.state, cached.type.id) : -1;
|
|
if (match > -1 && cached.length && (!strictCx || (cached.prop(NodeProp.contextHash) || 0) == cxHash)) {
|
|
stack.useNode(cached, match);
|
|
if (verbose)
|
|
console.log(base + this.stackID(stack) + ` (via reuse of ${parser2.getName(cached.type.id)})`);
|
|
return true;
|
|
}
|
|
if (!(cached instanceof Tree) || cached.children.length == 0 || cached.positions[0] > 0)
|
|
break;
|
|
let inner = cached.children[0];
|
|
if (inner instanceof Tree && cached.positions[0] == 0)
|
|
cached = inner;
|
|
else
|
|
break;
|
|
}
|
|
}
|
|
let defaultReduce = parser2.stateSlot(stack.state, 4);
|
|
if (defaultReduce > 0) {
|
|
stack.reduce(defaultReduce);
|
|
if (verbose)
|
|
console.log(base + this.stackID(stack) + ` (via always-reduce ${parser2.getName(defaultReduce & 65535)})`);
|
|
return true;
|
|
}
|
|
if (stack.stack.length >= 15e3) {
|
|
while (stack.stack.length > 9e3 && stack.forceReduce()) {
|
|
}
|
|
}
|
|
let actions = this.tokens.getActions(stack);
|
|
for (let i = 0; i < actions.length; ) {
|
|
let action = actions[i++], term = actions[i++], end2 = actions[i++];
|
|
let last = i == actions.length || !split;
|
|
let localStack = last ? stack : stack.split();
|
|
localStack.apply(action, term, end2);
|
|
if (verbose)
|
|
console.log(base + this.stackID(localStack) + ` (via ${(action & 65536) == 0 ? "shift" : `reduce of ${parser2.getName(action & 65535)}`} for ${parser2.getName(term)} @ ${start2}${localStack == stack ? "" : ", split"})`);
|
|
if (last)
|
|
return true;
|
|
else if (localStack.pos > start2)
|
|
stacks.push(localStack);
|
|
else
|
|
split.push(localStack);
|
|
}
|
|
return false;
|
|
}
|
|
advanceFully(stack, newStacks) {
|
|
let pos = stack.pos;
|
|
for (; ; ) {
|
|
if (!this.advanceStack(stack, null, null))
|
|
return false;
|
|
if (stack.pos > pos) {
|
|
pushStackDedup(stack, newStacks);
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
runRecovery(stacks, tokens, newStacks) {
|
|
let finished = null, restarted = false;
|
|
for (let i = 0; i < stacks.length; i++) {
|
|
let stack = stacks[i], token = tokens[i << 1], tokenEnd = tokens[(i << 1) + 1];
|
|
let base = verbose ? this.stackID(stack) + " -> " : "";
|
|
if (stack.deadEnd) {
|
|
if (restarted)
|
|
continue;
|
|
restarted = true;
|
|
stack.restart();
|
|
if (verbose)
|
|
console.log(base + this.stackID(stack) + " (restarted)");
|
|
let done = this.advanceFully(stack, newStacks);
|
|
if (done)
|
|
continue;
|
|
}
|
|
let force = stack.split(), forceBase = base;
|
|
for (let j = 0; force.forceReduce() && j < 10; j++) {
|
|
if (verbose)
|
|
console.log(forceBase + this.stackID(force) + " (via force-reduce)");
|
|
let done = this.advanceFully(force, newStacks);
|
|
if (done)
|
|
break;
|
|
if (verbose)
|
|
forceBase = this.stackID(force) + " -> ";
|
|
}
|
|
for (let insert of stack.recoverByInsert(token)) {
|
|
if (verbose)
|
|
console.log(base + this.stackID(insert) + " (via recover-insert)");
|
|
this.advanceFully(insert, newStacks);
|
|
}
|
|
if (this.stream.end > stack.pos) {
|
|
if (tokenEnd == stack.pos) {
|
|
tokenEnd++;
|
|
token = 0;
|
|
}
|
|
stack.recoverByDelete(token, tokenEnd);
|
|
if (verbose)
|
|
console.log(base + this.stackID(stack) + ` (via recover-delete ${this.parser.getName(token)})`);
|
|
pushStackDedup(stack, newStacks);
|
|
} else if (!finished || finished.score < stack.score) {
|
|
finished = stack;
|
|
}
|
|
}
|
|
return finished;
|
|
}
|
|
stackToTree(stack) {
|
|
stack.close();
|
|
return Tree.build({
|
|
buffer: StackBufferCursor.create(stack),
|
|
nodeSet: this.parser.nodeSet,
|
|
topID: this.topTerm,
|
|
maxBufferLength: this.parser.bufferLength,
|
|
reused: this.reused,
|
|
start: this.ranges[0].from,
|
|
length: stack.pos - this.ranges[0].from,
|
|
minRepeatType: this.parser.minRepeatTerm
|
|
});
|
|
}
|
|
stackID(stack) {
|
|
let id2 = (stackIDs || (stackIDs = new WeakMap())).get(stack);
|
|
if (!id2)
|
|
stackIDs.set(stack, id2 = String.fromCodePoint(this.nextStackID++));
|
|
return id2 + stack;
|
|
}
|
|
};
|
|
function pushStackDedup(stack, newStacks) {
|
|
for (let i = 0; i < newStacks.length; i++) {
|
|
let other = newStacks[i];
|
|
if (other.pos == stack.pos && other.sameState(stack)) {
|
|
if (newStacks[i].score < stack.score)
|
|
newStacks[i] = stack;
|
|
return;
|
|
}
|
|
}
|
|
newStacks.push(stack);
|
|
}
|
|
var Dialect = class {
|
|
constructor(source, flags, disabled) {
|
|
this.source = source;
|
|
this.flags = flags;
|
|
this.disabled = disabled;
|
|
}
|
|
allows(term) {
|
|
return !this.disabled || this.disabled[term] == 0;
|
|
}
|
|
};
|
|
var id = (x) => x;
|
|
var ContextTracker = class {
|
|
constructor(spec) {
|
|
this.start = spec.start;
|
|
this.shift = spec.shift || id;
|
|
this.reduce = spec.reduce || id;
|
|
this.reuse = spec.reuse || id;
|
|
this.hash = spec.hash || (() => 0);
|
|
this.strict = spec.strict !== false;
|
|
}
|
|
};
|
|
var LRParser = class extends Parser {
|
|
constructor(spec) {
|
|
super();
|
|
this.wrappers = [];
|
|
if (spec.version != 14)
|
|
throw new RangeError(`Parser version (${spec.version}) doesn't match runtime version (${14})`);
|
|
let nodeNames = spec.nodeNames.split(" ");
|
|
this.minRepeatTerm = nodeNames.length;
|
|
for (let i = 0; i < spec.repeatNodeCount; i++)
|
|
nodeNames.push("");
|
|
let topTerms = Object.keys(spec.topRules).map((r) => spec.topRules[r][1]);
|
|
let nodeProps = [];
|
|
for (let i = 0; i < nodeNames.length; i++)
|
|
nodeProps.push([]);
|
|
function setProp(nodeID, prop, value) {
|
|
nodeProps[nodeID].push([prop, prop.deserialize(String(value))]);
|
|
}
|
|
if (spec.nodeProps)
|
|
for (let propSpec of spec.nodeProps) {
|
|
let prop = propSpec[0];
|
|
if (typeof prop == "string")
|
|
prop = NodeProp[prop];
|
|
for (let i = 1; i < propSpec.length; ) {
|
|
let next = propSpec[i++];
|
|
if (next >= 0) {
|
|
setProp(next, prop, propSpec[i++]);
|
|
} else {
|
|
let value = propSpec[i + -next];
|
|
for (let j = -next; j > 0; j--)
|
|
setProp(propSpec[i++], prop, value);
|
|
i++;
|
|
}
|
|
}
|
|
}
|
|
this.nodeSet = new NodeSet(nodeNames.map((name, i) => NodeType.define({
|
|
name: i >= this.minRepeatTerm ? void 0 : name,
|
|
id: i,
|
|
props: nodeProps[i],
|
|
top: topTerms.indexOf(i) > -1,
|
|
error: i == 0,
|
|
skipped: spec.skippedNodes && spec.skippedNodes.indexOf(i) > -1
|
|
})));
|
|
if (spec.propSources)
|
|
this.nodeSet = this.nodeSet.extend(...spec.propSources);
|
|
this.strict = false;
|
|
this.bufferLength = DefaultBufferLength;
|
|
let tokenArray = decodeArray(spec.tokenData);
|
|
this.context = spec.context;
|
|
this.specializerSpecs = spec.specialized || [];
|
|
this.specialized = new Uint16Array(this.specializerSpecs.length);
|
|
for (let i = 0; i < this.specializerSpecs.length; i++)
|
|
this.specialized[i] = this.specializerSpecs[i].term;
|
|
this.specializers = this.specializerSpecs.map(getSpecializer);
|
|
this.states = decodeArray(spec.states, Uint32Array);
|
|
this.data = decodeArray(spec.stateData);
|
|
this.goto = decodeArray(spec.goto);
|
|
this.maxTerm = spec.maxTerm;
|
|
this.tokenizers = spec.tokenizers.map((value) => typeof value == "number" ? new TokenGroup(tokenArray, value) : value);
|
|
this.topRules = spec.topRules;
|
|
this.dialects = spec.dialects || {};
|
|
this.dynamicPrecedences = spec.dynamicPrecedences || null;
|
|
this.tokenPrecTable = spec.tokenPrec;
|
|
this.termNames = spec.termNames || null;
|
|
this.maxNode = this.nodeSet.types.length - 1;
|
|
this.dialect = this.parseDialect();
|
|
this.top = this.topRules[Object.keys(this.topRules)[0]];
|
|
}
|
|
createParse(input, fragments, ranges) {
|
|
let parse2 = new Parse(this, input, fragments, ranges);
|
|
for (let w of this.wrappers)
|
|
parse2 = w(parse2, input, fragments, ranges);
|
|
return parse2;
|
|
}
|
|
getGoto(state, term, loose = false) {
|
|
let table = this.goto;
|
|
if (term >= table[0])
|
|
return -1;
|
|
for (let pos = table[term + 1]; ; ) {
|
|
let groupTag = table[pos++], last = groupTag & 1;
|
|
let target = table[pos++];
|
|
if (last && loose)
|
|
return target;
|
|
for (let end2 = pos + (groupTag >> 1); pos < end2; pos++)
|
|
if (table[pos] == state)
|
|
return target;
|
|
if (last)
|
|
return -1;
|
|
}
|
|
}
|
|
hasAction(state, terminal) {
|
|
let data = this.data;
|
|
for (let set = 0; set < 2; set++) {
|
|
for (let i = this.stateSlot(state, set ? 2 : 1), next; ; i += 3) {
|
|
if ((next = data[i]) == 65535) {
|
|
if (data[i + 1] == 1)
|
|
next = data[i = pair(data, i + 2)];
|
|
else if (data[i + 1] == 2)
|
|
return pair(data, i + 2);
|
|
else
|
|
break;
|
|
}
|
|
if (next == terminal || next == 0)
|
|
return pair(data, i + 1);
|
|
}
|
|
}
|
|
return 0;
|
|
}
|
|
stateSlot(state, slot) {
|
|
return this.states[state * 6 + slot];
|
|
}
|
|
stateFlag(state, flag) {
|
|
return (this.stateSlot(state, 0) & flag) > 0;
|
|
}
|
|
validAction(state, action) {
|
|
if (action == this.stateSlot(state, 4))
|
|
return true;
|
|
for (let i = this.stateSlot(state, 1); ; i += 3) {
|
|
if (this.data[i] == 65535) {
|
|
if (this.data[i + 1] == 1)
|
|
i = pair(this.data, i + 2);
|
|
else
|
|
return false;
|
|
}
|
|
if (action == pair(this.data, i + 1))
|
|
return true;
|
|
}
|
|
}
|
|
nextStates(state) {
|
|
let result = [];
|
|
for (let i = this.stateSlot(state, 1); ; i += 3) {
|
|
if (this.data[i] == 65535) {
|
|
if (this.data[i + 1] == 1)
|
|
i = pair(this.data, i + 2);
|
|
else
|
|
break;
|
|
}
|
|
if ((this.data[i + 2] & 65536 >> 16) == 0) {
|
|
let value = this.data[i + 1];
|
|
if (!result.some((v, i2) => i2 & 1 && v == value))
|
|
result.push(this.data[i], value);
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
overrides(token, prev) {
|
|
let iPrev = findOffset(this.data, this.tokenPrecTable, prev);
|
|
return iPrev < 0 || findOffset(this.data, this.tokenPrecTable, token) < iPrev;
|
|
}
|
|
configure(config2) {
|
|
let copy = Object.assign(Object.create(LRParser.prototype), this);
|
|
if (config2.props)
|
|
copy.nodeSet = this.nodeSet.extend(...config2.props);
|
|
if (config2.top) {
|
|
let info = this.topRules[config2.top];
|
|
if (!info)
|
|
throw new RangeError(`Invalid top rule name ${config2.top}`);
|
|
copy.top = info;
|
|
}
|
|
if (config2.tokenizers)
|
|
copy.tokenizers = this.tokenizers.map((t2) => {
|
|
let found = config2.tokenizers.find((r) => r.from == t2);
|
|
return found ? found.to : t2;
|
|
});
|
|
if (config2.specializers) {
|
|
copy.specializers = this.specializers.slice();
|
|
copy.specializerSpecs = this.specializerSpecs.map((s, i) => {
|
|
let found = config2.specializers.find((r) => r.from == s.external);
|
|
if (!found)
|
|
return s;
|
|
let spec = Object.assign(Object.assign({}, s), { external: found.to });
|
|
copy.specializers[i] = getSpecializer(spec);
|
|
return spec;
|
|
});
|
|
}
|
|
if (config2.contextTracker)
|
|
copy.context = config2.contextTracker;
|
|
if (config2.dialect)
|
|
copy.dialect = this.parseDialect(config2.dialect);
|
|
if (config2.strict != null)
|
|
copy.strict = config2.strict;
|
|
if (config2.wrap)
|
|
copy.wrappers = copy.wrappers.concat(config2.wrap);
|
|
if (config2.bufferLength != null)
|
|
copy.bufferLength = config2.bufferLength;
|
|
return copy;
|
|
}
|
|
hasWrappers() {
|
|
return this.wrappers.length > 0;
|
|
}
|
|
getName(term) {
|
|
return this.termNames ? this.termNames[term] : String(term <= this.maxNode && this.nodeSet.types[term].name || term);
|
|
}
|
|
get eofTerm() {
|
|
return this.maxNode + 1;
|
|
}
|
|
get topNode() {
|
|
return this.nodeSet.types[this.top[1]];
|
|
}
|
|
dynamicPrecedence(term) {
|
|
let prec = this.dynamicPrecedences;
|
|
return prec == null ? 0 : prec[term] || 0;
|
|
}
|
|
parseDialect(dialect) {
|
|
let values = Object.keys(this.dialects), flags = values.map(() => false);
|
|
if (dialect)
|
|
for (let part of dialect.split(" ")) {
|
|
let id2 = values.indexOf(part);
|
|
if (id2 >= 0)
|
|
flags[id2] = true;
|
|
}
|
|
let disabled = null;
|
|
for (let i = 0; i < values.length; i++)
|
|
if (!flags[i]) {
|
|
for (let j = this.dialects[values[i]], id2; (id2 = this.data[j++]) != 65535; )
|
|
(disabled || (disabled = new Uint8Array(this.maxTerm + 1)))[id2] = 1;
|
|
}
|
|
return new Dialect(dialect, flags, disabled);
|
|
}
|
|
static deserialize(spec) {
|
|
return new LRParser(spec);
|
|
}
|
|
};
|
|
function pair(data, off) {
|
|
return data[off] | data[off + 1] << 16;
|
|
}
|
|
function findOffset(data, start2, term) {
|
|
for (let i = start2, next; (next = data[i]) != 65535; i++)
|
|
if (next == term)
|
|
return i - start2;
|
|
return -1;
|
|
}
|
|
function findFinished(stacks) {
|
|
let best = null;
|
|
for (let stack of stacks) {
|
|
let stopped = stack.p.stoppedAt;
|
|
if ((stack.pos == stack.p.stream.end || stopped != null && stack.pos > stopped) && stack.p.parser.stateFlag(stack.state, 2) && (!best || best.score < stack.score))
|
|
best = stack;
|
|
}
|
|
return best;
|
|
}
|
|
function getSpecializer(spec) {
|
|
if (spec.external) {
|
|
let mask = spec.extend ? 1 : 0;
|
|
return (value, stack) => spec.external(value, stack) << 1 | mask;
|
|
}
|
|
return spec.get;
|
|
}
|
|
|
|
// node_modules/@lezer/javascript/dist/index.es.js
|
|
var import_highlight = __toModule(require("@lezer/highlight"));
|
|
var TSExtends = 1;
|
|
var noSemi = 281;
|
|
var incdec = 2;
|
|
var incdecPrefix = 3;
|
|
var templateContent = 282;
|
|
var InterpolationStart = 4;
|
|
var templateEnd = 283;
|
|
var insertSemi = 284;
|
|
var spaces = 286;
|
|
var newline = 287;
|
|
var LineComment = 5;
|
|
var BlockComment = 6;
|
|
var Dialect_ts = 1;
|
|
var space = [
|
|
9,
|
|
10,
|
|
11,
|
|
12,
|
|
13,
|
|
32,
|
|
133,
|
|
160,
|
|
5760,
|
|
8192,
|
|
8193,
|
|
8194,
|
|
8195,
|
|
8196,
|
|
8197,
|
|
8198,
|
|
8199,
|
|
8200,
|
|
8201,
|
|
8202,
|
|
8232,
|
|
8233,
|
|
8239,
|
|
8287,
|
|
12288
|
|
];
|
|
var braceR = 125;
|
|
var braceL = 123;
|
|
var semicolon = 59;
|
|
var slash = 47;
|
|
var star = 42;
|
|
var plus = 43;
|
|
var minus = 45;
|
|
var dollar = 36;
|
|
var backtick = 96;
|
|
var backslash = 92;
|
|
var trackNewline = new ContextTracker({
|
|
start: false,
|
|
shift(context, term) {
|
|
return term == LineComment || term == BlockComment || term == spaces ? context : term == newline;
|
|
},
|
|
strict: false
|
|
});
|
|
var insertSemicolon = new ExternalTokenizer((input, stack) => {
|
|
let { next } = input;
|
|
if ((next == braceR || next == -1 || stack.context) && stack.canShift(insertSemi))
|
|
input.acceptToken(insertSemi);
|
|
}, { contextual: true, fallback: true });
|
|
var noSemicolon = new ExternalTokenizer((input, stack) => {
|
|
let { next } = input, after;
|
|
if (space.indexOf(next) > -1)
|
|
return;
|
|
if (next == slash && ((after = input.peek(1)) == slash || after == star))
|
|
return;
|
|
if (next != braceR && next != semicolon && next != -1 && !stack.context && stack.canShift(noSemi))
|
|
input.acceptToken(noSemi);
|
|
}, { contextual: true });
|
|
var incdecToken = new ExternalTokenizer((input, stack) => {
|
|
let { next } = input;
|
|
if (next == plus || next == minus) {
|
|
input.advance();
|
|
if (next == input.next) {
|
|
input.advance();
|
|
let mayPostfix = !stack.context && stack.canShift(incdec);
|
|
input.acceptToken(mayPostfix ? incdec : incdecPrefix);
|
|
}
|
|
}
|
|
}, { contextual: true });
|
|
var template = new ExternalTokenizer((input) => {
|
|
for (let afterDollar = false, i = 0; ; i++) {
|
|
let { next } = input;
|
|
if (next < 0) {
|
|
if (i)
|
|
input.acceptToken(templateContent);
|
|
break;
|
|
} else if (next == backtick) {
|
|
if (i)
|
|
input.acceptToken(templateContent);
|
|
else
|
|
input.acceptToken(templateEnd, 1);
|
|
break;
|
|
} else if (next == braceL && afterDollar) {
|
|
if (i == 1)
|
|
input.acceptToken(InterpolationStart, 1);
|
|
else
|
|
input.acceptToken(templateContent, -1);
|
|
break;
|
|
} else if (next == 10 && i) {
|
|
input.advance();
|
|
input.acceptToken(templateContent);
|
|
break;
|
|
} else if (next == backslash) {
|
|
input.advance();
|
|
}
|
|
afterDollar = next == dollar;
|
|
input.advance();
|
|
}
|
|
});
|
|
var tsExtends = new ExternalTokenizer((input, stack) => {
|
|
if (input.next != 101 || !stack.dialectEnabled(Dialect_ts))
|
|
return;
|
|
input.advance();
|
|
for (let i = 0; i < 6; i++) {
|
|
if (input.next != "xtends".charCodeAt(i))
|
|
return;
|
|
input.advance();
|
|
}
|
|
if (input.next >= 57 && input.next <= 65 || input.next >= 48 && input.next <= 90 || input.next == 95 || input.next >= 97 && input.next <= 122 || input.next > 160)
|
|
return;
|
|
input.acceptToken(TSExtends);
|
|
});
|
|
var jsHighlight = (0, import_highlight.styleTags)({
|
|
"get set async static": import_highlight.tags.modifier,
|
|
"for while do if else switch try catch finally return throw break continue default case": import_highlight.tags.controlKeyword,
|
|
"in of await yield void typeof delete instanceof": import_highlight.tags.operatorKeyword,
|
|
"let var const function class extends": import_highlight.tags.definitionKeyword,
|
|
"import export from": import_highlight.tags.moduleKeyword,
|
|
"with debugger as new": import_highlight.tags.keyword,
|
|
TemplateString: import_highlight.tags.special(import_highlight.tags.string),
|
|
super: import_highlight.tags.atom,
|
|
BooleanLiteral: import_highlight.tags.bool,
|
|
this: import_highlight.tags.self,
|
|
null: import_highlight.tags.null,
|
|
Star: import_highlight.tags.modifier,
|
|
VariableName: import_highlight.tags.variableName,
|
|
"CallExpression/VariableName TaggedTemplateExpression/VariableName": import_highlight.tags.function(import_highlight.tags.variableName),
|
|
VariableDefinition: import_highlight.tags.definition(import_highlight.tags.variableName),
|
|
Label: import_highlight.tags.labelName,
|
|
PropertyName: import_highlight.tags.propertyName,
|
|
PrivatePropertyName: import_highlight.tags.special(import_highlight.tags.propertyName),
|
|
"CallExpression/MemberExpression/PropertyName": import_highlight.tags.function(import_highlight.tags.propertyName),
|
|
"FunctionDeclaration/VariableDefinition": import_highlight.tags.function(import_highlight.tags.definition(import_highlight.tags.variableName)),
|
|
"ClassDeclaration/VariableDefinition": import_highlight.tags.definition(import_highlight.tags.className),
|
|
PropertyDefinition: import_highlight.tags.definition(import_highlight.tags.propertyName),
|
|
PrivatePropertyDefinition: import_highlight.tags.definition(import_highlight.tags.special(import_highlight.tags.propertyName)),
|
|
UpdateOp: import_highlight.tags.updateOperator,
|
|
LineComment: import_highlight.tags.lineComment,
|
|
BlockComment: import_highlight.tags.blockComment,
|
|
Number: import_highlight.tags.number,
|
|
String: import_highlight.tags.string,
|
|
ArithOp: import_highlight.tags.arithmeticOperator,
|
|
LogicOp: import_highlight.tags.logicOperator,
|
|
BitOp: import_highlight.tags.bitwiseOperator,
|
|
CompareOp: import_highlight.tags.compareOperator,
|
|
RegExp: import_highlight.tags.regexp,
|
|
Equals: import_highlight.tags.definitionOperator,
|
|
Arrow: import_highlight.tags.function(import_highlight.tags.punctuation),
|
|
": Spread": import_highlight.tags.punctuation,
|
|
"( )": import_highlight.tags.paren,
|
|
"[ ]": import_highlight.tags.squareBracket,
|
|
"{ }": import_highlight.tags.brace,
|
|
"InterpolationStart InterpolationEnd": import_highlight.tags.special(import_highlight.tags.brace),
|
|
".": import_highlight.tags.derefOperator,
|
|
", ;": import_highlight.tags.separator,
|
|
TypeName: import_highlight.tags.typeName,
|
|
TypeDefinition: import_highlight.tags.definition(import_highlight.tags.typeName),
|
|
"type enum interface implements namespace module declare": import_highlight.tags.definitionKeyword,
|
|
"abstract global Privacy readonly override": import_highlight.tags.modifier,
|
|
"is keyof unique infer": import_highlight.tags.operatorKeyword,
|
|
JSXAttributeValue: import_highlight.tags.attributeValue,
|
|
JSXText: import_highlight.tags.content,
|
|
"JSXStartTag JSXStartCloseTag JSXSelfCloseEndTag JSXEndTag": import_highlight.tags.angleBracket,
|
|
"JSXIdentifier JSXNameSpacedName": import_highlight.tags.tagName,
|
|
"JSXAttribute/JSXIdentifier JSXAttribute/JSXNameSpacedName": import_highlight.tags.attributeName
|
|
});
|
|
var spec_identifier = { __proto__: null, export: 18, as: 23, from: 29, default: 32, async: 37, function: 38, this: 48, true: 56, false: 56, void: 66, typeof: 70, null: 86, super: 88, new: 122, await: 139, yield: 141, delete: 142, class: 152, extends: 154, public: 197, private: 197, protected: 197, readonly: 199, instanceof: 220, in: 222, const: 224, import: 256, keyof: 307, unique: 311, infer: 317, is: 351, abstract: 371, implements: 373, type: 375, let: 378, var: 380, interface: 387, enum: 391, namespace: 397, module: 399, declare: 403, global: 407, for: 428, of: 437, while: 440, with: 444, do: 448, if: 452, else: 454, switch: 458, case: 464, try: 470, catch: 474, finally: 478, return: 482, throw: 486, break: 490, continue: 494, debugger: 498 };
|
|
var spec_word = { __proto__: null, async: 109, get: 111, set: 113, public: 161, private: 161, protected: 161, static: 163, abstract: 165, override: 167, readonly: 173, new: 355 };
|
|
var spec_LessThan = { __proto__: null, "<": 129 };
|
|
var parser = LRParser.deserialize({
|
|
version: 14,
|
|
states: "$8SO`QdOOO'QQ(C|O'#ChO'XOWO'#DVO)dQdO'#D]O)tQdO'#DhO){QdO'#DrO-xQdO'#DxOOQO'#E]'#E]O.]Q`O'#E[O.bQ`O'#E[OOQ(C['#Ef'#EfO0aQ(C|O'#ItO2wQ(C|O'#IuO3eQ`O'#EzO3jQ!bO'#FaOOQ(C['#FS'#FSO3rO#tO'#FSO4QQ&jO'#FhO5bQ`O'#FgOOQ(C['#Iu'#IuOOQ(CW'#It'#ItOOQS'#J^'#J^O5gQ`O'#HpO5lQ(ChO'#HqOOQS'#Ih'#IhOOQS'#Hr'#HrQ`QdOOO){QdO'#DjO5tQ`O'#G[O5yQ&jO'#CmO6XQ`O'#EZO6dQ`O'#EgO6iQ,UO'#FRO7TQ`O'#G[O7YQ`O'#G`O7eQ`O'#G`O7sQ`O'#GcO7sQ`O'#GdO7sQ`O'#GfO5tQ`O'#GiO8dQ`O'#GlO9rQ`O'#CdO:SQ`O'#GyO:[Q`O'#HPO:[Q`O'#HRO`QdO'#HTO:[Q`O'#HVO:[Q`O'#HYO:aQ`O'#H`O:fQ(CjO'#HfO){QdO'#HhO:qQ(CjO'#HjO:|Q(CjO'#HlO5lQ(ChO'#HnO){QdO'#DWOOOW'#Ht'#HtO;XOWO,59qOOQ(C[,59q,59qO=jQtO'#ChO=tQdO'#HuO>XQ`O'#IvO@WQtO'#IvO'dQdO'#IvO@_Q`O,59wO@u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Q6t4}Q7U5kQ7y6zQ8S7WR8i8TlhOSj}!n$]%c%f%g%i*o*t/g/jQ%]yR*d%YV$yrs*mR.u*TR*c%WQ$qpR)u$rR)k$lT%az%dT%bz%dT/i*t/j",
|
|
nodeNames: "\u26A0 extends ArithOp ArithOp InterpolationStart LineComment BlockComment Script ExportDeclaration export Star as VariableName String from ; default FunctionDeclaration async function VariableDefinition TypeParamList TypeDefinition ThisType this LiteralType ArithOp Number BooleanLiteral TemplateType InterpolationEnd Interpolation VoidType void TypeofType typeof MemberExpression . ?. PropertyName [ TemplateString Interpolation null super RegExp ] ArrayExpression Spread , } { ObjectExpression Property async get set PropertyDefinition Block : NewExpression new TypeArgList CompareOp < ) ( ArgList UnaryExpression await yield delete LogicOp BitOp ParenthesizedExpression ClassExpression class extends ClassBody MethodDeclaration Privacy static abstract override PrivatePropertyDefinition PropertyDeclaration readonly Optional TypeAnnotation Equals StaticBlock FunctionExpression ArrowFunction ParamList ParamList ArrayPattern ObjectPattern PatternProperty Privacy readonly Arrow MemberExpression PrivatePropertyName BinaryExpression ArithOp ArithOp ArithOp ArithOp BitOp CompareOp instanceof in const CompareOp BitOp BitOp BitOp LogicOp LogicOp ConditionalExpression LogicOp LogicOp AssignmentExpression UpdateOp PostfixExpression CallExpression TaggedTemplateExpression DynamicImport import ImportMeta JSXElement JSXSelfCloseEndTag JSXStartTag JSXSelfClosingTag JSXIdentifier JSXNamespacedName JSXMemberExpression JSXSpreadAttribute JSXAttribute JSXAttributeValue JSXEscape JSXEndTag JSXOpenTag JSXFragmentTag JSXText JSXEscape JSXStartCloseTag JSXCloseTag PrefixCast ArrowFunction TypeParamList SequenceExpression KeyofType keyof UniqueType unique ImportType InferredType infer TypeName ParenthesizedType FunctionSignature ParamList NewSignature IndexedType TupleType Label ArrayType ReadonlyType ObjectType MethodType PropertyType IndexSignature CallSignature TypePredicate is NewSignature new UnionType LogicOp IntersectionType LogicOp ConditionalType ParameterizedType ClassDeclaration abstract implements type VariableDeclaration let var TypeAliasDeclaration InterfaceDeclaration interface EnumDeclaration enum EnumBody NamespaceDeclaration namespace module AmbientDeclaration declare GlobalDeclaration global ClassDeclaration ClassBody MethodDeclaration AmbientFunctionDeclaration ExportGroup VariableName VariableName ImportDeclaration ImportGroup ForStatement for ForSpec ForInSpec ForOfSpec of WhileStatement while WithStatement with DoStatement do IfStatement if else SwitchStatement switch SwitchBody CaseLabel case DefaultLabel TryStatement try CatchClause catch FinallyClause finally ReturnStatement return ThrowStatement throw BreakStatement break ContinueStatement continue DebuggerStatement debugger LabeledStatement ExpressionStatement",
|
|
maxTerm: 332,
|
|
context: trackNewline,
|
|
nodeProps: [
|
|
["closedBy", 4, "InterpolationEnd", 40, "]", 51, "}", 66, ")", 132, "JSXSelfCloseEndTag JSXEndTag", 146, "JSXEndTag"],
|
|
["group", -26, 8, 15, 17, 58, 184, 188, 191, 192, 194, 197, 200, 211, 213, 219, 221, 223, 225, 228, 234, 240, 242, 244, 246, 248, 250, 251, "Statement", -30, 12, 13, 24, 27, 28, 41, 43, 44, 45, 47, 52, 60, 68, 74, 75, 91, 92, 101, 103, 119, 122, 124, 125, 126, 127, 129, 130, 148, 149, 151, "Expression", -22, 23, 25, 29, 32, 34, 152, 154, 156, 157, 159, 160, 161, 163, 164, 165, 167, 168, 169, 178, 180, 182, 183, "Type", -3, 79, 85, 90, "ClassItem"],
|
|
["openedBy", 30, "InterpolationStart", 46, "[", 50, "{", 65, "(", 131, "JSXStartTag", 141, "JSXStartTag JSXStartCloseTag"]
|
|
],
|
|
propSources: [jsHighlight],
|
|
skippedNodes: [0, 5, 6],
|
|
repeatNodeCount: 28,
|
|
tokenData: "!C}~R!`OX%TXY%cYZ'RZ[%c[]%T]^'R^p%Tpq%cqr'crs(kst0htu2`uv4pvw5ewx6cxy<yyz=Zz{=k{|>k|}?O}!O>k!O!P?`!P!QCl!Q!R!0[!R![!1q![!]!7s!]!^!8V!^!_!8g!_!`!9d!`!a!:[!a!b!<R!b!c%T!c!}2`!}#O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P!<o!P!^%T!_!a%T!a!b!=P!b#o%T#p~%T*[!<vRv*S$UWO!^%T!_#o%T#p~%T$O!=WS$UW#j#vO!^%T!_!`5T!`#o%T#p~%T7V!=kRx6}$UWO!^%T!_#o%T#p~%Tk!={R!Oc$UWO!^%T!_#o%T#p~%T$O!>]S#g#v$UWO!^%T!_!`5T!`#o%T#p~%T$a!>pR$UW'f$XO!^%T!_#o%T#p~%T~!?OO!T~5b!?VT'w5Y$UWO!^%T!_!`5T!`#o%T#p#q!=P#q~%T6X!?oR!S5}nQ$UWO!^%T!_#o%T#p~%TX!@PR!kP$UWO!^%T!_#o%T#p~%T7Z!@gr$UW'Y7R#zS']$y'g3SOX%TXY%cYZ%TZ[%c[p%Tpq%cqt%Ttu2`u}%T}!O3j!O!Q%T!Q![2`![!^%T!_!c%T!c!}2`!}#R%T#R#S2`#S#T%T#T#o2`#p$f%T$f$g%c$g#BY2`#BY#BZ!@Y#BZ$IS2`$IS$I_!@Y$I_$JT2`$JT$JU!@Y$JU$KV2`$KV$KW!@Y$KW&FU2`&FU&FV!@Y&FV?HT2`?HT?HU!@Y?HU~2`7Z!CO_$UW'Z7R#zS']$y'g3SOt%Ttu2`u}%T}!O3j!O!Q%T!Q![2`![!^%T!_!c%T!c!}2`!}#R%T#R#S2`#S#T%T#T#o2`#p$g%T$g~2`",
|
|
tokenizers: [tsExtends, noSemicolon, incdecToken, template, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, insertSemicolon],
|
|
topRules: { "Script": [0, 7] },
|
|
dialects: { jsx: 12107, ts: 12109 },
|
|
dynamicPrecedences: { "149": 1, "176": 1 },
|
|
specialized: [{ term: 289, get: (value) => spec_identifier[value] || -1 }, { term: 299, get: (value) => spec_word[value] || -1 }, { term: 63, get: (value) => spec_LessThan[value] || -1 }],
|
|
tokenPrec: 12130
|
|
});
|
|
|
|
// node_modules/@codemirror/lang-javascript/dist/index.js
|
|
var import_language = __toModule(require("@codemirror/language"));
|
|
var import_state = __toModule(require("@codemirror/state"));
|
|
var import_view = __toModule(require("@codemirror/view"));
|
|
var import_autocomplete = __toModule(require("@codemirror/autocomplete"));
|
|
var snippets = [
|
|
/* @__PURE__ */ (0, import_autocomplete.snippetCompletion)("function ${name}(${params}) {\n ${}\n}", {
|
|
label: "function",
|
|
detail: "definition",
|
|
type: "keyword"
|
|
}),
|
|
/* @__PURE__ */ (0, import_autocomplete.snippetCompletion)("for (let ${index} = 0; ${index} < ${bound}; ${index}++) {\n ${}\n}", {
|
|
label: "for",
|
|
detail: "loop",
|
|
type: "keyword"
|
|
}),
|
|
/* @__PURE__ */ (0, import_autocomplete.snippetCompletion)("for (let ${name} of ${collection}) {\n ${}\n}", {
|
|
label: "for",
|
|
detail: "of loop",
|
|
type: "keyword"
|
|
}),
|
|
/* @__PURE__ */ (0, import_autocomplete.snippetCompletion)("do {\n ${}\n} while (${})", {
|
|
label: "do",
|
|
detail: "loop",
|
|
type: "keyword"
|
|
}),
|
|
/* @__PURE__ */ (0, import_autocomplete.snippetCompletion)("while (${}) {\n ${}\n}", {
|
|
label: "while",
|
|
detail: "loop",
|
|
type: "keyword"
|
|
}),
|
|
/* @__PURE__ */ (0, import_autocomplete.snippetCompletion)("try {\n ${}\n} catch (${error}) {\n ${}\n}", {
|
|
label: "try",
|
|
detail: "/ catch block",
|
|
type: "keyword"
|
|
}),
|
|
/* @__PURE__ */ (0, import_autocomplete.snippetCompletion)("if (${}) {\n ${}\n}", {
|
|
label: "if",
|
|
detail: "block",
|
|
type: "keyword"
|
|
}),
|
|
/* @__PURE__ */ (0, import_autocomplete.snippetCompletion)("if (${}) {\n ${}\n} else {\n ${}\n}", {
|
|
label: "if",
|
|
detail: "/ else block",
|
|
type: "keyword"
|
|
}),
|
|
/* @__PURE__ */ (0, import_autocomplete.snippetCompletion)("class ${name} {\n constructor(${params}) {\n ${}\n }\n}", {
|
|
label: "class",
|
|
detail: "definition",
|
|
type: "keyword"
|
|
}),
|
|
/* @__PURE__ */ (0, import_autocomplete.snippetCompletion)('import {${names}} from "${module}"\n${}', {
|
|
label: "import",
|
|
detail: "named",
|
|
type: "keyword"
|
|
}),
|
|
/* @__PURE__ */ (0, import_autocomplete.snippetCompletion)('import ${name} from "${module}"\n${}', {
|
|
label: "import",
|
|
detail: "default",
|
|
type: "keyword"
|
|
})
|
|
];
|
|
var cache = /* @__PURE__ */ new NodeWeakMap();
|
|
var ScopeNodes = /* @__PURE__ */ new Set([
|
|
"Script",
|
|
"Block",
|
|
"FunctionExpression",
|
|
"FunctionDeclaration",
|
|
"ArrowFunction",
|
|
"MethodDeclaration",
|
|
"ForStatement"
|
|
]);
|
|
function defID(type) {
|
|
return (node, def) => {
|
|
let id2 = node.node.getChild("VariableDefinition");
|
|
if (id2)
|
|
def(id2, type);
|
|
return true;
|
|
};
|
|
}
|
|
var functionContext = ["FunctionDeclaration"];
|
|
var gatherCompletions = {
|
|
FunctionDeclaration: /* @__PURE__ */ defID("function"),
|
|
ClassDeclaration: /* @__PURE__ */ defID("class"),
|
|
ClassExpression: () => true,
|
|
EnumDeclaration: /* @__PURE__ */ defID("constant"),
|
|
TypeAliasDeclaration: /* @__PURE__ */ defID("type"),
|
|
NamespaceDeclaration: /* @__PURE__ */ defID("namespace"),
|
|
VariableDefinition(node, def) {
|
|
if (!node.matchContext(functionContext))
|
|
def(node, "variable");
|
|
},
|
|
TypeDefinition(node, def) {
|
|
def(node, "type");
|
|
},
|
|
__proto__: null
|
|
};
|
|
function getScope(doc, node) {
|
|
let cached = cache.get(node);
|
|
if (cached)
|
|
return cached;
|
|
let completions = [], top2 = true;
|
|
function def(node2, type) {
|
|
let name = doc.sliceString(node2.from, node2.to);
|
|
completions.push({ label: name, type });
|
|
}
|
|
node.cursor(IterMode.IncludeAnonymous).iterate((node2) => {
|
|
if (top2) {
|
|
top2 = false;
|
|
} else if (node2.name) {
|
|
let gather = gatherCompletions[node2.name];
|
|
if (gather && gather(node2, def) || ScopeNodes.has(node2.name))
|
|
return false;
|
|
} else if (node2.to - node2.from > 8192) {
|
|
for (let c of getScope(doc, node2.node))
|
|
completions.push(c);
|
|
return false;
|
|
}
|
|
});
|
|
cache.set(node, completions);
|
|
return completions;
|
|
}
|
|
var Identifier = /^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/;
|
|
var dontComplete = [
|
|
"TemplateString",
|
|
"String",
|
|
"RegExp",
|
|
"LineComment",
|
|
"BlockComment",
|
|
"VariableDefinition",
|
|
"TypeDefinition",
|
|
"Label",
|
|
"PropertyDefinition",
|
|
"PropertyName",
|
|
"PrivatePropertyDefinition",
|
|
"PrivatePropertyName"
|
|
];
|
|
function localCompletionSource(context) {
|
|
let inner = (0, import_language.syntaxTree)(context.state).resolveInner(context.pos, -1);
|
|
if (dontComplete.indexOf(inner.name) > -1)
|
|
return null;
|
|
let isWord = inner.to - inner.from < 20 && Identifier.test(context.state.sliceDoc(inner.from, inner.to));
|
|
if (!isWord && !context.explicit)
|
|
return null;
|
|
let options = [];
|
|
for (let pos = inner; pos; pos = pos.parent) {
|
|
if (ScopeNodes.has(pos.name))
|
|
options = options.concat(getScope(context.state.doc, pos));
|
|
}
|
|
return {
|
|
options,
|
|
from: isWord ? inner.from : context.pos,
|
|
validFor: Identifier
|
|
};
|
|
}
|
|
var javascriptLanguage = /* @__PURE__ */ import_language.LRLanguage.define({
|
|
parser: /* @__PURE__ */ parser.configure({
|
|
props: [
|
|
/* @__PURE__ */ import_language.indentNodeProp.add({
|
|
IfStatement: /* @__PURE__ */ (0, import_language.continuedIndent)({ except: /^\s*({|else\b)/ }),
|
|
TryStatement: /* @__PURE__ */ (0, import_language.continuedIndent)({ except: /^\s*({|catch\b|finally\b)/ }),
|
|
LabeledStatement: import_language.flatIndent,
|
|
SwitchBody: (context) => {
|
|
let after = context.textAfter, closed = /^\s*\}/.test(after), isCase = /^\s*(case|default)\b/.test(after);
|
|
return context.baseIndent + (closed ? 0 : isCase ? 1 : 2) * context.unit;
|
|
},
|
|
Block: /* @__PURE__ */ (0, import_language.delimitedIndent)({ closing: "}" }),
|
|
ArrowFunction: (cx) => cx.baseIndent + cx.unit,
|
|
"TemplateString BlockComment": () => null,
|
|
"Statement Property": /* @__PURE__ */ (0, import_language.continuedIndent)({ except: /^{/ }),
|
|
JSXElement(context) {
|
|
let closed = /^\s*<\//.test(context.textAfter);
|
|
return context.lineIndent(context.node.from) + (closed ? 0 : context.unit);
|
|
},
|
|
JSXEscape(context) {
|
|
let closed = /\s*\}/.test(context.textAfter);
|
|
return context.lineIndent(context.node.from) + (closed ? 0 : context.unit);
|
|
},
|
|
"JSXOpenTag JSXSelfClosingTag"(context) {
|
|
return context.column(context.node.from) + context.unit;
|
|
}
|
|
}),
|
|
/* @__PURE__ */ import_language.foldNodeProp.add({
|
|
"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression": import_language.foldInside,
|
|
BlockComment(tree) {
|
|
return { from: tree.from + 2, to: tree.to - 2 };
|
|
}
|
|
})
|
|
]
|
|
}),
|
|
languageData: {
|
|
closeBrackets: { brackets: ["(", "[", "{", "'", '"', "`"] },
|
|
commentTokens: { line: "//", block: { open: "/*", close: "*/" } },
|
|
indentOnInput: /^\s*(?:case |default:|\{|\}|<\/)$/,
|
|
wordChars: "$"
|
|
}
|
|
});
|
|
var typescriptLanguage = /* @__PURE__ */ javascriptLanguage.configure({ dialect: "ts" });
|
|
var jsxLanguage = /* @__PURE__ */ javascriptLanguage.configure({ dialect: "jsx" });
|
|
var tsxLanguage = /* @__PURE__ */ javascriptLanguage.configure({ dialect: "jsx ts" });
|
|
var keywords = /* @__PURE__ */ "break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield".split(" ").map((kw) => ({ label: kw, type: "keyword" }));
|
|
function javascript(config2 = {}) {
|
|
let lang = config2.jsx ? config2.typescript ? tsxLanguage : jsxLanguage : config2.typescript ? typescriptLanguage : javascriptLanguage;
|
|
return new import_language.LanguageSupport(lang, [
|
|
javascriptLanguage.data.of({
|
|
autocomplete: (0, import_autocomplete.ifNotIn)(dontComplete, (0, import_autocomplete.completeFromList)(snippets.concat(keywords)))
|
|
}),
|
|
javascriptLanguage.data.of({
|
|
autocomplete: localCompletionSource
|
|
}),
|
|
config2.jsx ? autoCloseTags : []
|
|
]);
|
|
}
|
|
function elementName(doc, tree, max2 = doc.length) {
|
|
if (!tree)
|
|
return "";
|
|
let name = tree.getChild("JSXIdentifier");
|
|
return name ? doc.sliceString(name.from, Math.min(name.to, max2)) : "";
|
|
}
|
|
var android = typeof navigator == "object" && /* @__PURE__ */ /Android\b/.test(navigator.userAgent);
|
|
var autoCloseTags = /* @__PURE__ */ import_view.EditorView.inputHandler.of((view, from, to, text) => {
|
|
if ((android ? view.composing : view.compositionStarted) || view.state.readOnly || from != to || text != ">" && text != "/" || !javascriptLanguage.isActiveAt(view.state, from, -1))
|
|
return false;
|
|
let { state } = view;
|
|
let changes = state.changeByRange((range) => {
|
|
var _a, _b, _c;
|
|
let { head } = range, around = (0, import_language.syntaxTree)(state).resolveInner(head, -1), name;
|
|
if (around.name == "JSXStartTag")
|
|
around = around.parent;
|
|
if (text == ">" && around.name == "JSXFragmentTag") {
|
|
return { range: import_state.EditorSelection.cursor(head + 1), changes: { from: head, insert: `><>` } };
|
|
} else if (text == ">" && around.name == "JSXIdentifier") {
|
|
if (((_b = (_a = around.parent) === null || _a === void 0 ? void 0 : _a.lastChild) === null || _b === void 0 ? void 0 : _b.name) != "JSXEndTag" && (name = elementName(state.doc, around.parent, head)))
|
|
return { range: import_state.EditorSelection.cursor(head + 1), changes: { from: head, insert: `></${name}>` } };
|
|
} else if (text == "/" && around.name == "JSXFragmentTag") {
|
|
let empty = around.parent, base = empty === null || empty === void 0 ? void 0 : empty.parent;
|
|
if (empty.from == head - 1 && ((_c = base.lastChild) === null || _c === void 0 ? void 0 : _c.name) != "JSXEndTag" && (name = elementName(state.doc, base === null || base === void 0 ? void 0 : base.firstChild, head))) {
|
|
let insert = `/${name}>`;
|
|
return { range: import_state.EditorSelection.cursor(head + insert.length), changes: { from: head, insert } };
|
|
}
|
|
}
|
|
return { range };
|
|
});
|
|
if (changes.changes.empty)
|
|
return false;
|
|
view.dispatch(changes, { userEvent: "input.type", scrollIntoView: true });
|
|
return true;
|
|
});
|
|
|
|
// src/settings/ui/snippets_editor/extensions.ts
|
|
var import_language3 = __toModule(require("@codemirror/language"));
|
|
var import_commands = __toModule(require("@codemirror/commands"));
|
|
var import_autocomplete2 = __toModule(require("@codemirror/autocomplete"));
|
|
var import_search = __toModule(require("@codemirror/search"));
|
|
var import_lint = __toModule(require("@codemirror/lint"));
|
|
|
|
// src/settings/ui/snippets_editor/obsidian_theme.ts
|
|
var import_view2 = __toModule(require("@codemirror/view"));
|
|
var import_language2 = __toModule(require("@codemirror/language"));
|
|
var import_highlight2 = __toModule(require("@lezer/highlight"));
|
|
var config = {
|
|
name: "obsidian",
|
|
dark: false,
|
|
background: "var(--background-primary)",
|
|
foreground: "var(--text-normal)",
|
|
selection: "var(--text-selection)",
|
|
cursor: "var(--text-normal)",
|
|
dropdownBackground: "var(--background-primary)",
|
|
dropdownBorder: "var(--background-modifier-border)",
|
|
activeLine: "var(--background-primary)",
|
|
matchingBracket: "var(--background-modifier-accent)",
|
|
keyword: "#d73a49",
|
|
storage: "#d73a49",
|
|
variable: "var(--text-normal)",
|
|
parameter: "var(--text-accent-hover)",
|
|
function: "var(--text-accent-hover)",
|
|
string: "var(--text-accent)",
|
|
constant: "var(--text-accent-hover)",
|
|
type: "var(--text-accent-hover)",
|
|
class: "#6f42c1",
|
|
number: "var(--text-accent-hover)",
|
|
comment: "var(--text-faint)",
|
|
heading: "var(--text-accent-hover)",
|
|
invalid: "var(--text-error)",
|
|
regexp: "var(--text-accent)"
|
|
};
|
|
var obsidianTheme = import_view2.EditorView.theme({
|
|
"&": {
|
|
color: config.foreground,
|
|
backgroundColor: config.background
|
|
},
|
|
".cm-content": { caretColor: config.cursor },
|
|
"&.cm-focused .cm-cursor": { borderLeftColor: config.cursor },
|
|
"&.cm-focused .cm-selectionBackground, .cm-selectionBackground, & ::selection": { backgroundColor: config.selection },
|
|
".cm-panels": { backgroundColor: config.dropdownBackground, color: config.foreground },
|
|
".cm-panels.cm-panels-top": { borderBottom: "2px solid black" },
|
|
".cm-panels.cm-panels-bottom": { borderTop: "2px solid black" },
|
|
".cm-searchMatch": {
|
|
backgroundColor: config.dropdownBackground,
|
|
outline: `1px solid ${config.dropdownBorder}`
|
|
},
|
|
".cm-searchMatch.cm-searchMatch-selected": {
|
|
backgroundColor: config.selection
|
|
},
|
|
".cm-activeLine": { backgroundColor: config.activeLine },
|
|
".cm-activeLineGutter": { backgroundColor: config.background },
|
|
".cm-selectionMatch": { backgroundColor: config.selection },
|
|
".cm-matchingBracket, .cm-nonmatchingBracket": {
|
|
backgroundColor: config.matchingBracket,
|
|
outline: "none"
|
|
},
|
|
".cm-gutters": {
|
|
backgroundColor: config.background,
|
|
color: config.comment,
|
|
borderRight: "1px solid var(--background-modifier-border)"
|
|
},
|
|
".cm-lineNumbers, .cm-gutterElement": { color: "inherit" },
|
|
".cm-foldPlaceholder": {
|
|
backgroundColor: "transparent",
|
|
border: "none",
|
|
color: config.foreground
|
|
},
|
|
".cm-tooltip": {
|
|
border: `1px solid ${config.dropdownBorder}`,
|
|
backgroundColor: config.dropdownBackground,
|
|
color: config.foreground
|
|
},
|
|
".cm-tooltip.cm-tooltip-autocomplete": {
|
|
"& > ul > li[aria-selected]": {
|
|
background: config.selection,
|
|
color: config.foreground
|
|
}
|
|
}
|
|
}, { dark: config.dark });
|
|
var obsidianHighlightStyle = import_language2.HighlightStyle.define([
|
|
{ tag: import_highlight2.tags.keyword, color: config.keyword },
|
|
{ tag: [import_highlight2.tags.name, import_highlight2.tags.deleted, import_highlight2.tags.character, import_highlight2.tags.macroName], color: config.variable },
|
|
{ tag: [import_highlight2.tags.propertyName], color: config.function },
|
|
{ tag: [import_highlight2.tags.processingInstruction, import_highlight2.tags.string, import_highlight2.tags.inserted, import_highlight2.tags.special(import_highlight2.tags.string)], color: config.string },
|
|
{ tag: [import_highlight2.tags.function(import_highlight2.tags.variableName), import_highlight2.tags.labelName], color: config.function },
|
|
{ tag: [import_highlight2.tags.color, import_highlight2.tags.constant(import_highlight2.tags.name), import_highlight2.tags.standard(import_highlight2.tags.name)], color: config.constant },
|
|
{ tag: [import_highlight2.tags.definition(import_highlight2.tags.name), import_highlight2.tags.separator], color: config.variable },
|
|
{ tag: [import_highlight2.tags.className], color: config.class },
|
|
{ tag: [import_highlight2.tags.number, import_highlight2.tags.changed, import_highlight2.tags.annotation, import_highlight2.tags.modifier, import_highlight2.tags.self, import_highlight2.tags.namespace], color: config.number },
|
|
{ tag: [import_highlight2.tags.typeName], color: config.type, fontStyle: config.type },
|
|
{ tag: [import_highlight2.tags.operator, import_highlight2.tags.operatorKeyword], color: config.keyword },
|
|
{ tag: [import_highlight2.tags.url, import_highlight2.tags.escape, import_highlight2.tags.regexp, import_highlight2.tags.link], color: config.regexp },
|
|
{ tag: [import_highlight2.tags.meta, import_highlight2.tags.comment], color: config.comment },
|
|
{ tag: import_highlight2.tags.strong, fontWeight: "bold" },
|
|
{ tag: import_highlight2.tags.emphasis, fontStyle: "italic" },
|
|
{ tag: import_highlight2.tags.link, textDecoration: "underline" },
|
|
{ tag: import_highlight2.tags.heading, fontWeight: "bold", color: config.heading },
|
|
{ tag: [import_highlight2.tags.atom, import_highlight2.tags.bool, import_highlight2.tags.special(import_highlight2.tags.variableName)], color: config.variable },
|
|
{ tag: import_highlight2.tags.invalid, color: config.invalid },
|
|
{ tag: import_highlight2.tags.strikethrough, textDecoration: "line-through" }
|
|
]);
|
|
var obsidian = [
|
|
obsidianTheme,
|
|
(0, import_language2.syntaxHighlighting)(obsidianHighlightStyle)
|
|
];
|
|
|
|
// src/settings/ui/snippets_editor/extensions.ts
|
|
var basicSetup = [
|
|
(0, import_view3.lineNumbers)(),
|
|
(0, import_view3.highlightSpecialChars)(),
|
|
(0, import_commands.history)(),
|
|
javascript(),
|
|
(0, import_view3.drawSelection)(),
|
|
(0, import_view3.dropCursor)(),
|
|
import_state2.EditorState.allowMultipleSelections.of(true),
|
|
(0, import_language3.indentOnInput)(),
|
|
import_language3.indentUnit.of(" "),
|
|
(0, import_language3.syntaxHighlighting)(import_language3.defaultHighlightStyle, { fallback: true }),
|
|
import_view3.EditorView.lineWrapping,
|
|
(0, import_language3.bracketMatching)(),
|
|
(0, import_autocomplete2.closeBrackets)(),
|
|
(0, import_view3.rectangularSelection)(),
|
|
(0, import_search.highlightSelectionMatches)(),
|
|
obsidian,
|
|
import_view3.keymap.of([
|
|
...import_autocomplete2.closeBracketsKeymap,
|
|
...import_commands.defaultKeymap,
|
|
...import_search.searchKeymap,
|
|
...import_commands.historyKeymap,
|
|
import_commands.indentWithTab,
|
|
...import_lint.lintKeymap
|
|
])
|
|
].filter((ext) => ext);
|
|
|
|
// src/settings/ui/file_suggest.ts
|
|
var import_obsidian3 = __toModule(require("obsidian"));
|
|
|
|
// node_modules/@popperjs/core/lib/enums.js
|
|
var top = "top";
|
|
var bottom = "bottom";
|
|
var right = "right";
|
|
var left = "left";
|
|
var auto = "auto";
|
|
var basePlacements = [top, bottom, right, left];
|
|
var start = "start";
|
|
var end = "end";
|
|
var clippingParents = "clippingParents";
|
|
var viewport = "viewport";
|
|
var popper = "popper";
|
|
var reference = "reference";
|
|
var variationPlacements = /* @__PURE__ */ basePlacements.reduce(function(acc, placement) {
|
|
return acc.concat([placement + "-" + start, placement + "-" + end]);
|
|
}, []);
|
|
var placements = /* @__PURE__ */ [].concat(basePlacements, [auto]).reduce(function(acc, placement) {
|
|
return acc.concat([placement, placement + "-" + start, placement + "-" + end]);
|
|
}, []);
|
|
var beforeRead = "beforeRead";
|
|
var read = "read";
|
|
var afterRead = "afterRead";
|
|
var beforeMain = "beforeMain";
|
|
var main = "main";
|
|
var afterMain = "afterMain";
|
|
var beforeWrite = "beforeWrite";
|
|
var write = "write";
|
|
var afterWrite = "afterWrite";
|
|
var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite];
|
|
|
|
// node_modules/@popperjs/core/lib/dom-utils/getNodeName.js
|
|
function getNodeName(element) {
|
|
return element ? (element.nodeName || "").toLowerCase() : null;
|
|
}
|
|
|
|
// node_modules/@popperjs/core/lib/dom-utils/getWindow.js
|
|
function getWindow(node) {
|
|
if (node == null) {
|
|
return window;
|
|
}
|
|
if (node.toString() !== "[object Window]") {
|
|
var ownerDocument = node.ownerDocument;
|
|
return ownerDocument ? ownerDocument.defaultView || window : window;
|
|
}
|
|
return node;
|
|
}
|
|
|
|
// node_modules/@popperjs/core/lib/dom-utils/instanceOf.js
|
|
function isElement(node) {
|
|
var OwnElement = getWindow(node).Element;
|
|
return node instanceof OwnElement || node instanceof Element;
|
|
}
|
|
function isHTMLElement(node) {
|
|
var OwnElement = getWindow(node).HTMLElement;
|
|
return node instanceof OwnElement || node instanceof HTMLElement;
|
|
}
|
|
function isShadowRoot(node) {
|
|
if (typeof ShadowRoot === "undefined") {
|
|
return false;
|
|
}
|
|
var OwnElement = getWindow(node).ShadowRoot;
|
|
return node instanceof OwnElement || node instanceof ShadowRoot;
|
|
}
|
|
|
|
// node_modules/@popperjs/core/lib/modifiers/applyStyles.js
|
|
function applyStyles(_ref) {
|
|
var state = _ref.state;
|
|
Object.keys(state.elements).forEach(function(name) {
|
|
var style = state.styles[name] || {};
|
|
var attributes = state.attributes[name] || {};
|
|
var element = state.elements[name];
|
|
if (!isHTMLElement(element) || !getNodeName(element)) {
|
|
return;
|
|
}
|
|
Object.assign(element.style, style);
|
|
Object.keys(attributes).forEach(function(name2) {
|
|
var value = attributes[name2];
|
|
if (value === false) {
|
|
element.removeAttribute(name2);
|
|
} else {
|
|
element.setAttribute(name2, value === true ? "" : value);
|
|
}
|
|
});
|
|
});
|
|
}
|
|
function effect(_ref2) {
|
|
var state = _ref2.state;
|
|
var initialStyles = {
|
|
popper: {
|
|
position: state.options.strategy,
|
|
left: "0",
|
|
top: "0",
|
|
margin: "0"
|
|
},
|
|
arrow: {
|
|
position: "absolute"
|
|
},
|
|
reference: {}
|
|
};
|
|
Object.assign(state.elements.popper.style, initialStyles.popper);
|
|
state.styles = initialStyles;
|
|
if (state.elements.arrow) {
|
|
Object.assign(state.elements.arrow.style, initialStyles.arrow);
|
|
}
|
|
return function() {
|
|
Object.keys(state.elements).forEach(function(name) {
|
|
var element = state.elements[name];
|
|
var attributes = state.attributes[name] || {};
|
|
var styleProperties = Object.keys(state.styles.hasOwnProperty(name) ? state.styles[name] : initialStyles[name]);
|
|
var style = styleProperties.reduce(function(style2, property) {
|
|
style2[property] = "";
|
|
return style2;
|
|
}, {});
|
|
if (!isHTMLElement(element) || !getNodeName(element)) {
|
|
return;
|
|
}
|
|
Object.assign(element.style, style);
|
|
Object.keys(attributes).forEach(function(attribute) {
|
|
element.removeAttribute(attribute);
|
|
});
|
|
});
|
|
};
|
|
}
|
|
var applyStyles_default = {
|
|
name: "applyStyles",
|
|
enabled: true,
|
|
phase: "write",
|
|
fn: applyStyles,
|
|
effect,
|
|
requires: ["computeStyles"]
|
|
};
|
|
|
|
// node_modules/@popperjs/core/lib/utils/getBasePlacement.js
|
|
function getBasePlacement(placement) {
|
|
return placement.split("-")[0];
|
|
}
|
|
|
|
// node_modules/@popperjs/core/lib/utils/math.js
|
|
var max = Math.max;
|
|
var min = Math.min;
|
|
var round = Math.round;
|
|
|
|
// node_modules/@popperjs/core/lib/dom-utils/getBoundingClientRect.js
|
|
function getBoundingClientRect(element, includeScale) {
|
|
if (includeScale === void 0) {
|
|
includeScale = false;
|
|
}
|
|
var rect = element.getBoundingClientRect();
|
|
var scaleX = 1;
|
|
var scaleY = 1;
|
|
if (isHTMLElement(element) && includeScale) {
|
|
var offsetHeight = element.offsetHeight;
|
|
var offsetWidth = element.offsetWidth;
|
|
if (offsetWidth > 0) {
|
|
scaleX = round(rect.width) / offsetWidth || 1;
|
|
}
|
|
if (offsetHeight > 0) {
|
|
scaleY = round(rect.height) / offsetHeight || 1;
|
|
}
|
|
}
|
|
return {
|
|
width: rect.width / scaleX,
|
|
height: rect.height / scaleY,
|
|
top: rect.top / scaleY,
|
|
right: rect.right / scaleX,
|
|
bottom: rect.bottom / scaleY,
|
|
left: rect.left / scaleX,
|
|
x: rect.left / scaleX,
|
|
y: rect.top / scaleY
|
|
};
|
|
}
|
|
|
|
// node_modules/@popperjs/core/lib/dom-utils/getLayoutRect.js
|
|
function getLayoutRect(element) {
|
|
var clientRect = getBoundingClientRect(element);
|
|
var width = element.offsetWidth;
|
|
var height = element.offsetHeight;
|
|
if (Math.abs(clientRect.width - width) <= 1) {
|
|
width = clientRect.width;
|
|
}
|
|
if (Math.abs(clientRect.height - height) <= 1) {
|
|
height = clientRect.height;
|
|
}
|
|
return {
|
|
x: element.offsetLeft,
|
|
y: element.offsetTop,
|
|
width,
|
|
height
|
|
};
|
|
}
|
|
|
|
// node_modules/@popperjs/core/lib/dom-utils/contains.js
|
|
function contains(parent, child) {
|
|
var rootNode = child.getRootNode && child.getRootNode();
|
|
if (parent.contains(child)) {
|
|
return true;
|
|
} else if (rootNode && isShadowRoot(rootNode)) {
|
|
var next = child;
|
|
do {
|
|
if (next && parent.isSameNode(next)) {
|
|
return true;
|
|
}
|
|
next = next.parentNode || next.host;
|
|
} while (next);
|
|
}
|
|
return false;
|
|
}
|
|
|
|
// node_modules/@popperjs/core/lib/dom-utils/getComputedStyle.js
|
|
function getComputedStyle(element) {
|
|
return getWindow(element).getComputedStyle(element);
|
|
}
|
|
|
|
// node_modules/@popperjs/core/lib/dom-utils/isTableElement.js
|
|
function isTableElement(element) {
|
|
return ["table", "td", "th"].indexOf(getNodeName(element)) >= 0;
|
|
}
|
|
|
|
// node_modules/@popperjs/core/lib/dom-utils/getDocumentElement.js
|
|
function getDocumentElement(element) {
|
|
return ((isElement(element) ? element.ownerDocument : element.document) || window.document).documentElement;
|
|
}
|
|
|
|
// node_modules/@popperjs/core/lib/dom-utils/getParentNode.js
|
|
function getParentNode(element) {
|
|
if (getNodeName(element) === "html") {
|
|
return element;
|
|
}
|
|
return element.assignedSlot || element.parentNode || (isShadowRoot(element) ? element.host : null) || getDocumentElement(element);
|
|
}
|
|
|
|
// node_modules/@popperjs/core/lib/dom-utils/getOffsetParent.js
|
|
function getTrueOffsetParent(element) {
|
|
if (!isHTMLElement(element) || getComputedStyle(element).position === "fixed") {
|
|
return null;
|
|
}
|
|
return element.offsetParent;
|
|
}
|
|
function getContainingBlock(element) {
|
|
var isFirefox = navigator.userAgent.toLowerCase().indexOf("firefox") !== -1;
|
|
var isIE = navigator.userAgent.indexOf("Trident") !== -1;
|
|
if (isIE && isHTMLElement(element)) {
|
|
var elementCss = getComputedStyle(element);
|
|
if (elementCss.position === "fixed") {
|
|
return null;
|
|
}
|
|
}
|
|
var currentNode = getParentNode(element);
|
|
if (isShadowRoot(currentNode)) {
|
|
currentNode = currentNode.host;
|
|
}
|
|
while (isHTMLElement(currentNode) && ["html", "body"].indexOf(getNodeName(currentNode)) < 0) {
|
|
var css = getComputedStyle(currentNode);
|
|
if (css.transform !== "none" || css.perspective !== "none" || css.contain === "paint" || ["transform", "perspective"].indexOf(css.willChange) !== -1 || isFirefox && css.willChange === "filter" || isFirefox && css.filter && css.filter !== "none") {
|
|
return currentNode;
|
|
} else {
|
|
currentNode = currentNode.parentNode;
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
function getOffsetParent(element) {
|
|
var window2 = getWindow(element);
|
|
var offsetParent = getTrueOffsetParent(element);
|
|
while (offsetParent && isTableElement(offsetParent) && getComputedStyle(offsetParent).position === "static") {
|
|
offsetParent = getTrueOffsetParent(offsetParent);
|
|
}
|
|
if (offsetParent && (getNodeName(offsetParent) === "html" || getNodeName(offsetParent) === "body" && getComputedStyle(offsetParent).position === "static")) {
|
|
return window2;
|
|
}
|
|
return offsetParent || getContainingBlock(element) || window2;
|
|
}
|
|
|
|
// node_modules/@popperjs/core/lib/utils/getMainAxisFromPlacement.js
|
|
function getMainAxisFromPlacement(placement) {
|
|
return ["top", "bottom"].indexOf(placement) >= 0 ? "x" : "y";
|
|
}
|
|
|
|
// node_modules/@popperjs/core/lib/utils/within.js
|
|
function within(min2, value, max2) {
|
|
return max(min2, min(value, max2));
|
|
}
|
|
function withinMaxClamp(min2, value, max2) {
|
|
var v = within(min2, value, max2);
|
|
return v > max2 ? max2 : v;
|
|
}
|
|
|
|
// node_modules/@popperjs/core/lib/utils/getFreshSideObject.js
|
|
function getFreshSideObject() {
|
|
return {
|
|
top: 0,
|
|
right: 0,
|
|
bottom: 0,
|
|
left: 0
|
|
};
|
|
}
|
|
|
|
// node_modules/@popperjs/core/lib/utils/mergePaddingObject.js
|
|
function mergePaddingObject(paddingObject) {
|
|
return Object.assign({}, getFreshSideObject(), paddingObject);
|
|
}
|
|
|
|
// node_modules/@popperjs/core/lib/utils/expandToHashMap.js
|
|
function expandToHashMap(value, keys) {
|
|
return keys.reduce(function(hashMap, key) {
|
|
hashMap[key] = value;
|
|
return hashMap;
|
|
}, {});
|
|
}
|
|
|
|
// node_modules/@popperjs/core/lib/modifiers/arrow.js
|
|
var toPaddingObject = function toPaddingObject2(padding, state) {
|
|
padding = typeof padding === "function" ? padding(Object.assign({}, state.rects, {
|
|
placement: state.placement
|
|
})) : padding;
|
|
return mergePaddingObject(typeof padding !== "number" ? padding : expandToHashMap(padding, basePlacements));
|
|
};
|
|
function arrow(_ref) {
|
|
var _state$modifiersData$;
|
|
var state = _ref.state, name = _ref.name, options = _ref.options;
|
|
var arrowElement = state.elements.arrow;
|
|
var popperOffsets2 = state.modifiersData.popperOffsets;
|
|
var basePlacement = getBasePlacement(state.placement);
|
|
var axis = getMainAxisFromPlacement(basePlacement);
|
|
var isVertical = [left, right].indexOf(basePlacement) >= 0;
|
|
var len = isVertical ? "height" : "width";
|
|
if (!arrowElement || !popperOffsets2) {
|
|
return;
|
|
}
|
|
var paddingObject = toPaddingObject(options.padding, state);
|
|
var arrowRect = getLayoutRect(arrowElement);
|
|
var minProp = axis === "y" ? top : left;
|
|
var maxProp = axis === "y" ? bottom : right;
|
|
var endDiff = state.rects.reference[len] + state.rects.reference[axis] - popperOffsets2[axis] - state.rects.popper[len];
|
|
var startDiff = popperOffsets2[axis] - state.rects.reference[axis];
|
|
var arrowOffsetParent = getOffsetParent(arrowElement);
|
|
var clientSize = arrowOffsetParent ? axis === "y" ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;
|
|
var centerToReference = endDiff / 2 - startDiff / 2;
|
|
var min2 = paddingObject[minProp];
|
|
var max2 = clientSize - arrowRect[len] - paddingObject[maxProp];
|
|
var center = clientSize / 2 - arrowRect[len] / 2 + centerToReference;
|
|
var offset2 = within(min2, center, max2);
|
|
var axisProp = axis;
|
|
state.modifiersData[name] = (_state$modifiersData$ = {}, _state$modifiersData$[axisProp] = offset2, _state$modifiersData$.centerOffset = offset2 - center, _state$modifiersData$);
|
|
}
|
|
function effect2(_ref2) {
|
|
var state = _ref2.state, options = _ref2.options;
|
|
var _options$element = options.element, arrowElement = _options$element === void 0 ? "[data-popper-arrow]" : _options$element;
|
|
if (arrowElement == null) {
|
|
return;
|
|
}
|
|
if (typeof arrowElement === "string") {
|
|
arrowElement = state.elements.popper.querySelector(arrowElement);
|
|
if (!arrowElement) {
|
|
return;
|
|
}
|
|
}
|
|
if (true) {
|
|
if (!isHTMLElement(arrowElement)) {
|
|
console.error(['Popper: "arrow" element must be an HTMLElement (not an SVGElement).', "To use an SVG arrow, wrap it in an HTMLElement that will be used as", "the arrow."].join(" "));
|
|
}
|
|
}
|
|
if (!contains(state.elements.popper, arrowElement)) {
|
|
if (true) {
|
|
console.error(['Popper: "arrow" modifier\'s `element` must be a child of the popper', "element."].join(" "));
|
|
}
|
|
return;
|
|
}
|
|
state.elements.arrow = arrowElement;
|
|
}
|
|
var arrow_default = {
|
|
name: "arrow",
|
|
enabled: true,
|
|
phase: "main",
|
|
fn: arrow,
|
|
effect: effect2,
|
|
requires: ["popperOffsets"],
|
|
requiresIfExists: ["preventOverflow"]
|
|
};
|
|
|
|
// node_modules/@popperjs/core/lib/utils/getVariation.js
|
|
function getVariation(placement) {
|
|
return placement.split("-")[1];
|
|
}
|
|
|
|
// node_modules/@popperjs/core/lib/modifiers/computeStyles.js
|
|
var unsetSides = {
|
|
top: "auto",
|
|
right: "auto",
|
|
bottom: "auto",
|
|
left: "auto"
|
|
};
|
|
function roundOffsetsByDPR(_ref) {
|
|
var x = _ref.x, y = _ref.y;
|
|
var win = window;
|
|
var dpr = win.devicePixelRatio || 1;
|
|
return {
|
|
x: round(x * dpr) / dpr || 0,
|
|
y: round(y * dpr) / dpr || 0
|
|
};
|
|
}
|
|
function mapToStyles(_ref2) {
|
|
var _Object$assign2;
|
|
var popper2 = _ref2.popper, popperRect = _ref2.popperRect, placement = _ref2.placement, variation = _ref2.variation, offsets = _ref2.offsets, position = _ref2.position, gpuAcceleration = _ref2.gpuAcceleration, adaptive = _ref2.adaptive, roundOffsets = _ref2.roundOffsets, isFixed = _ref2.isFixed;
|
|
var _offsets$x = offsets.x, x = _offsets$x === void 0 ? 0 : _offsets$x, _offsets$y = offsets.y, y = _offsets$y === void 0 ? 0 : _offsets$y;
|
|
var _ref3 = typeof roundOffsets === "function" ? roundOffsets({
|
|
x,
|
|
y
|
|
}) : {
|
|
x,
|
|
y
|
|
};
|
|
x = _ref3.x;
|
|
y = _ref3.y;
|
|
var hasX = offsets.hasOwnProperty("x");
|
|
var hasY = offsets.hasOwnProperty("y");
|
|
var sideX = left;
|
|
var sideY = top;
|
|
var win = window;
|
|
if (adaptive) {
|
|
var offsetParent = getOffsetParent(popper2);
|
|
var heightProp = "clientHeight";
|
|
var widthProp = "clientWidth";
|
|
if (offsetParent === getWindow(popper2)) {
|
|
offsetParent = getDocumentElement(popper2);
|
|
if (getComputedStyle(offsetParent).position !== "static" && position === "absolute") {
|
|
heightProp = "scrollHeight";
|
|
widthProp = "scrollWidth";
|
|
}
|
|
}
|
|
offsetParent = offsetParent;
|
|
if (placement === top || (placement === left || placement === right) && variation === end) {
|
|
sideY = bottom;
|
|
var offsetY = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.height : offsetParent[heightProp];
|
|
y -= offsetY - popperRect.height;
|
|
y *= gpuAcceleration ? 1 : -1;
|
|
}
|
|
if (placement === left || (placement === top || placement === bottom) && variation === end) {
|
|
sideX = right;
|
|
var offsetX = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.width : offsetParent[widthProp];
|
|
x -= offsetX - popperRect.width;
|
|
x *= gpuAcceleration ? 1 : -1;
|
|
}
|
|
}
|
|
var commonStyles = Object.assign({
|
|
position
|
|
}, adaptive && unsetSides);
|
|
var _ref4 = roundOffsets === true ? roundOffsetsByDPR({
|
|
x,
|
|
y
|
|
}) : {
|
|
x,
|
|
y
|
|
};
|
|
x = _ref4.x;
|
|
y = _ref4.y;
|
|
if (gpuAcceleration) {
|
|
var _Object$assign;
|
|
return Object.assign({}, commonStyles, (_Object$assign = {}, _Object$assign[sideY] = hasY ? "0" : "", _Object$assign[sideX] = hasX ? "0" : "", _Object$assign.transform = (win.devicePixelRatio || 1) <= 1 ? "translate(" + x + "px, " + y + "px)" : "translate3d(" + x + "px, " + y + "px, 0)", _Object$assign));
|
|
}
|
|
return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : "", _Object$assign2[sideX] = hasX ? x + "px" : "", _Object$assign2.transform = "", _Object$assign2));
|
|
}
|
|
function computeStyles(_ref5) {
|
|
var state = _ref5.state, options = _ref5.options;
|
|
var _options$gpuAccelerat = options.gpuAcceleration, gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat, _options$adaptive = options.adaptive, adaptive = _options$adaptive === void 0 ? true : _options$adaptive, _options$roundOffsets = options.roundOffsets, roundOffsets = _options$roundOffsets === void 0 ? true : _options$roundOffsets;
|
|
if (true) {
|
|
var transitionProperty = getComputedStyle(state.elements.popper).transitionProperty || "";
|
|
if (adaptive && ["transform", "top", "right", "bottom", "left"].some(function(property) {
|
|
return transitionProperty.indexOf(property) >= 0;
|
|
})) {
|
|
console.warn(["Popper: Detected CSS transitions on at least one of the following", 'CSS properties: "transform", "top", "right", "bottom", "left".', "\n\n", 'Disable the "computeStyles" modifier\'s `adaptive` option to allow', "for smooth transitions, or remove these properties from the CSS", "transition declaration on the popper element if only transitioning", "opacity or background-color for example.", "\n\n", "We recommend using the popper element as a wrapper around an inner", "element that can have any CSS property transitioned for animations."].join(" "));
|
|
}
|
|
}
|
|
var commonStyles = {
|
|
placement: getBasePlacement(state.placement),
|
|
variation: getVariation(state.placement),
|
|
popper: state.elements.popper,
|
|
popperRect: state.rects.popper,
|
|
gpuAcceleration,
|
|
isFixed: state.options.strategy === "fixed"
|
|
};
|
|
if (state.modifiersData.popperOffsets != null) {
|
|
state.styles.popper = Object.assign({}, state.styles.popper, mapToStyles(Object.assign({}, commonStyles, {
|
|
offsets: state.modifiersData.popperOffsets,
|
|
position: state.options.strategy,
|
|
adaptive,
|
|
roundOffsets
|
|
})));
|
|
}
|
|
if (state.modifiersData.arrow != null) {
|
|
state.styles.arrow = Object.assign({}, state.styles.arrow, mapToStyles(Object.assign({}, commonStyles, {
|
|
offsets: state.modifiersData.arrow,
|
|
position: "absolute",
|
|
adaptive: false,
|
|
roundOffsets
|
|
})));
|
|
}
|
|
state.attributes.popper = Object.assign({}, state.attributes.popper, {
|
|
"data-popper-placement": state.placement
|
|
});
|
|
}
|
|
var computeStyles_default = {
|
|
name: "computeStyles",
|
|
enabled: true,
|
|
phase: "beforeWrite",
|
|
fn: computeStyles,
|
|
data: {}
|
|
};
|
|
|
|
// node_modules/@popperjs/core/lib/modifiers/eventListeners.js
|
|
var passive = {
|
|
passive: true
|
|
};
|
|
function effect3(_ref) {
|
|
var state = _ref.state, instance2 = _ref.instance, options = _ref.options;
|
|
var _options$scroll = options.scroll, scroll = _options$scroll === void 0 ? true : _options$scroll, _options$resize = options.resize, resize = _options$resize === void 0 ? true : _options$resize;
|
|
var window2 = getWindow(state.elements.popper);
|
|
var scrollParents = [].concat(state.scrollParents.reference, state.scrollParents.popper);
|
|
if (scroll) {
|
|
scrollParents.forEach(function(scrollParent) {
|
|
scrollParent.addEventListener("scroll", instance2.update, passive);
|
|
});
|
|
}
|
|
if (resize) {
|
|
window2.addEventListener("resize", instance2.update, passive);
|
|
}
|
|
return function() {
|
|
if (scroll) {
|
|
scrollParents.forEach(function(scrollParent) {
|
|
scrollParent.removeEventListener("scroll", instance2.update, passive);
|
|
});
|
|
}
|
|
if (resize) {
|
|
window2.removeEventListener("resize", instance2.update, passive);
|
|
}
|
|
};
|
|
}
|
|
var eventListeners_default = {
|
|
name: "eventListeners",
|
|
enabled: true,
|
|
phase: "write",
|
|
fn: function fn() {
|
|
},
|
|
effect: effect3,
|
|
data: {}
|
|
};
|
|
|
|
// node_modules/@popperjs/core/lib/utils/getOppositePlacement.js
|
|
var hash = {
|
|
left: "right",
|
|
right: "left",
|
|
bottom: "top",
|
|
top: "bottom"
|
|
};
|
|
function getOppositePlacement(placement) {
|
|
return placement.replace(/left|right|bottom|top/g, function(matched) {
|
|
return hash[matched];
|
|
});
|
|
}
|
|
|
|
// node_modules/@popperjs/core/lib/utils/getOppositeVariationPlacement.js
|
|
var hash2 = {
|
|
start: "end",
|
|
end: "start"
|
|
};
|
|
function getOppositeVariationPlacement(placement) {
|
|
return placement.replace(/start|end/g, function(matched) {
|
|
return hash2[matched];
|
|
});
|
|
}
|
|
|
|
// node_modules/@popperjs/core/lib/dom-utils/getWindowScroll.js
|
|
function getWindowScroll(node) {
|
|
var win = getWindow(node);
|
|
var scrollLeft = win.pageXOffset;
|
|
var scrollTop = win.pageYOffset;
|
|
return {
|
|
scrollLeft,
|
|
scrollTop
|
|
};
|
|
}
|
|
|
|
// node_modules/@popperjs/core/lib/dom-utils/getWindowScrollBarX.js
|
|
function getWindowScrollBarX(element) {
|
|
return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft;
|
|
}
|
|
|
|
// node_modules/@popperjs/core/lib/dom-utils/getViewportRect.js
|
|
function getViewportRect(element) {
|
|
var win = getWindow(element);
|
|
var html = getDocumentElement(element);
|
|
var visualViewport = win.visualViewport;
|
|
var width = html.clientWidth;
|
|
var height = html.clientHeight;
|
|
var x = 0;
|
|
var y = 0;
|
|
if (visualViewport) {
|
|
width = visualViewport.width;
|
|
height = visualViewport.height;
|
|
if (!/^((?!chrome|android).)*safari/i.test(navigator.userAgent)) {
|
|
x = visualViewport.offsetLeft;
|
|
y = visualViewport.offsetTop;
|
|
}
|
|
}
|
|
return {
|
|
width,
|
|
height,
|
|
x: x + getWindowScrollBarX(element),
|
|
y
|
|
};
|
|
}
|
|
|
|
// node_modules/@popperjs/core/lib/dom-utils/getDocumentRect.js
|
|
function getDocumentRect(element) {
|
|
var _element$ownerDocumen;
|
|
var html = getDocumentElement(element);
|
|
var winScroll = getWindowScroll(element);
|
|
var body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
|
|
var width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
|
|
var height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
|
|
var x = -winScroll.scrollLeft + getWindowScrollBarX(element);
|
|
var y = -winScroll.scrollTop;
|
|
if (getComputedStyle(body || html).direction === "rtl") {
|
|
x += max(html.clientWidth, body ? body.clientWidth : 0) - width;
|
|
}
|
|
return {
|
|
width,
|
|
height,
|
|
x,
|
|
y
|
|
};
|
|
}
|
|
|
|
// node_modules/@popperjs/core/lib/dom-utils/isScrollParent.js
|
|
function isScrollParent(element) {
|
|
var _getComputedStyle = getComputedStyle(element), overflow = _getComputedStyle.overflow, overflowX = _getComputedStyle.overflowX, overflowY = _getComputedStyle.overflowY;
|
|
return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
|
|
}
|
|
|
|
// node_modules/@popperjs/core/lib/dom-utils/getScrollParent.js
|
|
function getScrollParent(node) {
|
|
if (["html", "body", "#document"].indexOf(getNodeName(node)) >= 0) {
|
|
return node.ownerDocument.body;
|
|
}
|
|
if (isHTMLElement(node) && isScrollParent(node)) {
|
|
return node;
|
|
}
|
|
return getScrollParent(getParentNode(node));
|
|
}
|
|
|
|
// node_modules/@popperjs/core/lib/dom-utils/listScrollParents.js
|
|
function listScrollParents(element, list) {
|
|
var _element$ownerDocumen;
|
|
if (list === void 0) {
|
|
list = [];
|
|
}
|
|
var scrollParent = getScrollParent(element);
|
|
var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body);
|
|
var win = getWindow(scrollParent);
|
|
var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;
|
|
var updatedList = list.concat(target);
|
|
return isBody ? updatedList : updatedList.concat(listScrollParents(getParentNode(target)));
|
|
}
|
|
|
|
// node_modules/@popperjs/core/lib/utils/rectToClientRect.js
|
|
function rectToClientRect(rect) {
|
|
return Object.assign({}, rect, {
|
|
left: rect.x,
|
|
top: rect.y,
|
|
right: rect.x + rect.width,
|
|
bottom: rect.y + rect.height
|
|
});
|
|
}
|
|
|
|
// node_modules/@popperjs/core/lib/dom-utils/getClippingRect.js
|
|
function getInnerBoundingClientRect(element) {
|
|
var rect = getBoundingClientRect(element);
|
|
rect.top = rect.top + element.clientTop;
|
|
rect.left = rect.left + element.clientLeft;
|
|
rect.bottom = rect.top + element.clientHeight;
|
|
rect.right = rect.left + element.clientWidth;
|
|
rect.width = element.clientWidth;
|
|
rect.height = element.clientHeight;
|
|
rect.x = rect.left;
|
|
rect.y = rect.top;
|
|
return rect;
|
|
}
|
|
function getClientRectFromMixedType(element, clippingParent) {
|
|
return clippingParent === viewport ? rectToClientRect(getViewportRect(element)) : isElement(clippingParent) ? getInnerBoundingClientRect(clippingParent) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
|
|
}
|
|
function getClippingParents(element) {
|
|
var clippingParents2 = listScrollParents(getParentNode(element));
|
|
var canEscapeClipping = ["absolute", "fixed"].indexOf(getComputedStyle(element).position) >= 0;
|
|
var clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;
|
|
if (!isElement(clipperElement)) {
|
|
return [];
|
|
}
|
|
return clippingParents2.filter(function(clippingParent) {
|
|
return isElement(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== "body";
|
|
});
|
|
}
|
|
function getClippingRect(element, boundary, rootBoundary) {
|
|
var mainClippingParents = boundary === "clippingParents" ? getClippingParents(element) : [].concat(boundary);
|
|
var clippingParents2 = [].concat(mainClippingParents, [rootBoundary]);
|
|
var firstClippingParent = clippingParents2[0];
|
|
var clippingRect = clippingParents2.reduce(function(accRect, clippingParent) {
|
|
var rect = getClientRectFromMixedType(element, clippingParent);
|
|
accRect.top = max(rect.top, accRect.top);
|
|
accRect.right = min(rect.right, accRect.right);
|
|
accRect.bottom = min(rect.bottom, accRect.bottom);
|
|
accRect.left = max(rect.left, accRect.left);
|
|
return accRect;
|
|
}, getClientRectFromMixedType(element, firstClippingParent));
|
|
clippingRect.width = clippingRect.right - clippingRect.left;
|
|
clippingRect.height = clippingRect.bottom - clippingRect.top;
|
|
clippingRect.x = clippingRect.left;
|
|
clippingRect.y = clippingRect.top;
|
|
return clippingRect;
|
|
}
|
|
|
|
// node_modules/@popperjs/core/lib/utils/computeOffsets.js
|
|
function computeOffsets(_ref) {
|
|
var reference2 = _ref.reference, element = _ref.element, placement = _ref.placement;
|
|
var basePlacement = placement ? getBasePlacement(placement) : null;
|
|
var variation = placement ? getVariation(placement) : null;
|
|
var commonX = reference2.x + reference2.width / 2 - element.width / 2;
|
|
var commonY = reference2.y + reference2.height / 2 - element.height / 2;
|
|
var offsets;
|
|
switch (basePlacement) {
|
|
case top:
|
|
offsets = {
|
|
x: commonX,
|
|
y: reference2.y - element.height
|
|
};
|
|
break;
|
|
case bottom:
|
|
offsets = {
|
|
x: commonX,
|
|
y: reference2.y + reference2.height
|
|
};
|
|
break;
|
|
case right:
|
|
offsets = {
|
|
x: reference2.x + reference2.width,
|
|
y: commonY
|
|
};
|
|
break;
|
|
case left:
|
|
offsets = {
|
|
x: reference2.x - element.width,
|
|
y: commonY
|
|
};
|
|
break;
|
|
default:
|
|
offsets = {
|
|
x: reference2.x,
|
|
y: reference2.y
|
|
};
|
|
}
|
|
var mainAxis = basePlacement ? getMainAxisFromPlacement(basePlacement) : null;
|
|
if (mainAxis != null) {
|
|
var len = mainAxis === "y" ? "height" : "width";
|
|
switch (variation) {
|
|
case start:
|
|
offsets[mainAxis] = offsets[mainAxis] - (reference2[len] / 2 - element[len] / 2);
|
|
break;
|
|
case end:
|
|
offsets[mainAxis] = offsets[mainAxis] + (reference2[len] / 2 - element[len] / 2);
|
|
break;
|
|
default:
|
|
}
|
|
}
|
|
return offsets;
|
|
}
|
|
|
|
// node_modules/@popperjs/core/lib/utils/detectOverflow.js
|
|
function detectOverflow(state, options) {
|
|
if (options === void 0) {
|
|
options = {};
|
|
}
|
|
var _options = options, _options$placement = _options.placement, placement = _options$placement === void 0 ? state.placement : _options$placement, _options$boundary = _options.boundary, boundary = _options$boundary === void 0 ? clippingParents : _options$boundary, _options$rootBoundary = _options.rootBoundary, rootBoundary = _options$rootBoundary === void 0 ? viewport : _options$rootBoundary, _options$elementConte = _options.elementContext, elementContext = _options$elementConte === void 0 ? popper : _options$elementConte, _options$altBoundary = _options.altBoundary, altBoundary = _options$altBoundary === void 0 ? false : _options$altBoundary, _options$padding = _options.padding, padding = _options$padding === void 0 ? 0 : _options$padding;
|
|
var paddingObject = mergePaddingObject(typeof padding !== "number" ? padding : expandToHashMap(padding, basePlacements));
|
|
var altContext = elementContext === popper ? reference : popper;
|
|
var popperRect = state.rects.popper;
|
|
var element = state.elements[altBoundary ? altContext : elementContext];
|
|
var clippingClientRect = getClippingRect(isElement(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary);
|
|
var referenceClientRect = getBoundingClientRect(state.elements.reference);
|
|
var popperOffsets2 = computeOffsets({
|
|
reference: referenceClientRect,
|
|
element: popperRect,
|
|
strategy: "absolute",
|
|
placement
|
|
});
|
|
var popperClientRect = rectToClientRect(Object.assign({}, popperRect, popperOffsets2));
|
|
var elementClientRect = elementContext === popper ? popperClientRect : referenceClientRect;
|
|
var overflowOffsets = {
|
|
top: clippingClientRect.top - elementClientRect.top + paddingObject.top,
|
|
bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,
|
|
left: clippingClientRect.left - elementClientRect.left + paddingObject.left,
|
|
right: elementClientRect.right - clippingClientRect.right + paddingObject.right
|
|
};
|
|
var offsetData = state.modifiersData.offset;
|
|
if (elementContext === popper && offsetData) {
|
|
var offset2 = offsetData[placement];
|
|
Object.keys(overflowOffsets).forEach(function(key) {
|
|
var multiply = [right, bottom].indexOf(key) >= 0 ? 1 : -1;
|
|
var axis = [top, bottom].indexOf(key) >= 0 ? "y" : "x";
|
|
overflowOffsets[key] += offset2[axis] * multiply;
|
|
});
|
|
}
|
|
return overflowOffsets;
|
|
}
|
|
|
|
// node_modules/@popperjs/core/lib/utils/computeAutoPlacement.js
|
|
function computeAutoPlacement(state, options) {
|
|
if (options === void 0) {
|
|
options = {};
|
|
}
|
|
var _options = options, placement = _options.placement, boundary = _options.boundary, rootBoundary = _options.rootBoundary, padding = _options.padding, flipVariations = _options.flipVariations, _options$allowedAutoP = _options.allowedAutoPlacements, allowedAutoPlacements = _options$allowedAutoP === void 0 ? placements : _options$allowedAutoP;
|
|
var variation = getVariation(placement);
|
|
var placements2 = variation ? flipVariations ? variationPlacements : variationPlacements.filter(function(placement2) {
|
|
return getVariation(placement2) === variation;
|
|
}) : basePlacements;
|
|
var allowedPlacements = placements2.filter(function(placement2) {
|
|
return allowedAutoPlacements.indexOf(placement2) >= 0;
|
|
});
|
|
if (allowedPlacements.length === 0) {
|
|
allowedPlacements = placements2;
|
|
if (true) {
|
|
console.error(["Popper: The `allowedAutoPlacements` option did not allow any", "placements. Ensure the `placement` option matches the variation", "of the allowed placements.", 'For example, "auto" cannot be used to allow "bottom-start".', 'Use "auto-start" instead.'].join(" "));
|
|
}
|
|
}
|
|
var overflows = allowedPlacements.reduce(function(acc, placement2) {
|
|
acc[placement2] = detectOverflow(state, {
|
|
placement: placement2,
|
|
boundary,
|
|
rootBoundary,
|
|
padding
|
|
})[getBasePlacement(placement2)];
|
|
return acc;
|
|
}, {});
|
|
return Object.keys(overflows).sort(function(a, b) {
|
|
return overflows[a] - overflows[b];
|
|
});
|
|
}
|
|
|
|
// node_modules/@popperjs/core/lib/modifiers/flip.js
|
|
function getExpandedFallbackPlacements(placement) {
|
|
if (getBasePlacement(placement) === auto) {
|
|
return [];
|
|
}
|
|
var oppositePlacement = getOppositePlacement(placement);
|
|
return [getOppositeVariationPlacement(placement), oppositePlacement, getOppositeVariationPlacement(oppositePlacement)];
|
|
}
|
|
function flip(_ref) {
|
|
var state = _ref.state, options = _ref.options, name = _ref.name;
|
|
if (state.modifiersData[name]._skip) {
|
|
return;
|
|
}
|
|
var _options$mainAxis = options.mainAxis, checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis, _options$altAxis = options.altAxis, checkAltAxis = _options$altAxis === void 0 ? true : _options$altAxis, specifiedFallbackPlacements = options.fallbackPlacements, padding = options.padding, boundary = options.boundary, rootBoundary = options.rootBoundary, altBoundary = options.altBoundary, _options$flipVariatio = options.flipVariations, flipVariations = _options$flipVariatio === void 0 ? true : _options$flipVariatio, allowedAutoPlacements = options.allowedAutoPlacements;
|
|
var preferredPlacement = state.options.placement;
|
|
var basePlacement = getBasePlacement(preferredPlacement);
|
|
var isBasePlacement = basePlacement === preferredPlacement;
|
|
var fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipVariations ? [getOppositePlacement(preferredPlacement)] : getExpandedFallbackPlacements(preferredPlacement));
|
|
var placements2 = [preferredPlacement].concat(fallbackPlacements).reduce(function(acc, placement2) {
|
|
return acc.concat(getBasePlacement(placement2) === auto ? computeAutoPlacement(state, {
|
|
placement: placement2,
|
|
boundary,
|
|
rootBoundary,
|
|
padding,
|
|
flipVariations,
|
|
allowedAutoPlacements
|
|
}) : placement2);
|
|
}, []);
|
|
var referenceRect = state.rects.reference;
|
|
var popperRect = state.rects.popper;
|
|
var checksMap = new Map();
|
|
var makeFallbackChecks = true;
|
|
var firstFittingPlacement = placements2[0];
|
|
for (var i = 0; i < placements2.length; i++) {
|
|
var placement = placements2[i];
|
|
var _basePlacement = getBasePlacement(placement);
|
|
var isStartVariation = getVariation(placement) === start;
|
|
var isVertical = [top, bottom].indexOf(_basePlacement) >= 0;
|
|
var len = isVertical ? "width" : "height";
|
|
var overflow = detectOverflow(state, {
|
|
placement,
|
|
boundary,
|
|
rootBoundary,
|
|
altBoundary,
|
|
padding
|
|
});
|
|
var mainVariationSide = isVertical ? isStartVariation ? right : left : isStartVariation ? bottom : top;
|
|
if (referenceRect[len] > popperRect[len]) {
|
|
mainVariationSide = getOppositePlacement(mainVariationSide);
|
|
}
|
|
var altVariationSide = getOppositePlacement(mainVariationSide);
|
|
var checks = [];
|
|
if (checkMainAxis) {
|
|
checks.push(overflow[_basePlacement] <= 0);
|
|
}
|
|
if (checkAltAxis) {
|
|
checks.push(overflow[mainVariationSide] <= 0, overflow[altVariationSide] <= 0);
|
|
}
|
|
if (checks.every(function(check) {
|
|
return check;
|
|
})) {
|
|
firstFittingPlacement = placement;
|
|
makeFallbackChecks = false;
|
|
break;
|
|
}
|
|
checksMap.set(placement, checks);
|
|
}
|
|
if (makeFallbackChecks) {
|
|
var numberOfChecks = flipVariations ? 3 : 1;
|
|
var _loop = function _loop2(_i2) {
|
|
var fittingPlacement = placements2.find(function(placement2) {
|
|
var checks2 = checksMap.get(placement2);
|
|
if (checks2) {
|
|
return checks2.slice(0, _i2).every(function(check) {
|
|
return check;
|
|
});
|
|
}
|
|
});
|
|
if (fittingPlacement) {
|
|
firstFittingPlacement = fittingPlacement;
|
|
return "break";
|
|
}
|
|
};
|
|
for (var _i = numberOfChecks; _i > 0; _i--) {
|
|
var _ret = _loop(_i);
|
|
if (_ret === "break")
|
|
break;
|
|
}
|
|
}
|
|
if (state.placement !== firstFittingPlacement) {
|
|
state.modifiersData[name]._skip = true;
|
|
state.placement = firstFittingPlacement;
|
|
state.reset = true;
|
|
}
|
|
}
|
|
var flip_default = {
|
|
name: "flip",
|
|
enabled: true,
|
|
phase: "main",
|
|
fn: flip,
|
|
requiresIfExists: ["offset"],
|
|
data: {
|
|
_skip: false
|
|
}
|
|
};
|
|
|
|
// node_modules/@popperjs/core/lib/modifiers/hide.js
|
|
function getSideOffsets(overflow, rect, preventedOffsets) {
|
|
if (preventedOffsets === void 0) {
|
|
preventedOffsets = {
|
|
x: 0,
|
|
y: 0
|
|
};
|
|
}
|
|
return {
|
|
top: overflow.top - rect.height - preventedOffsets.y,
|
|
right: overflow.right - rect.width + preventedOffsets.x,
|
|
bottom: overflow.bottom - rect.height + preventedOffsets.y,
|
|
left: overflow.left - rect.width - preventedOffsets.x
|
|
};
|
|
}
|
|
function isAnySideFullyClipped(overflow) {
|
|
return [top, right, bottom, left].some(function(side) {
|
|
return overflow[side] >= 0;
|
|
});
|
|
}
|
|
function hide(_ref) {
|
|
var state = _ref.state, name = _ref.name;
|
|
var referenceRect = state.rects.reference;
|
|
var popperRect = state.rects.popper;
|
|
var preventedOffsets = state.modifiersData.preventOverflow;
|
|
var referenceOverflow = detectOverflow(state, {
|
|
elementContext: "reference"
|
|
});
|
|
var popperAltOverflow = detectOverflow(state, {
|
|
altBoundary: true
|
|
});
|
|
var referenceClippingOffsets = getSideOffsets(referenceOverflow, referenceRect);
|
|
var popperEscapeOffsets = getSideOffsets(popperAltOverflow, popperRect, preventedOffsets);
|
|
var isReferenceHidden = isAnySideFullyClipped(referenceClippingOffsets);
|
|
var hasPopperEscaped = isAnySideFullyClipped(popperEscapeOffsets);
|
|
state.modifiersData[name] = {
|
|
referenceClippingOffsets,
|
|
popperEscapeOffsets,
|
|
isReferenceHidden,
|
|
hasPopperEscaped
|
|
};
|
|
state.attributes.popper = Object.assign({}, state.attributes.popper, {
|
|
"data-popper-reference-hidden": isReferenceHidden,
|
|
"data-popper-escaped": hasPopperEscaped
|
|
});
|
|
}
|
|
var hide_default = {
|
|
name: "hide",
|
|
enabled: true,
|
|
phase: "main",
|
|
requiresIfExists: ["preventOverflow"],
|
|
fn: hide
|
|
};
|
|
|
|
// node_modules/@popperjs/core/lib/modifiers/offset.js
|
|
function distanceAndSkiddingToXY(placement, rects, offset2) {
|
|
var basePlacement = getBasePlacement(placement);
|
|
var invertDistance = [left, top].indexOf(basePlacement) >= 0 ? -1 : 1;
|
|
var _ref = typeof offset2 === "function" ? offset2(Object.assign({}, rects, {
|
|
placement
|
|
})) : offset2, skidding = _ref[0], distance = _ref[1];
|
|
skidding = skidding || 0;
|
|
distance = (distance || 0) * invertDistance;
|
|
return [left, right].indexOf(basePlacement) >= 0 ? {
|
|
x: distance,
|
|
y: skidding
|
|
} : {
|
|
x: skidding,
|
|
y: distance
|
|
};
|
|
}
|
|
function offset(_ref2) {
|
|
var state = _ref2.state, options = _ref2.options, name = _ref2.name;
|
|
var _options$offset = options.offset, offset2 = _options$offset === void 0 ? [0, 0] : _options$offset;
|
|
var data = placements.reduce(function(acc, placement) {
|
|
acc[placement] = distanceAndSkiddingToXY(placement, state.rects, offset2);
|
|
return acc;
|
|
}, {});
|
|
var _data$state$placement = data[state.placement], x = _data$state$placement.x, y = _data$state$placement.y;
|
|
if (state.modifiersData.popperOffsets != null) {
|
|
state.modifiersData.popperOffsets.x += x;
|
|
state.modifiersData.popperOffsets.y += y;
|
|
}
|
|
state.modifiersData[name] = data;
|
|
}
|
|
var offset_default = {
|
|
name: "offset",
|
|
enabled: true,
|
|
phase: "main",
|
|
requires: ["popperOffsets"],
|
|
fn: offset
|
|
};
|
|
|
|
// node_modules/@popperjs/core/lib/modifiers/popperOffsets.js
|
|
function popperOffsets(_ref) {
|
|
var state = _ref.state, name = _ref.name;
|
|
state.modifiersData[name] = computeOffsets({
|
|
reference: state.rects.reference,
|
|
element: state.rects.popper,
|
|
strategy: "absolute",
|
|
placement: state.placement
|
|
});
|
|
}
|
|
var popperOffsets_default = {
|
|
name: "popperOffsets",
|
|
enabled: true,
|
|
phase: "read",
|
|
fn: popperOffsets,
|
|
data: {}
|
|
};
|
|
|
|
// node_modules/@popperjs/core/lib/utils/getAltAxis.js
|
|
function getAltAxis(axis) {
|
|
return axis === "x" ? "y" : "x";
|
|
}
|
|
|
|
// node_modules/@popperjs/core/lib/modifiers/preventOverflow.js
|
|
function preventOverflow(_ref) {
|
|
var state = _ref.state, options = _ref.options, name = _ref.name;
|
|
var _options$mainAxis = options.mainAxis, checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis, _options$altAxis = options.altAxis, checkAltAxis = _options$altAxis === void 0 ? false : _options$altAxis, boundary = options.boundary, rootBoundary = options.rootBoundary, altBoundary = options.altBoundary, padding = options.padding, _options$tether = options.tether, tether = _options$tether === void 0 ? true : _options$tether, _options$tetherOffset = options.tetherOffset, tetherOffset = _options$tetherOffset === void 0 ? 0 : _options$tetherOffset;
|
|
var overflow = detectOverflow(state, {
|
|
boundary,
|
|
rootBoundary,
|
|
padding,
|
|
altBoundary
|
|
});
|
|
var basePlacement = getBasePlacement(state.placement);
|
|
var variation = getVariation(state.placement);
|
|
var isBasePlacement = !variation;
|
|
var mainAxis = getMainAxisFromPlacement(basePlacement);
|
|
var altAxis = getAltAxis(mainAxis);
|
|
var popperOffsets2 = state.modifiersData.popperOffsets;
|
|
var referenceRect = state.rects.reference;
|
|
var popperRect = state.rects.popper;
|
|
var tetherOffsetValue = typeof tetherOffset === "function" ? tetherOffset(Object.assign({}, state.rects, {
|
|
placement: state.placement
|
|
})) : tetherOffset;
|
|
var normalizedTetherOffsetValue = typeof tetherOffsetValue === "number" ? {
|
|
mainAxis: tetherOffsetValue,
|
|
altAxis: tetherOffsetValue
|
|
} : Object.assign({
|
|
mainAxis: 0,
|
|
altAxis: 0
|
|
}, tetherOffsetValue);
|
|
var offsetModifierState = state.modifiersData.offset ? state.modifiersData.offset[state.placement] : null;
|
|
var data = {
|
|
x: 0,
|
|
y: 0
|
|
};
|
|
if (!popperOffsets2) {
|
|
return;
|
|
}
|
|
if (checkMainAxis) {
|
|
var _offsetModifierState$;
|
|
var mainSide = mainAxis === "y" ? top : left;
|
|
var altSide = mainAxis === "y" ? bottom : right;
|
|
var len = mainAxis === "y" ? "height" : "width";
|
|
var offset2 = popperOffsets2[mainAxis];
|
|
var min2 = offset2 + overflow[mainSide];
|
|
var max2 = offset2 - overflow[altSide];
|
|
var additive = tether ? -popperRect[len] / 2 : 0;
|
|
var minLen = variation === start ? referenceRect[len] : popperRect[len];
|
|
var maxLen = variation === start ? -popperRect[len] : -referenceRect[len];
|
|
var arrowElement = state.elements.arrow;
|
|
var arrowRect = tether && arrowElement ? getLayoutRect(arrowElement) : {
|
|
width: 0,
|
|
height: 0
|
|
};
|
|
var arrowPaddingObject = state.modifiersData["arrow#persistent"] ? state.modifiersData["arrow#persistent"].padding : getFreshSideObject();
|
|
var arrowPaddingMin = arrowPaddingObject[mainSide];
|
|
var arrowPaddingMax = arrowPaddingObject[altSide];
|
|
var arrowLen = within(0, referenceRect[len], arrowRect[len]);
|
|
var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis : minLen - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis;
|
|
var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis : maxLen + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis;
|
|
var arrowOffsetParent = state.elements.arrow && getOffsetParent(state.elements.arrow);
|
|
var clientOffset = arrowOffsetParent ? mainAxis === "y" ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0;
|
|
var offsetModifierValue = (_offsetModifierState$ = offsetModifierState == null ? void 0 : offsetModifierState[mainAxis]) != null ? _offsetModifierState$ : 0;
|
|
var tetherMin = offset2 + minOffset - offsetModifierValue - clientOffset;
|
|
var tetherMax = offset2 + maxOffset - offsetModifierValue;
|
|
var preventedOffset = within(tether ? min(min2, tetherMin) : min2, offset2, tether ? max(max2, tetherMax) : max2);
|
|
popperOffsets2[mainAxis] = preventedOffset;
|
|
data[mainAxis] = preventedOffset - offset2;
|
|
}
|
|
if (checkAltAxis) {
|
|
var _offsetModifierState$2;
|
|
var _mainSide = mainAxis === "x" ? top : left;
|
|
var _altSide = mainAxis === "x" ? bottom : right;
|
|
var _offset = popperOffsets2[altAxis];
|
|
var _len = altAxis === "y" ? "height" : "width";
|
|
var _min = _offset + overflow[_mainSide];
|
|
var _max = _offset - overflow[_altSide];
|
|
var isOriginSide = [top, left].indexOf(basePlacement) !== -1;
|
|
var _offsetModifierValue = (_offsetModifierState$2 = offsetModifierState == null ? void 0 : offsetModifierState[altAxis]) != null ? _offsetModifierState$2 : 0;
|
|
var _tetherMin = isOriginSide ? _min : _offset - referenceRect[_len] - popperRect[_len] - _offsetModifierValue + normalizedTetherOffsetValue.altAxis;
|
|
var _tetherMax = isOriginSide ? _offset + referenceRect[_len] + popperRect[_len] - _offsetModifierValue - normalizedTetherOffsetValue.altAxis : _max;
|
|
var _preventedOffset = tether && isOriginSide ? withinMaxClamp(_tetherMin, _offset, _tetherMax) : within(tether ? _tetherMin : _min, _offset, tether ? _tetherMax : _max);
|
|
popperOffsets2[altAxis] = _preventedOffset;
|
|
data[altAxis] = _preventedOffset - _offset;
|
|
}
|
|
state.modifiersData[name] = data;
|
|
}
|
|
var preventOverflow_default = {
|
|
name: "preventOverflow",
|
|
enabled: true,
|
|
phase: "main",
|
|
fn: preventOverflow,
|
|
requiresIfExists: ["offset"]
|
|
};
|
|
|
|
// node_modules/@popperjs/core/lib/dom-utils/getHTMLElementScroll.js
|
|
function getHTMLElementScroll(element) {
|
|
return {
|
|
scrollLeft: element.scrollLeft,
|
|
scrollTop: element.scrollTop
|
|
};
|
|
}
|
|
|
|
// node_modules/@popperjs/core/lib/dom-utils/getNodeScroll.js
|
|
function getNodeScroll(node) {
|
|
if (node === getWindow(node) || !isHTMLElement(node)) {
|
|
return getWindowScroll(node);
|
|
} else {
|
|
return getHTMLElementScroll(node);
|
|
}
|
|
}
|
|
|
|
// node_modules/@popperjs/core/lib/dom-utils/getCompositeRect.js
|
|
function isElementScaled(element) {
|
|
var rect = element.getBoundingClientRect();
|
|
var scaleX = round(rect.width) / element.offsetWidth || 1;
|
|
var scaleY = round(rect.height) / element.offsetHeight || 1;
|
|
return scaleX !== 1 || scaleY !== 1;
|
|
}
|
|
function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
|
|
if (isFixed === void 0) {
|
|
isFixed = false;
|
|
}
|
|
var isOffsetParentAnElement = isHTMLElement(offsetParent);
|
|
var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent);
|
|
var documentElement = getDocumentElement(offsetParent);
|
|
var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled);
|
|
var scroll = {
|
|
scrollLeft: 0,
|
|
scrollTop: 0
|
|
};
|
|
var offsets = {
|
|
x: 0,
|
|
y: 0
|
|
};
|
|
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
|
if (getNodeName(offsetParent) !== "body" || isScrollParent(documentElement)) {
|
|
scroll = getNodeScroll(offsetParent);
|
|
}
|
|
if (isHTMLElement(offsetParent)) {
|
|
offsets = getBoundingClientRect(offsetParent, true);
|
|
offsets.x += offsetParent.clientLeft;
|
|
offsets.y += offsetParent.clientTop;
|
|
} else if (documentElement) {
|
|
offsets.x = getWindowScrollBarX(documentElement);
|
|
}
|
|
}
|
|
return {
|
|
x: rect.left + scroll.scrollLeft - offsets.x,
|
|
y: rect.top + scroll.scrollTop - offsets.y,
|
|
width: rect.width,
|
|
height: rect.height
|
|
};
|
|
}
|
|
|
|
// node_modules/@popperjs/core/lib/utils/orderModifiers.js
|
|
function order(modifiers) {
|
|
var map = new Map();
|
|
var visited = new Set();
|
|
var result = [];
|
|
modifiers.forEach(function(modifier) {
|
|
map.set(modifier.name, modifier);
|
|
});
|
|
function sort(modifier) {
|
|
visited.add(modifier.name);
|
|
var requires = [].concat(modifier.requires || [], modifier.requiresIfExists || []);
|
|
requires.forEach(function(dep) {
|
|
if (!visited.has(dep)) {
|
|
var depModifier = map.get(dep);
|
|
if (depModifier) {
|
|
sort(depModifier);
|
|
}
|
|
}
|
|
});
|
|
result.push(modifier);
|
|
}
|
|
modifiers.forEach(function(modifier) {
|
|
if (!visited.has(modifier.name)) {
|
|
sort(modifier);
|
|
}
|
|
});
|
|
return result;
|
|
}
|
|
function orderModifiers(modifiers) {
|
|
var orderedModifiers = order(modifiers);
|
|
return modifierPhases.reduce(function(acc, phase) {
|
|
return acc.concat(orderedModifiers.filter(function(modifier) {
|
|
return modifier.phase === phase;
|
|
}));
|
|
}, []);
|
|
}
|
|
|
|
// node_modules/@popperjs/core/lib/utils/debounce.js
|
|
function debounce2(fn2) {
|
|
var pending;
|
|
return function() {
|
|
if (!pending) {
|
|
pending = new Promise(function(resolve) {
|
|
Promise.resolve().then(function() {
|
|
pending = void 0;
|
|
resolve(fn2());
|
|
});
|
|
});
|
|
}
|
|
return pending;
|
|
};
|
|
}
|
|
|
|
// node_modules/@popperjs/core/lib/utils/format.js
|
|
function format(str) {
|
|
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
args[_key - 1] = arguments[_key];
|
|
}
|
|
return [].concat(args).reduce(function(p, c) {
|
|
return p.replace(/%s/, c);
|
|
}, str);
|
|
}
|
|
|
|
// node_modules/@popperjs/core/lib/utils/validateModifiers.js
|
|
var INVALID_MODIFIER_ERROR = 'Popper: modifier "%s" provided an invalid %s property, expected %s but got %s';
|
|
var MISSING_DEPENDENCY_ERROR = 'Popper: modifier "%s" requires "%s", but "%s" modifier is not available';
|
|
var VALID_PROPERTIES = ["name", "enabled", "phase", "fn", "effect", "requires", "options"];
|
|
function validateModifiers(modifiers) {
|
|
modifiers.forEach(function(modifier) {
|
|
[].concat(Object.keys(modifier), VALID_PROPERTIES).filter(function(value, index, self) {
|
|
return self.indexOf(value) === index;
|
|
}).forEach(function(key) {
|
|
switch (key) {
|
|
case "name":
|
|
if (typeof modifier.name !== "string") {
|
|
console.error(format(INVALID_MODIFIER_ERROR, String(modifier.name), '"name"', '"string"', '"' + String(modifier.name) + '"'));
|
|
}
|
|
break;
|
|
case "enabled":
|
|
if (typeof modifier.enabled !== "boolean") {
|
|
console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"enabled"', '"boolean"', '"' + String(modifier.enabled) + '"'));
|
|
}
|
|
break;
|
|
case "phase":
|
|
if (modifierPhases.indexOf(modifier.phase) < 0) {
|
|
console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"phase"', "either " + modifierPhases.join(", "), '"' + String(modifier.phase) + '"'));
|
|
}
|
|
break;
|
|
case "fn":
|
|
if (typeof modifier.fn !== "function") {
|
|
console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"fn"', '"function"', '"' + String(modifier.fn) + '"'));
|
|
}
|
|
break;
|
|
case "effect":
|
|
if (modifier.effect != null && typeof modifier.effect !== "function") {
|
|
console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"effect"', '"function"', '"' + String(modifier.fn) + '"'));
|
|
}
|
|
break;
|
|
case "requires":
|
|
if (modifier.requires != null && !Array.isArray(modifier.requires)) {
|
|
console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"requires"', '"array"', '"' + String(modifier.requires) + '"'));
|
|
}
|
|
break;
|
|
case "requiresIfExists":
|
|
if (!Array.isArray(modifier.requiresIfExists)) {
|
|
console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"requiresIfExists"', '"array"', '"' + String(modifier.requiresIfExists) + '"'));
|
|
}
|
|
break;
|
|
case "options":
|
|
case "data":
|
|
break;
|
|
default:
|
|
console.error('PopperJS: an invalid property has been provided to the "' + modifier.name + '" modifier, valid properties are ' + VALID_PROPERTIES.map(function(s) {
|
|
return '"' + s + '"';
|
|
}).join(", ") + '; but "' + key + '" was provided.');
|
|
}
|
|
modifier.requires && modifier.requires.forEach(function(requirement) {
|
|
if (modifiers.find(function(mod) {
|
|
return mod.name === requirement;
|
|
}) == null) {
|
|
console.error(format(MISSING_DEPENDENCY_ERROR, String(modifier.name), requirement, requirement));
|
|
}
|
|
});
|
|
});
|
|
});
|
|
}
|
|
|
|
// node_modules/@popperjs/core/lib/utils/uniqueBy.js
|
|
function uniqueBy(arr, fn2) {
|
|
var identifiers = new Set();
|
|
return arr.filter(function(item) {
|
|
var identifier = fn2(item);
|
|
if (!identifiers.has(identifier)) {
|
|
identifiers.add(identifier);
|
|
return true;
|
|
}
|
|
});
|
|
}
|
|
|
|
// node_modules/@popperjs/core/lib/utils/mergeByName.js
|
|
function mergeByName(modifiers) {
|
|
var merged = modifiers.reduce(function(merged2, current) {
|
|
var existing = merged2[current.name];
|
|
merged2[current.name] = existing ? Object.assign({}, existing, current, {
|
|
options: Object.assign({}, existing.options, current.options),
|
|
data: Object.assign({}, existing.data, current.data)
|
|
}) : current;
|
|
return merged2;
|
|
}, {});
|
|
return Object.keys(merged).map(function(key) {
|
|
return merged[key];
|
|
});
|
|
}
|
|
|
|
// node_modules/@popperjs/core/lib/createPopper.js
|
|
var INVALID_ELEMENT_ERROR = "Popper: Invalid reference or popper argument provided. They must be either a DOM element or virtual element.";
|
|
var INFINITE_LOOP_ERROR = "Popper: An infinite loop in the modifiers cycle has been detected! The cycle has been interrupted to prevent a browser crash.";
|
|
var DEFAULT_OPTIONS = {
|
|
placement: "bottom",
|
|
modifiers: [],
|
|
strategy: "absolute"
|
|
};
|
|
function areValidElements() {
|
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
args[_key] = arguments[_key];
|
|
}
|
|
return !args.some(function(element) {
|
|
return !(element && typeof element.getBoundingClientRect === "function");
|
|
});
|
|
}
|
|
function popperGenerator(generatorOptions) {
|
|
if (generatorOptions === void 0) {
|
|
generatorOptions = {};
|
|
}
|
|
var _generatorOptions = generatorOptions, _generatorOptions$def = _generatorOptions.defaultModifiers, defaultModifiers2 = _generatorOptions$def === void 0 ? [] : _generatorOptions$def, _generatorOptions$def2 = _generatorOptions.defaultOptions, defaultOptions = _generatorOptions$def2 === void 0 ? DEFAULT_OPTIONS : _generatorOptions$def2;
|
|
return function createPopper2(reference2, popper2, options) {
|
|
if (options === void 0) {
|
|
options = defaultOptions;
|
|
}
|
|
var state = {
|
|
placement: "bottom",
|
|
orderedModifiers: [],
|
|
options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions),
|
|
modifiersData: {},
|
|
elements: {
|
|
reference: reference2,
|
|
popper: popper2
|
|
},
|
|
attributes: {},
|
|
styles: {}
|
|
};
|
|
var effectCleanupFns = [];
|
|
var isDestroyed = false;
|
|
var instance2 = {
|
|
state,
|
|
setOptions: function setOptions(setOptionsAction) {
|
|
var options2 = typeof setOptionsAction === "function" ? setOptionsAction(state.options) : setOptionsAction;
|
|
cleanupModifierEffects();
|
|
state.options = Object.assign({}, defaultOptions, state.options, options2);
|
|
state.scrollParents = {
|
|
reference: isElement(reference2) ? listScrollParents(reference2) : reference2.contextElement ? listScrollParents(reference2.contextElement) : [],
|
|
popper: listScrollParents(popper2)
|
|
};
|
|
var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers2, state.options.modifiers)));
|
|
state.orderedModifiers = orderedModifiers.filter(function(m) {
|
|
return m.enabled;
|
|
});
|
|
if (true) {
|
|
var modifiers = uniqueBy([].concat(orderedModifiers, state.options.modifiers), function(_ref) {
|
|
var name = _ref.name;
|
|
return name;
|
|
});
|
|
validateModifiers(modifiers);
|
|
if (getBasePlacement(state.options.placement) === auto) {
|
|
var flipModifier = state.orderedModifiers.find(function(_ref2) {
|
|
var name = _ref2.name;
|
|
return name === "flip";
|
|
});
|
|
if (!flipModifier) {
|
|
console.error(['Popper: "auto" placements require the "flip" modifier be', "present and enabled to work."].join(" "));
|
|
}
|
|
}
|
|
var _getComputedStyle = getComputedStyle(popper2), marginTop = _getComputedStyle.marginTop, marginRight = _getComputedStyle.marginRight, marginBottom = _getComputedStyle.marginBottom, marginLeft = _getComputedStyle.marginLeft;
|
|
if ([marginTop, marginRight, marginBottom, marginLeft].some(function(margin) {
|
|
return parseFloat(margin);
|
|
})) {
|
|
console.warn(['Popper: CSS "margin" styles cannot be used to apply padding', "between the popper and its reference element or boundary.", "To replicate margin, use the `offset` modifier, as well as", "the `padding` option in the `preventOverflow` and `flip`", "modifiers."].join(" "));
|
|
}
|
|
}
|
|
runModifierEffects();
|
|
return instance2.update();
|
|
},
|
|
forceUpdate: function forceUpdate() {
|
|
if (isDestroyed) {
|
|
return;
|
|
}
|
|
var _state$elements = state.elements, reference3 = _state$elements.reference, popper3 = _state$elements.popper;
|
|
if (!areValidElements(reference3, popper3)) {
|
|
if (true) {
|
|
console.error(INVALID_ELEMENT_ERROR);
|
|
}
|
|
return;
|
|
}
|
|
state.rects = {
|
|
reference: getCompositeRect(reference3, getOffsetParent(popper3), state.options.strategy === "fixed"),
|
|
popper: getLayoutRect(popper3)
|
|
};
|
|
state.reset = false;
|
|
state.placement = state.options.placement;
|
|
state.orderedModifiers.forEach(function(modifier) {
|
|
return state.modifiersData[modifier.name] = Object.assign({}, modifier.data);
|
|
});
|
|
var __debug_loops__ = 0;
|
|
for (var index = 0; index < state.orderedModifiers.length; index++) {
|
|
if (true) {
|
|
__debug_loops__ += 1;
|
|
if (__debug_loops__ > 100) {
|
|
console.error(INFINITE_LOOP_ERROR);
|
|
break;
|
|
}
|
|
}
|
|
if (state.reset === true) {
|
|
state.reset = false;
|
|
index = -1;
|
|
continue;
|
|
}
|
|
var _state$orderedModifie = state.orderedModifiers[index], fn2 = _state$orderedModifie.fn, _state$orderedModifie2 = _state$orderedModifie.options, _options = _state$orderedModifie2 === void 0 ? {} : _state$orderedModifie2, name = _state$orderedModifie.name;
|
|
if (typeof fn2 === "function") {
|
|
state = fn2({
|
|
state,
|
|
options: _options,
|
|
name,
|
|
instance: instance2
|
|
}) || state;
|
|
}
|
|
}
|
|
},
|
|
update: debounce2(function() {
|
|
return new Promise(function(resolve) {
|
|
instance2.forceUpdate();
|
|
resolve(state);
|
|
});
|
|
}),
|
|
destroy: function destroy() {
|
|
cleanupModifierEffects();
|
|
isDestroyed = true;
|
|
}
|
|
};
|
|
if (!areValidElements(reference2, popper2)) {
|
|
if (true) {
|
|
console.error(INVALID_ELEMENT_ERROR);
|
|
}
|
|
return instance2;
|
|
}
|
|
instance2.setOptions(options).then(function(state2) {
|
|
if (!isDestroyed && options.onFirstUpdate) {
|
|
options.onFirstUpdate(state2);
|
|
}
|
|
});
|
|
function runModifierEffects() {
|
|
state.orderedModifiers.forEach(function(_ref3) {
|
|
var name = _ref3.name, _ref3$options = _ref3.options, options2 = _ref3$options === void 0 ? {} : _ref3$options, effect4 = _ref3.effect;
|
|
if (typeof effect4 === "function") {
|
|
var cleanupFn = effect4({
|
|
state,
|
|
name,
|
|
instance: instance2,
|
|
options: options2
|
|
});
|
|
var noopFn = function noopFn2() {
|
|
};
|
|
effectCleanupFns.push(cleanupFn || noopFn);
|
|
}
|
|
});
|
|
}
|
|
function cleanupModifierEffects() {
|
|
effectCleanupFns.forEach(function(fn2) {
|
|
return fn2();
|
|
});
|
|
effectCleanupFns = [];
|
|
}
|
|
return instance2;
|
|
};
|
|
}
|
|
|
|
// node_modules/@popperjs/core/lib/popper.js
|
|
var defaultModifiers = [eventListeners_default, popperOffsets_default, computeStyles_default, applyStyles_default, offset_default, flip_default, preventOverflow_default, arrow_default, hide_default];
|
|
var createPopper = /* @__PURE__ */ popperGenerator({
|
|
defaultModifiers
|
|
});
|
|
|
|
// src/settings/ui/suggest.ts
|
|
var import_obsidian2 = __toModule(require("obsidian"));
|
|
var wrapAround = (value, size) => {
|
|
return (value % size + size) % size;
|
|
};
|
|
var Suggest = class {
|
|
constructor(owner, containerEl, scope) {
|
|
this.owner = owner;
|
|
this.containerEl = containerEl;
|
|
containerEl.on("click", ".suggestion-item", this.onSuggestionClick.bind(this));
|
|
containerEl.on("mousemove", ".suggestion-item", this.onSuggestionMouseover.bind(this));
|
|
scope.register([], "ArrowUp", (event) => {
|
|
if (!event.isComposing) {
|
|
this.setSelectedItem(this.selectedItem - 1, true);
|
|
return false;
|
|
}
|
|
});
|
|
scope.register([], "ArrowDown", (event) => {
|
|
if (!event.isComposing) {
|
|
this.setSelectedItem(this.selectedItem + 1, true);
|
|
return false;
|
|
}
|
|
});
|
|
scope.register([], "Enter", (event) => {
|
|
if (!event.isComposing) {
|
|
this.useSelectedItem(event);
|
|
return false;
|
|
}
|
|
});
|
|
}
|
|
onSuggestionClick(event, el) {
|
|
event.preventDefault();
|
|
const item = this.suggestions.indexOf(el);
|
|
this.setSelectedItem(item, false);
|
|
this.useSelectedItem(event);
|
|
}
|
|
onSuggestionMouseover(_event, el) {
|
|
const item = this.suggestions.indexOf(el);
|
|
this.setSelectedItem(item, false);
|
|
}
|
|
setSuggestions(values) {
|
|
this.containerEl.empty();
|
|
const suggestionEls = [];
|
|
values.forEach((value) => {
|
|
const suggestionEl = this.containerEl.createDiv("suggestion-item");
|
|
this.owner.renderSuggestion(value, suggestionEl);
|
|
suggestionEls.push(suggestionEl);
|
|
});
|
|
this.values = values;
|
|
this.suggestions = suggestionEls;
|
|
this.setSelectedItem(0, false);
|
|
}
|
|
useSelectedItem(event) {
|
|
const currentValue = this.values[this.selectedItem];
|
|
if (currentValue) {
|
|
this.owner.selectSuggestion(currentValue, event);
|
|
}
|
|
}
|
|
setSelectedItem(selectedIndex, scrollIntoView) {
|
|
const normalizedIndex = wrapAround(selectedIndex, this.suggestions.length);
|
|
const prevSelectedSuggestion = this.suggestions[this.selectedItem];
|
|
const selectedSuggestion = this.suggestions[normalizedIndex];
|
|
prevSelectedSuggestion == null ? void 0 : prevSelectedSuggestion.removeClass("is-selected");
|
|
selectedSuggestion == null ? void 0 : selectedSuggestion.addClass("is-selected");
|
|
this.selectedItem = normalizedIndex;
|
|
if (scrollIntoView) {
|
|
selectedSuggestion.scrollIntoView(false);
|
|
}
|
|
}
|
|
};
|
|
var TextInputSuggest = class {
|
|
constructor(app, inputEl) {
|
|
this.app = app;
|
|
this.inputEl = inputEl;
|
|
this.scope = new import_obsidian2.Scope();
|
|
this.suggestEl = createDiv("suggestion-container");
|
|
const suggestion = this.suggestEl.createDiv("suggestion");
|
|
this.suggest = new Suggest(this, suggestion, this.scope);
|
|
this.scope.register([], "Escape", this.close.bind(this));
|
|
this.inputEl.addEventListener("input", this.onInputChanged.bind(this));
|
|
this.inputEl.addEventListener("focus", this.onInputChanged.bind(this));
|
|
this.inputEl.addEventListener("blur", this.close.bind(this));
|
|
this.suggestEl.on("mousedown", ".suggestion-container", (event) => {
|
|
event.preventDefault();
|
|
});
|
|
}
|
|
onInputChanged() {
|
|
const inputStr = this.inputEl.value;
|
|
const suggestions = this.getSuggestions(inputStr);
|
|
if (suggestions.length > 0) {
|
|
this.suggest.setSuggestions(suggestions);
|
|
this.open(this.app.dom.appContainerEl, this.inputEl);
|
|
}
|
|
}
|
|
open(container, inputEl) {
|
|
this.app.keymap.pushScope(this.scope);
|
|
container.appendChild(this.suggestEl);
|
|
this.popper = createPopper(inputEl, this.suggestEl, {
|
|
placement: "bottom-start",
|
|
modifiers: [
|
|
{
|
|
name: "sameWidth",
|
|
enabled: true,
|
|
fn: ({ state, instance: instance2 }) => {
|
|
const targetWidth = `${state.rects.reference.width}px`;
|
|
if (state.styles.popper.width === targetWidth) {
|
|
return;
|
|
}
|
|
state.styles.popper.width = targetWidth;
|
|
instance2.update();
|
|
},
|
|
phase: "beforeWrite",
|
|
requires: ["computeStyles"]
|
|
}
|
|
]
|
|
});
|
|
}
|
|
close() {
|
|
this.app.keymap.popScope(this.scope);
|
|
this.suggest.setSuggestions([]);
|
|
this.popper.destroy();
|
|
this.suggestEl.detach();
|
|
}
|
|
};
|
|
|
|
// src/settings/ui/file_suggest.ts
|
|
var FileSuggest = class extends TextInputSuggest {
|
|
getSuggestions(inputStr) {
|
|
const files = [];
|
|
const lowerCaseInputStr = inputStr.toLowerCase();
|
|
import_obsidian3.Vault.recurseChildren(this.app.vault.getRoot(), (file) => {
|
|
if (file.path.toLowerCase().contains(lowerCaseInputStr)) {
|
|
files.push(file);
|
|
}
|
|
});
|
|
return files;
|
|
}
|
|
renderSuggestion(file, el) {
|
|
el.setText(file.path);
|
|
}
|
|
selectSuggestion(file) {
|
|
this.inputEl.value = file.path;
|
|
this.inputEl.trigger("input");
|
|
this.close();
|
|
}
|
|
};
|
|
|
|
// src/settings/settings_tab.ts
|
|
var LatexSuiteSettingTab = class extends import_obsidian4.PluginSettingTab {
|
|
constructor(app, plugin) {
|
|
super(app, plugin);
|
|
this.plugin = plugin;
|
|
}
|
|
hide() {
|
|
var _a;
|
|
(_a = this.snippetsEditor) == null ? void 0 : _a.destroy();
|
|
}
|
|
addHeading(containerEl, name, icon = "math") {
|
|
const heading = new import_obsidian4.Setting(containerEl).setName(name).setHeading();
|
|
const parentEl = heading.settingEl;
|
|
const iconEl = parentEl.createDiv();
|
|
(0, import_obsidian4.setIcon)(iconEl, icon);
|
|
iconEl.addClass("latex-suite-settings-icon");
|
|
parentEl.prepend(iconEl);
|
|
}
|
|
display() {
|
|
const { containerEl } = this;
|
|
containerEl.empty();
|
|
this.addHeading(containerEl, "Snippets", "ballpen");
|
|
new import_obsidian4.Setting(containerEl).setName("Enabled").setDesc("Whether snippets are enabled.").addToggle((toggle) => toggle.setValue(this.plugin.settings.snippetsEnabled).onChange((value) => __async(this, null, function* () {
|
|
this.plugin.settings.snippetsEnabled = value;
|
|
yield this.plugin.saveSettings();
|
|
})));
|
|
const snippetsSetting = new import_obsidian4.Setting(containerEl).setName("Snippets").setDesc('Enter snippets here. Remember to add a comma after each snippet, and escape all backslashes with an extra \\. Lines starting with "//" will be treated as comments and ignored.').setClass("snippets-text-area");
|
|
this.createSnippetsEditor(snippetsSetting);
|
|
new import_obsidian4.Setting(containerEl).setName("Load snippets from file or folder").setDesc("Whether to load snippets from a specified file, or from all files within a folder (instead of from the plugin settings).").addToggle((toggle) => toggle.setValue(this.plugin.settings.loadSnippetsFromFile).onChange((value) => __async(this, null, function* () {
|
|
this.plugin.settings.loadSnippetsFromFile = value;
|
|
snippetsSetting.settingEl.toggleClass("hidden", value);
|
|
if (this.snippetsFileLocEl != void 0)
|
|
this.snippetsFileLocEl.toggleClass("hidden", !value);
|
|
yield this.plugin.saveSettings();
|
|
})));
|
|
const snippetsFileLocDesc = new DocumentFragment();
|
|
snippetsFileLocDesc.createDiv({}, (div) => {
|
|
div.innerHTML = `
|
|
The file or folder to load snippets from. The file or folder must be within your vault, and not within a hidden folder (such as <code>.obsidian/</code>).`;
|
|
});
|
|
const snippetsFileLoc = new import_obsidian4.Setting(containerEl).setName("Snippets file or folder location").setDesc(snippetsFileLocDesc);
|
|
let inputEl;
|
|
snippetsFileLoc.addText((text) => {
|
|
text.setPlaceholder(DEFAULT_SETTINGS.snippetsFileLocation).setValue(this.plugin.settings.snippetsFileLocation).onChange((value) => __async(this, null, function* () {
|
|
this.plugin.settings.snippetsFileLocation = value;
|
|
yield this.plugin.saveSettings();
|
|
}));
|
|
inputEl = text.inputEl;
|
|
});
|
|
this.snippetsFileLocEl = snippetsFileLoc.settingEl;
|
|
new FileSuggest(this.app, inputEl);
|
|
const loadSnippetsFromFile = this.plugin.settings.loadSnippetsFromFile;
|
|
snippetsSetting.settingEl.toggleClass("hidden", loadSnippetsFromFile);
|
|
this.snippetsFileLocEl.toggleClass("hidden", !loadSnippetsFromFile);
|
|
new import_obsidian4.Setting(containerEl).setName("Key trigger for non-auto snippets").setDesc("What key to press to expand non-auto snippets.").addDropdown((dropdown) => dropdown.addOption("Tab", "Tab").addOption(" ", "Space").setValue(this.plugin.settings.snippetsTrigger).onChange((value) => __async(this, null, function* () {
|
|
this.plugin.settings.snippetsTrigger = value;
|
|
yield this.plugin.saveSettings();
|
|
})));
|
|
this.addHeading(containerEl, "Conceal", "math-integral-x");
|
|
{
|
|
const fragment = new DocumentFragment();
|
|
fragment.createDiv({}, (div) => div.setText("Make equations more readable by hiding LaTeX markup and instead displaying it in a pretty format."));
|
|
fragment.createDiv({}, (div) => div.innerHTML = `
|
|
e.g. <code>\\dot{x}^{2} + \\dot{y}^{2}</code> will display as \u1E8B\xB2 + \u1E8F\xB2, and <code>\\sqrt{ 1-\\beta^{2} }</code> will display as \u221A{ 1-\u03B2\xB2 }.
|
|
`);
|
|
fragment.createDiv({}, (div) => div.setText("LaTeX beneath the cursor will be revealed."));
|
|
fragment.createEl("br");
|
|
fragment.createDiv({}, (div) => div.setText("Disabled by default to not confuse new users. However, I recommend turning this on once you are comfortable with the plugin!"));
|
|
new import_obsidian4.Setting(containerEl).setName("Enabled").setDesc(fragment).addToggle((toggle) => toggle.setValue(this.plugin.settings.concealEnabled).onChange((value) => __async(this, null, function* () {
|
|
this.plugin.settings.concealEnabled = value;
|
|
yield this.plugin.saveSettings();
|
|
})));
|
|
}
|
|
this.addHeading(containerEl, "Highlight and color brackets", "parentheses");
|
|
new import_obsidian4.Setting(containerEl).setName("Color paired brackets").setDesc("Whether to colorize matching brackets.").addToggle((toggle) => toggle.setValue(this.plugin.settings.colorPairedBracketsEnabled).onChange((value) => __async(this, null, function* () {
|
|
this.plugin.settings.colorPairedBracketsEnabled = value;
|
|
yield this.plugin.saveSettings();
|
|
})));
|
|
new import_obsidian4.Setting(containerEl).setName("Highlight matching bracket beneath cursor").setDesc("When the cursor is adjacent to a bracket, highlight the matching bracket.").addToggle((toggle) => toggle.setValue(this.plugin.settings.highlightCursorBracketsEnabled).onChange((value) => __async(this, null, function* () {
|
|
this.plugin.settings.highlightCursorBracketsEnabled = value;
|
|
yield this.plugin.saveSettings();
|
|
})));
|
|
this.addHeading(containerEl, "Math popup preview", "superscript");
|
|
const popup_fragment = document.createDocumentFragment();
|
|
const popup_line1 = document.createElement("div");
|
|
popup_line1.setText("When inside an equation, show a popup preview window of the rendered math.");
|
|
const popup_space = document.createElement("br");
|
|
const popup_line4 = document.createElement("div");
|
|
popup_line4.setText("The popup preview will be shown for all inline math equations, as well as for block math equations in Source mode.");
|
|
popup_fragment.append(popup_line1, popup_space, popup_line4);
|
|
new import_obsidian4.Setting(containerEl).setName("Enabled").setDesc(popup_fragment).addToggle((toggle) => toggle.setValue(this.plugin.settings.mathPreviewEnabled).onChange((value) => __async(this, null, function* () {
|
|
this.plugin.settings.mathPreviewEnabled = value;
|
|
yield this.plugin.saveSettings();
|
|
})));
|
|
const mathPreviewPositionSetting = new import_obsidian4.Setting(containerEl).setName("Position").setDesc("Where to display the popup preview relative to the equation source.").addDropdown((dropdown) => dropdown.addOption("Above", "Above").addOption("Below", "Below").setValue(this.plugin.settings.mathPreviewPositionIsAbove ? "Above" : "Below").onChange((value) => __async(this, null, function* () {
|
|
this.plugin.settings.mathPreviewPositionIsAbove = value === "Above";
|
|
yield this.plugin.saveSettings();
|
|
})));
|
|
this.addHeading(containerEl, "Auto-fraction", "math-x-divide-y-2");
|
|
new import_obsidian4.Setting(containerEl).setName("Enabled").setDesc("Whether auto-fraction is enabled.").addToggle((toggle) => toggle.setValue(this.plugin.settings.autofractionEnabled).onChange((value) => __async(this, null, function* () {
|
|
this.plugin.settings.autofractionEnabled = value;
|
|
yield this.plugin.saveSettings();
|
|
})));
|
|
new import_obsidian4.Setting(containerEl).setName("Fraction symbol").setDesc("The fraction symbol to use in the replacement. e.g. \\frac, \\dfrac, \\tfrac").addText((text) => text.setPlaceholder(DEFAULT_SETTINGS.autofractionSymbol).setValue(this.plugin.settings.autofractionSymbol).onChange((value) => __async(this, null, function* () {
|
|
this.plugin.settings.autofractionSymbol = value;
|
|
yield this.plugin.saveSettings();
|
|
})));
|
|
new import_obsidian4.Setting(containerEl).setName("Excluded environments").setDesc('A list of environments to exclude auto-fraction from running in. For example, to exclude auto-fraction from running while inside an exponent, such as e^{...}, use ["^{", "}"]').addTextArea((text) => text.setPlaceholder('[ ["^{", "}] ]').setValue(this.plugin.settings.autofractionExcludedEnvs).onChange((value) => __async(this, null, function* () {
|
|
this.plugin.settings.autofractionExcludedEnvs = value;
|
|
yield this.plugin.saveSettings();
|
|
})));
|
|
new import_obsidian4.Setting(containerEl).setName("Breaking characters").setDesc('A list of characters that denote the start/end of a fraction. e.g. if + is included in the list, "a+b/c" will expand to "a+\\frac{b}{c}". If + is not in the list, it will expand to "\\frac{a+b}{c}".').addText((text) => text.setPlaceholder(DEFAULT_SETTINGS.autofractionBreakingChars).setValue(this.plugin.settings.autofractionBreakingChars).onChange((value) => __async(this, null, function* () {
|
|
this.plugin.settings.autofractionBreakingChars = value;
|
|
yield this.plugin.saveSettings();
|
|
})));
|
|
this.addHeading(containerEl, "Matrix shortcuts", "brackets-contain");
|
|
new import_obsidian4.Setting(containerEl).setName("Enabled").setDesc("Whether matrix shortcuts are enabled.").addToggle((toggle) => toggle.setValue(this.plugin.settings.matrixShortcutsEnabled).onChange((value) => __async(this, null, function* () {
|
|
this.plugin.settings.matrixShortcutsEnabled = value;
|
|
yield this.plugin.saveSettings();
|
|
})));
|
|
new import_obsidian4.Setting(containerEl).setName("Environments").setDesc("A list of environment names to run the matrix shortcuts in, separated by commas.").addText((text) => text.setPlaceholder(DEFAULT_SETTINGS.matrixShortcutsEnvNames).setValue(this.plugin.settings.matrixShortcutsEnvNames).onChange((value) => __async(this, null, function* () {
|
|
this.plugin.settings.matrixShortcutsEnvNames = value;
|
|
yield this.plugin.saveSettings();
|
|
})));
|
|
this.addHeading(containerEl, "Tabout", "tabout");
|
|
new import_obsidian4.Setting(containerEl).setName("Enabled").setDesc("Whether tabout is enabled.").addToggle((toggle) => toggle.setValue(this.plugin.settings.taboutEnabled).onChange((value) => __async(this, null, function* () {
|
|
this.plugin.settings.taboutEnabled = value;
|
|
yield this.plugin.saveSettings();
|
|
})));
|
|
this.addHeading(containerEl, "Auto-enlarge brackets", "parentheses");
|
|
new import_obsidian4.Setting(containerEl).setName("Enabled").setDesc("Whether to automatically enlarge brackets containing e.g. sum, int, frac.").addToggle((toggle) => toggle.setValue(this.plugin.settings.autoEnlargeBrackets).onChange((value) => __async(this, null, function* () {
|
|
this.plugin.settings.autoEnlargeBrackets = value;
|
|
yield this.plugin.saveSettings();
|
|
})));
|
|
new import_obsidian4.Setting(containerEl).setName("Triggers").setDesc("A list of symbols that should trigger auto-enlarge brackets, separated by commas.").addText((text) => text.setPlaceholder(DEFAULT_SETTINGS.autoEnlargeBracketsTriggers).setValue(this.plugin.settings.autoEnlargeBracketsTriggers).onChange((value) => __async(this, null, function* () {
|
|
this.plugin.settings.autoEnlargeBracketsTriggers = value;
|
|
yield this.plugin.saveSettings();
|
|
})));
|
|
this.addHeading(containerEl, "Advanced snippet settings");
|
|
new import_obsidian4.Setting(containerEl).setName("Snippet variables").setDesc("Assign snippet variables that can be used as shortcuts when writing snippets.").addTextArea((text) => text.setValue(this.plugin.settings.snippetVariables).onChange((value) => __async(this, null, function* () {
|
|
this.plugin.settings.snippetVariables = value;
|
|
yield this.plugin.saveSettings();
|
|
})).setPlaceholder(DEFAULT_SETTINGS.snippetVariables)).setClass("latex-suite-snippet-variables-setting");
|
|
new import_obsidian4.Setting(containerEl).setName("Word delimiters").setDesc('Symbols that will be treated as word delimiters, for use with the "w" snippet option.').addText((text) => text.setPlaceholder(DEFAULT_SETTINGS.wordDelimiters).setValue(this.plugin.settings.wordDelimiters).onChange((value) => __async(this, null, function* () {
|
|
this.plugin.settings.wordDelimiters = value;
|
|
yield this.plugin.saveSettings();
|
|
})));
|
|
new import_obsidian4.Setting(containerEl).setName("Remove trailing whitespaces in snippets in inline math").setDesc("Whether to remove trailing whitespaces when expanding snippets at the end of inline math blocks.").addToggle((toggle) => toggle.setValue(this.plugin.settings.removeSnippetWhitespace).onChange((value) => __async(this, null, function* () {
|
|
this.plugin.settings.removeSnippetWhitespace = value;
|
|
yield this.plugin.saveSettings();
|
|
})));
|
|
new import_obsidian4.Setting(containerEl).setName("Code languages to interpret as math mode").setDesc("Codeblock languages where the whole code block should be treated like a math block, separated by commas.").addText((text) => text.setPlaceholder(DEFAULT_SETTINGS.forceMathLanguages).setValue(this.plugin.settings.forceMathLanguages).onChange((value) => __async(this, null, function* () {
|
|
this.plugin.settings.forceMathLanguages = value;
|
|
yield this.plugin.saveSettings();
|
|
})));
|
|
}
|
|
createSnippetsEditor(snippetsSetting) {
|
|
const customCSSWrapper = snippetsSetting.controlEl.createDiv("snippets-editor-wrapper");
|
|
const snippetsFooter = snippetsSetting.controlEl.createDiv("snippets-footer");
|
|
const validity = snippetsFooter.createDiv("snippets-editor-validity");
|
|
const validityIndicator = new import_obsidian4.ExtraButtonComponent(validity);
|
|
validityIndicator.setIcon("checkmark").extraSettingsEl.addClass("snippets-editor-validity-indicator");
|
|
const validityText = validity.createDiv("snippets-editor-validity-text");
|
|
validityText.addClass("setting-item-description");
|
|
validityText.style.padding = "0";
|
|
function updateValidityIndicator(success) {
|
|
validityIndicator.setIcon(success ? "checkmark" : "cross");
|
|
validityIndicator.extraSettingsEl.removeClass(success ? "invalid" : "valid");
|
|
validityIndicator.extraSettingsEl.addClass(success ? "valid" : "invalid");
|
|
validityText.setText(success ? "Saved" : "Invalid syntax. Changes not saved");
|
|
}
|
|
const extensions = basicSetup;
|
|
const change = import_view4.EditorView.updateListener.of((v) => __async(this, null, function* () {
|
|
if (v.docChanged) {
|
|
const value = v.state.doc.toString();
|
|
let success = true;
|
|
const snippetVariables = getSnippetVariables(this.plugin.settings.snippetVariables);
|
|
try {
|
|
yield parseSnippets(value, snippetVariables);
|
|
} catch (e) {
|
|
success = false;
|
|
}
|
|
updateValidityIndicator(success);
|
|
if (!success)
|
|
return;
|
|
this.plugin.settings.snippets = value;
|
|
yield this.plugin.saveSettings();
|
|
}
|
|
}));
|
|
extensions.push(change);
|
|
this.snippetsEditor = createCMEditor(this.plugin.settings.snippets, extensions);
|
|
customCSSWrapper.appendChild(this.snippetsEditor.dom);
|
|
const buttonsDiv = snippetsFooter.createDiv("snippets-editor-buttons");
|
|
const reset = new import_obsidian4.ButtonComponent(buttonsDiv);
|
|
reset.setIcon("switch").setTooltip("Reset to default snippets").onClick(() => __async(this, null, function* () {
|
|
new ConfirmationModal(this.plugin.app, "Are you sure? This will delete any custom snippets you have written.", (button) => button.setButtonText("Reset to default snippets").setWarning(), () => __async(this, null, function* () {
|
|
this.snippetsEditor.setState(import_state3.EditorState.create({ doc: DEFAULT_SNIPPETS, extensions }));
|
|
updateValidityIndicator(true);
|
|
this.plugin.settings.snippets = DEFAULT_SNIPPETS;
|
|
yield this.plugin.saveSettings();
|
|
})).open();
|
|
}));
|
|
const remove = new import_obsidian4.ButtonComponent(buttonsDiv);
|
|
remove.setIcon("trash").setTooltip("Remove all snippets").onClick(() => __async(this, null, function* () {
|
|
new ConfirmationModal(this.plugin.app, "Are you sure? This will delete any custom snippets you have written.", (button) => button.setButtonText("Remove all snippets").setWarning(), () => __async(this, null, function* () {
|
|
const value = `[
|
|
|
|
]`;
|
|
this.snippetsEditor.setState(import_state3.EditorState.create({ doc: value, extensions }));
|
|
updateValidityIndicator(true);
|
|
this.plugin.settings.snippets = value;
|
|
yield this.plugin.saveSettings();
|
|
})).open();
|
|
}));
|
|
}
|
|
};
|
|
var ConfirmationModal = class extends import_obsidian4.Modal {
|
|
constructor(app, body, buttonCallback, clickCallback) {
|
|
super(app);
|
|
this.contentEl.addClass("latex-suite-confirmation-modal");
|
|
this.contentEl.createEl("p", { text: body });
|
|
new import_obsidian4.Setting(this.contentEl).addButton((button) => {
|
|
buttonCallback(button);
|
|
button.onClick(() => __async(this, null, function* () {
|
|
yield clickCallback();
|
|
this.close();
|
|
}));
|
|
}).addButton((button) => button.setButtonText("Cancel").onClick(() => this.close()));
|
|
}
|
|
};
|
|
function createCMEditor(content, extensions) {
|
|
const view = new import_view4.EditorView({
|
|
state: import_state3.EditorState.create({ doc: content, extensions })
|
|
});
|
|
return view;
|
|
}
|
|
|
|
// src/settings/ui/icons.ts
|
|
var ICONS = {
|
|
"math": `<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-math" width="100" height="100" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
|
|
<path d="M19 5h-7l-4 14l-3 -6h-2"></path>
|
|
<path d="M14 13l6 6"></path>
|
|
<path d="M14 19l6 -6"></path>
|
|
</svg>`,
|
|
"math-x-divide-y-2": `<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-math-x-divide-y-2" width="100" height="100" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
|
|
<path d="M3 21l18 -18"></path>
|
|
<path d="M15 14l3 4.5"></path>
|
|
<path d="M21 14l-4.5 7"></path>
|
|
<path d="M3 4l6 6"></path>
|
|
<path d="M3 10l6 -6"></path>
|
|
</svg>`,
|
|
"parentheses": `<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-parentheses" width="100" height="100" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
|
|
<path d="M7 4a12.25 12.25 0 0 0 0 16"></path>
|
|
<path d="M17 4a12.25 12.25 0 0 1 0 16"></path>
|
|
</svg>`,
|
|
"math-function": `<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-math-function" width="100" height="100" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
|
|
<path d="M3 19a2 2 0 0 0 2 2c2 0 2 -4 3 -9s1 -9 3 -9a2 2 0 0 1 2 2"></path>
|
|
<path d="M5 12h6"></path>
|
|
<path d="M15 12l6 6"></path>
|
|
<path d="M15 18l6 -6"></path>
|
|
</svg>`,
|
|
"math-integral-x": `<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-math-integral-x" width="100" height="100" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
|
|
<path d="M3 19a2 2 0 0 0 2 2c2 0 2 -4 3 -9s1 -9 3 -9a2 2 0 0 1 2 2"></path>
|
|
<path d="M14 12l6 6"></path>
|
|
<path d="M14 18l6 -6"></path>
|
|
</svg>`,
|
|
"brackets-contain": `<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-brackets-contain" width="100" height="100" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
|
|
<path d="M7 4h-4v16h4"></path>
|
|
<path d="M17 4h4v16h-4"></path>
|
|
<path d="M8 16h.01"></path>
|
|
<path d="M12 16h.01"></path>
|
|
<path d="M16 16h.01"></path>
|
|
</svg>`,
|
|
"code-dots": `<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-code-dots" width="100" height="100" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
|
|
<path d="M15 12h.01"></path>
|
|
<path d="M12 12h.01"></path>
|
|
<path d="M9 12h.01"></path>
|
|
<path d="M6 19a2 2 0 0 1 -2 -2v-4l-1 -1l1 -1v-4a2 2 0 0 1 2 -2"></path>
|
|
<path d="M18 19a2 2 0 0 0 2 -2v-4l1 -1l-1 -1v-4a2 2 0 0 0 -2 -2"></path>
|
|
</svg>`,
|
|
"ballpen": `<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-ballpen" width="100" height="100" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
|
|
<path d="M14 6l7 7l-4 4"></path>
|
|
<path d="M5.828 18.172a2.828 2.828 0 0 0 4 0l10.586 -10.586a2 2 0 0 0 0 -2.829l-1.171 -1.171a2 2 0 0 0 -2.829 0l-10.586 10.586a2.828 2.828 0 0 0 0 4z"></path>
|
|
<path d="M4 20l1.768 -1.768"></path>
|
|
</svg>`,
|
|
"superscript": `<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-superscript" width="100" height="100" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
|
|
<path d="M5 7l8 10m-8 0l8 -10"></path>
|
|
<path d="M21 11h-4l3.5 -4a1.73 1.73 0 0 0 -3.5 -2"></path>
|
|
</svg>`,
|
|
"tabout": `<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 10.583 10.583">
|
|
<g style="fill:none;stroke:currentColor;stroke-width:3.22892904;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none">
|
|
<path d="M14.818 22.164h-.688c-1.52 0-3.983-1.82-3.983-4.066V-.612c0-2.245 2.462-4.065 3.983-4.065h.688" style="stroke-width:3.22892904;stroke-miterlimit:4;stroke-dasharray:none" transform="translate(6.566 2.931) scale(.24373)"/>
|
|
<path d="M5.605 22.16h.662c1.462 0 3.88-1.906 3.88-4.258v-1.065M5.605-4.674h.662c1.462 0 3.88 1.907 3.88 4.259V.65" style="stroke-width:3.22892904;stroke-miterlimit:4;stroke-dasharray:none" transform="translate(6.566 2.931) scale(.24373)"/>
|
|
</g>
|
|
<g style="fill:none;stroke:currentColor;stroke-width:3.22892904;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none">
|
|
<path d="M0 0h24v24H0Z" style="fill:none;stroke:none;stroke-width:3.22892904;stroke-miterlimit:4;stroke-dasharray:none" transform="translate(2.662 4.719) scale(.24373)" stroke="none"/>
|
|
<path d="M-9.136 8.694v5.17a1 1 0 0 0 1 1h23.658a1 1 0 0 0 1-1v-5.17" style="stroke-width:3.22892904;stroke-miterlimit:4;stroke-dasharray:none" transform="translate(2.662 4.719) scale(.24373)"/>
|
|
</g>
|
|
</svg>
|
|
`
|
|
};
|
|
|
|
// src/utils/editor_utils.ts
|
|
var import_obsidian5 = __toModule(require("obsidian"));
|
|
var import_view5 = __toModule(require("@codemirror/view"));
|
|
function replaceRange(view, start2, end2, replacement) {
|
|
view.dispatch({
|
|
changes: { from: start2, to: end2, insert: replacement }
|
|
});
|
|
}
|
|
function iterateCM6(workspace, callback) {
|
|
workspace.iterateAllLeaves((leaf) => {
|
|
var _a;
|
|
(leaf == null ? void 0 : leaf.view) instanceof import_obsidian5.MarkdownView && ((_a = leaf.view.editor) == null ? void 0 : _a.cm) instanceof import_view5.EditorView && callback(leaf.view.editor.cm);
|
|
});
|
|
}
|
|
function getCharacterAtPos(view, pos) {
|
|
const doc = view.state.doc;
|
|
return doc.slice(pos, pos + 1).toString();
|
|
}
|
|
function setCursor(view, pos) {
|
|
view.dispatch({
|
|
selection: { anchor: pos, head: pos }
|
|
});
|
|
resetCursorBlink();
|
|
}
|
|
function setSelection(view, start2, end2) {
|
|
view.dispatch({
|
|
selection: { anchor: start2, head: end2 }
|
|
});
|
|
resetCursorBlink();
|
|
}
|
|
function resetCursorBlink() {
|
|
if (import_obsidian5.Platform.isMobile)
|
|
return;
|
|
const cursorLayer = document.getElementsByClassName("cm-cursorLayer")[0];
|
|
if (cursorLayer) {
|
|
const curAnim = cursorLayer.style.animationName;
|
|
cursorLayer.style.animationName = curAnim === "cm-blink" ? "cm-blink2" : "cm-blink";
|
|
}
|
|
}
|
|
function reverse(s) {
|
|
return s.split("").reverse().join("");
|
|
}
|
|
function findMatchingBracket(text, start2, openBracket, closeBracket, searchBackwards, end2) {
|
|
if (searchBackwards) {
|
|
const reversedIndex = findMatchingBracket(reverse(text), text.length - (start2 + closeBracket.length), reverse(closeBracket), reverse(openBracket), false);
|
|
if (reversedIndex === -1)
|
|
return -1;
|
|
return text.length - (reversedIndex + openBracket.length);
|
|
}
|
|
let brackets2 = 0;
|
|
const stop = end2 ? end2 : text.length;
|
|
for (let i = start2; i < stop; i++) {
|
|
if (text.slice(i, i + openBracket.length) === openBracket) {
|
|
brackets2++;
|
|
} else if (text.slice(i, i + closeBracket.length) === closeBracket) {
|
|
brackets2--;
|
|
if (brackets2 === 0) {
|
|
return i;
|
|
}
|
|
}
|
|
}
|
|
return -1;
|
|
}
|
|
function getOpenBracket(closeBracket) {
|
|
const openBrackets = { ")": "(", "]": "[", "}": "{" };
|
|
return openBrackets[closeBracket];
|
|
}
|
|
function getCloseBracket(openBracket) {
|
|
const closeBrackets2 = { "(": ")", "[": "]", "{": "}" };
|
|
return closeBrackets2[openBracket];
|
|
}
|
|
var Direction;
|
|
(function(Direction2) {
|
|
Direction2[Direction2["Backward"] = 0] = "Backward";
|
|
Direction2[Direction2["Forward"] = 1] = "Forward";
|
|
})(Direction || (Direction = {}));
|
|
function escalateToToken(cursor, dir, target) {
|
|
if (cursor.name.contains(target)) {
|
|
return cursor.node;
|
|
}
|
|
while (cursor.name != "Document" && (dir == 0 && cursor.prev() || dir == 1 && cursor.next() || cursor.parent())) {
|
|
if (cursor.name.contains(target)) {
|
|
return cursor.node;
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
|
|
// src/utils/context.ts
|
|
var import_view7 = __toModule(require("@codemirror/view"));
|
|
|
|
// src/snippets/codemirror/config.ts
|
|
var import_view6 = __toModule(require("@codemirror/view"));
|
|
var import_state4 = __toModule(require("@codemirror/state"));
|
|
var latexSuiteConfig = import_state4.Facet.define({
|
|
combine: (input) => {
|
|
const settings = input.length > 0 ? input[0] : processLatexSuiteSettings([], DEFAULT_SETTINGS);
|
|
return settings;
|
|
}
|
|
});
|
|
function getLatexSuiteConfig(viewOrState) {
|
|
const state = viewOrState instanceof import_view6.EditorView ? viewOrState.state : viewOrState;
|
|
return state.facet(latexSuiteConfig);
|
|
}
|
|
var latexSuiteConfigCompartment = new import_state4.Compartment();
|
|
function getLatexSuiteConfigExtension(pluginSettings) {
|
|
return latexSuiteConfigCompartment.of(latexSuiteConfig.of(pluginSettings));
|
|
}
|
|
function reconfigureLatexSuiteConfig(pluginSettings) {
|
|
return latexSuiteConfigCompartment.reconfigure(latexSuiteConfig.of(pluginSettings));
|
|
}
|
|
|
|
// src/utils/context.ts
|
|
var import_language4 = __toModule(require("@codemirror/language"));
|
|
var Context = class {
|
|
static fromState(state) {
|
|
const ctx = new Context();
|
|
const sel = state.selection;
|
|
ctx.state = state;
|
|
ctx.pos = sel.main.to;
|
|
ctx.ranges = Array.from(sel.ranges).reverse();
|
|
ctx.mode = new Mode();
|
|
ctx.boundsCache = new Map();
|
|
const codeblockLanguage = langIfWithinCodeblock(state);
|
|
const inCode = codeblockLanguage !== null;
|
|
const settings = getLatexSuiteConfig(state);
|
|
const forceMath = settings.forceMathLanguages.contains(codeblockLanguage);
|
|
ctx.mode.codeMath = forceMath;
|
|
ctx.mode.code = inCode && !forceMath;
|
|
if (ctx.mode.code)
|
|
ctx.codeblockLanguage = codeblockLanguage;
|
|
const inMath = forceMath || isWithinEquation(state);
|
|
if (inMath && !forceMath) {
|
|
const inInlineEquation = isWithinInlineEquation(state);
|
|
ctx.mode.blockMath = !inInlineEquation;
|
|
ctx.mode.inlineMath = inInlineEquation;
|
|
}
|
|
if (inMath) {
|
|
ctx.mode.textEnv = ctx.inTextEnvironment();
|
|
}
|
|
ctx.mode.text = !inCode && !inMath;
|
|
return ctx;
|
|
}
|
|
static fromView(view) {
|
|
return Context.fromState(view.state);
|
|
}
|
|
isWithinEnvironment(pos, env) {
|
|
if (!this.mode.inMath())
|
|
return false;
|
|
const bounds = this.getInnerBounds();
|
|
if (!bounds)
|
|
return;
|
|
const { start: start2, end: end2 } = bounds;
|
|
const text = this.state.sliceDoc(start2, end2);
|
|
pos -= start2;
|
|
const openBracket = env.openSymbol.slice(-1);
|
|
const closeBracket = getCloseBracket(openBracket);
|
|
let offset2;
|
|
let openSearchSymbol;
|
|
if (["{", "[", "("].contains(openBracket) && env.closeSymbol === closeBracket) {
|
|
offset2 = env.openSymbol.length - 1;
|
|
openSearchSymbol = openBracket;
|
|
} else {
|
|
offset2 = 0;
|
|
openSearchSymbol = env.openSymbol;
|
|
}
|
|
let left2 = text.lastIndexOf(env.openSymbol, pos - 1);
|
|
while (left2 != -1) {
|
|
const right2 = findMatchingBracket(text, left2 + offset2, openSearchSymbol, env.closeSymbol, false);
|
|
if (right2 === -1)
|
|
return false;
|
|
if (right2 >= pos && pos >= left2 + env.openSymbol.length) {
|
|
return true;
|
|
}
|
|
if (left2 <= 0)
|
|
return false;
|
|
left2 = text.lastIndexOf(env.openSymbol, left2 - 1);
|
|
}
|
|
return false;
|
|
}
|
|
inTextEnvironment() {
|
|
return this.isWithinEnvironment(this.pos, { openSymbol: "\\text{", closeSymbol: "}" }) || this.isWithinEnvironment(this.pos, { openSymbol: "\\tag{", closeSymbol: "}" }) || this.isWithinEnvironment(this.pos, { openSymbol: "\\begin{", closeSymbol: "}" }) || this.isWithinEnvironment(this.pos, { openSymbol: "\\end{", closeSymbol: "}" });
|
|
}
|
|
getBounds(pos = this.pos) {
|
|
if (this.boundsCache.has(pos)) {
|
|
return this.boundsCache.get(pos);
|
|
}
|
|
let bounds;
|
|
if (this.mode.codeMath) {
|
|
bounds = getCodeblockBounds(this.state, pos);
|
|
} else {
|
|
bounds = getEquationBounds(this.state);
|
|
}
|
|
this.boundsCache.set(pos, bounds);
|
|
return bounds;
|
|
}
|
|
getInnerBounds(pos = this.pos) {
|
|
let bounds;
|
|
if (this.mode.codeMath) {
|
|
bounds = getCodeblockBounds(this.state, pos);
|
|
} else {
|
|
bounds = getInnerEquationBounds(this.state);
|
|
}
|
|
return bounds;
|
|
}
|
|
};
|
|
var isWithinEquation = (state) => {
|
|
const pos = state.selection.main.to;
|
|
const tree = (0, import_language4.syntaxTree)(state);
|
|
let syntaxNode = tree.resolveInner(pos, -1);
|
|
if (syntaxNode.name.contains("math-end"))
|
|
return false;
|
|
if (!syntaxNode.parent) {
|
|
syntaxNode = tree.resolveInner(pos, 1);
|
|
if (syntaxNode.name.contains("math-begin"))
|
|
return false;
|
|
}
|
|
if (!syntaxNode.parent) {
|
|
const left2 = tree.resolveInner(pos - 1, -1);
|
|
const right2 = tree.resolveInner(pos + 1, 1);
|
|
return left2.name.contains("math") && right2.name.contains("math") && !left2.name.contains("math-end");
|
|
}
|
|
return syntaxNode.name.contains("math");
|
|
};
|
|
var isWithinInlineEquation = (state) => {
|
|
const pos = state.selection.main.to;
|
|
const tree = (0, import_language4.syntaxTree)(state);
|
|
let syntaxNode = tree.resolveInner(pos, -1);
|
|
if (syntaxNode.name.contains("math-end"))
|
|
return false;
|
|
if (!syntaxNode.parent) {
|
|
syntaxNode = tree.resolveInner(pos, 1);
|
|
if (syntaxNode.name.contains("math-begin"))
|
|
return false;
|
|
}
|
|
if (!syntaxNode.parent)
|
|
syntaxNode = tree.resolveInner(pos - 1, -1);
|
|
const cursor = syntaxNode.cursor();
|
|
const res = escalateToToken(cursor, Direction.Backward, "math-begin");
|
|
return !(res == null ? void 0 : res.name.contains("math-block"));
|
|
};
|
|
var getEquationBounds = (state, pos) => {
|
|
if (!pos)
|
|
pos = state.selection.main.to;
|
|
const tree = (0, import_language4.syntaxTree)(state);
|
|
let syntaxNode = tree.resolveInner(pos, -1);
|
|
if (!syntaxNode.parent) {
|
|
syntaxNode = tree.resolveInner(pos, 1);
|
|
}
|
|
if (!syntaxNode.parent)
|
|
syntaxNode = tree.resolveInner(pos - 1, -1);
|
|
const cursor = syntaxNode.cursor();
|
|
const begin = escalateToToken(cursor, Direction.Backward, "math-begin");
|
|
const end2 = escalateToToken(cursor, Direction.Forward, "math-end");
|
|
if (begin && end2) {
|
|
return { start: begin.to, end: end2.from };
|
|
} else {
|
|
return null;
|
|
}
|
|
};
|
|
var getInnerEquationBounds = (state, pos) => {
|
|
if (!pos)
|
|
pos = state.selection.main.to;
|
|
let text = state.doc.toString();
|
|
text = text.replaceAll("\\$", "\\R");
|
|
const left2 = text.lastIndexOf("$", pos - 1);
|
|
const right2 = text.indexOf("$", pos);
|
|
if (left2 === -1 || right2 === -1)
|
|
return null;
|
|
return { start: left2 + 1, end: right2 };
|
|
};
|
|
var getCodeblockBounds = (state, pos = state.selection.main.from) => {
|
|
const tree = (0, import_language4.syntaxTree)(state);
|
|
let cursor = tree.cursorAt(pos, -1);
|
|
const blockBegin = escalateToToken(cursor, Direction.Backward, "HyperMD-codeblock-begin");
|
|
cursor = tree.cursorAt(pos, -1);
|
|
const blockEnd = escalateToToken(cursor, Direction.Forward, "HyperMD-codeblock-end");
|
|
return { start: blockBegin.to + 1, end: blockEnd.from - 1 };
|
|
};
|
|
var langIfWithinCodeblock = (view) => {
|
|
const state = view instanceof import_view7.EditorView ? view.state : view;
|
|
const tree = (0, import_language4.syntaxTree)(state);
|
|
const pos = state.selection.ranges[0].from;
|
|
const inCodeblock = tree.resolveInner(pos, -1).name.contains("codeblock");
|
|
if (!inCodeblock) {
|
|
return null;
|
|
}
|
|
const cursor = tree.cursorAt(pos, -1);
|
|
const codeblockBegin = escalateToToken(cursor, Direction.Backward, "HyperMD-codeblock_HyperMD-codeblock-begin");
|
|
if (codeblockBegin == null) {
|
|
console.warn("unable to locate start of the codeblock even though inside one");
|
|
return "";
|
|
}
|
|
const language = state.sliceDoc(codeblockBegin.from, codeblockBegin.to).replace(/`+/, "");
|
|
return language;
|
|
};
|
|
|
|
// src/features/editor_commands.ts
|
|
function boxCurrentEquation(view) {
|
|
const ctx = Context.fromView(view);
|
|
const result = ctx.getBounds();
|
|
if (!result)
|
|
return false;
|
|
const { start: start2, end: end2 } = result;
|
|
let equation = "\\boxed{" + view.state.sliceDoc(start2, end2) + "}";
|
|
const insideBlockEqn = view.state.sliceDoc(start2 - 2, start2) === "$$" && view.state.sliceDoc(end2, end2 + 2) === "$$";
|
|
if (insideBlockEqn)
|
|
equation = "\n" + equation + "\n";
|
|
const pos = view.state.selection.main.to;
|
|
replaceRange(view, start2, end2, equation);
|
|
setCursor(view, pos + "\\boxed{".length + (insideBlockEqn ? 1 : 0));
|
|
}
|
|
function getBoxEquationCommand() {
|
|
return {
|
|
id: "latex-suite-box-equation",
|
|
name: "Box current equation",
|
|
editorCheckCallback: (checking, editor) => {
|
|
const view = editor.cm;
|
|
const ctx = Context.fromView(view);
|
|
const withinEquation = ctx.mode.inMath();
|
|
if (checking)
|
|
return withinEquation;
|
|
if (!withinEquation)
|
|
return;
|
|
boxCurrentEquation(view);
|
|
return;
|
|
}
|
|
};
|
|
}
|
|
function getSelectEquationCommand() {
|
|
return {
|
|
id: "latex-suite-select-equation",
|
|
name: "Select current equation",
|
|
editorCheckCallback: (checking, editor) => {
|
|
const view = editor.cm;
|
|
const ctx = Context.fromView(view);
|
|
const withinEquation = ctx.mode.inMath();
|
|
if (checking)
|
|
return withinEquation;
|
|
if (!withinEquation)
|
|
return;
|
|
const result = ctx.getBounds();
|
|
if (!result)
|
|
return false;
|
|
let { start: start2, end: end2 } = result;
|
|
const doc = view.state.doc.toString();
|
|
if (doc.charAt(start2) === "\n")
|
|
start2++;
|
|
if (doc.charAt(end2 - 1) === "\n")
|
|
end2--;
|
|
setSelection(view, start2, end2);
|
|
return;
|
|
}
|
|
};
|
|
}
|
|
function getEnableAllFeaturesCommand(plugin) {
|
|
return {
|
|
id: "latex-suite-enable-all-features",
|
|
name: "Enable all features",
|
|
callback: () => __async(this, null, function* () {
|
|
plugin.settings.snippetsEnabled = true;
|
|
plugin.settings.autofractionEnabled = true;
|
|
plugin.settings.matrixShortcutsEnabled = true;
|
|
plugin.settings.taboutEnabled = true;
|
|
plugin.settings.autoEnlargeBrackets = true;
|
|
yield plugin.saveSettings();
|
|
})
|
|
};
|
|
}
|
|
function getDisableAllFeaturesCommand(plugin) {
|
|
return {
|
|
id: "latex-suite-disable-all-features",
|
|
name: "Disable all features",
|
|
callback: () => __async(this, null, function* () {
|
|
plugin.settings.snippetsEnabled = false;
|
|
plugin.settings.autofractionEnabled = false;
|
|
plugin.settings.matrixShortcutsEnabled = false;
|
|
plugin.settings.taboutEnabled = false;
|
|
plugin.settings.autoEnlargeBrackets = false;
|
|
yield plugin.saveSettings();
|
|
})
|
|
};
|
|
}
|
|
var getEditorCommands = (plugin) => {
|
|
return [
|
|
getBoxEquationCommand(),
|
|
getSelectEquationCommand(),
|
|
getEnableAllFeaturesCommand(plugin),
|
|
getDisableAllFeaturesCommand(plugin)
|
|
];
|
|
};
|
|
|
|
// src/latex_suite.ts
|
|
var import_state13 = __toModule(require("@codemirror/state"));
|
|
var import_view13 = __toModule(require("@codemirror/view"));
|
|
|
|
// src/snippets/codemirror/snippet_queue_state_field.ts
|
|
var import_state5 = __toModule(require("@codemirror/state"));
|
|
|
|
// src/snippets/codemirror/snippet_change_spec.ts
|
|
var SnippetChangeSpec = class {
|
|
constructor(from, to, insert, keyPressed) {
|
|
this.from = from;
|
|
this.to = to;
|
|
this.insert = insert;
|
|
this.keyPressed = keyPressed;
|
|
}
|
|
getTabstops(view, start2) {
|
|
const tabstops = [];
|
|
const text = view.state.doc.toString();
|
|
for (let i = start2; i < start2 + this.insert.length; i++) {
|
|
if (!(text.charAt(i) === "$")) {
|
|
continue;
|
|
}
|
|
let number2 = parseInt(text.charAt(i + 1));
|
|
const tabstopStart = i;
|
|
let tabstopEnd = tabstopStart + 2;
|
|
let tabstopReplacement = "";
|
|
if (isNaN(number2)) {
|
|
if (!(text.charAt(i + 1) === "{"))
|
|
continue;
|
|
const closingIndex = findMatchingBracket(text, i + 1, "{", "}", false, start2 + this.insert.length);
|
|
const tabstopString = text.slice(i, closingIndex + 1);
|
|
if (!tabstopString.includes(":"))
|
|
continue;
|
|
const colonIndex = tabstopString.indexOf(":");
|
|
number2 = parseInt(tabstopString.slice(2, colonIndex));
|
|
if (isNaN(number2))
|
|
continue;
|
|
if (closingIndex === -1)
|
|
continue;
|
|
tabstopReplacement = text.slice(i + colonIndex + 1, closingIndex);
|
|
tabstopEnd = closingIndex + 1;
|
|
i = closingIndex;
|
|
}
|
|
const tabstop = { number: number2, from: tabstopStart, to: tabstopEnd, replacement: tabstopReplacement };
|
|
tabstops.push(tabstop);
|
|
}
|
|
return tabstops;
|
|
}
|
|
toChangeSpec() {
|
|
return this;
|
|
}
|
|
};
|
|
|
|
// src/snippets/codemirror/snippet_queue_state_field.ts
|
|
var queueSnippetEffect = import_state5.StateEffect.define();
|
|
var clearSnippetQueueEffect = import_state5.StateEffect.define();
|
|
var snippetQueueStateField = import_state5.StateField.define({
|
|
create() {
|
|
return [];
|
|
},
|
|
update(oldState, transaction) {
|
|
let snippetQueue = oldState;
|
|
for (const effect4 of transaction.effects) {
|
|
if (effect4.is(queueSnippetEffect)) {
|
|
snippetQueue.push(effect4.value);
|
|
} else if (effect4.is(clearSnippetQueueEffect)) {
|
|
snippetQueue = [];
|
|
}
|
|
}
|
|
return snippetQueue;
|
|
}
|
|
});
|
|
function queueSnippet(view, from, to, insert, keyPressed) {
|
|
const snippet = new SnippetChangeSpec(from, to, insert, keyPressed);
|
|
view.dispatch({
|
|
effects: [queueSnippetEffect.of(snippet)]
|
|
});
|
|
}
|
|
function clearSnippetQueue(view) {
|
|
view.dispatch({
|
|
effects: [clearSnippetQueueEffect.of(null)]
|
|
});
|
|
}
|
|
|
|
// src/snippets/snippet_management.ts
|
|
var import_state9 = __toModule(require("@codemirror/state"));
|
|
|
|
// src/snippets/codemirror/history.ts
|
|
var import_state7 = __toModule(require("@codemirror/state"));
|
|
var import_commands2 = __toModule(require("@codemirror/commands"));
|
|
|
|
// src/snippets/codemirror/tabstops_state_field.ts
|
|
var import_view8 = __toModule(require("@codemirror/view"));
|
|
var import_state6 = __toModule(require("@codemirror/state"));
|
|
var addTabstopsEffect = import_state6.StateEffect.define();
|
|
var filterTabstopsEffect = import_state6.StateEffect.define();
|
|
var removeTabstopEffect = import_state6.StateEffect.define();
|
|
var removeAllTabstopsEffect = import_state6.StateEffect.define();
|
|
var tabstopsStateField = import_state6.StateField.define({
|
|
create() {
|
|
return [];
|
|
},
|
|
update(value, transaction) {
|
|
let tabstopGroups = value;
|
|
tabstopGroups.forEach((grp) => grp.map(transaction.changes));
|
|
for (const effect4 of transaction.effects) {
|
|
if (effect4.is(addTabstopsEffect)) {
|
|
tabstopGroups.unshift(...effect4.value);
|
|
} else if (effect4.is(filterTabstopsEffect)) {
|
|
tabstopGroups = tabstopGroups.filter((value2) => {
|
|
return value2.decos.size != 0;
|
|
});
|
|
const editorSel = effect4.value;
|
|
tabstopGroups.forEach((value2) => {
|
|
if (editorSel.eq(value2.toEditorSelection())) {
|
|
value2.hideFromEditor();
|
|
}
|
|
});
|
|
} else if (effect4.is(removeTabstopEffect)) {
|
|
tabstopGroups.shift();
|
|
} else if (effect4.is(removeAllTabstopsEffect)) {
|
|
tabstopGroups = [];
|
|
}
|
|
}
|
|
return tabstopGroups;
|
|
},
|
|
provide: (field) => {
|
|
return import_view8.EditorView.decorations.of((view) => {
|
|
const tabstopGroups = view.state.field(field);
|
|
const decos = [];
|
|
for (const tabstopGroup of tabstopGroups) {
|
|
if (!tabstopGroup.hidden)
|
|
decos.push(...tabstopGroup.getRanges());
|
|
}
|
|
return import_view8.Decoration.set(decos, true);
|
|
});
|
|
}
|
|
});
|
|
function getTabstopGroupsFromView(view) {
|
|
const currentTabstopGroups = view.state.field(tabstopsStateField);
|
|
return currentTabstopGroups;
|
|
}
|
|
function addTabstops(view, tabstopGroups) {
|
|
view.dispatch({
|
|
effects: [addTabstopsEffect.of(tabstopGroups)]
|
|
});
|
|
}
|
|
function filterTabstops(view) {
|
|
view.dispatch({
|
|
effects: [filterTabstopsEffect.of(view.state.selection)]
|
|
});
|
|
}
|
|
function removeTabstop(view) {
|
|
view.dispatch({
|
|
effects: [removeTabstopEffect.of(null)]
|
|
});
|
|
}
|
|
function removeAllTabstops(view) {
|
|
view.dispatch({
|
|
effects: [removeAllTabstopsEffect.of(null)]
|
|
});
|
|
}
|
|
var N_COLORS = 7;
|
|
function getNextTabstopColor(view) {
|
|
const field = view.state.field(tabstopsStateField);
|
|
const existingColors = field.map((tabstopGroup) => tabstopGroup.color);
|
|
const uniqueExistingColors = new Set(existingColors);
|
|
for (let i = 0; i < N_COLORS; i++) {
|
|
if (!uniqueExistingColors.has(i))
|
|
return i;
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
// src/snippets/codemirror/history.ts
|
|
var startSnippet = import_state7.StateEffect.define();
|
|
var endSnippet = import_state7.StateEffect.define();
|
|
var undidStartSnippet = import_state7.StateEffect.define();
|
|
var undidEndSnippet = import_state7.StateEffect.define();
|
|
var snippetInvertedEffects = import_commands2.invertedEffects.of((tr) => {
|
|
const effects = [];
|
|
for (const effect4 of tr.effects) {
|
|
if (effect4.is(startSnippet)) {
|
|
effects.push(undidStartSnippet.of(null));
|
|
} else if (effect4.is(undidStartSnippet)) {
|
|
effects.push(startSnippet.of(null));
|
|
} else if (effect4.is(endSnippet)) {
|
|
effects.push(undidEndSnippet.of(null));
|
|
} else if (effect4.is(undidEndSnippet)) {
|
|
effects.push(endSnippet.of(null));
|
|
}
|
|
}
|
|
return effects;
|
|
});
|
|
var handleUndoRedo = (update) => {
|
|
const undoTr = update.transactions.find((tr) => tr.isUserEvent("undo"));
|
|
const redoTr = update.transactions.find((tr) => tr.isUserEvent("redo"));
|
|
for (const tr of update.transactions) {
|
|
for (const effect4 of tr.effects) {
|
|
if (effect4.is(startSnippet)) {
|
|
if (redoTr) {
|
|
(0, import_commands2.redo)(update.view);
|
|
}
|
|
} else if (effect4.is(undidEndSnippet)) {
|
|
if (undoTr) {
|
|
(0, import_commands2.undo)(update.view);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (undoTr) {
|
|
removeAllTabstops(update.view);
|
|
}
|
|
};
|
|
|
|
// src/snippets/snippet_management.ts
|
|
var import_commands3 = __toModule(require("@codemirror/commands"));
|
|
|
|
// src/snippets/tabstop.ts
|
|
var import_state8 = __toModule(require("@codemirror/state"));
|
|
var import_view9 = __toModule(require("@codemirror/view"));
|
|
var LATEX_SUITE_TABSTOP_DECO_CLASS = "latex-suite-snippet-placeholder";
|
|
function getMarkerDecoration(from, to, color) {
|
|
const className = `${LATEX_SUITE_TABSTOP_DECO_CLASS} ${LATEX_SUITE_TABSTOP_DECO_CLASS}-${color}`;
|
|
return import_view9.Decoration.mark({
|
|
inclusive: true,
|
|
color,
|
|
class: className
|
|
}).range(from, to);
|
|
}
|
|
var TabstopGroup = class {
|
|
constructor(tabstopSpecs, color) {
|
|
const decos = tabstopSpecs.map((spec) => getMarkerDecoration(spec.from, spec.to, color));
|
|
this.decos = import_view9.Decoration.set(decos, true);
|
|
this.color = color;
|
|
this.hidden = false;
|
|
}
|
|
select(view, selectEndpoints, isEndSnippet) {
|
|
const sel = this.toEditorSelection();
|
|
const toSelect = selectEndpoints ? getEditorSelectionEndpoints(sel) : sel;
|
|
view.dispatch({
|
|
selection: toSelect,
|
|
effects: isEndSnippet ? endSnippet.of(null) : null
|
|
});
|
|
resetCursorBlink();
|
|
this.hideFromEditor();
|
|
}
|
|
toSelectionRanges() {
|
|
const ranges = [];
|
|
const cur = this.decos.iter();
|
|
while (cur.value != null) {
|
|
ranges.push(import_state8.EditorSelection.range(cur.from, cur.to));
|
|
cur.next();
|
|
}
|
|
return ranges;
|
|
}
|
|
toEditorSelection() {
|
|
return import_state8.EditorSelection.create(this.toSelectionRanges());
|
|
}
|
|
containsSelection(selection) {
|
|
function rangeLiesWithinSelection(range, sel) {
|
|
for (const selRange of sel) {
|
|
if (selRange.from <= range.from && selRange.to >= range.to) {
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
const tabstopRanges = this.toSelectionRanges();
|
|
let result = true;
|
|
for (const range of selection.ranges) {
|
|
if (!rangeLiesWithinSelection(range, tabstopRanges)) {
|
|
result = false;
|
|
break;
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
hideFromEditor() {
|
|
this.hidden = true;
|
|
}
|
|
map(changes) {
|
|
this.decos = this.decos.map(changes);
|
|
}
|
|
getRanges() {
|
|
const ranges = [];
|
|
const cur = this.decos.iter();
|
|
while (cur.value != null) {
|
|
if (cur.from != cur.to) {
|
|
ranges.push(cur.value.range(cur.from, cur.to));
|
|
}
|
|
cur.next();
|
|
}
|
|
return ranges;
|
|
}
|
|
};
|
|
function tabstopSpecsToTabstopGroups(tabstops, color) {
|
|
const tabstopsByNumber = {};
|
|
for (const tabstop of tabstops) {
|
|
const n = String(tabstop.number);
|
|
if (tabstopsByNumber[n]) {
|
|
tabstopsByNumber[n].push(tabstop);
|
|
} else {
|
|
tabstopsByNumber[n] = [tabstop];
|
|
}
|
|
}
|
|
const result = [];
|
|
const numbers = Object.keys(tabstopsByNumber);
|
|
numbers.sort((a, b) => parseInt(a) - parseInt(b));
|
|
for (const number2 of numbers) {
|
|
const grp = new TabstopGroup(tabstopsByNumber[number2], color);
|
|
result.push(grp);
|
|
}
|
|
return result;
|
|
}
|
|
function getEditorSelectionEndpoints(sel) {
|
|
const endpoints = sel.ranges.map((range) => import_state8.EditorSelection.range(range.to, range.to));
|
|
return import_state8.EditorSelection.create(endpoints);
|
|
}
|
|
|
|
// src/snippets/snippet_management.ts
|
|
function expandSnippets(view) {
|
|
const snippetsToExpand = view.state.field(snippetQueueStateField);
|
|
if (snippetsToExpand.length === 0)
|
|
return false;
|
|
const originalDocLength = view.state.doc.length;
|
|
handleUndoKeypresses(view, snippetsToExpand);
|
|
const tabstopsToAdd = computeTabstops(view, snippetsToExpand, originalDocLength);
|
|
if (tabstopsToAdd.length === 0) {
|
|
clearSnippetQueue(view);
|
|
return true;
|
|
}
|
|
markTabstops(view, tabstopsToAdd);
|
|
expandTabstops(view, tabstopsToAdd);
|
|
clearSnippetQueue(view);
|
|
return true;
|
|
}
|
|
function handleUndoKeypresses(view, snippets2) {
|
|
const originalDoc = view.state.doc;
|
|
const originalDocLength = originalDoc.length;
|
|
const keyPresses = [];
|
|
for (const snippet of snippets2) {
|
|
if (snippet.keyPressed && snippet.keyPressed.length === 1) {
|
|
const prevChar = view.state.doc.sliceString(snippet.to - 1, snippet.to);
|
|
const from = snippet.to === 0 ? 0 : snippet.to - 1;
|
|
keyPresses.push({ from, to: snippet.to, insert: prevChar + snippet.keyPressed });
|
|
}
|
|
}
|
|
view.dispatch({
|
|
changes: keyPresses,
|
|
annotations: import_commands3.isolateHistory.of("full")
|
|
});
|
|
const undoKeyPresses = import_state9.ChangeSet.of(keyPresses, originalDocLength).invert(originalDoc);
|
|
const changesAsChangeSet = import_state9.ChangeSet.of(snippets2, originalDocLength);
|
|
const combinedChanges = undoKeyPresses.compose(changesAsChangeSet);
|
|
view.dispatch({
|
|
changes: combinedChanges,
|
|
effects: startSnippet.of(null)
|
|
});
|
|
}
|
|
function computeTabstops(view, snippets2, originalDocLength) {
|
|
const changeSet = import_state9.ChangeSet.of(snippets2, originalDocLength);
|
|
const oldPositions = snippets2.map((change) => change.from);
|
|
const newPositions = oldPositions.map((pos) => changeSet.mapPos(pos));
|
|
const tabstopsToAdd = [];
|
|
for (let i = 0; i < snippets2.length; i++) {
|
|
tabstopsToAdd.push(...snippets2[i].getTabstops(view, newPositions[i]));
|
|
}
|
|
return tabstopsToAdd;
|
|
}
|
|
function markTabstops(view, tabstops) {
|
|
const color = getNextTabstopColor(view);
|
|
const tabstopGroups = tabstopSpecsToTabstopGroups(tabstops, color);
|
|
addTabstops(view, tabstopGroups);
|
|
}
|
|
function expandTabstops(view, tabstops) {
|
|
const changes = tabstops.map((tabstop) => {
|
|
return { from: tabstop.from, to: tabstop.to, insert: tabstop.replacement };
|
|
});
|
|
view.dispatch({
|
|
changes
|
|
});
|
|
const firstGrp = getTabstopGroupsFromView(view)[0];
|
|
firstGrp.select(view, false, true);
|
|
tidyTabstops(view);
|
|
}
|
|
function tidyTabstops(view) {
|
|
filterTabstops(view);
|
|
const currentTabstopGroups = getTabstopGroupsFromView(view);
|
|
if (currentTabstopGroups.length === 1) {
|
|
removeAllTabstops(view);
|
|
}
|
|
}
|
|
function isInsideATabstop(view) {
|
|
const currentTabstopGroups = getTabstopGroupsFromView(view);
|
|
for (const tabstopGroup of currentTabstopGroups) {
|
|
if (tabstopGroup.containsSelection(view.state.selection)) {
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
function consumeAndGotoNextTabstop(view) {
|
|
if (getTabstopGroupsFromView(view).length === 0)
|
|
return false;
|
|
removeTabstop(view);
|
|
const oldSel = view.state.selection;
|
|
const nextGrp = getTabstopGroupsFromView(view)[0];
|
|
if (!nextGrp)
|
|
return false;
|
|
const shouldMoveToEndpoints = nextGrp.containsSelection(oldSel);
|
|
nextGrp.select(view, shouldMoveToEndpoints, false);
|
|
const newSel = view.state.selection;
|
|
if (oldSel.eq(newSel))
|
|
return consumeAndGotoNextTabstop(view);
|
|
tidyTabstops(view);
|
|
return true;
|
|
}
|
|
|
|
// src/features/auto_enlarge_brackets.ts
|
|
var autoEnlargeBrackets = (view) => {
|
|
const settings = getLatexSuiteConfig(view);
|
|
if (!settings.autoEnlargeBrackets)
|
|
return;
|
|
const ctx = Context.fromView(view);
|
|
const result = ctx.getBounds();
|
|
if (!result)
|
|
return false;
|
|
const { start: start2, end: end2 } = result;
|
|
const text = view.state.doc.toString();
|
|
const left2 = "\\left";
|
|
const right2 = "\\right";
|
|
for (let i = start2; i < end2; i++) {
|
|
const brackets2 = { "(": ")", "[": "]", "\\{": "\\}", "\\langle": "\\rangle", "\\lvert": "\\rvert", "\\lVert": "\\rVert", "\\lceil": "\\rceil", "\\lfloor": "\\rfloor" };
|
|
const openBrackets = Object.keys(brackets2);
|
|
let found = false;
|
|
let open = "";
|
|
for (const openBracket of openBrackets) {
|
|
if (text.slice(i, i + openBracket.length) === openBracket) {
|
|
found = true;
|
|
open = openBracket;
|
|
break;
|
|
}
|
|
}
|
|
if (!found)
|
|
continue;
|
|
const bracketSize = open.length;
|
|
const close = brackets2[open];
|
|
const j = findMatchingBracket(text, i, open, close, false, end2);
|
|
if (j === -1)
|
|
continue;
|
|
if (text.slice(i - left2.length, i) === left2 && text.slice(j - right2.length, j) === right2)
|
|
continue;
|
|
const bracketContents = text.slice(i + 1, j);
|
|
const containsTrigger = settings.autoEnlargeBracketsTriggers.some((word) => bracketContents.contains("\\" + word));
|
|
if (!containsTrigger) {
|
|
i = j;
|
|
continue;
|
|
}
|
|
queueSnippet(view, i, i + bracketSize, left2 + open + " ");
|
|
queueSnippet(view, j, j + bracketSize, " " + right2 + close);
|
|
}
|
|
expandSnippets(view);
|
|
};
|
|
|
|
// src/features/run_snippets.ts
|
|
var runSnippets = (view, ctx, key) => {
|
|
let shouldAutoEnlargeBrackets = false;
|
|
for (const range of ctx.ranges) {
|
|
const result = runSnippetCursor(view, ctx, key, range);
|
|
if (result.shouldAutoEnlargeBrackets)
|
|
shouldAutoEnlargeBrackets = true;
|
|
}
|
|
const success = expandSnippets(view);
|
|
if (shouldAutoEnlargeBrackets) {
|
|
autoEnlargeBrackets(view);
|
|
}
|
|
return success;
|
|
};
|
|
var runSnippetCursor = (view, ctx, key, range) => {
|
|
const settings = getLatexSuiteConfig(view);
|
|
const { from, to } = range;
|
|
const sel = view.state.sliceDoc(from, to);
|
|
for (const snippet of settings.snippets) {
|
|
let effectiveLine = view.state.sliceDoc(0, to);
|
|
if (!snippetShouldRunInMode(snippet.options, ctx.mode)) {
|
|
continue;
|
|
}
|
|
if (snippet.options.automatic || snippet.type === "visual") {
|
|
if (!(key.length === 1))
|
|
continue;
|
|
effectiveLine += key;
|
|
} else if (!(key === settings.snippetsTrigger)) {
|
|
continue;
|
|
}
|
|
let isExcluded = false;
|
|
for (const environment of snippet.excludedEnvironments) {
|
|
if (ctx.isWithinEnvironment(to, environment)) {
|
|
isExcluded = true;
|
|
}
|
|
}
|
|
if (isExcluded) {
|
|
continue;
|
|
}
|
|
const result = snippet.process(effectiveLine, range, sel);
|
|
if (result === null)
|
|
continue;
|
|
const triggerPos = result.triggerPos;
|
|
if (snippet.options.onWordBoundary) {
|
|
if (!isOnWordBoundary(view.state, triggerPos, to, settings.wordDelimiters))
|
|
continue;
|
|
}
|
|
let replacement = result.replacement;
|
|
if (ctx.mode.inlineMath && settings.removeSnippetWhitespace) {
|
|
replacement = trimWhitespace(replacement, ctx);
|
|
}
|
|
const start2 = triggerPos;
|
|
queueSnippet(view, start2, to, replacement, key);
|
|
const containsTrigger = settings.autoEnlargeBracketsTriggers.some((word) => replacement.contains("\\" + word));
|
|
return { success: true, shouldAutoEnlargeBrackets: containsTrigger };
|
|
}
|
|
return { success: false, shouldAutoEnlargeBrackets: false };
|
|
};
|
|
var snippetShouldRunInMode = (options, mode) => {
|
|
if (options.mode.inlineMath && mode.inlineMath || options.mode.blockMath && mode.blockMath || (options.mode.inlineMath || options.mode.blockMath) && mode.codeMath) {
|
|
if (!mode.textEnv) {
|
|
return true;
|
|
}
|
|
}
|
|
if (mode.inMath() && mode.textEnv && options.mode.text) {
|
|
return true;
|
|
}
|
|
if (options.mode.text && mode.text || options.mode.code && mode.code) {
|
|
return true;
|
|
}
|
|
};
|
|
var isOnWordBoundary = (state, triggerPos, to, wordDelimiters) => {
|
|
const prevChar = state.sliceDoc(triggerPos - 1, triggerPos);
|
|
const nextChar = state.sliceDoc(to, to + 1);
|
|
wordDelimiters = wordDelimiters.replace("\\n", "\n");
|
|
return wordDelimiters.contains(prevChar) && wordDelimiters.contains(nextChar);
|
|
};
|
|
var trimWhitespace = (replacement, ctx) => {
|
|
let spaceIndex = 0;
|
|
if (replacement.endsWith(" ")) {
|
|
spaceIndex = -1;
|
|
} else {
|
|
const lastThreeChars = replacement.slice(-3);
|
|
const lastChar = lastThreeChars.slice(-1);
|
|
if (lastThreeChars.slice(0, 2) === " $" && !isNaN(parseInt(lastChar))) {
|
|
spaceIndex = -3;
|
|
}
|
|
}
|
|
if (spaceIndex != 0) {
|
|
if (spaceIndex === -1) {
|
|
replacement = replacement.trimEnd();
|
|
} else if (spaceIndex === -3) {
|
|
replacement = replacement.slice(0, -3) + replacement.slice(-2);
|
|
}
|
|
}
|
|
return replacement;
|
|
};
|
|
|
|
// src/features/autofraction.ts
|
|
var runAutoFraction = (view, ctx) => {
|
|
for (const range of ctx.ranges) {
|
|
runAutoFractionCursor(view, ctx, range);
|
|
}
|
|
const success = expandSnippets(view);
|
|
if (success) {
|
|
autoEnlargeBrackets(view);
|
|
}
|
|
return success;
|
|
};
|
|
var runAutoFractionCursor = (view, ctx, range) => {
|
|
const settings = getLatexSuiteConfig(view);
|
|
const { from, to } = range;
|
|
for (const env of settings.autofractionExcludedEnvs) {
|
|
if (ctx.isWithinEnvironment(to, env)) {
|
|
return false;
|
|
}
|
|
}
|
|
const result = ctx.getBounds();
|
|
if (!result)
|
|
return false;
|
|
const eqnStart = result.start;
|
|
let curLine = view.state.sliceDoc(0, to);
|
|
let start2 = eqnStart;
|
|
if (from != to) {
|
|
start2 = from;
|
|
} else {
|
|
const greek2 = settings.snippetVariables["${GREEK}"];
|
|
if (greek2 !== void 0) {
|
|
const regex = new RegExp("(" + greek2 + ") ([^ ])", "g");
|
|
curLine = curLine.replace(regex, "$1#$2");
|
|
}
|
|
for (let i = curLine.length - 1; i >= eqnStart; i--) {
|
|
const curChar = curLine.charAt(i);
|
|
if ([")", "]", "}"].contains(curChar)) {
|
|
const closeBracket = curChar;
|
|
const openBracket = getOpenBracket(closeBracket);
|
|
const j = findMatchingBracket(curLine, i, openBracket, closeBracket, true);
|
|
if (j === -1)
|
|
return false;
|
|
i = j;
|
|
if (i < eqnStart) {
|
|
start2 = eqnStart;
|
|
break;
|
|
}
|
|
}
|
|
if (" $([{\n".concat(settings.autofractionBreakingChars).contains(curChar)) {
|
|
start2 = i + 1;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
if (start2 === to) {
|
|
return false;
|
|
}
|
|
let numerator = view.state.sliceDoc(start2, to);
|
|
if (numerator.at(0) === "(" && numerator.at(-1) === ")") {
|
|
const closing = findMatchingBracket(numerator, 0, "(", ")", false);
|
|
if (closing === numerator.length - 1) {
|
|
numerator = numerator.slice(1, -1);
|
|
}
|
|
}
|
|
const replacement = `${settings.autofractionSymbol}{${numerator}}{$0}$1`;
|
|
queueSnippet(view, start2, to, replacement, "/");
|
|
return true;
|
|
};
|
|
|
|
// src/features/tabout.ts
|
|
var tabout = (view, ctx) => {
|
|
if (!ctx.mode.inMath())
|
|
return false;
|
|
const result = ctx.getBounds();
|
|
if (!result)
|
|
return false;
|
|
const end2 = result.end;
|
|
const pos = view.state.selection.main.to;
|
|
const d = view.state.doc;
|
|
const text = d.toString();
|
|
const rangle = "\\rangle";
|
|
for (let i = pos; i < end2; i++) {
|
|
if (["}", ")", "]", ">", "|", "$"].contains(text.charAt(i))) {
|
|
setCursor(view, i + 1);
|
|
return true;
|
|
} else if (text.slice(i, i + rangle.length) === rangle) {
|
|
setCursor(view, i + rangle.length);
|
|
return true;
|
|
}
|
|
}
|
|
const textBtwnCursorAndEnd = d.sliceString(pos, end2);
|
|
const atEnd = textBtwnCursorAndEnd.trim().length === 0;
|
|
if (!atEnd)
|
|
return false;
|
|
if (ctx.mode.inlineMath || ctx.mode.codeMath) {
|
|
setCursor(view, end2 + 1);
|
|
} else {
|
|
const dollarLine = d.lineAt(end2 + 2);
|
|
if (dollarLine.number === d.lines) {
|
|
replaceRange(view, dollarLine.to, dollarLine.to, "\n");
|
|
}
|
|
setCursor(view, dollarLine.to + 1);
|
|
const line = d.lineAt(pos);
|
|
replaceRange(view, line.from, line.to, line.text.trim());
|
|
}
|
|
return true;
|
|
};
|
|
var shouldTaboutByCloseBracket = (view, keyPressed) => {
|
|
const sel = view.state.selection.main;
|
|
if (!sel.empty)
|
|
return;
|
|
const pos = sel.from;
|
|
const c = getCharacterAtPos(view, pos);
|
|
const brackets2 = [")", "]", "}"];
|
|
if (c === keyPressed && brackets2.contains(c)) {
|
|
return true;
|
|
} else {
|
|
return false;
|
|
}
|
|
};
|
|
|
|
// src/features/matrix_shortcuts.ts
|
|
var runMatrixShortcuts = (view, ctx, key, shiftKey) => {
|
|
const settings = getLatexSuiteConfig(view);
|
|
let isInsideAnEnv = false;
|
|
for (const envName of settings.matrixShortcutsEnvNames) {
|
|
const env = { openSymbol: "\\begin{" + envName + "}", closeSymbol: "\\end{" + envName + "}" };
|
|
isInsideAnEnv = ctx.isWithinEnvironment(ctx.pos, env);
|
|
if (isInsideAnEnv)
|
|
break;
|
|
}
|
|
if (!isInsideAnEnv)
|
|
return false;
|
|
if (key === "Tab") {
|
|
view.dispatch(view.state.replaceSelection(" & "));
|
|
return true;
|
|
} else if (key === "Enter") {
|
|
if (shiftKey) {
|
|
const d = view.state.doc;
|
|
const nextLineNo = d.lineAt(ctx.pos).number + 1;
|
|
const nextLine = d.line(nextLineNo);
|
|
setCursor(view, nextLine.to);
|
|
} else {
|
|
view.dispatch(view.state.replaceSelection(" \\\\\n"));
|
|
}
|
|
return true;
|
|
} else {
|
|
return false;
|
|
}
|
|
};
|
|
|
|
// src/snippets/codemirror/cursor_trigger_state_field.ts
|
|
var import_state10 = __toModule(require("@codemirror/state"));
|
|
var cursorTriggerStateField = import_state10.StateField.define({
|
|
create() {
|
|
return false;
|
|
},
|
|
update(value, transaction) {
|
|
if (transaction.docChanged) {
|
|
return true;
|
|
}
|
|
if (transaction.selection) {
|
|
if (value) {
|
|
return false;
|
|
}
|
|
}
|
|
return value;
|
|
}
|
|
});
|
|
|
|
// src/snippets/codemirror/extensions.ts
|
|
var snippetExtensions = [
|
|
tabstopsStateField.extension,
|
|
snippetQueueStateField.extension,
|
|
cursorTriggerStateField.extension,
|
|
snippetInvertedEffects
|
|
];
|
|
|
|
// src/editor_extensions/conceal.ts
|
|
var import_obsidian6 = __toModule(require("obsidian"));
|
|
var import_view10 = __toModule(require("@codemirror/view"));
|
|
var import_language5 = __toModule(require("@codemirror/language"));
|
|
|
|
// src/editor_extensions/conceal_maps.ts
|
|
var cmd_symbols = {
|
|
"aleph": "\u2135",
|
|
"amalg": "\u2210",
|
|
"angle": "\u2220",
|
|
"approx": "\u2248",
|
|
"ast": "\u2217",
|
|
"asymp": "\u224D",
|
|
"backslash": "\u2216",
|
|
"bigcap": "\u2229",
|
|
"bigcirc": "\u25CB",
|
|
"bigcup": "\u222A",
|
|
"bigodot": "\u2299",
|
|
"bigoplus": "\u2295",
|
|
"bigotimes": "\u2297",
|
|
"bigsqcup": "\u2294",
|
|
"bigtriangledown": "\u2207",
|
|
"bigtriangleup": "\u2206",
|
|
"bigvee": "\u22C1",
|
|
"bigwedge": "\u22C0",
|
|
"bot": "\u22A5",
|
|
"bowtie": "\u22C8",
|
|
"bullet": "\u2022",
|
|
"cap": "\u2229",
|
|
"cdots": "\u22EF",
|
|
"cdot": "\xB7",
|
|
"circ": "\u2218",
|
|
"clubsuit": "\u2663",
|
|
"cong": "\u2245",
|
|
"coprod": "\u2210",
|
|
"copyright": "\xA9",
|
|
"cup": "\u222A",
|
|
"dagger": "\u2020",
|
|
"dashv": "\u22A3",
|
|
"ddagger": "\u2021",
|
|
"ddots": "\u22F1",
|
|
"diamond": "\u22C4",
|
|
"diamondsuit": "\u2662",
|
|
"div": "\xF7",
|
|
"doteq": "\u2250",
|
|
"dots": "\u2026",
|
|
"downarrow": "\u2193",
|
|
"Downarrow": "\u21D3",
|
|
"ell": "\u2113",
|
|
"emptyset": "\xD8",
|
|
"equiv": "\u2261",
|
|
"exists": "\u2203",
|
|
"flat": "\u266D",
|
|
"forall": "\u2200",
|
|
"frown": "\u2054",
|
|
"geqslant": "\u2265",
|
|
"geq": "\u2265",
|
|
"gets": "\u2190",
|
|
"ge": "\u2265",
|
|
"gg": "\u27EB",
|
|
"hbar": "\u210F",
|
|
"heartsuit": "\u2661",
|
|
"hookleftarrow": "\u21A9",
|
|
"hookrightarrow": "\u21AA",
|
|
"iff": "\u21D4",
|
|
"Im": "\u2111",
|
|
"imath": "\u0269",
|
|
"infty": "\u221E",
|
|
"iiint": "\u222D",
|
|
"iint": "\u222C",
|
|
"int": "\u222B",
|
|
"in": "\u2208",
|
|
"jmath": "\u{1D6A5}",
|
|
"land": "\u2227",
|
|
"lnot": "\xAC",
|
|
"lceil": "\u2308",
|
|
"ldots": "\u2026",
|
|
"leftharpoondown": "\u21BD",
|
|
"leftharpoonup": "\u21BC",
|
|
"leftrightarrow": "\u2194",
|
|
"Leftrightarrow": "\u21D4",
|
|
"lhd": "\u25C1",
|
|
"rhd": "\u25B7",
|
|
"leftarrow": "\u2190",
|
|
"Leftarrow": "\u21D0",
|
|
"left": "",
|
|
"leq": "\u2264",
|
|
"le": "\u2264",
|
|
"ll": "\u226A",
|
|
"lmoustache": "\u256D",
|
|
"lor": "\u2228",
|
|
"mapsto": "\u21A6",
|
|
"middle": "",
|
|
"mid": "\u2223",
|
|
"models": "\u22A8",
|
|
"mp": "\u2213",
|
|
"nabla": "\u2207",
|
|
"natural": "\u266E",
|
|
"nearrow": "\u2197",
|
|
"neg": "\xAC",
|
|
"neqslant": "\u2260",
|
|
"neq": "\u2260",
|
|
"ne": "\u2260",
|
|
"ni": "\u220B",
|
|
"notin": "\u2209",
|
|
"nwarrow": "\u2196",
|
|
"odot": "\u2299",
|
|
"oint": "\u222E",
|
|
"ominus": "\u2296",
|
|
"oplus": "\u2295",
|
|
"oslash": "\u2298",
|
|
"otimes": "\u2297",
|
|
"owns": "\u220B",
|
|
"P": "\xB6",
|
|
"parallel": "\u2551",
|
|
"partial": "\u2202",
|
|
"perp": "\u22A5",
|
|
"pm": "\xB1",
|
|
"preceq": "\u2AAF",
|
|
"prec": "\u227A",
|
|
"prime": "\u2032",
|
|
"prod": "\u220F",
|
|
"propto": "\u221D",
|
|
"rceil": "\u2309",
|
|
"Re": "\u211C",
|
|
"qquad": "\u2001",
|
|
"quad": "\u2000",
|
|
"rightarrow": "\u2192",
|
|
"Rightarrow": "\u21D2",
|
|
"right": "",
|
|
"rightleftharpoons": "\u21CC",
|
|
"rmoustache": "\u256E",
|
|
"S": "\xA7",
|
|
"searrow": "\u2198",
|
|
"setminus": "\u29F5",
|
|
"sharp": "\u266F",
|
|
"simeq": "\u22CD",
|
|
"sim": "\u223C",
|
|
"smile": "\u203F",
|
|
"spadesuit": "\u2660",
|
|
"sqcap": "\u2293",
|
|
"sqcup": "\u2294",
|
|
"sqsubseteq": "\u2291",
|
|
"sqsubset": "\u228F",
|
|
"sqsupseteq": "\u2292",
|
|
"sqsupset": "\u2290",
|
|
"square": "\u25A1",
|
|
"star": "\u272B",
|
|
"subseteq": "\u2286",
|
|
"subset": "\u2282",
|
|
"succeq": "\u2AB0",
|
|
"succ": "\u227B",
|
|
"sum": "\u2211",
|
|
"supseteq": "\u2287",
|
|
"supset": "\u2283",
|
|
"surd": "\u221A",
|
|
"swarrow": "\u2199",
|
|
"times": "\xD7",
|
|
"top": "\u22A4",
|
|
"to": "\u2192",
|
|
"triangleleft": "\u22B2",
|
|
"triangleright": "\u22B3",
|
|
"triangle": "\u2206",
|
|
"uparrow": "\u2191",
|
|
"Uparrow": "\u21D1",
|
|
"updownarrow": "\u2195",
|
|
"Updownarrow": "\u21D5",
|
|
"vdash": "\u22A2",
|
|
"vdots": "\u22EE",
|
|
"vee": "\u2228",
|
|
"wedge": "\u2227",
|
|
"wp": "\u2118",
|
|
"wr": "\u2240",
|
|
"implies": "\u21D2",
|
|
"choose": "C",
|
|
"sqrt": "\u221A",
|
|
"coloneqq": "\u2254",
|
|
"colon": ":",
|
|
"displaystyle": " ",
|
|
",": " ",
|
|
":": " ",
|
|
";": " "
|
|
};
|
|
var operators = [
|
|
"arcsin",
|
|
"arccos",
|
|
"arctan",
|
|
"sinh",
|
|
"cosh",
|
|
"tanh",
|
|
"coth",
|
|
"sin",
|
|
"cos",
|
|
"tan",
|
|
"sec",
|
|
"csc",
|
|
"cot",
|
|
"exp",
|
|
"ker",
|
|
"limsup",
|
|
"lim",
|
|
"sup",
|
|
"deg",
|
|
"gcd",
|
|
"log",
|
|
"lg",
|
|
"ln",
|
|
"Pr",
|
|
"det",
|
|
"hom",
|
|
"arg",
|
|
"dim",
|
|
"liminf",
|
|
"min",
|
|
"max"
|
|
];
|
|
var fractions = {
|
|
"{1}{2}": "\xBD",
|
|
"{1}{3}": "\u2153",
|
|
"{2}{3}": "\u2154",
|
|
"{1}{4}": "\xBC",
|
|
"{1}{5}": "\u2155",
|
|
"{2}{5}": "\u2156",
|
|
"{3}{5}": "\u2157",
|
|
"{4}{5}": "\u2158",
|
|
"{1}{6}": "\u2159",
|
|
"{5}{6}": "\u215A",
|
|
"{1}{8}": "\u215B",
|
|
"{3}{8}": "\u215C",
|
|
"{5}{8}": "\u215D",
|
|
"{7}{8}": "\u215E"
|
|
};
|
|
var greek = {
|
|
"alpha": "\u03B1",
|
|
"beta": "\u03B2",
|
|
"gamma": "\u03B3",
|
|
"delta": "\u03B4",
|
|
"epsilon": "\u03F5",
|
|
"varepsilon": "\u03B5",
|
|
"zeta": "\u03B6",
|
|
"eta": "\u03B7",
|
|
"theta": "\u03B8",
|
|
"vartheta": "\u03D1",
|
|
"iota": "\u03B9",
|
|
"kappa": "\u03BA",
|
|
"lambda": "\u03BB",
|
|
"mu": "\u03BC",
|
|
"nu": "\u03BD",
|
|
"xi": "\u03BE",
|
|
"pi": "\u03C0",
|
|
"varpi": "\u03D6",
|
|
"rho": "\u03C1",
|
|
"varrho": "\u03F1",
|
|
"sigma": "\u03C3",
|
|
"varsigma": "\u03C2",
|
|
"tau": "\u03C4",
|
|
"upsilon": "\u03C5",
|
|
"phi": "\u03D5",
|
|
"varphi": "\u03C6",
|
|
"chi": "\u03C7",
|
|
"psi": "\u03C8",
|
|
"omega": "\u03C9",
|
|
"Gamma": "\u0393",
|
|
"Delta": "\u0394",
|
|
"Theta": "\u0398",
|
|
"Lambda": "\u039B",
|
|
"Xi": "\u039E",
|
|
"Pi": "\u03A0",
|
|
"Sigma": "\u03A3",
|
|
"Upsilon": "\u03A5",
|
|
"Phi": "\u03A6",
|
|
"Chi": "\u03A7",
|
|
"Psi": "\u03A8",
|
|
"Omega": "\u03A9"
|
|
};
|
|
var map_super = {
|
|
"(": "\u207D",
|
|
")": "\u207E",
|
|
"+": "\u207A",
|
|
"-": "\u207B",
|
|
"=": "\u207C",
|
|
":": "\uFE13",
|
|
";": "\uFE14",
|
|
"<": "\u02C2",
|
|
">": "\u02C3",
|
|
"0": "\u2070",
|
|
"1": "\xB9",
|
|
"2": "\xB2",
|
|
"3": "\xB3",
|
|
"4": "\u2074",
|
|
"5": "\u2075",
|
|
"6": "\u2076",
|
|
"7": "\u2077",
|
|
"8": "\u2078",
|
|
"9": "\u2079",
|
|
"a": "\u1D43",
|
|
"b": "\u1D47",
|
|
"c": "\u1D9C",
|
|
"d": "\u1D48",
|
|
"e": "\u1D49",
|
|
"f": "\u1DA0",
|
|
"g": "\u1D4D",
|
|
"h": "\u02B0",
|
|
"i": "\u2071",
|
|
"j": "\u02B2",
|
|
"k": "\u1D4F",
|
|
"l": "\u02E1",
|
|
"m": "\u1D50",
|
|
"n": "\u207F",
|
|
"o": "\u1D52",
|
|
"p": "\u1D56",
|
|
"r": "\u02B3",
|
|
"s": "\u02E2",
|
|
"t": "\u1D57",
|
|
"u": "\u1D58",
|
|
"v": "\u1D5B",
|
|
"w": "\u02B7",
|
|
"x": "\u02E3",
|
|
"y": "\u02B8",
|
|
"z": "\u1DBB",
|
|
"A": "\u1D2C",
|
|
"B": "\u1D2E",
|
|
"D": "\u1D30",
|
|
"E": "\u1D31",
|
|
"G": "\u1D33",
|
|
"H": "\u1D34",
|
|
"I": "\u1D35",
|
|
"J": "\u1D36",
|
|
"K": "\u1D37",
|
|
"L": "\u1D38",
|
|
"M": "\u1D39",
|
|
"N": "\u1D3A",
|
|
"O": "\u1D3C",
|
|
"P": "\u1D3E",
|
|
"R": "\u1D3F",
|
|
"T": "\u1D40",
|
|
"U": "\u1D41",
|
|
"V": "\u2C7D",
|
|
"W": "\u1D42"
|
|
};
|
|
var map_sub = {
|
|
"(": "\u208D",
|
|
")": "\u208E",
|
|
"+": "\u208A",
|
|
"-": "\u208B",
|
|
"=": "\u208C",
|
|
"0": "\u2080",
|
|
"1": "\u2081",
|
|
"2": "\u2082",
|
|
"3": "\u2083",
|
|
"4": "\u2084",
|
|
"5": "\u2085",
|
|
"6": "\u2086",
|
|
"7": "\u2087",
|
|
"8": "\u2088",
|
|
"9": "\u2089",
|
|
"a": "\u2090",
|
|
"e": "\u2091",
|
|
"h": "\u2095",
|
|
"i": "\u1D62",
|
|
"j": "\u2C7C",
|
|
"k": "\u2096",
|
|
"l": "\u2097",
|
|
"m": "\u2098",
|
|
"n": "\u2099",
|
|
"o": "\u2092",
|
|
"p": "\u209A",
|
|
"r": "\u1D63",
|
|
"s": "\u209B",
|
|
"t": "\u209C",
|
|
"u": "\u1D64",
|
|
"v": "\u1D65",
|
|
"x": "\u2093"
|
|
};
|
|
var brackets = {
|
|
"left<": "\u3008",
|
|
"right>": "\u3009",
|
|
"langle": "\u3008",
|
|
"rangle": "\u3009",
|
|
"lvert": "|",
|
|
"rvert": "|",
|
|
"lVert": "||",
|
|
"rVert": "||",
|
|
"vert": "|"
|
|
};
|
|
var mathbb = {
|
|
" ": " ",
|
|
"0": "\u{1D7D8}",
|
|
"1": "\u{1D7D9}",
|
|
"2": "\u{1D7DA}",
|
|
"3": "\u{1D7DB}",
|
|
"4": "\u{1D7DC}",
|
|
"5": "\u{1D7DD}",
|
|
"6": "\u{1D7DE}",
|
|
"7": "\u{1D7DF}",
|
|
"8": "\u{1D7E0}",
|
|
"9": "\u{1D7E1}",
|
|
"A": "\u{1D538}",
|
|
"B": "\u{1D539}",
|
|
"C": "\u2102",
|
|
"D": "\u{1D53B}",
|
|
"E": "\u{1D53C}",
|
|
"F": "\u{1D53D}",
|
|
"G": "\u{1D53E}",
|
|
"H": "\u210D",
|
|
"I": "\u{1D540}",
|
|
"J": "\u{1D541}",
|
|
"K": "\u{1D542}",
|
|
"L": "\u{1D543}",
|
|
"M": "\u{1D544}",
|
|
"N": "\u2115",
|
|
"O": "\u{1D546}",
|
|
"P": "\u2119",
|
|
"Q": "\u211A",
|
|
"R": "\u211D",
|
|
"S": "\u{1D54A}",
|
|
"T": "\u{1D54B}",
|
|
"U": "\u{1D54C}",
|
|
"V": "\u{1D54D}",
|
|
"W": "\u{1D54E}",
|
|
"X": "\u{1D54F}",
|
|
"Y": "\u{1D550}",
|
|
"Z": "\u2124",
|
|
"a": "\u{1D552}",
|
|
"b": "\u{1D553}",
|
|
"c": "\u{1D554}",
|
|
"d": "\u{1D555}",
|
|
"e": "\u{1D556}",
|
|
"f": "\u{1D557}",
|
|
"g": "\u{1D558}",
|
|
"h": "\u{1D559}",
|
|
"i": "\u{1D55A}",
|
|
"j": "\u{1D55B}",
|
|
"k": "\u{1D55C}",
|
|
"l": "\u{1D55D}",
|
|
"m": "\u{1D55E}",
|
|
"n": "\u{1D55F}",
|
|
"o": "\u{1D560}",
|
|
"p": "\u{1D561}",
|
|
"q": "\u{1D562}",
|
|
"r": "\u{1D563}",
|
|
"s": "\u{1D564}",
|
|
"t": "\u{1D565}",
|
|
"u": "\u{1D566}",
|
|
"v": "\u{1D567}",
|
|
"w": "\u{1D568}",
|
|
"x": "\u{1D569}",
|
|
"y": "\u{1D56A}",
|
|
"z": "\u{1D56B}"
|
|
};
|
|
var mathscrcal = {
|
|
"A": "\u{1D4D0}",
|
|
"B": "\u{1D4D1}",
|
|
"C": "\u{1D4D2}",
|
|
"D": "\u{1D4D3}",
|
|
"E": "\u{1D4D4}",
|
|
"F": "\u{1D4D5}",
|
|
"G": "\u{1D4D6}",
|
|
"H": "\u{1D4D7}",
|
|
"I": "\u{1D4D8}",
|
|
"J": "\u{1D4D9}",
|
|
"K": "\u{1D4DA}",
|
|
"L": "\u{1D4DB}",
|
|
"M": "\u{1D4DC}",
|
|
"N": "\u{1D4DD}",
|
|
"O": "\u{1D4DE}",
|
|
"P": "\u{1D4DF}",
|
|
"Q": "\u{1D4E0}",
|
|
"R": "\u{1D4E1}",
|
|
"S": "\u{1D4E2}",
|
|
"T": "\u{1D4E3}",
|
|
"U": "\u{1D4E4}",
|
|
"V": "\u{1D4E5}",
|
|
"W": "\u{1D4E6}",
|
|
"X": "\u{1D4E7}",
|
|
"Y": "\u{1D4E8}",
|
|
"Z": "\u{1D4E9}"
|
|
};
|
|
|
|
// src/editor_extensions/conceal.ts
|
|
var ConcealWidget = class extends import_view10.WidgetType {
|
|
constructor(symbol, className, elementType) {
|
|
super();
|
|
this.symbol = symbol;
|
|
this.className = className ? className : "";
|
|
this.elementType = elementType ? elementType : "span";
|
|
}
|
|
eq(other) {
|
|
return other.symbol == this.symbol && other.className === this.className && other.elementType === this.elementType;
|
|
}
|
|
toDOM() {
|
|
const span = document.createElement(this.elementType);
|
|
span.className = "cm-math " + this.className;
|
|
span.textContent = this.symbol;
|
|
return span;
|
|
}
|
|
ignoreEvent() {
|
|
return false;
|
|
}
|
|
};
|
|
var TextWidget = class extends import_view10.WidgetType {
|
|
constructor(symbol) {
|
|
super();
|
|
this.symbol = symbol;
|
|
}
|
|
eq(other) {
|
|
return other.symbol == this.symbol;
|
|
}
|
|
toDOM() {
|
|
const span = document.createElement("span");
|
|
span.className = "cm-math";
|
|
span.textContent = this.symbol;
|
|
return span;
|
|
}
|
|
ignoreEvent() {
|
|
return false;
|
|
}
|
|
};
|
|
function selectionAndRangeOverlap(selection, rangeFrom, rangeTo) {
|
|
for (const range of selection.ranges) {
|
|
if (range.from <= rangeTo && range.to >= rangeFrom) {
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
function escapeRegex(regex) {
|
|
const escapeChars = ["\\", "(", ")", "+", "-", "[", "]", "{", "}"];
|
|
for (const escapeChar of escapeChars) {
|
|
regex = regex.replaceAll(escapeChar, "\\" + escapeChar);
|
|
}
|
|
return regex;
|
|
}
|
|
function getEndIncludingLimits(eqn, end2) {
|
|
const LIMITS = "\\limits";
|
|
if (eqn.substring(end2, end2 + LIMITS.length) === LIMITS) {
|
|
return end2 + LIMITS.length;
|
|
}
|
|
return end2;
|
|
}
|
|
function concealSymbols(eqn, prefix, suffix, symbolMap, className, allowSucceedingLetters = true) {
|
|
const symbolNames = Object.keys(symbolMap);
|
|
const regexStr = prefix + "(" + escapeRegex(symbolNames.join("|")) + ")" + suffix;
|
|
const symbolRegex = new RegExp(regexStr, "g");
|
|
const matches = [...eqn.matchAll(symbolRegex)];
|
|
const concealments = [];
|
|
for (const match of matches) {
|
|
const symbol = match[1];
|
|
if (!allowSucceedingLetters) {
|
|
const end3 = match.index + match[0].length;
|
|
if (eqn.charAt(end3).match(/[a-zA-Z]/)) {
|
|
continue;
|
|
}
|
|
}
|
|
const end2 = getEndIncludingLimits(eqn, match.index + match[0].length);
|
|
concealments.push({ start: match.index, end: end2, replacement: symbolMap[symbol], class: className });
|
|
}
|
|
return concealments;
|
|
}
|
|
function concealModifier(eqn, modifier, combiningCharacter) {
|
|
const regexStr = "\\\\" + modifier + "{([A-Za-z])}";
|
|
const symbolRegex = new RegExp(regexStr, "g");
|
|
const matches = [...eqn.matchAll(symbolRegex)];
|
|
const concealments = [];
|
|
for (const match of matches) {
|
|
const symbol = match[1];
|
|
concealments.push({ start: match.index, end: match.index + match[0].length, replacement: symbol + combiningCharacter, class: "latex-suite-unicode" });
|
|
}
|
|
return concealments;
|
|
}
|
|
function concealSupSub(eqn, superscript, symbolMap) {
|
|
const prefix = superscript ? "\\^" : "_";
|
|
const regexStr = prefix + "{([A-Za-z0-9\\()\\[\\]/+-=<>':;\\\\ *]+)}";
|
|
const regex = new RegExp(regexStr, "g");
|
|
const matches = [...eqn.matchAll(regex)];
|
|
const concealments = [];
|
|
for (const match of matches) {
|
|
const exponent = match[1];
|
|
const elementType = superscript ? "sup" : "sub";
|
|
const symbolNames = Object.keys(symbolMap);
|
|
const symbolRegexStr = "\\\\(" + escapeRegex(symbolNames.join("|")) + ")";
|
|
const symbolRegex = new RegExp(symbolRegexStr, "g");
|
|
const replacement = exponent.replace(symbolRegex, (a, b) => {
|
|
return symbolMap[b];
|
|
});
|
|
concealments.push({ start: match.index, end: match.index + match[0].length, replacement, class: "cm-number", elementType });
|
|
}
|
|
return concealments;
|
|
}
|
|
function concealModified_A_to_Z_0_to_9(eqn, mathBBsymbolMap) {
|
|
const regexStr = "\\\\(mathbf|boldsymbol|underline|mathrm|text|mathbb){([A-Za-z0-9 ]+)}";
|
|
const regex = new RegExp(regexStr, "g");
|
|
const matches = [...eqn.matchAll(regex)];
|
|
const concealments = [];
|
|
for (const match of matches) {
|
|
const type = match[1];
|
|
const value = match[2];
|
|
const start2 = match.index;
|
|
const end2 = start2 + match[0].length;
|
|
if (type === "mathbf" || type === "boldsymbol") {
|
|
concealments.push({ start: start2, end: end2, replacement: value, class: "cm-concealed-bold" });
|
|
} else if (type === "underline") {
|
|
concealments.push({ start: start2, end: end2, replacement: value, class: "cm-concealed-underline" });
|
|
} else if (type === "mathrm") {
|
|
concealments.push({ start: start2, end: end2, replacement: value, class: "cm-concealed-mathrm" });
|
|
} else if (type === "text") {
|
|
if (start2 > 0 && eqn.charAt(start2 - 1) === "_") {
|
|
concealments.push({ start: start2 - 1, end: end2, replacement: value, class: "cm-concealed-mathrm", elementType: "sub" });
|
|
}
|
|
} else if (type === "mathbb") {
|
|
const letters = Array.from(value);
|
|
const replacement = letters.map((el) => mathBBsymbolMap[el]).join("");
|
|
concealments.push({ start: start2, end: end2, replacement });
|
|
}
|
|
}
|
|
return concealments;
|
|
}
|
|
function concealModifiedGreekLetters(eqn, greekSymbolMap) {
|
|
const greekSymbolNames = Object.keys(greekSymbolMap);
|
|
const regexStr = "\\\\(underline|boldsymbol){\\\\(" + escapeRegex(greekSymbolNames.join("|")) + ")}";
|
|
const regex = new RegExp(regexStr, "g");
|
|
const matches = [...eqn.matchAll(regex)];
|
|
const concealments = [];
|
|
for (const match of matches) {
|
|
const type = match[1];
|
|
const value = match[2];
|
|
const start2 = match.index;
|
|
const end2 = start2 + match[0].length;
|
|
if (type === "underline") {
|
|
concealments.push({ start: start2, end: end2, replacement: greekSymbolMap[value], class: "cm-concealed-underline" });
|
|
} else if (type === "boldsymbol") {
|
|
concealments.push({ start: start2, end: end2, replacement: greekSymbolMap[value], class: "cm-concealed-bold" });
|
|
}
|
|
}
|
|
return concealments;
|
|
}
|
|
function concealText(eqn) {
|
|
const regexStr = "\\\\text{([A-Za-z0-9-.!?() ]+)}";
|
|
const regex = new RegExp(regexStr, "g");
|
|
const matches = [...eqn.matchAll(regex)];
|
|
const concealments = [];
|
|
for (const match of matches) {
|
|
const value = match[1];
|
|
const start2 = match.index;
|
|
const end2 = start2 + match[0].length;
|
|
concealments.push({ start: start2, end: end2, replacement: value, class: "cm-concealed-mathrm cm-variable-2" });
|
|
}
|
|
return concealments;
|
|
}
|
|
function concealOperators(eqn, symbols) {
|
|
const regexStr = "(\\\\(" + symbols.join("|") + "))([^a-zA-Z]|$)";
|
|
const regex = new RegExp(regexStr, "g");
|
|
const matches = [...eqn.matchAll(regex)];
|
|
const concealments = [];
|
|
for (const match of matches) {
|
|
const value = match[2];
|
|
const start2 = match.index;
|
|
const end2 = getEndIncludingLimits(eqn, start2 + match[1].length);
|
|
concealments.push({ start: start2, end: end2, replacement: value, class: "cm-concealed-mathrm cm-variable-2" });
|
|
}
|
|
return concealments;
|
|
}
|
|
function concealAtoZ(eqn, prefix, suffix, symbolMap, className) {
|
|
const regexStr = prefix + "([A-Z]+)" + suffix;
|
|
const symbolRegex = new RegExp(regexStr, "g");
|
|
const matches = [...eqn.matchAll(symbolRegex)];
|
|
const concealments = [];
|
|
for (const match of matches) {
|
|
const symbol = match[1];
|
|
const letters = Array.from(symbol);
|
|
const replacement = letters.map((el) => symbolMap[el]).join("");
|
|
concealments.push({ start: match.index, end: match.index + match[0].length, replacement, class: className });
|
|
}
|
|
return concealments;
|
|
}
|
|
function concealBraKet(eqn, selection, eqnStartBound, mousedown) {
|
|
const langle = "\u3008";
|
|
const rangle = "\u3009";
|
|
const vert = "|";
|
|
const regexStr = "\\\\(braket|bra|ket){";
|
|
const symbolRegex = new RegExp(regexStr, "g");
|
|
const matches = [...eqn.matchAll(symbolRegex)];
|
|
const concealments = [];
|
|
for (const match of matches) {
|
|
const loc = match.index + match[0].length;
|
|
const j = findMatchingBracket(eqn, loc - 1, "{", "}", false);
|
|
if (j === -1)
|
|
continue;
|
|
const start2 = match.index;
|
|
const end2 = start2 + match[0].length;
|
|
if (!mousedown) {
|
|
if (selectionAndRangeOverlap(selection, eqnStartBound + start2, eqnStartBound + end2))
|
|
continue;
|
|
if (selectionAndRangeOverlap(selection, eqnStartBound + j, eqnStartBound + j + 1))
|
|
continue;
|
|
}
|
|
const type = match[1];
|
|
const left2 = type === "ket" ? vert : langle;
|
|
const right2 = type === "bra" ? vert : rangle;
|
|
concealments.push({ start: start2, end: end2 - 1, replacement: "" });
|
|
concealments.push({ start: end2 - 1, end: end2, replacement: left2, class: "cm-bracket" });
|
|
concealments.push({ start: j, end: j + 1, replacement: right2, class: "cm-bracket" });
|
|
}
|
|
return concealments;
|
|
}
|
|
function concealSet(eqn, selection, eqnStartBound, mousedown) {
|
|
const setRegex = /\\set\{/g;
|
|
const matches = [...eqn.matchAll(setRegex)];
|
|
const concealments = [];
|
|
for (const match of matches) {
|
|
const start2 = match.index;
|
|
const end2 = start2 + match[0].length;
|
|
const loc = match.index + match[0].length;
|
|
const j = findMatchingBracket(eqn, loc - 1, "{", "}", false);
|
|
if (j === -1) {
|
|
continue;
|
|
}
|
|
if (!mousedown) {
|
|
if (selectionAndRangeOverlap(selection, eqnStartBound + start2, eqnStartBound + end2)) {
|
|
continue;
|
|
}
|
|
if (selectionAndRangeOverlap(selection, eqnStartBound + j, eqnStartBound + j + 1)) {
|
|
continue;
|
|
}
|
|
}
|
|
concealments.push({ start: start2, end: end2 - 1, replacement: "" });
|
|
concealments.push({ start: end2 - 1, end: end2, replacement: "{", class: "cm-bracket" });
|
|
concealments.push({ start: j, end: j + 1, replacement: "}", class: "cm-bracket" });
|
|
}
|
|
return concealments;
|
|
}
|
|
function concealFraction(eqn, selection, eqnStartBound, mousedown) {
|
|
const regexStr = "\\\\(frac){";
|
|
const symbolRegex = new RegExp(regexStr, "g");
|
|
const matches = [...eqn.matchAll(symbolRegex)];
|
|
const concealments = [];
|
|
for (const match of matches) {
|
|
const loc = match.index + match[0].length;
|
|
const j = findMatchingBracket(eqn, loc - 1, "{", "}", false);
|
|
if (j === -1)
|
|
continue;
|
|
const charAfterFirstBracket = eqn.charAt(j + 1);
|
|
if (charAfterFirstBracket != "{")
|
|
continue;
|
|
const k = findMatchingBracket(eqn, j + 1, "{", "}", false);
|
|
if (k === -1)
|
|
continue;
|
|
const start2 = match.index;
|
|
const end2 = start2 + match[0].length;
|
|
if (!mousedown) {
|
|
if (selectionAndRangeOverlap(selection, eqnStartBound + start2, eqnStartBound + end2))
|
|
continue;
|
|
if (selectionAndRangeOverlap(selection, eqnStartBound + j, eqnStartBound + j + 2))
|
|
continue;
|
|
if (selectionAndRangeOverlap(selection, eqnStartBound + k, eqnStartBound + k + 1))
|
|
continue;
|
|
}
|
|
concealments.push({ start: start2, end: end2 - 1, replacement: "" });
|
|
concealments.push({ start: end2 - 1, end: end2, replacement: "(", class: "cm-bracket" });
|
|
concealments.push({ start: j, end: j + 1, replacement: ")", class: "cm-bracket" });
|
|
concealments.push({ start: j + 1, end: j + 1, replacement: "/", class: "cm-bracket" });
|
|
concealments.push({ start: j + 1, end: j + 2, replacement: "(", class: "cm-bracket" });
|
|
concealments.push({ start: k, end: k + 1, replacement: ")", class: "cm-bracket" });
|
|
}
|
|
return concealments;
|
|
}
|
|
function conceal(view) {
|
|
var _a;
|
|
const widgets = [];
|
|
const selection = view.state.selection;
|
|
const mousedown = (_a = view.plugin(import_obsidian6.livePreviewState)) == null ? void 0 : _a.mousedown;
|
|
for (const { from, to } of view.visibleRanges) {
|
|
(0, import_language5.syntaxTree)(view.state).iterate({
|
|
from,
|
|
to,
|
|
enter: (node) => {
|
|
const type = node.type;
|
|
const to2 = node.to;
|
|
if (!(type.name.contains("begin") && type.name.contains("math"))) {
|
|
return;
|
|
}
|
|
const bounds = getEquationBounds(view.state, to2);
|
|
if (!bounds)
|
|
return;
|
|
const eqn = view.state.doc.sliceString(bounds.start, bounds.end);
|
|
const ALL_SYMBOLS = __spreadValues(__spreadValues({}, greek), cmd_symbols);
|
|
const concealments = [
|
|
...concealSymbols(eqn, "\\^", "", map_super),
|
|
...concealSymbols(eqn, "_", "", map_sub),
|
|
...concealSymbols(eqn, "\\\\frac", "", fractions),
|
|
...concealSymbols(eqn, "\\\\", "", ALL_SYMBOLS, void 0, false),
|
|
...concealSupSub(eqn, true, ALL_SYMBOLS),
|
|
...concealSupSub(eqn, false, ALL_SYMBOLS),
|
|
...concealModifier(eqn, "hat", "\u0302"),
|
|
...concealModifier(eqn, "dot", "\u0307"),
|
|
...concealModifier(eqn, "ddot", "\u0308"),
|
|
...concealModifier(eqn, "overline", "\u0304"),
|
|
...concealModifier(eqn, "bar", "\u0304"),
|
|
...concealModifier(eqn, "tilde", "\u0303"),
|
|
...concealModifier(eqn, "vec", "\u20D7"),
|
|
...concealSymbols(eqn, "\\\\", "", brackets, "cm-bracket"),
|
|
...concealAtoZ(eqn, "\\\\mathcal{", "}", mathscrcal),
|
|
...concealModifiedGreekLetters(eqn, greek),
|
|
...concealModified_A_to_Z_0_to_9(eqn, mathbb),
|
|
...concealText(eqn),
|
|
...concealBraKet(eqn, selection, bounds.start, mousedown),
|
|
...concealSet(eqn, selection, bounds.start, mousedown),
|
|
...concealFraction(eqn, selection, bounds.start, mousedown),
|
|
...concealOperators(eqn, operators)
|
|
];
|
|
for (const concealment of concealments) {
|
|
const start2 = bounds.start + concealment.start;
|
|
const end2 = bounds.start + concealment.end;
|
|
const symbol = concealment.replacement;
|
|
let inclusiveStart = false;
|
|
let inclusiveEnd = false;
|
|
if (symbol === "") {
|
|
inclusiveStart = true;
|
|
}
|
|
if (!mousedown && selectionAndRangeOverlap(selection, start2, end2))
|
|
continue;
|
|
if (start2 === end2) {
|
|
widgets.push(import_view10.Decoration.widget({
|
|
widget: new TextWidget(symbol),
|
|
block: false
|
|
}).range(start2, end2));
|
|
} else {
|
|
widgets.push(import_view10.Decoration.replace({
|
|
widget: new ConcealWidget(symbol, concealment.class, concealment.elementType),
|
|
inclusiveStart,
|
|
inclusiveEnd,
|
|
block: false
|
|
}).range(start2, end2));
|
|
}
|
|
}
|
|
}
|
|
});
|
|
}
|
|
return import_view10.Decoration.set(widgets, true);
|
|
}
|
|
var concealPlugin = import_view10.ViewPlugin.fromClass(class {
|
|
constructor(view) {
|
|
this.decorations = conceal(view);
|
|
}
|
|
update(update) {
|
|
if (update.docChanged || update.viewportChanged || update.selectionSet)
|
|
this.decorations = conceal(update.view);
|
|
}
|
|
}, { decorations: (v) => v.decorations });
|
|
|
|
// src/editor_extensions/highlight_brackets.ts
|
|
var import_view11 = __toModule(require("@codemirror/view"));
|
|
var import_state11 = __toModule(require("@codemirror/state"));
|
|
var import_language6 = __toModule(require("@codemirror/language"));
|
|
var Ncolors = 3;
|
|
function getHighlightBracketMark(pos, className) {
|
|
return import_view11.Decoration.mark({
|
|
inclusive: true,
|
|
attributes: {},
|
|
class: className
|
|
}).range(pos, pos + 1);
|
|
}
|
|
function colorPairedBrackets(view) {
|
|
const widgets = [];
|
|
for (const { from, to } of view.visibleRanges) {
|
|
(0, import_language6.syntaxTree)(view.state).iterate({
|
|
from,
|
|
to,
|
|
enter: (node) => {
|
|
const type = node.type;
|
|
const to2 = node.to;
|
|
if (!(type.name.contains("begin") && type.name.contains("math"))) {
|
|
return;
|
|
}
|
|
const bounds = getEquationBounds(view.state, to2);
|
|
if (!bounds)
|
|
return;
|
|
const eqn = view.state.doc.sliceString(bounds.start, bounds.end);
|
|
const openBrackets = ["{", "[", "("];
|
|
const closeBrackets2 = ["}", "]", ")"];
|
|
const bracketsStack = [];
|
|
const bracketsPosStack = [];
|
|
for (let i = 0; i < eqn.length; i++) {
|
|
const char = eqn.charAt(i);
|
|
if (openBrackets.contains(char)) {
|
|
bracketsStack.push(char);
|
|
bracketsPosStack.push(i);
|
|
} else if (closeBrackets2.contains(char)) {
|
|
const lastBracket = bracketsStack.at(-1);
|
|
if (getCloseBracket(lastBracket) === char) {
|
|
bracketsStack.pop();
|
|
const lastBracketPos = bracketsPosStack.pop();
|
|
const depth = bracketsStack.length % Ncolors;
|
|
const className = "latex-suite-color-bracket-" + depth;
|
|
const j = lastBracketPos + bounds.start;
|
|
const k = i + bounds.start;
|
|
widgets.push(getHighlightBracketMark(j, className));
|
|
widgets.push(getHighlightBracketMark(k, className));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
});
|
|
}
|
|
return import_view11.Decoration.set(widgets, true);
|
|
}
|
|
function getEnclosingBracketsPos(view, pos) {
|
|
const result = getEquationBounds(view.state);
|
|
if (!result)
|
|
return -1;
|
|
const { start: start2, end: end2 } = result;
|
|
const text = view.state.doc.sliceString(start2, end2);
|
|
for (let i = pos - start2; i > 0; i--) {
|
|
let curChar = text.charAt(i);
|
|
if ([")", "]", "}"].contains(curChar)) {
|
|
const closeBracket = curChar;
|
|
const openBracket = getOpenBracket(closeBracket);
|
|
const j = findMatchingBracket(text, i, openBracket, closeBracket, true);
|
|
if (j === -1)
|
|
return -1;
|
|
i = j;
|
|
curChar = text.charAt(i);
|
|
} else {
|
|
if (!["{", "(", "["].contains(curChar))
|
|
continue;
|
|
const j = findMatchingBracket(text, i, curChar, getCloseBracket(curChar), false);
|
|
if (j === -1)
|
|
continue;
|
|
return { left: i + start2, right: j + start2 };
|
|
}
|
|
}
|
|
return -1;
|
|
}
|
|
function highlightCursorBrackets(view) {
|
|
const widgets = [];
|
|
const selection = view.state.selection;
|
|
const ranges = selection.ranges;
|
|
const text = view.state.doc.toString();
|
|
const ctx = Context.fromView(view);
|
|
if (!ctx.mode.inMath()) {
|
|
return import_view11.Decoration.none;
|
|
}
|
|
const bounds = ctx.getBounds(selection.main.to);
|
|
if (!bounds)
|
|
return import_view11.Decoration.none;
|
|
const eqn = view.state.doc.sliceString(bounds.start, bounds.end);
|
|
const openBrackets = ["{", "[", "("];
|
|
const brackets2 = ["{", "[", "(", "}", "]", ")"];
|
|
let done = false;
|
|
for (const range of ranges) {
|
|
for (let i = range.to; i > range.from - 2; i--) {
|
|
const char = text.charAt(i);
|
|
if (!brackets2.contains(char))
|
|
continue;
|
|
let openBracket, closeBracket;
|
|
let backwards = false;
|
|
if (openBrackets.contains(char)) {
|
|
openBracket = char;
|
|
closeBracket = getCloseBracket(openBracket);
|
|
} else {
|
|
closeBracket = char;
|
|
openBracket = getOpenBracket(char);
|
|
backwards = true;
|
|
}
|
|
let j = findMatchingBracket(eqn, i - bounds.start, openBracket, closeBracket, backwards);
|
|
if (j === -1)
|
|
continue;
|
|
j = j + bounds.start;
|
|
widgets.push(getHighlightBracketMark(i, "latex-suite-highlighted-bracket"));
|
|
widgets.push(getHighlightBracketMark(j, "latex-suite-highlighted-bracket"));
|
|
done = true;
|
|
break;
|
|
}
|
|
if (done)
|
|
break;
|
|
if (range.empty) {
|
|
const pos = range.from - 1;
|
|
const result = getEnclosingBracketsPos(view, pos);
|
|
if (result === -1)
|
|
continue;
|
|
widgets.push(getHighlightBracketMark(result.left, "latex-suite-highlighted-bracket"));
|
|
widgets.push(getHighlightBracketMark(result.right, "latex-suite-highlighted-bracket"));
|
|
done = true;
|
|
break;
|
|
}
|
|
if (done)
|
|
break;
|
|
}
|
|
return import_view11.Decoration.set(widgets, true);
|
|
}
|
|
var colorPairedBracketsPlugin = import_view11.ViewPlugin.fromClass(class {
|
|
constructor(view) {
|
|
this.decorations = colorPairedBrackets(view);
|
|
}
|
|
update(update) {
|
|
if (update.docChanged || update.viewportChanged) {
|
|
this.decorations = colorPairedBrackets(update.view);
|
|
}
|
|
}
|
|
}, { decorations: (v) => v.decorations });
|
|
var colorPairedBracketsPluginLowestPrec = import_state11.Prec.lowest(colorPairedBracketsPlugin.extension);
|
|
var highlightCursorBracketsPlugin = import_view11.ViewPlugin.fromClass(class {
|
|
constructor(view) {
|
|
this.decorations = highlightCursorBrackets(view);
|
|
}
|
|
update(update) {
|
|
if (update.docChanged || update.selectionSet)
|
|
this.decorations = highlightCursorBrackets(update.view);
|
|
}
|
|
}, { decorations: (v) => v.decorations });
|
|
|
|
// src/editor_extensions/math_tooltip.ts
|
|
var import_view12 = __toModule(require("@codemirror/view"));
|
|
var import_state12 = __toModule(require("@codemirror/state"));
|
|
var import_obsidian7 = __toModule(require("obsidian"));
|
|
var cursorTooltipField = import_state12.StateField.define({
|
|
create: getCursorTooltips,
|
|
update(tooltips2, tr) {
|
|
if (!tr.docChanged && !tr.selection)
|
|
return tooltips2;
|
|
return getCursorTooltips(tr.state);
|
|
},
|
|
provide: (f) => import_view12.showTooltip.computeN([f], (state) => state.field(f))
|
|
});
|
|
function getCursorTooltips(state) {
|
|
const settings = getLatexSuiteConfig(state);
|
|
const ctx = Context.fromState(state);
|
|
if (!ctx.mode.inMath()) {
|
|
return [];
|
|
}
|
|
const isLivePreview = state.field(import_obsidian7.editorLivePreviewField);
|
|
if (ctx.mode.blockMath && isLivePreview)
|
|
return [];
|
|
const bounds = ctx.getBounds();
|
|
if (!bounds)
|
|
return [];
|
|
const eqn = state.sliceDoc(bounds.start, bounds.end);
|
|
if (eqn.trim() === "")
|
|
return [];
|
|
return [
|
|
{
|
|
pos: ctx.mode.inlineMath || settings.mathPreviewPositionIsAbove ? bounds.start : bounds.end,
|
|
above: settings.mathPreviewPositionIsAbove,
|
|
strictSide: true,
|
|
arrow: true,
|
|
create: () => {
|
|
const dom = document.createElement("div");
|
|
dom.className = "cm-tooltip-cursor";
|
|
const renderedEqn = (0, import_obsidian7.renderMath)(eqn, ctx.mode.blockMath || ctx.mode.codeMath);
|
|
dom.appendChild(renderedEqn);
|
|
(0, import_obsidian7.finishRenderMath)();
|
|
return { dom };
|
|
}
|
|
}
|
|
];
|
|
}
|
|
var cursorTooltipBaseTheme = import_view12.EditorView.baseTheme({
|
|
".cm-tooltip.cm-tooltip-cursor": {
|
|
backgroundColor: "var(--background-secondary)",
|
|
color: "var(--text-normal)",
|
|
border: "1px solid var(--background-modifier-border-hover)",
|
|
padding: "4px 6px",
|
|
borderRadius: "6px",
|
|
"& .cm-tooltip-arrow:before": {
|
|
borderTopColor: "var(--background-modifier-border-hover)",
|
|
borderBottomColor: "var(--background-modifier-border-hover)"
|
|
},
|
|
"& .cm-tooltip-arrow:after": {
|
|
borderTopColor: "var(--background-secondary)",
|
|
borderBottomColor: "var(--background-secondary)"
|
|
},
|
|
"& p": {
|
|
margin: "0px"
|
|
},
|
|
"& mjx-container": {
|
|
padding: "2px !important"
|
|
}
|
|
}
|
|
});
|
|
|
|
// src/latex_suite.ts
|
|
var handleUpdate = (update) => {
|
|
const cursorTriggeredByChange = update.state.field(cursorTriggerStateField, false);
|
|
if (update.selectionSet) {
|
|
if (!cursorTriggeredByChange) {
|
|
if (!isInsideATabstop(update.view)) {
|
|
removeAllTabstops(update.view);
|
|
}
|
|
}
|
|
}
|
|
handleUndoRedo(update);
|
|
};
|
|
var onKeydown = (event, view) => {
|
|
const success = handleKeydown(event.key, event.shiftKey, event.ctrlKey || event.metaKey, view);
|
|
if (success)
|
|
event.preventDefault();
|
|
};
|
|
var handleKeydown = (key, shiftKey, ctrlKey, view) => {
|
|
const settings = getLatexSuiteConfig(view);
|
|
const ctx = Context.fromView(view);
|
|
let success = false;
|
|
if (settings.snippetsEnabled) {
|
|
if (!ctrlKey) {
|
|
try {
|
|
success = runSnippets(view, ctx, key);
|
|
if (success)
|
|
return true;
|
|
} catch (e) {
|
|
clearSnippetQueue(view);
|
|
console.error(e);
|
|
}
|
|
}
|
|
}
|
|
const taboutByCloseBracket = shouldTaboutByCloseBracket(view, key);
|
|
if (key === "Tab" || taboutByCloseBracket) {
|
|
success = handleTabstops(view);
|
|
if (success)
|
|
return true;
|
|
}
|
|
if (settings.autofractionEnabled && ctx.mode.strictlyInMath()) {
|
|
if (key === "/") {
|
|
success = runAutoFraction(view, ctx);
|
|
if (success)
|
|
return true;
|
|
}
|
|
}
|
|
if (settings.matrixShortcutsEnabled && ctx.mode.blockMath) {
|
|
if (["Tab", "Enter"].contains(key)) {
|
|
success = runMatrixShortcuts(view, ctx, key, shiftKey);
|
|
if (success)
|
|
return true;
|
|
}
|
|
}
|
|
if (settings.taboutEnabled) {
|
|
if (key === "Tab") {
|
|
success = tabout(view, ctx);
|
|
if (success)
|
|
return true;
|
|
}
|
|
}
|
|
tidyTabstops(view);
|
|
return false;
|
|
};
|
|
var handleTabstops = (view) => {
|
|
const success = consumeAndGotoNextTabstop(view);
|
|
return success;
|
|
};
|
|
var latexSuiteExtensions = (settings) => [
|
|
getLatexSuiteConfigExtension(settings),
|
|
import_state13.Prec.highest(import_view13.EditorView.domEventHandlers({ "keydown": onKeydown })),
|
|
import_view13.EditorView.updateListener.of(handleUpdate),
|
|
snippetExtensions
|
|
];
|
|
var optionalExtensions = {
|
|
"conceal": [concealPlugin.extension],
|
|
"colorPairedBrackets": [colorPairedBracketsPluginLowestPrec],
|
|
"highlightCursorBrackets": [highlightCursorBracketsPlugin.extension],
|
|
"mathPreview": [cursorTooltipField.extension, cursorTooltipBaseTheme, (0, import_view13.tooltips)({ position: "absolute" })]
|
|
};
|
|
|
|
// src/main.ts
|
|
var LatexSuitePlugin = class extends import_obsidian8.Plugin {
|
|
constructor() {
|
|
super(...arguments);
|
|
this.editorExtensions = [];
|
|
}
|
|
onload() {
|
|
return __async(this, null, function* () {
|
|
yield this.loadSettings();
|
|
this.loadIcons();
|
|
this.addSettingTab(new LatexSuiteSettingTab(this.app, this));
|
|
(0, import_obsidian8.loadMathJax)();
|
|
this.legacyEditorWarning();
|
|
this.registerEditorExtension(this.editorExtensions);
|
|
this.watchSnippetFiles();
|
|
this.addEditorCommands();
|
|
});
|
|
}
|
|
onunload() {
|
|
}
|
|
legacyEditorWarning() {
|
|
var _a;
|
|
if ((_a = this.app.vault.config) == null ? void 0 : _a.legacyEditor) {
|
|
const message = "Obsidian Latex Suite: This plugin does not support the legacy editor. Switch to Live Preview mode to use this plugin.";
|
|
new import_obsidian8.Notice(message, 1e5);
|
|
console.log(message);
|
|
return;
|
|
}
|
|
}
|
|
loadSettings() {
|
|
return __async(this, null, function* () {
|
|
let data = yield this.loadData();
|
|
const shouldMigrateSettings = data ? "basicSettings" in data : false;
|
|
function migrateSettings(oldSettings) {
|
|
return __spreadProps(__spreadValues(__spreadValues({}, oldSettings.basicSettings), oldSettings.rawSettings), {
|
|
snippets: oldSettings.snippets
|
|
});
|
|
}
|
|
if (shouldMigrateSettings) {
|
|
data = migrateSettings(data);
|
|
}
|
|
this.settings = Object.assign({}, DEFAULT_SETTINGS, data);
|
|
if (shouldMigrateSettings) {
|
|
this.saveSettings();
|
|
}
|
|
if (this.settings.loadSnippetsFromFile) {
|
|
const tempSnippetVariables = getSnippetVariables(this.settings.snippetVariables);
|
|
let tempSnippets = [];
|
|
try {
|
|
tempSnippets = yield parseSnippets(this.settings.snippets, tempSnippetVariables);
|
|
} catch (e) {
|
|
new import_obsidian8.Notice(`Failed to load snippets:
|
|
${e}`);
|
|
console.log("Failed to load snippets:\n", e);
|
|
}
|
|
this.CMSettings = processLatexSuiteSettings(tempSnippets, this.settings);
|
|
this.app.workspace.onLayoutReady(() => {
|
|
this.processSettings();
|
|
});
|
|
} else {
|
|
yield this.processSettings();
|
|
}
|
|
});
|
|
}
|
|
saveSettings() {
|
|
return __async(this, null, function* () {
|
|
yield this.saveData(this.settings);
|
|
this.processSettings();
|
|
});
|
|
}
|
|
getSnippets() {
|
|
return __async(this, null, function* () {
|
|
const snippetVariables = getSnippetVariables(this.settings.snippetVariables);
|
|
if (!this.settings.loadSnippetsFromFile) {
|
|
let snippets2 = [];
|
|
try {
|
|
snippets2 = yield parseSnippets(this.settings.snippets, snippetVariables);
|
|
} catch (e) {
|
|
new import_obsidian8.Notice("Failed to load snippets from settings");
|
|
console.log("Failed to load snippets from settings:", e);
|
|
}
|
|
return snippets2;
|
|
} else {
|
|
const snippets2 = yield getSnippetsWithinFileOrFolder(this.app.vault, this.settings.snippetsFileLocation, snippetVariables);
|
|
return snippets2;
|
|
}
|
|
});
|
|
}
|
|
processSettings() {
|
|
return __async(this, null, function* () {
|
|
this.CMSettings = processLatexSuiteSettings(yield this.getSnippets(), this.settings);
|
|
this.reconfigureLatexSuiteConfig();
|
|
this.refreshCMExtensions();
|
|
});
|
|
}
|
|
reconfigureLatexSuiteConfig() {
|
|
iterateCM6(this.app.workspace, (view) => {
|
|
view.dispatch({
|
|
effects: reconfigureLatexSuiteConfig(this.CMSettings)
|
|
});
|
|
});
|
|
}
|
|
refreshCMExtensions() {
|
|
while (this.editorExtensions.length)
|
|
this.editorExtensions.pop();
|
|
this.editorExtensions.push(latexSuiteExtensions(this.CMSettings));
|
|
const extensionDict = optionalExtensions;
|
|
const features = Object.keys(optionalExtensions);
|
|
for (const feature of features) {
|
|
if (this.CMSettings[feature + "Enabled"]) {
|
|
this.editorExtensions.push(extensionDict[feature]);
|
|
}
|
|
}
|
|
this.app.workspace.updateOptions();
|
|
}
|
|
addEditorCommands() {
|
|
for (const command of getEditorCommands(this)) {
|
|
this.addCommand(command);
|
|
}
|
|
}
|
|
watchSnippetFiles() {
|
|
const eventsAndCallbacks = {
|
|
"modify": onFileChange,
|
|
"delete": onFileDelete,
|
|
"create": onFileCreate
|
|
};
|
|
for (const [key, value] of Object.entries(eventsAndCallbacks)) {
|
|
this.registerEvent(this.app.vault.on(key, (file) => value(this, file)));
|
|
}
|
|
}
|
|
loadIcons() {
|
|
for (const [iconId, svgContent] of Object.entries(ICONS)) {
|
|
(0, import_obsidian8.addIcon)(iconId, svgContent);
|
|
}
|
|
}
|
|
};
|