/* THIS IS A GENERATED/BUNDLED FILE BY ESBUILD if you want to view the source, please visit the github repository of this plugin */ "use strict"; var __create = Object.create; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __getProtoOf = Object.getPrototypeOf; var __hasOwnProp = Object.prototype.hasOwnProperty; var __typeError = (msg) => { throw TypeError(msg); }; var __defNormalProp = (obj, key2, value) => key2 in obj ? __defProp(obj, key2, { enumerable: true, configurable: true, writable: true, value }) : obj[key2] = value; var __commonJS = (cb, mod) => function __require() { try { return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; } catch (e) { throw mod = 0, e; } }; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key2 of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key2) && key2 !== except) __defProp(to, key2, { get: () => from[key2], enumerable: !(desc = __getOwnPropDesc(from, key2)) || desc.enumerable }); } return to; }; var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( // If the importer is in node compatibility mode or this is not an ESM // file that has been converted to a CommonJS file using a Babel- // compatible transform (i.e. "__esModule" has not been set), then set // "default" to the CommonJS "module.exports" for node compatibility. isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod )); var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); var __publicField = (obj, key2, value) => __defNormalProp(obj, typeof key2 !== "symbol" ? key2 + "" : key2, value); var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg); var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj)); var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value); var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value); var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method); // node_modules/crypto-js/core.js var require_core = __commonJS({ "node_modules/crypto-js/core.js"(exports2, module2) { (function(root22, factory) { if (typeof exports2 === "object") { module2.exports = exports2 = factory(); } else if (typeof define === "function" && define.amd) { define([], factory); } else { root22.CryptoJS = factory(); } })(exports2, function() { var CryptoJS = CryptoJS || (function(Math2, undefined2) { var crypto2; if (typeof window !== "undefined" && window.crypto) { crypto2 = window.crypto; } if (typeof self !== "undefined" && self.crypto) { crypto2 = self.crypto; } if (typeof globalThis !== "undefined" && globalThis.crypto) { crypto2 = globalThis.crypto; } if (!crypto2 && typeof window !== "undefined" && window.msCrypto) { crypto2 = window.msCrypto; } if (!crypto2 && typeof global !== "undefined" && global.crypto) { crypto2 = global.crypto; } if (!crypto2 && typeof require === "function") { try { crypto2 = require("crypto"); } catch (err) { } } var cryptoSecureRandomInt = function() { if (crypto2) { if (typeof crypto2.getRandomValues === "function") { try { return crypto2.getRandomValues(new Uint32Array(1))[0]; } catch (err) { } } if (typeof crypto2.randomBytes === "function") { try { return crypto2.randomBytes(4).readInt32LE(); } catch (err) { } } } throw new Error("Native crypto module could not be used to get secure random number."); }; var create = Object.create || /* @__PURE__ */ (function() { function F() { } return function(obj) { var subtype; F.prototype = obj; subtype = new F(); F.prototype = null; return subtype; }; })(); var C = {}; var C_lib = C.lib = {}; var Base2 = C_lib.Base = /* @__PURE__ */ (function() { return { /** * Creates a new object that inherits from this object. * * @param {Object} overrides Properties to copy into the new object. * * @return {Object} The new object. * * @static * * @example * * var MyType = CryptoJS.lib.Base.extend({ * field: 'value', * * method: function () { * } * }); */ extend: function(overrides) { var subtype = create(this); if (overrides) { subtype.mixIn(overrides); } if (!subtype.hasOwnProperty("init") || this.init === subtype.init) { subtype.init = function() { subtype.$super.init.apply(this, arguments); }; } subtype.init.prototype = subtype; subtype.$super = this; return subtype; }, /** * Extends this object and runs the init method. * Arguments to create() will be passed to init(). * * @return {Object} The new object. * * @static * * @example * * var instance = MyType.create(); */ create: function() { var instance = this.extend(); instance.init.apply(instance, arguments); return instance; }, /** * Initializes a newly created object. * Override this method to add some logic when your objects are created. * * @example * * var MyType = CryptoJS.lib.Base.extend({ * init: function () { * // ... * } * }); */ init: function() { }, /** * Copies properties into this object. * * @param {Object} properties The properties to mix in. * * @example * * MyType.mixIn({ * field: 'value' * }); */ mixIn: function(properties) { for (var propertyName in properties) { if (properties.hasOwnProperty(propertyName)) { this[propertyName] = properties[propertyName]; } } if (properties.hasOwnProperty("toString")) { this.toString = properties.toString; } }, /** * Creates a copy of this object. * * @return {Object} The clone. * * @example * * var clone = instance.clone(); */ clone: function() { return this.init.prototype.extend(this); } }; })(); var WordArray = C_lib.WordArray = Base2.extend({ /** * Initializes a newly created word array. * * @param {Array} words (Optional) An array of 32-bit words. * @param {number} sigBytes (Optional) The number of significant bytes in the words. * * @example * * var wordArray = CryptoJS.lib.WordArray.create(); * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607]); * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607], 6); */ init: function(words, sigBytes) { words = this.words = words || []; if (sigBytes != undefined2) { this.sigBytes = sigBytes; } else { this.sigBytes = words.length * 4; } }, /** * Converts this word array to a string. * * @param {Encoder} encoder (Optional) The encoding strategy to use. Default: CryptoJS.enc.Hex * * @return {string} The stringified word array. * * @example * * var string = wordArray + ''; * var string = wordArray.toString(); * var string = wordArray.toString(CryptoJS.enc.Utf8); */ toString: function(encoder) { return (encoder || Hex).stringify(this); }, /** * Concatenates a word array to this word array. * * @param {WordArray} wordArray The word array to append. * * @return {WordArray} This word array. * * @example * * wordArray1.concat(wordArray2); */ concat: function(wordArray) { var thisWords = this.words; var thatWords = wordArray.words; var thisSigBytes = this.sigBytes; var thatSigBytes = wordArray.sigBytes; this.clamp(); if (thisSigBytes % 4) { for (var i = 0; i < thatSigBytes; i++) { var thatByte = thatWords[i >>> 2] >>> 24 - i % 4 * 8 & 255; thisWords[thisSigBytes + i >>> 2] |= thatByte << 24 - (thisSigBytes + i) % 4 * 8; } } else { for (var j = 0; j < thatSigBytes; j += 4) { thisWords[thisSigBytes + j >>> 2] = thatWords[j >>> 2]; } } this.sigBytes += thatSigBytes; return this; }, /** * Removes insignificant bits. * * @example * * wordArray.clamp(); */ clamp: function() { var words = this.words; var sigBytes = this.sigBytes; words[sigBytes >>> 2] &= 4294967295 << 32 - sigBytes % 4 * 8; words.length = Math2.ceil(sigBytes / 4); }, /** * Creates a copy of this word array. * * @return {WordArray} The clone. * * @example * * var clone = wordArray.clone(); */ clone: function() { var clone = Base2.clone.call(this); clone.words = this.words.slice(0); return clone; }, /** * Creates a word array filled with random bytes. * * @param {number} nBytes The number of random bytes to generate. * * @return {WordArray} The random word array. * * @static * * @example * * var wordArray = CryptoJS.lib.WordArray.random(16); */ random: function(nBytes) { var words = []; for (var i = 0; i < nBytes; i += 4) { words.push(cryptoSecureRandomInt()); } return new WordArray.init(words, nBytes); } }); var C_enc = C.enc = {}; var Hex = C_enc.Hex = { /** * Converts a word array to a hex string. * * @param {WordArray} wordArray The word array. * * @return {string} The hex string. * * @static * * @example * * var hexString = CryptoJS.enc.Hex.stringify(wordArray); */ stringify: function(wordArray) { var words = wordArray.words; var sigBytes = wordArray.sigBytes; var hexChars = []; for (var i = 0; i < sigBytes; i++) { var bite = words[i >>> 2] >>> 24 - i % 4 * 8 & 255; hexChars.push((bite >>> 4).toString(16)); hexChars.push((bite & 15).toString(16)); } return hexChars.join(""); }, /** * Converts a hex string to a word array. * * @param {string} hexStr The hex string. * * @return {WordArray} The word array. * * @static * * @example * * var wordArray = CryptoJS.enc.Hex.parse(hexString); */ parse: function(hexStr) { var hexStrLength = hexStr.length; var words = []; for (var i = 0; i < hexStrLength; i += 2) { words[i >>> 3] |= parseInt(hexStr.substr(i, 2), 16) << 24 - i % 8 * 4; } return new WordArray.init(words, hexStrLength / 2); } }; var Latin1 = C_enc.Latin1 = { /** * Converts a word array to a Latin1 string. * * @param {WordArray} wordArray The word array. * * @return {string} The Latin1 string. * * @static * * @example * * var latin1String = CryptoJS.enc.Latin1.stringify(wordArray); */ stringify: function(wordArray) { var words = wordArray.words; var sigBytes = wordArray.sigBytes; var latin1Chars = []; for (var i = 0; i < sigBytes; i++) { var bite = words[i >>> 2] >>> 24 - i % 4 * 8 & 255; latin1Chars.push(String.fromCharCode(bite)); } return latin1Chars.join(""); }, /** * Converts a Latin1 string to a word array. * * @param {string} latin1Str The Latin1 string. * * @return {WordArray} The word array. * * @static * * @example * * var wordArray = CryptoJS.enc.Latin1.parse(latin1String); */ parse: function(latin1Str) { var latin1StrLength = latin1Str.length; var words = []; for (var i = 0; i < latin1StrLength; i++) { words[i >>> 2] |= (latin1Str.charCodeAt(i) & 255) << 24 - i % 4 * 8; } return new WordArray.init(words, latin1StrLength); } }; var Utf8 = C_enc.Utf8 = { /** * Converts a word array to a UTF-8 string. * * @param {WordArray} wordArray The word array. * * @return {string} The UTF-8 string. * * @static * * @example * * var utf8String = CryptoJS.enc.Utf8.stringify(wordArray); */ stringify: function(wordArray) { try { return decodeURIComponent(escape(Latin1.stringify(wordArray))); } catch (e) { throw new Error("Malformed UTF-8 data"); } }, /** * Converts a UTF-8 string to a word array. * * @param {string} utf8Str The UTF-8 string. * * @return {WordArray} The word array. * * @static * * @example * * var wordArray = CryptoJS.enc.Utf8.parse(utf8String); */ parse: function(utf8Str) { return Latin1.parse(unescape(encodeURIComponent(utf8Str))); } }; var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm = Base2.extend({ /** * Resets this block algorithm's data buffer to its initial state. * * @example * * bufferedBlockAlgorithm.reset(); */ reset: function() { this._data = new WordArray.init(); this._nDataBytes = 0; }, /** * Adds new data to this block algorithm's buffer. * * @param {WordArray|string} data The data to append. Strings are converted to a WordArray using UTF-8. * * @example * * bufferedBlockAlgorithm._append('data'); * bufferedBlockAlgorithm._append(wordArray); */ _append: function(data) { if (typeof data == "string") { data = Utf8.parse(data); } this._data.concat(data); this._nDataBytes += data.sigBytes; }, /** * Processes available data blocks. * * This method invokes _doProcessBlock(offset), which must be implemented by a concrete subtype. * * @param {boolean} doFlush Whether all blocks and partial blocks should be processed. * * @return {WordArray} The processed data. * * @example * * var processedData = bufferedBlockAlgorithm._process(); * var processedData = bufferedBlockAlgorithm._process(!!'flush'); */ _process: function(doFlush) { var processedWords; var data = this._data; var dataWords = data.words; var dataSigBytes = data.sigBytes; var blockSize = this.blockSize; var blockSizeBytes = blockSize * 4; var nBlocksReady = dataSigBytes / blockSizeBytes; if (doFlush) { nBlocksReady = Math2.ceil(nBlocksReady); } else { nBlocksReady = Math2.max((nBlocksReady | 0) - this._minBufferSize, 0); } var nWordsReady = nBlocksReady * blockSize; var nBytesReady = Math2.min(nWordsReady * 4, dataSigBytes); if (nWordsReady) { for (var offset3 = 0; offset3 < nWordsReady; offset3 += blockSize) { this._doProcessBlock(dataWords, offset3); } processedWords = dataWords.splice(0, nWordsReady); data.sigBytes -= nBytesReady; } return new WordArray.init(processedWords, nBytesReady); }, /** * Creates a copy of this object. * * @return {Object} The clone. * * @example * * var clone = bufferedBlockAlgorithm.clone(); */ clone: function() { var clone = Base2.clone.call(this); clone._data = this._data.clone(); return clone; }, _minBufferSize: 0 }); var Hasher = C_lib.Hasher = BufferedBlockAlgorithm.extend({ /** * Configuration options. */ cfg: Base2.extend(), /** * Initializes a newly created hasher. * * @param {Object} cfg (Optional) The configuration options to use for this hash computation. * * @example * * var hasher = CryptoJS.algo.SHA256.create(); */ init: function(cfg) { this.cfg = this.cfg.extend(cfg); this.reset(); }, /** * Resets this hasher to its initial state. * * @example * * hasher.reset(); */ reset: function() { BufferedBlockAlgorithm.reset.call(this); this._doReset(); }, /** * Updates this hasher with a message. * * @param {WordArray|string} messageUpdate The message to append. * * @return {Hasher} This hasher. * * @example * * hasher.update('message'); * hasher.update(wordArray); */ update: function(messageUpdate) { this._append(messageUpdate); this._process(); return this; }, /** * Finalizes the hash computation. * Note that the finalize operation is effectively a destructive, read-once operation. * * @param {WordArray|string} messageUpdate (Optional) A final message update. * * @return {WordArray} The hash. * * @example * * var hash = hasher.finalize(); * var hash = hasher.finalize('message'); * var hash = hasher.finalize(wordArray); */ finalize: function(messageUpdate) { if (messageUpdate) { this._append(messageUpdate); } var hash2 = this._doFinalize(); return hash2; }, blockSize: 512 / 32, /** * Creates a shortcut function to a hasher's object interface. * * @param {Hasher} hasher The hasher to create a helper for. * * @return {Function} The shortcut function. * * @static * * @example * * var SHA256 = CryptoJS.lib.Hasher._createHelper(CryptoJS.algo.SHA256); */ _createHelper: function(hasher) { return function(message, cfg) { return new hasher.init(cfg).finalize(message); }; }, /** * Creates a shortcut function to the HMAC's object interface. * * @param {Hasher} hasher The hasher to use in this HMAC helper. * * @return {Function} The shortcut function. * * @static * * @example * * var HmacSHA256 = CryptoJS.lib.Hasher._createHmacHelper(CryptoJS.algo.SHA256); */ _createHmacHelper: function(hasher) { return function(message, key2) { return new C_algo.HMAC.init(hasher, key2).finalize(message); }; } }); var C_algo = C.algo = {}; return C; })(Math); return CryptoJS; }); } }); // node_modules/crypto-js/sha256.js var require_sha256 = __commonJS({ "node_modules/crypto-js/sha256.js"(exports2, module2) { (function(root22, factory) { if (typeof exports2 === "object") { module2.exports = exports2 = factory(require_core()); } else if (typeof define === "function" && define.amd) { define(["./core"], factory); } else { factory(root22.CryptoJS); } })(exports2, function(CryptoJS) { (function(Math2) { var C = CryptoJS; var C_lib = C.lib; var WordArray = C_lib.WordArray; var Hasher = C_lib.Hasher; var C_algo = C.algo; var H = []; var K = []; (function() { function isPrime(n2) { var sqrtN = Math2.sqrt(n2); for (var factor = 2; factor <= sqrtN; factor++) { if (!(n2 % factor)) { return false; } } return true; } function getFractionalBits(n2) { return (n2 - (n2 | 0)) * 4294967296 | 0; } var n = 2; var nPrime = 0; while (nPrime < 64) { if (isPrime(n)) { if (nPrime < 8) { H[nPrime] = getFractionalBits(Math2.pow(n, 1 / 2)); } K[nPrime] = getFractionalBits(Math2.pow(n, 1 / 3)); nPrime++; } n++; } })(); var W = []; var SHA256 = C_algo.SHA256 = Hasher.extend({ _doReset: function() { this._hash = new WordArray.init(H.slice(0)); }, _doProcessBlock: function(M, offset3) { var H2 = this._hash.words; var a = H2[0]; var b = H2[1]; var c = H2[2]; var d = H2[3]; var e = H2[4]; var f = H2[5]; var g = H2[6]; var h = H2[7]; for (var i = 0; i < 64; i++) { if (i < 16) { W[i] = M[offset3 + i] | 0; } else { var gamma0x = W[i - 15]; var gamma0 = (gamma0x << 25 | gamma0x >>> 7) ^ (gamma0x << 14 | gamma0x >>> 18) ^ gamma0x >>> 3; var gamma1x = W[i - 2]; var gamma1 = (gamma1x << 15 | gamma1x >>> 17) ^ (gamma1x << 13 | gamma1x >>> 19) ^ gamma1x >>> 10; W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16]; } var ch = e & f ^ ~e & g; var maj = a & b ^ a & c ^ b & c; var sigma0 = (a << 30 | a >>> 2) ^ (a << 19 | a >>> 13) ^ (a << 10 | a >>> 22); var sigma1 = (e << 26 | e >>> 6) ^ (e << 21 | e >>> 11) ^ (e << 7 | e >>> 25); var t1 = h + sigma1 + ch + K[i] + W[i]; var t2 = sigma0 + maj; h = g; g = f; f = e; e = d + t1 | 0; d = c; c = b; b = a; a = t1 + t2 | 0; } H2[0] = H2[0] + a | 0; H2[1] = H2[1] + b | 0; H2[2] = H2[2] + c | 0; H2[3] = H2[3] + d | 0; H2[4] = H2[4] + e | 0; H2[5] = H2[5] + f | 0; H2[6] = H2[6] + g | 0; H2[7] = H2[7] + h | 0; }, _doFinalize: function() { var data = this._data; var dataWords = data.words; var nBitsTotal = this._nDataBytes * 8; var nBitsLeft = data.sigBytes * 8; dataWords[nBitsLeft >>> 5] |= 128 << 24 - nBitsLeft % 32; dataWords[(nBitsLeft + 64 >>> 9 << 4) + 14] = Math2.floor(nBitsTotal / 4294967296); dataWords[(nBitsLeft + 64 >>> 9 << 4) + 15] = nBitsTotal; data.sigBytes = dataWords.length * 4; this._process(); return this._hash; }, clone: function() { var clone = Hasher.clone.call(this); clone._hash = this._hash.clone(); return clone; } }); C.SHA256 = Hasher._createHelper(SHA256); C.HmacSHA256 = Hasher._createHmacHelper(SHA256); })(Math); return CryptoJS.SHA256; }); } }); // node_modules/kind-of/index.js var require_kind_of = __commonJS({ "node_modules/kind-of/index.js"(exports2, module2) { var toString = Object.prototype.toString; module2.exports = function kindOf(val) { if (val === void 0) return "undefined"; if (val === null) return "null"; var type = typeof val; if (type === "boolean") return "boolean"; if (type === "string") return "string"; if (type === "number") return "number"; if (type === "symbol") return "symbol"; if (type === "function") { return isGeneratorFn(val) ? "generatorfunction" : "function"; } if (isArray(val)) return "array"; if (isBuffer(val)) return "buffer"; if (isArguments(val)) return "arguments"; if (isDate(val)) return "date"; if (isError(val)) return "error"; if (isRegexp(val)) return "regexp"; switch (ctorName(val)) { case "Symbol": return "symbol"; case "Promise": return "promise"; // Set, Map, WeakSet, WeakMap case "WeakMap": return "weakmap"; case "WeakSet": return "weakset"; case "Map": return "map"; case "Set": return "set"; // 8-bit typed arrays case "Int8Array": return "int8array"; case "Uint8Array": return "uint8array"; case "Uint8ClampedArray": return "uint8clampedarray"; // 16-bit typed arrays case "Int16Array": return "int16array"; case "Uint16Array": return "uint16array"; // 32-bit typed arrays case "Int32Array": return "int32array"; case "Uint32Array": return "uint32array"; case "Float32Array": return "float32array"; case "Float64Array": return "float64array"; } if (isGeneratorObj(val)) { return "generator"; } type = toString.call(val); switch (type) { case "[object Object]": return "object"; // iterators case "[object Map Iterator]": return "mapiterator"; case "[object Set Iterator]": return "setiterator"; case "[object String Iterator]": return "stringiterator"; case "[object Array Iterator]": return "arrayiterator"; } return type.slice(8, -1).toLowerCase().replace(/\s/g, ""); }; function ctorName(val) { return typeof val.constructor === "function" ? val.constructor.name : null; } function isArray(val) { if (Array.isArray) return Array.isArray(val); return val instanceof Array; } function isError(val) { return val instanceof Error || typeof val.message === "string" && val.constructor && typeof val.constructor.stackTraceLimit === "number"; } function isDate(val) { if (val instanceof Date) return true; return typeof val.toDateString === "function" && typeof val.getDate === "function" && typeof val.setDate === "function"; } function isRegexp(val) { if (val instanceof RegExp) return true; return typeof val.flags === "string" && typeof val.ignoreCase === "boolean" && typeof val.multiline === "boolean" && typeof val.global === "boolean"; } function isGeneratorFn(name, val) { return ctorName(name) === "GeneratorFunction"; } function isGeneratorObj(val) { return typeof val.throw === "function" && typeof val.return === "function" && typeof val.next === "function"; } function isArguments(val) { try { if (typeof val.length === "number" && typeof val.callee === "function") { return true; } } catch (err) { if (err.message.indexOf("callee") !== -1) { return true; } } return false; } function isBuffer(val) { if (val.constructor && typeof val.constructor.isBuffer === "function") { return val.constructor.isBuffer(val); } return false; } } }); // node_modules/is-extendable/index.js var require_is_extendable = __commonJS({ "node_modules/is-extendable/index.js"(exports2, module2) { "use strict"; module2.exports = function isExtendable(val) { return typeof val !== "undefined" && val !== null && (typeof val === "object" || typeof val === "function"); }; } }); // node_modules/extend-shallow/index.js var require_extend_shallow = __commonJS({ "node_modules/extend-shallow/index.js"(exports2, module2) { "use strict"; var isObject = require_is_extendable(); module2.exports = function extend(o) { if (!isObject(o)) { o = {}; } var len = arguments.length; for (var i = 1; i < len; i++) { var obj = arguments[i]; if (isObject(obj)) { assign2(o, obj); } } return o; }; function assign2(a, b) { for (var key2 in b) { if (hasOwn(b, key2)) { a[key2] = b[key2]; } } } function hasOwn(obj, key2) { return Object.prototype.hasOwnProperty.call(obj, key2); } } }); // node_modules/section-matter/index.js var require_section_matter = __commonJS({ "node_modules/section-matter/index.js"(exports2, module2) { "use strict"; var typeOf = require_kind_of(); var extend = require_extend_shallow(); module2.exports = function(input, options2) { if (typeof options2 === "function") { options2 = { parse: options2 }; } var file = toObject(input); var defaults = { section_delimiter: "---", parse: identity }; var opts = extend({}, defaults, options2); var delim = opts.section_delimiter; var lines = file.content.split(/\r?\n/); var sections = null; var section = createSection(); var content = []; var stack2 = []; function initSections(val) { file.content = val; sections = []; content = []; } function closeSection(val) { if (stack2.length) { section.key = getKey(stack2[0], delim); section.content = val; opts.parse(section, sections); sections.push(section); section = createSection(); content = []; stack2 = []; } } for (var i = 0; i < lines.length; i++) { var line = lines[i]; var len = stack2.length; var ln = line.trim(); if (isDelimiter(ln, delim)) { if (ln.length === 3 && i !== 0) { if (len === 0 || len === 2) { content.push(line); continue; } stack2.push(ln); section.data = content.join("\n"); content = []; continue; } if (sections === null) { initSections(content.join("\n")); } if (len === 2) { closeSection(content.join("\n")); } stack2.push(ln); continue; } content.push(line); } if (sections === null) { initSections(content.join("\n")); } else { closeSection(content.join("\n")); } file.sections = sections; return file; }; function isDelimiter(line, delim) { if (line.slice(0, delim.length) !== delim) { return false; } if (line.charAt(delim.length + 1) === delim.slice(-1)) { return false; } return true; } function toObject(input) { if (typeOf(input) !== "object") { input = { content: input }; } if (typeof input.content !== "string" && !isBuffer(input.content)) { throw new TypeError("expected a buffer or string"); } input.content = input.content.toString(); input.sections = []; return input; } function getKey(val, delim) { return val ? val.slice(delim.length).trim() : ""; } function createSection() { return { key: "", data: "", content: "" }; } function identity(val) { return val; } function isBuffer(val) { if (val && val.constructor && typeof val.constructor.isBuffer === "function") { return val.constructor.isBuffer(val); } return false; } } }); // node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/common.js var require_common = __commonJS({ "node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/common.js"(exports2, module2) { "use strict"; function isNothing(subject) { return typeof subject === "undefined" || subject === null; } function isObject(subject) { return typeof subject === "object" && subject !== null; } function toArray(sequence) { if (Array.isArray(sequence)) return sequence; else if (isNothing(sequence)) return []; return [sequence]; } function extend(target, source2) { var index2, length, key2, sourceKeys; if (source2) { sourceKeys = Object.keys(source2); for (index2 = 0, length = sourceKeys.length; index2 < length; index2 += 1) { key2 = sourceKeys[index2]; target[key2] = source2[key2]; } } return target; } function repeat(string, count) { var result = "", cycle; for (cycle = 0; cycle < count; cycle += 1) { result += string; } return result; } function isNegativeZero(number) { return number === 0 && Number.NEGATIVE_INFINITY === 1 / number; } module2.exports.isNothing = isNothing; module2.exports.isObject = isObject; module2.exports.toArray = toArray; module2.exports.repeat = repeat; module2.exports.isNegativeZero = isNegativeZero; module2.exports.extend = extend; } }); // node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/exception.js var require_exception = __commonJS({ "node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/exception.js"(exports2, module2) { "use strict"; function YAMLException(reason, mark) { Error.call(this); this.name = "YAMLException"; this.reason = reason; this.mark = mark; this.message = (this.reason || "(unknown reason)") + (this.mark ? " " + this.mark.toString() : ""); if (Error.captureStackTrace) { Error.captureStackTrace(this, this.constructor); } else { this.stack = new Error().stack || ""; } } YAMLException.prototype = Object.create(Error.prototype); YAMLException.prototype.constructor = YAMLException; YAMLException.prototype.toString = function toString(compact) { var result = this.name + ": "; result += this.reason || "(unknown reason)"; if (!compact && this.mark) { result += " " + this.mark.toString(); } return result; }; module2.exports = YAMLException; } }); // node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/mark.js var require_mark = __commonJS({ "node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/mark.js"(exports2, module2) { "use strict"; var common = require_common(); function Mark(name, buffer, position, line, column) { this.name = name; this.buffer = buffer; this.position = position; this.line = line; this.column = column; } Mark.prototype.getSnippet = function getSnippet(indent, maxLength) { var head2, start, tail, end, snippet2; if (!this.buffer) return null; indent = indent || 4; maxLength = maxLength || 75; head2 = ""; start = this.position; while (start > 0 && "\0\r\n\x85\u2028\u2029".indexOf(this.buffer.charAt(start - 1)) === -1) { start -= 1; if (this.position - start > maxLength / 2 - 1) { head2 = " ... "; start += 5; break; } } tail = ""; end = this.position; while (end < this.buffer.length && "\0\r\n\x85\u2028\u2029".indexOf(this.buffer.charAt(end)) === -1) { end += 1; if (end - this.position > maxLength / 2 - 1) { tail = " ... "; end -= 5; break; } } snippet2 = this.buffer.slice(start, end); return common.repeat(" ", indent) + head2 + snippet2 + tail + "\n" + common.repeat(" ", indent + this.position - start + head2.length) + "^"; }; Mark.prototype.toString = function toString(compact) { var snippet2, where = ""; if (this.name) { where += 'in "' + this.name + '" '; } where += "at line " + (this.line + 1) + ", column " + (this.column + 1); if (!compact) { snippet2 = this.getSnippet(); if (snippet2) { where += ":\n" + snippet2; } } return where; }; module2.exports = Mark; } }); // node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type.js var require_type = __commonJS({ "node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type.js"(exports2, module2) { "use strict"; var YAMLException = require_exception(); var TYPE_CONSTRUCTOR_OPTIONS = [ "kind", "resolve", "construct", "instanceOf", "predicate", "represent", "defaultStyle", "styleAliases" ]; var YAML_NODE_KINDS = [ "scalar", "sequence", "mapping" ]; function compileStyleAliases(map) { var result = {}; if (map !== null) { Object.keys(map).forEach(function(style) { map[style].forEach(function(alias) { result[String(alias)] = style; }); }); } return result; } function Type(tag2, options2) { options2 = options2 || {}; Object.keys(options2).forEach(function(name) { if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) { throw new YAMLException('Unknown option "' + name + '" is met in definition of "' + tag2 + '" YAML type.'); } }); this.tag = tag2; this.kind = options2["kind"] || null; this.resolve = options2["resolve"] || function() { return true; }; this.construct = options2["construct"] || function(data) { return data; }; this.instanceOf = options2["instanceOf"] || null; this.predicate = options2["predicate"] || null; this.represent = options2["represent"] || null; this.defaultStyle = options2["defaultStyle"] || null; this.styleAliases = compileStyleAliases(options2["styleAliases"] || null); if (YAML_NODE_KINDS.indexOf(this.kind) === -1) { throw new YAMLException('Unknown kind "' + this.kind + '" is specified for "' + tag2 + '" YAML type.'); } } module2.exports = Type; } }); // node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/schema.js var require_schema = __commonJS({ "node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/schema.js"(exports2, module2) { "use strict"; var common = require_common(); var YAMLException = require_exception(); var Type = require_type(); function compileList(schema, name, result) { var exclude = []; schema.include.forEach(function(includedSchema) { result = compileList(includedSchema, name, result); }); schema[name].forEach(function(currentType) { result.forEach(function(previousType, previousIndex) { if (previousType.tag === currentType.tag && previousType.kind === currentType.kind) { exclude.push(previousIndex); } }); result.push(currentType); }); return result.filter(function(type, index2) { return exclude.indexOf(index2) === -1; }); } function compileMap() { var result = { scalar: {}, sequence: {}, mapping: {}, fallback: {} }, index2, length; function collectType(type) { result[type.kind][type.tag] = result["fallback"][type.tag] = type; } for (index2 = 0, length = arguments.length; index2 < length; index2 += 1) { arguments[index2].forEach(collectType); } return result; } function Schema(definition) { this.include = definition.include || []; this.implicit = definition.implicit || []; this.explicit = definition.explicit || []; this.implicit.forEach(function(type) { if (type.loadKind && type.loadKind !== "scalar") { throw new YAMLException("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported."); } }); this.compiledImplicit = compileList(this, "implicit", []); this.compiledExplicit = compileList(this, "explicit", []); this.compiledTypeMap = compileMap(this.compiledImplicit, this.compiledExplicit); } Schema.DEFAULT = null; Schema.create = function createSchema() { var schemas, types; switch (arguments.length) { case 1: schemas = Schema.DEFAULT; types = arguments[0]; break; case 2: schemas = arguments[0]; types = arguments[1]; break; default: throw new YAMLException("Wrong number of arguments for Schema.create function"); } schemas = common.toArray(schemas); types = common.toArray(types); if (!schemas.every(function(schema) { return schema instanceof Schema; })) { throw new YAMLException("Specified list of super schemas (or a single Schema object) contains a non-Schema object."); } if (!types.every(function(type) { return type instanceof Type; })) { throw new YAMLException("Specified list of YAML types (or a single Type object) contains a non-Type object."); } return new Schema({ include: schemas, explicit: types }); }; module2.exports = Schema; } }); // node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/str.js var require_str = __commonJS({ "node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/str.js"(exports2, module2) { "use strict"; var Type = require_type(); module2.exports = new Type("tag:yaml.org,2002:str", { kind: "scalar", construct: function(data) { return data !== null ? data : ""; } }); } }); // node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/seq.js var require_seq = __commonJS({ "node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/seq.js"(exports2, module2) { "use strict"; var Type = require_type(); module2.exports = new Type("tag:yaml.org,2002:seq", { kind: "sequence", construct: function(data) { return data !== null ? data : []; } }); } }); // node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/map.js var require_map = __commonJS({ "node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/map.js"(exports2, module2) { "use strict"; var Type = require_type(); module2.exports = new Type("tag:yaml.org,2002:map", { kind: "mapping", construct: function(data) { return data !== null ? data : {}; } }); } }); // node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/schema/failsafe.js var require_failsafe = __commonJS({ "node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/schema/failsafe.js"(exports2, module2) { "use strict"; var Schema = require_schema(); module2.exports = new Schema({ explicit: [ require_str(), require_seq(), require_map() ] }); } }); // node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/null.js var require_null = __commonJS({ "node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/null.js"(exports2, module2) { "use strict"; var Type = require_type(); function resolveYamlNull(data) { if (data === null) return true; var max2 = data.length; return max2 === 1 && data === "~" || max2 === 4 && (data === "null" || data === "Null" || data === "NULL"); } function constructYamlNull() { return null; } function isNull(object) { return object === null; } module2.exports = new Type("tag:yaml.org,2002:null", { kind: "scalar", resolve: resolveYamlNull, construct: constructYamlNull, predicate: isNull, represent: { canonical: function() { return "~"; }, lowercase: function() { return "null"; }, uppercase: function() { return "NULL"; }, camelcase: function() { return "Null"; } }, defaultStyle: "lowercase" }); } }); // node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/bool.js var require_bool = __commonJS({ "node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/bool.js"(exports2, module2) { "use strict"; var Type = require_type(); function resolveYamlBoolean(data) { if (data === null) return false; var max2 = data.length; return max2 === 4 && (data === "true" || data === "True" || data === "TRUE") || max2 === 5 && (data === "false" || data === "False" || data === "FALSE"); } function constructYamlBoolean(data) { return data === "true" || data === "True" || data === "TRUE"; } function isBoolean(object) { return Object.prototype.toString.call(object) === "[object Boolean]"; } module2.exports = new Type("tag:yaml.org,2002:bool", { kind: "scalar", resolve: resolveYamlBoolean, construct: constructYamlBoolean, predicate: isBoolean, represent: { lowercase: function(object) { return object ? "true" : "false"; }, uppercase: function(object) { return object ? "TRUE" : "FALSE"; }, camelcase: function(object) { return object ? "True" : "False"; } }, defaultStyle: "lowercase" }); } }); // node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/int.js var require_int = __commonJS({ "node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/int.js"(exports2, module2) { "use strict"; var common = require_common(); var Type = require_type(); function isHexCode(c) { return 48 <= c && c <= 57 || 65 <= c && c <= 70 || 97 <= c && c <= 102; } function isOctCode(c) { return 48 <= c && c <= 55; } function isDecCode(c) { return 48 <= c && c <= 57; } function resolveYamlInteger(data) { if (data === null) return false; var max2 = data.length, index2 = 0, hasDigits = false, ch; if (!max2) return false; ch = data[index2]; if (ch === "-" || ch === "+") { ch = data[++index2]; } if (ch === "0") { if (index2 + 1 === max2) return true; ch = data[++index2]; if (ch === "b") { index2++; for (; index2 < max2; index2++) { ch = data[index2]; if (ch === "_") continue; if (ch !== "0" && ch !== "1") return false; hasDigits = true; } return hasDigits && ch !== "_"; } if (ch === "x") { index2++; for (; index2 < max2; index2++) { ch = data[index2]; if (ch === "_") continue; if (!isHexCode(data.charCodeAt(index2))) return false; hasDigits = true; } return hasDigits && ch !== "_"; } for (; index2 < max2; index2++) { ch = data[index2]; if (ch === "_") continue; if (!isOctCode(data.charCodeAt(index2))) return false; hasDigits = true; } return hasDigits && ch !== "_"; } if (ch === "_") return false; for (; index2 < max2; index2++) { ch = data[index2]; if (ch === "_") continue; if (ch === ":") break; if (!isDecCode(data.charCodeAt(index2))) { return false; } hasDigits = true; } if (!hasDigits || ch === "_") return false; if (ch !== ":") return true; return /^(:[0-5]?[0-9])+$/.test(data.slice(index2)); } function constructYamlInteger(data) { var value = data, sign = 1, ch, base, digits = []; if (value.indexOf("_") !== -1) { value = value.replace(/_/g, ""); } ch = value[0]; if (ch === "-" || ch === "+") { if (ch === "-") sign = -1; value = value.slice(1); ch = value[0]; } if (value === "0") return 0; if (ch === "0") { if (value[1] === "b") return sign * parseInt(value.slice(2), 2); if (value[1] === "x") return sign * parseInt(value, 16); return sign * parseInt(value, 8); } if (value.indexOf(":") !== -1) { value.split(":").forEach(function(v) { digits.unshift(parseInt(v, 10)); }); value = 0; base = 1; digits.forEach(function(d) { value += d * base; base *= 60; }); return sign * value; } return sign * parseInt(value, 10); } function isInteger(object) { return Object.prototype.toString.call(object) === "[object Number]" && (object % 1 === 0 && !common.isNegativeZero(object)); } module2.exports = new Type("tag:yaml.org,2002:int", { kind: "scalar", resolve: resolveYamlInteger, construct: constructYamlInteger, predicate: isInteger, represent: { binary: function(obj) { return obj >= 0 ? "0b" + obj.toString(2) : "-0b" + obj.toString(2).slice(1); }, octal: function(obj) { return obj >= 0 ? "0" + obj.toString(8) : "-0" + obj.toString(8).slice(1); }, decimal: function(obj) { return obj.toString(10); }, /* eslint-disable max-len */ hexadecimal: function(obj) { return obj >= 0 ? "0x" + obj.toString(16).toUpperCase() : "-0x" + obj.toString(16).toUpperCase().slice(1); } }, defaultStyle: "decimal", styleAliases: { binary: [2, "bin"], octal: [8, "oct"], decimal: [10, "dec"], hexadecimal: [16, "hex"] } }); } }); // node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/float.js var require_float = __commonJS({ "node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/float.js"(exports2, module2) { "use strict"; var common = require_common(); var Type = require_type(); var YAML_FLOAT_PATTERN = new RegExp( // 2.5e4, 2.5 and integers "^(?:[-+]?(?:0|[1-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$" ); function resolveYamlFloat(data) { if (data === null) return false; if (!YAML_FLOAT_PATTERN.test(data) || // Quick hack to not allow integers end with `_` // Probably should update regexp & check speed data[data.length - 1] === "_") { return false; } return true; } function constructYamlFloat(data) { var value, sign, base, digits; value = data.replace(/_/g, "").toLowerCase(); sign = value[0] === "-" ? -1 : 1; digits = []; if ("+-".indexOf(value[0]) >= 0) { value = value.slice(1); } if (value === ".inf") { return sign === 1 ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY; } else if (value === ".nan") { return NaN; } else if (value.indexOf(":") >= 0) { value.split(":").forEach(function(v) { digits.unshift(parseFloat(v, 10)); }); value = 0; base = 1; digits.forEach(function(d) { value += d * base; base *= 60; }); return sign * value; } return sign * parseFloat(value, 10); } var SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/; function representYamlFloat(object, style) { var res; if (isNaN(object)) { switch (style) { case "lowercase": return ".nan"; case "uppercase": return ".NAN"; case "camelcase": return ".NaN"; } } else if (Number.POSITIVE_INFINITY === object) { switch (style) { case "lowercase": return ".inf"; case "uppercase": return ".INF"; case "camelcase": return ".Inf"; } } else if (Number.NEGATIVE_INFINITY === object) { switch (style) { case "lowercase": return "-.inf"; case "uppercase": return "-.INF"; case "camelcase": return "-.Inf"; } } else if (common.isNegativeZero(object)) { return "-0.0"; } res = object.toString(10); return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace("e", ".e") : res; } function isFloat(object) { return Object.prototype.toString.call(object) === "[object Number]" && (object % 1 !== 0 || common.isNegativeZero(object)); } module2.exports = new Type("tag:yaml.org,2002:float", { kind: "scalar", resolve: resolveYamlFloat, construct: constructYamlFloat, predicate: isFloat, represent: representYamlFloat, defaultStyle: "lowercase" }); } }); // node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/schema/json.js var require_json = __commonJS({ "node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/schema/json.js"(exports2, module2) { "use strict"; var Schema = require_schema(); module2.exports = new Schema({ include: [ require_failsafe() ], implicit: [ require_null(), require_bool(), require_int(), require_float() ] }); } }); // node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/schema/core.js var require_core2 = __commonJS({ "node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/schema/core.js"(exports2, module2) { "use strict"; var Schema = require_schema(); module2.exports = new Schema({ include: [ require_json() ] }); } }); // node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/timestamp.js var require_timestamp = __commonJS({ "node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/timestamp.js"(exports2, module2) { "use strict"; var Type = require_type(); var YAML_DATE_REGEXP = new RegExp( "^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$" ); var YAML_TIMESTAMP_REGEXP = new RegExp( "^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$" ); function resolveYamlTimestamp(data) { if (data === null) return false; if (YAML_DATE_REGEXP.exec(data) !== null) return true; if (YAML_TIMESTAMP_REGEXP.exec(data) !== null) return true; return false; } function constructYamlTimestamp(data) { var match, year, month, day, hour, minute, second, fraction = 0, delta = null, tz_hour, tz_minute, date; match = YAML_DATE_REGEXP.exec(data); if (match === null) match = YAML_TIMESTAMP_REGEXP.exec(data); if (match === null) throw new Error("Date resolve error"); year = +match[1]; month = +match[2] - 1; day = +match[3]; if (!match[4]) { return new Date(Date.UTC(year, month, day)); } hour = +match[4]; minute = +match[5]; second = +match[6]; if (match[7]) { fraction = match[7].slice(0, 3); while (fraction.length < 3) { fraction += "0"; } fraction = +fraction; } if (match[9]) { tz_hour = +match[10]; tz_minute = +(match[11] || 0); delta = (tz_hour * 60 + tz_minute) * 6e4; if (match[9] === "-") delta = -delta; } date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction)); if (delta) date.setTime(date.getTime() - delta); return date; } function representYamlTimestamp(object) { return object.toISOString(); } module2.exports = new Type("tag:yaml.org,2002:timestamp", { kind: "scalar", resolve: resolveYamlTimestamp, construct: constructYamlTimestamp, instanceOf: Date, represent: representYamlTimestamp }); } }); // node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/merge.js var require_merge = __commonJS({ "node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/merge.js"(exports2, module2) { "use strict"; var Type = require_type(); function resolveYamlMerge(data) { return data === "<<" || data === null; } module2.exports = new Type("tag:yaml.org,2002:merge", { kind: "scalar", resolve: resolveYamlMerge }); } }); // node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/binary.js var require_binary = __commonJS({ "node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/binary.js"(exports2, module2) { "use strict"; var NodeBuffer; try { _require = require; NodeBuffer = _require("buffer").Buffer; } catch (__) { } var _require; var Type = require_type(); var BASE64_MAP = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r"; function resolveYamlBinary(data) { if (data === null) return false; var code, idx, bitlen = 0, max2 = data.length, map = BASE64_MAP; for (idx = 0; idx < max2; idx++) { code = map.indexOf(data.charAt(idx)); if (code > 64) continue; if (code < 0) return false; bitlen += 6; } return bitlen % 8 === 0; } function constructYamlBinary(data) { var idx, tailbits, input = data.replace(/[\r\n=]/g, ""), max2 = input.length, map = BASE64_MAP, bits = 0, result = []; for (idx = 0; idx < max2; idx++) { if (idx % 4 === 0 && idx) { result.push(bits >> 16 & 255); result.push(bits >> 8 & 255); result.push(bits & 255); } bits = bits << 6 | map.indexOf(input.charAt(idx)); } tailbits = max2 % 4 * 6; if (tailbits === 0) { result.push(bits >> 16 & 255); result.push(bits >> 8 & 255); result.push(bits & 255); } else if (tailbits === 18) { result.push(bits >> 10 & 255); result.push(bits >> 2 & 255); } else if (tailbits === 12) { result.push(bits >> 4 & 255); } if (NodeBuffer) { return NodeBuffer.from ? NodeBuffer.from(result) : new NodeBuffer(result); } return result; } function representYamlBinary(object) { var result = "", bits = 0, idx, tail, max2 = object.length, map = BASE64_MAP; for (idx = 0; idx < max2; idx++) { if (idx % 3 === 0 && idx) { result += map[bits >> 18 & 63]; result += map[bits >> 12 & 63]; result += map[bits >> 6 & 63]; result += map[bits & 63]; } bits = (bits << 8) + object[idx]; } tail = max2 % 3; if (tail === 0) { result += map[bits >> 18 & 63]; result += map[bits >> 12 & 63]; result += map[bits >> 6 & 63]; result += map[bits & 63]; } else if (tail === 2) { result += map[bits >> 10 & 63]; result += map[bits >> 4 & 63]; result += map[bits << 2 & 63]; result += map[64]; } else if (tail === 1) { result += map[bits >> 2 & 63]; result += map[bits << 4 & 63]; result += map[64]; result += map[64]; } return result; } function isBinary(object) { return NodeBuffer && NodeBuffer.isBuffer(object); } module2.exports = new Type("tag:yaml.org,2002:binary", { kind: "scalar", resolve: resolveYamlBinary, construct: constructYamlBinary, predicate: isBinary, represent: representYamlBinary }); } }); // node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/omap.js var require_omap = __commonJS({ "node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/omap.js"(exports2, module2) { "use strict"; var Type = require_type(); var _hasOwnProperty = Object.prototype.hasOwnProperty; var _toString = Object.prototype.toString; function resolveYamlOmap(data) { if (data === null) return true; var objectKeys = [], index2, length, pair, pairKey, pairHasKey, object = data; for (index2 = 0, length = object.length; index2 < length; index2 += 1) { pair = object[index2]; pairHasKey = false; if (_toString.call(pair) !== "[object Object]") return false; for (pairKey in pair) { if (_hasOwnProperty.call(pair, pairKey)) { if (!pairHasKey) pairHasKey = true; else return false; } } if (!pairHasKey) return false; if (objectKeys.indexOf(pairKey) === -1) objectKeys.push(pairKey); else return false; } return true; } function constructYamlOmap(data) { return data !== null ? data : []; } module2.exports = new Type("tag:yaml.org,2002:omap", { kind: "sequence", resolve: resolveYamlOmap, construct: constructYamlOmap }); } }); // node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/pairs.js var require_pairs = __commonJS({ "node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/pairs.js"(exports2, module2) { "use strict"; var Type = require_type(); var _toString = Object.prototype.toString; function resolveYamlPairs(data) { if (data === null) return true; var index2, length, pair, keys, result, object = data; result = new Array(object.length); for (index2 = 0, length = object.length; index2 < length; index2 += 1) { pair = object[index2]; if (_toString.call(pair) !== "[object Object]") return false; keys = Object.keys(pair); if (keys.length !== 1) return false; result[index2] = [keys[0], pair[keys[0]]]; } return true; } function constructYamlPairs(data) { if (data === null) return []; var index2, length, pair, keys, result, object = data; result = new Array(object.length); for (index2 = 0, length = object.length; index2 < length; index2 += 1) { pair = object[index2]; keys = Object.keys(pair); result[index2] = [keys[0], pair[keys[0]]]; } return result; } module2.exports = new Type("tag:yaml.org,2002:pairs", { kind: "sequence", resolve: resolveYamlPairs, construct: constructYamlPairs }); } }); // node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/set.js var require_set = __commonJS({ "node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/set.js"(exports2, module2) { "use strict"; var Type = require_type(); var _hasOwnProperty = Object.prototype.hasOwnProperty; function resolveYamlSet(data) { if (data === null) return true; var key2, object = data; for (key2 in object) { if (_hasOwnProperty.call(object, key2)) { if (object[key2] !== null) return false; } } return true; } function constructYamlSet(data) { return data !== null ? data : {}; } module2.exports = new Type("tag:yaml.org,2002:set", { kind: "mapping", resolve: resolveYamlSet, construct: constructYamlSet }); } }); // node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/schema/default_safe.js var require_default_safe = __commonJS({ "node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/schema/default_safe.js"(exports2, module2) { "use strict"; var Schema = require_schema(); module2.exports = new Schema({ include: [ require_core2() ], implicit: [ require_timestamp(), require_merge() ], explicit: [ require_binary(), require_omap(), require_pairs(), require_set() ] }); } }); // node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/js/undefined.js var require_undefined = __commonJS({ "node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/js/undefined.js"(exports2, module2) { "use strict"; var Type = require_type(); function resolveJavascriptUndefined() { return true; } function constructJavascriptUndefined() { return void 0; } function representJavascriptUndefined() { return ""; } function isUndefined(object) { return typeof object === "undefined"; } module2.exports = new Type("tag:yaml.org,2002:js/undefined", { kind: "scalar", resolve: resolveJavascriptUndefined, construct: constructJavascriptUndefined, predicate: isUndefined, represent: representJavascriptUndefined }); } }); // node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/js/regexp.js var require_regexp = __commonJS({ "node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/js/regexp.js"(exports2, module2) { "use strict"; var Type = require_type(); function resolveJavascriptRegExp(data) { if (data === null) return false; if (data.length === 0) return false; var regexp = data, tail = /\/([gim]*)$/.exec(data), modifiers = ""; if (regexp[0] === "/") { if (tail) modifiers = tail[1]; if (modifiers.length > 3) return false; if (regexp[regexp.length - modifiers.length - 1] !== "/") return false; } return true; } function constructJavascriptRegExp(data) { var regexp = data, tail = /\/([gim]*)$/.exec(data), modifiers = ""; if (regexp[0] === "/") { if (tail) modifiers = tail[1]; regexp = regexp.slice(1, regexp.length - modifiers.length - 1); } return new RegExp(regexp, modifiers); } function representJavascriptRegExp(object) { var result = "/" + object.source + "/"; if (object.global) result += "g"; if (object.multiline) result += "m"; if (object.ignoreCase) result += "i"; return result; } function isRegExp(object) { return Object.prototype.toString.call(object) === "[object RegExp]"; } module2.exports = new Type("tag:yaml.org,2002:js/regexp", { kind: "scalar", resolve: resolveJavascriptRegExp, construct: constructJavascriptRegExp, predicate: isRegExp, represent: representJavascriptRegExp }); } }); // node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/js/function.js var require_function = __commonJS({ "node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/js/function.js"(exports2, module2) { "use strict"; var esprima; try { _require = require; esprima = _require("esprima"); } catch (_) { if (typeof window !== "undefined") esprima = window.esprima; } var _require; var Type = require_type(); function resolveJavascriptFunction(data) { if (data === null) return false; try { var source2 = "(" + data + ")", ast = esprima.parse(source2, { range: true }); if (ast.type !== "Program" || ast.body.length !== 1 || ast.body[0].type !== "ExpressionStatement" || ast.body[0].expression.type !== "ArrowFunctionExpression" && ast.body[0].expression.type !== "FunctionExpression") { return false; } return true; } catch (err) { return false; } } function constructJavascriptFunction(data) { var source2 = "(" + data + ")", ast = esprima.parse(source2, { range: true }), params = [], body; if (ast.type !== "Program" || ast.body.length !== 1 || ast.body[0].type !== "ExpressionStatement" || ast.body[0].expression.type !== "ArrowFunctionExpression" && ast.body[0].expression.type !== "FunctionExpression") { throw new Error("Failed to resolve function"); } ast.body[0].expression.params.forEach(function(param) { params.push(param.name); }); body = ast.body[0].expression.body.range; if (ast.body[0].expression.body.type === "BlockStatement") { return new Function(params, source2.slice(body[0] + 1, body[1] - 1)); } return new Function(params, "return " + source2.slice(body[0], body[1])); } function representJavascriptFunction(object) { return object.toString(); } function isFunction(object) { return Object.prototype.toString.call(object) === "[object Function]"; } module2.exports = new Type("tag:yaml.org,2002:js/function", { kind: "scalar", resolve: resolveJavascriptFunction, construct: constructJavascriptFunction, predicate: isFunction, represent: representJavascriptFunction }); } }); // node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/schema/default_full.js var require_default_full = __commonJS({ "node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/schema/default_full.js"(exports2, module2) { "use strict"; var Schema = require_schema(); module2.exports = Schema.DEFAULT = new Schema({ include: [ require_default_safe() ], explicit: [ require_undefined(), require_regexp(), require_function() ] }); } }); // node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/loader.js var require_loader = __commonJS({ "node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/loader.js"(exports2, module2) { "use strict"; var common = require_common(); var YAMLException = require_exception(); var Mark = require_mark(); var DEFAULT_SAFE_SCHEMA = require_default_safe(); var DEFAULT_FULL_SCHEMA = require_default_full(); var _hasOwnProperty = Object.prototype.hasOwnProperty; var CONTEXT_FLOW_IN = 1; var CONTEXT_FLOW_OUT = 2; var CONTEXT_BLOCK_IN = 3; var CONTEXT_BLOCK_OUT = 4; var CHOMPING_CLIP = 1; var CHOMPING_STRIP = 2; var CHOMPING_KEEP = 3; var PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/; var PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/; var PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/; var PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i; var PATTERN_TAG_URI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i; function _class(obj) { return Object.prototype.toString.call(obj); } function is_EOL(c) { return c === 10 || c === 13; } function is_WHITE_SPACE(c) { return c === 9 || c === 32; } function is_WS_OR_EOL(c) { return c === 9 || c === 32 || c === 10 || c === 13; } function is_FLOW_INDICATOR(c) { return c === 44 || c === 91 || c === 93 || c === 123 || c === 125; } function fromHexCode(c) { var lc; if (48 <= c && c <= 57) { return c - 48; } lc = c | 32; if (97 <= lc && lc <= 102) { return lc - 97 + 10; } return -1; } function escapedHexLen(c) { if (c === 120) { return 2; } if (c === 117) { return 4; } if (c === 85) { return 8; } return 0; } function fromDecimalCode(c) { if (48 <= c && c <= 57) { return c - 48; } return -1; } function simpleEscapeSequence(c) { return c === 48 ? "\0" : c === 97 ? "\x07" : c === 98 ? "\b" : c === 116 ? " " : c === 9 ? " " : c === 110 ? "\n" : c === 118 ? "\v" : c === 102 ? "\f" : c === 114 ? "\r" : c === 101 ? "\x1B" : c === 32 ? " " : c === 34 ? '"' : c === 47 ? "/" : c === 92 ? "\\" : c === 78 ? "\x85" : c === 95 ? "\xA0" : c === 76 ? "\u2028" : c === 80 ? "\u2029" : ""; } function charFromCodepoint(c) { if (c <= 65535) { return String.fromCharCode(c); } return String.fromCharCode( (c - 65536 >> 10) + 55296, (c - 65536 & 1023) + 56320 ); } function setProperty(object, key2, value) { if (key2 === "__proto__") { Object.defineProperty(object, key2, { configurable: true, enumerable: true, writable: true, value }); } else { object[key2] = value; } } var simpleEscapeCheck = new Array(256); var simpleEscapeMap = new Array(256); for (i = 0; i < 256; i++) { simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0; simpleEscapeMap[i] = simpleEscapeSequence(i); } var i; function State(input, options2) { this.input = input; this.filename = options2["filename"] || null; this.schema = options2["schema"] || DEFAULT_FULL_SCHEMA; this.onWarning = options2["onWarning"] || null; this.legacy = options2["legacy"] || false; this.json = options2["json"] || false; this.listener = options2["listener"] || null; this.implicitTypes = this.schema.compiledImplicit; this.typeMap = this.schema.compiledTypeMap; this.length = input.length; this.position = 0; this.line = 0; this.lineStart = 0; this.lineIndent = 0; this.documents = []; } function generateError(state2, message) { return new YAMLException( message, new Mark(state2.filename, state2.input, state2.position, state2.line, state2.position - state2.lineStart) ); } function throwError(state2, message) { throw generateError(state2, message); } function throwWarning(state2, message) { if (state2.onWarning) { state2.onWarning.call(null, generateError(state2, message)); } } var directiveHandlers = { YAML: function handleYamlDirective(state2, name, args) { var match, major, minor; if (state2.version !== null) { throwError(state2, "duplication of %YAML directive"); } if (args.length !== 1) { throwError(state2, "YAML directive accepts exactly one argument"); } match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]); if (match === null) { throwError(state2, "ill-formed argument of the YAML directive"); } major = parseInt(match[1], 10); minor = parseInt(match[2], 10); if (major !== 1) { throwError(state2, "unacceptable YAML version of the document"); } state2.version = args[0]; state2.checkLineBreaks = minor < 2; if (minor !== 1 && minor !== 2) { throwWarning(state2, "unsupported YAML version of the document"); } }, TAG: function handleTagDirective(state2, name, args) { var handle, prefix; if (args.length !== 2) { throwError(state2, "TAG directive accepts exactly two arguments"); } handle = args[0]; prefix = args[1]; if (!PATTERN_TAG_HANDLE.test(handle)) { throwError(state2, "ill-formed tag handle (first argument) of the TAG directive"); } if (_hasOwnProperty.call(state2.tagMap, handle)) { throwError(state2, 'there is a previously declared suffix for "' + handle + '" tag handle'); } if (!PATTERN_TAG_URI.test(prefix)) { throwError(state2, "ill-formed tag prefix (second argument) of the TAG directive"); } state2.tagMap[handle] = prefix; } }; function captureSegment(state2, start, end, checkJson) { var _position, _length, _character, _result; if (start < end) { _result = state2.input.slice(start, end); if (checkJson) { for (_position = 0, _length = _result.length; _position < _length; _position += 1) { _character = _result.charCodeAt(_position); if (!(_character === 9 || 32 <= _character && _character <= 1114111)) { throwError(state2, "expected valid JSON character"); } } } else if (PATTERN_NON_PRINTABLE.test(_result)) { throwError(state2, "the stream contains non-printable characters"); } state2.result += _result; } } function mergeMappings(state2, destination, source2, overridableKeys) { var sourceKeys, key2, index2, quantity; if (!common.isObject(source2)) { throwError(state2, "cannot merge mappings; the provided source object is unacceptable"); } sourceKeys = Object.keys(source2); for (index2 = 0, quantity = sourceKeys.length; index2 < quantity; index2 += 1) { key2 = sourceKeys[index2]; if (!_hasOwnProperty.call(destination, key2)) { setProperty(destination, key2, source2[key2]); overridableKeys[key2] = true; } } } function storeMappingPair(state2, _result, overridableKeys, keyTag, keyNode, valueNode, startLine, startPos) { var index2, quantity; if (Array.isArray(keyNode)) { keyNode = Array.prototype.slice.call(keyNode); for (index2 = 0, quantity = keyNode.length; index2 < quantity; index2 += 1) { if (Array.isArray(keyNode[index2])) { throwError(state2, "nested arrays are not supported inside keys"); } if (typeof keyNode === "object" && _class(keyNode[index2]) === "[object Object]") { keyNode[index2] = "[object Object]"; } } } if (typeof keyNode === "object" && _class(keyNode) === "[object Object]") { keyNode = "[object Object]"; } keyNode = String(keyNode); if (_result === null) { _result = {}; } if (keyTag === "tag:yaml.org,2002:merge") { if (Array.isArray(valueNode)) { for (index2 = 0, quantity = valueNode.length; index2 < quantity; index2 += 1) { mergeMappings(state2, _result, valueNode[index2], overridableKeys); } } else { mergeMappings(state2, _result, valueNode, overridableKeys); } } else { if (!state2.json && !_hasOwnProperty.call(overridableKeys, keyNode) && _hasOwnProperty.call(_result, keyNode)) { state2.line = startLine || state2.line; state2.position = startPos || state2.position; throwError(state2, "duplicated mapping key"); } setProperty(_result, keyNode, valueNode); delete overridableKeys[keyNode]; } return _result; } function readLineBreak(state2) { var ch; ch = state2.input.charCodeAt(state2.position); if (ch === 10) { state2.position++; } else if (ch === 13) { state2.position++; if (state2.input.charCodeAt(state2.position) === 10) { state2.position++; } } else { throwError(state2, "a line break is expected"); } state2.line += 1; state2.lineStart = state2.position; } function skipSeparationSpace(state2, allowComments, checkIndent) { var lineBreaks = 0, ch = state2.input.charCodeAt(state2.position); while (ch !== 0) { while (is_WHITE_SPACE(ch)) { ch = state2.input.charCodeAt(++state2.position); } if (allowComments && ch === 35) { do { ch = state2.input.charCodeAt(++state2.position); } while (ch !== 10 && ch !== 13 && ch !== 0); } if (is_EOL(ch)) { readLineBreak(state2); ch = state2.input.charCodeAt(state2.position); lineBreaks++; state2.lineIndent = 0; while (ch === 32) { state2.lineIndent++; ch = state2.input.charCodeAt(++state2.position); } } else { break; } } if (checkIndent !== -1 && lineBreaks !== 0 && state2.lineIndent < checkIndent) { throwWarning(state2, "deficient indentation"); } return lineBreaks; } function testDocumentSeparator(state2) { var _position = state2.position, ch; ch = state2.input.charCodeAt(_position); if ((ch === 45 || ch === 46) && ch === state2.input.charCodeAt(_position + 1) && ch === state2.input.charCodeAt(_position + 2)) { _position += 3; ch = state2.input.charCodeAt(_position); if (ch === 0 || is_WS_OR_EOL(ch)) { return true; } } return false; } function writeFoldedLines(state2, count) { if (count === 1) { state2.result += " "; } else if (count > 1) { state2.result += common.repeat("\n", count - 1); } } function readPlainScalar(state2, nodeIndent, withinFlowCollection) { var preceding, following, captureStart, captureEnd, hasPendingContent, _line, _lineStart, _lineIndent, _kind = state2.kind, _result = state2.result, ch; ch = state2.input.charCodeAt(state2.position); if (is_WS_OR_EOL(ch) || is_FLOW_INDICATOR(ch) || ch === 35 || ch === 38 || ch === 42 || ch === 33 || ch === 124 || ch === 62 || ch === 39 || ch === 34 || ch === 37 || ch === 64 || ch === 96) { return false; } if (ch === 63 || ch === 45) { following = state2.input.charCodeAt(state2.position + 1); if (is_WS_OR_EOL(following) || withinFlowCollection && is_FLOW_INDICATOR(following)) { return false; } } state2.kind = "scalar"; state2.result = ""; captureStart = captureEnd = state2.position; hasPendingContent = false; while (ch !== 0) { if (ch === 58) { following = state2.input.charCodeAt(state2.position + 1); if (is_WS_OR_EOL(following) || withinFlowCollection && is_FLOW_INDICATOR(following)) { break; } } else if (ch === 35) { preceding = state2.input.charCodeAt(state2.position - 1); if (is_WS_OR_EOL(preceding)) { break; } } else if (state2.position === state2.lineStart && testDocumentSeparator(state2) || withinFlowCollection && is_FLOW_INDICATOR(ch)) { break; } else if (is_EOL(ch)) { _line = state2.line; _lineStart = state2.lineStart; _lineIndent = state2.lineIndent; skipSeparationSpace(state2, false, -1); if (state2.lineIndent >= nodeIndent) { hasPendingContent = true; ch = state2.input.charCodeAt(state2.position); continue; } else { state2.position = captureEnd; state2.line = _line; state2.lineStart = _lineStart; state2.lineIndent = _lineIndent; break; } } if (hasPendingContent) { captureSegment(state2, captureStart, captureEnd, false); writeFoldedLines(state2, state2.line - _line); captureStart = captureEnd = state2.position; hasPendingContent = false; } if (!is_WHITE_SPACE(ch)) { captureEnd = state2.position + 1; } ch = state2.input.charCodeAt(++state2.position); } captureSegment(state2, captureStart, captureEnd, false); if (state2.result) { return true; } state2.kind = _kind; state2.result = _result; return false; } function readSingleQuotedScalar(state2, nodeIndent) { var ch, captureStart, captureEnd; ch = state2.input.charCodeAt(state2.position); if (ch !== 39) { return false; } state2.kind = "scalar"; state2.result = ""; state2.position++; captureStart = captureEnd = state2.position; while ((ch = state2.input.charCodeAt(state2.position)) !== 0) { if (ch === 39) { captureSegment(state2, captureStart, state2.position, true); ch = state2.input.charCodeAt(++state2.position); if (ch === 39) { captureStart = state2.position; state2.position++; captureEnd = state2.position; } else { return true; } } else if (is_EOL(ch)) { captureSegment(state2, captureStart, captureEnd, true); writeFoldedLines(state2, skipSeparationSpace(state2, false, nodeIndent)); captureStart = captureEnd = state2.position; } else if (state2.position === state2.lineStart && testDocumentSeparator(state2)) { throwError(state2, "unexpected end of the document within a single quoted scalar"); } else { state2.position++; captureEnd = state2.position; } } throwError(state2, "unexpected end of the stream within a single quoted scalar"); } function readDoubleQuotedScalar(state2, nodeIndent) { var captureStart, captureEnd, hexLength, hexResult, tmp, ch; ch = state2.input.charCodeAt(state2.position); if (ch !== 34) { return false; } state2.kind = "scalar"; state2.result = ""; state2.position++; captureStart = captureEnd = state2.position; while ((ch = state2.input.charCodeAt(state2.position)) !== 0) { if (ch === 34) { captureSegment(state2, captureStart, state2.position, true); state2.position++; return true; } else if (ch === 92) { captureSegment(state2, captureStart, state2.position, true); ch = state2.input.charCodeAt(++state2.position); if (is_EOL(ch)) { skipSeparationSpace(state2, false, nodeIndent); } else if (ch < 256 && simpleEscapeCheck[ch]) { state2.result += simpleEscapeMap[ch]; state2.position++; } else if ((tmp = escapedHexLen(ch)) > 0) { hexLength = tmp; hexResult = 0; for (; hexLength > 0; hexLength--) { ch = state2.input.charCodeAt(++state2.position); if ((tmp = fromHexCode(ch)) >= 0) { hexResult = (hexResult << 4) + tmp; } else { throwError(state2, "expected hexadecimal character"); } } state2.result += charFromCodepoint(hexResult); state2.position++; } else { throwError(state2, "unknown escape sequence"); } captureStart = captureEnd = state2.position; } else if (is_EOL(ch)) { captureSegment(state2, captureStart, captureEnd, true); writeFoldedLines(state2, skipSeparationSpace(state2, false, nodeIndent)); captureStart = captureEnd = state2.position; } else if (state2.position === state2.lineStart && testDocumentSeparator(state2)) { throwError(state2, "unexpected end of the document within a double quoted scalar"); } else { state2.position++; captureEnd = state2.position; } } throwError(state2, "unexpected end of the stream within a double quoted scalar"); } function readFlowCollection(state2, nodeIndent) { var readNext = true, _line, _tag = state2.tag, _result, _anchor2 = state2.anchor, following, terminator, isPair, isExplicitPair, isMapping, overridableKeys = {}, keyNode, keyTag, valueNode, ch; ch = state2.input.charCodeAt(state2.position); if (ch === 91) { terminator = 93; isMapping = false; _result = []; } else if (ch === 123) { terminator = 125; isMapping = true; _result = {}; } else { return false; } if (state2.anchor !== null) { state2.anchorMap[state2.anchor] = _result; } ch = state2.input.charCodeAt(++state2.position); while (ch !== 0) { skipSeparationSpace(state2, true, nodeIndent); ch = state2.input.charCodeAt(state2.position); if (ch === terminator) { state2.position++; state2.tag = _tag; state2.anchor = _anchor2; state2.kind = isMapping ? "mapping" : "sequence"; state2.result = _result; return true; } else if (!readNext) { throwError(state2, "missed comma between flow collection entries"); } keyTag = keyNode = valueNode = null; isPair = isExplicitPair = false; if (ch === 63) { following = state2.input.charCodeAt(state2.position + 1); if (is_WS_OR_EOL(following)) { isPair = isExplicitPair = true; state2.position++; skipSeparationSpace(state2, true, nodeIndent); } } _line = state2.line; composeNode(state2, nodeIndent, CONTEXT_FLOW_IN, false, true); keyTag = state2.tag; keyNode = state2.result; skipSeparationSpace(state2, true, nodeIndent); ch = state2.input.charCodeAt(state2.position); if ((isExplicitPair || state2.line === _line) && ch === 58) { isPair = true; ch = state2.input.charCodeAt(++state2.position); skipSeparationSpace(state2, true, nodeIndent); composeNode(state2, nodeIndent, CONTEXT_FLOW_IN, false, true); valueNode = state2.result; } if (isMapping) { storeMappingPair(state2, _result, overridableKeys, keyTag, keyNode, valueNode); } else if (isPair) { _result.push(storeMappingPair(state2, null, overridableKeys, keyTag, keyNode, valueNode)); } else { _result.push(keyNode); } skipSeparationSpace(state2, true, nodeIndent); ch = state2.input.charCodeAt(state2.position); if (ch === 44) { readNext = true; ch = state2.input.charCodeAt(++state2.position); } else { readNext = false; } } throwError(state2, "unexpected end of the stream within a flow collection"); } function readBlockScalar(state2, nodeIndent) { var captureStart, folding, chomping = CHOMPING_CLIP, didReadContent = false, detectedIndent = false, textIndent = nodeIndent, emptyLines = 0, atMoreIndented = false, tmp, ch; ch = state2.input.charCodeAt(state2.position); if (ch === 124) { folding = false; } else if (ch === 62) { folding = true; } else { return false; } state2.kind = "scalar"; state2.result = ""; while (ch !== 0) { ch = state2.input.charCodeAt(++state2.position); if (ch === 43 || ch === 45) { if (CHOMPING_CLIP === chomping) { chomping = ch === 43 ? CHOMPING_KEEP : CHOMPING_STRIP; } else { throwError(state2, "repeat of a chomping mode identifier"); } } else if ((tmp = fromDecimalCode(ch)) >= 0) { if (tmp === 0) { throwError(state2, "bad explicit indentation width of a block scalar; it cannot be less than one"); } else if (!detectedIndent) { textIndent = nodeIndent + tmp - 1; detectedIndent = true; } else { throwError(state2, "repeat of an indentation width identifier"); } } else { break; } } if (is_WHITE_SPACE(ch)) { do { ch = state2.input.charCodeAt(++state2.position); } while (is_WHITE_SPACE(ch)); if (ch === 35) { do { ch = state2.input.charCodeAt(++state2.position); } while (!is_EOL(ch) && ch !== 0); } } while (ch !== 0) { readLineBreak(state2); state2.lineIndent = 0; ch = state2.input.charCodeAt(state2.position); while ((!detectedIndent || state2.lineIndent < textIndent) && ch === 32) { state2.lineIndent++; ch = state2.input.charCodeAt(++state2.position); } if (!detectedIndent && state2.lineIndent > textIndent) { textIndent = state2.lineIndent; } if (is_EOL(ch)) { emptyLines++; continue; } if (state2.lineIndent < textIndent) { if (chomping === CHOMPING_KEEP) { state2.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines); } else if (chomping === CHOMPING_CLIP) { if (didReadContent) { state2.result += "\n"; } } break; } if (folding) { if (is_WHITE_SPACE(ch)) { atMoreIndented = true; state2.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines); } else if (atMoreIndented) { atMoreIndented = false; state2.result += common.repeat("\n", emptyLines + 1); } else if (emptyLines === 0) { if (didReadContent) { state2.result += " "; } } else { state2.result += common.repeat("\n", emptyLines); } } else { state2.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines); } didReadContent = true; detectedIndent = true; emptyLines = 0; captureStart = state2.position; while (!is_EOL(ch) && ch !== 0) { ch = state2.input.charCodeAt(++state2.position); } captureSegment(state2, captureStart, state2.position, false); } return true; } function readBlockSequence(state2, nodeIndent) { var _line, _tag = state2.tag, _anchor2 = state2.anchor, _result = [], following, detected = false, ch; if (state2.anchor !== null) { state2.anchorMap[state2.anchor] = _result; } ch = state2.input.charCodeAt(state2.position); while (ch !== 0) { if (ch !== 45) { break; } following = state2.input.charCodeAt(state2.position + 1); if (!is_WS_OR_EOL(following)) { break; } detected = true; state2.position++; if (skipSeparationSpace(state2, true, -1)) { if (state2.lineIndent <= nodeIndent) { _result.push(null); ch = state2.input.charCodeAt(state2.position); continue; } } _line = state2.line; composeNode(state2, nodeIndent, CONTEXT_BLOCK_IN, false, true); _result.push(state2.result); skipSeparationSpace(state2, true, -1); ch = state2.input.charCodeAt(state2.position); if ((state2.line === _line || state2.lineIndent > nodeIndent) && ch !== 0) { throwError(state2, "bad indentation of a sequence entry"); } else if (state2.lineIndent < nodeIndent) { break; } } if (detected) { state2.tag = _tag; state2.anchor = _anchor2; state2.kind = "sequence"; state2.result = _result; return true; } return false; } function readBlockMapping(state2, nodeIndent, flowIndent) { var following, allowCompact, _line, _pos, _tag = state2.tag, _anchor2 = state2.anchor, _result = {}, overridableKeys = {}, keyTag = null, keyNode = null, valueNode = null, atExplicitKey = false, detected = false, ch; if (state2.anchor !== null) { state2.anchorMap[state2.anchor] = _result; } ch = state2.input.charCodeAt(state2.position); while (ch !== 0) { following = state2.input.charCodeAt(state2.position + 1); _line = state2.line; _pos = state2.position; if ((ch === 63 || ch === 58) && is_WS_OR_EOL(following)) { if (ch === 63) { if (atExplicitKey) { storeMappingPair(state2, _result, overridableKeys, keyTag, keyNode, null); keyTag = keyNode = valueNode = null; } detected = true; atExplicitKey = true; allowCompact = true; } else if (atExplicitKey) { atExplicitKey = false; allowCompact = true; } else { throwError(state2, "incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"); } state2.position += 1; ch = following; } else if (composeNode(state2, flowIndent, CONTEXT_FLOW_OUT, false, true)) { if (state2.line === _line) { ch = state2.input.charCodeAt(state2.position); while (is_WHITE_SPACE(ch)) { ch = state2.input.charCodeAt(++state2.position); } if (ch === 58) { ch = state2.input.charCodeAt(++state2.position); if (!is_WS_OR_EOL(ch)) { throwError(state2, "a whitespace character is expected after the key-value separator within a block mapping"); } if (atExplicitKey) { storeMappingPair(state2, _result, overridableKeys, keyTag, keyNode, null); keyTag = keyNode = valueNode = null; } detected = true; atExplicitKey = false; allowCompact = false; keyTag = state2.tag; keyNode = state2.result; } else if (detected) { throwError(state2, "can not read an implicit mapping pair; a colon is missed"); } else { state2.tag = _tag; state2.anchor = _anchor2; return true; } } else if (detected) { throwError(state2, "can not read a block mapping entry; a multiline key may not be an implicit key"); } else { state2.tag = _tag; state2.anchor = _anchor2; return true; } } else { break; } if (state2.line === _line || state2.lineIndent > nodeIndent) { if (composeNode(state2, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) { if (atExplicitKey) { keyNode = state2.result; } else { valueNode = state2.result; } } if (!atExplicitKey) { storeMappingPair(state2, _result, overridableKeys, keyTag, keyNode, valueNode, _line, _pos); keyTag = keyNode = valueNode = null; } skipSeparationSpace(state2, true, -1); ch = state2.input.charCodeAt(state2.position); } if (state2.lineIndent > nodeIndent && ch !== 0) { throwError(state2, "bad indentation of a mapping entry"); } else if (state2.lineIndent < nodeIndent) { break; } } if (atExplicitKey) { storeMappingPair(state2, _result, overridableKeys, keyTag, keyNode, null); } if (detected) { state2.tag = _tag; state2.anchor = _anchor2; state2.kind = "mapping"; state2.result = _result; } return detected; } function readTagProperty(state2) { var _position, isVerbatim = false, isNamed = false, tagHandle, tagName, ch; ch = state2.input.charCodeAt(state2.position); if (ch !== 33) return false; if (state2.tag !== null) { throwError(state2, "duplication of a tag property"); } ch = state2.input.charCodeAt(++state2.position); if (ch === 60) { isVerbatim = true; ch = state2.input.charCodeAt(++state2.position); } else if (ch === 33) { isNamed = true; tagHandle = "!!"; ch = state2.input.charCodeAt(++state2.position); } else { tagHandle = "!"; } _position = state2.position; if (isVerbatim) { do { ch = state2.input.charCodeAt(++state2.position); } while (ch !== 0 && ch !== 62); if (state2.position < state2.length) { tagName = state2.input.slice(_position, state2.position); ch = state2.input.charCodeAt(++state2.position); } else { throwError(state2, "unexpected end of the stream within a verbatim tag"); } } else { while (ch !== 0 && !is_WS_OR_EOL(ch)) { if (ch === 33) { if (!isNamed) { tagHandle = state2.input.slice(_position - 1, state2.position + 1); if (!PATTERN_TAG_HANDLE.test(tagHandle)) { throwError(state2, "named tag handle cannot contain such characters"); } isNamed = true; _position = state2.position + 1; } else { throwError(state2, "tag suffix cannot contain exclamation marks"); } } ch = state2.input.charCodeAt(++state2.position); } tagName = state2.input.slice(_position, state2.position); if (PATTERN_FLOW_INDICATORS.test(tagName)) { throwError(state2, "tag suffix cannot contain flow indicator characters"); } } if (tagName && !PATTERN_TAG_URI.test(tagName)) { throwError(state2, "tag name cannot contain such characters: " + tagName); } if (isVerbatim) { state2.tag = tagName; } else if (_hasOwnProperty.call(state2.tagMap, tagHandle)) { state2.tag = state2.tagMap[tagHandle] + tagName; } else if (tagHandle === "!") { state2.tag = "!" + tagName; } else if (tagHandle === "!!") { state2.tag = "tag:yaml.org,2002:" + tagName; } else { throwError(state2, 'undeclared tag handle "' + tagHandle + '"'); } return true; } function readAnchorProperty(state2) { var _position, ch; ch = state2.input.charCodeAt(state2.position); if (ch !== 38) return false; if (state2.anchor !== null) { throwError(state2, "duplication of an anchor property"); } ch = state2.input.charCodeAt(++state2.position); _position = state2.position; while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) { ch = state2.input.charCodeAt(++state2.position); } if (state2.position === _position) { throwError(state2, "name of an anchor node must contain at least one character"); } state2.anchor = state2.input.slice(_position, state2.position); return true; } function readAlias(state2) { var _position, alias, ch; ch = state2.input.charCodeAt(state2.position); if (ch !== 42) return false; ch = state2.input.charCodeAt(++state2.position); _position = state2.position; while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) { ch = state2.input.charCodeAt(++state2.position); } if (state2.position === _position) { throwError(state2, "name of an alias node must contain at least one character"); } alias = state2.input.slice(_position, state2.position); if (!_hasOwnProperty.call(state2.anchorMap, alias)) { throwError(state2, 'unidentified alias "' + alias + '"'); } state2.result = state2.anchorMap[alias]; skipSeparationSpace(state2, true, -1); return true; } function composeNode(state2, parentIndent, nodeContext, allowToSeek, allowCompact) { var allowBlockStyles, allowBlockScalars, allowBlockCollections, indentStatus = 1, atNewLine = false, hasContent = false, typeIndex, typeQuantity, type, flowIndent, blockIndent; if (state2.listener !== null) { state2.listener("open", state2); } state2.tag = null; state2.anchor = null; state2.kind = null; state2.result = null; allowBlockStyles = allowBlockScalars = allowBlockCollections = CONTEXT_BLOCK_OUT === nodeContext || CONTEXT_BLOCK_IN === nodeContext; if (allowToSeek) { if (skipSeparationSpace(state2, true, -1)) { atNewLine = true; if (state2.lineIndent > parentIndent) { indentStatus = 1; } else if (state2.lineIndent === parentIndent) { indentStatus = 0; } else if (state2.lineIndent < parentIndent) { indentStatus = -1; } } } if (indentStatus === 1) { while (readTagProperty(state2) || readAnchorProperty(state2)) { if (skipSeparationSpace(state2, true, -1)) { atNewLine = true; allowBlockCollections = allowBlockStyles; if (state2.lineIndent > parentIndent) { indentStatus = 1; } else if (state2.lineIndent === parentIndent) { indentStatus = 0; } else if (state2.lineIndent < parentIndent) { indentStatus = -1; } } else { allowBlockCollections = false; } } } if (allowBlockCollections) { allowBlockCollections = atNewLine || allowCompact; } if (indentStatus === 1 || CONTEXT_BLOCK_OUT === nodeContext) { if (CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext) { flowIndent = parentIndent; } else { flowIndent = parentIndent + 1; } blockIndent = state2.position - state2.lineStart; if (indentStatus === 1) { if (allowBlockCollections && (readBlockSequence(state2, blockIndent) || readBlockMapping(state2, blockIndent, flowIndent)) || readFlowCollection(state2, flowIndent)) { hasContent = true; } else { if (allowBlockScalars && readBlockScalar(state2, flowIndent) || readSingleQuotedScalar(state2, flowIndent) || readDoubleQuotedScalar(state2, flowIndent)) { hasContent = true; } else if (readAlias(state2)) { hasContent = true; if (state2.tag !== null || state2.anchor !== null) { throwError(state2, "alias node should not have any properties"); } } else if (readPlainScalar(state2, flowIndent, CONTEXT_FLOW_IN === nodeContext)) { hasContent = true; if (state2.tag === null) { state2.tag = "?"; } } if (state2.anchor !== null) { state2.anchorMap[state2.anchor] = state2.result; } } } else if (indentStatus === 0) { hasContent = allowBlockCollections && readBlockSequence(state2, blockIndent); } } if (state2.tag !== null && state2.tag !== "!") { if (state2.tag === "?") { if (state2.result !== null && state2.kind !== "scalar") { throwError(state2, 'unacceptable node kind for ! tag; it should be "scalar", not "' + state2.kind + '"'); } for (typeIndex = 0, typeQuantity = state2.implicitTypes.length; typeIndex < typeQuantity; typeIndex += 1) { type = state2.implicitTypes[typeIndex]; if (type.resolve(state2.result)) { state2.result = type.construct(state2.result); state2.tag = type.tag; if (state2.anchor !== null) { state2.anchorMap[state2.anchor] = state2.result; } break; } } } else if (_hasOwnProperty.call(state2.typeMap[state2.kind || "fallback"], state2.tag)) { type = state2.typeMap[state2.kind || "fallback"][state2.tag]; if (state2.result !== null && type.kind !== state2.kind) { throwError(state2, "unacceptable node kind for !<" + state2.tag + '> tag; it should be "' + type.kind + '", not "' + state2.kind + '"'); } if (!type.resolve(state2.result)) { throwError(state2, "cannot resolve a node with !<" + state2.tag + "> explicit tag"); } else { state2.result = type.construct(state2.result); if (state2.anchor !== null) { state2.anchorMap[state2.anchor] = state2.result; } } } else { throwError(state2, "unknown tag !<" + state2.tag + ">"); } } if (state2.listener !== null) { state2.listener("close", state2); } return state2.tag !== null || state2.anchor !== null || hasContent; } function readDocument(state2) { var documentStart = state2.position, _position, directiveName, directiveArgs, hasDirectives = false, ch; state2.version = null; state2.checkLineBreaks = state2.legacy; state2.tagMap = {}; state2.anchorMap = {}; while ((ch = state2.input.charCodeAt(state2.position)) !== 0) { skipSeparationSpace(state2, true, -1); ch = state2.input.charCodeAt(state2.position); if (state2.lineIndent > 0 || ch !== 37) { break; } hasDirectives = true; ch = state2.input.charCodeAt(++state2.position); _position = state2.position; while (ch !== 0 && !is_WS_OR_EOL(ch)) { ch = state2.input.charCodeAt(++state2.position); } directiveName = state2.input.slice(_position, state2.position); directiveArgs = []; if (directiveName.length < 1) { throwError(state2, "directive name must not be less than one character in length"); } while (ch !== 0) { while (is_WHITE_SPACE(ch)) { ch = state2.input.charCodeAt(++state2.position); } if (ch === 35) { do { ch = state2.input.charCodeAt(++state2.position); } while (ch !== 0 && !is_EOL(ch)); break; } if (is_EOL(ch)) break; _position = state2.position; while (ch !== 0 && !is_WS_OR_EOL(ch)) { ch = state2.input.charCodeAt(++state2.position); } directiveArgs.push(state2.input.slice(_position, state2.position)); } if (ch !== 0) readLineBreak(state2); if (_hasOwnProperty.call(directiveHandlers, directiveName)) { directiveHandlers[directiveName](state2, directiveName, directiveArgs); } else { throwWarning(state2, 'unknown document directive "' + directiveName + '"'); } } skipSeparationSpace(state2, true, -1); if (state2.lineIndent === 0 && state2.input.charCodeAt(state2.position) === 45 && state2.input.charCodeAt(state2.position + 1) === 45 && state2.input.charCodeAt(state2.position + 2) === 45) { state2.position += 3; skipSeparationSpace(state2, true, -1); } else if (hasDirectives) { throwError(state2, "directives end mark is expected"); } composeNode(state2, state2.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true); skipSeparationSpace(state2, true, -1); if (state2.checkLineBreaks && PATTERN_NON_ASCII_LINE_BREAKS.test(state2.input.slice(documentStart, state2.position))) { throwWarning(state2, "non-ASCII line breaks are interpreted as content"); } state2.documents.push(state2.result); if (state2.position === state2.lineStart && testDocumentSeparator(state2)) { if (state2.input.charCodeAt(state2.position) === 46) { state2.position += 3; skipSeparationSpace(state2, true, -1); } return; } if (state2.position < state2.length - 1) { throwError(state2, "end of the stream or a document separator is expected"); } else { return; } } function loadDocuments(input, options2) { input = String(input); options2 = options2 || {}; if (input.length !== 0) { if (input.charCodeAt(input.length - 1) !== 10 && input.charCodeAt(input.length - 1) !== 13) { input += "\n"; } if (input.charCodeAt(0) === 65279) { input = input.slice(1); } } var state2 = new State(input, options2); var nullpos = input.indexOf("\0"); if (nullpos !== -1) { state2.position = nullpos; throwError(state2, "null byte is not allowed in input"); } state2.input += "\0"; while (state2.input.charCodeAt(state2.position) === 32) { state2.lineIndent += 1; state2.position += 1; } while (state2.position < state2.length - 1) { readDocument(state2); } return state2.documents; } function loadAll(input, iterator, options2) { if (iterator !== null && typeof iterator === "object" && typeof options2 === "undefined") { options2 = iterator; iterator = null; } var documents = loadDocuments(input, options2); if (typeof iterator !== "function") { return documents; } for (var index2 = 0, length = documents.length; index2 < length; index2 += 1) { iterator(documents[index2]); } } function load(input, options2) { var documents = loadDocuments(input, options2); if (documents.length === 0) { return void 0; } else if (documents.length === 1) { return documents[0]; } throw new YAMLException("expected a single document in the stream, but found more"); } function safeLoadAll(input, iterator, options2) { if (typeof iterator === "object" && iterator !== null && typeof options2 === "undefined") { options2 = iterator; iterator = null; } return loadAll(input, iterator, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options2)); } function safeLoad(input, options2) { return load(input, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options2)); } module2.exports.loadAll = loadAll; module2.exports.load = load; module2.exports.safeLoadAll = safeLoadAll; module2.exports.safeLoad = safeLoad; } }); // node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/dumper.js var require_dumper = __commonJS({ "node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/dumper.js"(exports2, module2) { "use strict"; var common = require_common(); var YAMLException = require_exception(); var DEFAULT_FULL_SCHEMA = require_default_full(); var DEFAULT_SAFE_SCHEMA = require_default_safe(); var _toString = Object.prototype.toString; var _hasOwnProperty = Object.prototype.hasOwnProperty; var CHAR_TAB = 9; var CHAR_LINE_FEED = 10; var CHAR_CARRIAGE_RETURN = 13; var CHAR_SPACE = 32; var CHAR_EXCLAMATION = 33; var CHAR_DOUBLE_QUOTE = 34; var CHAR_SHARP = 35; var CHAR_PERCENT = 37; var CHAR_AMPERSAND = 38; var CHAR_SINGLE_QUOTE = 39; var CHAR_ASTERISK = 42; var CHAR_COMMA = 44; var CHAR_MINUS = 45; var CHAR_COLON = 58; var CHAR_EQUALS = 61; var CHAR_GREATER_THAN = 62; var CHAR_QUESTION = 63; var CHAR_COMMERCIAL_AT = 64; var CHAR_LEFT_SQUARE_BRACKET = 91; var CHAR_RIGHT_SQUARE_BRACKET = 93; var CHAR_GRAVE_ACCENT = 96; var CHAR_LEFT_CURLY_BRACKET = 123; var CHAR_VERTICAL_LINE = 124; var CHAR_RIGHT_CURLY_BRACKET = 125; var ESCAPE_SEQUENCES = {}; ESCAPE_SEQUENCES[0] = "\\0"; ESCAPE_SEQUENCES[7] = "\\a"; ESCAPE_SEQUENCES[8] = "\\b"; ESCAPE_SEQUENCES[9] = "\\t"; ESCAPE_SEQUENCES[10] = "\\n"; ESCAPE_SEQUENCES[11] = "\\v"; ESCAPE_SEQUENCES[12] = "\\f"; ESCAPE_SEQUENCES[13] = "\\r"; ESCAPE_SEQUENCES[27] = "\\e"; ESCAPE_SEQUENCES[34] = '\\"'; ESCAPE_SEQUENCES[92] = "\\\\"; ESCAPE_SEQUENCES[133] = "\\N"; ESCAPE_SEQUENCES[160] = "\\_"; ESCAPE_SEQUENCES[8232] = "\\L"; ESCAPE_SEQUENCES[8233] = "\\P"; var DEPRECATED_BOOLEANS_SYNTAX = [ "y", "Y", "yes", "Yes", "YES", "on", "On", "ON", "n", "N", "no", "No", "NO", "off", "Off", "OFF" ]; function compileStyleMap(schema, map) { var result, keys, index2, length, tag2, style, type; if (map === null) return {}; result = {}; keys = Object.keys(map); for (index2 = 0, length = keys.length; index2 < length; index2 += 1) { tag2 = keys[index2]; style = String(map[tag2]); if (tag2.slice(0, 2) === "!!") { tag2 = "tag:yaml.org,2002:" + tag2.slice(2); } type = schema.compiledTypeMap["fallback"][tag2]; if (type && _hasOwnProperty.call(type.styleAliases, style)) { style = type.styleAliases[style]; } result[tag2] = style; } return result; } function encodeHex(character) { var string, handle, length; string = character.toString(16).toUpperCase(); if (character <= 255) { handle = "x"; length = 2; } else if (character <= 65535) { handle = "u"; length = 4; } else if (character <= 4294967295) { handle = "U"; length = 8; } else { throw new YAMLException("code point within a string may not be greater than 0xFFFFFFFF"); } return "\\" + handle + common.repeat("0", length - string.length) + string; } function State(options2) { this.schema = options2["schema"] || DEFAULT_FULL_SCHEMA; this.indent = Math.max(1, options2["indent"] || 2); this.noArrayIndent = options2["noArrayIndent"] || false; this.skipInvalid = options2["skipInvalid"] || false; this.flowLevel = common.isNothing(options2["flowLevel"]) ? -1 : options2["flowLevel"]; this.styleMap = compileStyleMap(this.schema, options2["styles"] || null); this.sortKeys = options2["sortKeys"] || false; this.lineWidth = options2["lineWidth"] || 80; this.noRefs = options2["noRefs"] || false; this.noCompatMode = options2["noCompatMode"] || false; this.condenseFlow = options2["condenseFlow"] || false; this.implicitTypes = this.schema.compiledImplicit; this.explicitTypes = this.schema.compiledExplicit; this.tag = null; this.result = ""; this.duplicates = []; this.usedDuplicates = null; } function indentString(string, spaces) { var ind = common.repeat(" ", spaces), position = 0, next2 = -1, result = "", line, length = string.length; while (position < length) { next2 = string.indexOf("\n", position); if (next2 === -1) { line = string.slice(position); position = length; } else { line = string.slice(position, next2 + 1); position = next2 + 1; } if (line.length && line !== "\n") result += ind; result += line; } return result; } function generateNextLine(state2, level) { return "\n" + common.repeat(" ", state2.indent * level); } function testImplicitResolving(state2, str2) { var index2, length, type; for (index2 = 0, length = state2.implicitTypes.length; index2 < length; index2 += 1) { type = state2.implicitTypes[index2]; if (type.resolve(str2)) { return true; } } return false; } function isWhitespace(c) { return c === CHAR_SPACE || c === CHAR_TAB; } function isPrintable(c) { return 32 <= c && c <= 126 || 161 <= c && c <= 55295 && c !== 8232 && c !== 8233 || 57344 <= c && c <= 65533 && c !== 65279 || 65536 <= c && c <= 1114111; } function isNsChar(c) { return isPrintable(c) && !isWhitespace(c) && c !== 65279 && c !== CHAR_CARRIAGE_RETURN && c !== CHAR_LINE_FEED; } function isPlainSafe(c, prev) { return isPrintable(c) && c !== 65279 && c !== CHAR_COMMA && c !== CHAR_LEFT_SQUARE_BRACKET && c !== CHAR_RIGHT_SQUARE_BRACKET && c !== CHAR_LEFT_CURLY_BRACKET && c !== CHAR_RIGHT_CURLY_BRACKET && c !== CHAR_COLON && (c !== CHAR_SHARP || prev && isNsChar(prev)); } function isPlainSafeFirst(c) { return isPrintable(c) && c !== 65279 && !isWhitespace(c) && c !== CHAR_MINUS && c !== CHAR_QUESTION && c !== CHAR_COLON && c !== CHAR_COMMA && c !== CHAR_LEFT_SQUARE_BRACKET && c !== CHAR_RIGHT_SQUARE_BRACKET && c !== CHAR_LEFT_CURLY_BRACKET && c !== CHAR_RIGHT_CURLY_BRACKET && c !== CHAR_SHARP && c !== CHAR_AMPERSAND && c !== CHAR_ASTERISK && c !== CHAR_EXCLAMATION && c !== CHAR_VERTICAL_LINE && c !== CHAR_EQUALS && c !== CHAR_GREATER_THAN && c !== CHAR_SINGLE_QUOTE && c !== CHAR_DOUBLE_QUOTE && c !== CHAR_PERCENT && c !== CHAR_COMMERCIAL_AT && c !== CHAR_GRAVE_ACCENT; } function needIndentIndicator(string) { var leadingSpaceRe = /^\n* /; return leadingSpaceRe.test(string); } var STYLE_PLAIN = 1; var STYLE_SINGLE = 2; var STYLE_LITERAL = 3; var STYLE_FOLDED = 4; var STYLE_DOUBLE = 5; function chooseScalarStyle(string, singleLineOnly, indentPerLevel, lineWidth, testAmbiguousType) { var i; var char, prev_char; var hasLineBreak = false; var hasFoldableLine = false; var shouldTrackWidth = lineWidth !== -1; var previousLineBreak = -1; var plain = isPlainSafeFirst(string.charCodeAt(0)) && !isWhitespace(string.charCodeAt(string.length - 1)); if (singleLineOnly) { for (i = 0; i < string.length; i++) { char = string.charCodeAt(i); if (!isPrintable(char)) { return STYLE_DOUBLE; } prev_char = i > 0 ? string.charCodeAt(i - 1) : null; plain = plain && isPlainSafe(char, prev_char); } } else { for (i = 0; i < string.length; i++) { char = string.charCodeAt(i); if (char === CHAR_LINE_FEED) { hasLineBreak = true; if (shouldTrackWidth) { hasFoldableLine = hasFoldableLine || // Foldable line = too long, and not more-indented. i - previousLineBreak - 1 > lineWidth && string[previousLineBreak + 1] !== " "; previousLineBreak = i; } } else if (!isPrintable(char)) { return STYLE_DOUBLE; } prev_char = i > 0 ? string.charCodeAt(i - 1) : null; plain = plain && isPlainSafe(char, prev_char); } hasFoldableLine = hasFoldableLine || shouldTrackWidth && (i - previousLineBreak - 1 > lineWidth && string[previousLineBreak + 1] !== " "); } if (!hasLineBreak && !hasFoldableLine) { return plain && !testAmbiguousType(string) ? STYLE_PLAIN : STYLE_SINGLE; } if (indentPerLevel > 9 && needIndentIndicator(string)) { return STYLE_DOUBLE; } return hasFoldableLine ? STYLE_FOLDED : STYLE_LITERAL; } function writeScalar(state2, string, level, iskey) { state2.dump = (function() { if (string.length === 0) { return "''"; } if (!state2.noCompatMode && DEPRECATED_BOOLEANS_SYNTAX.indexOf(string) !== -1) { return "'" + string + "'"; } var indent = state2.indent * Math.max(1, level); var lineWidth = state2.lineWidth === -1 ? -1 : Math.max(Math.min(state2.lineWidth, 40), state2.lineWidth - indent); var singleLineOnly = iskey || state2.flowLevel > -1 && level >= state2.flowLevel; function testAmbiguity(string2) { return testImplicitResolving(state2, string2); } switch (chooseScalarStyle(string, singleLineOnly, state2.indent, lineWidth, testAmbiguity)) { case STYLE_PLAIN: return string; case STYLE_SINGLE: return "'" + string.replace(/'/g, "''") + "'"; case STYLE_LITERAL: return "|" + blockHeader(string, state2.indent) + dropEndingNewline(indentString(string, indent)); case STYLE_FOLDED: return ">" + blockHeader(string, state2.indent) + dropEndingNewline(indentString(foldString(string, lineWidth), indent)); case STYLE_DOUBLE: return '"' + escapeString(string, lineWidth) + '"'; default: throw new YAMLException("impossible error: invalid scalar style"); } })(); } function blockHeader(string, indentPerLevel) { var indentIndicator = needIndentIndicator(string) ? String(indentPerLevel) : ""; var clip = string[string.length - 1] === "\n"; var keep = clip && (string[string.length - 2] === "\n" || string === "\n"); var chomp = keep ? "+" : clip ? "" : "-"; return indentIndicator + chomp + "\n"; } function dropEndingNewline(string) { return string[string.length - 1] === "\n" ? string.slice(0, -1) : string; } function foldString(string, width) { var lineRe = /(\n+)([^\n]*)/g; var result = (function() { var nextLF = string.indexOf("\n"); nextLF = nextLF !== -1 ? nextLF : string.length; lineRe.lastIndex = nextLF; return foldLine(string.slice(0, nextLF), width); })(); var prevMoreIndented = string[0] === "\n" || string[0] === " "; var moreIndented; var match; while (match = lineRe.exec(string)) { var prefix = match[1], line = match[2]; moreIndented = line[0] === " "; result += prefix + (!prevMoreIndented && !moreIndented && line !== "" ? "\n" : "") + foldLine(line, width); prevMoreIndented = moreIndented; } return result; } function foldLine(line, width) { if (line === "" || line[0] === " ") return line; var breakRe = / [^ ]/g; var match; var start = 0, end, curr = 0, next2 = 0; var result = ""; while (match = breakRe.exec(line)) { next2 = match.index; if (next2 - start > width) { end = curr > start ? curr : next2; result += "\n" + line.slice(start, end); start = end + 1; } curr = next2; } result += "\n"; if (line.length - start > width && curr > start) { result += line.slice(start, curr) + "\n" + line.slice(curr + 1); } else { result += line.slice(start); } return result.slice(1); } function escapeString(string) { var result = ""; var char, nextChar; var escapeSeq; for (var i = 0; i < string.length; i++) { char = string.charCodeAt(i); if (char >= 55296 && char <= 56319) { nextChar = string.charCodeAt(i + 1); if (nextChar >= 56320 && nextChar <= 57343) { result += encodeHex((char - 55296) * 1024 + nextChar - 56320 + 65536); i++; continue; } } escapeSeq = ESCAPE_SEQUENCES[char]; result += !escapeSeq && isPrintable(char) ? string[i] : escapeSeq || encodeHex(char); } return result; } function writeFlowSequence(state2, level, object) { var _result = "", _tag = state2.tag, index2, length; for (index2 = 0, length = object.length; index2 < length; index2 += 1) { if (writeNode(state2, level, object[index2], false, false)) { if (index2 !== 0) _result += "," + (!state2.condenseFlow ? " " : ""); _result += state2.dump; } } state2.tag = _tag; state2.dump = "[" + _result + "]"; } function writeBlockSequence(state2, level, object, compact) { var _result = "", _tag = state2.tag, index2, length; for (index2 = 0, length = object.length; index2 < length; index2 += 1) { if (writeNode(state2, level + 1, object[index2], true, true)) { if (!compact || index2 !== 0) { _result += generateNextLine(state2, level); } if (state2.dump && CHAR_LINE_FEED === state2.dump.charCodeAt(0)) { _result += "-"; } else { _result += "- "; } _result += state2.dump; } } state2.tag = _tag; state2.dump = _result || "[]"; } function writeFlowMapping(state2, level, object) { var _result = "", _tag = state2.tag, objectKeyList = Object.keys(object), index2, length, objectKey, objectValue, pairBuffer; for (index2 = 0, length = objectKeyList.length; index2 < length; index2 += 1) { pairBuffer = ""; if (index2 !== 0) pairBuffer += ", "; if (state2.condenseFlow) pairBuffer += '"'; objectKey = objectKeyList[index2]; objectValue = object[objectKey]; if (!writeNode(state2, level, objectKey, false, false)) { continue; } if (state2.dump.length > 1024) pairBuffer += "? "; pairBuffer += state2.dump + (state2.condenseFlow ? '"' : "") + ":" + (state2.condenseFlow ? "" : " "); if (!writeNode(state2, level, objectValue, false, false)) { continue; } pairBuffer += state2.dump; _result += pairBuffer; } state2.tag = _tag; state2.dump = "{" + _result + "}"; } function writeBlockMapping(state2, level, object, compact) { var _result = "", _tag = state2.tag, objectKeyList = Object.keys(object), index2, length, objectKey, objectValue, explicitPair, pairBuffer; if (state2.sortKeys === true) { objectKeyList.sort(); } else if (typeof state2.sortKeys === "function") { objectKeyList.sort(state2.sortKeys); } else if (state2.sortKeys) { throw new YAMLException("sortKeys must be a boolean or a function"); } for (index2 = 0, length = objectKeyList.length; index2 < length; index2 += 1) { pairBuffer = ""; if (!compact || index2 !== 0) { pairBuffer += generateNextLine(state2, level); } objectKey = objectKeyList[index2]; objectValue = object[objectKey]; if (!writeNode(state2, level + 1, objectKey, true, true, true)) { continue; } explicitPair = state2.tag !== null && state2.tag !== "?" || state2.dump && state2.dump.length > 1024; if (explicitPair) { if (state2.dump && CHAR_LINE_FEED === state2.dump.charCodeAt(0)) { pairBuffer += "?"; } else { pairBuffer += "? "; } } pairBuffer += state2.dump; if (explicitPair) { pairBuffer += generateNextLine(state2, level); } if (!writeNode(state2, level + 1, objectValue, true, explicitPair)) { continue; } if (state2.dump && CHAR_LINE_FEED === state2.dump.charCodeAt(0)) { pairBuffer += ":"; } else { pairBuffer += ": "; } pairBuffer += state2.dump; _result += pairBuffer; } state2.tag = _tag; state2.dump = _result || "{}"; } function detectType(state2, object, explicit) { var _result, typeList, index2, length, type, style; typeList = explicit ? state2.explicitTypes : state2.implicitTypes; for (index2 = 0, length = typeList.length; index2 < length; index2 += 1) { type = typeList[index2]; if ((type.instanceOf || type.predicate) && (!type.instanceOf || typeof object === "object" && object instanceof type.instanceOf) && (!type.predicate || type.predicate(object))) { state2.tag = explicit ? type.tag : "?"; if (type.represent) { style = state2.styleMap[type.tag] || type.defaultStyle; if (_toString.call(type.represent) === "[object Function]") { _result = type.represent(object, style); } else if (_hasOwnProperty.call(type.represent, style)) { _result = type.represent[style](object, style); } else { throw new YAMLException("!<" + type.tag + '> tag resolver accepts not "' + style + '" style'); } state2.dump = _result; } return true; } } return false; } function writeNode(state2, level, object, block2, compact, iskey) { state2.tag = null; state2.dump = object; if (!detectType(state2, object, false)) { detectType(state2, object, true); } var type = _toString.call(state2.dump); if (block2) { block2 = state2.flowLevel < 0 || state2.flowLevel > level; } var objectOrArray = type === "[object Object]" || type === "[object Array]", duplicateIndex, duplicate; if (objectOrArray) { duplicateIndex = state2.duplicates.indexOf(object); duplicate = duplicateIndex !== -1; } if (state2.tag !== null && state2.tag !== "?" || duplicate || state2.indent !== 2 && level > 0) { compact = false; } if (duplicate && state2.usedDuplicates[duplicateIndex]) { state2.dump = "*ref_" + duplicateIndex; } else { if (objectOrArray && duplicate && !state2.usedDuplicates[duplicateIndex]) { state2.usedDuplicates[duplicateIndex] = true; } if (type === "[object Object]") { if (block2 && Object.keys(state2.dump).length !== 0) { writeBlockMapping(state2, level, state2.dump, compact); if (duplicate) { state2.dump = "&ref_" + duplicateIndex + state2.dump; } } else { writeFlowMapping(state2, level, state2.dump); if (duplicate) { state2.dump = "&ref_" + duplicateIndex + " " + state2.dump; } } } else if (type === "[object Array]") { var arrayLevel = state2.noArrayIndent && level > 0 ? level - 1 : level; if (block2 && state2.dump.length !== 0) { writeBlockSequence(state2, arrayLevel, state2.dump, compact); if (duplicate) { state2.dump = "&ref_" + duplicateIndex + state2.dump; } } else { writeFlowSequence(state2, arrayLevel, state2.dump); if (duplicate) { state2.dump = "&ref_" + duplicateIndex + " " + state2.dump; } } } else if (type === "[object String]") { if (state2.tag !== "?") { writeScalar(state2, state2.dump, level, iskey); } } else { if (state2.skipInvalid) return false; throw new YAMLException("unacceptable kind of an object to dump " + type); } if (state2.tag !== null && state2.tag !== "?") { state2.dump = "!<" + state2.tag + "> " + state2.dump; } } return true; } function getDuplicateReferences(object, state2) { var objects = [], duplicatesIndexes = [], index2, length; inspectNode(object, objects, duplicatesIndexes); for (index2 = 0, length = duplicatesIndexes.length; index2 < length; index2 += 1) { state2.duplicates.push(objects[duplicatesIndexes[index2]]); } state2.usedDuplicates = new Array(length); } function inspectNode(object, objects, duplicatesIndexes) { var objectKeyList, index2, length; if (object !== null && typeof object === "object") { index2 = objects.indexOf(object); if (index2 !== -1) { if (duplicatesIndexes.indexOf(index2) === -1) { duplicatesIndexes.push(index2); } } else { objects.push(object); if (Array.isArray(object)) { for (index2 = 0, length = object.length; index2 < length; index2 += 1) { inspectNode(object[index2], objects, duplicatesIndexes); } } else { objectKeyList = Object.keys(object); for (index2 = 0, length = objectKeyList.length; index2 < length; index2 += 1) { inspectNode(object[objectKeyList[index2]], objects, duplicatesIndexes); } } } } } function dump(input, options2) { options2 = options2 || {}; var state2 = new State(options2); if (!state2.noRefs) getDuplicateReferences(input, state2); if (writeNode(state2, 0, input, true, true)) return state2.dump + "\n"; return ""; } function safeDump(input, options2) { return dump(input, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options2)); } module2.exports.dump = dump; module2.exports.safeDump = safeDump; } }); // node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml.js var require_js_yaml = __commonJS({ "node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml.js"(exports2, module2) { "use strict"; var loader = require_loader(); var dumper = require_dumper(); function deprecated(name) { return function() { throw new Error("Function " + name + " is deprecated and cannot be used."); }; } module2.exports.Type = require_type(); module2.exports.Schema = require_schema(); module2.exports.FAILSAFE_SCHEMA = require_failsafe(); module2.exports.JSON_SCHEMA = require_json(); module2.exports.CORE_SCHEMA = require_core2(); module2.exports.DEFAULT_SAFE_SCHEMA = require_default_safe(); module2.exports.DEFAULT_FULL_SCHEMA = require_default_full(); module2.exports.load = loader.load; module2.exports.loadAll = loader.loadAll; module2.exports.safeLoad = loader.safeLoad; module2.exports.safeLoadAll = loader.safeLoadAll; module2.exports.dump = dumper.dump; module2.exports.safeDump = dumper.safeDump; module2.exports.YAMLException = require_exception(); module2.exports.MINIMAL_SCHEMA = require_failsafe(); module2.exports.SAFE_SCHEMA = require_default_safe(); module2.exports.DEFAULT_SCHEMA = require_default_full(); module2.exports.scan = deprecated("scan"); module2.exports.parse = deprecated("parse"); module2.exports.compose = deprecated("compose"); module2.exports.addConstructor = deprecated("addConstructor"); } }); // node_modules/gray-matter/node_modules/js-yaml/index.js var require_js_yaml2 = __commonJS({ "node_modules/gray-matter/node_modules/js-yaml/index.js"(exports2, module2) { "use strict"; var yaml2 = require_js_yaml(); module2.exports = yaml2; } }); // node_modules/gray-matter/lib/engines.js var require_engines = __commonJS({ "node_modules/gray-matter/lib/engines.js"(exports, module) { "use strict"; var yaml = require_js_yaml2(); var engines = exports = module.exports; engines.yaml = { parse: yaml.safeLoad.bind(yaml), stringify: yaml.safeDump.bind(yaml) }; engines.json = { parse: JSON.parse.bind(JSON), stringify: function(obj, options2) { const opts = Object.assign({ replacer: null, space: 2 }, options2); return JSON.stringify(obj, opts.replacer, opts.space); } }; engines.javascript = { parse: function parse(str, options, wrap) { try { if (wrap !== false) { str = "(function() {\nreturn " + str.trim() + ";\n}());"; } return eval(str) || {}; } catch (err) { if (wrap !== false && /(unexpected|identifier)/i.test(err.message)) { return parse(str, options, false); } throw new SyntaxError(err); } }, stringify: function() { throw new Error("stringifying JavaScript is not supported"); } }; } }); // node_modules/strip-bom-string/index.js var require_strip_bom_string = __commonJS({ "node_modules/strip-bom-string/index.js"(exports2, module2) { "use strict"; module2.exports = function(str2) { if (typeof str2 === "string" && str2.charAt(0) === "\uFEFF") { return str2.slice(1); } return str2; }; } }); // node_modules/gray-matter/lib/utils.js var require_utils = __commonJS({ "node_modules/gray-matter/lib/utils.js"(exports2) { "use strict"; var stripBom = require_strip_bom_string(); var typeOf = require_kind_of(); exports2.define = function(obj, key2, val) { Reflect.defineProperty(obj, key2, { enumerable: false, configurable: true, writable: true, value: val }); }; exports2.isBuffer = function(val) { return typeOf(val) === "buffer"; }; exports2.isObject = function(val) { return typeOf(val) === "object"; }; exports2.toBuffer = function(input) { return typeof input === "string" ? Buffer.from(input) : input; }; exports2.toString = function(input) { if (exports2.isBuffer(input)) return stripBom(String(input)); if (typeof input !== "string") { throw new TypeError("expected input to be a string or buffer"); } return stripBom(input); }; exports2.arrayify = function(val) { return val ? Array.isArray(val) ? val : [val] : []; }; exports2.startsWith = function(str2, substr, len) { if (typeof len !== "number") len = substr.length; return str2.slice(0, len) === substr; }; } }); // node_modules/gray-matter/lib/defaults.js var require_defaults = __commonJS({ "node_modules/gray-matter/lib/defaults.js"(exports2, module2) { "use strict"; var engines2 = require_engines(); var utils = require_utils(); module2.exports = function(options2) { const opts = Object.assign({}, options2); opts.delimiters = utils.arrayify(opts.delims || opts.delimiters || "---"); if (opts.delimiters.length === 1) { opts.delimiters.push(opts.delimiters[0]); } opts.language = (opts.language || opts.lang || "yaml").toLowerCase(); opts.engines = Object.assign({}, engines2, opts.parsers, opts.engines); return opts; }; } }); // node_modules/gray-matter/lib/engine.js var require_engine = __commonJS({ "node_modules/gray-matter/lib/engine.js"(exports2, module2) { "use strict"; module2.exports = function(name, options2) { let engine = options2.engines[name] || options2.engines[aliase(name)]; if (typeof engine === "undefined") { throw new Error('gray-matter engine "' + name + '" is not registered'); } if (typeof engine === "function") { engine = { parse: engine }; } return engine; }; function aliase(name) { switch (name.toLowerCase()) { case "js": case "javascript": return "javascript"; case "coffee": case "coffeescript": case "cson": return "coffee"; case "yaml": case "yml": return "yaml"; default: { return name; } } } } }); // node_modules/gray-matter/lib/stringify.js var require_stringify = __commonJS({ "node_modules/gray-matter/lib/stringify.js"(exports2, module2) { "use strict"; var typeOf = require_kind_of(); var getEngine = require_engine(); var defaults = require_defaults(); module2.exports = function(file, data, options2) { if (data == null && options2 == null) { switch (typeOf(file)) { case "object": data = file.data; options2 = {}; break; case "string": return file; default: { throw new TypeError("expected file to be a string or object"); } } } const str2 = file.content; const opts = defaults(options2); if (data == null) { if (!opts.data) return file; data = opts.data; } const language = file.language || opts.language; const engine = getEngine(language, opts); if (typeof engine.stringify !== "function") { throw new TypeError('expected "' + language + '.stringify" to be a function'); } data = Object.assign({}, file.data, data); const open = opts.delimiters[0]; const close = opts.delimiters[1]; const matter2 = engine.stringify(data, options2).trim(); let buf = ""; if (matter2 !== "{}") { buf = newline(open) + newline(matter2) + newline(close); } if (typeof file.excerpt === "string" && file.excerpt !== "") { if (str2.indexOf(file.excerpt.trim()) === -1) { buf += newline(file.excerpt) + newline(close); } } return buf + newline(str2); }; function newline(str2) { return str2.slice(-1) !== "\n" ? str2 + "\n" : str2; } } }); // node_modules/gray-matter/lib/excerpt.js var require_excerpt = __commonJS({ "node_modules/gray-matter/lib/excerpt.js"(exports2, module2) { "use strict"; var defaults = require_defaults(); module2.exports = function(file, options2) { const opts = defaults(options2); if (file.data == null) { file.data = {}; } if (typeof opts.excerpt === "function") { return opts.excerpt(file, opts); } const sep = file.data.excerpt_separator || opts.excerpt_separator; if (sep == null && (opts.excerpt === false || opts.excerpt == null)) { return file; } const delimiter = typeof opts.excerpt === "string" ? opts.excerpt : sep || opts.delimiters[0]; const idx = file.content.indexOf(delimiter); if (idx !== -1) { file.excerpt = file.content.slice(0, idx); } return file; }; } }); // node_modules/gray-matter/lib/to-file.js var require_to_file = __commonJS({ "node_modules/gray-matter/lib/to-file.js"(exports2, module2) { "use strict"; var typeOf = require_kind_of(); var stringify = require_stringify(); var utils = require_utils(); module2.exports = function(file) { if (typeOf(file) !== "object") { file = { content: file }; } if (typeOf(file.data) !== "object") { file.data = {}; } if (file.contents && file.content == null) { file.content = file.contents; } utils.define(file, "orig", utils.toBuffer(file.content)); utils.define(file, "language", file.language || ""); utils.define(file, "matter", file.matter || ""); utils.define(file, "stringify", function(data, options2) { if (options2 && options2.language) { file.language = options2.language; } return stringify(file, data, options2); }); file.content = utils.toString(file.content); file.isEmpty = false; file.excerpt = ""; return file; }; } }); // node_modules/gray-matter/lib/parse.js var require_parse = __commonJS({ "node_modules/gray-matter/lib/parse.js"(exports2, module2) { "use strict"; var getEngine = require_engine(); var defaults = require_defaults(); module2.exports = function(language, str2, options2) { const opts = defaults(options2); const engine = getEngine(language, opts); if (typeof engine.parse !== "function") { throw new TypeError('expected "' + language + '.parse" to be a function'); } return engine.parse(str2, opts); }; } }); // node_modules/gray-matter/index.js var require_gray_matter = __commonJS({ "node_modules/gray-matter/index.js"(exports2, module2) { "use strict"; var fs = require("fs"); var sections = require_section_matter(); var defaults = require_defaults(); var stringify = require_stringify(); var excerpt = require_excerpt(); var engines2 = require_engines(); var toFile = require_to_file(); var parse2 = require_parse(); var utils = require_utils(); function matter2(input, options2) { if (input === "") { return { data: {}, content: input, excerpt: "", orig: input }; } let file = toFile(input); const cached = matter2.cache[file.content]; if (!options2) { if (cached) { file = Object.assign({}, cached); file.orig = cached.orig; return file; } matter2.cache[file.content] = file; } return parseMatter(file, options2); } function parseMatter(file, options2) { const opts = defaults(options2); const open = opts.delimiters[0]; const close = "\n" + opts.delimiters[1]; let str2 = file.content; if (opts.language) { file.language = opts.language; } const openLen = open.length; if (!utils.startsWith(str2, open, openLen)) { excerpt(file, opts); return file; } if (str2.charAt(openLen) === open.slice(-1)) { return file; } str2 = str2.slice(openLen); const len = str2.length; const language = matter2.language(str2, opts); if (language.name) { file.language = language.name; str2 = str2.slice(language.raw.length); } let closeIndex = str2.indexOf(close); if (closeIndex === -1) { closeIndex = len; } file.matter = str2.slice(0, closeIndex); const block2 = file.matter.replace(/^\s*#[^\n]+/gm, "").trim(); if (block2 === "") { file.isEmpty = true; file.empty = file.content; file.data = {}; } else { file.data = parse2(file.language, file.matter, opts); } if (closeIndex === len) { file.content = ""; } else { file.content = str2.slice(closeIndex + close.length); if (file.content[0] === "\r") { file.content = file.content.slice(1); } if (file.content[0] === "\n") { file.content = file.content.slice(1); } } excerpt(file, opts); if (opts.sections === true || typeof opts.section === "function") { sections(file, opts.section); } return file; } matter2.engines = engines2; matter2.stringify = function(file, data, options2) { if (typeof file === "string") file = matter2(file, options2); return stringify(file, data, options2); }; matter2.read = function(filepath, options2) { const str2 = fs.readFileSync(filepath, "utf8"); const file = matter2(str2, options2); file.path = filepath; return file; }; matter2.test = function(str2, options2) { return utils.startsWith(str2, defaults(options2).delimiters[0]); }; matter2.language = function(str2, options2) { const opts = defaults(options2); const open = opts.delimiters[0]; if (matter2.test(str2)) { str2 = str2.slice(open.length); } const language = str2.slice(0, str2.search(/\r?\n/)); return { raw: language, name: language ? language.trim() : "" }; }; matter2.cache = {}; matter2.clearCache = function() { matter2.cache = {}; }; module2.exports = matter2; } }); // src/entry.ts var entry_exports = {}; __export(entry_exports, { default: () => Base }); module.exports = __toCommonJS(entry_exports); var import_obsidian13 = require("obsidian"); // src/ui/text_view.ts var import_obsidian12 = require("obsidian"); // node_modules/svelte/src/internal/client/constants.js var DERIVED = 1 << 1; var EFFECT = 1 << 2; var RENDER_EFFECT = 1 << 3; var MANAGED_EFFECT = 1 << 24; var BLOCK_EFFECT = 1 << 4; var BRANCH_EFFECT = 1 << 5; var ROOT_EFFECT = 1 << 6; var BOUNDARY_EFFECT = 1 << 7; var CONNECTED = 1 << 9; var CLEAN = 1 << 10; var DIRTY = 1 << 11; var MAYBE_DIRTY = 1 << 12; var INERT = 1 << 13; var DESTROYED = 1 << 14; var REACTION_RAN = 1 << 15; var DESTROYING = 1 << 25; var EFFECT_TRANSPARENT = 1 << 16; var EAGER_EFFECT = 1 << 17; var HEAD_EFFECT = 1 << 18; var EFFECT_PRESERVED = 1 << 19; var USER_EFFECT = 1 << 20; var EFFECT_OFFSCREEN = 1 << 25; var WAS_MARKED = 1 << 16; var REACTION_IS_UPDATING = 1 << 21; var ASYNC = 1 << 22; var ERROR_VALUE = 1 << 23; var STATE_SYMBOL = /* @__PURE__ */ Symbol("$state"); var LEGACY_PROPS = /* @__PURE__ */ Symbol("legacy props"); var LOADING_ATTR_SYMBOL = /* @__PURE__ */ Symbol(""); var PROXY_PATH_SYMBOL = /* @__PURE__ */ Symbol("proxy path"); var ATTRIBUTES_CACHE = /* @__PURE__ */ Symbol("attributes"); var CLASS_CACHE = /* @__PURE__ */ Symbol("class"); var STYLE_CACHE = /* @__PURE__ */ Symbol("style"); var TEXT_CACHE = /* @__PURE__ */ Symbol("text"); var FORM_RESET_HANDLER = /* @__PURE__ */ Symbol("form reset"); var HMR_ANCHOR = /* @__PURE__ */ Symbol("hmr anchor"); var STALE_REACTION = new class StaleReactionError extends Error { constructor() { super(...arguments); __publicField(this, "name", "StaleReactionError"); __publicField(this, "message", "The reaction that called `getAbortSignal()` was re-run or destroyed"); } }(); var _a; var IS_XHTML = ( // We gotta write it like this because after downleveling the pure comment may end up in the wrong location !!((_a = globalThis.document) == null ? void 0 : _a.contentType) && /* @__PURE__ */ globalThis.document.contentType.includes("xml") ); var TEXT_NODE = 3; var COMMENT_NODE = 8; // node_modules/esm-env/dev-fallback.js var _a2, _b; var node_env = (_b = (_a2 = globalThis.process) == null ? void 0 : _a2.env) == null ? void 0 : _b.NODE_ENV; var dev_fallback_default = node_env && !node_env.toLowerCase().startsWith("prod"); // node_modules/svelte/src/internal/shared/utils.js var is_array = Array.isArray; var index_of = Array.prototype.indexOf; var includes = Array.prototype.includes; var array_from = Array.from; var object_keys = Object.keys; var define_property = Object.defineProperty; var get_descriptor = Object.getOwnPropertyDescriptor; var get_descriptors = Object.getOwnPropertyDescriptors; var object_prototype = Object.prototype; var array_prototype = Array.prototype; var get_prototype_of = Object.getPrototypeOf; var is_extensible = Object.isExtensible; var noop = () => { }; function run(fn) { return fn(); } function run_all(arr) { for (var i = 0; i < arr.length; i++) { arr[i](); } } function deferred() { var resolve; var reject; var promise = new Promise((res, rej) => { resolve = res; reject = rej; }); return { promise, resolve, reject }; } function fallback(value, fallback2, lazy = false) { return value === void 0 ? lazy ? ( /** @type {() => V} */ fallback2() ) : ( /** @type {V} */ fallback2 ) : value; } // node_modules/svelte/src/internal/client/reactivity/equality.js function equals(value) { return value === this.v; } function safe_not_equal(a, b) { return a != a ? b == b : a !== b || a !== null && typeof a === "object" || typeof a === "function"; } function safe_equals(value) { return !safe_not_equal(value, this.v); } // node_modules/svelte/src/internal/shared/errors.js function invariant_violation(message) { if (dev_fallback_default) { const error = new Error(`invariant_violation An invariant violation occurred, meaning Svelte's internal assumptions were flawed. This is a bug in Svelte, not your app \u2014 please open an issue at https://github.com/sveltejs/svelte, citing the following message: "${message}" https://svelte.dev/e/invariant_violation`); error.name = "Svelte error"; throw error; } else { throw new Error(`https://svelte.dev/e/invariant_violation`); } } function lifecycle_outside_component(name) { if (dev_fallback_default) { const error = new Error(`lifecycle_outside_component \`${name}(...)\` can only be used during component initialisation https://svelte.dev/e/lifecycle_outside_component`); error.name = "Svelte error"; throw error; } else { throw new Error(`https://svelte.dev/e/lifecycle_outside_component`); } } // node_modules/svelte/src/internal/client/errors.js function async_derived_orphan() { if (dev_fallback_default) { const error = new Error(`async_derived_orphan Cannot create a \`$derived(...)\` with an \`await\` expression outside of an effect tree https://svelte.dev/e/async_derived_orphan`); error.name = "Svelte error"; throw error; } else { throw new Error(`https://svelte.dev/e/async_derived_orphan`); } } function bind_invalid_checkbox_value() { if (dev_fallback_default) { const error = new Error(`bind_invalid_checkbox_value Using \`bind:value\` together with a checkbox input is not allowed. Use \`bind:checked\` instead https://svelte.dev/e/bind_invalid_checkbox_value`); error.name = "Svelte error"; throw error; } else { throw new Error(`https://svelte.dev/e/bind_invalid_checkbox_value`); } } function derived_references_self() { if (dev_fallback_default) { const error = new Error(`derived_references_self A derived value cannot reference itself recursively https://svelte.dev/e/derived_references_self`); error.name = "Svelte error"; throw error; } else { throw new Error(`https://svelte.dev/e/derived_references_self`); } } function each_key_duplicate(a, b, value) { if (dev_fallback_default) { const error = new Error(`each_key_duplicate ${value ? `Keyed each block has duplicate key \`${value}\` at indexes ${a} and ${b}` : `Keyed each block has duplicate key at indexes ${a} and ${b}`} https://svelte.dev/e/each_key_duplicate`); error.name = "Svelte error"; throw error; } else { throw new Error(`https://svelte.dev/e/each_key_duplicate`); } } function each_key_volatile(index2, a, b) { if (dev_fallback_default) { const error = new Error(`each_key_volatile Keyed each block has key that is not idempotent \u2014 the key for item at index ${index2} was \`${a}\` but is now \`${b}\`. Keys must be the same each time for a given item https://svelte.dev/e/each_key_volatile`); error.name = "Svelte error"; throw error; } else { throw new Error(`https://svelte.dev/e/each_key_volatile`); } } function effect_in_teardown(rune) { if (dev_fallback_default) { const error = new Error(`effect_in_teardown \`${rune}\` cannot be used inside an effect cleanup function https://svelte.dev/e/effect_in_teardown`); error.name = "Svelte error"; throw error; } else { throw new Error(`https://svelte.dev/e/effect_in_teardown`); } } function effect_in_unowned_derived() { if (dev_fallback_default) { const error = new Error(`effect_in_unowned_derived Effect cannot be created inside a \`$derived\` value that was not itself created inside an effect https://svelte.dev/e/effect_in_unowned_derived`); error.name = "Svelte error"; throw error; } else { throw new Error(`https://svelte.dev/e/effect_in_unowned_derived`); } } function effect_orphan(rune) { if (dev_fallback_default) { const error = new Error(`effect_orphan \`${rune}\` can only be used inside an effect (e.g. during component initialisation) https://svelte.dev/e/effect_orphan`); error.name = "Svelte error"; throw error; } else { throw new Error(`https://svelte.dev/e/effect_orphan`); } } function effect_update_depth_exceeded() { if (dev_fallback_default) { const error = new Error(`effect_update_depth_exceeded Maximum update depth exceeded. This typically indicates that an effect reads and writes the same piece of state https://svelte.dev/e/effect_update_depth_exceeded`); error.name = "Svelte error"; throw error; } else { throw new Error(`https://svelte.dev/e/effect_update_depth_exceeded`); } } function hydration_failed() { if (dev_fallback_default) { const error = new Error(`hydration_failed Failed to hydrate the application https://svelte.dev/e/hydration_failed`); error.name = "Svelte error"; throw error; } else { throw new Error(`https://svelte.dev/e/hydration_failed`); } } function lifecycle_legacy_only(name) { if (dev_fallback_default) { const error = new Error(`lifecycle_legacy_only \`${name}(...)\` cannot be used in runes mode https://svelte.dev/e/lifecycle_legacy_only`); error.name = "Svelte error"; throw error; } else { throw new Error(`https://svelte.dev/e/lifecycle_legacy_only`); } } function props_invalid_value(key2) { if (dev_fallback_default) { const error = new Error(`props_invalid_value Cannot do \`bind:${key2}={undefined}\` when \`${key2}\` has a fallback value https://svelte.dev/e/props_invalid_value`); error.name = "Svelte error"; throw error; } else { throw new Error(`https://svelte.dev/e/props_invalid_value`); } } function rune_outside_svelte(rune) { if (dev_fallback_default) { const error = new Error(`rune_outside_svelte The \`${rune}\` rune is only available inside \`.svelte\` and \`.svelte.js/ts\` files https://svelte.dev/e/rune_outside_svelte`); error.name = "Svelte error"; throw error; } else { throw new Error(`https://svelte.dev/e/rune_outside_svelte`); } } function state_descriptors_fixed() { if (dev_fallback_default) { const error = new Error(`state_descriptors_fixed Property descriptors defined on \`$state\` objects must contain \`value\` and always be \`enumerable\`, \`configurable\` and \`writable\`. https://svelte.dev/e/state_descriptors_fixed`); error.name = "Svelte error"; throw error; } else { throw new Error(`https://svelte.dev/e/state_descriptors_fixed`); } } function state_prototype_fixed() { if (dev_fallback_default) { const error = new Error(`state_prototype_fixed Cannot set prototype of \`$state\` object https://svelte.dev/e/state_prototype_fixed`); error.name = "Svelte error"; throw error; } else { throw new Error(`https://svelte.dev/e/state_prototype_fixed`); } } function state_unsafe_mutation() { if (dev_fallback_default) { const error = new Error(`state_unsafe_mutation Updating state inside \`$derived(...)\`, \`$inspect(...)\` or a template expression is forbidden. If the value should not be reactive, declare it without \`$state\` https://svelte.dev/e/state_unsafe_mutation`); error.name = "Svelte error"; throw error; } else { throw new Error(`https://svelte.dev/e/state_unsafe_mutation`); } } function svelte_boundary_reset_onerror() { if (dev_fallback_default) { const error = new Error(`svelte_boundary_reset_onerror A \`\` \`reset\` function cannot be called while an error is still being handled https://svelte.dev/e/svelte_boundary_reset_onerror`); error.name = "Svelte error"; throw error; } else { throw new Error(`https://svelte.dev/e/svelte_boundary_reset_onerror`); } } // node_modules/svelte/src/internal/flags/index.js var async_mode_flag = false; var legacy_mode_flag = false; var tracing_mode_flag = false; function enable_legacy_mode_flag() { legacy_mode_flag = true; } // node_modules/svelte/src/constants.js var EACH_ITEM_REACTIVE = 1; var EACH_INDEX_REACTIVE = 1 << 1; var EACH_IS_CONTROLLED = 1 << 2; var EACH_IS_ANIMATED = 1 << 3; var EACH_ITEM_IMMUTABLE = 1 << 4; var PROPS_IS_IMMUTABLE = 1; var PROPS_IS_RUNES = 1 << 1; var PROPS_IS_UPDATED = 1 << 2; var PROPS_IS_BINDABLE = 1 << 3; var PROPS_IS_LAZY_INITIAL = 1 << 4; var TRANSITION_OUT = 1 << 1; var TRANSITION_GLOBAL = 1 << 2; var TEMPLATE_FRAGMENT = 1; var TEMPLATE_USE_IMPORT_NODE = 1 << 1; var TEMPLATE_USE_SVG = 1 << 2; var TEMPLATE_USE_MATHML = 1 << 3; var HYDRATION_START = "["; var HYDRATION_START_ELSE = "[!"; var HYDRATION_START_FAILED = "[?"; var HYDRATION_END = "]"; var HYDRATION_ERROR = {}; var ELEMENT_PRESERVE_ATTRIBUTE_CASE = 1 << 1; var ELEMENT_IS_INPUT = 1 << 2; var UNINITIALIZED = /* @__PURE__ */ Symbol("uninitialized"); var FILENAME = /* @__PURE__ */ Symbol("filename"); var NAMESPACE_HTML = "http://www.w3.org/1999/xhtml"; var ATTACHMENT_KEY = "@attach"; // node_modules/svelte/src/internal/client/dev/tracing.js var tracing_expressions = null; function tag(source2, label) { source2.label = label; tag_proxy(source2.v, label); return source2; } function tag_proxy(value, label) { var _a5; (_a5 = value == null ? void 0 : value[PROXY_PATH_SYMBOL]) == null ? void 0 : _a5.call(value, label); return value; } // node_modules/svelte/src/internal/shared/dev.js function get_error(label) { const error = new Error(); const stack2 = get_stack(); if (stack2.length === 0) { return null; } stack2.unshift("\n"); define_property(error, "stack", { value: stack2.join("\n") }); define_property(error, "name", { value: label }); return ( /** @type {Error & { stack: string }} */ error ); } function get_stack() { const limit = Error.stackTraceLimit; Error.stackTraceLimit = Infinity; const stack2 = new Error().stack; Error.stackTraceLimit = limit; if (!stack2) return []; const lines = stack2.split("\n"); const new_lines = []; for (let i = 0; i < lines.length; i++) { const line = lines[i]; const posixified = line.replaceAll("\\", "/"); if (line.trim() === "Error") { continue; } if (line.includes("validate_each_keys")) { return []; } if (posixified.includes("svelte/src/internal") || posixified.includes("node_modules/.vite")) { continue; } new_lines.push(line); } return new_lines; } function invariant(condition, message) { if (!dev_fallback_default) { throw new Error("invariant(...) was not guarded by if (DEV)"); } if (!condition) invariant_violation(message); } // node_modules/svelte/src/internal/client/context.js var component_context = null; function set_component_context(context) { component_context = context; } var dev_stack = null; function set_dev_stack(stack2) { dev_stack = stack2; } var dev_current_component_function = null; function set_dev_current_component_function(fn) { dev_current_component_function = fn; } function push(props, runes = false, fn) { component_context = { p: component_context, i: false, c: null, e: null, s: props, x: null, r: ( /** @type {Effect} */ active_effect ), l: legacy_mode_flag && !runes ? { s: null, u: null, $: [] } : null }; if (dev_fallback_default) { component_context.function = fn; dev_current_component_function = fn; } } function pop(component2) { var _a5; var context = ( /** @type {ComponentContext} */ component_context ); var effects = context.e; if (effects !== null) { context.e = null; for (var fn of effects) { create_user_effect(fn); } } if (component2 !== void 0) { context.x = component2; } context.i = true; component_context = context.p; if (dev_fallback_default) { dev_current_component_function = (_a5 = component_context == null ? void 0 : component_context.function) != null ? _a5 : null; } return component2 != null ? component2 : ( /** @type {T} */ {} ); } function is_runes() { return !legacy_mode_flag || component_context !== null && component_context.l === null; } // node_modules/svelte/src/internal/client/dom/task.js var micro_tasks = []; function run_micro_tasks() { var tasks = micro_tasks; micro_tasks = []; run_all(tasks); } function queue_micro_task(fn) { if (micro_tasks.length === 0 && !is_flushing_sync) { var tasks = micro_tasks; queueMicrotask(() => { if (tasks === micro_tasks) run_micro_tasks(); }); } micro_tasks.push(fn); } function flush_tasks() { while (micro_tasks.length > 0) { run_micro_tasks(); } } // node_modules/svelte/src/internal/client/warnings.js var bold = "font-weight: bold"; var normal = "font-weight: normal"; function await_reactivity_loss(name) { if (dev_fallback_default) { console.warn(`%c[svelte] await_reactivity_loss %cDetected reactivity loss when reading \`${name}\`. This happens when state is read in an async function after an earlier \`await\` https://svelte.dev/e/await_reactivity_loss`, bold, normal); } else { console.warn(`https://svelte.dev/e/await_reactivity_loss`); } } function await_waterfall(name, location) { if (dev_fallback_default) { console.warn(`%c[svelte] await_waterfall %cAn async derived, \`${name}\` (${location}) was not read immediately after it resolved. This often indicates an unnecessary waterfall, which can slow down your app https://svelte.dev/e/await_waterfall`, bold, normal); } else { console.warn(`https://svelte.dev/e/await_waterfall`); } } function derived_inert() { if (dev_fallback_default) { console.warn(`%c[svelte] derived_inert %cReading a derived belonging to a now-destroyed effect may result in stale values https://svelte.dev/e/derived_inert`, bold, normal); } else { console.warn(`https://svelte.dev/e/derived_inert`); } } function hydration_attribute_changed(attribute, html2, value) { if (dev_fallback_default) { console.warn(`%c[svelte] hydration_attribute_changed %cThe \`${attribute}\` attribute on \`${html2}\` changed its value between server and client renders. The client value, \`${value}\`, will be ignored in favour of the server value https://svelte.dev/e/hydration_attribute_changed`, bold, normal); } else { console.warn(`https://svelte.dev/e/hydration_attribute_changed`); } } function hydration_mismatch(location) { if (dev_fallback_default) { console.warn( `%c[svelte] hydration_mismatch %c${location ? `Hydration failed because the initial UI does not match what was rendered on the server. The error occurred near ${location}` : "Hydration failed because the initial UI does not match what was rendered on the server"} https://svelte.dev/e/hydration_mismatch`, bold, normal ); } else { console.warn(`https://svelte.dev/e/hydration_mismatch`); } } function lifecycle_double_unmount() { if (dev_fallback_default) { console.warn(`%c[svelte] lifecycle_double_unmount %cTried to unmount a component that was not mounted https://svelte.dev/e/lifecycle_double_unmount`, bold, normal); } else { console.warn(`https://svelte.dev/e/lifecycle_double_unmount`); } } function select_multiple_invalid_value() { if (dev_fallback_default) { console.warn(`%c[svelte] select_multiple_invalid_value %cThe \`value\` property of a \``); var root_2 = from_html(``); var $$css3 = { hash: "svelte-48e5ji", code: ".task-status-marker.svelte-48e5ji {display:inline-flex !important;align-items:center;justify-content:center;width:var(--task-status-marker-size);height:var(--task-status-marker-size);min-width:var(--task-status-marker-size);min-height:var(--task-status-marker-size);overflow:visible;margin:0 !important;padding:0 !important;text-indent:0 !important;line-height:1 !important;list-style:none !important;vertical-align:middle;}.task-status-marker.svelte-48e5ji .task-list-item.HyperMD-task-line:where(.svelte-48e5ji) {display:contents !important;}.task-status-marker.svelte-48e5ji .source-status-checkbox:where(.svelte-48e5ji),\n.task-status-marker.svelte-48e5ji .status-text-marker:where(.svelte-48e5ji) {display:inline-flex !important;align-items:center !important;justify-content:center !important;box-sizing:border-box;width:var(--task-status-marker-size) !important;height:var(--task-status-marker-size) !important;min-width:var(--task-status-marker-size) !important;min-height:var(--task-status-marker-size) !important;margin:0 !important;padding:0 !important;pointer-events:none;text-indent:0 !important;line-height:1 !important;vertical-align:middle !important;}.task-status-marker.svelte-48e5ji .status-text-marker:where(.svelte-48e5ji) {font-size:calc(var(--task-status-marker-size) - 3px);}.task-status-marker.svelte-48e5ji .source-status-checkbox:where(.svelte-48e5ji) {position:relative !important;top:0 !important;left:0 !important;transform:none !important;margin:0 !important;padding:0 !important;appearance:none !important;-webkit-appearance:none !important;box-sizing:border-box !important;}" }; function TaskStatusMarker($$anchor, $$props) { if (new.target) return createClassComponent({ component: TaskStatusMarker, ...$$anchor }); push($$props, false); append_styles($$anchor, $$css3); const isCustom = mutable_source(); const markerSize = mutable_source(); const resolvedIsChecked = mutable_source(); let status = prop($$props, "status", 12); let isDone = prop($$props, "isDone", 12, false); let isChecked = prop($$props, "isChecked", 12, void 0); let size2 = prop($$props, "size", 12, 16); legacy_pre_effect(() => deep_read_state(status()), () => { set(isCustom, status() !== " "); }); legacy_pre_effect(() => deep_read_state(size2()), () => { set(markerSize, `${size2()}px`); }); legacy_pre_effect(() => (deep_read_state(isChecked()), deep_read_state(isDone())), () => { var _a5; set(resolvedIsChecked, (_a5 = isChecked()) != null ? _a5 : isDone()); }); legacy_pre_effect_reset(); var $$exports = { get status() { return status(); }, set status($$value) { status($$value); flushSync(); }, get isDone() { return isDone(); }, set isDone($$value) { isDone($$value); flushSync(); }, get isChecked() { return isChecked(); }, set isChecked($$value) { isChecked($$value); flushSync(); }, get size() { return size2(); }, set size($$value) { size2($$value); flushSync(); }, $set: update_legacy_props, $on: ($$event_name, $$event_cb) => add_legacy_event_listener($$props, $$event_name, $$event_cb) }; init(); var fragment = comment(); var node = first_child(fragment); { var consequent_1 = ($$anchor2) => { var span = root_2(); let styles; var span_1 = child(span); let classes; var node_1 = child(span_1); { var consequent = ($$anchor3) => { var span_2 = root3(); var text2 = child(span_2, true); reset(span_2); template_effect(() => set_text(text2, status())); append($$anchor3, span_2); }; var d = user_derived(() => (deep_read_state(shouldRenderStatusAsText), deep_read_state(status()), untrack(() => shouldRenderStatusAsText(status())))); var alternate = ($$anchor3) => { var input = root_1(); remove_input_defaults(input); template_effect(() => { set_attribute2(input, "data-task", status()); set_checked(input, get(resolvedIsChecked)); }); append($$anchor3, input); }; if_block(node_1, ($$render) => { if (get(d)) $$render(consequent); else $$render(alternate, -1); }); } reset(span_1); reset(span); template_effect(() => { styles = set_style(span, "", styles, { "--task-status-marker-size": get(markerSize) }); classes = set_class(span_1, 1, "task-list-item HyperMD-task-line svelte-48e5ji", null, classes, { "is-checked": get(resolvedIsChecked) }); set_attribute2(span_1, "data-task", status()); }); append($$anchor2, span); }; var alternate_1 = ($$anchor2) => { { let $0 = derived_safe_equal(() => isDone() ? "lucide-check-square" : "lucide-square"); let $1 = derived_safe_equal(() => isDone() ? 1 : 0.5); Icon($$anchor2, { get name() { return get($0); }, get size() { return size2(); }, get opacity() { return get($1); } }); } }; if_block(node, ($$render) => { if (get(isCustom)) $$render(consequent_1); else $$render(alternate_1, -1); }); } append($$anchor, fragment); return pop($$exports); } // src/ui/components/ColumnHeader.svelte var root4 = from_html(` `); var root_12 = from_html(`
`); var root_22 = from_html(`
Status
`); var root_3 = from_html(``); var root_4 = from_html(`
Priority
`); var root_5 = from_html(`
`); var root_6 = from_html(`
`); var root_7 = from_html(`

`); var $$css4 = { hash: "svelte-1q9xxoc", code: '.column-header.svelte-1q9xxoc {width:100%;--header-accent: var(--column-color, var(--background-modifier-border-hover));--column-header-x-padding: var(--column-header-x-padding-override, var(--size-4-4));--column-header-y-padding: var(--column-header-y-padding-override, var(--size-4-4));display:flex;flex-direction:column;gap:var(--size-2-3);}.column-header.svelte-1q9xxoc::before {content:"";display:block;width:calc(100% + 2 * var(--column-header-x-padding));height:12px;margin:calc(-1 * var(--column-header-y-padding)) calc(-1 * var(--column-header-x-padding)) 0;border-radius:2px;background:var(--header-accent);box-shadow:inset 0 0 0 1px color-mix(in srgb, var(--text-normal) 10%, transparent);flex:0 0 auto;}.column-header.row-header.svelte-1q9xxoc {position:relative;display:flex;align-items:stretch;margin-bottom:0;}.column-header.row-header.svelte-1q9xxoc::before {position:absolute;top:calc(-1 * var(--column-header-y-padding));bottom:calc(-1 * var(--column-header-y-padding));left:calc(-1 * var(--column-header-x-padding));width:12px;height:auto;margin:0;z-index:3;}.column-header.row-header.svelte-1q9xxoc .header:where(.svelte-1q9xxoc) {margin:calc(-1 * var(--size-4-2)) calc(-1 * var(--size-4-3)) calc(-1 * var(--size-2-2));padding:var(--size-4-2) var(--size-4-3) var(--size-2-2);width:calc(100% + 2 * var(--size-4-3));box-sizing:border-box;position:sticky;top:var(--header-height, 0px);z-index:2;background:color-mix(in srgb, var(--background-secondary) 72%, var(--background-primary));}.column-header.row-header.svelte-1q9xxoc .column-meta:where(.svelte-1q9xxoc),\n.column-header.row-header.svelte-1q9xxoc .selection-info:where(.svelte-1q9xxoc) {padding-left:var(--size-4-3);box-sizing:border-box;}.column-header.row-header.svelte-1q9xxoc .column-meta:where(.svelte-1q9xxoc) {margin-top:var(--size-2-2);}.column-header.row-header.svelte-1q9xxoc .column-meta:where(.svelte-1q9xxoc) .column-meta-line:where(.svelte-1q9xxoc) {justify-content:flex-start;flex-wrap:wrap;gap:var(--size-2-2) var(--size-4-2);}.column-header.row-header.svelte-1q9xxoc .column-meta:where(.svelte-1q9xxoc) .column-meta-line:where(.svelte-1q9xxoc) .column-match-tags:where(.svelte-1q9xxoc),\n.column-header.row-header.svelte-1q9xxoc .column-meta:where(.svelte-1q9xxoc) .column-meta-line:where(.svelte-1q9xxoc) .column-match-status:where(.svelte-1q9xxoc),\n.column-header.row-header.svelte-1q9xxoc .column-meta:where(.svelte-1q9xxoc) .column-meta-line:where(.svelte-1q9xxoc) .column-match-priority:where(.svelte-1q9xxoc) {order:1;flex:0 0 100%;}.column-header.row-header.svelte-1q9xxoc .column-meta:where(.svelte-1q9xxoc) .column-meta-line:where(.svelte-1q9xxoc) .task-count:where(.svelte-1q9xxoc) {order:2;flex:0 0 100%;margin-left:0;}.column-header.row-header.svelte-1q9xxoc .column-meta:where(.svelte-1q9xxoc) .column-meta-line:where(.svelte-1q9xxoc) .mode-toggle:where(.svelte-1q9xxoc) {order:3;flex:0 0 auto;}.column-header.collapsed.svelte-1q9xxoc {position:sticky;top:0;align-self:flex-start;z-index:1;}.column-header.collapsed.svelte-1q9xxoc .header:where(.svelte-1q9xxoc) {flex-direction:column;align-items:center;min-height:unset;gap:var(--size-4-2);}.column-header.collapsed.svelte-1q9xxoc .header:where(.svelte-1q9xxoc) .column-title-group:where(.svelte-1q9xxoc) {order:2;}.column-header.collapsed.svelte-1q9xxoc .header:where(.svelte-1q9xxoc) .column-title-group:where(.svelte-1q9xxoc) h2:where(.svelte-1q9xxoc) {writing-mode:vertical-rl;text-orientation:mixed;white-space:nowrap;overflow:visible;text-overflow:unset;flex:0 0 auto;line-height:normal;}.column-header.collapsed.svelte-1q9xxoc .header:where(.svelte-1q9xxoc) .task-count:where(.svelte-1q9xxoc) {order:3;writing-mode:horizontal-tb;align-self:center;line-height:normal;}.column-header.collapsed.svelte-1q9xxoc .header:where(.svelte-1q9xxoc) .header-menu:where(.svelte-1q9xxoc) {display:flex;margin-left:0;order:4;}.column-header.collapsed.svelte-1q9xxoc .header:where(.svelte-1q9xxoc) .header-menu button {width:20px;height:20px;}.column-header.collapsed.svelte-1q9xxoc .header:where(.svelte-1q9xxoc) .collapse-btn:where(.svelte-1q9xxoc) {order:1;}.column-header.vertical-collapsed.row-header.svelte-1q9xxoc {margin-bottom:0;}.column-header.vertical-collapsed.row-header.svelte-1q9xxoc .header-menu:where(.svelte-1q9xxoc) {display:flex;}.header.svelte-1q9xxoc {display:flex;align-items:center;min-height:22px;width:100%;flex-shrink:0;gap:var(--size-4-2);}.header.svelte-1q9xxoc .column-title-group:where(.svelte-1q9xxoc) {min-width:0;display:flex;flex-direction:column;align-items:flex-start;gap:2px;flex:1 1 auto;}.header.svelte-1q9xxoc h2:where(.svelte-1q9xxoc) {font-size:var(--font-ui-medium);font-weight:var(--font-bold);margin:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;line-height:1.2;position:sticky;left:calc(var(--sticky-left-offset, 0px) + var(--column-header-x-padding, var(--size-4-4)));max-width:100%;}.header.svelte-1q9xxoc .task-count:where(.svelte-1q9xxoc) {font-size:var(--font-ui-small);color:var(--text-muted);white-space:nowrap;align-self:flex-start;line-height:28px;}.header.svelte-1q9xxoc .header-menu:where(.svelte-1q9xxoc) {margin-left:auto;flex-shrink:0;display:flex;align-items:center;gap:var(--size-2-1);height:24px;}.header.svelte-1q9xxoc .collapse-btn:where(.svelte-1q9xxoc) {background:transparent;border:none;box-shadow:none;cursor:pointer;color:var(--text-muted);padding:0;width:14px;height:24px;display:flex;align-items:center;justify-content:center;font-size:10px;line-height:1;flex-shrink:0;transition:color 0.15s ease;}.header.svelte-1q9xxoc .collapse-btn:where(.svelte-1q9xxoc):hover {color:var(--text-normal);background:transparent;}.header.svelte-1q9xxoc .collapse-btn:where(.svelte-1q9xxoc):focus-visible {outline:2px solid var(--background-modifier-border-focus);outline-offset:2px;}.mode-toggle.svelte-1q9xxoc {display:flex;align-items:center;background:var(--background-modifier-form-field, var(--background-secondary));border-radius:var(--radius-s);padding:2px;gap:0;width:fit-content;max-width:100%;flex:0 0 auto;}.mode-toggle.svelte-1q9xxoc .mode-btn:where(.svelte-1q9xxoc) {font-size:var(--font-ui-smaller);padding:1px 5px;min-width:0;width:auto;border:none;background:transparent;color:var(--text-muted);border-radius:calc(var(--radius-s) - 2px);cursor:pointer;transition:background 0.15s ease, color 0.15s ease;white-space:nowrap;box-shadow:none;line-height:1.2;}.mode-toggle.svelte-1q9xxoc .mode-btn:where(.svelte-1q9xxoc):hover {background:transparent;color:var(--text-normal);box-shadow:none;}.mode-toggle.svelte-1q9xxoc .mode-btn.active:where(.svelte-1q9xxoc) {background:var(--background-primary);color:var(--text-normal);box-shadow:var(--input-shadow);font-weight:var(--font-medium);}.mode-toggle.svelte-1q9xxoc .mode-btn:where(.svelte-1q9xxoc):focus-visible {outline:2px solid var(--background-modifier-border-focus);outline-offset:1px;}.column-meta.svelte-1q9xxoc {display:flex;flex-direction:column;gap:var(--size-2-1);width:100%;align-items:flex-start;}.column-meta.svelte-1q9xxoc .column-meta-line:where(.svelte-1q9xxoc) {display:flex;align-items:center;justify-content:space-between;width:100%;gap:var(--size-2-3);min-width:0;}.column-meta.svelte-1q9xxoc .column-meta-line:where(.svelte-1q9xxoc) .task-count:where(.svelte-1q9xxoc) {font-size:var(--font-ui-small);color:var(--text-muted);white-space:nowrap;line-height:1.3;margin-left:auto;flex:0 0 auto;}.column-match-tags.svelte-1q9xxoc,\n.column-match-status.svelte-1q9xxoc,\n.column-match-priority.svelte-1q9xxoc {font-size:var(--font-ui-small);color:var(--text-muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;line-height:1.3;min-width:0;flex:1 1 auto;}.column-match-status.svelte-1q9xxoc,\n.column-match-priority.svelte-1q9xxoc {display:inline-flex;align-items:center;gap:var(--size-2-2);flex:0 0 auto;overflow:visible;}.column-match-status-label.svelte-1q9xxoc {font-weight:var(--font-medium);}.column-priority-preview.svelte-1q9xxoc {display:inline-flex;align-items:center;gap:3px;min-width:0;}.column-priority-icon.svelte-1q9xxoc {line-height:1;}.column-status-preview.svelte-1q9xxoc {display:inline-flex !important;align-items:center !important;justify-content:center !important;width:18px !important;height:18px !important;min-width:18px !important;min-height:18px !important;max-width:18px !important;max-height:18px !important;margin:0 !important;padding:0 !important;text-indent:0 !important;line-height:1 !important;list-style:none !important;color:var(--text-normal);vertical-align:middle;}.selection-info.svelte-1q9xxoc {font-size:var(--font-ui-smaller);color:var(--text-muted);margin-top:var(--size-2-1);}' }; function ColumnHeader($$anchor, $$props) { if (new.target) return createClassComponent({ component: ColumnHeader, ...$$anchor }); push($$props, false); append_styles($$anchor, $$css4); const $columnTagTableStore = () => store_get(columnTagTableStore(), "$columnTagTableStore", $$stores); const $columnColourTableStore = () => store_get(columnColourTableStore(), "$columnColourTableStore", $$stores); const $columnMatchTagTableStore = () => store_get(columnMatchTagTableStore(), "$columnMatchTagTableStore", $$stores); const $columnSubtitleTableStore = () => store_get(columnSubtitleTableStore(), "$columnSubtitleTableStore", $$stores); const $selectionModeStore = () => store_get(selectionModeStore, "$selectionModeStore", $$stores); const $taskSelectionStore = () => store_get(taskSelectionStore, "$taskSelectionStore", $$stores); const [$$stores, $$cleanup] = setup_stores(); const columnTitle = mutable_source(); const columnColor = mutable_source(); const columnMatchTags = mutable_source(); const columnStatusMarker = mutable_source(); const columnStatusLabel = mutable_source(); const columnPriorityLabel = mutable_source(); const columnPriorityIcon = mutable_source(); const taskCountLabel = mutable_source(); const collapseIcon = mutable_source(); const isHorizontalCollapsed = mutable_source(); const isVerticalCollapsed = mutable_source(); const displayTaskCount = mutable_source(); const showColumnMatchTags = mutable_source(); const showColumnStatus = mutable_source(); const showColumnPriority = mutable_source(); const isSelectMode = mutable_source(); const columnTaskIds = mutable_source(); const selectedCount = mutable_source(); const selectedIds = mutable_source(); const showContextMenu = mutable_source(); let column = prop($$props, "column", 12); let tasks = prop($$props, "tasks", 12); let taskActions = prop($$props, "taskActions", 12); let columnTagTableStore = prop($$props, "columnTagTableStore", 12); let columnColourTableStore = prop($$props, "columnColourTableStore", 12); let columnMatchTagTableStore = prop($$props, "columnMatchTagTableStore", 12); let columnSubtitleTableStore = prop($$props, "columnSubtitleTableStore", 12); let isVerticalFlow = prop($$props, "isVerticalFlow", 12, false); let isCollapsed = prop($$props, "isCollapsed", 12, false); let onToggleCollapse = prop($$props, "onToggleCollapse", 12); let uncategorizedColumnName = prop($$props, "uncategorizedColumnName", 12, void 0); let doneColumnName = prop($$props, "doneColumnName", 12, void 0); let columnSubtitle = mutable_source(); function getColumnTitle(col, columnTagTable) { switch (col) { case "done": case "uncategorised": return resolveDefaultColumnName(col, uncategorizedColumnName(), doneColumnName()); default: return columnTagTable[col]; } } function showMenu(e) { const menu = new import_obsidian3.Menu(); if (get(isSelectMode) && get(selectedCount) > 0) { if (column() !== "done") { menu.addItem((i) => { i.setTitle(`Move ${get(selectedCount)} selected to ${resolveDefaultColumnName("done", uncategorizedColumnName(), doneColumnName())}`).onClick(async () => { for (const id of get(selectedIds)) { await taskActions().markDone(id); } clearColumnSelections(get(columnTaskIds)); }); }); } for (const [tag2, label] of Object.entries($columnTagTableStore())) { const tagAsColumn = tag2; if (tagAsColumn === column()) continue; menu.addItem((i) => { i.setTitle(`Move ${get(selectedCount)} selected to ${label}`).onClick(async () => { for (const id of get(selectedIds)) { await taskActions().changeColumn(id, tagAsColumn); } clearColumnSelections(get(columnTaskIds)); }); }); } menu.addSeparator(); const selectedTasks = get(selectedIds).map((id) => tasks().find((t) => t.id === id)).filter(Boolean); const allCancelled = selectedTasks.length > 0 && selectedTasks.every((t) => t.isCancelled); if (allCancelled) { menu.addItem((i) => { i.setTitle(`Restore ${get(selectedCount)} selected`).onClick(async () => { await taskActions().restoreTasks(get(selectedIds)); clearColumnSelections(get(columnTaskIds)); }); }); } else { menu.addItem((i) => { i.setTitle(`Cancel ${get(selectedCount)} selected`).onClick(async () => { await taskActions().cancelTasks(get(selectedIds)); clearColumnSelections(get(columnTaskIds)); }); }); } menu.addSeparator(); menu.addItem((i) => { i.setTitle(`Archive ${get(selectedCount)} selected`).onClick(async () => { await taskActions().archiveTasks(get(selectedIds)); clearColumnSelections(get(columnTaskIds)); }); }); } if (column() === "done") { menu.addItem((i) => { i.setTitle(`Archive all`).onClick(() => taskActions().archiveTasks(tasks().map(({ id }) => id))); }); } menu.showAtMouseEvent(e); } legacy_pre_effect( () => (deep_read_state(uncategorizedColumnName()), deep_read_state(doneColumnName()), deep_read_state(column()), $columnTagTableStore()), () => { set(columnTitle, (() => { void uncategorizedColumnName(); void doneColumnName(); return getColumnTitle(column(), $columnTagTableStore()); })()); } ); legacy_pre_effect( () => (isColumnTag, deep_read_state(column()), deep_read_state(columnTagTableStore()), $columnColourTableStore()), () => { set(columnColor, isColumnTag(column(), columnTagTableStore()) ? $columnColourTableStore()[column()] : void 0); } ); legacy_pre_effect( () => (isColumnTag, deep_read_state(column()), deep_read_state(columnTagTableStore()), $columnMatchTagTableStore()), () => { var _a5; set(columnMatchTags, isColumnTag(column(), columnTagTableStore()) ? (_a5 = $columnMatchTagTableStore()[column()]) != null ? _a5 : [] : []); } ); legacy_pre_effect( () => (isColumnTag, deep_read_state(column()), deep_read_state(columnTagTableStore()), $columnSubtitleTableStore()), () => { set(columnSubtitle, isColumnTag(column(), columnTagTableStore()) ? $columnSubtitleTableStore()[column()] : void 0); } ); legacy_pre_effect(() => get(columnSubtitle), () => { var _a5; set(columnStatusMarker, ((_a5 = get(columnSubtitle)) == null ? void 0 : _a5.kind) === "status" ? get(columnSubtitle).value : void 0); }); legacy_pre_effect(() => get(columnSubtitle), () => { var _a5; set(columnStatusLabel, ((_a5 = get(columnSubtitle)) == null ? void 0 : _a5.kind) === "status" ? get(columnSubtitle).label : ""); }); legacy_pre_effect(() => get(columnSubtitle), () => { var _a5; set(columnPriorityLabel, ((_a5 = get(columnSubtitle)) == null ? void 0 : _a5.kind) === "priority" ? get(columnSubtitle).label : ""); }); legacy_pre_effect(() => get(columnSubtitle), () => { var _a5; set(columnPriorityIcon, ((_a5 = get(columnSubtitle)) == null ? void 0 : _a5.kind) === "priority" ? get(columnSubtitle).icon : void 0); }); legacy_pre_effect(() => deep_read_state(tasks()), () => { set(taskCountLabel, tasks().length === 1 ? "1 task" : `${tasks().length} tasks`); }); legacy_pre_effect(() => deep_read_state(isCollapsed()), () => { set(collapseIcon, isCollapsed() ? "\u25B6" : "\u25BC"); }); legacy_pre_effect( () => (deep_read_state(isCollapsed()), deep_read_state(isVerticalFlow())), () => { set(isHorizontalCollapsed, isCollapsed() && !isVerticalFlow()); } ); legacy_pre_effect( () => (deep_read_state(isCollapsed()), deep_read_state(isVerticalFlow())), () => { set(isVerticalCollapsed, isCollapsed() && isVerticalFlow()); } ); legacy_pre_effect( () => (deep_read_state(isCollapsed()), deep_read_state(tasks()), get(taskCountLabel)), () => { set(displayTaskCount, isCollapsed() ? `${tasks().length}` : get(taskCountLabel)); } ); legacy_pre_effect(() => (get(columnMatchTags), deep_read_state(isCollapsed())), () => { set(showColumnMatchTags, get(columnMatchTags).length > 0 && !isCollapsed()); }); legacy_pre_effect(() => (get(columnStatusMarker), deep_read_state(isCollapsed())), () => { set(showColumnStatus, get(columnStatusMarker) !== void 0 && !isCollapsed()); }); legacy_pre_effect(() => (get(columnSubtitle), deep_read_state(isCollapsed())), () => { var _a5; set(showColumnPriority, ((_a5 = get(columnSubtitle)) == null ? void 0 : _a5.kind) === "priority" && !isCollapsed()); }); legacy_pre_effect( () => (isInSelectionMode, deep_read_state(column()), $selectionModeStore()), () => { set(isSelectMode, isInSelectionMode(column(), $selectionModeStore())); } ); legacy_pre_effect(() => deep_read_state(tasks()), () => { set(columnTaskIds, tasks().map((t) => t.id)); }); legacy_pre_effect( () => (getSelectedTaskCount, get(columnTaskIds), $taskSelectionStore()), () => { set(selectedCount, getSelectedTaskCount(get(columnTaskIds), $taskSelectionStore())); } ); legacy_pre_effect(() => (get(columnTaskIds), isTaskSelected, $taskSelectionStore()), () => { set(selectedIds, get(columnTaskIds).filter((id) => isTaskSelected(id, $taskSelectionStore()))); }); legacy_pre_effect( () => (deep_read_state(column()), get(isSelectMode), get(selectedCount)), () => { set(showContextMenu, column() === "done" || get(isSelectMode) && get(selectedCount) > 0); } ); legacy_pre_effect_reset(); var $$exports = { get column() { return column(); }, set column($$value) { column($$value); flushSync(); }, get tasks() { return tasks(); }, set tasks($$value) { tasks($$value); flushSync(); }, get taskActions() { return taskActions(); }, set taskActions($$value) { taskActions($$value); flushSync(); }, get columnTagTableStore() { return columnTagTableStore(); }, set columnTagTableStore($$value) { columnTagTableStore($$value); flushSync(); }, get columnColourTableStore() { return columnColourTableStore(); }, set columnColourTableStore($$value) { columnColourTableStore($$value); flushSync(); }, get columnMatchTagTableStore() { return columnMatchTagTableStore(); }, set columnMatchTagTableStore($$value) { columnMatchTagTableStore($$value); flushSync(); }, get columnSubtitleTableStore() { return columnSubtitleTableStore(); }, set columnSubtitleTableStore($$value) { columnSubtitleTableStore($$value); flushSync(); }, get isVerticalFlow() { return isVerticalFlow(); }, set isVerticalFlow($$value) { isVerticalFlow($$value); flushSync(); }, get isCollapsed() { return isCollapsed(); }, set isCollapsed($$value) { isCollapsed($$value); flushSync(); }, get onToggleCollapse() { return onToggleCollapse(); }, set onToggleCollapse($$value) { onToggleCollapse($$value); flushSync(); }, get uncategorizedColumnName() { return uncategorizedColumnName(); }, set uncategorizedColumnName($$value) { uncategorizedColumnName($$value); flushSync(); }, get doneColumnName() { return doneColumnName(); }, set doneColumnName($$value) { doneColumnName($$value); flushSync(); }, $set: update_legacy_props, $on: ($$event_name, $$event_cb) => add_legacy_event_listener($$props, $$event_name, $$event_cb) }; init(); var div = root_7(); let classes; let styles; var div_1 = child(div); var span = child(div_1); var text2 = child(span, true); reset(span); var div_2 = sibling(span, 2); var h2 = child(div_2); var text_1 = child(h2, true); reset(h2); reset(div_2); var node = sibling(div_2, 2); { var consequent = ($$anchor2) => { var span_1 = root4(); var text_2 = child(span_1, true); reset(span_1); template_effect(() => { set_attribute2(span_1, "aria-label", get(taskCountLabel)); set_text(text_2, get(displayTaskCount)); }); append($$anchor2, span_1); }; if_block(node, ($$render) => { if (isCollapsed()) $$render(consequent); }); } var div_3 = sibling(node, 2); var node_1 = child(div_3); { var consequent_1 = ($$anchor2) => { Icon_button($$anchor2, { icon: "lucide-more-vertical", get "aria-label"() { var _a5; return `Column options for ${(_a5 = get(columnTitle)) != null ? _a5 : ""}`; }, $$events: { click: showMenu } }); }; if_block(node_1, ($$render) => { if (get(showContextMenu)) $$render(consequent_1); }); } reset(div_3); reset(div_1); var node_2 = sibling(div_1, 2); { var consequent_6 = ($$anchor2) => { var div_4 = root_5(); var div_5 = child(div_4); var node_3 = child(div_5); { var consequent_2 = ($$anchor3) => { var div_6 = root_12(); var text_3 = child(div_6, true); reset(div_6); template_effect( ($0, $1) => { set_attribute2(div_6, "title", $0); set_text(text_3, $1); }, [ () => (get(columnMatchTags), untrack(() => get(columnMatchTags).map((tag2) => `#${tag2}`).join(" "))), () => (get(columnMatchTags), untrack(() => get(columnMatchTags).map((tag2) => `#${tag2}`).join(" "))) ] ); append($$anchor3, div_6); }; if_block(node_3, ($$render) => { if (get(showColumnMatchTags)) $$render(consequent_2); }); } var node_4 = sibling(node_3, 2); { var consequent_3 = ($$anchor3) => { var div_7 = root_22(); var span_2 = sibling(child(div_7), 2); var node_5 = child(span_2); { let $0 = derived_safe_equal(() => { var _a5; return (_a5 = get(columnStatusMarker)) != null ? _a5 : " "; }); TaskStatusMarker(node_5, { get status() { return get($0); }, size: 18 }); } reset(span_2); reset(div_7); template_effect(() => { var _a5, _b3; set_attribute2(div_7, "title", `Status: ${(_a5 = get(columnStatusLabel)) != null ? _a5 : ""}`); set_attribute2(span_2, "aria-label", `Status: ${(_b3 = get(columnStatusLabel)) != null ? _b3 : ""}`); }); append($$anchor3, div_7); }; if_block(node_4, ($$render) => { if (get(showColumnStatus)) $$render(consequent_3); }); } var node_6 = sibling(node_4, 2); { var consequent_5 = ($$anchor3) => { var div_8 = root_4(); var span_3 = sibling(child(div_8), 2); var node_7 = child(span_3); { var consequent_4 = ($$anchor4) => { var span_4 = root_3(); var text_4 = child(span_4, true); reset(span_4); template_effect(() => set_text(text_4, get(columnPriorityIcon))); append($$anchor4, span_4); }; if_block(node_7, ($$render) => { if (get(columnPriorityIcon)) $$render(consequent_4); }); } var span_5 = sibling(node_7, 2); var text_5 = child(span_5, true); reset(span_5); reset(span_3); reset(div_8); template_effect(() => { var _a5, _b3; set_attribute2(div_8, "title", `Priority: ${(_a5 = get(columnPriorityLabel)) != null ? _a5 : ""}`); set_attribute2(span_3, "aria-label", `Priority: ${(_b3 = get(columnPriorityLabel)) != null ? _b3 : ""}`); set_text(text_5, get(columnPriorityLabel)); }); append($$anchor3, div_8); }; if_block(node_6, ($$render) => { if (get(showColumnPriority)) $$render(consequent_5); }); } var span_6 = sibling(node_6, 2); var text_6 = child(span_6, true); reset(span_6); var div_9 = sibling(span_6, 2); var button = child(div_9); let classes_1; var button_1 = sibling(button, 2); let classes_2; reset(div_9); reset(div_5); reset(div_4); template_effect(() => { set_attribute2(span_6, "aria-label", get(taskCountLabel)); set_text(text_6, get(displayTaskCount)); classes_1 = set_class(button, 1, "mode-btn svelte-1q9xxoc", null, classes_1, { active: !get(isSelectMode) }); set_attribute2(button, "aria-pressed", !get(isSelectMode)); classes_2 = set_class(button_1, 1, "mode-btn svelte-1q9xxoc", null, classes_2, { active: get(isSelectMode) }); set_attribute2(button_1, "aria-pressed", get(isSelectMode)); }); event("click", button, () => { if (get(isSelectMode)) toggleSelectionMode(column()); }); event("click", button_1, () => { if (!get(isSelectMode)) toggleSelectionMode(column()); }); append($$anchor2, div_4); }; if_block(node_2, ($$render) => { if (!isCollapsed()) $$render(consequent_6); }); } var node_8 = sibling(node_2, 2); { var consequent_7 = ($$anchor2) => { var div_10 = root_6(); var text_7 = child(div_10); reset(div_10); template_effect(() => { var _a5; return set_text(text_7, `${(_a5 = get(selectedCount)) != null ? _a5 : ""} selected`); }); append($$anchor2, div_10); }; if_block(node_8, ($$render) => { if (get(isSelectMode) && get(selectedCount) > 0) $$render(consequent_7); }); } reset(div); template_effect(() => { var _a5, _b3; classes = set_class(div, 1, "column-header svelte-1q9xxoc", null, classes, { "row-header": isVerticalFlow(), collapsed: get(isHorizontalCollapsed), "vertical-collapsed": get(isVerticalCollapsed) }); styles = set_style(div, "", styles, { "--column-color": get(columnColor) }); set_attribute2(span, "aria-expanded", !isCollapsed()); set_attribute2(span, "aria-label", `${isCollapsed() ? "Expand" : "Collapse"} ${(_a5 = get(columnTitle)) != null ? _a5 : ""} column`); set_text(text2, get(collapseIcon)); set_attribute2(h2, "id", `column-title-${(_b3 = column()) != null ? _b3 : ""}`); set_attribute2(h2, "title", get(columnTitle)); set_text(text_1, get(columnTitle)); }); event("click", span, function(...$$args) { var _a5; (_a5 = onToggleCollapse()) == null ? void 0 : _a5.apply(this, $$args); }); event("keydown", span, (e) => { if (e.key === "Enter" || e.key === " ") { e.preventDefault(); onToggleCollapse()(); } }); append($$anchor, div); var $$pop = pop($$exports); $$cleanup(); return $$pop; } // src/ui/board/BoardCell.svelte var import_obsidian7 = require("obsidian"); // src/ui/board/cell_creation.ts function deriveCellCreationMetadata(secondaryAxisBucket) { var _a5, _b3, _c2; const value = (_a5 = secondaryAxisBucket.meta) == null ? void 0 : _a5.value; switch ((_c2 = (_b3 = secondaryAxisBucket.meta) == null ? void 0 : _b3.source) == null ? void 0 : _c2.kind) { case "file": return { targetFilePath: typeof value === "string" ? value : null, additionalTags: [] }; case "tag-prefix": return { targetFilePath: null, additionalTags: typeof value === "string" ? [value] : [] }; case "none": default: return { targetFilePath: null, additionalTags: [] }; } } // src/ui/dnd/store.ts var isDraggingStore = writable(null); var subtaskDraggingStore = writable(null); // src/ui/tasks/source_block.ts function parseSourceTaskLine(input) { const match = input.match(sourceTaskLineRegex); if (!match) { return null; } const [, indentation, bullet, status, content] = match; if (indentation == null || bullet == null || status == null || content == null) { return null; } return { indentation, bullet, status, content }; } function getSourceNodeText(node) { return node.kind === "task" ? node.content : node.rawLine.slice(node.indentation.length); } function getRawListItemText(node) { var _a5; const match = node.rawLine.slice(node.indentation.length).match(/^[-*+]\s+(.+)$/); return (_a5 = match == null ? void 0 : match[1]) != null ? _a5 : null; } function getVisibleSourceTaskDescendants(nodes) { return flattenSourceBlockNodes(nodes).filter( (node) => node.kind === "task" && node.taskVisibility === "visible" ); } function flattenSourceBlockNodes(nodes) { return nodes.flatMap((node) => [ node, ...flattenSourceBlockNodes(node.sourceChildren) ]); } var sourceTaskLineRegex = /^(\s*)([-*+])\s\[([^\[\]]*)\]\s(.+)/; // src/ui/components/TaskLineRow.svelte var root5 = from_html(`
`); var root_13 = from_html(`
`); var $$css5 = { hash: "svelte-1y3uj64", code: ".task-line-row.svelte-1y3uj64 {--task-line-base-padding-left: calc(var(--size-4-2) + 8px);--task-line-indent-step: 1.65rem;--task-line-marker-size: 20px;--task-line-row-height: 1.3em;--task-line-column-gap: var(--size-2-2);--task-line-block-padding: 0 var(--size-4-2) var(--size-2-1)\n calc(\n var(--task-line-base-padding-left) +\n (var(--task-line-depth) * var(--task-line-indent-step))\n );display:grid;grid-template-columns:var(--task-line-marker-size) minmax(0, 1fr);column-gap:var(--task-line-column-gap);align-items:start;padding:var(--task-line-block-padding);}.task-line-row.has-actions.svelte-1y3uj64 {grid-template-columns:var(--task-line-marker-size) minmax(0, 1fr) auto;}.task-line-row.card-variant.svelte-1y3uj64 {--task-line-column-gap: var(--size-2-3);--task-line-row-height: var(--task-content-line-height, 1.5rem);--task-line-block-padding: var(--size-4-2) var(--size-4-2)\n var(--size-4-2)\n calc(\n var(--task-line-base-padding-left) +\n (var(--task-line-depth) * var(--task-line-indent-step))\n );}.task-line-marker.svelte-1y3uj64,\n.task-line-actions.svelte-1y3uj64 {display:flex;align-items:center;justify-content:center;min-width:0;height:var(--task-line-row-height);}.task-line-content.svelte-1y3uj64 {display:block;min-width:0;min-height:var(--task-line-row-height);}.task-line-actions.svelte-1y3uj64 {justify-content:flex-end;}" }; function TaskLineRow($$anchor, $$props) { if (new.target) return createClassComponent({ component: TaskLineRow, ...$$anchor }); push($$props, false); append_styles($$anchor, $$css5); let depth = prop($$props, "depth", 12, 0); let hasActions = prop($$props, "hasActions", 12, false); let variant = prop($$props, "variant", 12, "source"); var $$exports = { get depth() { return depth(); }, set depth($$value) { depth($$value); flushSync(); }, get hasActions() { return hasActions(); }, set hasActions($$value) { hasActions($$value); flushSync(); }, get variant() { return variant(); }, set variant($$value) { variant($$value); flushSync(); }, $set: update_legacy_props, $on: ($$event_name, $$event_cb) => add_legacy_event_listener($$props, $$event_name, $$event_cb) }; var div = root_13(); let classes; let styles; var div_1 = child(div); var node = child(div_1); slot(node, $$props, "marker", {}, null); reset(div_1); var div_2 = sibling(div_1, 2); var node_1 = child(div_2); slot(node_1, $$props, "default", {}, null); reset(div_2); var node_2 = sibling(div_2, 2); { var consequent = ($$anchor2) => { var div_3 = root5(); var node_3 = child(div_3); slot(node_3, $$props, "actions", {}, null); reset(div_3); append($$anchor2, div_3); }; if_block(node_2, ($$render) => { if (hasActions()) $$render(consequent); }); } reset(div); template_effect(() => { classes = set_class(div, 1, "task-line-row svelte-1y3uj64", null, classes, { "has-actions": hasActions(), "card-variant": variant() === "card" }); styles = set_style(div, "", styles, { "--task-line-depth": depth() }); }); append($$anchor, div); return pop($$exports); } // src/ui/components/TaskSourceRow.svelte var import_obsidian4 = require("obsidian"); // src/ui/components/TaskSourceStatusButton.svelte var root6 = from_html(``); var $$css6 = { hash: "svelte-74sw79", code: ".icon-button.source-row-status.svelte-74sw79 {display:flex;justify-content:center;align-items:center;width:20px;height:20px;padding:0;border:none;background:transparent;cursor:pointer;border-radius:var(--radius-s);box-shadow:none;overflow:visible;}.icon-button.source-row-status.svelte-74sw79:hover, .icon-button.source-row-status.svelte-74sw79:active {background:transparent;box-shadow:none;}.icon-button.source-row-status.svelte-74sw79:disabled {cursor:default;opacity:0.35;}.icon-button.source-row-status.usesStatusMarker.svelte-74sw79 {color:var(--text-normal);}.icon-button.source-row-status.is-done.svelte-74sw79 svg {color:var(--interactive-accent);}" }; function TaskSourceStatusButton($$anchor, $$props) { if (new.target) return createClassComponent({ component: TaskSourceStatusButton, ...$$anchor }); push($$props, false); append_styles($$anchor, $$css6); const isDone = mutable_source(); const isIgnored = mutable_source(); const isChecked = mutable_source(); const displayStatusIsCustom = mutable_source(); let task = prop($$props, "task", 12); let taskActions = prop($$props, "taskActions", 12); let node = prop($$props, "node", 12); let isSelectionMode = prop($$props, "isSelectionMode", 12, false); function toggleStatus() { void taskActions().toggleSourceTaskStatus(task().id, node().rowIndex); } function handleKeydown(e) { if (e.key === "Enter" || e.key === " ") { e.preventDefault(); toggleStatus(); } } legacy_pre_effect(() => (deep_read_state(task()), deep_read_state(node())), () => { set(isDone, task().isSourceTaskStatusDone(node().status)); }); legacy_pre_effect(() => deep_read_state(node()), () => { set(isIgnored, node().taskVisibility === "ignored"); }); legacy_pre_effect(() => (get(isDone), get(isIgnored)), () => { set(isChecked, get(isDone) || get(isIgnored)); }); legacy_pre_effect(() => deep_read_state(node()), () => { set(displayStatusIsCustom, node().status !== " "); }); legacy_pre_effect_reset(); var $$exports = { get task() { return task(); }, set task($$value) { task($$value); flushSync(); }, get taskActions() { return taskActions(); }, set taskActions($$value) { taskActions($$value); flushSync(); }, get node() { return node(); }, set node($$value) { node($$value); flushSync(); }, get isSelectionMode() { return isSelectionMode(); }, set isSelectionMode($$value) { isSelectionMode($$value); flushSync(); }, $set: update_legacy_props, $on: ($$event_name, $$event_cb) => add_legacy_event_listener($$props, $$event_name, $$event_cb) }; init(); var button = root6(); let classes; var node_1 = child(button); TaskStatusMarker(node_1, { get status() { return deep_read_state(node()), untrack(() => node().status); }, get isDone() { return get(isDone); }, size: 16 }); reset(button); template_effect(() => { classes = set_class(button, 1, "icon-button source-row-status svelte-74sw79", null, classes, { "is-done": get(isDone), usesStatusMarker: get(displayStatusIsCustom) }); set_attribute2(button, "aria-checked", get(isChecked)); button.disabled = isSelectionMode(); set_attribute2(button, "tabindex", isSelectionMode() ? -1 : 0); }); event("click", button, stopPropagation(toggleStatus)); event("keydown", button, stopPropagation(handleKeydown)); append($$anchor, button); return pop($$exports); } // src/ui/components/TaskSourceRow.svelte var root7 = from_html(``); var root_14 = from_html(``); var root_23 = from_html(``); var root_32 = from_html(``); var root_42 = from_html(`
`); var $$css7 = { hash: "svelte-smkg1f", code: '.source-row.svelte-smkg1f {--source-row-line-height: 1.3;position:relative;}.source-row.is-dragging.svelte-smkg1f {opacity:0.4;}.source-row.drop-before.svelte-smkg1f::before, .source-row.drop-after.svelte-smkg1f::before {content:"";position:absolute;left:calc(var(--task-line-base-padding-left, 20px) + var(--drag-indicator-depth, 0) * var(--task-line-indent-step, 26px));right:8px;height:2px;background:var(--interactive-accent);pointer-events:none;}.source-row.drop-before.svelte-smkg1f::after, .source-row.drop-after.svelte-smkg1f::after {content:"";position:absolute;left:calc(var(--task-line-base-padding-left, 20px) + var(--drag-indicator-depth, 0) * var(--task-line-indent-step, 26px) - 8px);width:10px;height:10px;border-radius:999px;background:var(--interactive-accent);pointer-events:none;}.source-row.drop-before.svelte-smkg1f::before {top:-1px;}.source-row.drop-before.svelte-smkg1f::after {top:-5px;}.source-row.drop-after.svelte-smkg1f::before {bottom:-1px;}.source-row.drop-after.svelte-smkg1f::after {bottom:-5px;}.delete-subtask-btn.svelte-smkg1f {display:flex;justify-content:center;align-items:center;width:20px;height:20px;padding:0;border:none;background:transparent;cursor:pointer;color:var(--text-muted);opacity:0;transition:opacity 0.15s ease, color 0.15s ease;box-shadow:none;}.delete-subtask-btn.svelte-smkg1f:hover {color:var(--text-error, var(--text-accent));background:transparent;box-shadow:none;}.source-row.svelte-smkg1f:hover .delete-subtask-btn:where(.svelte-smkg1f) {opacity:0.8;}.delete-subtask-btn.svelte-smkg1f:hover {opacity:1 !important;}.source-row-preview.svelte-smkg1f {display:block;width:100%;height:auto;min-height:var(--task-line-row-height, 1.5rem);appearance:none;padding:0;border:none;background:transparent;box-shadow:none;color:var(--text-normal);font:inherit;line-height:var(--source-row-line-height);text-align:left;white-space:pre-wrap;overflow-wrap:anywhere;cursor:text;}.source-row-preview.svelte-smkg1f:hover, .source-row-preview.svelte-smkg1f:active {background:transparent;box-shadow:none;}.source-row-preview.svelte-smkg1f:focus-visible {outline:2px solid var(--background-modifier-border-focus);outline-offset:2px;}textarea.svelte-smkg1f {cursor:text;background-color:var(--color-base-25);width:100%;min-height:1.6rem;resize:none;}.source-row-bullet.svelte-smkg1f {display:block;width:8px;height:8px;border-radius:50%;background:var(--text-muted);}.is-ignored-task.svelte-smkg1f .source-row-preview:where(.svelte-smkg1f) {color:var(--text-normal);}' }; function TaskSourceRow($$anchor, $$props) { if (new.target) return createClassComponent({ component: TaskSourceRow, ...$$anchor }); push($$props, false); append_styles($$anchor, $$css7); const $subtaskDraggingStore = () => store_get(subtaskDraggingStore, "$subtaskDraggingStore", $$stores); const [$$stores, $$cleanup] = setup_stores(); const rawListItemText = mutable_source(); const editText = mutable_source(); const previewText = mutable_source(); let app = prop($$props, "app", 12); let task = prop($$props, "task", 12); let taskActions = prop($$props, "taskActions", 12); let node = prop($$props, "node", 12); let isSelectionMode = prop($$props, "isSelectionMode", 12, false); let depth = prop($$props, "depth", 12, 0); let isEditing = mutable_source(false); let isDragging = mutable_source(false); let isDraggedOver = mutable_source(false); let dropBefore = mutable_source(false); let dropAfter = mutable_source(false); let dragIndicatorDepth = mutable_source(depth()); function startEditing() { set(isEditing, true); } function finishEditing(e) { const next2 = e.currentTarget.value; set(isEditing, false); if (next2 !== get(editText)) { void taskActions().updateSourceBlockRow(task().id, node().rowIndex, next2); } } function handleTextareaKeydown(e) { var _a5; if (e.key === "Enter" && !e.shiftKey || e.key === "Escape") { e.preventDefault(); (_a5 = e.currentTarget) == null ? void 0 : _a5.blur(); if (e.key === "Escape") { set(isEditing, false); } } } function handlePreviewKeydown(e) { if (e.key === "Enter" || e.key === " ") { e.preventDefault(); startEditing(); } } function focusAndAutosize(node2) { function resize() { node2.style.height = "0px"; node2.style.height = `${node2.scrollHeight}px`; } const focusTimer = setTimeout(() => node2.focus(), 0); node2.addEventListener("input", resize); resize(); return { destroy() { clearTimeout(focusTimer); node2.removeEventListener("input", resize); } }; } class ConfirmDeleteSubtaskModal extends import_obsidian4.Modal { constructor(app2, subtaskText, onConfirm) { super(app2); this.subtaskText = subtaskText; this.onConfirm = onConfirm; } onOpen() { this.contentEl.addClass("task-list-kanban-confirm-modal"); this.contentEl.createEl("h2", { text: "Delete subtask?" }); this.contentEl.createEl("p", { text: `Are you sure you want to delete "${this.subtaskText}" and all its nested items? This action cannot be undone.` }); const actions = this.contentEl.createDiv({ cls: "confirm-modal-actions" }); const cancelButton = actions.createEl("button", { text: "Cancel" }); cancelButton.addEventListener("click", () => this.close()); const deleteButton = actions.createEl("button", { text: "Delete", cls: "mod-warning" }); deleteButton.addEventListener("click", () => { this.onConfirm(); this.close(); }); window.requestAnimationFrame(() => cancelButton.focus()); } onClose() { this.contentEl.empty(); } } function handleDeleteClick() { const text2 = node().kind === "task" ? node().content : node().rawLine.trim(); new ConfirmDeleteSubtaskModal(app(), text2, () => { void taskActions().deleteSourceBlockRow(task().id, node().rowIndex); }).open(); } function handleDragStart(e) { e.stopPropagation(); set(isDragging, true); subtaskDraggingStore.set({ taskId: task().id, draggedRowIndex: node().rowIndex, draggedIndentation: node().indentation }); if (e.dataTransfer) { e.dataTransfer.setData("text/plain", `${task().id}:${node().rowIndex}`); e.dataTransfer.dropEffect = "move"; } } function handleDragEnd(e) { e.stopPropagation(); set(isDragging, false); subtaskDraggingStore.set(null); } function handleDragOver(e) { if (!$subtaskDraggingStore() || $subtaskDraggingStore().taskId !== task().id) return; if ($subtaskDraggingStore().draggedRowIndex === node().rowIndex) return; e.preventDefault(); e.stopPropagation(); set(isDraggedOver, true); const rect = e.currentTarget.getBoundingClientRect(); const relativeY = e.clientY - rect.top; set(dropBefore, relativeY < rect.height / 2); set(dropAfter, !get(dropBefore)); const mouseX = e.clientX - rect.left; const hoveredRowDepth = depth(); const maxDepth = get(dropBefore) ? hoveredRowDepth : hoveredRowDepth + 1; set(dragIndicatorDepth, Math.min(maxDepth, Math.max(1, Math.floor((mouseX - 20) / 26)))); } function handleDragLeave(e) { e.stopPropagation(); set(isDraggedOver, false); set(dropBefore, false); set(dropAfter, false); } function handleDrop(e) { if (!$subtaskDraggingStore() || $subtaskDraggingStore().taskId !== task().id) return; e.preventDefault(); e.stopPropagation(); set(isDraggedOver, false); const draggedRowIndex = $subtaskDraggingStore().draggedRowIndex; subtaskDraggingStore.set(null); const position = get(dropBefore) ? "before" : "after"; void taskActions().moveSourceBlockRow(task().id, draggedRowIndex, node().rowIndex, position, get(dragIndicatorDepth)); set(dropBefore, false); set(dropAfter, false); } legacy_pre_effect(() => (deep_read_state(node()), getRawListItemText), () => { set(rawListItemText, node().kind === "raw" ? getRawListItemText(node()) : null); }); legacy_pre_effect( () => (get(rawListItemText), getSourceNodeText, deep_read_state(node())), () => { var _a5; set(editText, ((_a5 = get(rawListItemText)) != null ? _a5 : getSourceNodeText(node())).replaceAll("
", "\n")); } ); legacy_pre_effect(() => (get(rawListItemText), get(editText)), () => { var _a5; set(previewText, ((_a5 = get(rawListItemText)) != null ? _a5 : get(editText)).replaceAll("
", "\n")); }); legacy_pre_effect(() => $subtaskDraggingStore(), () => { if (!$subtaskDraggingStore()) { set(isDraggedOver, false); set(dropBefore, false); set(dropAfter, false); } }); legacy_pre_effect_reset(); var $$exports = { get app() { return app(); }, set app($$value) { app($$value); flushSync(); }, get task() { return task(); }, set task($$value) { task($$value); flushSync(); }, get taskActions() { return taskActions(); }, set taskActions($$value) { taskActions($$value); flushSync(); }, get node() { return node(); }, set node($$value) { node($$value); flushSync(); }, get isSelectionMode() { return isSelectionMode(); }, set isSelectionMode($$value) { isSelectionMode($$value); flushSync(); }, get depth() { return depth(); }, set depth($$value) { depth($$value); flushSync(); }, $set: update_legacy_props, $on: ($$event_name, $$event_cb) => add_legacy_event_listener($$props, $$event_name, $$event_cb) }; init(); var div = root_42(); let classes; let styles; var node_1 = child(div); TaskLineRow(node_1, { get depth() { return depth(); }, hasActions: true, children: ($$anchor2, $$slotProps) => { var fragment = comment(); var node_2 = first_child(fragment); { var consequent = ($$anchor3) => { var textarea = root7(); remove_textarea_child(textarea); action(textarea, ($$node) => focusAndAutosize == null ? void 0 : focusAndAutosize($$node)); effect(() => event("keydown", textarea, handleTextareaKeydown)); effect(() => event("blur", textarea, finishEditing)); template_effect(() => set_value(textarea, get(editText))); append($$anchor3, textarea); }; var alternate = ($$anchor3) => { var button = root_14(); var text_1 = child(button, true); reset(button); template_effect(() => set_text(text_1, get(previewText))); event("click", button, stopPropagation(startEditing)); event("keydown", button, stopPropagation(handlePreviewKeydown)); append($$anchor3, button); }; if_block(node_2, ($$render) => { if (get(isEditing)) $$render(consequent); else $$render(alternate, -1); }); } append($$anchor2, fragment); }, $$slots: { default: true, marker: ($$anchor2, $$slotProps) => { var fragment_1 = comment(); var node_3 = first_child(fragment_1); { var consequent_1 = ($$anchor3) => { TaskSourceStatusButton($$anchor3, { get task() { return task(); }, get taskActions() { return taskActions(); }, get node() { return node(); }, get isSelectionMode() { return isSelectionMode(); } }); }; var consequent_2 = ($$anchor3) => { var span = root_23(); append($$anchor3, span); }; if_block(node_3, ($$render) => { if (deep_read_state(node()), untrack(() => node().kind === "task")) $$render(consequent_1); else if (get(rawListItemText) !== null) $$render(consequent_2, 1); }); } append($$anchor2, fragment_1); }, actions: ($$anchor2, $$slotProps) => { var fragment_3 = comment(); var node_4 = first_child(fragment_3); { var consequent_3 = ($$anchor3) => { var button_1 = root_32(); var node_5 = child(button_1); Icon(node_5, { name: "lucide-x", size: 14, opacity: 0.6 }); reset(button_1); event("click", button_1, stopPropagation(handleDeleteClick)); append($$anchor3, button_1); }; if_block(node_4, ($$render) => { if (!isSelectionMode()) $$render(consequent_3); }); } append($$anchor2, fragment_3); } } }); var node_6 = sibling(node_1, 2); slot(node_6, $$props, "default", {}, null); reset(div); template_effect(() => { classes = set_class(div, 1, "source-row svelte-smkg1f", null, classes, { "is-ignored-task": node().kind === "task" && node().taskVisibility === "ignored", "is-raw-list-item": get(rawListItemText) !== null, "is-dragging": get(isDragging), "is-dragged-over": get(isDraggedOver), "drop-before": get(isDraggedOver) && get(dropBefore), "drop-after": get(isDraggedOver) && get(dropAfter) }); set_attribute2(div, "draggable", !get(isEditing)); styles = set_style(div, "", styles, { "--drag-indicator-depth": get(dragIndicatorDepth) }); }); event("dragstart", div, handleDragStart); event("dragend", div, handleDragEnd); event("dragover", div, handleDragOver); event("dragleave", div, handleDragLeave); event("drop", div, handleDrop); append($$anchor, div); var $$pop = pop($$exports); $$cleanup(); return $$pop; } // src/ui/components/TaskSourceRows.svelte function TaskSourceRows($$anchor, $$props) { if (new.target) return createClassComponent({ component: TaskSourceRows, ...$$anchor }); push($$props, false); let app = prop($$props, "app", 12); let task = prop($$props, "task", 12); let taskActions = prop($$props, "taskActions", 12); let nodes = prop($$props, "nodes", 28, () => []); let isSelectionMode = prop($$props, "isSelectionMode", 12, false); let depth = prop($$props, "depth", 12, 0); var $$exports = { get app() { return app(); }, set app($$value) { app($$value); flushSync(); }, get task() { return task(); }, set task($$value) { task($$value); flushSync(); }, get taskActions() { return taskActions(); }, set taskActions($$value) { taskActions($$value); flushSync(); }, get nodes() { return nodes(); }, set nodes($$value) { nodes($$value); flushSync(); }, get isSelectionMode() { return isSelectionMode(); }, set isSelectionMode($$value) { isSelectionMode($$value); flushSync(); }, get depth() { return depth(); }, set depth($$value) { depth($$value); flushSync(); }, $set: update_legacy_props, $on: ($$event_name, $$event_cb) => add_legacy_event_listener($$props, $$event_name, $$event_cb) }; var fragment = comment(); var node_1 = first_child(fragment); each(node_1, 1, nodes, (node) => node.rowIndex, ($$anchor2, node) => { TaskSourceRow($$anchor2, { get app() { return app(); }, get task() { return task(); }, get taskActions() { return taskActions(); }, get node() { return get(node); }, get isSelectionMode() { return isSelectionMode(); }, get depth() { return depth(); }, children: ($$anchor3, $$slotProps) => { var fragment_2 = comment(); var node_2 = first_child(fragment_2); { var consequent = ($$anchor4) => { var fragment_3 = comment(); var node_3 = first_child(fragment_3); { let $0 = derived_safe_equal(() => depth() + 1); TaskSourceRows(node_3, { get app() { return app(); }, get task() { return task(); }, get taskActions() { return taskActions(); }, get nodes() { return get(node), untrack(() => get(node).sourceChildren); }, get isSelectionMode() { return isSelectionMode(); }, get depth() { return get($0); } }); } append($$anchor4, fragment_3); }; if_block(node_2, ($$render) => { if (get(node), untrack(() => get(node).sourceChildren.length > 0)) $$render(consequent); }); } append($$anchor3, fragment_2); }, $$slots: { default: true } }); }); append($$anchor, fragment); return pop($$exports); } // src/ui/components/task_menu.svelte var import_obsidian5 = require("obsidian"); function Task_menu($$anchor, $$props) { if (new.target) return createClassComponent({ component: Task_menu, ...$$anchor }); push($$props, false); const $columnTagTableStore = () => store_get(columnTagTableStore(), "$columnTagTableStore", $$stores); const [$$stores, $$cleanup] = setup_stores(); let task = prop($$props, "task", 12); let taskActions = prop($$props, "taskActions", 12); let columnTagTableStore = prop($$props, "columnTagTableStore", 12); let doneColumnName = prop($$props, "doneColumnName", 12, void 0); function showMenu(e) { const menu = new import_obsidian5.Menu(); const target = e.target; if (!target) { return; } const boundingRect = target.getBoundingClientRect(); const y = boundingRect.top + boundingRect.height / 2; const x = boundingRect.left + boundingRect.width / 2; menu.addItem((i) => { i.setTitle(`Go to file`).onClick(() => taskActions().viewFile(task().id)); }); menu.addSeparator(); for (const [tag2, label] of Object.entries($columnTagTableStore())) { menu.addItem((i) => { i.setTitle(`Move to ${label}`).onClick(() => taskActions().changeColumn(task().id, tag2)); if (task().column === tag2) { i.setDisabled(true); } }); } menu.addItem((i) => { i.setTitle(`Move to ${resolveDefaultColumnName("done", void 0, doneColumnName())}`).onClick(() => taskActions().markDone(task().id)); if (task().done) { i.setDisabled(true); } }); menu.addSeparator(); menu.addItem((i) => { i.setTitle(`Duplicate task`).onClick(() => taskActions().duplicateTask(task().id)); }); menu.addItem((i) => { if (task().isCancelled) { i.setTitle(`Restore task`).onClick(() => taskActions().restoreTasks([task().id])); } else { i.setTitle(`Cancel task`).onClick(() => taskActions().cancelTasks([task().id])); } }); menu.addItem((i) => { i.setTitle(`Archive task`).onClick(() => taskActions().archiveTasks([task().id])); }); menu.addItem((i) => { i.setTitle(`Delete task`).onClick(() => taskActions().deleteTask(task().id)); }); menu.showAtPosition({ x, y }); } var $$exports = { get task() { return task(); }, set task($$value) { task($$value); flushSync(); }, get taskActions() { return taskActions(); }, set taskActions($$value) { taskActions($$value); flushSync(); }, get columnTagTableStore() { return columnTagTableStore(); }, set columnTagTableStore($$value) { columnTagTableStore($$value); flushSync(); }, get doneColumnName() { return doneColumnName(); }, set doneColumnName($$value) { doneColumnName($$value); flushSync(); }, $set: update_legacy_props, $on: ($$event_name, $$event_cb) => add_legacy_event_listener($$props, $$event_name, $$event_cb) }; init(); Icon_button($$anchor, { icon: "lucide-more-vertical", $$events: { click: showMenu } }); var $$pop = pop($$exports); $$cleanup(); return $$pop; } // src/parsing/properties/none_schema.ts var NoneSchema = class { constructor() { this.id = "none" /* None */; this.label = "None"; } parseProperties(rawLine) { return createPropertyMapWithStatus(rawLine); } knownKeys() { return [ { key: UNIVERSAL_STATUS_PROPERTY_KEY, label: "Status", type: "text" } ]; } }; // src/parsing/properties/dataview_schema.ts var DATAVIEW_KEY_PATTERN = "[a-zA-Z0-9_-]+"; var ENCLOSED_DATAVIEW_REGEX = /\[\s*([a-zA-Z0-9_-]+)\s*::\s*([^\]]*?)\s*\]|\(\s*([a-zA-Z0-9_-]+)\s*::\s*([^\)]*?)\s*\)/g; var BARE_DATAVIEW_MARKER_REGEX = new RegExp(`(^|\\s)(${DATAVIEW_KEY_PATTERN})\\s*::\\s*`, "g"); function parseDataviewValue(value) { const trimmed = value.trim(); const parsedDate = parseIsoDate(trimmed); if (parsedDate) { return parsedDate; } const parsedNumber = parseNumber(trimmed); if (parsedNumber !== null) { return parsedNumber; } return trimmed; } function isInsideRange(index2, ranges) { return ranges.some((range) => index2 >= range.start && index2 < range.end); } function parseEnclosedFields(rawLine) { return [...rawLine.matchAll(ENCLOSED_DATAVIEW_REGEX)].flatMap((match) => { var _a5, _b3, _c2; const index2 = (_a5 = match.index) != null ? _a5 : Number.MAX_SAFE_INTEGER; const key2 = (_b3 = match[1]) != null ? _b3 : match[3]; const rawValueText = (_c2 = match[2]) != null ? _c2 : match[4]; if (!key2 || rawValueText === void 0) return []; return [{ index: index2, endIndex: index2 + match[0].length, key: key2, rawValue: match[0], rawValueText }]; }); } function parseBareFields(rawLine, enclosedFields) { const enclosedRanges = enclosedFields.map((field) => ({ start: field.index, end: field.endIndex })); const markers = [...rawLine.matchAll(BARE_DATAVIEW_MARKER_REGEX)].map((match) => { var _a5, _b3, _c2; const prefix = (_a5 = match[1]) != null ? _a5 : ""; const index2 = ((_b3 = match.index) != null ? _b3 : 0) + prefix.length; return { index: index2, valueStart: ((_c2 = match.index) != null ? _c2 : 0) + match[0].length, key: match[2] }; }).filter((marker) => marker.key && !isInsideRange(marker.index, enclosedRanges)); return markers.flatMap((marker, markerIndex) => { var _a5, _b3, _c2; if (!marker.key) return []; const nextMarkerIndex = (_b3 = (_a5 = markers[markerIndex + 1]) == null ? void 0 : _a5.index) != null ? _b3 : Number.MAX_SAFE_INTEGER; const nextEnclosedIndex = (_c2 = enclosedFields.map((field) => field.index).filter((index2) => index2 > marker.valueStart).sort((a, b) => a - b)[0]) != null ? _c2 : Number.MAX_SAFE_INTEGER; const endIndex = Math.min(nextMarkerIndex, nextEnclosedIndex, rawLine.length); const rawValueText = rawLine.slice(marker.valueStart, endIndex).trim(); const rawValue = rawLine.slice(marker.index, endIndex).trimEnd(); if (!rawValueText) return []; return [{ index: marker.index, endIndex: marker.index + rawValue.length, key: marker.key, rawValue, rawValueText }]; }); } var DataviewSchema = class { constructor() { this.id = "dataview" /* Dataview */; this.label = "Dataview"; } parseProperties(rawLine) { const properties = createPropertyMapWithStatus(rawLine); const enclosedFields = parseEnclosedFields(rawLine); const fields = [ ...enclosedFields, ...parseBareFields(rawLine, enclosedFields) ].sort((a, b) => a.index - b.index); for (const field of fields) { if (!properties.has(field.key)) { properties.set(field.key, { key: field.key, rawValue: field.rawValue, value: parseDataviewValue(field.rawValueText), startIndex: field.index, endIndex: field.endIndex }); } } return properties; } knownKeys() { return [ { key: UNIVERSAL_STATUS_PROPERTY_KEY, label: "Status", type: "text" }, { key: "due", label: "Due", type: "date" }, { key: "scheduled", label: "Scheduled", type: "date" }, { key: "start", label: "Start", type: "date" }, { key: "done", label: "Done", type: "date", aliases: getPropertyAliases("done") }, { key: "completion", label: "Completion", type: "date" }, { key: "created", label: "Created", type: "date" }, { key: "priority", label: "Priority", type: "text" }, { key: "repeat", label: "Repeat", type: "text", aliases: getPropertyAliases("repeat") } ]; } }; // src/parsing/properties/comparators.ts var ColumnOrderMode = /* @__PURE__ */ ((ColumnOrderMode2) => { ColumnOrderMode2["FileOrder"] = "file"; ColumnOrderMode2["TaskName"] = "task-name"; ColumnOrderMode2["Property"] = "property"; ColumnOrderMode2["Manual"] = "manual"; return ColumnOrderMode2; })(ColumnOrderMode || {}); function compareValues(a, b) { if (a instanceof Date && b instanceof Date) { return a.getTime() - b.getTime(); } if (typeof a === "number" && typeof b === "number") { return a - b; } return String(a).localeCompare(String(b)); } function compareByProperty(a, b, key2, direction, options2 = {}) { var _a5, _b3, _c2, _d, _e, _f; const aValue = (_b3 = (_a5 = a.properties.get(key2)) == null ? void 0 : _a5.value) != null ? _b3 : null; const bValue = (_d = (_c2 = b.properties.get(key2)) == null ? void 0 : _c2.value) != null ? _d : null; if (aValue === null && bValue === null) return 0; if (aValue === null) return direction === "desc" ? -1 : 1; if (bValue === null) return direction === "desc" ? 1 : -1; if (key2 === UNIVERSAL_STATUS_PROPERTY_KEY) { return compareStatusMarkerValues( aValue, bValue, (_e = options2.statusMarkerOrder) != null ? _e : "", (_f = options2.doneStatusMarkers) != null ? _f : "", direction ); } const result = compareValues(aValue, bValue); return direction === "desc" ? -result : result; } function compareStatusMarkerValues(a, b, statusMarkerOrder, doneStatusMarkers = "", direction = "asc") { const aMarker = String(a); const bMarker = String(b); const doneRankByMarker = createMarkerRankMap(doneStatusMarkers); const aDoneRank = doneRankByMarker.get(aMarker); const bDoneRank = doneRankByMarker.get(bMarker); if (aDoneRank !== void 0 && bDoneRank !== void 0) { return aDoneRank - bDoneRank; } if (aDoneRank !== void 0) return 1; if (bDoneRank !== void 0) return -1; const rankByMarker = createStatusMarkerRankMap(statusMarkerOrder); const aRank = rankByMarker.get(aMarker); const bRank = rankByMarker.get(bMarker); let result; if (aRank !== void 0 && bRank !== void 0) { result = aRank - bRank; } else if (aRank !== void 0) { result = -1; } else if (bRank !== void 0) { result = 1; } else { result = aMarker.localeCompare(bMarker); } return direction === "desc" ? -result : result; } function createStatusMarkerRankMap(statusMarkerOrder) { return createMarkerRankMap(getOrderedStatusMarkers(statusMarkerOrder).join("")); } function getOrderedStatusMarkers(statusMarkerOrder) { const orderedMarkers = Array.from(statusMarkerOrder); if (!orderedMarkers.includes(" ")) { orderedMarkers.unshift(" "); } return orderedMarkers; } function createMarkerRankMap(markers) { const rankByMarker = /* @__PURE__ */ new Map(); for (const marker of Array.from(markers)) { if (!rankByMarker.has(marker)) { rankByMarker.set(marker, rankByMarker.size); } } return rankByMarker; } // src/parsing/properties/write.ts var TASKS_WRITERS = { due: "\u{1F4C5}", scheduled: "\u23F3", start: "\u{1F6EB}", done: "\u2705" }; var DATAVIEW_WRITERS = { due: "due", scheduled: "scheduled", start: "start", completion: "completion" }; var DATAVIEW_PRIORITY_KEY = "priority"; var TRAILING_BLOCK_LINK_REGEX = /(\s\^[a-zA-Z0-9-]+)$/; var TasksPluginWriteAdapter = class { constructor() { this.schema = "tasks" /* TasksPlugin */; this.propertySchema = new TasksPluginSchema(); } addCompletionDateIfMissing(rawLine, date) { if (this.propertySchema.parseProperties(rawLine).has("done")) { return rawLine; } return appendBeforeBlockLink(rawLine, `${TASKS_WRITERS.done} ${date}`); } upsertDate(rawLine, key2, date) { var _a5; const marker = (_a5 = markerForExistingTasksProperty(rawLine, key2)) != null ? _a5 : TASKS_WRITERS[key2]; const property = this.propertySchema.parseProperties(rawLine).get(key2); return upsertProperty(rawLine, property, `${marker} ${date}`); } removeDate(rawLine, key2) { const propertyKey = key2 === "completion" ? "done" : key2; const property = this.propertySchema.parseProperties(rawLine).get(propertyKey); return property ? removeProperty(rawLine, property) : rawLine; } upsertPriority(rawLine, priority) { const option = getTasksPriorityOption(priority); if (!option) { return rawLine; } const property = this.propertySchema.parseProperties(rawLine).get("priority"); return upsertProperty(rawLine, property, option.emoji); } removePriority(rawLine) { const property = this.propertySchema.parseProperties(rawLine).get("priority"); return property ? removeProperty(rawLine, property) : rawLine; } }; var DataviewWriteAdapter = class { constructor() { this.schema = "dataview" /* Dataview */; this.propertySchema = new DataviewSchema(); } addCompletionDateIfMissing(rawLine, date) { if (hasDataviewCompletionProperty(rawLine, this.propertySchema)) { return rawLine; } return appendBeforeBlockLink(rawLine, formatDataviewField("completion", date)); } upsertDate(rawLine, key2, date) { const property = this.propertySchema.parseProperties(rawLine).get(key2); return upsertProperty(rawLine, property, formatDataviewField(DATAVIEW_WRITERS[key2], date)); } removeDate(rawLine, key2) { const property = this.propertySchema.parseProperties(rawLine).get(key2); return property ? removeProperty(rawLine, property) : rawLine; } upsertPriority(rawLine, priority) { const normalizedPriority = priority.trim(); if (!normalizedPriority) { return rawLine; } const property = this.propertySchema.parseProperties(rawLine).get(DATAVIEW_PRIORITY_KEY); return upsertProperty(rawLine, property, formatDataviewField(DATAVIEW_PRIORITY_KEY, normalizedPriority)); } removePriority(rawLine) { const property = this.propertySchema.parseProperties(rawLine).get(DATAVIEW_PRIORITY_KEY); return property ? removeProperty(rawLine, property) : rawLine; } }; var WRITE_ADAPTERS = { ["tasks" /* TasksPlugin */]: new TasksPluginWriteAdapter(), ["dataview" /* Dataview */]: new DataviewWriteAdapter() }; function getPropertyWriteAdapter(schema) { if (schema === "tasks" /* TasksPlugin */ || schema === "dataview" /* Dataview */) { return WRITE_ADAPTERS[schema]; } return null; } function formatLocalDate(date = /* @__PURE__ */ new Date()) { const year = date.getFullYear(); const month = `${date.getMonth() + 1}`.padStart(2, "0"); const day = `${date.getDate()}`.padStart(2, "0"); return `${year}-${month}-${day}`; } function formatDataviewField(key2, date) { return `[${key2}:: ${date}]`; } function upsertProperty(rawLine, property, replacement) { if (!property) { return appendBeforeBlockLink(rawLine, replacement); } return replaceProperty(rawLine, property, replacement); } function replaceProperty(rawLine, property, replacement) { return `${rawLine.slice(0, property.startIndex)}${replacement}${rawLine.slice(property.endIndex)}`; } function removeProperty(rawLine, property) { const next2 = `${rawLine.slice(0, property.startIndex)}${rawLine.slice(property.endIndex)}`; return normalizeWhitespaceAroundIndex(next2, property.startIndex); } function appendBeforeBlockLink(rawLine, metadata) { const match = rawLine.match(TRAILING_BLOCK_LINK_REGEX); if (!(match == null ? void 0 : match.index)) { return `${rawLine.trimEnd()} ${metadata}`; } const body = rawLine.slice(0, match.index).trimEnd(); return `${body} ${metadata}${match[0]}`; } function normalizeWhitespaceAroundIndex(rawLine, index2) { var _a5, _b3; let start = Math.max(0, index2); while (start > 0 && /[ \t]/.test((_a5 = rawLine[start - 1]) != null ? _a5 : "")) { start -= 1; } let end = Math.min(rawLine.length, index2); while (end < rawLine.length && /[ \t]/.test((_b3 = rawLine[end]) != null ? _b3 : "")) { end += 1; } const before = rawLine.slice(0, start); const after = rawLine.slice(end); const separator = before && after ? " " : ""; return `${before}${separator}${after}`.trimEnd(); } function markerForExistingTasksProperty(rawLine, key2) { const property = new TasksPluginSchema().parseProperties(rawLine).get(key2); if (!property) return void 0; const marker = Array.from(property.rawValue.trim())[0]; return marker; } function hasDataviewCompletionProperty(rawLine, schema) { const properties = schema.parseProperties(rawLine); return properties.has("completion") || properties.has("done"); } // src/parsing/properties/index.ts var SCHEMA_IMPLS = { ["none" /* None */]: new NoneSchema(), ["tasks" /* TasksPlugin */]: new TasksPluginSchema(), ["dataview" /* Dataview */]: new DataviewSchema() }; function getSchemaImpl(option) { var _a5; return (_a5 = SCHEMA_IMPLS[option]) != null ? _a5 : SCHEMA_IMPLS["none" /* None */]; } // src/ui/components/DateInputFields.svelte var root8 = from_html(``); var root_15 = from_html(``); var root_24 = from_html(`
`); var $$css8 = { hash: "svelte-4hxhuo", code: ".date-input-fields.svelte-4hxhuo {display:flex;flex-wrap:wrap;align-items:end;gap:var(--size-2-2);width:100%;}.date-input-field.svelte-4hxhuo {display:flex;flex-direction:column;gap:2px;min-width:116px;flex:1 1 116px;color:var(--text-muted);font-size:var(--font-smallest);text-transform:uppercase;}.date-input-field.svelte-4hxhuo input:where(.svelte-4hxhuo) {width:100%;min-height:28px;font-size:var(--font-ui-smaller);text-transform:none;}.done-date-editing.svelte-4hxhuo {display:inline-flex;align-items:center;gap:var(--size-2-1);min-height:28px;padding:1px var(--size-2-2);border:var(--border-width) solid var(--background-modifier-border);border-radius:var(--radius-s);background:var(--background-secondary-alt);color:var(--text-muted);box-shadow:none;line-height:var(--line-height-tight);}.done-date-editing.svelte-4hxhuo:hover {border-color:var(--text-muted);color:var(--text-normal);background:var(--background-secondary);box-shadow:none;}" }; function DateInputFields($$anchor, $$props) { if (new.target) return createClassComponent({ component: DateInputFields, ...$$anchor }); push($$props, false); append_styles($$anchor, $$css8); let values = prop($$props, "values", 12); let onDateChange = prop($$props, "onDateChange", 12); let showDoneButton = prop($$props, "showDoneButton", 12, false); let onDone = prop($$props, "onDone", 12, () => { }); const editableDateFields = [ { key: "due", label: "Due" }, { key: "scheduled", label: "Scheduled" }, { key: "start", label: "Start" } ]; var $$exports = { get values() { return values(); }, set values($$value) { values($$value); flushSync(); }, get onDateChange() { return onDateChange(); }, set onDateChange($$value) { onDateChange($$value); flushSync(); }, get showDoneButton() { return showDoneButton(); }, set showDoneButton($$value) { showDoneButton($$value); flushSync(); }, get onDone() { return onDone(); }, set onDone($$value) { onDone($$value); flushSync(); }, $set: update_legacy_props, $on: ($$event_name, $$event_cb) => add_legacy_event_listener($$props, $$event_name, $$event_cb) }; init(); var div = root_24(); var node = child(div); each(node, 1, () => editableDateFields, (field) => field.key, ($$anchor2, field) => { var label = root8(); var span = child(label); var text2 = child(span, true); reset(span); var input = sibling(span, 2); remove_input_defaults(input); reset(label); template_effect(() => { set_text(text2, (get(field), untrack(() => get(field).label))); set_value(input, (deep_read_state(values()), get(field), untrack(() => values()[get(field).key]))); }); event("mousedown", input, stopPropagation(function($$arg) { bubble_event.call(this, $$props, $$arg); })); event("mouseup", input, stopPropagation(function($$arg) { bubble_event.call(this, $$props, $$arg); })); event("click", input, stopPropagation(function($$arg) { bubble_event.call(this, $$props, $$arg); })); event("change", input, (event2) => onDateChange()(get(field).key, event2.currentTarget.value)); event("keydown", input, stopPropagation(function($$arg) { bubble_event.call(this, $$props, $$arg); })); append($$anchor2, label); }); var node_1 = sibling(node, 2); { var consequent = ($$anchor2) => { var button = root_15(); event("mousedown", button, stopPropagation(function($$arg) { bubble_event.call(this, $$props, $$arg); })); event("mouseup", button, stopPropagation(function($$arg) { bubble_event.call(this, $$props, $$arg); })); event("click", button, function(...$$args) { var _a5; (_a5 = onDone()) == null ? void 0 : _a5.apply(this, $$args); }); event("keydown", button, stopPropagation(function($$arg) { bubble_event.call(this, $$props, $$arg); })); append($$anchor2, button); }; if_block(node_1, ($$render) => { if (showDoneButton()) $$render(consequent); }); } reset(div); append($$anchor, div); return pop($$exports); } // src/ui/components/TaskDateFields.svelte var root9 = from_html(`
`); var root_16 = from_html(`
`); var $$css9 = { hash: "svelte-1ml44qr", code: ".task-date-fields.svelte-1ml44qr {display:contents;font-size:var(--font-ui-smaller);}.add-date-button.svelte-1ml44qr {display:inline-flex;align-items:center;gap:var(--size-2-1);height:auto;min-height:0;padding:0 var(--size-2-2);margin:0;border:none;border-radius:var(--radius-s);background:transparent;color:var(--text-accent);box-shadow:none;font-size:inherit;font-weight:var(--font-medium);line-height:inherit;}.add-date-button.svelte-1ml44qr span:where(.svelte-1ml44qr) {font-size:inherit;line-height:1;}.add-date-button.svelte-1ml44qr:hover {background:transparent;color:var(--text-accent-hover);box-shadow:none;}.edit-mode.svelte-1ml44qr {display:flex;width:100%;padding-top:var(--size-2-1);border-top:var(--border-width) solid var(--background-modifier-border);}" }; function TaskDateFields($$anchor, $$props) { if (new.target) return createClassComponent({ component: TaskDateFields, ...$$anchor }); push($$props, false); append_styles($$anchor, $$css9); const dateEditingEnabled = mutable_source(); const dateValues = mutable_source(); const showDateInputs = mutable_source(); const showReadChips = mutable_source(); let task = prop($$props, "task", 12); let taskActions = prop($$props, "taskActions", 12); let propertySchemaOption = prop($$props, "propertySchemaOption", 28, () => "none" /* None */); let isTaskEditing = prop($$props, "isTaskEditing", 12, false); let isEditingDates = prop($$props, "isEditingDates", 12, false); const editableDateFields = [ { key: "due", label: "Due", shortLabel: "Due" }, { key: "scheduled", label: "Scheduled", shortLabel: "Sched" }, { key: "start", label: "Start", shortLabel: "Start" } ]; let isDateEditing = mutable_source(false); let draftDateValues = mutable_source({ due: "", scheduled: "", start: "" }); let wasShowingDateInputs = mutable_source(false); function getDateValue(key2) { const property = getPropertyByKey(task().properties, key2); return (property == null ? void 0 : property.value) instanceof Date ? formatLocalDate(property.value) : ""; } function openDateEditor() { set(draftDateValues, { ...get(dateValues) }); set(isDateEditing, true); } function handleDraftDateChange(key2, value) { set(draftDateValues, { ...get(draftDateValues), [key2]: value }); } async function saveDraftDates() { var _a5; for (const field of editableDateFields) { const key2 = field.key; const nextValue = (_a5 = get(draftDateValues)[key2]) != null ? _a5 : ""; if (nextValue === get(dateValues)[key2]) { continue; } if (nextValue) { await taskActions().setDateProperty(task().id, key2, nextValue); } else { await taskActions().clearDateProperty(task().id, key2); } } set(isDateEditing, false); } legacy_pre_effect( () => (getPropertyWriteAdapter, deep_read_state(propertySchemaOption())), () => { set(dateEditingEnabled, getPropertyWriteAdapter(propertySchemaOption()) !== null); } ); legacy_pre_effect(() => { }, () => { set(dateValues, Object.fromEntries(editableDateFields.map((field) => [field.key, getDateValue(field.key)]))); }); legacy_pre_effect( () => (get(dateEditingEnabled), deep_read_state(isTaskEditing()), get(isDateEditing)), () => { set(showDateInputs, get(dateEditingEnabled) && (isTaskEditing() || get(isDateEditing))); } ); legacy_pre_effect(() => (get(dateEditingEnabled), get(showDateInputs)), () => { set(showReadChips, get(dateEditingEnabled) && !get(showDateInputs)); }); legacy_pre_effect(() => get(showDateInputs), () => { isEditingDates(get(showDateInputs)); }); legacy_pre_effect( () => (get(showDateInputs), get(wasShowingDateInputs), get(dateValues)), () => { if (get(showDateInputs) && !get(wasShowingDateInputs)) { set(draftDateValues, { ...get(dateValues) }); } set(wasShowingDateInputs, get(showDateInputs)); } ); legacy_pre_effect_reset(); var $$exports = { get task() { return task(); }, set task($$value) { task($$value); flushSync(); }, get taskActions() { return taskActions(); }, set taskActions($$value) { taskActions($$value); flushSync(); }, get propertySchemaOption() { return propertySchemaOption(); }, set propertySchemaOption($$value) { propertySchemaOption($$value); flushSync(); }, get isTaskEditing() { return isTaskEditing(); }, set isTaskEditing($$value) { isTaskEditing($$value); flushSync(); }, get isEditingDates() { return isEditingDates(); }, set isEditingDates($$value) { isEditingDates($$value); flushSync(); }, $set: update_legacy_props, $on: ($$event_name, $$event_cb) => add_legacy_event_listener($$props, $$event_name, $$event_cb) }; init(); var fragment = comment(); var node = first_child(fragment); { var consequent = ($$anchor2) => { var div = root9(); var button = child(div); reset(div); event("mousedown", button, stopPropagation(function($$arg) { bubble_event.call(this, $$props, $$arg); })); event("mouseup", button, stopPropagation(function($$arg) { bubble_event.call(this, $$props, $$arg); })); event("click", button, openDateEditor); event("keydown", button, stopPropagation(function($$arg) { bubble_event.call(this, $$props, $$arg); })); append($$anchor2, div); }; var consequent_1 = ($$anchor2) => { var div_1 = root_16(); var node_1 = child(div_1); DateInputFields(node_1, { get values() { return get(draftDateValues); }, onDateChange: handleDraftDateChange, showDoneButton: true, onDone: saveDraftDates }); reset(div_1); append($$anchor2, div_1); }; if_block(node, ($$render) => { if (get(showReadChips)) $$render(consequent); else if (get(showDateInputs)) $$render(consequent_1, 1); }); } append($$anchor, fragment); return pop($$exports); } // src/ui/components/task.svelte var import_obsidian6 = require("obsidian"); // node_modules/zod/lib/index.mjs var util; (function(util2) { util2.assertEqual = (val) => val; function assertIs(_arg) { } util2.assertIs = assertIs; function assertNever(_x) { throw new Error(); } util2.assertNever = assertNever; util2.arrayToEnum = (items) => { const obj = {}; for (const item of items) { obj[item] = item; } return obj; }; util2.getValidEnumValues = (obj) => { const validKeys = util2.objectKeys(obj).filter((k) => typeof obj[obj[k]] !== "number"); const filtered = {}; for (const k of validKeys) { filtered[k] = obj[k]; } return util2.objectValues(filtered); }; util2.objectValues = (obj) => { return util2.objectKeys(obj).map(function(e) { return obj[e]; }); }; util2.objectKeys = typeof Object.keys === "function" ? (obj) => Object.keys(obj) : (object) => { const keys = []; for (const key2 in object) { if (Object.prototype.hasOwnProperty.call(object, key2)) { keys.push(key2); } } return keys; }; util2.find = (arr, checker) => { for (const item of arr) { if (checker(item)) return item; } return void 0; }; util2.isInteger = typeof Number.isInteger === "function" ? (val) => Number.isInteger(val) : (val) => typeof val === "number" && isFinite(val) && Math.floor(val) === val; function joinValues(array, separator = " | ") { return array.map((val) => typeof val === "string" ? `'${val}'` : val).join(separator); } util2.joinValues = joinValues; util2.jsonStringifyReplacer = (_, value) => { if (typeof value === "bigint") { return value.toString(); } return value; }; })(util || (util = {})); var objectUtil; (function(objectUtil2) { objectUtil2.mergeShapes = (first, second) => { return { ...first, ...second // second overwrites first }; }; })(objectUtil || (objectUtil = {})); var ZodParsedType = util.arrayToEnum([ "string", "nan", "number", "integer", "float", "boolean", "date", "bigint", "symbol", "function", "undefined", "null", "array", "object", "unknown", "promise", "void", "never", "map", "set" ]); var getParsedType = (data) => { const t = typeof data; switch (t) { case "undefined": return ZodParsedType.undefined; case "string": return ZodParsedType.string; case "number": return isNaN(data) ? ZodParsedType.nan : ZodParsedType.number; case "boolean": return ZodParsedType.boolean; case "function": return ZodParsedType.function; case "bigint": return ZodParsedType.bigint; case "symbol": return ZodParsedType.symbol; case "object": if (Array.isArray(data)) { return ZodParsedType.array; } if (data === null) { return ZodParsedType.null; } if (data.then && typeof data.then === "function" && data.catch && typeof data.catch === "function") { return ZodParsedType.promise; } if (typeof Map !== "undefined" && data instanceof Map) { return ZodParsedType.map; } if (typeof Set !== "undefined" && data instanceof Set) { return ZodParsedType.set; } if (typeof Date !== "undefined" && data instanceof Date) { return ZodParsedType.date; } return ZodParsedType.object; default: return ZodParsedType.unknown; } }; var ZodIssueCode = util.arrayToEnum([ "invalid_type", "invalid_literal", "custom", "invalid_union", "invalid_union_discriminator", "invalid_enum_value", "unrecognized_keys", "invalid_arguments", "invalid_return_type", "invalid_date", "invalid_string", "too_small", "too_big", "invalid_intersection_types", "not_multiple_of", "not_finite" ]); var quotelessJson = (obj) => { const json = JSON.stringify(obj, null, 2); return json.replace(/"([^"]+)":/g, "$1:"); }; var ZodError = class _ZodError extends Error { constructor(issues) { super(); this.issues = []; this.addIssue = (sub) => { this.issues = [...this.issues, sub]; }; this.addIssues = (subs = []) => { this.issues = [...this.issues, ...subs]; }; const actualProto = new.target.prototype; if (Object.setPrototypeOf) { Object.setPrototypeOf(this, actualProto); } else { this.__proto__ = actualProto; } this.name = "ZodError"; this.issues = issues; } get errors() { return this.issues; } format(_mapper) { const mapper = _mapper || function(issue) { return issue.message; }; const fieldErrors = { _errors: [] }; const processError = (error) => { for (const issue of error.issues) { if (issue.code === "invalid_union") { issue.unionErrors.map(processError); } else if (issue.code === "invalid_return_type") { processError(issue.returnTypeError); } else if (issue.code === "invalid_arguments") { processError(issue.argumentsError); } else if (issue.path.length === 0) { fieldErrors._errors.push(mapper(issue)); } else { let curr = fieldErrors; let i = 0; while (i < issue.path.length) { const el = issue.path[i]; const terminal = i === issue.path.length - 1; if (!terminal) { curr[el] = curr[el] || { _errors: [] }; } else { curr[el] = curr[el] || { _errors: [] }; curr[el]._errors.push(mapper(issue)); } curr = curr[el]; i++; } } } }; processError(this); return fieldErrors; } static assert(value) { if (!(value instanceof _ZodError)) { throw new Error(`Not a ZodError: ${value}`); } } toString() { return this.message; } get message() { return JSON.stringify(this.issues, util.jsonStringifyReplacer, 2); } get isEmpty() { return this.issues.length === 0; } flatten(mapper = (issue) => issue.message) { const fieldErrors = {}; const formErrors = []; for (const sub of this.issues) { if (sub.path.length > 0) { fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || []; fieldErrors[sub.path[0]].push(mapper(sub)); } else { formErrors.push(mapper(sub)); } } return { formErrors, fieldErrors }; } get formErrors() { return this.flatten(); } }; ZodError.create = (issues) => { const error = new ZodError(issues); return error; }; var errorMap = (issue, _ctx) => { let message; switch (issue.code) { case ZodIssueCode.invalid_type: if (issue.received === ZodParsedType.undefined) { message = "Required"; } else { message = `Expected ${issue.expected}, received ${issue.received}`; } break; case ZodIssueCode.invalid_literal: message = `Invalid literal value, expected ${JSON.stringify(issue.expected, util.jsonStringifyReplacer)}`; break; case ZodIssueCode.unrecognized_keys: message = `Unrecognized key(s) in object: ${util.joinValues(issue.keys, ", ")}`; break; case ZodIssueCode.invalid_union: message = `Invalid input`; break; case ZodIssueCode.invalid_union_discriminator: message = `Invalid discriminator value. Expected ${util.joinValues(issue.options)}`; break; case ZodIssueCode.invalid_enum_value: message = `Invalid enum value. Expected ${util.joinValues(issue.options)}, received '${issue.received}'`; break; case ZodIssueCode.invalid_arguments: message = `Invalid function arguments`; break; case ZodIssueCode.invalid_return_type: message = `Invalid function return type`; break; case ZodIssueCode.invalid_date: message = `Invalid date`; break; case ZodIssueCode.invalid_string: if (typeof issue.validation === "object") { if ("includes" in issue.validation) { message = `Invalid input: must include "${issue.validation.includes}"`; if (typeof issue.validation.position === "number") { message = `${message} at one or more positions greater than or equal to ${issue.validation.position}`; } } else if ("startsWith" in issue.validation) { message = `Invalid input: must start with "${issue.validation.startsWith}"`; } else if ("endsWith" in issue.validation) { message = `Invalid input: must end with "${issue.validation.endsWith}"`; } else { util.assertNever(issue.validation); } } else if (issue.validation !== "regex") { message = `Invalid ${issue.validation}`; } else { message = "Invalid"; } break; case ZodIssueCode.too_small: if (issue.type === "array") message = `Array must contain ${issue.exact ? "exactly" : issue.inclusive ? `at least` : `more than`} ${issue.minimum} element(s)`; else if (issue.type === "string") message = `String must contain ${issue.exact ? "exactly" : issue.inclusive ? `at least` : `over`} ${issue.minimum} character(s)`; else if (issue.type === "number") message = `Number must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${issue.minimum}`; else if (issue.type === "date") message = `Date must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${new Date(Number(issue.minimum))}`; else message = "Invalid input"; break; case ZodIssueCode.too_big: if (issue.type === "array") message = `Array must contain ${issue.exact ? `exactly` : issue.inclusive ? `at most` : `less than`} ${issue.maximum} element(s)`; else if (issue.type === "string") message = `String must contain ${issue.exact ? `exactly` : issue.inclusive ? `at most` : `under`} ${issue.maximum} character(s)`; else if (issue.type === "number") message = `Number must be ${issue.exact ? `exactly` : issue.inclusive ? `less than or equal to` : `less than`} ${issue.maximum}`; else if (issue.type === "bigint") message = `BigInt must be ${issue.exact ? `exactly` : issue.inclusive ? `less than or equal to` : `less than`} ${issue.maximum}`; else if (issue.type === "date") message = `Date must be ${issue.exact ? `exactly` : issue.inclusive ? `smaller than or equal to` : `smaller than`} ${new Date(Number(issue.maximum))}`; else message = "Invalid input"; break; case ZodIssueCode.custom: message = `Invalid input`; break; case ZodIssueCode.invalid_intersection_types: message = `Intersection results could not be merged`; break; case ZodIssueCode.not_multiple_of: message = `Number must be a multiple of ${issue.multipleOf}`; break; case ZodIssueCode.not_finite: message = "Number must be finite"; break; default: message = _ctx.defaultError; util.assertNever(issue); } return { message }; }; var overrideErrorMap = errorMap; function setErrorMap(map) { overrideErrorMap = map; } function getErrorMap() { return overrideErrorMap; } var makeIssue = (params) => { const { data, path, errorMaps, issueData } = params; const fullPath = [...path, ...issueData.path || []]; const fullIssue = { ...issueData, path: fullPath }; if (issueData.message !== void 0) { return { ...issueData, path: fullPath, message: issueData.message }; } let errorMessage = ""; const maps = errorMaps.filter((m) => !!m).slice().reverse(); for (const map of maps) { errorMessage = map(fullIssue, { data, defaultError: errorMessage }).message; } return { ...issueData, path: fullPath, message: errorMessage }; }; var EMPTY_PATH = []; function addIssueToContext(ctx, issueData) { const overrideMap = getErrorMap(); const issue = makeIssue({ issueData, data: ctx.data, path: ctx.path, errorMaps: [ ctx.common.contextualErrorMap, ctx.schemaErrorMap, overrideMap, overrideMap === errorMap ? void 0 : errorMap // then global default map ].filter((x) => !!x) }); ctx.common.issues.push(issue); } var ParseStatus = class _ParseStatus { constructor() { this.value = "valid"; } dirty() { if (this.value === "valid") this.value = "dirty"; } abort() { if (this.value !== "aborted") this.value = "aborted"; } static mergeArray(status, results) { const arrayValue = []; for (const s of results) { if (s.status === "aborted") return INVALID; if (s.status === "dirty") status.dirty(); arrayValue.push(s.value); } return { status: status.value, value: arrayValue }; } static async mergeObjectAsync(status, pairs) { const syncPairs = []; for (const pair of pairs) { const key2 = await pair.key; const value = await pair.value; syncPairs.push({ key: key2, value }); } return _ParseStatus.mergeObjectSync(status, syncPairs); } static mergeObjectSync(status, pairs) { const finalObject = {}; for (const pair of pairs) { const { key: key2, value } = pair; if (key2.status === "aborted") return INVALID; if (value.status === "aborted") return INVALID; if (key2.status === "dirty") status.dirty(); if (value.status === "dirty") status.dirty(); if (key2.value !== "__proto__" && (typeof value.value !== "undefined" || pair.alwaysSet)) { finalObject[key2.value] = value.value; } } return { status: status.value, value: finalObject }; } }; var INVALID = Object.freeze({ status: "aborted" }); var DIRTY2 = (value) => ({ status: "dirty", value }); var OK = (value) => ({ status: "valid", value }); var isAborted = (x) => x.status === "aborted"; var isDirty = (x) => x.status === "dirty"; var isValid = (x) => x.status === "valid"; var isAsync = (x) => typeof Promise !== "undefined" && x instanceof Promise; function __classPrivateFieldGet(receiver, state2, kind, f) { if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); if (typeof state2 === "function" ? receiver !== state2 || !f : !state2.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state2.get(receiver); } function __classPrivateFieldSet(receiver, state2, value, kind, f) { if (kind === "m") throw new TypeError("Private method is not writable"); if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); if (typeof state2 === "function" ? receiver !== state2 || !f : !state2.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state2.set(receiver, value), value; } var errorUtil; (function(errorUtil2) { errorUtil2.errToObj = (message) => typeof message === "string" ? { message } : message || {}; errorUtil2.toString = (message) => typeof message === "string" ? message : message === null || message === void 0 ? void 0 : message.message; })(errorUtil || (errorUtil = {})); var _ZodEnum_cache; var _ZodNativeEnum_cache; var ParseInputLazyPath = class { constructor(parent, value, path, key2) { this._cachedPath = []; this.parent = parent; this.data = value; this._path = path; this._key = key2; } get path() { if (!this._cachedPath.length) { if (this._key instanceof Array) { this._cachedPath.push(...this._path, ...this._key); } else { this._cachedPath.push(...this._path, this._key); } } return this._cachedPath; } }; var handleResult = (ctx, result) => { if (isValid(result)) { return { success: true, data: result.value }; } else { if (!ctx.common.issues.length) { throw new Error("Validation failed but no issues detected."); } return { success: false, get error() { if (this._error) return this._error; const error = new ZodError(ctx.common.issues); this._error = error; return this._error; } }; } }; function processCreateParams(params) { if (!params) return {}; const { errorMap: errorMap2, invalid_type_error, required_error, description } = params; if (errorMap2 && (invalid_type_error || required_error)) { throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`); } if (errorMap2) return { errorMap: errorMap2, description }; const customMap = (iss, ctx) => { var _a5, _b3; const { message } = params; if (iss.code === "invalid_enum_value") { return { message: message !== null && message !== void 0 ? message : ctx.defaultError }; } if (typeof ctx.data === "undefined") { return { message: (_a5 = message !== null && message !== void 0 ? message : required_error) !== null && _a5 !== void 0 ? _a5 : ctx.defaultError }; } if (iss.code !== "invalid_type") return { message: ctx.defaultError }; return { message: (_b3 = message !== null && message !== void 0 ? message : invalid_type_error) !== null && _b3 !== void 0 ? _b3 : ctx.defaultError }; }; return { errorMap: customMap, description }; } var ZodType = class { constructor(def) { this.spa = this.safeParseAsync; this._def = def; this.parse = this.parse.bind(this); this.safeParse = this.safeParse.bind(this); this.parseAsync = this.parseAsync.bind(this); this.safeParseAsync = this.safeParseAsync.bind(this); this.spa = this.spa.bind(this); this.refine = this.refine.bind(this); this.refinement = this.refinement.bind(this); this.superRefine = this.superRefine.bind(this); this.optional = this.optional.bind(this); this.nullable = this.nullable.bind(this); this.nullish = this.nullish.bind(this); this.array = this.array.bind(this); this.promise = this.promise.bind(this); this.or = this.or.bind(this); this.and = this.and.bind(this); this.transform = this.transform.bind(this); this.brand = this.brand.bind(this); this.default = this.default.bind(this); this.catch = this.catch.bind(this); this.describe = this.describe.bind(this); this.pipe = this.pipe.bind(this); this.readonly = this.readonly.bind(this); this.isNullable = this.isNullable.bind(this); this.isOptional = this.isOptional.bind(this); } get description() { return this._def.description; } _getType(input) { return getParsedType(input.data); } _getOrReturnCtx(input, ctx) { return ctx || { common: input.parent.common, data: input.data, parsedType: getParsedType(input.data), schemaErrorMap: this._def.errorMap, path: input.path, parent: input.parent }; } _processInputParams(input) { return { status: new ParseStatus(), ctx: { common: input.parent.common, data: input.data, parsedType: getParsedType(input.data), schemaErrorMap: this._def.errorMap, path: input.path, parent: input.parent } }; } _parseSync(input) { const result = this._parse(input); if (isAsync(result)) { throw new Error("Synchronous parse encountered promise."); } return result; } _parseAsync(input) { const result = this._parse(input); return Promise.resolve(result); } parse(data, params) { const result = this.safeParse(data, params); if (result.success) return result.data; throw result.error; } safeParse(data, params) { var _a5; const ctx = { common: { issues: [], async: (_a5 = params === null || params === void 0 ? void 0 : params.async) !== null && _a5 !== void 0 ? _a5 : false, contextualErrorMap: params === null || params === void 0 ? void 0 : params.errorMap }, path: (params === null || params === void 0 ? void 0 : params.path) || [], schemaErrorMap: this._def.errorMap, parent: null, data, parsedType: getParsedType(data) }; const result = this._parseSync({ data, path: ctx.path, parent: ctx }); return handleResult(ctx, result); } async parseAsync(data, params) { const result = await this.safeParseAsync(data, params); if (result.success) return result.data; throw result.error; } async safeParseAsync(data, params) { const ctx = { common: { issues: [], contextualErrorMap: params === null || params === void 0 ? void 0 : params.errorMap, async: true }, path: (params === null || params === void 0 ? void 0 : params.path) || [], schemaErrorMap: this._def.errorMap, parent: null, data, parsedType: getParsedType(data) }; const maybeAsyncResult = this._parse({ data, path: ctx.path, parent: ctx }); const result = await (isAsync(maybeAsyncResult) ? maybeAsyncResult : Promise.resolve(maybeAsyncResult)); return handleResult(ctx, result); } refine(check, message) { const getIssueProperties = (val) => { if (typeof message === "string" || typeof message === "undefined") { return { message }; } else if (typeof message === "function") { return message(val); } else { return message; } }; return this._refinement((val, ctx) => { const result = check(val); const setError = () => ctx.addIssue({ code: ZodIssueCode.custom, ...getIssueProperties(val) }); if (typeof Promise !== "undefined" && result instanceof Promise) { return result.then((data) => { if (!data) { setError(); return false; } else { return true; } }); } if (!result) { setError(); return false; } else { return true; } }); } refinement(check, refinementData) { return this._refinement((val, ctx) => { if (!check(val)) { ctx.addIssue(typeof refinementData === "function" ? refinementData(val, ctx) : refinementData); return false; } else { return true; } }); } _refinement(refinement) { return new ZodEffects({ schema: this, typeName: ZodFirstPartyTypeKind.ZodEffects, effect: { type: "refinement", refinement } }); } superRefine(refinement) { return this._refinement(refinement); } optional() { return ZodOptional.create(this, this._def); } nullable() { return ZodNullable.create(this, this._def); } nullish() { return this.nullable().optional(); } array() { return ZodArray.create(this, this._def); } promise() { return ZodPromise.create(this, this._def); } or(option) { return ZodUnion.create([this, option], this._def); } and(incoming) { return ZodIntersection.create(this, incoming, this._def); } transform(transform) { return new ZodEffects({ ...processCreateParams(this._def), schema: this, typeName: ZodFirstPartyTypeKind.ZodEffects, effect: { type: "transform", transform } }); } default(def) { const defaultValueFunc = typeof def === "function" ? def : () => def; return new ZodDefault({ ...processCreateParams(this._def), innerType: this, defaultValue: defaultValueFunc, typeName: ZodFirstPartyTypeKind.ZodDefault }); } brand() { return new ZodBranded({ typeName: ZodFirstPartyTypeKind.ZodBranded, type: this, ...processCreateParams(this._def) }); } catch(def) { const catchValueFunc = typeof def === "function" ? def : () => def; return new ZodCatch({ ...processCreateParams(this._def), innerType: this, catchValue: catchValueFunc, typeName: ZodFirstPartyTypeKind.ZodCatch }); } describe(description) { const This = this.constructor; return new This({ ...this._def, description }); } pipe(target) { return ZodPipeline.create(this, target); } readonly() { return ZodReadonly.create(this); } isOptional() { return this.safeParse(void 0).success; } isNullable() { return this.safeParse(null).success; } }; var cuidRegex = /^c[^\s-]{8,}$/i; var cuid2Regex = /^[0-9a-z]+$/; var ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}$/; var uuidRegex = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i; var nanoidRegex = /^[a-z0-9_-]{21}$/i; var durationRegex = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/; var emailRegex = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i; var _emojiRegex = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`; var emojiRegex; var ipv4Regex = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/; var ipv6Regex = /^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/; var base64Regex = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/; var dateRegexSource = `((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))`; var dateRegex = new RegExp(`^${dateRegexSource}$`); function timeRegexSource(args) { let regex = `([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d`; if (args.precision) { regex = `${regex}\\.\\d{${args.precision}}`; } else if (args.precision == null) { regex = `${regex}(\\.\\d+)?`; } return regex; } function timeRegex(args) { return new RegExp(`^${timeRegexSource(args)}$`); } function datetimeRegex(args) { let regex = `${dateRegexSource}T${timeRegexSource(args)}`; const opts = []; opts.push(args.local ? `Z?` : `Z`); if (args.offset) opts.push(`([+-]\\d{2}:?\\d{2})`); regex = `${regex}(${opts.join("|")})`; return new RegExp(`^${regex}$`); } function isValidIP(ip, version) { if ((version === "v4" || !version) && ipv4Regex.test(ip)) { return true; } if ((version === "v6" || !version) && ipv6Regex.test(ip)) { return true; } return false; } var ZodString = class _ZodString extends ZodType { _parse(input) { if (this._def.coerce) { input.data = String(input.data); } const parsedType = this._getType(input); if (parsedType !== ZodParsedType.string) { const ctx2 = this._getOrReturnCtx(input); addIssueToContext(ctx2, { code: ZodIssueCode.invalid_type, expected: ZodParsedType.string, received: ctx2.parsedType }); return INVALID; } const status = new ParseStatus(); let ctx = void 0; for (const check of this._def.checks) { if (check.kind === "min") { if (input.data.length < check.value) { ctx = this._getOrReturnCtx(input, ctx); addIssueToContext(ctx, { code: ZodIssueCode.too_small, minimum: check.value, type: "string", inclusive: true, exact: false, message: check.message }); status.dirty(); } } else if (check.kind === "max") { if (input.data.length > check.value) { ctx = this._getOrReturnCtx(input, ctx); addIssueToContext(ctx, { code: ZodIssueCode.too_big, maximum: check.value, type: "string", inclusive: true, exact: false, message: check.message }); status.dirty(); } } else if (check.kind === "length") { const tooBig = input.data.length > check.value; const tooSmall = input.data.length < check.value; if (tooBig || tooSmall) { ctx = this._getOrReturnCtx(input, ctx); if (tooBig) { addIssueToContext(ctx, { code: ZodIssueCode.too_big, maximum: check.value, type: "string", inclusive: true, exact: true, message: check.message }); } else if (tooSmall) { addIssueToContext(ctx, { code: ZodIssueCode.too_small, minimum: check.value, type: "string", inclusive: true, exact: true, message: check.message }); } status.dirty(); } } else if (check.kind === "email") { if (!emailRegex.test(input.data)) { ctx = this._getOrReturnCtx(input, ctx); addIssueToContext(ctx, { validation: "email", code: ZodIssueCode.invalid_string, message: check.message }); status.dirty(); } } else if (check.kind === "emoji") { if (!emojiRegex) { emojiRegex = new RegExp(_emojiRegex, "u"); } if (!emojiRegex.test(input.data)) { ctx = this._getOrReturnCtx(input, ctx); addIssueToContext(ctx, { validation: "emoji", code: ZodIssueCode.invalid_string, message: check.message }); status.dirty(); } } else if (check.kind === "uuid") { if (!uuidRegex.test(input.data)) { ctx = this._getOrReturnCtx(input, ctx); addIssueToContext(ctx, { validation: "uuid", code: ZodIssueCode.invalid_string, message: check.message }); status.dirty(); } } else if (check.kind === "nanoid") { if (!nanoidRegex.test(input.data)) { ctx = this._getOrReturnCtx(input, ctx); addIssueToContext(ctx, { validation: "nanoid", code: ZodIssueCode.invalid_string, message: check.message }); status.dirty(); } } else if (check.kind === "cuid") { if (!cuidRegex.test(input.data)) { ctx = this._getOrReturnCtx(input, ctx); addIssueToContext(ctx, { validation: "cuid", code: ZodIssueCode.invalid_string, message: check.message }); status.dirty(); } } else if (check.kind === "cuid2") { if (!cuid2Regex.test(input.data)) { ctx = this._getOrReturnCtx(input, ctx); addIssueToContext(ctx, { validation: "cuid2", code: ZodIssueCode.invalid_string, message: check.message }); status.dirty(); } } else if (check.kind === "ulid") { if (!ulidRegex.test(input.data)) { ctx = this._getOrReturnCtx(input, ctx); addIssueToContext(ctx, { validation: "ulid", code: ZodIssueCode.invalid_string, message: check.message }); status.dirty(); } } else if (check.kind === "url") { try { new URL(input.data); } catch (_a5) { ctx = this._getOrReturnCtx(input, ctx); addIssueToContext(ctx, { validation: "url", code: ZodIssueCode.invalid_string, message: check.message }); status.dirty(); } } else if (check.kind === "regex") { check.regex.lastIndex = 0; const testResult = check.regex.test(input.data); if (!testResult) { ctx = this._getOrReturnCtx(input, ctx); addIssueToContext(ctx, { validation: "regex", code: ZodIssueCode.invalid_string, message: check.message }); status.dirty(); } } else if (check.kind === "trim") { input.data = input.data.trim(); } else if (check.kind === "includes") { if (!input.data.includes(check.value, check.position)) { ctx = this._getOrReturnCtx(input, ctx); addIssueToContext(ctx, { code: ZodIssueCode.invalid_string, validation: { includes: check.value, position: check.position }, message: check.message }); status.dirty(); } } else if (check.kind === "toLowerCase") { input.data = input.data.toLowerCase(); } else if (check.kind === "toUpperCase") { input.data = input.data.toUpperCase(); } else if (check.kind === "startsWith") { if (!input.data.startsWith(check.value)) { ctx = this._getOrReturnCtx(input, ctx); addIssueToContext(ctx, { code: ZodIssueCode.invalid_string, validation: { startsWith: check.value }, message: check.message }); status.dirty(); } } else if (check.kind === "endsWith") { if (!input.data.endsWith(check.value)) { ctx = this._getOrReturnCtx(input, ctx); addIssueToContext(ctx, { code: ZodIssueCode.invalid_string, validation: { endsWith: check.value }, message: check.message }); status.dirty(); } } else if (check.kind === "datetime") { const regex = datetimeRegex(check); if (!regex.test(input.data)) { ctx = this._getOrReturnCtx(input, ctx); addIssueToContext(ctx, { code: ZodIssueCode.invalid_string, validation: "datetime", message: check.message }); status.dirty(); } } else if (check.kind === "date") { const regex = dateRegex; if (!regex.test(input.data)) { ctx = this._getOrReturnCtx(input, ctx); addIssueToContext(ctx, { code: ZodIssueCode.invalid_string, validation: "date", message: check.message }); status.dirty(); } } else if (check.kind === "time") { const regex = timeRegex(check); if (!regex.test(input.data)) { ctx = this._getOrReturnCtx(input, ctx); addIssueToContext(ctx, { code: ZodIssueCode.invalid_string, validation: "time", message: check.message }); status.dirty(); } } else if (check.kind === "duration") { if (!durationRegex.test(input.data)) { ctx = this._getOrReturnCtx(input, ctx); addIssueToContext(ctx, { validation: "duration", code: ZodIssueCode.invalid_string, message: check.message }); status.dirty(); } } else if (check.kind === "ip") { if (!isValidIP(input.data, check.version)) { ctx = this._getOrReturnCtx(input, ctx); addIssueToContext(ctx, { validation: "ip", code: ZodIssueCode.invalid_string, message: check.message }); status.dirty(); } } else if (check.kind === "base64") { if (!base64Regex.test(input.data)) { ctx = this._getOrReturnCtx(input, ctx); addIssueToContext(ctx, { validation: "base64", code: ZodIssueCode.invalid_string, message: check.message }); status.dirty(); } } else { util.assertNever(check); } } return { status: status.value, value: input.data }; } _regex(regex, validation, message) { return this.refinement((data) => regex.test(data), { validation, code: ZodIssueCode.invalid_string, ...errorUtil.errToObj(message) }); } _addCheck(check) { return new _ZodString({ ...this._def, checks: [...this._def.checks, check] }); } email(message) { return this._addCheck({ kind: "email", ...errorUtil.errToObj(message) }); } url(message) { return this._addCheck({ kind: "url", ...errorUtil.errToObj(message) }); } emoji(message) { return this._addCheck({ kind: "emoji", ...errorUtil.errToObj(message) }); } uuid(message) { return this._addCheck({ kind: "uuid", ...errorUtil.errToObj(message) }); } nanoid(message) { return this._addCheck({ kind: "nanoid", ...errorUtil.errToObj(message) }); } cuid(message) { return this._addCheck({ kind: "cuid", ...errorUtil.errToObj(message) }); } cuid2(message) { return this._addCheck({ kind: "cuid2", ...errorUtil.errToObj(message) }); } ulid(message) { return this._addCheck({ kind: "ulid", ...errorUtil.errToObj(message) }); } base64(message) { return this._addCheck({ kind: "base64", ...errorUtil.errToObj(message) }); } ip(options2) { return this._addCheck({ kind: "ip", ...errorUtil.errToObj(options2) }); } datetime(options2) { var _a5, _b3; if (typeof options2 === "string") { return this._addCheck({ kind: "datetime", precision: null, offset: false, local: false, message: options2 }); } return this._addCheck({ kind: "datetime", precision: typeof (options2 === null || options2 === void 0 ? void 0 : options2.precision) === "undefined" ? null : options2 === null || options2 === void 0 ? void 0 : options2.precision, offset: (_a5 = options2 === null || options2 === void 0 ? void 0 : options2.offset) !== null && _a5 !== void 0 ? _a5 : false, local: (_b3 = options2 === null || options2 === void 0 ? void 0 : options2.local) !== null && _b3 !== void 0 ? _b3 : false, ...errorUtil.errToObj(options2 === null || options2 === void 0 ? void 0 : options2.message) }); } date(message) { return this._addCheck({ kind: "date", message }); } time(options2) { if (typeof options2 === "string") { return this._addCheck({ kind: "time", precision: null, message: options2 }); } return this._addCheck({ kind: "time", precision: typeof (options2 === null || options2 === void 0 ? void 0 : options2.precision) === "undefined" ? null : options2 === null || options2 === void 0 ? void 0 : options2.precision, ...errorUtil.errToObj(options2 === null || options2 === void 0 ? void 0 : options2.message) }); } duration(message) { return this._addCheck({ kind: "duration", ...errorUtil.errToObj(message) }); } regex(regex, message) { return this._addCheck({ kind: "regex", regex, ...errorUtil.errToObj(message) }); } includes(value, options2) { return this._addCheck({ kind: "includes", value, position: options2 === null || options2 === void 0 ? void 0 : options2.position, ...errorUtil.errToObj(options2 === null || options2 === void 0 ? void 0 : options2.message) }); } startsWith(value, message) { return this._addCheck({ kind: "startsWith", value, ...errorUtil.errToObj(message) }); } endsWith(value, message) { return this._addCheck({ kind: "endsWith", value, ...errorUtil.errToObj(message) }); } min(minLength, message) { return this._addCheck({ kind: "min", value: minLength, ...errorUtil.errToObj(message) }); } max(maxLength, message) { return this._addCheck({ kind: "max", value: maxLength, ...errorUtil.errToObj(message) }); } length(len, message) { return this._addCheck({ kind: "length", value: len, ...errorUtil.errToObj(message) }); } /** * @deprecated Use z.string().min(1) instead. * @see {@link ZodString.min} */ nonempty(message) { return this.min(1, errorUtil.errToObj(message)); } trim() { return new _ZodString({ ...this._def, checks: [...this._def.checks, { kind: "trim" }] }); } toLowerCase() { return new _ZodString({ ...this._def, checks: [...this._def.checks, { kind: "toLowerCase" }] }); } toUpperCase() { return new _ZodString({ ...this._def, checks: [...this._def.checks, { kind: "toUpperCase" }] }); } get isDatetime() { return !!this._def.checks.find((ch) => ch.kind === "datetime"); } get isDate() { return !!this._def.checks.find((ch) => ch.kind === "date"); } get isTime() { return !!this._def.checks.find((ch) => ch.kind === "time"); } get isDuration() { return !!this._def.checks.find((ch) => ch.kind === "duration"); } get isEmail() { return !!this._def.checks.find((ch) => ch.kind === "email"); } get isURL() { return !!this._def.checks.find((ch) => ch.kind === "url"); } get isEmoji() { return !!this._def.checks.find((ch) => ch.kind === "emoji"); } get isUUID() { return !!this._def.checks.find((ch) => ch.kind === "uuid"); } get isNANOID() { return !!this._def.checks.find((ch) => ch.kind === "nanoid"); } get isCUID() { return !!this._def.checks.find((ch) => ch.kind === "cuid"); } get isCUID2() { return !!this._def.checks.find((ch) => ch.kind === "cuid2"); } get isULID() { return !!this._def.checks.find((ch) => ch.kind === "ulid"); } get isIP() { return !!this._def.checks.find((ch) => ch.kind === "ip"); } get isBase64() { return !!this._def.checks.find((ch) => ch.kind === "base64"); } get minLength() { let min2 = null; for (const ch of this._def.checks) { if (ch.kind === "min") { if (min2 === null || ch.value > min2) min2 = ch.value; } } return min2; } get maxLength() { let max2 = null; for (const ch of this._def.checks) { if (ch.kind === "max") { if (max2 === null || ch.value < max2) max2 = ch.value; } } return max2; } }; ZodString.create = (params) => { var _a5; return new ZodString({ checks: [], typeName: ZodFirstPartyTypeKind.ZodString, coerce: (_a5 = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a5 !== void 0 ? _a5 : false, ...processCreateParams(params) }); }; function floatSafeRemainder(val, step) { const valDecCount = (val.toString().split(".")[1] || "").length; const stepDecCount = (step.toString().split(".")[1] || "").length; const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount; const valInt = parseInt(val.toFixed(decCount).replace(".", "")); const stepInt = parseInt(step.toFixed(decCount).replace(".", "")); return valInt % stepInt / Math.pow(10, decCount); } var ZodNumber = class _ZodNumber extends ZodType { constructor() { super(...arguments); this.min = this.gte; this.max = this.lte; this.step = this.multipleOf; } _parse(input) { if (this._def.coerce) { input.data = Number(input.data); } const parsedType = this._getType(input); if (parsedType !== ZodParsedType.number) { const ctx2 = this._getOrReturnCtx(input); addIssueToContext(ctx2, { code: ZodIssueCode.invalid_type, expected: ZodParsedType.number, received: ctx2.parsedType }); return INVALID; } let ctx = void 0; const status = new ParseStatus(); for (const check of this._def.checks) { if (check.kind === "int") { if (!util.isInteger(input.data)) { ctx = this._getOrReturnCtx(input, ctx); addIssueToContext(ctx, { code: ZodIssueCode.invalid_type, expected: "integer", received: "float", message: check.message }); status.dirty(); } } else if (check.kind === "min") { const tooSmall = check.inclusive ? input.data < check.value : input.data <= check.value; if (tooSmall) { ctx = this._getOrReturnCtx(input, ctx); addIssueToContext(ctx, { code: ZodIssueCode.too_small, minimum: check.value, type: "number", inclusive: check.inclusive, exact: false, message: check.message }); status.dirty(); } } else if (check.kind === "max") { const tooBig = check.inclusive ? input.data > check.value : input.data >= check.value; if (tooBig) { ctx = this._getOrReturnCtx(input, ctx); addIssueToContext(ctx, { code: ZodIssueCode.too_big, maximum: check.value, type: "number", inclusive: check.inclusive, exact: false, message: check.message }); status.dirty(); } } else if (check.kind === "multipleOf") { if (floatSafeRemainder(input.data, check.value) !== 0) { ctx = this._getOrReturnCtx(input, ctx); addIssueToContext(ctx, { code: ZodIssueCode.not_multiple_of, multipleOf: check.value, message: check.message }); status.dirty(); } } else if (check.kind === "finite") { if (!Number.isFinite(input.data)) { ctx = this._getOrReturnCtx(input, ctx); addIssueToContext(ctx, { code: ZodIssueCode.not_finite, message: check.message }); status.dirty(); } } else { util.assertNever(check); } } return { status: status.value, value: input.data }; } gte(value, message) { return this.setLimit("min", value, true, errorUtil.toString(message)); } gt(value, message) { return this.setLimit("min", value, false, errorUtil.toString(message)); } lte(value, message) { return this.setLimit("max", value, true, errorUtil.toString(message)); } lt(value, message) { return this.setLimit("max", value, false, errorUtil.toString(message)); } setLimit(kind, value, inclusive, message) { return new _ZodNumber({ ...this._def, checks: [ ...this._def.checks, { kind, value, inclusive, message: errorUtil.toString(message) } ] }); } _addCheck(check) { return new _ZodNumber({ ...this._def, checks: [...this._def.checks, check] }); } int(message) { return this._addCheck({ kind: "int", message: errorUtil.toString(message) }); } positive(message) { return this._addCheck({ kind: "min", value: 0, inclusive: false, message: errorUtil.toString(message) }); } negative(message) { return this._addCheck({ kind: "max", value: 0, inclusive: false, message: errorUtil.toString(message) }); } nonpositive(message) { return this._addCheck({ kind: "max", value: 0, inclusive: true, message: errorUtil.toString(message) }); } nonnegative(message) { return this._addCheck({ kind: "min", value: 0, inclusive: true, message: errorUtil.toString(message) }); } multipleOf(value, message) { return this._addCheck({ kind: "multipleOf", value, message: errorUtil.toString(message) }); } finite(message) { return this._addCheck({ kind: "finite", message: errorUtil.toString(message) }); } safe(message) { return this._addCheck({ kind: "min", inclusive: true, value: Number.MIN_SAFE_INTEGER, message: errorUtil.toString(message) })._addCheck({ kind: "max", inclusive: true, value: Number.MAX_SAFE_INTEGER, message: errorUtil.toString(message) }); } get minValue() { let min2 = null; for (const ch of this._def.checks) { if (ch.kind === "min") { if (min2 === null || ch.value > min2) min2 = ch.value; } } return min2; } get maxValue() { let max2 = null; for (const ch of this._def.checks) { if (ch.kind === "max") { if (max2 === null || ch.value < max2) max2 = ch.value; } } return max2; } get isInt() { return !!this._def.checks.find((ch) => ch.kind === "int" || ch.kind === "multipleOf" && util.isInteger(ch.value)); } get isFinite() { let max2 = null, min2 = null; for (const ch of this._def.checks) { if (ch.kind === "finite" || ch.kind === "int" || ch.kind === "multipleOf") { return true; } else if (ch.kind === "min") { if (min2 === null || ch.value > min2) min2 = ch.value; } else if (ch.kind === "max") { if (max2 === null || ch.value < max2) max2 = ch.value; } } return Number.isFinite(min2) && Number.isFinite(max2); } }; ZodNumber.create = (params) => { return new ZodNumber({ checks: [], typeName: ZodFirstPartyTypeKind.ZodNumber, coerce: (params === null || params === void 0 ? void 0 : params.coerce) || false, ...processCreateParams(params) }); }; var ZodBigInt = class _ZodBigInt extends ZodType { constructor() { super(...arguments); this.min = this.gte; this.max = this.lte; } _parse(input) { if (this._def.coerce) { input.data = BigInt(input.data); } const parsedType = this._getType(input); if (parsedType !== ZodParsedType.bigint) { const ctx2 = this._getOrReturnCtx(input); addIssueToContext(ctx2, { code: ZodIssueCode.invalid_type, expected: ZodParsedType.bigint, received: ctx2.parsedType }); return INVALID; } let ctx = void 0; const status = new ParseStatus(); for (const check of this._def.checks) { if (check.kind === "min") { const tooSmall = check.inclusive ? input.data < check.value : input.data <= check.value; if (tooSmall) { ctx = this._getOrReturnCtx(input, ctx); addIssueToContext(ctx, { code: ZodIssueCode.too_small, type: "bigint", minimum: check.value, inclusive: check.inclusive, message: check.message }); status.dirty(); } } else if (check.kind === "max") { const tooBig = check.inclusive ? input.data > check.value : input.data >= check.value; if (tooBig) { ctx = this._getOrReturnCtx(input, ctx); addIssueToContext(ctx, { code: ZodIssueCode.too_big, type: "bigint", maximum: check.value, inclusive: check.inclusive, message: check.message }); status.dirty(); } } else if (check.kind === "multipleOf") { if (input.data % check.value !== BigInt(0)) { ctx = this._getOrReturnCtx(input, ctx); addIssueToContext(ctx, { code: ZodIssueCode.not_multiple_of, multipleOf: check.value, message: check.message }); status.dirty(); } } else { util.assertNever(check); } } return { status: status.value, value: input.data }; } gte(value, message) { return this.setLimit("min", value, true, errorUtil.toString(message)); } gt(value, message) { return this.setLimit("min", value, false, errorUtil.toString(message)); } lte(value, message) { return this.setLimit("max", value, true, errorUtil.toString(message)); } lt(value, message) { return this.setLimit("max", value, false, errorUtil.toString(message)); } setLimit(kind, value, inclusive, message) { return new _ZodBigInt({ ...this._def, checks: [ ...this._def.checks, { kind, value, inclusive, message: errorUtil.toString(message) } ] }); } _addCheck(check) { return new _ZodBigInt({ ...this._def, checks: [...this._def.checks, check] }); } positive(message) { return this._addCheck({ kind: "min", value: BigInt(0), inclusive: false, message: errorUtil.toString(message) }); } negative(message) { return this._addCheck({ kind: "max", value: BigInt(0), inclusive: false, message: errorUtil.toString(message) }); } nonpositive(message) { return this._addCheck({ kind: "max", value: BigInt(0), inclusive: true, message: errorUtil.toString(message) }); } nonnegative(message) { return this._addCheck({ kind: "min", value: BigInt(0), inclusive: true, message: errorUtil.toString(message) }); } multipleOf(value, message) { return this._addCheck({ kind: "multipleOf", value, message: errorUtil.toString(message) }); } get minValue() { let min2 = null; for (const ch of this._def.checks) { if (ch.kind === "min") { if (min2 === null || ch.value > min2) min2 = ch.value; } } return min2; } get maxValue() { let max2 = null; for (const ch of this._def.checks) { if (ch.kind === "max") { if (max2 === null || ch.value < max2) max2 = ch.value; } } return max2; } }; ZodBigInt.create = (params) => { var _a5; return new ZodBigInt({ checks: [], typeName: ZodFirstPartyTypeKind.ZodBigInt, coerce: (_a5 = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a5 !== void 0 ? _a5 : false, ...processCreateParams(params) }); }; var ZodBoolean = class extends ZodType { _parse(input) { if (this._def.coerce) { input.data = Boolean(input.data); } const parsedType = this._getType(input); if (parsedType !== ZodParsedType.boolean) { const ctx = this._getOrReturnCtx(input); addIssueToContext(ctx, { code: ZodIssueCode.invalid_type, expected: ZodParsedType.boolean, received: ctx.parsedType }); return INVALID; } return OK(input.data); } }; ZodBoolean.create = (params) => { return new ZodBoolean({ typeName: ZodFirstPartyTypeKind.ZodBoolean, coerce: (params === null || params === void 0 ? void 0 : params.coerce) || false, ...processCreateParams(params) }); }; var ZodDate = class _ZodDate extends ZodType { _parse(input) { if (this._def.coerce) { input.data = new Date(input.data); } const parsedType = this._getType(input); if (parsedType !== ZodParsedType.date) { const ctx2 = this._getOrReturnCtx(input); addIssueToContext(ctx2, { code: ZodIssueCode.invalid_type, expected: ZodParsedType.date, received: ctx2.parsedType }); return INVALID; } if (isNaN(input.data.getTime())) { const ctx2 = this._getOrReturnCtx(input); addIssueToContext(ctx2, { code: ZodIssueCode.invalid_date }); return INVALID; } const status = new ParseStatus(); let ctx = void 0; for (const check of this._def.checks) { if (check.kind === "min") { if (input.data.getTime() < check.value) { ctx = this._getOrReturnCtx(input, ctx); addIssueToContext(ctx, { code: ZodIssueCode.too_small, message: check.message, inclusive: true, exact: false, minimum: check.value, type: "date" }); status.dirty(); } } else if (check.kind === "max") { if (input.data.getTime() > check.value) { ctx = this._getOrReturnCtx(input, ctx); addIssueToContext(ctx, { code: ZodIssueCode.too_big, message: check.message, inclusive: true, exact: false, maximum: check.value, type: "date" }); status.dirty(); } } else { util.assertNever(check); } } return { status: status.value, value: new Date(input.data.getTime()) }; } _addCheck(check) { return new _ZodDate({ ...this._def, checks: [...this._def.checks, check] }); } min(minDate, message) { return this._addCheck({ kind: "min", value: minDate.getTime(), message: errorUtil.toString(message) }); } max(maxDate, message) { return this._addCheck({ kind: "max", value: maxDate.getTime(), message: errorUtil.toString(message) }); } get minDate() { let min2 = null; for (const ch of this._def.checks) { if (ch.kind === "min") { if (min2 === null || ch.value > min2) min2 = ch.value; } } return min2 != null ? new Date(min2) : null; } get maxDate() { let max2 = null; for (const ch of this._def.checks) { if (ch.kind === "max") { if (max2 === null || ch.value < max2) max2 = ch.value; } } return max2 != null ? new Date(max2) : null; } }; ZodDate.create = (params) => { return new ZodDate({ checks: [], coerce: (params === null || params === void 0 ? void 0 : params.coerce) || false, typeName: ZodFirstPartyTypeKind.ZodDate, ...processCreateParams(params) }); }; var ZodSymbol = class extends ZodType { _parse(input) { const parsedType = this._getType(input); if (parsedType !== ZodParsedType.symbol) { const ctx = this._getOrReturnCtx(input); addIssueToContext(ctx, { code: ZodIssueCode.invalid_type, expected: ZodParsedType.symbol, received: ctx.parsedType }); return INVALID; } return OK(input.data); } }; ZodSymbol.create = (params) => { return new ZodSymbol({ typeName: ZodFirstPartyTypeKind.ZodSymbol, ...processCreateParams(params) }); }; var ZodUndefined = class extends ZodType { _parse(input) { const parsedType = this._getType(input); if (parsedType !== ZodParsedType.undefined) { const ctx = this._getOrReturnCtx(input); addIssueToContext(ctx, { code: ZodIssueCode.invalid_type, expected: ZodParsedType.undefined, received: ctx.parsedType }); return INVALID; } return OK(input.data); } }; ZodUndefined.create = (params) => { return new ZodUndefined({ typeName: ZodFirstPartyTypeKind.ZodUndefined, ...processCreateParams(params) }); }; var ZodNull = class extends ZodType { _parse(input) { const parsedType = this._getType(input); if (parsedType !== ZodParsedType.null) { const ctx = this._getOrReturnCtx(input); addIssueToContext(ctx, { code: ZodIssueCode.invalid_type, expected: ZodParsedType.null, received: ctx.parsedType }); return INVALID; } return OK(input.data); } }; ZodNull.create = (params) => { return new ZodNull({ typeName: ZodFirstPartyTypeKind.ZodNull, ...processCreateParams(params) }); }; var ZodAny = class extends ZodType { constructor() { super(...arguments); this._any = true; } _parse(input) { return OK(input.data); } }; ZodAny.create = (params) => { return new ZodAny({ typeName: ZodFirstPartyTypeKind.ZodAny, ...processCreateParams(params) }); }; var ZodUnknown = class extends ZodType { constructor() { super(...arguments); this._unknown = true; } _parse(input) { return OK(input.data); } }; ZodUnknown.create = (params) => { return new ZodUnknown({ typeName: ZodFirstPartyTypeKind.ZodUnknown, ...processCreateParams(params) }); }; var ZodNever = class extends ZodType { _parse(input) { const ctx = this._getOrReturnCtx(input); addIssueToContext(ctx, { code: ZodIssueCode.invalid_type, expected: ZodParsedType.never, received: ctx.parsedType }); return INVALID; } }; ZodNever.create = (params) => { return new ZodNever({ typeName: ZodFirstPartyTypeKind.ZodNever, ...processCreateParams(params) }); }; var ZodVoid = class extends ZodType { _parse(input) { const parsedType = this._getType(input); if (parsedType !== ZodParsedType.undefined) { const ctx = this._getOrReturnCtx(input); addIssueToContext(ctx, { code: ZodIssueCode.invalid_type, expected: ZodParsedType.void, received: ctx.parsedType }); return INVALID; } return OK(input.data); } }; ZodVoid.create = (params) => { return new ZodVoid({ typeName: ZodFirstPartyTypeKind.ZodVoid, ...processCreateParams(params) }); }; var ZodArray = class _ZodArray extends ZodType { _parse(input) { const { ctx, status } = this._processInputParams(input); const def = this._def; if (ctx.parsedType !== ZodParsedType.array) { addIssueToContext(ctx, { code: ZodIssueCode.invalid_type, expected: ZodParsedType.array, received: ctx.parsedType }); return INVALID; } if (def.exactLength !== null) { const tooBig = ctx.data.length > def.exactLength.value; const tooSmall = ctx.data.length < def.exactLength.value; if (tooBig || tooSmall) { addIssueToContext(ctx, { code: tooBig ? ZodIssueCode.too_big : ZodIssueCode.too_small, minimum: tooSmall ? def.exactLength.value : void 0, maximum: tooBig ? def.exactLength.value : void 0, type: "array", inclusive: true, exact: true, message: def.exactLength.message }); status.dirty(); } } if (def.minLength !== null) { if (ctx.data.length < def.minLength.value) { addIssueToContext(ctx, { code: ZodIssueCode.too_small, minimum: def.minLength.value, type: "array", inclusive: true, exact: false, message: def.minLength.message }); status.dirty(); } } if (def.maxLength !== null) { if (ctx.data.length > def.maxLength.value) { addIssueToContext(ctx, { code: ZodIssueCode.too_big, maximum: def.maxLength.value, type: "array", inclusive: true, exact: false, message: def.maxLength.message }); status.dirty(); } } if (ctx.common.async) { return Promise.all([...ctx.data].map((item, i) => { return def.type._parseAsync(new ParseInputLazyPath(ctx, item, ctx.path, i)); })).then((result2) => { return ParseStatus.mergeArray(status, result2); }); } const result = [...ctx.data].map((item, i) => { return def.type._parseSync(new ParseInputLazyPath(ctx, item, ctx.path, i)); }); return ParseStatus.mergeArray(status, result); } get element() { return this._def.type; } min(minLength, message) { return new _ZodArray({ ...this._def, minLength: { value: minLength, message: errorUtil.toString(message) } }); } max(maxLength, message) { return new _ZodArray({ ...this._def, maxLength: { value: maxLength, message: errorUtil.toString(message) } }); } length(len, message) { return new _ZodArray({ ...this._def, exactLength: { value: len, message: errorUtil.toString(message) } }); } nonempty(message) { return this.min(1, message); } }; ZodArray.create = (schema, params) => { return new ZodArray({ type: schema, minLength: null, maxLength: null, exactLength: null, typeName: ZodFirstPartyTypeKind.ZodArray, ...processCreateParams(params) }); }; function deepPartialify(schema) { if (schema instanceof ZodObject) { const newShape = {}; for (const key2 in schema.shape) { const fieldSchema = schema.shape[key2]; newShape[key2] = ZodOptional.create(deepPartialify(fieldSchema)); } return new ZodObject({ ...schema._def, shape: () => newShape }); } else if (schema instanceof ZodArray) { return new ZodArray({ ...schema._def, type: deepPartialify(schema.element) }); } else if (schema instanceof ZodOptional) { return ZodOptional.create(deepPartialify(schema.unwrap())); } else if (schema instanceof ZodNullable) { return ZodNullable.create(deepPartialify(schema.unwrap())); } else if (schema instanceof ZodTuple) { return ZodTuple.create(schema.items.map((item) => deepPartialify(item))); } else { return schema; } } var ZodObject = class _ZodObject extends ZodType { constructor() { super(...arguments); this._cached = null; this.nonstrict = this.passthrough; this.augment = this.extend; } _getCached() { if (this._cached !== null) return this._cached; const shape = this._def.shape(); const keys = util.objectKeys(shape); return this._cached = { shape, keys }; } _parse(input) { const parsedType = this._getType(input); if (parsedType !== ZodParsedType.object) { const ctx2 = this._getOrReturnCtx(input); addIssueToContext(ctx2, { code: ZodIssueCode.invalid_type, expected: ZodParsedType.object, received: ctx2.parsedType }); return INVALID; } const { status, ctx } = this._processInputParams(input); const { shape, keys: shapeKeys } = this._getCached(); const extraKeys = []; if (!(this._def.catchall instanceof ZodNever && this._def.unknownKeys === "strip")) { for (const key2 in ctx.data) { if (!shapeKeys.includes(key2)) { extraKeys.push(key2); } } } const pairs = []; for (const key2 of shapeKeys) { const keyValidator = shape[key2]; const value = ctx.data[key2]; pairs.push({ key: { status: "valid", value: key2 }, value: keyValidator._parse(new ParseInputLazyPath(ctx, value, ctx.path, key2)), alwaysSet: key2 in ctx.data }); } if (this._def.catchall instanceof ZodNever) { const unknownKeys = this._def.unknownKeys; if (unknownKeys === "passthrough") { for (const key2 of extraKeys) { pairs.push({ key: { status: "valid", value: key2 }, value: { status: "valid", value: ctx.data[key2] } }); } } else if (unknownKeys === "strict") { if (extraKeys.length > 0) { addIssueToContext(ctx, { code: ZodIssueCode.unrecognized_keys, keys: extraKeys }); status.dirty(); } } else if (unknownKeys === "strip") ; else { throw new Error(`Internal ZodObject error: invalid unknownKeys value.`); } } else { const catchall = this._def.catchall; for (const key2 of extraKeys) { const value = ctx.data[key2]; pairs.push({ key: { status: "valid", value: key2 }, value: catchall._parse( new ParseInputLazyPath(ctx, value, ctx.path, key2) //, ctx.child(key), value, getParsedType(value) ), alwaysSet: key2 in ctx.data }); } } if (ctx.common.async) { return Promise.resolve().then(async () => { const syncPairs = []; for (const pair of pairs) { const key2 = await pair.key; const value = await pair.value; syncPairs.push({ key: key2, value, alwaysSet: pair.alwaysSet }); } return syncPairs; }).then((syncPairs) => { return ParseStatus.mergeObjectSync(status, syncPairs); }); } else { return ParseStatus.mergeObjectSync(status, pairs); } } get shape() { return this._def.shape(); } strict(message) { errorUtil.errToObj; return new _ZodObject({ ...this._def, unknownKeys: "strict", ...message !== void 0 ? { errorMap: (issue, ctx) => { var _a5, _b3, _c2, _d; const defaultError = (_c2 = (_b3 = (_a5 = this._def).errorMap) === null || _b3 === void 0 ? void 0 : _b3.call(_a5, issue, ctx).message) !== null && _c2 !== void 0 ? _c2 : ctx.defaultError; if (issue.code === "unrecognized_keys") return { message: (_d = errorUtil.errToObj(message).message) !== null && _d !== void 0 ? _d : defaultError }; return { message: defaultError }; } } : {} }); } strip() { return new _ZodObject({ ...this._def, unknownKeys: "strip" }); } passthrough() { return new _ZodObject({ ...this._def, unknownKeys: "passthrough" }); } // const AugmentFactory = // (def: Def) => // ( // augmentation: Augmentation // ): ZodObject< // extendShape, Augmentation>, // Def["unknownKeys"], // Def["catchall"] // > => { // return new ZodObject({ // ...def, // shape: () => ({ // ...def.shape(), // ...augmentation, // }), // }) as any; // }; extend(augmentation) { return new _ZodObject({ ...this._def, shape: () => ({ ...this._def.shape(), ...augmentation }) }); } /** * Prior to zod@1.0.12 there was a bug in the * inferred type of merged objects. Please * upgrade if you are experiencing issues. */ merge(merging) { const merged = new _ZodObject({ unknownKeys: merging._def.unknownKeys, catchall: merging._def.catchall, shape: () => ({ ...this._def.shape(), ...merging._def.shape() }), typeName: ZodFirstPartyTypeKind.ZodObject }); return merged; } // merge< // Incoming extends AnyZodObject, // Augmentation extends Incoming["shape"], // NewOutput extends { // [k in keyof Augmentation | keyof Output]: k extends keyof Augmentation // ? Augmentation[k]["_output"] // : k extends keyof Output // ? Output[k] // : never; // }, // NewInput extends { // [k in keyof Augmentation | keyof Input]: k extends keyof Augmentation // ? Augmentation[k]["_input"] // : k extends keyof Input // ? Input[k] // : never; // } // >( // merging: Incoming // ): ZodObject< // extendShape>, // Incoming["_def"]["unknownKeys"], // Incoming["_def"]["catchall"], // NewOutput, // NewInput // > { // const merged: any = new ZodObject({ // unknownKeys: merging._def.unknownKeys, // catchall: merging._def.catchall, // shape: () => // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()), // typeName: ZodFirstPartyTypeKind.ZodObject, // }) as any; // return merged; // } setKey(key2, schema) { return this.augment({ [key2]: schema }); } // merge( // merging: Incoming // ): //ZodObject = (merging) => { // ZodObject< // extendShape>, // Incoming["_def"]["unknownKeys"], // Incoming["_def"]["catchall"] // > { // // const mergedShape = objectUtil.mergeShapes( // // this._def.shape(), // // merging._def.shape() // // ); // const merged: any = new ZodObject({ // unknownKeys: merging._def.unknownKeys, // catchall: merging._def.catchall, // shape: () => // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()), // typeName: ZodFirstPartyTypeKind.ZodObject, // }) as any; // return merged; // } catchall(index2) { return new _ZodObject({ ...this._def, catchall: index2 }); } pick(mask) { const shape = {}; util.objectKeys(mask).forEach((key2) => { if (mask[key2] && this.shape[key2]) { shape[key2] = this.shape[key2]; } }); return new _ZodObject({ ...this._def, shape: () => shape }); } omit(mask) { const shape = {}; util.objectKeys(this.shape).forEach((key2) => { if (!mask[key2]) { shape[key2] = this.shape[key2]; } }); return new _ZodObject({ ...this._def, shape: () => shape }); } /** * @deprecated */ deepPartial() { return deepPartialify(this); } partial(mask) { const newShape = {}; util.objectKeys(this.shape).forEach((key2) => { const fieldSchema = this.shape[key2]; if (mask && !mask[key2]) { newShape[key2] = fieldSchema; } else { newShape[key2] = fieldSchema.optional(); } }); return new _ZodObject({ ...this._def, shape: () => newShape }); } required(mask) { const newShape = {}; util.objectKeys(this.shape).forEach((key2) => { if (mask && !mask[key2]) { newShape[key2] = this.shape[key2]; } else { const fieldSchema = this.shape[key2]; let newField = fieldSchema; while (newField instanceof ZodOptional) { newField = newField._def.innerType; } newShape[key2] = newField; } }); return new _ZodObject({ ...this._def, shape: () => newShape }); } keyof() { return createZodEnum(util.objectKeys(this.shape)); } }; ZodObject.create = (shape, params) => { return new ZodObject({ shape: () => shape, unknownKeys: "strip", catchall: ZodNever.create(), typeName: ZodFirstPartyTypeKind.ZodObject, ...processCreateParams(params) }); }; ZodObject.strictCreate = (shape, params) => { return new ZodObject({ shape: () => shape, unknownKeys: "strict", catchall: ZodNever.create(), typeName: ZodFirstPartyTypeKind.ZodObject, ...processCreateParams(params) }); }; ZodObject.lazycreate = (shape, params) => { return new ZodObject({ shape, unknownKeys: "strip", catchall: ZodNever.create(), typeName: ZodFirstPartyTypeKind.ZodObject, ...processCreateParams(params) }); }; var ZodUnion = class extends ZodType { _parse(input) { const { ctx } = this._processInputParams(input); const options2 = this._def.options; function handleResults(results) { for (const result of results) { if (result.result.status === "valid") { return result.result; } } for (const result of results) { if (result.result.status === "dirty") { ctx.common.issues.push(...result.ctx.common.issues); return result.result; } } const unionErrors = results.map((result) => new ZodError(result.ctx.common.issues)); addIssueToContext(ctx, { code: ZodIssueCode.invalid_union, unionErrors }); return INVALID; } if (ctx.common.async) { return Promise.all(options2.map(async (option) => { const childCtx = { ...ctx, common: { ...ctx.common, issues: [] }, parent: null }; return { result: await option._parseAsync({ data: ctx.data, path: ctx.path, parent: childCtx }), ctx: childCtx }; })).then(handleResults); } else { let dirty = void 0; const issues = []; for (const option of options2) { const childCtx = { ...ctx, common: { ...ctx.common, issues: [] }, parent: null }; const result = option._parseSync({ data: ctx.data, path: ctx.path, parent: childCtx }); if (result.status === "valid") { return result; } else if (result.status === "dirty" && !dirty) { dirty = { result, ctx: childCtx }; } if (childCtx.common.issues.length) { issues.push(childCtx.common.issues); } } if (dirty) { ctx.common.issues.push(...dirty.ctx.common.issues); return dirty.result; } const unionErrors = issues.map((issues2) => new ZodError(issues2)); addIssueToContext(ctx, { code: ZodIssueCode.invalid_union, unionErrors }); return INVALID; } } get options() { return this._def.options; } }; ZodUnion.create = (types, params) => { return new ZodUnion({ options: types, typeName: ZodFirstPartyTypeKind.ZodUnion, ...processCreateParams(params) }); }; var getDiscriminator = (type) => { if (type instanceof ZodLazy) { return getDiscriminator(type.schema); } else if (type instanceof ZodEffects) { return getDiscriminator(type.innerType()); } else if (type instanceof ZodLiteral) { return [type.value]; } else if (type instanceof ZodEnum) { return type.options; } else if (type instanceof ZodNativeEnum) { return util.objectValues(type.enum); } else if (type instanceof ZodDefault) { return getDiscriminator(type._def.innerType); } else if (type instanceof ZodUndefined) { return [void 0]; } else if (type instanceof ZodNull) { return [null]; } else if (type instanceof ZodOptional) { return [void 0, ...getDiscriminator(type.unwrap())]; } else if (type instanceof ZodNullable) { return [null, ...getDiscriminator(type.unwrap())]; } else if (type instanceof ZodBranded) { return getDiscriminator(type.unwrap()); } else if (type instanceof ZodReadonly) { return getDiscriminator(type.unwrap()); } else if (type instanceof ZodCatch) { return getDiscriminator(type._def.innerType); } else { return []; } }; var ZodDiscriminatedUnion = class _ZodDiscriminatedUnion extends ZodType { _parse(input) { const { ctx } = this._processInputParams(input); if (ctx.parsedType !== ZodParsedType.object) { addIssueToContext(ctx, { code: ZodIssueCode.invalid_type, expected: ZodParsedType.object, received: ctx.parsedType }); return INVALID; } const discriminator = this.discriminator; const discriminatorValue = ctx.data[discriminator]; const option = this.optionsMap.get(discriminatorValue); if (!option) { addIssueToContext(ctx, { code: ZodIssueCode.invalid_union_discriminator, options: Array.from(this.optionsMap.keys()), path: [discriminator] }); return INVALID; } if (ctx.common.async) { return option._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }); } else { return option._parseSync({ data: ctx.data, path: ctx.path, parent: ctx }); } } get discriminator() { return this._def.discriminator; } get options() { return this._def.options; } get optionsMap() { return this._def.optionsMap; } /** * The constructor of the discriminated union schema. Its behaviour is very similar to that of the normal z.union() constructor. * However, it only allows a union of objects, all of which need to share a discriminator property. This property must * have a different value for each object in the union. * @param discriminator the name of the discriminator property * @param types an array of object schemas * @param params */ static create(discriminator, options2, params) { const optionsMap = /* @__PURE__ */ new Map(); for (const type of options2) { const discriminatorValues = getDiscriminator(type.shape[discriminator]); if (!discriminatorValues.length) { throw new Error(`A discriminator value for key \`${discriminator}\` could not be extracted from all schema options`); } for (const value of discriminatorValues) { if (optionsMap.has(value)) { throw new Error(`Discriminator property ${String(discriminator)} has duplicate value ${String(value)}`); } optionsMap.set(value, type); } } return new _ZodDiscriminatedUnion({ typeName: ZodFirstPartyTypeKind.ZodDiscriminatedUnion, discriminator, options: options2, optionsMap, ...processCreateParams(params) }); } }; function mergeValues(a, b) { const aType = getParsedType(a); const bType = getParsedType(b); if (a === b) { return { valid: true, data: a }; } else if (aType === ZodParsedType.object && bType === ZodParsedType.object) { const bKeys = util.objectKeys(b); const sharedKeys = util.objectKeys(a).filter((key2) => bKeys.indexOf(key2) !== -1); const newObj = { ...a, ...b }; for (const key2 of sharedKeys) { const sharedValue = mergeValues(a[key2], b[key2]); if (!sharedValue.valid) { return { valid: false }; } newObj[key2] = sharedValue.data; } return { valid: true, data: newObj }; } else if (aType === ZodParsedType.array && bType === ZodParsedType.array) { if (a.length !== b.length) { return { valid: false }; } const newArray = []; for (let index2 = 0; index2 < a.length; index2++) { const itemA = a[index2]; const itemB = b[index2]; const sharedValue = mergeValues(itemA, itemB); if (!sharedValue.valid) { return { valid: false }; } newArray.push(sharedValue.data); } return { valid: true, data: newArray }; } else if (aType === ZodParsedType.date && bType === ZodParsedType.date && +a === +b) { return { valid: true, data: a }; } else { return { valid: false }; } } var ZodIntersection = class extends ZodType { _parse(input) { const { status, ctx } = this._processInputParams(input); const handleParsed = (parsedLeft, parsedRight) => { if (isAborted(parsedLeft) || isAborted(parsedRight)) { return INVALID; } const merged = mergeValues(parsedLeft.value, parsedRight.value); if (!merged.valid) { addIssueToContext(ctx, { code: ZodIssueCode.invalid_intersection_types }); return INVALID; } if (isDirty(parsedLeft) || isDirty(parsedRight)) { status.dirty(); } return { status: status.value, value: merged.data }; }; if (ctx.common.async) { return Promise.all([ this._def.left._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }), this._def.right._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }) ]).then(([left, right]) => handleParsed(left, right)); } else { return handleParsed(this._def.left._parseSync({ data: ctx.data, path: ctx.path, parent: ctx }), this._def.right._parseSync({ data: ctx.data, path: ctx.path, parent: ctx })); } } }; ZodIntersection.create = (left, right, params) => { return new ZodIntersection({ left, right, typeName: ZodFirstPartyTypeKind.ZodIntersection, ...processCreateParams(params) }); }; var ZodTuple = class _ZodTuple extends ZodType { _parse(input) { const { status, ctx } = this._processInputParams(input); if (ctx.parsedType !== ZodParsedType.array) { addIssueToContext(ctx, { code: ZodIssueCode.invalid_type, expected: ZodParsedType.array, received: ctx.parsedType }); return INVALID; } if (ctx.data.length < this._def.items.length) { addIssueToContext(ctx, { code: ZodIssueCode.too_small, minimum: this._def.items.length, inclusive: true, exact: false, type: "array" }); return INVALID; } const rest = this._def.rest; if (!rest && ctx.data.length > this._def.items.length) { addIssueToContext(ctx, { code: ZodIssueCode.too_big, maximum: this._def.items.length, inclusive: true, exact: false, type: "array" }); status.dirty(); } const items = [...ctx.data].map((item, itemIndex) => { const schema = this._def.items[itemIndex] || this._def.rest; if (!schema) return null; return schema._parse(new ParseInputLazyPath(ctx, item, ctx.path, itemIndex)); }).filter((x) => !!x); if (ctx.common.async) { return Promise.all(items).then((results) => { return ParseStatus.mergeArray(status, results); }); } else { return ParseStatus.mergeArray(status, items); } } get items() { return this._def.items; } rest(rest) { return new _ZodTuple({ ...this._def, rest }); } }; ZodTuple.create = (schemas, params) => { if (!Array.isArray(schemas)) { throw new Error("You must pass an array of schemas to z.tuple([ ... ])"); } return new ZodTuple({ items: schemas, typeName: ZodFirstPartyTypeKind.ZodTuple, rest: null, ...processCreateParams(params) }); }; var ZodRecord = class _ZodRecord extends ZodType { get keySchema() { return this._def.keyType; } get valueSchema() { return this._def.valueType; } _parse(input) { const { status, ctx } = this._processInputParams(input); if (ctx.parsedType !== ZodParsedType.object) { addIssueToContext(ctx, { code: ZodIssueCode.invalid_type, expected: ZodParsedType.object, received: ctx.parsedType }); return INVALID; } const pairs = []; const keyType = this._def.keyType; const valueType = this._def.valueType; for (const key2 in ctx.data) { pairs.push({ key: keyType._parse(new ParseInputLazyPath(ctx, key2, ctx.path, key2)), value: valueType._parse(new ParseInputLazyPath(ctx, ctx.data[key2], ctx.path, key2)), alwaysSet: key2 in ctx.data }); } if (ctx.common.async) { return ParseStatus.mergeObjectAsync(status, pairs); } else { return ParseStatus.mergeObjectSync(status, pairs); } } get element() { return this._def.valueType; } static create(first, second, third) { if (second instanceof ZodType) { return new _ZodRecord({ keyType: first, valueType: second, typeName: ZodFirstPartyTypeKind.ZodRecord, ...processCreateParams(third) }); } return new _ZodRecord({ keyType: ZodString.create(), valueType: first, typeName: ZodFirstPartyTypeKind.ZodRecord, ...processCreateParams(second) }); } }; var ZodMap = class extends ZodType { get keySchema() { return this._def.keyType; } get valueSchema() { return this._def.valueType; } _parse(input) { const { status, ctx } = this._processInputParams(input); if (ctx.parsedType !== ZodParsedType.map) { addIssueToContext(ctx, { code: ZodIssueCode.invalid_type, expected: ZodParsedType.map, received: ctx.parsedType }); return INVALID; } const keyType = this._def.keyType; const valueType = this._def.valueType; const pairs = [...ctx.data.entries()].map(([key2, value], index2) => { return { key: keyType._parse(new ParseInputLazyPath(ctx, key2, ctx.path, [index2, "key"])), value: valueType._parse(new ParseInputLazyPath(ctx, value, ctx.path, [index2, "value"])) }; }); if (ctx.common.async) { const finalMap = /* @__PURE__ */ new Map(); return Promise.resolve().then(async () => { for (const pair of pairs) { const key2 = await pair.key; const value = await pair.value; if (key2.status === "aborted" || value.status === "aborted") { return INVALID; } if (key2.status === "dirty" || value.status === "dirty") { status.dirty(); } finalMap.set(key2.value, value.value); } return { status: status.value, value: finalMap }; }); } else { const finalMap = /* @__PURE__ */ new Map(); for (const pair of pairs) { const key2 = pair.key; const value = pair.value; if (key2.status === "aborted" || value.status === "aborted") { return INVALID; } if (key2.status === "dirty" || value.status === "dirty") { status.dirty(); } finalMap.set(key2.value, value.value); } return { status: status.value, value: finalMap }; } } }; ZodMap.create = (keyType, valueType, params) => { return new ZodMap({ valueType, keyType, typeName: ZodFirstPartyTypeKind.ZodMap, ...processCreateParams(params) }); }; var ZodSet = class _ZodSet extends ZodType { _parse(input) { const { status, ctx } = this._processInputParams(input); if (ctx.parsedType !== ZodParsedType.set) { addIssueToContext(ctx, { code: ZodIssueCode.invalid_type, expected: ZodParsedType.set, received: ctx.parsedType }); return INVALID; } const def = this._def; if (def.minSize !== null) { if (ctx.data.size < def.minSize.value) { addIssueToContext(ctx, { code: ZodIssueCode.too_small, minimum: def.minSize.value, type: "set", inclusive: true, exact: false, message: def.minSize.message }); status.dirty(); } } if (def.maxSize !== null) { if (ctx.data.size > def.maxSize.value) { addIssueToContext(ctx, { code: ZodIssueCode.too_big, maximum: def.maxSize.value, type: "set", inclusive: true, exact: false, message: def.maxSize.message }); status.dirty(); } } const valueType = this._def.valueType; function finalizeSet(elements2) { const parsedSet = /* @__PURE__ */ new Set(); for (const element2 of elements2) { if (element2.status === "aborted") return INVALID; if (element2.status === "dirty") status.dirty(); parsedSet.add(element2.value); } return { status: status.value, value: parsedSet }; } const elements = [...ctx.data.values()].map((item, i) => valueType._parse(new ParseInputLazyPath(ctx, item, ctx.path, i))); if (ctx.common.async) { return Promise.all(elements).then((elements2) => finalizeSet(elements2)); } else { return finalizeSet(elements); } } min(minSize, message) { return new _ZodSet({ ...this._def, minSize: { value: minSize, message: errorUtil.toString(message) } }); } max(maxSize, message) { return new _ZodSet({ ...this._def, maxSize: { value: maxSize, message: errorUtil.toString(message) } }); } size(size2, message) { return this.min(size2, message).max(size2, message); } nonempty(message) { return this.min(1, message); } }; ZodSet.create = (valueType, params) => { return new ZodSet({ valueType, minSize: null, maxSize: null, typeName: ZodFirstPartyTypeKind.ZodSet, ...processCreateParams(params) }); }; var ZodFunction = class _ZodFunction extends ZodType { constructor() { super(...arguments); this.validate = this.implement; } _parse(input) { const { ctx } = this._processInputParams(input); if (ctx.parsedType !== ZodParsedType.function) { addIssueToContext(ctx, { code: ZodIssueCode.invalid_type, expected: ZodParsedType.function, received: ctx.parsedType }); return INVALID; } function makeArgsIssue(args, error) { return makeIssue({ data: args, path: ctx.path, errorMaps: [ ctx.common.contextualErrorMap, ctx.schemaErrorMap, getErrorMap(), errorMap ].filter((x) => !!x), issueData: { code: ZodIssueCode.invalid_arguments, argumentsError: error } }); } function makeReturnsIssue(returns, error) { return makeIssue({ data: returns, path: ctx.path, errorMaps: [ ctx.common.contextualErrorMap, ctx.schemaErrorMap, getErrorMap(), errorMap ].filter((x) => !!x), issueData: { code: ZodIssueCode.invalid_return_type, returnTypeError: error } }); } const params = { errorMap: ctx.common.contextualErrorMap }; const fn = ctx.data; if (this._def.returns instanceof ZodPromise) { const me = this; return OK(async function(...args) { const error = new ZodError([]); const parsedArgs = await me._def.args.parseAsync(args, params).catch((e) => { error.addIssue(makeArgsIssue(args, e)); throw error; }); const result = await Reflect.apply(fn, this, parsedArgs); const parsedReturns = await me._def.returns._def.type.parseAsync(result, params).catch((e) => { error.addIssue(makeReturnsIssue(result, e)); throw error; }); return parsedReturns; }); } else { const me = this; return OK(function(...args) { const parsedArgs = me._def.args.safeParse(args, params); if (!parsedArgs.success) { throw new ZodError([makeArgsIssue(args, parsedArgs.error)]); } const result = Reflect.apply(fn, this, parsedArgs.data); const parsedReturns = me._def.returns.safeParse(result, params); if (!parsedReturns.success) { throw new ZodError([makeReturnsIssue(result, parsedReturns.error)]); } return parsedReturns.data; }); } } parameters() { return this._def.args; } returnType() { return this._def.returns; } args(...items) { return new _ZodFunction({ ...this._def, args: ZodTuple.create(items).rest(ZodUnknown.create()) }); } returns(returnType) { return new _ZodFunction({ ...this._def, returns: returnType }); } implement(func) { const validatedFunc = this.parse(func); return validatedFunc; } strictImplement(func) { const validatedFunc = this.parse(func); return validatedFunc; } static create(args, returns, params) { return new _ZodFunction({ args: args ? args : ZodTuple.create([]).rest(ZodUnknown.create()), returns: returns || ZodUnknown.create(), typeName: ZodFirstPartyTypeKind.ZodFunction, ...processCreateParams(params) }); } }; var ZodLazy = class extends ZodType { get schema() { return this._def.getter(); } _parse(input) { const { ctx } = this._processInputParams(input); const lazySchema = this._def.getter(); return lazySchema._parse({ data: ctx.data, path: ctx.path, parent: ctx }); } }; ZodLazy.create = (getter, params) => { return new ZodLazy({ getter, typeName: ZodFirstPartyTypeKind.ZodLazy, ...processCreateParams(params) }); }; var ZodLiteral = class extends ZodType { _parse(input) { if (input.data !== this._def.value) { const ctx = this._getOrReturnCtx(input); addIssueToContext(ctx, { received: ctx.data, code: ZodIssueCode.invalid_literal, expected: this._def.value }); return INVALID; } return { status: "valid", value: input.data }; } get value() { return this._def.value; } }; ZodLiteral.create = (value, params) => { return new ZodLiteral({ value, typeName: ZodFirstPartyTypeKind.ZodLiteral, ...processCreateParams(params) }); }; function createZodEnum(values, params) { return new ZodEnum({ values, typeName: ZodFirstPartyTypeKind.ZodEnum, ...processCreateParams(params) }); } var ZodEnum = class _ZodEnum extends ZodType { constructor() { super(...arguments); _ZodEnum_cache.set(this, void 0); } _parse(input) { if (typeof input.data !== "string") { const ctx = this._getOrReturnCtx(input); const expectedValues = this._def.values; addIssueToContext(ctx, { expected: util.joinValues(expectedValues), received: ctx.parsedType, code: ZodIssueCode.invalid_type }); return INVALID; } if (!__classPrivateFieldGet(this, _ZodEnum_cache, "f")) { __classPrivateFieldSet(this, _ZodEnum_cache, new Set(this._def.values), "f"); } if (!__classPrivateFieldGet(this, _ZodEnum_cache, "f").has(input.data)) { const ctx = this._getOrReturnCtx(input); const expectedValues = this._def.values; addIssueToContext(ctx, { received: ctx.data, code: ZodIssueCode.invalid_enum_value, options: expectedValues }); return INVALID; } return OK(input.data); } get options() { return this._def.values; } get enum() { const enumValues = {}; for (const val of this._def.values) { enumValues[val] = val; } return enumValues; } get Values() { const enumValues = {}; for (const val of this._def.values) { enumValues[val] = val; } return enumValues; } get Enum() { const enumValues = {}; for (const val of this._def.values) { enumValues[val] = val; } return enumValues; } extract(values, newDef = this._def) { return _ZodEnum.create(values, { ...this._def, ...newDef }); } exclude(values, newDef = this._def) { return _ZodEnum.create(this.options.filter((opt) => !values.includes(opt)), { ...this._def, ...newDef }); } }; _ZodEnum_cache = /* @__PURE__ */ new WeakMap(); ZodEnum.create = createZodEnum; var ZodNativeEnum = class extends ZodType { constructor() { super(...arguments); _ZodNativeEnum_cache.set(this, void 0); } _parse(input) { const nativeEnumValues = util.getValidEnumValues(this._def.values); const ctx = this._getOrReturnCtx(input); if (ctx.parsedType !== ZodParsedType.string && ctx.parsedType !== ZodParsedType.number) { const expectedValues = util.objectValues(nativeEnumValues); addIssueToContext(ctx, { expected: util.joinValues(expectedValues), received: ctx.parsedType, code: ZodIssueCode.invalid_type }); return INVALID; } if (!__classPrivateFieldGet(this, _ZodNativeEnum_cache, "f")) { __classPrivateFieldSet(this, _ZodNativeEnum_cache, new Set(util.getValidEnumValues(this._def.values)), "f"); } if (!__classPrivateFieldGet(this, _ZodNativeEnum_cache, "f").has(input.data)) { const expectedValues = util.objectValues(nativeEnumValues); addIssueToContext(ctx, { received: ctx.data, code: ZodIssueCode.invalid_enum_value, options: expectedValues }); return INVALID; } return OK(input.data); } get enum() { return this._def.values; } }; _ZodNativeEnum_cache = /* @__PURE__ */ new WeakMap(); ZodNativeEnum.create = (values, params) => { return new ZodNativeEnum({ values, typeName: ZodFirstPartyTypeKind.ZodNativeEnum, ...processCreateParams(params) }); }; var ZodPromise = class extends ZodType { unwrap() { return this._def.type; } _parse(input) { const { ctx } = this._processInputParams(input); if (ctx.parsedType !== ZodParsedType.promise && ctx.common.async === false) { addIssueToContext(ctx, { code: ZodIssueCode.invalid_type, expected: ZodParsedType.promise, received: ctx.parsedType }); return INVALID; } const promisified = ctx.parsedType === ZodParsedType.promise ? ctx.data : Promise.resolve(ctx.data); return OK(promisified.then((data) => { return this._def.type.parseAsync(data, { path: ctx.path, errorMap: ctx.common.contextualErrorMap }); })); } }; ZodPromise.create = (schema, params) => { return new ZodPromise({ type: schema, typeName: ZodFirstPartyTypeKind.ZodPromise, ...processCreateParams(params) }); }; var ZodEffects = class extends ZodType { innerType() { return this._def.schema; } sourceType() { return this._def.schema._def.typeName === ZodFirstPartyTypeKind.ZodEffects ? this._def.schema.sourceType() : this._def.schema; } _parse(input) { const { status, ctx } = this._processInputParams(input); const effect2 = this._def.effect || null; const checkCtx = { addIssue: (arg) => { addIssueToContext(ctx, arg); if (arg.fatal) { status.abort(); } else { status.dirty(); } }, get path() { return ctx.path; } }; checkCtx.addIssue = checkCtx.addIssue.bind(checkCtx); if (effect2.type === "preprocess") { const processed = effect2.transform(ctx.data, checkCtx); if (ctx.common.async) { return Promise.resolve(processed).then(async (processed2) => { if (status.value === "aborted") return INVALID; const result = await this._def.schema._parseAsync({ data: processed2, path: ctx.path, parent: ctx }); if (result.status === "aborted") return INVALID; if (result.status === "dirty") return DIRTY2(result.value); if (status.value === "dirty") return DIRTY2(result.value); return result; }); } else { if (status.value === "aborted") return INVALID; const result = this._def.schema._parseSync({ data: processed, path: ctx.path, parent: ctx }); if (result.status === "aborted") return INVALID; if (result.status === "dirty") return DIRTY2(result.value); if (status.value === "dirty") return DIRTY2(result.value); return result; } } if (effect2.type === "refinement") { const executeRefinement = (acc) => { const result = effect2.refinement(acc, checkCtx); if (ctx.common.async) { return Promise.resolve(result); } if (result instanceof Promise) { throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead."); } return acc; }; if (ctx.common.async === false) { const inner = this._def.schema._parseSync({ data: ctx.data, path: ctx.path, parent: ctx }); if (inner.status === "aborted") return INVALID; if (inner.status === "dirty") status.dirty(); executeRefinement(inner.value); return { status: status.value, value: inner.value }; } else { return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((inner) => { if (inner.status === "aborted") return INVALID; if (inner.status === "dirty") status.dirty(); return executeRefinement(inner.value).then(() => { return { status: status.value, value: inner.value }; }); }); } } if (effect2.type === "transform") { if (ctx.common.async === false) { const base = this._def.schema._parseSync({ data: ctx.data, path: ctx.path, parent: ctx }); if (!isValid(base)) return base; const result = effect2.transform(base.value, checkCtx); if (result instanceof Promise) { throw new Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`); } return { status: status.value, value: result }; } else { return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((base) => { if (!isValid(base)) return base; return Promise.resolve(effect2.transform(base.value, checkCtx)).then((result) => ({ status: status.value, value: result })); }); } } util.assertNever(effect2); } }; ZodEffects.create = (schema, effect2, params) => { return new ZodEffects({ schema, typeName: ZodFirstPartyTypeKind.ZodEffects, effect: effect2, ...processCreateParams(params) }); }; ZodEffects.createWithPreprocess = (preprocess, schema, params) => { return new ZodEffects({ schema, effect: { type: "preprocess", transform: preprocess }, typeName: ZodFirstPartyTypeKind.ZodEffects, ...processCreateParams(params) }); }; var ZodOptional = class extends ZodType { _parse(input) { const parsedType = this._getType(input); if (parsedType === ZodParsedType.undefined) { return OK(void 0); } return this._def.innerType._parse(input); } unwrap() { return this._def.innerType; } }; ZodOptional.create = (type, params) => { return new ZodOptional({ innerType: type, typeName: ZodFirstPartyTypeKind.ZodOptional, ...processCreateParams(params) }); }; var ZodNullable = class extends ZodType { _parse(input) { const parsedType = this._getType(input); if (parsedType === ZodParsedType.null) { return OK(null); } return this._def.innerType._parse(input); } unwrap() { return this._def.innerType; } }; ZodNullable.create = (type, params) => { return new ZodNullable({ innerType: type, typeName: ZodFirstPartyTypeKind.ZodNullable, ...processCreateParams(params) }); }; var ZodDefault = class extends ZodType { _parse(input) { const { ctx } = this._processInputParams(input); let data = ctx.data; if (ctx.parsedType === ZodParsedType.undefined) { data = this._def.defaultValue(); } return this._def.innerType._parse({ data, path: ctx.path, parent: ctx }); } removeDefault() { return this._def.innerType; } }; ZodDefault.create = (type, params) => { return new ZodDefault({ innerType: type, typeName: ZodFirstPartyTypeKind.ZodDefault, defaultValue: typeof params.default === "function" ? params.default : () => params.default, ...processCreateParams(params) }); }; var ZodCatch = class extends ZodType { _parse(input) { const { ctx } = this._processInputParams(input); const newCtx = { ...ctx, common: { ...ctx.common, issues: [] } }; const result = this._def.innerType._parse({ data: newCtx.data, path: newCtx.path, parent: { ...newCtx } }); if (isAsync(result)) { return result.then((result2) => { return { status: "valid", value: result2.status === "valid" ? result2.value : this._def.catchValue({ get error() { return new ZodError(newCtx.common.issues); }, input: newCtx.data }) }; }); } else { return { status: "valid", value: result.status === "valid" ? result.value : this._def.catchValue({ get error() { return new ZodError(newCtx.common.issues); }, input: newCtx.data }) }; } } removeCatch() { return this._def.innerType; } }; ZodCatch.create = (type, params) => { return new ZodCatch({ innerType: type, typeName: ZodFirstPartyTypeKind.ZodCatch, catchValue: typeof params.catch === "function" ? params.catch : () => params.catch, ...processCreateParams(params) }); }; var ZodNaN = class extends ZodType { _parse(input) { const parsedType = this._getType(input); if (parsedType !== ZodParsedType.nan) { const ctx = this._getOrReturnCtx(input); addIssueToContext(ctx, { code: ZodIssueCode.invalid_type, expected: ZodParsedType.nan, received: ctx.parsedType }); return INVALID; } return { status: "valid", value: input.data }; } }; ZodNaN.create = (params) => { return new ZodNaN({ typeName: ZodFirstPartyTypeKind.ZodNaN, ...processCreateParams(params) }); }; var BRAND = /* @__PURE__ */ Symbol("zod_brand"); var ZodBranded = class extends ZodType { _parse(input) { const { ctx } = this._processInputParams(input); const data = ctx.data; return this._def.type._parse({ data, path: ctx.path, parent: ctx }); } unwrap() { return this._def.type; } }; var ZodPipeline = class _ZodPipeline extends ZodType { _parse(input) { const { status, ctx } = this._processInputParams(input); if (ctx.common.async) { const handleAsync = async () => { const inResult = await this._def.in._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }); if (inResult.status === "aborted") return INVALID; if (inResult.status === "dirty") { status.dirty(); return DIRTY2(inResult.value); } else { return this._def.out._parseAsync({ data: inResult.value, path: ctx.path, parent: ctx }); } }; return handleAsync(); } else { const inResult = this._def.in._parseSync({ data: ctx.data, path: ctx.path, parent: ctx }); if (inResult.status === "aborted") return INVALID; if (inResult.status === "dirty") { status.dirty(); return { status: "dirty", value: inResult.value }; } else { return this._def.out._parseSync({ data: inResult.value, path: ctx.path, parent: ctx }); } } } static create(a, b) { return new _ZodPipeline({ in: a, out: b, typeName: ZodFirstPartyTypeKind.ZodPipeline }); } }; var ZodReadonly = class extends ZodType { _parse(input) { const result = this._def.innerType._parse(input); const freeze = (data) => { if (isValid(data)) { data.value = Object.freeze(data.value); } return data; }; return isAsync(result) ? result.then((data) => freeze(data)) : freeze(result); } unwrap() { return this._def.innerType; } }; ZodReadonly.create = (type, params) => { return new ZodReadonly({ innerType: type, typeName: ZodFirstPartyTypeKind.ZodReadonly, ...processCreateParams(params) }); }; function custom(check, params = {}, fatal) { if (check) return ZodAny.create().superRefine((data, ctx) => { var _a5, _b3; if (!check(data)) { const p = typeof params === "function" ? params(data) : typeof params === "string" ? { message: params } : params; const _fatal = (_b3 = (_a5 = p.fatal) !== null && _a5 !== void 0 ? _a5 : fatal) !== null && _b3 !== void 0 ? _b3 : true; const p2 = typeof p === "string" ? { message: p } : p; ctx.addIssue({ code: "custom", ...p2, fatal: _fatal }); } }); return ZodAny.create(); } var late = { object: ZodObject.lazycreate }; var ZodFirstPartyTypeKind; (function(ZodFirstPartyTypeKind2) { ZodFirstPartyTypeKind2["ZodString"] = "ZodString"; ZodFirstPartyTypeKind2["ZodNumber"] = "ZodNumber"; ZodFirstPartyTypeKind2["ZodNaN"] = "ZodNaN"; ZodFirstPartyTypeKind2["ZodBigInt"] = "ZodBigInt"; ZodFirstPartyTypeKind2["ZodBoolean"] = "ZodBoolean"; ZodFirstPartyTypeKind2["ZodDate"] = "ZodDate"; ZodFirstPartyTypeKind2["ZodSymbol"] = "ZodSymbol"; ZodFirstPartyTypeKind2["ZodUndefined"] = "ZodUndefined"; ZodFirstPartyTypeKind2["ZodNull"] = "ZodNull"; ZodFirstPartyTypeKind2["ZodAny"] = "ZodAny"; ZodFirstPartyTypeKind2["ZodUnknown"] = "ZodUnknown"; ZodFirstPartyTypeKind2["ZodNever"] = "ZodNever"; ZodFirstPartyTypeKind2["ZodVoid"] = "ZodVoid"; ZodFirstPartyTypeKind2["ZodArray"] = "ZodArray"; ZodFirstPartyTypeKind2["ZodObject"] = "ZodObject"; ZodFirstPartyTypeKind2["ZodUnion"] = "ZodUnion"; ZodFirstPartyTypeKind2["ZodDiscriminatedUnion"] = "ZodDiscriminatedUnion"; ZodFirstPartyTypeKind2["ZodIntersection"] = "ZodIntersection"; ZodFirstPartyTypeKind2["ZodTuple"] = "ZodTuple"; ZodFirstPartyTypeKind2["ZodRecord"] = "ZodRecord"; ZodFirstPartyTypeKind2["ZodMap"] = "ZodMap"; ZodFirstPartyTypeKind2["ZodSet"] = "ZodSet"; ZodFirstPartyTypeKind2["ZodFunction"] = "ZodFunction"; ZodFirstPartyTypeKind2["ZodLazy"] = "ZodLazy"; ZodFirstPartyTypeKind2["ZodLiteral"] = "ZodLiteral"; ZodFirstPartyTypeKind2["ZodEnum"] = "ZodEnum"; ZodFirstPartyTypeKind2["ZodEffects"] = "ZodEffects"; ZodFirstPartyTypeKind2["ZodNativeEnum"] = "ZodNativeEnum"; ZodFirstPartyTypeKind2["ZodOptional"] = "ZodOptional"; ZodFirstPartyTypeKind2["ZodNullable"] = "ZodNullable"; ZodFirstPartyTypeKind2["ZodDefault"] = "ZodDefault"; ZodFirstPartyTypeKind2["ZodCatch"] = "ZodCatch"; ZodFirstPartyTypeKind2["ZodPromise"] = "ZodPromise"; ZodFirstPartyTypeKind2["ZodBranded"] = "ZodBranded"; ZodFirstPartyTypeKind2["ZodPipeline"] = "ZodPipeline"; ZodFirstPartyTypeKind2["ZodReadonly"] = "ZodReadonly"; })(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {})); var instanceOfType = (cls, params = { message: `Input not instance of ${cls.name}` }) => custom((data) => data instanceof cls, params); var stringType = ZodString.create; var numberType = ZodNumber.create; var nanType = ZodNaN.create; var bigIntType = ZodBigInt.create; var booleanType = ZodBoolean.create; var dateType = ZodDate.create; var symbolType = ZodSymbol.create; var undefinedType = ZodUndefined.create; var nullType = ZodNull.create; var anyType = ZodAny.create; var unknownType = ZodUnknown.create; var neverType = ZodNever.create; var voidType = ZodVoid.create; var arrayType = ZodArray.create; var objectType = ZodObject.create; var strictObjectType = ZodObject.strictCreate; var unionType = ZodUnion.create; var discriminatedUnionType = ZodDiscriminatedUnion.create; var intersectionType = ZodIntersection.create; var tupleType = ZodTuple.create; var recordType = ZodRecord.create; var mapType = ZodMap.create; var setType = ZodSet.create; var functionType = ZodFunction.create; var lazyType = ZodLazy.create; var literalType = ZodLiteral.create; var enumType = ZodEnum.create; var nativeEnumType = ZodNativeEnum.create; var promiseType = ZodPromise.create; var effectsType = ZodEffects.create; var optionalType = ZodOptional.create; var nullableType = ZodNullable.create; var preprocessType = ZodEffects.createWithPreprocess; var pipelineType = ZodPipeline.create; var ostring = () => stringType().optional(); var onumber = () => numberType().optional(); var oboolean = () => booleanType().optional(); var coerce = { string: ((arg) => ZodString.create({ ...arg, coerce: true })), number: ((arg) => ZodNumber.create({ ...arg, coerce: true })), boolean: ((arg) => ZodBoolean.create({ ...arg, coerce: true })), bigint: ((arg) => ZodBigInt.create({ ...arg, coerce: true })), date: ((arg) => ZodDate.create({ ...arg, coerce: true })) }; var NEVER = INVALID; var z = /* @__PURE__ */ Object.freeze({ __proto__: null, defaultErrorMap: errorMap, setErrorMap, getErrorMap, makeIssue, EMPTY_PATH, addIssueToContext, ParseStatus, INVALID, DIRTY: DIRTY2, OK, isAborted, isDirty, isValid, isAsync, get util() { return util; }, get objectUtil() { return objectUtil; }, ZodParsedType, getParsedType, ZodType, datetimeRegex, ZodString, ZodNumber, ZodBigInt, ZodBoolean, ZodDate, ZodSymbol, ZodUndefined, ZodNull, ZodAny, ZodUnknown, ZodNever, ZodVoid, ZodArray, ZodObject, ZodUnion, ZodDiscriminatedUnion, ZodIntersection, ZodTuple, ZodRecord, ZodMap, ZodSet, ZodFunction, ZodLazy, ZodLiteral, ZodEnum, ZodNativeEnum, ZodPromise, ZodEffects, ZodTransformer: ZodEffects, ZodOptional, ZodNullable, ZodDefault, ZodCatch, ZodNaN, BRAND, ZodBranded, ZodPipeline, ZodReadonly, custom, Schema: ZodType, ZodSchema: ZodType, late, get ZodFirstPartyTypeKind() { return ZodFirstPartyTypeKind; }, coerce, any: anyType, array: arrayType, bigint: bigIntType, boolean: booleanType, date: dateType, discriminatedUnion: discriminatedUnionType, effect: effectsType, "enum": enumType, "function": functionType, "instanceof": instanceOfType, intersection: intersectionType, lazy: lazyType, literal: literalType, map: mapType, nan: nanType, nativeEnum: nativeEnumType, never: neverType, "null": nullType, nullable: nullableType, number: numberType, object: objectType, oboolean, onumber, optional: optionalType, ostring, pipeline: pipelineType, preprocess: preprocessType, promise: promiseType, record: recordType, set: setType, strictObject: strictObjectType, string: stringType, symbol: symbolType, transformer: effectsType, tuple: tupleType, "undefined": undefinedType, union: unionType, unknown: unknownType, "void": voidType, NEVER, ZodIssueCode, quotelessJson, ZodError }); // src/ui/tasks/task.ts var import_sha256 = __toESM(require_sha256()); // src/parsing/tags/tags.ts function getTagsFromContent(content) { const tags = /* @__PURE__ */ new Set(); const matches = content.matchAll(tagsRegex); for (const match of matches) { if (match[1] && tagNonNumericTest.test(match[1])) { tags.add(match[1]); } } return tags; } function isValidTag(tag2) { return /^[-_/\p{L}\p{N}]+$/u.test(tag2); } var tagsRegex = /#([-_/\p{L}\p{N}]+)/gu; var tagNonNumericTest = /\p{L}/u; // src/ui/tasks/task.ts var DEFAULT_DONE_STATUS_MARKERS = "xX"; var DEFAULT_IGNORED_STATUS_MARKERS = ""; var DEFAULT_CANCELLED_STATUS_MARKERS = "-"; function validateStatusMarkers(markers) { const errors = []; const chars = Array.from(markers); const seen = /* @__PURE__ */ new Set(); for (let i = 0; i < chars.length; i++) { const char = chars[i]; if (!char) continue; if (seen.has(char)) { errors.push(`Duplicate marker '${char}' at position ${i + 1}`); continue; } seen.add(char); if (/\s/.test(char)) { errors.push(`Marker at position ${i + 1} is whitespace`); } if (char.charCodeAt(0) < 32 || char.charCodeAt(0) === 127) { errors.push(`Marker at position ${i + 1} is a control character`); } } return errors; } function validateTypedStatusMarkers(markers, label, allowEmpty) { if (!markers || markers.length === 0) { return allowEmpty ? [] : [`${label} status markers cannot be empty`]; } return validateStatusMarkers(markers); } function validateDoneStatusMarkers(markers) { return validateTypedStatusMarkers(markers, "Done", false); } function validateIgnoredStatusMarkers(markers) { return validateTypedStatusMarkers(markers, "Ignored", true); } function validateCancelledStatusMarkers(markers) { return validateTypedStatusMarkers(markers, "Cancelled", false); } function validateStatusMarkerOrder(markers) { const errors = []; const chars = Array.from(markers); const seen = /* @__PURE__ */ new Set(); for (let i = 0; i < chars.length; i++) { const char = chars[i]; if (char !== " " && /\s/.test(char)) { errors.push(`Marker at position ${i + 1} is whitespace`); } if (seen.has(char)) { errors.push(`Duplicate marker '${char}' at position ${i + 1}`); } seen.add(char); } return errors; } function isStatusMatch(statusContent, markers) { if (!statusContent || !markers) return false; const contentChars = Array.from(statusContent); const markersChars = Array.from(markers); if (contentChars.length !== 1) { return false; } const singleChar = contentChars[0]; if (!singleChar) return false; return markersChars.includes(singleChar); } function getNextStatusMarker(currentStatus, doneStatusMarkers, statusMarkerOrder) { var _a5; if (isStatusMatch(currentStatus, doneStatusMarkers)) { return { status: " ", done: false }; } const orderedMarkers = getOrderedStatusMarkers(statusMarkerOrder); const currentIndex = orderedMarkers.indexOf(currentStatus); const nextMarker = currentIndex >= 0 ? orderedMarkers[currentIndex + 1] : void 0; if (!nextMarker || isStatusMatch(nextMarker, doneStatusMarkers)) { return { status: (_a5 = Array.from(doneStatusMarkers)[0]) != null ? _a5 : "x", done: true }; } return { status: nextMarker, done: false }; } var Task = class { constructor(rawContent, fileHandle, rowIndex, context, sourceChildren = []) { this.rowIndex = rowIndex; this._deleted = false; var _a5, _b3; const [, blockLink] = (_a5 = rawContent.match(blockLinkRegexp)) != null ? _a5 : []; this.blockLink = blockLink; const match = (blockLink ? rawContent.replace(blockLinkRegexp, "") : rawContent).match(taskStringRegex); if (!match) { throw new Error( "Attempted to create a task from invalid raw content" ); } const [, indentation, status, content] = match; if (!content) { throw new Error("Content not found in raw content"); } this.sourceChildren = sourceChildren; const tags = getTagsFromContent(content); this._id = (0, import_sha256.default)(content + fileHandle.path + rowIndex).toString(); this.content = content; this._displayStatus = status || " "; this._done = isStatusMatch(this._displayStatus, context.doneStatusMarkers); this._path = fileHandle.path; this._indentation = indentation || ""; this.properties = context.propertySchema.parseProperties(rawContent); this.propertySchemaOption = context.propertySchema.id; const priorityMatches = getTaskPriorityMatchValues(rawContent); const matchedColumn = resolveMatchedColumnDefinition(context.columnDefinitions, { tags, status: this._displayStatus, priority: getTaskPriorityMatchValue(this.propertySchemaOption, this.properties), prioritySchema: this.propertySchemaOption === "tasks" /* TasksPlugin */ ? "tasks" /* TasksPlugin */ : this.propertySchemaOption === "dataview" /* Dataview */ ? "dataview" /* Dataview */ : void 0, priorities: priorityMatches }); for (const tag2 of tags) { if (tag2 === "done") { if (!this._column) { this._column = "done"; } tags.delete(tag2); if (!context.consolidateTags) { this.content = this.stripTagFromContent(this.content, tag2); } continue; } if (matchedColumn && isPlacementTag(matchedColumn, tag2)) { if (!this._column) { this._column = matchedColumn.id; } tags.delete(tag2); if (!context.consolidateTags) { this.content = this.stripTagFromContent(this.content, tag2); } } if (context.consolidateTags) { this.content = this.stripTagFromContent(this.content, tag2); } } if (matchedColumn && usesStatusMatching(matchedColumn) && !this._column) { this._column = matchedColumn.id; } if (matchedColumn && usesPriorityMatching(matchedColumn) && !this._column) { this._column = matchedColumn.id; } this._tags = tags; this.blockLink = blockLink; this.consolidateTags = context.consolidateTags; this.sourceColumnDefinitions = context.columnDefinitions; this.columnDefinitions = (_b3 = context.columnWriteDefinitions) != null ? _b3 : context.columnDefinitions; this.columnPlacementTagTable = context.columnPlacementTagTable; this.doneStatusMarkers = context.doneStatusMarkers; this.cancelledStatusMarkers = context.cancelledStatusMarkers; this.ignoredStatusMarkers = context.ignoredStatusMarkers; if (this._done) { this._column = void 0; } } get id() { return this._id; } get done() { return this._done; } set done(done) { var _a5; this._done = done; this._column = void 0; this._displayStatus = (_a5 = Array.from(this.doneStatusMarkers)[0]) != null ? _a5 : "x"; } get isCancelled() { return isStatusMatch(this._displayStatus, this.cancelledStatusMarkers); } undone() { this._done = false; this._displayStatus = " "; } cycleStatus(statusMarkerOrder) { const next2 = getNextStatusMarker( this._displayStatus, this.doneStatusMarkers, statusMarkerOrder ); if (next2.done) { this.done = true; return true; } this._done = false; this._displayStatus = next2.status; return false; } get displayStatus() { return this._displayStatus; } get path() { return this._path; } get indentation() { return this._indentation; } get column() { return this._column; } set column(column) { if (column === "done") { this.done = true; return; } const wasDone = this._done; if (column === "uncategorised") { this.moveToUncategorised(); if (wasDone) { this._displayStatus = " "; } return; } this._done = false; if (wasDone) { this._displayStatus = " "; } this.moveToColumn(column); } get tags() { return this._tags; } getPlacementTagsForColumn(column) { var _a5; return ((_a5 = this.columnPlacementTagTable[column]) != null ? _a5 : []).filter((tag2) => isValidTag(tag2)); } getCurrentPlacementTags() { if (!this.column || this.column === "archived" || this.column === "done" || this.column === "uncategorised") { return []; } return this.getPlacementTagsForColumn(this.column); } getColumnDefinition(column, definitions = this.columnDefinitions) { if (!column) return void 0; return definitions.find((definition) => definition.id === column); } moveToColumn(column) { const sourceColumn = this.getColumnDefinition( this._column && this._column !== "archived" && this._column !== "done" && this._column !== "uncategorised" ? this._column : void 0, this.sourceColumnDefinitions ); const destinationColumn = this.getColumnDefinition(column); if (sourceColumn && usesStatusMatching(sourceColumn)) { this._displayStatus = " "; } const sourcePrioritySchema = getColumnPrioritySchema(sourceColumn); if (sourceColumn && sourcePrioritySchema) { this.removePriorityPlacement(sourcePrioritySchema); } const destinationStatus = destinationColumn ? getColumnStatus(destinationColumn) : void 0; if (destinationStatus) { this._displayStatus = destinationStatus; } const destinationPriority = getColumnPriority(destinationColumn); if (destinationPriority && destinationColumn) { this.writePriorityPlacement(destinationPriority, getColumnPrioritySchema(destinationColumn)); } this._column = column; } moveToUncategorised() { const sourceColumn = this.getColumnDefinition( this._column && this._column !== "archived" && this._column !== "done" && this._column !== "uncategorised" ? this._column : void 0, this.sourceColumnDefinitions ); if (sourceColumn && usesStatusMatching(sourceColumn)) { this._displayStatus = " "; } const sourcePrioritySchema = getColumnPrioritySchema(sourceColumn); if (sourceColumn && sourcePrioritySchema) { this.removePriorityPlacement(sourcePrioritySchema); } this._column = void 0; this._done = false; } stripTagFromContent(value, tag2) { const escapedTag = escapeRegExp2(tag2); return value.replace(new RegExp(`(^|\\s)#${escapedTag}(?=$|\\s|[^-_/\\p{L}\\p{N}])`, "gu"), "$1").replace(/[ \t]{2,}/g, " ").trim(); } replaceTag(oldTag, newTag) { if (oldTag) { this._tags.delete(oldTag); this.content = this.stripTagFromContent(this.content, oldTag); } if (newTag) { this._tags.add(newTag); const contentTags = Array.from(getTagsFromContent(this.content)).map((tag2) => tag2.toLowerCase()); if (!this.consolidateTags && !contentTags.includes(newTag.toLowerCase())) { this.content = `${this.content.trim()} #${newTag}`.trim(); } } } stripPlacementTags(value, placementTags) { return placementTags.reduce((nextValue, tag2) => this.stripTagFromContent(nextValue, tag2), value); } transformContentWithPropertyWriter(transform) { const rawLine = `- [ ] ${this.content.trim()}`; const transformed = transform(rawLine); const match = transformed.match(taskStringRegex); if (match == null ? void 0 : match[3]) { this.content = match[3]; } } removePriorityPlacement(schema = getPriorityColumnContextSchema(this.propertySchemaOption)) { if (!schema) return; const adapter = getPropertyWriteAdapter(schema); if (!adapter) return; this.transformContentWithPropertyWriter((rawLine) => adapter.removePriority(rawLine)); } writePriorityPlacement(priority, schema = getPriorityColumnContextSchema(this.propertySchemaOption)) { if (!schema) return; const adapter = getPropertyWriteAdapter(schema); if (!adapter) return; this.transformContentWithPropertyWriter((rawLine) => adapter.upsertPriority(rawLine, priority)); } serialise() { if (this._deleted) { return ""; } const placementTags = this.getCurrentPlacementTags(); const currentColumnDefinition = this.getColumnDefinition( this.column && this.column !== "archived" && this.column !== "done" && this.column !== "uncategorised" ? this.column : void 0 ); const usesStatusPlacement = !!currentColumnDefinition && usesStatusMatching(currentColumnDefinition); const usesPriorityPlacement = !!currentColumnDefinition && usesPriorityMatching(currentColumnDefinition); const serialisedContent = placementTags.length > 0 ? this.stripPlacementTags(this.content.trim(), placementTags) : this.content.trim(); const serialisedTags = this.consolidateTags ? Array.from(this.tags).filter((tag2) => !placementTags.includes(tag2)) : []; return [ this.indentation, `- [${this._displayStatus}] `, serialisedContent, this.consolidateTags && serialisedTags.length > 0 ? ` ${serialisedTags.map((tag2) => `#${tag2}`).join(" ")}` : "", this.column ? this.column === "archived" ? ` #${this.column}` : usesStatusPlacement || usesPriorityPlacement ? "" : placementTags.length > 0 ? ` ${placementTags.map((tag2) => `#${tag2}`).join(" ")}` : ` #${this.column}` : "", this.blockLink ? ` ^${this.blockLink}` : "" ].join("").trimEnd(); } get sourceBlockLineCount() { return 1 + flattenSourceBlockNodes(this.sourceChildren).length; } sourceBlockRows(serializedParent = this.serialise()) { return [ serializedParent, ...flattenSourceBlockNodes(this.sourceChildren).map((node) => node.rawLine) ]; } updateSourceBlockRowContent(rowIndex, content) { const node = this.findSourceBlockNode(rowIndex); if (!node) { return null; } if (node.kind === "raw") { if (content === "") { return ""; } const rawListItemMatch = node.rawLine.slice(node.indentation.length).match(/^([-*+]\s+)(.+)$/); if (rawListItemMatch && !/^[-*+]\s+/.test(content)) { return `${node.indentation}${rawListItemMatch[1]}${content}`; } return `${node.indentation}${content}`; } const parsed = parseSourceTaskLine(node.rawLine); if (!parsed) { return null; } return `${parsed.indentation}${parsed.bullet} [${parsed.status}] ${content}`; } cycleSourceTaskRowStatus(rowIndex, statusMarkerOrder) { const node = this.findSourceBlockNode(rowIndex); if (!node || node.kind !== "task") { return null; } const parsed = parseSourceTaskLine(node.rawLine); if (!parsed) { return null; } const next2 = getNextStatusMarker( parsed.status || " ", this.doneStatusMarkers, statusMarkerOrder ); return `${parsed.indentation}${parsed.bullet} [${next2.status}] ${parsed.content}`; } isSourceTaskStatusDone(status) { return isStatusMatch(status, this.doneStatusMarkers); } findSourceBlockNode(rowIndex) { var _a5; return (_a5 = flattenSourceBlockNodes(this.sourceChildren).find((node) => node.rowIndex === rowIndex)) != null ? _a5 : null; } serialiseForColumn(column) { const originalColumn = this._column; const originalDone = this._done; const originalDisplayStatus = this._displayStatus; const originalContent = this.content; if (column === "done") { this.done = true; } else if (column === "uncategorised") { this.moveToUncategorised(); } else { this.column = column; } try { return this.serialise(); } finally { this._column = originalColumn; this._done = originalDone; this._displayStatus = originalDisplayStatus; this.content = originalContent; } } archive() { const sourceColumn = this.getColumnDefinition( this._column && this._column !== "archived" && this._column !== "done" && this._column !== "uncategorised" ? this._column : void 0, this.sourceColumnDefinitions ); const sourcePrioritySchema = getColumnPrioritySchema(sourceColumn); if (sourceColumn && sourcePrioritySchema) { this.removePriorityPlacement(sourcePrioritySchema); } if (!this._done) { this._displayStatus = "x"; } this._done = true; this._column = "archived"; } cancel() { var _a5; this._displayStatus = (_a5 = Array.from(this.cancelledStatusMarkers)[0]) != null ? _a5 : "-"; } restore() { this._displayStatus = " "; } delete() { this._deleted = true; } }; function isTrackedTaskString(input, ignoredStatusMarkers = DEFAULT_IGNORED_STATUS_MARKERS) { if (input.includes("#archived")) { return false; } const parsed = parseSourceTaskLine(input); if (!parsed) { return false; } if (isStatusMatch(parsed.status, ignoredStatusMarkers)) { return false; } return true; } var taskStringRegex = /^(\s*)[-*+]\s\[([^\[\]]*)\]\s(.+)/; var blockLinkRegexp = /\s\^([a-zA-Z0-9-]+)$/; function escapeRegExp2(input) { return input.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); } function getTaskPriorityMatchValue(propertySchemaOption, properties) { const priority = properties.get("priority"); if (propertySchemaOption === "tasks" /* TasksPlugin */ && typeof (priority == null ? void 0 : priority.value) === "number") { return getTasksPriorityValueFromWeight(priority.value); } if (propertySchemaOption === "dataview" /* Dataview */ && typeof (priority == null ? void 0 : priority.value) === "string") { return priority.value.trim(); } return void 0; } function getPriorityColumnContextSchema(propertySchemaOption) { return propertySchemaOption === "tasks" /* TasksPlugin */ || propertySchemaOption === "dataview" /* Dataview */ ? propertySchemaOption : void 0; } function getTaskPriorityMatchValues(rawLine) { return { ["tasks" /* TasksPlugin */]: getTaskPriorityMatchValue( "tasks" /* TasksPlugin */, getSchemaImpl("tasks" /* TasksPlugin */).parseProperties(rawLine) ), ["dataview" /* Dataview */]: getTaskPriorityMatchValue( "dataview" /* Dataview */, getSchemaImpl("dataview" /* Dataview */).parseProperties(rawLine) ) }; } // src/ui/tasks/task_grouping.ts var DEFAULT_GROUP_BUCKET_ID = "__default__"; function deriveGroupBuckets(tasks, source2, excludedTags = [], statusMarkerOrder = "", doneStatusMarkers = "", groupDirection = "asc") { var _a5; if (source2.kind === "file") { const paths = [...new Set(tasks.map((task) => task.path))].sort( (a, b) => a.localeCompare(b) ); if (paths.length === 0) { return [ { id: DEFAULT_GROUP_BUCKET_ID, label: "No files", value: null, source: source2, isDefault: true } ]; } const buckets = paths.map((path) => ({ id: createFileGroupBucketId(path), label: path, value: path, source: source2, isDefault: false })); return applyGroupDirection(buckets, groupDirection); } if (source2.kind === "tag-prefix") { const prefix = normalizeTagPrefix(source2.prefix); const excludeSet = createNormalizedTagSet(excludedTags); const tagMap = /* @__PURE__ */ new Map(); for (const task of tasks) { for (const tag2 of task.tags) { if (isTagExcluded(tag2, excludeSet)) continue; if (prefix) { if (tag2.toLowerCase().startsWith(prefix)) { const suffix = tag2.slice(prefix.length); const key2 = suffix.toLowerCase(); if (suffix && !tagMap.has(key2)) { tagMap.set(key2, tag2); } } } else { const key2 = tag2.toLowerCase(); if (!tagMap.has(key2)) { tagMap.set(key2, tag2); } } } } const sortedFullTags = Array.from(tagMap.entries()).sort((a, b) => a[0].localeCompare(b[0])).map((entry) => entry[1]); const buckets = sortedFullTags.map((fullTag) => { const label = prefix ? fullTag.slice(prefix.length) : fullTag; return { id: createTagPrefixGroupBucketId(prefix, label.toLowerCase()), label, value: fullTag, source: { kind: "tag-prefix", prefix }, isDefault: false }; }); buckets.push({ id: createTagPrefixUnassignedGroupBucketId(prefix), label: "Unassigned", value: null, source: { kind: "tag-prefix", prefix }, isDefault: true }); return applyGroupDirection(buckets, groupDirection); } if (source2.kind === "property") { const valueMap = /* @__PURE__ */ new Map(); let hasMissingValue = false; for (const task of tasks) { const property = task.properties.get(source2.key); const value = (_a5 = property == null ? void 0 : property.value) != null ? _a5 : null; if (value === null) { hasMissingValue = true; continue; } const key2 = propertyValueKey(value); if (!valueMap.has(key2)) { valueMap.set(key2, { value, label: property ? formatPropertyGroupLabel(property) : formatPropertyValueLabel(value) }); } } const buckets = Array.from(valueMap.values()).sort((a, b) => comparePropertyGroupValues( source2.key, a.value, b.value, statusMarkerOrder, doneStatusMarkers )).map((entry) => ({ id: createPropertyGroupBucketId(source2.key, entry.value), label: entry.label, value: entry.value, source: source2, isDefault: false })); if (hasMissingValue || buckets.length === 0) { buckets.push({ id: createPropertyMissingGroupBucketId(source2.key), label: "Unassigned", value: null, source: source2, isDefault: true }); } return applyGroupDirection(buckets, groupDirection); } return [ { id: DEFAULT_GROUP_BUCKET_ID, label: "Default", value: null, source: source2, isDefault: true } ]; } function applyGroupDirection(buckets, groupDirection) { return groupDirection === "desc" ? [...buckets].reverse() : buckets; } function getTaskTagGroupValue(task, source2, excludedTags = []) { return resolveTaskGroupTag(task, normalizeTagPrefix(source2.prefix), createNormalizedTagSet(excludedTags)); } function resolveTaskGroupTag(task, prefix, excludeSet) { var _a5; const candidateTags = Array.from(task.tags).filter((tag2) => !isTagExcluded(tag2, excludeSet)).filter((tag2) => { if (!prefix) return true; return tag2.toLowerCase().startsWith(prefix) && tag2.slice(prefix.length).length > 0; }); return (_a5 = candidateTags.sort((a, b) => a.toLowerCase().localeCompare(b.toLowerCase()))[0]) != null ? _a5 : null; } function createGroupAssigner(buckets, source2, excludedTags = []) { var _a5; const defaultBucketId = (_a5 = buckets.find((bucket) => bucket.isDefault)) == null ? void 0 : _a5.id; if (source2.kind === "tag-prefix") { const prefix = normalizeTagPrefix(source2.prefix); const excludeSet = createNormalizedTagSet(excludedTags); const idByValue = /* @__PURE__ */ new Map(); for (const bucket of buckets) { if (!bucket.isDefault && typeof bucket.value === "string") { idByValue.set(bucket.value.toLowerCase(), bucket.id); } } return (task) => { var _a6; const groupTag = resolveTaskGroupTag(task, prefix, excludeSet); if (groupTag === null) return defaultBucketId; return (_a6 = idByValue.get(groupTag.toLowerCase())) != null ? _a6 : defaultBucketId; }; } if (source2.kind === "file") { const idByPath = /* @__PURE__ */ new Map(); for (const bucket of buckets) { if (typeof bucket.value === "string") idByPath.set(bucket.value, bucket.id); } return (task) => { var _a6; return (_a6 = idByPath.get(task.path)) != null ? _a6 : defaultBucketId; }; } if (source2.kind === "property") { const idByValue = /* @__PURE__ */ new Map(); for (const bucket of buckets) { if (!bucket.isDefault && bucket.value !== null) { idByValue.set(propertyValueKey(bucket.value), bucket.id); } } return (task) => { var _a6, _b3, _c2; const value = (_b3 = (_a6 = task.properties.get(source2.key)) == null ? void 0 : _a6.value) != null ? _b3 : null; if (value === null) return defaultBucketId; return (_c2 = idByValue.get(propertyValueKey(value))) != null ? _c2 : defaultBucketId; }; } return () => defaultBucketId; } function createFileGroupBucketId(path) { return `file:${path}`; } function createTagPrefixGroupBucketId(prefix, label) { return `tag-prefix:${prefix}:${label}`; } function createTagPrefixUnassignedGroupBucketId(prefix) { return createTagPrefixGroupBucketId(prefix, "__unassigned__"); } function createPropertyGroupBucketId(key2, value) { return `property:${key2}:${propertyValueKey(value)}`; } function createPropertyMissingGroupBucketId(key2) { return `property:${key2}:__missing__`; } function propertyValueKey(value) { if (value instanceof Date) { return `date:${value.getTime()}`; } return `${typeof value}:${String(value).toLowerCase()}`; } function comparePropertyGroupValues(key2, a, b, statusMarkerOrder, doneStatusMarkers) { if (key2 === "priority") { return comparePriorityGroupValues(a, b); } if (key2 === UNIVERSAL_STATUS_PROPERTY_KEY) { return compareStatusMarkerValues(a, b, statusMarkerOrder, doneStatusMarkers); } return compareValues(a, b); } function comparePriorityGroupValues(a, b) { const aRank = priorityRank(a); const bRank = priorityRank(b); if (aRank !== null && bRank !== null && aRank !== bRank) { return bRank - aRank; } if (aRank !== null && bRank === null) return -1; if (aRank === null && bRank !== null) return 1; return compareValues(a, b); } function priorityRank(value) { if (typeof value === "number") { return value; } if (typeof value !== "string") { return null; } switch (value.trim().toLowerCase()) { case "highest": return 5; case "high": return 4; case "medium": return 3; case "low": return 2; case "lowest": return 1; default: return null; } } function formatPropertyGroupLabel(property) { if (property.key === "priority") { if (typeof property.value === "number") { return property.rawValue || formatPropertyValueLabel(property.value); } if (property.value !== null) { return String(property.value); } return property.rawValue; } return property.value === null ? property.rawValue : formatPropertyValueLabel(property.value); } function formatPropertyValueLabel(value) { if (value instanceof Date) { return value.toISOString().slice(0, 10); } return String(value); } function normalizeTagPrefix(prefix) { var _a5; return (_a5 = prefix == null ? void 0 : prefix.trim().replace(/^#/, "").toLowerCase()) != null ? _a5 : ""; } function createNormalizedTagSet(tags) { return new Set(tags.map((tag2) => tag2.trim().replace(/^#/, "").toLowerCase()).filter(Boolean)); } function isTagExcluded(tag2, excludeSet) { return excludeSet.has(tag2.toLowerCase()); } // src/ui/settings/settings_store.ts var VisibilityOption = /* @__PURE__ */ ((VisibilityOption2) => { VisibilityOption2["Auto"] = "auto"; VisibilityOption2["NeverShow"] = "never"; VisibilityOption2["AlwaysShow"] = "always"; return VisibilityOption2; })(VisibilityOption || {}); var ScopeOption = /* @__PURE__ */ ((ScopeOption2) => { ScopeOption2["Folder"] = "folder"; ScopeOption2["Everywhere"] = "everywhere"; ScopeOption2["SelectedFolders"] = "selectedFolders"; return ScopeOption2; })(ScopeOption || {}); var FlowDirection = /* @__PURE__ */ ((FlowDirection2) => { FlowDirection2["LeftToRight"] = "ltr"; FlowDirection2["RightToLeft"] = "rtl"; FlowDirection2["TopToBottom"] = "ttb"; FlowDirection2["BottomToTop"] = "btt"; return FlowDirection2; })(FlowDirection || {}); var PropertyDisplayMode = /* @__PURE__ */ ((PropertyDisplayMode2) => { PropertyDisplayMode2["None"] = "none"; PropertyDisplayMode2["Pretty"] = "pretty"; PropertyDisplayMode2["Debug"] = "debug"; return PropertyDisplayMode2; })(PropertyDisplayMode || {}); var contentValueSchema = z.object({ text: z.string() }); var tagValueSchema = z.object({ tags: z.array(z.string()) }); var fileValueSchema = z.object({ filepaths: z.array(z.string()) }); var savedFilterSchema = z.object({ id: z.string(), content: contentValueSchema.optional(), tag: tagValueSchema.optional(), file: fileValueSchema.optional() }); var groupSourceSchema = z.union([ z.object({ kind: z.literal("none") }), z.object({ kind: z.literal("file") }), z.object({ kind: z.literal("tag-prefix"), prefix: z.string().optional() }), z.object({ kind: z.literal("property"), key: z.string() }) ]).catch({ kind: "none" }); var savedGroupingSchema = z.object({ id: z.string(), name: z.string(), source: groupSourceSchema }); var columnDefinitionSchema = z.object({ id: z.string(), label: z.string(), color: z.string().optional(), matchMode: z.enum(["name", "tags", "status", "priority"]).default("name"), matchTags: z.array(z.string()).default([]), matchStatus: z.string().optional(), matchPriority: z.string().optional(), matchPropertySchema: z.enum(["tasks" /* TasksPlugin */, "dataview" /* Dataview */]).optional() }); var manualOrderEntriesSchema = z.array(z.string()); var manualOrderCellSchema = z.record(z.string(), manualOrderEntriesSchema); var manualOrderSchema = z.preprocess((value) => { if (!value || typeof value !== "object" || Array.isArray(value)) { return {}; } const record = value; const hasFlatEntries = Object.values(record).some((entry) => Array.isArray(entry)); if (hasFlatEntries) { const migrated = {}; for (const [columnTag, entries] of Object.entries(record)) { if (Array.isArray(entries)) { migrated[columnTag] = entries; } } return { [DEFAULT_GROUP_BUCKET_ID]: migrated }; } return value; }, z.record(z.string(), manualOrderCellSchema)); var settingsObject = z.object({ columns: z.array(z.union([z.string(), columnDefinitionSchema])), scope: z.nativeEnum(ScopeOption).catch("folder" /* Folder */), showFilepath: z.boolean().default(true).optional(), consolidateTags: z.boolean().default(false).optional(), uncategorizedVisibility: z.nativeEnum(VisibilityOption).catch("auto" /* Auto */).optional(), doneVisibility: z.nativeEnum(VisibilityOption).catch("always" /* AlwaysShow */).optional(), doneStatusMarkers: z.string().default(DEFAULT_DONE_STATUS_MARKERS).optional(), cancelledStatusMarkers: z.string().default(DEFAULT_CANCELLED_STATUS_MARKERS).optional(), ignoredStatusMarkers: z.string().default(DEFAULT_IGNORED_STATUS_MARKERS).optional(), statusMarkerOrder: z.string().default("").optional(), savedFilters: z.array(savedFilterSchema).default([]).optional(), savedGroupings: z.array(savedGroupingSchema).default([]).optional(), lastContentFilter: z.string().optional(), lastTagFilter: z.array(z.string()).optional(), lastFileFilter: z.array(z.string()).optional(), filtersExpanded: z.boolean().default(true).optional(), filtersSidebarExpanded: z.boolean().default(true).optional(), filtersSidebarWidth: z.number().default(280).optional(), columnWidth: z.number().min(200).max(600).catch(300).optional(), flowDirection: z.nativeEnum(FlowDirection).catch("ltr" /* LeftToRight */).optional(), collapsedColumns: z.array(z.string()).default([]).optional(), defaultTaskFile: z.string().default("").optional(), lastUsedTaskFile: z.string().default("").optional(), scopeFolders: z.array(z.string()).default([]).optional(), excludePaths: z.array(z.string()).default([]).optional(), excludedTags: z.array(z.string()).default([]).optional(), excludedTaskTags: z.array(z.string()).default([]).optional(), uncategorizedColumnName: z.string().default("Uncategorized").optional(), doneColumnName: z.string().default("Done").optional(), groupSource: groupSourceSchema.default({ kind: "none" }).optional(), propertySchema: z.nativeEnum(PropertySchemaOption).catch("none" /* None */).optional(), propertyDisplay: z.nativeEnum(PropertyDisplayMode).catch("none" /* None */).optional(), treatNestedTasksAsSubtasks: z.boolean().default(false).optional(), columnOrderMode: z.nativeEnum(ColumnOrderMode).catch("file" /* FileOrder */).optional(), sortProperty: z.string().nullable().default(null).optional(), sortDirection: z.enum(["asc", "desc"]).catch("asc").optional(), groupDirection: z.enum(["asc", "desc"]).catch("asc").optional(), // Cell-local manual ordering: group bucket id -> column id -> `path::blockLink`. // Stored alongside display settings in the board's frontmatter (the plugin has // no separate data file), but kept as its own field so it is never conflated // with display configuration. Legacy column-local records are migrated under // the default group bucket id at parse time. manualOrder: manualOrderSchema.default({}).optional() }); var defaultSettings = { columns: createDefaultColumns(["Later", "Soonish", "Next week", "This week", "Today", "Pending"]), scope: "folder" /* Folder */, showFilepath: true, consolidateTags: false, uncategorizedVisibility: "auto" /* Auto */, doneVisibility: "always" /* AlwaysShow */, doneStatusMarkers: DEFAULT_DONE_STATUS_MARKERS, cancelledStatusMarkers: DEFAULT_CANCELLED_STATUS_MARKERS, ignoredStatusMarkers: DEFAULT_IGNORED_STATUS_MARKERS, statusMarkerOrder: "", savedFilters: [], lastContentFilter: "", lastTagFilter: [], lastFileFilter: [], columnWidth: 300, flowDirection: "ltr" /* LeftToRight */, collapsedColumns: [], defaultTaskFile: "", lastUsedTaskFile: "", scopeFolders: [], excludePaths: [], excludedTags: [], excludedTaskTags: [], uncategorizedColumnName: "Uncategorized", doneColumnName: "Done", groupSource: { kind: "none" }, propertySchema: "none" /* None */, propertyDisplay: "none" /* None */, treatNestedTasksAsSubtasks: false, columnOrderMode: "file" /* FileOrder */, sortProperty: null, sortDirection: "asc", groupDirection: "asc", manualOrder: {} }; var createSettingsStore = () => writable(defaultSettings); function parseSettingsString(str2) { var _a5, _b3; try { const parsed = JSON.parse(str2); const partial = settingsObject.partial().parse(parsed); const columns = migrateColumnDefinitions( (_a5 = partial.columns) != null ? _a5 : defaultSettings.columns ); const propertyDisplay = (_b3 = partial.propertyDisplay) != null ? _b3 : typeof (parsed == null ? void 0 : parsed.showProperties) === "boolean" ? parsed.showProperties ? "debug" /* Debug */ : "none" /* None */ : defaultSettings.propertyDisplay; return { ...defaultSettings, ...partial, columns, propertyDisplay, collapsedColumns: migrateCollapsedColumns(partial.collapsedColumns, columns) }; } catch (e) { return defaultSettings; } } function toSettingsString(settings) { return JSON.stringify(settings); } function createDefaultColumns(labels) { const usedIds = /* @__PURE__ */ new Set(); return labels.map((label) => ({ id: createColumnId(label, usedIds), label, matchMode: "name", matchTags: [], matchStatus: void 0, matchPriority: void 0, matchPropertySchema: void 0 })); } // src/ui/components/task_markdown.ts function renderTaskMarkdownSource({ content, displayStatus, blockLink, excludedTags = [] }) { let contentWithBlockLink = (content + (blockLink ? ` ^${blockLink}` : "")).replaceAll("
", "\n"); for (const tag2 of excludedTags) { contentWithBlockLink = stripTagFromRenderedContent(contentWithBlockLink, tag2); } const indentedContinuationLines = contentWithBlockLink.replaceAll("\n", "\n "); return `- [${displayStatus || " "}] ${indentedContinuationLines}`; } function stripTagFromRenderedContent(content, tag2) { const normalizedTag = tag2.trim().replace(/^#/, ""); if (!normalizedTag) return content; const escapedTag = normalizedTag.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); return content.replace(new RegExp(`(^|\\s)#${escapedTag}(?=$|\\s|[^-_/\\p{L}\\p{N}])`, "giu"), "$1").trim(); } // src/ui/components/task.svelte var root10 = from_html(``); var root_17 = from_html(`
`); var root_25 = from_html(`
`); var root_33 = from_html(`
`); var root_43 = from_html(``); var root_52 = from_html(``); var root_62 = from_html(``); var root_72 = from_html(``); var root_8 = from_html(` `, 1); var root_9 = from_html(`
Subtask
`); var root_10 = from_html(` `, 1); var root_11 = from_html(`# `); var root_122 = from_html(`
`); var root_132 = from_html(`
 
`); var root_142 = from_html(` `); var root_152 = from_html(` `); var root_162 = from_html(` `); var root_172 = from_html(`
`); var root_18 = from_html(` `); var root_19 = from_html(`
`); var root_20 = from_html(``); var root_21 = from_html(`
`); var $$css10 = { hash: "svelte-1fvsaoa", code: '.task.svelte-1fvsaoa {--task-accent: var(--task-accent-color, var(--background-modifier-border-hover));--task-content-line-height: 1.5rem;--task-footer-line-height: 1.15;--task-footer-block-padding: 2px;position:relative;overflow:hidden;background:var(--background-primary);border-radius:var(--radius-s);border:var(--border-width) solid var(--background-modifier-border);cursor:grab;box-shadow:0 1px 2px rgba(0, 0, 0, 0.06);transition:border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;}.task.svelte-1fvsaoa::before {content:"";position:absolute;inset:0 auto 0 0;width:8px;background:var(--task-accent);}.task.svelte-1fvsaoa:hover {border-color:color-mix(in srgb, var(--text-muted) 45%, var(--background-modifier-border));box-shadow:0 8px 22px rgba(0, 0, 0, 0.08);transform:translateY(-1px);}.task.is-dragging.svelte-1fvsaoa {opacity:0.15;}.task.is-selected.svelte-1fvsaoa {border-color:var(--interactive-accent);background:color-mix(in srgb, var(--interactive-accent) 8%, var(--background-primary));}.task.svelte-1fvsaoa .task-row-content:where(.svelte-1fvsaoa) {min-width:0;}.task.svelte-1fvsaoa .task-row-content:where(.svelte-1fvsaoa) textarea:where(.svelte-1fvsaoa) {cursor:text;background-color:var(--color-base-25);width:100%;}.task.svelte-1fvsaoa .task-row-content:where(.svelte-1fvsaoa) .content-preview:where(.svelte-1fvsaoa) {min-height:var(--task-content-line-height);}.task.svelte-1fvsaoa .task-row-content:where(.svelte-1fvsaoa) .content-preview:where(.svelte-1fvsaoa):focus {box-shadow:0 0 0 3px var(--background-modifier-border-focus);}.task.svelte-1fvsaoa .icon-button:where(.svelte-1fvsaoa) {display:flex;justify-content:center;align-items:center;width:20px;height:20px;padding:0;border:none;background:transparent;cursor:pointer;border-radius:var(--radius-s);transition:opacity 0.2s ease;box-shadow:none;overflow:visible;}.task.svelte-1fvsaoa .icon-button:where(.svelte-1fvsaoa):hover, .task.svelte-1fvsaoa .icon-button:where(.svelte-1fvsaoa):active {background:transparent;box-shadow:none;}.task.svelte-1fvsaoa .icon-button:where(.svelte-1fvsaoa):focus-visible {outline:2px solid var(--background-modifier-border-focus);outline-offset:2px;}.task.svelte-1fvsaoa .icon-button.select-task:where(.svelte-1fvsaoa):hover svg {opacity:0.8 !important;color:var(--interactive-accent);}.task.svelte-1fvsaoa .icon-button.select-task.is-selected:where(.svelte-1fvsaoa) svg {color:var(--interactive-accent);}.task.svelte-1fvsaoa .icon-button.pin-marker:where(.svelte-1fvsaoa) svg {color:var(--interactive-accent);}.task.svelte-1fvsaoa .icon-button.pin-marker:where(.svelte-1fvsaoa):hover svg {opacity:1 !important;}.task.svelte-1fvsaoa .icon-button.usesStatusMarker:where(.svelte-1fvsaoa) {color:var(--text-normal);}.task.svelte-1fvsaoa .drag-handle:where(.svelte-1fvsaoa) {display:flex;align-items:center;justify-content:center;width:22px;height:22px;cursor:grab;}.task.svelte-1fvsaoa .task-footer:where(.svelte-1fvsaoa) {border-top:var(--border-width) solid var(--background-modifier-border);padding:var(--task-footer-block-padding) var(--size-4-2) var(--task-footer-block-padding) calc(var(--size-4-2) + 8px);font-size:var(--font-ui-smaller);line-height:var(--task-footer-line-height);display:flex;align-items:center;min-height:0;}.task.svelte-1fvsaoa .task-footer:where(.svelte-1fvsaoa) .go-to-file-button:where(.svelte-1fvsaoa) {display:inline-flex;align-items:center;justify-content:flex-start;gap:var(--size-2-1);width:auto;max-width:100%;padding:0;min-height:0;height:auto;border:none;background:transparent;cursor:pointer;text-align:left;box-shadow:none;transition:opacity 0.2s ease;border-radius:var(--radius-s);font:inherit;line-height:inherit;}.task.svelte-1fvsaoa .task-footer:where(.svelte-1fvsaoa) .go-to-file-button:where(.svelte-1fvsaoa):hover {background:transparent;box-shadow:none;}.task.svelte-1fvsaoa .task-footer:where(.svelte-1fvsaoa) .go-to-file-button:where(.svelte-1fvsaoa):hover svg {opacity:1 !important;color:var(--interactive-accent);}.task.svelte-1fvsaoa .task-footer:where(.svelte-1fvsaoa) .go-to-file-button:where(.svelte-1fvsaoa):hover .file-path:where(.svelte-1fvsaoa) {color:var(--interactive-accent);}.task.svelte-1fvsaoa .task-footer:where(.svelte-1fvsaoa) .go-to-file-button:where(.svelte-1fvsaoa):focus-visible {outline:2px solid var(--background-modifier-border-focus);outline-offset:2px;}.task.svelte-1fvsaoa .task-footer:where(.svelte-1fvsaoa) .go-to-file-button:where(.svelte-1fvsaoa) .file-path:where(.svelte-1fvsaoa) {margin:0;color:var(--text-muted);transition:color 0.2s ease;overflow-wrap:anywhere;white-space:normal;min-width:0;line-height:inherit;}.task.svelte-1fvsaoa .task-footer:where(.svelte-1fvsaoa) .go-to-file-button:where(.svelte-1fvsaoa) svg {width:1em;height:1em;}.task.svelte-1fvsaoa .task-tags:where(.svelte-1fvsaoa) {display:flex;flex-wrap:wrap;gap:var(--size-2-1);padding:0 var(--size-4-2) var(--size-4-2) calc(var(--size-4-2) + 8px);margin-top:calc(-1 * var(--size-2-2));}.task.svelte-1fvsaoa .task-tags:where(.svelte-1fvsaoa) span:where(.svelte-1fvsaoa) {background-color:var(--background-secondary);color:var(--text-muted);border:1px solid var(--background-modifier-border);border-radius:var(--radius-s);padding:1px 5px;font-size:var(--font-ui-smaller);line-height:1.1;display:inline-flex;align-items:center;transition:color 0.15s ease, border-color 0.15s ease;}.task.svelte-1fvsaoa .task-tags:where(.svelte-1fvsaoa) span:where(.svelte-1fvsaoa):hover {color:var(--text-normal);border-color:var(--text-muted);}.task.svelte-1fvsaoa .task-tags:where(.svelte-1fvsaoa) span:where(.svelte-1fvsaoa) .cm-formatting-hashtag {color:var(--text-accent) !important;font-weight:var(--font-medium);margin-right:1px;}.task.svelte-1fvsaoa .task-tags:where(.svelte-1fvsaoa) span:where(.svelte-1fvsaoa) .cm-hashtag-end {color:inherit !important;}.task.svelte-1fvsaoa .task-properties-debug:where(.svelte-1fvsaoa) {padding:var(--size-2-3) var(--size-4-2) var(--size-2-3) calc(var(--size-4-2) + 8px);border-top:var(--border-width) solid var(--background-modifier-border);background-color:var(--background-secondary-alt);font-size:var(--font-ui-smaller);overflow-x:auto;}.task.svelte-1fvsaoa .task-properties-debug:where(.svelte-1fvsaoa) pre:where(.svelte-1fvsaoa) {margin:0;}.task.svelte-1fvsaoa .task-properties:where(.svelte-1fvsaoa) {display:flex;flex-wrap:wrap;gap:var(--size-2-2);padding:var(--task-footer-block-padding) var(--size-4-2) var(--task-footer-block-padding) calc(var(--size-4-2) + 8px);border-top:var(--border-width) solid var(--background-modifier-border);font-size:var(--font-ui-smaller);line-height:var(--task-footer-line-height);}.task.svelte-1fvsaoa .task-date-properties:where(.svelte-1fvsaoa) {align-items:center;}.task.svelte-1fvsaoa .task-date-properties:where(.svelte-1fvsaoa) .edit-mode {flex-basis:100%;}.task.svelte-1fvsaoa .task-property:where(.svelte-1fvsaoa) {display:inline-flex;align-items:baseline;gap:var(--size-2-1);padding:0 var(--size-2-2);border-radius:var(--radius-s);background-color:var(--background-secondary-alt);line-height:inherit;}.task.svelte-1fvsaoa .task-property-label:where(.svelte-1fvsaoa) {color:var(--text-muted);text-transform:uppercase;font-size:var(--font-smallest);letter-spacing:0.02em;}.task.svelte-1fvsaoa .task-property.dataview-property:where(.svelte-1fvsaoa) .task-property-label:where(.svelte-1fvsaoa) {text-transform:none;letter-spacing:0;}.task.svelte-1fvsaoa .task-property-icon:where(.svelte-1fvsaoa) {font-size:inherit;line-height:1;}.task.svelte-1fvsaoa .task-property-value:where(.svelte-1fvsaoa) {color:var(--text-normal);}.task-row-content img {max-width:100%;max-height:160px;object-fit:contain;}.task-row-content code {white-space:pre-wrap;}.task-row-content .content-preview,\n.task-row-content .content-preview > ul,\n.task-row-content .content-preview > ul > li,\n.task-row-content .content-preview > ul > li > p {margin:0;}.task .task-row-content .content-preview > ul {padding-left:0 !important;margin:0 !important;list-style:none !important;}.task-row-content .content-preview .task-list-item {min-width:0;word-break:break-word;padding-left:0 !important;list-style-type:none !important;}.task-row-content input.task-nested-checkbox {pointer-events:none;}.task-row-content .content-preview .task-list-item > input[type="checkbox"].task-primary-checkbox {display:none !important;}.task-row-content .content-preview .task-list-item > *:not(input[type="checkbox"]) {min-width:0;}.task-progress-wrapper.svelte-1fvsaoa {display:flex;align-items:center;gap:var(--size-4-2);margin-top:var(--size-2-2);margin-bottom:var(--size-2-1);}.task-progress-wrapper.is-complete.svelte-1fvsaoa .task-progress-bar:where(.svelte-1fvsaoa) {background-color:hsl(140, 75%, 45%);background-image:linear-gradient(90deg, hsl(140, 75%, 40%) 0%, hsl(140, 75%, 50%) 100%);box-shadow:0 0 6px hsla(140, 75%, 45%, 0.3);}.task-progress-wrapper.is-complete.svelte-1fvsaoa .task-progress-text:where(.svelte-1fvsaoa) {color:hsl(140, 75%, 45%);font-weight:var(--font-bold);}.task-progress-bar-container.svelte-1fvsaoa {flex:1;height:6px;background-color:var(--background-modifier-border);border-radius:3px;overflow:hidden;box-shadow:inset 0 1px 2px rgba(0, 0, 0, 0.05);}.task-progress-bar.svelte-1fvsaoa {height:100%;background-color:var(--interactive-accent);background-image:linear-gradient(90deg, hsla(var(--accent-h, 210), var(--accent-s, 75%), calc(var(--accent-l, 50%) - 5%), 0.95) 0%, var(--interactive-accent) 100%);border-radius:3px;transition:width 0.4s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.3s ease, background-image 0.3s ease;box-shadow:0 1px 2px rgba(0, 0, 0, 0.1);}.task-progress-text.svelte-1fvsaoa {font-size:var(--font-ui-smaller);color:var(--text-muted);font-weight:var(--font-medium);white-space:nowrap;transition:color 0.3s ease;}.subtask-collapse-btn.svelte-1fvsaoa {background:transparent;border:none;box-shadow:none;padding:0;color:var(--text-muted);font-size:10px;cursor:pointer;display:flex;align-items:center;justify-content:center;width:var(--task-line-marker-size, 20px);height:14px;line-height:1;flex-shrink:0;transition:color 0.15s ease;\n /* Shift to the left under the checkbox */margin-left:calc(-1 * (var(--task-line-marker-size, 20px) + var(--task-line-column-gap, var(--size-2-3))));margin-right:var(--task-line-column-gap, var(--size-2-3));}.subtask-collapse-btn.svelte-1fvsaoa:hover {color:var(--text-normal);background:transparent;}.add-subtask-container.svelte-1fvsaoa {padding:var(--size-2-2) var(--size-4-2) var(--size-2-2) calc(var(--size-4-2) + 8px);}.add-subtask-btn.svelte-1fvsaoa {display:inline-flex;align-items:center;gap:var(--size-2-1);align-self:flex-start;cursor:pointer;border:0;border-radius:var(--radius-s);box-shadow:none;margin:0;min-height:22px;padding:0;background:transparent;background-color:transparent;color:var(--text-accent);font-size:var(--font-ui-smaller);font-weight:var(--font-medium);line-height:1.2;}.add-subtask-btn.svelte-1fvsaoa span:where(.svelte-1fvsaoa) {display:inline-flex;align-items:center;justify-content:center;font-size:var(--font-ui-small);line-height:1;}.add-subtask-btn.svelte-1fvsaoa:hover {color:var(--text-accent-hover);background:transparent;background-color:transparent;}.add-subtask-btn.svelte-1fvsaoa:active {color:var(--text-accent-hover);background:transparent;background-color:transparent;}' }; function Task2($$anchor, $$props) { if (new.target) return createClassComponent({ component: Task2, ...$$anchor }); push($$props, false); append_styles($$anchor, $$css10); const displayStatusIsCustom = mutable_source(); const excludedTagNames = mutable_source(); const visibleTags = mutable_source(); const shouldconsolidateTags = mutable_source(); const dateEditingEnabled = mutable_source(); const displayProperties = mutable_source(); const dateDisplayProperties = mutable_source(); const nonDateDisplayProperties = mutable_source(); const dateProperties = mutable_source(); const visibleSubtasks = mutable_source(); const totalSubtasksCount = mutable_source(); const completedSubtasksCount = mutable_source(); const completionPercentage = mutable_source(); let app = prop($$props, "app", 12); let task = prop($$props, "task", 12); let taskActions = prop($$props, "taskActions", 12); let columnTagTableStore = prop($$props, "columnTagTableStore", 12); let showFilepath = prop($$props, "showFilepath", 12); let propertyDisplay = prop($$props, "propertyDisplay", 28, () => "none" /* None */); let propertySchemaOption = prop($$props, "propertySchemaOption", 28, () => "none" /* None */); let consolidateTags = prop($$props, "consolidateTags", 12); let excludedTags = prop($$props, "excludedTags", 28, () => []); let displayColumn = prop($$props, "displayColumn", 12); let displaySecondaryId = prop($$props, "displaySecondaryId", 12); let isSelectionMode = prop($$props, "isSelectionMode", 12, false); let isSelected = prop($$props, "isSelected", 12, false); let onToggleSelection = prop($$props, "onToggleSelection", 12, () => { }); let selectedTaskIds = prop($$props, "selectedTaskIds", 28, () => []); let taskSecondaryIds = prop($$props, "taskSecondaryIds", 28, () => ({})); let doneColumnName = prop($$props, "doneColumnName", 12, void 0); let accentColor = prop($$props, "accentColor", 12, void 0); let isManualOrder = prop($$props, "isManualOrder", 12, false); let isPinned = prop($$props, "isPinned", 12, false); let showDragHandle = prop($$props, "showDragHandle", 12, false); let onUnpin = prop($$props, "onUnpin", 12, () => { }); let treatNestedTasksAsSubtasks = prop($$props, "treatNestedTasksAsSubtasks", 12, false); function handleContentBlur() { var _a5; set(isEditing, false); const content = (_a5 = get(textAreaEl)) == null ? void 0 : _a5.value; if (!content) return; const updatedContent = content.replaceAll("\n", "
"); taskActions().updateContent(task().id, updatedContent); } function handleKeypress(e) { var _a5; if (e.key === "Enter" && !e.shiftKey || e.key === "Escape") { (_a5 = get(textAreaEl)) == null ? void 0 : _a5.blur(); } } function handleOpenKeypress(e) { if (e.key === "Enter" || e.key === " ") { handleFocus(e); } } let isEditing = mutable_source(false); let isDragging = mutable_source(false); let isSubtasksCollapsed = mutable_source(false); function toggleSubtasksCollapse() { set(isSubtasksCollapsed, !get(isSubtasksCollapsed)); } function handleDragStart(e) { handleContentBlur(); set(isDragging, true); const taskIds = isSelectionMode() && isSelected() && selectedTaskIds().length > 0 ? selectedTaskIds() : [task().id]; isDraggingStore.set({ fromColumn: displayColumn(), fromSecondaryId: displaySecondaryId(), draggedTaskIds: taskIds, taskSecondaryIds: taskSecondaryIds() }); if (e.dataTransfer) { e.dataTransfer.setData("text/plain", task().id); e.dataTransfer.dropEffect = "move"; } if (taskIds.length > 1 && e.dataTransfer) { const ghost = document.createElement("div"); ghost.textContent = `Moving ${taskIds.length} tasks`; ghost.style.cssText = [ "position:fixed", "top:-9999px", "left:-9999px", "padding:6px 12px", "background:var(--background-secondary-alt)", "border:1px solid var(--background-modifier-border)", "border-radius:var(--radius-m)", "font-size:var(--font-ui-small)", "color:var(--text-normal)", "box-shadow:var(--shadow-s)", "white-space:nowrap" ].join(";"); document.body.appendChild(ghost); e.dataTransfer.setDragImage(ghost, 0, 0); setTimeout(() => document.body.removeChild(ghost), 0); } } function handleDragEnd() { set(isDragging, false); isDraggingStore.set(null); } let textAreaEl = mutable_source(); let previewContainerEl = mutable_source(); let markdownComponent; let isEditingDates = mutable_source(false); const editableDatePropertyKeys = /* @__PURE__ */ new Set(["due", "scheduled", "start"]); const interactiveTagNames = /* @__PURE__ */ new Set([ "a", "button", "input", "select", "textarea", "label", "summary", "details" ]); function eventHasInteractiveTarget(e) { if (e instanceof MouseEvent && get(previewContainerEl)) { const rect = get(previewContainerEl).getBoundingClientRect(); const relativeX = e.clientX - rect.left; if (relativeX >= 0 && relativeX < 28) { return true; } } const path = (e == null ? void 0 : e.composedPath()) || []; const currentTarget = e == null ? void 0 : e.currentTarget; for (const element2 of path) { if (!(element2 instanceof HTMLElement)) { continue; } if (currentTarget instanceof HTMLElement && element2 === currentTarget) { continue; } if (interactiveTagNames.has(element2.tagName.toLowerCase())) { return true; } if (element2.isContentEditable) { return true; } const role = element2.getAttribute("role"); if (role === "button" || role === "checkbox" || role === "link") { return true; } } return false; } function handleFocus(e) { if (eventHasInteractiveTarget(e)) { return; } set(isEditing, true); setTimeout( () => { var _a5; (_a5 = get(textAreaEl)) == null ? void 0 : _a5.focus(); }, 100 ); } function renderTaskMarkdown() { let body = task().content; if (task().properties) { if (propertyDisplay() === "pretty" /* Pretty */) { body = stripDisplayedPropertiesFromContent(body, task().properties); } else if (get(dateEditingEnabled)) { body = stripDisplayedPropertiesFromContent(body, get(dateProperties)); } } return renderTaskMarkdownSource({ content: body, displayStatus: task().displayStatus, blockLink: task().blockLink, excludedTags: excludedTags() }); } async function renderMarkdown(selectionMode) { if (!get(previewContainerEl)) return; if (markdownComponent) { markdownComponent.unload(); } get(previewContainerEl).empty(); markdownComponent = new import_obsidian6.Component(); const contentToRender = renderTaskMarkdown(); await import_obsidian6.MarkdownRenderer.render(app(), contentToRender, get(previewContainerEl), task().path, markdownComponent); setupLinkHandlers(); postProcessRenderedContent(selectionMode); } function setupLinkHandlers() { if (!get(previewContainerEl)) return; const internalLinks = get(previewContainerEl).querySelectorAll("a.internal-link"); internalLinks.forEach((link2) => { const anchorEl = link2; anchorEl.addEventListener("click", (e) => { e.preventDefault(); e.stopPropagation(); const linkTarget = anchorEl.getAttribute("data-href"); if (linkTarget && app()) { app().workspace.openLinkText(linkTarget, task().path, import_obsidian6.Keymap.isModEvent(e)); } }); anchorEl.addEventListener("mouseover", (e) => { const linkTarget = anchorEl.getAttribute("data-href"); if (linkTarget && app() && get(previewContainerEl)) { app().workspace.trigger("hover-link", { event: e, source: "kanban-view", hoverParent: get(previewContainerEl), targetEl: anchorEl, linktext: linkTarget, sourcePath: task().path }); } }); }); } function postProcessRenderedContent(selectionMode) { if (!get(previewContainerEl)) return; function stopPropagation2(e) { e.stopPropagation(); } function handlePrimaryCheckboxClick(e) { e.preventDefault(); e.stopPropagation(); void taskActions().toggleDone(task().id); } get(previewContainerEl).querySelectorAll("a:not(.internal-link)").forEach((a) => { const anchor = a; anchor.target = "_blank"; anchor.rel = "noopener noreferrer"; anchor.addEventListener("click", stopPropagation2); anchor.addEventListener("keypress", stopPropagation2); }); const checkboxes = Array.from(get(previewContainerEl).querySelectorAll('input[type="checkbox"]')); const [primaryCheckbox, ...nestedCheckboxes] = checkboxes; if (primaryCheckbox) { primaryCheckbox.classList.add("task-primary-checkbox"); primaryCheckbox.addEventListener("mousedown", stopPropagation2); primaryCheckbox.addEventListener("mouseup", stopPropagation2); primaryCheckbox.addEventListener("keypress", stopPropagation2); if (selectionMode) { primaryCheckbox.disabled = true; primaryCheckbox.tabIndex = -1; primaryCheckbox.style.visibility = "hidden"; primaryCheckbox.setAttribute("aria-hidden", "true"); primaryCheckbox.addEventListener("click", stopPropagation2); } else { primaryCheckbox.disabled = false; primaryCheckbox.style.removeProperty("visibility"); primaryCheckbox.removeAttribute("aria-hidden"); primaryCheckbox.setAttribute("aria-label", "Advance status"); primaryCheckbox.addEventListener("click", handlePrimaryCheckboxClick); } } nestedCheckboxes.forEach((checkbox) => { checkbox.classList.add("task-nested-checkbox"); checkbox.disabled = true; checkbox.tabIndex = -1; checkbox.addEventListener("click", stopPropagation2); checkbox.addEventListener("keypress", stopPropagation2); }); get(previewContainerEl).querySelectorAll("iframe, audio, video").forEach((el) => { el.remove(); }); } onDestroy(() => { if (markdownComponent) { markdownComponent.unload(); } }); function onInput(e) { e.currentTarget.style.height = `0px`; e.currentTarget.style.height = `${e.currentTarget.scrollHeight}px`; } legacy_pre_effect(() => deep_read_state(task()), () => { set(displayStatusIsCustom, task().displayStatus !== " "); }); legacy_pre_effect( () => (deep_read_state(task()), deep_read_state(propertyDisplay()), get(isEditing), get(previewContainerEl), deep_read_state(isSelectionMode())), () => { if (task() && task().content && task().displayStatus && propertyDisplay() && !get(isEditing) && get(previewContainerEl)) { void renderMarkdown(isSelectionMode()); } } ); legacy_pre_effect(() => get(textAreaEl), () => { if (get(textAreaEl)) { mutate(textAreaEl, get(textAreaEl).style.height = `0px`); mutate(textAreaEl, get(textAreaEl).style.height = `${get(textAreaEl).scrollHeight}px`); } }); legacy_pre_effect(() => deep_read_state(excludedTags()), () => { set(excludedTagNames, excludedTags().map((tag2) => tag2.trim().replace(/^#/, "").toLowerCase())); }); legacy_pre_effect(() => (deep_read_state(task()), get(excludedTagNames)), () => { set(visibleTags, Array.from(task().tags).filter((t) => !get(excludedTagNames).includes(t.toLowerCase()))); }); legacy_pre_effect(() => (deep_read_state(consolidateTags()), get(visibleTags)), () => { set(shouldconsolidateTags, consolidateTags() && get(visibleTags).length > 0); }); legacy_pre_effect( () => (getPropertyWriteAdapter, deep_read_state(propertySchemaOption())), () => { set(dateEditingEnabled, getPropertyWriteAdapter(propertySchemaOption()) !== null); } ); legacy_pre_effect(() => (deep_read_state(task()), toDisplayProperties), () => { set(displayProperties, task().properties ? toDisplayProperties(task().properties) : []); }); legacy_pre_effect( () => (get(dateEditingEnabled), get(displayProperties), deep_read_state(propertySchemaOption()), PropertySchemaOption), () => { set(dateDisplayProperties, get(dateEditingEnabled) ? get(displayProperties).filter((prop2) => editableDatePropertyKeys.has(prop2.key)).map((prop2) => propertySchemaOption() === "dataview" /* Dataview */ ? { ...prop2, icon: void 0, label: `${prop2.key}::` } : prop2) : []); } ); legacy_pre_effect(() => get(displayProperties), () => { set(nonDateDisplayProperties, get(displayProperties).filter((prop2) => !editableDatePropertyKeys.has(prop2.key))); }); legacy_pre_effect(() => deep_read_state(task()), () => { var _a5, _b3; set(dateProperties, new Map(Array.from((_b3 = (_a5 = task().properties) == null ? void 0 : _a5.entries()) != null ? _b3 : []).filter(([key2]) => editableDatePropertyKeys.has(key2)))); }); legacy_pre_effect(() => (getVisibleSourceTaskDescendants, deep_read_state(task())), () => { set(visibleSubtasks, getVisibleSourceTaskDescendants(task().sourceChildren)); }); legacy_pre_effect(() => get(visibleSubtasks), () => { set(totalSubtasksCount, get(visibleSubtasks).length); }); legacy_pre_effect(() => (get(visibleSubtasks), deep_read_state(task())), () => { set(completedSubtasksCount, get(visibleSubtasks).filter((node) => task().isSourceTaskStatusDone(node.status)).length); }); legacy_pre_effect(() => (get(totalSubtasksCount), get(completedSubtasksCount)), () => { set(completionPercentage, get(totalSubtasksCount) > 0 ? Math.round(get(completedSubtasksCount) / get(totalSubtasksCount) * 100) : 0); }); legacy_pre_effect_reset(); var $$exports = { get app() { return app(); }, set app($$value) { app($$value); flushSync(); }, get task() { return task(); }, set task($$value) { task($$value); flushSync(); }, get taskActions() { return taskActions(); }, set taskActions($$value) { taskActions($$value); flushSync(); }, get columnTagTableStore() { return columnTagTableStore(); }, set columnTagTableStore($$value) { columnTagTableStore($$value); flushSync(); }, get showFilepath() { return showFilepath(); }, set showFilepath($$value) { showFilepath($$value); flushSync(); }, get propertyDisplay() { return propertyDisplay(); }, set propertyDisplay($$value) { propertyDisplay($$value); flushSync(); }, get propertySchemaOption() { return propertySchemaOption(); }, set propertySchemaOption($$value) { propertySchemaOption($$value); flushSync(); }, get consolidateTags() { return consolidateTags(); }, set consolidateTags($$value) { consolidateTags($$value); flushSync(); }, get excludedTags() { return excludedTags(); }, set excludedTags($$value) { excludedTags($$value); flushSync(); }, get displayColumn() { return displayColumn(); }, set displayColumn($$value) { displayColumn($$value); flushSync(); }, get displaySecondaryId() { return displaySecondaryId(); }, set displaySecondaryId($$value) { displaySecondaryId($$value); flushSync(); }, get isSelectionMode() { return isSelectionMode(); }, set isSelectionMode($$value) { isSelectionMode($$value); flushSync(); }, get isSelected() { return isSelected(); }, set isSelected($$value) { isSelected($$value); flushSync(); }, get onToggleSelection() { return onToggleSelection(); }, set onToggleSelection($$value) { onToggleSelection($$value); flushSync(); }, get selectedTaskIds() { return selectedTaskIds(); }, set selectedTaskIds($$value) { selectedTaskIds($$value); flushSync(); }, get taskSecondaryIds() { return taskSecondaryIds(); }, set taskSecondaryIds($$value) { taskSecondaryIds($$value); flushSync(); }, get doneColumnName() { return doneColumnName(); }, set doneColumnName($$value) { doneColumnName($$value); flushSync(); }, get accentColor() { return accentColor(); }, set accentColor($$value) { accentColor($$value); flushSync(); }, get isManualOrder() { return isManualOrder(); }, set isManualOrder($$value) { isManualOrder($$value); flushSync(); }, get isPinned() { return isPinned(); }, set isPinned($$value) { isPinned($$value); flushSync(); }, get showDragHandle() { return showDragHandle(); }, set showDragHandle($$value) { showDragHandle($$value); flushSync(); }, get onUnpin() { return onUnpin(); }, set onUnpin($$value) { onUnpin($$value); flushSync(); }, get treatNestedTasksAsSubtasks() { return treatNestedTasksAsSubtasks(); }, set treatNestedTasksAsSubtasks($$value) { treatNestedTasksAsSubtasks($$value); flushSync(); }, $set: update_legacy_props, $on: ($$event_name, $$event_cb) => add_legacy_event_listener($$props, $$event_name, $$event_cb) }; init(); var div = root_21(); let classes; let styles; var node_1 = child(div); TaskLineRow(node_1, { variant: "card", hasActions: true, children: ($$anchor2, $$slotProps) => { var div_1 = root_33(); var node_2 = child(div_1); { var consequent = ($$anchor3) => { var textarea = root10(); remove_textarea_child(textarea); let classes_1; bind_this(textarea, ($$value) => set(textAreaEl, $$value), () => get(textAreaEl)); template_effect( ($0) => { set_value(textarea, $0); classes_1 = set_class(textarea, 1, "svelte-1fvsaoa", null, classes_1, { editing: get(isEditing) }); }, [ () => (deep_read_state(task()), untrack(() => task().content.replaceAll("
", "\n"))) ] ); event("keypress", textarea, handleKeypress); event("blur", textarea, handleContentBlur); event("input", textarea, onInput); append($$anchor3, textarea); }; var alternate = ($$anchor3) => { var div_2 = root_17(); bind_this(div_2, ($$value) => set(previewContainerEl, $$value), () => get(previewContainerEl)); event("mouseup", div_2, handleFocus); event("keypress", div_2, handleOpenKeypress); append($$anchor3, div_2); }; if_block(node_2, ($$render) => { if (get(isEditing)) $$render(consequent); else $$render(alternate, -1); }); } var node_3 = sibling(node_2, 2); { var consequent_1 = ($$anchor3) => { var div_3 = root_25(); let classes_2; var span = child(div_3); let classes_3; var text2 = child(span, true); reset(span); var div_4 = sibling(span, 2); var div_5 = child(div_4); reset(div_4); var span_1 = sibling(div_4, 2); var text_1 = child(span_1); reset(span_1); reset(div_3); template_effect(() => { var _a5, _b3, _c2, _d; classes_2 = set_class(div_3, 1, "task-progress-wrapper svelte-1fvsaoa", null, classes_2, { "is-complete": get(completionPercentage) === 100 }); classes_3 = set_class(span, 1, "subtask-collapse-btn svelte-1fvsaoa", null, classes_3, { collapsed: get(isSubtasksCollapsed) }); set_attribute2(span, "aria-label", get(isSubtasksCollapsed) ? "Expand subtasks" : "Collapse subtasks"); set_text(text2, get(isSubtasksCollapsed) ? "\u25B6" : "\u25BC"); set_style(div_5, `width: ${(_a5 = get(completionPercentage)) != null ? _a5 : ""}%`); set_text(text_1, `${(_b3 = get(completedSubtasksCount)) != null ? _b3 : ""}/${(_c2 = get(totalSubtasksCount)) != null ? _c2 : ""} (${(_d = get(completionPercentage)) != null ? _d : ""}%)`); }); event("click", span, stopPropagation(toggleSubtasksCollapse)); event("keydown", span, stopPropagation((e) => { if (e.key === "Enter" || e.key === " ") { e.preventDefault(); toggleSubtasksCollapse(); } })); append($$anchor3, div_3); }; if_block(node_3, ($$render) => { if (treatNestedTasksAsSubtasks() && get(totalSubtasksCount) > 0) $$render(consequent_1); }); } reset(div_1); append($$anchor2, div_1); }, $$slots: { default: true, marker: ($$anchor2, $$slotProps) => { var fragment = comment(); var node_4 = first_child(fragment); { var consequent_2 = ($$anchor3) => { var button = root_43(); let classes_4; var node_5 = child(button); { let $0 = derived_safe_equal(() => isSelected() ? "lucide-check-circle" : "lucide-circle"); let $1 = derived_safe_equal(() => isSelected() ? 1 : 0.5); Icon(node_5, { get name() { return get($0); }, size: 18, get opacity() { return get($1); } }); } reset(button); template_effect(() => { classes_4 = set_class(button, 1, "icon-button select-task svelte-1fvsaoa", null, classes_4, { "is-selected": isSelected() }); set_attribute2(button, "aria-label", isSelected() ? "Deselect for bulk actions" : "Select for bulk actions"); set_attribute2(button, "aria-checked", isSelected()); }); event("click", button, function(...$$args) { var _a5; (_a5 = onToggleSelection()) == null ? void 0 : _a5.apply(this, $$args); }); event("keydown", button, (e) => { if (e.key === "Enter" || e.key === " ") { e.preventDefault(); onToggleSelection()(); } }); append($$anchor3, button); }; var alternate_1 = ($$anchor3) => { var button_1 = root_52(); let classes_5; var node_6 = child(button_1); TaskStatusMarker(node_6, { get status() { return deep_read_state(task()), untrack(() => task().displayStatus); }, get isDone() { return deep_read_state(task()), untrack(() => task().done); }, size: 16 }); reset(button_1); template_effect(() => { classes_5 = set_class(button_1, 1, "icon-button toggle-done-task svelte-1fvsaoa", null, classes_5, { "is-done": task().done, usesStatusMarker: get(displayStatusIsCustom) }); set_attribute2(button_1, "aria-checked", (deep_read_state(task()), untrack(() => task().done))); }); event("click", button_1, () => void taskActions().toggleDone(task().id)); event("keydown", button_1, (e) => { if (e.key === "Enter" || e.key === " ") { e.preventDefault(); void taskActions().toggleDone(task().id); } }); append($$anchor3, button_1); }; if_block(node_4, ($$render) => { if (isSelectionMode()) $$render(consequent_2); else $$render(alternate_1, -1); }); } append($$anchor2, fragment); }, actions: ($$anchor2, $$slotProps) => { var fragment_1 = root_8(); var node_7 = first_child(fragment_1); { var consequent_3 = ($$anchor3) => { var button_2 = root_62(); var node_8 = child(button_2); Icon(node_8, { name: "lucide-pin", size: 16, opacity: 0.9 }); reset(button_2); event("click", button_2, stopPropagation(function(...$$args) { var _a5; (_a5 = onUnpin()) == null ? void 0 : _a5.apply(this, $$args); })); event("keydown", button_2, (e) => { if (e.key === "Enter" || e.key === " ") { e.preventDefault(); e.stopPropagation(); onUnpin()(); } }); append($$anchor3, button_2); }; if_block(node_7, ($$render) => { if (isManualOrder() && isPinned()) $$render(consequent_3); }); } var node_9 = sibling(node_7, 2); { var consequent_4 = ($$anchor3) => { var span_2 = root_72(); var node_10 = child(span_2); Icon(node_10, { name: "lucide-grip-vertical", size: 16, opacity: 0.5 }); reset(span_2); append($$anchor3, span_2); }; if_block(node_9, ($$render) => { if (isManualOrder() && showDragHandle()) $$render(consequent_4); }); } var node_11 = sibling(node_9, 2); Task_menu(node_11, { get task() { return task(); }, get taskActions() { return taskActions(); }, get columnTagTableStore() { return columnTagTableStore(); }, get doneColumnName() { return doneColumnName(); } }); append($$anchor2, fragment_1); } } }); var node_12 = sibling(node_1, 2); { var consequent_7 = ($$anchor2) => { var fragment_2 = root_10(); var node_13 = first_child(fragment_2); { var consequent_5 = ($$anchor3) => { TaskSourceRows($$anchor3, { get app() { return app(); }, get task() { return task(); }, get taskActions() { return taskActions(); }, get nodes() { return deep_read_state(task()), untrack(() => task().sourceChildren); }, get isSelectionMode() { return isSelectionMode(); }, depth: 1 }); }; if_block(node_13, ($$render) => { if (deep_read_state(task()), untrack(() => task().sourceChildren.length > 0)) $$render(consequent_5); }); } var node_14 = sibling(node_13, 2); { var consequent_6 = ($$anchor3) => { var div_6 = root_9(); var div_7 = child(div_6); reset(div_6); event("click", div_7, stopPropagation(() => void taskActions().addSourceBlockRow(task().id, task().rowIndex, "child", "task"))); event("keydown", div_7, stopPropagation((e) => { if (e.key === "Enter" || e.key === " ") { e.preventDefault(); void taskActions().addSourceBlockRow(task().id, task().rowIndex, "child", "task"); } })); append($$anchor3, div_6); }; if_block(node_14, ($$render) => { if (treatNestedTasksAsSubtasks()) $$render(consequent_6); }); } append($$anchor2, fragment_2); }; if_block(node_12, ($$render) => { if (!get(isSubtasksCollapsed)) $$render(consequent_7); }); } var node_15 = sibling(node_12, 2); { var consequent_8 = ($$anchor2) => { var div_8 = root_122(); each(div_8, 5, () => get(visibleTags), index, ($$anchor3, tag2) => { var span_3 = root_11(); var span_4 = sibling(child(span_3)); var text_2 = child(span_4, true); reset(span_4); reset(span_3); template_effect(() => set_text(text_2, get(tag2))); append($$anchor3, span_3); }); reset(div_8); append($$anchor2, div_8); }; if_block(node_15, ($$render) => { if (get(shouldconsolidateTags)) $$render(consequent_8); }); } var node_16 = sibling(node_15, 2); { var consequent_9 = ($$anchor2) => { var div_9 = root_132(); var pre = child(div_9); var code = child(pre); var text_3 = child(code, true); reset(code); reset(pre); reset(div_9); template_effect(($0) => set_text(text_3, $0), [ () => (deep_read_state(task()), untrack(() => JSON.stringify(Array.from(task().properties.entries()), null, 2))) ]); append($$anchor2, div_9); }; var consequent_12 = ($$anchor2) => { var fragment_4 = comment(); var node_17 = first_child(fragment_4); { var consequent_11 = ($$anchor3) => { var div_10 = root_172(); each(div_10, 5, () => get(nonDateDisplayProperties), (prop2) => prop2.key, ($$anchor4, prop2) => { var span_5 = root_162(); var node_18 = child(span_5); { var consequent_10 = ($$anchor5) => { var span_6 = root_142(); var text_4 = child(span_6, true); reset(span_6); template_effect(() => { set_attribute2(span_6, "title", (get(prop2), untrack(() => get(prop2).label))); set_attribute2(span_6, "aria-label", (get(prop2), untrack(() => get(prop2).label))); set_text(text_4, (get(prop2), untrack(() => get(prop2).icon))); }); append($$anchor5, span_6); }; var alternate_2 = ($$anchor5) => { var span_7 = root_152(); var text_5 = child(span_7, true); reset(span_7); template_effect(() => set_text(text_5, (get(prop2), untrack(() => get(prop2).label)))); append($$anchor5, span_7); }; if_block(node_18, ($$render) => { if (get(prop2), untrack(() => get(prop2).icon)) $$render(consequent_10); else $$render(alternate_2, -1); }); } var span_8 = sibling(node_18, 2); var text_6 = child(span_8, true); reset(span_8); reset(span_5); template_effect(() => set_text(text_6, (get(prop2), untrack(() => get(prop2).value)))); append($$anchor4, span_5); }); reset(div_10); append($$anchor3, div_10); }; if_block(node_17, ($$render) => { if (get(nonDateDisplayProperties), untrack(() => get(nonDateDisplayProperties).length > 0)) $$render(consequent_11); }); } append($$anchor2, fragment_4); }; if_block(node_16, ($$render) => { if (deep_read_state(propertyDisplay()), deep_read_state(PropertyDisplayMode), deep_read_state(task()), untrack(() => propertyDisplay() === "debug" /* Debug */ && task().properties && task().properties.size > 0)) $$render(consequent_9); else if (deep_read_state(propertyDisplay()), deep_read_state(PropertyDisplayMode), deep_read_state(task()), untrack(() => propertyDisplay() === "pretty" /* Pretty */ && task().properties)) $$render(consequent_12, 1); }); } var node_19 = sibling(node_16, 2); { var consequent_15 = ($$anchor2) => { var div_11 = root_19(); var node_20 = child(div_11); { var consequent_14 = ($$anchor3) => { var fragment_5 = root_10(); var node_21 = first_child(fragment_5); TaskDateFields(node_21, { get task() { return task(); }, get taskActions() { return taskActions(); }, get propertySchemaOption() { return propertySchemaOption(); }, get isTaskEditing() { return get(isEditing); }, get isEditingDates() { return get(isEditingDates); }, set isEditingDates($$value) { set(isEditingDates, $$value); }, $$legacy: true }); var node_22 = sibling(node_21, 2); each(node_22, 1, () => get(dateDisplayProperties), (prop2) => prop2.key, ($$anchor4, prop2) => { var span_9 = root_18(); let classes_6; var node_23 = child(span_9); { var consequent_13 = ($$anchor5) => { var span_10 = root_142(); var text_7 = child(span_10, true); reset(span_10); template_effect(() => { set_attribute2(span_10, "title", (get(prop2), untrack(() => get(prop2).label))); set_attribute2(span_10, "aria-label", (get(prop2), untrack(() => get(prop2).label))); set_text(text_7, (get(prop2), untrack(() => get(prop2).icon))); }); append($$anchor5, span_10); }; var alternate_3 = ($$anchor5) => { var span_11 = root_152(); var text_8 = child(span_11, true); reset(span_11); template_effect(() => set_text(text_8, (get(prop2), untrack(() => get(prop2).label)))); append($$anchor5, span_11); }; if_block(node_23, ($$render) => { if (get(prop2), untrack(() => get(prop2).icon)) $$render(consequent_13); else $$render(alternate_3, -1); }); } var span_12 = sibling(node_23, 2); var text_9 = child(span_12, true); reset(span_12); reset(span_9); template_effect(() => { classes_6 = set_class(span_9, 1, "task-property svelte-1fvsaoa", null, classes_6, { "dataview-property": propertySchemaOption() === "dataview" /* Dataview */ }); set_text(text_9, (get(prop2), untrack(() => get(prop2).value))); }); append($$anchor4, span_9); }); append($$anchor3, fragment_5); }; var alternate_4 = ($$anchor3) => { TaskDateFields($$anchor3, { get task() { return task(); }, get taskActions() { return taskActions(); }, get propertySchemaOption() { return propertySchemaOption(); }, get isTaskEditing() { return get(isEditing); }, get isEditingDates() { return get(isEditingDates); }, set isEditingDates($$value) { set(isEditingDates, $$value); }, $$legacy: true }); }; if_block(node_20, ($$render) => { if (!get(isEditingDates)) $$render(consequent_14); else $$render(alternate_4, -1); }); } reset(div_11); append($$anchor2, div_11); }; if_block(node_19, ($$render) => { if (get(dateEditingEnabled)) $$render(consequent_15); }); } var node_24 = sibling(node_19, 2); { var consequent_16 = ($$anchor2) => { var div_12 = root_20(); var button_3 = child(div_12); var node_25 = child(button_3); Icon(node_25, { name: "lucide-arrow-up-right", size: 18, opacity: 0.5 }); var span_13 = sibling(node_25, 2); var text_10 = child(span_13, true); reset(span_13); reset(button_3); reset(div_12); template_effect(() => set_text(text_10, (deep_read_state(task()), untrack(() => task().path)))); event("click", button_3, (e) => taskActions().viewFile(task().id, e)); event("keydown", button_3, (e) => { if (e.key === "Enter" || e.key === " ") { e.preventDefault(); taskActions().viewFile(task().id, e); } }); append($$anchor2, div_12); }; if_block(node_24, ($$render) => { if (showFilepath()) $$render(consequent_16); }); } reset(div); template_effect(() => { classes = set_class(div, 1, "task svelte-1fvsaoa", null, classes, { "is-dragging": get(isDragging), "is-selected": isSelectionMode() && isSelected(), "is-selection-mode": isSelectionMode() }); set_attribute2(div, "draggable", !get(isEditing)); styles = set_style(div, "", styles, { "--task-accent-color": accentColor() }); }); event("dragstart", div, handleDragStart); event("dragend", div, handleDragEnd); append($$anchor, div); return pop($$exports); } // src/ui/tasks/manual_order.ts function manualOrderKey(path, blockLink) { return `${path}::${blockLink}`; } function taskKey(task) { return task.blockLink ? manualOrderKey(task.path, task.blockLink) : null; } function computeDisplayOrder(tasks, entries) { if (!entries || entries.length === 0) { return tasks; } const byKey = /* @__PURE__ */ new Map(); for (const task of tasks) { const key2 = taskKey(task); if (key2 !== null && !byKey.has(key2)) { byKey.set(key2, task); } } const pinned = []; const pinnedIds = /* @__PURE__ */ new Set(); for (const entry of entries) { const task = byKey.get(entry); if (task && !pinnedIds.has(task.id)) { pinned.push(task); pinnedIds.add(task.id); } } const tail = tasks.filter((task) => !pinnedIds.has(task.id)); return [...pinned, ...tail]; } function computePinnedIds(tasks, entries) { const pinned = /* @__PURE__ */ new Set(); if (!entries || entries.length === 0) { return pinned; } const present = /* @__PURE__ */ new Set(); for (const task of tasks) { const key2 = taskKey(task); if (key2 !== null) present.add(key2); } const entrySet = new Set(entries); for (const task of tasks) { const key2 = taskKey(task); if (key2 !== null && entrySet.has(key2) && present.has(key2)) { pinned.add(task.id); } } return pinned; } function arrayMove(items, fromIndex, targetIndex) { if (fromIndex < 0 || fromIndex >= items.length) { return [...items]; } const next2 = [...items]; const [moved] = next2.splice(fromIndex, 1); if (moved === void 0) { return next2; } const clamped = Math.max(0, Math.min(targetIndex, next2.length)); next2.splice(clamped, 0, moved); return next2; } function computeDropPlan(displayOrder, draggedId, targetIndex) { const fromIndex = displayOrder.findIndex((task) => task.id === draggedId); if (fromIndex === -1) { return { prefixTasks: [], tasksNeedingBlockLink: [] }; } const reordered = arrayMove(displayOrder, fromIndex, targetIndex); const landedIndex = reordered.findIndex((task) => task.id === draggedId); const prefixTasks = reordered.slice(0, landedIndex + 1); const tasksNeedingBlockLink = prefixTasks.filter((task) => !task.blockLink); return { prefixTasks, tasksNeedingBlockLink }; } function buildOrderEntries(prefixTasks, resolveBlockLink) { return prefixTasks.map((task) => manualOrderKey(task.path, resolveBlockLink(task))); } function removeEntry(entries, key2) { if (!entries || entries.length === 0) { return entries != null ? entries : []; } const next2 = entries.filter((entry) => entry !== key2); return next2.length === entries.length ? entries : next2; } function collectPresentManualOrderKeys(tasks, assignGroupId) { var _a5, _b3, _c2; const presentKeysByGroupAndColumn = {}; for (const task of tasks) { if (!task.blockLink || task.column === "archived") { continue; } const groupId = assignGroupId(task); if (!groupId) { continue; } const columnTag = task.done || task.column === "done" ? "done" : (_a5 = task.column) != null ? _a5 : "uncategorised"; const keysByColumn = (_b3 = presentKeysByGroupAndColumn[groupId]) != null ? _b3 : {}; const keys = (_c2 = keysByColumn[columnTag]) != null ? _c2 : /* @__PURE__ */ new Set(); keys.add(manualOrderKey(task.path, task.blockLink)); keysByColumn[columnTag] = keys; presentKeysByGroupAndColumn[groupId] = keysByColumn; } return presentKeysByGroupAndColumn; } var BLOCK_LINK_ALPHABET = "abcdefghijklmnopqrstuvwxyz0123456789"; function generateBlockLinkId(existing) { for (let attempt = 0; attempt < 100; attempt++) { let id = ""; for (let i = 0; i < 6; i++) { id += BLOCK_LINK_ALPHABET[Math.floor(Math.random() * BLOCK_LINK_ALPHABET.length)]; } if (!existing.has(id)) { return id; } } return `t${Date.now().toString(36)}`; } var blockLinkRegexp2 = /\s\^([a-zA-Z0-9-]+)\s*$/; function ensureRowBlockLink(row, existing) { const existingMatch = row.match(blockLinkRegexp2); if (existingMatch == null ? void 0 : existingMatch[1]) { existing.add(existingMatch[1]); return { row, blockLink: existingMatch[1], changed: false }; } const blockLink = generateBlockLinkId(existing); existing.add(blockLink); return { row: `${row.trimEnd()} ^${blockLink}`, blockLink, changed: true }; } // src/ui/board/BoardCell.svelte var root11 = from_html(`(default)`); var root_110 = from_html(`
\u2192
`); var root_26 = from_html(`
Task
`, 1); var root_34 = from_html(`
`); var root_44 = from_html(`
`); var root_53 = from_html(`
`); var root_63 = from_html(`
`); var $$css11 = { hash: "svelte-xi2aql", code: '.tasks-wrapper.svelte-xi2aql {display:flex;flex-direction:column;height:100%;min-height:100%;border:var(--border-width) solid transparent;border-radius:var(--radius-s);\n /* The wrapper should be invisible if collapsed in horizontal mode */}.tasks-wrapper.collapsed.svelte-xi2aql {display:none;}.tasks-wrapper.vertical-collapsed.svelte-xi2aql {display:none;}.tasks-wrapper.vertical-flow.svelte-xi2aql {width:100%;display:flex;flex-direction:column;gap:var(--size-4-2);}.tasks-wrapper.vertical-flow.svelte-xi2aql .tasks:where(.svelte-xi2aql) {order:1;flex-direction:row;flex-wrap:nowrap;align-items:flex-start;min-width:max-content;}.tasks-wrapper.vertical-flow.svelte-xi2aql .tasks:where(.svelte-xi2aql) .task {width:var(--column-width, 300px);flex-shrink:0;}.tasks-wrapper.vertical-flow.svelte-xi2aql .task-slot:where(.svelte-xi2aql) {flex:0 0 var(--column-width, 300px);}.tasks-wrapper.vertical-flow.svelte-xi2aql .new-task-input:where(.svelte-xi2aql) {order:4;width:var(--column-width, 300px);box-sizing:border-box;}.tasks-wrapper.vertical-flow.svelte-xi2aql .add-new-controls:where(.svelte-xi2aql) {order:2;}.tasks-wrapper.vertical-flow.svelte-xi2aql .file-indicator:where(.svelte-xi2aql) {order:3;}.tasks-wrapper.drop-active.svelte-xi2aql .tasks:where(.svelte-xi2aql) {opacity:0.4;}.tasks-wrapper.drop-hover.svelte-xi2aql {border-color:color-mix(in srgb, var(--column-color, var(--interactive-accent)) 75%, transparent);background:color-mix(in srgb, var(--column-color, var(--interactive-accent)) 10%, transparent);}.tasks-wrapper.svelte-xi2aql .tasks:where(.svelte-xi2aql) {display:flex;flex-direction:column;gap:var(--size-4-2);padding-top:var(--size-4-2);}.tasks-wrapper.svelte-xi2aql .task-slot:where(.svelte-xi2aql) {position:relative;}.tasks-wrapper.svelte-xi2aql .task-slot.drop-before:where(.svelte-xi2aql)::before, .tasks-wrapper.svelte-xi2aql .task-slot.drop-after:where(.svelte-xi2aql)::before {content:"";position:absolute;left:8px;right:8px;height:2px;background:var(--column-color, var(--interactive-accent));pointer-events:none;}.tasks-wrapper.svelte-xi2aql .task-slot.drop-before:where(.svelte-xi2aql)::after, .tasks-wrapper.svelte-xi2aql .task-slot.drop-after:where(.svelte-xi2aql)::after {content:"";position:absolute;left:4px;width:10px;height:10px;border-radius:999px;background:var(--column-color, var(--interactive-accent));pointer-events:none;}.tasks-wrapper.svelte-xi2aql .task-slot.drop-before:where(.svelte-xi2aql)::before {top:calc(-1 * var(--size-4-1) - 1px);}.tasks-wrapper.svelte-xi2aql .task-slot.drop-before:where(.svelte-xi2aql)::after {top:calc(-1 * var(--size-4-1) - 5px);}.tasks-wrapper.svelte-xi2aql .task-slot.drop-after:where(.svelte-xi2aql)::before {bottom:calc(-1 * var(--size-4-1) - 1px);}.tasks-wrapper.svelte-xi2aql .task-slot.drop-after:where(.svelte-xi2aql)::after {bottom:calc(-1 * var(--size-4-1) - 5px);}.tasks-wrapper.svelte-xi2aql .new-task-input:where(.svelte-xi2aql) {margin-top:var(--size-4-3);background-color:var(--background-primary);border-radius:var(--radius-s);border:var(--border-width) solid var(--background-modifier-border);padding:var(--size-4-2);}.tasks-wrapper.svelte-xi2aql .new-task-input:where(.svelte-xi2aql) textarea:where(.svelte-xi2aql) {cursor:text;background-color:var(--color-base-25);width:100%;}.tasks-wrapper.svelte-xi2aql .new-task-date-fields:where(.svelte-xi2aql) {margin-top:var(--size-2-3);}.tasks-wrapper.svelte-xi2aql .add-new-btn:where(.svelte-xi2aql) {display:inline-flex;align-items:center;gap:var(--size-2-1);align-self:flex-start;cursor:pointer;border:0;border-radius:var(--radius-s);box-shadow:none;margin:0;min-height:26px;padding:0;background:transparent;background-color:transparent;color:var(--text-accent);font-size:var(--font-ui-small);font-weight:var(--font-medium);line-height:1.2;}.tasks-wrapper.svelte-xi2aql .add-new-btn:where(.svelte-xi2aql) span:where(.svelte-xi2aql) {display:inline-flex;align-items:center;justify-content:center;font-size:var(--font-ui-medium);line-height:1;}.tasks-wrapper.svelte-xi2aql .add-new-btn.disabled:where(.svelte-xi2aql) {cursor:not-allowed;opacity:0.5;color:var(--text-muted);pointer-events:none;}.tasks-wrapper.svelte-xi2aql .add-new-controls:where(.svelte-xi2aql) {display:inline-flex;align-items:center;gap:var(--size-2-1);align-self:flex-start;border:0;background:transparent;box-shadow:none;}.tasks-wrapper.svelte-xi2aql .add-new-picker-btn {flex-shrink:0;width:22px;height:26px;border:0;border-radius:var(--radius-s);box-shadow:none;margin:0;background-color:transparent;color:var(--text-accent);}.tasks-wrapper.svelte-xi2aql .add-new-picker-btn.disabled:where(.svelte-xi2aql) {cursor:not-allowed;opacity:0.5;color:var(--text-muted);pointer-events:none;}.tasks-wrapper.svelte-xi2aql .add-new-btn:where(.svelte-xi2aql),\n.tasks-wrapper.svelte-xi2aql .add-new-picker-btn {background-color:transparent;}.tasks-wrapper.svelte-xi2aql .add-new-btn:where(.svelte-xi2aql):hover:not(.disabled),\n.tasks-wrapper.svelte-xi2aql .add-new-picker-btn:hover:not(.disabled) {background-color:transparent;color:var(--text-accent-hover);}.tasks-wrapper.svelte-xi2aql .add-new-btn:where(.svelte-xi2aql):active:not(.disabled),\n.tasks-wrapper.svelte-xi2aql .add-new-picker-btn:active:not(.disabled) {background-color:transparent;color:var(--text-accent-hover);}.tasks-wrapper.svelte-xi2aql .file-indicator:where(.svelte-xi2aql) {display:flex;align-items:center;gap:var(--size-2-1);font-size:var(--font-ui-small);color:var(--text-muted);margin-top:var(--size-2-1);}.tasks-wrapper.svelte-xi2aql .file-indicator:where(.svelte-xi2aql) .file-indicator-arrow:where(.svelte-xi2aql) {flex-shrink:0;}.tasks-wrapper.svelte-xi2aql .file-indicator:where(.svelte-xi2aql) .file-indicator-name:where(.svelte-xi2aql) {overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.tasks-wrapper.svelte-xi2aql .file-indicator:where(.svelte-xi2aql) .file-indicator-label:where(.svelte-xi2aql) {white-space:nowrap;}' }; function BoardCell($$anchor, $$props) { if (new.target) return createClassComponent({ component: BoardCell, ...$$anchor }); push($$props, false); append_styles($$anchor, $$css11); const $selectionModeStore = () => store_get(selectionModeStore, "$selectionModeStore", $$stores); const $taskSelectionStore = () => store_get(taskSelectionStore, "$taskSelectionStore", $$stores); const $isDraggingStore = () => store_get(isDraggingStore, "$isDraggingStore", $$stores); const [$$stores, $$cleanup] = setup_stores(); const column = mutable_source(); const tasks = mutable_source(); const columnTitle = mutable_source(); const creationMetadata = mutable_source(); const fileGroupTargetFile = mutable_source(); const effectiveTargetTaskFile = mutable_source(); const effectiveTargetFileIsDefault = mutable_source(); const isColTag = mutable_source(); const isSelectMode = mutable_source(); const columnTaskIds = mutable_source(); const selectedIds = mutable_source(); const taskSecondaryIds = mutable_source(); const pinnedIds = mutable_source(); const displayIds = mutable_source(); const isManualReorderDrag = mutable_source(); const draggingData = mutable_source(); const hasSelectedTaskOutsideTargetFile = mutable_source(); const isSameSwimlaneColumnDrop = mutable_source(); const isFileSwimlaneDrop = mutable_source(); const isTagSwimlaneDrop = mutable_source(); const canDrop = mutable_source(); const canEditNewTaskDates = mutable_source(); let app = prop($$props, "app", 12); let cell = prop($$props, "cell", 12); let primaryTasks = prop($$props, "primaryTasks", 28, () => []); let secondaryAxisBucket = prop($$props, "secondaryAxisBucket", 12); let primaryAxisLabel = prop($$props, "primaryAxisLabel", 12); let taskActions = prop($$props, "taskActions", 12); let columnTagTableStore = prop($$props, "columnTagTableStore", 12); let showFilepath = prop($$props, "showFilepath", 12); let propertyDisplay = prop($$props, "propertyDisplay", 28, () => "none" /* None */); let propertySchemaOption = prop($$props, "propertySchemaOption", 28, () => "none" /* None */); let consolidateTags = prop($$props, "consolidateTags", 12); let excludedTags = prop($$props, "excludedTags", 28, () => []); let isVerticalFlow = prop($$props, "isVerticalFlow", 12, false); let targetTaskFile = prop($$props, "targetTaskFile", 12, null); let targetFileIsDefault = prop($$props, "targetFileIsDefault", 12, false); let doneColumnName = prop($$props, "doneColumnName", 12, void 0); let accentColor = prop($$props, "accentColor", 12, void 0); let treatNestedTasksAsSubtasks = prop($$props, "treatNestedTasksAsSubtasks", 12, false); let isManualOrder = prop($$props, "isManualOrder", 12, false); let manualOrderEntries = prop($$props, "manualOrderEntries", 12, void 0); let reorderEnabled = prop($$props, "reorderEnabled", 12, false); let isCollapsed = prop($$props, "isCollapsed", 12, false); let isDraggedOver = mutable_source(false); let reorderOverId = mutable_source(null); let reorderPlaceBefore = mutable_source(false); function computeTargetIndex(draggedId, overId, placeBefore) { const without = get(displayIds).filter((id) => id !== draggedId); const overPos = without.indexOf(overId); if (overPos === -1) return without.length; return placeBefore ? overPos : overPos + 1; } function handleReorderDragOver(e, overTaskId) { if (!get(isManualReorderDrag)) return; e.preventDefault(); e.stopPropagation(); const target = e.currentTarget; const rect = target.getBoundingClientRect(); set(reorderPlaceBefore, e.clientY < rect.top + rect.height / 2); set(reorderOverId, overTaskId); if (e.dataTransfer) e.dataTransfer.dropEffect = "move"; } function handleReorderDragLeave() { set(reorderOverId, null); } async function handleReorderDrop(e, overTaskId) { if (!get(isManualReorderDrag) || !get(draggingData)) return; e.preventDefault(); e.stopPropagation(); const draggedId = get(draggingData).draggedTaskIds[0]; const placeBefore = get(reorderPlaceBefore); set(reorderOverId, null); if (!draggedId || draggedId === overTaskId) return; const targetIndex = computeTargetIndex(draggedId, overTaskId, placeBefore); await taskActions().reorderTask(cell().secondaryId, get(column), get(displayIds), draggedId, targetIndex); } function handleDragOver(e) { e.preventDefault(); if (!get(canDrop)) { if (e.dataTransfer) { e.dataTransfer.dropEffect = "none"; } return; } set(isDraggedOver, true); if (e.dataTransfer) { e.dataTransfer.dropEffect = "move"; } } function handleDragLeave(e) { set(isDraggedOver, false); } async function handleDrop(e) { var _a5, _b3, _c2, _d; e.preventDefault(); set(isDraggedOver, false); if (!get(canDrop) || !get(draggingData)) { return; } const droppedIds = get(draggingData).draggedTaskIds.length > 0 ? get(draggingData).draggedTaskIds : (() => { var _a6; const id = (_a6 = e.dataTransfer) == null ? void 0 : _a6.getData("text/plain"); return id ? [id] : []; })(); if (droppedIds.length === 0) return; if (get(isFileSwimlaneDrop) && get(fileGroupTargetFile)) { const droppedIdsBySourceSwimlane = groupIdsBySecondaryId(droppedIds, get(draggingData).taskSecondaryIds); for (const [sourceFilePath, ids] of droppedIdsBySourceSwimlane) { if (sourceFilePath === get(fileGroupTargetFile).path) { await applyColumnChange(ids); } else { await taskActions().moveTasksToFile(ids, get(fileGroupTargetFile), get(column)); } } } else if (get(isTagSwimlaneDrop)) { const source2 = (_a5 = secondaryAxisBucket().meta) == null ? void 0 : _a5.source; const prefix = (source2 == null ? void 0 : source2.kind) === "tag-prefix" ? (_b3 = source2.prefix) != null ? _b3 : "" : ""; await taskActions().updateSwimlaneTag(droppedIds, (_d = (_c2 = secondaryAxisBucket().meta) == null ? void 0 : _c2.value) != null ? _d : null, prefix, excludedTags()); await applyColumnChange(droppedIds); } else { await applyColumnChange(droppedIds); } clearColumnSelections(droppedIds); } let pendingNewTask = mutable_source(null); let pendingCancelled = false; let newTaskTextAreaEl = mutable_source(); let newTaskInputEl = mutable_source(); const emptyDateValues = { due: "", scheduled: "", start: "" }; let newTaskDateValues = mutable_source({ ...emptyDateValues }); async function handleNewTaskSave(event2) { var _a5, _b3, _c2; const nextTarget = event2 == null ? void 0 : event2.relatedTarget; if (nextTarget instanceof Node && ((_a5 = get(newTaskInputEl)) == null ? void 0 : _a5.contains(nextTarget))) { return; } if (pendingCancelled) { pendingCancelled = false; set(pendingNewTask, null); set(newTaskDateValues, { ...emptyDateValues }); return; } const content = (_c2 = (_b3 = get(newTaskTextAreaEl)) == null ? void 0 : _b3.value) == null ? void 0 : _c2.trim(); const file = get(pendingNewTask); set(pendingNewTask, null); if (!content || !file || !get(isColTag)) { set(newTaskDateValues, { ...emptyDateValues }); return; } await taskActions().createTask(file, content, get(column), get(creationMetadata).additionalTags, get(newTaskDateValues)); set(newTaskDateValues, { ...emptyDateValues }); } function handleNewTaskKeydown(e) { var _a5, _b3; if (e.key === "Escape") { e.preventDefault(); pendingCancelled = true; (_a5 = get(newTaskTextAreaEl)) == null ? void 0 : _a5.blur(); } else if (e.key === "Enter" && !e.shiftKey) { e.preventDefault(); (_b3 = get(newTaskTextAreaEl)) == null ? void 0 : _b3.blur(); } } function handleAddNewClick(e) { if (!get(isColTag)) { return; } set(newTaskDateValues, { ...emptyDateValues }); if (get(fileGroupTargetFile)) { set(pendingNewTask, get(fileGroupTargetFile)); return; } taskActions().pickFileForNewTask(get(column), e, (file) => { set(newTaskDateValues, { ...emptyDateValues }); set(pendingNewTask, file); }); } function handleChooseTaskFileClick(e) { if (!get(isColTag)) { return; } taskActions().pickFileForNewTask( get(column), e, (file) => { set(newTaskDateValues, { ...emptyDateValues }); set(pendingNewTask, file); }, true ); } function handleNewTaskDateChange(key2, value) { set(newTaskDateValues, { ...get(newTaskDateValues), [key2]: value }); } function groupIdsBySecondaryId(taskIds, taskSecondaryIds2) { var _a5, _b3; const grouped = /* @__PURE__ */ new Map(); for (const id of taskIds) { const secondaryId = (_a5 = taskSecondaryIds2[id]) != null ? _a5 : ""; const ids = (_b3 = grouped.get(secondaryId)) != null ? _b3 : []; ids.push(id); grouped.set(secondaryId, ids); } return grouped; } async function applyColumnChange(taskIds) { for (const id of taskIds) { switch (get(column)) { case "done": await taskActions().markDone(id); break; default: await taskActions().changeColumn(id, get(column)); break; } } } legacy_pre_effect(() => deep_read_state(cell()), () => { set(column, cell().primaryId); }); legacy_pre_effect(() => deep_read_state(cell()), () => { set(tasks, cell().tasks); }); legacy_pre_effect(() => deep_read_state(primaryAxisLabel()), () => { set(columnTitle, primaryAxisLabel()); }); legacy_pre_effect( () => (deriveCellCreationMetadata, deep_read_state(secondaryAxisBucket())), () => { set(creationMetadata, deriveCellCreationMetadata(secondaryAxisBucket())); } ); legacy_pre_effect(() => (get(creationMetadata), deep_read_state(app()), import_obsidian7.TFile), () => { set(fileGroupTargetFile, (() => { if (!get(creationMetadata).targetFilePath) return null; const file = app().vault.getAbstractFileByPath(get(creationMetadata).targetFilePath); return file instanceof import_obsidian7.TFile ? file : null; })()); }); legacy_pre_effect( () => (get(fileGroupTargetFile), deep_read_state(targetTaskFile())), () => { var _a5; set(effectiveTargetTaskFile, (_a5 = get(fileGroupTargetFile)) != null ? _a5 : targetTaskFile()); } ); legacy_pre_effect( () => (get(fileGroupTargetFile), deep_read_state(targetFileIsDefault())), () => { set(effectiveTargetFileIsDefault, get(fileGroupTargetFile) ? false : targetFileIsDefault()); } ); legacy_pre_effect( () => (isColumnTag, get(column), deep_read_state(columnTagTableStore())), () => { set(isColTag, isColumnTag(get(column), columnTagTableStore())); } ); legacy_pre_effect(() => (isInSelectionMode, get(column), $selectionModeStore()), () => { set(isSelectMode, isInSelectionMode(get(column), $selectionModeStore())); }); legacy_pre_effect(() => deep_read_state(primaryTasks()), () => { set(columnTaskIds, primaryTasks().map((t) => t.id)); }); legacy_pre_effect(() => (get(columnTaskIds), isTaskSelected, $taskSelectionStore()), () => { set(selectedIds, get(columnTaskIds).filter((id) => isTaskSelected(id, $taskSelectionStore()))); }); legacy_pre_effect(() => deep_read_state(primaryTasks()), () => { set(taskSecondaryIds, Object.fromEntries(primaryTasks().map((task) => [task.id, task.path]))); }); legacy_pre_effect( () => (deep_read_state(isManualOrder()), computePinnedIds, get(tasks), deep_read_state(manualOrderEntries())), () => { set(pinnedIds, isManualOrder() ? computePinnedIds(get(tasks), manualOrderEntries()) : /* @__PURE__ */ new Set()); } ); legacy_pre_effect(() => get(tasks), () => { set(displayIds, get(tasks).map((t) => t.id)); }); legacy_pre_effect(() => $isDraggingStore(), () => { set(draggingData, $isDraggingStore()); }); legacy_pre_effect( () => (deep_read_state(reorderEnabled()), get(draggingData), get(column), deep_read_state(cell())), () => { set(isManualReorderDrag, reorderEnabled() && !!get(draggingData) && get(draggingData).fromColumn === get(column) && get(draggingData).fromSecondaryId === cell().secondaryId && get(draggingData).draggedTaskIds.length === 1); } ); legacy_pre_effect(() => (get(draggingData), get(fileGroupTargetFile)), () => { set(hasSelectedTaskOutsideTargetFile, !!get(draggingData) && !!get(fileGroupTargetFile) && get(draggingData).draggedTaskIds.some((id) => { var _a5; return ((_a5 = get(draggingData)) == null ? void 0 : _a5.taskSecondaryIds[id]) !== get(fileGroupTargetFile).path; })); }); legacy_pre_effect( () => (get(draggingData), get(column), deep_read_state(cell())), () => { set(isSameSwimlaneColumnDrop, !!get(draggingData) && get(draggingData).fromColumn !== get(column) && get(draggingData).fromSecondaryId === cell().secondaryId); } ); legacy_pre_effect( () => (get(draggingData), get(fileGroupTargetFile), deep_read_state(cell()), get(hasSelectedTaskOutsideTargetFile)), () => { set(isFileSwimlaneDrop, !!get(draggingData) && !!get(fileGroupTargetFile) && (get(draggingData).fromSecondaryId !== cell().secondaryId || get(hasSelectedTaskOutsideTargetFile))); } ); legacy_pre_effect( () => (get(draggingData), deep_read_state(secondaryAxisBucket()), deep_read_state(cell())), () => { var _a5, _b3; set(isTagSwimlaneDrop, !!get(draggingData) && ((_b3 = (_a5 = secondaryAxisBucket().meta) == null ? void 0 : _a5.source) == null ? void 0 : _b3.kind) === "tag-prefix" && get(draggingData).fromSecondaryId !== cell().secondaryId); } ); legacy_pre_effect( () => (get(isSameSwimlaneColumnDrop), get(isFileSwimlaneDrop), get(isTagSwimlaneDrop)), () => { set(canDrop, get(isSameSwimlaneColumnDrop) || get(isFileSwimlaneDrop) || get(isTagSwimlaneDrop)); } ); legacy_pre_effect( () => (getPropertyWriteAdapter, deep_read_state(propertySchemaOption())), () => { set(canEditNewTaskDates, getPropertyWriteAdapter(propertySchemaOption()) !== null); } ); legacy_pre_effect(() => (get(pendingNewTask), get(newTaskTextAreaEl)), () => { if (get(pendingNewTask) && get(newTaskTextAreaEl)) { get(newTaskTextAreaEl).focus(); } }); legacy_pre_effect_reset(); var $$exports = { get app() { return app(); }, set app($$value) { app($$value); flushSync(); }, get cell() { return cell(); }, set cell($$value) { cell($$value); flushSync(); }, get primaryTasks() { return primaryTasks(); }, set primaryTasks($$value) { primaryTasks($$value); flushSync(); }, get secondaryAxisBucket() { return secondaryAxisBucket(); }, set secondaryAxisBucket($$value) { secondaryAxisBucket($$value); flushSync(); }, get primaryAxisLabel() { return primaryAxisLabel(); }, set primaryAxisLabel($$value) { primaryAxisLabel($$value); flushSync(); }, get taskActions() { return taskActions(); }, set taskActions($$value) { taskActions($$value); flushSync(); }, get columnTagTableStore() { return columnTagTableStore(); }, set columnTagTableStore($$value) { columnTagTableStore($$value); flushSync(); }, get showFilepath() { return showFilepath(); }, set showFilepath($$value) { showFilepath($$value); flushSync(); }, get propertyDisplay() { return propertyDisplay(); }, set propertyDisplay($$value) { propertyDisplay($$value); flushSync(); }, get propertySchemaOption() { return propertySchemaOption(); }, set propertySchemaOption($$value) { propertySchemaOption($$value); flushSync(); }, get consolidateTags() { return consolidateTags(); }, set consolidateTags($$value) { consolidateTags($$value); flushSync(); }, get excludedTags() { return excludedTags(); }, set excludedTags($$value) { excludedTags($$value); flushSync(); }, get isVerticalFlow() { return isVerticalFlow(); }, set isVerticalFlow($$value) { isVerticalFlow($$value); flushSync(); }, get targetTaskFile() { return targetTaskFile(); }, set targetTaskFile($$value) { targetTaskFile($$value); flushSync(); }, get targetFileIsDefault() { return targetFileIsDefault(); }, set targetFileIsDefault($$value) { targetFileIsDefault($$value); flushSync(); }, get doneColumnName() { return doneColumnName(); }, set doneColumnName($$value) { doneColumnName($$value); flushSync(); }, get accentColor() { return accentColor(); }, set accentColor($$value) { accentColor($$value); flushSync(); }, get treatNestedTasksAsSubtasks() { return treatNestedTasksAsSubtasks(); }, set treatNestedTasksAsSubtasks($$value) { treatNestedTasksAsSubtasks($$value); flushSync(); }, get isManualOrder() { return isManualOrder(); }, set isManualOrder($$value) { isManualOrder($$value); flushSync(); }, get manualOrderEntries() { return manualOrderEntries(); }, set manualOrderEntries($$value) { manualOrderEntries($$value); flushSync(); }, get reorderEnabled() { return reorderEnabled(); }, set reorderEnabled($$value) { reorderEnabled($$value); flushSync(); }, get isCollapsed() { return isCollapsed(); }, set isCollapsed($$value) { isCollapsed($$value); flushSync(); }, $set: update_legacy_props, $on: ($$event_name, $$event_cb) => add_legacy_event_listener($$props, $$event_name, $$event_cb) }; init(); var div = root_63(); let classes; var node = child(div); { var consequent_2 = ($$anchor2) => { var fragment = root_26(); var div_1 = first_child(fragment); var div_2 = child(div_1); let classes_1; var node_1 = sibling(div_2, 2); { let $0 = derived_safe_equal(() => get(pendingNewTask) ? "disabled" : ""); let $1 = derived_safe_equal(() => !!get(pendingNewTask)); Icon_button(node_1, { get class() { var _a5; return `add-new-picker-btn ${(_a5 = get($0)) != null ? _a5 : ""}`; }, icon: "lucide-chevron-down", get "aria-label"() { var _a5; return `Choose file for new task in ${(_a5 = get(columnTitle)) != null ? _a5 : ""}`; }, get disabled() { return get($1); }, $$events: { click(...$$args) { var _a5; (_a5 = !get(pendingNewTask) ? handleChooseTaskFileClick : void 0) == null ? void 0 : _a5.apply(this, $$args); } } }); } reset(div_1); var node_2 = sibling(div_1, 2); { var consequent_1 = ($$anchor3) => { var div_3 = root_110(); var span = sibling(child(div_3), 2); var text2 = child(span, true); reset(span); var node_3 = sibling(span, 2); { var consequent = ($$anchor4) => { var span_1 = root11(); append($$anchor4, span_1); }; if_block(node_3, ($$render) => { if (get(effectiveTargetFileIsDefault)) $$render(consequent); }); } reset(div_3); template_effect(() => { set_attribute2(span, "title", (get(effectiveTargetTaskFile), untrack(() => get(effectiveTargetTaskFile).path))); set_text(text2, (get(effectiveTargetTaskFile), untrack(() => get(effectiveTargetTaskFile).name))); }); append($$anchor3, div_3); }; if_block(node_2, ($$render) => { if (get(effectiveTargetTaskFile)) $$render(consequent_1); }); } template_effect(() => { var _a5; classes_1 = set_class(div_2, 1, "add-new-btn svelte-xi2aql", null, classes_1, { disabled: !!get(pendingNewTask) }); set_attribute2(div_2, "tabindex", get(pendingNewTask) ? -1 : 0); set_attribute2(div_2, "aria-label", `Add new task to ${(_a5 = get(columnTitle)) != null ? _a5 : ""}`); set_attribute2(div_2, "aria-disabled", !!get(pendingNewTask)); }); event("click", div_2, function(...$$args) { var _a5; (_a5 = !get(pendingNewTask) ? handleAddNewClick : void 0) == null ? void 0 : _a5.apply(this, $$args); }); event("keydown", div_2, (e) => { if (!get(pendingNewTask) && (e.key === "Enter" || e.key === " ")) { e.preventDefault(); handleAddNewClick(); } }); append($$anchor2, fragment); }; if_block(node, ($$render) => { if (get(isColTag)) $$render(consequent_2); }); } var node_4 = sibling(node, 2); { var consequent_4 = ($$anchor2) => { var div_4 = root_44(); var textarea = child(div_4); bind_this(textarea, ($$value) => set(newTaskTextAreaEl, $$value), () => get(newTaskTextAreaEl)); var node_5 = sibling(textarea, 2); { var consequent_3 = ($$anchor3) => { var div_5 = root_34(); var node_6 = child(div_5); DateInputFields(node_6, { get values() { return get(newTaskDateValues); }, onDateChange: handleNewTaskDateChange }); reset(div_5); append($$anchor3, div_5); }; if_block(node_5, ($$render) => { if (get(canEditNewTaskDates)) $$render(consequent_3); }); } reset(div_4); bind_this(div_4, ($$value) => set(newTaskInputEl, $$value), () => get(newTaskInputEl)); event("keydown", textarea, handleNewTaskKeydown); event("focusout", div_4, handleNewTaskSave); append($$anchor2, div_4); }; if_block(node_4, ($$render) => { if (get(pendingNewTask)) $$render(consequent_4); }); } var div_6 = sibling(node_4, 2); each(div_6, 5, () => get(tasks), (task) => task.id, ($$anchor2, task) => { var div_7 = root_53(); let classes_2; var node_7 = child(div_7); { let $0 = derived_safe_equal(() => (deep_read_state(isTaskSelected), get(task), $taskSelectionStore(), untrack(() => isTaskSelected(get(task).id, $taskSelectionStore())))); let $1 = derived_safe_equal(() => (get(pinnedIds), get(task), untrack(() => get(pinnedIds).has(get(task).id)))); Task2(node_7, { get app() { return app(); }, get task() { return get(task); }, get taskActions() { return taskActions(); }, get columnTagTableStore() { return columnTagTableStore(); }, get showFilepath() { return showFilepath(); }, get propertyDisplay() { return propertyDisplay(); }, get propertySchemaOption() { return propertySchemaOption(); }, get consolidateTags() { return consolidateTags(); }, get excludedTags() { return excludedTags(); }, get treatNestedTasksAsSubtasks() { return treatNestedTasksAsSubtasks(); }, get displayColumn() { return get(column); }, get displaySecondaryId() { return deep_read_state(cell()), untrack(() => cell().secondaryId); }, get isSelectionMode() { return get(isSelectMode); }, get isSelected() { return get($0); }, onToggleSelection: () => toggleTaskSelection(get(task).id), get selectedTaskIds() { return get(selectedIds); }, get taskSecondaryIds() { return get(taskSecondaryIds); }, get doneColumnName() { return doneColumnName(); }, get accentColor() { return accentColor(); }, get isManualOrder() { return isManualOrder(); }, get isPinned() { return get($1); }, get showDragHandle() { return reorderEnabled(); }, onUnpin: () => taskActions().unpinTask(cell().secondaryId, get(column), get(task).id) }); } reset(div_7); template_effect(() => classes_2 = set_class(div_7, 1, "task-slot svelte-xi2aql", null, classes_2, { "drop-before": get(isManualReorderDrag) && get(reorderOverId) === get(task).id && get(reorderPlaceBefore), "drop-after": get(isManualReorderDrag) && get(reorderOverId) === get(task).id && !get(reorderPlaceBefore) })); event("dragover", div_7, (e) => handleReorderDragOver(e, get(task).id)); event("drop", div_7, (e) => handleReorderDrop(e, get(task).id)); event("dragleave", div_7, handleReorderDragLeave); append($$anchor2, div_7); }); reset(div_6); reset(div); template_effect(() => classes = set_class(div, 1, "tasks-wrapper svelte-xi2aql", null, classes, { "vertical-flow": isVerticalFlow(), collapsed: isCollapsed() && !isVerticalFlow(), "vertical-collapsed": isCollapsed() && isVerticalFlow(), "drop-active": !!get(draggingData) && !get(isManualReorderDrag), "drop-hover": get(isDraggedOver) })); event("dragover", div, handleDragOver); event("dragleave", div, handleDragLeave); event("drop", div, handleDrop); append($$anchor, div); var $$pop = pop($$exports); $$cleanup(); return $$pop; } // src/ui/board/board_matrix_vertical.svelte var root12 = from_html(`
`, 1); var root_111 = from_html(`
`); var root_27 = from_html(`
`); var root_35 = from_html(`
`); var root_45 = from_html(`
`, 1); var root_54 = from_html(`
`); var $$css12 = { hash: "svelte-iq029y", code: ".matrix-vertical.svelte-iq029y {--vertical-row-header-width: clamp(220px, 24vw, 280px);padding-bottom:var(--size-4-4);}.matrix-vertical.ungrouped-grid.svelte-iq029y, .matrix-vertical.transposed-grid.svelte-iq029y {display:grid;column-gap:0;row-gap:0;align-items:stretch;min-width:max-content;border:var(--border-width) solid var(--background-modifier-border);border-radius:var(--radius-m);background:var(--background-primary);box-shadow:var(--shadow-s);overflow:visible;}.matrix-vertical.ungrouped-grid.svelte-iq029y {grid-template-columns:var(--vertical-row-header-width) max-content;}.matrix-corner.svelte-iq029y,\n.group-header-cell.svelte-iq029y {position:sticky;top:0;z-index:5;min-height:64px;background:color-mix(in srgb, var(--background-secondary) 72%, var(--background-primary));border-right:var(--border-width) solid var(--background-modifier-border);border-bottom:var(--border-width) solid var(--background-modifier-border);box-shadow:inset 0 var(--border-width) 0 var(--background-modifier-border), inset var(--border-width) 0 0 var(--background-modifier-border);}.matrix-corner.svelte-iq029y {left:0;z-index:8;}.group-header-cell.svelte-iq029y {display:flex;align-items:center;min-width:var(--column-width, 300px);padding:var(--size-4-3) var(--size-4-4);overflow:clip;}.group-header-cell.svelte-iq029y .group-label:where(.svelte-iq029y) {position:sticky;left:calc(var(--vertical-row-header-width) + var(--size-4-4));display:inline-block;max-width:max-content;color:var(--text-normal);font-size:var(--font-ui-medium);font-weight:var(--font-medium);line-height:1.2;white-space:nowrap;}.row-header-wrapper.svelte-iq029y,\n.row-cell.svelte-iq029y {border-bottom:var(--border-width) solid var(--background-modifier-border);}.row-header-wrapper.svelte-iq029y {position:sticky;left:0;z-index:4;display:flex;align-items:stretch;min-height:96px;padding:var(--size-4-2) var(--size-4-3);background:color-mix(in srgb, var(--background-secondary) 72%, var(--background-primary));border-right:var(--border-width) solid var(--background-modifier-border);--column-header-x-padding-override: var(--size-4-3);--column-header-y-padding-override: var(--size-4-2);}.row-header-wrapper.collapsed.svelte-iq029y {min-height:64px;cursor:pointer;}.row-cell.svelte-iq029y {z-index:1;display:flex;align-self:stretch;min-height:96px;min-width:max-content;padding:var(--size-4-2) var(--size-4-4);background:color-mix(in srgb, var(--background-primary) 88%, var(--background-secondary));}.row-cell.collapsed.svelte-iq029y {display:none;}.cell-wrapper.svelte-iq029y {padding:var(--size-4-2) var(--size-4-4);border-bottom:var(--border-width) solid var(--background-modifier-border);}.cell-wrapper.grouped-cell.svelte-iq029y {z-index:1;display:flex;align-self:stretch;min-height:96px;min-width:var(--column-width, 300px);background:color-mix(in srgb, var(--background-primary) 88%, var(--background-secondary));border-right:var(--border-width) solid var(--background-modifier-border);}.cell-wrapper.grouped-cell.collapsed.svelte-iq029y {display:none;}" }; function Board_matrix_vertical($$anchor, $$props) { if (new.target) return createClassComponent({ component: Board_matrix_vertical, ...$$anchor }); push($$props, false); append_styles($$anchor, $$css12); const tasksByPrimary = mutable_source(); const showSwimlaneHeaders = mutable_source(); const ungroupedSecondaryBucket = mutable_source(); const ungroupedGridTemplateRows = mutable_source(); const groupedGridTemplateColumns = mutable_source(); const groupedGridTemplateRows = mutable_source(); let app = prop($$props, "app", 12); let matrix = prop($$props, "matrix", 12); let taskActions = prop($$props, "taskActions", 12); let columnTagTableStore = prop($$props, "columnTagTableStore", 12); let columnColourTableStore = prop($$props, "columnColourTableStore", 12); let columnMatchTagTableStore = prop($$props, "columnMatchTagTableStore", 12); let columnSubtitleTableStore = prop($$props, "columnSubtitleTableStore", 12); let showFilepath = prop($$props, "showFilepath", 12); let propertyDisplay = prop($$props, "propertyDisplay", 28, () => "none" /* None */); let propertySchemaOption = prop($$props, "propertySchemaOption", 28, () => "none" /* None */); let consolidateTags = prop($$props, "consolidateTags", 12); let excludedTags = prop($$props, "excludedTags", 28, () => []); let targetTaskFile = prop($$props, "targetTaskFile", 12, null); let targetFileIsDefault = prop($$props, "targetFileIsDefault", 12, false); let onToggleCollapse = prop($$props, "onToggleCollapse", 12); let uncategorizedColumnName = prop($$props, "uncategorizedColumnName", 12, void 0); let doneColumnName = prop($$props, "doneColumnName", 12, void 0); let isManualOrder = prop($$props, "isManualOrder", 12, false); let manualOrder = prop($$props, "manualOrder", 28, () => ({})); let reorderEnabled = prop($$props, "reorderEnabled", 12, false); let treatNestedTasksAsSubtasks = prop($$props, "treatNestedTasksAsSubtasks", 12, false); let headerHeight = mutable_source(64); legacy_pre_effect(() => deep_read_state(matrix()), () => { set(tasksByPrimary, Object.fromEntries(matrix().primaryAxis.map((bucket) => [ bucket.id, Object.values(matrix().cells[bucket.id] || {}).flatMap((cell) => cell.tasks) ]))); }); legacy_pre_effect(() => deep_read_state(matrix()), () => { var _a5; set(showSwimlaneHeaders, matrix().secondaryAxis.length > 1 || matrix().secondaryAxis.length > 0 && !((_a5 = matrix().secondaryAxis[0].meta) == null ? void 0 : _a5.isDefault)); }); legacy_pre_effect(() => deep_read_state(matrix()), () => { set(ungroupedSecondaryBucket, matrix().secondaryAxis[0]); }); legacy_pre_effect(() => deep_read_state(matrix()), () => { set(ungroupedGridTemplateRows, matrix().primaryAxis.map(() => "max-content").join(" ")); }); legacy_pre_effect(() => deep_read_state(matrix()), () => { set(groupedGridTemplateColumns, [ "var(--vertical-row-header-width)", ...matrix().secondaryAxis.map(() => "max-content") ].join(" ")); }); legacy_pre_effect(() => deep_read_state(matrix()), () => { set(groupedGridTemplateRows, [ "max-content", ...matrix().primaryAxis.map(() => "max-content") ].join(" ")); }); legacy_pre_effect_reset(); var $$exports = { get app() { return app(); }, set app($$value) { app($$value); flushSync(); }, get matrix() { return matrix(); }, set matrix($$value) { matrix($$value); flushSync(); }, get taskActions() { return taskActions(); }, set taskActions($$value) { taskActions($$value); flushSync(); }, get columnTagTableStore() { return columnTagTableStore(); }, set columnTagTableStore($$value) { columnTagTableStore($$value); flushSync(); }, get columnColourTableStore() { return columnColourTableStore(); }, set columnColourTableStore($$value) { columnColourTableStore($$value); flushSync(); }, get columnMatchTagTableStore() { return columnMatchTagTableStore(); }, set columnMatchTagTableStore($$value) { columnMatchTagTableStore($$value); flushSync(); }, get columnSubtitleTableStore() { return columnSubtitleTableStore(); }, set columnSubtitleTableStore($$value) { columnSubtitleTableStore($$value); flushSync(); }, get showFilepath() { return showFilepath(); }, set showFilepath($$value) { showFilepath($$value); flushSync(); }, get propertyDisplay() { return propertyDisplay(); }, set propertyDisplay($$value) { propertyDisplay($$value); flushSync(); }, get propertySchemaOption() { return propertySchemaOption(); }, set propertySchemaOption($$value) { propertySchemaOption($$value); flushSync(); }, get consolidateTags() { return consolidateTags(); }, set consolidateTags($$value) { consolidateTags($$value); flushSync(); }, get excludedTags() { return excludedTags(); }, set excludedTags($$value) { excludedTags($$value); flushSync(); }, get targetTaskFile() { return targetTaskFile(); }, set targetTaskFile($$value) { targetTaskFile($$value); flushSync(); }, get targetFileIsDefault() { return targetFileIsDefault(); }, set targetFileIsDefault($$value) { targetFileIsDefault($$value); flushSync(); }, get onToggleCollapse() { return onToggleCollapse(); }, set onToggleCollapse($$value) { onToggleCollapse($$value); flushSync(); }, get uncategorizedColumnName() { return uncategorizedColumnName(); }, set uncategorizedColumnName($$value) { uncategorizedColumnName($$value); flushSync(); }, get doneColumnName() { return doneColumnName(); }, set doneColumnName($$value) { doneColumnName($$value); flushSync(); }, get isManualOrder() { return isManualOrder(); }, set isManualOrder($$value) { isManualOrder($$value); flushSync(); }, get manualOrder() { return manualOrder(); }, set manualOrder($$value) { manualOrder($$value); flushSync(); }, get reorderEnabled() { return reorderEnabled(); }, set reorderEnabled($$value) { reorderEnabled($$value); flushSync(); }, get treatNestedTasksAsSubtasks() { return treatNestedTasksAsSubtasks(); }, set treatNestedTasksAsSubtasks($$value) { treatNestedTasksAsSubtasks($$value); flushSync(); }, $set: update_legacy_props, $on: ($$event_name, $$event_cb) => add_legacy_event_listener($$props, $$event_name, $$event_cb) }; init(); var fragment = comment(); var node = first_child(fragment); { var consequent = ($$anchor2) => { var div = root_111(); let styles; each( div, 7, () => (deep_read_state(matrix()), untrack(() => matrix().primaryAxis)), (pBucket) => pBucket.id, ($$anchor3, pBucket, pIndex) => { var fragment_1 = root12(); var div_1 = first_child(fragment_1); let classes; let styles_1; var node_1 = child(div_1); { let $0 = derived_safe_equal(() => (get(tasksByPrimary), get(pBucket), untrack(() => { var _a5; return (_a5 = get(tasksByPrimary)[get(pBucket).id]) != null ? _a5 : []; }))); ColumnHeader(node_1, { get column() { return get(pBucket), untrack(() => get(pBucket).id); }, get tasks() { return get($0); }, get taskActions() { return taskActions(); }, get columnTagTableStore() { return columnTagTableStore(); }, get columnColourTableStore() { return columnColourTableStore(); }, get columnMatchTagTableStore() { return columnMatchTagTableStore(); }, get columnSubtitleTableStore() { return columnSubtitleTableStore(); }, isVerticalFlow: true, get isCollapsed() { return get(pBucket), untrack(() => get(pBucket).collapsed); }, onToggleCollapse: () => onToggleCollapse()(get(pBucket).id), get uncategorizedColumnName() { return uncategorizedColumnName(); }, get doneColumnName() { return doneColumnName(); } }); } reset(div_1); var div_2 = sibling(div_1, 2); let classes_1; let styles_2; var node_2 = child(div_2); { let $0 = derived_safe_equal(() => (get(tasksByPrimary), get(pBucket), untrack(() => { var _a5; return (_a5 = get(tasksByPrimary)[get(pBucket).id]) != null ? _a5 : []; }))); let $1 = derived_safe_equal(() => (get(pBucket), untrack(() => { var _a5; return (_a5 = get(pBucket).meta) == null ? void 0 : _a5.color; }))); let $2 = derived_safe_equal(() => (deep_read_state(manualOrder()), get(ungroupedSecondaryBucket), get(pBucket), untrack(() => { var _a5; return (_a5 = manualOrder()[get(ungroupedSecondaryBucket).id]) == null ? void 0 : _a5[get(pBucket).id]; }))); BoardCell(node_2, { get app() { return app(); }, get cell() { return deep_read_state(matrix()), get(pBucket), get(ungroupedSecondaryBucket), untrack(() => matrix().cells[get(pBucket).id][get(ungroupedSecondaryBucket).id]); }, get primaryTasks() { return get($0); }, get secondaryAxisBucket() { return get(ungroupedSecondaryBucket); }, get primaryAxisLabel() { return get(pBucket), untrack(() => get(pBucket).label); }, get taskActions() { return taskActions(); }, get columnTagTableStore() { return columnTagTableStore(); }, get showFilepath() { return showFilepath(); }, get propertyDisplay() { return propertyDisplay(); }, get propertySchemaOption() { return propertySchemaOption(); }, get consolidateTags() { return consolidateTags(); }, get excludedTags() { return excludedTags(); }, get treatNestedTasksAsSubtasks() { return treatNestedTasksAsSubtasks(); }, isVerticalFlow: true, get targetTaskFile() { return targetTaskFile(); }, get targetFileIsDefault() { return targetFileIsDefault(); }, get doneColumnName() { return doneColumnName(); }, get isCollapsed() { return get(pBucket), untrack(() => get(pBucket).collapsed); }, get accentColor() { return get($1); }, get isManualOrder() { return isManualOrder(); }, get manualOrderEntries() { return get($2); }, get reorderEnabled() { return reorderEnabled(); } }); } reset(div_2); template_effect(() => { classes = set_class(div_1, 1, "row-header-wrapper svelte-iq029y", null, classes, { collapsed: get(pBucket).collapsed }); styles_1 = set_style(div_1, "", styles_1, { "grid-column": "1", "grid-row": get(pIndex) + 1, "--column-color": (get(pBucket), untrack(() => { var _a5; return (_a5 = get(pBucket).meta) == null ? void 0 : _a5.color; })) }); classes_1 = set_class(div_2, 1, "cell-wrapper row-cell svelte-iq029y", null, classes_1, { collapsed: get(pBucket).collapsed }); styles_2 = set_style(div_2, "", styles_2, { "grid-column": "2", "grid-row": get(pIndex) + 1, "--column-color": (get(pBucket), untrack(() => { var _a5; return (_a5 = get(pBucket).meta) == null ? void 0 : _a5.color; })) }); }); append($$anchor3, fragment_1); } ); reset(div); template_effect(() => styles = set_style(div, "", styles, { "grid-template-rows": get(ungroupedGridTemplateRows), "--header-height": "0px" })); append($$anchor2, div); }; var alternate = ($$anchor2) => { var div_3 = root_54(); let styles_3; var div_4 = child(div_3); set_style(div_4, "", {}, { "grid-column": "1", "grid-row": "1" }); var node_3 = sibling(div_4, 2); each( node_3, 3, () => (deep_read_state(matrix()), untrack(() => matrix().secondaryAxis)), (sBucket) => sBucket.id, ($$anchor3, sBucket, sIndex) => { var div_5 = root_27(); let styles_4; var span = child(div_5); var text2 = child(span, true); reset(span); reset(div_5); template_effect(() => { styles_4 = set_style(div_5, "", styles_4, { "grid-column": get(sIndex) + 2, "grid-row": "1" }); set_attribute2(span, "title", (get(sBucket), untrack(() => get(sBucket).label))); set_text(text2, (get(sBucket), untrack(() => get(sBucket).label))); }); append($$anchor3, div_5); } ); var node_4 = sibling(node_3, 2); each( node_4, 3, () => (deep_read_state(matrix()), untrack(() => matrix().primaryAxis)), (pBucket) => pBucket.id, ($$anchor3, pBucket, pIndex) => { var fragment_2 = root_45(); var div_6 = first_child(fragment_2); let classes_2; let styles_5; var node_5 = child(div_6); { let $0 = derived_safe_equal(() => (get(tasksByPrimary), get(pBucket), untrack(() => { var _a5; return (_a5 = get(tasksByPrimary)[get(pBucket).id]) != null ? _a5 : []; }))); ColumnHeader(node_5, { get column() { return get(pBucket), untrack(() => get(pBucket).id); }, get tasks() { return get($0); }, get taskActions() { return taskActions(); }, get columnTagTableStore() { return columnTagTableStore(); }, get columnColourTableStore() { return columnColourTableStore(); }, get columnMatchTagTableStore() { return columnMatchTagTableStore(); }, get columnSubtitleTableStore() { return columnSubtitleTableStore(); }, isVerticalFlow: true, get isCollapsed() { return get(pBucket), untrack(() => get(pBucket).collapsed); }, onToggleCollapse: () => onToggleCollapse()(get(pBucket).id), get uncategorizedColumnName() { return uncategorizedColumnName(); }, get doneColumnName() { return doneColumnName(); } }); } reset(div_6); var node_6 = sibling(div_6, 2); each( node_6, 3, () => (deep_read_state(matrix()), untrack(() => matrix().secondaryAxis)), (sBucket) => sBucket.id, ($$anchor4, sBucket, sIndex) => { var div_7 = root_35(); let classes_3; let styles_6; var node_7 = child(div_7); { let $0 = derived_safe_equal(() => (get(tasksByPrimary), get(pBucket), untrack(() => { var _a5; return (_a5 = get(tasksByPrimary)[get(pBucket).id]) != null ? _a5 : []; }))); let $1 = derived_safe_equal(() => (get(pBucket), untrack(() => { var _a5; return (_a5 = get(pBucket).meta) == null ? void 0 : _a5.color; }))); let $2 = derived_safe_equal(() => (deep_read_state(manualOrder()), get(sBucket), get(pBucket), untrack(() => { var _a5; return (_a5 = manualOrder()[get(sBucket).id]) == null ? void 0 : _a5[get(pBucket).id]; }))); BoardCell(node_7, { get app() { return app(); }, get cell() { return deep_read_state(matrix()), get(pBucket), get(sBucket), untrack(() => matrix().cells[get(pBucket).id][get(sBucket).id]); }, get primaryTasks() { return get($0); }, get secondaryAxisBucket() { return get(sBucket); }, get primaryAxisLabel() { return get(pBucket), untrack(() => get(pBucket).label); }, get taskActions() { return taskActions(); }, get columnTagTableStore() { return columnTagTableStore(); }, get showFilepath() { return showFilepath(); }, get propertyDisplay() { return propertyDisplay(); }, get propertySchemaOption() { return propertySchemaOption(); }, get consolidateTags() { return consolidateTags(); }, get excludedTags() { return excludedTags(); }, get treatNestedTasksAsSubtasks() { return treatNestedTasksAsSubtasks(); }, isVerticalFlow: true, get targetTaskFile() { return targetTaskFile(); }, get targetFileIsDefault() { return targetFileIsDefault(); }, get doneColumnName() { return doneColumnName(); }, get isCollapsed() { return get(pBucket), untrack(() => get(pBucket).collapsed); }, get accentColor() { return get($1); }, get isManualOrder() { return isManualOrder(); }, get manualOrderEntries() { return get($2); }, get reorderEnabled() { return reorderEnabled(); } }); } reset(div_7); template_effect(() => { classes_3 = set_class(div_7, 1, "cell-wrapper grouped-cell svelte-iq029y", null, classes_3, { collapsed: get(pBucket).collapsed }); styles_6 = set_style(div_7, "", styles_6, { "grid-column": get(sIndex) + 2, "grid-row": get(pIndex) + 2, "--column-color": (get(pBucket), untrack(() => { var _a5; return (_a5 = get(pBucket).meta) == null ? void 0 : _a5.color; })) }); }); append($$anchor4, div_7); } ); template_effect(() => { classes_2 = set_class(div_6, 1, "row-header-wrapper svelte-iq029y", null, classes_2, { collapsed: get(pBucket).collapsed }); styles_5 = set_style(div_6, "", styles_5, { "grid-column": "1", "grid-row": get(pIndex) + 2, "--column-color": (get(pBucket), untrack(() => { var _a5; return (_a5 = get(pBucket).meta) == null ? void 0 : _a5.color; })) }); }); append($$anchor3, fragment_2); } ); reset(div_3); template_effect(() => { var _a5; return styles_3 = set_style(div_3, "", styles_3, { "grid-template-columns": get(groupedGridTemplateColumns), "grid-template-rows": get(groupedGridTemplateRows), "--header-height": `${(_a5 = get(headerHeight)) != null ? _a5 : ""}px` }); }); bind_element_size(div_4, "clientHeight", ($$value) => set(headerHeight, $$value)); append($$anchor2, div_3); }; if_block(node, ($$render) => { if (!get(showSwimlaneHeaders) && get(ungroupedSecondaryBucket)) $$render(consequent); else $$render(alternate, -1); }); } append($$anchor, fragment); return pop($$exports); } // src/ui/board/board_matrix_horizontal.svelte var root13 = from_html(`
`); var root_112 = from_html(`
`); var root_28 = from_html(`
`); var root_36 = from_html(` `, 1); var root_46 = from_html(`
`); var $$css13 = { hash: "svelte-1j479gc", code: ".matrix-horizontal.svelte-1j479gc {display:grid;column-gap:0;row-gap:0;align-items:stretch;min-width:max-content;padding-bottom:var(--size-4-4);border:var(--border-width) solid var(--background-modifier-border);border-radius:var(--radius-m);background:var(--background-primary);box-shadow:var(--shadow-s);overflow:visible;}.matrix-corner.svelte-1j479gc,\n.header-wrapper.svelte-1j479gc {background:color-mix(in srgb, var(--background-secondary) 72%, var(--background-primary));border-bottom:var(--border-width) solid var(--background-modifier-border);border-right:var(--border-width) solid var(--background-modifier-border);min-height:64px;}.matrix-corner.svelte-1j479gc {position:sticky;left:0;top:0;z-index:7;}.header-wrapper.svelte-1j479gc {position:sticky;top:0;z-index:5;padding:var(--size-4-2) var(--size-4-3);--column-header-x-padding-override: var(--size-4-3);--column-header-y-padding-override: var(--size-4-2);display:flex;align-items:stretch;}.header-wrapper.collapsed.svelte-1j479gc {position:sticky;top:0;display:flex;flex-direction:column;align-self:start;height:100%;min-height:100%;padding:0 var(--size-2-3) var(--size-4-3);--column-header-x-padding-override: var(--size-2-3);--column-header-y-padding-override: 0px;cursor:pointer;z-index:6;}.swimlane-header-cell.svelte-1j479gc {position:sticky;left:0;z-index:3;display:flex;align-items:start;justify-content:center;min-height:188px;padding:var(--size-4-3) var(--size-2-2);background:color-mix(in srgb, var(--background-primary) 82%, var(--background-secondary));border-right:var(--border-width) solid var(--background-modifier-border);border-bottom:var(--border-width) solid var(--background-modifier-border);}.swimlane-header-cell.svelte-1j479gc .swimlane-label:where(.svelte-1j479gc) {position:sticky;top:calc(var(--header-height) + var(--size-4-3));color:var(--text-normal);font-size:var(--font-ui-medium);font-weight:var(--font-medium);line-height:1.2;writing-mode:vertical-rl;text-orientation:mixed;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-height:100%;}.cell-wrapper.svelte-1j479gc {z-index:1;min-height:188px;padding:var(--size-4-2) var(--size-4-4);display:flex;flex-direction:column;align-self:stretch;background:color-mix(in srgb, var(--background-primary) 88%, var(--background-secondary));border-right:var(--border-width) solid var(--background-modifier-border);border-bottom:var(--border-width) solid var(--background-modifier-border);}.cell-wrapper.collapsed.svelte-1j479gc {display:none;}" }; function Board_matrix_horizontal($$anchor, $$props) { if (new.target) return createClassComponent({ component: Board_matrix_horizontal, ...$$anchor }); push($$props, false); append_styles($$anchor, $$css13); const tasksByPrimary = mutable_source(); const showSwimlaneHeaders = mutable_source(); const gridTemplateColumns = mutable_source(); const primaryGridColumnOffset = mutable_source(); const gridTemplateRows = mutable_source(); let app = prop($$props, "app", 12); let matrix = prop($$props, "matrix", 12); let taskActions = prop($$props, "taskActions", 12); let columnTagTableStore = prop($$props, "columnTagTableStore", 12); let columnColourTableStore = prop($$props, "columnColourTableStore", 12); let columnMatchTagTableStore = prop($$props, "columnMatchTagTableStore", 12); let columnSubtitleTableStore = prop($$props, "columnSubtitleTableStore", 12); let showFilepath = prop($$props, "showFilepath", 12); let propertyDisplay = prop($$props, "propertyDisplay", 28, () => "none" /* None */); let propertySchemaOption = prop($$props, "propertySchemaOption", 28, () => "none" /* None */); let consolidateTags = prop($$props, "consolidateTags", 12); let excludedTags = prop($$props, "excludedTags", 28, () => []); let targetTaskFile = prop($$props, "targetTaskFile", 12, null); let targetFileIsDefault = prop($$props, "targetFileIsDefault", 12, false); let onToggleCollapse = prop($$props, "onToggleCollapse", 12); let uncategorizedColumnName = prop($$props, "uncategorizedColumnName", 12, void 0); let doneColumnName = prop($$props, "doneColumnName", 12, void 0); let columnWidth = prop($$props, "columnWidth", 12, "300px"); let isManualOrder = prop($$props, "isManualOrder", 12, false); let manualOrder = prop($$props, "manualOrder", 28, () => ({})); let reorderEnabled = prop($$props, "reorderEnabled", 12, false); let treatNestedTasksAsSubtasks = prop($$props, "treatNestedTasksAsSubtasks", 12, false); let headerHeight = mutable_source(64); legacy_pre_effect(() => deep_read_state(matrix()), () => { set(tasksByPrimary, Object.fromEntries(matrix().primaryAxis.map((bucket) => [ bucket.id, Object.values(matrix().cells[bucket.id] || {}).flatMap((cell) => cell.tasks) ]))); }); legacy_pre_effect(() => deep_read_state(matrix()), () => { var _a5; set(showSwimlaneHeaders, matrix().secondaryAxis.length > 1 || matrix().secondaryAxis.length > 0 && !((_a5 = matrix().secondaryAxis[0].meta) == null ? void 0 : _a5.isDefault)); }); legacy_pre_effect( () => (get(showSwimlaneHeaders), deep_read_state(matrix()), deep_read_state(columnWidth())), () => { set(gridTemplateColumns, [ ...get(showSwimlaneHeaders) ? ["56px"] : [], ...matrix().primaryAxis.map((b) => b.collapsed ? "48px" : columnWidth()) ].join(" ")); } ); legacy_pre_effect(() => get(showSwimlaneHeaders), () => { set(primaryGridColumnOffset, get(showSwimlaneHeaders) ? 2 : 1); }); legacy_pre_effect(() => deep_read_state(matrix()), () => { set(gridTemplateRows, (() => { const rows = ["max-content"]; for (let i = 0; i < matrix().secondaryAxis.length; i++) { rows.push(i === matrix().secondaryAxis.length - 1 ? "minmax(188px, 1fr)" : "minmax(188px, max-content)"); } return rows.join(" "); })()); }); legacy_pre_effect_reset(); var $$exports = { get app() { return app(); }, set app($$value) { app($$value); flushSync(); }, get matrix() { return matrix(); }, set matrix($$value) { matrix($$value); flushSync(); }, get taskActions() { return taskActions(); }, set taskActions($$value) { taskActions($$value); flushSync(); }, get columnTagTableStore() { return columnTagTableStore(); }, set columnTagTableStore($$value) { columnTagTableStore($$value); flushSync(); }, get columnColourTableStore() { return columnColourTableStore(); }, set columnColourTableStore($$value) { columnColourTableStore($$value); flushSync(); }, get columnMatchTagTableStore() { return columnMatchTagTableStore(); }, set columnMatchTagTableStore($$value) { columnMatchTagTableStore($$value); flushSync(); }, get columnSubtitleTableStore() { return columnSubtitleTableStore(); }, set columnSubtitleTableStore($$value) { columnSubtitleTableStore($$value); flushSync(); }, get showFilepath() { return showFilepath(); }, set showFilepath($$value) { showFilepath($$value); flushSync(); }, get propertyDisplay() { return propertyDisplay(); }, set propertyDisplay($$value) { propertyDisplay($$value); flushSync(); }, get propertySchemaOption() { return propertySchemaOption(); }, set propertySchemaOption($$value) { propertySchemaOption($$value); flushSync(); }, get consolidateTags() { return consolidateTags(); }, set consolidateTags($$value) { consolidateTags($$value); flushSync(); }, get excludedTags() { return excludedTags(); }, set excludedTags($$value) { excludedTags($$value); flushSync(); }, get targetTaskFile() { return targetTaskFile(); }, set targetTaskFile($$value) { targetTaskFile($$value); flushSync(); }, get targetFileIsDefault() { return targetFileIsDefault(); }, set targetFileIsDefault($$value) { targetFileIsDefault($$value); flushSync(); }, get onToggleCollapse() { return onToggleCollapse(); }, set onToggleCollapse($$value) { onToggleCollapse($$value); flushSync(); }, get uncategorizedColumnName() { return uncategorizedColumnName(); }, set uncategorizedColumnName($$value) { uncategorizedColumnName($$value); flushSync(); }, get doneColumnName() { return doneColumnName(); }, set doneColumnName($$value) { doneColumnName($$value); flushSync(); }, get columnWidth() { return columnWidth(); }, set columnWidth($$value) { columnWidth($$value); flushSync(); }, get isManualOrder() { return isManualOrder(); }, set isManualOrder($$value) { isManualOrder($$value); flushSync(); }, get manualOrder() { return manualOrder(); }, set manualOrder($$value) { manualOrder($$value); flushSync(); }, get reorderEnabled() { return reorderEnabled(); }, set reorderEnabled($$value) { reorderEnabled($$value); flushSync(); }, get treatNestedTasksAsSubtasks() { return treatNestedTasksAsSubtasks(); }, set treatNestedTasksAsSubtasks($$value) { treatNestedTasksAsSubtasks($$value); flushSync(); }, $set: update_legacy_props, $on: ($$event_name, $$event_cb) => add_legacy_event_listener($$props, $$event_name, $$event_cb) }; init(); var div = root_46(); let styles; var node = child(div); { var consequent = ($$anchor2) => { var div_1 = root13(); set_style(div_1, "", {}, { "grid-column": "1", "grid-row": "1" }); bind_element_size(div_1, "clientHeight", ($$value) => set(headerHeight, $$value)); append($$anchor2, div_1); }; if_block(node, ($$render) => { if (get(showSwimlaneHeaders)) $$render(consequent); }); } var node_1 = sibling(node, 2); each( node_1, 3, () => (deep_read_state(matrix()), untrack(() => matrix().primaryAxis)), (pBucket) => pBucket.id, ($$anchor2, pBucket, index2) => { var div_2 = root_112(); let classes; let styles_1; var node_2 = child(div_2); { let $0 = derived_safe_equal(() => (get(tasksByPrimary), get(pBucket), untrack(() => { var _a5; return (_a5 = get(tasksByPrimary)[get(pBucket).id]) != null ? _a5 : []; }))); ColumnHeader(node_2, { get column() { return get(pBucket), untrack(() => get(pBucket).id); }, get tasks() { return get($0); }, get taskActions() { return taskActions(); }, get columnTagTableStore() { return columnTagTableStore(); }, get columnColourTableStore() { return columnColourTableStore(); }, get columnMatchTagTableStore() { return columnMatchTagTableStore(); }, get columnSubtitleTableStore() { return columnSubtitleTableStore(); }, isVerticalFlow: false, get isCollapsed() { return get(pBucket), untrack(() => get(pBucket).collapsed); }, onToggleCollapse: () => onToggleCollapse()(get(pBucket).id), get uncategorizedColumnName() { return uncategorizedColumnName(); }, get doneColumnName() { return doneColumnName(); } }); } reset(div_2); template_effect(() => { classes = set_class(div_2, 1, "header-wrapper svelte-1j479gc", null, classes, { collapsed: get(pBucket).collapsed }); styles_1 = set_style(div_2, "", styles_1, { "grid-column": get(index2) + get(primaryGridColumnOffset), "grid-row": (get(pBucket), untrack(() => get(pBucket).collapsed ? "1 / -1" : "1")), "--column-color": (get(pBucket), untrack(() => { var _a5; return (_a5 = get(pBucket).meta) == null ? void 0 : _a5.color; })) }); }); append($$anchor2, div_2); } ); var node_3 = sibling(node_1, 2); each( node_3, 3, () => (deep_read_state(matrix()), untrack(() => matrix().secondaryAxis)), (sBucket) => sBucket.id, ($$anchor2, sBucket, sIndex) => { var fragment = root_36(); var node_4 = first_child(fragment); { var consequent_1 = ($$anchor3) => { var div_3 = root_28(); let styles_2; var span = child(div_3); var text2 = child(span, true); reset(span); reset(div_3); template_effect(() => { styles_2 = set_style(div_3, "", styles_2, { "grid-column": "1", "grid-row": get(sIndex) + 2 }); set_attribute2(span, "title", (get(sBucket), untrack(() => get(sBucket).label))); set_text(text2, (get(sBucket), untrack(() => get(sBucket).label))); }); append($$anchor3, div_3); }; if_block(node_4, ($$render) => { if (get(showSwimlaneHeaders)) $$render(consequent_1); }); } var node_5 = sibling(node_4, 2); each( node_5, 3, () => (deep_read_state(matrix()), untrack(() => matrix().primaryAxis)), (pBucket) => pBucket.id, ($$anchor3, pBucket, pIndex) => { var div_4 = root_112(); let classes_1; let styles_3; var node_6 = child(div_4); { let $0 = derived_safe_equal(() => (get(tasksByPrimary), get(pBucket), untrack(() => { var _a5; return (_a5 = get(tasksByPrimary)[get(pBucket).id]) != null ? _a5 : []; }))); let $1 = derived_safe_equal(() => (get(pBucket), untrack(() => { var _a5; return (_a5 = get(pBucket).meta) == null ? void 0 : _a5.color; }))); let $2 = derived_safe_equal(() => (deep_read_state(manualOrder()), get(sBucket), get(pBucket), untrack(() => { var _a5; return (_a5 = manualOrder()[get(sBucket).id]) == null ? void 0 : _a5[get(pBucket).id]; }))); BoardCell(node_6, { get app() { return app(); }, get cell() { return deep_read_state(matrix()), get(pBucket), get(sBucket), untrack(() => matrix().cells[get(pBucket).id][get(sBucket).id]); }, get primaryTasks() { return get($0); }, get secondaryAxisBucket() { return get(sBucket); }, get primaryAxisLabel() { return get(pBucket), untrack(() => get(pBucket).label); }, get taskActions() { return taskActions(); }, get columnTagTableStore() { return columnTagTableStore(); }, get showFilepath() { return showFilepath(); }, get propertyDisplay() { return propertyDisplay(); }, get propertySchemaOption() { return propertySchemaOption(); }, get consolidateTags() { return consolidateTags(); }, get excludedTags() { return excludedTags(); }, get treatNestedTasksAsSubtasks() { return treatNestedTasksAsSubtasks(); }, isVerticalFlow: false, get targetTaskFile() { return targetTaskFile(); }, get targetFileIsDefault() { return targetFileIsDefault(); }, get doneColumnName() { return doneColumnName(); }, get isCollapsed() { return get(pBucket), untrack(() => get(pBucket).collapsed); }, get accentColor() { return get($1); }, get isManualOrder() { return isManualOrder(); }, get manualOrderEntries() { return get($2); }, get reorderEnabled() { return reorderEnabled(); } }); } reset(div_4); template_effect(() => { classes_1 = set_class(div_4, 1, "cell-wrapper svelte-1j479gc", null, classes_1, { collapsed: get(pBucket).collapsed }); styles_3 = set_style(div_4, "", styles_3, { "grid-column": get(pIndex) + get(primaryGridColumnOffset), "grid-row": get(sIndex) + 2, "--column-color": (get(pBucket), untrack(() => { var _a5; return (_a5 = get(pBucket).meta) == null ? void 0 : _a5.color; })) }); }); append($$anchor3, div_4); } ); append($$anchor2, fragment); } ); reset(div); template_effect(() => { var _a5; return styles = set_style(div, "", styles, { "grid-template-columns": get(gridTemplateColumns), "grid-template-rows": get(gridTemplateRows), "--header-height": `${(_a5 = get(headerHeight)) != null ? _a5 : ""}px`, "--sticky-left-offset": get(showSwimlaneHeaders) ? "56px" : "0px" }); }); append($$anchor, div); return pop($$exports); } // src/ui/board/board_matrix.ts function deriveBoardMatrix(tasks, columns, settings) { var _a5, _b3, _c2, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q; const tasksByPrimary = { uncategorised: [], done: [] }; for (const column of columns) { tasksByPrimary[column.id] = []; } for (const task of tasks) { if (task.done || task.column === "done") { tasksByPrimary["done"].push(task); } else if (task.column === "archived") { } else if (task.column) { if (!tasksByPrimary[task.column]) { tasksByPrimary[task.column] = []; } tasksByPrimary[task.column].push(task); } else { tasksByPrimary["uncategorised"].push(task); } } const orderMode = (_a5 = settings.columnOrderMode) != null ? _a5 : "file" /* FileOrder */; const sortProperty = (_b3 = settings.sortProperty) != null ? _b3 : null; const sortDirection = (_c2 = settings.sortDirection) != null ? _c2 : "asc"; const useProperty = orderMode === "property" /* Property */ && !!sortProperty; const useManual = orderMode === "manual" /* Manual */; const manualOrder = (_d = settings.manualOrder) != null ? _d : {}; for (const bucketTasks of Object.values(tasksByPrimary)) { if (orderMode === "task-name" /* TaskName */) { sortTasksByTaskName(bucketTasks, sortDirection); } else if (useProperty && sortProperty) { sortTasksByProperty( bucketTasks, sortProperty, sortDirection, (_e = settings.statusMarkerOrder) != null ? _e : "", (_f = settings.doneStatusMarkers) != null ? _f : "" ); } else { sortTasksByFile(bucketTasks); } } const collapsedColumns = new Set((_g = settings.collapsedColumns) != null ? _g : []); const uncategorizedVisibility = (_h = settings.uncategorizedVisibility) != null ? _h : "auto" /* Auto */; const showUncategorizedColumn = uncategorizedVisibility === "always" /* AlwaysShow */ || uncategorizedVisibility === "auto" /* Auto */ && tasksByPrimary["uncategorised"].length > 0; const doneVisibility = (_i = settings.doneVisibility) != null ? _i : "always" /* AlwaysShow */; const showDoneColumn = doneVisibility === "always" /* AlwaysShow */ || doneVisibility === "auto" /* Auto */ && tasksByPrimary["done"].length > 0; const allColumns = []; if (showUncategorizedColumn) allColumns.push("uncategorised"); for (const column of columns) { allColumns.push(column.id); } if (showDoneColumn) allColumns.push("done"); const flowDirection = (_j = settings.flowDirection) != null ? _j : "ltr" /* LeftToRight */; const shouldReverse = flowDirection === "rtl" /* RightToLeft */ || flowDirection === "btt" /* BottomToTop */; if (shouldReverse) { allColumns.reverse(); } const primaryAxis = allColumns.map((id) => { let label = id; let color = void 0; const colDef = columns.find((c) => c.id === id); if (id === "uncategorised") { label = settings.uncategorizedColumnName || "Uncategorized"; } else if (id === "done") { label = settings.doneColumnName || "Done"; } else { if (colDef) { label = colDef.label; color = colDef.color; } } return { id, label, kind: "column", collapsed: collapsedColumns.has(id), meta: { color } }; }); const groupSource = (_k = settings.groupSource) != null ? _k : { kind: "none" }; const groupBuckets = deriveGroupBuckets( Object.values(tasksByPrimary).flat(), groupSource, settings.excludedTags, (_l = settings.statusMarkerOrder) != null ? _l : "", (_m = settings.doneStatusMarkers) != null ? _m : "", (_n = settings.groupDirection) != null ? _n : "asc" ); const assignTaskToBucket = createGroupAssigner(groupBuckets, groupSource, settings.excludedTags); const secondaryAxis = groupBuckets.map((bucket) => ({ id: bucket.id, label: bucket.label, kind: "group", collapsed: false, meta: { value: bucket.value, source: bucket.source, isDefault: bucket.isDefault } })); const cells = {}; for (const primaryBucket of primaryAxis) { const pId = primaryBucket.id; cells[pId] = {}; const cellTasksByPrimary = (_o = tasksByPrimary[pId]) != null ? _o : []; const cellTasksBySecondary = /* @__PURE__ */ new Map(); for (const task of cellTasksByPrimary) { const sId = assignTaskToBucket(task); if (sId === void 0) continue; let bucketTasks = cellTasksBySecondary.get(sId); if (!bucketTasks) { bucketTasks = []; cellTasksBySecondary.set(sId, bucketTasks); } bucketTasks.push(task); } for (const groupBucket of groupBuckets) { const sId = groupBucket.id; const cellTasks = (_p = cellTasksBySecondary.get(sId)) != null ? _p : []; const orderedCellTasks = useManual ? computeDisplayOrder(cellTasks, (_q = manualOrder[sId]) == null ? void 0 : _q[pId]) : cellTasks; cells[pId][sId] = { primaryId: pId, secondaryId: sId, tasks: orderedCellTasks, isEmpty: orderedCellTasks.length === 0 }; } } return { primaryAxis, secondaryAxis, cells }; } function sortTasksByFile(tasks) { tasks.sort(compareByFile); } function compareByFile(a, b) { if (a.path === b.path) { return a.rowIndex - b.rowIndex; } return a.path.localeCompare(b.path); } function sortTasksByProperty(tasks, key2, direction, statusMarkerOrder, doneStatusMarkers) { tasks.sort((a, b) => { const result = compareByProperty(a, b, key2, direction, { statusMarkerOrder, doneStatusMarkers }); return result !== 0 ? result : compareByFile(a, b); }); } function sortTasksByTaskName(tasks, direction) { tasks.sort((a, b) => { const result = a.content.trim().localeCompare(b.content.trim()); if (result !== 0) { return direction === "desc" ? -result : result; } return compareByFile(a, b); }); } // node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs var min = Math.min; var max = Math.max; var round = Math.round; var floor = Math.floor; var createCoords = (v) => ({ x: v, y: v }); var oppositeSideMap = { left: "right", right: "left", bottom: "top", top: "bottom" }; var oppositeAlignmentMap = { start: "end", end: "start" }; function clamp(start, value, end) { return max(start, min(value, end)); } function evaluate(value, param) { return typeof value === "function" ? value(param) : value; } function getSide(placement) { return placement.split("-")[0]; } function getAlignment(placement) { return placement.split("-")[1]; } function getOppositeAxis(axis) { return axis === "x" ? "y" : "x"; } function getAxisLength(axis) { return axis === "y" ? "height" : "width"; } function getSideAxis(placement) { return ["top", "bottom"].includes(getSide(placement)) ? "y" : "x"; } function getAlignmentAxis(placement) { return getOppositeAxis(getSideAxis(placement)); } function getAlignmentSides(placement, rects, rtl) { if (rtl === void 0) { rtl = false; } const alignment = getAlignment(placement); const alignmentAxis = getAlignmentAxis(placement); const length = getAxisLength(alignmentAxis); let mainAlignmentSide = alignmentAxis === "x" ? alignment === (rtl ? "end" : "start") ? "right" : "left" : alignment === "start" ? "bottom" : "top"; if (rects.reference[length] > rects.floating[length]) { mainAlignmentSide = getOppositePlacement(mainAlignmentSide); } return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)]; } function getExpandedPlacements(placement) { const oppositePlacement = getOppositePlacement(placement); return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)]; } function getOppositeAlignmentPlacement(placement) { return placement.replace(/start|end/g, (alignment) => oppositeAlignmentMap[alignment]); } function getSideList(side, isStart, rtl) { const lr = ["left", "right"]; const rl = ["right", "left"]; const tb = ["top", "bottom"]; const bt = ["bottom", "top"]; switch (side) { case "top": case "bottom": if (rtl) return isStart ? rl : lr; return isStart ? lr : rl; case "left": case "right": return isStart ? tb : bt; default: return []; } } function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) { const alignment = getAlignment(placement); let list = getSideList(getSide(placement), direction === "start", rtl); if (alignment) { list = list.map((side) => side + "-" + alignment); if (flipAlignment) { list = list.concat(list.map(getOppositeAlignmentPlacement)); } } return list; } function getOppositePlacement(placement) { return placement.replace(/left|right|bottom|top/g, (side) => oppositeSideMap[side]); } function expandPaddingObject(padding) { return { top: 0, right: 0, bottom: 0, left: 0, ...padding }; } function getPaddingObject(padding) { return typeof padding !== "number" ? expandPaddingObject(padding) : { top: padding, right: padding, bottom: padding, left: padding }; } function rectToClientRect(rect) { return { ...rect, top: rect.y, left: rect.x, right: rect.x + rect.width, bottom: rect.y + rect.height }; } // node_modules/@floating-ui/core/dist/floating-ui.core.mjs function computeCoordsFromPlacement(_ref, placement, rtl) { let { reference, floating } = _ref; const sideAxis = getSideAxis(placement); const alignmentAxis = getAlignmentAxis(placement); const alignLength = getAxisLength(alignmentAxis); const side = getSide(placement); const isVertical = sideAxis === "y"; const commonX = reference.x + reference.width / 2 - floating.width / 2; const commonY = reference.y + reference.height / 2 - floating.height / 2; const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2; let coords; switch (side) { case "top": coords = { x: commonX, y: reference.y - floating.height }; break; case "bottom": coords = { x: commonX, y: reference.y + reference.height }; break; case "right": coords = { x: reference.x + reference.width, y: commonY }; break; case "left": coords = { x: reference.x - floating.width, y: commonY }; break; default: coords = { x: reference.x, y: reference.y }; } switch (getAlignment(placement)) { case "start": coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1); break; case "end": coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1); break; } return coords; } var computePosition = async (reference, floating, config) => { const { placement = "bottom", strategy = "absolute", middleware = [], platform: platform2 } = config; const validMiddleware = middleware.filter(Boolean); const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(floating)); let rects = await platform2.getElementRects({ reference, floating, strategy }); let { x, y } = computeCoordsFromPlacement(rects, placement, rtl); let statefulPlacement = placement; let middlewareData = {}; let resetCount = 0; for (let i = 0; i < validMiddleware.length; i++) { const { name, fn } = validMiddleware[i]; const { x: nextX, y: nextY, data, reset: reset2 } = await fn({ x, y, initialPlacement: placement, placement: statefulPlacement, strategy, middlewareData, rects, platform: platform2, elements: { reference, floating } }); x = nextX != null ? nextX : x; y = nextY != null ? nextY : y; middlewareData = { ...middlewareData, [name]: { ...middlewareData[name], ...data } }; if (reset2 && resetCount <= 50) { resetCount++; if (typeof reset2 === "object") { if (reset2.placement) { statefulPlacement = reset2.placement; } if (reset2.rects) { rects = reset2.rects === true ? await platform2.getElementRects({ reference, floating, strategy }) : reset2.rects; } ({ x, y } = computeCoordsFromPlacement(rects, statefulPlacement, rtl)); } i = -1; } } return { x, y, placement: statefulPlacement, strategy, middlewareData }; }; async function detectOverflow(state2, options2) { var _await$platform$isEle; if (options2 === void 0) { options2 = {}; } const { x, y, platform: platform2, rects, elements, strategy } = state2; const { boundary: boundary2 = "clippingAncestors", rootBoundary = "viewport", elementContext = "floating", altBoundary = false, padding = 0 } = evaluate(options2, state2); const paddingObject = getPaddingObject(padding); const altContext = elementContext === "floating" ? "reference" : "floating"; const element2 = elements[altBoundary ? altContext : elementContext]; const clippingClientRect = rectToClientRect(await platform2.getClippingRect({ element: ((_await$platform$isEle = await (platform2.isElement == null ? void 0 : platform2.isElement(element2))) != null ? _await$platform$isEle : true) ? element2 : element2.contextElement || await (platform2.getDocumentElement == null ? void 0 : platform2.getDocumentElement(elements.floating)), boundary: boundary2, rootBoundary, strategy })); const rect = elementContext === "floating" ? { ...rects.floating, x, y } : rects.reference; const offsetParent = await (platform2.getOffsetParent == null ? void 0 : platform2.getOffsetParent(elements.floating)); const offsetScale = await (platform2.isElement == null ? void 0 : platform2.isElement(offsetParent)) ? await (platform2.getScale == null ? void 0 : platform2.getScale(offsetParent)) || { x: 1, y: 1 } : { x: 1, y: 1 }; const elementClientRect = rectToClientRect(platform2.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform2.convertOffsetParentRelativeRectToViewportRelativeRect({ elements, rect, offsetParent, strategy }) : rect); return { top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y, bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y, left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x, right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x }; } var flip = function(options2) { if (options2 === void 0) { options2 = {}; } return { name: "flip", options: options2, async fn(state2) { var _middlewareData$arrow, _middlewareData$flip; const { placement, middlewareData, rects, initialPlacement, platform: platform2, elements } = state2; const { mainAxis: checkMainAxis = true, crossAxis: checkCrossAxis = true, fallbackPlacements: specifiedFallbackPlacements, fallbackStrategy = "bestFit", fallbackAxisSideDirection = "none", flipAlignment = true, ...detectOverflowOptions } = evaluate(options2, state2); if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) { return {}; } const side = getSide(placement); const isBasePlacement = getSide(initialPlacement) === initialPlacement; const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating)); const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement)); if (!specifiedFallbackPlacements && fallbackAxisSideDirection !== "none") { fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl)); } const placements2 = [initialPlacement, ...fallbackPlacements]; const overflow = await detectOverflow(state2, detectOverflowOptions); const overflows = []; let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || []; if (checkMainAxis) { overflows.push(overflow[side]); } if (checkCrossAxis) { const sides2 = getAlignmentSides(placement, rects, rtl); overflows.push(overflow[sides2[0]], overflow[sides2[1]]); } overflowsData = [...overflowsData, { placement, overflows }]; if (!overflows.every((side2) => side2 <= 0)) { var _middlewareData$flip2, _overflowsData$filter; const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1; const nextPlacement = placements2[nextIndex]; if (nextPlacement) { return { data: { index: nextIndex, overflows: overflowsData }, reset: { placement: nextPlacement } }; } let resetPlacement = (_overflowsData$filter = overflowsData.filter((d) => d.overflows[0] <= 0).sort((a, b) => a.overflows[1] - b.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement; if (!resetPlacement) { switch (fallbackStrategy) { case "bestFit": { var _overflowsData$map$so; const placement2 = (_overflowsData$map$so = overflowsData.map((d) => [d.placement, d.overflows.filter((overflow2) => overflow2 > 0).reduce((acc, overflow2) => acc + overflow2, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$map$so[0]; if (placement2) { resetPlacement = placement2; } break; } case "initialPlacement": resetPlacement = initialPlacement; break; } } if (placement !== resetPlacement) { return { reset: { placement: resetPlacement } }; } } return {}; } }; }; async function convertValueToCoords(state2, options2) { const { placement, platform: platform2, elements } = state2; const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating)); const side = getSide(placement); const alignment = getAlignment(placement); const isVertical = getSideAxis(placement) === "y"; const mainAxisMulti = ["left", "top"].includes(side) ? -1 : 1; const crossAxisMulti = rtl && isVertical ? -1 : 1; const rawValue = evaluate(options2, state2); let { mainAxis, crossAxis, alignmentAxis } = typeof rawValue === "number" ? { mainAxis: rawValue, crossAxis: 0, alignmentAxis: null } : { mainAxis: 0, crossAxis: 0, alignmentAxis: null, ...rawValue }; if (alignment && typeof alignmentAxis === "number") { crossAxis = alignment === "end" ? alignmentAxis * -1 : alignmentAxis; } return isVertical ? { x: crossAxis * crossAxisMulti, y: mainAxis * mainAxisMulti } : { x: mainAxis * mainAxisMulti, y: crossAxis * crossAxisMulti }; } var offset = function(options2) { if (options2 === void 0) { options2 = 0; } return { name: "offset", options: options2, async fn(state2) { var _middlewareData$offse, _middlewareData$arrow; const { x, y, placement, middlewareData } = state2; const diffCoords = await convertValueToCoords(state2, options2); if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) { return {}; } return { x: x + diffCoords.x, y: y + diffCoords.y, data: { ...diffCoords, placement } }; } }; }; var shift = function(options2) { if (options2 === void 0) { options2 = {}; } return { name: "shift", options: options2, async fn(state2) { const { x, y, placement } = state2; const { mainAxis: checkMainAxis = true, crossAxis: checkCrossAxis = false, limiter = { fn: (_ref) => { let { x: x2, y: y2 } = _ref; return { x: x2, y: y2 }; } }, ...detectOverflowOptions } = evaluate(options2, state2); const coords = { x, y }; const overflow = await detectOverflow(state2, detectOverflowOptions); const crossAxis = getSideAxis(getSide(placement)); const mainAxis = getOppositeAxis(crossAxis); let mainAxisCoord = coords[mainAxis]; let crossAxisCoord = coords[crossAxis]; if (checkMainAxis) { const minSide = mainAxis === "y" ? "top" : "left"; const maxSide = mainAxis === "y" ? "bottom" : "right"; const min2 = mainAxisCoord + overflow[minSide]; const max2 = mainAxisCoord - overflow[maxSide]; mainAxisCoord = clamp(min2, mainAxisCoord, max2); } if (checkCrossAxis) { const minSide = crossAxis === "y" ? "top" : "left"; const maxSide = crossAxis === "y" ? "bottom" : "right"; const min2 = crossAxisCoord + overflow[minSide]; const max2 = crossAxisCoord - overflow[maxSide]; crossAxisCoord = clamp(min2, crossAxisCoord, max2); } const limitedCoords = limiter.fn({ ...state2, [mainAxis]: mainAxisCoord, [crossAxis]: crossAxisCoord }); return { ...limitedCoords, data: { x: limitedCoords.x - x, y: limitedCoords.y - y } }; } }; }; // node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs function getNodeName(node) { if (isNode(node)) { return (node.nodeName || "").toLowerCase(); } return "#document"; } function getWindow(node) { var _node$ownerDocument; return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window; } function getDocumentElement(node) { var _ref; return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement; } function isNode(value) { return value instanceof Node || value instanceof getWindow(value).Node; } function isElement(value) { return value instanceof Element || value instanceof getWindow(value).Element; } function isHTMLElement(value) { return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement; } function isShadowRoot(value) { if (typeof ShadowRoot === "undefined") { return false; } return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot; } function isOverflowElement(element2) { const { overflow, overflowX, overflowY, display } = getComputedStyle2(element2); return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !["inline", "contents"].includes(display); } function isTableElement(element2) { return ["table", "td", "th"].includes(getNodeName(element2)); } function isContainingBlock(element2) { const webkit = isWebKit(); const css = getComputedStyle2(element2); return css.transform !== "none" || css.perspective !== "none" || (css.containerType ? css.containerType !== "normal" : false) || !webkit && (css.backdropFilter ? css.backdropFilter !== "none" : false) || !webkit && (css.filter ? css.filter !== "none" : false) || ["transform", "perspective", "filter"].some((value) => (css.willChange || "").includes(value)) || ["paint", "layout", "strict", "content"].some((value) => (css.contain || "").includes(value)); } function getContainingBlock(element2) { let currentNode = getParentNode(element2); while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) { if (isContainingBlock(currentNode)) { return currentNode; } else { currentNode = getParentNode(currentNode); } } return null; } function isWebKit() { if (typeof CSS === "undefined" || !CSS.supports) return false; return CSS.supports("-webkit-backdrop-filter", "none"); } function isLastTraversableNode(node) { return ["html", "body", "#document"].includes(getNodeName(node)); } function getComputedStyle2(element2) { return getWindow(element2).getComputedStyle(element2); } function getNodeScroll(element2) { if (isElement(element2)) { return { scrollLeft: element2.scrollLeft, scrollTop: element2.scrollTop }; } return { scrollLeft: element2.pageXOffset, scrollTop: element2.pageYOffset }; } function getParentNode(node) { if (getNodeName(node) === "html") { return node; } const result = ( // Step into the shadow DOM of the parent of a slotted node. node.assignedSlot || // DOM Element detected. node.parentNode || // ShadowRoot detected. isShadowRoot(node) && node.host || // Fallback. getDocumentElement(node) ); return isShadowRoot(result) ? result.host : result; } function getNearestOverflowAncestor(node) { const parentNode = getParentNode(node); if (isLastTraversableNode(parentNode)) { return node.ownerDocument ? node.ownerDocument.body : node.body; } if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) { return parentNode; } return getNearestOverflowAncestor(parentNode); } function getOverflowAncestors(node, list, traverseIframes) { var _node$ownerDocument2; if (list === void 0) { list = []; } if (traverseIframes === void 0) { traverseIframes = true; } const scrollableAncestor = getNearestOverflowAncestor(node); const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body); const win = getWindow(scrollableAncestor); if (isBody) { return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], win.frameElement && traverseIframes ? getOverflowAncestors(win.frameElement) : []); } return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes)); } // node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs function getCssDimensions(element2) { const css = getComputedStyle2(element2); let width = parseFloat(css.width) || 0; let height = parseFloat(css.height) || 0; const hasOffset = isHTMLElement(element2); const offsetWidth = hasOffset ? element2.offsetWidth : width; const offsetHeight = hasOffset ? element2.offsetHeight : height; const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight; if (shouldFallback) { width = offsetWidth; height = offsetHeight; } return { width, height, $: shouldFallback }; } function unwrapElement(element2) { return !isElement(element2) ? element2.contextElement : element2; } function getScale(element2) { const domElement = unwrapElement(element2); if (!isHTMLElement(domElement)) { return createCoords(1); } const rect = domElement.getBoundingClientRect(); const { width, height, $ } = getCssDimensions(domElement); let x = ($ ? round(rect.width) : rect.width) / width; let y = ($ ? round(rect.height) : rect.height) / height; if (!x || !Number.isFinite(x)) { x = 1; } if (!y || !Number.isFinite(y)) { y = 1; } return { x, y }; } var noOffsets = /* @__PURE__ */ createCoords(0); function getVisualOffsets(element2) { const win = getWindow(element2); if (!isWebKit() || !win.visualViewport) { return noOffsets; } return { x: win.visualViewport.offsetLeft, y: win.visualViewport.offsetTop }; } function shouldAddVisualOffsets(element2, isFixed, floatingOffsetParent) { if (isFixed === void 0) { isFixed = false; } if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element2)) { return false; } return isFixed; } function getBoundingClientRect(element2, includeScale, isFixedStrategy, offsetParent) { if (includeScale === void 0) { includeScale = false; } if (isFixedStrategy === void 0) { isFixedStrategy = false; } const clientRect = element2.getBoundingClientRect(); const domElement = unwrapElement(element2); let scale = createCoords(1); if (includeScale) { if (offsetParent) { if (isElement(offsetParent)) { scale = getScale(offsetParent); } } else { scale = getScale(element2); } } const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0); let x = (clientRect.left + visualOffsets.x) / scale.x; let y = (clientRect.top + visualOffsets.y) / scale.y; let width = clientRect.width / scale.x; let height = clientRect.height / scale.y; if (domElement) { const win = getWindow(domElement); const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent; let currentWin = win; let currentIFrame = currentWin.frameElement; while (currentIFrame && offsetParent && offsetWin !== currentWin) { const iframeScale = getScale(currentIFrame); const iframeRect = currentIFrame.getBoundingClientRect(); const css = getComputedStyle2(currentIFrame); const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x; const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y; x *= iframeScale.x; y *= iframeScale.y; width *= iframeScale.x; height *= iframeScale.y; x += left; y += top; currentWin = getWindow(currentIFrame); currentIFrame = currentWin.frameElement; } } return rectToClientRect({ width, height, x, y }); } var topLayerSelectors = [":popover-open", ":modal"]; function isTopLayer(element2) { return topLayerSelectors.some((selector) => { try { return element2.matches(selector); } catch (e) { return false; } }); } function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) { let { elements, rect, offsetParent, strategy } = _ref; const isFixed = strategy === "fixed"; const documentElement = getDocumentElement(offsetParent); const topLayer = elements ? isTopLayer(elements.floating) : false; if (offsetParent === documentElement || topLayer && isFixed) { return rect; } let scroll = { scrollLeft: 0, scrollTop: 0 }; let scale = createCoords(1); const offsets = createCoords(0); const isOffsetParentAnElement = isHTMLElement(offsetParent); if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) { if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) { scroll = getNodeScroll(offsetParent); } if (isHTMLElement(offsetParent)) { const offsetRect = getBoundingClientRect(offsetParent); scale = getScale(offsetParent); offsets.x = offsetRect.x + offsetParent.clientLeft; offsets.y = offsetRect.y + offsetParent.clientTop; } } return { width: rect.width * scale.x, height: rect.height * scale.y, x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x, y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y }; } function getClientRects(element2) { return Array.from(element2.getClientRects()); } function getWindowScrollBarX(element2) { return getBoundingClientRect(getDocumentElement(element2)).left + getNodeScroll(element2).scrollLeft; } function getDocumentRect(element2) { const html2 = getDocumentElement(element2); const scroll = getNodeScroll(element2); const body = element2.ownerDocument.body; const width = max(html2.scrollWidth, html2.clientWidth, body.scrollWidth, body.clientWidth); const height = max(html2.scrollHeight, html2.clientHeight, body.scrollHeight, body.clientHeight); let x = -scroll.scrollLeft + getWindowScrollBarX(element2); const y = -scroll.scrollTop; if (getComputedStyle2(body).direction === "rtl") { x += max(html2.clientWidth, body.clientWidth) - width; } return { width, height, x, y }; } function getViewportRect(element2, strategy) { const win = getWindow(element2); const html2 = getDocumentElement(element2); const visualViewport = win.visualViewport; let width = html2.clientWidth; let height = html2.clientHeight; let x = 0; let y = 0; if (visualViewport) { width = visualViewport.width; height = visualViewport.height; const visualViewportBased = isWebKit(); if (!visualViewportBased || visualViewportBased && strategy === "fixed") { x = visualViewport.offsetLeft; y = visualViewport.offsetTop; } } return { width, height, x, y }; } function getInnerBoundingClientRect(element2, strategy) { const clientRect = getBoundingClientRect(element2, true, strategy === "fixed"); const top = clientRect.top + element2.clientTop; const left = clientRect.left + element2.clientLeft; const scale = isHTMLElement(element2) ? getScale(element2) : createCoords(1); const width = element2.clientWidth * scale.x; const height = element2.clientHeight * scale.y; const x = left * scale.x; const y = top * scale.y; return { width, height, x, y }; } function getClientRectFromClippingAncestor(element2, clippingAncestor, strategy) { let rect; if (clippingAncestor === "viewport") { rect = getViewportRect(element2, strategy); } else if (clippingAncestor === "document") { rect = getDocumentRect(getDocumentElement(element2)); } else if (isElement(clippingAncestor)) { rect = getInnerBoundingClientRect(clippingAncestor, strategy); } else { const visualOffsets = getVisualOffsets(element2); rect = { ...clippingAncestor, x: clippingAncestor.x - visualOffsets.x, y: clippingAncestor.y - visualOffsets.y }; } return rectToClientRect(rect); } function hasFixedPositionAncestor(element2, stopNode) { const parentNode = getParentNode(element2); if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) { return false; } return getComputedStyle2(parentNode).position === "fixed" || hasFixedPositionAncestor(parentNode, stopNode); } function getClippingElementAncestors(element2, cache) { const cachedResult = cache.get(element2); if (cachedResult) { return cachedResult; } let result = getOverflowAncestors(element2, [], false).filter((el) => isElement(el) && getNodeName(el) !== "body"); let currentContainingBlockComputedStyle = null; const elementIsFixed = getComputedStyle2(element2).position === "fixed"; let currentNode = elementIsFixed ? getParentNode(element2) : element2; while (isElement(currentNode) && !isLastTraversableNode(currentNode)) { const computedStyle = getComputedStyle2(currentNode); const currentNodeIsContaining = isContainingBlock(currentNode); if (!currentNodeIsContaining && computedStyle.position === "fixed") { currentContainingBlockComputedStyle = null; } const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === "static" && !!currentContainingBlockComputedStyle && ["absolute", "fixed"].includes(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element2, currentNode); if (shouldDropCurrentNode) { result = result.filter((ancestor) => ancestor !== currentNode); } else { currentContainingBlockComputedStyle = computedStyle; } currentNode = getParentNode(currentNode); } cache.set(element2, result); return result; } function getClippingRect(_ref) { let { element: element2, boundary: boundary2, rootBoundary, strategy } = _ref; const elementClippingAncestors = boundary2 === "clippingAncestors" ? isTopLayer(element2) ? [] : getClippingElementAncestors(element2, this._c) : [].concat(boundary2); const clippingAncestors = [...elementClippingAncestors, rootBoundary]; const firstClippingAncestor = clippingAncestors[0]; const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => { const rect = getClientRectFromClippingAncestor(element2, clippingAncestor, strategy); 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; }, getClientRectFromClippingAncestor(element2, firstClippingAncestor, strategy)); return { width: clippingRect.right - clippingRect.left, height: clippingRect.bottom - clippingRect.top, x: clippingRect.left, y: clippingRect.top }; } function getDimensions(element2) { const { width, height } = getCssDimensions(element2); return { width, height }; } function getRectRelativeToOffsetParent(element2, offsetParent, strategy) { const isOffsetParentAnElement = isHTMLElement(offsetParent); const documentElement = getDocumentElement(offsetParent); const isFixed = strategy === "fixed"; const rect = getBoundingClientRect(element2, true, isFixed, offsetParent); let scroll = { scrollLeft: 0, scrollTop: 0 }; const offsets = createCoords(0); if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) { if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) { scroll = getNodeScroll(offsetParent); } if (isOffsetParentAnElement) { const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent); offsets.x = offsetRect.x + offsetParent.clientLeft; offsets.y = offsetRect.y + offsetParent.clientTop; } else if (documentElement) { offsets.x = getWindowScrollBarX(documentElement); } } const x = rect.left + scroll.scrollLeft - offsets.x; const y = rect.top + scroll.scrollTop - offsets.y; return { x, y, width: rect.width, height: rect.height }; } function isStaticPositioned(element2) { return getComputedStyle2(element2).position === "static"; } function getTrueOffsetParent(element2, polyfill) { if (!isHTMLElement(element2) || getComputedStyle2(element2).position === "fixed") { return null; } if (polyfill) { return polyfill(element2); } return element2.offsetParent; } function getOffsetParent(element2, polyfill) { const win = getWindow(element2); if (isTopLayer(element2)) { return win; } if (!isHTMLElement(element2)) { let svgOffsetParent = getParentNode(element2); while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) { if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) { return svgOffsetParent; } svgOffsetParent = getParentNode(svgOffsetParent); } return win; } let offsetParent = getTrueOffsetParent(element2, polyfill); while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) { offsetParent = getTrueOffsetParent(offsetParent, polyfill); } if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) { return win; } return offsetParent || getContainingBlock(element2) || win; } var getElementRects = async function(data) { const getOffsetParentFn = this.getOffsetParent || getOffsetParent; const getDimensionsFn = this.getDimensions; const floatingDimensions = await getDimensionsFn(data.floating); return { reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy), floating: { x: 0, y: 0, width: floatingDimensions.width, height: floatingDimensions.height } }; }; function isRTL(element2) { return getComputedStyle2(element2).direction === "rtl"; } var platform = { convertOffsetParentRelativeRectToViewportRelativeRect, getDocumentElement, getClippingRect, getOffsetParent, getElementRects, getClientRects, getDimensions, getScale, isElement, isRTL }; function observeMove(element2, onMove) { let io = null; let timeoutId; const root22 = getDocumentElement(element2); function cleanup() { var _io; clearTimeout(timeoutId); (_io = io) == null || _io.disconnect(); io = null; } function refresh(skip, threshold) { if (skip === void 0) { skip = false; } if (threshold === void 0) { threshold = 1; } cleanup(); const { left, top, width, height } = element2.getBoundingClientRect(); if (!skip) { onMove(); } if (!width || !height) { return; } const insetTop = floor(top); const insetRight = floor(root22.clientWidth - (left + width)); const insetBottom = floor(root22.clientHeight - (top + height)); const insetLeft = floor(left); const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px"; const options2 = { rootMargin, threshold: max(0, min(1, threshold)) || 1 }; let isFirstUpdate = true; function handleObserve(entries) { const ratio = entries[0].intersectionRatio; if (ratio !== threshold) { if (!isFirstUpdate) { return refresh(); } if (!ratio) { timeoutId = setTimeout(() => { refresh(false, 1e-7); }, 1e3); } else { refresh(false, ratio); } } isFirstUpdate = false; } try { io = new IntersectionObserver(handleObserve, { ...options2, // Handle