'use strict'; var obsidian = require('obsidian'); function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } var obsidian__default = /*#__PURE__*/_interopDefaultLegacy(obsidian); const VIEW_TYPE_CALENDAR = "calendar"; const TRIGGER_ON_OPEN = "calendar:open"; const debug = ( typeof process === 'object' && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ) ? (...args) => console.error('SEMVER', ...args) : () => {}; var debug_1 = debug; // Note: this is the semver.org version of the spec that it implements // Not necessarily the package version of this code. const SEMVER_SPEC_VERSION = '2.0.0'; const MAX_LENGTH$1 = 256; const MAX_SAFE_INTEGER$1 = Number.MAX_SAFE_INTEGER || /* istanbul ignore next */ 9007199254740991; // Max safe segment length for coercion. const MAX_SAFE_COMPONENT_LENGTH = 16; var constants = { SEMVER_SPEC_VERSION, MAX_LENGTH: MAX_LENGTH$1, MAX_SAFE_INTEGER: MAX_SAFE_INTEGER$1, MAX_SAFE_COMPONENT_LENGTH }; function createCommonjsModule(fn) { var module = { exports: {} }; return fn(module, module.exports), module.exports; } var re_1 = createCommonjsModule(function (module, exports) { const { MAX_SAFE_COMPONENT_LENGTH } = constants; exports = module.exports = {}; // The actual regexps go on exports.re const re = exports.re = []; const src = exports.src = []; const t = exports.t = {}; let R = 0; const createToken = (name, value, isGlobal) => { const index = R++; debug_1(index, value); t[name] = index; src[index] = value; re[index] = new RegExp(value, isGlobal ? 'g' : undefined); }; // The following Regular Expressions can be used for tokenizing, // validating, and parsing SemVer version strings. // ## Numeric Identifier // A single `0`, or a non-zero digit followed by zero or more digits. createToken('NUMERICIDENTIFIER', '0|[1-9]\\d*'); createToken('NUMERICIDENTIFIERLOOSE', '[0-9]+'); // ## Non-numeric Identifier // Zero or more digits, followed by a letter or hyphen, and then zero or // more letters, digits, or hyphens. createToken('NONNUMERICIDENTIFIER', '\\d*[a-zA-Z-][a-zA-Z0-9-]*'); // ## Main Version // Three dot-separated numeric identifiers. createToken('MAINVERSION', `(${src[t.NUMERICIDENTIFIER]})\\.` + `(${src[t.NUMERICIDENTIFIER]})\\.` + `(${src[t.NUMERICIDENTIFIER]})`); createToken('MAINVERSIONLOOSE', `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` + `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` + `(${src[t.NUMERICIDENTIFIERLOOSE]})`); // ## Pre-release Version Identifier // A numeric identifier, or a non-numeric identifier. createToken('PRERELEASEIDENTIFIER', `(?:${src[t.NUMERICIDENTIFIER] }|${src[t.NONNUMERICIDENTIFIER]})`); createToken('PRERELEASEIDENTIFIERLOOSE', `(?:${src[t.NUMERICIDENTIFIERLOOSE] }|${src[t.NONNUMERICIDENTIFIER]})`); // ## Pre-release Version // Hyphen, followed by one or more dot-separated pre-release version // identifiers. createToken('PRERELEASE', `(?:-(${src[t.PRERELEASEIDENTIFIER] }(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`); createToken('PRERELEASELOOSE', `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE] }(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`); // ## Build Metadata Identifier // Any combination of digits, letters, or hyphens. createToken('BUILDIDENTIFIER', '[0-9A-Za-z-]+'); // ## Build Metadata // Plus sign, followed by one or more period-separated build metadata // identifiers. createToken('BUILD', `(?:\\+(${src[t.BUILDIDENTIFIER] }(?:\\.${src[t.BUILDIDENTIFIER]})*))`); // ## Full Version String // A main version, followed optionally by a pre-release version and // build metadata. // Note that the only major, minor, patch, and pre-release sections of // the version string are capturing groups. The build metadata is not a // capturing group, because it should not ever be used in version // comparison. createToken('FULLPLAIN', `v?${src[t.MAINVERSION] }${src[t.PRERELEASE]}?${ src[t.BUILD]}?`); createToken('FULL', `^${src[t.FULLPLAIN]}$`); // like full, but allows v1.2.3 and =1.2.3, which people do sometimes. // also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty // common in the npm registry. createToken('LOOSEPLAIN', `[v=\\s]*${src[t.MAINVERSIONLOOSE] }${src[t.PRERELEASELOOSE]}?${ src[t.BUILD]}?`); createToken('LOOSE', `^${src[t.LOOSEPLAIN]}$`); createToken('GTLT', '((?:<|>)?=?)'); // Something like "2.*" or "1.2.x". // Note that "x.x" is a valid xRange identifer, meaning "any version" // Only the first item is strictly required. createToken('XRANGEIDENTIFIERLOOSE', `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`); createToken('XRANGEIDENTIFIER', `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`); createToken('XRANGEPLAIN', `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})` + `(?:\\.(${src[t.XRANGEIDENTIFIER]})` + `(?:\\.(${src[t.XRANGEIDENTIFIER]})` + `(?:${src[t.PRERELEASE]})?${ src[t.BUILD]}?` + `)?)?`); createToken('XRANGEPLAINLOOSE', `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})` + `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` + `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` + `(?:${src[t.PRERELEASELOOSE]})?${ src[t.BUILD]}?` + `)?)?`); createToken('XRANGE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`); createToken('XRANGELOOSE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`); // Coercion. // Extract anything that could conceivably be a part of a valid semver createToken('COERCE', `${'(^|[^\\d])' + '(\\d{1,'}${MAX_SAFE_COMPONENT_LENGTH}})` + `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` + `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` + `(?:$|[^\\d])`); createToken('COERCERTL', src[t.COERCE], true); // Tilde ranges. // Meaning is "reasonably at or greater than" createToken('LONETILDE', '(?:~>?)'); createToken('TILDETRIM', `(\\s*)${src[t.LONETILDE]}\\s+`, true); exports.tildeTrimReplace = '$1~'; createToken('TILDE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`); createToken('TILDELOOSE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`); // Caret ranges. // Meaning is "at least and backwards compatible with" createToken('LONECARET', '(?:\\^)'); createToken('CARETTRIM', `(\\s*)${src[t.LONECARET]}\\s+`, true); exports.caretTrimReplace = '$1^'; createToken('CARET', `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`); createToken('CARETLOOSE', `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`); // A simple gt/lt/eq thing, or just "" to indicate "any version" createToken('COMPARATORLOOSE', `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`); createToken('COMPARATOR', `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`); // An expression to strip any whitespace between the gtlt and the thing // it modifies, so that `> 1.2.3` ==> `>1.2.3` createToken('COMPARATORTRIM', `(\\s*)${src[t.GTLT] }\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true); exports.comparatorTrimReplace = '$1$2$3'; // Something like `1.2.3 - 1.2.4` // Note that these all use the loose form, because they'll be // checked against either the strict or loose comparator form // later. createToken('HYPHENRANGE', `^\\s*(${src[t.XRANGEPLAIN]})` + `\\s+-\\s+` + `(${src[t.XRANGEPLAIN]})` + `\\s*$`); createToken('HYPHENRANGELOOSE', `^\\s*(${src[t.XRANGEPLAINLOOSE]})` + `\\s+-\\s+` + `(${src[t.XRANGEPLAINLOOSE]})` + `\\s*$`); // Star ranges basically just allow anything at all. createToken('STAR', '(<|>)?=?\\s*\\*'); // >=0.0.0 is like a star createToken('GTE0', '^\\s*>=\\s*0\.0\.0\\s*$'); createToken('GTE0PRE', '^\\s*>=\\s*0\.0\.0-0\\s*$'); }); // parse out just the options we care about so we always get a consistent // obj with keys in a consistent order. const opts = ['includePrerelease', 'loose', 'rtl']; const parseOptions = options => !options ? {} : typeof options !== 'object' ? { loose: true } : opts.filter(k => options[k]).reduce((options, k) => { options[k] = true; return options }, {}); var parseOptions_1 = parseOptions; const numeric = /^[0-9]+$/; const compareIdentifiers$1 = (a, b) => { const anum = numeric.test(a); const bnum = numeric.test(b); if (anum && bnum) { a = +a; b = +b; } return a === b ? 0 : (anum && !bnum) ? -1 : (bnum && !anum) ? 1 : a < b ? -1 : 1 }; const rcompareIdentifiers = (a, b) => compareIdentifiers$1(b, a); var identifiers = { compareIdentifiers: compareIdentifiers$1, rcompareIdentifiers }; const { MAX_LENGTH, MAX_SAFE_INTEGER } = constants; const { re, t } = re_1; const { compareIdentifiers } = identifiers; class SemVer { constructor (version, options) { options = parseOptions_1(options); if (version instanceof SemVer) { if (version.loose === !!options.loose && version.includePrerelease === !!options.includePrerelease) { return version } else { version = version.version; } } else if (typeof version !== 'string') { throw new TypeError(`Invalid Version: ${version}`) } if (version.length > MAX_LENGTH) { throw new TypeError( `version is longer than ${MAX_LENGTH} characters` ) } debug_1('SemVer', version, options); this.options = options; this.loose = !!options.loose; // this isn't actually relevant for versions, but keep it so that we // don't run into trouble passing this.options around. this.includePrerelease = !!options.includePrerelease; const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]); if (!m) { throw new TypeError(`Invalid Version: ${version}`) } this.raw = version; // these are actually numbers this.major = +m[1]; this.minor = +m[2]; this.patch = +m[3]; if (this.major > MAX_SAFE_INTEGER || this.major < 0) { throw new TypeError('Invalid major version') } if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) { throw new TypeError('Invalid minor version') } if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) { throw new TypeError('Invalid patch version') } // numberify any prerelease numeric ids if (!m[4]) { this.prerelease = []; } else { this.prerelease = m[4].split('.').map((id) => { if (/^[0-9]+$/.test(id)) { const num = +id; if (num >= 0 && num < MAX_SAFE_INTEGER) { return num } } return id }); } this.build = m[5] ? m[5].split('.') : []; this.format(); } format () { this.version = `${this.major}.${this.minor}.${this.patch}`; if (this.prerelease.length) { this.version += `-${this.prerelease.join('.')}`; } return this.version } toString () { return this.version } compare (other) { debug_1('SemVer.compare', this.version, this.options, other); if (!(other instanceof SemVer)) { if (typeof other === 'string' && other === this.version) { return 0 } other = new SemVer(other, this.options); } if (other.version === this.version) { return 0 } return this.compareMain(other) || this.comparePre(other) } compareMain (other) { if (!(other instanceof SemVer)) { other = new SemVer(other, this.options); } return ( compareIdentifiers(this.major, other.major) || compareIdentifiers(this.minor, other.minor) || compareIdentifiers(this.patch, other.patch) ) } comparePre (other) { if (!(other instanceof SemVer)) { other = new SemVer(other, this.options); } // NOT having a prerelease is > having one if (this.prerelease.length && !other.prerelease.length) { return -1 } else if (!this.prerelease.length && other.prerelease.length) { return 1 } else if (!this.prerelease.length && !other.prerelease.length) { return 0 } let i = 0; do { const a = this.prerelease[i]; const b = other.prerelease[i]; debug_1('prerelease compare', i, a, b); if (a === undefined && b === undefined) { return 0 } else if (b === undefined) { return 1 } else if (a === undefined) { return -1 } else if (a === b) { continue } else { return compareIdentifiers(a, b) } } while (++i) } compareBuild (other) { if (!(other instanceof SemVer)) { other = new SemVer(other, this.options); } let i = 0; do { const a = this.build[i]; const b = other.build[i]; debug_1('prerelease compare', i, a, b); if (a === undefined && b === undefined) { return 0 } else if (b === undefined) { return 1 } else if (a === undefined) { return -1 } else if (a === b) { continue } else { return compareIdentifiers(a, b) } } while (++i) } // preminor will bump the version up to the next minor release, and immediately // down to pre-release. premajor and prepatch work the same way. inc (release, identifier) { switch (release) { case 'premajor': this.prerelease.length = 0; this.patch = 0; this.minor = 0; this.major++; this.inc('pre', identifier); break case 'preminor': this.prerelease.length = 0; this.patch = 0; this.minor++; this.inc('pre', identifier); break case 'prepatch': // If this is already a prerelease, it will bump to the next version // drop any prereleases that might already exist, since they are not // relevant at this point. this.prerelease.length = 0; this.inc('patch', identifier); this.inc('pre', identifier); break // If the input is a non-prerelease version, this acts the same as // prepatch. case 'prerelease': if (this.prerelease.length === 0) { this.inc('patch', identifier); } this.inc('pre', identifier); break case 'major': // If this is a pre-major version, bump up to the same major version. // Otherwise increment major. // 1.0.0-5 bumps to 1.0.0 // 1.1.0 bumps to 2.0.0 if ( this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0 ) { this.major++; } this.minor = 0; this.patch = 0; this.prerelease = []; break case 'minor': // If this is a pre-minor version, bump up to the same minor version. // Otherwise increment minor. // 1.2.0-5 bumps to 1.2.0 // 1.2.1 bumps to 1.3.0 if (this.patch !== 0 || this.prerelease.length === 0) { this.minor++; } this.patch = 0; this.prerelease = []; break case 'patch': // If this is not a pre-release version, it will increment the patch. // If it is a pre-release it will bump up to the same patch version. // 1.2.0-5 patches to 1.2.0 // 1.2.0 patches to 1.2.1 if (this.prerelease.length === 0) { this.patch++; } this.prerelease = []; break // This probably shouldn't be used publicly. // 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction. case 'pre': if (this.prerelease.length === 0) { this.prerelease = [0]; } else { let i = this.prerelease.length; while (--i >= 0) { if (typeof this.prerelease[i] === 'number') { this.prerelease[i]++; i = -2; } } if (i === -1) { // didn't increment anything this.prerelease.push(0); } } if (identifier) { // 1.2.0-beta.1 bumps to 1.2.0-beta.2, // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0 if (this.prerelease[0] === identifier) { if (isNaN(this.prerelease[1])) { this.prerelease = [identifier, 0]; } } else { this.prerelease = [identifier, 0]; } } break default: throw new Error(`invalid increment argument: ${release}`) } this.format(); this.raw = this.version; return this } } var semver = SemVer; const compare = (a, b, loose) => new semver(a, loose).compare(new semver(b, loose)); var compare_1 = compare; const gte = (a, b, loose) => compare_1(a, b, loose) >= 0; var gte_1 = gte; const lt = (a, b, loose) => compare_1(a, b, loose) < 0; var lt_1 = lt; const migrations = []; function applyMigrations(settings) { const previousVersion = settings.version || "1.0.0"; const currentVersion = "1.5.3"; for (const migration of migrations) { if (lt_1(previousVersion, migration.version) && gte_1(currentVersion, migration.version)) { migration.apply(settings); } } return settings; } function noop$1() { } function assign$1(tar, src) { // @ts-ignore for (const k in src) tar[k] = src[k]; return tar; } function run$1(fn) { return fn(); } function blank_object$1() { return Object.create(null); } function run_all$1(fns) { fns.forEach(run$1); } function is_function$1(thing) { return typeof thing === 'function'; } function safe_not_equal$1(a, b) { return a != a ? b == b : a !== b || ((a && typeof a === 'object') || typeof a === 'function'); } function is_empty$1(obj) { return Object.keys(obj).length === 0; } function subscribe$1(store, ...callbacks) { if (store == null) { return noop$1; } const unsub = store.subscribe(...callbacks); return unsub.unsubscribe ? () => unsub.unsubscribe() : unsub; } function get_store_value$1(store) { let value; subscribe$1(store, _ => value = _)(); return value; } function component_subscribe$1(component, store, callback) { component.$$.on_destroy.push(subscribe$1(store, callback)); } function create_slot$1(definition, ctx, $$scope, fn) { if (definition) { const slot_ctx = get_slot_context$1(definition, ctx, $$scope, fn); return definition[0](slot_ctx); } } function get_slot_context$1(definition, ctx, $$scope, fn) { return definition[1] && fn ? assign$1($$scope.ctx.slice(), definition[1](fn(ctx))) : $$scope.ctx; } function get_slot_changes$1(definition, $$scope, dirty, fn) { if (definition[2] && fn) { const lets = definition[2](fn(dirty)); if ($$scope.dirty === undefined) { return lets; } if (typeof lets === 'object') { const merged = []; const len = Math.max($$scope.dirty.length, lets.length); for (let i = 0; i < len; i += 1) { merged[i] = $$scope.dirty[i] | lets[i]; } return merged; } return $$scope.dirty | lets; } return $$scope.dirty; } function update_slot$1(slot, slot_definition, ctx, $$scope, dirty, get_slot_changes_fn, get_slot_context_fn) { const slot_changes = get_slot_changes$1(slot_definition, $$scope, dirty, get_slot_changes_fn); if (slot_changes) { const slot_context = get_slot_context$1(slot_definition, ctx, $$scope, get_slot_context_fn); slot.p(slot_context, slot_changes); } } function set_store_value(store, ret, value = ret) { store.set(value); return ret; } function action_destroyer$1(action_result) { return action_result && is_function$1(action_result.destroy) ? action_result.destroy : noop$1; } function append$1(target, node) { target.appendChild(node); } function insert$1(target, node, anchor) { target.insertBefore(node, anchor || null); } function detach$1(node) { node.parentNode.removeChild(node); } function destroy_each$1(iterations, detaching) { for (let i = 0; i < iterations.length; i += 1) { if (iterations[i]) iterations[i].d(detaching); } } function element$1(name) { return document.createElement(name); } function svg_element$1(name) { return document.createElementNS('http://www.w3.org/2000/svg', name); } function text$1(data) { return document.createTextNode(data); } function space$1() { return text$1(' '); } function empty$1() { return text$1(''); } function listen$1(node, event, handler, options) { node.addEventListener(event, handler, options); return () => node.removeEventListener(event, handler, options); } function stop_propagation(fn) { return function (event) { event.stopPropagation(); // @ts-ignore return fn.call(this, event); }; } function attr$1(node, attribute, value) { if (value == null) node.removeAttribute(attribute); else if (node.getAttribute(attribute) !== value) node.setAttribute(attribute, value); } function set_attributes$1(node, attributes) { // @ts-ignore const descriptors = Object.getOwnPropertyDescriptors(node.__proto__); for (const key in attributes) { if (attributes[key] == null) { node.removeAttribute(key); } else if (key === 'style') { node.style.cssText = attributes[key]; } else if (key === '__value') { node.value = node[key] = attributes[key]; } else if (descriptors[key] && descriptors[key].set) { node[key] = attributes[key]; } else { attr$1(node, key, attributes[key]); } } } function children$1(element) { return Array.from(element.childNodes); } function set_data$1(text, data) { data = '' + data; if (text.wholeText !== data) text.data = data; } function set_input_value(input, value) { input.value = value == null ? '' : value; } function set_style$1(node, key, value, important) { node.style.setProperty(key, value, important ? 'important' : ''); } function select_option(select, value) { for (let i = 0; i < select.options.length; i += 1) { const option = select.options[i]; if (option.__value === value) { option.selected = true; return; } } } function select_value(select) { const selected_option = select.querySelector(':checked') || select.options[0]; return selected_option && selected_option.__value; } function toggle_class$1(element, name, toggle) { element.classList[toggle ? 'add' : 'remove'](name); } function custom_event$1(type, detail) { const e = document.createEvent('CustomEvent'); e.initCustomEvent(type, false, false, detail); return e; } let current_component$1; function set_current_component$1(component) { current_component$1 = component; } function get_current_component$1() { if (!current_component$1) throw new Error('Function called outside component initialization'); return current_component$1; } function onDestroy$1(fn) { get_current_component$1().$$.on_destroy.push(fn); } function createEventDispatcher$1() { const component = get_current_component$1(); return (type, detail) => { const callbacks = component.$$.callbacks[type]; if (callbacks) { // TODO are there situations where events could be dispatched // in a server (non-DOM) environment? const event = custom_event$1(type, detail); callbacks.slice().forEach(fn => { fn.call(component, event); }); } }; } // TODO figure out if we still want to support // shorthand events, or if we want to implement // a real bubbling mechanism function bubble$1(component, event) { const callbacks = component.$$.callbacks[event.type]; if (callbacks) { callbacks.slice().forEach(fn => fn(event)); } } const dirty_components$1 = []; const binding_callbacks$1 = []; const render_callbacks$1 = []; const flush_callbacks$1 = []; const resolved_promise$1 = Promise.resolve(); let update_scheduled$1 = false; function schedule_update$1() { if (!update_scheduled$1) { update_scheduled$1 = true; resolved_promise$1.then(flush$1); } } function tick$1() { schedule_update$1(); return resolved_promise$1; } function add_render_callback$1(fn) { render_callbacks$1.push(fn); } function add_flush_callback$1(fn) { flush_callbacks$1.push(fn); } let flushing$1 = false; const seen_callbacks$1 = new Set(); function flush$1() { if (flushing$1) return; flushing$1 = true; do { // first, call beforeUpdate functions // and update components for (let i = 0; i < dirty_components$1.length; i += 1) { const component = dirty_components$1[i]; set_current_component$1(component); update$1(component.$$); } set_current_component$1(null); dirty_components$1.length = 0; while (binding_callbacks$1.length) binding_callbacks$1.pop()(); // then, once components are updated, call // afterUpdate functions. This may cause // subsequent updates... for (let i = 0; i < render_callbacks$1.length; i += 1) { const callback = render_callbacks$1[i]; if (!seen_callbacks$1.has(callback)) { // ...so guard against infinite loops seen_callbacks$1.add(callback); callback(); } } render_callbacks$1.length = 0; } while (dirty_components$1.length); while (flush_callbacks$1.length) { flush_callbacks$1.pop()(); } update_scheduled$1 = false; flushing$1 = false; seen_callbacks$1.clear(); } function update$1($$) { if ($$.fragment !== null) { $$.update(); run_all$1($$.before_update); const dirty = $$.dirty; $$.dirty = [-1]; $$.fragment && $$.fragment.p($$.ctx, dirty); $$.after_update.forEach(add_render_callback$1); } } const outroing$1 = new Set(); let outros$1; function group_outros$1() { outros$1 = { r: 0, c: [], p: outros$1 // parent group }; } function check_outros$1() { if (!outros$1.r) { run_all$1(outros$1.c); } outros$1 = outros$1.p; } function transition_in$1(block, local) { if (block && block.i) { outroing$1.delete(block); block.i(local); } } function transition_out$1(block, local, detach, callback) { if (block && block.o) { if (outroing$1.has(block)) return; outroing$1.add(block); outros$1.c.push(() => { outroing$1.delete(block); if (callback) { if (detach) block.d(1); callback(); } }); block.o(local); } } function outro_and_destroy_block$1(block, lookup) { transition_out$1(block, 1, 1, () => { lookup.delete(block.key); }); } function update_keyed_each$1(old_blocks, dirty, get_key, dynamic, ctx, list, lookup, node, destroy, create_each_block, next, get_context) { let o = old_blocks.length; let n = list.length; let i = o; const old_indexes = {}; while (i--) old_indexes[old_blocks[i].key] = i; const new_blocks = []; const new_lookup = new Map(); const deltas = new Map(); i = n; while (i--) { const child_ctx = get_context(ctx, list, i); const key = get_key(child_ctx); let block = lookup.get(key); if (!block) { block = create_each_block(key, child_ctx); block.c(); } else if (dynamic) { block.p(child_ctx, dirty); } new_lookup.set(key, new_blocks[i] = block); if (key in old_indexes) deltas.set(key, Math.abs(i - old_indexes[key])); } const will_move = new Set(); const did_move = new Set(); function insert(block) { transition_in$1(block, 1); block.m(node, next); lookup.set(block.key, block); next = block.first; n--; } while (o && n) { const new_block = new_blocks[n - 1]; const old_block = old_blocks[o - 1]; const new_key = new_block.key; const old_key = old_block.key; if (new_block === old_block) { // do nothing next = new_block.first; o--; n--; } else if (!new_lookup.has(old_key)) { // remove old block destroy(old_block, lookup); o--; } else if (!lookup.has(new_key) || will_move.has(new_key)) { insert(new_block); } else if (did_move.has(old_key)) { o--; } else if (deltas.get(new_key) > deltas.get(old_key)) { did_move.add(new_key); insert(new_block); } else { will_move.add(old_key); o--; } } while (o--) { const old_block = old_blocks[o]; if (!new_lookup.has(old_block.key)) destroy(old_block, lookup); } while (n) insert(new_blocks[n - 1]); return new_blocks; } function get_spread_update$1(levels, updates) { const update = {}; const to_null_out = {}; const accounted_for = { $$scope: 1 }; let i = levels.length; while (i--) { const o = levels[i]; const n = updates[i]; if (n) { for (const key in o) { if (!(key in n)) to_null_out[key] = 1; } for (const key in n) { if (!accounted_for[key]) { update[key] = n[key]; accounted_for[key] = 1; } } levels[i] = n; } else { for (const key in o) { accounted_for[key] = 1; } } } for (const key in to_null_out) { if (!(key in update)) update[key] = undefined; } return update; } function bind$1(component, name, callback) { const index = component.$$.props[name]; if (index !== undefined) { component.$$.bound[index] = callback; callback(component.$$.ctx[index]); } } function create_component$1(block) { block && block.c(); } function mount_component$1(component, target, anchor, customElement) { const { fragment, on_mount, on_destroy, after_update } = component.$$; fragment && fragment.m(target, anchor); if (!customElement) { // onMount happens before the initial afterUpdate add_render_callback$1(() => { const new_on_destroy = on_mount.map(run$1).filter(is_function$1); if (on_destroy) { on_destroy.push(...new_on_destroy); } else { // Edge case - component was destroyed immediately, // most likely as a result of a binding initialising run_all$1(new_on_destroy); } component.$$.on_mount = []; }); } after_update.forEach(add_render_callback$1); } function destroy_component$1(component, detaching) { const $$ = component.$$; if ($$.fragment !== null) { run_all$1($$.on_destroy); $$.fragment && $$.fragment.d(detaching); // TODO null out other refs, including component.$$ (but need to // preserve final state?) $$.on_destroy = $$.fragment = null; $$.ctx = []; } } function make_dirty$1(component, i) { if (component.$$.dirty[0] === -1) { dirty_components$1.push(component); schedule_update$1(); component.$$.dirty.fill(0); } component.$$.dirty[(i / 31) | 0] |= (1 << (i % 31)); } function init$1(component, options, instance, create_fragment, not_equal, props, dirty = [-1]) { const parent_component = current_component$1; set_current_component$1(component); const $$ = component.$$ = { fragment: null, ctx: null, // state props, update: noop$1, not_equal, bound: blank_object$1(), // lifecycle on_mount: [], on_destroy: [], on_disconnect: [], before_update: [], after_update: [], context: new Map(parent_component ? parent_component.$$.context : options.context || []), // everything else callbacks: blank_object$1(), dirty, skip_bound: false }; let ready = false; $$.ctx = instance ? instance(component, options.props || {}, (i, ret, ...rest) => { const value = rest.length ? rest[0] : ret; if ($$.ctx && not_equal($$.ctx[i], $$.ctx[i] = value)) { if (!$$.skip_bound && $$.bound[i]) $$.bound[i](value); if (ready) make_dirty$1(component, i); } return ret; }) : []; $$.update(); ready = true; run_all$1($$.before_update); // `false` as a special case of no DOM component $$.fragment = create_fragment ? create_fragment($$.ctx) : false; if (options.target) { if (options.hydrate) { const nodes = children$1(options.target); // eslint-disable-next-line @typescript-eslint/no-non-null-assertion $$.fragment && $$.fragment.l(nodes); nodes.forEach(detach$1); } else { // eslint-disable-next-line @typescript-eslint/no-non-null-assertion $$.fragment && $$.fragment.c(); } if (options.intro) transition_in$1(component.$$.fragment); mount_component$1(component, options.target, options.anchor, options.customElement); flush$1(); } set_current_component$1(parent_component); } /** * Base class for Svelte components. Used when dev=false. */ class SvelteComponent$1 { $destroy() { destroy_component$1(this, 1); this.$destroy = noop$1; } $on(type, callback) { const callbacks = (this.$$.callbacks[type] || (this.$$.callbacks[type] = [])); callbacks.push(callback); return () => { const index = callbacks.indexOf(callback); if (index !== -1) callbacks.splice(index, 1); }; } $set($$props) { if (this.$$set && !is_empty$1($$props)) { this.$$.skip_bound = true; this.$$set($$props); this.$$.skip_bound = false; } } } const subscriber_queue$1 = []; /** * Create a `Writable` store that allows both updating and reading by subscription. * @param {*=}value initial value * @param {StartStopNotifier=}start start and stop notifications for subscriptions */ function writable$1(value, start = noop$1) { let stop; const subscribers = []; function set(new_value) { if (safe_not_equal$1(value, new_value)) { value = new_value; if (stop) { // store is ready const run_queue = !subscriber_queue$1.length; for (let i = 0; i < subscribers.length; i += 1) { const s = subscribers[i]; s[1](); subscriber_queue$1.push(s, value); } if (run_queue) { for (let i = 0; i < subscriber_queue$1.length; i += 2) { subscriber_queue$1[i][0](subscriber_queue$1[i + 1]); } subscriber_queue$1.length = 0; } } } } function update(fn) { set(fn(value)); } function subscribe(run, invalidate = noop$1) { const subscriber = [run, invalidate]; subscribers.push(subscriber); if (subscribers.length === 1) { stop = start(set) || noop$1; } run(value); return () => { const index = subscribers.indexOf(subscriber); if (index !== -1) { subscribers.splice(index, 1); } if (subscribers.length === 0) { stop(); stop = null; } }; } return { set, update, subscribe }; } const defaultSettings = Object.freeze({ shouldConfirmBeforeCreate: true, localeOverride: "system-default", weekStart: "locale", showWeeklyNote: false, sourceSettings: {}, }); const DEFAULT_DAILY_NOTE_FORMAT$1 = "YYYY-MM-DD"; const DEFAULT_WEEKLY_NOTE_FORMAT$1 = "gggg-[W]ww"; const DEFAULT_MONTHLY_NOTE_FORMAT$1 = "YYYY-MM"; function shouldUsePeriodicNotesSettings$1(periodicity) { // eslint-disable-next-line @typescript-eslint/no-explicit-any const periodicNotes = window.app.plugins.getPlugin("periodic-notes"); return periodicNotes && periodicNotes.settings?.[periodicity]?.enabled; } /** * Read the user settings for the `daily-notes` plugin * to keep behavior of creating a new note in-sync. */ function getDailyNoteSettings$1() { try { // eslint-disable-next-line @typescript-eslint/no-explicit-any const { internalPlugins, plugins } = window.app; if (shouldUsePeriodicNotesSettings$1("daily")) { const { format, folder, template } = plugins.getPlugin("periodic-notes")?.settings?.daily || {}; return { format: format || DEFAULT_DAILY_NOTE_FORMAT$1, folder: folder?.trim() || "", template: template?.trim() || "", }; } const { folder, format, template } = internalPlugins.getPluginById("daily-notes")?.instance?.options || {}; return { format: format || DEFAULT_DAILY_NOTE_FORMAT$1, folder: folder?.trim() || "", template: template?.trim() || "", }; } catch (err) { console.info("No custom daily note settings found!", err); } } /** * Read the user settings for the `weekly-notes` plugin * to keep behavior of creating a new note in-sync. */ function getWeeklyNoteSettings$1() { try { // eslint-disable-next-line @typescript-eslint/no-explicit-any const pluginManager = window.app.plugins; const calendarSettings = pluginManager.getPlugin("calendar")?.options; const periodicNotesSettings = pluginManager.getPlugin("periodic-notes") ?.settings?.weekly; if (shouldUsePeriodicNotesSettings$1("weekly")) { return { format: periodicNotesSettings.format || DEFAULT_WEEKLY_NOTE_FORMAT$1, folder: periodicNotesSettings.folder?.trim() || "", template: periodicNotesSettings.template?.trim() || "", }; } const settings = calendarSettings || {}; return { format: settings.weeklyNoteFormat || DEFAULT_WEEKLY_NOTE_FORMAT$1, folder: settings.weeklyNoteFolder?.trim() || "", template: settings.weeklyNoteTemplate?.trim() || "", }; } catch (err) { console.info("No custom weekly note settings found!", err); } } /** * Read the user settings for the `periodic-notes` plugin * to keep behavior of creating a new note in-sync. */ function getMonthlyNoteSettings$1() { // eslint-disable-next-line @typescript-eslint/no-explicit-any const pluginManager = window.app.plugins; try { const settings = (shouldUsePeriodicNotesSettings$1("monthly") && pluginManager.getPlugin("periodic-notes")?.settings?.monthly) || {}; return { format: settings.format || DEFAULT_MONTHLY_NOTE_FORMAT$1, folder: settings.folder?.trim() || "", template: settings.template?.trim() || "", }; } catch (err) { console.info("No custom monthly note settings found!", err); } } // Credit: @creationix/path.js function join(...partSegments) { // Split the inputs into a list of path commands. let parts = []; for (let i = 0, l = partSegments.length; i < l; i++) { parts = parts.concat(partSegments[i].split("/")); } // Interpret the path commands to get the new resolved path. const newParts = []; for (let i = 0, l = parts.length; i < l; i++) { const part = parts[i]; // Remove leading and trailing slashes // Also remove "." segments if (!part || part === ".") continue; // Push new path segments. else newParts.push(part); } // Preserve the initial slash if there was one. if (parts[0] === "") newParts.unshift(""); // Turn back into a single string path. return newParts.join("/"); } async function ensureFolderExists(path) { const dirs = path.replace(/\\/g, "/").split("/"); dirs.pop(); // remove basename if (dirs.length) { const dir = join(...dirs); if (!window.app.vault.getAbstractFileByPath(dir)) { await window.app.vault.createFolder(dir); } } } async function getNotePath(directory, filename) { if (!filename.endsWith(".md")) { filename += ".md"; } const path = obsidian__default['default'].normalizePath(join(directory, filename)); await ensureFolderExists(path); return path; } async function getTemplateInfo(template) { const { metadataCache, vault } = window.app; const templatePath = obsidian__default['default'].normalizePath(template); if (templatePath === "/") { return Promise.resolve(["", null]); } try { const templateFile = metadataCache.getFirstLinkpathDest(templatePath, ""); const contents = await vault.cachedRead(templateFile); // eslint-disable-next-line @typescript-eslint/no-explicit-any const IFoldInfo = window.app.foldManager.load(templateFile); return [contents, IFoldInfo]; } catch (err) { console.error(`Failed to read the daily note template '${templatePath}'`, err); new obsidian__default['default'].Notice("Failed to read the daily note template"); return ["", null]; } } /** * dateUID is a way of weekly identifying daily/weekly/monthly notes. * They are prefixed with the granularity to avoid ambiguity. */ function getDateUID$1(date, granularity = "day") { const ts = date.clone().startOf(granularity).format(); return `${granularity}-${ts}`; } function removeEscapedCharacters$1(format) { return format.replace(/\[[^\]]*\]/g, ""); // remove everything within brackets } /** * XXX: When parsing dates that contain both week numbers and months, * Moment choses to ignore the week numbers. For the week dateUID, we * want the opposite behavior. Strip the MMM from the format to patch. */ function isFormatAmbiguous$1(format, granularity) { if (granularity === "week") { const cleanFormat = removeEscapedCharacters$1(format); return (/w{1,2}/i.test(cleanFormat) && (/M{1,4}/.test(cleanFormat) || /D{1,4}/.test(cleanFormat))); } return false; } function getDateFromFile$1(file, granularity) { return getDateFromFilename$1(file.basename, granularity); } function getDateFromFilename$1(filename, granularity) { const getSettings = { day: getDailyNoteSettings$1, week: getWeeklyNoteSettings$1, month: getMonthlyNoteSettings$1, }; const format = getSettings[granularity]().format.split("/").pop(); const noteDate = window.moment(filename, format, true); if (!noteDate.isValid()) { return null; } if (isFormatAmbiguous$1(format, granularity)) { if (granularity === "week") { const cleanFormat = removeEscapedCharacters$1(format); if (/w{1,2}/i.test(cleanFormat)) { return window.moment(filename, // If format contains week, remove day & month formatting format.replace(/M{1,4}/g, "").replace(/D{1,4}/g, ""), false); } } } return noteDate; } /** * This function mimics the behavior of the daily-notes plugin * so it will replace {{date}}, {{title}}, and {{time}} with the * formatted timestamp. * * Note: it has an added bonus that it's not 'today' specific. */ async function createDailyNote(date) { const app = window.app; const { vault } = app; const moment = window.moment; const { template, format, folder } = getDailyNoteSettings$1(); const [templateContents, IFoldInfo] = await getTemplateInfo(template); const filename = date.format(format); const normalizedPath = await getNotePath(folder, filename); try { const createdFile = await vault.create(normalizedPath, templateContents .replace(/{{\s*date\s*}}/gi, filename) .replace(/{{\s*time\s*}}/gi, moment().format("HH:mm")) .replace(/{{\s*title\s*}}/gi, filename) .replace(/{{\s*(date|time)\s*(([+-]\d+)([yqmwdhs]))?\s*(:.+?)?}}/gi, (_, _timeOrDate, calc, timeDelta, unit, momentFormat) => { const now = moment(); const currentDate = date.clone().set({ hour: now.get("hour"), minute: now.get("minute"), second: now.get("second"), }); if (calc) { currentDate.add(parseInt(timeDelta, 10), unit); } if (momentFormat) { return currentDate.format(momentFormat.substring(1).trim()); } return currentDate.format(format); }) .replace(/{{\s*yesterday\s*}}/gi, date.clone().subtract(1, "day").format(format)) .replace(/{{\s*tomorrow\s*}}/gi, date.clone().add(1, "d").format(format))); // eslint-disable-next-line @typescript-eslint/no-explicit-any app.foldManager.save(createdFile, IFoldInfo); return createdFile; } catch (err) { console.error(`Failed to create file: '${normalizedPath}'`, err); new obsidian__default['default'].Notice("Unable to create new file."); } } function getDaysOfWeek$1() { const { moment } = window; // eslint-disable-next-line @typescript-eslint/no-explicit-any let weekStart = moment.localeData()._week.dow; const daysOfWeek = [ "sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday", ]; while (weekStart) { daysOfWeek.push(daysOfWeek.shift()); weekStart--; } return daysOfWeek; } function getDayOfWeekNumericalValue(dayOfWeekName) { return getDaysOfWeek$1().indexOf(dayOfWeekName.toLowerCase()); } async function createWeeklyNote(date) { const { vault } = window.app; const { template, format, folder } = getWeeklyNoteSettings$1(); const [templateContents, IFoldInfo] = await getTemplateInfo(template); const filename = date.format(format); const normalizedPath = await getNotePath(folder, filename); try { const createdFile = await vault.create(normalizedPath, templateContents .replace(/{{\s*(date|time)\s*(([+-]\d+)([yqmwdhs]))?\s*(:.+?)?}}/gi, (_, _timeOrDate, calc, timeDelta, unit, momentFormat) => { const now = window.moment(); const currentDate = date.clone().set({ hour: now.get("hour"), minute: now.get("minute"), second: now.get("second"), }); if (calc) { currentDate.add(parseInt(timeDelta, 10), unit); } if (momentFormat) { return currentDate.format(momentFormat.substring(1).trim()); } return currentDate.format(format); }) .replace(/{{\s*title\s*}}/gi, filename) .replace(/{{\s*time\s*}}/gi, window.moment().format("HH:mm")) .replace(/{{\s*(sunday|monday|tuesday|wednesday|thursday|friday|saturday)\s*:(.*?)}}/gi, (_, dayOfWeek, momentFormat) => { const day = getDayOfWeekNumericalValue(dayOfWeek); return date.weekday(day).format(momentFormat.trim()); })); // eslint-disable-next-line @typescript-eslint/no-explicit-any window.app.foldManager.save(createdFile, IFoldInfo); return createdFile; } catch (err) { console.error(`Failed to create file: '${normalizedPath}'`, err); new obsidian__default['default'].Notice("Unable to create new file."); } } /** * This function mimics the behavior of the daily-notes plugin * so it will replace {{date}}, {{title}}, and {{time}} with the * formatted timestamp. * * Note: it has an added bonus that it's not 'today' specific. */ async function createMonthlyNote(date) { const { vault } = window.app; const { template, format, folder } = getMonthlyNoteSettings$1(); const [templateContents, IFoldInfo] = await getTemplateInfo(template); const filename = date.format(format); const normalizedPath = await getNotePath(folder, filename); try { const createdFile = await vault.create(normalizedPath, templateContents .replace(/{{\s*(date|time)\s*(([+-]\d+)([yqmwdhs]))?\s*(:.+?)?}}/gi, (_, _timeOrDate, calc, timeDelta, unit, momentFormat) => { const now = window.moment(); const currentDate = date.clone().set({ hour: now.get("hour"), minute: now.get("minute"), second: now.get("second"), }); if (calc) { currentDate.add(parseInt(timeDelta, 10), unit); } if (momentFormat) { return currentDate.format(momentFormat.substring(1).trim()); } return currentDate.format(format); }) .replace(/{{\s*date\s*}}/gi, filename) .replace(/{{\s*time\s*}}/gi, window.moment().format("HH:mm")) .replace(/{{\s*title\s*}}/gi, filename)); // eslint-disable-next-line @typescript-eslint/no-explicit-any window.app.foldManager.save(createdFile, IFoldInfo); return createdFile; } catch (err) { console.error(`Failed to create file: '${normalizedPath}'`, err); new obsidian__default['default'].Notice("Unable to create new file."); } } function getPeriodicNoteSettings(granularity) { const getSettings = { day: getDailyNoteSettings$1, week: getWeeklyNoteSettings$1, month: getMonthlyNoteSettings$1, }[granularity]; return getSettings(); } function createPeriodicNote(granularity, date) { const createFn = { day: createDailyNote, month: createMonthlyNote, week: createWeeklyNote, }; return createFn[granularity](date); } var createPeriodicNote_1 = createPeriodicNote; var getDateFromFile_1$1 = getDateFromFile$1; var getDateUID_1$1 = getDateUID$1; var getPeriodicNoteSettings_1 = getPeriodicNoteSettings; function partition(arr, predicate) { const pass = []; const fail = []; arr.forEach((elem) => { if (predicate(elem)) { pass.push(elem); } else { fail.push(elem); } }); return [pass, fail]; } /** * Lookup the dateUID for a given file. It compares the filename * to the daily and weekly note formats to find a match. * * @param file */ function getDateUIDFromFile$1(file) { if (!file) { return null; } // TODO: I'm not checking the path! let date = getDateFromFile_1$1(file, "day"); if (date) { return getDateUID_1$1(date, "day"); } date = getDateFromFile_1$1(file, "week"); if (date) { return getDateUID_1$1(date, "week"); } return null; } function getWordCount(text) { const spaceDelimitedChars = /A-Za-z\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC/ .source; const nonSpaceDelimitedWords = /[\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u4E00-\u9FD5\uAC00-\uD7A3\uA960-\uA97C\uD7B0-\uD7C6]/ .source; const pattern = new RegExp([ `(?:[0-9]+(?:(?:,|\\.)[0-9]+)*|[\\-${spaceDelimitedChars}-가-힣ꥠ-ꥼힰ-ퟆ])+`, nonSpaceDelimitedWords, ].join("|"), "g"); return (text.match(pattern) || []).length; } function createSettingsStore() { const store = writable$1(defaultSettings); return Object.assign({ getSourceSettings: (sourceId) => { var _a; const defaultSourceSettings = (((_a = get_store_value$1(sources).find((source) => source.id === sourceId)) === null || _a === void 0 ? void 0 : _a.defaultSettings) || {}); const userSettings = (get_store_value$1(store).sourceSettings[sourceId] || {}); return Object.assign(Object.assign({}, defaultSourceSettings), userSettings); } }, store); } const settings = createSettingsStore(); function createSelectedFileStore() { const store = writable$1(null); return Object.assign({ setFile: (file) => { const id = getDateUIDFromFile$1(file); store.set(id); } }, store); } const activeFile = createSelectedFileStore(); function createSourcesStore() { const store = writable$1([]); return Object.assign({ registerSource: (source) => { store.update((val) => { val.push(source); return val; }); settings.update((existingSettings) => { existingSettings.sourceSettings[source.id] = settings.getSourceSettings(source.id); return existingSettings; }); } }, store); } const sources = createSourcesStore(); class ConfirmationModal extends obsidian.Modal { constructor(app, config) { super(app); const { cta, onAccept, text, title } = config; this.contentEl.createEl("h2", { text: title }); this.contentEl.createEl("p", { text }); this.contentEl.createEl("form", { cls: "modal-button-container" }, (buttonsEl) => { buttonsEl .createEl("button", { text: "Never mind" }) .addEventListener("click", () => this.close()); this.submitEl = buttonsEl.createEl("button", { attr: { type: "submit" }, cls: "mod-cta", text: cta, }); buttonsEl.addEventListener("submit", async (e) => { e.preventDefault(); await onAccept(e); this.close(); }); }); } onOpen() { this.submitEl.focus(); } } function createConfirmationDialog({ cta, onAccept, text, title, }) { new ConfirmationModal(window.app, { cta, onAccept, text, title }).open(); } function getPeriodicity(granularity) { const periodicity = { day: "daily", week: "weekly", month: "monthly", }; return periodicity[granularity]; } function capitalize(text) { return text.charAt(0).toUpperCase() + text.slice(1); } /** * Create a Daily Note for a given date. */ async function tryToCreatePeriodicNote(granularity, date, inNewSplit, settings, cb) { const { workspace } = window.app; const { format } = getPeriodicNoteSettings_1(granularity); const filename = date.format(format); const createFile = async () => { const periodicNote = await createPeriodicNote_1(granularity, date); const leaf = inNewSplit ? workspace.splitActiveLeaf() : workspace.getUnpinnedLeaf(); await leaf.openFile(periodicNote); cb === null || cb === void 0 ? void 0 : cb(periodicNote); }; if (settings.shouldConfirmBeforeCreate) { createConfirmationDialog({ cta: "Create", onAccept: createFile, text: `File ${filename} does not exist. Would you like to create it?`, title: `New ${capitalize(getPeriodicity(granularity))} Note`, }); } else { await createFile(); } } function noop() { } function assign(tar, src) { // @ts-ignore for (const k in src) tar[k] = src[k]; return tar; } function is_promise(value) { return value && typeof value === 'object' && typeof value.then === 'function'; } function run(fn) { return fn(); } function blank_object() { return Object.create(null); } function run_all(fns) { fns.forEach(run); } function is_function(thing) { return typeof thing === 'function'; } function safe_not_equal(a, b) { return a != a ? b == b : a !== b || ((a && typeof a === 'object') || typeof a === 'function'); } function not_equal(a, b) { return a != a ? b == b : a !== b; } function is_empty(obj) { return Object.keys(obj).length === 0; } function subscribe(store, ...callbacks) { if (store == null) { return noop; } const unsub = store.subscribe(...callbacks); return unsub.unsubscribe ? () => unsub.unsubscribe() : unsub; } function get_store_value(store) { let value; subscribe(store, _ => value = _)(); return value; } function component_subscribe(component, store, callback) { component.$$.on_destroy.push(subscribe(store, callback)); } function create_slot(definition, ctx, $$scope, fn) { if (definition) { const slot_ctx = get_slot_context(definition, ctx, $$scope, fn); return definition[0](slot_ctx); } } function get_slot_context(definition, ctx, $$scope, fn) { return definition[1] && fn ? assign($$scope.ctx.slice(), definition[1](fn(ctx))) : $$scope.ctx; } function get_slot_changes(definition, $$scope, dirty, fn) { if (definition[2] && fn) { const lets = definition[2](fn(dirty)); if ($$scope.dirty === undefined) { return lets; } if (typeof lets === 'object') { const merged = []; const len = Math.max($$scope.dirty.length, lets.length); for (let i = 0; i < len; i += 1) { merged[i] = $$scope.dirty[i] | lets[i]; } return merged; } return $$scope.dirty | lets; } return $$scope.dirty; } function update_slot(slot, slot_definition, ctx, $$scope, dirty, get_slot_changes_fn, get_slot_context_fn) { const slot_changes = get_slot_changes(slot_definition, $$scope, dirty, get_slot_changes_fn); if (slot_changes) { const slot_context = get_slot_context(slot_definition, ctx, $$scope, get_slot_context_fn); slot.p(slot_context, slot_changes); } } function action_destroyer(action_result) { return action_result && is_function(action_result.destroy) ? action_result.destroy : noop; } function append(target, node) { target.appendChild(node); } function insert(target, node, anchor) { target.insertBefore(node, anchor || null); } function detach(node) { node.parentNode.removeChild(node); } function destroy_each(iterations, detaching) { for (let i = 0; i < iterations.length; i += 1) { if (iterations[i]) iterations[i].d(detaching); } } function element(name) { return document.createElement(name); } function svg_element(name) { return document.createElementNS('http://www.w3.org/2000/svg', name); } function text(data) { return document.createTextNode(data); } function space() { return text(' '); } function empty() { return text(''); } function listen(node, event, handler, options) { node.addEventListener(event, handler, options); return () => node.removeEventListener(event, handler, options); } function attr(node, attribute, value) { if (value == null) node.removeAttribute(attribute); else if (node.getAttribute(attribute) !== value) node.setAttribute(attribute, value); } function set_attributes(node, attributes) { // @ts-ignore const descriptors = Object.getOwnPropertyDescriptors(node.__proto__); for (const key in attributes) { if (attributes[key] == null) { node.removeAttribute(key); } else if (key === 'style') { node.style.cssText = attributes[key]; } else if (key === '__value') { node.value = node[key] = attributes[key]; } else if (descriptors[key] && descriptors[key].set) { node[key] = attributes[key]; } else { attr(node, key, attributes[key]); } } } function children(element) { return Array.from(element.childNodes); } function set_data(text, data) { data = '' + data; if (text.wholeText !== data) text.data = data; } function set_style(node, key, value, important) { node.style.setProperty(key, value, important ? 'important' : ''); } function toggle_class(element, name, toggle) { element.classList[toggle ? 'add' : 'remove'](name); } function custom_event(type, detail) { const e = document.createEvent('CustomEvent'); e.initCustomEvent(type, false, false, detail); return e; } let current_component; function set_current_component(component) { current_component = component; } function get_current_component() { if (!current_component) throw new Error('Function called outside component initialization'); return current_component; } function onDestroy(fn) { get_current_component().$$.on_destroy.push(fn); } function createEventDispatcher() { const component = get_current_component(); return (type, detail) => { const callbacks = component.$$.callbacks[type]; if (callbacks) { // TODO are there situations where events could be dispatched // in a server (non-DOM) environment? const event = custom_event(type, detail); callbacks.slice().forEach(fn => { fn.call(component, event); }); } }; } function setContext(key, context) { get_current_component().$$.context.set(key, context); } function getContext(key) { return get_current_component().$$.context.get(key); } // TODO figure out if we still want to support // shorthand events, or if we want to implement // a real bubbling mechanism function bubble(component, event) { const callbacks = component.$$.callbacks[event.type]; if (callbacks) { callbacks.slice().forEach(fn => fn(event)); } } const dirty_components = []; const binding_callbacks = []; const render_callbacks = []; const flush_callbacks = []; const resolved_promise = Promise.resolve(); let update_scheduled = false; function schedule_update() { if (!update_scheduled) { update_scheduled = true; resolved_promise.then(flush); } } function tick() { schedule_update(); return resolved_promise; } function add_render_callback(fn) { render_callbacks.push(fn); } function add_flush_callback(fn) { flush_callbacks.push(fn); } let flushing = false; const seen_callbacks = new Set(); function flush() { if (flushing) return; flushing = true; do { // first, call beforeUpdate functions // and update components for (let i = 0; i < dirty_components.length; i += 1) { const component = dirty_components[i]; set_current_component(component); update(component.$$); } set_current_component(null); dirty_components.length = 0; while (binding_callbacks.length) binding_callbacks.pop()(); // then, once components are updated, call // afterUpdate functions. This may cause // subsequent updates... for (let i = 0; i < render_callbacks.length; i += 1) { const callback = render_callbacks[i]; if (!seen_callbacks.has(callback)) { // ...so guard against infinite loops seen_callbacks.add(callback); callback(); } } render_callbacks.length = 0; } while (dirty_components.length); while (flush_callbacks.length) { flush_callbacks.pop()(); } update_scheduled = false; flushing = false; seen_callbacks.clear(); } function update($$) { if ($$.fragment !== null) { $$.update(); run_all($$.before_update); const dirty = $$.dirty; $$.dirty = [-1]; $$.fragment && $$.fragment.p($$.ctx, dirty); $$.after_update.forEach(add_render_callback); } } const outroing = new Set(); let outros; function group_outros() { outros = { r: 0, c: [], p: outros // parent group }; } function check_outros() { if (!outros.r) { run_all(outros.c); } outros = outros.p; } function transition_in(block, local) { if (block && block.i) { outroing.delete(block); block.i(local); } } function transition_out(block, local, detach, callback) { if (block && block.o) { if (outroing.has(block)) return; outroing.add(block); outros.c.push(() => { outroing.delete(block); if (callback) { if (detach) block.d(1); callback(); } }); block.o(local); } } function handle_promise(promise, info) { const token = info.token = {}; function update(type, index, key, value) { if (info.token !== token) return; info.resolved = value; let child_ctx = info.ctx; if (key !== undefined) { child_ctx = child_ctx.slice(); child_ctx[key] = value; } const block = type && (info.current = type)(child_ctx); let needs_flush = false; if (info.block) { if (info.blocks) { info.blocks.forEach((block, i) => { if (i !== index && block) { group_outros(); transition_out(block, 1, 1, () => { if (info.blocks[i] === block) { info.blocks[i] = null; } }); check_outros(); } }); } else { info.block.d(1); } block.c(); transition_in(block, 1); block.m(info.mount(), info.anchor); needs_flush = true; } info.block = block; if (info.blocks) info.blocks[index] = block; if (needs_flush) { flush(); } } if (is_promise(promise)) { const current_component = get_current_component(); promise.then(value => { set_current_component(current_component); update(info.then, 1, info.value, value); set_current_component(null); }, error => { set_current_component(current_component); update(info.catch, 2, info.error, error); set_current_component(null); if (!info.hasCatch) { throw error; } }); // if we previously had a then/catch block, destroy it if (info.current !== info.pending) { update(info.pending, 0); return true; } } else { if (info.current !== info.then) { update(info.then, 1, info.value, promise); return true; } info.resolved = promise; } } function outro_and_destroy_block(block, lookup) { transition_out(block, 1, 1, () => { lookup.delete(block.key); }); } function update_keyed_each(old_blocks, dirty, get_key, dynamic, ctx, list, lookup, node, destroy, create_each_block, next, get_context) { let o = old_blocks.length; let n = list.length; let i = o; const old_indexes = {}; while (i--) old_indexes[old_blocks[i].key] = i; const new_blocks = []; const new_lookup = new Map(); const deltas = new Map(); i = n; while (i--) { const child_ctx = get_context(ctx, list, i); const key = get_key(child_ctx); let block = lookup.get(key); if (!block) { block = create_each_block(key, child_ctx); block.c(); } else if (dynamic) { block.p(child_ctx, dirty); } new_lookup.set(key, new_blocks[i] = block); if (key in old_indexes) deltas.set(key, Math.abs(i - old_indexes[key])); } const will_move = new Set(); const did_move = new Set(); function insert(block) { transition_in(block, 1); block.m(node, next); lookup.set(block.key, block); next = block.first; n--; } while (o && n) { const new_block = new_blocks[n - 1]; const old_block = old_blocks[o - 1]; const new_key = new_block.key; const old_key = old_block.key; if (new_block === old_block) { // do nothing next = new_block.first; o--; n--; } else if (!new_lookup.has(old_key)) { // remove old block destroy(old_block, lookup); o--; } else if (!lookup.has(new_key) || will_move.has(new_key)) { insert(new_block); } else if (did_move.has(old_key)) { o--; } else if (deltas.get(new_key) > deltas.get(old_key)) { did_move.add(new_key); insert(new_block); } else { will_move.add(old_key); o--; } } while (o--) { const old_block = old_blocks[o]; if (!new_lookup.has(old_block.key)) destroy(old_block, lookup); } while (n) insert(new_blocks[n - 1]); return new_blocks; } function get_spread_update(levels, updates) { const update = {}; const to_null_out = {}; const accounted_for = { $$scope: 1 }; let i = levels.length; while (i--) { const o = levels[i]; const n = updates[i]; if (n) { for (const key in o) { if (!(key in n)) to_null_out[key] = 1; } for (const key in n) { if (!accounted_for[key]) { update[key] = n[key]; accounted_for[key] = 1; } } levels[i] = n; } else { for (const key in o) { accounted_for[key] = 1; } } } for (const key in to_null_out) { if (!(key in update)) update[key] = undefined; } return update; } function get_spread_object(spread_props) { return typeof spread_props === 'object' && spread_props !== null ? spread_props : {}; } function bind(component, name, callback) { const index = component.$$.props[name]; if (index !== undefined) { component.$$.bound[index] = callback; callback(component.$$.ctx[index]); } } function create_component(block) { block && block.c(); } function mount_component(component, target, anchor, customElement) { const { fragment, on_mount, on_destroy, after_update } = component.$$; fragment && fragment.m(target, anchor); if (!customElement) { // onMount happens before the initial afterUpdate add_render_callback(() => { const new_on_destroy = on_mount.map(run).filter(is_function); if (on_destroy) { on_destroy.push(...new_on_destroy); } else { // Edge case - component was destroyed immediately, // most likely as a result of a binding initialising run_all(new_on_destroy); } component.$$.on_mount = []; }); } after_update.forEach(add_render_callback); } function destroy_component(component, detaching) { const $$ = component.$$; if ($$.fragment !== null) { run_all($$.on_destroy); $$.fragment && $$.fragment.d(detaching); // TODO null out other refs, including component.$$ (but need to // preserve final state?) $$.on_destroy = $$.fragment = null; $$.ctx = []; } } function make_dirty(component, i) { if (component.$$.dirty[0] === -1) { dirty_components.push(component); schedule_update(); component.$$.dirty.fill(0); } component.$$.dirty[(i / 31) | 0] |= (1 << (i % 31)); } function init(component, options, instance, create_fragment, not_equal, props, dirty = [-1]) { const parent_component = current_component; set_current_component(component); const $$ = component.$$ = { fragment: null, ctx: null, // state props, update: noop, not_equal, bound: blank_object(), // lifecycle on_mount: [], on_destroy: [], on_disconnect: [], before_update: [], after_update: [], context: new Map(parent_component ? parent_component.$$.context : options.context || []), // everything else callbacks: blank_object(), dirty, skip_bound: false }; let ready = false; $$.ctx = instance ? instance(component, options.props || {}, (i, ret, ...rest) => { const value = rest.length ? rest[0] : ret; if ($$.ctx && not_equal($$.ctx[i], $$.ctx[i] = value)) { if (!$$.skip_bound && $$.bound[i]) $$.bound[i](value); if (ready) make_dirty(component, i); } return ret; }) : []; $$.update(); ready = true; run_all($$.before_update); // `false` as a special case of no DOM component $$.fragment = create_fragment ? create_fragment($$.ctx) : false; if (options.target) { if (options.hydrate) { const nodes = children(options.target); // eslint-disable-next-line @typescript-eslint/no-non-null-assertion $$.fragment && $$.fragment.l(nodes); nodes.forEach(detach); } else { // eslint-disable-next-line @typescript-eslint/no-non-null-assertion $$.fragment && $$.fragment.c(); } if (options.intro) transition_in(component.$$.fragment); mount_component(component, options.target, options.anchor, options.customElement); flush(); } set_current_component(parent_component); } /** * Base class for Svelte components. Used when dev=false. */ class SvelteComponent { $destroy() { destroy_component(this, 1); this.$destroy = noop; } $on(type, callback) { const callbacks = (this.$$.callbacks[type] || (this.$$.callbacks[type] = [])); callbacks.push(callback); return () => { const index = callbacks.indexOf(callback); if (index !== -1) callbacks.splice(index, 1); }; } $set($$props) { if (this.$$set && !is_empty($$props)) { this.$$.skip_bound = true; this.$$set($$props); this.$$.skip_bound = false; } } } const subscriber_queue = []; /** * Create a `Writable` store that allows both updating and reading by subscription. * @param {*=}value initial value * @param {StartStopNotifier=}start start and stop notifications for subscriptions */ function writable(value, start = noop) { let stop; const subscribers = []; function set(new_value) { if (safe_not_equal(value, new_value)) { value = new_value; if (stop) { // store is ready const run_queue = !subscriber_queue.length; for (let i = 0; i < subscribers.length; i += 1) { const s = subscribers[i]; s[1](); subscriber_queue.push(s, value); } if (run_queue) { for (let i = 0; i < subscriber_queue.length; i += 2) { subscriber_queue[i][0](subscriber_queue[i + 1]); } subscriber_queue.length = 0; } } } } function update(fn) { set(fn(value)); } function subscribe(run, invalidate = noop) { const subscriber = [run, invalidate]; subscribers.push(subscriber); if (subscribers.length === 1) { stop = start(set) || noop; } run(value); return () => { const index = subscribers.indexOf(subscriber); if (index !== -1) { subscribers.splice(index, 1); } if (subscribers.length === 0) { stop(); stop = null; } }; } return { set, update, subscribe }; } const IS_MOBILE = Symbol("isMobile"); const DISPLAYED_MONTH = Symbol("displayedMonth"); /* node_modules/svelte-portal/src/Portal.svelte generated by Svelte v3.37.0 */ function create_fragment$d(ctx) { let div; let portal_action; let current; let mounted; let dispose; const default_slot_template = /*#slots*/ ctx[2].default; const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[1], null); return { c() { div = element("div"); if (default_slot) default_slot.c(); div.hidden = true; }, m(target, anchor) { insert(target, div, anchor); if (default_slot) { default_slot.m(div, null); } current = true; if (!mounted) { dispose = action_destroyer(portal_action = portal.call(null, div, /*target*/ ctx[0])); mounted = true; } }, p(ctx, [dirty]) { if (default_slot) { if (default_slot.p && dirty & /*$$scope*/ 2) { update_slot(default_slot, default_slot_template, ctx, /*$$scope*/ ctx[1], dirty, null, null); } } if (portal_action && is_function(portal_action.update) && dirty & /*target*/ 1) portal_action.update.call(null, /*target*/ ctx[0]); }, i(local) { if (current) return; transition_in(default_slot, local); current = true; }, o(local) { transition_out(default_slot, local); current = false; }, d(detaching) { if (detaching) detach(div); if (default_slot) default_slot.d(detaching); mounted = false; dispose(); } }; } function portal(el, target = "body") { let targetEl; async function update(newTarget) { target = newTarget; if (typeof target === "string") { targetEl = document.querySelector(target); if (targetEl === null) { await tick(); targetEl = document.querySelector(target); } if (targetEl === null) { throw new Error(`No element found matching css selector: "${target}"`); } } else if (target instanceof HTMLElement) { targetEl = target; } else { throw new TypeError(`Unknown portal target type: ${target === null ? "null" : typeof target}. Allowed types: string (CSS selector) or HTMLElement.`); } targetEl.appendChild(el); el.hidden = false; } function destroy() { if (el.parentNode) { el.parentNode.removeChild(el); } } update(target); return { update, destroy }; } function instance$d($$self, $$props, $$invalidate) { let { $$slots: slots = {}, $$scope } = $$props; let { target = "body" } = $$props; $$self.$$set = $$props => { if ("target" in $$props) $$invalidate(0, target = $$props.target); if ("$$scope" in $$props) $$invalidate(1, $$scope = $$props.$$scope); }; return [target, $$scope, slots]; } class Portal extends SvelteComponent { constructor(options) { super(); init(this, options, instance$d, create_fragment$d, safe_not_equal, { target: 0 }); } } /* src/components/popover/Box.svelte generated by Svelte v3.37.0 */ function add_css$9() { var style = element("style"); style.id = "svelte-evqoh3-style"; style.textContent = ".container.svelte-evqoh3.svelte-evqoh3{background-color:var(--background-primary);border-radius:4px;box-shadow:0 4px 12px 0 rgba(0, 0, 0, 0.25);color:var(--text-normal);display:flex;flex-direction:column;padding:24px}.is-mobile .container.svelte-evqoh3.svelte-evqoh3{box-shadow:unset;padding:0}.overflow-items.svelte-evqoh3.svelte-evqoh3{align-items:center;display:grid;grid-row-gap:8px;grid-template-columns:auto auto minmax(160px, 2fr)}.showcase.svelte-evqoh3.svelte-evqoh3{display:grid;gap:12px;grid-template-columns:minmax(0, 1fr) minmax(0, 1fr);margin-bottom:12px}.showcase-item.svelte-evqoh3.svelte-evqoh3{display:flex;flex-direction:column;justify-content:space-between;letter-spacing:0.8px;text-align:right}.showcase.svelte-evqoh3 .item-value.svelte-evqoh3{font-size:32px;margin-bottom:4px;width:100%}.showcase.svelte-evqoh3 .item-name.svelte-evqoh3{align-items:center;color:var(--text-muted);display:flex;font-size:14px;font-weight:700;justify-content:flex-end;text-transform:uppercase}.item-value.svelte-evqoh3.svelte-evqoh3{font-size:20px;font-weight:500}.item-name.svelte-evqoh3.svelte-evqoh3{color:var(--text-muted)}.overflow-item.svelte-evqoh3.svelte-evqoh3{display:contents;padding:8px}.goal.svelte-evqoh3.svelte-evqoh3{font-size:50%;opacity:0.6;letter-spacing:1px}.overflow-item.svelte-evqoh3 .item-value.svelte-evqoh3{margin-right:8px}.showcase-dot.svelte-evqoh3.svelte-evqoh3,.dot.svelte-evqoh3.svelte-evqoh3{flex-shrink:0;margin-right:6px;height:8px;width:8px}.showcase-dot.svelte-evqoh3.svelte-evqoh3{height:10px;width:10px}.empty.svelte-evqoh3 .item-value.svelte-evqoh3,.empty.svelte-evqoh3 .dot.svelte-evqoh3,.empty.svelte-evqoh3 .item-name.svelte-evqoh3{color:var(--text-faint)}"; append(document.head, style); } function get_each_context$2$1(ctx, list, i) { const child_ctx = ctx.slice(); child_ctx[3] = list[i]; return child_ctx; } function get_each_context_1$2(ctx, list, i) { const child_ctx = ctx.slice(); child_ctx[6] = list[i]; return child_ctx; } // (17:13) {#if showcaseItem.goal} function create_if_block$5(ctx) { let span; let t0; let t1_value = /*showcaseItem*/ ctx[6].goal + ""; let t1; return { c() { span = element("span"); t0 = text("/"); t1 = text(t1_value); attr(span, "class", "goal svelte-evqoh3"); }, m(target, anchor) { insert(target, span, anchor); append(span, t0); append(span, t1); }, p(ctx, dirty) { if (dirty & /*showcaseItems*/ 1 && t1_value !== (t1_value = /*showcaseItem*/ ctx[6].goal + "")) set_data(t1, t1_value); }, d(detaching) { if (detaching) detach(span); } }; } // (13:4) {#each showcaseItems as showcaseItem} function create_each_block_1$2(ctx) { let div2; let div0; let t0_value = /*showcaseItem*/ ctx[6].value + ""; let t0; let t1; let div1; let svg; let circle; let circle_fill_value; let t2; let t3_value = /*showcaseItem*/ ctx[6].name + ""; let t3; let t4; let if_block = /*showcaseItem*/ ctx[6].goal && create_if_block$5(ctx); return { c() { div2 = element("div"); div0 = element("div"); t0 = text(t0_value); if (if_block) if_block.c(); t1 = space(); div1 = element("div"); svg = svg_element("svg"); circle = svg_element("circle"); t2 = space(); t3 = text(t3_value); t4 = space(); attr(div0, "class", "item-value svelte-evqoh3"); attr(circle, "fill", circle_fill_value = /*showcaseItem*/ ctx[6].color); attr(circle, "cx", "3"); attr(circle, "cy", "3"); attr(circle, "r", "2"); attr(svg, "class", "showcase-dot svelte-evqoh3"); attr(svg, "viewBox", "0 0 6 6"); attr(svg, "xmlns", "http://www.w3.org/2000/svg"); attr(div1, "class", "item-name svelte-evqoh3"); attr(div2, "class", "showcase-item svelte-evqoh3"); }, m(target, anchor) { insert(target, div2, anchor); append(div2, div0); append(div0, t0); if (if_block) if_block.m(div0, null); append(div2, t1); append(div2, div1); append(div1, svg); append(svg, circle); append(div1, t2); append(div1, t3); append(div2, t4); }, p(ctx, dirty) { if (dirty & /*showcaseItems*/ 1 && t0_value !== (t0_value = /*showcaseItem*/ ctx[6].value + "")) set_data(t0, t0_value); if (/*showcaseItem*/ ctx[6].goal) { if (if_block) { if_block.p(ctx, dirty); } else { if_block = create_if_block$5(ctx); if_block.c(); if_block.m(div0, null); } } else if (if_block) { if_block.d(1); if_block = null; } if (dirty & /*showcaseItems*/ 1 && circle_fill_value !== (circle_fill_value = /*showcaseItem*/ ctx[6].color)) { attr(circle, "fill", circle_fill_value); } if (dirty & /*showcaseItems*/ 1 && t3_value !== (t3_value = /*showcaseItem*/ ctx[6].name + "")) set_data(t3, t3_value); }, d(detaching) { if (detaching) detach(div2); if (if_block) if_block.d(); } }; } // (35:4) {#each overflowItems as overflowItem} function create_each_block$2$1(ctx) { let div2; let div0; let t0_value = /*overflowItem*/ ctx[3].value + ""; let t0; let t1; let svg; let circle; let circle_fill_value; let t2; let div1; let t3_value = /*overflowItem*/ ctx[3].name + ""; let t3; let t4; return { c() { div2 = element("div"); div0 = element("div"); t0 = text(t0_value); t1 = space(); svg = svg_element("svg"); circle = svg_element("circle"); t2 = space(); div1 = element("div"); t3 = text(t3_value); t4 = space(); attr(div0, "class", "item-value svelte-evqoh3"); attr(circle, "fill", circle_fill_value = /*overflowItem*/ ctx[3].value ? /*overflowItem*/ ctx[3].color : "currentColor"); attr(circle, "cx", "3"); attr(circle, "cy", "3"); attr(circle, "r", "2"); attr(svg, "class", "dot svelte-evqoh3"); attr(svg, "viewBox", "0 0 6 6"); attr(svg, "xmlns", "http://www.w3.org/2000/svg"); attr(div1, "class", "item-name svelte-evqoh3"); attr(div2, "class", "overflow-item svelte-evqoh3"); toggle_class(div2, "empty", !/*overflowItem*/ ctx[3].value); }, m(target, anchor) { insert(target, div2, anchor); append(div2, div0); append(div0, t0); append(div2, t1); append(div2, svg); append(svg, circle); append(div2, t2); append(div2, div1); append(div1, t3); append(div2, t4); }, p(ctx, dirty) { if (dirty & /*overflowItems*/ 2 && t0_value !== (t0_value = /*overflowItem*/ ctx[3].value + "")) set_data(t0, t0_value); if (dirty & /*overflowItems*/ 2 && circle_fill_value !== (circle_fill_value = /*overflowItem*/ ctx[3].value ? /*overflowItem*/ ctx[3].color : "currentColor")) { attr(circle, "fill", circle_fill_value); } if (dirty & /*overflowItems*/ 2 && t3_value !== (t3_value = /*overflowItem*/ ctx[3].name + "")) set_data(t3, t3_value); if (dirty & /*overflowItems*/ 2) { toggle_class(div2, "empty", !/*overflowItem*/ ctx[3].value); } }, d(detaching) { if (detaching) detach(div2); } }; } function create_fragment$c(ctx) { let div2; let div0; let t; let div1; let each_value_1 = /*showcaseItems*/ ctx[0]; let each_blocks_1 = []; for (let i = 0; i < each_value_1.length; i += 1) { each_blocks_1[i] = create_each_block_1$2(get_each_context_1$2(ctx, each_value_1, i)); } let each_value = /*overflowItems*/ ctx[1]; let each_blocks = []; for (let i = 0; i < each_value.length; i += 1) { each_blocks[i] = create_each_block$2$1(get_each_context$2$1(ctx, each_value, i)); } return { c() { div2 = element("div"); div0 = element("div"); for (let i = 0; i < each_blocks_1.length; i += 1) { each_blocks_1[i].c(); } t = space(); div1 = element("div"); for (let i = 0; i < each_blocks.length; i += 1) { each_blocks[i].c(); } attr(div0, "class", "showcase svelte-evqoh3"); attr(div1, "class", "overflow-items svelte-evqoh3"); attr(div2, "class", "container svelte-evqoh3"); }, m(target, anchor) { insert(target, div2, anchor); append(div2, div0); for (let i = 0; i < each_blocks_1.length; i += 1) { each_blocks_1[i].m(div0, null); } append(div2, t); append(div2, div1); for (let i = 0; i < each_blocks.length; i += 1) { each_blocks[i].m(div1, null); } }, p(ctx, [dirty]) { if (dirty & /*showcaseItems*/ 1) { each_value_1 = /*showcaseItems*/ ctx[0]; let i; for (i = 0; i < each_value_1.length; i += 1) { const child_ctx = get_each_context_1$2(ctx, each_value_1, i); if (each_blocks_1[i]) { each_blocks_1[i].p(child_ctx, dirty); } else { each_blocks_1[i] = create_each_block_1$2(child_ctx); each_blocks_1[i].c(); each_blocks_1[i].m(div0, null); } } for (; i < each_blocks_1.length; i += 1) { each_blocks_1[i].d(1); } each_blocks_1.length = each_value_1.length; } if (dirty & /*overflowItems*/ 2) { each_value = /*overflowItems*/ ctx[1]; let i; for (i = 0; i < each_value.length; i += 1) { const child_ctx = get_each_context$2$1(ctx, each_value, i); if (each_blocks[i]) { each_blocks[i].p(child_ctx, dirty); } else { each_blocks[i] = create_each_block$2$1(child_ctx); each_blocks[i].c(); each_blocks[i].m(div1, null); } } for (; i < each_blocks.length; i += 1) { each_blocks[i].d(1); } each_blocks.length = each_value.length; } }, i: noop, o: noop, d(detaching) { if (detaching) detach(div2); destroy_each(each_blocks_1, detaching); destroy_each(each_blocks, detaching); } }; } function instance$c($$self, $$props, $$invalidate) { let { menuItems } = $$props; let showcaseItems; let overflowItems; $$self.$$set = $$props => { if ("menuItems" in $$props) $$invalidate(2, menuItems = $$props.menuItems); }; $$self.$$.update = () => { if ($$self.$$.dirty & /*menuItems*/ 4) { { $$invalidate(0, showcaseItems = (menuItems || []).slice(0, 2)); $$invalidate(1, overflowItems = (menuItems || []).slice(2)); } } }; return [showcaseItems, overflowItems, menuItems]; } class Box extends SvelteComponent { constructor(options) { super(); if (!document.getElementById("svelte-evqoh3-style")) add_css$9(); init(this, options, instance$c, create_fragment$c, safe_not_equal, { menuItems: 2 }); } } var top$1 = 'top'; var bottom$1 = 'bottom'; var right$1 = 'right'; var left$1 = 'left'; var auto$1 = 'auto'; var basePlacements$1 = [top$1, bottom$1, right$1, left$1]; var start$1 = 'start'; var end$1 = 'end'; var clippingParents$1 = 'clippingParents'; var viewport$1 = 'viewport'; var popper$1 = 'popper'; var reference$1 = 'reference'; var variationPlacements$1 = /*#__PURE__*/basePlacements$1.reduce(function (acc, placement) { return acc.concat([placement + "-" + start$1, placement + "-" + end$1]); }, []); var placements$1 = /*#__PURE__*/[].concat(basePlacements$1, [auto$1]).reduce(function (acc, placement) { return acc.concat([placement, placement + "-" + start$1, placement + "-" + end$1]); }, []); // modifiers that need to read the DOM var beforeRead$1 = 'beforeRead'; var read$1 = 'read'; var afterRead$1 = 'afterRead'; // pure-logic modifiers var beforeMain$1 = 'beforeMain'; var main$1 = 'main'; var afterMain$1 = 'afterMain'; // modifier with the purpose to write to the DOM (or write into a framework state) var beforeWrite$1 = 'beforeWrite'; var write$1 = 'write'; var afterWrite$1 = 'afterWrite'; var modifierPhases$1 = [beforeRead$1, read$1, afterRead$1, beforeMain$1, main$1, afterMain$1, beforeWrite$1, write$1, afterWrite$1]; function getNodeName$1(element) { return element ? (element.nodeName || '').toLowerCase() : null; } function getWindow$1(node) { if (node == null) { return window; } if (node.toString() !== '[object Window]') { var ownerDocument = node.ownerDocument; return ownerDocument ? ownerDocument.defaultView || window : window; } return node; } function isElement$1(node) { var OwnElement = getWindow$1(node).Element; return node instanceof OwnElement || node instanceof Element; } function isHTMLElement$1(node) { var OwnElement = getWindow$1(node).HTMLElement; return node instanceof OwnElement || node instanceof HTMLElement; } function isShadowRoot$1(node) { // IE 11 has no ShadowRoot if (typeof ShadowRoot === 'undefined') { return false; } var OwnElement = getWindow$1(node).ShadowRoot; return node instanceof OwnElement || node instanceof ShadowRoot; } // and applies them to the HTMLElements such as popper and arrow function applyStyles$2(_ref) { var state = _ref.state; Object.keys(state.elements).forEach(function (name) { var style = state.styles[name] || {}; var attributes = state.attributes[name] || {}; var element = state.elements[name]; // arrow is optional + virtual elements if (!isHTMLElement$1(element) || !getNodeName$1(element)) { return; } // Flow doesn't support to extend this property, but it's the most // effective way to apply styles to an HTMLElement // $FlowFixMe[cannot-write] Object.assign(element.style, style); Object.keys(attributes).forEach(function (name) { var value = attributes[name]; if (value === false) { element.removeAttribute(name); } else { element.setAttribute(name, value === true ? '' : value); } }); }); } function effect$2$1(_ref2) { var state = _ref2.state; var initialStyles = { popper: { position: state.options.strategy, left: '0', top: '0', margin: '0' }, arrow: { position: 'absolute' }, reference: {} }; Object.assign(state.elements.popper.style, initialStyles.popper); state.styles = initialStyles; if (state.elements.arrow) { Object.assign(state.elements.arrow.style, initialStyles.arrow); } return function () { Object.keys(state.elements).forEach(function (name) { var element = state.elements[name]; var attributes = state.attributes[name] || {}; var styleProperties = Object.keys(state.styles.hasOwnProperty(name) ? state.styles[name] : initialStyles[name]); // Set all values to an empty string to unset them var style = styleProperties.reduce(function (style, property) { style[property] = ''; return style; }, {}); // arrow is optional + virtual elements if (!isHTMLElement$1(element) || !getNodeName$1(element)) { return; } Object.assign(element.style, style); Object.keys(attributes).forEach(function (attribute) { element.removeAttribute(attribute); }); }); }; } // eslint-disable-next-line import/no-unused-modules var applyStyles$1$1 = { name: 'applyStyles', enabled: true, phase: 'write', fn: applyStyles$2, effect: effect$2$1, requires: ['computeStyles'] }; function getBasePlacement$1(placement) { return placement.split('-')[0]; } function getBoundingClientRect$1(element) { var rect = element.getBoundingClientRect(); return { width: rect.width, height: rect.height, top: rect.top, right: rect.right, bottom: rect.bottom, left: rect.left, x: rect.left, y: rect.top }; } // means it doesn't take into account transforms. function getLayoutRect$1(element) { var clientRect = getBoundingClientRect$1(element); // Use the clientRect sizes if it's not been transformed. // Fixes https://github.com/popperjs/popper-core/issues/1223 var width = element.offsetWidth; var height = element.offsetHeight; if (Math.abs(clientRect.width - width) <= 1) { width = clientRect.width; } if (Math.abs(clientRect.height - height) <= 1) { height = clientRect.height; } return { x: element.offsetLeft, y: element.offsetTop, width: width, height: height }; } function contains$1(parent, child) { var rootNode = child.getRootNode && child.getRootNode(); // First, attempt with faster native method if (parent.contains(child)) { return true; } // then fallback to custom implementation with Shadow DOM support else if (rootNode && isShadowRoot$1(rootNode)) { var next = child; do { if (next && parent.isSameNode(next)) { return true; } // $FlowFixMe[prop-missing]: need a better way to handle this... next = next.parentNode || next.host; } while (next); } // Give up, the result is false return false; } function getComputedStyle$2(element) { return getWindow$1(element).getComputedStyle(element); } function isTableElement$1(element) { return ['table', 'td', 'th'].indexOf(getNodeName$1(element)) >= 0; } function getDocumentElement$1(element) { // $FlowFixMe[incompatible-return]: assume body is always available return ((isElement$1(element) ? element.ownerDocument : // $FlowFixMe[prop-missing] element.document) || window.document).documentElement; } function getParentNode$1(element) { if (getNodeName$1(element) === 'html') { return element; } return (// this is a quicker (but less type safe) way to save quite some bytes from the bundle // $FlowFixMe[incompatible-return] // $FlowFixMe[prop-missing] element.assignedSlot || // step into the shadow DOM of the parent of a slotted node element.parentNode || ( // DOM Element detected isShadowRoot$1(element) ? element.host : null) || // ShadowRoot detected // $FlowFixMe[incompatible-call]: HTMLElement is a Node getDocumentElement$1(element) // fallback ); } function getTrueOffsetParent$1(element) { if (!isHTMLElement$1(element) || // https://github.com/popperjs/popper-core/issues/837 getComputedStyle$2(element).position === 'fixed') { return null; } return element.offsetParent; } // `.offsetParent` reports `null` for fixed elements, while absolute elements // return the containing block function getContainingBlock$1(element) { var isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') !== -1; var isIE = navigator.userAgent.indexOf('Trident') !== -1; if (isIE && isHTMLElement$1(element)) { // In IE 9, 10 and 11 fixed elements containing block is always established by the viewport var elementCss = getComputedStyle$2(element); if (elementCss.position === 'fixed') { return null; } } var currentNode = getParentNode$1(element); while (isHTMLElement$1(currentNode) && ['html', 'body'].indexOf(getNodeName$1(currentNode)) < 0) { var css = getComputedStyle$2(currentNode); // This is non-exhaustive but covers the most common CSS properties that // create a containing block. // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block if (css.transform !== 'none' || css.perspective !== 'none' || css.contain === 'paint' || ['transform', 'perspective'].indexOf(css.willChange) !== -1 || isFirefox && css.willChange === 'filter' || isFirefox && css.filter && css.filter !== 'none') { return currentNode; } else { currentNode = currentNode.parentNode; } } return null; } // Gets the closest ancestor positioned element. Handles some edge cases, // such as table ancestors and cross browser bugs. function getOffsetParent$1(element) { var window = getWindow$1(element); var offsetParent = getTrueOffsetParent$1(element); while (offsetParent && isTableElement$1(offsetParent) && getComputedStyle$2(offsetParent).position === 'static') { offsetParent = getTrueOffsetParent$1(offsetParent); } if (offsetParent && (getNodeName$1(offsetParent) === 'html' || getNodeName$1(offsetParent) === 'body' && getComputedStyle$2(offsetParent).position === 'static')) { return window; } return offsetParent || getContainingBlock$1(element) || window; } function getMainAxisFromPlacement$1(placement) { return ['top', 'bottom'].indexOf(placement) >= 0 ? 'x' : 'y'; } var max$1 = Math.max; var min$1 = Math.min; var round$1 = Math.round; function within$1(min$1$1, value, max$1$1) { return max$1(min$1$1, min$1(value, max$1$1)); } function getFreshSideObject$1() { return { top: 0, right: 0, bottom: 0, left: 0 }; } function mergePaddingObject$1(paddingObject) { return Object.assign({}, getFreshSideObject$1(), paddingObject); } function expandToHashMap$1(value, keys) { return keys.reduce(function (hashMap, key) { hashMap[key] = value; return hashMap; }, {}); } var toPaddingObject$1 = function toPaddingObject(padding, state) { padding = typeof padding === 'function' ? padding(Object.assign({}, state.rects, { placement: state.placement })) : padding; return mergePaddingObject$1(typeof padding !== 'number' ? padding : expandToHashMap$1(padding, basePlacements$1)); }; function arrow$2(_ref) { var _state$modifiersData$; var state = _ref.state, name = _ref.name, options = _ref.options; var arrowElement = state.elements.arrow; var popperOffsets = state.modifiersData.popperOffsets; var basePlacement = getBasePlacement$1(state.placement); var axis = getMainAxisFromPlacement$1(basePlacement); var isVertical = [left$1, right$1].indexOf(basePlacement) >= 0; var len = isVertical ? 'height' : 'width'; if (!arrowElement || !popperOffsets) { return; } var paddingObject = toPaddingObject$1(options.padding, state); var arrowRect = getLayoutRect$1(arrowElement); var minProp = axis === 'y' ? top$1 : left$1; var maxProp = axis === 'y' ? bottom$1 : right$1; var endDiff = state.rects.reference[len] + state.rects.reference[axis] - popperOffsets[axis] - state.rects.popper[len]; var startDiff = popperOffsets[axis] - state.rects.reference[axis]; var arrowOffsetParent = getOffsetParent$1(arrowElement); var clientSize = arrowOffsetParent ? axis === 'y' ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0; var centerToReference = endDiff / 2 - startDiff / 2; // Make sure the arrow doesn't overflow the popper if the center point is // outside of the popper bounds var min = paddingObject[minProp]; var max = clientSize - arrowRect[len] - paddingObject[maxProp]; var center = clientSize / 2 - arrowRect[len] / 2 + centerToReference; var offset = within$1(min, center, max); // Prevents breaking syntax highlighting... var axisProp = axis; state.modifiersData[name] = (_state$modifiersData$ = {}, _state$modifiersData$[axisProp] = offset, _state$modifiersData$.centerOffset = offset - center, _state$modifiersData$); } function effect$1$1(_ref2) { var state = _ref2.state, options = _ref2.options; var _options$element = options.element, arrowElement = _options$element === void 0 ? '[data-popper-arrow]' : _options$element; if (arrowElement == null) { return; } // CSS selector if (typeof arrowElement === 'string') { arrowElement = state.elements.popper.querySelector(arrowElement); if (!arrowElement) { return; } } if (process.env.NODE_ENV !== "production") { if (!isHTMLElement$1(arrowElement)) { console.error(['Popper: "arrow" element must be an HTMLElement (not an SVGElement).', 'To use an SVG arrow, wrap it in an HTMLElement that will be used as', 'the arrow.'].join(' ')); } } if (!contains$1(state.elements.popper, arrowElement)) { if (process.env.NODE_ENV !== "production") { console.error(['Popper: "arrow" modifier\'s `element` must be a child of the popper', 'element.'].join(' ')); } return; } state.elements.arrow = arrowElement; } // eslint-disable-next-line import/no-unused-modules var arrow$1$1 = { name: 'arrow', enabled: true, phase: 'main', fn: arrow$2, effect: effect$1$1, requires: ['popperOffsets'], requiresIfExists: ['preventOverflow'] }; var unsetSides$1 = { top: 'auto', right: 'auto', bottom: 'auto', left: 'auto' }; // Round the offsets to the nearest suitable subpixel based on the DPR. // Zooming can change the DPR, but it seems to report a value that will // cleanly divide the values into the appropriate subpixels. function roundOffsetsByDPR$1(_ref) { var x = _ref.x, y = _ref.y; var win = window; var dpr = win.devicePixelRatio || 1; return { x: round$1(round$1(x * dpr) / dpr) || 0, y: round$1(round$1(y * dpr) / dpr) || 0 }; } function mapToStyles$1(_ref2) { var _Object$assign2; var popper = _ref2.popper, popperRect = _ref2.popperRect, placement = _ref2.placement, offsets = _ref2.offsets, position = _ref2.position, gpuAcceleration = _ref2.gpuAcceleration, adaptive = _ref2.adaptive, roundOffsets = _ref2.roundOffsets; var _ref3 = roundOffsets === true ? roundOffsetsByDPR$1(offsets) : typeof roundOffsets === 'function' ? roundOffsets(offsets) : offsets, _ref3$x = _ref3.x, x = _ref3$x === void 0 ? 0 : _ref3$x, _ref3$y = _ref3.y, y = _ref3$y === void 0 ? 0 : _ref3$y; var hasX = offsets.hasOwnProperty('x'); var hasY = offsets.hasOwnProperty('y'); var sideX = left$1; var sideY = top$1; var win = window; if (adaptive) { var offsetParent = getOffsetParent$1(popper); var heightProp = 'clientHeight'; var widthProp = 'clientWidth'; if (offsetParent === getWindow$1(popper)) { offsetParent = getDocumentElement$1(popper); if (getComputedStyle$2(offsetParent).position !== 'static') { heightProp = 'scrollHeight'; widthProp = 'scrollWidth'; } } // $FlowFixMe[incompatible-cast]: force type refinement, we compare offsetParent with window above, but Flow doesn't detect it offsetParent = offsetParent; if (placement === top$1) { sideY = bottom$1; // $FlowFixMe[prop-missing] y -= offsetParent[heightProp] - popperRect.height; y *= gpuAcceleration ? 1 : -1; } if (placement === left$1) { sideX = right$1; // $FlowFixMe[prop-missing] x -= offsetParent[widthProp] - popperRect.width; x *= gpuAcceleration ? 1 : -1; } } var commonStyles = Object.assign({ position: position }, adaptive && unsetSides$1); if (gpuAcceleration) { var _Object$assign; return Object.assign({}, commonStyles, (_Object$assign = {}, _Object$assign[sideY] = hasY ? '0' : '', _Object$assign[sideX] = hasX ? '0' : '', _Object$assign.transform = (win.devicePixelRatio || 1) < 2 ? "translate(" + x + "px, " + y + "px)" : "translate3d(" + x + "px, " + y + "px, 0)", _Object$assign)); } return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : '', _Object$assign2[sideX] = hasX ? x + "px" : '', _Object$assign2.transform = '', _Object$assign2)); } function computeStyles$2(_ref4) { var state = _ref4.state, options = _ref4.options; var _options$gpuAccelerat = options.gpuAcceleration, gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat, _options$adaptive = options.adaptive, adaptive = _options$adaptive === void 0 ? true : _options$adaptive, _options$roundOffsets = options.roundOffsets, roundOffsets = _options$roundOffsets === void 0 ? true : _options$roundOffsets; if (process.env.NODE_ENV !== "production") { var transitionProperty = getComputedStyle$2(state.elements.popper).transitionProperty || ''; if (adaptive && ['transform', 'top', 'right', 'bottom', 'left'].some(function (property) { return transitionProperty.indexOf(property) >= 0; })) { console.warn(['Popper: Detected CSS transitions on at least one of the following', 'CSS properties: "transform", "top", "right", "bottom", "left".', '\n\n', 'Disable the "computeStyles" modifier\'s `adaptive` option to allow', 'for smooth transitions, or remove these properties from the CSS', 'transition declaration on the popper element if only transitioning', 'opacity or background-color for example.', '\n\n', 'We recommend using the popper element as a wrapper around an inner', 'element that can have any CSS property transitioned for animations.'].join(' ')); } } var commonStyles = { placement: getBasePlacement$1(state.placement), popper: state.elements.popper, popperRect: state.rects.popper, gpuAcceleration: gpuAcceleration }; if (state.modifiersData.popperOffsets != null) { state.styles.popper = Object.assign({}, state.styles.popper, mapToStyles$1(Object.assign({}, commonStyles, { offsets: state.modifiersData.popperOffsets, position: state.options.strategy, adaptive: adaptive, roundOffsets: roundOffsets }))); } if (state.modifiersData.arrow != null) { state.styles.arrow = Object.assign({}, state.styles.arrow, mapToStyles$1(Object.assign({}, commonStyles, { offsets: state.modifiersData.arrow, position: 'absolute', adaptive: false, roundOffsets: roundOffsets }))); } state.attributes.popper = Object.assign({}, state.attributes.popper, { 'data-popper-placement': state.placement }); } // eslint-disable-next-line import/no-unused-modules var computeStyles$1$1 = { name: 'computeStyles', enabled: true, phase: 'beforeWrite', fn: computeStyles$2, data: {} }; var passive$1 = { passive: true }; function effect$3(_ref) { var state = _ref.state, instance = _ref.instance, options = _ref.options; var _options$scroll = options.scroll, scroll = _options$scroll === void 0 ? true : _options$scroll, _options$resize = options.resize, resize = _options$resize === void 0 ? true : _options$resize; var window = getWindow$1(state.elements.popper); var scrollParents = [].concat(state.scrollParents.reference, state.scrollParents.popper); if (scroll) { scrollParents.forEach(function (scrollParent) { scrollParent.addEventListener('scroll', instance.update, passive$1); }); } if (resize) { window.addEventListener('resize', instance.update, passive$1); } return function () { if (scroll) { scrollParents.forEach(function (scrollParent) { scrollParent.removeEventListener('scroll', instance.update, passive$1); }); } if (resize) { window.removeEventListener('resize', instance.update, passive$1); } }; } // eslint-disable-next-line import/no-unused-modules var eventListeners$1 = { name: 'eventListeners', enabled: true, phase: 'write', fn: function fn() {}, effect: effect$3, data: {} }; var hash$1$1 = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' }; function getOppositePlacement$1(placement) { return placement.replace(/left|right|bottom|top/g, function (matched) { return hash$1$1[matched]; }); } var hash$2 = { start: 'end', end: 'start' }; function getOppositeVariationPlacement$1(placement) { return placement.replace(/start|end/g, function (matched) { return hash$2[matched]; }); } function getWindowScroll$1(node) { var win = getWindow$1(node); var scrollLeft = win.pageXOffset; var scrollTop = win.pageYOffset; return { scrollLeft: scrollLeft, scrollTop: scrollTop }; } function getWindowScrollBarX$1(element) { // If has a CSS width greater than the viewport, then this will be // incorrect for RTL. // Popper 1 is broken in this case and never had a bug report so let's assume // it's not an issue. I don't think anyone ever specifies width on // anyway. // Browsers where the left scrollbar doesn't cause an issue report `0` for // this (e.g. Edge 2019, IE11, Safari) return getBoundingClientRect$1(getDocumentElement$1(element)).left + getWindowScroll$1(element).scrollLeft; } function getViewportRect$1(element) { var win = getWindow$1(element); var html = getDocumentElement$1(element); var visualViewport = win.visualViewport; var width = html.clientWidth; var height = html.clientHeight; var x = 0; var y = 0; // NB: This isn't supported on iOS <= 12. If the keyboard is open, the popper // can be obscured underneath it. // Also, `html.clientHeight` adds the bottom bar height in Safari iOS, even // if it isn't open, so if this isn't available, the popper will be detected // to overflow the bottom of the screen too early. if (visualViewport) { width = visualViewport.width; height = visualViewport.height; // Uses Layout Viewport (like Chrome; Safari does not currently) // In Chrome, it returns a value very close to 0 (+/-) but contains rounding // errors due to floating point numbers, so we need to check precision. // Safari returns a number <= 0, usually < -1 when pinch-zoomed // Feature detection fails in mobile emulation mode in Chrome. // Math.abs(win.innerWidth / visualViewport.scale - visualViewport.width) < // 0.001 // Fallback here: "Not Safari" userAgent if (!/^((?!chrome|android).)*safari/i.test(navigator.userAgent)) { x = visualViewport.offsetLeft; y = visualViewport.offsetTop; } } return { width: width, height: height, x: x + getWindowScrollBarX$1(element), y: y }; } // of the `` and `
` rect bounds if horizontally scrollable function getDocumentRect$1(element) { var _element$ownerDocumen; var html = getDocumentElement$1(element); var winScroll = getWindowScroll$1(element); var body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body; var width = max$1(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0); var height = max$1(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0); var x = -winScroll.scrollLeft + getWindowScrollBarX$1(element); var y = -winScroll.scrollTop; if (getComputedStyle$2(body || html).direction === 'rtl') { x += max$1(html.clientWidth, body ? body.clientWidth : 0) - width; } return { width: width, height: height, x: x, y: y }; } function isScrollParent$1(element) { // Firefox wants us to check `-x` and `-y` variations as well var _getComputedStyle = getComputedStyle$2(element), overflow = _getComputedStyle.overflow, overflowX = _getComputedStyle.overflowX, overflowY = _getComputedStyle.overflowY; return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX); } function getScrollParent$1(node) { if (['html', 'body', '#document'].indexOf(getNodeName$1(node)) >= 0) { // $FlowFixMe[incompatible-return]: assume body is always available return node.ownerDocument.body; } if (isHTMLElement$1(node) && isScrollParent$1(node)) { return node; } return getScrollParent$1(getParentNode$1(node)); } /* given a DOM element, return the list of all scroll parents, up the list of ancesors until we get to the top window object. This list is what we attach scroll listeners to, because if any of these parent elements scroll, we'll need to re-calculate the reference element's position. */ function listScrollParents$1(element, list) { var _element$ownerDocumen; if (list === void 0) { list = []; } var scrollParent = getScrollParent$1(element); var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body); var win = getWindow$1(scrollParent); var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent$1(scrollParent) ? scrollParent : []) : scrollParent; var updatedList = list.concat(target); return isBody ? updatedList : // $FlowFixMe[incompatible-call]: isBody tells us target will be an HTMLElement here updatedList.concat(listScrollParents$1(getParentNode$1(target))); } function rectToClientRect$1(rect) { return Object.assign({}, rect, { left: rect.x, top: rect.y, right: rect.x + rect.width, bottom: rect.y + rect.height }); } function getInnerBoundingClientRect$1(element) { var rect = getBoundingClientRect$1(element); rect.top = rect.top + element.clientTop; rect.left = rect.left + element.clientLeft; rect.bottom = rect.top + element.clientHeight; rect.right = rect.left + element.clientWidth; rect.width = element.clientWidth; rect.height = element.clientHeight; rect.x = rect.left; rect.y = rect.top; return rect; } function getClientRectFromMixedType$1(element, clippingParent) { return clippingParent === viewport$1 ? rectToClientRect$1(getViewportRect$1(element)) : isHTMLElement$1(clippingParent) ? getInnerBoundingClientRect$1(clippingParent) : rectToClientRect$1(getDocumentRect$1(getDocumentElement$1(element))); } // A "clipping parent" is an overflowable container with the characteristic of // clipping (or hiding) overflowing elements with a position different from // `initial` function getClippingParents$1(element) { var clippingParents = listScrollParents$1(getParentNode$1(element)); var canEscapeClipping = ['absolute', 'fixed'].indexOf(getComputedStyle$2(element).position) >= 0; var clipperElement = canEscapeClipping && isHTMLElement$1(element) ? getOffsetParent$1(element) : element; if (!isElement$1(clipperElement)) { return []; } // $FlowFixMe[incompatible-return]: https://github.com/facebook/flow/issues/1414 return clippingParents.filter(function (clippingParent) { return isElement$1(clippingParent) && contains$1(clippingParent, clipperElement) && getNodeName$1(clippingParent) !== 'body'; }); } // Gets the maximum area that the element is visible in due to any number of // clipping parents function getClippingRect$1(element, boundary, rootBoundary) { var mainClippingParents = boundary === 'clippingParents' ? getClippingParents$1(element) : [].concat(boundary); var clippingParents = [].concat(mainClippingParents, [rootBoundary]); var firstClippingParent = clippingParents[0]; var clippingRect = clippingParents.reduce(function (accRect, clippingParent) { var rect = getClientRectFromMixedType$1(element, clippingParent); accRect.top = max$1(rect.top, accRect.top); accRect.right = min$1(rect.right, accRect.right); accRect.bottom = min$1(rect.bottom, accRect.bottom); accRect.left = max$1(rect.left, accRect.left); return accRect; }, getClientRectFromMixedType$1(element, firstClippingParent)); clippingRect.width = clippingRect.right - clippingRect.left; clippingRect.height = clippingRect.bottom - clippingRect.top; clippingRect.x = clippingRect.left; clippingRect.y = clippingRect.top; return clippingRect; } function getVariation$1(placement) { return placement.split('-')[1]; } function computeOffsets$1(_ref) { var reference = _ref.reference, element = _ref.element, placement = _ref.placement; var basePlacement = placement ? getBasePlacement$1(placement) : null; var variation = placement ? getVariation$1(placement) : null; var commonX = reference.x + reference.width / 2 - element.width / 2; var commonY = reference.y + reference.height / 2 - element.height / 2; var offsets; switch (basePlacement) { case top$1: offsets = { x: commonX, y: reference.y - element.height }; break; case bottom$1: offsets = { x: commonX, y: reference.y + reference.height }; break; case right$1: offsets = { x: reference.x + reference.width, y: commonY }; break; case left$1: offsets = { x: reference.x - element.width, y: commonY }; break; default: offsets = { x: reference.x, y: reference.y }; } var mainAxis = basePlacement ? getMainAxisFromPlacement$1(basePlacement) : null; if (mainAxis != null) { var len = mainAxis === 'y' ? 'height' : 'width'; switch (variation) { case start$1: offsets[mainAxis] = offsets[mainAxis] - (reference[len] / 2 - element[len] / 2); break; case end$1: offsets[mainAxis] = offsets[mainAxis] + (reference[len] / 2 - element[len] / 2); break; } } return offsets; } function detectOverflow$1(state, options) { if (options === void 0) { options = {}; } var _options = options, _options$placement = _options.placement, placement = _options$placement === void 0 ? state.placement : _options$placement, _options$boundary = _options.boundary, boundary = _options$boundary === void 0 ? clippingParents$1 : _options$boundary, _options$rootBoundary = _options.rootBoundary, rootBoundary = _options$rootBoundary === void 0 ? viewport$1 : _options$rootBoundary, _options$elementConte = _options.elementContext, elementContext = _options$elementConte === void 0 ? popper$1 : _options$elementConte, _options$altBoundary = _options.altBoundary, altBoundary = _options$altBoundary === void 0 ? false : _options$altBoundary, _options$padding = _options.padding, padding = _options$padding === void 0 ? 0 : _options$padding; var paddingObject = mergePaddingObject$1(typeof padding !== 'number' ? padding : expandToHashMap$1(padding, basePlacements$1)); var altContext = elementContext === popper$1 ? reference$1 : popper$1; var referenceElement = state.elements.reference; var popperRect = state.rects.popper; var element = state.elements[altBoundary ? altContext : elementContext]; var clippingClientRect = getClippingRect$1(isElement$1(element) ? element : element.contextElement || getDocumentElement$1(state.elements.popper), boundary, rootBoundary); var referenceClientRect = getBoundingClientRect$1(referenceElement); var popperOffsets = computeOffsets$1({ reference: referenceClientRect, element: popperRect, strategy: 'absolute', placement: placement }); var popperClientRect = rectToClientRect$1(Object.assign({}, popperRect, popperOffsets)); var elementClientRect = elementContext === popper$1 ? popperClientRect : referenceClientRect; // positive = overflowing the clipping rect // 0 or negative = within the clipping rect var overflowOffsets = { top: clippingClientRect.top - elementClientRect.top + paddingObject.top, bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom, left: clippingClientRect.left - elementClientRect.left + paddingObject.left, right: elementClientRect.right - clippingClientRect.right + paddingObject.right }; var offsetData = state.modifiersData.offset; // Offsets can be applied only to the popper element if (elementContext === popper$1 && offsetData) { var offset = offsetData[placement]; Object.keys(overflowOffsets).forEach(function (key) { var multiply = [right$1, bottom$1].indexOf(key) >= 0 ? 1 : -1; var axis = [top$1, bottom$1].indexOf(key) >= 0 ? 'y' : 'x'; overflowOffsets[key] += offset[axis] * multiply; }); } return overflowOffsets; } function computeAutoPlacement$1(state, options) { if (options === void 0) { options = {}; } var _options = options, placement = _options.placement, boundary = _options.boundary, rootBoundary = _options.rootBoundary, padding = _options.padding, flipVariations = _options.flipVariations, _options$allowedAutoP = _options.allowedAutoPlacements, allowedAutoPlacements = _options$allowedAutoP === void 0 ? placements$1 : _options$allowedAutoP; var variation = getVariation$1(placement); var placements$1$1 = variation ? flipVariations ? variationPlacements$1 : variationPlacements$1.filter(function (placement) { return getVariation$1(placement) === variation; }) : basePlacements$1; var allowedPlacements = placements$1$1.filter(function (placement) { return allowedAutoPlacements.indexOf(placement) >= 0; }); if (allowedPlacements.length === 0) { allowedPlacements = placements$1$1; if (process.env.NODE_ENV !== "production") { console.error(['Popper: The `allowedAutoPlacements` option did not allow any', 'placements. Ensure the `placement` option matches the variation', 'of the allowed placements.', 'For example, "auto" cannot be used to allow "bottom-start".', 'Use "auto-start" instead.'].join(' ')); } } // $FlowFixMe[incompatible-type]: Flow seems to have problems with two array unions... var overflows = allowedPlacements.reduce(function (acc, placement) { acc[placement] = detectOverflow$1(state, { placement: placement, boundary: boundary, rootBoundary: rootBoundary, padding: padding })[getBasePlacement$1(placement)]; return acc; }, {}); return Object.keys(overflows).sort(function (a, b) { return overflows[a] - overflows[b]; }); } function getExpandedFallbackPlacements$1(placement) { if (getBasePlacement$1(placement) === auto$1) { return []; } var oppositePlacement = getOppositePlacement$1(placement); return [getOppositeVariationPlacement$1(placement), oppositePlacement, getOppositeVariationPlacement$1(oppositePlacement)]; } function flip$2(_ref) { var state = _ref.state, options = _ref.options, name = _ref.name; if (state.modifiersData[name]._skip) { return; } var _options$mainAxis = options.mainAxis, checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis, _options$altAxis = options.altAxis, checkAltAxis = _options$altAxis === void 0 ? true : _options$altAxis, specifiedFallbackPlacements = options.fallbackPlacements, padding = options.padding, boundary = options.boundary, rootBoundary = options.rootBoundary, altBoundary = options.altBoundary, _options$flipVariatio = options.flipVariations, flipVariations = _options$flipVariatio === void 0 ? true : _options$flipVariatio, allowedAutoPlacements = options.allowedAutoPlacements; var preferredPlacement = state.options.placement; var basePlacement = getBasePlacement$1(preferredPlacement); var isBasePlacement = basePlacement === preferredPlacement; var fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipVariations ? [getOppositePlacement$1(preferredPlacement)] : getExpandedFallbackPlacements$1(preferredPlacement)); var placements = [preferredPlacement].concat(fallbackPlacements).reduce(function (acc, placement) { return acc.concat(getBasePlacement$1(placement) === auto$1 ? computeAutoPlacement$1(state, { placement: placement, boundary: boundary, rootBoundary: rootBoundary, padding: padding, flipVariations: flipVariations, allowedAutoPlacements: allowedAutoPlacements }) : placement); }, []); var referenceRect = state.rects.reference; var popperRect = state.rects.popper; var checksMap = new Map(); var makeFallbackChecks = true; var firstFittingPlacement = placements[0]; for (var i = 0; i < placements.length; i++) { var placement = placements[i]; var _basePlacement = getBasePlacement$1(placement); var isStartVariation = getVariation$1(placement) === start$1; var isVertical = [top$1, bottom$1].indexOf(_basePlacement) >= 0; var len = isVertical ? 'width' : 'height'; var overflow = detectOverflow$1(state, { placement: placement, boundary: boundary, rootBoundary: rootBoundary, altBoundary: altBoundary, padding: padding }); var mainVariationSide = isVertical ? isStartVariation ? right$1 : left$1 : isStartVariation ? bottom$1 : top$1; if (referenceRect[len] > popperRect[len]) { mainVariationSide = getOppositePlacement$1(mainVariationSide); } var altVariationSide = getOppositePlacement$1(mainVariationSide); var checks = []; if (checkMainAxis) { checks.push(overflow[_basePlacement] <= 0); } if (checkAltAxis) { checks.push(overflow[mainVariationSide] <= 0, overflow[altVariationSide] <= 0); } if (checks.every(function (check) { return check; })) { firstFittingPlacement = placement; makeFallbackChecks = false; break; } checksMap.set(placement, checks); } if (makeFallbackChecks) { // `2` may be desired in some cases – research later var numberOfChecks = flipVariations ? 3 : 1; var _loop = function _loop(_i) { var fittingPlacement = placements.find(function (placement) { var checks = checksMap.get(placement); if (checks) { return checks.slice(0, _i).every(function (check) { return check; }); } }); if (fittingPlacement) { firstFittingPlacement = fittingPlacement; return "break"; } }; for (var _i = numberOfChecks; _i > 0; _i--) { var _ret = _loop(_i); if (_ret === "break") break; } } if (state.placement !== firstFittingPlacement) { state.modifiersData[name]._skip = true; state.placement = firstFittingPlacement; state.reset = true; } } // eslint-disable-next-line import/no-unused-modules var flip$1$1 = { name: 'flip', enabled: true, phase: 'main', fn: flip$2, requiresIfExists: ['offset'], data: { _skip: false } }; function getSideOffsets$1(overflow, rect, preventedOffsets) { if (preventedOffsets === void 0) { preventedOffsets = { x: 0, y: 0 }; } return { top: overflow.top - rect.height - preventedOffsets.y, right: overflow.right - rect.width + preventedOffsets.x, bottom: overflow.bottom - rect.height + preventedOffsets.y, left: overflow.left - rect.width - preventedOffsets.x }; } function isAnySideFullyClipped$1(overflow) { return [top$1, right$1, bottom$1, left$1].some(function (side) { return overflow[side] >= 0; }); } function hide$2(_ref) { var state = _ref.state, name = _ref.name; var referenceRect = state.rects.reference; var popperRect = state.rects.popper; var preventedOffsets = state.modifiersData.preventOverflow; var referenceOverflow = detectOverflow$1(state, { elementContext: 'reference' }); var popperAltOverflow = detectOverflow$1(state, { altBoundary: true }); var referenceClippingOffsets = getSideOffsets$1(referenceOverflow, referenceRect); var popperEscapeOffsets = getSideOffsets$1(popperAltOverflow, popperRect, preventedOffsets); var isReferenceHidden = isAnySideFullyClipped$1(referenceClippingOffsets); var hasPopperEscaped = isAnySideFullyClipped$1(popperEscapeOffsets); state.modifiersData[name] = { referenceClippingOffsets: referenceClippingOffsets, popperEscapeOffsets: popperEscapeOffsets, isReferenceHidden: isReferenceHidden, hasPopperEscaped: hasPopperEscaped }; state.attributes.popper = Object.assign({}, state.attributes.popper, { 'data-popper-reference-hidden': isReferenceHidden, 'data-popper-escaped': hasPopperEscaped }); } // eslint-disable-next-line import/no-unused-modules var hide$1$1 = { name: 'hide', enabled: true, phase: 'main', requiresIfExists: ['preventOverflow'], fn: hide$2 }; function distanceAndSkiddingToXY$1(placement, rects, offset) { var basePlacement = getBasePlacement$1(placement); var invertDistance = [left$1, top$1].indexOf(basePlacement) >= 0 ? -1 : 1; var _ref = typeof offset === 'function' ? offset(Object.assign({}, rects, { placement: placement })) : offset, skidding = _ref[0], distance = _ref[1]; skidding = skidding || 0; distance = (distance || 0) * invertDistance; return [left$1, right$1].indexOf(basePlacement) >= 0 ? { x: distance, y: skidding } : { x: skidding, y: distance }; } function offset$2(_ref2) { var state = _ref2.state, options = _ref2.options, name = _ref2.name; var _options$offset = options.offset, offset = _options$offset === void 0 ? [0, 0] : _options$offset; var data = placements$1.reduce(function (acc, placement) { acc[placement] = distanceAndSkiddingToXY$1(placement, state.rects, offset); return acc; }, {}); var _data$state$placement = data[state.placement], x = _data$state$placement.x, y = _data$state$placement.y; if (state.modifiersData.popperOffsets != null) { state.modifiersData.popperOffsets.x += x; state.modifiersData.popperOffsets.y += y; } state.modifiersData[name] = data; } // eslint-disable-next-line import/no-unused-modules var offset$1$1 = { name: 'offset', enabled: true, phase: 'main', requires: ['popperOffsets'], fn: offset$2 }; function popperOffsets$2(_ref) { var state = _ref.state, name = _ref.name; // Offsets are the actual position the popper needs to have to be // properly positioned near its reference element // This is the most basic placement, and will be adjusted by // the modifiers in the next step state.modifiersData[name] = computeOffsets$1({ reference: state.rects.reference, element: state.rects.popper, strategy: 'absolute', placement: state.placement }); } // eslint-disable-next-line import/no-unused-modules var popperOffsets$1$1 = { name: 'popperOffsets', enabled: true, phase: 'read', fn: popperOffsets$2, data: {} }; function getAltAxis$1(axis) { return axis === 'x' ? 'y' : 'x'; } function preventOverflow$2(_ref) { var state = _ref.state, options = _ref.options, name = _ref.name; var _options$mainAxis = options.mainAxis, checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis, _options$altAxis = options.altAxis, checkAltAxis = _options$altAxis === void 0 ? false : _options$altAxis, boundary = options.boundary, rootBoundary = options.rootBoundary, altBoundary = options.altBoundary, padding = options.padding, _options$tether = options.tether, tether = _options$tether === void 0 ? true : _options$tether, _options$tetherOffset = options.tetherOffset, tetherOffset = _options$tetherOffset === void 0 ? 0 : _options$tetherOffset; var overflow = detectOverflow$1(state, { boundary: boundary, rootBoundary: rootBoundary, padding: padding, altBoundary: altBoundary }); var basePlacement = getBasePlacement$1(state.placement); var variation = getVariation$1(state.placement); var isBasePlacement = !variation; var mainAxis = getMainAxisFromPlacement$1(basePlacement); var altAxis = getAltAxis$1(mainAxis); var popperOffsets = state.modifiersData.popperOffsets; var referenceRect = state.rects.reference; var popperRect = state.rects.popper; var tetherOffsetValue = typeof tetherOffset === 'function' ? tetherOffset(Object.assign({}, state.rects, { placement: state.placement })) : tetherOffset; var data = { x: 0, y: 0 }; if (!popperOffsets) { return; } if (checkMainAxis || checkAltAxis) { var mainSide = mainAxis === 'y' ? top$1 : left$1; var altSide = mainAxis === 'y' ? bottom$1 : right$1; var len = mainAxis === 'y' ? 'height' : 'width'; var offset = popperOffsets[mainAxis]; var min$1$1 = popperOffsets[mainAxis] + overflow[mainSide]; var max$1$1 = popperOffsets[mainAxis] - overflow[altSide]; var additive = tether ? -popperRect[len] / 2 : 0; var minLen = variation === start$1 ? referenceRect[len] : popperRect[len]; var maxLen = variation === start$1 ? -popperRect[len] : -referenceRect[len]; // We need to include the arrow in the calculation so the arrow doesn't go // outside the reference bounds var arrowElement = state.elements.arrow; var arrowRect = tether && arrowElement ? getLayoutRect$1(arrowElement) : { width: 0, height: 0 }; var arrowPaddingObject = state.modifiersData['arrow#persistent'] ? state.modifiersData['arrow#persistent'].padding : getFreshSideObject$1(); var arrowPaddingMin = arrowPaddingObject[mainSide]; var arrowPaddingMax = arrowPaddingObject[altSide]; // If the reference length is smaller than the arrow length, we don't want // to include its full size in the calculation. If the reference is small // and near the edge of a boundary, the popper can overflow even if the // reference is not overflowing as well (e.g. virtual elements with no // width or height) var arrowLen = within$1(0, referenceRect[len], arrowRect[len]); var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - tetherOffsetValue : minLen - arrowLen - arrowPaddingMin - tetherOffsetValue; var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + tetherOffsetValue : maxLen + arrowLen + arrowPaddingMax + tetherOffsetValue; var arrowOffsetParent = state.elements.arrow && getOffsetParent$1(state.elements.arrow); var clientOffset = arrowOffsetParent ? mainAxis === 'y' ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0; var offsetModifierValue = state.modifiersData.offset ? state.modifiersData.offset[state.placement][mainAxis] : 0; var tetherMin = popperOffsets[mainAxis] + minOffset - offsetModifierValue - clientOffset; var tetherMax = popperOffsets[mainAxis] + maxOffset - offsetModifierValue; if (checkMainAxis) { var preventedOffset = within$1(tether ? min$1(min$1$1, tetherMin) : min$1$1, offset, tether ? max$1(max$1$1, tetherMax) : max$1$1); popperOffsets[mainAxis] = preventedOffset; data[mainAxis] = preventedOffset - offset; } if (checkAltAxis) { var _mainSide = mainAxis === 'x' ? top$1 : left$1; var _altSide = mainAxis === 'x' ? bottom$1 : right$1; var _offset = popperOffsets[altAxis]; var _min = _offset + overflow[_mainSide]; var _max = _offset - overflow[_altSide]; var _preventedOffset = within$1(tether ? min$1(_min, tetherMin) : _min, _offset, tether ? max$1(_max, tetherMax) : _max); popperOffsets[altAxis] = _preventedOffset; data[altAxis] = _preventedOffset - _offset; } } state.modifiersData[name] = data; } // eslint-disable-next-line import/no-unused-modules var preventOverflow$1$1 = { name: 'preventOverflow', enabled: true, phase: 'main', fn: preventOverflow$2, requiresIfExists: ['offset'] }; function getHTMLElementScroll$1(element) { return { scrollLeft: element.scrollLeft, scrollTop: element.scrollTop }; } function getNodeScroll$1(node) { if (node === getWindow$1(node) || !isHTMLElement$1(node)) { return getWindowScroll$1(node); } else { return getHTMLElementScroll$1(node); } } // Composite means it takes into account transforms as well as layout. function getCompositeRect$1(elementOrVirtualElement, offsetParent, isFixed) { if (isFixed === void 0) { isFixed = false; } var documentElement = getDocumentElement$1(offsetParent); var rect = getBoundingClientRect$1(elementOrVirtualElement); var isOffsetParentAnElement = isHTMLElement$1(offsetParent); var scroll = { scrollLeft: 0, scrollTop: 0 }; var offsets = { x: 0, y: 0 }; if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) { if (getNodeName$1(offsetParent) !== 'body' || // https://github.com/popperjs/popper-core/issues/1078 isScrollParent$1(documentElement)) { scroll = getNodeScroll$1(offsetParent); } if (isHTMLElement$1(offsetParent)) { offsets = getBoundingClientRect$1(offsetParent); offsets.x += offsetParent.clientLeft; offsets.y += offsetParent.clientTop; } else if (documentElement) { offsets.x = getWindowScrollBarX$1(documentElement); } } return { x: rect.left + scroll.scrollLeft - offsets.x, y: rect.top + scroll.scrollTop - offsets.y, width: rect.width, height: rect.height }; } function order$1(modifiers) { var map = new Map(); var visited = new Set(); var result = []; modifiers.forEach(function (modifier) { map.set(modifier.name, modifier); }); // On visiting object, check for its dependencies and visit them recursively function sort(modifier) { visited.add(modifier.name); var requires = [].concat(modifier.requires || [], modifier.requiresIfExists || []); requires.forEach(function (dep) { if (!visited.has(dep)) { var depModifier = map.get(dep); if (depModifier) { sort(depModifier); } } }); result.push(modifier); } modifiers.forEach(function (modifier) { if (!visited.has(modifier.name)) { // check for visited object sort(modifier); } }); return result; } function orderModifiers$1(modifiers) { // order based on dependencies var orderedModifiers = order$1(modifiers); // order based on phase return modifierPhases$1.reduce(function (acc, phase) { return acc.concat(orderedModifiers.filter(function (modifier) { return modifier.phase === phase; })); }, []); } function debounce$1(fn) { var pending; return function () { if (!pending) { pending = new Promise(function (resolve) { Promise.resolve().then(function () { pending = undefined; resolve(fn()); }); }); } return pending; }; } function format$1(str) { for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { args[_key - 1] = arguments[_key]; } return [].concat(args).reduce(function (p, c) { return p.replace(/%s/, c); }, str); } var INVALID_MODIFIER_ERROR$1 = 'Popper: modifier "%s" provided an invalid %s property, expected %s but got %s'; var MISSING_DEPENDENCY_ERROR$1 = 'Popper: modifier "%s" requires "%s", but "%s" modifier is not available'; var VALID_PROPERTIES$1 = ['name', 'enabled', 'phase', 'fn', 'effect', 'requires', 'options']; function validateModifiers$1(modifiers) { modifiers.forEach(function (modifier) { Object.keys(modifier).forEach(function (key) { switch (key) { case 'name': if (typeof modifier.name !== 'string') { console.error(format$1(INVALID_MODIFIER_ERROR$1, String(modifier.name), '"name"', '"string"', "\"" + String(modifier.name) + "\"")); } break; case 'enabled': if (typeof modifier.enabled !== 'boolean') { console.error(format$1(INVALID_MODIFIER_ERROR$1, modifier.name, '"enabled"', '"boolean"', "\"" + String(modifier.enabled) + "\"")); } case 'phase': if (modifierPhases$1.indexOf(modifier.phase) < 0) { console.error(format$1(INVALID_MODIFIER_ERROR$1, modifier.name, '"phase"', "either " + modifierPhases$1.join(', '), "\"" + String(modifier.phase) + "\"")); } break; case 'fn': if (typeof modifier.fn !== 'function') { console.error(format$1(INVALID_MODIFIER_ERROR$1, modifier.name, '"fn"', '"function"', "\"" + String(modifier.fn) + "\"")); } break; case 'effect': if (typeof modifier.effect !== 'function') { console.error(format$1(INVALID_MODIFIER_ERROR$1, modifier.name, '"effect"', '"function"', "\"" + String(modifier.fn) + "\"")); } break; case 'requires': if (!Array.isArray(modifier.requires)) { console.error(format$1(INVALID_MODIFIER_ERROR$1, modifier.name, '"requires"', '"array"', "\"" + String(modifier.requires) + "\"")); } break; case 'requiresIfExists': if (!Array.isArray(modifier.requiresIfExists)) { console.error(format$1(INVALID_MODIFIER_ERROR$1, modifier.name, '"requiresIfExists"', '"array"', "\"" + String(modifier.requiresIfExists) + "\"")); } break; case 'options': case 'data': break; default: console.error("PopperJS: an invalid property has been provided to the \"" + modifier.name + "\" modifier, valid properties are " + VALID_PROPERTIES$1.map(function (s) { return "\"" + s + "\""; }).join(', ') + "; but \"" + key + "\" was provided."); } modifier.requires && modifier.requires.forEach(function (requirement) { if (modifiers.find(function (mod) { return mod.name === requirement; }) == null) { console.error(format$1(MISSING_DEPENDENCY_ERROR$1, String(modifier.name), requirement, requirement)); } }); }); }); } function uniqueBy$1(arr, fn) { var identifiers = new Set(); return arr.filter(function (item) { var identifier = fn(item); if (!identifiers.has(identifier)) { identifiers.add(identifier); return true; } }); } function mergeByName$1(modifiers) { var merged = modifiers.reduce(function (merged, current) { var existing = merged[current.name]; merged[current.name] = existing ? Object.assign({}, existing, current, { options: Object.assign({}, existing.options, current.options), data: Object.assign({}, existing.data, current.data) }) : current; return merged; }, {}); // IE11 does not support Object.values return Object.keys(merged).map(function (key) { return merged[key]; }); } var INVALID_ELEMENT_ERROR$1 = 'Popper: Invalid reference or popper argument provided. They must be either a DOM element or virtual element.'; var INFINITE_LOOP_ERROR$1 = 'Popper: An infinite loop in the modifiers cycle has been detected! The cycle has been interrupted to prevent a browser crash.'; var DEFAULT_OPTIONS$1 = { placement: 'bottom', modifiers: [], strategy: 'absolute' }; function areValidElements$1() { for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } return !args.some(function (element) { return !(element && typeof element.getBoundingClientRect === 'function'); }); } function popperGenerator$1(generatorOptions) { if (generatorOptions === void 0) { generatorOptions = {}; } var _generatorOptions = generatorOptions, _generatorOptions$def = _generatorOptions.defaultModifiers, defaultModifiers = _generatorOptions$def === void 0 ? [] : _generatorOptions$def, _generatorOptions$def2 = _generatorOptions.defaultOptions, defaultOptions = _generatorOptions$def2 === void 0 ? DEFAULT_OPTIONS$1 : _generatorOptions$def2; return function createPopper(reference, popper, options) { if (options === void 0) { options = defaultOptions; } var state = { placement: 'bottom', orderedModifiers: [], options: Object.assign({}, DEFAULT_OPTIONS$1, defaultOptions), modifiersData: {}, elements: { reference: reference, popper: popper }, attributes: {}, styles: {} }; var effectCleanupFns = []; var isDestroyed = false; var instance = { state: state, setOptions: function setOptions(options) { cleanupModifierEffects(); state.options = Object.assign({}, defaultOptions, state.options, options); state.scrollParents = { reference: isElement$1(reference) ? listScrollParents$1(reference) : reference.contextElement ? listScrollParents$1(reference.contextElement) : [], popper: listScrollParents$1(popper) }; // Orders the modifiers based on their dependencies and `phase` // properties var orderedModifiers = orderModifiers$1(mergeByName$1([].concat(defaultModifiers, state.options.modifiers))); // Strip out disabled modifiers state.orderedModifiers = orderedModifiers.filter(function (m) { return m.enabled; }); // Validate the provided modifiers so that the consumer will get warned // if one of the modifiers is invalid for any reason if (process.env.NODE_ENV !== "production") { var modifiers = uniqueBy$1([].concat(orderedModifiers, state.options.modifiers), function (_ref) { var name = _ref.name; return name; }); validateModifiers$1(modifiers); if (getBasePlacement$1(state.options.placement) === auto$1) { var flipModifier = state.orderedModifiers.find(function (_ref2) { var name = _ref2.name; return name === 'flip'; }); if (!flipModifier) { console.error(['Popper: "auto" placements require the "flip" modifier be', 'present and enabled to work.'].join(' ')); } } var _getComputedStyle = getComputedStyle$2(popper), marginTop = _getComputedStyle.marginTop, marginRight = _getComputedStyle.marginRight, marginBottom = _getComputedStyle.marginBottom, marginLeft = _getComputedStyle.marginLeft; // We no longer take into account `margins` on the popper, and it can // cause bugs with positioning, so we'll warn the consumer if ([marginTop, marginRight, marginBottom, marginLeft].some(function (margin) { return parseFloat(margin); })) { console.warn(['Popper: CSS "margin" styles cannot be used to apply padding', 'between the popper and its reference element or boundary.', 'To replicate margin, use the `offset` modifier, as well as', 'the `padding` option in the `preventOverflow` and `flip`', 'modifiers.'].join(' ')); } } runModifierEffects(); return instance.update(); }, // Sync update – it will always be executed, even if not necessary. This // is useful for low frequency updates where sync behavior simplifies the // logic. // For high frequency updates (e.g. `resize` and `scroll` events), always // prefer the async Popper#update method forceUpdate: function forceUpdate() { if (isDestroyed) { return; } var _state$elements = state.elements, reference = _state$elements.reference, popper = _state$elements.popper; // Don't proceed if `reference` or `popper` are not valid elements // anymore if (!areValidElements$1(reference, popper)) { if (process.env.NODE_ENV !== "production") { console.error(INVALID_ELEMENT_ERROR$1); } return; } // Store the reference and popper rects to be read by modifiers state.rects = { reference: getCompositeRect$1(reference, getOffsetParent$1(popper), state.options.strategy === 'fixed'), popper: getLayoutRect$1(popper) }; // Modifiers have the ability to reset the current update cycle. The // most common use case for this is the `flip` modifier changing the // placement, which then needs to re-run all the modifiers, because the // logic was previously ran for the previous placement and is therefore // stale/incorrect state.reset = false; state.placement = state.options.placement; // On each update cycle, the `modifiersData` property for each modifier // is filled with the initial data specified by the modifier. This means // it doesn't persist and is fresh on each update. // To ensure persistent data, use `${name}#persistent` state.orderedModifiers.forEach(function (modifier) { return state.modifiersData[modifier.name] = Object.assign({}, modifier.data); }); var __debug_loops__ = 0; for (var index = 0; index < state.orderedModifiers.length; index++) { if (process.env.NODE_ENV !== "production") { __debug_loops__ += 1; if (__debug_loops__ > 100) { console.error(INFINITE_LOOP_ERROR$1); break; } } if (state.reset === true) { state.reset = false; index = -1; continue; } var _state$orderedModifie = state.orderedModifiers[index], fn = _state$orderedModifie.fn, _state$orderedModifie2 = _state$orderedModifie.options, _options = _state$orderedModifie2 === void 0 ? {} : _state$orderedModifie2, name = _state$orderedModifie.name; if (typeof fn === 'function') { state = fn({ state: state, options: _options, name: name, instance: instance }) || state; } } }, // Async and optimistically optimized update – it will not be executed if // not necessary (debounced to run at most once-per-tick) update: debounce$1(function () { return new Promise(function (resolve) { instance.forceUpdate(); resolve(state); }); }), destroy: function destroy() { cleanupModifierEffects(); isDestroyed = true; } }; if (!areValidElements$1(reference, popper)) { if (process.env.NODE_ENV !== "production") { console.error(INVALID_ELEMENT_ERROR$1); } return instance; } instance.setOptions(options).then(function (state) { if (!isDestroyed && options.onFirstUpdate) { options.onFirstUpdate(state); } }); // Modifiers have the ability to execute arbitrary code before the first // update cycle runs. They will be executed in the same order as the update // cycle. This is useful when a modifier adds some persistent data that // other modifiers need to use, but the modifier is run after the dependent // one. function runModifierEffects() { state.orderedModifiers.forEach(function (_ref3) { var name = _ref3.name, _ref3$options = _ref3.options, options = _ref3$options === void 0 ? {} : _ref3$options, effect = _ref3.effect; if (typeof effect === 'function') { var cleanupFn = effect({ state: state, name: name, instance: instance, options: options }); var noopFn = function noopFn() {}; effectCleanupFns.push(cleanupFn || noopFn); } }); } function cleanupModifierEffects() { effectCleanupFns.forEach(function (fn) { return fn(); }); effectCleanupFns = []; } return instance; }; } var defaultModifiers$1 = [eventListeners$1, popperOffsets$1$1, computeStyles$1$1, applyStyles$1$1, offset$1$1, flip$1$1, preventOverflow$1$1, arrow$1$1, hide$1$1]; var createPopper$1 = /*#__PURE__*/popperGenerator$1({ defaultModifiers: defaultModifiers$1 }); // eslint-disable-next-line import/no-unused-modules /* node_modules/@popperjs/svelte/src/Popper.svelte generated by Svelte v3.37.0 */ function create_fragment$b$1(ctx) { let current; const default_slot_template = /*#slots*/ ctx[12].default; const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[11], null); return { c() { if (default_slot) default_slot.c(); }, m(target, anchor) { if (default_slot) { default_slot.m(target, anchor); } current = true; }, p(ctx, [dirty]) { if (default_slot) { if (default_slot.p && dirty & /*$$scope*/ 2048) { update_slot(default_slot, default_slot_template, ctx, /*$$scope*/ ctx[11], dirty, null, null); } } }, i(local) { if (current) return; transition_in(default_slot, local); current = true; }, o(local) { transition_out(default_slot, local); current = false; }, d(detaching) { if (default_slot) default_slot.d(detaching); } }; } function instance$b($$self, $$props, $$invalidate) { let $store, $$unsubscribe_store = noop, $$subscribe_store = () => ($$unsubscribe_store(), $$unsubscribe_store = subscribe(store, $$value => $$invalidate(10, $store = $$value)), store); $$self.$$.on_destroy.push(() => $$unsubscribe_store()); let { $$slots: slots = {}, $$scope } = $$props; let { reference: referenceElement } = $$props; let { popper: popperElement } = $$props; let { options = {} } = $$props; const store = writable({}); $$subscribe_store(); let previousReferenceElement; let previousPopperElement; let popperInstance; const updateStateModifier = { name: "updateState", enabled: true, phase: "write", fn: ({ state }) => store.set(state) }; onDestroy(() => { popperInstance && popperInstance.destroy(); $$invalidate(9, popperInstance = null); }); let { styles = {} } = $$props; let { attributes = {} } = $$props; let { state = {} } = $$props; $$self.$$set = $$props => { if ("reference" in $$props) $$invalidate(4, referenceElement = $$props.reference); if ("popper" in $$props) $$invalidate(5, popperElement = $$props.popper); if ("options" in $$props) $$invalidate(6, options = $$props.options); if ("styles" in $$props) $$invalidate(1, styles = $$props.styles); if ("attributes" in $$props) $$invalidate(2, attributes = $$props.attributes); if ("state" in $$props) $$invalidate(3, state = $$props.state); if ("$$scope" in $$props) $$invalidate(11, $$scope = $$props.$$scope); }; $$self.$$.update = () => { if ($$self.$$.dirty & /*previousPopperElement, popperElement, previousReferenceElement, referenceElement, popperInstance, options*/ 1008) { (async () => { if (previousPopperElement != popperElement || previousReferenceElement != referenceElement) { await tick(); popperInstance && popperInstance.destroy(); if (referenceElement != null && popperElement != null) { $$invalidate(9, popperInstance = createPopper$1(referenceElement, popperElement, { ...options, modifiers: [ ...options.modifiers, updateStateModifier, { name: "applyStyles", enabled: false } ] })); $$invalidate(8, previousPopperElement = popperElement); $$invalidate(7, previousReferenceElement = referenceElement); } } })(); } if ($$self.$$.dirty & /*popperInstance, options*/ 576) { { if (popperInstance != null) { popperInstance.setOptions({ ...options, modifiers: [ ...options.modifiers, updateStateModifier, { name: "applyStyles", enabled: false } ] }); } } } if ($$self.$$.dirty & /*$store*/ 1024) { $$invalidate(1, styles = $store.styles || {}); } if ($$self.$$.dirty & /*$store*/ 1024) { $$invalidate(2, attributes = $store.attributes || {}); } if ($$self.$$.dirty & /*$store*/ 1024) { $$invalidate(3, state = $store); } }; return [ store, styles, attributes, state, referenceElement, popperElement, options, previousReferenceElement, previousPopperElement, popperInstance, $store, $$scope, slots ]; } class Popper$1 extends SvelteComponent { constructor(options) { super(); init(this, options, instance$b, create_fragment$b$1, safe_not_equal, { reference: 4, popper: 5, options: 6, store: 0, styles: 1, attributes: 2, state: 3 }); } get store() { return this.$$.ctx[0]; } } /* src/components/popover/Popper.svelte generated by Svelte v3.37.0 */ function add_css$8() { var style = element("style"); style.id = "svelte-ejuyfk-style"; style.textContent = ".popper.svelte-ejuyfk{transition:opacity 0.1s ease-in;opacity:0;pointer-events:none;position:absolute;z-index:var(--layer-popover)}.popper.visible.svelte-ejuyfk{opacity:1}"; append(document.head, style); } // (27:0)
`;
attr$1(div1, "class", "footer svelte-1kza10w");
},
m(target, anchor) {
insert$1(target, div1, anchor);
},
p: noop$1,
i: noop$1,
o: noop$1,
d(detaching) {
if (detaching) detach$1(div1);
}
};
}
class Footer extends SvelteComponent$1 {
constructor(options) {
super();
if (!document.getElementById("svelte-1kza10w-style")) add_css$5();
init$1(this, options, null, create_fragment$a, safe_not_equal$1, {});
}
}
/* src/ui/settings/SettingItem.svelte generated by Svelte v3.37.0 */
const get_control_slot_changes = dirty => ({});
const get_control_slot_context = ctx => ({});
// (18:4) {#if description}
function create_if_block$1(ctx) {
let div;
let t;
return {
c() {
div = element$1("div");
t = text$1(/*description*/ ctx[1]);
attr$1(div, "class", "setting-item-description");
},
m(target, anchor) {
insert$1(target, div, anchor);
append$1(div, t);
},
p(ctx, dirty) {
if (dirty & /*description*/ 2) set_data$1(t, /*description*/ ctx[1]);
},
d(detaching) {
if (detaching) detach$1(div);
}
};
}
function create_fragment$9(ctx) {
let div4;
let div2;
let div1;
let div0;
let t0;
let t1;
let t2;
let div3;
let current;
let if_block = /*description*/ ctx[1] && create_if_block$1(ctx);
const control_slot_template = /*#slots*/ ctx[5].control;
const control_slot = create_slot$1(control_slot_template, ctx, /*$$scope*/ ctx[4], get_control_slot_context);
return {
c() {
div4 = element$1("div");
div2 = element$1("div");
div1 = element$1("div");
div0 = element$1("div");
t0 = text$1(/*name*/ ctx[0]);
t1 = space$1();
if (if_block) if_block.c();
t2 = space$1();
div3 = element$1("div");
if (control_slot) control_slot.c();
attr$1(div1, "class", "setting-item-name");
attr$1(div2, "class", "setting-item-info");
attr$1(div3, "class", "setting-item-control");
attr$1(div4, "class", "setting-item");
toggle_class$1(div4, "setting-item-heading", /*isHeading*/ ctx[2]);
toggle_class$1(div4, "mod-dropdown", /*type*/ ctx[3] === "dropdown");
},
m(target, anchor) {
insert$1(target, div4, anchor);
append$1(div4, div2);
append$1(div2, div1);
append$1(div1, div0);
append$1(div0, t0);
append$1(div2, t1);
if (if_block) if_block.m(div2, null);
append$1(div4, t2);
append$1(div4, div3);
if (control_slot) {
control_slot.m(div3, null);
}
current = true;
},
p(ctx, [dirty]) {
if (!current || dirty & /*name*/ 1) set_data$1(t0, /*name*/ ctx[0]);
if (/*description*/ ctx[1]) {
if (if_block) {
if_block.p(ctx, dirty);
} else {
if_block = create_if_block$1(ctx);
if_block.c();
if_block.m(div2, null);
}
} else if (if_block) {
if_block.d(1);
if_block = null;
}
if (control_slot) {
if (control_slot.p && dirty & /*$$scope*/ 16) {
update_slot$1(control_slot, control_slot_template, ctx, /*$$scope*/ ctx[4], dirty, get_control_slot_changes, get_control_slot_context);
}
}
if (dirty & /*isHeading*/ 4) {
toggle_class$1(div4, "setting-item-heading", /*isHeading*/ ctx[2]);
}
if (dirty & /*type*/ 8) {
toggle_class$1(div4, "mod-dropdown", /*type*/ ctx[3] === "dropdown");
}
},
i(local) {
if (current) return;
transition_in$1(control_slot, local);
current = true;
},
o(local) {
transition_out$1(control_slot, local);
current = false;
},
d(detaching) {
if (detaching) detach$1(div4);
if (if_block) if_block.d();
if (control_slot) control_slot.d(detaching);
}
};
}
function instance$9($$self, $$props, $$invalidate) {
let { $$slots: slots = {}, $$scope } = $$props;
let { name } = $$props;
let { description } = $$props;
let { isHeading } = $$props;
let { type } = $$props;
$$self.$$set = $$props => {
if ("name" in $$props) $$invalidate(0, name = $$props.name);
if ("description" in $$props) $$invalidate(1, description = $$props.description);
if ("isHeading" in $$props) $$invalidate(2, isHeading = $$props.isHeading);
if ("type" in $$props) $$invalidate(3, type = $$props.type);
if ("$$scope" in $$props) $$invalidate(4, $$scope = $$props.$$scope);
};
return [name, description, isHeading, type, $$scope, slots];
}
class SettingItem extends SvelteComponent$1 {
constructor(options) {
super();
init$1(this, options, instance$9, create_fragment$9, safe_not_equal$1, {
name: 0,
description: 1,
isHeading: 2,
type: 3
});
}
}
// external events
const FINALIZE_EVENT_NAME = "finalize";
const CONSIDER_EVENT_NAME = "consider";
/**
* @typedef {Object} Info
* @property {string} trigger
* @property {string} id
* @property {string} source
* @param {Node} el
* @param {Array} items
* @param {Info} info
*/
function dispatchFinalizeEvent(el, items, info) {
el.dispatchEvent(
new CustomEvent(FINALIZE_EVENT_NAME, {
detail: {items, info}
})
);
}
/**
* Dispatches a consider event
* @param {Node} el
* @param {Array} items
* @param {Info} info
*/
function dispatchConsiderEvent(el, items, info) {
el.dispatchEvent(
new CustomEvent(CONSIDER_EVENT_NAME, {
detail: {items, info}
})
);
}
// internal events
const DRAGGED_ENTERED_EVENT_NAME = "draggedEntered";
const DRAGGED_LEFT_EVENT_NAME = "draggedLeft";
const DRAGGED_OVER_INDEX_EVENT_NAME = "draggedOverIndex";
const DRAGGED_LEFT_DOCUMENT_EVENT_NAME = "draggedLeftDocument";
const DRAGGED_LEFT_TYPES = {
LEFT_FOR_ANOTHER: "leftForAnother",
OUTSIDE_OF_ANY: "outsideOfAny"
};
function dispatchDraggedElementEnteredContainer(containerEl, indexObj, draggedEl) {
containerEl.dispatchEvent(
new CustomEvent(DRAGGED_ENTERED_EVENT_NAME, {
detail: {indexObj, draggedEl}
})
);
}
/**
* @param containerEl - the dropzone the element left
* @param draggedEl - the dragged element
* @param theOtherDz - the new dropzone the element entered
*/
function dispatchDraggedElementLeftContainerForAnother(containerEl, draggedEl, theOtherDz) {
containerEl.dispatchEvent(
new CustomEvent(DRAGGED_LEFT_EVENT_NAME, {
detail: {draggedEl, type: DRAGGED_LEFT_TYPES.LEFT_FOR_ANOTHER, theOtherDz}
})
);
}
function dispatchDraggedElementLeftContainerForNone(containerEl, draggedEl) {
containerEl.dispatchEvent(
new CustomEvent(DRAGGED_LEFT_EVENT_NAME, {
detail: {draggedEl, type: DRAGGED_LEFT_TYPES.OUTSIDE_OF_ANY}
})
);
}
function dispatchDraggedElementIsOverIndex(containerEl, indexObj, draggedEl) {
containerEl.dispatchEvent(
new CustomEvent(DRAGGED_OVER_INDEX_EVENT_NAME, {
detail: {indexObj, draggedEl}
})
);
}
function dispatchDraggedLeftDocument(draggedEl) {
window.dispatchEvent(
new CustomEvent(DRAGGED_LEFT_DOCUMENT_EVENT_NAME, {
detail: {draggedEl}
})
);
}
const TRIGGERS = {
DRAG_STARTED: "dragStarted",
DRAGGED_ENTERED: DRAGGED_ENTERED_EVENT_NAME,
DRAGGED_ENTERED_ANOTHER: "dragEnteredAnother",
DRAGGED_OVER_INDEX: DRAGGED_OVER_INDEX_EVENT_NAME,
DRAGGED_LEFT: DRAGGED_LEFT_EVENT_NAME,
DRAGGED_LEFT_ALL: "draggedLeftAll",
DROPPED_INTO_ZONE: "droppedIntoZone",
DROPPED_INTO_ANOTHER: "droppedIntoAnother",
DROPPED_OUTSIDE_OF_ANY: "droppedOutsideOfAny",
DRAG_STOPPED: "dragStopped"
};
const SOURCES = {
POINTER: "pointer",
KEYBOARD: "keyboard"
};
const SHADOW_ITEM_MARKER_PROPERTY_NAME = "isDndShadowItem";
const SHADOW_ELEMENT_ATTRIBUTE_NAME = "data-is-dnd-shadow-item";
const SHADOW_PLACEHOLDER_ITEM_ID = "id:dnd-shadow-placeholder-0000";
const DRAGGED_ELEMENT_ID = "dnd-action-dragged-el";
let ITEM_ID_KEY = "id";
let activeDndZoneCount = 0;
function incrementActiveDropZoneCount() {
activeDndZoneCount++;
}
function decrementActiveDropZoneCount() {
if (activeDndZoneCount === 0) {
throw new Error("Bug! trying to decrement when there are no dropzones");
}
activeDndZoneCount--;
}
const isOnServer = typeof window === "undefined";
// This is based off https://stackoverflow.com/questions/27745438/how-to-compute-getboundingclientrect-without-considering-transforms/57876601#57876601
// It removes the transforms that are potentially applied by the flip animations
/**
* Gets the bounding rect but removes transforms (ex: flip animation)
* @param {HTMLElement} el
* @return {{top: number, left: number, bottom: number, right: number}}
*/
function getBoundingRectNoTransforms(el) {
let ta;
const rect = el.getBoundingClientRect();
const style = getComputedStyle(el);
const tx = style.transform;
if (tx) {
let sx, sy, dx, dy;
if (tx.startsWith("matrix3d(")) {
ta = tx.slice(9, -1).split(/, /);
sx = +ta[0];
sy = +ta[5];
dx = +ta[12];
dy = +ta[13];
} else if (tx.startsWith("matrix(")) {
ta = tx.slice(7, -1).split(/, /);
sx = +ta[0];
sy = +ta[3];
dx = +ta[4];
dy = +ta[5];
} else {
return rect;
}
const to = style.transformOrigin;
const x = rect.x - dx - (1 - sx) * parseFloat(to);
const y = rect.y - dy - (1 - sy) * parseFloat(to.slice(to.indexOf(" ") + 1));
const w = sx ? rect.width / sx : el.offsetWidth;
const h = sy ? rect.height / sy : el.offsetHeight;
return {
x: x,
y: y,
width: w,
height: h,
top: y,
right: x + w,
bottom: y + h,
left: x
};
} else {
return rect;
}
}
/**
* Gets the absolute bounding rect (accounts for the window's scroll position and removes transforms)
* @param {HTMLElement} el
* @return {{top: number, left: number, bottom: number, right: number}}
*/
function getAbsoluteRectNoTransforms(el) {
const rect = getBoundingRectNoTransforms(el);
return {
top: rect.top + window.scrollY,
bottom: rect.bottom + window.scrollY,
left: rect.left + window.scrollX,
right: rect.right + window.scrollX
};
}
/**
* Gets the absolute bounding rect (accounts for the window's scroll position)
* @param {HTMLElement} el
* @return {{top: number, left: number, bottom: number, right: number}}
*/
function getAbsoluteRect(el) {
const rect = el.getBoundingClientRect();
return {
top: rect.top + window.scrollY,
bottom: rect.bottom + window.scrollY,
left: rect.left + window.scrollX,
right: rect.right + window.scrollX
};
}
/**
* finds the center :)
* @typedef {Object} Rect
* @property {number} top
* @property {number} bottom
* @property {number} left
* @property {number} right
* @param {Rect} rect
* @return {{x: number, y: number}}
*/
function findCenter(rect) {
return {
x: (rect.left + rect.right) / 2,
y: (rect.top + rect.bottom) / 2
};
}
/**
* @typedef {Object} Point
* @property {number} x
* @property {number} y
* @param {Point} pointA
* @param {Point} pointB
* @return {number}
*/
function calcDistance(pointA, pointB) {
return Math.sqrt(Math.pow(pointA.x - pointB.x, 2) + Math.pow(pointA.y - pointB.y, 2));
}
/**
* @param {Point} point
* @param {Rect} rect
* @return {boolean|boolean}
*/
function isPointInsideRect(point, rect) {
return point.y <= rect.bottom && point.y >= rect.top && point.x >= rect.left && point.x <= rect.right;
}
/**
* find the absolute coordinates of the center of a dom element
* @param el {HTMLElement}
* @returns {{x: number, y: number}}
*/
function findCenterOfElement(el) {
return findCenter(getAbsoluteRect(el));
}
/**
* @param {HTMLElement} elA
* @param {HTMLElement} elB
* @return {boolean}
*/
function isCenterOfAInsideB(elA, elB) {
const centerOfA = findCenterOfElement(elA);
const rectOfB = getAbsoluteRectNoTransforms(elB);
return isPointInsideRect(centerOfA, rectOfB);
}
/**
* @param {HTMLElement|ChildNode} elA
* @param {HTMLElement|ChildNode} elB
* @return {number}
*/
function calcDistanceBetweenCenters(elA, elB) {
const centerOfA = findCenterOfElement(elA);
const centerOfB = findCenterOfElement(elB);
return calcDistance(centerOfA, centerOfB);
}
/**
* @param {HTMLElement} el - the element to check
* @returns {boolean} - true if the element in its entirety is off screen including the scrollable area (the normal dom events look at the mouse rather than the element)
*/
function isElementOffDocument(el) {
const rect = getAbsoluteRect(el);
return rect.right < 0 || rect.left > document.documentElement.scrollWidth || rect.bottom < 0 || rect.top > document.documentElement.scrollHeight;
}
/**
* If the point is inside the element returns its distances from the sides, otherwise returns null
* @param {Point} point
* @param {HTMLElement} el
* @return {null|{top: number, left: number, bottom: number, right: number}}
*/
function calcInnerDistancesBetweenPointAndSidesOfElement(point, el) {
const rect = getAbsoluteRect(el);
if (!isPointInsideRect(point, rect)) {
return null;
}
return {
top: point.y - rect.top,
bottom: rect.bottom - point.y,
left: point.x - rect.left,
// TODO - figure out what is so special about right (why the rect is too big)
right: Math.min(rect.right, document.documentElement.clientWidth) - point.x
};
}
let dzToShadowIndexToRect;
/**
* Resets the cache that allows for smarter "would be index" resolution. Should be called after every drag operation
*/
function resetIndexesCache() {
dzToShadowIndexToRect = new Map();
}
resetIndexesCache();
/**
* Caches the coordinates of the shadow element when it's in a certain index in a certain dropzone.
* Helpful in order to determine "would be index" more effectively
* @param {HTMLElement} dz
* @return {number} - the shadow element index
*/
function cacheShadowRect(dz) {
const shadowElIndex = Array.from(dz.children).findIndex(child => child.getAttribute(SHADOW_ELEMENT_ATTRIBUTE_NAME));
if (shadowElIndex >= 0) {
if (!dzToShadowIndexToRect.has(dz)) {
dzToShadowIndexToRect.set(dz, new Map());
}
dzToShadowIndexToRect.get(dz).set(shadowElIndex, getAbsoluteRectNoTransforms(dz.children[shadowElIndex]));
return shadowElIndex;
}
return undefined;
}
/**
* @typedef {Object} Index
* @property {number} index - the would be index
* @property {boolean} isProximityBased - false if the element is actually over the index, true if it is not over it but this index is the closest
*/
/**
* Find the index for the dragged element in the list it is dragged over
* @param {HTMLElement} floatingAboveEl
* @param {HTMLElement} collectionBelowEl
* @returns {Index|null} - if the element is over the container the Index object otherwise null
*/
function findWouldBeIndex(floatingAboveEl, collectionBelowEl) {
if (!isCenterOfAInsideB(floatingAboveEl, collectionBelowEl)) {
return null;
}
const children = collectionBelowEl.children;
// the container is empty, floating element should be the first
if (children.length === 0) {
return {index: 0, isProximityBased: true};
}
const shadowElIndex = cacheShadowRect(collectionBelowEl);
// the search could be more efficient but keeping it simple for now
// a possible improvement: pass in the lastIndex it was found in and check there first, then expand from there
for (let i = 0; i < children.length; i++) {
if (isCenterOfAInsideB(floatingAboveEl, children[i])) {
const cachedShadowRect = dzToShadowIndexToRect.has(collectionBelowEl) && dzToShadowIndexToRect.get(collectionBelowEl).get(i);
if (cachedShadowRect) {
if (!isPointInsideRect(findCenterOfElement(floatingAboveEl), cachedShadowRect)) {
return {index: shadowElIndex, isProximityBased: false};
}
}
return {index: i, isProximityBased: false};
}
}
// this can happen if there is space around the children so the floating element has
//entered the container but not any of the children, in this case we will find the nearest child
let minDistanceSoFar = Number.MAX_VALUE;
let indexOfMin = undefined;
// we are checking all of them because we don't know whether we are dealing with a horizontal or vertical container and where the floating element entered from
for (let i = 0; i < children.length; i++) {
const distance = calcDistanceBetweenCenters(floatingAboveEl, children[i]);
if (distance < minDistanceSoFar) {
minDistanceSoFar = distance;
indexOfMin = i;
}
}
return {index: indexOfMin, isProximityBased: true};
}
const SCROLL_ZONE_PX = 25;
function makeScroller() {
let scrollingInfo;
function resetScrolling() {
scrollingInfo = {directionObj: undefined, stepPx: 0};
}
resetScrolling();
// directionObj {x: 0|1|-1, y:0|1|-1} - 1 means down in y and right in x
function scrollContainer(containerEl) {
const {directionObj, stepPx} = scrollingInfo;
if (directionObj) {
containerEl.scrollBy(directionObj.x * stepPx, directionObj.y * stepPx);
window.requestAnimationFrame(() => scrollContainer(containerEl));
}
}
function calcScrollStepPx(distancePx) {
return SCROLL_ZONE_PX - distancePx;
}
/**
* If the pointer is next to the sides of the element to scroll, will trigger scrolling
* Can be called repeatedly with updated pointer and elementToScroll values without issues
* @return {boolean} - true if scrolling was needed
*/
function scrollIfNeeded(pointer, elementToScroll) {
if (!elementToScroll) {
return false;
}
const distances = calcInnerDistancesBetweenPointAndSidesOfElement(pointer, elementToScroll);
if (distances === null) {
resetScrolling();
return false;
}
const isAlreadyScrolling = !!scrollingInfo.directionObj;
let [scrollingVertically, scrollingHorizontally] = [false, false];
// vertical
if (elementToScroll.scrollHeight > elementToScroll.clientHeight) {
if (distances.bottom < SCROLL_ZONE_PX) {
scrollingVertically = true;
scrollingInfo.directionObj = {x: 0, y: 1};
scrollingInfo.stepPx = calcScrollStepPx(distances.bottom);
} else if (distances.top < SCROLL_ZONE_PX) {
scrollingVertically = true;
scrollingInfo.directionObj = {x: 0, y: -1};
scrollingInfo.stepPx = calcScrollStepPx(distances.top);
}
if (!isAlreadyScrolling && scrollingVertically) {
scrollContainer(elementToScroll);
return true;
}
}
// horizontal
if (elementToScroll.scrollWidth > elementToScroll.clientWidth) {
if (distances.right < SCROLL_ZONE_PX) {
scrollingHorizontally = true;
scrollingInfo.directionObj = {x: 1, y: 0};
scrollingInfo.stepPx = calcScrollStepPx(distances.right);
} else if (distances.left < SCROLL_ZONE_PX) {
scrollingHorizontally = true;
scrollingInfo.directionObj = {x: -1, y: 0};
scrollingInfo.stepPx = calcScrollStepPx(distances.left);
}
if (!isAlreadyScrolling && scrollingHorizontally) {
scrollContainer(elementToScroll);
return true;
}
}
resetScrolling();
return false;
}
return {
scrollIfNeeded,
resetScrolling
};
}
/**
* @param {Object} object
* @return {string}
*/
function toString(object) {
return JSON.stringify(object, null, 2);
}
/**
* Finds the depth of the given node in the DOM tree
* @param {HTMLElement} node
* @return {number} - the depth of the node
*/
function getDepth(node) {
if (!node) {
throw new Error("cannot get depth of a falsy node");
}
return _getDepth(node, 0);
}
function _getDepth(node, countSoFar = 0) {
if (!node.parentElement) {
return countSoFar - 1;
}
return _getDepth(node.parentElement, countSoFar + 1);
}
/**
* A simple util to shallow compare objects quickly, it doesn't validate the arguments so pass objects in
* @param {Object} objA
* @param {Object} objB
* @return {boolean} - true if objA and objB are shallow equal
*/
function areObjectsShallowEqual(objA, objB) {
if (Object.keys(objA).length !== Object.keys(objB).length) {
return false;
}
for (const keyA in objA) {
if (!{}.hasOwnProperty.call(objB, keyA) || objB[keyA] !== objA[keyA]) {
return false;
}
}
return true;
}
/**
* Shallow compares two arrays
* @param arrA
* @param arrB
* @return {boolean} - whether the arrays are shallow equal
*/
function areArraysShallowEqualSameOrder(arrA, arrB) {
if (arrA.length !== arrB.length) {
return false;
}
for (let i = 0; i < arrA.length; i++) {
if (arrA[i] !== arrB[i]) {
return false;
}
}
return true;
}
const INTERVAL_MS$1 = 200;
const TOLERANCE_PX = 10;
const {scrollIfNeeded: scrollIfNeeded$1, resetScrolling: resetScrolling$1} = makeScroller();
let next$1;
/**
* Tracks the dragged elements and performs the side effects when it is dragged over a drop zone (basically dispatching custom-events scrolling)
* @param {Set${txt}
`; div.style.display = "none"; div.style.position = "fixed"; div.style.zIndex = "-5"; return div; } /** * Will make the screen reader alert the provided text to the user * @param {string} txt */ function alertToScreenReader(txt) { alertsDiv.innerHTML = ""; const alertText = document.createTextNode(txt); alertsDiv.appendChild(alertText); // this is needed for Safari alertsDiv.style.display = "none"; alertsDiv.style.display = "inline"; } const DEFAULT_DROP_ZONE_TYPE = "--any--"; const DEFAULT_DROP_TARGET_STYLE = { outline: "rgba(255, 255, 102, 0.7) solid 2px" }; let isDragging = false; let draggedItemType; let focusedDz; let focusedDzLabel = ""; let focusedItem; let focusedItemId; let focusedItemLabel = ""; const allDragTargets = new WeakSet(); const elToKeyDownListeners = new WeakMap(); const elToFocusListeners = new WeakMap(); const dzToHandles = new Map(); const dzToConfig = new Map(); const typeToDropZones = new Map(); /* TODO (potentially) * what's the deal with the black border of voice-reader not following focus? * maybe keep focus on the last dragged item upon drop? */ const INSTRUCTION_IDs = initAria(); /* drop-zones registration management */ function registerDropZone(dropZoneEl, type) { if (typeToDropZones.size === 0) { window.addEventListener("keydown", globalKeyDownHandler); window.addEventListener("click", globalClickHandler); } if (!typeToDropZones.has(type)) { typeToDropZones.set(type, new Set()); } if (!typeToDropZones.get(type).has(dropZoneEl)) { typeToDropZones.get(type).add(dropZoneEl); incrementActiveDropZoneCount(); } } function unregisterDropZone(dropZoneEl, type) { if (focusedDz === dropZoneEl) { handleDrop(); } typeToDropZones.get(type).delete(dropZoneEl); decrementActiveDropZoneCount(); if (typeToDropZones.get(type).size === 0) { typeToDropZones.delete(type); } if (typeToDropZones.size === 0) { window.removeEventListener("keydown", globalKeyDownHandler); window.removeEventListener("click", globalClickHandler); } } function globalKeyDownHandler(e) { if (!isDragging) return; switch (e.key) { case "Escape": { handleDrop(); break; } } } function globalClickHandler() { if (!isDragging) return; if (!allDragTargets.has(document.activeElement)) { handleDrop(); } } function handleZoneFocus(e) { if (!isDragging) return; const newlyFocusedDz = e.currentTarget; if (newlyFocusedDz === focusedDz) return; focusedDzLabel = newlyFocusedDz.getAttribute("aria-label") || ""; const {items: originItems} = dzToConfig.get(focusedDz); const originItem = originItems.find(item => item[ITEM_ID_KEY] === focusedItemId); const originIdx = originItems.indexOf(originItem); const itemToMove = originItems.splice(originIdx, 1)[0]; const {items: targetItems, autoAriaDisabled} = dzToConfig.get(newlyFocusedDz); if ( newlyFocusedDz.getBoundingClientRect().top < focusedDz.getBoundingClientRect().top || newlyFocusedDz.getBoundingClientRect().left < focusedDz.getBoundingClientRect().left ) { targetItems.push(itemToMove); if (!autoAriaDisabled) { alertToScreenReader(`Moved item ${focusedItemLabel} to the end of the list ${focusedDzLabel}`); } } else { targetItems.unshift(itemToMove); if (!autoAriaDisabled) { alertToScreenReader(`Moved item ${focusedItemLabel} to the beginning of the list ${focusedDzLabel}`); } } const dzFrom = focusedDz; dispatchFinalizeEvent(dzFrom, originItems, {trigger: TRIGGERS.DROPPED_INTO_ANOTHER, id: focusedItemId, source: SOURCES.KEYBOARD}); dispatchFinalizeEvent(newlyFocusedDz, targetItems, {trigger: TRIGGERS.DROPPED_INTO_ZONE, id: focusedItemId, source: SOURCES.KEYBOARD}); focusedDz = newlyFocusedDz; } function triggerAllDzsUpdate() { dzToHandles.forEach(({update}, dz) => update(dzToConfig.get(dz))); } function handleDrop(dispatchConsider = true) { if (!dzToConfig.get(focusedDz).autoAriaDisabled) { alertToScreenReader(`Stopped dragging item ${focusedItemLabel}`); } if (allDragTargets.has(document.activeElement)) { document.activeElement.blur(); } if (dispatchConsider) { dispatchConsiderEvent(focusedDz, dzToConfig.get(focusedDz).items, { trigger: TRIGGERS.DRAG_STOPPED, id: focusedItemId, source: SOURCES.KEYBOARD }); } styleInactiveDropZones( typeToDropZones.get(draggedItemType), dz => dzToConfig.get(dz).dropTargetStyle, dz => dzToConfig.get(dz).dropTargetClasses ); focusedItem = null; focusedItemId = null; focusedItemLabel = ""; draggedItemType = null; focusedDz = null; focusedDzLabel = ""; isDragging = false; triggerAllDzsUpdate(); } ////// function dndzone$1(node, options) { const config = { items: undefined, type: undefined, dragDisabled: false, dropFromOthersDisabled: false, dropTargetStyle: DEFAULT_DROP_TARGET_STYLE, dropTargetClasses: [], autoAriaDisabled: false }; function swap(arr, i, j) { if (arr.length <= 1) return; arr.splice(j, 1, arr.splice(i, 1, arr[j])[0]); } function handleKeyDown(e) { switch (e.key) { case "Enter": case " ": { // we don't want to affect nested input elements or clickable elements if ((e.target.disabled !== undefined || e.target.href || e.target.isContentEditable) && !allDragTargets.has(e.target)) { return; } e.preventDefault(); // preventing scrolling on spacebar e.stopPropagation(); if (isDragging) { // TODO - should this trigger a drop? only here or in general (as in when hitting space or enter outside of any zone)? handleDrop(); } else { // drag start handleDragStart(e); } break; } case "ArrowDown": case "ArrowRight": { if (!isDragging) return; e.preventDefault(); // prevent scrolling e.stopPropagation(); const {items} = dzToConfig.get(node); const children = Array.from(node.children); const idx = children.indexOf(e.currentTarget); if (idx < children.length - 1) { if (!config.autoAriaDisabled) { alertToScreenReader(`Moved item ${focusedItemLabel} to position ${idx + 2} in the list ${focusedDzLabel}`); } swap(items, idx, idx + 1); dispatchFinalizeEvent(node, items, {trigger: TRIGGERS.DROPPED_INTO_ZONE, id: focusedItemId, source: SOURCES.KEYBOARD}); } break; } case "ArrowUp": case "ArrowLeft": { if (!isDragging) return; e.preventDefault(); // prevent scrolling e.stopPropagation(); const {items} = dzToConfig.get(node); const children = Array.from(node.children); const idx = children.indexOf(e.currentTarget); if (idx > 0) { if (!config.autoAriaDisabled) { alertToScreenReader(`Moved item ${focusedItemLabel} to position ${idx} in the list ${focusedDzLabel}`); } swap(items, idx, idx - 1); dispatchFinalizeEvent(node, items, {trigger: TRIGGERS.DROPPED_INTO_ZONE, id: focusedItemId, source: SOURCES.KEYBOARD}); } break; } } } function handleDragStart(e) { setCurrentFocusedItem(e.currentTarget); focusedDz = node; draggedItemType = config.type; isDragging = true; const dropTargets = Array.from(typeToDropZones.get(config.type)).filter(dz => dz === focusedDz || !dzToConfig.get(dz).dropFromOthersDisabled); styleActiveDropZones( dropTargets, dz => dzToConfig.get(dz).dropTargetStyle, dz => dzToConfig.get(dz).dropTargetClasses ); if (!config.autoAriaDisabled) { let msg = `Started dragging item ${focusedItemLabel}. Use the arrow keys to move it within its list ${focusedDzLabel}`; if (dropTargets.length > 1) { msg += `, or tab to another list in order to move the item into it`; } alertToScreenReader(msg); } dispatchConsiderEvent(node, dzToConfig.get(node).items, {trigger: TRIGGERS.DRAG_STARTED, id: focusedItemId, source: SOURCES.KEYBOARD}); triggerAllDzsUpdate(); } function handleClick(e) { if (!isDragging) return; if (e.currentTarget === focusedItem) return; e.stopPropagation(); handleDrop(false); handleDragStart(e); } function setCurrentFocusedItem(draggableEl) { const {items} = dzToConfig.get(node); const children = Array.from(node.children); const focusedItemIdx = children.indexOf(draggableEl); focusedItem = draggableEl; focusedItem.tabIndex = 0; focusedItemId = items[focusedItemIdx][ITEM_ID_KEY]; focusedItemLabel = children[focusedItemIdx].getAttribute("aria-label") || ""; } function configure({ items = [], type: newType = DEFAULT_DROP_ZONE_TYPE, dragDisabled = false, dropFromOthersDisabled = false, dropTargetStyle = DEFAULT_DROP_TARGET_STYLE, dropTargetClasses = [], autoAriaDisabled = false }) { config.items = [...items]; config.dragDisabled = dragDisabled; config.dropFromOthersDisabled = dropFromOthersDisabled; config.dropTargetStyle = dropTargetStyle; config.dropTargetClasses = dropTargetClasses; config.autoAriaDisabled = autoAriaDisabled; if (!autoAriaDisabled) { node.setAttribute("aria-disabled", dragDisabled); node.setAttribute("role", "list"); node.setAttribute("aria-describedby", dragDisabled ? INSTRUCTION_IDs.DND_ZONE_DRAG_DISABLED : INSTRUCTION_IDs.DND_ZONE_ACTIVE); } if (config.type && newType !== config.type) { unregisterDropZone(node, config.type); } config.type = newType; registerDropZone(node, newType); dzToConfig.set(node, config); node.tabIndex = isDragging && (node === focusedDz || focusedItem.contains(node) || config.dropFromOthersDisabled || (focusedDz && config.type !== dzToConfig.get(focusedDz).type)) ? -1 : 0; node.addEventListener("focus", handleZoneFocus); for (let i = 0; i < node.children.length; i++) { const draggableEl = node.children[i]; allDragTargets.add(draggableEl); draggableEl.tabIndex = isDragging ? -1 : 0; if (!autoAriaDisabled) { draggableEl.setAttribute("role", "listitem"); } draggableEl.removeEventListener("keydown", elToKeyDownListeners.get(draggableEl)); draggableEl.removeEventListener("click", elToFocusListeners.get(draggableEl)); if (!dragDisabled) { draggableEl.addEventListener("keydown", handleKeyDown); elToKeyDownListeners.set(draggableEl, handleKeyDown); draggableEl.addEventListener("click", handleClick); elToFocusListeners.set(draggableEl, handleClick); } if (isDragging && config.items[i][ITEM_ID_KEY] === focusedItemId) { // if it is a nested dropzone, it was re-rendered and we need to refresh our pointer focusedItem = draggableEl; focusedItem.tabIndex = 0; // without this the element loses focus if it moves backwards in the list draggableEl.focus(); } } } configure(options); const handles = { update: newOptions => { configure(newOptions); }, destroy: () => { unregisterDropZone(node, config.type); dzToConfig.delete(node); dzToHandles.delete(node); } }; dzToHandles.set(node, handles); return handles; } /** * A custom action to turn any container to a dnd zone and all of its direct children to draggables * Supports mouse, touch and keyboard interactions. * Dispatches two events that the container is expected to react to by modifying its list of items, * which will then feed back in to this action via the update function * * @typedef {object} Options * @property {array} items - the list of items that was used to generate the children of the given node (the list used in the #each block * @property {string} [type] - the type of the dnd zone. children dragged from here can only be dropped in other zones of the same type, default to a base type * @property {number} [flipDurationMs] - if the list animated using flip (recommended), specifies the flip duration such that everything syncs with it without conflict, defaults to zero * @property {boolean} [dragDisabled] * @property {boolean} [morphDisabled] - whether dragged element should morph to zone dimensions * @property {boolean} [dropFromOthersDisabled] * @property {object} [dropTargetStyle] * @property {string[]} [dropTargetClasses] * @property {function} [transformDraggedElement] * @param {HTMLElement} node - the element to enhance * @param {Options} options * @return {{update: function, destroy: function}} */ function dndzone(node, options) { validateOptions(options); const pointerZone = dndzone$2(node, options); const keyboardZone = dndzone$1(node, options); return { update: newOptions => { validateOptions(newOptions); pointerZone.update(newOptions); keyboardZone.update(newOptions); }, destroy: () => { pointerZone.destroy(); keyboardZone.destroy(); } }; } function validateOptions(options) { /*eslint-disable*/ const { items, flipDurationMs, type, dragDisabled, morphDisabled, dropFromOthersDisabled, dropTargetStyle, dropTargetClasses, transformDraggedElement, autoAriaDisabled, centreDraggedOnCursor, ...rest } = options; /*eslint-enable*/ if (Object.keys(rest).length > 0) { console.warn(`dndzone will ignore unknown options`, rest); } if (!items) { throw new Error("no 'items' key provided to dndzone"); } const itemWithMissingId = items.find(item => !{}.hasOwnProperty.call(item, ITEM_ID_KEY)); if (itemWithMissingId) { throw new Error(`missing '${ITEM_ID_KEY}' property for item ${toString(itemWithMissingId)}`); } if (dropTargetClasses && !Array.isArray(dropTargetClasses)) { throw new Error(`dropTargetClasses should be an array but instead it is a ${typeof dropTargetClasses}, ${toString(dropTargetClasses)}`); } } /* src/ui/settings/DragHandle.svelte generated by Svelte v3.37.0 */ function add_css$4() { var style = element$1("style"); style.id = "svelte-m1gtpn-style"; style.textContent = ".handle.svelte-m1gtpn.svelte-m1gtpn{color:var(--background-modifier-border);height:16px;margin-right:8px;width:16px}.active .handle.svelte-m1gtpn.svelte-m1gtpn{color:var(--text-accent-hover)}.handle.svelte-m1gtpn svg.svelte-m1gtpn{width:16px;height:16px}"; append$1(document.head, style); } function create_fragment$8(ctx) { let div; let svg; let circle0; let circle1; let circle2; let circle3; let circle4; let circle5; let div_style_value; let mounted; let dispose; return { c() { div = element$1("div"); svg = svg_element$1("svg"); circle0 = svg_element$1("circle"); circle1 = svg_element$1("circle"); circle2 = svg_element$1("circle"); circle3 = svg_element$1("circle"); circle4 = svg_element$1("circle"); circle5 = svg_element$1("circle"); attr$1(circle0, "cx", "3.13232"); attr$1(circle0, "cy", "3.64536"); attr$1(circle0, "r", "3"); attr$1(circle0, "fill", "currentColor"); attr$1(circle1, "cx", "13.167"); attr$1(circle1, "cy", "3.64536"); attr$1(circle1, "r", "3"); attr$1(circle1, "fill", "currentColor"); attr$1(circle2, "cx", "3.13232"); attr$1(circle2, "cy", "15.8953"); attr$1(circle2, "r", "3"); attr$1(circle2, "fill", "currentColor"); attr$1(circle3, "cx", "13.167"); attr$1(circle3, "cy", "15.8953"); attr$1(circle3, "r", "3"); attr$1(circle3, "fill", "currentColor"); attr$1(circle4, "cx", "3.13232"); attr$1(circle4, "cy", "28.1452"); attr$1(circle4, "r", "3"); attr$1(circle4, "fill", "currentColor"); attr$1(circle5, "cx", "13.167"); attr$1(circle5, "cy", "28.1452"); attr$1(circle5, "r", "3"); attr$1(circle5, "fill", "currentColor"); attr$1(svg, "fill", "none"); attr$1(svg, "height", "32"); attr$1(svg, "viewBox", "0 0 17 32"); attr$1(svg, "width", "17"); attr$1(svg, "xmlns", "http://www.w3.org/2000/svg"); attr$1(svg, "class", "svelte-m1gtpn"); attr$1(div, "aria-label", "Drag to rearrange"); attr$1(div, "style", div_style_value = /*dragDisabled*/ ctx[0] ? "cursor: grab" : "cursor: grabbing"); attr$1(div, "class", "handle svelte-m1gtpn"); }, m(target, anchor) { insert$1(target, div, anchor); append$1(div, svg); append$1(svg, circle0); append$1(svg, circle1); append$1(svg, circle2); append$1(svg, circle3); append$1(svg, circle4); append$1(svg, circle5); if (!mounted) { dispose = [ listen$1(div, "mousedown", function () { if (is_function$1(/*startDrag*/ ctx[1])) /*startDrag*/ ctx[1].apply(this, arguments); }), listen$1(div, "touchstart", function () { if (is_function$1(/*startDrag*/ ctx[1])) /*startDrag*/ ctx[1].apply(this, arguments); }), listen$1(div, "keydown", function () { if (is_function$1(/*handleKeyDown*/ ctx[2])) /*handleKeyDown*/ ctx[2].apply(this, arguments); }) ]; mounted = true; } }, p(new_ctx, [dirty]) { ctx = new_ctx; if (dirty & /*dragDisabled*/ 1 && div_style_value !== (div_style_value = /*dragDisabled*/ ctx[0] ? "cursor: grab" : "cursor: grabbing")) { attr$1(div, "style", div_style_value); } }, i: noop$1, o: noop$1, d(detaching) { if (detaching) detach$1(div); mounted = false; run_all$1(dispose); } }; } function instance$8($$self, $$props, $$invalidate) { let { dragDisabled } = $$props; let { startDrag } = $$props; let { handleKeyDown } = $$props; $$self.$$set = $$props => { if ("dragDisabled" in $$props) $$invalidate(0, dragDisabled = $$props.dragDisabled); if ("startDrag" in $$props) $$invalidate(1, startDrag = $$props.startDrag); if ("handleKeyDown" in $$props) $$invalidate(2, handleKeyDown = $$props.handleKeyDown); }; return [dragDisabled, startDrag, handleKeyDown]; } class DragHandle extends SvelteComponent$1 { constructor(options) { super(); if (!document.getElementById("svelte-m1gtpn-style")) add_css$4(); init$1(this, options, instance$8, create_fragment$8, safe_not_equal$1, { dragDisabled: 0, startDrag: 1, handleKeyDown: 2 }); } } /* eslint-disable */ function clickOutside(node, onEventFunction) { const handleClick = (event) => { var path = event.composedPath(); if (!path.includes(node)) { onEventFunction(); } }; document.addEventListener("click", handleClick); return { destroy() { document.removeEventListener("click", handleClick); }, }; } /* eslint-enable */ const colors = { Gruvbox: [ [ { value: "#282828", name: "dark0" }, { value: "#32302f", name: "dark0-soft" }, { value: "#3c3836", name: "dark1" }, { value: "#504945", name: "dark2" }, { value: "#665c54", name: "dark3" }, { value: "#7c6f64", name: "dark4" }, { value: "#928374", name: "gray" }, { value: "#f9f5d7", name: "light0-hard" }, { value: "#fbf1c7", name: "light0" }, { value: "#f2e5bc", name: "light0-soft" }, { value: "#ebdbb2", name: "light1" }, { value: "#d5c4a1", name: "light2" }, { value: "#bdae93", name: "light3" }, { value: "#a89984", name: "light4" }, ], [ { name: "bright-red", value: "#fb4934" }, { name: "bright-green", value: "#b8bb26" }, { name: "bright-yellow", value: "#fabd2f" }, { name: "bright-blue", value: "#83a598" }, { name: "bright-purple", value: "#d3869b" }, { name: "bright-aqua", value: "#8ec07c" }, { name: "bright-orange", value: "#fe8019" }, ], [ { name: "neutral-red", value: "#cc241d" }, { name: "neutral-green", value: "#98971a" }, { name: "neutral-yellow", value: "#d79921" }, { name: "neutral-blue", value: "#458588" }, { name: "neutral-purple", value: "#b16286" }, { name: "neutral-aqua", value: "#689d6a" }, { name: "neutral-orange", value: "#d65d0e" }, ], [ { name: "faded-red", value: "#9d0006" }, { name: "faded-green", value: "#79740e" }, { name: "faded-yellow", value: "#b57614" }, { name: "faded-blue", value: "#076678" }, { name: "faded-purple", value: "#8f3f71" }, { name: "faded-aqua", value: "#427b58" }, { name: "faded-orange", value: "#af3a03" }, ], ], Nord: [ [ { value: "#2e3440", name: "Gunmetal" }, { value: "#3b4252", name: "Bright Gray" }, { value: "#434c5e", name: "River Bed" }, { value: "#4c566a", name: "Easy Bay" }, { value: "#d8dee9", name: "Hawkes Blue" }, { value: "#e5e9f0", name: "Mystic" }, { value: "#eceff4", name: "Athens Gray" }, ], [ { value: "#bf616a", name: "Contessa" }, { value: "#d08770", name: "Feldspar" }, { value: "#ebcb8b", name: "Putty" }, { value: "#a3be8c", name: "Norway" }, { value: "#b48ead", name: "London Hue" }, ], [ { value: "#8fbcbb", name: "Shadow Green" }, { value: "#88c0d0", name: "Half Baked" }, { value: "#81a1c1", name: "Dark Pastel Blue" }, { value: "#5e81ac", name: "Air Force Blue" }, ], [ { value: "#292e39", name: "Black Rock" }, { value: "#abb9cf", name: "Casper" }, ], ], Default: [ [ { value: "#197300", name: "Japanese Laurel" }, { value: "#483699", name: "Blue Gem" }, { value: "#7f6df2", name: "Medium Slate Blue" }, { value: "#990000", name: "Ou Crimson Red" }, { value: "#2a2a2a", name: "Jaguar" }, { value: "#303030", name: "Code Gray" }, { value: "#333333", name: "Mineshaft" }, { value: "#4d3ca6", name: "Gigas" }, { value: "#666666", name: "Steel" }, { value: "#999999", name: "Aluminium" }, { value: "#DCDDDE", name: "Athens Gray" }, { value: "#FF3333", name: "Red Orange" }, { value: "#FF999040", name: "Mona Lisa 40%" }, { value: "#FFFF0040", name: "Yellow 40%" }, ], ], Minimal: [ [ { value: "#ffffff", name: "White" }, { value: "#d4d4d4", name: "Light Gray" }, { value: "#556b77", name: "Dark Electric Blue" }, { value: "#5c5c5c", name: "Chicago" }, { value: "#414141", name: "Charcoal" }, { value: "#1d1d1d", name: "Dark Jungle Green" }, ], [{ value: "#fc3233", name: "Red Orange" }], ], "Clair de Lune": [ [ { name: "background-secondary", value: "#1e2030" }, { name: "background-tag", value: "#131421" }, { name: "background-quick", value: "#191a2a" }, ], [ { name: "interactive-hover", value: "#2f334d" }, { name: "interactive-accent", value: "#444a73" }, { name: "interactive-accent-hover", value: "#828bb8" }, { name: "text-accent", value: "#50c4fa" }, { name: "text-muted", value: "#a9b8e8" }, { name: "text-normal", value: "#c8d3f5" }, { name: "text-on-accent", value: "#e2e8fa" }, { name: "text-tag", value: "#7a88cf" }, { name: "text-error", value: "#ff98a4" }, ], ], }; function getPaletteNames() { return Object.keys(colors); } function getPaletteName(themeName) { const palette = colors[themeName]; // Exact match if (palette) { return themeName; } // Partial matches if (themeName.toLowerCase().contains("gruvbox")) { return "Gruvbox"; } if (themeName.toLowerCase().contains("nord") || themeName.toLowerCase().contains("stormcloak")) { return "Nord"; } return "Default"; } function getColors(paletteName) { return colors[paletteName]; } /* src/ui/settings/palette/Palette.svelte generated by Svelte v3.37.0 */ function add_css$3() { var style = element$1("style"); style.id = "svelte-1d1m25g-style"; style.textContent = ".container.svelte-1d1m25g{display:flex;flex-direction:column;gap:8px}.palette-bottom-bar.svelte-1d1m25g{display:flex;gap:8px;margin-top:8px}.palette-dropdown.svelte-1d1m25g{background-color:var(--background-primary);font-size:14px;padding:0.3em 1.5em 0.3em 0.8em}.hex-input.svelte-1d1m25g{font-size:14px;background-color:var(--background-primary);width:100%}.palette.svelte-1d1m25g{display:flex;gap:8px;flex-wrap:wrap;flex-direction:row}.is-mobile .palette.svelte-1d1m25g{gap:12px}.opacity-grid.svelte-1d1m25g,.swatch.svelte-1d1m25g{border:1px solid var(--background-modifier-border);border-radius:50%;cursor:pointer;display:flex;height:24px;width:24px}.is-mobile .opacity-grid.svelte-1d1m25g,.is-mobile .swatch.svelte-1d1m25g{height:36px;width:36px}.swatch.svelte-1d1m25g{position:absolute}.swatch.svelte-1d1m25g:hover{border:1px solid var(--text-muted)}.opacity-grid.svelte-1d1m25g{background-image:linear-gradient(45deg, #808080 25%, transparent 25%),\n linear-gradient(-45deg, #808080 25%, transparent 25%),\n linear-gradient(45deg, transparent 75%, #808080 75%),\n linear-gradient(-45deg, transparent 75%, #808080 75%);background-size:10px 10px;background-position:0 0, 0 5px, 5px -5px, -5px 0px;border-radius:50%;border:none;position:relative}.swatch.selected.svelte-1d1m25g{border:2px solid var(--text-normal)}"; append$1(document.head, style); } function get_each_context$2(ctx, list, i) { const child_ctx = ctx.slice(); child_ctx[11] = list[i]; return child_ctx; } function get_each_context_1$1(ctx, list, i) { const child_ctx = ctx.slice(); child_ctx[14] = list[i]; return child_ctx; } function get_each_context_2(ctx, list, i) { const child_ctx = ctx.slice(); child_ctx[17] = list[i].value; child_ctx[18] = list[i].name; return child_ctx; } // (23:6) {#each palette as { value: hex, name }} function create_each_block_2(ctx) { let div1; let div0; let div0_aria_label_value; let mounted; let dispose; function click_handler() { return /*click_handler*/ ctx[6](/*hex*/ ctx[17]); } return { c() { div1 = element$1("div"); div0 = element$1("div"); attr$1(div0, "aria-label", div0_aria_label_value = /*name*/ ctx[18]); attr$1(div0, "class", "swatch svelte-1d1m25g"); set_style$1(div0, "background-color", /*hex*/ ctx[17]); toggle_class$1(div0, "selected", /*hex*/ ctx[17] === /*value*/ ctx[0]); attr$1(div1, "class", "opacity-grid svelte-1d1m25g"); }, m(target, anchor) { insert$1(target, div1, anchor); append$1(div1, div0); if (!mounted) { dispose = listen$1(div0, "click", stop_propagation(click_handler)); mounted = true; } }, p(new_ctx, dirty) { ctx = new_ctx; if (dirty & /*swatches*/ 4 && div0_aria_label_value !== (div0_aria_label_value = /*name*/ ctx[18])) { attr$1(div0, "aria-label", div0_aria_label_value); } if (dirty & /*swatches*/ 4) { set_style$1(div0, "background-color", /*hex*/ ctx[17]); } if (dirty & /*swatches, value*/ 5) { toggle_class$1(div0, "selected", /*hex*/ ctx[17] === /*value*/ ctx[0]); } }, d(detaching) { if (detaching) detach$1(div1); mounted = false; dispose(); } }; } // (21:2) {#each swatches as palette} function create_each_block_1$1(ctx) { let div; let each_value_2 = /*palette*/ ctx[14]; let each_blocks = []; for (let i = 0; i < each_value_2.length; i += 1) { each_blocks[i] = create_each_block_2(get_each_context_2(ctx, each_value_2, i)); } return { c() { div = element$1("div"); for (let i = 0; i < each_blocks.length; i += 1) { each_blocks[i].c(); } attr$1(div, "class", "palette svelte-1d1m25g"); }, m(target, anchor) { insert$1(target, div, anchor); for (let i = 0; i < each_blocks.length; i += 1) { each_blocks[i].m(div, null); } }, p(ctx, dirty) { if (dirty & /*swatches, value, selectSwatch*/ 13) { each_value_2 = /*palette*/ ctx[14]; let i; for (i = 0; i < each_value_2.length; i += 1) { const child_ctx = get_each_context_2(ctx, each_value_2, i); if (each_blocks[i]) { each_blocks[i].p(child_ctx, dirty); } else { each_blocks[i] = create_each_block_2(child_ctx); each_blocks[i].c(); each_blocks[i].m(div, null); } } for (; i < each_blocks.length; i += 1) { each_blocks[i].d(1); } each_blocks.length = each_value_2.length; } }, d(detaching) { if (detaching) detach$1(div); destroy_each$1(each_blocks, detaching); } }; } // (38:6) {#each getPaletteNames() as paletteOption} function create_each_block$2(ctx) { let option; let t0_value = /*paletteOption*/ ctx[11] + ""; let t0; let t1; return { c() { option = element$1("option"); t0 = text$1(t0_value); t1 = text$1(" palette"); option.__value = /*paletteOption*/ ctx[11]; option.value = option.__value; }, m(target, anchor) { insert$1(target, option, anchor); append$1(option, t0); append$1(option, t1); }, p: noop$1, d(detaching) { if (detaching) detach$1(option); } }; } function create_fragment$7(ctx) { let div1; let t0; let div0; let select; let t1; let input; let mounted; let dispose; let each_value_1 = /*swatches*/ ctx[2]; let each_blocks_1 = []; for (let i = 0; i < each_value_1.length; i += 1) { each_blocks_1[i] = create_each_block_1$1(get_each_context_1$1(ctx, each_value_1, i)); } let each_value = getPaletteNames(); let each_blocks = []; for (let i = 0; i < each_value.length; i += 1) { each_blocks[i] = create_each_block$2(get_each_context$2(ctx, each_value, i)); } return { c() { div1 = element$1("div"); for (let i = 0; i < each_blocks_1.length; i += 1) { each_blocks_1[i].c(); } t0 = space$1(); div0 = element$1("div"); select = element$1("select"); for (let i = 0; i < each_blocks.length; i += 1) { each_blocks[i].c(); } t1 = space$1(); input = element$1("input"); attr$1(select, "class", "dropdown palette-dropdown svelte-1d1m25g"); if (/*activePalette*/ ctx[1] === void 0) add_render_callback$1(() => /*select_change_handler*/ ctx[7].call(select)); attr$1(input, "class", "hex-input svelte-1d1m25g"); attr$1(input, "type", "text"); attr$1(div0, "class", "palette-bottom-bar svelte-1d1m25g"); attr$1(div1, "class", "container svelte-1d1m25g"); }, m(target, anchor) { insert$1(target, div1, anchor); for (let i = 0; i < each_blocks_1.length; i += 1) { each_blocks_1[i].m(div1, null); } append$1(div1, t0); append$1(div1, div0); append$1(div0, select); for (let i = 0; i < each_blocks.length; i += 1) { each_blocks[i].m(select, null); } select_option(select, /*activePalette*/ ctx[1]); append$1(div0, t1); append$1(div0, input); set_input_value(input, /*value*/ ctx[0]); if (!mounted) { dispose = [ listen$1(select, "change", /*select_change_handler*/ ctx[7]), listen$1(input, "input", /*input_input_handler*/ ctx[8]) ]; mounted = true; } }, p(ctx, [dirty]) { if (dirty & /*swatches, value, selectSwatch*/ 13) { each_value_1 = /*swatches*/ ctx[2]; let i; for (i = 0; i < each_value_1.length; i += 1) { const child_ctx = get_each_context_1$1(ctx, each_value_1, i); if (each_blocks_1[i]) { each_blocks_1[i].p(child_ctx, dirty); } else { each_blocks_1[i] = create_each_block_1$1(child_ctx); each_blocks_1[i].c(); each_blocks_1[i].m(div1, t0); } } for (; i < each_blocks_1.length; i += 1) { each_blocks_1[i].d(1); } each_blocks_1.length = each_value_1.length; } if (dirty & /*getPaletteNames*/ 0) { each_value = getPaletteNames(); let i; for (i = 0; i < each_value.length; i += 1) { const child_ctx = get_each_context$2(ctx, each_value, i); if (each_blocks[i]) { each_blocks[i].p(child_ctx, dirty); } else { each_blocks[i] = create_each_block$2(child_ctx); each_blocks[i].c(); each_blocks[i].m(select, null); } } for (; i < each_blocks.length; i += 1) { each_blocks[i].d(1); } each_blocks.length = each_value.length; } if (dirty & /*activePalette, getPaletteNames*/ 2) { select_option(select, /*activePalette*/ ctx[1]); } if (dirty & /*value*/ 1 && input.value !== /*value*/ ctx[0]) { set_input_value(input, /*value*/ ctx[0]); } }, i: noop$1, o: noop$1, d(detaching) { if (detaching) detach$1(div1); destroy_each$1(each_blocks_1, detaching); destroy_each$1(each_blocks, detaching); mounted = false; run_all$1(dispose); } }; } function instance$7($$self, $$props, $$invalidate) { let { value } = $$props; let { close } = $$props; let { setValue } = $$props; // eslint-disable-next-line @typescript-eslint/no-explicit-any const theme = window.app.customCss.theme; let activePalette = getPaletteName(theme); let swatches; const dispatch = createEventDispatcher$1(); function selectSwatch(swatch) { $$invalidate(0, value = swatch); dispatch("input", swatch); setValue === null || setValue === void 0 ? void 0 : setValue(swatch); close(); } const click_handler = hex => selectSwatch(hex); function select_change_handler() { activePalette = select_value(this); $$invalidate(1, activePalette); } function input_input_handler() { value = this.value; $$invalidate(0, value); } $$self.$$set = $$props => { if ("value" in $$props) $$invalidate(0, value = $$props.value); if ("close" in $$props) $$invalidate(4, close = $$props.close); if ("setValue" in $$props) $$invalidate(5, setValue = $$props.setValue); }; $$self.$$.update = () => { if ($$self.$$.dirty & /*activePalette*/ 2) { $$invalidate(2, swatches = getColors(activePalette)); } }; return [ value, activePalette, swatches, selectSwatch, close, setValue, click_handler, select_change_handler, input_input_handler ]; } class Palette extends SvelteComponent$1 { constructor(options) { super(); if (!document.getElementById("svelte-1d1m25g-style")) add_css$3(); init$1(this, options, instance$7, create_fragment$7, safe_not_equal$1, { value: 0, close: 4, setValue: 5 }); } } var top = 'top'; var bottom = 'bottom'; var right = 'right'; var left = 'left'; var auto = 'auto'; var basePlacements = [top, bottom, right, left]; var start = 'start'; var end = 'end'; var clippingParents = 'clippingParents'; var viewport = 'viewport'; var popper = 'popper'; var reference = 'reference'; var variationPlacements = /*#__PURE__*/basePlacements.reduce(function (acc, placement) { return acc.concat([placement + "-" + start, placement + "-" + end]); }, []); var placements = /*#__PURE__*/[].concat(basePlacements, [auto]).reduce(function (acc, placement) { return acc.concat([placement, placement + "-" + start, placement + "-" + end]); }, []); // modifiers that need to read the DOM var beforeRead = 'beforeRead'; var read = 'read'; var afterRead = 'afterRead'; // pure-logic modifiers var beforeMain = 'beforeMain'; var main = 'main'; var afterMain = 'afterMain'; // modifier with the purpose to write to the DOM (or write into a framework state) var beforeWrite = 'beforeWrite'; var write = 'write'; var afterWrite = 'afterWrite'; var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite]; function getNodeName(element) { return element ? (element.nodeName || '').toLowerCase() : null; } function getWindow(node) { if (node == null) { return window; } if (node.toString() !== '[object Window]') { var ownerDocument = node.ownerDocument; return ownerDocument ? ownerDocument.defaultView || window : window; } return node; } function isElement(node) { var OwnElement = getWindow(node).Element; return node instanceof OwnElement || node instanceof Element; } function isHTMLElement(node) { var OwnElement = getWindow(node).HTMLElement; return node instanceof OwnElement || node instanceof HTMLElement; } function isShadowRoot(node) { // IE 11 has no ShadowRoot if (typeof ShadowRoot === 'undefined') { return false; } var OwnElement = getWindow(node).ShadowRoot; return node instanceof OwnElement || node instanceof ShadowRoot; } // and applies them to the HTMLElements such as popper and arrow function applyStyles(_ref) { var state = _ref.state; Object.keys(state.elements).forEach(function (name) { var style = state.styles[name] || {}; var attributes = state.attributes[name] || {}; var element = state.elements[name]; // arrow is optional + virtual elements if (!isHTMLElement(element) || !getNodeName(element)) { return; } // Flow doesn't support to extend this property, but it's the most // effective way to apply styles to an HTMLElement // $FlowFixMe[cannot-write] Object.assign(element.style, style); Object.keys(attributes).forEach(function (name) { var value = attributes[name]; if (value === false) { element.removeAttribute(name); } else { element.setAttribute(name, value === true ? '' : value); } }); }); } function effect$2(_ref2) { var state = _ref2.state; var initialStyles = { popper: { position: state.options.strategy, left: '0', top: '0', margin: '0' }, arrow: { position: 'absolute' }, reference: {} }; Object.assign(state.elements.popper.style, initialStyles.popper); state.styles = initialStyles; if (state.elements.arrow) { Object.assign(state.elements.arrow.style, initialStyles.arrow); } return function () { Object.keys(state.elements).forEach(function (name) { var element = state.elements[name]; var attributes = state.attributes[name] || {}; var styleProperties = Object.keys(state.styles.hasOwnProperty(name) ? state.styles[name] : initialStyles[name]); // Set all values to an empty string to unset them var style = styleProperties.reduce(function (style, property) { style[property] = ''; return style; }, {}); // arrow is optional + virtual elements if (!isHTMLElement(element) || !getNodeName(element)) { return; } Object.assign(element.style, style); Object.keys(attributes).forEach(function (attribute) { element.removeAttribute(attribute); }); }); }; } // eslint-disable-next-line import/no-unused-modules var applyStyles$1 = { name: 'applyStyles', enabled: true, phase: 'write', fn: applyStyles, effect: effect$2, requires: ['computeStyles'] }; function getBasePlacement(placement) { return placement.split('-')[0]; } function getBoundingClientRect(element) { var rect = element.getBoundingClientRect(); return { width: rect.width, height: rect.height, top: rect.top, right: rect.right, bottom: rect.bottom, left: rect.left, x: rect.left, y: rect.top }; } // means it doesn't take into account transforms. function getLayoutRect(element) { var clientRect = getBoundingClientRect(element); // Use the clientRect sizes if it's not been transformed. // Fixes https://github.com/popperjs/popper-core/issues/1223 var width = element.offsetWidth; var height = element.offsetHeight; if (Math.abs(clientRect.width - width) <= 1) { width = clientRect.width; } if (Math.abs(clientRect.height - height) <= 1) { height = clientRect.height; } return { x: element.offsetLeft, y: element.offsetTop, width: width, height: height }; } function contains(parent, child) { var rootNode = child.getRootNode && child.getRootNode(); // First, attempt with faster native method if (parent.contains(child)) { return true; } // then fallback to custom implementation with Shadow DOM support else if (rootNode && isShadowRoot(rootNode)) { var next = child; do { if (next && parent.isSameNode(next)) { return true; } // $FlowFixMe[prop-missing]: need a better way to handle this... next = next.parentNode || next.host; } while (next); } // Give up, the result is false return false; } function getComputedStyle$1(element) { return getWindow(element).getComputedStyle(element); } function isTableElement(element) { return ['table', 'td', 'th'].indexOf(getNodeName(element)) >= 0; } function getDocumentElement(element) { // $FlowFixMe[incompatible-return]: assume body is always available return ((isElement(element) ? element.ownerDocument : // $FlowFixMe[prop-missing] element.document) || window.document).documentElement; } function getParentNode(element) { if (getNodeName(element) === 'html') { return element; } return (// this is a quicker (but less type safe) way to save quite some bytes from the bundle // $FlowFixMe[incompatible-return] // $FlowFixMe[prop-missing] element.assignedSlot || // step into the shadow DOM of the parent of a slotted node element.parentNode || ( // DOM Element detected isShadowRoot(element) ? element.host : null) || // ShadowRoot detected // $FlowFixMe[incompatible-call]: HTMLElement is a Node getDocumentElement(element) // fallback ); } function getTrueOffsetParent(element) { if (!isHTMLElement(element) || // https://github.com/popperjs/popper-core/issues/837 getComputedStyle$1(element).position === 'fixed') { return null; } return element.offsetParent; } // `.offsetParent` reports `null` for fixed elements, while absolute elements // return the containing block function getContainingBlock(element) { var isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') !== -1; var isIE = navigator.userAgent.indexOf('Trident') !== -1; if (isIE && isHTMLElement(element)) { // In IE 9, 10 and 11 fixed elements containing block is always established by the viewport var elementCss = getComputedStyle$1(element); if (elementCss.position === 'fixed') { return null; } } var currentNode = getParentNode(element); while (isHTMLElement(currentNode) && ['html', 'body'].indexOf(getNodeName(currentNode)) < 0) { var css = getComputedStyle$1(currentNode); // This is non-exhaustive but covers the most common CSS properties that // create a containing block. // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block if (css.transform !== 'none' || css.perspective !== 'none' || css.contain === 'paint' || ['transform', 'perspective'].indexOf(css.willChange) !== -1 || isFirefox && css.willChange === 'filter' || isFirefox && css.filter && css.filter !== 'none') { return currentNode; } else { currentNode = currentNode.parentNode; } } return null; } // Gets the closest ancestor positioned element. Handles some edge cases, // such as table ancestors and cross browser bugs. function getOffsetParent(element) { var window = getWindow(element); var offsetParent = getTrueOffsetParent(element); while (offsetParent && isTableElement(offsetParent) && getComputedStyle$1(offsetParent).position === 'static') { offsetParent = getTrueOffsetParent(offsetParent); } if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle$1(offsetParent).position === 'static')) { return window; } return offsetParent || getContainingBlock(element) || window; } function getMainAxisFromPlacement(placement) { return ['top', 'bottom'].indexOf(placement) >= 0 ? 'x' : 'y'; } var max = Math.max; var min = Math.min; var round = Math.round; function within(min$1, value, max$1) { return max(min$1, min(value, max$1)); } function getFreshSideObject() { return { top: 0, right: 0, bottom: 0, left: 0 }; } function mergePaddingObject(paddingObject) { return Object.assign({}, getFreshSideObject(), paddingObject); } function expandToHashMap(value, keys) { return keys.reduce(function (hashMap, key) { hashMap[key] = value; return hashMap; }, {}); } var toPaddingObject = function toPaddingObject(padding, state) { padding = typeof padding === 'function' ? padding(Object.assign({}, state.rects, { placement: state.placement })) : padding; return mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements)); }; function arrow(_ref) { var _state$modifiersData$; var state = _ref.state, name = _ref.name, options = _ref.options; var arrowElement = state.elements.arrow; var popperOffsets = state.modifiersData.popperOffsets; var basePlacement = getBasePlacement(state.placement); var axis = getMainAxisFromPlacement(basePlacement); var isVertical = [left, right].indexOf(basePlacement) >= 0; var len = isVertical ? 'height' : 'width'; if (!arrowElement || !popperOffsets) { return; } var paddingObject = toPaddingObject(options.padding, state); var arrowRect = getLayoutRect(arrowElement); var minProp = axis === 'y' ? top : left; var maxProp = axis === 'y' ? bottom : right; var endDiff = state.rects.reference[len] + state.rects.reference[axis] - popperOffsets[axis] - state.rects.popper[len]; var startDiff = popperOffsets[axis] - state.rects.reference[axis]; var arrowOffsetParent = getOffsetParent(arrowElement); var clientSize = arrowOffsetParent ? axis === 'y' ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0; var centerToReference = endDiff / 2 - startDiff / 2; // Make sure the arrow doesn't overflow the popper if the center point is // outside of the popper bounds var min = paddingObject[minProp]; var max = clientSize - arrowRect[len] - paddingObject[maxProp]; var center = clientSize / 2 - arrowRect[len] / 2 + centerToReference; var offset = within(min, center, max); // Prevents breaking syntax highlighting... var axisProp = axis; state.modifiersData[name] = (_state$modifiersData$ = {}, _state$modifiersData$[axisProp] = offset, _state$modifiersData$.centerOffset = offset - center, _state$modifiersData$); } function effect$1(_ref2) { var state = _ref2.state, options = _ref2.options; var _options$element = options.element, arrowElement = _options$element === void 0 ? '[data-popper-arrow]' : _options$element; if (arrowElement == null) { return; } // CSS selector if (typeof arrowElement === 'string') { arrowElement = state.elements.popper.querySelector(arrowElement); if (!arrowElement) { return; } } if (process.env.NODE_ENV !== "production") { if (!isHTMLElement(arrowElement)) { console.error(['Popper: "arrow" element must be an HTMLElement (not an SVGElement).', 'To use an SVG arrow, wrap it in an HTMLElement that will be used as', 'the arrow.'].join(' ')); } } if (!contains(state.elements.popper, arrowElement)) { if (process.env.NODE_ENV !== "production") { console.error(['Popper: "arrow" modifier\'s `element` must be a child of the popper', 'element.'].join(' ')); } return; } state.elements.arrow = arrowElement; } // eslint-disable-next-line import/no-unused-modules var arrow$1 = { name: 'arrow', enabled: true, phase: 'main', fn: arrow, effect: effect$1, requires: ['popperOffsets'], requiresIfExists: ['preventOverflow'] }; var unsetSides = { top: 'auto', right: 'auto', bottom: 'auto', left: 'auto' }; // Round the offsets to the nearest suitable subpixel based on the DPR. // Zooming can change the DPR, but it seems to report a value that will // cleanly divide the values into the appropriate subpixels. function roundOffsetsByDPR(_ref) { var x = _ref.x, y = _ref.y; var win = window; var dpr = win.devicePixelRatio || 1; return { x: round(round(x * dpr) / dpr) || 0, y: round(round(y * dpr) / dpr) || 0 }; } function mapToStyles(_ref2) { var _Object$assign2; var popper = _ref2.popper, popperRect = _ref2.popperRect, placement = _ref2.placement, offsets = _ref2.offsets, position = _ref2.position, gpuAcceleration = _ref2.gpuAcceleration, adaptive = _ref2.adaptive, roundOffsets = _ref2.roundOffsets; var _ref3 = roundOffsets === true ? roundOffsetsByDPR(offsets) : typeof roundOffsets === 'function' ? roundOffsets(offsets) : offsets, _ref3$x = _ref3.x, x = _ref3$x === void 0 ? 0 : _ref3$x, _ref3$y = _ref3.y, y = _ref3$y === void 0 ? 0 : _ref3$y; var hasX = offsets.hasOwnProperty('x'); var hasY = offsets.hasOwnProperty('y'); var sideX = left; var sideY = top; var win = window; if (adaptive) { var offsetParent = getOffsetParent(popper); var heightProp = 'clientHeight'; var widthProp = 'clientWidth'; if (offsetParent === getWindow(popper)) { offsetParent = getDocumentElement(popper); if (getComputedStyle$1(offsetParent).position !== 'static') { heightProp = 'scrollHeight'; widthProp = 'scrollWidth'; } } // $FlowFixMe[incompatible-cast]: force type refinement, we compare offsetParent with window above, but Flow doesn't detect it offsetParent = offsetParent; if (placement === top) { sideY = bottom; // $FlowFixMe[prop-missing] y -= offsetParent[heightProp] - popperRect.height; y *= gpuAcceleration ? 1 : -1; } if (placement === left) { sideX = right; // $FlowFixMe[prop-missing] x -= offsetParent[widthProp] - popperRect.width; x *= gpuAcceleration ? 1 : -1; } } var commonStyles = Object.assign({ position: position }, adaptive && unsetSides); if (gpuAcceleration) { var _Object$assign; return Object.assign({}, commonStyles, (_Object$assign = {}, _Object$assign[sideY] = hasY ? '0' : '', _Object$assign[sideX] = hasX ? '0' : '', _Object$assign.transform = (win.devicePixelRatio || 1) < 2 ? "translate(" + x + "px, " + y + "px)" : "translate3d(" + x + "px, " + y + "px, 0)", _Object$assign)); } return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : '', _Object$assign2[sideX] = hasX ? x + "px" : '', _Object$assign2.transform = '', _Object$assign2)); } function computeStyles(_ref4) { var state = _ref4.state, options = _ref4.options; var _options$gpuAccelerat = options.gpuAcceleration, gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat, _options$adaptive = options.adaptive, adaptive = _options$adaptive === void 0 ? true : _options$adaptive, _options$roundOffsets = options.roundOffsets, roundOffsets = _options$roundOffsets === void 0 ? true : _options$roundOffsets; if (process.env.NODE_ENV !== "production") { var transitionProperty = getComputedStyle$1(state.elements.popper).transitionProperty || ''; if (adaptive && ['transform', 'top', 'right', 'bottom', 'left'].some(function (property) { return transitionProperty.indexOf(property) >= 0; })) { console.warn(['Popper: Detected CSS transitions on at least one of the following', 'CSS properties: "transform", "top", "right", "bottom", "left".', '\n\n', 'Disable the "computeStyles" modifier\'s `adaptive` option to allow', 'for smooth transitions, or remove these properties from the CSS', 'transition declaration on the popper element if only transitioning', 'opacity or background-color for example.', '\n\n', 'We recommend using the popper element as a wrapper around an inner', 'element that can have any CSS property transitioned for animations.'].join(' ')); } } var commonStyles = { placement: getBasePlacement(state.placement), popper: state.elements.popper, popperRect: state.rects.popper, gpuAcceleration: gpuAcceleration }; if (state.modifiersData.popperOffsets != null) { state.styles.popper = Object.assign({}, state.styles.popper, mapToStyles(Object.assign({}, commonStyles, { offsets: state.modifiersData.popperOffsets, position: state.options.strategy, adaptive: adaptive, roundOffsets: roundOffsets }))); } if (state.modifiersData.arrow != null) { state.styles.arrow = Object.assign({}, state.styles.arrow, mapToStyles(Object.assign({}, commonStyles, { offsets: state.modifiersData.arrow, position: 'absolute', adaptive: false, roundOffsets: roundOffsets }))); } state.attributes.popper = Object.assign({}, state.attributes.popper, { 'data-popper-placement': state.placement }); } // eslint-disable-next-line import/no-unused-modules var computeStyles$1 = { name: 'computeStyles', enabled: true, phase: 'beforeWrite', fn: computeStyles, data: {} }; var passive = { passive: true }; function effect(_ref) { var state = _ref.state, instance = _ref.instance, options = _ref.options; var _options$scroll = options.scroll, scroll = _options$scroll === void 0 ? true : _options$scroll, _options$resize = options.resize, resize = _options$resize === void 0 ? true : _options$resize; var window = getWindow(state.elements.popper); var scrollParents = [].concat(state.scrollParents.reference, state.scrollParents.popper); if (scroll) { scrollParents.forEach(function (scrollParent) { scrollParent.addEventListener('scroll', instance.update, passive); }); } if (resize) { window.addEventListener('resize', instance.update, passive); } return function () { if (scroll) { scrollParents.forEach(function (scrollParent) { scrollParent.removeEventListener('scroll', instance.update, passive); }); } if (resize) { window.removeEventListener('resize', instance.update, passive); } }; } // eslint-disable-next-line import/no-unused-modules var eventListeners = { name: 'eventListeners', enabled: true, phase: 'write', fn: function fn() {}, effect: effect, data: {} }; var hash$1 = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' }; function getOppositePlacement(placement) { return placement.replace(/left|right|bottom|top/g, function (matched) { return hash$1[matched]; }); } var hash = { start: 'end', end: 'start' }; function getOppositeVariationPlacement(placement) { return placement.replace(/start|end/g, function (matched) { return hash[matched]; }); } function getWindowScroll(node) { var win = getWindow(node); var scrollLeft = win.pageXOffset; var scrollTop = win.pageYOffset; return { scrollLeft: scrollLeft, scrollTop: scrollTop }; } function getWindowScrollBarX(element) { // If has a CSS width greater than the viewport, then this will be // incorrect for RTL. // Popper 1 is broken in this case and never had a bug report so let's assume // it's not an issue. I don't think anyone ever specifies width on // anyway. // Browsers where the left scrollbar doesn't cause an issue report `0` for // this (e.g. Edge 2019, IE11, Safari) return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft; } function getViewportRect(element) { var win = getWindow(element); var html = getDocumentElement(element); var visualViewport = win.visualViewport; var width = html.clientWidth; var height = html.clientHeight; var x = 0; var y = 0; // NB: This isn't supported on iOS <= 12. If the keyboard is open, the popper // can be obscured underneath it. // Also, `html.clientHeight` adds the bottom bar height in Safari iOS, even // if it isn't open, so if this isn't available, the popper will be detected // to overflow the bottom of the screen too early. if (visualViewport) { width = visualViewport.width; height = visualViewport.height; // Uses Layout Viewport (like Chrome; Safari does not currently) // In Chrome, it returns a value very close to 0 (+/-) but contains rounding // errors due to floating point numbers, so we need to check precision. // Safari returns a number <= 0, usually < -1 when pinch-zoomed // Feature detection fails in mobile emulation mode in Chrome. // Math.abs(win.innerWidth / visualViewport.scale - visualViewport.width) < // 0.001 // Fallback here: "Not Safari" userAgent if (!/^((?!chrome|android).)*safari/i.test(navigator.userAgent)) { x = visualViewport.offsetLeft; y = visualViewport.offsetTop; } } return { width: width, height: height, x: x + getWindowScrollBarX(element), y: y }; } // of the `` and `` rect bounds if horizontally scrollable function getDocumentRect(element) { var _element$ownerDocumen; var html = getDocumentElement(element); var winScroll = getWindowScroll(element); var body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body; var width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0); var height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0); var x = -winScroll.scrollLeft + getWindowScrollBarX(element); var y = -winScroll.scrollTop; if (getComputedStyle$1(body || html).direction === 'rtl') { x += max(html.clientWidth, body ? body.clientWidth : 0) - width; } return { width: width, height: height, x: x, y: y }; } function isScrollParent(element) { // Firefox wants us to check `-x` and `-y` variations as well var _getComputedStyle = getComputedStyle$1(element), overflow = _getComputedStyle.overflow, overflowX = _getComputedStyle.overflowX, overflowY = _getComputedStyle.overflowY; return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX); } function getScrollParent(node) { if (['html', 'body', '#document'].indexOf(getNodeName(node)) >= 0) { // $FlowFixMe[incompatible-return]: assume body is always available return node.ownerDocument.body; } if (isHTMLElement(node) && isScrollParent(node)) { return node; } return getScrollParent(getParentNode(node)); } /* given a DOM element, return the list of all scroll parents, up the list of ancesors until we get to the top window object. This list is what we attach scroll listeners to, because if any of these parent elements scroll, we'll need to re-calculate the reference element's position. */ function listScrollParents(element, list) { var _element$ownerDocumen; if (list === void 0) { list = []; } var scrollParent = getScrollParent(element); var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body); var win = getWindow(scrollParent); var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent; var updatedList = list.concat(target); return isBody ? updatedList : // $FlowFixMe[incompatible-call]: isBody tells us target will be an HTMLElement here updatedList.concat(listScrollParents(getParentNode(target))); } function rectToClientRect(rect) { return Object.assign({}, rect, { left: rect.x, top: rect.y, right: rect.x + rect.width, bottom: rect.y + rect.height }); } function getInnerBoundingClientRect(element) { var rect = getBoundingClientRect(element); rect.top = rect.top + element.clientTop; rect.left = rect.left + element.clientLeft; rect.bottom = rect.top + element.clientHeight; rect.right = rect.left + element.clientWidth; rect.width = element.clientWidth; rect.height = element.clientHeight; rect.x = rect.left; rect.y = rect.top; return rect; } function getClientRectFromMixedType(element, clippingParent) { return clippingParent === viewport ? rectToClientRect(getViewportRect(element)) : isHTMLElement(clippingParent) ? getInnerBoundingClientRect(clippingParent) : rectToClientRect(getDocumentRect(getDocumentElement(element))); } // A "clipping parent" is an overflowable container with the characteristic of // clipping (or hiding) overflowing elements with a position different from // `initial` function getClippingParents(element) { var clippingParents = listScrollParents(getParentNode(element)); var canEscapeClipping = ['absolute', 'fixed'].indexOf(getComputedStyle$1(element).position) >= 0; var clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element; if (!isElement(clipperElement)) { return []; } // $FlowFixMe[incompatible-return]: https://github.com/facebook/flow/issues/1414 return clippingParents.filter(function (clippingParent) { return isElement(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== 'body'; }); } // Gets the maximum area that the element is visible in due to any number of // clipping parents function getClippingRect(element, boundary, rootBoundary) { var mainClippingParents = boundary === 'clippingParents' ? getClippingParents(element) : [].concat(boundary); var clippingParents = [].concat(mainClippingParents, [rootBoundary]); var firstClippingParent = clippingParents[0]; var clippingRect = clippingParents.reduce(function (accRect, clippingParent) { var rect = getClientRectFromMixedType(element, clippingParent); accRect.top = max(rect.top, accRect.top); accRect.right = min(rect.right, accRect.right); accRect.bottom = min(rect.bottom, accRect.bottom); accRect.left = max(rect.left, accRect.left); return accRect; }, getClientRectFromMixedType(element, firstClippingParent)); clippingRect.width = clippingRect.right - clippingRect.left; clippingRect.height = clippingRect.bottom - clippingRect.top; clippingRect.x = clippingRect.left; clippingRect.y = clippingRect.top; return clippingRect; } function getVariation(placement) { return placement.split('-')[1]; } function computeOffsets(_ref) { var reference = _ref.reference, element = _ref.element, placement = _ref.placement; var basePlacement = placement ? getBasePlacement(placement) : null; var variation = placement ? getVariation(placement) : null; var commonX = reference.x + reference.width / 2 - element.width / 2; var commonY = reference.y + reference.height / 2 - element.height / 2; var offsets; switch (basePlacement) { case top: offsets = { x: commonX, y: reference.y - element.height }; break; case bottom: offsets = { x: commonX, y: reference.y + reference.height }; break; case right: offsets = { x: reference.x + reference.width, y: commonY }; break; case left: offsets = { x: reference.x - element.width, y: commonY }; break; default: offsets = { x: reference.x, y: reference.y }; } var mainAxis = basePlacement ? getMainAxisFromPlacement(basePlacement) : null; if (mainAxis != null) { var len = mainAxis === 'y' ? 'height' : 'width'; switch (variation) { case start: offsets[mainAxis] = offsets[mainAxis] - (reference[len] / 2 - element[len] / 2); break; case end: offsets[mainAxis] = offsets[mainAxis] + (reference[len] / 2 - element[len] / 2); break; } } return offsets; } function detectOverflow(state, options) { if (options === void 0) { options = {}; } var _options = options, _options$placement = _options.placement, placement = _options$placement === void 0 ? state.placement : _options$placement, _options$boundary = _options.boundary, boundary = _options$boundary === void 0 ? clippingParents : _options$boundary, _options$rootBoundary = _options.rootBoundary, rootBoundary = _options$rootBoundary === void 0 ? viewport : _options$rootBoundary, _options$elementConte = _options.elementContext, elementContext = _options$elementConte === void 0 ? popper : _options$elementConte, _options$altBoundary = _options.altBoundary, altBoundary = _options$altBoundary === void 0 ? false : _options$altBoundary, _options$padding = _options.padding, padding = _options$padding === void 0 ? 0 : _options$padding; var paddingObject = mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements)); var altContext = elementContext === popper ? reference : popper; var referenceElement = state.elements.reference; var popperRect = state.rects.popper; var element = state.elements[altBoundary ? altContext : elementContext]; var clippingClientRect = getClippingRect(isElement(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary); var referenceClientRect = getBoundingClientRect(referenceElement); var popperOffsets = computeOffsets({ reference: referenceClientRect, element: popperRect, strategy: 'absolute', placement: placement }); var popperClientRect = rectToClientRect(Object.assign({}, popperRect, popperOffsets)); var elementClientRect = elementContext === popper ? popperClientRect : referenceClientRect; // positive = overflowing the clipping rect // 0 or negative = within the clipping rect var overflowOffsets = { top: clippingClientRect.top - elementClientRect.top + paddingObject.top, bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom, left: clippingClientRect.left - elementClientRect.left + paddingObject.left, right: elementClientRect.right - clippingClientRect.right + paddingObject.right }; var offsetData = state.modifiersData.offset; // Offsets can be applied only to the popper element if (elementContext === popper && offsetData) { var offset = offsetData[placement]; Object.keys(overflowOffsets).forEach(function (key) { var multiply = [right, bottom].indexOf(key) >= 0 ? 1 : -1; var axis = [top, bottom].indexOf(key) >= 0 ? 'y' : 'x'; overflowOffsets[key] += offset[axis] * multiply; }); } return overflowOffsets; } function computeAutoPlacement(state, options) { if (options === void 0) { options = {}; } var _options = options, placement = _options.placement, boundary = _options.boundary, rootBoundary = _options.rootBoundary, padding = _options.padding, flipVariations = _options.flipVariations, _options$allowedAutoP = _options.allowedAutoPlacements, allowedAutoPlacements = _options$allowedAutoP === void 0 ? placements : _options$allowedAutoP; var variation = getVariation(placement); var placements$1 = variation ? flipVariations ? variationPlacements : variationPlacements.filter(function (placement) { return getVariation(placement) === variation; }) : basePlacements; var allowedPlacements = placements$1.filter(function (placement) { return allowedAutoPlacements.indexOf(placement) >= 0; }); if (allowedPlacements.length === 0) { allowedPlacements = placements$1; if (process.env.NODE_ENV !== "production") { console.error(['Popper: The `allowedAutoPlacements` option did not allow any', 'placements. Ensure the `placement` option matches the variation', 'of the allowed placements.', 'For example, "auto" cannot be used to allow "bottom-start".', 'Use "auto-start" instead.'].join(' ')); } } // $FlowFixMe[incompatible-type]: Flow seems to have problems with two array unions... var overflows = allowedPlacements.reduce(function (acc, placement) { acc[placement] = detectOverflow(state, { placement: placement, boundary: boundary, rootBoundary: rootBoundary, padding: padding })[getBasePlacement(placement)]; return acc; }, {}); return Object.keys(overflows).sort(function (a, b) { return overflows[a] - overflows[b]; }); } function getExpandedFallbackPlacements(placement) { if (getBasePlacement(placement) === auto) { return []; } var oppositePlacement = getOppositePlacement(placement); return [getOppositeVariationPlacement(placement), oppositePlacement, getOppositeVariationPlacement(oppositePlacement)]; } function flip(_ref) { var state = _ref.state, options = _ref.options, name = _ref.name; if (state.modifiersData[name]._skip) { return; } var _options$mainAxis = options.mainAxis, checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis, _options$altAxis = options.altAxis, checkAltAxis = _options$altAxis === void 0 ? true : _options$altAxis, specifiedFallbackPlacements = options.fallbackPlacements, padding = options.padding, boundary = options.boundary, rootBoundary = options.rootBoundary, altBoundary = options.altBoundary, _options$flipVariatio = options.flipVariations, flipVariations = _options$flipVariatio === void 0 ? true : _options$flipVariatio, allowedAutoPlacements = options.allowedAutoPlacements; var preferredPlacement = state.options.placement; var basePlacement = getBasePlacement(preferredPlacement); var isBasePlacement = basePlacement === preferredPlacement; var fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipVariations ? [getOppositePlacement(preferredPlacement)] : getExpandedFallbackPlacements(preferredPlacement)); var placements = [preferredPlacement].concat(fallbackPlacements).reduce(function (acc, placement) { return acc.concat(getBasePlacement(placement) === auto ? computeAutoPlacement(state, { placement: placement, boundary: boundary, rootBoundary: rootBoundary, padding: padding, flipVariations: flipVariations, allowedAutoPlacements: allowedAutoPlacements }) : placement); }, []); var referenceRect = state.rects.reference; var popperRect = state.rects.popper; var checksMap = new Map(); var makeFallbackChecks = true; var firstFittingPlacement = placements[0]; for (var i = 0; i < placements.length; i++) { var placement = placements[i]; var _basePlacement = getBasePlacement(placement); var isStartVariation = getVariation(placement) === start; var isVertical = [top, bottom].indexOf(_basePlacement) >= 0; var len = isVertical ? 'width' : 'height'; var overflow = detectOverflow(state, { placement: placement, boundary: boundary, rootBoundary: rootBoundary, altBoundary: altBoundary, padding: padding }); var mainVariationSide = isVertical ? isStartVariation ? right : left : isStartVariation ? bottom : top; if (referenceRect[len] > popperRect[len]) { mainVariationSide = getOppositePlacement(mainVariationSide); } var altVariationSide = getOppositePlacement(mainVariationSide); var checks = []; if (checkMainAxis) { checks.push(overflow[_basePlacement] <= 0); } if (checkAltAxis) { checks.push(overflow[mainVariationSide] <= 0, overflow[altVariationSide] <= 0); } if (checks.every(function (check) { return check; })) { firstFittingPlacement = placement; makeFallbackChecks = false; break; } checksMap.set(placement, checks); } if (makeFallbackChecks) { // `2` may be desired in some cases – research later var numberOfChecks = flipVariations ? 3 : 1; var _loop = function _loop(_i) { var fittingPlacement = placements.find(function (placement) { var checks = checksMap.get(placement); if (checks) { return checks.slice(0, _i).every(function (check) { return check; }); } }); if (fittingPlacement) { firstFittingPlacement = fittingPlacement; return "break"; } }; for (var _i = numberOfChecks; _i > 0; _i--) { var _ret = _loop(_i); if (_ret === "break") break; } } if (state.placement !== firstFittingPlacement) { state.modifiersData[name]._skip = true; state.placement = firstFittingPlacement; state.reset = true; } } // eslint-disable-next-line import/no-unused-modules var flip$1 = { name: 'flip', enabled: true, phase: 'main', fn: flip, requiresIfExists: ['offset'], data: { _skip: false } }; function getSideOffsets(overflow, rect, preventedOffsets) { if (preventedOffsets === void 0) { preventedOffsets = { x: 0, y: 0 }; } return { top: overflow.top - rect.height - preventedOffsets.y, right: overflow.right - rect.width + preventedOffsets.x, bottom: overflow.bottom - rect.height + preventedOffsets.y, left: overflow.left - rect.width - preventedOffsets.x }; } function isAnySideFullyClipped(overflow) { return [top, right, bottom, left].some(function (side) { return overflow[side] >= 0; }); } function hide(_ref) { var state = _ref.state, name = _ref.name; var referenceRect = state.rects.reference; var popperRect = state.rects.popper; var preventedOffsets = state.modifiersData.preventOverflow; var referenceOverflow = detectOverflow(state, { elementContext: 'reference' }); var popperAltOverflow = detectOverflow(state, { altBoundary: true }); var referenceClippingOffsets = getSideOffsets(referenceOverflow, referenceRect); var popperEscapeOffsets = getSideOffsets(popperAltOverflow, popperRect, preventedOffsets); var isReferenceHidden = isAnySideFullyClipped(referenceClippingOffsets); var hasPopperEscaped = isAnySideFullyClipped(popperEscapeOffsets); state.modifiersData[name] = { referenceClippingOffsets: referenceClippingOffsets, popperEscapeOffsets: popperEscapeOffsets, isReferenceHidden: isReferenceHidden, hasPopperEscaped: hasPopperEscaped }; state.attributes.popper = Object.assign({}, state.attributes.popper, { 'data-popper-reference-hidden': isReferenceHidden, 'data-popper-escaped': hasPopperEscaped }); } // eslint-disable-next-line import/no-unused-modules var hide$1 = { name: 'hide', enabled: true, phase: 'main', requiresIfExists: ['preventOverflow'], fn: hide }; function distanceAndSkiddingToXY(placement, rects, offset) { var basePlacement = getBasePlacement(placement); var invertDistance = [left, top].indexOf(basePlacement) >= 0 ? -1 : 1; var _ref = typeof offset === 'function' ? offset(Object.assign({}, rects, { placement: placement })) : offset, skidding = _ref[0], distance = _ref[1]; skidding = skidding || 0; distance = (distance || 0) * invertDistance; return [left, right].indexOf(basePlacement) >= 0 ? { x: distance, y: skidding } : { x: skidding, y: distance }; } function offset(_ref2) { var state = _ref2.state, options = _ref2.options, name = _ref2.name; var _options$offset = options.offset, offset = _options$offset === void 0 ? [0, 0] : _options$offset; var data = placements.reduce(function (acc, placement) { acc[placement] = distanceAndSkiddingToXY(placement, state.rects, offset); return acc; }, {}); var _data$state$placement = data[state.placement], x = _data$state$placement.x, y = _data$state$placement.y; if (state.modifiersData.popperOffsets != null) { state.modifiersData.popperOffsets.x += x; state.modifiersData.popperOffsets.y += y; } state.modifiersData[name] = data; } // eslint-disable-next-line import/no-unused-modules var offset$1 = { name: 'offset', enabled: true, phase: 'main', requires: ['popperOffsets'], fn: offset }; function popperOffsets(_ref) { var state = _ref.state, name = _ref.name; // Offsets are the actual position the popper needs to have to be // properly positioned near its reference element // This is the most basic placement, and will be adjusted by // the modifiers in the next step state.modifiersData[name] = computeOffsets({ reference: state.rects.reference, element: state.rects.popper, strategy: 'absolute', placement: state.placement }); } // eslint-disable-next-line import/no-unused-modules var popperOffsets$1 = { name: 'popperOffsets', enabled: true, phase: 'read', fn: popperOffsets, data: {} }; function getAltAxis(axis) { return axis === 'x' ? 'y' : 'x'; } function preventOverflow(_ref) { var state = _ref.state, options = _ref.options, name = _ref.name; var _options$mainAxis = options.mainAxis, checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis, _options$altAxis = options.altAxis, checkAltAxis = _options$altAxis === void 0 ? false : _options$altAxis, boundary = options.boundary, rootBoundary = options.rootBoundary, altBoundary = options.altBoundary, padding = options.padding, _options$tether = options.tether, tether = _options$tether === void 0 ? true : _options$tether, _options$tetherOffset = options.tetherOffset, tetherOffset = _options$tetherOffset === void 0 ? 0 : _options$tetherOffset; var overflow = detectOverflow(state, { boundary: boundary, rootBoundary: rootBoundary, padding: padding, altBoundary: altBoundary }); var basePlacement = getBasePlacement(state.placement); var variation = getVariation(state.placement); var isBasePlacement = !variation; var mainAxis = getMainAxisFromPlacement(basePlacement); var altAxis = getAltAxis(mainAxis); var popperOffsets = state.modifiersData.popperOffsets; var referenceRect = state.rects.reference; var popperRect = state.rects.popper; var tetherOffsetValue = typeof tetherOffset === 'function' ? tetherOffset(Object.assign({}, state.rects, { placement: state.placement })) : tetherOffset; var data = { x: 0, y: 0 }; if (!popperOffsets) { return; } if (checkMainAxis || checkAltAxis) { var mainSide = mainAxis === 'y' ? top : left; var altSide = mainAxis === 'y' ? bottom : right; var len = mainAxis === 'y' ? 'height' : 'width'; var offset = popperOffsets[mainAxis]; var min$1 = popperOffsets[mainAxis] + overflow[mainSide]; var max$1 = popperOffsets[mainAxis] - overflow[altSide]; var additive = tether ? -popperRect[len] / 2 : 0; var minLen = variation === start ? referenceRect[len] : popperRect[len]; var maxLen = variation === start ? -popperRect[len] : -referenceRect[len]; // We need to include the arrow in the calculation so the arrow doesn't go // outside the reference bounds var arrowElement = state.elements.arrow; var arrowRect = tether && arrowElement ? getLayoutRect(arrowElement) : { width: 0, height: 0 }; var arrowPaddingObject = state.modifiersData['arrow#persistent'] ? state.modifiersData['arrow#persistent'].padding : getFreshSideObject(); var arrowPaddingMin = arrowPaddingObject[mainSide]; var arrowPaddingMax = arrowPaddingObject[altSide]; // If the reference length is smaller than the arrow length, we don't want // to include its full size in the calculation. If the reference is small // and near the edge of a boundary, the popper can overflow even if the // reference is not overflowing as well (e.g. virtual elements with no // width or height) var arrowLen = within(0, referenceRect[len], arrowRect[len]); var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - tetherOffsetValue : minLen - arrowLen - arrowPaddingMin - tetherOffsetValue; var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + tetherOffsetValue : maxLen + arrowLen + arrowPaddingMax + tetherOffsetValue; var arrowOffsetParent = state.elements.arrow && getOffsetParent(state.elements.arrow); var clientOffset = arrowOffsetParent ? mainAxis === 'y' ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0; var offsetModifierValue = state.modifiersData.offset ? state.modifiersData.offset[state.placement][mainAxis] : 0; var tetherMin = popperOffsets[mainAxis] + minOffset - offsetModifierValue - clientOffset; var tetherMax = popperOffsets[mainAxis] + maxOffset - offsetModifierValue; if (checkMainAxis) { var preventedOffset = within(tether ? min(min$1, tetherMin) : min$1, offset, tether ? max(max$1, tetherMax) : max$1); popperOffsets[mainAxis] = preventedOffset; data[mainAxis] = preventedOffset - offset; } if (checkAltAxis) { var _mainSide = mainAxis === 'x' ? top : left; var _altSide = mainAxis === 'x' ? bottom : right; var _offset = popperOffsets[altAxis]; var _min = _offset + overflow[_mainSide]; var _max = _offset - overflow[_altSide]; var _preventedOffset = within(tether ? min(_min, tetherMin) : _min, _offset, tether ? max(_max, tetherMax) : _max); popperOffsets[altAxis] = _preventedOffset; data[altAxis] = _preventedOffset - _offset; } } state.modifiersData[name] = data; } // eslint-disable-next-line import/no-unused-modules var preventOverflow$1 = { name: 'preventOverflow', enabled: true, phase: 'main', fn: preventOverflow, requiresIfExists: ['offset'] }; function getHTMLElementScroll(element) { return { scrollLeft: element.scrollLeft, scrollTop: element.scrollTop }; } function getNodeScroll(node) { if (node === getWindow(node) || !isHTMLElement(node)) { return getWindowScroll(node); } else { return getHTMLElementScroll(node); } } // Composite means it takes into account transforms as well as layout. function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) { if (isFixed === void 0) { isFixed = false; } var documentElement = getDocumentElement(offsetParent); var rect = getBoundingClientRect(elementOrVirtualElement); var isOffsetParentAnElement = isHTMLElement(offsetParent); var scroll = { scrollLeft: 0, scrollTop: 0 }; var offsets = { x: 0, y: 0 }; if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) { if (getNodeName(offsetParent) !== 'body' || // https://github.com/popperjs/popper-core/issues/1078 isScrollParent(documentElement)) { scroll = getNodeScroll(offsetParent); } if (isHTMLElement(offsetParent)) { offsets = getBoundingClientRect(offsetParent); offsets.x += offsetParent.clientLeft; offsets.y += offsetParent.clientTop; } else if (documentElement) { offsets.x = getWindowScrollBarX(documentElement); } } return { x: rect.left + scroll.scrollLeft - offsets.x, y: rect.top + scroll.scrollTop - offsets.y, width: rect.width, height: rect.height }; } function order(modifiers) { var map = new Map(); var visited = new Set(); var result = []; modifiers.forEach(function (modifier) { map.set(modifier.name, modifier); }); // On visiting object, check for its dependencies and visit them recursively function sort(modifier) { visited.add(modifier.name); var requires = [].concat(modifier.requires || [], modifier.requiresIfExists || []); requires.forEach(function (dep) { if (!visited.has(dep)) { var depModifier = map.get(dep); if (depModifier) { sort(depModifier); } } }); result.push(modifier); } modifiers.forEach(function (modifier) { if (!visited.has(modifier.name)) { // check for visited object sort(modifier); } }); return result; } function orderModifiers(modifiers) { // order based on dependencies var orderedModifiers = order(modifiers); // order based on phase return modifierPhases.reduce(function (acc, phase) { return acc.concat(orderedModifiers.filter(function (modifier) { return modifier.phase === phase; })); }, []); } function debounce(fn) { var pending; return function () { if (!pending) { pending = new Promise(function (resolve) { Promise.resolve().then(function () { pending = undefined; resolve(fn()); }); }); } return pending; }; } function format(str) { for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { args[_key - 1] = arguments[_key]; } return [].concat(args).reduce(function (p, c) { return p.replace(/%s/, c); }, str); } var INVALID_MODIFIER_ERROR = 'Popper: modifier "%s" provided an invalid %s property, expected %s but got %s'; var MISSING_DEPENDENCY_ERROR = 'Popper: modifier "%s" requires "%s", but "%s" modifier is not available'; var VALID_PROPERTIES = ['name', 'enabled', 'phase', 'fn', 'effect', 'requires', 'options']; function validateModifiers(modifiers) { modifiers.forEach(function (modifier) { Object.keys(modifier).forEach(function (key) { switch (key) { case 'name': if (typeof modifier.name !== 'string') { console.error(format(INVALID_MODIFIER_ERROR, String(modifier.name), '"name"', '"string"', "\"" + String(modifier.name) + "\"")); } break; case 'enabled': if (typeof modifier.enabled !== 'boolean') { console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"enabled"', '"boolean"', "\"" + String(modifier.enabled) + "\"")); } case 'phase': if (modifierPhases.indexOf(modifier.phase) < 0) { console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"phase"', "either " + modifierPhases.join(', '), "\"" + String(modifier.phase) + "\"")); } break; case 'fn': if (typeof modifier.fn !== 'function') { console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"fn"', '"function"', "\"" + String(modifier.fn) + "\"")); } break; case 'effect': if (typeof modifier.effect !== 'function') { console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"effect"', '"function"', "\"" + String(modifier.fn) + "\"")); } break; case 'requires': if (!Array.isArray(modifier.requires)) { console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"requires"', '"array"', "\"" + String(modifier.requires) + "\"")); } break; case 'requiresIfExists': if (!Array.isArray(modifier.requiresIfExists)) { console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"requiresIfExists"', '"array"', "\"" + String(modifier.requiresIfExists) + "\"")); } break; case 'options': case 'data': break; default: console.error("PopperJS: an invalid property has been provided to the \"" + modifier.name + "\" modifier, valid properties are " + VALID_PROPERTIES.map(function (s) { return "\"" + s + "\""; }).join(', ') + "; but \"" + key + "\" was provided."); } modifier.requires && modifier.requires.forEach(function (requirement) { if (modifiers.find(function (mod) { return mod.name === requirement; }) == null) { console.error(format(MISSING_DEPENDENCY_ERROR, String(modifier.name), requirement, requirement)); } }); }); }); } function uniqueBy(arr, fn) { var identifiers = new Set(); return arr.filter(function (item) { var identifier = fn(item); if (!identifiers.has(identifier)) { identifiers.add(identifier); return true; } }); } function mergeByName(modifiers) { var merged = modifiers.reduce(function (merged, current) { var existing = merged[current.name]; merged[current.name] = existing ? Object.assign({}, existing, current, { options: Object.assign({}, existing.options, current.options), data: Object.assign({}, existing.data, current.data) }) : current; return merged; }, {}); // IE11 does not support Object.values return Object.keys(merged).map(function (key) { return merged[key]; }); } var INVALID_ELEMENT_ERROR = 'Popper: Invalid reference or popper argument provided. They must be either a DOM element or virtual element.'; var INFINITE_LOOP_ERROR = 'Popper: An infinite loop in the modifiers cycle has been detected! The cycle has been interrupted to prevent a browser crash.'; var DEFAULT_OPTIONS = { placement: 'bottom', modifiers: [], strategy: 'absolute' }; function areValidElements() { for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } return !args.some(function (element) { return !(element && typeof element.getBoundingClientRect === 'function'); }); } function popperGenerator(generatorOptions) { if (generatorOptions === void 0) { generatorOptions = {}; } var _generatorOptions = generatorOptions, _generatorOptions$def = _generatorOptions.defaultModifiers, defaultModifiers = _generatorOptions$def === void 0 ? [] : _generatorOptions$def, _generatorOptions$def2 = _generatorOptions.defaultOptions, defaultOptions = _generatorOptions$def2 === void 0 ? DEFAULT_OPTIONS : _generatorOptions$def2; return function createPopper(reference, popper, options) { if (options === void 0) { options = defaultOptions; } var state = { placement: 'bottom', orderedModifiers: [], options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions), modifiersData: {}, elements: { reference: reference, popper: popper }, attributes: {}, styles: {} }; var effectCleanupFns = []; var isDestroyed = false; var instance = { state: state, setOptions: function setOptions(options) { cleanupModifierEffects(); state.options = Object.assign({}, defaultOptions, state.options, options); state.scrollParents = { reference: isElement(reference) ? listScrollParents(reference) : reference.contextElement ? listScrollParents(reference.contextElement) : [], popper: listScrollParents(popper) }; // Orders the modifiers based on their dependencies and `phase` // properties var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers, state.options.modifiers))); // Strip out disabled modifiers state.orderedModifiers = orderedModifiers.filter(function (m) { return m.enabled; }); // Validate the provided modifiers so that the consumer will get warned // if one of the modifiers is invalid for any reason if (process.env.NODE_ENV !== "production") { var modifiers = uniqueBy([].concat(orderedModifiers, state.options.modifiers), function (_ref) { var name = _ref.name; return name; }); validateModifiers(modifiers); if (getBasePlacement(state.options.placement) === auto) { var flipModifier = state.orderedModifiers.find(function (_ref2) { var name = _ref2.name; return name === 'flip'; }); if (!flipModifier) { console.error(['Popper: "auto" placements require the "flip" modifier be', 'present and enabled to work.'].join(' ')); } } var _getComputedStyle = getComputedStyle$1(popper), marginTop = _getComputedStyle.marginTop, marginRight = _getComputedStyle.marginRight, marginBottom = _getComputedStyle.marginBottom, marginLeft = _getComputedStyle.marginLeft; // We no longer take into account `margins` on the popper, and it can // cause bugs with positioning, so we'll warn the consumer if ([marginTop, marginRight, marginBottom, marginLeft].some(function (margin) { return parseFloat(margin); })) { console.warn(['Popper: CSS "margin" styles cannot be used to apply padding', 'between the popper and its reference element or boundary.', 'To replicate margin, use the `offset` modifier, as well as', 'the `padding` option in the `preventOverflow` and `flip`', 'modifiers.'].join(' ')); } } runModifierEffects(); return instance.update(); }, // Sync update – it will always be executed, even if not necessary. This // is useful for low frequency updates where sync behavior simplifies the // logic. // For high frequency updates (e.g. `resize` and `scroll` events), always // prefer the async Popper#update method forceUpdate: function forceUpdate() { if (isDestroyed) { return; } var _state$elements = state.elements, reference = _state$elements.reference, popper = _state$elements.popper; // Don't proceed if `reference` or `popper` are not valid elements // anymore if (!areValidElements(reference, popper)) { if (process.env.NODE_ENV !== "production") { console.error(INVALID_ELEMENT_ERROR); } return; } // Store the reference and popper rects to be read by modifiers state.rects = { reference: getCompositeRect(reference, getOffsetParent(popper), state.options.strategy === 'fixed'), popper: getLayoutRect(popper) }; // Modifiers have the ability to reset the current update cycle. The // most common use case for this is the `flip` modifier changing the // placement, which then needs to re-run all the modifiers, because the // logic was previously ran for the previous placement and is therefore // stale/incorrect state.reset = false; state.placement = state.options.placement; // On each update cycle, the `modifiersData` property for each modifier // is filled with the initial data specified by the modifier. This means // it doesn't persist and is fresh on each update. // To ensure persistent data, use `${name}#persistent` state.orderedModifiers.forEach(function (modifier) { return state.modifiersData[modifier.name] = Object.assign({}, modifier.data); }); var __debug_loops__ = 0; for (var index = 0; index < state.orderedModifiers.length; index++) { if (process.env.NODE_ENV !== "production") { __debug_loops__ += 1; if (__debug_loops__ > 100) { console.error(INFINITE_LOOP_ERROR); break; } } if (state.reset === true) { state.reset = false; index = -1; continue; } var _state$orderedModifie = state.orderedModifiers[index], fn = _state$orderedModifie.fn, _state$orderedModifie2 = _state$orderedModifie.options, _options = _state$orderedModifie2 === void 0 ? {} : _state$orderedModifie2, name = _state$orderedModifie.name; if (typeof fn === 'function') { state = fn({ state: state, options: _options, name: name, instance: instance }) || state; } } }, // Async and optimistically optimized update – it will not be executed if // not necessary (debounced to run at most once-per-tick) update: debounce(function () { return new Promise(function (resolve) { instance.forceUpdate(); resolve(state); }); }), destroy: function destroy() { cleanupModifierEffects(); isDestroyed = true; } }; if (!areValidElements(reference, popper)) { if (process.env.NODE_ENV !== "production") { console.error(INVALID_ELEMENT_ERROR); } return instance; } instance.setOptions(options).then(function (state) { if (!isDestroyed && options.onFirstUpdate) { options.onFirstUpdate(state); } }); // Modifiers have the ability to execute arbitrary code before the first // update cycle runs. They will be executed in the same order as the update // cycle. This is useful when a modifier adds some persistent data that // other modifiers need to use, but the modifier is run after the dependent // one. function runModifierEffects() { state.orderedModifiers.forEach(function (_ref3) { var name = _ref3.name, _ref3$options = _ref3.options, options = _ref3$options === void 0 ? {} : _ref3$options, effect = _ref3.effect; if (typeof effect === 'function') { var cleanupFn = effect({ state: state, name: name, instance: instance, options: options }); var noopFn = function noopFn() {}; effectCleanupFns.push(cleanupFn || noopFn); } }); } function cleanupModifierEffects() { effectCleanupFns.forEach(function (fn) { return fn(); }); effectCleanupFns = []; } return instance; }; } var defaultModifiers = [eventListeners, popperOffsets$1, computeStyles$1, applyStyles$1, offset$1, flip$1, preventOverflow$1, arrow$1, hide$1]; var createPopper = /*#__PURE__*/popperGenerator({ defaultModifiers: defaultModifiers }); // eslint-disable-next-line import/no-unused-modules /* node_modules/@popperjs/svelte/src/Popper.svelte generated by Svelte v3.37.0 */ function create_fragment$6(ctx) { let current; const default_slot_template = /*#slots*/ ctx[12].default; const default_slot = create_slot$1(default_slot_template, ctx, /*$$scope*/ ctx[11], null); return { c() { if (default_slot) default_slot.c(); }, m(target, anchor) { if (default_slot) { default_slot.m(target, anchor); } current = true; }, p(ctx, [dirty]) { if (default_slot) { if (default_slot.p && dirty & /*$$scope*/ 2048) { update_slot$1(default_slot, default_slot_template, ctx, /*$$scope*/ ctx[11], dirty, null, null); } } }, i(local) { if (current) return; transition_in$1(default_slot, local); current = true; }, o(local) { transition_out$1(default_slot, local); current = false; }, d(detaching) { if (default_slot) default_slot.d(detaching); } }; } function instance$6($$self, $$props, $$invalidate) { let $store, $$unsubscribe_store = noop$1, $$subscribe_store = () => ($$unsubscribe_store(), $$unsubscribe_store = subscribe$1(store, $$value => $$invalidate(10, $store = $$value)), store); $$self.$$.on_destroy.push(() => $$unsubscribe_store()); let { $$slots: slots = {}, $$scope } = $$props; let { reference: referenceElement } = $$props; let { popper: popperElement } = $$props; let { options = {} } = $$props; const store = writable$1({}); $$subscribe_store(); let previousReferenceElement; let previousPopperElement; let popperInstance; const updateStateModifier = { name: "updateState", enabled: true, phase: "write", fn: ({ state }) => store.set(state) }; onDestroy$1(() => { popperInstance && popperInstance.destroy(); $$invalidate(9, popperInstance = null); }); let { styles = {} } = $$props; let { attributes = {} } = $$props; let { state = {} } = $$props; $$self.$$set = $$props => { if ("reference" in $$props) $$invalidate(4, referenceElement = $$props.reference); if ("popper" in $$props) $$invalidate(5, popperElement = $$props.popper); if ("options" in $$props) $$invalidate(6, options = $$props.options); if ("styles" in $$props) $$invalidate(1, styles = $$props.styles); if ("attributes" in $$props) $$invalidate(2, attributes = $$props.attributes); if ("state" in $$props) $$invalidate(3, state = $$props.state); if ("$$scope" in $$props) $$invalidate(11, $$scope = $$props.$$scope); }; $$self.$$.update = () => { if ($$self.$$.dirty & /*previousPopperElement, popperElement, previousReferenceElement, referenceElement, popperInstance, options*/ 1008) { (async () => { if (previousPopperElement != popperElement || previousReferenceElement != referenceElement) { await tick$1(); popperInstance && popperInstance.destroy(); if (referenceElement != null && popperElement != null) { $$invalidate(9, popperInstance = createPopper(referenceElement, popperElement, { ...options, modifiers: [ ...options.modifiers, updateStateModifier, { name: "applyStyles", enabled: false } ] })); $$invalidate(8, previousPopperElement = popperElement); $$invalidate(7, previousReferenceElement = referenceElement); } } })(); } if ($$self.$$.dirty & /*popperInstance, options*/ 576) { { if (popperInstance != null) { popperInstance.setOptions({ ...options, modifiers: [ ...options.modifiers, updateStateModifier, { name: "applyStyles", enabled: false } ] }); } } } if ($$self.$$.dirty & /*$store*/ 1024) { $$invalidate(1, styles = $store.styles || {}); } if ($$self.$$.dirty & /*$store*/ 1024) { $$invalidate(2, attributes = $store.attributes || {}); } if ($$self.$$.dirty & /*$store*/ 1024) { $$invalidate(3, state = $store); } }; return [ store, styles, attributes, state, referenceElement, popperElement, options, previousReferenceElement, previousPopperElement, popperInstance, $store, $$scope, slots ]; } class Popper extends SvelteComponent$1 { constructor(options) { super(); init$1(this, options, instance$6, create_fragment$6, safe_not_equal$1, { reference: 4, popper: 5, options: 6, store: 0, styles: 1, attributes: 2, state: 3 }); } get store() { return this.$$.ctx[0]; } } /* src/ui/settings/palette/Popper.svelte generated by Svelte v3.37.0 */ function add_css$2() { var style = element$1("style"); style.id = "svelte-1tkxxcu-style"; style.textContent = ".popper.svelte-1tkxxcu{cursor:default;transition:opacity 0.1s ease-in;opacity:0;position:absolute;z-index:var(--layer-popover)}.popper.visible.svelte-1tkxxcu{opacity:1}"; append$1(document.head, style); } // (29:0)