vanilla-jsoneditor-cn 3.12.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../node_modules/svelte/src/version.js","../node_modules/svelte/src/internal/disclose-version.js","../node_modules/svelte/src/internal/flags/index.js","../node_modules/svelte/src/constants.js","../node_modules/svelte/src/internal/shared/utils.js","../node_modules/svelte/src/internal/client/constants.js","../node_modules/svelte/src/internal/shared/errors.js","../node_modules/svelte/src/internal/client/reactivity/equality.js","../node_modules/svelte/src/internal/client/context.js","../node_modules/svelte/src/internal/client/dom/task.js","../node_modules/svelte/src/internal/client/error-handling.js","../node_modules/svelte/src/internal/client/reactivity/status.js","../node_modules/svelte/src/internal/client/reactivity/utils.js","../node_modules/svelte/src/internal/client/reactivity/store.js","../node_modules/svelte/src/internal/client/reactivity/batch.js","../node_modules/svelte/src/internal/client/errors.js","../node_modules/svelte/src/internal/client/dom/blocks/boundary.js","../node_modules/svelte/src/reactivity/create-subscriber.js","../node_modules/svelte/src/internal/client/warnings.js","../node_modules/svelte/src/internal/client/reactivity/async.js","../node_modules/svelte/src/internal/client/reactivity/deriveds.js","../node_modules/svelte/src/internal/client/reactivity/effects.js","../node_modules/svelte/src/internal/client/reactivity/sources.js","../node_modules/svelte/src/internal/client/dom/operations.js","../node_modules/svelte/src/internal/client/runtime.js","../node_modules/svelte/src/internal/client/proxy.js","../node_modules/svelte/src/internal/client/dom/elements/misc.js","../node_modules/svelte/src/internal/client/dom/elements/bindings/shared.js","../node_modules/svelte/src/internal/client/dom/elements/events.js","../node_modules/svelte/src/internal/client/dom/reconciler.js","../node_modules/svelte/src/internal/client/dom/template.js","../node_modules/svelte/src/utils.js","../node_modules/svelte/src/internal/client/render.js","../node_modules/svelte/src/internal/client/dom/blocks/branches.js","../node_modules/svelte/src/index-client.js","../node_modules/svelte/src/internal/client/dom/blocks/if.js","../node_modules/svelte/src/internal/client/dom/blocks/key.js","../node_modules/svelte/src/internal/client/dom/blocks/each.js","../node_modules/svelte/src/internal/client/dom/blocks/html.js","../node_modules/svelte/src/internal/client/dom/blocks/slot.js","../node_modules/svelte/src/internal/client/dom/blocks/svelte-component.js","../node_modules/svelte/src/internal/client/dom/elements/actions.js","../node_modules/svelte/src/internal/client/dom/elements/attachments.js","../node_modules/clsx/dist/clsx.mjs","../node_modules/svelte/src/internal/shared/attributes.js","../node_modules/svelte/src/internal/client/dom/elements/class.js","../node_modules/svelte/src/internal/client/dom/elements/style.js","../node_modules/svelte/src/internal/client/dom/elements/bindings/select.js","../node_modules/svelte/src/internal/client/dom/elements/attributes.js","../node_modules/svelte/src/internal/client/dom/elements/bindings/input.js","../node_modules/svelte/src/internal/client/dom/elements/bindings/props.js","../node_modules/svelte/src/internal/client/dom/elements/bindings/this.js","../node_modules/svelte/src/internal/client/dom/legacy/event-modifiers.js","../node_modules/svelte/src/internal/client/dom/legacy/lifecycle.js","../node_modules/svelte/src/internal/client/dom/legacy/misc.js","../node_modules/svelte/src/internal/client/reactivity/props.js","../src/lib/utils/debug.ts","../src/lib/utils/uniqueId.ts","../src/lib/utils/numberUtils.ts","../src/lib/utils/typeUtils.ts","../src/lib/utils/arrayUtils.ts","../src/lib/utils/jsonUtils.ts","../src/lib/types.ts","../src/lib/utils/domUtils.ts","../src/lib/utils/navigatorUtils.ts","../src/lib/utils/keyBindings.ts","../node_modules/style-inject/dist/style-inject.es.js","../src/lib/components/modals/popup/AbsolutePopupEntry.svelte","../src/lib/components/modals/popup/AbsolutePopup.svelte","../src/lib/utils/stringUtils.ts","../src/lib/plugins/query/jsonQueryLanguage.ts","../node_modules/svelte-awesome/package/components/svg/Raw.svelte","../node_modules/svelte-awesome/package/components/Icon.svelte","../node_modules/svelte-awesome/package/components/svg/Svg.svelte","../src/lib/plugins/value/components/BooleanToggle.svelte","../src/lib/components/controls/ColorPickerPopup.svelte","../src/lib/plugins/value/components/ColorPicker.svelte","../src/lib/constants.ts","../src/lib/logic/expandItemsSections.ts","../src/lib/typeguards.ts","../src/lib/logic/documentState.ts","../src/lib/logic/selection.ts","../src/lib/utils/cssUtils.ts","../src/lib/plugins/value/components/utils/getValueClass.ts","../src/lib/components/controls/EditableDiv.svelte","../src/lib/plugins/value/components/EditableValue.svelte","../src/lib/logic/operations.ts","../src/lib/logic/search.ts","../src/lib/components/modes/treemode/highlight/SearchResultHighlighter.svelte","../src/lib/utils/fileUtils.ts","../src/lib/components/controls/Tag.svelte","../node_modules/svelte/src/internal/client/dom/blocks/snippet.js","../src/lib/plugins/value/components/ReadonlyValue.svelte","../src/lib/components/controls/tooltip/Tooltip.svelte","../src/lib/components/controls/tooltip/tooltip.ts","../src/lib/plugins/value/components/TimestampTag.svelte","../src/lib/plugins/value/renderValue.ts","../src/lib/utils/pathUtils.ts","../src/lib/components/modals/transformModalStates.ts","../node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs","../node_modules/@floating-ui/core/dist/floating-ui.core.mjs","../node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs","../node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs","../node_modules/svelte-floating-ui/index.js","../node_modules/svelte-select/filter.js","../node_modules/svelte-select/get-items.js","../node_modules/svelte-select/ClearIcon.svelte","../node_modules/svelte-select/Select.svelte","../node_modules/svelte-select/LoadingIcon.svelte","../node_modules/svelte-select/ChevronIcon.svelte","../src/lib/components/modals/TransformWizard.svelte","../src/lib/components/controls/selectQueryLanguage/SelectQueryLanguage.svelte","../src/lib/components/modals/Header.svelte","../src/lib/components/controls/createAutoScrollHandler.ts","../src/lib/assets/jump.js/src/easing.ts","../src/lib/assets/jump.js/src/jump.ts","../src/lib/utils/timeUtils.ts","../src/lib/logic/validation.ts","../src/lib/components/controls/createFocusTracker.ts","../src/lib/components/controls/Message.svelte","../src/lib/components/controls/ValidationErrorsOverview.svelte","../src/lib/actions/onEscape.ts","../src/lib/components/modals/Modal.svelte","../src/lib/components/modals/CopyPasteModal.svelte","../src/lib/components/controls/Menu.svelte","../src/lib/components/modals/repair/JSONRepairComponent.svelte","../src/lib/components/modals/JSONRepairModal.svelte","../src/lib/components/modes/treemode/CollapsedItems.svelte","../src/lib/components/controls/contextmenu/ContextMenuPointer.svelte","../src/lib/components/modes/treemode/JSONValue.svelte","../src/lib/components/modes/treemode/singleton.ts","../src/lib/logic/dragging.ts","../src/lib/components/modes/treemode/ValidationErrorIcon.svelte","../src/lib/components/modes/treemode/JSONNode.svelte","../src/lib/components/modes/treemode/JSONKey.svelte","../src/lib/img/customFontawesomeIcons.ts","../src/lib/logic/sort.ts","../src/lib/components/controls/navigationBar/NavigationBarDropdown.svelte","../src/lib/components/controls/navigationBar/NavigationBarItem.svelte","../src/lib/utils/copyToClipboard.ts","../src/lib/components/controls/navigationBar/NavigationBarPathEditor.svelte","../src/lib/components/controls/navigationBar/NavigationBar.svelte","../src/lib/components/controls/SearchBox.svelte","../src/lib/logic/table.ts","../src/lib/logic/actions.ts","../src/lib/components/controls/JSONPreview.svelte","../src/lib/components/controls/contextmenu/ContextMenuButton.svelte","../src/lib/components/controls/contextmenu/ContextMenuDropDownButton.svelte","../src/lib/components/controls/DropdownButton.svelte","../src/lib/components/controls/contextmenu/ContextMenu.svelte","../src/lib/plugins/value/components/EnumValue.svelte","../src/lib/utils/jsonSchemaUtils.ts","../src/lib/plugins/value/renderJSONSchemaEnum.ts","../src/lib/plugins/validator/createAjvValidator.ts","../src/lib/plugins/query/jmespathQueryLanguage.ts","../src/lib/plugins/query/jsonpathQueryLanguage.ts","../src/lib/plugins/query/lodashQueryLanguage.ts","../src/lib/plugins/query/javascriptQueryLanguage.ts","../src/lib/actions/resizeObserver.ts","../src/lib/components/modes/treemode/TreeMode.svelte","../src/lib/components/modes/treemode/contextmenu/createTreeContextMenuItems.ts","../src/lib/components/modes/treemode/menu/TreeMenu.svelte","../src/lib/components/modes/treemode/Welcome.svelte","../src/lib/utils/readonlyProxy.ts","../src/lib/logic/history.ts","../src/lib/components/modals/TransformModal.svelte","../src/lib/components/modals/TransformModalHeader.svelte","../src/lib/utils/noop.ts","../node_modules/@lezer/common/dist/index.js","../src/lib/components/modes/textmode/codemirror/codemirror-theme.ts","../node_modules/codemirror-wrapped-line-indent/dist/index.js","../src/lib/components/modes/textmode/TextMode.svelte","../src/lib/components/modes/textmode/menu/TextMenu.svelte","../src/lib/components/modes/textmode/StatusBar.svelte","../src/lib/components/modes/tablemode/TableModeWelcome.svelte","../src/lib/components/modes/tablemode/TableMode.svelte","../src/lib/components/modes/tablemode/contextmenu/createTableContextMenuItems.ts","../src/lib/components/modes/tablemode/menu/TableMenu.svelte","../src/lib/components/modes/tablemode/ColumnHeader.svelte","../src/lib/components/modes/tablemode/RefreshColumnHeader.svelte","../src/lib/components/modes/tablemode/tag/InlineValue.svelte","../src/lib/components/modes/JSONEditorRoot.svelte","../src/lib/components/modals/sortModalStates.ts","../src/lib/components/JSONEditor.svelte","../src/lib/components/modals/SortModal.svelte","../src/lib/components/modals/JSONEditorModal.svelte","../src/lib/index-vanilla.ts"],"sourcesContent":["// generated during release, do not modify\n\n/**\n * The current version, as set in package.json.\n * @type {string}\n */\nexport const VERSION = '5.55.1';\nexport const PUBLIC_VERSION = '5';\n","import { PUBLIC_VERSION } from '../version.js';\n\nif (typeof window !== 'undefined') {\n\t// @ts-expect-error\n\t((window.__svelte ??= {}).v ??= new Set()).add(PUBLIC_VERSION);\n}\n","/** True if experimental.async=true */\nexport let async_mode_flag = false;\n/** True if we're not certain that we only have Svelte 5 code in the compilation */\nexport let legacy_mode_flag = false;\n/** True if $inspect.trace is used */\nexport let tracing_mode_flag = false;\n\nexport function enable_async_mode_flag() {\n\tasync_mode_flag = true;\n}\n\n/** ONLY USE THIS DURING TESTING */\nexport function disable_async_mode_flag() {\n\tasync_mode_flag = false;\n}\n\nexport function enable_legacy_mode_flag() {\n\tlegacy_mode_flag = true;\n}\n\nexport function enable_tracing_mode_flag() {\n\ttracing_mode_flag = true;\n}\n","export const EACH_ITEM_REACTIVE = 1;\nexport const EACH_INDEX_REACTIVE = 1 << 1;\n/** See EachBlock interface metadata.is_controlled for an explanation what this is */\nexport const EACH_IS_CONTROLLED = 1 << 2;\nexport const EACH_IS_ANIMATED = 1 << 3;\nexport const EACH_ITEM_IMMUTABLE = 1 << 4;\n\nexport const PROPS_IS_IMMUTABLE = 1;\nexport const PROPS_IS_RUNES = 1 << 1;\nexport const PROPS_IS_UPDATED = 1 << 2;\nexport const PROPS_IS_BINDABLE = 1 << 3;\nexport const PROPS_IS_LAZY_INITIAL = 1 << 4;\n\nexport const TRANSITION_IN = 1;\nexport const TRANSITION_OUT = 1 << 1;\nexport const TRANSITION_GLOBAL = 1 << 2;\n\nexport const TEMPLATE_FRAGMENT = 1;\nexport const TEMPLATE_USE_IMPORT_NODE = 1 << 1;\nexport const TEMPLATE_USE_SVG = 1 << 2;\nexport const TEMPLATE_USE_MATHML = 1 << 3;\n\nexport const HYDRATION_START = '[';\n/** used to indicate that an `{:else}...` block was rendered */\nexport const HYDRATION_START_ELSE = '[!';\n/** used to indicate that a boundary's `failed` snippet was rendered on the server */\nexport const HYDRATION_START_FAILED = '[?';\nexport const HYDRATION_END = ']';\nexport const HYDRATION_ERROR = {};\n\nexport const ELEMENT_IS_NAMESPACED = 1;\nexport const ELEMENT_PRESERVE_ATTRIBUTE_CASE = 1 << 1;\nexport const ELEMENT_IS_INPUT = 1 << 2;\n\nexport const UNINITIALIZED = Symbol();\n\n// Dev-time component properties\nexport const FILENAME = Symbol('filename');\nexport const HMR = Symbol('hmr');\n\nexport const NAMESPACE_HTML = 'http://www.w3.org/1999/xhtml';\nexport const NAMESPACE_SVG = 'http://www.w3.org/2000/svg';\nexport const NAMESPACE_MATHML = 'http://www.w3.org/1998/Math/MathML';\n\n// we use a list of ignorable runtime warnings because not every runtime warning\n// can be ignored and we want to keep the validation for svelte-ignore in place\nexport const IGNORABLE_RUNTIME_WARNINGS = /** @type {const} */ ([\n\t'await_waterfall',\n\t'await_reactivity_loss',\n\t'state_snapshot_uncloneable',\n\t'binding_property_non_reactive',\n\t'hydration_attribute_changed',\n\t'hydration_html_changed',\n\t'ownership_invalid_binding',\n\t'ownership_invalid_mutation'\n]);\n\n/**\n * Whitespace inside one of these elements will not result in\n * a whitespace node being created in any circumstances. (This\n * list is almost certainly very incomplete)\n * TODO this is currently unused\n */\nexport const ELEMENTS_WITHOUT_TEXT = ['audio', 'datalist', 'dl', 'optgroup', 'select', 'video'];\n\nexport const ATTACHMENT_KEY = '@attach';\n","// Store the references to globals in case someone tries to monkey patch these, causing the below\n// to de-opt (this occurs often when using popular extensions).\nexport var is_array = Array.isArray;\nexport var index_of = Array.prototype.indexOf;\nexport var includes = Array.prototype.includes;\nexport var array_from = Array.from;\nexport var object_keys = Object.keys;\nexport var define_property = Object.defineProperty;\nexport var get_descriptor = Object.getOwnPropertyDescriptor;\nexport var get_descriptors = Object.getOwnPropertyDescriptors;\nexport var object_prototype = Object.prototype;\nexport var array_prototype = Array.prototype;\nexport var get_prototype_of = Object.getPrototypeOf;\nexport var is_extensible = Object.isExtensible;\nexport var has_own_property = Object.prototype.hasOwnProperty;\n\n/**\n * @param {any} thing\n * @returns {thing is Function}\n */\nexport function is_function(thing) {\n\treturn typeof thing === 'function';\n}\n\nexport const noop = () => {};\n\n// Adapted from https://github.com/then/is-promise/blob/master/index.js\n// Distributed under MIT License https://github.com/then/is-promise/blob/master/LICENSE\n\n/**\n * @template [T=any]\n * @param {any} value\n * @returns {value is PromiseLike<T>}\n */\nexport function is_promise(value) {\n\treturn typeof value?.then === 'function';\n}\n\n/** @param {Function} fn */\nexport function run(fn) {\n\treturn fn();\n}\n\n/** @param {Array<() => void>} arr */\nexport function run_all(arr) {\n\tfor (var i = 0; i < arr.length; i++) {\n\t\tarr[i]();\n\t}\n}\n\n/**\n * TODO replace with Promise.withResolvers once supported widely enough\n * @template [T=void]\n */\nexport function deferred() {\n\t/** @type {(value: T) => void} */\n\tvar resolve;\n\n\t/** @type {(reason: any) => void} */\n\tvar reject;\n\n\t/** @type {Promise<T>} */\n\tvar promise = new Promise((res, rej) => {\n\t\tresolve = res;\n\t\treject = rej;\n\t});\n\n\t// @ts-expect-error\n\treturn { promise, resolve, reject };\n}\n\n/**\n * @template V\n * @param {V} value\n * @param {V | (() => V)} fallback\n * @param {boolean} [lazy]\n * @returns {V}\n */\nexport function fallback(value, fallback, lazy = false) {\n\treturn value === undefined\n\t\t? lazy\n\t\t\t? /** @type {() => V} */ (fallback)()\n\t\t\t: /** @type {V} */ (fallback)\n\t\t: value;\n}\n\n/**\n * When encountering a situation like `let [a, b, c] = $derived(blah())`,\n * we need to stash an intermediate value that `a`, `b`, and `c` derive\n * from, in case it's an iterable\n * @template T\n * @param {ArrayLike<T> | Iterable<T>} value\n * @param {number} [n]\n * @returns {Array<T>}\n */\nexport function to_array(value, n) {\n\t// return arrays unchanged\n\tif (Array.isArray(value)) {\n\t\treturn value;\n\t}\n\n\t// if value is not iterable, or `n` is unspecified (indicates a rest\n\t// element, which means we're not concerned about unbounded iterables)\n\t// convert to an array with `Array.from`\n\tif (n === undefined || !(Symbol.iterator in value)) {\n\t\treturn Array.from(value);\n\t}\n\n\t// otherwise, populate an array with `n` values\n\n\t/** @type {T[]} */\n\tconst array = [];\n\n\tfor (const element of value) {\n\t\tarray.push(element);\n\t\tif (array.length === n) break;\n\t}\n\n\treturn array;\n}\n\n/**\n * @param {Record<string | symbol, unknown>} obj\n * @param {Array<string | symbol>} keys\n * @returns {Record<string | symbol, unknown>}\n */\nexport function exclude_from_object(obj, keys) {\n\t/** @type {Record<string | symbol, unknown>} */\n\tvar result = {};\n\n\tfor (var key in obj) {\n\t\tif (!keys.includes(key)) {\n\t\t\tresult[key] = obj[key];\n\t\t}\n\t}\n\n\tfor (var symbol of Object.getOwnPropertySymbols(obj)) {\n\t\tif (Object.propertyIsEnumerable.call(obj, symbol) && !keys.includes(symbol)) {\n\t\t\tresult[symbol] = obj[symbol];\n\t\t}\n\t}\n\n\treturn result;\n}\n","// General flags\nexport const DERIVED = 1 << 1;\nexport const EFFECT = 1 << 2;\nexport const RENDER_EFFECT = 1 << 3;\n/**\n * An effect that does not destroy its child effects when it reruns.\n * Runs as part of render effects, i.e. not eagerly as part of tree traversal or effect flushing.\n */\nexport const MANAGED_EFFECT = 1 << 24;\n/**\n * An effect that does not destroy its child effects when it reruns (like MANAGED_EFFECT).\n * Runs eagerly as part of tree traversal or effect flushing.\n */\nexport const BLOCK_EFFECT = 1 << 4;\nexport const BRANCH_EFFECT = 1 << 5;\nexport const ROOT_EFFECT = 1 << 6;\nexport const BOUNDARY_EFFECT = 1 << 7;\n/**\n * Indicates that a reaction is connected to an effect root — either it is an effect,\n * or it is a derived that is depended on by at least one effect. If a derived has\n * no dependents, we can disconnect it from the graph, allowing it to either be\n * GC'd or reconnected later if an effect comes to depend on it again\n */\nexport const CONNECTED = 1 << 9;\nexport const CLEAN = 1 << 10;\nexport const DIRTY = 1 << 11;\nexport const MAYBE_DIRTY = 1 << 12;\nexport const INERT = 1 << 13;\nexport const DESTROYED = 1 << 14;\n/** Set once a reaction has run for the first time */\nexport const REACTION_RAN = 1 << 15;\n/** Effect is in the process of getting destroyed. Can be observed in child teardown functions */\nexport const DESTROYING = 1 << 25;\n\n// Flags exclusive to effects\n/**\n * 'Transparent' effects do not create a transition boundary.\n * This is on a block effect 99% of the time but may also be on a branch effect if its parent block effect was pruned\n */\nexport const EFFECT_TRANSPARENT = 1 << 16;\nexport const EAGER_EFFECT = 1 << 17;\nexport const HEAD_EFFECT = 1 << 18;\nexport const EFFECT_PRESERVED = 1 << 19;\nexport const USER_EFFECT = 1 << 20;\nexport const EFFECT_OFFSCREEN = 1 << 25;\n\n// Flags exclusive to deriveds\n/**\n * Tells that we marked this derived and its reactions as visited during the \"mark as (maybe) dirty\"-phase.\n * Will be lifted during execution of the derived and during checking its dirty state (both are necessary\n * because a derived might be checked but not executed).\n */\nexport const WAS_MARKED = 1 << 16;\n\n// Flags used for async\nexport const REACTION_IS_UPDATING = 1 << 21;\nexport const ASYNC = 1 << 22;\n\nexport const ERROR_VALUE = 1 << 23;\n\nexport const STATE_SYMBOL = Symbol('$state');\nexport const LEGACY_PROPS = Symbol('legacy props');\nexport const LOADING_ATTR_SYMBOL = Symbol('');\nexport const PROXY_PATH_SYMBOL = Symbol('proxy path');\n\n/** allow users to ignore aborted signal errors if `reason.name === 'StaleReactionError` */\nexport const STALE_REACTION = new (class StaleReactionError extends Error {\n\tname = 'StaleReactionError';\n\tmessage = 'The reaction that called `getAbortSignal()` was re-run or destroyed';\n})();\n\nexport const IS_XHTML =\n\t// We gotta write it like this because after downleveling the pure comment may end up in the wrong location\n\t!!globalThis.document?.contentType &&\n\t/* @__PURE__ */ globalThis.document.contentType.includes('xml');\nexport const ELEMENT_NODE = 1;\nexport const TEXT_NODE = 3;\nexport const COMMENT_NODE = 8;\nexport const DOCUMENT_FRAGMENT_NODE = 11;\n","/* This file is generated by scripts/process-messages/index.js. Do not edit! */\n\nimport { DEV } from 'esm-env';\n\n/**\n * Cannot use `%name%(...)` unless the `experimental.async` compiler option is `true`\n * @param {string} name\n * @returns {never}\n */\nexport function experimental_async_required(name) {\n\tif (DEV) {\n\t\tconst error = new Error(`experimental_async_required\\nCannot use \\`${name}(...)\\` unless the \\`experimental.async\\` compiler option is \\`true\\`\\nhttps://svelte.dev/e/experimental_async_required`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/experimental_async_required`);\n\t}\n}\n\n/**\n * Cannot use `{@render children(...)}` if the parent component uses `let:` directives. Consider using a named snippet instead\n * @returns {never}\n */\nexport function invalid_default_snippet() {\n\tif (DEV) {\n\t\tconst error = new Error(`invalid_default_snippet\\nCannot use \\`{@render children(...)}\\` if the parent component uses \\`let:\\` directives. Consider using a named snippet instead\\nhttps://svelte.dev/e/invalid_default_snippet`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/invalid_default_snippet`);\n\t}\n}\n\n/**\n * A snippet function was passed invalid arguments. Snippets should only be instantiated via `{@render ...}`\n * @returns {never}\n */\nexport function invalid_snippet_arguments() {\n\tif (DEV) {\n\t\tconst error = new Error(`invalid_snippet_arguments\\nA snippet function was passed invalid arguments. Snippets should only be instantiated via \\`{@render ...}\\`\\nhttps://svelte.dev/e/invalid_snippet_arguments`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/invalid_snippet_arguments`);\n\t}\n}\n\n/**\n * An invariant violation occurred, meaning Svelte's internal assumptions were flawed. This is a bug in Svelte, not your app — please open an issue at https://github.com/sveltejs/svelte, citing the following message: \"%message%\"\n * @param {string} message\n * @returns {never}\n */\nexport function invariant_violation(message) {\n\tif (DEV) {\n\t\tconst error = new Error(`invariant_violation\\nAn invariant violation occurred, meaning Svelte's internal assumptions were flawed. This is a bug in Svelte, not your app — please open an issue at https://github.com/sveltejs/svelte, citing the following message: \"${message}\"\\nhttps://svelte.dev/e/invariant_violation`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/invariant_violation`);\n\t}\n}\n\n/**\n * `%name%(...)` can only be used during component initialisation\n * @param {string} name\n * @returns {never}\n */\nexport function lifecycle_outside_component(name) {\n\tif (DEV) {\n\t\tconst error = new Error(`lifecycle_outside_component\\n\\`${name}(...)\\` can only be used during component initialisation\\nhttps://svelte.dev/e/lifecycle_outside_component`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/lifecycle_outside_component`);\n\t}\n}\n\n/**\n * Context was not set in a parent component\n * @returns {never}\n */\nexport function missing_context() {\n\tif (DEV) {\n\t\tconst error = new Error(`missing_context\\nContext was not set in a parent component\\nhttps://svelte.dev/e/missing_context`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/missing_context`);\n\t}\n}\n\n/**\n * Attempted to render a snippet without a `{@render}` block. This would cause the snippet code to be stringified instead of its content being rendered to the DOM. To fix this, change `{snippet}` to `{@render snippet()}`.\n * @returns {never}\n */\nexport function snippet_without_render_tag() {\n\tif (DEV) {\n\t\tconst error = new Error(`snippet_without_render_tag\\nAttempted to render a snippet without a \\`{@render}\\` block. This would cause the snippet code to be stringified instead of its content being rendered to the DOM. To fix this, change \\`{snippet}\\` to \\`{@render snippet()}\\`.\\nhttps://svelte.dev/e/snippet_without_render_tag`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/snippet_without_render_tag`);\n\t}\n}\n\n/**\n * `%name%` is not a store with a `subscribe` method\n * @param {string} name\n * @returns {never}\n */\nexport function store_invalid_shape(name) {\n\tif (DEV) {\n\t\tconst error = new Error(`store_invalid_shape\\n\\`${name}\\` is not a store with a \\`subscribe\\` method\\nhttps://svelte.dev/e/store_invalid_shape`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/store_invalid_shape`);\n\t}\n}\n\n/**\n * The `this` prop on `<svelte:element>` must be a string, if defined\n * @returns {never}\n */\nexport function svelte_element_invalid_this_value() {\n\tif (DEV) {\n\t\tconst error = new Error(`svelte_element_invalid_this_value\\nThe \\`this\\` prop on \\`<svelte:element>\\` must be a string, if defined\\nhttps://svelte.dev/e/svelte_element_invalid_this_value`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/svelte_element_invalid_this_value`);\n\t}\n}","/** @import { Equals } from '#client' */\n\n/** @type {Equals} */\nexport function equals(value) {\n\treturn value === this.v;\n}\n\n/**\n * @param {unknown} a\n * @param {unknown} b\n * @returns {boolean}\n */\nexport function safe_not_equal(a, b) {\n\treturn a != a\n\t\t? b == b\n\t\t: a !== b || (a !== null && typeof a === 'object') || typeof a === 'function';\n}\n\n/**\n * @param {unknown} a\n * @param {unknown} b\n * @returns {boolean}\n */\nexport function not_equal(a, b) {\n\treturn a !== b;\n}\n\n/** @type {Equals} */\nexport function safe_equals(value) {\n\treturn !safe_not_equal(value, this.v);\n}\n","/** @import { ComponentContext, DevStackEntry, Effect } from '#client' */\nimport { DEV } from 'esm-env';\nimport * as e from './errors.js';\nimport { active_effect, active_reaction } from './runtime.js';\nimport { create_user_effect } from './reactivity/effects.js';\nimport { async_mode_flag, legacy_mode_flag } from '../flags/index.js';\nimport { FILENAME } from '../../constants.js';\nimport { BRANCH_EFFECT } from './constants.js';\n\n/** @type {ComponentContext | null} */\nexport let component_context = null;\n\n/** @param {ComponentContext | null} context */\nexport function set_component_context(context) {\n\tcomponent_context = context;\n}\n\n/** @type {DevStackEntry | null} */\nexport let dev_stack = null;\n\n/** @param {DevStackEntry | null} stack */\nexport function set_dev_stack(stack) {\n\tdev_stack = stack;\n}\n\n/**\n * Execute a callback with a new dev stack entry\n * @param {() => any} callback - Function to execute\n * @param {DevStackEntry['type']} type - Type of block/component\n * @param {any} component - Component function\n * @param {number} line - Line number\n * @param {number} column - Column number\n * @param {Record<string, any>} [additional] - Any additional properties to add to the dev stack entry\n * @returns {any}\n */\nexport function add_svelte_meta(callback, type, component, line, column, additional) {\n\tconst parent = dev_stack;\n\n\tdev_stack = {\n\t\ttype,\n\t\tfile: component[FILENAME],\n\t\tline,\n\t\tcolumn,\n\t\tparent,\n\t\t...additional\n\t};\n\n\ttry {\n\t\treturn callback();\n\t} finally {\n\t\tdev_stack = parent;\n\t}\n}\n\n/**\n * The current component function. Different from current component context:\n * ```html\n * <!-- App.svelte -->\n * <Foo>\n * <Bar /> <!-- context == Foo.svelte, function == App.svelte -->\n * </Foo>\n * ```\n * @type {ComponentContext['function']}\n */\nexport let dev_current_component_function = null;\n\n/** @param {ComponentContext['function']} fn */\nexport function set_dev_current_component_function(fn) {\n\tdev_current_component_function = fn;\n}\n\n/**\n * Returns a `[get, set]` pair of functions for working with context in a type-safe way.\n *\n * `get` will throw an error if no parent component called `set`.\n *\n * @template T\n * @returns {[() => T, (context: T) => T]}\n * @since 5.40.0\n */\nexport function createContext() {\n\tconst key = {};\n\n\treturn [\n\t\t() => {\n\t\t\tif (!hasContext(key)) {\n\t\t\t\te.missing_context();\n\t\t\t}\n\n\t\t\treturn getContext(key);\n\t\t},\n\t\t(context) => setContext(key, context)\n\t];\n}\n\n/**\n * Retrieves the context that belongs to the closest parent component with the specified `key`.\n * Must be called during component initialisation.\n *\n * [`createContext`](https://svelte.dev/docs/svelte/svelte#createContext) is a type-safe alternative.\n *\n * @template T\n * @param {any} key\n * @returns {T}\n */\nexport function getContext(key) {\n\tconst context_map = get_or_init_context_map('getContext');\n\tconst result = /** @type {T} */ (context_map.get(key));\n\treturn result;\n}\n\n/**\n * Associates an arbitrary `context` object with the current component and the specified `key`\n * and returns that object. The context is then available to children of the component\n * (including slotted content) with `getContext`.\n *\n * Like lifecycle functions, this must be called during component initialisation.\n *\n * [`createContext`](https://svelte.dev/docs/svelte/svelte#createContext) is a type-safe alternative.\n *\n * @template T\n * @param {any} key\n * @param {T} context\n * @returns {T}\n */\nexport function setContext(key, context) {\n\tconst context_map = get_or_init_context_map('setContext');\n\n\tif (async_mode_flag) {\n\t\tvar flags = /** @type {Effect} */ (active_effect).f;\n\t\tvar valid =\n\t\t\t!active_reaction &&\n\t\t\t(flags & BRANCH_EFFECT) !== 0 &&\n\t\t\t// pop() runs synchronously, so this indicates we're setting context after an await\n\t\t\t!(/** @type {ComponentContext} */ (component_context).i);\n\n\t\tif (!valid) {\n\t\t\te.set_context_after_init();\n\t\t}\n\t}\n\n\tcontext_map.set(key, context);\n\treturn context;\n}\n\n/**\n * Checks whether a given `key` has been set in the context of a parent component.\n * Must be called during component initialisation.\n *\n * @param {any} key\n * @returns {boolean}\n */\nexport function hasContext(key) {\n\tconst context_map = get_or_init_context_map('hasContext');\n\treturn context_map.has(key);\n}\n\n/**\n * Retrieves the whole context map that belongs to the closest parent component.\n * Must be called during component initialisation. Useful, for example, if you\n * programmatically create a component and want to pass the existing context to it.\n *\n * @template {Map<any, any>} [T=Map<any, any>]\n * @returns {T}\n */\nexport function getAllContexts() {\n\tconst context_map = get_or_init_context_map('getAllContexts');\n\treturn /** @type {T} */ (context_map);\n}\n\n/**\n * @param {Record<string, unknown>} props\n * @param {any} runes\n * @param {Function} [fn]\n * @returns {void}\n */\nexport function push(props, runes = false, fn) {\n\tcomponent_context = {\n\t\tp: component_context,\n\t\ti: false,\n\t\tc: null,\n\t\te: null,\n\t\ts: props,\n\t\tx: null,\n\t\tr: /** @type {Effect} */ (active_effect),\n\t\tl: legacy_mode_flag && !runes ? { s: null, u: null, $: [] } : null\n\t};\n\n\tif (DEV) {\n\t\t// component function\n\t\tcomponent_context.function = fn;\n\t\tdev_current_component_function = fn;\n\t}\n}\n\n/**\n * @template {Record<string, any>} T\n * @param {T} [component]\n * @returns {T}\n */\nexport function pop(component) {\n\tvar context = /** @type {ComponentContext} */ (component_context);\n\tvar effects = context.e;\n\n\tif (effects !== null) {\n\t\tcontext.e = null;\n\n\t\tfor (var fn of effects) {\n\t\t\tcreate_user_effect(fn);\n\t\t}\n\t}\n\n\tif (component !== undefined) {\n\t\tcontext.x = component;\n\t}\n\n\tcontext.i = true;\n\n\tcomponent_context = context.p;\n\n\tif (DEV) {\n\t\tdev_current_component_function = component_context?.function ?? null;\n\t}\n\n\treturn component ?? /** @type {T} */ ({});\n}\n\n/** @returns {boolean} */\nexport function is_runes() {\n\treturn !legacy_mode_flag || (component_context !== null && component_context.l === null);\n}\n\n/**\n * @param {string} name\n * @returns {Map<unknown, unknown>}\n */\nfunction get_or_init_context_map(name) {\n\tif (component_context === null) {\n\t\te.lifecycle_outside_component(name);\n\t}\n\n\treturn (component_context.c ??= new Map(get_parent_context(component_context) || undefined));\n}\n\n/**\n * @param {ComponentContext} component_context\n * @returns {Map<unknown, unknown> | null}\n */\nfunction get_parent_context(component_context) {\n\tlet parent = component_context.p;\n\twhile (parent !== null) {\n\t\tconst context_map = parent.c;\n\t\tif (context_map !== null) {\n\t\t\treturn context_map;\n\t\t}\n\t\tparent = parent.p;\n\t}\n\treturn null;\n}\n","import { run_all } from '../../shared/utils.js';\nimport { is_flushing_sync } from '../reactivity/batch.js';\n\n/** @type {Array<() => void>} */\nlet micro_tasks = [];\n\nfunction run_micro_tasks() {\n\tvar tasks = micro_tasks;\n\tmicro_tasks = [];\n\trun_all(tasks);\n}\n\n/**\n * @param {() => void} fn\n */\nexport function queue_micro_task(fn) {\n\tif (micro_tasks.length === 0 && !is_flushing_sync) {\n\t\tvar tasks = micro_tasks;\n\t\tqueueMicrotask(() => {\n\t\t\t// If this is false, a flushSync happened in the meantime. Do _not_ run new scheduled microtasks in that case\n\t\t\t// as the ordering of microtasks would be broken at that point - consider this case:\n\t\t\t// - queue_micro_task schedules microtask A to flush task X\n\t\t\t// - synchronously after, flushSync runs, processing task X\n\t\t\t// - synchronously after, some other microtask B is scheduled, but not through queue_micro_task but for example a Promise.resolve() in user code\n\t\t\t// - synchronously after, queue_micro_task schedules microtask C to flush task Y\n\t\t\t// - one tick later, microtask A now resolves, flushing task Y before microtask B, which is incorrect\n\t\t\t// This if check prevents that race condition (that realistically will only happen in tests)\n\t\t\tif (tasks === micro_tasks) run_micro_tasks();\n\t\t});\n\t}\n\n\tmicro_tasks.push(fn);\n}\n\n/**\n * Synchronously run any queued tasks.\n */\nexport function flush_tasks() {\n\twhile (micro_tasks.length > 0) {\n\t\trun_micro_tasks();\n\t}\n}\n","/** @import { Derived, Effect } from '#client' */\n/** @import { Boundary } from './dom/blocks/boundary.js' */\nimport { DEV } from 'esm-env';\nimport { FILENAME } from '../../constants.js';\nimport { is_firefox } from './dom/operations.js';\nimport { ERROR_VALUE, BOUNDARY_EFFECT, REACTION_RAN, EFFECT } from './constants.js';\nimport { define_property, get_descriptor } from '../shared/utils.js';\nimport { active_effect, active_reaction } from './runtime.js';\n\nconst adjustments = new WeakMap();\n\n/**\n * @param {unknown} error\n */\nexport function handle_error(error) {\n\tvar effect = active_effect;\n\n\t// for unowned deriveds, don't throw until we read the value\n\tif (effect === null) {\n\t\t/** @type {Derived} */ (active_reaction).f |= ERROR_VALUE;\n\t\treturn error;\n\t}\n\n\tif (DEV && error instanceof Error && !adjustments.has(error)) {\n\t\tadjustments.set(error, get_adjustments(error, effect));\n\t}\n\n\t// if the error occurred while creating this subtree, we let it\n\t// bubble up until it hits a boundary that can handle it, unless\n\t// it's an $effect in which case it doesn't run immediately\n\tif ((effect.f & REACTION_RAN) === 0 && (effect.f & EFFECT) === 0) {\n\t\tif (DEV && !effect.parent && error instanceof Error) {\n\t\t\tapply_adjustments(error);\n\t\t}\n\n\t\tthrow error;\n\t}\n\n\t// otherwise we bubble up the effect tree ourselves\n\tinvoke_error_boundary(error, effect);\n}\n\n/**\n * @param {unknown} error\n * @param {Effect | null} effect\n */\nexport function invoke_error_boundary(error, effect) {\n\twhile (effect !== null) {\n\t\tif ((effect.f & BOUNDARY_EFFECT) !== 0) {\n\t\t\tif ((effect.f & REACTION_RAN) === 0) {\n\t\t\t\t// we are still creating the boundary effect\n\t\t\t\tthrow error;\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\t/** @type {Boundary} */ (effect.b).error(error);\n\t\t\t\treturn;\n\t\t\t} catch (e) {\n\t\t\t\terror = e;\n\t\t\t}\n\t\t}\n\n\t\teffect = effect.parent;\n\t}\n\n\tif (DEV && error instanceof Error) {\n\t\tapply_adjustments(error);\n\t}\n\n\tthrow error;\n}\n\n/**\n * Add useful information to the error message/stack in development\n * @param {Error} error\n * @param {Effect} effect\n */\nfunction get_adjustments(error, effect) {\n\tconst message_descriptor = get_descriptor(error, 'message');\n\n\t// if the message was already changed and it's not configurable we can't change it\n\t// or it will throw a different error swallowing the original error\n\tif (message_descriptor && !message_descriptor.configurable) return;\n\n\tvar indent = is_firefox ? ' ' : '\\t';\n\tvar component_stack = `\\n${indent}in ${effect.fn?.name || '<unknown>'}`;\n\tvar context = effect.ctx;\n\n\twhile (context !== null) {\n\t\tcomponent_stack += `\\n${indent}in ${context.function?.[FILENAME].split('/').pop()}`;\n\t\tcontext = context.p;\n\t}\n\n\treturn {\n\t\tmessage: error.message + `\\n${component_stack}\\n`,\n\t\tstack: error.stack\n\t\t\t?.split('\\n')\n\t\t\t.filter((line) => !line.includes('svelte/src/internal'))\n\t\t\t.join('\\n')\n\t};\n}\n\n/**\n * @param {Error} error\n */\nfunction apply_adjustments(error) {\n\tconst adjusted = adjustments.get(error);\n\n\tif (adjusted) {\n\t\tdefine_property(error, 'message', {\n\t\t\tvalue: adjusted.message\n\t\t});\n\n\t\tdefine_property(error, 'stack', {\n\t\t\tvalue: adjusted.stack\n\t\t});\n\t}\n}\n","/** @import { Derived, Signal } from '#client' */\nimport { CLEAN, CONNECTED, DIRTY, MAYBE_DIRTY } from '#client/constants';\n\nconst STATUS_MASK = ~(DIRTY | MAYBE_DIRTY | CLEAN);\n\n/**\n * @param {Signal} signal\n * @param {number} status\n */\nexport function set_signal_status(signal, status) {\n\tsignal.f = (signal.f & STATUS_MASK) | status;\n}\n\n/**\n * Set a derived's status to CLEAN or MAYBE_DIRTY based on its connection state.\n * @param {Derived} derived\n */\nexport function update_derived_status(derived) {\n\t// Only mark as MAYBE_DIRTY if disconnected and has dependencies.\n\tif ((derived.f & CONNECTED) !== 0 || derived.deps === null) {\n\t\tset_signal_status(derived, CLEAN);\n\t} else {\n\t\tset_signal_status(derived, MAYBE_DIRTY);\n\t}\n}\n","/** @import { Derived, Effect, Value } from '#client' */\nimport { CLEAN, DERIVED, DIRTY, MAYBE_DIRTY, WAS_MARKED } from '#client/constants';\nimport { set_signal_status } from './status.js';\n\n/**\n * @param {Value[] | null} deps\n */\nfunction clear_marked(deps) {\n\tif (deps === null) return;\n\n\tfor (const dep of deps) {\n\t\tif ((dep.f & DERIVED) === 0 || (dep.f & WAS_MARKED) === 0) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tdep.f ^= WAS_MARKED;\n\n\t\tclear_marked(/** @type {Derived} */ (dep).deps);\n\t}\n}\n\n/**\n * @param {Effect} effect\n * @param {Set<Effect>} dirty_effects\n * @param {Set<Effect>} maybe_dirty_effects\n */\nexport function defer_effect(effect, dirty_effects, maybe_dirty_effects) {\n\tif ((effect.f & DIRTY) !== 0) {\n\t\tdirty_effects.add(effect);\n\t} else if ((effect.f & MAYBE_DIRTY) !== 0) {\n\t\tmaybe_dirty_effects.add(effect);\n\t}\n\n\t// Since we're not executing these effects now, we need to clear any WAS_MARKED flags\n\t// so that other batches can correctly reach these effects during their own traversal\n\tclear_marked(effect.deps);\n\n\t// mark as clean so they get scheduled if they depend on pending async state\n\tset_signal_status(effect, CLEAN);\n}\n","/** @import { StoreReferencesContainer } from '#client' */\n/** @import { Store } from '#shared' */\nimport { subscribe_to_store } from '../../../store/utils.js';\nimport { get as get_store } from '../../../store/shared/index.js';\nimport { define_property, noop } from '../../shared/utils.js';\nimport { get } from '../runtime.js';\nimport { teardown } from './effects.js';\nimport { mutable_source, set } from './sources.js';\nimport { DEV } from 'esm-env';\n\n/**\n * We set this to `true` when updating a store so that we correctly\n * schedule effects if the update takes place inside a `$:` effect\n */\nexport let legacy_is_updating_store = false;\n\n/**\n * Whether or not the prop currently being read is a store binding, as in\n * `<Child bind:x={$y} />`. If it is, we treat the prop as mutable even in\n * runes mode, and skip `binding_property_non_reactive` validation\n */\nlet is_store_binding = false;\n\nlet IS_UNMOUNTED = Symbol();\n\n/**\n * Gets the current value of a store. If the store isn't subscribed to yet, it will create a proxy\n * signal that will be updated when the store is. The store references container is needed to\n * track reassignments to stores and to track the correct component context.\n * @template V\n * @param {Store<V> | null | undefined} store\n * @param {string} store_name\n * @param {StoreReferencesContainer} stores\n * @returns {V}\n */\nexport function store_get(store, store_name, stores) {\n\tconst entry = (stores[store_name] ??= {\n\t\tstore: null,\n\t\tsource: mutable_source(undefined),\n\t\tunsubscribe: noop\n\t});\n\n\tif (DEV) {\n\t\tentry.source.label = store_name;\n\t}\n\n\t// if the component that setup this is already unmounted we don't want to register a subscription\n\tif (entry.store !== store && !(IS_UNMOUNTED in stores)) {\n\t\tentry.unsubscribe();\n\t\tentry.store = store ?? null;\n\n\t\tif (store == null) {\n\t\t\tentry.source.v = undefined; // see synchronous callback comment below\n\t\t\tentry.unsubscribe = noop;\n\t\t} else {\n\t\t\tvar is_synchronous_callback = true;\n\n\t\t\tentry.unsubscribe = subscribe_to_store(store, (v) => {\n\t\t\t\tif (is_synchronous_callback) {\n\t\t\t\t\t// If the first updates to the store value (possibly multiple of them) are synchronously\n\t\t\t\t\t// inside a derived, we will hit the `state_unsafe_mutation` error if we `set` the value\n\t\t\t\t\tentry.source.v = v;\n\t\t\t\t} else {\n\t\t\t\t\tset(entry.source, v);\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tis_synchronous_callback = false;\n\t\t}\n\t}\n\n\t// if the component that setup this stores is already unmounted the source will be out of sync\n\t// so we just use the `get` for the stores, less performant but it avoids to create a memory leak\n\t// and it will keep the value consistent\n\tif (store && IS_UNMOUNTED in stores) {\n\t\treturn get_store(store);\n\t}\n\n\treturn get(entry.source);\n}\n\n/**\n * Unsubscribe from a store if it's not the same as the one in the store references container.\n * We need this in addition to `store_get` because someone could unsubscribe from a store but\n * then never subscribe to the new one (if any), causing the subscription to stay open wrongfully.\n * @param {Store<any> | null | undefined} store\n * @param {string} store_name\n * @param {StoreReferencesContainer} stores\n */\nexport function store_unsub(store, store_name, stores) {\n\t/** @type {StoreReferencesContainer[''] | undefined} */\n\tlet entry = stores[store_name];\n\n\tif (entry && entry.store !== store) {\n\t\t// Don't reset store yet, so that store_get above can resubscribe to new store if necessary\n\t\tentry.unsubscribe();\n\t\tentry.unsubscribe = noop;\n\t}\n\n\treturn store;\n}\n\n/**\n * Sets the new value of a store and returns that value.\n * @template V\n * @param {Store<V>} store\n * @param {V} value\n * @returns {V}\n */\nexport function store_set(store, value) {\n\tupdate_with_flag(store, value);\n\treturn value;\n}\n\n/**\n * @param {StoreReferencesContainer} stores\n * @param {string} store_name\n */\nexport function invalidate_store(stores, store_name) {\n\tvar entry = stores[store_name];\n\tif (entry.store !== null) {\n\t\tstore_set(entry.store, entry.source.v);\n\t}\n}\n\n/**\n * Unsubscribes from all auto-subscribed stores on destroy\n * @returns {[StoreReferencesContainer, ()=>void]}\n */\nexport function setup_stores() {\n\t/** @type {StoreReferencesContainer} */\n\tconst stores = {};\n\n\tfunction cleanup() {\n\t\tteardown(() => {\n\t\t\tfor (var store_name in stores) {\n\t\t\t\tconst ref = stores[store_name];\n\t\t\t\tref.unsubscribe();\n\t\t\t}\n\t\t\tdefine_property(stores, IS_UNMOUNTED, {\n\t\t\t\tenumerable: false,\n\t\t\t\tvalue: true\n\t\t\t});\n\t\t});\n\t}\n\n\treturn [stores, cleanup];\n}\n\n/**\n * @param {Store<V>} store\n * @param {V} value\n * @template V\n */\nfunction update_with_flag(store, value) {\n\tlegacy_is_updating_store = true;\n\n\ttry {\n\t\tstore.set(value);\n\t} finally {\n\t\tlegacy_is_updating_store = false;\n\t}\n}\n\n/**\n * Updates a store with a new value.\n * @param {Store<V>} store the store to update\n * @param {any} expression the expression that mutates the store\n * @param {V} new_value the new store value\n * @template V\n */\nexport function store_mutate(store, expression, new_value) {\n\tupdate_with_flag(store, new_value);\n\treturn expression;\n}\n\n/**\n * @param {Store<number>} store\n * @param {number} store_value\n * @param {1 | -1} [d]\n * @returns {number}\n */\nexport function update_store(store, store_value, d = 1) {\n\tupdate_with_flag(store, store_value + d);\n\treturn store_value;\n}\n\n/**\n * @param {Store<number>} store\n * @param {number} store_value\n * @param {1 | -1} [d]\n * @returns {number}\n */\nexport function update_pre_store(store, store_value, d = 1) {\n\tconst value = store_value + d;\n\tupdate_with_flag(store, value);\n\treturn value;\n}\n\n/**\n * Called inside prop getters to communicate that the prop is a store binding\n */\nexport function mark_store_binding() {\n\tis_store_binding = true;\n}\n\n/**\n * Returns a tuple that indicates whether `fn()` reads a prop that is a store binding.\n * Used to prevent `binding_property_non_reactive` validation false positives and\n * ensure that these props are treated as mutable even in runes mode\n * @template T\n * @param {() => T} fn\n * @returns {[T, boolean]}\n */\nexport function capture_store_binding(fn) {\n\tvar previous_is_store_binding = is_store_binding;\n\n\ttry {\n\t\tis_store_binding = false;\n\t\treturn [fn(), is_store_binding];\n\t} finally {\n\t\tis_store_binding = previous_is_store_binding;\n\t}\n}\n","/** @import { Fork } from 'svelte' */\n/** @import { Derived, Effect, Reaction, Source, Value } from '#client' */\nimport {\n\tBLOCK_EFFECT,\n\tBRANCH_EFFECT,\n\tCLEAN,\n\tDESTROYED,\n\tDIRTY,\n\tEFFECT,\n\tASYNC,\n\tINERT,\n\tRENDER_EFFECT,\n\tROOT_EFFECT,\n\tMAYBE_DIRTY,\n\tDERIVED,\n\tEAGER_EFFECT,\n\tERROR_VALUE,\n\tMANAGED_EFFECT,\n\tREACTION_RAN\n} from '#client/constants';\nimport { async_mode_flag } from '../../flags/index.js';\nimport { deferred, define_property, includes } from '../../shared/utils.js';\nimport {\n\tactive_effect,\n\tactive_reaction,\n\tget,\n\tincrement_write_version,\n\tis_dirty,\n\tupdate_effect\n} from '../runtime.js';\nimport * as e from '../errors.js';\nimport { flush_tasks, queue_micro_task } from '../dom/task.js';\nimport { DEV } from 'esm-env';\nimport { invoke_error_boundary } from '../error-handling.js';\nimport { flush_eager_effects, old_values, set_eager_effects, source, update } from './sources.js';\nimport { eager_effect, unlink_effect } from './effects.js';\nimport { defer_effect } from './utils.js';\nimport { UNINITIALIZED } from '../../../constants.js';\nimport { set_signal_status } from './status.js';\nimport { legacy_is_updating_store } from './store.js';\nimport { invariant } from '../../shared/dev.js';\nimport { log_effect_tree } from '../dev/debug.js';\n\n/** @type {Set<Batch>} */\nconst batches = new Set();\n\n/** @type {Batch | null} */\nexport let current_batch = null;\n\n/**\n * This is needed to avoid overwriting inputs\n * @type {Batch | null}\n */\nexport let previous_batch = null;\n\n/**\n * When time travelling (i.e. working in one batch, while other batches\n * still have ongoing work), we ignore the real values of affected\n * signals in favour of their values within the batch\n * @type {Map<Value, any> | null}\n */\nexport let batch_values = null;\n\n/** @type {Effect | null} */\nlet last_scheduled_effect = null;\n\nexport let is_flushing_sync = false;\nlet is_processing = false;\n\n/**\n * During traversal, this is an array. Newly created effects are (if not immediately\n * executed) pushed to this array, rather than going through the scheduling\n * rigamarole that would cause another turn of the flush loop.\n * @type {Effect[] | null}\n */\nexport let collected_effects = null;\n\n/**\n * An array of effects that are marked during traversal as a result of a `set`\n * (not `internal_set`) call. These will be added to the next batch and\n * trigger another `batch.process()`\n * @type {Effect[] | null}\n * @deprecated when we get rid of legacy mode and stores, we can get rid of this\n */\nexport let legacy_updates = null;\n\nvar flush_count = 0;\nvar source_stacks = DEV ? new Set() : null;\n\nlet uid = 1;\n\nexport class Batch {\n\tid = uid++;\n\n\t/**\n\t * The current values of any signals that are updated in this batch.\n\t * Tuple format: [value, is_derived] (note: is_derived is false for deriveds, too, if they were overridden via assignment)\n\t * They keys of this map are identical to `this.#previous`\n\t * @type {Map<Value, [any, boolean]>}\n\t */\n\tcurrent = new Map();\n\n\t/**\n\t * The values of any signals (sources and deriveds) that are updated in this batch _before_ those updates took place.\n\t * They keys of this map are identical to `this.#current`\n\t * @type {Map<Value, any>}\n\t */\n\tprevious = new Map();\n\n\t/**\n\t * When the batch is committed (and the DOM is updated), we need to remove old branches\n\t * and append new ones by calling the functions added inside (if/each/key/etc) blocks\n\t * @type {Set<(batch: Batch) => void>}\n\t */\n\t#commit_callbacks = new Set();\n\n\t/**\n\t * If a fork is discarded, we need to destroy any effects that are no longer needed\n\t * @type {Set<(batch: Batch) => void>}\n\t */\n\t#discard_callbacks = new Set();\n\n\t/**\n\t * Async effects that are currently in flight\n\t * @type {Map<Effect, number>}\n\t */\n\t#pending = new Map();\n\n\t/**\n\t * Async effects that are currently in flight, _not_ inside a pending boundary\n\t * @type {Map<Effect, number>}\n\t */\n\t#blocking_pending = new Map();\n\n\t/**\n\t * A deferred that resolves when the batch is committed, used with `settled()`\n\t * TODO replace with Promise.withResolvers once supported widely enough\n\t * @type {{ promise: Promise<void>, resolve: (value?: any) => void, reject: (reason: unknown) => void } | null}\n\t */\n\t#deferred = null;\n\n\t/**\n\t * The root effects that need to be flushed\n\t * @type {Effect[]}\n\t */\n\t#roots = [];\n\n\t/**\n\t * Effects created while this batch was active.\n\t * @type {Effect[]}\n\t */\n\t#new_effects = [];\n\n\t/**\n\t * Deferred effects (which run after async work has completed) that are DIRTY\n\t * @type {Set<Effect>}\n\t */\n\t#dirty_effects = new Set();\n\n\t/**\n\t * Deferred effects that are MAYBE_DIRTY\n\t * @type {Set<Effect>}\n\t */\n\t#maybe_dirty_effects = new Set();\n\n\t/**\n\t * A map of branches that still exist, but will be destroyed when this batch\n\t * is committed — we skip over these during `process`.\n\t * The value contains child effects that were dirty/maybe_dirty before being reset,\n\t * so they can be rescheduled if the branch survives.\n\t * @type {Map<Effect, { d: Effect[], m: Effect[] }>}\n\t */\n\t#skipped_branches = new Map();\n\n\tis_fork = false;\n\n\t#decrement_queued = false;\n\n\t/** @type {Set<Batch>} */\n\t#blockers = new Set();\n\n\t#is_deferred() {\n\t\treturn this.is_fork || this.#blocking_pending.size > 0;\n\t}\n\n\t#is_blocked() {\n\t\tfor (const batch of this.#blockers) {\n\t\t\tfor (const effect of batch.#blocking_pending.keys()) {\n\t\t\t\tvar skipped = false;\n\t\t\t\tvar e = effect;\n\n\t\t\t\twhile (e.parent !== null) {\n\t\t\t\t\tif (this.#skipped_branches.has(e)) {\n\t\t\t\t\t\tskipped = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\te = e.parent;\n\t\t\t\t}\n\n\t\t\t\tif (!skipped) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n\n\t/**\n\t * Add an effect to the #skipped_branches map and reset its children\n\t * @param {Effect} effect\n\t */\n\tskip_effect(effect) {\n\t\tif (!this.#skipped_branches.has(effect)) {\n\t\t\tthis.#skipped_branches.set(effect, { d: [], m: [] });\n\t\t}\n\t}\n\n\t/**\n\t * Remove an effect from the #skipped_branches map and reschedule\n\t * any tracked dirty/maybe_dirty child effects\n\t * @param {Effect} effect\n\t */\n\tunskip_effect(effect) {\n\t\tvar tracked = this.#skipped_branches.get(effect);\n\t\tif (tracked) {\n\t\t\tthis.#skipped_branches.delete(effect);\n\n\t\t\tfor (var e of tracked.d) {\n\t\t\t\tset_signal_status(e, DIRTY);\n\t\t\t\tthis.schedule(e);\n\t\t\t}\n\n\t\t\tfor (e of tracked.m) {\n\t\t\t\tset_signal_status(e, MAYBE_DIRTY);\n\t\t\t\tthis.schedule(e);\n\t\t\t}\n\t\t}\n\t}\n\n\t#process() {\n\t\tif (flush_count++ > 1000) {\n\t\t\tbatches.delete(this);\n\t\t\tinfinite_loop_guard();\n\t\t}\n\n\t\t// we only reschedule previously-deferred effects if we expect\n\t\t// to be able to run them after processing the batch\n\t\tif (!this.#is_deferred()) {\n\t\t\tfor (const e of this.#dirty_effects) {\n\t\t\t\tthis.#maybe_dirty_effects.delete(e);\n\t\t\t\tset_signal_status(e, DIRTY);\n\t\t\t\tthis.schedule(e);\n\t\t\t}\n\n\t\t\tfor (const e of this.#maybe_dirty_effects) {\n\t\t\t\tset_signal_status(e, MAYBE_DIRTY);\n\t\t\t\tthis.schedule(e);\n\t\t\t}\n\t\t}\n\n\t\tconst roots = this.#roots;\n\t\tthis.#roots = [];\n\n\t\tthis.apply();\n\n\t\t/** @type {Effect[]} */\n\t\tvar effects = (collected_effects = []);\n\n\t\t/** @type {Effect[]} */\n\t\tvar render_effects = [];\n\n\t\t/**\n\t\t * @type {Effect[]}\n\t\t * @deprecated when we get rid of legacy mode and stores, we can get rid of this\n\t\t */\n\t\tvar updates = (legacy_updates = []);\n\n\t\tfor (const root of roots) {\n\t\t\ttry {\n\t\t\t\tthis.#traverse(root, effects, render_effects);\n\t\t\t} catch (e) {\n\t\t\t\treset_all(root);\n\t\t\t\tthrow e;\n\t\t\t}\n\t\t}\n\n\t\t// any writes should take effect in a subsequent batch\n\t\tcurrent_batch = null;\n\n\t\tif (updates.length > 0) {\n\t\t\tvar batch = Batch.ensure();\n\t\t\tfor (const e of updates) {\n\t\t\t\tbatch.schedule(e);\n\t\t\t}\n\t\t}\n\n\t\tcollected_effects = null;\n\t\tlegacy_updates = null;\n\n\t\tif (this.#is_deferred() || this.#is_blocked()) {\n\t\t\tthis.#defer_effects(render_effects);\n\t\t\tthis.#defer_effects(effects);\n\n\t\t\tfor (const [e, t] of this.#skipped_branches) {\n\t\t\t\treset_branch(e, t);\n\t\t\t}\n\t\t} else {\n\t\t\tif (this.#pending.size === 0) {\n\t\t\t\tbatches.delete(this);\n\t\t\t}\n\n\t\t\t// clear effects. Those that are still needed will be rescheduled through unskipping the skipped branches.\n\t\t\tthis.#dirty_effects.clear();\n\t\t\tthis.#maybe_dirty_effects.clear();\n\n\t\t\t// append/remove branches\n\t\t\tfor (const fn of this.#commit_callbacks) fn(this);\n\t\t\tthis.#commit_callbacks.clear();\n\n\t\t\tprevious_batch = this;\n\t\t\tflush_queued_effects(render_effects);\n\t\t\tflush_queued_effects(effects);\n\t\t\tprevious_batch = null;\n\n\t\t\tthis.#deferred?.resolve();\n\t\t}\n\n\t\tvar next_batch = /** @type {Batch | null} */ (/** @type {unknown} */ (current_batch));\n\n\t\t// Edge case: During traversal new branches might create effects that run immediately and set state,\n\t\t// causing an effect and therefore a root to be scheduled again. We need to traverse the current batch\n\t\t// once more in that case - most of the time this will just clean up dirty branches.\n\t\tif (this.#roots.length > 0) {\n\t\t\tconst batch = (next_batch ??= this);\n\t\t\tbatch.#roots.push(...this.#roots.filter((r) => !batch.#roots.includes(r)));\n\t\t}\n\n\t\tif (next_batch !== null) {\n\t\t\tbatches.add(next_batch);\n\n\t\t\tif (DEV) {\n\t\t\t\tfor (const source of this.current.keys()) {\n\t\t\t\t\t/** @type {Set<Source>} */ (source_stacks).add(source);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tnext_batch.#process();\n\t\t}\n\n\t\tif (!batches.has(this)) {\n\t\t\tthis.#commit();\n\t\t}\n\t}\n\n\t/**\n\t * Traverse the effect tree, executing effects or stashing\n\t * them for later execution as appropriate\n\t * @param {Effect} root\n\t * @param {Effect[]} effects\n\t * @param {Effect[]} render_effects\n\t */\n\t#traverse(root, effects, render_effects) {\n\t\troot.f ^= CLEAN;\n\n\t\tvar effect = root.first;\n\n\t\twhile (effect !== null) {\n\t\t\tvar flags = effect.f;\n\t\t\tvar is_branch = (flags & (BRANCH_EFFECT | ROOT_EFFECT)) !== 0;\n\t\t\tvar is_skippable_branch = is_branch && (flags & CLEAN) !== 0;\n\n\t\t\tvar skip = is_skippable_branch || (flags & INERT) !== 0 || this.#skipped_branches.has(effect);\n\n\t\t\tif (!skip && effect.fn !== null) {\n\t\t\t\tif (is_branch) {\n\t\t\t\t\teffect.f ^= CLEAN;\n\t\t\t\t} else if ((flags & EFFECT) !== 0) {\n\t\t\t\t\teffects.push(effect);\n\t\t\t\t} else if (async_mode_flag && (flags & (RENDER_EFFECT | MANAGED_EFFECT)) !== 0) {\n\t\t\t\t\trender_effects.push(effect);\n\t\t\t\t} else if (is_dirty(effect)) {\n\t\t\t\t\tif ((flags & BLOCK_EFFECT) !== 0) this.#maybe_dirty_effects.add(effect);\n\t\t\t\t\tupdate_effect(effect);\n\t\t\t\t}\n\n\t\t\t\tvar child = effect.first;\n\n\t\t\t\tif (child !== null) {\n\t\t\t\t\teffect = child;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\twhile (effect !== null) {\n\t\t\t\tvar next = effect.next;\n\n\t\t\t\tif (next !== null) {\n\t\t\t\t\teffect = next;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\teffect = effect.parent;\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * @param {Effect[]} effects\n\t */\n\t#defer_effects(effects) {\n\t\tfor (var i = 0; i < effects.length; i += 1) {\n\t\t\tdefer_effect(effects[i], this.#dirty_effects, this.#maybe_dirty_effects);\n\t\t}\n\t}\n\n\t/**\n\t * Associate a change to a given source with the current\n\t * batch, noting its previous and current values\n\t * @param {Value} source\n\t * @param {any} old_value\n\t * @param {boolean} [is_derived]\n\t */\n\tcapture(source, old_value, is_derived = false) {\n\t\tif (old_value !== UNINITIALIZED && !this.previous.has(source)) {\n\t\t\tthis.previous.set(source, old_value);\n\t\t}\n\n\t\t// Don't save errors in `batch_values`, or they won't be thrown in `runtime.js#get`\n\t\tif ((source.f & ERROR_VALUE) === 0) {\n\t\t\tthis.current.set(source, [source.v, is_derived]);\n\t\t\tbatch_values?.set(source, source.v);\n\t\t}\n\t}\n\n\tactivate() {\n\t\tcurrent_batch = this;\n\t}\n\n\tdeactivate() {\n\t\tcurrent_batch = null;\n\t\tbatch_values = null;\n\t}\n\n\tflush() {\n\t\tvar source_stacks = DEV ? new Set() : null;\n\n\t\ttry {\n\t\t\tis_processing = true;\n\t\t\tcurrent_batch = this;\n\n\t\t\tthis.#process();\n\t\t} finally {\n\t\t\tflush_count = 0;\n\t\t\tlast_scheduled_effect = null;\n\t\t\tcollected_effects = null;\n\t\t\tlegacy_updates = null;\n\t\t\tis_processing = false;\n\n\t\t\tcurrent_batch = null;\n\t\t\tbatch_values = null;\n\n\t\t\told_values.clear();\n\n\t\t\tif (DEV) {\n\t\t\t\tfor (const source of /** @type {Set<Source>} */ (source_stacks)) {\n\t\t\t\t\tsource.updated = null;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tdiscard() {\n\t\tfor (const fn of this.#discard_callbacks) fn(this);\n\t\tthis.#discard_callbacks.clear();\n\n\t\tbatches.delete(this);\n\t}\n\n\t/**\n\t * @param {Effect} effect\n\t */\n\tregister_created_effect(effect) {\n\t\tthis.#new_effects.push(effect);\n\t}\n\n\t#commit() {\n\t\t// If there are other pending batches, they now need to be 'rebased' —\n\t\t// in other words, we re-run block/async effects with the newly\n\t\t// committed state, unless the batch in question has a more\n\t\t// recent value for a given source\n\t\tfor (const batch of batches) {\n\t\t\tvar is_earlier = batch.id < this.id;\n\n\t\t\t/** @type {Source[]} */\n\t\t\tvar sources = [];\n\n\t\t\tfor (const [source, [value, is_derived]] of this.current) {\n\t\t\t\tif (batch.current.has(source)) {\n\t\t\t\t\tvar batch_value = /** @type {[any, boolean]} */ (batch.current.get(source))[0]; // faster than destructuring\n\n\t\t\t\t\tif (is_earlier && value !== batch_value) {\n\t\t\t\t\t\t// bring the value up to date\n\t\t\t\t\t\tbatch.current.set(source, [value, is_derived]);\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// same value or later batch has more recent value,\n\t\t\t\t\t\t// no need to re-run these effects\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tsources.push(source);\n\t\t\t}\n\n\t\t\t// Re-run async/block effects that depend on distinct values changed in both batches\n\t\t\tvar others = [...batch.current.keys()].filter((s) => !this.current.has(s));\n\n\t\t\tif (others.length === 0) {\n\t\t\t\tif (is_earlier) {\n\t\t\t\t\t// this batch is now obsolete and can be discarded\n\t\t\t\t\tbatch.discard();\n\t\t\t\t}\n\t\t\t} else if (sources.length > 0) {\n\t\t\t\tif (DEV) {\n\t\t\t\t\tinvariant(batch.#roots.length === 0, 'Batch has scheduled roots');\n\t\t\t\t}\n\n\t\t\t\tbatch.activate();\n\n\t\t\t\t/** @type {Set<Value>} */\n\t\t\t\tvar marked = new Set();\n\n\t\t\t\t/** @type {Map<Reaction, boolean>} */\n\t\t\t\tvar checked = new Map();\n\n\t\t\t\tfor (var source of sources) {\n\t\t\t\t\tmark_effects(source, others, marked, checked);\n\t\t\t\t}\n\n\t\t\t\tchecked = new Map();\n\t\t\t\tvar current_unequal = [...batch.current.keys()].filter((c) =>\n\t\t\t\t\tthis.current.has(c) ? /** @type {[any, boolean]} */ (this.current.get(c))[0] !== c : true\n\t\t\t\t);\n\n\t\t\t\tfor (const effect of this.#new_effects) {\n\t\t\t\t\tif (\n\t\t\t\t\t\t(effect.f & (DESTROYED | INERT | EAGER_EFFECT)) === 0 &&\n\t\t\t\t\t\tdepends_on(effect, current_unequal, checked)\n\t\t\t\t\t) {\n\t\t\t\t\t\tif ((effect.f & (ASYNC | BLOCK_EFFECT)) !== 0) {\n\t\t\t\t\t\t\tset_signal_status(effect, DIRTY);\n\t\t\t\t\t\t\tbatch.schedule(effect);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tbatch.#dirty_effects.add(effect);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Only apply and traverse when we know we triggered async work with marking the effects\n\t\t\t\tif (batch.#roots.length > 0) {\n\t\t\t\t\tbatch.apply();\n\n\t\t\t\t\tfor (var root of batch.#roots) {\n\t\t\t\t\t\tbatch.#traverse(root, [], []);\n\t\t\t\t\t}\n\n\t\t\t\t\tbatch.#roots = [];\n\t\t\t\t}\n\n\t\t\t\tbatch.deactivate();\n\t\t\t}\n\t\t}\n\n\t\tfor (const batch of batches) {\n\t\t\tif (batch.#blockers.has(this)) {\n\t\t\t\tbatch.#blockers.delete(this);\n\n\t\t\t\tif (batch.#blockers.size === 0 && !batch.#is_deferred()) {\n\t\t\t\t\tbatch.activate();\n\t\t\t\t\tbatch.#process();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * @param {boolean} blocking\n\t * @param {Effect} effect\n\t */\n\tincrement(blocking, effect) {\n\t\tlet pending_count = this.#pending.get(effect) ?? 0;\n\t\tthis.#pending.set(effect, pending_count + 1);\n\n\t\tif (blocking) {\n\t\t\tlet blocking_pending_count = this.#blocking_pending.get(effect) ?? 0;\n\t\t\tthis.#blocking_pending.set(effect, blocking_pending_count + 1);\n\t\t}\n\t}\n\n\t/**\n\t * @param {boolean} blocking\n\t * @param {Effect} effect\n\t * @param {boolean} skip - whether to skip updates (because this is triggered by a stale reaction)\n\t */\n\tdecrement(blocking, effect, skip) {\n\t\tlet pending_count = this.#pending.get(effect) ?? 0;\n\n\t\tif (pending_count === 1) {\n\t\t\tthis.#pending.delete(effect);\n\t\t} else {\n\t\t\tthis.#pending.set(effect, pending_count - 1);\n\t\t}\n\n\t\tif (blocking) {\n\t\t\tlet blocking_pending_count = this.#blocking_pending.get(effect) ?? 0;\n\n\t\t\tif (blocking_pending_count === 1) {\n\t\t\t\tthis.#blocking_pending.delete(effect);\n\t\t\t} else {\n\t\t\t\tthis.#blocking_pending.set(effect, blocking_pending_count - 1);\n\t\t\t}\n\t\t}\n\n\t\tif (this.#decrement_queued || skip) return;\n\t\tthis.#decrement_queued = true;\n\n\t\tqueue_micro_task(() => {\n\t\t\tthis.#decrement_queued = false;\n\t\t\tthis.flush();\n\t\t});\n\t}\n\n\t/**\n\t * @param {Set<Effect>} dirty_effects\n\t * @param {Set<Effect>} maybe_dirty_effects\n\t */\n\ttransfer_effects(dirty_effects, maybe_dirty_effects) {\n\t\tfor (const e of dirty_effects) {\n\t\t\tthis.#dirty_effects.add(e);\n\t\t}\n\n\t\tfor (const e of maybe_dirty_effects) {\n\t\t\tthis.#maybe_dirty_effects.add(e);\n\t\t}\n\n\t\tdirty_effects.clear();\n\t\tmaybe_dirty_effects.clear();\n\t}\n\n\t/** @param {(batch: Batch) => void} fn */\n\toncommit(fn) {\n\t\tthis.#commit_callbacks.add(fn);\n\t}\n\n\t/** @param {(batch: Batch) => void} fn */\n\tondiscard(fn) {\n\t\tthis.#discard_callbacks.add(fn);\n\t}\n\n\tsettled() {\n\t\treturn (this.#deferred ??= deferred()).promise;\n\t}\n\n\tstatic ensure() {\n\t\tif (current_batch === null) {\n\t\t\tconst batch = (current_batch = new Batch());\n\n\t\t\tif (!is_processing) {\n\t\t\t\tbatches.add(current_batch);\n\n\t\t\t\tif (!is_flushing_sync) {\n\t\t\t\t\tqueue_micro_task(() => {\n\t\t\t\t\t\tif (current_batch !== batch) {\n\t\t\t\t\t\t\t// a flushSync happened in the meantime\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tbatch.flush();\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn current_batch;\n\t}\n\n\tapply() {\n\t\tif (!async_mode_flag || (!this.is_fork && batches.size === 1)) {\n\t\t\tbatch_values = null;\n\t\t\treturn;\n\t\t}\n\n\t\t// if there are multiple batches, we are 'time travelling' —\n\t\t// we need to override values with the ones in this batch...\n\t\tbatch_values = new Map();\n\t\tfor (const [source, [value]] of this.current) {\n\t\t\tbatch_values.set(source, value);\n\t\t}\n\n\t\t// ...and undo changes belonging to other batches unless they block this one\n\t\tfor (const batch of batches) {\n\t\t\tif (batch === this || batch.is_fork) continue;\n\n\t\t\t// A batch is blocked on an earlier batch if it overlaps with the earlier batch's changes but is not a superset\n\t\t\tvar intersects = false;\n\t\t\tvar differs = false;\n\n\t\t\tif (batch.id < this.id) {\n\t\t\t\tfor (const [source, [, is_derived]] of batch.current) {\n\t\t\t\t\t// Derived values don't partake in the blocking mechanism, because a derived could\n\t\t\t\t\t// be triggered in one batch already but not the other one yet, causing a false-positive\n\t\t\t\t\tif (is_derived) continue;\n\n\t\t\t\t\tintersects ||= this.current.has(source);\n\t\t\t\t\tdiffers ||= !this.current.has(source);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (intersects && differs) {\n\t\t\t\tthis.#blockers.add(batch);\n\t\t\t} else {\n\t\t\t\tfor (const [source, previous] of batch.previous) {\n\t\t\t\t\tif (!batch_values.has(source)) {\n\t\t\t\t\t\tbatch_values.set(source, previous);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t *\n\t * @param {Effect} effect\n\t */\n\tschedule(effect) {\n\t\tlast_scheduled_effect = effect;\n\n\t\t// defer render effects inside a pending boundary\n\t\t// TODO the `REACTION_RAN` check is only necessary because of legacy `$:` effects AFAICT — we can remove later\n\t\tif (\n\t\t\teffect.b?.is_pending &&\n\t\t\t(effect.f & (EFFECT | RENDER_EFFECT | MANAGED_EFFECT)) !== 0 &&\n\t\t\t(effect.f & REACTION_RAN) === 0\n\t\t) {\n\t\t\teffect.b.defer_effect(effect);\n\t\t\treturn;\n\t\t}\n\n\t\tvar e = effect;\n\n\t\twhile (e.parent !== null) {\n\t\t\te = e.parent;\n\t\t\tvar flags = e.f;\n\n\t\t\t// if the effect is being scheduled because a parent (each/await/etc) block\n\t\t\t// updated an internal source, or because a branch is being unskipped,\n\t\t\t// bail out or we'll cause a second flush\n\t\t\tif (collected_effects !== null && e === active_effect) {\n\t\t\t\tif (async_mode_flag) return;\n\n\t\t\t\t// in sync mode, render effects run during traversal. in an extreme edge case\n\t\t\t\t// — namely that we're setting a value inside a derived read during traversal —\n\t\t\t\t// they can be made dirty after they have already been visited, in which\n\t\t\t\t// case we shouldn't bail out. we also shouldn't bail out if we're\n\t\t\t\t// updating a store inside a `$:`, since this might invalidate\n\t\t\t\t// effects that were already visited\n\t\t\t\tif (\n\t\t\t\t\t(active_reaction === null || (active_reaction.f & DERIVED) === 0) &&\n\t\t\t\t\t!legacy_is_updating_store\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ((flags & (ROOT_EFFECT | BRANCH_EFFECT)) !== 0) {\n\t\t\t\tif ((flags & CLEAN) === 0) {\n\t\t\t\t\t// branch is already dirty, bail\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\te.f ^= CLEAN;\n\t\t\t}\n\t\t}\n\n\t\tthis.#roots.push(e);\n\t}\n}\n\n/**\n * Synchronously flush any pending updates.\n * Returns void if no callback is provided, otherwise returns the result of calling the callback.\n * @template [T=void]\n * @param {(() => T) | undefined} [fn]\n * @returns {T}\n */\nexport function flushSync(fn) {\n\tvar was_flushing_sync = is_flushing_sync;\n\tis_flushing_sync = true;\n\n\ttry {\n\t\tvar result;\n\n\t\tif (fn) {\n\t\t\tif (current_batch !== null && !current_batch.is_fork) {\n\t\t\t\tcurrent_batch.flush();\n\t\t\t}\n\n\t\t\tresult = fn();\n\t\t}\n\n\t\twhile (true) {\n\t\t\tflush_tasks();\n\n\t\t\tif (current_batch === null) {\n\t\t\t\treturn /** @type {T} */ (result);\n\t\t\t}\n\n\t\t\tcurrent_batch.flush();\n\t\t}\n\t} finally {\n\t\tis_flushing_sync = was_flushing_sync;\n\t}\n}\n\nfunction infinite_loop_guard() {\n\tif (DEV) {\n\t\tvar updates = new Map();\n\n\t\tfor (const source of /** @type {Batch} */ (current_batch).current.keys()) {\n\t\t\tfor (const [stack, update] of source.updated ?? []) {\n\t\t\t\tvar entry = updates.get(stack);\n\n\t\t\t\tif (!entry) {\n\t\t\t\t\tentry = { error: update.error, count: 0 };\n\t\t\t\t\tupdates.set(stack, entry);\n\t\t\t\t}\n\n\t\t\t\tentry.count += update.count;\n\t\t\t}\n\t\t}\n\n\t\tfor (const update of updates.values()) {\n\t\t\tif (update.error) {\n\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\tconsole.error(update.error);\n\t\t\t}\n\t\t}\n\t}\n\n\ttry {\n\t\te.effect_update_depth_exceeded();\n\t} catch (error) {\n\t\tif (DEV) {\n\t\t\t// stack contains no useful information, replace it\n\t\t\tdefine_property(error, 'stack', { value: '' });\n\t\t}\n\n\t\t// Best effort: invoke the boundary nearest the most recent\n\t\t// effect and hope that it's relevant to the infinite loop\n\t\tinvoke_error_boundary(error, last_scheduled_effect);\n\t}\n}\n\n/** @type {Set<Effect> | null} */\nexport let eager_block_effects = null;\n\n/**\n * @param {Array<Effect>} effects\n * @returns {void}\n */\nfunction flush_queued_effects(effects) {\n\tvar length = effects.length;\n\tif (length === 0) return;\n\n\tvar i = 0;\n\n\twhile (i < length) {\n\t\tvar effect = effects[i++];\n\n\t\tif ((effect.f & (DESTROYED | INERT)) === 0 && is_dirty(effect)) {\n\t\t\teager_block_effects = new Set();\n\n\t\t\tupdate_effect(effect);\n\n\t\t\t// Effects with no dependencies or teardown do not get added to the effect tree.\n\t\t\t// Deferred effects (e.g. `$effect(...)`) _are_ added to the tree because we\n\t\t\t// don't know if we need to keep them until they are executed. Doing the check\n\t\t\t// here (rather than in `update_effect`) allows us to skip the work for\n\t\t\t// immediate effects.\n\t\t\tif (\n\t\t\t\teffect.deps === null &&\n\t\t\t\teffect.first === null &&\n\t\t\t\teffect.nodes === null &&\n\t\t\t\teffect.teardown === null &&\n\t\t\t\teffect.ac === null\n\t\t\t) {\n\t\t\t\t// remove this effect from the graph\n\t\t\t\tunlink_effect(effect);\n\t\t\t}\n\n\t\t\t// If update_effect() has a flushSync() in it, we may have flushed another flush_queued_effects(),\n\t\t\t// which already handled this logic and did set eager_block_effects to null.\n\t\t\tif (eager_block_effects?.size > 0) {\n\t\t\t\told_values.clear();\n\n\t\t\t\tfor (const e of eager_block_effects) {\n\t\t\t\t\t// Skip eager effects that have already been unmounted\n\t\t\t\t\tif ((e.f & (DESTROYED | INERT)) !== 0) continue;\n\n\t\t\t\t\t// Run effects in order from ancestor to descendant, else we could run into nullpointers\n\t\t\t\t\t/** @type {Effect[]} */\n\t\t\t\t\tconst ordered_effects = [e];\n\t\t\t\t\tlet ancestor = e.parent;\n\t\t\t\t\twhile (ancestor !== null) {\n\t\t\t\t\t\tif (eager_block_effects.has(ancestor)) {\n\t\t\t\t\t\t\teager_block_effects.delete(ancestor);\n\t\t\t\t\t\t\tordered_effects.push(ancestor);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tancestor = ancestor.parent;\n\t\t\t\t\t}\n\n\t\t\t\t\tfor (let j = ordered_effects.length - 1; j >= 0; j--) {\n\t\t\t\t\t\tconst e = ordered_effects[j];\n\t\t\t\t\t\t// Skip eager effects that have already been unmounted\n\t\t\t\t\t\tif ((e.f & (DESTROYED | INERT)) !== 0) continue;\n\t\t\t\t\t\tupdate_effect(e);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\teager_block_effects.clear();\n\t\t\t}\n\t\t}\n\t}\n\n\teager_block_effects = null;\n}\n\n/**\n * This is similar to `mark_reactions`, but it only marks async/block effects\n * depending on `value` and at least one of the other `sources`, so that\n * these effects can re-run after another batch has been committed\n * @param {Value} value\n * @param {Source[]} sources\n * @param {Set<Value>} marked\n * @param {Map<Reaction, boolean>} checked\n */\nfunction mark_effects(value, sources, marked, checked) {\n\tif (marked.has(value)) return;\n\tmarked.add(value);\n\n\tif (value.reactions !== null) {\n\t\tfor (const reaction of value.reactions) {\n\t\t\tconst flags = reaction.f;\n\n\t\t\tif ((flags & DERIVED) !== 0) {\n\t\t\t\tmark_effects(/** @type {Derived} */ (reaction), sources, marked, checked);\n\t\t\t} else if (\n\t\t\t\t(flags & (ASYNC | BLOCK_EFFECT)) !== 0 &&\n\t\t\t\t(flags & DIRTY) === 0 &&\n\t\t\t\tdepends_on(reaction, sources, checked)\n\t\t\t) {\n\t\t\t\tset_signal_status(reaction, DIRTY);\n\t\t\t\tschedule_effect(/** @type {Effect} */ (reaction));\n\t\t\t}\n\t\t}\n\t}\n}\n\n/**\n * When committing a fork, we need to trigger eager effects so that\n * any `$state.eager(...)` expressions update immediately. This\n * function allows us to discover them\n * @param {Value} value\n * @param {Set<Effect>} effects\n */\nfunction mark_eager_effects(value, effects) {\n\tif (value.reactions === null) return;\n\n\tfor (const reaction of value.reactions) {\n\t\tconst flags = reaction.f;\n\n\t\tif ((flags & DERIVED) !== 0) {\n\t\t\tmark_eager_effects(/** @type {Derived} */ (reaction), effects);\n\t\t} else if ((flags & EAGER_EFFECT) !== 0) {\n\t\t\tset_signal_status(reaction, DIRTY);\n\t\t\teffects.add(/** @type {Effect} */ (reaction));\n\t\t}\n\t}\n}\n\n/**\n * @param {Reaction} reaction\n * @param {Source[]} sources\n * @param {Map<Reaction, boolean>} checked\n */\nfunction depends_on(reaction, sources, checked) {\n\tconst depends = checked.get(reaction);\n\tif (depends !== undefined) return depends;\n\n\tif (reaction.deps !== null) {\n\t\tfor (const dep of reaction.deps) {\n\t\t\tif (includes.call(sources, dep)) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\tif ((dep.f & DERIVED) !== 0 && depends_on(/** @type {Derived} */ (dep), sources, checked)) {\n\t\t\t\tchecked.set(/** @type {Derived} */ (dep), true);\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t}\n\n\tchecked.set(reaction, false);\n\n\treturn false;\n}\n\n/**\n * @param {Effect} effect\n * @returns {void}\n */\nexport function schedule_effect(effect) {\n\t/** @type {Batch} */ (current_batch).schedule(effect);\n}\n\n/** @type {Source<number>[]} */\nlet eager_versions = [];\n\nfunction eager_flush() {\n\ttry {\n\t\tflushSync(() => {\n\t\t\tfor (const version of eager_versions) {\n\t\t\t\tupdate(version);\n\t\t\t}\n\t\t});\n\t} finally {\n\t\teager_versions = [];\n\t}\n}\n\n/**\n * Implementation of `$state.eager(fn())`\n * @template T\n * @param {() => T} fn\n * @returns {T}\n */\nexport function eager(fn) {\n\tvar version = source(0);\n\tvar initial = true;\n\tvar value = /** @type {T} */ (undefined);\n\n\tget(version);\n\n\teager_effect(() => {\n\t\tif (initial) {\n\t\t\t// the first time this runs, we create an eager effect\n\t\t\t// that will run eagerly whenever the expression changes\n\t\t\tvar previous_batch_values = batch_values;\n\n\t\t\ttry {\n\t\t\t\tbatch_values = null;\n\t\t\t\tvalue = fn();\n\t\t\t} finally {\n\t\t\t\tbatch_values = previous_batch_values;\n\t\t\t}\n\n\t\t\treturn;\n\t\t}\n\n\t\t// the second time this effect runs, it's to schedule a\n\t\t// `version` update. since this will recreate the effect,\n\t\t// we don't need to evaluate the expression here\n\t\tif (eager_versions.length === 0) {\n\t\t\tqueue_micro_task(eager_flush);\n\t\t}\n\n\t\teager_versions.push(version);\n\t});\n\n\tinitial = false;\n\n\treturn value;\n}\n\n/**\n * Mark all the effects inside a skipped branch CLEAN, so that\n * they can be correctly rescheduled later. Tracks dirty and maybe_dirty\n * effects so they can be rescheduled if the branch survives.\n * @param {Effect} effect\n * @param {{ d: Effect[], m: Effect[] }} tracked\n */\nfunction reset_branch(effect, tracked) {\n\t// clean branch = nothing dirty inside, no need to traverse further\n\tif ((effect.f & BRANCH_EFFECT) !== 0 && (effect.f & CLEAN) !== 0) {\n\t\treturn;\n\t}\n\n\tif ((effect.f & DIRTY) !== 0) {\n\t\ttracked.d.push(effect);\n\t} else if ((effect.f & MAYBE_DIRTY) !== 0) {\n\t\ttracked.m.push(effect);\n\t}\n\n\tset_signal_status(effect, CLEAN);\n\n\tvar e = effect.first;\n\twhile (e !== null) {\n\t\treset_branch(e, tracked);\n\t\te = e.next;\n\t}\n}\n\n/**\n * Mark an entire effect tree clean following an error\n * @param {Effect} effect\n */\nfunction reset_all(effect) {\n\tset_signal_status(effect, CLEAN);\n\n\tvar e = effect.first;\n\twhile (e !== null) {\n\t\treset_all(e);\n\t\te = e.next;\n\t}\n}\n\n/**\n * Creates a 'fork', in which state changes are evaluated but not applied to the DOM.\n * This is useful for speculatively loading data (for example) when you suspect that\n * the user is about to take some action.\n *\n * Frameworks like SvelteKit can use this to preload data when the user touches or\n * hovers over a link, making any subsequent navigation feel instantaneous.\n *\n * The `fn` parameter is a synchronous function that modifies some state. The\n * state changes will be reverted after the fork is initialised, then reapplied\n * if and when the fork is eventually committed.\n *\n * When it becomes clear that a fork will _not_ be committed (e.g. because the\n * user navigated elsewhere), it must be discarded to avoid leaking memory.\n *\n * @param {() => void} fn\n * @returns {Fork}\n * @since 5.42\n */\nexport function fork(fn) {\n\tif (!async_mode_flag) {\n\t\te.experimental_async_required('fork');\n\t}\n\n\tif (current_batch !== null) {\n\t\te.fork_timing();\n\t}\n\n\tvar batch = Batch.ensure();\n\tbatch.is_fork = true;\n\tbatch_values = new Map();\n\n\tvar committed = false;\n\tvar settled = batch.settled();\n\n\tflushSync(fn);\n\n\t// revert state changes\n\tfor (var [source, value] of batch.previous) {\n\t\tsource.v = value;\n\t}\n\n\treturn {\n\t\tcommit: async () => {\n\t\t\tif (committed) {\n\t\t\t\tawait settled;\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (!batches.has(batch)) {\n\t\t\t\te.fork_discarded();\n\t\t\t}\n\n\t\t\tcommitted = true;\n\n\t\t\tbatch.is_fork = false;\n\n\t\t\t// apply changes and update write versions so deriveds see the change\n\t\t\tfor (var [source, [value]] of batch.current) {\n\t\t\t\tsource.v = value;\n\t\t\t\tsource.wv = increment_write_version();\n\t\t\t}\n\n\t\t\t// trigger any `$state.eager(...)` expressions with the new state.\n\t\t\t// eager effects don't get scheduled like other effects, so we\n\t\t\t// can't just encounter them during traversal, we need to\n\t\t\t// proactively flush them\n\t\t\t// TODO maybe there's a better implementation?\n\t\t\tflushSync(() => {\n\t\t\t\t/** @type {Set<Effect>} */\n\t\t\t\tvar eager_effects = new Set();\n\n\t\t\t\tfor (var source of batch.current.keys()) {\n\t\t\t\t\tmark_eager_effects(source, eager_effects);\n\t\t\t\t}\n\n\t\t\t\tset_eager_effects(eager_effects);\n\t\t\t\tflush_eager_effects();\n\t\t\t});\n\n\t\t\tbatch.flush();\n\t\t\tawait settled;\n\t\t},\n\t\tdiscard: () => {\n\t\t\t// cause any MAYBE_DIRTY deriveds to update\n\t\t\t// if they depend on things thath changed\n\t\t\t// inside the discarded fork\n\t\t\tfor (var source of batch.current.keys()) {\n\t\t\t\tsource.wv = increment_write_version();\n\t\t\t}\n\n\t\t\tif (!committed && batches.has(batch)) {\n\t\t\t\tbatch.discard();\n\t\t\t}\n\t\t}\n\t};\n}\n\n/**\n * Forcibly remove all current batches, to prevent cross-talk between tests\n */\nexport function clear() {\n\tbatches.clear();\n}\n","/* This file is generated by scripts/process-messages/index.js. Do not edit! */\n\nimport { DEV } from 'esm-env';\n\nexport * from '../shared/errors.js';\n\n/**\n * Cannot create a `$derived(...)` with an `await` expression outside of an effect tree\n * @returns {never}\n */\nexport function async_derived_orphan() {\n\tif (DEV) {\n\t\tconst error = new Error(`async_derived_orphan\\nCannot create a \\`$derived(...)\\` with an \\`await\\` expression outside of an effect tree\\nhttps://svelte.dev/e/async_derived_orphan`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/async_derived_orphan`);\n\t}\n}\n\n/**\n * Using `bind:value` together with a checkbox input is not allowed. Use `bind:checked` instead\n * @returns {never}\n */\nexport function bind_invalid_checkbox_value() {\n\tif (DEV) {\n\t\tconst error = new Error(`bind_invalid_checkbox_value\\nUsing \\`bind:value\\` together with a checkbox input is not allowed. Use \\`bind:checked\\` instead\\nhttps://svelte.dev/e/bind_invalid_checkbox_value`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/bind_invalid_checkbox_value`);\n\t}\n}\n\n/**\n * Component %component% has an export named `%key%` that a consumer component is trying to access using `bind:%key%`, which is disallowed. Instead, use `bind:this` (e.g. `<%name% bind:this={component} />`) and then access the property on the bound component instance (e.g. `component.%key%`)\n * @param {string} component\n * @param {string} key\n * @param {string} name\n * @returns {never}\n */\nexport function bind_invalid_export(component, key, name) {\n\tif (DEV) {\n\t\tconst error = new Error(`bind_invalid_export\\nComponent ${component} has an export named \\`${key}\\` that a consumer component is trying to access using \\`bind:${key}\\`, which is disallowed. Instead, use \\`bind:this\\` (e.g. \\`<${name} bind:this={component} />\\`) and then access the property on the bound component instance (e.g. \\`component.${key}\\`)\\nhttps://svelte.dev/e/bind_invalid_export`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/bind_invalid_export`);\n\t}\n}\n\n/**\n * A component is attempting to bind to a non-bindable property `%key%` belonging to %component% (i.e. `<%name% bind:%key%={...}>`). To mark a property as bindable: `let { %key% = $bindable() } = $props()`\n * @param {string} key\n * @param {string} component\n * @param {string} name\n * @returns {never}\n */\nexport function bind_not_bindable(key, component, name) {\n\tif (DEV) {\n\t\tconst error = new Error(`bind_not_bindable\\nA component is attempting to bind to a non-bindable property \\`${key}\\` belonging to ${component} (i.e. \\`<${name} bind:${key}={...}>\\`). To mark a property as bindable: \\`let { ${key} = $bindable() } = $props()\\`\\nhttps://svelte.dev/e/bind_not_bindable`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/bind_not_bindable`);\n\t}\n}\n\n/**\n * Calling `%method%` on a component instance (of %component%) is no longer valid in Svelte 5\n * @param {string} method\n * @param {string} component\n * @returns {never}\n */\nexport function component_api_changed(method, component) {\n\tif (DEV) {\n\t\tconst error = new Error(`component_api_changed\\nCalling \\`${method}\\` on a component instance (of ${component}) is no longer valid in Svelte 5\\nhttps://svelte.dev/e/component_api_changed`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/component_api_changed`);\n\t}\n}\n\n/**\n * Attempted to instantiate %component% with `new %name%`, which is no longer valid in Svelte 5. If this component is not under your control, set the `compatibility.componentApi` compiler option to `4` to keep it working.\n * @param {string} component\n * @param {string} name\n * @returns {never}\n */\nexport function component_api_invalid_new(component, name) {\n\tif (DEV) {\n\t\tconst error = new Error(`component_api_invalid_new\\nAttempted to instantiate ${component} with \\`new ${name}\\`, which is no longer valid in Svelte 5. If this component is not under your control, set the \\`compatibility.componentApi\\` compiler option to \\`4\\` to keep it working.\\nhttps://svelte.dev/e/component_api_invalid_new`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/component_api_invalid_new`);\n\t}\n}\n\n/**\n * A derived value cannot reference itself recursively\n * @returns {never}\n */\nexport function derived_references_self() {\n\tif (DEV) {\n\t\tconst error = new Error(`derived_references_self\\nA derived value cannot reference itself recursively\\nhttps://svelte.dev/e/derived_references_self`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/derived_references_self`);\n\t}\n}\n\n/**\n * Keyed each block has duplicate key `%value%` at indexes %a% and %b%\n * @param {string} a\n * @param {string} b\n * @param {string | undefined | null} [value]\n * @returns {never}\n */\nexport function each_key_duplicate(a, b, value) {\n\tif (DEV) {\n\t\tconst error = new Error(`each_key_duplicate\\n${value\n\t\t\t? `Keyed each block has duplicate key \\`${value}\\` at indexes ${a} and ${b}`\n\t\t\t: `Keyed each block has duplicate key at indexes ${a} and ${b}`}\\nhttps://svelte.dev/e/each_key_duplicate`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/each_key_duplicate`);\n\t}\n}\n\n/**\n * Keyed each block has key that is not idempotent — the key for item at index %index% was `%a%` but is now `%b%`. Keys must be the same each time for a given item\n * @param {string} index\n * @param {string} a\n * @param {string} b\n * @returns {never}\n */\nexport function each_key_volatile(index, a, b) {\n\tif (DEV) {\n\t\tconst error = new Error(`each_key_volatile\\nKeyed each block has key that is not idempotent — the key for item at index ${index} was \\`${a}\\` but is now \\`${b}\\`. Keys must be the same each time for a given item\\nhttps://svelte.dev/e/each_key_volatile`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/each_key_volatile`);\n\t}\n}\n\n/**\n * `%rune%` cannot be used inside an effect cleanup function\n * @param {string} rune\n * @returns {never}\n */\nexport function effect_in_teardown(rune) {\n\tif (DEV) {\n\t\tconst error = new Error(`effect_in_teardown\\n\\`${rune}\\` cannot be used inside an effect cleanup function\\nhttps://svelte.dev/e/effect_in_teardown`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/effect_in_teardown`);\n\t}\n}\n\n/**\n * Effect cannot be created inside a `$derived` value that was not itself created inside an effect\n * @returns {never}\n */\nexport function effect_in_unowned_derived() {\n\tif (DEV) {\n\t\tconst error = new Error(`effect_in_unowned_derived\\nEffect cannot be created inside a \\`$derived\\` value that was not itself created inside an effect\\nhttps://svelte.dev/e/effect_in_unowned_derived`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/effect_in_unowned_derived`);\n\t}\n}\n\n/**\n * `%rune%` can only be used inside an effect (e.g. during component initialisation)\n * @param {string} rune\n * @returns {never}\n */\nexport function effect_orphan(rune) {\n\tif (DEV) {\n\t\tconst error = new Error(`effect_orphan\\n\\`${rune}\\` can only be used inside an effect (e.g. during component initialisation)\\nhttps://svelte.dev/e/effect_orphan`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/effect_orphan`);\n\t}\n}\n\n/**\n * `$effect.pending()` can only be called inside an effect or derived\n * @returns {never}\n */\nexport function effect_pending_outside_reaction() {\n\tif (DEV) {\n\t\tconst error = new Error(`effect_pending_outside_reaction\\n\\`$effect.pending()\\` can only be called inside an effect or derived\\nhttps://svelte.dev/e/effect_pending_outside_reaction`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/effect_pending_outside_reaction`);\n\t}\n}\n\n/**\n * Maximum update depth exceeded. This typically indicates that an effect reads and writes the same piece of state\n * @returns {never}\n */\nexport function effect_update_depth_exceeded() {\n\tif (DEV) {\n\t\tconst error = new Error(`effect_update_depth_exceeded\\nMaximum update depth exceeded. This typically indicates that an effect reads and writes the same piece of state\\nhttps://svelte.dev/e/effect_update_depth_exceeded`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/effect_update_depth_exceeded`);\n\t}\n}\n\n/**\n * Cannot use `flushSync` inside an effect\n * @returns {never}\n */\nexport function flush_sync_in_effect() {\n\tif (DEV) {\n\t\tconst error = new Error(`flush_sync_in_effect\\nCannot use \\`flushSync\\` inside an effect\\nhttps://svelte.dev/e/flush_sync_in_effect`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/flush_sync_in_effect`);\n\t}\n}\n\n/**\n * Cannot commit a fork that was already discarded\n * @returns {never}\n */\nexport function fork_discarded() {\n\tif (DEV) {\n\t\tconst error = new Error(`fork_discarded\\nCannot commit a fork that was already discarded\\nhttps://svelte.dev/e/fork_discarded`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/fork_discarded`);\n\t}\n}\n\n/**\n * Cannot create a fork inside an effect or when state changes are pending\n * @returns {never}\n */\nexport function fork_timing() {\n\tif (DEV) {\n\t\tconst error = new Error(`fork_timing\\nCannot create a fork inside an effect or when state changes are pending\\nhttps://svelte.dev/e/fork_timing`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/fork_timing`);\n\t}\n}\n\n/**\n * `getAbortSignal()` can only be called inside an effect or derived\n * @returns {never}\n */\nexport function get_abort_signal_outside_reaction() {\n\tif (DEV) {\n\t\tconst error = new Error(`get_abort_signal_outside_reaction\\n\\`getAbortSignal()\\` can only be called inside an effect or derived\\nhttps://svelte.dev/e/get_abort_signal_outside_reaction`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/get_abort_signal_outside_reaction`);\n\t}\n}\n\n/**\n * Expected to find a hydratable with key `%key%` during hydration, but did not.\n * @param {string} key\n * @returns {never}\n */\nexport function hydratable_missing_but_required(key) {\n\tif (DEV) {\n\t\tconst error = new Error(`hydratable_missing_but_required\\nExpected to find a hydratable with key \\`${key}\\` during hydration, but did not.\\nhttps://svelte.dev/e/hydratable_missing_but_required`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/hydratable_missing_but_required`);\n\t}\n}\n\n/**\n * Failed to hydrate the application\n * @returns {never}\n */\nexport function hydration_failed() {\n\tif (DEV) {\n\t\tconst error = new Error(`hydration_failed\\nFailed to hydrate the application\\nhttps://svelte.dev/e/hydration_failed`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/hydration_failed`);\n\t}\n}\n\n/**\n * Could not `{@render}` snippet due to the expression being `null` or `undefined`. Consider using optional chaining `{@render snippet?.()}`\n * @returns {never}\n */\nexport function invalid_snippet() {\n\tif (DEV) {\n\t\tconst error = new Error(`invalid_snippet\\nCould not \\`{@render}\\` snippet due to the expression being \\`null\\` or \\`undefined\\`. Consider using optional chaining \\`{@render snippet?.()}\\`\\nhttps://svelte.dev/e/invalid_snippet`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/invalid_snippet`);\n\t}\n}\n\n/**\n * `%name%(...)` cannot be used in runes mode\n * @param {string} name\n * @returns {never}\n */\nexport function lifecycle_legacy_only(name) {\n\tif (DEV) {\n\t\tconst error = new Error(`lifecycle_legacy_only\\n\\`${name}(...)\\` cannot be used in runes mode\\nhttps://svelte.dev/e/lifecycle_legacy_only`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/lifecycle_legacy_only`);\n\t}\n}\n\n/**\n * Cannot do `bind:%key%={undefined}` when `%key%` has a fallback value\n * @param {string} key\n * @returns {never}\n */\nexport function props_invalid_value(key) {\n\tif (DEV) {\n\t\tconst error = new Error(`props_invalid_value\\nCannot do \\`bind:${key}={undefined}\\` when \\`${key}\\` has a fallback value\\nhttps://svelte.dev/e/props_invalid_value`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/props_invalid_value`);\n\t}\n}\n\n/**\n * Rest element properties of `$props()` such as `%property%` are readonly\n * @param {string} property\n * @returns {never}\n */\nexport function props_rest_readonly(property) {\n\tif (DEV) {\n\t\tconst error = new Error(`props_rest_readonly\\nRest element properties of \\`$props()\\` such as \\`${property}\\` are readonly\\nhttps://svelte.dev/e/props_rest_readonly`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/props_rest_readonly`);\n\t}\n}\n\n/**\n * The `%rune%` rune is only available inside `.svelte` and `.svelte.js/ts` files\n * @param {string} rune\n * @returns {never}\n */\nexport function rune_outside_svelte(rune) {\n\tif (DEV) {\n\t\tconst error = new Error(`rune_outside_svelte\\nThe \\`${rune}\\` rune is only available inside \\`.svelte\\` and \\`.svelte.js/ts\\` files\\nhttps://svelte.dev/e/rune_outside_svelte`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/rune_outside_svelte`);\n\t}\n}\n\n/**\n * `setContext` must be called when a component first initializes, not in a subsequent effect or after an `await` expression\n * @returns {never}\n */\nexport function set_context_after_init() {\n\tif (DEV) {\n\t\tconst error = new Error(`set_context_after_init\\n\\`setContext\\` must be called when a component first initializes, not in a subsequent effect or after an \\`await\\` expression\\nhttps://svelte.dev/e/set_context_after_init`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/set_context_after_init`);\n\t}\n}\n\n/**\n * Property descriptors defined on `$state` objects must contain `value` and always be `enumerable`, `configurable` and `writable`.\n * @returns {never}\n */\nexport function state_descriptors_fixed() {\n\tif (DEV) {\n\t\tconst error = new Error(`state_descriptors_fixed\\nProperty descriptors defined on \\`$state\\` objects must contain \\`value\\` and always be \\`enumerable\\`, \\`configurable\\` and \\`writable\\`.\\nhttps://svelte.dev/e/state_descriptors_fixed`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/state_descriptors_fixed`);\n\t}\n}\n\n/**\n * Cannot set prototype of `$state` object\n * @returns {never}\n */\nexport function state_prototype_fixed() {\n\tif (DEV) {\n\t\tconst error = new Error(`state_prototype_fixed\\nCannot set prototype of \\`$state\\` object\\nhttps://svelte.dev/e/state_prototype_fixed`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/state_prototype_fixed`);\n\t}\n}\n\n/**\n * Updating state inside `$derived(...)`, `$inspect(...)` or a template expression is forbidden. If the value should not be reactive, declare it without `$state`\n * @returns {never}\n */\nexport function state_unsafe_mutation() {\n\tif (DEV) {\n\t\tconst error = new Error(`state_unsafe_mutation\\nUpdating state inside \\`$derived(...)\\`, \\`$inspect(...)\\` or a template expression is forbidden. If the value should not be reactive, declare it without \\`$state\\`\\nhttps://svelte.dev/e/state_unsafe_mutation`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/state_unsafe_mutation`);\n\t}\n}\n\n/**\n * A `<svelte:boundary>` `reset` function cannot be called while an error is still being handled\n * @returns {never}\n */\nexport function svelte_boundary_reset_onerror() {\n\tif (DEV) {\n\t\tconst error = new Error(`svelte_boundary_reset_onerror\\nA \\`<svelte:boundary>\\` \\`reset\\` function cannot be called while an error is still being handled\\nhttps://svelte.dev/e/svelte_boundary_reset_onerror`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/svelte_boundary_reset_onerror`);\n\t}\n}","/** @import { Effect, Source, TemplateNode, } from '#client' */\nimport {\n\tBOUNDARY_EFFECT,\n\tDIRTY,\n\tEFFECT_PRESERVED,\n\tEFFECT_TRANSPARENT,\n\tMAYBE_DIRTY\n} from '#client/constants';\nimport { HYDRATION_START_ELSE, HYDRATION_START_FAILED } from '../../../../constants.js';\nimport { component_context, set_component_context } from '../../context.js';\nimport { handle_error, invoke_error_boundary } from '../../error-handling.js';\nimport {\n\tblock,\n\tbranch,\n\tdestroy_effect,\n\tmove_effect,\n\tpause_effect\n} from '../../reactivity/effects.js';\nimport {\n\tactive_effect,\n\tactive_reaction,\n\tget,\n\tset_active_effect,\n\tset_active_reaction\n} from '../../runtime.js';\nimport {\n\thydrate_next,\n\thydrate_node,\n\thydrating,\n\tnext,\n\tskip_nodes,\n\tset_hydrate_node\n} from '../hydration.js';\nimport { queue_micro_task } from '../task.js';\nimport * as e from '../../errors.js';\nimport * as w from '../../warnings.js';\nimport { DEV } from 'esm-env';\nimport { Batch, current_batch, schedule_effect } from '../../reactivity/batch.js';\nimport { internal_set, source } from '../../reactivity/sources.js';\nimport { tag } from '../../dev/tracing.js';\nimport { createSubscriber } from '../../../../reactivity/create-subscriber.js';\nimport { create_text } from '../operations.js';\nimport { defer_effect } from '../../reactivity/utils.js';\nimport { set_signal_status } from '../../reactivity/status.js';\n\n/**\n * @typedef {{\n * \t onerror?: (error: unknown, reset: () => void) => void;\n * failed?: (anchor: Node, error: () => unknown, reset: () => () => void) => void;\n * pending?: (anchor: Node) => void;\n * }} BoundaryProps\n */\n\nvar flags = EFFECT_TRANSPARENT | EFFECT_PRESERVED;\n\n/**\n * @param {TemplateNode} node\n * @param {BoundaryProps} props\n * @param {((anchor: Node) => void)} children\n * @param {((error: unknown) => unknown) | undefined} [transform_error]\n * @returns {void}\n */\nexport function boundary(node, props, children, transform_error) {\n\tnew Boundary(node, props, children, transform_error);\n}\n\nexport class Boundary {\n\t/** @type {Boundary | null} */\n\tparent;\n\n\tis_pending = false;\n\n\t/**\n\t * API-level transformError transform function. Transforms errors before they reach the `failed` snippet.\n\t * Inherited from parent boundary, or defaults to identity.\n\t * @type {(error: unknown) => unknown}\n\t */\n\ttransform_error;\n\n\t/** @type {TemplateNode} */\n\t#anchor;\n\n\t/** @type {TemplateNode | null} */\n\t#hydrate_open = hydrating ? hydrate_node : null;\n\n\t/** @type {BoundaryProps} */\n\t#props;\n\n\t/** @type {((anchor: Node) => void)} */\n\t#children;\n\n\t/** @type {Effect} */\n\t#effect;\n\n\t/** @type {Effect | null} */\n\t#main_effect = null;\n\n\t/** @type {Effect | null} */\n\t#pending_effect = null;\n\n\t/** @type {Effect | null} */\n\t#failed_effect = null;\n\n\t/** @type {DocumentFragment | null} */\n\t#offscreen_fragment = null;\n\n\t#local_pending_count = 0;\n\t#pending_count = 0;\n\t#pending_count_update_queued = false;\n\n\t/** @type {Set<Effect>} */\n\t#dirty_effects = new Set();\n\n\t/** @type {Set<Effect>} */\n\t#maybe_dirty_effects = new Set();\n\n\t/**\n\t * A source containing the number of pending async deriveds/expressions.\n\t * Only created if `$effect.pending()` is used inside the boundary,\n\t * otherwise updating the source results in needless `Batch.ensure()`\n\t * calls followed by no-op flushes\n\t * @type {Source<number> | null}\n\t */\n\t#effect_pending = null;\n\n\t#effect_pending_subscriber = createSubscriber(() => {\n\t\tthis.#effect_pending = source(this.#local_pending_count);\n\n\t\tif (DEV) {\n\t\t\ttag(this.#effect_pending, '$effect.pending()');\n\t\t}\n\n\t\treturn () => {\n\t\t\tthis.#effect_pending = null;\n\t\t};\n\t});\n\n\t/**\n\t * @param {TemplateNode} node\n\t * @param {BoundaryProps} props\n\t * @param {((anchor: Node) => void)} children\n\t * @param {((error: unknown) => unknown) | undefined} [transform_error]\n\t */\n\tconstructor(node, props, children, transform_error) {\n\t\tthis.#anchor = node;\n\t\tthis.#props = props;\n\n\t\tthis.#children = (anchor) => {\n\t\t\tvar effect = /** @type {Effect} */ (active_effect);\n\n\t\t\teffect.b = this;\n\t\t\teffect.f |= BOUNDARY_EFFECT;\n\n\t\t\tchildren(anchor);\n\t\t};\n\n\t\tthis.parent = /** @type {Effect} */ (active_effect).b;\n\n\t\t// Inherit transform_error from parent boundary, or use the provided one, or default to identity\n\t\tthis.transform_error = transform_error ?? this.parent?.transform_error ?? ((e) => e);\n\n\t\tthis.#effect = block(() => {\n\t\t\tif (hydrating) {\n\t\t\t\tconst comment = /** @type {Comment} */ (this.#hydrate_open);\n\t\t\t\thydrate_next();\n\n\t\t\t\tconst server_rendered_pending = comment.data === HYDRATION_START_ELSE;\n\t\t\t\tconst server_rendered_failed = comment.data.startsWith(HYDRATION_START_FAILED);\n\n\t\t\t\tif (server_rendered_failed) {\n\t\t\t\t\t// Server rendered the failed snippet - hydrate it.\n\t\t\t\t\t// The serialized error is embedded in the comment: <!--[?<json>-->\n\t\t\t\t\tconst serialized_error = JSON.parse(comment.data.slice(HYDRATION_START_FAILED.length));\n\t\t\t\t\tthis.#hydrate_failed_content(serialized_error);\n\t\t\t\t} else if (server_rendered_pending) {\n\t\t\t\t\tthis.#hydrate_pending_content();\n\t\t\t\t} else {\n\t\t\t\t\tthis.#hydrate_resolved_content();\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tthis.#render();\n\t\t\t}\n\t\t}, flags);\n\n\t\tif (hydrating) {\n\t\t\tthis.#anchor = hydrate_node;\n\t\t}\n\t}\n\n\t#hydrate_resolved_content() {\n\t\ttry {\n\t\t\tthis.#main_effect = branch(() => this.#children(this.#anchor));\n\t\t} catch (error) {\n\t\t\tthis.error(error);\n\t\t}\n\t}\n\n\t/**\n\t * @param {unknown} error The deserialized error from the server's hydration comment\n\t */\n\t#hydrate_failed_content(error) {\n\t\tconst failed = this.#props.failed;\n\t\tif (!failed) return;\n\n\t\tthis.#failed_effect = branch(() => {\n\t\t\tfailed(\n\t\t\t\tthis.#anchor,\n\t\t\t\t() => error,\n\t\t\t\t() => () => {}\n\t\t\t);\n\t\t});\n\t}\n\n\t#hydrate_pending_content() {\n\t\tconst pending = this.#props.pending;\n\t\tif (!pending) return;\n\n\t\tthis.is_pending = true;\n\t\tthis.#pending_effect = branch(() => pending(this.#anchor));\n\n\t\tqueue_micro_task(() => {\n\t\t\tvar fragment = (this.#offscreen_fragment = document.createDocumentFragment());\n\t\t\tvar anchor = create_text();\n\n\t\t\tfragment.append(anchor);\n\n\t\t\tthis.#main_effect = this.#run(() => {\n\t\t\t\treturn branch(() => this.#children(anchor));\n\t\t\t});\n\n\t\t\tif (this.#pending_count === 0) {\n\t\t\t\tthis.#anchor.before(fragment);\n\t\t\t\tthis.#offscreen_fragment = null;\n\n\t\t\t\tpause_effect(/** @type {Effect} */ (this.#pending_effect), () => {\n\t\t\t\t\tthis.#pending_effect = null;\n\t\t\t\t});\n\n\t\t\t\tthis.#resolve(/** @type {Batch} */ (current_batch));\n\t\t\t}\n\t\t});\n\t}\n\n\t#render() {\n\t\ttry {\n\t\t\tthis.is_pending = this.has_pending_snippet();\n\t\t\tthis.#pending_count = 0;\n\t\t\tthis.#local_pending_count = 0;\n\n\t\t\tthis.#main_effect = branch(() => {\n\t\t\t\tthis.#children(this.#anchor);\n\t\t\t});\n\n\t\t\tif (this.#pending_count > 0) {\n\t\t\t\tvar fragment = (this.#offscreen_fragment = document.createDocumentFragment());\n\t\t\t\tmove_effect(this.#main_effect, fragment);\n\n\t\t\t\tconst pending = /** @type {(anchor: Node) => void} */ (this.#props.pending);\n\t\t\t\tthis.#pending_effect = branch(() => pending(this.#anchor));\n\t\t\t} else {\n\t\t\t\tthis.#resolve(/** @type {Batch} */ (current_batch));\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tthis.error(error);\n\t\t}\n\t}\n\n\t/**\n\t * @param {Batch} batch\n\t */\n\t#resolve(batch) {\n\t\tthis.is_pending = false;\n\n\t\t// any effects that were previously deferred should be transferred\n\t\t// to the batch, which will flush in the next microtask\n\t\tbatch.transfer_effects(this.#dirty_effects, this.#maybe_dirty_effects);\n\t}\n\n\t/**\n\t * Defer an effect inside a pending boundary until the boundary resolves\n\t * @param {Effect} effect\n\t */\n\tdefer_effect(effect) {\n\t\tdefer_effect(effect, this.#dirty_effects, this.#maybe_dirty_effects);\n\t}\n\n\t/**\n\t * Returns `false` if the effect exists inside a boundary whose pending snippet is shown\n\t * @returns {boolean}\n\t */\n\tis_rendered() {\n\t\treturn !this.is_pending && (!this.parent || this.parent.is_rendered());\n\t}\n\n\thas_pending_snippet() {\n\t\treturn !!this.#props.pending;\n\t}\n\n\t/**\n\t * @template T\n\t * @param {() => T} fn\n\t */\n\t#run(fn) {\n\t\tvar previous_effect = active_effect;\n\t\tvar previous_reaction = active_reaction;\n\t\tvar previous_ctx = component_context;\n\n\t\tset_active_effect(this.#effect);\n\t\tset_active_reaction(this.#effect);\n\t\tset_component_context(this.#effect.ctx);\n\n\t\ttry {\n\t\t\tBatch.ensure();\n\t\t\treturn fn();\n\t\t} catch (e) {\n\t\t\thandle_error(e);\n\t\t\treturn null;\n\t\t} finally {\n\t\t\tset_active_effect(previous_effect);\n\t\t\tset_active_reaction(previous_reaction);\n\t\t\tset_component_context(previous_ctx);\n\t\t}\n\t}\n\n\t/**\n\t * Updates the pending count associated with the currently visible pending snippet,\n\t * if any, such that we can replace the snippet with content once work is done\n\t * @param {1 | -1} d\n\t * @param {Batch} batch\n\t */\n\t#update_pending_count(d, batch) {\n\t\tif (!this.has_pending_snippet()) {\n\t\t\tif (this.parent) {\n\t\t\t\tthis.parent.#update_pending_count(d, batch);\n\t\t\t}\n\n\t\t\t// if there's no parent, we're in a scope with no pending snippet\n\t\t\treturn;\n\t\t}\n\n\t\tthis.#pending_count += d;\n\n\t\tif (this.#pending_count === 0) {\n\t\t\tthis.#resolve(batch);\n\n\t\t\tif (this.#pending_effect) {\n\t\t\t\tpause_effect(this.#pending_effect, () => {\n\t\t\t\t\tthis.#pending_effect = null;\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tif (this.#offscreen_fragment) {\n\t\t\t\tthis.#anchor.before(this.#offscreen_fragment);\n\t\t\t\tthis.#offscreen_fragment = null;\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Update the source that powers `$effect.pending()` inside this boundary,\n\t * and controls when the current `pending` snippet (if any) is removed.\n\t * Do not call from inside the class\n\t * @param {1 | -1} d\n\t * @param {Batch} batch\n\t */\n\tupdate_pending_count(d, batch) {\n\t\tthis.#update_pending_count(d, batch);\n\n\t\tthis.#local_pending_count += d;\n\n\t\tif (!this.#effect_pending || this.#pending_count_update_queued) return;\n\t\tthis.#pending_count_update_queued = true;\n\n\t\tqueue_micro_task(() => {\n\t\t\tthis.#pending_count_update_queued = false;\n\t\t\tif (this.#effect_pending) {\n\t\t\t\tinternal_set(this.#effect_pending, this.#local_pending_count);\n\t\t\t}\n\t\t});\n\t}\n\n\tget_effect_pending() {\n\t\tthis.#effect_pending_subscriber();\n\t\treturn get(/** @type {Source<number>} */ (this.#effect_pending));\n\t}\n\n\t/** @param {unknown} error */\n\terror(error) {\n\t\tvar onerror = this.#props.onerror;\n\t\tlet failed = this.#props.failed;\n\n\t\t// If we have nothing to capture the error, or if we hit an error while\n\t\t// rendering the fallback, re-throw for another boundary to handle\n\t\tif (!onerror && !failed) {\n\t\t\tthrow error;\n\t\t}\n\n\t\tif (this.#main_effect) {\n\t\t\tdestroy_effect(this.#main_effect);\n\t\t\tthis.#main_effect = null;\n\t\t}\n\n\t\tif (this.#pending_effect) {\n\t\t\tdestroy_effect(this.#pending_effect);\n\t\t\tthis.#pending_effect = null;\n\t\t}\n\n\t\tif (this.#failed_effect) {\n\t\t\tdestroy_effect(this.#failed_effect);\n\t\t\tthis.#failed_effect = null;\n\t\t}\n\n\t\tif (hydrating) {\n\t\t\tset_hydrate_node(/** @type {TemplateNode} */ (this.#hydrate_open));\n\t\t\tnext();\n\t\t\tset_hydrate_node(skip_nodes());\n\t\t}\n\n\t\tvar did_reset = false;\n\t\tvar calling_on_error = false;\n\n\t\tconst reset = () => {\n\t\t\tif (did_reset) {\n\t\t\t\tw.svelte_boundary_reset_noop();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tdid_reset = true;\n\n\t\t\tif (calling_on_error) {\n\t\t\t\te.svelte_boundary_reset_onerror();\n\t\t\t}\n\n\t\t\tif (this.#failed_effect !== null) {\n\t\t\t\tpause_effect(this.#failed_effect, () => {\n\t\t\t\t\tthis.#failed_effect = null;\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tthis.#run(() => {\n\t\t\t\tthis.#render();\n\t\t\t});\n\t\t};\n\n\t\t/** @param {unknown} transformed_error */\n\t\tconst handle_error_result = (transformed_error) => {\n\t\t\ttry {\n\t\t\t\tcalling_on_error = true;\n\t\t\t\tonerror?.(transformed_error, reset);\n\t\t\t\tcalling_on_error = false;\n\t\t\t} catch (error) {\n\t\t\t\tinvoke_error_boundary(error, this.#effect && this.#effect.parent);\n\t\t\t}\n\n\t\t\tif (failed) {\n\t\t\t\tthis.#failed_effect = this.#run(() => {\n\t\t\t\t\ttry {\n\t\t\t\t\t\treturn branch(() => {\n\t\t\t\t\t\t\t// errors in `failed` snippets cause the boundary to error again\n\t\t\t\t\t\t\t// TODO Svelte 6: revisit this decision, most likely better to go to parent boundary instead\n\t\t\t\t\t\t\tvar effect = /** @type {Effect} */ (active_effect);\n\n\t\t\t\t\t\t\teffect.b = this;\n\t\t\t\t\t\t\teffect.f |= BOUNDARY_EFFECT;\n\n\t\t\t\t\t\t\tfailed(\n\t\t\t\t\t\t\t\tthis.#anchor,\n\t\t\t\t\t\t\t\t() => transformed_error,\n\t\t\t\t\t\t\t\t() => reset\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t});\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tinvoke_error_boundary(error, /** @type {Effect} */ (this.#effect.parent));\n\t\t\t\t\t\treturn null;\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t};\n\n\t\tqueue_micro_task(() => {\n\t\t\t// Run the error through the API-level transformError transform (e.g. SvelteKit's handleError)\n\t\t\t/** @type {unknown} */\n\t\t\tvar result;\n\t\t\ttry {\n\t\t\t\tresult = this.transform_error(error);\n\t\t\t} catch (e) {\n\t\t\t\tinvoke_error_boundary(e, this.#effect && this.#effect.parent);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\tresult !== null &&\n\t\t\t\ttypeof result === 'object' &&\n\t\t\t\ttypeof (/** @type {any} */ (result).then) === 'function'\n\t\t\t) {\n\t\t\t\t// transformError returned a Promise — wait for it\n\t\t\t\t/** @type {any} */ (result).then(\n\t\t\t\t\thandle_error_result,\n\t\t\t\t\t/** @param {unknown} e */\n\t\t\t\t\t(e) => invoke_error_boundary(e, this.#effect && this.#effect.parent)\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\t// Synchronous result — handle immediately\n\t\t\t\thandle_error_result(result);\n\t\t\t}\n\t\t});\n\t}\n}\n\nexport function pending() {\n\tif (active_effect === null) {\n\t\te.effect_pending_outside_reaction();\n\t}\n\n\tvar boundary = active_effect.b;\n\n\tif (boundary === null) {\n\t\treturn 0; // TODO eventually we will need this to be global\n\t}\n\n\treturn boundary.get_effect_pending();\n}\n","import { get, tick, untrack } from '../internal/client/runtime.js';\nimport { effect_tracking, render_effect } from '../internal/client/reactivity/effects.js';\nimport { source, increment } from '../internal/client/reactivity/sources.js';\nimport { tag } from '../internal/client/dev/tracing.js';\nimport { DEV } from 'esm-env';\nimport { queue_micro_task } from '../internal/client/dom/task.js';\n\n/**\n * Returns a `subscribe` function that integrates external event-based systems with Svelte's reactivity.\n * It's particularly useful for integrating with web APIs like `MediaQuery`, `IntersectionObserver`, or `WebSocket`.\n *\n * If `subscribe` is called inside an effect (including indirectly, for example inside a getter),\n * the `start` callback will be called with an `update` function. Whenever `update` is called, the effect re-runs.\n *\n * If `start` returns a cleanup function, it will be called when the effect is destroyed.\n *\n * If `subscribe` is called in multiple effects, `start` will only be called once as long as the effects\n * are active, and the returned teardown function will only be called when all effects are destroyed.\n *\n * It's best understood with an example. Here's an implementation of [`MediaQuery`](https://svelte.dev/docs/svelte/svelte-reactivity#MediaQuery):\n *\n * ```js\n * import { createSubscriber } from 'svelte/reactivity';\n * import { on } from 'svelte/events';\n *\n * export class MediaQuery {\n * \t#query;\n * \t#subscribe;\n *\n * \tconstructor(query) {\n * \t\tthis.#query = window.matchMedia(`(${query})`);\n *\n * \t\tthis.#subscribe = createSubscriber((update) => {\n * \t\t\t// when the `change` event occurs, re-run any effects that read `this.current`\n * \t\t\tconst off = on(this.#query, 'change', update);\n *\n * \t\t\t// stop listening when all the effects are destroyed\n * \t\t\treturn () => off();\n * \t\t});\n * \t}\n *\n * \tget current() {\n * \t\t// This makes the getter reactive, if read in an effect\n * \t\tthis.#subscribe();\n *\n * \t\t// Return the current state of the query, whether or not we're in an effect\n * \t\treturn this.#query.matches;\n * \t}\n * }\n * ```\n * @param {(update: () => void) => (() => void) | void} start\n * @since 5.7.0\n */\nexport function createSubscriber(start) {\n\tlet subscribers = 0;\n\tlet version = source(0);\n\t/** @type {(() => void) | void} */\n\tlet stop;\n\n\tif (DEV) {\n\t\ttag(version, 'createSubscriber version');\n\t}\n\n\treturn () => {\n\t\tif (effect_tracking()) {\n\t\t\tget(version);\n\n\t\t\trender_effect(() => {\n\t\t\t\tif (subscribers === 0) {\n\t\t\t\t\tstop = untrack(() => start(() => increment(version)));\n\t\t\t\t}\n\n\t\t\t\tsubscribers += 1;\n\n\t\t\t\treturn () => {\n\t\t\t\t\tqueue_micro_task(() => {\n\t\t\t\t\t\t// Only count down after a microtask, else we would reach 0 before our own render effect reruns,\n\t\t\t\t\t\t// but reach 1 again when the tick callback of the prior teardown runs. That would mean we\n\t\t\t\t\t\t// re-subcribe unnecessarily and create a memory leak because the old subscription is never cleaned up.\n\t\t\t\t\t\tsubscribers -= 1;\n\n\t\t\t\t\t\tif (subscribers === 0) {\n\t\t\t\t\t\t\tstop?.();\n\t\t\t\t\t\t\tstop = undefined;\n\t\t\t\t\t\t\t// Increment the version to ensure any dependent deriveds are marked dirty when the subscription is picked up again later.\n\t\t\t\t\t\t\t// If we didn't do this then the comparison of write versions would determine that the derived has a later version than\n\t\t\t\t\t\t\t// the subscriber, and it would not be re-run.\n\t\t\t\t\t\t\tincrement(version);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t};\n\t\t\t});\n\t\t}\n\t};\n}\n","/* This file is generated by scripts/process-messages/index.js. Do not edit! */\n\nimport { DEV } from 'esm-env';\n\nvar bold = 'font-weight: bold';\nvar normal = 'font-weight: normal';\n\n/**\n * Assignment to `%property%` property (%location%) will evaluate to the right-hand side, not the value of `%property%` following the assignment. This may result in unexpected behaviour.\n * @param {string} property\n * @param {string} location\n */\nexport function assignment_value_stale(property, location) {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] assignment_value_stale\\n%cAssignment to \\`${property}\\` property (${location}) will evaluate to the right-hand side, not the value of \\`${property}\\` following the assignment. This may result in unexpected behaviour.\\nhttps://svelte.dev/e/assignment_value_stale`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/assignment_value_stale`);\n\t}\n}\n\n/**\n * Detected reactivity loss when reading `%name%`. This happens when state is read in an async function after an earlier `await`\n * @param {string} name\n */\nexport function await_reactivity_loss(name) {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] await_reactivity_loss\\n%cDetected reactivity loss when reading \\`${name}\\`. This happens when state is read in an async function after an earlier \\`await\\`\\nhttps://svelte.dev/e/await_reactivity_loss`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/await_reactivity_loss`);\n\t}\n}\n\n/**\n * An async derived, `%name%` (%location%) was not read immediately after it resolved. This often indicates an unnecessary waterfall, which can slow down your app\n * @param {string} name\n * @param {string} location\n */\nexport function await_waterfall(name, location) {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] await_waterfall\\n%cAn async derived, \\`${name}\\` (${location}) was not read immediately after it resolved. This often indicates an unnecessary waterfall, which can slow down your app\\nhttps://svelte.dev/e/await_waterfall`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/await_waterfall`);\n\t}\n}\n\n/**\n * `%binding%` (%location%) is binding to a non-reactive property\n * @param {string} binding\n * @param {string | undefined | null} [location]\n */\nexport function binding_property_non_reactive(binding, location) {\n\tif (DEV) {\n\t\tconsole.warn(\n\t\t\t`%c[svelte] binding_property_non_reactive\\n%c${location\n\t\t\t\t? `\\`${binding}\\` (${location}) is binding to a non-reactive property`\n\t\t\t\t: `\\`${binding}\\` is binding to a non-reactive property`}\\nhttps://svelte.dev/e/binding_property_non_reactive`,\n\t\t\tbold,\n\t\t\tnormal\n\t\t);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/binding_property_non_reactive`);\n\t}\n}\n\n/**\n * Your `console.%method%` contained `$state` proxies. Consider using `$inspect(...)` or `$state.snapshot(...)` instead\n * @param {string} method\n */\nexport function console_log_state(method) {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] console_log_state\\n%cYour \\`console.${method}\\` contained \\`$state\\` proxies. Consider using \\`$inspect(...)\\` or \\`$state.snapshot(...)\\` instead\\nhttps://svelte.dev/e/console_log_state`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/console_log_state`);\n\t}\n}\n\n/**\n * %handler% should be a function. Did you mean to %suggestion%?\n * @param {string} handler\n * @param {string} suggestion\n */\nexport function event_handler_invalid(handler, suggestion) {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] event_handler_invalid\\n%c${handler} should be a function. Did you mean to ${suggestion}?\\nhttps://svelte.dev/e/event_handler_invalid`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/event_handler_invalid`);\n\t}\n}\n\n/**\n * Expected to find a hydratable with key `%key%` during hydration, but did not.\n * @param {string} key\n */\nexport function hydratable_missing_but_expected(key) {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] hydratable_missing_but_expected\\n%cExpected to find a hydratable with key \\`${key}\\` during hydration, but did not.\\nhttps://svelte.dev/e/hydratable_missing_but_expected`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/hydratable_missing_but_expected`);\n\t}\n}\n\n/**\n * The `%attribute%` attribute on `%html%` changed its value between server and client renders. The client value, `%value%`, will be ignored in favour of the server value\n * @param {string} attribute\n * @param {string} html\n * @param {string} value\n */\nexport function hydration_attribute_changed(attribute, html, value) {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] hydration_attribute_changed\\n%cThe \\`${attribute}\\` attribute on \\`${html}\\` changed its value between server and client renders. The client value, \\`${value}\\`, will be ignored in favour of the server value\\nhttps://svelte.dev/e/hydration_attribute_changed`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/hydration_attribute_changed`);\n\t}\n}\n\n/**\n * The value of an `{@html ...}` block %location% changed between server and client renders. The client value will be ignored in favour of the server value\n * @param {string | undefined | null} [location]\n */\nexport function hydration_html_changed(location) {\n\tif (DEV) {\n\t\tconsole.warn(\n\t\t\t`%c[svelte] hydration_html_changed\\n%c${location\n\t\t\t\t? `The value of an \\`{@html ...}\\` block ${location} changed between server and client renders. The client value will be ignored in favour of the server value`\n\t\t\t\t: 'The value of an `{@html ...}` block changed between server and client renders. The client value will be ignored in favour of the server value'}\\nhttps://svelte.dev/e/hydration_html_changed`,\n\t\t\tbold,\n\t\t\tnormal\n\t\t);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/hydration_html_changed`);\n\t}\n}\n\n/**\n * Hydration failed because the initial UI does not match what was rendered on the server. The error occurred near %location%\n * @param {string | undefined | null} [location]\n */\nexport function hydration_mismatch(location) {\n\tif (DEV) {\n\t\tconsole.warn(\n\t\t\t`%c[svelte] hydration_mismatch\\n%c${location\n\t\t\t\t? `Hydration failed because the initial UI does not match what was rendered on the server. The error occurred near ${location}`\n\t\t\t\t: 'Hydration failed because the initial UI does not match what was rendered on the server'}\\nhttps://svelte.dev/e/hydration_mismatch`,\n\t\t\tbold,\n\t\t\tnormal\n\t\t);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/hydration_mismatch`);\n\t}\n}\n\n/**\n * The `render` function passed to `createRawSnippet` should return HTML for a single element\n */\nexport function invalid_raw_snippet_render() {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] invalid_raw_snippet_render\\n%cThe \\`render\\` function passed to \\`createRawSnippet\\` should return HTML for a single element\\nhttps://svelte.dev/e/invalid_raw_snippet_render`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/invalid_raw_snippet_render`);\n\t}\n}\n\n/**\n * Detected a migrated `$:` reactive block in `%filename%` that both accesses and updates the same reactive value. This may cause recursive updates when converted to an `$effect`.\n * @param {string} filename\n */\nexport function legacy_recursive_reactive_block(filename) {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] legacy_recursive_reactive_block\\n%cDetected a migrated \\`$:\\` reactive block in \\`${filename}\\` that both accesses and updates the same reactive value. This may cause recursive updates when converted to an \\`$effect\\`.\\nhttps://svelte.dev/e/legacy_recursive_reactive_block`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/legacy_recursive_reactive_block`);\n\t}\n}\n\n/**\n * Tried to unmount a component that was not mounted\n */\nexport function lifecycle_double_unmount() {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] lifecycle_double_unmount\\n%cTried to unmount a component that was not mounted\\nhttps://svelte.dev/e/lifecycle_double_unmount`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/lifecycle_double_unmount`);\n\t}\n}\n\n/**\n * %parent% passed property `%prop%` to %child% with `bind:`, but its parent component %owner% did not declare `%prop%` as a binding. Consider creating a binding between %owner% and %parent% (e.g. `bind:%prop%={...}` instead of `%prop%={...}`)\n * @param {string} parent\n * @param {string} prop\n * @param {string} child\n * @param {string} owner\n */\nexport function ownership_invalid_binding(parent, prop, child, owner) {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] ownership_invalid_binding\\n%c${parent} passed property \\`${prop}\\` to ${child} with \\`bind:\\`, but its parent component ${owner} did not declare \\`${prop}\\` as a binding. Consider creating a binding between ${owner} and ${parent} (e.g. \\`bind:${prop}={...}\\` instead of \\`${prop}={...}\\`)\\nhttps://svelte.dev/e/ownership_invalid_binding`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/ownership_invalid_binding`);\n\t}\n}\n\n/**\n * Mutating unbound props (`%name%`, at %location%) is strongly discouraged. Consider using `bind:%prop%={...}` in %parent% (or using a callback) instead\n * @param {string} name\n * @param {string} location\n * @param {string} prop\n * @param {string} parent\n */\nexport function ownership_invalid_mutation(name, location, prop, parent) {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] ownership_invalid_mutation\\n%cMutating unbound props (\\`${name}\\`, at ${location}) is strongly discouraged. Consider using \\`bind:${prop}={...}\\` in ${parent} (or using a callback) instead\\nhttps://svelte.dev/e/ownership_invalid_mutation`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/ownership_invalid_mutation`);\n\t}\n}\n\n/**\n * The `value` property of a `<select multiple>` element should be an array, but it received a non-array value. The selection will be kept as is.\n */\nexport function select_multiple_invalid_value() {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] select_multiple_invalid_value\\n%cThe \\`value\\` property of a \\`<select multiple>\\` element should be an array, but it received a non-array value. The selection will be kept as is.\\nhttps://svelte.dev/e/select_multiple_invalid_value`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/select_multiple_invalid_value`);\n\t}\n}\n\n/**\n * Reactive `$state(...)` proxies and the values they proxy have different identities. Because of this, comparisons with `%operator%` will produce unexpected results\n * @param {string} operator\n */\nexport function state_proxy_equality_mismatch(operator) {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] state_proxy_equality_mismatch\\n%cReactive \\`$state(...)\\` proxies and the values they proxy have different identities. Because of this, comparisons with \\`${operator}\\` will produce unexpected results\\nhttps://svelte.dev/e/state_proxy_equality_mismatch`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/state_proxy_equality_mismatch`);\n\t}\n}\n\n/**\n * Tried to unmount a state proxy, rather than a component\n */\nexport function state_proxy_unmount() {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] state_proxy_unmount\\n%cTried to unmount a state proxy, rather than a component\\nhttps://svelte.dev/e/state_proxy_unmount`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/state_proxy_unmount`);\n\t}\n}\n\n/**\n * A `<svelte:boundary>` `reset` function only resets the boundary the first time it is called\n */\nexport function svelte_boundary_reset_noop() {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] svelte_boundary_reset_noop\\n%cA \\`<svelte:boundary>\\` \\`reset\\` function only resets the boundary the first time it is called\\nhttps://svelte.dev/e/svelte_boundary_reset_noop`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/svelte_boundary_reset_noop`);\n\t}\n}\n\n/**\n * The `slide` transition does not work correctly for elements with `display: %value%`\n * @param {string} value\n */\nexport function transition_slide_display(value) {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] transition_slide_display\\n%cThe \\`slide\\` transition does not work correctly for elements with \\`display: ${value}\\`\\nhttps://svelte.dev/e/transition_slide_display`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/transition_slide_display`);\n\t}\n}","/** @import { Blocker, Effect, Value } from '#client' */\nimport { DESTROYED, STALE_REACTION } from '#client/constants';\nimport { DEV } from 'esm-env';\nimport {\n\tcomponent_context,\n\tdev_stack,\n\tis_runes,\n\tset_component_context,\n\tset_dev_stack\n} from '../context.js';\nimport { Boundary } from '../dom/blocks/boundary.js';\nimport { invoke_error_boundary } from '../error-handling.js';\nimport {\n\tactive_effect,\n\tactive_reaction,\n\tset_active_effect,\n\tset_active_reaction\n} from '../runtime.js';\nimport { Batch, current_batch } from './batch.js';\nimport {\n\tasync_derived,\n\treactivity_loss_tracker,\n\tderived,\n\tderived_safe_equal,\n\tset_reactivity_loss_tracker\n} from './deriveds.js';\nimport { aborted } from './effects.js';\n\n/**\n * @param {Blocker[]} blockers\n * @param {Array<() => any>} sync\n * @param {Array<() => Promise<any>>} async\n * @param {(values: Value[]) => any} fn\n */\nexport function flatten(blockers, sync, async, fn) {\n\tconst d = is_runes() ? derived : derived_safe_equal;\n\n\t// Filter out already-settled blockers - no need to wait for them\n\tvar pending = blockers.filter((b) => !b.settled);\n\n\tif (async.length === 0 && pending.length === 0) {\n\t\tfn(sync.map(d));\n\t\treturn;\n\t}\n\n\tvar parent = /** @type {Effect} */ (active_effect);\n\n\tvar restore = capture();\n\tvar blocker_promise =\n\t\tpending.length === 1\n\t\t\t? pending[0].promise\n\t\t\t: pending.length > 1\n\t\t\t\t? Promise.all(pending.map((b) => b.promise))\n\t\t\t\t: null;\n\n\t/** @param {Value[]} values */\n\tfunction finish(values) {\n\t\trestore();\n\n\t\ttry {\n\t\t\tfn(values);\n\t\t} catch (error) {\n\t\t\tif ((parent.f & DESTROYED) === 0) {\n\t\t\t\tinvoke_error_boundary(error, parent);\n\t\t\t}\n\t\t}\n\n\t\tunset_context();\n\t}\n\n\t// Fast path: blockers but no async expressions\n\tif (async.length === 0) {\n\t\t/** @type {Promise<any>} */ (blocker_promise).then(() => finish(sync.map(d)));\n\t\treturn;\n\t}\n\n\tvar decrement_pending = increment_pending();\n\n\t// Full path: has async expressions\n\tfunction run() {\n\t\tPromise.all(async.map((expression) => async_derived(expression)))\n\t\t\t.then((result) => finish([...sync.map(d), ...result]))\n\t\t\t.catch((error) => invoke_error_boundary(error, parent))\n\t\t\t.finally(() => decrement_pending());\n\t}\n\n\tif (blocker_promise) {\n\t\tblocker_promise.then(() => {\n\t\t\trestore();\n\t\t\trun();\n\t\t\tunset_context();\n\t\t});\n\t} else {\n\t\trun();\n\t}\n}\n\n/**\n * @param {Blocker[]} blockers\n * @param {(values: Value[]) => any} fn\n */\nexport function run_after_blockers(blockers, fn) {\n\tflatten(blockers, [], [], fn);\n}\n\n/**\n * Captures the current effect context so that we can restore it after\n * some asynchronous work has happened (so that e.g. `await a + b`\n * causes `b` to be registered as a dependency).\n */\nexport function capture() {\n\tvar previous_effect = /** @type {Effect} */ (active_effect);\n\tvar previous_reaction = active_reaction;\n\tvar previous_component_context = component_context;\n\tvar previous_batch = /** @type {Batch} */ (current_batch);\n\n\tif (DEV) {\n\t\tvar previous_dev_stack = dev_stack;\n\t}\n\n\treturn function restore(activate_batch = true) {\n\t\tset_active_effect(previous_effect);\n\t\tset_active_reaction(previous_reaction);\n\t\tset_component_context(previous_component_context);\n\n\t\tif (activate_batch && (previous_effect.f & DESTROYED) === 0) {\n\t\t\t// TODO we only need optional chaining here because `{#await ...}` blocks\n\t\t\t// are anomalous. Once we retire them we can get rid of it\n\t\t\tprevious_batch?.activate();\n\t\t\tprevious_batch?.apply();\n\t\t}\n\n\t\tif (DEV) {\n\t\t\tset_reactivity_loss_tracker(null);\n\t\t\tset_dev_stack(previous_dev_stack);\n\t\t}\n\t};\n}\n\n/**\n * Wraps an `await` expression in such a way that the effect context that was\n * active before the expression evaluated can be reapplied afterwards —\n * `await a + b` becomes `(await $.save(a))() + b`\n * @template T\n * @param {Promise<T>} promise\n * @returns {Promise<() => T>}\n */\nexport async function save(promise) {\n\tvar restore = capture();\n\tvar value = await promise;\n\n\treturn () => {\n\t\trestore();\n\t\treturn value;\n\t};\n}\n\n/**\n * Reset `current_async_effect` after the `promise` resolves, so\n * that we can emit `await_reactivity_loss` warnings\n * @template T\n * @param {Promise<T>} promise\n * @returns {Promise<() => T>}\n */\nexport async function track_reactivity_loss(promise) {\n\tvar previous_async_effect = reactivity_loss_tracker;\n\tvar value = await promise;\n\n\treturn () => {\n\t\tset_reactivity_loss_tracker(previous_async_effect);\n\t\treturn value;\n\t};\n}\n\n/**\n * Used in `for await` loops in DEV, so\n * that we can emit `await_reactivity_loss` warnings\n * after each `async_iterator` result resolves and\n * after the `async_iterator` return resolves (if it runs)\n * @template T\n * @template TReturn\n * @param {Iterable<T> | AsyncIterable<T>} iterable\n * @returns {AsyncGenerator<T, TReturn | undefined>}\n */\nexport async function* for_await_track_reactivity_loss(iterable) {\n\t// This is based on the algorithms described in ECMA-262:\n\t// ForIn/OfBodyEvaluation\n\t// https://tc39.es/ecma262/multipage/ecmascript-language-statements-and-declarations.html#sec-runtime-semantics-forin-div-ofbodyevaluation-lhs-stmt-iterator-lhskind-labelset\n\t// AsyncIteratorClose\n\t// https://tc39.es/ecma262/multipage/abstract-operations.html#sec-asynciteratorclose\n\n\t/** @type {AsyncIterator<T, TReturn>} */\n\t// @ts-ignore\n\tconst iterator = iterable[Symbol.asyncIterator]?.() ?? iterable[Symbol.iterator]?.();\n\n\tif (iterator === undefined) {\n\t\tthrow new TypeError('value is not async iterable');\n\t}\n\n\t/** Whether the completion of the iterator was \"normal\", meaning it wasn't ended via `break` or a similar method */\n\tlet normal_completion = false;\n\ttry {\n\t\twhile (true) {\n\t\t\tconst { done, value } = (await track_reactivity_loss(iterator.next()))();\n\t\t\tif (done) {\n\t\t\t\tnormal_completion = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tyield value;\n\t\t}\n\t} finally {\n\t\t// If the iterator had an abrupt completion and `return` is defined on the iterator, call it and return the value\n\t\tif (!normal_completion && iterator.return !== undefined) {\n\t\t\t// eslint-disable-next-line no-unsafe-finally\n\t\t\treturn /** @type {TReturn} */ ((await track_reactivity_loss(iterator.return()))().value);\n\t\t}\n\t}\n}\n\nexport function unset_context(deactivate_batch = true) {\n\tset_active_effect(null);\n\tset_active_reaction(null);\n\tset_component_context(null);\n\tif (deactivate_batch) current_batch?.deactivate();\n\n\tif (DEV) {\n\t\tset_reactivity_loss_tracker(null);\n\t\tset_dev_stack(null);\n\t}\n}\n\n/**\n * @param {Array<() => void | Promise<void>>} thunks\n */\nexport function run(thunks) {\n\tconst restore = capture();\n\n\tconst decrement_pending = increment_pending();\n\n\tvar active = /** @type {Effect} */ (active_effect);\n\n\t/** @type {null | { error: any }} */\n\tvar errored = null;\n\n\t/** @param {any} error */\n\tconst handle_error = (error) => {\n\t\terrored = { error }; // wrap in object in case a promise rejects with a falsy value\n\n\t\tif (!aborted(active)) {\n\t\t\tinvoke_error_boundary(error, active);\n\t\t}\n\t};\n\n\tvar promise = Promise.resolve(thunks[0]()).catch(handle_error);\n\n\t/** @type {Blocker} */\n\tvar blocker = { promise, settled: false };\n\tvar blockers = [blocker];\n\n\tpromise.finally(() => {\n\t\tblocker.settled = true;\n\t\tunset_context();\n\t});\n\n\tfor (const fn of thunks.slice(1)) {\n\t\tpromise = promise\n\t\t\t.then(() => {\n\t\t\t\tif (errored) {\n\t\t\t\t\tthrow errored.error;\n\t\t\t\t}\n\n\t\t\t\tif (aborted(active)) {\n\t\t\t\t\tthrow STALE_REACTION;\n\t\t\t\t}\n\n\t\t\t\trestore();\n\t\t\t\treturn fn();\n\t\t\t})\n\t\t\t.catch(handle_error);\n\n\t\tconst blocker = { promise, settled: false };\n\t\tblockers.push(blocker);\n\n\t\tpromise.finally(() => {\n\t\t\tblocker.settled = true;\n\t\t\tunset_context();\n\t\t});\n\t}\n\n\tpromise\n\t\t// wait one more tick, so that template effects are\n\t\t// guaranteed to run before `$effect(...)`\n\t\t.then(() => Promise.resolve())\n\t\t.finally(() => decrement_pending());\n\n\treturn blockers;\n}\n\n/**\n * @param {Blocker[]} blockers\n */\nexport function wait(blockers) {\n\treturn Promise.all(blockers.map((b) => b.promise));\n}\n\n/**\n * @returns {(skip?: boolean) => void}\n */\nexport function increment_pending() {\n\tvar effect = /** @type {Effect} */ (active_effect);\n\tvar boundary = /** @type {Boundary} */ (effect.b);\n\tvar batch = /** @type {Batch} */ (current_batch);\n\tvar blocking = boundary.is_rendered();\n\n\tboundary.update_pending_count(1, batch);\n\tbatch.increment(blocking, effect);\n\n\treturn (skip = false) => {\n\t\tboundary.update_pending_count(-1, batch);\n\t\tbatch.decrement(blocking, effect, skip);\n\t};\n}\n","/** @import { Derived, Effect, Source } from '#client' */\n/** @import { Batch } from './batch.js'; */\n/** @import { Boundary } from '../dom/blocks/boundary.js'; */\nimport { DEV } from 'esm-env';\nimport {\n\tERROR_VALUE,\n\tDERIVED,\n\tDIRTY,\n\tEFFECT_PRESERVED,\n\tSTALE_REACTION,\n\tASYNC,\n\tWAS_MARKED,\n\tDESTROYED,\n\tCLEAN,\n\tREACTION_RAN\n} from '#client/constants';\nimport {\n\tactive_reaction,\n\tactive_effect,\n\tupdate_reaction,\n\tincrement_write_version,\n\tset_active_effect,\n\tpush_reaction_value,\n\tis_destroying_effect,\n\tupdate_effect,\n\tremove_reactions\n} from '../runtime.js';\nimport { equals, safe_equals } from './equality.js';\nimport * as e from '../errors.js';\nimport * as w from '../warnings.js';\nimport {\n\tasync_effect,\n\tdestroy_effect,\n\tdestroy_effect_children,\n\teffect_tracking,\n\tteardown\n} from './effects.js';\nimport { eager_effects, internal_set, set_eager_effects, source } from './sources.js';\nimport { get_error } from '../../shared/dev.js';\nimport { async_mode_flag, tracing_mode_flag } from '../../flags/index.js';\nimport { component_context } from '../context.js';\nimport { UNINITIALIZED } from '../../../constants.js';\nimport { batch_values, current_batch } from './batch.js';\nimport { increment_pending, unset_context } from './async.js';\nimport { deferred, includes, noop } from '../../shared/utils.js';\nimport { set_signal_status, update_derived_status } from './status.js';\n\n/**\n * This allows us to track 'reactivity loss' that occurs when signals\n * are read after a non-context-restoring `await`. Dev-only\n * @type {{ effect: Effect, warned: boolean } | null}\n */\nexport let reactivity_loss_tracker = null;\n\n/** @param {{ effect: Effect, warned: boolean } | null} v */\nexport function set_reactivity_loss_tracker(v) {\n\treactivity_loss_tracker = v;\n}\n\nexport const recent_async_deriveds = new Set();\n\n/**\n * @template V\n * @param {() => V} fn\n * @returns {Derived<V>}\n */\n/*#__NO_SIDE_EFFECTS__*/\nexport function derived(fn) {\n\tvar flags = DERIVED | DIRTY;\n\tvar parent_derived =\n\t\tactive_reaction !== null && (active_reaction.f & DERIVED) !== 0\n\t\t\t? /** @type {Derived} */ (active_reaction)\n\t\t\t: null;\n\n\tif (active_effect !== null) {\n\t\t// Since deriveds are evaluated lazily, any effects created inside them are\n\t\t// created too late to ensure that the parent effect is added to the tree\n\t\tactive_effect.f |= EFFECT_PRESERVED;\n\t}\n\n\t/** @type {Derived<V>} */\n\tconst signal = {\n\t\tctx: component_context,\n\t\tdeps: null,\n\t\teffects: null,\n\t\tequals,\n\t\tf: flags,\n\t\tfn,\n\t\treactions: null,\n\t\trv: 0,\n\t\tv: /** @type {V} */ (UNINITIALIZED),\n\t\twv: 0,\n\t\tparent: parent_derived ?? active_effect,\n\t\tac: null\n\t};\n\n\tif (DEV && tracing_mode_flag) {\n\t\tsignal.created = get_error('created at');\n\t}\n\n\treturn signal;\n}\n\n/**\n * @template V\n * @param {() => V | Promise<V>} fn\n * @param {string} [label]\n * @param {string} [location] If provided, print a warning if the value is not read immediately after update\n * @returns {Promise<Source<V>>}\n */\n/*#__NO_SIDE_EFFECTS__*/\nexport function async_derived(fn, label, location) {\n\tlet parent = /** @type {Effect | null} */ (active_effect);\n\n\tif (parent === null) {\n\t\te.async_derived_orphan();\n\t}\n\n\tvar promise = /** @type {Promise<V>} */ (/** @type {unknown} */ (undefined));\n\tvar signal = source(/** @type {V} */ (UNINITIALIZED));\n\n\tif (DEV) signal.label = label;\n\n\t// only suspend in async deriveds created on initialisation\n\tvar should_suspend = !active_reaction;\n\n\t/** @type {Map<Batch, ReturnType<typeof deferred<V>>>} */\n\tvar deferreds = new Map();\n\n\tasync_effect(() => {\n\t\tif (DEV) {\n\t\t\treactivity_loss_tracker = {\n\t\t\t\teffect: /** @type {Effect} */ (active_effect),\n\t\t\t\twarned: false\n\t\t\t};\n\t\t}\n\n\t\tvar effect = /** @type {Effect} */ (active_effect);\n\n\t\t/** @type {ReturnType<typeof deferred<V>>} */\n\t\tvar d = deferred();\n\t\tpromise = d.promise;\n\n\t\ttry {\n\t\t\t// If this code is changed at some point, make sure to still access the then property\n\t\t\t// of fn() to read any signals it might access, so that we track them as dependencies.\n\t\t\t// We call `unset_context` to undo any `save` calls that happen inside `fn()`\n\t\t\tPromise.resolve(fn()).then(d.resolve, d.reject).finally(unset_context);\n\t\t} catch (error) {\n\t\t\td.reject(error);\n\t\t\tunset_context();\n\t\t}\n\n\t\tif (DEV) {\n\t\t\treactivity_loss_tracker = null;\n\t\t}\n\n\t\tvar batch = /** @type {Batch} */ (current_batch);\n\n\t\tif (should_suspend) {\n\t\t\t// we only increment the batch's pending state for updates, not creation, otherwise\n\t\t\t// we will decrement to zero before the work that depends on this promise (e.g. a\n\t\t\t// template effect) has initialized, causing the batch to resolve prematurely\n\t\t\tif ((effect.f & REACTION_RAN) !== 0) {\n\t\t\t\tvar decrement_pending = increment_pending();\n\t\t\t}\n\n\t\t\tif (/** @type {Boundary} */ (parent.b).is_rendered()) {\n\t\t\t\tdeferreds.get(batch)?.reject(STALE_REACTION);\n\t\t\t\tdeferreds.delete(batch); // delete to ensure correct order in Map iteration below\n\t\t\t} else {\n\t\t\t\t// While the boundary is still showing pending, a new run supersedes all older in-flight runs\n\t\t\t\t// for this async expression. Cancel eagerly so resolution cannot commit stale values.\n\t\t\t\tfor (const d of deferreds.values()) {\n\t\t\t\t\td.reject(STALE_REACTION);\n\t\t\t\t}\n\t\t\t\tdeferreds.clear();\n\t\t\t}\n\n\t\t\tdeferreds.set(batch, d);\n\t\t}\n\n\t\t/**\n\t\t * @param {any} value\n\t\t * @param {unknown} error\n\t\t */\n\t\tconst handler = (value, error = undefined) => {\n\t\t\tif (DEV) {\n\t\t\t\treactivity_loss_tracker = null;\n\t\t\t}\n\n\t\t\tif (decrement_pending) {\n\t\t\t\t// don't trigger an update if we're only here because\n\t\t\t\t// the promise was superseded before it could resolve\n\t\t\t\tvar skip = error === STALE_REACTION;\n\t\t\t\tdecrement_pending(skip);\n\t\t\t}\n\n\t\t\tif (error === STALE_REACTION || (effect.f & DESTROYED) !== 0) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tbatch.activate();\n\n\t\t\tif (error) {\n\t\t\t\tsignal.f |= ERROR_VALUE;\n\n\t\t\t\t// @ts-expect-error the error is the wrong type, but we don't care\n\t\t\t\tinternal_set(signal, error);\n\t\t\t} else {\n\t\t\t\tif ((signal.f & ERROR_VALUE) !== 0) {\n\t\t\t\t\tsignal.f ^= ERROR_VALUE;\n\t\t\t\t}\n\n\t\t\t\tinternal_set(signal, value);\n\n\t\t\t\t// All prior async derived runs are now stale\n\t\t\t\tfor (const [b, d] of deferreds) {\n\t\t\t\t\tdeferreds.delete(b);\n\t\t\t\t\tif (b === batch) break;\n\t\t\t\t\td.reject(STALE_REACTION);\n\t\t\t\t}\n\n\t\t\t\tif (DEV && location !== undefined) {\n\t\t\t\t\trecent_async_deriveds.add(signal);\n\n\t\t\t\t\tsetTimeout(() => {\n\t\t\t\t\t\tif (recent_async_deriveds.has(signal)) {\n\t\t\t\t\t\t\tw.await_waterfall(/** @type {string} */ (signal.label), location);\n\t\t\t\t\t\t\trecent_async_deriveds.delete(signal);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tbatch.deactivate();\n\t\t};\n\n\t\td.promise.then(handler, (e) => handler(null, e || 'unknown'));\n\t});\n\n\tteardown(() => {\n\t\tfor (const d of deferreds.values()) {\n\t\t\td.reject(STALE_REACTION);\n\t\t}\n\t});\n\n\tif (DEV) {\n\t\t// add a flag that lets this be printed as a derived\n\t\t// when using `$inspect.trace()`\n\t\tsignal.f |= ASYNC;\n\t}\n\n\treturn new Promise((fulfil) => {\n\t\t/** @param {Promise<V>} p */\n\t\tfunction next(p) {\n\t\t\tfunction go() {\n\t\t\t\tif (p === promise) {\n\t\t\t\t\tfulfil(signal);\n\t\t\t\t} else {\n\t\t\t\t\t// if the effect re-runs before the initial promise\n\t\t\t\t\t// resolves, delay resolution until we have a value\n\t\t\t\t\tnext(promise);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tp.then(go, go);\n\t\t}\n\n\t\tnext(promise);\n\t});\n}\n\n/**\n * @template V\n * @param {() => V} fn\n * @returns {Derived<V>}\n */\n/*#__NO_SIDE_EFFECTS__*/\nexport function user_derived(fn) {\n\tconst d = derived(fn);\n\n\tif (!async_mode_flag) push_reaction_value(d);\n\n\treturn d;\n}\n\n/**\n * @template V\n * @param {() => V} fn\n * @returns {Derived<V>}\n */\n/*#__NO_SIDE_EFFECTS__*/\nexport function derived_safe_equal(fn) {\n\tconst signal = derived(fn);\n\tsignal.equals = safe_equals;\n\treturn signal;\n}\n\n/**\n * @param {Derived} derived\n * @returns {void}\n */\nexport function destroy_derived_effects(derived) {\n\tvar effects = derived.effects;\n\n\tif (effects !== null) {\n\t\tderived.effects = null;\n\n\t\tfor (var i = 0; i < effects.length; i += 1) {\n\t\t\tdestroy_effect(/** @type {Effect} */ (effects[i]));\n\t\t}\n\t}\n}\n\n/**\n * The currently updating deriveds, used to detect infinite recursion\n * in dev mode and provide a nicer error than 'too much recursion'\n * @type {Derived[]}\n */\nlet stack = [];\n\n/**\n * @param {Derived} derived\n * @returns {Effect | null}\n */\nfunction get_derived_parent_effect(derived) {\n\tvar parent = derived.parent;\n\twhile (parent !== null) {\n\t\tif ((parent.f & DERIVED) === 0) {\n\t\t\t// The original parent effect might've been destroyed but the derived\n\t\t\t// is used elsewhere now - do not return the destroyed effect in that case\n\t\t\treturn (parent.f & DESTROYED) === 0 ? /** @type {Effect} */ (parent) : null;\n\t\t}\n\t\tparent = parent.parent;\n\t}\n\treturn null;\n}\n\n/**\n * @template T\n * @param {Derived} derived\n * @returns {T}\n */\nexport function execute_derived(derived) {\n\tvar value;\n\tvar prev_active_effect = active_effect;\n\n\tset_active_effect(get_derived_parent_effect(derived));\n\n\tif (DEV) {\n\t\tlet prev_eager_effects = eager_effects;\n\t\tset_eager_effects(new Set());\n\t\ttry {\n\t\t\tif (includes.call(stack, derived)) {\n\t\t\t\te.derived_references_self();\n\t\t\t}\n\n\t\t\tstack.push(derived);\n\n\t\t\tderived.f &= ~WAS_MARKED;\n\t\t\tdestroy_derived_effects(derived);\n\t\t\tvalue = update_reaction(derived);\n\t\t} finally {\n\t\t\tset_active_effect(prev_active_effect);\n\t\t\tset_eager_effects(prev_eager_effects);\n\t\t\tstack.pop();\n\t\t}\n\t} else {\n\t\ttry {\n\t\t\tderived.f &= ~WAS_MARKED;\n\t\t\tdestroy_derived_effects(derived);\n\t\t\tvalue = update_reaction(derived);\n\t\t} finally {\n\t\t\tset_active_effect(prev_active_effect);\n\t\t}\n\t}\n\n\treturn value;\n}\n\n/**\n * @param {Derived} derived\n * @returns {void}\n */\nexport function update_derived(derived) {\n\tvar old_value = derived.v;\n\tvar value = execute_derived(derived);\n\n\tif (!derived.equals(value)) {\n\t\tderived.wv = increment_write_version();\n\n\t\t// in a fork, we don't update the underlying value, just `batch_values`.\n\t\t// the underlying value will be updated when the fork is committed.\n\t\t// otherwise, the next time we get here after a 'real world' state\n\t\t// change, `derived.equals` may incorrectly return `true`\n\t\tif (!current_batch?.is_fork || derived.deps === null) {\n\t\t\tderived.v = value;\n\t\t\tcurrent_batch?.capture(derived, old_value, true);\n\n\t\t\t// deriveds without dependencies should never be recomputed\n\t\t\tif (derived.deps === null) {\n\t\t\t\tset_signal_status(derived, CLEAN);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t}\n\n\t// don't mark derived clean if we're reading it inside a\n\t// cleanup function, or it will cache a stale value\n\tif (is_destroying_effect) {\n\t\treturn;\n\t}\n\n\t// During time traveling we don't want to reset the status so that\n\t// traversal of the graph in the other batches still happens\n\tif (batch_values !== null) {\n\t\t// only cache the value if we're in a tracking context, otherwise we won't\n\t\t// clear the cache in `mark_reactions` when dependencies are updated\n\t\tif (effect_tracking() || current_batch?.is_fork) {\n\t\t\tbatch_values.set(derived, value);\n\t\t}\n\t} else {\n\t\tupdate_derived_status(derived);\n\t}\n}\n\n/**\n * @param {Derived} derived\n */\nexport function freeze_derived_effects(derived) {\n\tif (derived.effects === null) return;\n\n\tfor (const e of derived.effects) {\n\t\t// if the effect has a teardown function or abort signal, call it\n\t\tif (e.teardown || e.ac) {\n\t\t\te.teardown?.();\n\t\t\te.ac?.abort(STALE_REACTION);\n\n\t\t\t// make it a noop so it doesn't get called again if the derived\n\t\t\t// is unfrozen. we don't set it to `null`, because the existence\n\t\t\t// of a teardown function is what determines whether the\n\t\t\t// effect runs again during unfreezing\n\t\t\te.teardown = noop;\n\t\t\te.ac = null;\n\n\t\t\tremove_reactions(e, 0);\n\t\t\tdestroy_effect_children(e);\n\t\t}\n\t}\n}\n\n/**\n * @param {Derived} derived\n */\nexport function unfreeze_derived_effects(derived) {\n\tif (derived.effects === null) return;\n\n\tfor (const e of derived.effects) {\n\t\t// if the effect was previously frozen — indicated by the presence\n\t\t// of a teardown function — unfreeze it\n\t\tif (e.teardown) {\n\t\t\tupdate_effect(e);\n\t\t}\n\t}\n}\n","/** @import { Blocker, ComponentContext, ComponentContextLegacy, Derived, Effect, TemplateNode, TransitionManager } from '#client' */\nimport {\n\tis_dirty,\n\tactive_effect,\n\tactive_reaction,\n\tupdate_effect,\n\tget,\n\tis_destroying_effect,\n\tremove_reactions,\n\tset_active_reaction,\n\tset_is_destroying_effect,\n\tuntrack,\n\tuntracking,\n\tset_active_effect\n} from '../runtime.js';\nimport {\n\tDIRTY,\n\tBRANCH_EFFECT,\n\tRENDER_EFFECT,\n\tEFFECT,\n\tDESTROYED,\n\tINERT,\n\tREACTION_RAN,\n\tBLOCK_EFFECT,\n\tROOT_EFFECT,\n\tEFFECT_TRANSPARENT,\n\tDERIVED,\n\tCLEAN,\n\tEAGER_EFFECT,\n\tHEAD_EFFECT,\n\tMAYBE_DIRTY,\n\tEFFECT_PRESERVED,\n\tSTALE_REACTION,\n\tUSER_EFFECT,\n\tASYNC,\n\tCONNECTED,\n\tMANAGED_EFFECT,\n\tDESTROYING\n} from '#client/constants';\nimport * as e from '../errors.js';\nimport { DEV } from 'esm-env';\nimport { define_property } from '../../shared/utils.js';\nimport { get_next_sibling } from '../dom/operations.js';\nimport { component_context, dev_current_component_function, dev_stack } from '../context.js';\nimport { Batch, collected_effects, current_batch } from './batch.js';\nimport { flatten, increment_pending } from './async.js';\nimport { without_reactive_context } from '../dom/elements/bindings/shared.js';\nimport { set_signal_status } from './status.js';\n\n/**\n * @param {'$effect' | '$effect.pre' | '$inspect'} rune\n */\nexport function validate_effect(rune) {\n\tif (active_effect === null) {\n\t\tif (active_reaction === null) {\n\t\t\te.effect_orphan(rune);\n\t\t}\n\n\t\te.effect_in_unowned_derived();\n\t}\n\n\tif (is_destroying_effect) {\n\t\te.effect_in_teardown(rune);\n\t}\n}\n\n/**\n * @param {Effect} effect\n * @param {Effect} parent_effect\n */\nfunction push_effect(effect, parent_effect) {\n\tvar parent_last = parent_effect.last;\n\tif (parent_last === null) {\n\t\tparent_effect.last = parent_effect.first = effect;\n\t} else {\n\t\tparent_last.next = effect;\n\t\teffect.prev = parent_last;\n\t\tparent_effect.last = effect;\n\t}\n}\n\n/**\n * @param {number} type\n * @param {null | (() => void | (() => void))} fn\n * @returns {Effect}\n */\nfunction create_effect(type, fn) {\n\tvar parent = active_effect;\n\n\tif (DEV) {\n\t\t// Ensure the parent is never an inspect effect\n\t\twhile (parent !== null && (parent.f & EAGER_EFFECT) !== 0) {\n\t\t\tparent = parent.parent;\n\t\t}\n\t}\n\n\tif (parent !== null && (parent.f & INERT) !== 0) {\n\t\ttype |= INERT;\n\t}\n\n\t/** @type {Effect} */\n\tvar effect = {\n\t\tctx: component_context,\n\t\tdeps: null,\n\t\tnodes: null,\n\t\tf: type | DIRTY | CONNECTED,\n\t\tfirst: null,\n\t\tfn,\n\t\tlast: null,\n\t\tnext: null,\n\t\tparent,\n\t\tb: parent && parent.b,\n\t\tprev: null,\n\t\tteardown: null,\n\t\twv: 0,\n\t\tac: null\n\t};\n\n\tif (DEV) {\n\t\teffect.component_function = dev_current_component_function;\n\t}\n\n\tcurrent_batch?.register_created_effect(effect);\n\n\t/** @type {Effect | null} */\n\tvar e = effect;\n\n\tif ((type & EFFECT) !== 0) {\n\t\tif (collected_effects !== null) {\n\t\t\t// created during traversal — collect and run afterwards\n\t\t\tcollected_effects.push(effect);\n\t\t} else {\n\t\t\t// schedule for later\n\t\t\tBatch.ensure().schedule(effect);\n\t\t}\n\t} else if (fn !== null) {\n\t\ttry {\n\t\t\tupdate_effect(effect);\n\t\t} catch (e) {\n\t\t\tdestroy_effect(effect);\n\t\t\tthrow e;\n\t\t}\n\n\t\t// if an effect doesn't need to be kept in the tree (because it\n\t\t// won't re-run, has no DOM, and has no teardown etc)\n\t\t// then we skip it and go to its child (if any)\n\t\tif (\n\t\t\te.deps === null &&\n\t\t\te.teardown === null &&\n\t\t\te.nodes === null &&\n\t\t\te.first === e.last && // either `null`, or a singular child\n\t\t\t(e.f & EFFECT_PRESERVED) === 0\n\t\t) {\n\t\t\te = e.first;\n\t\t\tif ((type & BLOCK_EFFECT) !== 0 && (type & EFFECT_TRANSPARENT) !== 0 && e !== null) {\n\t\t\t\te.f |= EFFECT_TRANSPARENT;\n\t\t\t}\n\t\t}\n\t}\n\n\tif (e !== null) {\n\t\te.parent = parent;\n\n\t\tif (parent !== null) {\n\t\t\tpush_effect(e, parent);\n\t\t}\n\n\t\t// if we're in a derived, add the effect there too\n\t\tif (\n\t\t\tactive_reaction !== null &&\n\t\t\t(active_reaction.f & DERIVED) !== 0 &&\n\t\t\t(type & ROOT_EFFECT) === 0\n\t\t) {\n\t\t\tvar derived = /** @type {Derived} */ (active_reaction);\n\t\t\t(derived.effects ??= []).push(e);\n\t\t}\n\t}\n\n\treturn effect;\n}\n\n/**\n * Internal representation of `$effect.tracking()`\n * @returns {boolean}\n */\nexport function effect_tracking() {\n\treturn active_reaction !== null && !untracking;\n}\n\n/**\n * @param {() => void} fn\n */\nexport function teardown(fn) {\n\tconst effect = create_effect(RENDER_EFFECT, null);\n\tset_signal_status(effect, CLEAN);\n\teffect.teardown = fn;\n\treturn effect;\n}\n\n/**\n * Internal representation of `$effect(...)`\n * @param {() => void | (() => void)} fn\n */\nexport function user_effect(fn) {\n\tvalidate_effect('$effect');\n\n\tif (DEV) {\n\t\tdefine_property(fn, 'name', {\n\t\t\tvalue: '$effect'\n\t\t});\n\t}\n\n\t// Non-nested `$effect(...)` in a component should be deferred\n\t// until the component is mounted\n\tvar flags = /** @type {Effect} */ (active_effect).f;\n\tvar defer = !active_reaction && (flags & BRANCH_EFFECT) !== 0 && (flags & REACTION_RAN) === 0;\n\n\tif (defer) {\n\t\t// Top-level `$effect(...)` in an unmounted component — defer until mount\n\t\tvar context = /** @type {ComponentContext} */ (component_context);\n\t\t(context.e ??= []).push(fn);\n\t} else {\n\t\t// Everything else — create immediately\n\t\treturn create_user_effect(fn);\n\t}\n}\n\n/**\n * @param {() => void | (() => void)} fn\n */\nexport function create_user_effect(fn) {\n\treturn create_effect(EFFECT | USER_EFFECT, fn);\n}\n\n/**\n * Internal representation of `$effect.pre(...)`\n * @param {() => void | (() => void)} fn\n * @returns {Effect}\n */\nexport function user_pre_effect(fn) {\n\tvalidate_effect('$effect.pre');\n\tif (DEV) {\n\t\tdefine_property(fn, 'name', {\n\t\t\tvalue: '$effect.pre'\n\t\t});\n\t}\n\treturn create_effect(RENDER_EFFECT | USER_EFFECT, fn);\n}\n\n/** @param {() => void | (() => void)} fn */\nexport function eager_effect(fn) {\n\treturn create_effect(EAGER_EFFECT, fn);\n}\n\n/**\n * Internal representation of `$effect.root(...)`\n * @param {() => void | (() => void)} fn\n * @returns {() => void}\n */\nexport function effect_root(fn) {\n\tBatch.ensure();\n\tconst effect = create_effect(ROOT_EFFECT | EFFECT_PRESERVED, fn);\n\n\treturn () => {\n\t\tdestroy_effect(effect);\n\t};\n}\n\n/**\n * An effect root whose children can transition out\n * @param {() => void} fn\n * @returns {(options?: { outro?: boolean }) => Promise<void>}\n */\nexport function component_root(fn) {\n\tBatch.ensure();\n\tconst effect = create_effect(ROOT_EFFECT | EFFECT_PRESERVED, fn);\n\n\treturn (options = {}) => {\n\t\treturn new Promise((fulfil) => {\n\t\t\tif (options.outro) {\n\t\t\t\tpause_effect(effect, () => {\n\t\t\t\t\tdestroy_effect(effect);\n\t\t\t\t\tfulfil(undefined);\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tdestroy_effect(effect);\n\t\t\t\tfulfil(undefined);\n\t\t\t}\n\t\t});\n\t};\n}\n\n/**\n * @param {() => void | (() => void)} fn\n * @returns {Effect}\n */\nexport function effect(fn) {\n\treturn create_effect(EFFECT, fn);\n}\n\n/**\n * Internal representation of `$: ..`\n * @param {() => any} deps\n * @param {() => void | (() => void)} fn\n */\nexport function legacy_pre_effect(deps, fn) {\n\tvar context = /** @type {ComponentContextLegacy} */ (component_context);\n\n\t/** @type {{ effect: null | Effect, ran: boolean, deps: () => any }} */\n\tvar token = { effect: null, ran: false, deps };\n\n\tcontext.l.$.push(token);\n\n\ttoken.effect = render_effect(() => {\n\t\tdeps();\n\n\t\t// If this legacy pre effect has already run before the end of the reset, then\n\t\t// bail out to emulate the same behavior.\n\t\tif (token.ran) return;\n\n\t\ttoken.ran = true;\n\n\t\tvar effect = /** @type {Effect} */ (active_effect);\n\n\t\t// here, we lie: by setting `active_effect` to be the parent branch, any writes\n\t\t// that happen inside `fn` will _not_ cause an unnecessary reschedule, because\n\t\t// the affected effects will be children of `active_effect`. this is safe\n\t\t// because these effects are known to run in the correct order\n\t\ttry {\n\t\t\tset_active_effect(effect.parent);\n\t\t\tuntrack(fn);\n\t\t} finally {\n\t\t\tset_active_effect(effect);\n\t\t}\n\t});\n}\n\nexport function legacy_pre_effect_reset() {\n\tvar context = /** @type {ComponentContextLegacy} */ (component_context);\n\n\trender_effect(() => {\n\t\t// Run dirty `$:` statements\n\t\tfor (var token of context.l.$) {\n\t\t\ttoken.deps();\n\n\t\t\tvar effect = token.effect;\n\n\t\t\t// If the effect is CLEAN, then make it MAYBE_DIRTY. This ensures we traverse through\n\t\t\t// the effects dependencies and correctly ensure each dependency is up-to-date.\n\t\t\tif ((effect.f & CLEAN) !== 0 && effect.deps !== null) {\n\t\t\t\tset_signal_status(effect, MAYBE_DIRTY);\n\t\t\t}\n\n\t\t\tif (is_dirty(effect)) {\n\t\t\t\tupdate_effect(effect);\n\t\t\t}\n\n\t\t\ttoken.ran = false;\n\t\t}\n\t});\n}\n\n/**\n * @param {() => void | (() => void)} fn\n * @returns {Effect}\n */\nexport function async_effect(fn) {\n\treturn create_effect(ASYNC | EFFECT_PRESERVED, fn);\n}\n\n/**\n * @param {() => void | (() => void)} fn\n * @returns {Effect}\n */\nexport function render_effect(fn, flags = 0) {\n\treturn create_effect(RENDER_EFFECT | flags, fn);\n}\n\n/**\n * @param {(...expressions: any) => void | (() => void)} fn\n * @param {Array<() => any>} sync\n * @param {Array<() => Promise<any>>} async\n * @param {Blocker[]} blockers\n */\nexport function template_effect(fn, sync = [], async = [], blockers = []) {\n\tflatten(blockers, sync, async, (values) => {\n\t\tcreate_effect(RENDER_EFFECT, () => fn(...values.map(get)));\n\t});\n}\n\n/**\n * Like `template_effect`, but with an effect which is deferred until the batch commits\n * @param {(...expressions: any) => void | (() => void)} fn\n * @param {Array<() => any>} sync\n * @param {Array<() => Promise<any>>} async\n * @param {Blocker[]} blockers\n */\nexport function deferred_template_effect(fn, sync = [], async = [], blockers = []) {\n\tif (async.length > 0 || blockers.length > 0) {\n\t\tvar decrement_pending = increment_pending();\n\t}\n\n\tflatten(blockers, sync, async, (values) => {\n\t\tcreate_effect(EFFECT, () => fn(...values.map(get)));\n\n\t\tif (decrement_pending) {\n\t\t\tdecrement_pending();\n\t\t}\n\t});\n}\n\n/**\n * @param {(() => void)} fn\n * @param {number} flags\n */\nexport function block(fn, flags = 0) {\n\tvar effect = create_effect(BLOCK_EFFECT | flags, fn);\n\tif (DEV) {\n\t\teffect.dev_stack = dev_stack;\n\t}\n\treturn effect;\n}\n\n/**\n * @param {(() => void)} fn\n * @param {number} flags\n */\nexport function managed(fn, flags = 0) {\n\tvar effect = create_effect(MANAGED_EFFECT | flags, fn);\n\tif (DEV) {\n\t\teffect.dev_stack = dev_stack;\n\t}\n\treturn effect;\n}\n\n/**\n * @param {(() => void)} fn\n */\nexport function branch(fn) {\n\treturn create_effect(BRANCH_EFFECT | EFFECT_PRESERVED, fn);\n}\n\n/**\n * @param {Effect} effect\n */\nexport function execute_effect_teardown(effect) {\n\tvar teardown = effect.teardown;\n\tif (teardown !== null) {\n\t\tconst previously_destroying_effect = is_destroying_effect;\n\t\tconst previous_reaction = active_reaction;\n\t\tset_is_destroying_effect(true);\n\t\tset_active_reaction(null);\n\t\ttry {\n\t\t\tteardown.call(null);\n\t\t} finally {\n\t\t\tset_is_destroying_effect(previously_destroying_effect);\n\t\t\tset_active_reaction(previous_reaction);\n\t\t}\n\t}\n}\n\n/**\n * @param {Effect} signal\n * @param {boolean} remove_dom\n * @returns {void}\n */\nexport function destroy_effect_children(signal, remove_dom = false) {\n\tvar effect = signal.first;\n\tsignal.first = signal.last = null;\n\n\twhile (effect !== null) {\n\t\tconst controller = effect.ac;\n\n\t\tif (controller !== null) {\n\t\t\twithout_reactive_context(() => {\n\t\t\t\tcontroller.abort(STALE_REACTION);\n\t\t\t});\n\t\t}\n\n\t\tvar next = effect.next;\n\n\t\tif ((effect.f & ROOT_EFFECT) !== 0) {\n\t\t\t// this is now an independent root\n\t\t\teffect.parent = null;\n\t\t} else {\n\t\t\tdestroy_effect(effect, remove_dom);\n\t\t}\n\n\t\teffect = next;\n\t}\n}\n\n/**\n * @param {Effect} signal\n * @returns {void}\n */\nexport function destroy_block_effect_children(signal) {\n\tvar effect = signal.first;\n\n\twhile (effect !== null) {\n\t\tvar next = effect.next;\n\t\tif ((effect.f & BRANCH_EFFECT) === 0) {\n\t\t\tdestroy_effect(effect);\n\t\t}\n\t\teffect = next;\n\t}\n}\n\n/**\n * @param {Effect} effect\n * @param {boolean} [remove_dom]\n * @returns {void}\n */\nexport function destroy_effect(effect, remove_dom = true) {\n\tvar removed = false;\n\n\tif (\n\t\t(remove_dom || (effect.f & HEAD_EFFECT) !== 0) &&\n\t\teffect.nodes !== null &&\n\t\teffect.nodes.end !== null\n\t) {\n\t\tremove_effect_dom(effect.nodes.start, /** @type {TemplateNode} */ (effect.nodes.end));\n\t\tremoved = true;\n\t}\n\n\tset_signal_status(effect, DESTROYING);\n\tdestroy_effect_children(effect, remove_dom && !removed);\n\tremove_reactions(effect, 0);\n\n\tvar transitions = effect.nodes && effect.nodes.t;\n\n\tif (transitions !== null) {\n\t\tfor (const transition of transitions) {\n\t\t\ttransition.stop();\n\t\t}\n\t}\n\n\texecute_effect_teardown(effect);\n\n\teffect.f ^= DESTROYING;\n\teffect.f |= DESTROYED;\n\n\tvar parent = effect.parent;\n\n\t// If the parent doesn't have any children, then skip this work altogether\n\tif (parent !== null && parent.first !== null) {\n\t\tunlink_effect(effect);\n\t}\n\n\tif (DEV) {\n\t\teffect.component_function = null;\n\t}\n\n\t// `first` and `child` are nulled out in destroy_effect_children\n\t// we don't null out `parent` so that error propagation can work correctly\n\teffect.next =\n\t\teffect.prev =\n\t\teffect.teardown =\n\t\teffect.ctx =\n\t\teffect.deps =\n\t\teffect.fn =\n\t\teffect.nodes =\n\t\teffect.ac =\n\t\teffect.b =\n\t\t\tnull;\n}\n\n/**\n *\n * @param {TemplateNode | null} node\n * @param {TemplateNode} end\n */\nexport function remove_effect_dom(node, end) {\n\twhile (node !== null) {\n\t\t/** @type {TemplateNode | null} */\n\t\tvar next = node === end ? null : get_next_sibling(node);\n\n\t\tnode.remove();\n\t\tnode = next;\n\t}\n}\n\n/**\n * Detach an effect from the effect tree, freeing up memory and\n * reducing the amount of work that happens on subsequent traversals\n * @param {Effect} effect\n */\nexport function unlink_effect(effect) {\n\tvar parent = effect.parent;\n\tvar prev = effect.prev;\n\tvar next = effect.next;\n\n\tif (prev !== null) prev.next = next;\n\tif (next !== null) next.prev = prev;\n\n\tif (parent !== null) {\n\t\tif (parent.first === effect) parent.first = next;\n\t\tif (parent.last === effect) parent.last = prev;\n\t}\n}\n\n/**\n * When a block effect is removed, we don't immediately destroy it or yank it\n * out of the DOM, because it might have transitions. Instead, we 'pause' it.\n * It stays around (in memory, and in the DOM) until outro transitions have\n * completed, and if the state change is reversed then we _resume_ it.\n * A paused effect does not update, and the DOM subtree becomes inert.\n * @param {Effect} effect\n * @param {() => void} [callback]\n * @param {boolean} [destroy]\n */\nexport function pause_effect(effect, callback, destroy = true) {\n\t/** @type {TransitionManager[]} */\n\tvar transitions = [];\n\n\tpause_children(effect, transitions, true);\n\n\tvar fn = () => {\n\t\tif (destroy) destroy_effect(effect);\n\t\tif (callback) callback();\n\t};\n\n\tvar remaining = transitions.length;\n\tif (remaining > 0) {\n\t\tvar check = () => --remaining || fn();\n\t\tfor (var transition of transitions) {\n\t\t\ttransition.out(check);\n\t\t}\n\t} else {\n\t\tfn();\n\t}\n}\n\n/**\n * @param {Effect} effect\n * @param {TransitionManager[]} transitions\n * @param {boolean} local\n */\nfunction pause_children(effect, transitions, local) {\n\tif ((effect.f & INERT) !== 0) return;\n\teffect.f ^= INERT;\n\n\tvar t = effect.nodes && effect.nodes.t;\n\n\tif (t !== null) {\n\t\tfor (const transition of t) {\n\t\t\tif (transition.is_global || local) {\n\t\t\t\ttransitions.push(transition);\n\t\t\t}\n\t\t}\n\t}\n\n\tvar child = effect.first;\n\n\twhile (child !== null) {\n\t\tvar sibling = child.next;\n\t\tvar transparent =\n\t\t\t(child.f & EFFECT_TRANSPARENT) !== 0 ||\n\t\t\t// If this is a branch effect without a block effect parent,\n\t\t\t// it means the parent block effect was pruned. In that case,\n\t\t\t// transparency information was transferred to the branch effect.\n\t\t\t((child.f & BRANCH_EFFECT) !== 0 && (effect.f & BLOCK_EFFECT) !== 0);\n\t\t// TODO we don't need to call pause_children recursively with a linked list in place\n\t\t// it's slightly more involved though as we have to account for `transparent` changing\n\t\t// through the tree.\n\t\tpause_children(child, transitions, transparent ? local : false);\n\t\tchild = sibling;\n\t}\n}\n\n/**\n * The opposite of `pause_effect`. We call this if (for example)\n * `x` becomes falsy then truthy: `{#if x}...{/if}`\n * @param {Effect} effect\n */\nexport function resume_effect(effect) {\n\tresume_children(effect, true);\n}\n\n/**\n * @param {Effect} effect\n * @param {boolean} local\n */\nfunction resume_children(effect, local) {\n\tif ((effect.f & INERT) === 0) return;\n\teffect.f ^= INERT;\n\n\t// If a dependency of this effect changed while it was paused,\n\t// schedule the effect to update. we don't use `is_dirty`\n\t// here because we don't want to eagerly recompute a derived like\n\t// `{#if foo}{foo.bar()}{/if}` if `foo` is now `undefined\n\tif ((effect.f & CLEAN) === 0) {\n\t\tset_signal_status(effect, DIRTY);\n\t\tBatch.ensure().schedule(effect); // Assumption: This happens during the commit phase of the batch, causing another flush, but it's safe\n\t}\n\n\tvar child = effect.first;\n\n\twhile (child !== null) {\n\t\tvar sibling = child.next;\n\t\tvar transparent = (child.f & EFFECT_TRANSPARENT) !== 0 || (child.f & BRANCH_EFFECT) !== 0;\n\t\t// TODO we don't need to call resume_children recursively with a linked list in place\n\t\t// it's slightly more involved though as we have to account for `transparent` changing\n\t\t// through the tree.\n\t\tresume_children(child, transparent ? local : false);\n\t\tchild = sibling;\n\t}\n\n\tvar t = effect.nodes && effect.nodes.t;\n\n\tif (t !== null) {\n\t\tfor (const transition of t) {\n\t\t\tif (transition.is_global || local) {\n\t\t\t\ttransition.in();\n\t\t\t}\n\t\t}\n\t}\n}\n\nexport function aborted(effect = /** @type {Effect} */ (active_effect)) {\n\treturn (effect.f & DESTROYED) !== 0;\n}\n\n/**\n * @param {Effect} effect\n * @param {DocumentFragment} fragment\n */\nexport function move_effect(effect, fragment) {\n\tif (!effect.nodes) return;\n\n\t/** @type {TemplateNode | null} */\n\tvar node = effect.nodes.start;\n\tvar end = effect.nodes.end;\n\n\twhile (node !== null) {\n\t\t/** @type {TemplateNode | null} */\n\t\tvar next = node === end ? null : get_next_sibling(node);\n\n\t\tfragment.append(node);\n\t\tnode = next;\n\t}\n}\n","/** @import { Derived, Effect, Source, Value } from '#client' */\nimport { DEV } from 'esm-env';\nimport {\n\tactive_reaction,\n\tactive_effect,\n\tuntracked_writes,\n\tget,\n\tset_untracked_writes,\n\tuntrack,\n\tincrement_write_version,\n\tupdate_effect,\n\tcurrent_sources,\n\tis_dirty,\n\tuntracking,\n\tis_destroying_effect,\n\tpush_reaction_value\n} from '../runtime.js';\nimport { equals, safe_equals } from './equality.js';\nimport {\n\tCLEAN,\n\tDERIVED,\n\tDIRTY,\n\tBRANCH_EFFECT,\n\tEAGER_EFFECT,\n\tMAYBE_DIRTY,\n\tBLOCK_EFFECT,\n\tROOT_EFFECT,\n\tASYNC,\n\tWAS_MARKED,\n\tCONNECTED\n} from '#client/constants';\nimport * as e from '../errors.js';\nimport { legacy_mode_flag, tracing_mode_flag } from '../../flags/index.js';\nimport { includes } from '../../shared/utils.js';\nimport { tag_proxy } from '../dev/tracing.js';\nimport { get_error } from '../../shared/dev.js';\nimport { component_context, is_runes } from '../context.js';\nimport {\n\tBatch,\n\tbatch_values,\n\teager_block_effects,\n\tschedule_effect,\n\tlegacy_updates\n} from './batch.js';\nimport { proxy } from '../proxy.js';\nimport { execute_derived } from './deriveds.js';\nimport { set_signal_status, update_derived_status } from './status.js';\n\n/** @type {Set<any>} */\nexport let eager_effects = new Set();\n\n/** @type {Map<Source, any>} */\nexport const old_values = new Map();\n\n/**\n * @param {Set<any>} v\n */\nexport function set_eager_effects(v) {\n\teager_effects = v;\n}\n\nlet eager_effects_deferred = false;\n\nexport function set_eager_effects_deferred() {\n\teager_effects_deferred = true;\n}\n\n/**\n * @template V\n * @param {V} v\n * @param {Error | null} [stack]\n * @returns {Source<V>}\n */\n// TODO rename this to `state` throughout the codebase\nexport function source(v, stack) {\n\t/** @type {Value} */\n\tvar signal = {\n\t\tf: 0, // TODO ideally we could skip this altogether, but it causes type errors\n\t\tv,\n\t\treactions: null,\n\t\tequals,\n\t\trv: 0,\n\t\twv: 0\n\t};\n\n\tif (DEV && tracing_mode_flag) {\n\t\tsignal.created = stack ?? get_error('created at');\n\t\tsignal.updated = null;\n\t\tsignal.set_during_effect = false;\n\t\tsignal.trace = null;\n\t}\n\n\treturn signal;\n}\n\n/**\n * @template V\n * @param {V} v\n * @param {Error | null} [stack]\n */\n/*#__NO_SIDE_EFFECTS__*/\nexport function state(v, stack) {\n\tconst s = source(v, stack);\n\n\tpush_reaction_value(s);\n\n\treturn s;\n}\n\n/**\n * @template V\n * @param {V} initial_value\n * @param {boolean} [immutable]\n * @returns {Source<V>}\n */\n/*#__NO_SIDE_EFFECTS__*/\nexport function mutable_source(initial_value, immutable = false, trackable = true) {\n\tconst s = source(initial_value);\n\tif (!immutable) {\n\t\ts.equals = safe_equals;\n\t}\n\n\t// bind the signal to the component context, in case we need to\n\t// track updates to trigger beforeUpdate/afterUpdate callbacks\n\tif (legacy_mode_flag && trackable && component_context !== null && component_context.l !== null) {\n\t\t(component_context.l.s ??= []).push(s);\n\t}\n\n\treturn s;\n}\n\n/**\n * @template V\n * @param {Value<V>} source\n * @param {V} value\n */\nexport function mutate(source, value) {\n\tset(\n\t\tsource,\n\t\tuntrack(() => get(source))\n\t);\n\treturn value;\n}\n\n/**\n * @template V\n * @param {Source<V>} source\n * @param {V} value\n * @param {boolean} [should_proxy]\n * @returns {V}\n */\nexport function set(source, value, should_proxy = false) {\n\tif (\n\t\tactive_reaction !== null &&\n\t\t// since we are untracking the function inside `$inspect.with` we need to add this check\n\t\t// to ensure we error if state is set inside an inspect effect\n\t\t(!untracking || (active_reaction.f & EAGER_EFFECT) !== 0) &&\n\t\tis_runes() &&\n\t\t(active_reaction.f & (DERIVED | BLOCK_EFFECT | ASYNC | EAGER_EFFECT)) !== 0 &&\n\t\t(current_sources === null || !includes.call(current_sources, source))\n\t) {\n\t\te.state_unsafe_mutation();\n\t}\n\n\tlet new_value = should_proxy ? proxy(value) : value;\n\n\tif (DEV) {\n\t\ttag_proxy(new_value, /** @type {string} */ (source.label));\n\t}\n\n\treturn internal_set(source, new_value, legacy_updates);\n}\n\n/**\n * @template V\n * @param {Source<V>} source\n * @param {V} value\n * @param {Effect[] | null} [updated_during_traversal]\n * @returns {V}\n */\nexport function internal_set(source, value, updated_during_traversal = null) {\n\tif (!source.equals(value)) {\n\t\tvar old_value = source.v;\n\n\t\tif (is_destroying_effect) {\n\t\t\told_values.set(source, value);\n\t\t} else {\n\t\t\told_values.set(source, old_value);\n\t\t}\n\n\t\tsource.v = value;\n\n\t\tvar batch = Batch.ensure();\n\t\tbatch.capture(source, old_value);\n\n\t\tif (DEV) {\n\t\t\tif (tracing_mode_flag || active_effect !== null) {\n\t\t\t\tsource.updated ??= new Map();\n\n\t\t\t\t// For performance reasons, when not using $inspect.trace, we only start collecting stack traces\n\t\t\t\t// after the same source has been updated more than 5 times in the same flush cycle.\n\t\t\t\tconst count = (source.updated.get('')?.count ?? 0) + 1;\n\t\t\t\tsource.updated.set('', { error: /** @type {any} */ (null), count });\n\n\t\t\t\tif (tracing_mode_flag || count > 5) {\n\t\t\t\t\tconst error = get_error('updated at');\n\n\t\t\t\t\tif (error !== null) {\n\t\t\t\t\t\tlet entry = source.updated.get(error.stack);\n\n\t\t\t\t\t\tif (!entry) {\n\t\t\t\t\t\t\tentry = { error, count: 0 };\n\t\t\t\t\t\t\tsource.updated.set(error.stack, entry);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tentry.count++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (active_effect !== null) {\n\t\t\t\tsource.set_during_effect = true;\n\t\t\t}\n\t\t}\n\n\t\tif ((source.f & DERIVED) !== 0) {\n\t\t\tconst derived = /** @type {Derived} */ (source);\n\n\t\t\t// if we are assigning to a dirty derived we set it to clean/maybe dirty but we also eagerly execute it to track the dependencies\n\t\t\tif ((source.f & DIRTY) !== 0) {\n\t\t\t\texecute_derived(derived);\n\t\t\t}\n\n\t\t\t// During time traveling we don't want to reset the status so that\n\t\t\t// traversal of the graph in the other batches still happens\n\t\t\tif (batch_values === null) {\n\t\t\t\tupdate_derived_status(derived);\n\t\t\t}\n\t\t}\n\n\t\tsource.wv = increment_write_version();\n\n\t\t// For debugging, in case you want to know which reactions are being scheduled:\n\t\t// log_reactions(source);\n\t\tmark_reactions(source, DIRTY, updated_during_traversal);\n\n\t\t// It's possible that the current reaction might not have up-to-date dependencies\n\t\t// whilst it's actively running. So in the case of ensuring it registers the reaction\n\t\t// properly for itself, we need to ensure the current effect actually gets\n\t\t// scheduled. i.e: `$effect(() => x++)`\n\t\tif (\n\t\t\tis_runes() &&\n\t\t\tactive_effect !== null &&\n\t\t\t(active_effect.f & CLEAN) !== 0 &&\n\t\t\t(active_effect.f & (BRANCH_EFFECT | ROOT_EFFECT)) === 0\n\t\t) {\n\t\t\tif (untracked_writes === null) {\n\t\t\t\tset_untracked_writes([source]);\n\t\t\t} else {\n\t\t\t\tuntracked_writes.push(source);\n\t\t\t}\n\t\t}\n\n\t\tif (!batch.is_fork && eager_effects.size > 0 && !eager_effects_deferred) {\n\t\t\tflush_eager_effects();\n\t\t}\n\t}\n\n\treturn value;\n}\n\nexport function flush_eager_effects() {\n\teager_effects_deferred = false;\n\n\tfor (const effect of eager_effects) {\n\t\t// Mark clean inspect-effects as maybe dirty and then check their dirtiness\n\t\t// instead of just updating the effects - this way we avoid overfiring.\n\t\tif ((effect.f & CLEAN) !== 0) {\n\t\t\tset_signal_status(effect, MAYBE_DIRTY);\n\t\t}\n\n\t\tif (is_dirty(effect)) {\n\t\t\tupdate_effect(effect);\n\t\t}\n\t}\n\n\teager_effects.clear();\n}\n\n/**\n * @template {number | bigint} T\n * @param {Source<T>} source\n * @param {1 | -1} [d]\n * @returns {T}\n */\nexport function update(source, d = 1) {\n\tvar value = get(source);\n\tvar result = d === 1 ? value++ : value--;\n\n\tset(source, value);\n\n\t// @ts-expect-error\n\treturn result;\n}\n\n/**\n * @template {number | bigint} T\n * @param {Source<T>} source\n * @param {1 | -1} [d]\n * @returns {T}\n */\nexport function update_pre(source, d = 1) {\n\tvar value = get(source);\n\n\t// @ts-expect-error\n\t// eslint-disable-next-line no-useless-assignment -- `++`/`--` used for return value, not side effect on `value`\n\treturn set(source, d === 1 ? ++value : --value);\n}\n\n/**\n * Silently (without using `get`) increment a source\n * @param {Source<number>} source\n */\nexport function increment(source) {\n\tset(source, source.v + 1);\n}\n\n/**\n * @param {Value} signal\n * @param {number} status should be DIRTY or MAYBE_DIRTY\n * @param {Effect[] | null} updated_during_traversal\n * @returns {void}\n */\nfunction mark_reactions(signal, status, updated_during_traversal) {\n\tvar reactions = signal.reactions;\n\tif (reactions === null) return;\n\n\tvar runes = is_runes();\n\tvar length = reactions.length;\n\n\tfor (var i = 0; i < length; i++) {\n\t\tvar reaction = reactions[i];\n\t\tvar flags = reaction.f;\n\n\t\t// In legacy mode, skip the current effect to prevent infinite loops\n\t\tif (!runes && reaction === active_effect) continue;\n\n\t\t// Inspect effects need to run immediately, so that the stack trace makes sense\n\t\tif (DEV && (flags & EAGER_EFFECT) !== 0) {\n\t\t\teager_effects.add(reaction);\n\t\t\tcontinue;\n\t\t}\n\n\t\tvar not_dirty = (flags & DIRTY) === 0;\n\n\t\t// don't set a DIRTY reaction to MAYBE_DIRTY\n\t\tif (not_dirty) {\n\t\t\tset_signal_status(reaction, status);\n\t\t}\n\n\t\tif ((flags & DERIVED) !== 0) {\n\t\t\tvar derived = /** @type {Derived} */ (reaction);\n\n\t\t\tbatch_values?.delete(derived);\n\n\t\t\tif ((flags & WAS_MARKED) === 0) {\n\t\t\t\t// Only connected deriveds can be reliably unmarked right away\n\t\t\t\tif (flags & CONNECTED) {\n\t\t\t\t\treaction.f |= WAS_MARKED;\n\t\t\t\t}\n\n\t\t\t\tmark_reactions(derived, MAYBE_DIRTY, updated_during_traversal);\n\t\t\t}\n\t\t} else if (not_dirty) {\n\t\t\tvar effect = /** @type {Effect} */ (reaction);\n\n\t\t\tif ((flags & BLOCK_EFFECT) !== 0 && eager_block_effects !== null) {\n\t\t\t\teager_block_effects.add(effect);\n\t\t\t}\n\n\t\t\tif (updated_during_traversal !== null) {\n\t\t\t\tupdated_during_traversal.push(effect);\n\t\t\t} else {\n\t\t\t\tschedule_effect(effect);\n\t\t\t}\n\t\t}\n\t}\n}\n","/** @import { Effect, TemplateNode } from '#client' */\nimport { hydrate_node, hydrating, set_hydrate_node } from './hydration.js';\nimport { DEV } from 'esm-env';\nimport { init_array_prototype_warnings } from '../dev/equality.js';\nimport { get_descriptor, is_extensible } from '../../shared/utils.js';\nimport { active_effect } from '../runtime.js';\nimport { async_mode_flag } from '../../flags/index.js';\nimport { TEXT_NODE, REACTION_RAN } from '#client/constants';\nimport { eager_block_effects } from '../reactivity/batch.js';\nimport { NAMESPACE_HTML } from '../../../constants.js';\n\n// export these for reference in the compiled code, making global name deduplication unnecessary\n/** @type {Window} */\nexport var $window;\n\n/** @type {Document} */\nexport var $document;\n\n/** @type {boolean} */\nexport var is_firefox;\n\n/** @type {() => Node | null} */\nvar first_child_getter;\n/** @type {() => Node | null} */\nvar next_sibling_getter;\n\n/**\n * Initialize these lazily to avoid issues when using the runtime in a server context\n * where these globals are not available while avoiding a separate server entry point\n */\nexport function init_operations() {\n\tif ($window !== undefined) {\n\t\treturn;\n\t}\n\n\t$window = window;\n\t$document = document;\n\tis_firefox = /Firefox/.test(navigator.userAgent);\n\n\tvar element_prototype = Element.prototype;\n\tvar node_prototype = Node.prototype;\n\tvar text_prototype = Text.prototype;\n\n\t// @ts-ignore\n\tfirst_child_getter = get_descriptor(node_prototype, 'firstChild').get;\n\t// @ts-ignore\n\tnext_sibling_getter = get_descriptor(node_prototype, 'nextSibling').get;\n\n\tif (is_extensible(element_prototype)) {\n\t\t// the following assignments improve perf of lookups on DOM nodes\n\t\t// @ts-expect-error\n\t\telement_prototype.__click = undefined;\n\t\t// @ts-expect-error\n\t\telement_prototype.__className = undefined;\n\t\t// @ts-expect-error\n\t\telement_prototype.__attributes = null;\n\t\t// @ts-expect-error\n\t\telement_prototype.__style = undefined;\n\t\t// @ts-expect-error\n\t\telement_prototype.__e = undefined;\n\t}\n\n\tif (is_extensible(text_prototype)) {\n\t\t// @ts-expect-error\n\t\ttext_prototype.__t = undefined;\n\t}\n\n\tif (DEV) {\n\t\t// @ts-expect-error\n\t\telement_prototype.__svelte_meta = null;\n\n\t\tinit_array_prototype_warnings();\n\t}\n}\n\n/**\n * @param {string} value\n * @returns {Text}\n */\nexport function create_text(value = '') {\n\treturn document.createTextNode(value);\n}\n\n/**\n * @template {Node} N\n * @param {N} node\n */\n/*@__NO_SIDE_EFFECTS__*/\nexport function get_first_child(node) {\n\treturn /** @type {TemplateNode | null} */ (first_child_getter.call(node));\n}\n\n/**\n * @template {Node} N\n * @param {N} node\n */\n/*@__NO_SIDE_EFFECTS__*/\nexport function get_next_sibling(node) {\n\treturn /** @type {TemplateNode | null} */ (next_sibling_getter.call(node));\n}\n\n/**\n * Don't mark this as side-effect-free, hydration needs to walk all nodes\n * @template {Node} N\n * @param {N} node\n * @param {boolean} is_text\n * @returns {TemplateNode | null}\n */\nexport function child(node, is_text) {\n\tif (!hydrating) {\n\t\treturn get_first_child(node);\n\t}\n\n\tvar child = get_first_child(hydrate_node);\n\n\t// Child can be null if we have an element with a single child, like `<p>{text}</p>`, where `text` is empty\n\tif (child === null) {\n\t\tchild = hydrate_node.appendChild(create_text());\n\t} else if (is_text && child.nodeType !== TEXT_NODE) {\n\t\tvar text = create_text();\n\t\tchild?.before(text);\n\t\tset_hydrate_node(text);\n\t\treturn text;\n\t}\n\n\tif (is_text) {\n\t\tmerge_text_nodes(/** @type {Text} */ (child));\n\t}\n\n\tset_hydrate_node(child);\n\treturn child;\n}\n\n/**\n * Don't mark this as side-effect-free, hydration needs to walk all nodes\n * @param {TemplateNode} node\n * @param {boolean} [is_text]\n * @returns {TemplateNode | null}\n */\nexport function first_child(node, is_text = false) {\n\tif (!hydrating) {\n\t\tvar first = get_first_child(node);\n\n\t\t// TODO prevent user comments with the empty string when preserveComments is true\n\t\tif (first instanceof Comment && first.data === '') return get_next_sibling(first);\n\n\t\treturn first;\n\t}\n\n\tif (is_text) {\n\t\t// if an {expression} is empty during SSR, there might be no\n\t\t// text node to hydrate — we must therefore create one\n\t\tif (hydrate_node?.nodeType !== TEXT_NODE) {\n\t\t\tvar text = create_text();\n\n\t\t\thydrate_node?.before(text);\n\t\t\tset_hydrate_node(text);\n\t\t\treturn text;\n\t\t}\n\n\t\tmerge_text_nodes(/** @type {Text} */ (hydrate_node));\n\t}\n\n\treturn hydrate_node;\n}\n\n/**\n * Don't mark this as side-effect-free, hydration needs to walk all nodes\n * @param {TemplateNode} node\n * @param {number} count\n * @param {boolean} is_text\n * @returns {TemplateNode | null}\n */\nexport function sibling(node, count = 1, is_text = false) {\n\tlet next_sibling = hydrating ? hydrate_node : node;\n\tvar last_sibling;\n\n\twhile (count--) {\n\t\tlast_sibling = next_sibling;\n\t\tnext_sibling = /** @type {TemplateNode} */ (get_next_sibling(next_sibling));\n\t}\n\n\tif (!hydrating) {\n\t\treturn next_sibling;\n\t}\n\n\tif (is_text) {\n\t\t// if a sibling {expression} is empty during SSR, there might be no\n\t\t// text node to hydrate — we must therefore create one\n\t\tif (next_sibling?.nodeType !== TEXT_NODE) {\n\t\t\tvar text = create_text();\n\t\t\t// If the next sibling is `null` and we're handling text then it's because\n\t\t\t// the SSR content was empty for the text, so we need to generate a new text\n\t\t\t// node and insert it after the last sibling\n\t\t\tif (next_sibling === null) {\n\t\t\t\tlast_sibling?.after(text);\n\t\t\t} else {\n\t\t\t\tnext_sibling.before(text);\n\t\t\t}\n\t\t\tset_hydrate_node(text);\n\t\t\treturn text;\n\t\t}\n\n\t\tmerge_text_nodes(/** @type {Text} */ (next_sibling));\n\t}\n\n\tset_hydrate_node(next_sibling);\n\treturn next_sibling;\n}\n\n/**\n * @template {Node} N\n * @param {N} node\n * @returns {void}\n */\nexport function clear_text_content(node) {\n\tnode.textContent = '';\n}\n\n/**\n * Returns `true` if we're updating the current block, for example `condition` in\n * an `{#if condition}` block just changed. In this case, the branch should be\n * appended (or removed) at the same time as other updates within the\n * current `<svelte:boundary>`\n */\nexport function should_defer_append() {\n\tif (!async_mode_flag) return false;\n\tif (eager_block_effects !== null) return false;\n\n\tvar flags = /** @type {Effect} */ (active_effect).f;\n\treturn (flags & REACTION_RAN) !== 0;\n}\n\n/**\n * @template {keyof HTMLElementTagNameMap | string} T\n * @param {T} tag\n * @param {string} [namespace]\n * @param {string} [is]\n * @returns {T extends keyof HTMLElementTagNameMap ? HTMLElementTagNameMap[T] : Element}\n */\nexport function create_element(tag, namespace, is) {\n\tlet options = is ? { is } : undefined;\n\treturn /** @type {T extends keyof HTMLElementTagNameMap ? HTMLElementTagNameMap[T] : Element} */ (\n\t\tdocument.createElementNS(namespace ?? NAMESPACE_HTML, tag, options)\n\t);\n}\n\nexport function create_fragment() {\n\treturn document.createDocumentFragment();\n}\n\n/**\n * @param {string} data\n * @returns\n */\nexport function create_comment(data = '') {\n\treturn document.createComment(data);\n}\n\n/**\n * @param {Element} element\n * @param {string} key\n * @param {string} value\n * @returns\n */\nexport function set_attribute(element, key, value = '') {\n\tif (key.startsWith('xlink:')) {\n\t\telement.setAttributeNS('http://www.w3.org/1999/xlink', key, value);\n\t\treturn;\n\t}\n\treturn element.setAttribute(key, value);\n}\n\n/**\n * Browsers split text nodes larger than 65536 bytes when parsing.\n * For hydration to succeed, we need to stitch them back together\n * @param {Text} text\n */\nexport function merge_text_nodes(text) {\n\tif (/** @type {string} */ (text.nodeValue).length < 65536) {\n\t\treturn;\n\t}\n\n\tlet next = text.nextSibling;\n\n\twhile (next !== null && next.nodeType === TEXT_NODE) {\n\t\tnext.remove();\n\n\t\t/** @type {string} */ (text.nodeValue) += /** @type {string} */ (next.nodeValue);\n\n\t\tnext = text.nextSibling;\n\t}\n}\n","/** @import { Derived, Effect, Reaction, Source, Value } from '#client' */\nimport { DEV } from 'esm-env';\nimport { get_descriptors, get_prototype_of, includes, index_of } from '../shared/utils.js';\nimport {\n\tdestroy_block_effect_children,\n\tdestroy_effect_children,\n\teffect_tracking,\n\texecute_effect_teardown\n} from './reactivity/effects.js';\nimport {\n\tDIRTY,\n\tMAYBE_DIRTY,\n\tCLEAN,\n\tDERIVED,\n\tDESTROYED,\n\tBRANCH_EFFECT,\n\tSTATE_SYMBOL,\n\tBLOCK_EFFECT,\n\tROOT_EFFECT,\n\tCONNECTED,\n\tREACTION_IS_UPDATING,\n\tSTALE_REACTION,\n\tERROR_VALUE,\n\tWAS_MARKED,\n\tMANAGED_EFFECT,\n\tREACTION_RAN\n} from './constants.js';\nimport { old_values } from './reactivity/sources.js';\nimport {\n\treactivity_loss_tracker,\n\texecute_derived,\n\tfreeze_derived_effects,\n\trecent_async_deriveds,\n\tunfreeze_derived_effects,\n\tupdate_derived\n} from './reactivity/deriveds.js';\nimport { async_mode_flag, tracing_mode_flag } from '../flags/index.js';\nimport { tracing_expressions } from './dev/tracing.js';\nimport { get_error } from '../shared/dev.js';\nimport {\n\tcomponent_context,\n\tdev_current_component_function,\n\tdev_stack,\n\tis_runes,\n\tset_component_context,\n\tset_dev_current_component_function,\n\tset_dev_stack\n} from './context.js';\nimport {\n\tBatch,\n\tbatch_values,\n\tcurrent_batch,\n\tflushSync,\n\tschedule_effect\n} from './reactivity/batch.js';\nimport { handle_error } from './error-handling.js';\nimport { UNINITIALIZED } from '../../constants.js';\nimport { captured_signals } from './legacy.js';\nimport { without_reactive_context } from './dom/elements/bindings/shared.js';\nimport { set_signal_status, update_derived_status } from './reactivity/status.js';\nimport * as w from './warnings.js';\n\nlet is_updating_effect = false;\n\nexport let is_destroying_effect = false;\n\n/** @param {boolean} value */\nexport function set_is_destroying_effect(value) {\n\tis_destroying_effect = value;\n}\n\n/** @type {null | Reaction} */\nexport let active_reaction = null;\n\nexport let untracking = false;\n\n/** @param {null | Reaction} reaction */\nexport function set_active_reaction(reaction) {\n\tactive_reaction = reaction;\n}\n\n/** @type {null | Effect} */\nexport let active_effect = null;\n\n/** @param {null | Effect} effect */\nexport function set_active_effect(effect) {\n\tactive_effect = effect;\n}\n\n/**\n * When sources are created within a reaction, reading and writing\n * them within that reaction should not cause a re-run\n * @type {null | Source[]}\n */\nexport let current_sources = null;\n\n/** @param {Value} value */\nexport function push_reaction_value(value) {\n\tif (active_reaction !== null && (!async_mode_flag || (active_reaction.f & DERIVED) !== 0)) {\n\t\tif (current_sources === null) {\n\t\t\tcurrent_sources = [value];\n\t\t} else {\n\t\t\tcurrent_sources.push(value);\n\t\t}\n\t}\n}\n\n/**\n * The dependencies of the reaction that is currently being executed. In many cases,\n * the dependencies are unchanged between runs, and so this will be `null` unless\n * and until a new dependency is accessed — we track this via `skipped_deps`\n * @type {null | Value[]}\n */\nlet new_deps = null;\n\nlet skipped_deps = 0;\n\n/**\n * Tracks writes that the effect it's executed in doesn't listen to yet,\n * so that the dependency can be added to the effect later on if it then reads it\n * @type {null | Source[]}\n */\nexport let untracked_writes = null;\n\n/** @param {null | Source[]} value */\nexport function set_untracked_writes(value) {\n\tuntracked_writes = value;\n}\n\n/**\n * @type {number} Used by sources and deriveds for handling updates.\n * Version starts from 1 so that unowned deriveds differentiate between a created effect and a run one for tracing\n **/\nexport let write_version = 1;\n\n/** @type {number} Used to version each read of a source of derived to avoid duplicating depedencies inside a reaction */\nlet read_version = 0;\n\nexport let update_version = read_version;\n\n/** @param {number} value */\nexport function set_update_version(value) {\n\tupdate_version = value;\n}\n\nexport function increment_write_version() {\n\treturn ++write_version;\n}\n\n/**\n * Determines whether a derived or effect is dirty.\n * If it is MAYBE_DIRTY, will set the status to CLEAN\n * @param {Reaction} reaction\n * @returns {boolean}\n */\nexport function is_dirty(reaction) {\n\tvar flags = reaction.f;\n\n\tif ((flags & DIRTY) !== 0) {\n\t\treturn true;\n\t}\n\n\tif (flags & DERIVED) {\n\t\treaction.f &= ~WAS_MARKED;\n\t}\n\n\tif ((flags & MAYBE_DIRTY) !== 0) {\n\t\tvar dependencies = /** @type {Value[]} */ (reaction.deps);\n\t\tvar length = dependencies.length;\n\n\t\tfor (var i = 0; i < length; i++) {\n\t\t\tvar dependency = dependencies[i];\n\n\t\t\tif (is_dirty(/** @type {Derived} */ (dependency))) {\n\t\t\t\tupdate_derived(/** @type {Derived} */ (dependency));\n\t\t\t}\n\n\t\t\tif (dependency.wv > reaction.wv) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\n\t\tif (\n\t\t\t(flags & CONNECTED) !== 0 &&\n\t\t\t// During time traveling we don't want to reset the status so that\n\t\t\t// traversal of the graph in the other batches still happens\n\t\t\tbatch_values === null\n\t\t) {\n\t\t\tset_signal_status(reaction, CLEAN);\n\t\t}\n\t}\n\n\treturn false;\n}\n\n/**\n * @param {Value} signal\n * @param {Effect} effect\n * @param {boolean} [root]\n */\nfunction schedule_possible_effect_self_invalidation(signal, effect, root = true) {\n\tvar reactions = signal.reactions;\n\tif (reactions === null) return;\n\n\tif (!async_mode_flag && current_sources !== null && includes.call(current_sources, signal)) {\n\t\treturn;\n\t}\n\n\tfor (var i = 0; i < reactions.length; i++) {\n\t\tvar reaction = reactions[i];\n\n\t\tif ((reaction.f & DERIVED) !== 0) {\n\t\t\tschedule_possible_effect_self_invalidation(/** @type {Derived} */ (reaction), effect, false);\n\t\t} else if (effect === reaction) {\n\t\t\tif (root) {\n\t\t\t\tset_signal_status(reaction, DIRTY);\n\t\t\t} else if ((reaction.f & CLEAN) !== 0) {\n\t\t\t\tset_signal_status(reaction, MAYBE_DIRTY);\n\t\t\t}\n\t\t\tschedule_effect(/** @type {Effect} */ (reaction));\n\t\t}\n\t}\n}\n\n/** @param {Reaction} reaction */\nexport function update_reaction(reaction) {\n\tvar previous_deps = new_deps;\n\tvar previous_skipped_deps = skipped_deps;\n\tvar previous_untracked_writes = untracked_writes;\n\tvar previous_reaction = active_reaction;\n\tvar previous_sources = current_sources;\n\tvar previous_component_context = component_context;\n\tvar previous_untracking = untracking;\n\tvar previous_update_version = update_version;\n\n\tvar flags = reaction.f;\n\n\tnew_deps = /** @type {null | Value[]} */ (null);\n\tskipped_deps = 0;\n\tuntracked_writes = null;\n\tactive_reaction = (flags & (BRANCH_EFFECT | ROOT_EFFECT)) === 0 ? reaction : null;\n\n\tcurrent_sources = null;\n\tset_component_context(reaction.ctx);\n\tuntracking = false;\n\tupdate_version = ++read_version;\n\n\tif (reaction.ac !== null) {\n\t\twithout_reactive_context(() => {\n\t\t\t/** @type {AbortController} */ (reaction.ac).abort(STALE_REACTION);\n\t\t});\n\n\t\treaction.ac = null;\n\t}\n\n\ttry {\n\t\treaction.f |= REACTION_IS_UPDATING;\n\t\tvar fn = /** @type {Function} */ (reaction.fn);\n\t\tvar result = fn();\n\t\treaction.f |= REACTION_RAN;\n\t\tvar deps = reaction.deps;\n\n\t\t// Don't remove reactions during fork;\n\t\t// they must remain for when fork is discarded\n\t\tvar is_fork = current_batch?.is_fork;\n\n\t\tif (new_deps !== null) {\n\t\t\tvar i;\n\n\t\t\tif (!is_fork) {\n\t\t\t\tremove_reactions(reaction, skipped_deps);\n\t\t\t}\n\n\t\t\tif (deps !== null && skipped_deps > 0) {\n\t\t\t\tdeps.length = skipped_deps + new_deps.length;\n\t\t\t\tfor (i = 0; i < new_deps.length; i++) {\n\t\t\t\t\tdeps[skipped_deps + i] = new_deps[i];\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\treaction.deps = deps = new_deps;\n\t\t\t}\n\n\t\t\tif (effect_tracking() && (reaction.f & CONNECTED) !== 0) {\n\t\t\t\tfor (i = skipped_deps; i < deps.length; i++) {\n\t\t\t\t\t(deps[i].reactions ??= []).push(reaction);\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (!is_fork && deps !== null && skipped_deps < deps.length) {\n\t\t\tremove_reactions(reaction, skipped_deps);\n\t\t\tdeps.length = skipped_deps;\n\t\t}\n\n\t\t// If we're inside an effect and we have untracked writes, then we need to\n\t\t// ensure that if any of those untracked writes result in re-invalidation\n\t\t// of the current effect, then that happens accordingly\n\t\tif (\n\t\t\tis_runes() &&\n\t\t\tuntracked_writes !== null &&\n\t\t\t!untracking &&\n\t\t\tdeps !== null &&\n\t\t\t(reaction.f & (DERIVED | MAYBE_DIRTY | DIRTY)) === 0\n\t\t) {\n\t\t\tfor (i = 0; i < /** @type {Source[]} */ (untracked_writes).length; i++) {\n\t\t\t\tschedule_possible_effect_self_invalidation(\n\t\t\t\t\tuntracked_writes[i],\n\t\t\t\t\t/** @type {Effect} */ (reaction)\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\t// If we are returning to an previous reaction then\n\t\t// we need to increment the read version to ensure that\n\t\t// any dependencies in this reaction aren't marked with\n\t\t// the same version\n\t\tif (previous_reaction !== null && previous_reaction !== reaction) {\n\t\t\tread_version++;\n\n\t\t\t// update the `rv` of the previous reaction's deps — both existing and new —\n\t\t\t// so that they are not added again\n\t\t\tif (previous_reaction.deps !== null) {\n\t\t\t\tfor (let i = 0; i < previous_skipped_deps; i += 1) {\n\t\t\t\t\tprevious_reaction.deps[i].rv = read_version;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (previous_deps !== null) {\n\t\t\t\tfor (const dep of previous_deps) {\n\t\t\t\t\tdep.rv = read_version;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (untracked_writes !== null) {\n\t\t\t\tif (previous_untracked_writes === null) {\n\t\t\t\t\tprevious_untracked_writes = untracked_writes;\n\t\t\t\t} else {\n\t\t\t\t\tprevious_untracked_writes.push(.../** @type {Source[]} */ (untracked_writes));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif ((reaction.f & ERROR_VALUE) !== 0) {\n\t\t\treaction.f ^= ERROR_VALUE;\n\t\t}\n\n\t\treturn result;\n\t} catch (error) {\n\t\treturn handle_error(error);\n\t} finally {\n\t\treaction.f ^= REACTION_IS_UPDATING;\n\t\tnew_deps = previous_deps;\n\t\tskipped_deps = previous_skipped_deps;\n\t\tuntracked_writes = previous_untracked_writes;\n\t\tactive_reaction = previous_reaction;\n\t\tcurrent_sources = previous_sources;\n\t\tset_component_context(previous_component_context);\n\t\tuntracking = previous_untracking;\n\t\tupdate_version = previous_update_version;\n\t}\n}\n\n/**\n * @template V\n * @param {Reaction} signal\n * @param {Value<V>} dependency\n * @returns {void}\n */\nfunction remove_reaction(signal, dependency) {\n\tlet reactions = dependency.reactions;\n\tif (reactions !== null) {\n\t\tvar index = index_of.call(reactions, signal);\n\t\tif (index !== -1) {\n\t\t\tvar new_length = reactions.length - 1;\n\t\t\tif (new_length === 0) {\n\t\t\t\treactions = dependency.reactions = null;\n\t\t\t} else {\n\t\t\t\t// Swap with last element and then remove.\n\t\t\t\treactions[index] = reactions[new_length];\n\t\t\t\treactions.pop();\n\t\t\t}\n\t\t}\n\t}\n\n\t// If the derived has no reactions, then we can disconnect it from the graph,\n\t// allowing it to either reconnect in the future, or be GC'd by the VM.\n\tif (\n\t\treactions === null &&\n\t\t(dependency.f & DERIVED) !== 0 &&\n\t\t// Destroying a child effect while updating a parent effect can cause a dependency to appear\n\t\t// to be unused, when in fact it is used by the currently-updating parent. Checking `new_deps`\n\t\t// allows us to skip the expensive work of disconnecting and immediately reconnecting it\n\t\t(new_deps === null || !includes.call(new_deps, dependency))\n\t) {\n\t\tvar derived = /** @type {Derived} */ (dependency);\n\n\t\t// If we are working with a derived that is owned by an effect, then mark it as being\n\t\t// disconnected and remove the mark flag, as it cannot be reliably removed otherwise\n\t\tif ((derived.f & CONNECTED) !== 0) {\n\t\t\tderived.f ^= CONNECTED;\n\t\t\tderived.f &= ~WAS_MARKED;\n\t\t}\n\n\t\tupdate_derived_status(derived);\n\n\t\t// freeze any effects inside this derived\n\t\tfreeze_derived_effects(derived);\n\n\t\t// Disconnect any reactions owned by this reaction\n\t\tremove_reactions(derived, 0);\n\t}\n}\n\n/**\n * @param {Reaction} signal\n * @param {number} start_index\n * @returns {void}\n */\nexport function remove_reactions(signal, start_index) {\n\tvar dependencies = signal.deps;\n\tif (dependencies === null) return;\n\n\tfor (var i = start_index; i < dependencies.length; i++) {\n\t\tremove_reaction(signal, dependencies[i]);\n\t}\n}\n\n/**\n * @param {Effect} effect\n * @returns {void}\n */\nexport function update_effect(effect) {\n\tvar flags = effect.f;\n\n\tif ((flags & DESTROYED) !== 0) {\n\t\treturn;\n\t}\n\n\tset_signal_status(effect, CLEAN);\n\n\tvar previous_effect = active_effect;\n\tvar was_updating_effect = is_updating_effect;\n\n\tactive_effect = effect;\n\tis_updating_effect = true;\n\n\tif (DEV) {\n\t\tvar previous_component_fn = dev_current_component_function;\n\t\tset_dev_current_component_function(effect.component_function);\n\t\tvar previous_stack = /** @type {any} */ (dev_stack);\n\t\t// only block effects have a dev stack, keep the current one otherwise\n\t\tset_dev_stack(effect.dev_stack ?? dev_stack);\n\t}\n\n\ttry {\n\t\tif ((flags & (BLOCK_EFFECT | MANAGED_EFFECT)) !== 0) {\n\t\t\tdestroy_block_effect_children(effect);\n\t\t} else {\n\t\t\tdestroy_effect_children(effect);\n\t\t}\n\n\t\texecute_effect_teardown(effect);\n\t\tvar teardown = update_reaction(effect);\n\t\teffect.teardown = typeof teardown === 'function' ? teardown : null;\n\t\teffect.wv = write_version;\n\n\t\t// In DEV, increment versions of any sources that were written to during the effect,\n\t\t// so that they are correctly marked as dirty when the effect re-runs\n\t\tif (DEV && tracing_mode_flag && (effect.f & DIRTY) !== 0 && effect.deps !== null) {\n\t\t\tfor (var dep of effect.deps) {\n\t\t\t\tif (dep.set_during_effect) {\n\t\t\t\t\tdep.wv = increment_write_version();\n\t\t\t\t\tdep.set_during_effect = false;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t} finally {\n\t\tis_updating_effect = was_updating_effect;\n\t\tactive_effect = previous_effect;\n\n\t\tif (DEV) {\n\t\t\tset_dev_current_component_function(previous_component_fn);\n\t\t\tset_dev_stack(previous_stack);\n\t\t}\n\t}\n}\n\n/**\n * Returns a promise that resolves once any pending state changes have been applied.\n * @returns {Promise<void>}\n */\nexport async function tick() {\n\tif (async_mode_flag) {\n\t\treturn new Promise((f) => {\n\t\t\t// Race them against each other - in almost all cases requestAnimationFrame will fire first,\n\t\t\t// but e.g. in case the window is not focused or a view transition happens, requestAnimationFrame\n\t\t\t// will be delayed and setTimeout helps us resolve fast enough in that case\n\t\t\trequestAnimationFrame(() => f());\n\t\t\tsetTimeout(() => f());\n\t\t});\n\t}\n\n\tawait Promise.resolve();\n\n\t// By calling flushSync we guarantee that any pending state changes are applied after one tick.\n\t// TODO look into whether we can make flushing subsequent updates synchronously in the future.\n\tflushSync();\n}\n\n/**\n * Returns a promise that resolves once any state changes, and asynchronous work resulting from them,\n * have resolved and the DOM has been updated\n * @returns {Promise<void>}\n * @since 5.36\n */\nexport function settled() {\n\treturn Batch.ensure().settled();\n}\n\n/**\n * @template V\n * @param {Value<V>} signal\n * @returns {V}\n */\nexport function get(signal) {\n\tvar flags = signal.f;\n\tvar is_derived = (flags & DERIVED) !== 0;\n\n\tcaptured_signals?.add(signal);\n\n\t// Register the dependency on the current reaction signal.\n\tif (active_reaction !== null && !untracking) {\n\t\t// if we're in a derived that is being read inside an _async_ derived,\n\t\t// it's possible that the effect was already destroyed. In this case,\n\t\t// we don't add the dependency, because that would create a memory leak\n\t\tvar destroyed = active_effect !== null && (active_effect.f & DESTROYED) !== 0;\n\n\t\tif (!destroyed && (current_sources === null || !includes.call(current_sources, signal))) {\n\t\t\tvar deps = active_reaction.deps;\n\n\t\t\tif ((active_reaction.f & REACTION_IS_UPDATING) !== 0) {\n\t\t\t\t// we're in the effect init/update cycle\n\t\t\t\tif (signal.rv < read_version) {\n\t\t\t\t\tsignal.rv = read_version;\n\n\t\t\t\t\t// If the signal is accessing the same dependencies in the same\n\t\t\t\t\t// order as it did last time, increment `skipped_deps`\n\t\t\t\t\t// rather than updating `new_deps`, which creates GC cost\n\t\t\t\t\tif (new_deps === null && deps !== null && deps[skipped_deps] === signal) {\n\t\t\t\t\t\tskipped_deps++;\n\t\t\t\t\t} else if (new_deps === null) {\n\t\t\t\t\t\tnew_deps = [signal];\n\t\t\t\t\t} else {\n\t\t\t\t\t\tnew_deps.push(signal);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// we're adding a dependency outside the init/update cycle\n\t\t\t\t// (i.e. after an `await`)\n\t\t\t\t(active_reaction.deps ??= []).push(signal);\n\n\t\t\t\tvar reactions = signal.reactions;\n\n\t\t\t\tif (reactions === null) {\n\t\t\t\t\tsignal.reactions = [active_reaction];\n\t\t\t\t} else if (!includes.call(reactions, active_reaction)) {\n\t\t\t\t\treactions.push(active_reaction);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tif (DEV) {\n\t\tif (\n\t\t\t!untracking &&\n\t\t\treactivity_loss_tracker &&\n\t\t\t!reactivity_loss_tracker.warned &&\n\t\t\t(reactivity_loss_tracker.effect.f & REACTION_IS_UPDATING) === 0\n\t\t) {\n\t\t\treactivity_loss_tracker.warned = true;\n\n\t\t\tw.await_reactivity_loss(/** @type {string} */ (signal.label));\n\n\t\t\tvar trace = get_error('traced at');\n\t\t\t// eslint-disable-next-line no-console\n\t\t\tif (trace) console.warn(trace);\n\t\t}\n\n\t\trecent_async_deriveds.delete(signal);\n\n\t\tif (\n\t\t\ttracing_mode_flag &&\n\t\t\t!untracking &&\n\t\t\ttracing_expressions !== null &&\n\t\t\tactive_reaction !== null &&\n\t\t\ttracing_expressions.reaction === active_reaction\n\t\t) {\n\t\t\t// Used when mapping state between special blocks like `each`\n\t\t\tif (signal.trace) {\n\t\t\t\tsignal.trace();\n\t\t\t} else {\n\t\t\t\ttrace = get_error('traced at');\n\n\t\t\t\tif (trace) {\n\t\t\t\t\tvar entry = tracing_expressions.entries.get(signal);\n\n\t\t\t\t\tif (entry === undefined) {\n\t\t\t\t\t\tentry = { traces: [] };\n\t\t\t\t\t\ttracing_expressions.entries.set(signal, entry);\n\t\t\t\t\t}\n\n\t\t\t\t\tvar last = entry.traces[entry.traces.length - 1];\n\n\t\t\t\t\t// traces can be duplicated, e.g. by `snapshot` invoking both\n\t\t\t\t\t// both `getOwnPropertyDescriptor` and `get` traps at once\n\t\t\t\t\tif (trace.stack !== last?.stack) {\n\t\t\t\t\t\tentry.traces.push(trace);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tif (is_destroying_effect && old_values.has(signal)) {\n\t\treturn old_values.get(signal);\n\t}\n\n\tif (is_derived) {\n\t\tvar derived = /** @type {Derived} */ (signal);\n\n\t\tif (is_destroying_effect) {\n\t\t\tvar value = derived.v;\n\n\t\t\t// if the derived is dirty and has reactions, or depends on the values that just changed, re-execute\n\t\t\t// (a derived can be maybe_dirty due to the effect destroy removing its last reaction)\n\t\t\tif (\n\t\t\t\t((derived.f & CLEAN) === 0 && derived.reactions !== null) ||\n\t\t\t\tdepends_on_old_values(derived)\n\t\t\t) {\n\t\t\t\tvalue = execute_derived(derived);\n\t\t\t}\n\n\t\t\told_values.set(derived, value);\n\n\t\t\treturn value;\n\t\t}\n\n\t\t// connect disconnected deriveds if we are reading them inside an effect,\n\t\t// or inside another derived that is already connected\n\t\tvar should_connect =\n\t\t\t(derived.f & CONNECTED) === 0 &&\n\t\t\t!untracking &&\n\t\t\tactive_reaction !== null &&\n\t\t\t(is_updating_effect || (active_reaction.f & CONNECTED) !== 0);\n\n\t\tvar is_new = (derived.f & REACTION_RAN) === 0;\n\n\t\tif (is_dirty(derived)) {\n\t\t\tif (should_connect) {\n\t\t\t\t// set the flag before `update_derived`, so that the derived\n\t\t\t\t// is added as a reaction to its dependencies\n\t\t\t\tderived.f |= CONNECTED;\n\t\t\t}\n\n\t\t\tupdate_derived(derived);\n\t\t}\n\n\t\tif (should_connect && !is_new) {\n\t\t\tunfreeze_derived_effects(derived);\n\t\t\treconnect(derived);\n\t\t}\n\t}\n\n\tif (batch_values?.has(signal)) {\n\t\treturn batch_values.get(signal);\n\t}\n\n\tif ((signal.f & ERROR_VALUE) !== 0) {\n\t\tthrow signal.v;\n\t}\n\n\treturn signal.v;\n}\n\n/**\n * (Re)connect a disconnected derived, so that it is notified\n * of changes in `mark_reactions`\n * @param {Derived} derived\n */\nfunction reconnect(derived) {\n\tderived.f |= CONNECTED;\n\n\tif (derived.deps === null) return;\n\n\tfor (const dep of derived.deps) {\n\t\t(dep.reactions ??= []).push(derived);\n\n\t\tif ((dep.f & DERIVED) !== 0 && (dep.f & CONNECTED) === 0) {\n\t\t\tunfreeze_derived_effects(/** @type {Derived} */ (dep));\n\t\t\treconnect(/** @type {Derived} */ (dep));\n\t\t}\n\t}\n}\n\n/** @param {Derived} derived */\nfunction depends_on_old_values(derived) {\n\tif (derived.v === UNINITIALIZED) return true; // we don't know, so assume the worst\n\tif (derived.deps === null) return false;\n\n\tfor (const dep of derived.deps) {\n\t\tif (old_values.has(dep)) {\n\t\t\treturn true;\n\t\t}\n\n\t\tif ((dep.f & DERIVED) !== 0 && depends_on_old_values(/** @type {Derived} */ (dep))) {\n\t\t\treturn true;\n\t\t}\n\t}\n\n\treturn false;\n}\n\n/**\n * Like `get`, but checks for `undefined`. Used for `var` declarations because they can be accessed before being declared\n * @template V\n * @param {Value<V> | undefined} signal\n * @returns {V | undefined}\n */\nexport function safe_get(signal) {\n\treturn signal && get(signal);\n}\n\n/**\n * When used inside a [`$derived`](https://svelte.dev/docs/svelte/$derived) or [`$effect`](https://svelte.dev/docs/svelte/$effect),\n * any state read inside `fn` will not be treated as a dependency.\n *\n * ```ts\n * $effect(() => {\n * // this will run when `data` changes, but not when `time` changes\n * save(data, {\n * timestamp: untrack(() => time)\n * });\n * });\n * ```\n * @template T\n * @param {() => T} fn\n * @returns {T}\n */\nexport function untrack(fn) {\n\tvar previous_untracking = untracking;\n\ttry {\n\t\tuntracking = true;\n\t\treturn fn();\n\t} finally {\n\t\tuntracking = previous_untracking;\n\t}\n}\n\n/**\n * Possibly traverse an object and read all its properties so that they're all reactive in case this is `$state`.\n * Does only check first level of an object for performance reasons (heuristic should be good for 99% of all cases).\n * @param {any} value\n * @returns {void}\n */\nexport function deep_read_state(value) {\n\tif (typeof value !== 'object' || !value || value instanceof EventTarget) {\n\t\treturn;\n\t}\n\n\tif (STATE_SYMBOL in value) {\n\t\tdeep_read(value);\n\t} else if (!Array.isArray(value)) {\n\t\tfor (let key in value) {\n\t\t\tconst prop = value[key];\n\t\t\tif (typeof prop === 'object' && prop && STATE_SYMBOL in prop) {\n\t\t\t\tdeep_read(prop);\n\t\t\t}\n\t\t}\n\t}\n}\n\n/**\n * Deeply traverse an object and read all its properties\n * so that they're all reactive in case this is `$state`\n * @param {any} value\n * @param {Set<any>} visited\n * @returns {void}\n */\nexport function deep_read(value, visited = new Set()) {\n\tif (\n\t\ttypeof value === 'object' &&\n\t\tvalue !== null &&\n\t\t// We don't want to traverse DOM elements\n\t\t!(value instanceof EventTarget) &&\n\t\t!visited.has(value)\n\t) {\n\t\tvisited.add(value);\n\t\t// When working with a possible SvelteDate, this\n\t\t// will ensure we capture changes to it.\n\t\tif (value instanceof Date) {\n\t\t\tvalue.getTime();\n\t\t}\n\t\tfor (let key in value) {\n\t\t\ttry {\n\t\t\t\tdeep_read(value[key], visited);\n\t\t\t} catch (e) {\n\t\t\t\t// continue\n\t\t\t}\n\t\t}\n\t\tconst proto = get_prototype_of(value);\n\t\tif (\n\t\t\tproto !== Object.prototype &&\n\t\t\tproto !== Array.prototype &&\n\t\t\tproto !== Map.prototype &&\n\t\t\tproto !== Set.prototype &&\n\t\t\tproto !== Date.prototype\n\t\t) {\n\t\t\tconst descriptors = get_descriptors(proto);\n\t\t\tfor (let key in descriptors) {\n\t\t\t\tconst get = descriptors[key].get;\n\t\t\t\tif (get) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tget.call(value);\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\t// continue\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n","/** @import { Source } from '#client' */\nimport { DEV } from 'esm-env';\nimport {\n\tget,\n\tactive_effect,\n\tupdate_version,\n\tactive_reaction,\n\tset_update_version,\n\tset_active_reaction\n} from './runtime.js';\nimport {\n\tarray_prototype,\n\tget_descriptor,\n\tget_prototype_of,\n\tis_array,\n\tobject_prototype\n} from '../shared/utils.js';\nimport {\n\tstate as source,\n\tset,\n\tincrement,\n\tflush_eager_effects,\n\tset_eager_effects_deferred\n} from './reactivity/sources.js';\nimport { PROXY_PATH_SYMBOL, STATE_SYMBOL } from '#client/constants';\nimport { UNINITIALIZED } from '../../constants.js';\nimport * as e from './errors.js';\nimport { tag } from './dev/tracing.js';\nimport { get_error } from '../shared/dev.js';\nimport { tracing_mode_flag } from '../flags/index.js';\n\n// TODO move all regexes into shared module?\nconst regex_is_valid_identifier = /^[a-zA-Z_$][a-zA-Z_$0-9]*$/;\n\n/**\n * @template T\n * @param {T} value\n * @returns {T}\n */\nexport function proxy(value) {\n\t// if non-proxyable, or is already a proxy, return `value`\n\tif (typeof value !== 'object' || value === null || STATE_SYMBOL in value) {\n\t\treturn value;\n\t}\n\n\tconst prototype = get_prototype_of(value);\n\n\tif (prototype !== object_prototype && prototype !== array_prototype) {\n\t\treturn value;\n\t}\n\n\t/** @type {Map<any, Source<any>>} */\n\tvar sources = new Map();\n\tvar is_proxied_array = is_array(value);\n\tvar version = source(0);\n\n\tvar stack = DEV && tracing_mode_flag ? get_error('created at') : null;\n\tvar parent_version = update_version;\n\n\t/**\n\t * Executes the proxy in the context of the reaction it was originally created in, if any\n\t * @template T\n\t * @param {() => T} fn\n\t */\n\tvar with_parent = (fn) => {\n\t\tif (update_version === parent_version) {\n\t\t\treturn fn();\n\t\t}\n\n\t\t// child source is being created after the initial proxy —\n\t\t// prevent it from being associated with the current reaction\n\t\tvar reaction = active_reaction;\n\t\tvar version = update_version;\n\n\t\tset_active_reaction(null);\n\t\tset_update_version(parent_version);\n\n\t\tvar result = fn();\n\n\t\tset_active_reaction(reaction);\n\t\tset_update_version(version);\n\n\t\treturn result;\n\t};\n\n\tif (is_proxied_array) {\n\t\t// We need to create the length source eagerly to ensure that\n\t\t// mutations to the array are properly synced with our proxy\n\t\tsources.set('length', source(/** @type {any[]} */ (value).length, stack));\n\t\tif (DEV) {\n\t\t\tvalue = /** @type {any} */ (inspectable_array(/** @type {any[]} */ (value)));\n\t\t}\n\t}\n\n\t/** Used in dev for $inspect.trace() */\n\tvar path = '';\n\tlet updating = false;\n\t/** @param {string} new_path */\n\tfunction update_path(new_path) {\n\t\tif (updating) return;\n\t\tupdating = true;\n\t\tpath = new_path;\n\n\t\ttag(version, `${path} version`);\n\n\t\t// rename all child sources and child proxies\n\t\tfor (const [prop, source] of sources) {\n\t\t\ttag(source, get_label(path, prop));\n\t\t}\n\t\tupdating = false;\n\t}\n\n\treturn new Proxy(/** @type {any} */ (value), {\n\t\tdefineProperty(_, prop, descriptor) {\n\t\t\tif (\n\t\t\t\t!('value' in descriptor) ||\n\t\t\t\tdescriptor.configurable === false ||\n\t\t\t\tdescriptor.enumerable === false ||\n\t\t\t\tdescriptor.writable === false\n\t\t\t) {\n\t\t\t\t// we disallow non-basic descriptors, because unless they are applied to the\n\t\t\t\t// target object — which we avoid, so that state can be forked — we will run\n\t\t\t\t// afoul of the various invariants\n\t\t\t\t// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy/Proxy/getOwnPropertyDescriptor#invariants\n\t\t\t\te.state_descriptors_fixed();\n\t\t\t}\n\t\t\tvar s = sources.get(prop);\n\t\t\tif (s === undefined) {\n\t\t\t\twith_parent(() => {\n\t\t\t\t\tvar s = source(descriptor.value, stack);\n\t\t\t\t\tsources.set(prop, s);\n\t\t\t\t\tif (DEV && typeof prop === 'string') {\n\t\t\t\t\t\ttag(s, get_label(path, prop));\n\t\t\t\t\t}\n\t\t\t\t\treturn s;\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tset(s, descriptor.value, true);\n\t\t\t}\n\n\t\t\treturn true;\n\t\t},\n\n\t\tdeleteProperty(target, prop) {\n\t\t\tvar s = sources.get(prop);\n\n\t\t\tif (s === undefined) {\n\t\t\t\tif (prop in target) {\n\t\t\t\t\tconst s = with_parent(() => source(UNINITIALIZED, stack));\n\t\t\t\t\tsources.set(prop, s);\n\t\t\t\t\tincrement(version);\n\n\t\t\t\t\tif (DEV) {\n\t\t\t\t\t\ttag(s, get_label(path, prop));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tset(s, UNINITIALIZED);\n\t\t\t\tincrement(version);\n\t\t\t}\n\n\t\t\treturn true;\n\t\t},\n\n\t\tget(target, prop, receiver) {\n\t\t\tif (prop === STATE_SYMBOL) {\n\t\t\t\treturn value;\n\t\t\t}\n\n\t\t\tif (DEV && prop === PROXY_PATH_SYMBOL) {\n\t\t\t\treturn update_path;\n\t\t\t}\n\n\t\t\tvar s = sources.get(prop);\n\t\t\tvar exists = prop in target;\n\n\t\t\t// create a source, but only if it's an own property and not a prototype property\n\t\t\tif (s === undefined && (!exists || get_descriptor(target, prop)?.writable)) {\n\t\t\t\ts = with_parent(() => {\n\t\t\t\t\tvar p = proxy(exists ? target[prop] : UNINITIALIZED);\n\t\t\t\t\tvar s = source(p, stack);\n\n\t\t\t\t\tif (DEV) {\n\t\t\t\t\t\ttag(s, get_label(path, prop));\n\t\t\t\t\t}\n\n\t\t\t\t\treturn s;\n\t\t\t\t});\n\n\t\t\t\tsources.set(prop, s);\n\t\t\t}\n\n\t\t\tif (s !== undefined) {\n\t\t\t\tvar v = get(s);\n\t\t\t\treturn v === UNINITIALIZED ? undefined : v;\n\t\t\t}\n\n\t\t\treturn Reflect.get(target, prop, receiver);\n\t\t},\n\n\t\tgetOwnPropertyDescriptor(target, prop) {\n\t\t\tvar descriptor = Reflect.getOwnPropertyDescriptor(target, prop);\n\n\t\t\tif (descriptor && 'value' in descriptor) {\n\t\t\t\tvar s = sources.get(prop);\n\t\t\t\tif (s) descriptor.value = get(s);\n\t\t\t} else if (descriptor === undefined) {\n\t\t\t\tvar source = sources.get(prop);\n\t\t\t\tvar value = source?.v;\n\n\t\t\t\tif (source !== undefined && value !== UNINITIALIZED) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tenumerable: true,\n\t\t\t\t\t\tconfigurable: true,\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t\twritable: true\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn descriptor;\n\t\t},\n\n\t\thas(target, prop) {\n\t\t\tif (prop === STATE_SYMBOL) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\tvar s = sources.get(prop);\n\t\t\tvar has = (s !== undefined && s.v !== UNINITIALIZED) || Reflect.has(target, prop);\n\n\t\t\tif (\n\t\t\t\ts !== undefined ||\n\t\t\t\t(active_effect !== null && (!has || get_descriptor(target, prop)?.writable))\n\t\t\t) {\n\t\t\t\tif (s === undefined) {\n\t\t\t\t\ts = with_parent(() => {\n\t\t\t\t\t\tvar p = has ? proxy(target[prop]) : UNINITIALIZED;\n\t\t\t\t\t\tvar s = source(p, stack);\n\n\t\t\t\t\t\tif (DEV) {\n\t\t\t\t\t\t\ttag(s, get_label(path, prop));\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn s;\n\t\t\t\t\t});\n\n\t\t\t\t\tsources.set(prop, s);\n\t\t\t\t}\n\n\t\t\t\tvar value = get(s);\n\t\t\t\tif (value === UNINITIALIZED) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn has;\n\t\t},\n\n\t\tset(target, prop, value, receiver) {\n\t\t\tvar s = sources.get(prop);\n\t\t\tvar has = prop in target;\n\n\t\t\t// variable.length = value -> clear all signals with index >= value\n\t\t\tif (is_proxied_array && prop === 'length') {\n\t\t\t\tfor (var i = value; i < /** @type {Source<number>} */ (s).v; i += 1) {\n\t\t\t\t\tvar other_s = sources.get(i + '');\n\t\t\t\t\tif (other_s !== undefined) {\n\t\t\t\t\t\tset(other_s, UNINITIALIZED);\n\t\t\t\t\t} else if (i in target) {\n\t\t\t\t\t\t// If the item exists in the original, we need to create an uninitialized source,\n\t\t\t\t\t\t// else a later read of the property would result in a source being created with\n\t\t\t\t\t\t// the value of the original item at that index.\n\t\t\t\t\t\tother_s = with_parent(() => source(UNINITIALIZED, stack));\n\t\t\t\t\t\tsources.set(i + '', other_s);\n\n\t\t\t\t\t\tif (DEV) {\n\t\t\t\t\t\t\ttag(other_s, get_label(path, i));\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// If we haven't yet created a source for this property, we need to ensure\n\t\t\t// we do so otherwise if we read it later, then the write won't be tracked and\n\t\t\t// the heuristics of effects will be different vs if we had read the proxied\n\t\t\t// object property before writing to that property.\n\t\t\tif (s === undefined) {\n\t\t\t\tif (!has || get_descriptor(target, prop)?.writable) {\n\t\t\t\t\ts = with_parent(() => source(undefined, stack));\n\n\t\t\t\t\tif (DEV) {\n\t\t\t\t\t\ttag(s, get_label(path, prop));\n\t\t\t\t\t}\n\t\t\t\t\tset(s, proxy(value));\n\n\t\t\t\t\tsources.set(prop, s);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\thas = s.v !== UNINITIALIZED;\n\n\t\t\t\tvar p = with_parent(() => proxy(value));\n\t\t\t\tset(s, p);\n\t\t\t}\n\n\t\t\tvar descriptor = Reflect.getOwnPropertyDescriptor(target, prop);\n\n\t\t\t// Set the new value before updating any signals so that any listeners get the new value\n\t\t\tif (descriptor?.set) {\n\t\t\t\tdescriptor.set.call(receiver, value);\n\t\t\t}\n\n\t\t\tif (!has) {\n\t\t\t\t// If we have mutated an array directly, we might need to\n\t\t\t\t// signal that length has also changed. Do it before updating metadata\n\t\t\t\t// to ensure that iterating over the array as a result of a metadata update\n\t\t\t\t// will not cause the length to be out of sync.\n\t\t\t\tif (is_proxied_array && typeof prop === 'string') {\n\t\t\t\t\tvar ls = /** @type {Source<number>} */ (sources.get('length'));\n\t\t\t\t\tvar n = Number(prop);\n\n\t\t\t\t\tif (Number.isInteger(n) && n >= ls.v) {\n\t\t\t\t\t\tset(ls, n + 1);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tincrement(version);\n\t\t\t}\n\n\t\t\treturn true;\n\t\t},\n\n\t\townKeys(target) {\n\t\t\tget(version);\n\n\t\t\tvar own_keys = Reflect.ownKeys(target).filter((key) => {\n\t\t\t\tvar source = sources.get(key);\n\t\t\t\treturn source === undefined || source.v !== UNINITIALIZED;\n\t\t\t});\n\n\t\t\tfor (var [key, source] of sources) {\n\t\t\t\tif (source.v !== UNINITIALIZED && !(key in target)) {\n\t\t\t\t\town_keys.push(key);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn own_keys;\n\t\t},\n\n\t\tsetPrototypeOf() {\n\t\t\te.state_prototype_fixed();\n\t\t}\n\t});\n}\n\n/**\n * @param {string} path\n * @param {string | symbol} prop\n */\nfunction get_label(path, prop) {\n\tif (typeof prop === 'symbol') return `${path}[Symbol(${prop.description ?? ''})]`;\n\tif (regex_is_valid_identifier.test(prop)) return `${path}.${prop}`;\n\treturn /^\\d+$/.test(prop) ? `${path}[${prop}]` : `${path}['${prop}']`;\n}\n\n/**\n * @param {any} value\n */\nexport function get_proxied_value(value) {\n\ttry {\n\t\tif (value !== null && typeof value === 'object' && STATE_SYMBOL in value) {\n\t\t\treturn value[STATE_SYMBOL];\n\t\t}\n\t} catch {\n\t\t// the above if check can throw an error if the value in question\n\t\t// is the contentWindow of an iframe on another domain, in which\n\t\t// case we want to just return the value (because it's definitely\n\t\t// not a proxied value) so we don't break any JavaScript interacting\n\t\t// with that iframe (such as various payment companies client side\n\t\t// JavaScript libraries interacting with their iframes on the same\n\t\t// domain)\n\t}\n\n\treturn value;\n}\n\n/**\n * @param {any} a\n * @param {any} b\n */\nexport function is(a, b) {\n\treturn Object.is(get_proxied_value(a), get_proxied_value(b));\n}\n\nconst ARRAY_MUTATING_METHODS = new Set([\n\t'copyWithin',\n\t'fill',\n\t'pop',\n\t'push',\n\t'reverse',\n\t'shift',\n\t'sort',\n\t'splice',\n\t'unshift'\n]);\n\n/**\n * Wrap array mutating methods so $inspect is triggered only once and\n * to prevent logging an array in intermediate state (e.g. with an empty slot)\n * @param {any[]} array\n */\nfunction inspectable_array(array) {\n\treturn new Proxy(array, {\n\t\tget(target, prop, receiver) {\n\t\t\tvar value = Reflect.get(target, prop, receiver);\n\t\t\tif (!ARRAY_MUTATING_METHODS.has(/** @type {string} */ (prop))) {\n\t\t\t\treturn value;\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * @this {any[]}\n\t\t\t * @param {any[]} args\n\t\t\t */\n\t\t\treturn function (...args) {\n\t\t\t\tset_eager_effects_deferred();\n\t\t\t\tvar result = value.apply(this, args);\n\t\t\t\tflush_eager_effects();\n\t\t\t\treturn result;\n\t\t\t};\n\t\t}\n\t});\n}\n","import { hydrating } from '../hydration.js';\nimport { clear_text_content, get_first_child } from '../operations.js';\nimport { queue_micro_task } from '../task.js';\n\n/**\n * @param {HTMLElement} dom\n * @param {boolean} value\n * @returns {void}\n */\nexport function autofocus(dom, value) {\n\tif (value) {\n\t\tconst body = document.body;\n\t\tdom.autofocus = true;\n\n\t\tqueue_micro_task(() => {\n\t\t\tif (document.activeElement === body) {\n\t\t\t\tdom.focus();\n\t\t\t}\n\t\t});\n\t}\n}\n\n/**\n * The child of a textarea actually corresponds to the defaultValue property, so we need\n * to remove it upon hydration to avoid a bug when someone resets the form value.\n * @param {HTMLTextAreaElement} dom\n * @returns {void}\n */\nexport function remove_textarea_child(dom) {\n\tif (hydrating && get_first_child(dom) !== null) {\n\t\tclear_text_content(dom);\n\t}\n}\n\nlet listening_to_form_reset = false;\n\nexport function add_form_reset_listener() {\n\tif (!listening_to_form_reset) {\n\t\tlistening_to_form_reset = true;\n\t\tdocument.addEventListener(\n\t\t\t'reset',\n\t\t\t(evt) => {\n\t\t\t\t// Needs to happen one tick later or else the dom properties of the form\n\t\t\t\t// elements have not updated to their reset values yet\n\t\t\t\tPromise.resolve().then(() => {\n\t\t\t\t\tif (!evt.defaultPrevented) {\n\t\t\t\t\t\tfor (const e of /**@type {HTMLFormElement} */ (evt.target).elements) {\n\t\t\t\t\t\t\t// @ts-expect-error\n\t\t\t\t\t\t\te.__on_r?.();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t},\n\t\t\t// In the capture phase to guarantee we get noticed of it (no possibility of stopPropagation)\n\t\t\t{ capture: true }\n\t\t);\n\t}\n}\n","import { teardown } from '../../../reactivity/effects.js';\nimport {\n\tactive_effect,\n\tactive_reaction,\n\tset_active_effect,\n\tset_active_reaction\n} from '../../../runtime.js';\nimport { add_form_reset_listener } from '../misc.js';\n\n/**\n * Fires the handler once immediately (unless corresponding arg is set to `false`),\n * then listens to the given events until the render effect context is destroyed\n * @param {EventTarget} target\n * @param {Array<string>} events\n * @param {(event?: Event) => void} handler\n * @param {any} call_handler_immediately\n */\nexport function listen(target, events, handler, call_handler_immediately = true) {\n\tif (call_handler_immediately) {\n\t\thandler();\n\t}\n\n\tfor (var name of events) {\n\t\ttarget.addEventListener(name, handler);\n\t}\n\n\tteardown(() => {\n\t\tfor (var name of events) {\n\t\t\ttarget.removeEventListener(name, handler);\n\t\t}\n\t});\n}\n\n/**\n * @template T\n * @param {() => T} fn\n */\nexport function without_reactive_context(fn) {\n\tvar previous_reaction = active_reaction;\n\tvar previous_effect = active_effect;\n\tset_active_reaction(null);\n\tset_active_effect(null);\n\ttry {\n\t\treturn fn();\n\t} finally {\n\t\tset_active_reaction(previous_reaction);\n\t\tset_active_effect(previous_effect);\n\t}\n}\n\n/**\n * Listen to the given event, and then instantiate a global form reset listener if not already done,\n * to notify all bindings when the form is reset\n * @param {HTMLElement} element\n * @param {string} event\n * @param {(is_reset?: true) => void} handler\n * @param {(is_reset?: true) => void} [on_reset]\n */\nexport function listen_to_event_and_reset_event(element, event, handler, on_reset = handler) {\n\telement.addEventListener(event, () => without_reactive_context(handler));\n\t// @ts-expect-error\n\tconst prev = element.__on_r;\n\tif (prev) {\n\t\t// special case for checkbox that can have multiple binds (group & checked)\n\t\t// @ts-expect-error\n\t\telement.__on_r = () => {\n\t\t\tprev();\n\t\t\ton_reset(true);\n\t\t};\n\t} else {\n\t\t// @ts-expect-error\n\t\telement.__on_r = () => on_reset(true);\n\t}\n\n\tadd_form_reset_listener();\n}\n","import { teardown } from '../../reactivity/effects.js';\nimport { define_property } from '../../../shared/utils.js';\nimport { hydrating } from '../hydration.js';\nimport { queue_micro_task } from '../task.js';\nimport { FILENAME } from '../../../../constants.js';\nimport * as w from '../../warnings.js';\nimport {\n\tactive_effect,\n\tactive_reaction,\n\tset_active_effect,\n\tset_active_reaction\n} from '../../runtime.js';\nimport { without_reactive_context } from './bindings/shared.js';\n\n/**\n * Used on elements, as a map of event type -> event handler,\n * and on events themselves to track which element handled an event\n */\nexport const event_symbol = Symbol('events');\n\n/** @type {Set<string>} */\nexport const all_registered_events = new Set();\n\n/** @type {Set<(events: Array<string>) => void>} */\nexport const root_event_handles = new Set();\n\n/**\n * SSR adds onload and onerror attributes to catch those events before the hydration.\n * This function detects those cases, removes the attributes and replays the events.\n * @param {HTMLElement} dom\n */\nexport function replay_events(dom) {\n\tif (!hydrating) return;\n\n\tdom.removeAttribute('onload');\n\tdom.removeAttribute('onerror');\n\t// @ts-expect-error\n\tconst event = dom.__e;\n\tif (event !== undefined) {\n\t\t// @ts-expect-error\n\t\tdom.__e = undefined;\n\t\tqueueMicrotask(() => {\n\t\t\tif (dom.isConnected) {\n\t\t\t\tdom.dispatchEvent(event);\n\t\t\t}\n\t\t});\n\t}\n}\n\n/**\n * @param {string} event_name\n * @param {EventTarget} dom\n * @param {EventListener} [handler]\n * @param {AddEventListenerOptions} [options]\n */\nexport function create_event(event_name, dom, handler, options = {}) {\n\t/**\n\t * @this {EventTarget}\n\t */\n\tfunction target_handler(/** @type {Event} */ event) {\n\t\tif (!options.capture) {\n\t\t\t// Only call in the bubble phase, else delegated events would be called before the capturing events\n\t\t\thandle_event_propagation.call(dom, event);\n\t\t}\n\t\tif (!event.cancelBubble) {\n\t\t\treturn without_reactive_context(() => {\n\t\t\t\treturn handler?.call(this, event);\n\t\t\t});\n\t\t}\n\t}\n\n\t// Chrome has a bug where pointer events don't work when attached to a DOM element that has been cloned\n\t// with cloneNode() and the DOM element is disconnected from the document. To ensure the event works, we\n\t// defer the attachment till after it's been appended to the document. TODO: remove this once Chrome fixes\n\t// this bug. The same applies to wheel events and touch events.\n\tif (\n\t\tevent_name.startsWith('pointer') ||\n\t\tevent_name.startsWith('touch') ||\n\t\tevent_name === 'wheel'\n\t) {\n\t\tqueue_micro_task(() => {\n\t\t\tdom.addEventListener(event_name, target_handler, options);\n\t\t});\n\t} else {\n\t\tdom.addEventListener(event_name, target_handler, options);\n\t}\n\n\treturn target_handler;\n}\n\n/**\n * Attaches an event handler to an element and returns a function that removes the handler. Using this\n * rather than `addEventListener` will preserve the correct order relative to handlers added declaratively\n * (with attributes like `onclick`), which use event delegation for performance reasons\n *\n * @param {EventTarget} element\n * @param {string} type\n * @param {EventListener} handler\n * @param {AddEventListenerOptions} [options]\n */\nexport function on(element, type, handler, options = {}) {\n\tvar target_handler = create_event(type, element, handler, options);\n\n\treturn () => {\n\t\telement.removeEventListener(type, target_handler, options);\n\t};\n}\n\n/**\n * @param {string} event_name\n * @param {Element} dom\n * @param {EventListener} [handler]\n * @param {boolean} [capture]\n * @param {boolean} [passive]\n * @returns {void}\n */\nexport function event(event_name, dom, handler, capture, passive) {\n\tvar options = { capture, passive };\n\tvar target_handler = create_event(event_name, dom, handler, options);\n\n\tif (\n\t\tdom === document.body ||\n\t\t// @ts-ignore\n\t\tdom === window ||\n\t\t// @ts-ignore\n\t\tdom === document ||\n\t\t// Firefox has quirky behavior, it can happen that we still get \"canplay\" events when the element is already removed\n\t\tdom instanceof HTMLMediaElement\n\t) {\n\t\tteardown(() => {\n\t\t\tdom.removeEventListener(event_name, target_handler, options);\n\t\t});\n\t}\n}\n\n/**\n * @param {string} event_name\n * @param {Element} element\n * @param {EventListener} [handler]\n * @returns {void}\n */\nexport function delegated(event_name, element, handler) {\n\t// @ts-expect-error\n\t(element[event_symbol] ??= {})[event_name] = handler;\n}\n\n/**\n * @param {Array<string>} events\n * @returns {void}\n */\nexport function delegate(events) {\n\tfor (var i = 0; i < events.length; i++) {\n\t\tall_registered_events.add(events[i]);\n\t}\n\n\tfor (var fn of root_event_handles) {\n\t\tfn(events);\n\t}\n}\n\n// used to store the reference to the currently propagated event\n// to prevent garbage collection between microtasks in Firefox\n// If the event object is GCed too early, the expando __root property\n// set on the event object is lost, causing the event delegation\n// to process the event twice\nlet last_propagated_event = null;\n\n/**\n * @this {EventTarget}\n * @param {Event} event\n * @returns {void}\n */\nexport function handle_event_propagation(event) {\n\tvar handler_element = this;\n\tvar owner_document = /** @type {Node} */ (handler_element).ownerDocument;\n\tvar event_name = event.type;\n\tvar path = event.composedPath?.() || [];\n\tvar current_target = /** @type {null | Element} */ (path[0] || event.target);\n\n\tlast_propagated_event = event;\n\n\t// composedPath contains list of nodes the event has propagated through.\n\t// We check `event_symbol` to skip all nodes below it in case this is a\n\t// parent of the `event_symbol` node, which indicates that there's nested\n\t// mounted apps. In this case we don't want to trigger events multiple times.\n\tvar path_idx = 0;\n\n\t// the `last_propagated_event === event` check is redundant, but\n\t// without it the variable will be DCE'd and things will\n\t// fail mysteriously in Firefox\n\t// @ts-expect-error is added below\n\tvar handled_at = last_propagated_event === event && event[event_symbol];\n\n\tif (handled_at) {\n\t\tvar at_idx = path.indexOf(handled_at);\n\t\tif (\n\t\t\tat_idx !== -1 &&\n\t\t\t(handler_element === document || handler_element === /** @type {any} */ (window))\n\t\t) {\n\t\t\t// This is the fallback document listener or a window listener, but the event was already handled\n\t\t\t// -> ignore, but set handle_at to document/window so that we're resetting the event\n\t\t\t// chain in case someone manually dispatches the same event object again.\n\t\t\t// @ts-expect-error\n\t\t\tevent[event_symbol] = handler_element;\n\t\t\treturn;\n\t\t}\n\n\t\t// We're deliberately not skipping if the index is higher, because\n\t\t// someone could create an event programmatically and emit it multiple times,\n\t\t// in which case we want to handle the whole propagation chain properly each time.\n\t\t// (this will only be a false negative if the event is dispatched multiple times and\n\t\t// the fallback document listener isn't reached in between, but that's super rare)\n\t\tvar handler_idx = path.indexOf(handler_element);\n\t\tif (handler_idx === -1) {\n\t\t\t// handle_idx can theoretically be -1 (happened in some JSDOM testing scenarios with an event listener on the window object)\n\t\t\t// so guard against that, too, and assume that everything was handled at this point.\n\t\t\treturn;\n\t\t}\n\n\t\tif (at_idx <= handler_idx) {\n\t\t\tpath_idx = at_idx;\n\t\t}\n\t}\n\n\tcurrent_target = /** @type {Element} */ (path[path_idx] || event.target);\n\t// there can only be one delegated event per element, and we either already handled the current target,\n\t// or this is the very first target in the chain which has a non-delegated listener, in which case it's safe\n\t// to handle a possible delegated event on it later (through the root delegation listener for example).\n\tif (current_target === handler_element) return;\n\n\t// Proxy currentTarget to correct target\n\tdefine_property(event, 'currentTarget', {\n\t\tconfigurable: true,\n\t\tget() {\n\t\t\treturn current_target || owner_document;\n\t\t}\n\t});\n\n\t// This started because of Chromium issue https://chromestatus.com/feature/5128696823545856,\n\t// where removal or moving of of the DOM can cause sync `blur` events to fire, which can cause logic\n\t// to run inside the current `active_reaction`, which isn't what we want at all. However, on reflection,\n\t// it's probably best that all event handled by Svelte have this behaviour, as we don't really want\n\t// an event handler to run in the context of another reaction or effect.\n\tvar previous_reaction = active_reaction;\n\tvar previous_effect = active_effect;\n\tset_active_reaction(null);\n\tset_active_effect(null);\n\n\ttry {\n\t\t/**\n\t\t * @type {unknown}\n\t\t */\n\t\tvar throw_error;\n\t\t/**\n\t\t * @type {unknown[]}\n\t\t */\n\t\tvar other_errors = [];\n\n\t\twhile (current_target !== null) {\n\t\t\t/** @type {null | Element} */\n\t\t\tvar parent_element =\n\t\t\t\tcurrent_target.assignedSlot ||\n\t\t\t\tcurrent_target.parentNode ||\n\t\t\t\t/** @type {any} */ (current_target).host ||\n\t\t\t\tnull;\n\n\t\t\ttry {\n\t\t\t\t// @ts-expect-error\n\t\t\t\tvar delegated = current_target[event_symbol]?.[event_name];\n\n\t\t\t\tif (\n\t\t\t\t\tdelegated != null &&\n\t\t\t\t\t(!(/** @type {any} */ (current_target).disabled) ||\n\t\t\t\t\t\t// DOM could've been updated already by the time this is reached, so we check this as well\n\t\t\t\t\t\t// -> the target could not have been disabled because it emits the event in the first place\n\t\t\t\t\t\tevent.target === current_target)\n\t\t\t\t) {\n\t\t\t\t\tdelegated.call(current_target, event);\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\tif (throw_error) {\n\t\t\t\t\tother_errors.push(error);\n\t\t\t\t} else {\n\t\t\t\t\tthrow_error = error;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (event.cancelBubble || parent_element === handler_element || parent_element === null) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcurrent_target = parent_element;\n\t\t}\n\n\t\tif (throw_error) {\n\t\t\tfor (let error of other_errors) {\n\t\t\t\t// Throw the rest of the errors, one-by-one on a microtask\n\t\t\t\tqueueMicrotask(() => {\n\t\t\t\t\tthrow error;\n\t\t\t\t});\n\t\t\t}\n\t\t\tthrow throw_error;\n\t\t}\n\t} finally {\n\t\t// @ts-expect-error is used above\n\t\tevent[event_symbol] = handler_element;\n\t\t// @ts-ignore remove proxy on currentTarget\n\t\tdelete event.currentTarget;\n\t\tset_active_reaction(previous_reaction);\n\t\tset_active_effect(previous_effect);\n\t}\n}\n\n/**\n * In dev, warn if an event handler is not a function, as it means the\n * user probably called the handler or forgot to add a `() =>`\n * @param {() => (event: Event, ...args: any) => void} thunk\n * @param {EventTarget} element\n * @param {[Event, ...any]} args\n * @param {any} component\n * @param {[number, number]} [loc]\n * @param {boolean} [remove_parens]\n */\nexport function apply(\n\tthunk,\n\telement,\n\targs,\n\tcomponent,\n\tloc,\n\thas_side_effects = false,\n\tremove_parens = false\n) {\n\tlet handler;\n\tlet error;\n\n\ttry {\n\t\thandler = thunk();\n\t} catch (e) {\n\t\terror = e;\n\t}\n\n\tif (typeof handler !== 'function' && (has_side_effects || handler != null || error)) {\n\t\tconst filename = component?.[FILENAME];\n\t\tconst location = loc ? ` at ${filename}:${loc[0]}:${loc[1]}` : ` in ${filename}`;\n\t\tconst phase = args[0]?.eventPhase < Event.BUBBLING_PHASE ? 'capture' : '';\n\t\tconst event_name = args[0]?.type + phase;\n\t\tconst description = `\\`${event_name}\\` handler${location}`;\n\t\tconst suggestion = remove_parens ? 'remove the trailing `()`' : 'add a leading `() =>`';\n\n\t\tw.event_handler_invalid(description, suggestion);\n\n\t\tif (error) {\n\t\t\tthrow error;\n\t\t}\n\t}\n\thandler?.apply(element, args);\n}\n","import { create_element } from './operations.js';\n\nconst policy =\n\t// We gotta write it like this because after downleveling the pure comment may end up in the wrong location\n\tglobalThis?.window?.trustedTypes &&\n\t/* @__PURE__ */ globalThis.window.trustedTypes.createPolicy('svelte-trusted-html', {\n\t\t/** @param {string} html */\n\t\tcreateHTML: (html) => {\n\t\t\treturn html;\n\t\t}\n\t});\n\n/** @param {string} html */\nexport function create_trusted_html(html) {\n\treturn /** @type {string} */ (policy?.createHTML(html) ?? html);\n}\n\n/**\n * @param {string} html\n */\nexport function create_fragment_from_html(html) {\n\tvar elem = create_element('template');\n\telem.innerHTML = create_trusted_html(html.replaceAll('<!>', '<!---->')); // XHTML compliance\n\treturn elem.content;\n}\n","/** @import { Effect, EffectNodes, TemplateNode } from '#client' */\n/** @import { TemplateStructure } from './types' */\nimport { hydrate_next, hydrate_node, hydrating, set_hydrate_node } from './hydration.js';\nimport {\n\tcreate_text,\n\tget_first_child,\n\tget_next_sibling,\n\tis_firefox,\n\tcreate_element,\n\tcreate_fragment,\n\tcreate_comment,\n\tset_attribute,\n\tmerge_text_nodes\n} from './operations.js';\nimport { create_fragment_from_html } from './reconciler.js';\nimport { active_effect } from '../runtime.js';\nimport {\n\tNAMESPACE_MATHML,\n\tNAMESPACE_SVG,\n\tTEMPLATE_FRAGMENT,\n\tTEMPLATE_USE_IMPORT_NODE,\n\tTEMPLATE_USE_MATHML,\n\tTEMPLATE_USE_SVG\n} from '../../../constants.js';\nimport {\n\tCOMMENT_NODE,\n\tDOCUMENT_FRAGMENT_NODE,\n\tIS_XHTML,\n\tREACTION_RAN,\n\tTEXT_NODE\n} from '#client/constants';\n\nconst TEMPLATE_TAG = IS_XHTML ? 'template' : 'TEMPLATE';\nconst SCRIPT_TAG = IS_XHTML ? 'script' : 'SCRIPT';\n\n/**\n * @param {TemplateNode} start\n * @param {TemplateNode | null} end\n */\nexport function assign_nodes(start, end) {\n\tvar effect = /** @type {Effect} */ (active_effect);\n\tif (effect.nodes === null) {\n\t\teffect.nodes = { start, end, a: null, t: null };\n\t}\n}\n\n/**\n * @param {string} content\n * @param {number} flags\n * @returns {() => Node | Node[]}\n */\n/*#__NO_SIDE_EFFECTS__*/\nexport function from_html(content, flags) {\n\tvar is_fragment = (flags & TEMPLATE_FRAGMENT) !== 0;\n\tvar use_import_node = (flags & TEMPLATE_USE_IMPORT_NODE) !== 0;\n\n\t/** @type {Node} */\n\tvar node;\n\n\t/**\n\t * Whether or not the first item is a text/element node. If not, we need to\n\t * create an additional comment node to act as `effect.nodes.start`\n\t */\n\tvar has_start = !content.startsWith('<!>');\n\n\treturn () => {\n\t\tif (hydrating) {\n\t\t\tassign_nodes(hydrate_node, null);\n\t\t\treturn hydrate_node;\n\t\t}\n\n\t\tif (node === undefined) {\n\t\t\tnode = create_fragment_from_html(has_start ? content : '<!>' + content);\n\t\t\tif (!is_fragment) node = /** @type {TemplateNode} */ (get_first_child(node));\n\t\t}\n\n\t\tvar clone = /** @type {TemplateNode} */ (\n\t\t\tuse_import_node || is_firefox ? document.importNode(node, true) : node.cloneNode(true)\n\t\t);\n\n\t\tif (is_fragment) {\n\t\t\tvar start = /** @type {TemplateNode} */ (get_first_child(clone));\n\t\t\tvar end = /** @type {TemplateNode} */ (clone.lastChild);\n\n\t\t\tassign_nodes(start, end);\n\t\t} else {\n\t\t\tassign_nodes(clone, clone);\n\t\t}\n\n\t\treturn clone;\n\t};\n}\n\n/**\n * @param {string} content\n * @param {number} flags\n * @param {'svg' | 'math'} ns\n * @returns {() => Node | Node[]}\n */\n/*#__NO_SIDE_EFFECTS__*/\nfunction from_namespace(content, flags, ns = 'svg') {\n\t/**\n\t * Whether or not the first item is a text/element node. If not, we need to\n\t * create an additional comment node to act as `effect.nodes.start`\n\t */\n\tvar has_start = !content.startsWith('<!>');\n\n\tvar is_fragment = (flags & TEMPLATE_FRAGMENT) !== 0;\n\tvar wrapped = `<${ns}>${has_start ? content : '<!>' + content}</${ns}>`;\n\n\t/** @type {Element | DocumentFragment} */\n\tvar node;\n\n\treturn () => {\n\t\tif (hydrating) {\n\t\t\tassign_nodes(hydrate_node, null);\n\t\t\treturn hydrate_node;\n\t\t}\n\n\t\tif (!node) {\n\t\t\tvar fragment = /** @type {DocumentFragment} */ (create_fragment_from_html(wrapped));\n\t\t\tvar root = /** @type {Element} */ (get_first_child(fragment));\n\n\t\t\tif (is_fragment) {\n\t\t\t\tnode = document.createDocumentFragment();\n\t\t\t\twhile (get_first_child(root)) {\n\t\t\t\t\tnode.appendChild(/** @type {TemplateNode} */ (get_first_child(root)));\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tnode = /** @type {Element} */ (get_first_child(root));\n\t\t\t}\n\t\t}\n\n\t\tvar clone = /** @type {TemplateNode} */ (node.cloneNode(true));\n\n\t\tif (is_fragment) {\n\t\t\tvar start = /** @type {TemplateNode} */ (get_first_child(clone));\n\t\t\tvar end = /** @type {TemplateNode} */ (clone.lastChild);\n\n\t\t\tassign_nodes(start, end);\n\t\t} else {\n\t\t\tassign_nodes(clone, clone);\n\t\t}\n\n\t\treturn clone;\n\t};\n}\n\n/**\n * @param {string} content\n * @param {number} flags\n */\n/*#__NO_SIDE_EFFECTS__*/\nexport function from_svg(content, flags) {\n\treturn from_namespace(content, flags, 'svg');\n}\n\n/**\n * @param {string} content\n * @param {number} flags\n */\n/*#__NO_SIDE_EFFECTS__*/\nexport function from_mathml(content, flags) {\n\treturn from_namespace(content, flags, 'math');\n}\n\n/**\n * @param {TemplateStructure[]} structure\n * @param {typeof NAMESPACE_SVG | typeof NAMESPACE_MATHML | undefined} [ns]\n */\nfunction fragment_from_tree(structure, ns) {\n\tvar fragment = create_fragment();\n\n\tfor (var item of structure) {\n\t\tif (typeof item === 'string') {\n\t\t\tfragment.append(create_text(item));\n\t\t\tcontinue;\n\t\t}\n\n\t\t// if `preserveComments === true`, comments are represented as `['// <data>']`\n\t\tif (item === undefined || item[0][0] === '/') {\n\t\t\tfragment.append(create_comment(item ? item[0].slice(3) : ''));\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst [name, attributes, ...children] = item;\n\n\t\tconst namespace = name === 'svg' ? NAMESPACE_SVG : name === 'math' ? NAMESPACE_MATHML : ns;\n\n\t\tvar element = create_element(name, namespace, attributes?.is);\n\n\t\tfor (var key in attributes) {\n\t\t\tset_attribute(element, key, attributes[key]);\n\t\t}\n\n\t\tif (children.length > 0) {\n\t\t\tvar target =\n\t\t\t\telement.nodeName === TEMPLATE_TAG\n\t\t\t\t\t? /** @type {HTMLTemplateElement} */ (element).content\n\t\t\t\t\t: element;\n\n\t\t\ttarget.append(\n\t\t\t\tfragment_from_tree(children, element.nodeName === 'foreignObject' ? undefined : namespace)\n\t\t\t);\n\t\t}\n\n\t\tfragment.append(element);\n\t}\n\n\treturn fragment;\n}\n\n/**\n * @param {TemplateStructure[]} structure\n * @param {number} flags\n * @returns {() => Node | Node[]}\n */\n/*#__NO_SIDE_EFFECTS__*/\nexport function from_tree(structure, flags) {\n\tvar is_fragment = (flags & TEMPLATE_FRAGMENT) !== 0;\n\tvar use_import_node = (flags & TEMPLATE_USE_IMPORT_NODE) !== 0;\n\n\t/** @type {Node} */\n\tvar node;\n\n\treturn () => {\n\t\tif (hydrating) {\n\t\t\tassign_nodes(hydrate_node, null);\n\t\t\treturn hydrate_node;\n\t\t}\n\n\t\tif (node === undefined) {\n\t\t\tconst ns =\n\t\t\t\t(flags & TEMPLATE_USE_SVG) !== 0\n\t\t\t\t\t? NAMESPACE_SVG\n\t\t\t\t\t: (flags & TEMPLATE_USE_MATHML) !== 0\n\t\t\t\t\t\t? NAMESPACE_MATHML\n\t\t\t\t\t\t: undefined;\n\n\t\t\tnode = fragment_from_tree(structure, ns);\n\t\t\tif (!is_fragment) node = /** @type {TemplateNode} */ (get_first_child(node));\n\t\t}\n\n\t\tvar clone = /** @type {TemplateNode} */ (\n\t\t\tuse_import_node || is_firefox ? document.importNode(node, true) : node.cloneNode(true)\n\t\t);\n\n\t\tif (is_fragment) {\n\t\t\tvar start = /** @type {TemplateNode} */ (get_first_child(clone));\n\t\t\tvar end = /** @type {TemplateNode} */ (clone.lastChild);\n\n\t\t\tassign_nodes(start, end);\n\t\t} else {\n\t\t\tassign_nodes(clone, clone);\n\t\t}\n\n\t\treturn clone;\n\t};\n}\n\n/**\n * @param {() => Element | DocumentFragment} fn\n */\nexport function with_script(fn) {\n\treturn () => run_scripts(fn());\n}\n\n/**\n * Creating a document fragment from HTML that contains script tags will not execute\n * the scripts. We need to replace the script tags with new ones so that they are executed.\n * @param {Element | DocumentFragment} node\n * @returns {Node | Node[]}\n */\nfunction run_scripts(node) {\n\t// scripts were SSR'd, in which case they will run\n\tif (hydrating) return node;\n\n\tconst is_fragment = node.nodeType === DOCUMENT_FRAGMENT_NODE;\n\tconst scripts =\n\t\t/** @type {HTMLElement} */ (node).nodeName === SCRIPT_TAG\n\t\t\t? [/** @type {HTMLScriptElement} */ (node)]\n\t\t\t: node.querySelectorAll('script');\n\n\tconst effect = /** @type {Effect & { nodes: EffectNodes }} */ (active_effect);\n\n\tfor (const script of scripts) {\n\t\tconst clone = create_element('script');\n\t\tfor (var attribute of script.attributes) {\n\t\t\tclone.setAttribute(attribute.name, attribute.value);\n\t\t}\n\n\t\tclone.textContent = script.textContent;\n\n\t\t// The script has changed - if it's at the edges, the effect now points at dead nodes\n\t\tif (is_fragment ? node.firstChild === script : node === script) {\n\t\t\teffect.nodes.start = clone;\n\t\t}\n\t\tif (is_fragment ? node.lastChild === script : node === script) {\n\t\t\teffect.nodes.end = clone;\n\t\t}\n\n\t\tscript.replaceWith(clone);\n\t}\n\treturn node;\n}\n\n/**\n * Don't mark this as side-effect-free, hydration needs to walk all nodes\n * @param {any} value\n */\nexport function text(value = '') {\n\tif (!hydrating) {\n\t\tvar t = create_text(value + '');\n\t\tassign_nodes(t, t);\n\t\treturn t;\n\t}\n\n\tvar node = hydrate_node;\n\n\tif (node.nodeType !== TEXT_NODE) {\n\t\t// if an {expression} is empty during SSR, we need to insert an empty text node\n\t\tnode.before((node = create_text()));\n\t\tset_hydrate_node(node);\n\t} else {\n\t\tmerge_text_nodes(/** @type {Text} */ (node));\n\t}\n\n\tassign_nodes(node, node);\n\treturn node;\n}\n\n/**\n * @returns {TemplateNode | DocumentFragment}\n */\nexport function comment() {\n\t// we're not delegating to `template` here for performance reasons\n\tif (hydrating) {\n\t\tassign_nodes(hydrate_node, null);\n\t\treturn hydrate_node;\n\t}\n\n\tvar frag = document.createDocumentFragment();\n\tvar start = document.createComment('');\n\tvar anchor = create_text();\n\tfrag.append(start, anchor);\n\n\tassign_nodes(start, anchor);\n\n\treturn frag;\n}\n\n/**\n * Assign the created (or in hydration mode, traversed) dom elements to the current block\n * and insert the elements into the dom (in client mode).\n * @param {Text | Comment | Element} anchor\n * @param {DocumentFragment | Element} dom\n */\nexport function append(anchor, dom) {\n\tif (hydrating) {\n\t\tvar effect = /** @type {Effect & { nodes: EffectNodes }} */ (active_effect);\n\n\t\t// When hydrating and outer component and an inner component is async, i.e. blocked on a promise,\n\t\t// then by the time the inner resolves we have already advanced to the end of the hydrated nodes\n\t\t// of the parent component. Check for defined for that reason to avoid rewinding the parent's end marker.\n\t\tif ((effect.f & REACTION_RAN) === 0 || effect.nodes.end === null) {\n\t\t\teffect.nodes.end = hydrate_node;\n\t\t}\n\n\t\thydrate_next();\n\t\treturn;\n\t}\n\n\tif (anchor === null) {\n\t\t// edge case — void `<svelte:element>` with content\n\t\treturn;\n\t}\n\n\tanchor.before(/** @type {Node} */ (dom));\n}\n\n/**\n * Create (or hydrate) an unique UID for the component instance.\n */\nexport function props_id() {\n\tif (\n\t\thydrating &&\n\t\thydrate_node &&\n\t\thydrate_node.nodeType === COMMENT_NODE &&\n\t\thydrate_node.textContent?.startsWith(`$`)\n\t) {\n\t\tconst id = hydrate_node.textContent.substring(1);\n\t\thydrate_next();\n\t\treturn id;\n\t}\n\n\t// @ts-expect-error This way we ensure the id is unique even across Svelte runtimes\n\t(window.__svelte ??= {}).uid ??= 1;\n\n\t// @ts-expect-error\n\treturn `c${window.__svelte.uid++}`;\n}\n","const regex_return_characters = /\\r/g;\n\n/**\n * @param {string} str\n * @returns {string}\n */\nexport function hash(str) {\n\tstr = str.replace(regex_return_characters, '');\n\tlet hash = 5381;\n\tlet i = str.length;\n\n\twhile (i--) hash = ((hash << 5) - hash) ^ str.charCodeAt(i);\n\treturn (hash >>> 0).toString(36);\n}\n\nconst VOID_ELEMENT_NAMES = [\n\t'area',\n\t'base',\n\t'br',\n\t'col',\n\t'command',\n\t'embed',\n\t'hr',\n\t'img',\n\t'input',\n\t'keygen',\n\t'link',\n\t'meta',\n\t'param',\n\t'source',\n\t'track',\n\t'wbr'\n];\n\n/**\n * Returns `true` if `name` is of a void element\n * @param {string} name\n */\nexport function is_void(name) {\n\treturn VOID_ELEMENT_NAMES.includes(name) || name.toLowerCase() === '!doctype';\n}\n\nconst RESERVED_WORDS = [\n\t'arguments',\n\t'await',\n\t'break',\n\t'case',\n\t'catch',\n\t'class',\n\t'const',\n\t'continue',\n\t'debugger',\n\t'default',\n\t'delete',\n\t'do',\n\t'else',\n\t'enum',\n\t'eval',\n\t'export',\n\t'extends',\n\t'false',\n\t'finally',\n\t'for',\n\t'function',\n\t'if',\n\t'implements',\n\t'import',\n\t'in',\n\t'instanceof',\n\t'interface',\n\t'let',\n\t'new',\n\t'null',\n\t'package',\n\t'private',\n\t'protected',\n\t'public',\n\t'return',\n\t'static',\n\t'super',\n\t'switch',\n\t'this',\n\t'throw',\n\t'true',\n\t'try',\n\t'typeof',\n\t'var',\n\t'void',\n\t'while',\n\t'with',\n\t'yield'\n];\n\n/**\n * Returns `true` if `word` is a reserved JavaScript keyword\n * @param {string} word\n */\nexport function is_reserved(word) {\n\treturn RESERVED_WORDS.includes(word);\n}\n\n/**\n * @param {string} name\n */\nexport function is_capture_event(name) {\n\treturn name.endsWith('capture') && name !== 'gotpointercapture' && name !== 'lostpointercapture';\n}\n\n/** List of Element events that will be delegated */\nconst DELEGATED_EVENTS = [\n\t'beforeinput',\n\t'click',\n\t'change',\n\t'dblclick',\n\t'contextmenu',\n\t'focusin',\n\t'focusout',\n\t'input',\n\t'keydown',\n\t'keyup',\n\t'mousedown',\n\t'mousemove',\n\t'mouseout',\n\t'mouseover',\n\t'mouseup',\n\t'pointerdown',\n\t'pointermove',\n\t'pointerout',\n\t'pointerover',\n\t'pointerup',\n\t'touchend',\n\t'touchmove',\n\t'touchstart'\n];\n\n/**\n * Returns `true` if `event_name` is a delegated event\n * @param {string} event_name\n */\nexport function can_delegate_event(event_name) {\n\treturn DELEGATED_EVENTS.includes(event_name);\n}\n\n/**\n * Attributes that are boolean, i.e. they are present or not present.\n */\nconst DOM_BOOLEAN_ATTRIBUTES = [\n\t'allowfullscreen',\n\t'async',\n\t'autofocus',\n\t'autoplay',\n\t'checked',\n\t'controls',\n\t'default',\n\t'disabled',\n\t'formnovalidate',\n\t'indeterminate',\n\t'inert',\n\t'ismap',\n\t'loop',\n\t'multiple',\n\t'muted',\n\t'nomodule',\n\t'novalidate',\n\t'open',\n\t'playsinline',\n\t'readonly',\n\t'required',\n\t'reversed',\n\t'seamless',\n\t'selected',\n\t'webkitdirectory',\n\t'defer',\n\t'disablepictureinpicture',\n\t'disableremoteplayback'\n];\n\n/**\n * Returns `true` if `name` is a boolean attribute\n * @param {string} name\n */\nexport function is_boolean_attribute(name) {\n\treturn DOM_BOOLEAN_ATTRIBUTES.includes(name);\n}\n\n/**\n * @type {Record<string, string>}\n * List of attribute names that should be aliased to their property names\n * because they behave differently between setting them as an attribute and\n * setting them as a property.\n */\nconst ATTRIBUTE_ALIASES = {\n\t// no `class: 'className'` because we handle that separately\n\tformnovalidate: 'formNoValidate',\n\tismap: 'isMap',\n\tnomodule: 'noModule',\n\tplaysinline: 'playsInline',\n\treadonly: 'readOnly',\n\tdefaultvalue: 'defaultValue',\n\tdefaultchecked: 'defaultChecked',\n\tsrcobject: 'srcObject',\n\tnovalidate: 'noValidate',\n\tallowfullscreen: 'allowFullscreen',\n\tdisablepictureinpicture: 'disablePictureInPicture',\n\tdisableremoteplayback: 'disableRemotePlayback'\n};\n\n/**\n * @param {string} name\n */\nexport function normalize_attribute(name) {\n\tname = name.toLowerCase();\n\treturn ATTRIBUTE_ALIASES[name] ?? name;\n}\n\nconst DOM_PROPERTIES = [\n\t...DOM_BOOLEAN_ATTRIBUTES,\n\t'formNoValidate',\n\t'isMap',\n\t'noModule',\n\t'playsInline',\n\t'readOnly',\n\t'value',\n\t'volume',\n\t'defaultValue',\n\t'defaultChecked',\n\t'srcObject',\n\t'noValidate',\n\t'allowFullscreen',\n\t'disablePictureInPicture',\n\t'disableRemotePlayback'\n];\n\n/**\n * @param {string} name\n */\nexport function is_dom_property(name) {\n\treturn DOM_PROPERTIES.includes(name);\n}\n\nconst NON_STATIC_PROPERTIES = ['autofocus', 'muted', 'defaultValue', 'defaultChecked'];\n\n/**\n * Returns `true` if the given attribute cannot be set through the template\n * string, i.e. needs some kind of JavaScript handling to work.\n * @param {string} name\n */\nexport function cannot_be_set_statically(name) {\n\treturn NON_STATIC_PROPERTIES.includes(name);\n}\n\n/**\n * Subset of delegated events which should be passive by default.\n * These two are already passive via browser defaults on window, document and body.\n * But since\n * - we're delegating them\n * - they happen often\n * - they apply to mobile which is generally less performant\n * we're marking them as passive by default for other elements, too.\n */\nconst PASSIVE_EVENTS = ['touchstart', 'touchmove'];\n\n/**\n * Returns `true` if `name` is a passive event\n * @param {string} name\n */\nexport function is_passive_event(name) {\n\treturn PASSIVE_EVENTS.includes(name);\n}\n\nconst CONTENT_EDITABLE_BINDINGS = ['textContent', 'innerHTML', 'innerText'];\n\n/** @param {string} name */\nexport function is_content_editable_binding(name) {\n\treturn CONTENT_EDITABLE_BINDINGS.includes(name);\n}\n\nconst LOAD_ERROR_ELEMENTS = [\n\t'body',\n\t'embed',\n\t'iframe',\n\t'img',\n\t'link',\n\t'object',\n\t'script',\n\t'style',\n\t'track'\n];\n\n/**\n * Returns `true` if the element emits `load` and `error` events\n * @param {string} name\n */\nexport function is_load_error_element(name) {\n\treturn LOAD_ERROR_ELEMENTS.includes(name);\n}\n\nconst SVG_ELEMENTS = [\n\t'altGlyph',\n\t'altGlyphDef',\n\t'altGlyphItem',\n\t'animate',\n\t'animateColor',\n\t'animateMotion',\n\t'animateTransform',\n\t'circle',\n\t'clipPath',\n\t'color-profile',\n\t'cursor',\n\t'defs',\n\t'desc',\n\t'discard',\n\t'ellipse',\n\t'feBlend',\n\t'feColorMatrix',\n\t'feComponentTransfer',\n\t'feComposite',\n\t'feConvolveMatrix',\n\t'feDiffuseLighting',\n\t'feDisplacementMap',\n\t'feDistantLight',\n\t'feDropShadow',\n\t'feFlood',\n\t'feFuncA',\n\t'feFuncB',\n\t'feFuncG',\n\t'feFuncR',\n\t'feGaussianBlur',\n\t'feImage',\n\t'feMerge',\n\t'feMergeNode',\n\t'feMorphology',\n\t'feOffset',\n\t'fePointLight',\n\t'feSpecularLighting',\n\t'feSpotLight',\n\t'feTile',\n\t'feTurbulence',\n\t'filter',\n\t'font',\n\t'font-face',\n\t'font-face-format',\n\t'font-face-name',\n\t'font-face-src',\n\t'font-face-uri',\n\t'foreignObject',\n\t'g',\n\t'glyph',\n\t'glyphRef',\n\t'hatch',\n\t'hatchpath',\n\t'hkern',\n\t'image',\n\t'line',\n\t'linearGradient',\n\t'marker',\n\t'mask',\n\t'mesh',\n\t'meshgradient',\n\t'meshpatch',\n\t'meshrow',\n\t'metadata',\n\t'missing-glyph',\n\t'mpath',\n\t'path',\n\t'pattern',\n\t'polygon',\n\t'polyline',\n\t'radialGradient',\n\t'rect',\n\t'set',\n\t'solidcolor',\n\t'stop',\n\t'svg',\n\t'switch',\n\t'symbol',\n\t'text',\n\t'textPath',\n\t'tref',\n\t'tspan',\n\t'unknown',\n\t'use',\n\t'view',\n\t'vkern'\n];\n\n/** @param {string} name */\nexport function is_svg(name) {\n\treturn SVG_ELEMENTS.includes(name);\n}\n\nconst MATHML_ELEMENTS = [\n\t'annotation',\n\t'annotation-xml',\n\t'maction',\n\t'math',\n\t'merror',\n\t'mfrac',\n\t'mi',\n\t'mmultiscripts',\n\t'mn',\n\t'mo',\n\t'mover',\n\t'mpadded',\n\t'mphantom',\n\t'mprescripts',\n\t'mroot',\n\t'mrow',\n\t'ms',\n\t'mspace',\n\t'msqrt',\n\t'mstyle',\n\t'msub',\n\t'msubsup',\n\t'msup',\n\t'mtable',\n\t'mtd',\n\t'mtext',\n\t'mtr',\n\t'munder',\n\t'munderover',\n\t'semantics'\n];\n\n/** @param {string} name */\nexport function is_mathml(name) {\n\treturn MATHML_ELEMENTS.includes(name);\n}\n\nconst STATE_CREATION_RUNES = /** @type {const} */ ([\n\t'$state',\n\t'$state.raw',\n\t'$derived',\n\t'$derived.by'\n]);\n\nconst RUNES = /** @type {const} */ ([\n\t...STATE_CREATION_RUNES,\n\t'$state.eager',\n\t'$state.snapshot',\n\t'$props',\n\t'$props.id',\n\t'$bindable',\n\t'$effect',\n\t'$effect.pre',\n\t'$effect.tracking',\n\t'$effect.root',\n\t'$effect.pending',\n\t'$inspect',\n\t'$inspect().with',\n\t'$inspect.trace',\n\t'$host'\n]);\n\n/** @typedef {typeof RUNES[number]} RuneName */\n\n/**\n * @param {string} name\n * @returns {name is RuneName}\n */\nexport function is_rune(name) {\n\treturn RUNES.includes(/** @type {RuneName} */ (name));\n}\n\n/** @typedef {typeof STATE_CREATION_RUNES[number]} StateCreationRuneName */\n\n/**\n * @param {string} name\n * @returns {name is StateCreationRuneName}\n */\nexport function is_state_creation_rune(name) {\n\treturn STATE_CREATION_RUNES.includes(/** @type {StateCreationRuneName} */ (name));\n}\n\n/** List of elements that require raw contents and should not have SSR comments put in them */\nconst RAW_TEXT_ELEMENTS = /** @type {const} */ (['textarea', 'script', 'style', 'title']);\n\n/** @param {string} name */\nexport function is_raw_text_element(name) {\n\treturn RAW_TEXT_ELEMENTS.includes(/** @type {typeof RAW_TEXT_ELEMENTS[number]} */ (name));\n}\n\n// Matches valid HTML/SVG/MathML element names and custom element names.\n// https://html.spec.whatwg.org/multipage/custom-elements.html#valid-custom-element-name\n//\n// Standard elements: ASCII alpha start, followed by ASCII alphanumerics.\n// Custom elements: ASCII alpha start, followed by any mix of PCENChar (which\n// includes ASCII alphanumerics, `-`, `.`, `_`, and specified Unicode ranges),\n// with at least one hyphen required somewhere after the first character.\n//\n// Rejects strings containing whitespace, quotes, angle brackets, slashes, equals,\n// or other characters that could break out of a tag-name token and enable markup injection.\nexport const REGEX_VALID_TAG_NAME =\n\t/^[a-zA-Z][a-zA-Z0-9]*(-[a-zA-Z0-9.\\-_\\u00B7\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u203F-\\u2040\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\u{10000}-\\u{EFFFF}]+)*$/u;\n\n/**\n * Prevent devtools trying to make `location` a clickable link by inserting a zero-width space\n * @template {string | undefined} T\n * @param {T} location\n * @returns {T};\n */\nexport function sanitize_location(location) {\n\treturn /** @type {T} */ (location?.replace(/\\//g, '/\\u200b'));\n}\n","/** @import { ComponentContext, Effect, EffectNodes, TemplateNode } from '#client' */\n/** @import { Component, ComponentType, SvelteComponent, MountOptions } from '../../index.js' */\nimport { DEV } from 'esm-env';\nimport {\n\tclear_text_content,\n\tcreate_text,\n\tget_first_child,\n\tget_next_sibling,\n\tinit_operations\n} from './dom/operations.js';\nimport { HYDRATION_END, HYDRATION_ERROR, HYDRATION_START } from '../../constants.js';\nimport { active_effect } from './runtime.js';\nimport { push, pop, component_context } from './context.js';\nimport { component_root } from './reactivity/effects.js';\nimport { hydrate_node, hydrating, set_hydrate_node, set_hydrating } from './dom/hydration.js';\nimport { array_from } from '../shared/utils.js';\nimport {\n\tall_registered_events,\n\thandle_event_propagation,\n\troot_event_handles\n} from './dom/elements/events.js';\nimport * as w from './warnings.js';\nimport * as e from './errors.js';\nimport { assign_nodes } from './dom/template.js';\nimport { is_passive_event } from '../../utils.js';\nimport { COMMENT_NODE, STATE_SYMBOL } from './constants.js';\nimport { boundary } from './dom/blocks/boundary.js';\n\n/**\n * This is normally true — block effects should run their intro transitions —\n * but is false during hydration (unless `options.intro` is `true`) and\n * when creating the children of a `<svelte:element>` that just changed tag\n */\nexport let should_intro = true;\n\n/** @param {boolean} value */\nexport function set_should_intro(value) {\n\tshould_intro = value;\n}\n\n/**\n * @param {Element} text\n * @param {string} value\n * @returns {void}\n */\nexport function set_text(text, value) {\n\t// For objects, we apply string coercion (which might make things like $state array references in the template reactive) before diffing\n\tvar str = value == null ? '' : typeof value === 'object' ? `${value}` : value;\n\t// @ts-expect-error\n\tif (str !== (text.__t ??= text.nodeValue)) {\n\t\t// @ts-expect-error\n\t\ttext.__t = str;\n\t\ttext.nodeValue = `${str}`;\n\t}\n}\n\n/**\n * Mounts a component to the given target and returns the exports and potentially the props (if compiled with `accessors: true`) of the component.\n * Transitions will play during the initial render unless the `intro` option is set to `false`.\n *\n * @template {Record<string, any>} Props\n * @template {Record<string, any>} Exports\n * @param {ComponentType<SvelteComponent<Props>> | Component<Props, Exports, any>} component\n * @param {MountOptions<Props>} options\n * @returns {Exports}\n */\nexport function mount(component, options) {\n\treturn _mount(component, options);\n}\n\n/**\n * Hydrates a component on the given target and returns the exports and potentially the props (if compiled with `accessors: true`) of the component\n *\n * @template {Record<string, any>} Props\n * @template {Record<string, any>} Exports\n * @param {ComponentType<SvelteComponent<Props>> | Component<Props, Exports, any>} component\n * @param {{} extends Props ? {\n * \t\ttarget: Document | Element | ShadowRoot;\n * \t\tprops?: Props;\n * \t\tevents?: Record<string, (e: any) => any>;\n * \tcontext?: Map<any, any>;\n * \t\tintro?: boolean;\n * \t\trecover?: boolean;\n *\t\ttransformError?: (error: unknown) => unknown;\n * \t} : {\n * \t\ttarget: Document | Element | ShadowRoot;\n * \t\tprops: Props;\n * \t\tevents?: Record<string, (e: any) => any>;\n * \tcontext?: Map<any, any>;\n * \t\tintro?: boolean;\n * \t\trecover?: boolean;\n *\t\ttransformError?: (error: unknown) => unknown;\n * \t}} options\n * @returns {Exports}\n */\nexport function hydrate(component, options) {\n\tinit_operations();\n\toptions.intro = options.intro ?? false;\n\tconst target = options.target;\n\tconst was_hydrating = hydrating;\n\tconst previous_hydrate_node = hydrate_node;\n\n\ttry {\n\t\tvar anchor = get_first_child(target);\n\n\t\twhile (\n\t\t\tanchor &&\n\t\t\t(anchor.nodeType !== COMMENT_NODE || /** @type {Comment} */ (anchor).data !== HYDRATION_START)\n\t\t) {\n\t\t\tanchor = get_next_sibling(anchor);\n\t\t}\n\n\t\tif (!anchor) {\n\t\t\tthrow HYDRATION_ERROR;\n\t\t}\n\n\t\tset_hydrating(true);\n\t\tset_hydrate_node(/** @type {Comment} */ (anchor));\n\n\t\tconst instance = _mount(component, { ...options, anchor });\n\n\t\tset_hydrating(false);\n\n\t\treturn /** @type {Exports} */ (instance);\n\t} catch (error) {\n\t\t// re-throw Svelte errors - they are certainly not related to hydration\n\t\tif (\n\t\t\terror instanceof Error &&\n\t\t\terror.message.split('\\n').some((line) => line.startsWith('https://svelte.dev/e/'))\n\t\t) {\n\t\t\tthrow error;\n\t\t}\n\t\tif (error !== HYDRATION_ERROR) {\n\t\t\t// eslint-disable-next-line no-console\n\t\t\tconsole.warn('Failed to hydrate: ', error);\n\t\t}\n\n\t\tif (options.recover === false) {\n\t\t\te.hydration_failed();\n\t\t}\n\n\t\t// If an error occurred above, the operations might not yet have been initialised.\n\t\tinit_operations();\n\t\tclear_text_content(target);\n\n\t\tset_hydrating(false);\n\t\treturn mount(component, options);\n\t} finally {\n\t\tset_hydrating(was_hydrating);\n\t\tset_hydrate_node(previous_hydrate_node);\n\t}\n}\n\n/** @type {Map<EventTarget, Map<string, number>>} */\nconst listeners = new Map();\n\n/**\n * @template {Record<string, any>} Exports\n * @param {ComponentType<SvelteComponent<any>> | Component<any>} Component\n * @param {MountOptions} options\n * @returns {Exports}\n */\nfunction _mount(\n\tComponent,\n\t{ target, anchor, props = {}, events, context, intro = true, transformError }\n) {\n\tinit_operations();\n\n\t/** @type {Exports} */\n\t// @ts-expect-error will be defined because the render effect runs synchronously\n\tvar component = undefined;\n\n\tvar unmount = component_root(() => {\n\t\tvar anchor_node = anchor ?? target.appendChild(create_text());\n\n\t\tboundary(\n\t\t\t/** @type {TemplateNode} */ (anchor_node),\n\t\t\t{\n\t\t\t\tpending: () => {}\n\t\t\t},\n\t\t\t(anchor_node) => {\n\t\t\t\tpush({});\n\t\t\t\tvar ctx = /** @type {ComponentContext} */ (component_context);\n\t\t\t\tif (context) ctx.c = context;\n\n\t\t\t\tif (events) {\n\t\t\t\t\t// We can't spread the object or else we'd lose the state proxy stuff, if it is one\n\t\t\t\t\t/** @type {any} */ (props).$$events = events;\n\t\t\t\t}\n\n\t\t\t\tif (hydrating) {\n\t\t\t\t\tassign_nodes(/** @type {TemplateNode} */ (anchor_node), null);\n\t\t\t\t}\n\n\t\t\t\tshould_intro = intro;\n\t\t\t\t// @ts-expect-error the public typings are not what the actual function looks like\n\t\t\t\tcomponent = Component(anchor_node, props) || {};\n\t\t\t\tshould_intro = true;\n\n\t\t\t\tif (hydrating) {\n\t\t\t\t\t/** @type {Effect & { nodes: EffectNodes }} */ (active_effect).nodes.end = hydrate_node;\n\n\t\t\t\t\tif (\n\t\t\t\t\t\thydrate_node === null ||\n\t\t\t\t\t\thydrate_node.nodeType !== COMMENT_NODE ||\n\t\t\t\t\t\t/** @type {Comment} */ (hydrate_node).data !== HYDRATION_END\n\t\t\t\t\t) {\n\t\t\t\t\t\tw.hydration_mismatch();\n\t\t\t\t\t\tthrow HYDRATION_ERROR;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tpop();\n\t\t\t},\n\t\t\ttransformError\n\t\t);\n\n\t\t// Setup event delegation _after_ component is mounted - if an error would happen during mount, it would otherwise not be cleaned up\n\t\t/** @type {Set<string>} */\n\t\tvar registered_events = new Set();\n\n\t\t/** @param {Array<string>} events */\n\t\tvar event_handle = (events) => {\n\t\t\tfor (var i = 0; i < events.length; i++) {\n\t\t\t\tvar event_name = events[i];\n\n\t\t\t\tif (registered_events.has(event_name)) continue;\n\t\t\t\tregistered_events.add(event_name);\n\n\t\t\t\tvar passive = is_passive_event(event_name);\n\n\t\t\t\t// Add the event listener to both the container and the document.\n\t\t\t\t// The container listener ensures we catch events from within in case\n\t\t\t\t// the outer content stops propagation of the event.\n\t\t\t\t//\n\t\t\t\t// The document listener ensures we catch events that originate from elements that were\n\t\t\t\t// manually moved outside of the container (e.g. via manual portals).\n\t\t\t\tfor (const node of [target, document]) {\n\t\t\t\t\tvar counts = listeners.get(node);\n\n\t\t\t\t\tif (counts === undefined) {\n\t\t\t\t\t\tcounts = new Map();\n\t\t\t\t\t\tlisteners.set(node, counts);\n\t\t\t\t\t}\n\n\t\t\t\t\tvar count = counts.get(event_name);\n\n\t\t\t\t\tif (count === undefined) {\n\t\t\t\t\t\tnode.addEventListener(event_name, handle_event_propagation, { passive });\n\t\t\t\t\t\tcounts.set(event_name, 1);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tcounts.set(event_name, count + 1);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\tevent_handle(array_from(all_registered_events));\n\t\troot_event_handles.add(event_handle);\n\n\t\treturn () => {\n\t\t\tfor (var event_name of registered_events) {\n\t\t\t\tfor (const node of [target, document]) {\n\t\t\t\t\tvar counts = /** @type {Map<string, number>} */ (listeners.get(node));\n\t\t\t\t\tvar count = /** @type {number} */ (counts.get(event_name));\n\n\t\t\t\t\tif (--count == 0) {\n\t\t\t\t\t\tnode.removeEventListener(event_name, handle_event_propagation);\n\t\t\t\t\t\tcounts.delete(event_name);\n\n\t\t\t\t\t\tif (counts.size === 0) {\n\t\t\t\t\t\t\tlisteners.delete(node);\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tcounts.set(event_name, count);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\troot_event_handles.delete(event_handle);\n\n\t\t\tif (anchor_node !== anchor) {\n\t\t\t\tanchor_node.parentNode?.removeChild(anchor_node);\n\t\t\t}\n\t\t};\n\t});\n\n\tmounted_components.set(component, unmount);\n\treturn component;\n}\n\n/**\n * References of the components that were mounted or hydrated.\n * Uses a `WeakMap` to avoid memory leaks.\n */\nlet mounted_components = new WeakMap();\n\n/**\n * Unmounts a component that was previously mounted using `mount` or `hydrate`.\n *\n * Since 5.13.0, if `options.outro` is `true`, [transitions](https://svelte.dev/docs/svelte/transition) will play before the component is removed from the DOM.\n *\n * Returns a `Promise` that resolves after transitions have completed if `options.outro` is true, or immediately otherwise (prior to 5.13.0, returns `void`).\n *\n * ```js\n * import { mount, unmount } from 'svelte';\n * import App from './App.svelte';\n *\n * const app = mount(App, { target: document.body });\n *\n * // later...\n * unmount(app, { outro: true });\n * ```\n * @param {Record<string, any>} component\n * @param {{ outro?: boolean }} [options]\n * @returns {Promise<void>}\n */\nexport function unmount(component, options) {\n\tconst fn = mounted_components.get(component);\n\n\tif (fn) {\n\t\tmounted_components.delete(component);\n\t\treturn fn(options);\n\t}\n\n\tif (DEV) {\n\t\tif (STATE_SYMBOL in component) {\n\t\t\tw.state_proxy_unmount();\n\t\t} else {\n\t\t\tw.lifecycle_double_unmount();\n\t\t}\n\t}\n\n\treturn Promise.resolve();\n}\n","/** @import { Effect, TemplateNode } from '#client' */\nimport { Batch, current_batch } from '../../reactivity/batch.js';\nimport {\n\tbranch,\n\tdestroy_effect,\n\tmove_effect,\n\tpause_effect,\n\tresume_effect\n} from '../../reactivity/effects.js';\nimport { hydrate_node, hydrating } from '../hydration.js';\nimport { create_text, should_defer_append } from '../operations.js';\n\n/**\n * @typedef {{ effect: Effect, fragment: DocumentFragment }} Branch\n */\n\n/**\n * @template Key\n */\nexport class BranchManager {\n\t/** @type {TemplateNode} */\n\tanchor;\n\n\t/** @type {Map<Batch, Key>} */\n\t#batches = new Map();\n\n\t/**\n\t * Map of keys to effects that are currently rendered in the DOM.\n\t * These effects are visible and actively part of the document tree.\n\t * Example:\n\t * ```\n\t * {#if condition}\n\t * \tfoo\n\t * {:else}\n\t * \tbar\n\t * {/if}\n\t * ```\n\t * Can result in the entries `true->Effect` and `false->Effect`\n\t * @type {Map<Key, Effect>}\n\t */\n\t#onscreen = new Map();\n\n\t/**\n\t * Similar to #onscreen with respect to the keys, but contains branches that are not yet\n\t * in the DOM, because their insertion is deferred.\n\t * @type {Map<Key, Branch>}\n\t */\n\t#offscreen = new Map();\n\n\t/**\n\t * Keys of effects that are currently outroing\n\t * @type {Set<Key>}\n\t */\n\t#outroing = new Set();\n\n\t/**\n\t * Whether to pause (i.e. outro) on change, or destroy immediately.\n\t * This is necessary for `<svelte:element>`\n\t */\n\t#transition = true;\n\n\t/**\n\t * @param {TemplateNode} anchor\n\t * @param {boolean} transition\n\t */\n\tconstructor(anchor, transition = true) {\n\t\tthis.anchor = anchor;\n\t\tthis.#transition = transition;\n\t}\n\n\t/**\n\t * @param {Batch} batch\n\t */\n\t#commit = (batch) => {\n\t\t// if this batch was made obsolete, bail\n\t\tif (!this.#batches.has(batch)) return;\n\n\t\tvar key = /** @type {Key} */ (this.#batches.get(batch));\n\n\t\tvar onscreen = this.#onscreen.get(key);\n\n\t\tif (onscreen) {\n\t\t\t// effect is already in the DOM — abort any current outro\n\t\t\tresume_effect(onscreen);\n\t\t\tthis.#outroing.delete(key);\n\t\t} else {\n\t\t\t// effect is currently offscreen. put it in the DOM\n\t\t\tvar offscreen = this.#offscreen.get(key);\n\n\t\t\tif (offscreen) {\n\t\t\t\tthis.#onscreen.set(key, offscreen.effect);\n\t\t\t\tthis.#offscreen.delete(key);\n\n\t\t\t\t// remove the anchor...\n\t\t\t\t/** @type {TemplateNode} */ (offscreen.fragment.lastChild).remove();\n\n\t\t\t\t// ...and append the fragment\n\t\t\t\tthis.anchor.before(offscreen.fragment);\n\t\t\t\tonscreen = offscreen.effect;\n\t\t\t}\n\t\t}\n\n\t\tfor (const [b, k] of this.#batches) {\n\t\t\tthis.#batches.delete(b);\n\n\t\t\tif (b === batch) {\n\t\t\t\t// keep values for newer batches\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tconst offscreen = this.#offscreen.get(k);\n\n\t\t\tif (offscreen) {\n\t\t\t\t// for older batches, destroy offscreen effects\n\t\t\t\t// as they will never be committed\n\t\t\t\tdestroy_effect(offscreen.effect);\n\t\t\t\tthis.#offscreen.delete(k);\n\t\t\t}\n\t\t}\n\n\t\t// outro/destroy all onscreen effects...\n\t\tfor (const [k, effect] of this.#onscreen) {\n\t\t\t// ...except the one that was just committed\n\t\t\t// or those that are already outroing (else the transition is aborted and the effect destroyed right away)\n\t\t\tif (k === key || this.#outroing.has(k)) continue;\n\n\t\t\tconst on_destroy = () => {\n\t\t\t\tconst keys = Array.from(this.#batches.values());\n\n\t\t\t\tif (keys.includes(k)) {\n\t\t\t\t\t// keep the effect offscreen, as another batch will need it\n\t\t\t\t\tvar fragment = document.createDocumentFragment();\n\t\t\t\t\tmove_effect(effect, fragment);\n\n\t\t\t\t\tfragment.append(create_text()); // TODO can we avoid this?\n\n\t\t\t\t\tthis.#offscreen.set(k, { effect, fragment });\n\t\t\t\t} else {\n\t\t\t\t\tdestroy_effect(effect);\n\t\t\t\t}\n\n\t\t\t\tthis.#outroing.delete(k);\n\t\t\t\tthis.#onscreen.delete(k);\n\t\t\t};\n\n\t\t\tif (this.#transition || !onscreen) {\n\t\t\t\tthis.#outroing.add(k);\n\t\t\t\tpause_effect(effect, on_destroy, false);\n\t\t\t} else {\n\t\t\t\ton_destroy();\n\t\t\t}\n\t\t}\n\t};\n\n\t/**\n\t * @param {Batch} batch\n\t */\n\t#discard = (batch) => {\n\t\tthis.#batches.delete(batch);\n\n\t\tconst keys = Array.from(this.#batches.values());\n\n\t\tfor (const [k, branch] of this.#offscreen) {\n\t\t\tif (!keys.includes(k)) {\n\t\t\t\tdestroy_effect(branch.effect);\n\t\t\t\tthis.#offscreen.delete(k);\n\t\t\t}\n\t\t}\n\t};\n\n\t/**\n\t *\n\t * @param {any} key\n\t * @param {null | ((target: TemplateNode) => void)} fn\n\t */\n\tensure(key, fn) {\n\t\tvar batch = /** @type {Batch} */ (current_batch);\n\t\tvar defer = should_defer_append();\n\n\t\tif (fn && !this.#onscreen.has(key) && !this.#offscreen.has(key)) {\n\t\t\tif (defer) {\n\t\t\t\tvar fragment = document.createDocumentFragment();\n\t\t\t\tvar target = create_text();\n\n\t\t\t\tfragment.append(target);\n\n\t\t\t\tthis.#offscreen.set(key, {\n\t\t\t\t\teffect: branch(() => fn(target)),\n\t\t\t\t\tfragment\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tthis.#onscreen.set(\n\t\t\t\t\tkey,\n\t\t\t\t\tbranch(() => fn(this.anchor))\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\tthis.#batches.set(batch, key);\n\n\t\tif (defer) {\n\t\t\tfor (const [k, effect] of this.#onscreen) {\n\t\t\t\tif (k === key) {\n\t\t\t\t\tbatch.unskip_effect(effect);\n\t\t\t\t} else {\n\t\t\t\t\tbatch.skip_effect(effect);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor (const [k, branch] of this.#offscreen) {\n\t\t\t\tif (k === key) {\n\t\t\t\t\tbatch.unskip_effect(branch.effect);\n\t\t\t\t} else {\n\t\t\t\t\tbatch.skip_effect(branch.effect);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tbatch.oncommit(this.#commit);\n\t\t\tbatch.ondiscard(this.#discard);\n\t\t} else {\n\t\t\tif (hydrating) {\n\t\t\t\tthis.anchor = hydrate_node;\n\t\t\t}\n\n\t\t\tthis.#commit(batch);\n\t\t}\n\t}\n}\n","/** @import { ComponentContext, ComponentContextLegacy } from '#client' */\n/** @import { EventDispatcher } from './index.js' */\n/** @import { NotFunction } from './internal/types.js' */\nimport { active_reaction, untrack } from './internal/client/runtime.js';\nimport { is_array } from './internal/shared/utils.js';\nimport { user_effect } from './internal/client/index.js';\nimport * as e from './internal/client/errors.js';\nimport { legacy_mode_flag } from './internal/flags/index.js';\nimport { component_context } from './internal/client/context.js';\nimport { DEV } from 'esm-env';\n\nif (DEV) {\n\t/**\n\t * @param {string} rune\n\t */\n\tfunction throw_rune_error(rune) {\n\t\tif (!(rune in globalThis)) {\n\t\t\t// TODO if people start adjusting the \"this can contain runes\" config through v-p-s more, adjust this message\n\t\t\t/** @type {any} */\n\t\t\tlet value; // let's hope noone modifies this global, but belts and braces\n\t\t\tObject.defineProperty(globalThis, rune, {\n\t\t\t\tconfigurable: true,\n\t\t\t\t// eslint-disable-next-line getter-return\n\t\t\t\tget: () => {\n\t\t\t\t\tif (value !== undefined) {\n\t\t\t\t\t\treturn value;\n\t\t\t\t\t}\n\n\t\t\t\t\te.rune_outside_svelte(rune);\n\t\t\t\t},\n\t\t\t\tset: (v) => {\n\t\t\t\t\tvalue = v;\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\n\tthrow_rune_error('$state');\n\tthrow_rune_error('$effect');\n\tthrow_rune_error('$derived');\n\tthrow_rune_error('$inspect');\n\tthrow_rune_error('$props');\n\tthrow_rune_error('$bindable');\n}\n\n/**\n * Returns an [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) that aborts when the current [derived](https://svelte.dev/docs/svelte/$derived) or [effect](https://svelte.dev/docs/svelte/$effect) re-runs or is destroyed.\n *\n * Must be called while a derived or effect is running.\n *\n * ```svelte\n * <script>\n * \timport { getAbortSignal } from 'svelte';\n *\n * \tlet { id } = $props();\n *\n * \tasync function getData(id) {\n * \t\tconst response = await fetch(`/items/${id}`, {\n * \t\t\tsignal: getAbortSignal()\n * \t\t});\n *\n * \t\treturn await response.json();\n * \t}\n *\n * \tconst data = $derived(await getData(id));\n * </script>\n * ```\n */\nexport function getAbortSignal() {\n\tif (active_reaction === null) {\n\t\te.get_abort_signal_outside_reaction();\n\t}\n\n\treturn (active_reaction.ac ??= new AbortController()).signal;\n}\n\n/**\n * `onMount`, like [`$effect`](https://svelte.dev/docs/svelte/$effect), schedules a function to run as soon as the component has been mounted to the DOM.\n * Unlike `$effect`, the provided function only runs once.\n *\n * It must be called during the component's initialisation (but doesn't need to live _inside_ the component;\n * it can be called from an external module). If a function is returned _synchronously_ from `onMount`,\n * it will be called when the component is unmounted.\n *\n * `onMount` functions do not run during [server-side rendering](https://svelte.dev/docs/svelte/svelte-server#render).\n *\n * @template T\n * @param {() => NotFunction<T> | Promise<NotFunction<T>> | (() => any)} fn\n * @returns {void}\n */\nexport function onMount(fn) {\n\tif (component_context === null) {\n\t\te.lifecycle_outside_component('onMount');\n\t}\n\n\tif (legacy_mode_flag && component_context.l !== null) {\n\t\tinit_update_callbacks(component_context).m.push(fn);\n\t} else {\n\t\tuser_effect(() => {\n\t\t\tconst cleanup = untrack(fn);\n\t\t\tif (typeof cleanup === 'function') return /** @type {() => void} */ (cleanup);\n\t\t});\n\t}\n}\n\n/**\n * Schedules a callback to run immediately before the component is unmounted.\n *\n * Out of `onMount`, `beforeUpdate`, `afterUpdate` and `onDestroy`, this is the\n * only one that runs inside a server-side component.\n *\n * @param {() => any} fn\n * @returns {void}\n */\nexport function onDestroy(fn) {\n\tif (component_context === null) {\n\t\te.lifecycle_outside_component('onDestroy');\n\t}\n\n\tonMount(() => () => untrack(fn));\n}\n\n/**\n * @template [T=any]\n * @param {string} type\n * @param {T} [detail]\n * @param {any}params_0\n * @returns {CustomEvent<T>}\n */\nfunction create_custom_event(type, detail, { bubbles = false, cancelable = false } = {}) {\n\treturn new CustomEvent(type, { detail, bubbles, cancelable });\n}\n\n/**\n * Creates an event dispatcher that can be used to dispatch [component events](https://svelte.dev/docs/svelte/legacy-on#Component-events).\n * Event dispatchers are functions that can take two arguments: `name` and `detail`.\n *\n * Component events created with `createEventDispatcher` create a\n * [CustomEvent](https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent).\n * These events do not [bubble](https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Building_blocks/Events#Event_bubbling_and_capture).\n * The `detail` argument corresponds to the [CustomEvent.detail](https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/detail)\n * property and can contain any type of data.\n *\n * The event dispatcher can be typed to narrow the allowed event names and the type of the `detail` argument:\n * ```ts\n * const dispatch = createEventDispatcher<{\n * loaded: null; // does not take a detail argument\n * change: string; // takes a detail argument of type string, which is required\n * optional: number | null; // takes an optional detail argument of type number\n * }>();\n * ```\n *\n * @deprecated Use callback props and/or the `$host()` rune instead — see [migration guide](https://svelte.dev/docs/svelte/v5-migration-guide#Event-changes-Component-events)\n * @template {Record<string, any>} [EventMap = any]\n * @returns {EventDispatcher<EventMap>}\n */\nexport function createEventDispatcher() {\n\tconst active_component_context = component_context;\n\tif (active_component_context === null) {\n\t\te.lifecycle_outside_component('createEventDispatcher');\n\t}\n\n\t/**\n\t * @param [detail]\n\t * @param [options]\n\t */\n\treturn (type, detail, options) => {\n\t\tconst events = /** @type {Record<string, Function | Function[]>} */ (\n\t\t\tactive_component_context.s.$$events\n\t\t)?.[/** @type {string} */ (type)];\n\n\t\tif (events) {\n\t\t\tconst callbacks = is_array(events) ? events.slice() : [events];\n\t\t\t// TODO are there situations where events could be dispatched\n\t\t\t// in a server (non-DOM) environment?\n\t\t\tconst event = create_custom_event(/** @type {string} */ (type), detail, options);\n\t\t\tfor (const fn of callbacks) {\n\t\t\t\tfn.call(active_component_context.x, event);\n\t\t\t}\n\t\t\treturn !event.defaultPrevented;\n\t\t}\n\n\t\treturn true;\n\t};\n}\n\n// TODO mark beforeUpdate and afterUpdate as deprecated in Svelte 6\n\n/**\n * Schedules a callback to run immediately before the component is updated after any state change.\n *\n * The first time the callback runs will be before the initial `onMount`.\n *\n * In runes mode use `$effect.pre` instead.\n *\n * @deprecated Use [`$effect.pre`](https://svelte.dev/docs/svelte/$effect#$effect.pre) instead\n * @param {() => void} fn\n * @returns {void}\n */\nexport function beforeUpdate(fn) {\n\tif (component_context === null) {\n\t\te.lifecycle_outside_component('beforeUpdate');\n\t}\n\n\tif (component_context.l === null) {\n\t\te.lifecycle_legacy_only('beforeUpdate');\n\t}\n\n\tinit_update_callbacks(component_context).b.push(fn);\n}\n\n/**\n * Schedules a callback to run immediately after the component has been updated.\n *\n * The first time the callback runs will be after the initial `onMount`.\n *\n * In runes mode use `$effect` instead.\n *\n * @deprecated Use [`$effect`](https://svelte.dev/docs/svelte/$effect) instead\n * @param {() => void} fn\n * @returns {void}\n */\nexport function afterUpdate(fn) {\n\tif (component_context === null) {\n\t\te.lifecycle_outside_component('afterUpdate');\n\t}\n\n\tif (component_context.l === null) {\n\t\te.lifecycle_legacy_only('afterUpdate');\n\t}\n\n\tinit_update_callbacks(component_context).a.push(fn);\n}\n\n/**\n * Legacy-mode: Init callbacks object for onMount/beforeUpdate/afterUpdate\n * @param {ComponentContext} context\n */\nfunction init_update_callbacks(context) {\n\tvar l = /** @type {ComponentContextLegacy} */ (context).l;\n\treturn (l.u ??= { a: [], b: [], m: [] });\n}\n\nexport { flushSync, fork } from './internal/client/reactivity/batch.js';\nexport {\n\tcreateContext,\n\tgetContext,\n\tgetAllContexts,\n\thasContext,\n\tsetContext\n} from './internal/client/context.js';\nexport { hydratable } from './internal/client/hydratable.js';\nexport { hydrate, mount, unmount } from './internal/client/render.js';\nexport { tick, untrack, settled } from './internal/client/runtime.js';\nexport { createRawSnippet } from './internal/client/dom/blocks/snippet.js';\n","/** @import { TemplateNode } from '#client' */\nimport { EFFECT_TRANSPARENT } from '#client/constants';\nimport {\n\thydrate_next,\n\thydrating,\n\tread_hydration_instruction,\n\tskip_nodes,\n\tset_hydrate_node,\n\tset_hydrating,\n\thydrate_node\n} from '../hydration.js';\nimport { block } from '../../reactivity/effects.js';\nimport { BranchManager } from './branches.js';\n\n/**\n * @param {TemplateNode} node\n * @param {(branch: (fn: (anchor: Node) => void, key?: number | false) => void) => void} fn\n * @param {boolean} [elseif] True if this is an `{:else if ...}` block rather than an `{#if ...}`, as that affects which transitions are considered 'local'\n * @returns {void}\n */\nexport function if_block(node, fn, elseif = false) {\n\t/** @type {TemplateNode | undefined} */\n\tvar marker;\n\tif (hydrating) {\n\t\tmarker = hydrate_node;\n\t\thydrate_next();\n\t}\n\n\tvar branches = new BranchManager(node);\n\tvar flags = elseif ? EFFECT_TRANSPARENT : 0;\n\n\t/**\n\t * @param {number | false} key\n\t * @param {null | ((anchor: Node) => void)} fn\n\t */\n\tfunction update_branch(key, fn) {\n\t\tif (hydrating) {\n\t\t\tvar data = read_hydration_instruction(/** @type {TemplateNode} */ (marker));\n\n\t\t\t// \"[n\" = branch n, \"[-1\" = else\n\t\t\tif (key !== parseInt(data.substring(1))) {\n\t\t\t\t// Hydration mismatch: remove everything inside the anchor and start fresh.\n\t\t\t\t// This could happen with `{#if browser}...{/if}`, for example\n\t\t\t\tvar anchor = skip_nodes();\n\n\t\t\t\tset_hydrate_node(anchor);\n\t\t\t\tbranches.anchor = anchor;\n\n\t\t\t\tset_hydrating(false);\n\t\t\t\tbranches.ensure(key, fn);\n\t\t\t\tset_hydrating(true);\n\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tbranches.ensure(key, fn);\n\t}\n\n\tblock(() => {\n\t\tvar has_branch = false;\n\n\t\tfn((fn, key = 0) => {\n\t\t\thas_branch = true;\n\t\t\tupdate_branch(key, fn);\n\t\t});\n\n\t\tif (!has_branch) {\n\t\t\tupdate_branch(-1, null);\n\t\t}\n\t}, flags);\n}\n","/** @import { TemplateNode } from '#client' */\nimport { is_runes } from '../../context.js';\nimport { block } from '../../reactivity/effects.js';\nimport { hydrate_next, hydrating } from '../hydration.js';\nimport { BranchManager } from './branches.js';\n\nconst NAN = Symbol('NaN');\n\n/**\n * @template V\n * @param {TemplateNode} node\n * @param {() => V} get_key\n * @param {(anchor: Node) => TemplateNode | void} render_fn\n * @returns {void}\n */\nexport function key(node, get_key, render_fn) {\n\tif (hydrating) {\n\t\thydrate_next();\n\t}\n\n\tvar branches = new BranchManager(node);\n\n\tvar legacy = !is_runes();\n\n\tblock(() => {\n\t\tvar key = get_key();\n\n\t\t// NaN !== NaN, hence we do this workaround to not trigger remounts unnecessarily\n\t\tif (key !== key) {\n\t\t\tkey = /** @type {any} */ (NAN);\n\t\t}\n\n\t\t// key blocks in Svelte <5 had stupid semantics\n\t\tif (legacy && key !== null && typeof key === 'object') {\n\t\t\tkey = /** @type {V} */ ({});\n\t\t}\n\n\t\tbranches.ensure(key, render_fn);\n\t});\n}\n","/** @import { EachItem, EachOutroGroup, EachState, Effect, EffectNodes, MaybeSource, Source, TemplateNode, TransitionManager, Value } from '#client' */\n/** @import { Batch } from '../../reactivity/batch.js'; */\nimport {\n\tEACH_INDEX_REACTIVE,\n\tEACH_IS_ANIMATED,\n\tEACH_IS_CONTROLLED,\n\tEACH_ITEM_IMMUTABLE,\n\tEACH_ITEM_REACTIVE,\n\tHYDRATION_END,\n\tHYDRATION_START_ELSE\n} from '../../../../constants.js';\nimport {\n\thydrate_next,\n\thydrate_node,\n\thydrating,\n\tread_hydration_instruction,\n\tskip_nodes,\n\tset_hydrate_node,\n\tset_hydrating\n} from '../hydration.js';\nimport {\n\tclear_text_content,\n\tcreate_text,\n\tget_first_child,\n\tget_next_sibling,\n\tshould_defer_append\n} from '../operations.js';\nimport {\n\tblock,\n\tbranch,\n\tdestroy_effect,\n\tmove_effect,\n\tpause_effect,\n\tresume_effect\n} from '../../reactivity/effects.js';\nimport { source, mutable_source, internal_set } from '../../reactivity/sources.js';\nimport { array_from, is_array } from '../../../shared/utils.js';\nimport { BRANCH_EFFECT, COMMENT_NODE, DESTROYED, EFFECT_OFFSCREEN, INERT } from '#client/constants';\nimport { queue_micro_task } from '../task.js';\nimport { get } from '../../runtime.js';\nimport { DEV } from 'esm-env';\nimport { derived_safe_equal } from '../../reactivity/deriveds.js';\nimport { current_batch } from '../../reactivity/batch.js';\nimport * as e from '../../errors.js';\n\n// When making substantive changes to this file, validate them with the each block stress test:\n// https://svelte.dev/playground/1972b2cf46564476ad8c8c6405b23b7b\n// This test also exists in this repo, as `packages/svelte/tests/manual/each-stress-test`\n\n/**\n * @param {any} _\n * @param {number} i\n */\nexport function index(_, i) {\n\treturn i;\n}\n\n/**\n * Pause multiple effects simultaneously, and coordinate their\n * subsequent destruction. Used in each blocks\n * @param {EachState} state\n * @param {Effect[]} to_destroy\n * @param {null | Node} controlled_anchor\n */\nfunction pause_effects(state, to_destroy, controlled_anchor) {\n\t/** @type {TransitionManager[]} */\n\tvar transitions = [];\n\tvar length = to_destroy.length;\n\n\t/** @type {EachOutroGroup} */\n\tvar group;\n\tvar remaining = to_destroy.length;\n\n\tfor (var i = 0; i < length; i++) {\n\t\tlet effect = to_destroy[i];\n\n\t\tpause_effect(\n\t\t\teffect,\n\t\t\t() => {\n\t\t\t\tif (group) {\n\t\t\t\t\tgroup.pending.delete(effect);\n\t\t\t\t\tgroup.done.add(effect);\n\n\t\t\t\t\tif (group.pending.size === 0) {\n\t\t\t\t\t\tvar groups = /** @type {Set<EachOutroGroup>} */ (state.outrogroups);\n\n\t\t\t\t\t\tdestroy_effects(state, array_from(group.done));\n\t\t\t\t\t\tgroups.delete(group);\n\n\t\t\t\t\t\tif (groups.size === 0) {\n\t\t\t\t\t\t\tstate.outrogroups = null;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tremaining -= 1;\n\t\t\t\t}\n\t\t\t},\n\t\t\tfalse\n\t\t);\n\t}\n\n\tif (remaining === 0) {\n\t\t// If we're in a controlled each block (i.e. the block is the only child of an\n\t\t// element), and we are removing all items, _and_ there are no out transitions,\n\t\t// we can use the fast path — emptying the element and replacing the anchor\n\t\tvar fast_path = transitions.length === 0 && controlled_anchor !== null;\n\n\t\tif (fast_path) {\n\t\t\tvar anchor = /** @type {Element} */ (controlled_anchor);\n\t\t\tvar parent_node = /** @type {Element} */ (anchor.parentNode);\n\n\t\t\tclear_text_content(parent_node);\n\t\t\tparent_node.append(anchor);\n\n\t\t\tstate.items.clear();\n\t\t}\n\n\t\tdestroy_effects(state, to_destroy, !fast_path);\n\t} else {\n\t\tgroup = {\n\t\t\tpending: new Set(to_destroy),\n\t\t\tdone: new Set()\n\t\t};\n\n\t\t(state.outrogroups ??= new Set()).add(group);\n\t}\n}\n\n/**\n * @param {EachState} state\n * @param {Effect[]} to_destroy\n * @param {boolean} remove_dom\n */\nfunction destroy_effects(state, to_destroy, remove_dom = true) {\n\t/** @type {Set<Effect> | undefined} */\n\tvar preserved_effects;\n\n\t// The loop-in-a-loop isn't ideal, but we should only hit this in relatively rare cases\n\tif (state.pending.size > 0) {\n\t\tpreserved_effects = new Set();\n\n\t\tfor (const keys of state.pending.values()) {\n\t\t\tfor (const key of keys) {\n\t\t\t\tpreserved_effects.add(/** @type {EachItem} */ (state.items.get(key)).e);\n\t\t\t}\n\t\t}\n\t}\n\n\tfor (var i = 0; i < to_destroy.length; i++) {\n\t\tvar e = to_destroy[i];\n\n\t\tif (preserved_effects?.has(e)) {\n\t\t\te.f |= EFFECT_OFFSCREEN;\n\n\t\t\tconst fragment = document.createDocumentFragment();\n\t\t\tmove_effect(e, fragment);\n\t\t} else {\n\t\t\tdestroy_effect(to_destroy[i], remove_dom);\n\t\t}\n\t}\n}\n\n/** @type {TemplateNode} */\nvar offscreen_anchor;\n\n/**\n * @template V\n * @param {Element | Comment} node The next sibling node, or the parent node if this is a 'controlled' block\n * @param {number} flags\n * @param {() => V[]} get_collection\n * @param {(value: V, index: number) => any} get_key\n * @param {(anchor: Node, item: MaybeSource<V>, index: MaybeSource<number>) => void} render_fn\n * @param {null | ((anchor: Node) => void)} fallback_fn\n * @returns {void}\n */\nexport function each(node, flags, get_collection, get_key, render_fn, fallback_fn = null) {\n\tvar anchor = node;\n\n\t/** @type {Map<any, EachItem>} */\n\tvar items = new Map();\n\n\tvar is_controlled = (flags & EACH_IS_CONTROLLED) !== 0;\n\n\tif (is_controlled) {\n\t\tvar parent_node = /** @type {Element} */ (node);\n\n\t\tanchor = hydrating\n\t\t\t? set_hydrate_node(get_first_child(parent_node))\n\t\t\t: parent_node.appendChild(create_text());\n\t}\n\n\tif (hydrating) {\n\t\thydrate_next();\n\t}\n\n\t/** @type {Effect | null} */\n\tvar fallback = null;\n\n\t// TODO: ideally we could use derived for runes mode but because of the ability\n\t// to use a store which can be mutated, we can't do that here as mutating a store\n\t// will still result in the collection array being the same from the store\n\tvar each_array = derived_safe_equal(() => {\n\t\tvar collection = get_collection();\n\n\t\treturn is_array(collection) ? collection : collection == null ? [] : array_from(collection);\n\t});\n\n\t/** @type {V[]} */\n\tvar array;\n\n\t/** @type {Map<Batch, Set<any>>} */\n\tvar pending = new Map();\n\n\tvar first_run = true;\n\n\t/**\n\t * @param {Batch} batch\n\t */\n\tfunction commit(batch) {\n\t\tif ((state.effect.f & DESTROYED) !== 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tstate.pending.delete(batch);\n\n\t\tstate.fallback = fallback;\n\t\treconcile(state, array, anchor, flags, get_key);\n\n\t\tif (fallback !== null) {\n\t\t\tif (array.length === 0) {\n\t\t\t\tif ((fallback.f & EFFECT_OFFSCREEN) === 0) {\n\t\t\t\t\tresume_effect(fallback);\n\t\t\t\t} else {\n\t\t\t\t\tfallback.f ^= EFFECT_OFFSCREEN;\n\t\t\t\t\tmove(fallback, null, anchor);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tpause_effect(fallback, () => {\n\t\t\t\t\t// TODO only null out if no pending batch needs it,\n\t\t\t\t\t// otherwise re-add `fallback.fragment` and move the\n\t\t\t\t\t// effect into it\n\t\t\t\t\tfallback = null;\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * @param {Batch} batch\n\t */\n\tfunction discard(batch) {\n\t\tstate.pending.delete(batch);\n\t}\n\n\tvar effect = block(() => {\n\t\tarray = /** @type {V[]} */ (get(each_array));\n\t\tvar length = array.length;\n\n\t\t/** `true` if there was a hydration mismatch. Needs to be a `let` or else it isn't treeshaken out */\n\t\tlet mismatch = false;\n\n\t\tif (hydrating) {\n\t\t\tvar is_else = read_hydration_instruction(anchor) === HYDRATION_START_ELSE;\n\n\t\t\tif (is_else !== (length === 0)) {\n\t\t\t\t// hydration mismatch — remove the server-rendered DOM and start over\n\t\t\t\tanchor = skip_nodes();\n\n\t\t\t\tset_hydrate_node(anchor);\n\t\t\t\tset_hydrating(false);\n\t\t\t\tmismatch = true;\n\t\t\t}\n\t\t}\n\n\t\tvar keys = new Set();\n\t\tvar batch = /** @type {Batch} */ (current_batch);\n\t\tvar defer = should_defer_append();\n\n\t\tfor (var index = 0; index < length; index += 1) {\n\t\t\tif (\n\t\t\t\thydrating &&\n\t\t\t\thydrate_node.nodeType === COMMENT_NODE &&\n\t\t\t\t/** @type {Comment} */ (hydrate_node).data === HYDRATION_END\n\t\t\t) {\n\t\t\t\t// The server rendered fewer items than expected,\n\t\t\t\t// so break out and continue appending non-hydrated items\n\t\t\t\tanchor = /** @type {Comment} */ (hydrate_node);\n\t\t\t\tmismatch = true;\n\t\t\t\tset_hydrating(false);\n\t\t\t}\n\n\t\t\tvar value = array[index];\n\t\t\tvar key = get_key(value, index);\n\n\t\t\tif (DEV) {\n\t\t\t\t// Check that the key function is idempotent (returns the same value when called twice)\n\t\t\t\tvar key_again = get_key(value, index);\n\t\t\t\tif (key !== key_again) {\n\t\t\t\t\te.each_key_volatile(String(index), String(key), String(key_again));\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tvar item = first_run ? null : items.get(key);\n\n\t\t\tif (item) {\n\t\t\t\t// update before reconciliation, to trigger any async updates\n\t\t\t\tif (item.v) internal_set(item.v, value);\n\t\t\t\tif (item.i) internal_set(item.i, index);\n\n\t\t\t\tif (defer) {\n\t\t\t\t\tbatch.unskip_effect(item.e);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\titem = create_item(\n\t\t\t\t\titems,\n\t\t\t\t\tfirst_run ? anchor : (offscreen_anchor ??= create_text()),\n\t\t\t\t\tvalue,\n\t\t\t\t\tkey,\n\t\t\t\t\tindex,\n\t\t\t\t\trender_fn,\n\t\t\t\t\tflags,\n\t\t\t\t\tget_collection\n\t\t\t\t);\n\n\t\t\t\tif (!first_run) {\n\t\t\t\t\titem.e.f |= EFFECT_OFFSCREEN;\n\t\t\t\t}\n\n\t\t\t\titems.set(key, item);\n\t\t\t}\n\n\t\t\tkeys.add(key);\n\t\t}\n\n\t\tif (length === 0 && fallback_fn && !fallback) {\n\t\t\tif (first_run) {\n\t\t\t\tfallback = branch(() => fallback_fn(anchor));\n\t\t\t} else {\n\t\t\t\tfallback = branch(() => fallback_fn((offscreen_anchor ??= create_text())));\n\t\t\t\tfallback.f |= EFFECT_OFFSCREEN;\n\t\t\t}\n\t\t}\n\n\t\tif (length > keys.size) {\n\t\t\tif (DEV) {\n\t\t\t\tvalidate_each_keys(array, get_key);\n\t\t\t} else {\n\t\t\t\t// in prod, the additional information isn't printed, so don't bother computing it\n\t\t\t\te.each_key_duplicate('', '', '');\n\t\t\t}\n\t\t}\n\n\t\t// remove excess nodes\n\t\tif (hydrating && length > 0) {\n\t\t\tset_hydrate_node(skip_nodes());\n\t\t}\n\n\t\tif (!first_run) {\n\t\t\tpending.set(batch, keys);\n\n\t\t\tif (defer) {\n\t\t\t\tfor (const [key, item] of items) {\n\t\t\t\t\tif (!keys.has(key)) {\n\t\t\t\t\t\tbatch.skip_effect(item.e);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tbatch.oncommit(commit);\n\t\t\t\tbatch.ondiscard(discard);\n\t\t\t} else {\n\t\t\t\tcommit(batch);\n\t\t\t}\n\t\t}\n\n\t\tif (mismatch) {\n\t\t\t// continue in hydration mode\n\t\t\tset_hydrating(true);\n\t\t}\n\n\t\t// When we mount the each block for the first time, the collection won't be\n\t\t// connected to this effect as the effect hasn't finished running yet and its deps\n\t\t// won't be assigned. However, it's possible that when reconciling the each block\n\t\t// that a mutation occurred and it's made the collection MAYBE_DIRTY, so reading the\n\t\t// collection again can provide consistency to the reactive graph again as the deriveds\n\t\t// will now be `CLEAN`.\n\t\tget(each_array);\n\t});\n\n\t/** @type {EachState} */\n\tvar state = { effect, flags, items, pending, outrogroups: null, fallback };\n\n\tfirst_run = false;\n\n\tif (hydrating) {\n\t\tanchor = hydrate_node;\n\t}\n}\n\n/**\n * Skip past any non-branch effects (which could be created with `createSubscriber`, for example) to find the next branch effect\n * @param {Effect | null} effect\n * @returns {Effect | null}\n */\nfunction skip_to_branch(effect) {\n\twhile (effect !== null && (effect.f & BRANCH_EFFECT) === 0) {\n\t\teffect = effect.next;\n\t}\n\treturn effect;\n}\n\n/**\n * Add, remove, or reorder items output by an each block as its input changes\n * @template V\n * @param {EachState} state\n * @param {Array<V>} array\n * @param {Element | Comment | Text} anchor\n * @param {number} flags\n * @param {(value: V, index: number) => any} get_key\n * @returns {void}\n */\nfunction reconcile(state, array, anchor, flags, get_key) {\n\tvar is_animated = (flags & EACH_IS_ANIMATED) !== 0;\n\n\tvar length = array.length;\n\tvar items = state.items;\n\tvar current = skip_to_branch(state.effect.first);\n\n\t/** @type {undefined | Set<Effect>} */\n\tvar seen;\n\n\t/** @type {Effect | null} */\n\tvar prev = null;\n\n\t/** @type {undefined | Set<Effect>} */\n\tvar to_animate;\n\n\t/** @type {Effect[]} */\n\tvar matched = [];\n\n\t/** @type {Effect[]} */\n\tvar stashed = [];\n\n\t/** @type {V} */\n\tvar value;\n\n\t/** @type {any} */\n\tvar key;\n\n\t/** @type {Effect | undefined} */\n\tvar effect;\n\n\t/** @type {number} */\n\tvar i;\n\n\tif (is_animated) {\n\t\tfor (i = 0; i < length; i += 1) {\n\t\t\tvalue = array[i];\n\t\t\tkey = get_key(value, i);\n\t\t\teffect = /** @type {EachItem} */ (items.get(key)).e;\n\n\t\t\t// offscreen == coming in now, no animation in that case,\n\t\t\t// else this would happen https://github.com/sveltejs/svelte/issues/17181\n\t\t\tif ((effect.f & EFFECT_OFFSCREEN) === 0) {\n\t\t\t\teffect.nodes?.a?.measure();\n\t\t\t\t(to_animate ??= new Set()).add(effect);\n\t\t\t}\n\t\t}\n\t}\n\n\tfor (i = 0; i < length; i += 1) {\n\t\tvalue = array[i];\n\t\tkey = get_key(value, i);\n\n\t\teffect = /** @type {EachItem} */ (items.get(key)).e;\n\n\t\tif (state.outrogroups !== null) {\n\t\t\tfor (const group of state.outrogroups) {\n\t\t\t\tgroup.pending.delete(effect);\n\t\t\t\tgroup.done.delete(effect);\n\t\t\t}\n\t\t}\n\n\t\tif ((effect.f & INERT) !== 0) {\n\t\t\tresume_effect(effect);\n\t\t\tif (is_animated) {\n\t\t\t\teffect.nodes?.a?.unfix();\n\t\t\t\t(to_animate ??= new Set()).delete(effect);\n\t\t\t}\n\t\t}\n\n\t\tif ((effect.f & EFFECT_OFFSCREEN) !== 0) {\n\t\t\teffect.f ^= EFFECT_OFFSCREEN;\n\n\t\t\tif (effect === current) {\n\t\t\t\tmove(effect, null, anchor);\n\t\t\t} else {\n\t\t\t\tvar next = prev ? prev.next : current;\n\n\t\t\t\tif (effect === state.effect.last) {\n\t\t\t\t\tstate.effect.last = effect.prev;\n\t\t\t\t}\n\n\t\t\t\tif (effect.prev) effect.prev.next = effect.next;\n\t\t\t\tif (effect.next) effect.next.prev = effect.prev;\n\t\t\t\tlink(state, prev, effect);\n\t\t\t\tlink(state, effect, next);\n\n\t\t\t\tmove(effect, next, anchor);\n\t\t\t\tprev = effect;\n\n\t\t\t\tmatched = [];\n\t\t\t\tstashed = [];\n\n\t\t\t\tcurrent = skip_to_branch(prev.next);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\n\t\tif (effect !== current) {\n\t\t\tif (seen !== undefined && seen.has(effect)) {\n\t\t\t\tif (matched.length < stashed.length) {\n\t\t\t\t\t// more efficient to move later items to the front\n\t\t\t\t\tvar start = stashed[0];\n\t\t\t\t\tvar j;\n\n\t\t\t\t\tprev = start.prev;\n\n\t\t\t\t\tvar a = matched[0];\n\t\t\t\t\tvar b = matched[matched.length - 1];\n\n\t\t\t\t\tfor (j = 0; j < matched.length; j += 1) {\n\t\t\t\t\t\tmove(matched[j], start, anchor);\n\t\t\t\t\t}\n\n\t\t\t\t\tfor (j = 0; j < stashed.length; j += 1) {\n\t\t\t\t\t\tseen.delete(stashed[j]);\n\t\t\t\t\t}\n\n\t\t\t\t\tlink(state, a.prev, b.next);\n\t\t\t\t\tlink(state, prev, a);\n\t\t\t\t\tlink(state, b, start);\n\n\t\t\t\t\tcurrent = start;\n\t\t\t\t\tprev = b;\n\t\t\t\t\ti -= 1;\n\n\t\t\t\t\tmatched = [];\n\t\t\t\t\tstashed = [];\n\t\t\t\t} else {\n\t\t\t\t\t// more efficient to move earlier items to the back\n\t\t\t\t\tseen.delete(effect);\n\t\t\t\t\tmove(effect, current, anchor);\n\n\t\t\t\t\tlink(state, effect.prev, effect.next);\n\t\t\t\t\tlink(state, effect, prev === null ? state.effect.first : prev.next);\n\t\t\t\t\tlink(state, prev, effect);\n\n\t\t\t\t\tprev = effect;\n\t\t\t\t}\n\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tmatched = [];\n\t\t\tstashed = [];\n\n\t\t\twhile (current !== null && current !== effect) {\n\t\t\t\t(seen ??= new Set()).add(current);\n\t\t\t\tstashed.push(current);\n\t\t\t\tcurrent = skip_to_branch(current.next);\n\t\t\t}\n\n\t\t\tif (current === null) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\n\t\tif ((effect.f & EFFECT_OFFSCREEN) === 0) {\n\t\t\tmatched.push(effect);\n\t\t}\n\n\t\tprev = effect;\n\t\tcurrent = skip_to_branch(effect.next);\n\t}\n\n\tif (state.outrogroups !== null) {\n\t\tfor (const group of state.outrogroups) {\n\t\t\tif (group.pending.size === 0) {\n\t\t\t\tdestroy_effects(state, array_from(group.done));\n\t\t\t\tstate.outrogroups?.delete(group);\n\t\t\t}\n\t\t}\n\n\t\tif (state.outrogroups.size === 0) {\n\t\t\tstate.outrogroups = null;\n\t\t}\n\t}\n\n\tif (current !== null || seen !== undefined) {\n\t\t/** @type {Effect[]} */\n\t\tvar to_destroy = [];\n\n\t\tif (seen !== undefined) {\n\t\t\tfor (effect of seen) {\n\t\t\t\tif ((effect.f & INERT) === 0) {\n\t\t\t\t\tto_destroy.push(effect);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\twhile (current !== null) {\n\t\t\t// If the each block isn't inert, then inert effects are currently outroing and will be removed once the transition is finished\n\t\t\tif ((current.f & INERT) === 0 && current !== state.fallback) {\n\t\t\t\tto_destroy.push(current);\n\t\t\t}\n\n\t\t\tcurrent = skip_to_branch(current.next);\n\t\t}\n\n\t\tvar destroy_length = to_destroy.length;\n\n\t\tif (destroy_length > 0) {\n\t\t\tvar controlled_anchor = (flags & EACH_IS_CONTROLLED) !== 0 && length === 0 ? anchor : null;\n\n\t\t\tif (is_animated) {\n\t\t\t\tfor (i = 0; i < destroy_length; i += 1) {\n\t\t\t\t\tto_destroy[i].nodes?.a?.measure();\n\t\t\t\t}\n\n\t\t\t\tfor (i = 0; i < destroy_length; i += 1) {\n\t\t\t\t\tto_destroy[i].nodes?.a?.fix();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tpause_effects(state, to_destroy, controlled_anchor);\n\t\t}\n\t}\n\n\tif (is_animated) {\n\t\tqueue_micro_task(() => {\n\t\t\tif (to_animate === undefined) return;\n\t\t\tfor (effect of to_animate) {\n\t\t\t\teffect.nodes?.a?.apply();\n\t\t\t}\n\t\t});\n\t}\n}\n\n/**\n * @template V\n * @param {Map<any, EachItem>} items\n * @param {Node} anchor\n * @param {V} value\n * @param {unknown} key\n * @param {number} index\n * @param {(anchor: Node, item: V | Source<V>, index: number | Value<number>, collection: () => V[]) => void} render_fn\n * @param {number} flags\n * @param {() => V[]} get_collection\n * @returns {EachItem}\n */\nfunction create_item(items, anchor, value, key, index, render_fn, flags, get_collection) {\n\tvar v =\n\t\t(flags & EACH_ITEM_REACTIVE) !== 0\n\t\t\t? (flags & EACH_ITEM_IMMUTABLE) === 0\n\t\t\t\t? mutable_source(value, false, false)\n\t\t\t\t: source(value)\n\t\t\t: null;\n\n\tvar i = (flags & EACH_INDEX_REACTIVE) !== 0 ? source(index) : null;\n\n\tif (DEV && v) {\n\t\t// For tracing purposes, we need to link the source signal we create with the\n\t\t// collection + index so that tracing works as intended\n\t\tv.trace = () => {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unused-expressions\n\t\t\tget_collection()[i?.v ?? index];\n\t\t};\n\t}\n\n\treturn {\n\t\tv,\n\t\ti,\n\t\te: branch(() => {\n\t\t\trender_fn(anchor, v ?? value, i ?? index, get_collection);\n\n\t\t\treturn () => {\n\t\t\t\titems.delete(key);\n\t\t\t};\n\t\t})\n\t};\n}\n\n/**\n * @param {Effect} effect\n * @param {Effect | null} next\n * @param {Text | Element | Comment} anchor\n */\nfunction move(effect, next, anchor) {\n\tif (!effect.nodes) return;\n\n\tvar node = effect.nodes.start;\n\tvar end = effect.nodes.end;\n\n\tvar dest =\n\t\tnext && (next.f & EFFECT_OFFSCREEN) === 0\n\t\t\t? /** @type {EffectNodes} */ (next.nodes).start\n\t\t\t: anchor;\n\n\twhile (node !== null) {\n\t\tvar next_node = /** @type {TemplateNode} */ (get_next_sibling(node));\n\t\tdest.before(node);\n\n\t\tif (node === end) {\n\t\t\treturn;\n\t\t}\n\n\t\tnode = next_node;\n\t}\n}\n\n/**\n * @param {EachState} state\n * @param {Effect | null} prev\n * @param {Effect | null} next\n */\nfunction link(state, prev, next) {\n\tif (prev === null) {\n\t\tstate.effect.first = next;\n\t} else {\n\t\tprev.next = next;\n\t}\n\n\tif (next === null) {\n\t\tstate.effect.last = prev;\n\t} else {\n\t\tnext.prev = prev;\n\t}\n}\n\n/**\n * @param {Array<any>} array\n * @param {(item: any, index: number) => string} key_fn\n * @returns {void}\n */\nfunction validate_each_keys(array, key_fn) {\n\tconst keys = new Map();\n\tconst length = array.length;\n\n\tfor (let i = 0; i < length; i++) {\n\t\tconst key = key_fn(array[i], i);\n\n\t\tif (keys.has(key)) {\n\t\t\tconst a = String(keys.get(key));\n\t\t\tconst b = String(i);\n\n\t\t\t/** @type {string | null} */\n\t\t\tlet k = String(key);\n\t\t\tif (k.startsWith('[object ')) k = null;\n\n\t\t\te.each_key_duplicate(a, b, k);\n\t\t}\n\n\t\tkeys.set(key, i);\n\t}\n}\n","/** @import { Effect, TemplateNode } from '#client' */\n/** @import {} from 'trusted-types' */\nimport {\n\tFILENAME,\n\tHYDRATION_ERROR,\n\tNAMESPACE_SVG,\n\tNAMESPACE_MATHML\n} from '../../../../constants.js';\nimport { remove_effect_dom, template_effect } from '../../reactivity/effects.js';\nimport { hydrate_next, hydrate_node, hydrating, set_hydrate_node } from '../hydration.js';\n\nimport { assign_nodes } from '../template.js';\nimport * as w from '../../warnings.js';\nimport { hash, sanitize_location } from '../../../../utils.js';\nimport { DEV } from 'esm-env';\nimport { dev_current_component_function } from '../../context.js';\nimport { create_element, get_first_child, get_next_sibling } from '../operations.js';\nimport { active_effect } from '../../runtime.js';\nimport { COMMENT_NODE } from '#client/constants';\n\n/**\n * @param {Element} element\n * @param {string | null} server_hash\n * @param {string | TrustedHTML} value\n */\nfunction check_hash(element, server_hash, value) {\n\tif (!server_hash || server_hash === hash(String(value ?? ''))) return;\n\n\tlet location;\n\n\t// @ts-expect-error\n\tconst loc = element.__svelte_meta?.loc;\n\tif (loc) {\n\t\tlocation = `near ${loc.file}:${loc.line}:${loc.column}`;\n\t} else if (dev_current_component_function?.[FILENAME]) {\n\t\tlocation = `in ${dev_current_component_function[FILENAME]}`;\n\t}\n\n\tw.hydration_html_changed(sanitize_location(location));\n}\n\n/**\n * @param {Element | Text | Comment} node\n * @param {() => string | TrustedHTML} get_value\n * @param {boolean} [is_controlled]\n * @param {boolean} [svg]\n * @param {boolean} [mathml]\n * @param {boolean} [skip_warning]\n * @returns {void}\n */\nexport function html(\n\tnode,\n\tget_value,\n\tis_controlled = false,\n\tsvg = false,\n\tmathml = false,\n\tskip_warning = false\n) {\n\tvar anchor = node;\n\n\t/** @type {string | TrustedHTML} */\n\tvar value = '';\n\n\tif (is_controlled) {\n\t\tvar parent_node = /** @type {Element} */ (node);\n\n\t\tif (hydrating) {\n\t\t\tanchor = set_hydrate_node(get_first_child(parent_node));\n\t\t}\n\t}\n\n\ttemplate_effect(() => {\n\t\tvar effect = /** @type {Effect} */ (active_effect);\n\n\t\tif (value === (value = get_value() ?? '')) {\n\t\t\tif (hydrating) hydrate_next();\n\t\t\treturn;\n\t\t}\n\n\t\tif (is_controlled && !hydrating) {\n\t\t\t// When @html is the only child, use innerHTML directly.\n\t\t\t// This also handles contenteditable, where the user may delete the anchor comment.\n\t\t\teffect.nodes = null;\n\t\t\tparent_node.innerHTML = /** @type {string} */ (value);\n\n\t\t\tif (value !== '') {\n\t\t\t\tassign_nodes(\n\t\t\t\t\t/** @type {TemplateNode} */ (get_first_child(parent_node)),\n\t\t\t\t\t/** @type {TemplateNode} */ (parent_node.lastChild)\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn;\n\t\t}\n\n\t\tif (effect.nodes !== null) {\n\t\t\tremove_effect_dom(effect.nodes.start, /** @type {TemplateNode} */ (effect.nodes.end));\n\t\t\teffect.nodes = null;\n\t\t}\n\n\t\tif (value === '') return;\n\n\t\tif (hydrating) {\n\t\t\t// We're deliberately not trying to repair mismatches between server and client,\n\t\t\t// as it's costly and error-prone (and it's an edge case to have a mismatch anyway)\n\t\t\tvar hash = /** @type {Comment} */ (hydrate_node).data;\n\n\t\t\t/** @type {TemplateNode | null} */\n\t\t\tvar next = hydrate_next();\n\t\t\tvar last = next;\n\n\t\t\twhile (\n\t\t\t\tnext !== null &&\n\t\t\t\t(next.nodeType !== COMMENT_NODE || /** @type {Comment} */ (next).data !== '')\n\t\t\t) {\n\t\t\t\tlast = next;\n\t\t\t\tnext = get_next_sibling(next);\n\t\t\t}\n\n\t\t\tif (next === null) {\n\t\t\t\tw.hydration_mismatch();\n\t\t\t\tthrow HYDRATION_ERROR;\n\t\t\t}\n\n\t\t\tif (DEV && !skip_warning) {\n\t\t\t\tcheck_hash(/** @type {Element} */ (next.parentNode), hash, value);\n\t\t\t}\n\n\t\t\tassign_nodes(hydrate_node, last);\n\t\t\tanchor = set_hydrate_node(next);\n\t\t\treturn;\n\t\t}\n\n\t\t// Don't use create_fragment_with_script_from_html here because that would mean script tags are executed.\n\t\t// @html is basically `.innerHTML = ...` and that doesn't execute scripts either due to security reasons.\n\t\t// Use a <template>, <svg>, or <math> wrapper depending on context. If value is a TrustedHTML object,\n\t\t// it will be assigned directly to innerHTML without coercion — this allows {@html policy.createHTML(...)} to work.\n\t\tvar ns = svg ? NAMESPACE_SVG : mathml ? NAMESPACE_MATHML : undefined;\n\t\tvar wrapper = /** @type {HTMLTemplateElement | SVGElement | MathMLElement} */ (\n\t\t\tcreate_element(svg ? 'svg' : mathml ? 'math' : 'template', ns)\n\t\t);\n\t\twrapper.innerHTML = /** @type {any} */ (value);\n\n\t\t/** @type {DocumentFragment | Element} */\n\t\tvar node = svg || mathml ? wrapper : /** @type {HTMLTemplateElement} */ (wrapper).content;\n\n\t\tassign_nodes(\n\t\t\t/** @type {TemplateNode} */ (get_first_child(node)),\n\t\t\t/** @type {TemplateNode} */ (node.lastChild)\n\t\t);\n\n\t\tif (svg || mathml) {\n\t\t\twhile (get_first_child(node)) {\n\t\t\t\tanchor.before(/** @type {TemplateNode} */ (get_first_child(node)));\n\t\t\t}\n\t\t} else {\n\t\t\tanchor.before(node);\n\t\t}\n\t});\n}\n","import { hydrate_next, hydrating } from '../hydration.js';\n\n/**\n * @param {Comment} anchor\n * @param {Record<string, any>} $$props\n * @param {string} name\n * @param {Record<string, unknown>} slot_props\n * @param {null | ((anchor: Comment) => void)} fallback_fn\n */\nexport function slot(anchor, $$props, name, slot_props, fallback_fn) {\n\tif (hydrating) {\n\t\thydrate_next();\n\t}\n\n\tvar slot_fn = $$props.$$slots?.[name];\n\t// Interop: Can use snippets to fill slots\n\tvar is_interop = false;\n\tif (slot_fn === true) {\n\t\tslot_fn = $$props[name === 'default' ? 'children' : name];\n\t\tis_interop = true;\n\t}\n\n\tif (slot_fn === undefined) {\n\t\tif (fallback_fn !== null) {\n\t\t\tfallback_fn(anchor);\n\t\t}\n\t} else {\n\t\tslot_fn(anchor, is_interop ? () => slot_props : slot_props);\n\t}\n}\n\n/**\n * @param {Record<string, any>} props\n * @returns {Record<string, boolean>}\n */\nexport function sanitize_slots(props) {\n\t/** @type {Record<string, boolean>} */\n\tconst sanitized = {};\n\tif (props.children) sanitized.default = true;\n\tfor (const key in props.$$slots) {\n\t\tsanitized[key] = true;\n\t}\n\treturn sanitized;\n}\n","/** @import { TemplateNode, Dom } from '#client' */\nimport { EFFECT_TRANSPARENT } from '#client/constants';\nimport { block } from '../../reactivity/effects.js';\nimport {\n\thydrate_next,\n\thydrate_node,\n\thydrating,\n\tread_hydration_instruction,\n\tset_hydrate_node,\n\tset_hydrating,\n\tskip_nodes\n} from '../hydration.js';\nimport { BranchManager } from './branches.js';\nimport { HYDRATION_START, HYDRATION_START_ELSE } from '../../../../constants.js';\n\n/**\n * @template P\n * @template {(props: P) => void} C\n * @param {TemplateNode} node\n * @param {() => C} get_component\n * @param {(anchor: TemplateNode, component: C) => Dom | void} render_fn\n * @returns {void}\n */\nexport function component(node, get_component, render_fn) {\n\t/** @type {TemplateNode | undefined} */\n\tvar hydration_start_node;\n\n\tif (hydrating) {\n\t\thydration_start_node = hydrate_node;\n\t\thydrate_next();\n\t}\n\n\tvar branches = new BranchManager(node);\n\n\tblock(() => {\n\t\tvar component = get_component() ?? null;\n\n\t\tif (hydrating) {\n\t\t\tvar data = read_hydration_instruction(/** @type {TemplateNode} */ (hydration_start_node));\n\n\t\t\tvar server_had_component = data === HYDRATION_START;\n\t\t\tvar client_has_component = component !== null;\n\n\t\t\tif (server_had_component !== client_has_component) {\n\t\t\t\t// Hydration mismatch: skip the server-rendered nodes and render fresh\n\t\t\t\tvar anchor = skip_nodes();\n\n\t\t\t\tset_hydrate_node(anchor);\n\t\t\t\tbranches.anchor = anchor;\n\n\t\t\t\tset_hydrating(false);\n\t\t\t\tbranches.ensure(component, component && ((target) => render_fn(target, component)));\n\t\t\t\tset_hydrating(true);\n\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tbranches.ensure(component, component && ((target) => render_fn(target, component)));\n\t}, EFFECT_TRANSPARENT);\n}\n","/** @import { ActionPayload } from '#client' */\nimport { effect, render_effect } from '../../reactivity/effects.js';\nimport { safe_not_equal } from '../../reactivity/equality.js';\nimport { deep_read_state, untrack } from '../../runtime.js';\n\n/**\n * @template P\n * @param {Element} dom\n * @param {(dom: Element, value?: P) => ActionPayload<P>} action\n * @param {() => P} [get_value]\n * @returns {void}\n */\nexport function action(dom, action, get_value) {\n\teffect(() => {\n\t\tvar payload = untrack(() => action(dom, get_value?.()) || {});\n\n\t\tif (get_value && payload?.update) {\n\t\t\tvar inited = false;\n\t\t\t/** @type {P} */\n\t\t\tvar prev = /** @type {any} */ ({}); // initialize with something so it's never equal on first run\n\n\t\t\trender_effect(() => {\n\t\t\t\tvar value = get_value();\n\n\t\t\t\t// Action's update method is coarse-grained, i.e. when anything in the passed value changes, update.\n\t\t\t\t// This works in legacy mode because of mutable_source being updated as a whole, but when using $state\n\t\t\t\t// together with actions and mutation, it wouldn't notice the change without a deep read.\n\t\t\t\tdeep_read_state(value);\n\n\t\t\t\tif (inited && safe_not_equal(prev, value)) {\n\t\t\t\t\tprev = value;\n\t\t\t\t\t/** @type {Function} */ (payload.update)(value);\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tinited = true;\n\t\t}\n\n\t\tif (payload?.destroy) {\n\t\t\treturn () => /** @type {Function} */ (payload.destroy)();\n\t\t}\n\t});\n}\n","/** @import { Effect } from '#client' */\nimport { branch, effect, destroy_effect, managed } from '../../reactivity/effects.js';\n\n// TODO in 6.0 or 7.0, when we remove legacy mode, we can simplify this by\n// getting rid of the block/branch stuff and just letting the effect rip.\n// see https://github.com/sveltejs/svelte/pull/15962\n\n/**\n * @param {Element} node\n * @param {() => (node: Element) => void} get_fn\n */\nexport function attach(node, get_fn) {\n\t/** @type {false | undefined | ((node: Element) => void)} */\n\tvar fn = undefined;\n\n\t/** @type {Effect | null} */\n\tvar e;\n\n\tmanaged(() => {\n\t\tif (fn !== (fn = get_fn())) {\n\t\t\tif (e) {\n\t\t\t\tdestroy_effect(e);\n\t\t\t\te = null;\n\t\t\t}\n\n\t\t\tif (fn) {\n\t\t\t\te = branch(() => {\n\t\t\t\t\teffect(() => /** @type {(node: Element) => void} */ (fn)(node));\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t});\n}\n","function r(e){var t,f,n=\"\";if(\"string\"==typeof e||\"number\"==typeof e)n+=e;else if(\"object\"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=\" \"),n+=f)}else for(f in e)e[f]&&(n&&(n+=\" \"),n+=f);return n}export function clsx(){for(var e,t,f=0,n=\"\",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=r(e))&&(n&&(n+=\" \"),n+=t);return n}export default clsx;","import { escape_html } from '../../escaping.js';\nimport { clsx as _clsx } from 'clsx';\nimport { has_own_property } from './utils.js';\n\n/**\n * `<div translate={false}>` should be rendered as `<div translate=\"no\">` and _not_\n * `<div translate=\"false\">`, which is equivalent to `<div translate=\"yes\">`. There\n * may be other odd cases that need to be added to this list in future\n * @type {Record<string, Map<any, string>>}\n */\nconst replacements = {\n\ttranslate: new Map([\n\t\t[true, 'yes'],\n\t\t[false, 'no']\n\t])\n};\n\n/**\n * @template V\n * @param {string} name\n * @param {V} value\n * @param {boolean} [is_boolean]\n * @returns {string}\n */\nexport function attr(name, value, is_boolean = false) {\n\t// attribute hidden for values other than \"until-found\" behaves like a boolean attribute\n\tif (name === 'hidden' && value !== 'until-found') {\n\t\tis_boolean = true;\n\t}\n\tif (value == null || (!value && is_boolean)) return '';\n\tconst normalized =\n\t\t(has_own_property.call(replacements, name) && replacements[name].get(value)) || value;\n\tconst assignment = is_boolean ? `=\"\"` : `=\"${escape_html(normalized, true)}\"`;\n\treturn ` ${name}${assignment}`;\n}\n\n/**\n * Small wrapper around clsx to preserve Svelte's (weird) handling of falsy values.\n * TODO Svelte 6 revisit this, and likely turn all falsy values into the empty string (what clsx also does)\n * @param {any} value\n */\nexport function clsx(value) {\n\tif (typeof value === 'object') {\n\t\treturn _clsx(value);\n\t} else {\n\t\treturn value ?? '';\n\t}\n}\n\nconst whitespace = [...' \\t\\n\\r\\f\\u00a0\\u000b\\ufeff'];\n\n/**\n * @param {any} value\n * @param {string | null} [hash]\n * @param {Record<string, boolean>} [directives]\n * @returns {string | null}\n */\nexport function to_class(value, hash, directives) {\n\tvar classname = value == null ? '' : '' + value;\n\n\tif (hash) {\n\t\tclassname = classname ? classname + ' ' + hash : hash;\n\t}\n\n\tif (directives) {\n\t\tfor (var key of Object.keys(directives)) {\n\t\t\tif (directives[key]) {\n\t\t\t\tclassname = classname ? classname + ' ' + key : key;\n\t\t\t} else if (classname.length) {\n\t\t\t\tvar len = key.length;\n\t\t\t\tvar a = 0;\n\n\t\t\t\twhile ((a = classname.indexOf(key, a)) >= 0) {\n\t\t\t\t\tvar b = a + len;\n\n\t\t\t\t\tif (\n\t\t\t\t\t\t(a === 0 || whitespace.includes(classname[a - 1])) &&\n\t\t\t\t\t\t(b === classname.length || whitespace.includes(classname[b]))\n\t\t\t\t\t) {\n\t\t\t\t\t\tclassname = (a === 0 ? '' : classname.substring(0, a)) + classname.substring(b + 1);\n\t\t\t\t\t} else {\n\t\t\t\t\t\ta = b;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn classname === '' ? null : classname;\n}\n\n/**\n *\n * @param {Record<string,any>} styles\n * @param {boolean} important\n */\nfunction append_styles(styles, important = false) {\n\tvar separator = important ? ' !important;' : ';';\n\tvar css = '';\n\n\tfor (var key of Object.keys(styles)) {\n\t\tvar value = styles[key];\n\t\tif (value != null && value !== '') {\n\t\t\tcss += ' ' + key + ': ' + value + separator;\n\t\t}\n\t}\n\n\treturn css;\n}\n\n/**\n * @param {string} name\n * @returns {string}\n */\nfunction to_css_name(name) {\n\tif (name[0] !== '-' || name[1] !== '-') {\n\t\treturn name.toLowerCase();\n\t}\n\treturn name;\n}\n\n/**\n * @param {any} value\n * @param {Record<string, any> | [Record<string, any>, Record<string, any>]} [styles]\n * @returns {string | null}\n */\nexport function to_style(value, styles) {\n\tif (styles) {\n\t\tvar new_style = '';\n\n\t\t/** @type {Record<string,any> | undefined} */\n\t\tvar normal_styles;\n\n\t\t/** @type {Record<string,any> | undefined} */\n\t\tvar important_styles;\n\n\t\tif (Array.isArray(styles)) {\n\t\t\tnormal_styles = styles[0];\n\t\t\timportant_styles = styles[1];\n\t\t} else {\n\t\t\tnormal_styles = styles;\n\t\t}\n\n\t\tif (value) {\n\t\t\tvalue = String(value)\n\t\t\t\t.replaceAll(/\\s*\\/\\*.*?\\*\\/\\s*/g, '')\n\t\t\t\t.trim();\n\n\t\t\t/** @type {boolean | '\"' | \"'\"} */\n\t\t\tvar in_str = false;\n\t\t\tvar in_apo = 0;\n\t\t\tvar in_comment = false;\n\n\t\t\tvar reserved_names = [];\n\n\t\t\tif (normal_styles) {\n\t\t\t\treserved_names.push(...Object.keys(normal_styles).map(to_css_name));\n\t\t\t}\n\t\t\tif (important_styles) {\n\t\t\t\treserved_names.push(...Object.keys(important_styles).map(to_css_name));\n\t\t\t}\n\n\t\t\tvar start_index = 0;\n\t\t\tvar name_index = -1;\n\n\t\t\tconst len = value.length;\n\t\t\tfor (var i = 0; i < len; i++) {\n\t\t\t\tvar c = value[i];\n\n\t\t\t\tif (in_comment) {\n\t\t\t\t\tif (c === '/' && value[i - 1] === '*') {\n\t\t\t\t\t\tin_comment = false;\n\t\t\t\t\t}\n\t\t\t\t} else if (in_str) {\n\t\t\t\t\tif (in_str === c) {\n\t\t\t\t\t\tin_str = false;\n\t\t\t\t\t}\n\t\t\t\t} else if (c === '/' && value[i + 1] === '*') {\n\t\t\t\t\tin_comment = true;\n\t\t\t\t} else if (c === '\"' || c === \"'\") {\n\t\t\t\t\tin_str = c;\n\t\t\t\t} else if (c === '(') {\n\t\t\t\t\tin_apo++;\n\t\t\t\t} else if (c === ')') {\n\t\t\t\t\tin_apo--;\n\t\t\t\t}\n\n\t\t\t\tif (!in_comment && in_str === false && in_apo === 0) {\n\t\t\t\t\tif (c === ':' && name_index === -1) {\n\t\t\t\t\t\tname_index = i;\n\t\t\t\t\t} else if (c === ';' || i === len - 1) {\n\t\t\t\t\t\tif (name_index !== -1) {\n\t\t\t\t\t\t\tvar name = to_css_name(value.substring(start_index, name_index).trim());\n\n\t\t\t\t\t\t\tif (!reserved_names.includes(name)) {\n\t\t\t\t\t\t\t\tif (c !== ';') {\n\t\t\t\t\t\t\t\t\ti++;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tvar property = value.substring(start_index, i).trim();\n\t\t\t\t\t\t\t\tnew_style += ' ' + property + ';';\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tstart_index = i + 1;\n\t\t\t\t\t\tname_index = -1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (normal_styles) {\n\t\t\tnew_style += append_styles(normal_styles);\n\t\t}\n\n\t\tif (important_styles) {\n\t\t\tnew_style += append_styles(important_styles, true);\n\t\t}\n\n\t\tnew_style = new_style.trim();\n\t\treturn new_style === '' ? null : new_style;\n\t}\n\n\treturn value == null ? null : String(value);\n}\n","import { to_class } from '../../../shared/attributes.js';\nimport { hydrating } from '../hydration.js';\n\n/**\n * @param {Element} dom\n * @param {boolean | number} is_html\n * @param {string | null} value\n * @param {string} [hash]\n * @param {Record<string, any>} [prev_classes]\n * @param {Record<string, any>} [next_classes]\n * @returns {Record<string, boolean> | undefined}\n */\nexport function set_class(dom, is_html, value, hash, prev_classes, next_classes) {\n\t// @ts-expect-error need to add __className to patched prototype\n\tvar prev = dom.__className;\n\n\tif (\n\t\thydrating ||\n\t\tprev !== value ||\n\t\tprev === undefined // for edge case of `class={undefined}`\n\t) {\n\t\tvar next_class_name = to_class(value, hash, next_classes);\n\n\t\tif (!hydrating || next_class_name !== dom.getAttribute('class')) {\n\t\t\t// Removing the attribute when the value is only an empty string causes\n\t\t\t// performance issues vs simply making the className an empty string. So\n\t\t\t// we should only remove the class if the value is nullish\n\t\t\t// and there no hash/directives :\n\t\t\tif (next_class_name == null) {\n\t\t\t\tdom.removeAttribute('class');\n\t\t\t} else if (is_html) {\n\t\t\t\tdom.className = next_class_name;\n\t\t\t} else {\n\t\t\t\tdom.setAttribute('class', next_class_name);\n\t\t\t}\n\t\t}\n\n\t\t// @ts-expect-error need to add __className to patched prototype\n\t\tdom.__className = value;\n\t} else if (next_classes && prev_classes !== next_classes) {\n\t\tfor (var key in next_classes) {\n\t\t\tvar is_present = !!next_classes[key];\n\n\t\t\tif (prev_classes == null || is_present !== !!prev_classes[key]) {\n\t\t\t\tdom.classList.toggle(key, is_present);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn next_classes;\n}\n","import { to_style } from '../../../shared/attributes.js';\nimport { hydrating } from '../hydration.js';\n\n/**\n * @param {Element & ElementCSSInlineStyle} dom\n * @param {Record<string, any>} prev\n * @param {Record<string, any>} next\n * @param {string} [priority]\n */\nfunction update_styles(dom, prev = {}, next, priority) {\n\tfor (var key in next) {\n\t\tvar value = next[key];\n\n\t\tif (prev[key] !== value) {\n\t\t\tif (next[key] == null) {\n\t\t\t\tdom.style.removeProperty(key);\n\t\t\t} else {\n\t\t\t\tdom.style.setProperty(key, value, priority);\n\t\t\t}\n\t\t}\n\t}\n}\n\n/**\n * @param {Element & ElementCSSInlineStyle} dom\n * @param {string | null} value\n * @param {Record<string, any> | [Record<string, any>, Record<string, any>]} [prev_styles]\n * @param {Record<string, any> | [Record<string, any>, Record<string, any>]} [next_styles]\n */\nexport function set_style(dom, value, prev_styles, next_styles) {\n\t// @ts-expect-error\n\tvar prev = dom.__style;\n\n\tif (hydrating || prev !== value) {\n\t\tvar next_style_attr = to_style(value, next_styles);\n\n\t\tif (!hydrating || next_style_attr !== dom.getAttribute('style')) {\n\t\t\tif (next_style_attr == null) {\n\t\t\t\tdom.removeAttribute('style');\n\t\t\t} else {\n\t\t\t\tdom.style.cssText = next_style_attr;\n\t\t\t}\n\t\t}\n\n\t\t// @ts-expect-error\n\t\tdom.__style = value;\n\t} else if (next_styles) {\n\t\tif (Array.isArray(next_styles)) {\n\t\t\tupdate_styles(dom, prev_styles?.[0], next_styles[0]);\n\t\t\tupdate_styles(dom, prev_styles?.[1], next_styles[1], 'important');\n\t\t} else {\n\t\t\tupdate_styles(dom, prev_styles, next_styles);\n\t\t}\n\t}\n\n\treturn next_styles;\n}\n","import { effect, teardown } from '../../../reactivity/effects.js';\nimport { listen_to_event_and_reset_event } from './shared.js';\nimport { is } from '../../../proxy.js';\nimport { is_array } from '../../../../shared/utils.js';\nimport * as w from '../../../warnings.js';\nimport { Batch, current_batch, previous_batch } from '../../../reactivity/batch.js';\nimport { async_mode_flag } from '../../../../flags/index.js';\n\n/**\n * Selects the correct option(s) (depending on whether this is a multiple select)\n * @template V\n * @param {HTMLSelectElement} select\n * @param {V} value\n * @param {boolean} mounting\n */\nexport function select_option(select, value, mounting = false) {\n\tif (select.multiple) {\n\t\t// If value is null or undefined, keep the selection as is\n\t\tif (value == undefined) {\n\t\t\treturn;\n\t\t}\n\n\t\t// If not an array, warn and keep the selection as is\n\t\tif (!is_array(value)) {\n\t\t\treturn w.select_multiple_invalid_value();\n\t\t}\n\n\t\t// Otherwise, update the selection\n\t\tfor (var option of select.options) {\n\t\t\toption.selected = value.includes(get_option_value(option));\n\t\t}\n\n\t\treturn;\n\t}\n\n\tfor (option of select.options) {\n\t\tvar option_value = get_option_value(option);\n\t\tif (is(option_value, value)) {\n\t\t\toption.selected = true;\n\t\t\treturn;\n\t\t}\n\t}\n\n\tif (!mounting || value !== undefined) {\n\t\tselect.selectedIndex = -1; // no option should be selected\n\t}\n}\n\n/**\n * Selects the correct option(s) if `value` is given,\n * and then sets up a mutation observer to sync the\n * current selection to the dom when it changes. Such\n * changes could for example occur when options are\n * inside an `#each` block.\n * @param {HTMLSelectElement} select\n */\nexport function init_select(select) {\n\tvar observer = new MutationObserver(() => {\n\t\t// @ts-ignore\n\t\tselect_option(select, select.__value);\n\t\t// Deliberately don't update the potential binding value,\n\t\t// the model should be preserved unless explicitly changed\n\t});\n\n\tobserver.observe(select, {\n\t\t// Listen to option element changes\n\t\tchildList: true,\n\t\tsubtree: true, // because of <optgroup>\n\t\t// Listen to option element value attribute changes\n\t\t// (doesn't get notified of select value changes,\n\t\t// because that property is not reflected as an attribute)\n\t\tattributes: true,\n\t\tattributeFilter: ['value']\n\t});\n\n\tteardown(() => {\n\t\tobserver.disconnect();\n\t});\n}\n\n/**\n * @param {HTMLSelectElement} select\n * @param {() => unknown} get\n * @param {(value: unknown) => void} set\n * @returns {void}\n */\nexport function bind_select_value(select, get, set = get) {\n\tvar batches = new WeakSet();\n\tvar mounting = true;\n\n\tlisten_to_event_and_reset_event(select, 'change', (is_reset) => {\n\t\tvar query = is_reset ? '[selected]' : ':checked';\n\t\t/** @type {unknown} */\n\t\tvar value;\n\n\t\tif (select.multiple) {\n\t\t\tvalue = [].map.call(select.querySelectorAll(query), get_option_value);\n\t\t} else {\n\t\t\t/** @type {HTMLOptionElement | null} */\n\t\t\tvar selected_option =\n\t\t\t\tselect.querySelector(query) ??\n\t\t\t\t// will fall back to first non-disabled option if no option is selected\n\t\t\t\tselect.querySelector('option:not([disabled])');\n\t\t\tvalue = selected_option && get_option_value(selected_option);\n\t\t}\n\n\t\tset(value);\n\n\t\t// @ts-ignore\n\t\tselect.__value = value;\n\n\t\tif (current_batch !== null) {\n\t\t\tbatches.add(current_batch);\n\t\t}\n\t});\n\n\t// Needs to be an effect, not a render_effect, so that in case of each loops the logic runs after the each block has updated\n\teffect(() => {\n\t\tvar value = get();\n\n\t\tif (select === document.activeElement) {\n\t\t\t// In sync mode render effects are executed during tree traversal -> needs current_batch\n\t\t\t// In async mode render effects are flushed once batch resolved, at which point current_batch is null -> needs previous_batch\n\t\t\tvar batch = /** @type {Batch} */ (async_mode_flag ? previous_batch : current_batch);\n\n\t\t\t// Don't update the <select> if it is focused. We can get here if, for example,\n\t\t\t// an update is deferred because of async work depending on the select:\n\t\t\t//\n\t\t\t// <select bind:value={selected}>...</select>\n\t\t\t// <p>{await find(selected)}</p>\n\t\t\tif (batches.has(batch)) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tselect_option(select, value, mounting);\n\n\t\t// Mounting and value undefined -> take selection from dom\n\t\tif (mounting && value === undefined) {\n\t\t\t/** @type {HTMLOptionElement | null} */\n\t\t\tvar selected_option = select.querySelector(':checked');\n\t\t\tif (selected_option !== null) {\n\t\t\t\tvalue = get_option_value(selected_option);\n\t\t\t\tset(value);\n\t\t\t}\n\t\t}\n\n\t\t// @ts-ignore\n\t\tselect.__value = value;\n\t\tmounting = false;\n\t});\n\n\tinit_select(select);\n}\n\n/** @param {HTMLOptionElement} option */\nfunction get_option_value(option) {\n\t// __value only exists if the <option> has a value attribute\n\tif ('__value' in option) {\n\t\treturn option.__value;\n\t} else {\n\t\treturn option.value;\n\t}\n}\n","/** @import { Blocker, Effect } from '#client' */\nimport { DEV } from 'esm-env';\nimport { hydrating, set_hydrating } from '../hydration.js';\nimport { get_descriptors, get_prototype_of } from '../../../shared/utils.js';\nimport { create_event, delegate, delegated, event, event_symbol } from './events.js';\nimport { add_form_reset_listener, autofocus } from './misc.js';\nimport * as w from '../../warnings.js';\nimport { IS_XHTML, LOADING_ATTR_SYMBOL } from '#client/constants';\nimport { queue_micro_task } from '../task.js';\nimport { is_capture_event, can_delegate_event, normalize_attribute } from '../../../../utils.js';\nimport {\n\tactive_effect,\n\tactive_reaction,\n\tget,\n\tset_active_effect,\n\tset_active_reaction\n} from '../../runtime.js';\nimport { attach } from './attachments.js';\nimport { clsx } from '../../../shared/attributes.js';\nimport { set_class } from './class.js';\nimport { set_style } from './style.js';\nimport { ATTACHMENT_KEY, NAMESPACE_HTML, UNINITIALIZED } from '../../../../constants.js';\nimport { branch, destroy_effect, effect, managed } from '../../reactivity/effects.js';\nimport { init_select, select_option } from './bindings/select.js';\nimport { flatten } from '../../reactivity/async.js';\n\nexport const CLASS = Symbol('class');\nexport const STYLE = Symbol('style');\n\nconst IS_CUSTOM_ELEMENT = Symbol('is custom element');\nconst IS_HTML = Symbol('is html');\n\nconst LINK_TAG = IS_XHTML ? 'link' : 'LINK';\nconst INPUT_TAG = IS_XHTML ? 'input' : 'INPUT';\nconst OPTION_TAG = IS_XHTML ? 'option' : 'OPTION';\nconst SELECT_TAG = IS_XHTML ? 'select' : 'SELECT';\nconst PROGRESS_TAG = IS_XHTML ? 'progress' : 'PROGRESS';\n\n/**\n * The value/checked attribute in the template actually corresponds to the defaultValue property, so we need\n * to remove it upon hydration to avoid a bug when someone resets the form value.\n * @param {HTMLInputElement} input\n * @returns {void}\n */\nexport function remove_input_defaults(input) {\n\tif (!hydrating) return;\n\n\tvar already_removed = false;\n\n\t// We try and remove the default attributes later, rather than sync during hydration.\n\t// Doing it sync during hydration has a negative impact on performance, but deferring the\n\t// work in an idle task alleviates this greatly. If a form reset event comes in before\n\t// the idle callback, then we ensure the input defaults are cleared just before.\n\tvar remove_defaults = () => {\n\t\tif (already_removed) return;\n\t\talready_removed = true;\n\n\t\t// Remove the attributes but preserve the values\n\t\tif (input.hasAttribute('value')) {\n\t\t\tvar value = input.value;\n\t\t\tset_attribute(input, 'value', null);\n\t\t\tinput.value = value;\n\t\t}\n\n\t\tif (input.hasAttribute('checked')) {\n\t\t\tvar checked = input.checked;\n\t\t\tset_attribute(input, 'checked', null);\n\t\t\tinput.checked = checked;\n\t\t}\n\t};\n\n\t// @ts-expect-error\n\tinput.__on_r = remove_defaults;\n\tqueue_micro_task(remove_defaults);\n\tadd_form_reset_listener();\n}\n\n/**\n * @param {Element} element\n * @param {any} value\n */\nexport function set_value(element, value) {\n\tvar attributes = get_attributes(element);\n\n\tif (\n\t\tattributes.value ===\n\t\t\t(attributes.value =\n\t\t\t\t// treat null and undefined the same for the initial value\n\t\t\t\tvalue ?? undefined) ||\n\t\t// @ts-expect-error\n\t\t// `progress` elements always need their value set when it's `0`\n\t\t(element.value === value && (value !== 0 || element.nodeName !== PROGRESS_TAG))\n\t) {\n\t\treturn;\n\t}\n\n\t// @ts-expect-error\n\telement.value = value ?? '';\n}\n\n/**\n * @param {Element} element\n * @param {boolean} checked\n */\nexport function set_checked(element, checked) {\n\tvar attributes = get_attributes(element);\n\n\tif (\n\t\tattributes.checked ===\n\t\t(attributes.checked =\n\t\t\t// treat null and undefined the same for the initial value\n\t\t\tchecked ?? undefined)\n\t) {\n\t\treturn;\n\t}\n\n\t// @ts-expect-error\n\telement.checked = checked;\n}\n\n/**\n * Sets the `selected` attribute on an `option` element.\n * Not set through the property because that doesn't reflect to the DOM,\n * which means it wouldn't be taken into account when a form is reset.\n * @param {HTMLOptionElement} element\n * @param {boolean} selected\n */\nexport function set_selected(element, selected) {\n\tif (selected) {\n\t\t// The selected option could've changed via user selection, and\n\t\t// setting the value without this check would set it back.\n\t\tif (!element.hasAttribute('selected')) {\n\t\t\telement.setAttribute('selected', '');\n\t\t}\n\t} else {\n\t\telement.removeAttribute('selected');\n\t}\n}\n\n/**\n * Applies the default checked property without influencing the current checked property.\n * @param {HTMLInputElement} element\n * @param {boolean} checked\n */\nexport function set_default_checked(element, checked) {\n\tconst existing_value = element.checked;\n\telement.defaultChecked = checked;\n\telement.checked = existing_value;\n}\n\n/**\n * Applies the default value property without influencing the current value property.\n * @param {HTMLInputElement | HTMLTextAreaElement} element\n * @param {string} value\n */\nexport function set_default_value(element, value) {\n\tconst existing_value = element.value;\n\telement.defaultValue = value;\n\telement.value = existing_value;\n}\n\n/**\n * @param {Element} element\n * @param {string} attribute\n * @param {string | null} value\n * @param {boolean} [skip_warning]\n */\nexport function set_attribute(element, attribute, value, skip_warning) {\n\tvar attributes = get_attributes(element);\n\n\tif (hydrating) {\n\t\tattributes[attribute] = element.getAttribute(attribute);\n\n\t\tif (\n\t\t\tattribute === 'src' ||\n\t\t\tattribute === 'srcset' ||\n\t\t\t(attribute === 'href' && element.nodeName === LINK_TAG)\n\t\t) {\n\t\t\tif (!skip_warning) {\n\t\t\t\tcheck_src_in_dev_hydration(element, attribute, value ?? '');\n\t\t\t}\n\n\t\t\t// If we reset these attributes, they would result in another network request, which we want to avoid.\n\t\t\t// We assume they are the same between client and server as checking if they are equal is expensive\n\t\t\t// (we can't just compare the strings as they can be different between client and server but result in the\n\t\t\t// same url, so we would need to create hidden anchor elements to compare them)\n\t\t\treturn;\n\t\t}\n\t}\n\n\tif (attributes[attribute] === (attributes[attribute] = value)) return;\n\n\tif (attribute === 'loading') {\n\t\t// @ts-expect-error\n\t\telement[LOADING_ATTR_SYMBOL] = value;\n\t}\n\n\tif (value == null) {\n\t\telement.removeAttribute(attribute);\n\t} else if (typeof value !== 'string' && get_setters(element).includes(attribute)) {\n\t\t// @ts-ignore\n\t\telement[attribute] = value;\n\t} else {\n\t\telement.setAttribute(attribute, value);\n\t}\n}\n\n/**\n * @param {Element} dom\n * @param {string} attribute\n * @param {string} value\n */\nexport function set_xlink_attribute(dom, attribute, value) {\n\tdom.setAttributeNS('http://www.w3.org/1999/xlink', attribute, value);\n}\n\n/**\n * @param {HTMLElement} node\n * @param {string} prop\n * @param {any} value\n */\nexport function set_custom_element_data(node, prop, value) {\n\t// We need to ensure that setting custom element props, which can\n\t// invoke lifecycle methods on other custom elements, does not also\n\t// associate those lifecycle methods with the current active reaction\n\t// or effect\n\tvar previous_reaction = active_reaction;\n\tvar previous_effect = active_effect;\n\n\t// If we're hydrating but the custom element is from Svelte, and it already scaffolded,\n\t// then it might run block logic in hydration mode, which we have to prevent.\n\tlet was_hydrating = hydrating;\n\tif (hydrating) {\n\t\tset_hydrating(false);\n\t}\n\n\tset_active_reaction(null);\n\tset_active_effect(null);\n\n\ttry {\n\t\tif (\n\t\t\t// `style` should use `set_attribute` rather than the setter\n\t\t\tprop !== 'style' &&\n\t\t\t// Don't compute setters for custom elements while they aren't registered yet,\n\t\t\t// because during their upgrade/instantiation they might add more setters.\n\t\t\t// Instead, fall back to a simple \"an object, then set as property\" heuristic.\n\t\t\t(setters_cache.has(node.getAttribute('is') || node.nodeName) ||\n\t\t\t// customElements may not be available in browser extension contexts\n\t\t\t!customElements ||\n\t\t\tcustomElements.get(node.getAttribute('is') || node.nodeName.toLowerCase())\n\t\t\t\t? get_setters(node).includes(prop)\n\t\t\t\t: value && typeof value === 'object')\n\t\t) {\n\t\t\t// @ts-expect-error\n\t\t\tnode[prop] = value;\n\t\t} else {\n\t\t\t// We did getters etc checks already, stringify before passing to set_attribute\n\t\t\t// to ensure it doesn't invoke the same logic again, and potentially populating\n\t\t\t// the setters cache too early.\n\t\t\tset_attribute(node, prop, value == null ? value : String(value));\n\t\t}\n\t} finally {\n\t\tset_active_reaction(previous_reaction);\n\t\tset_active_effect(previous_effect);\n\t\tif (was_hydrating) {\n\t\t\tset_hydrating(true);\n\t\t}\n\t}\n}\n\n/**\n * Spreads attributes onto a DOM element, taking into account the currently set attributes\n * @param {Element & ElementCSSInlineStyle} element\n * @param {Record<string | symbol, any> | undefined} prev\n * @param {Record<string | symbol, any>} next New attributes - this function mutates this object\n * @param {string} [css_hash]\n * @param {boolean} [should_remove_defaults]\n * @param {boolean} [skip_warning]\n * @returns {Record<string, any>}\n */\nfunction set_attributes(\n\telement,\n\tprev,\n\tnext,\n\tcss_hash,\n\tshould_remove_defaults = false,\n\tskip_warning = false\n) {\n\tif (hydrating && should_remove_defaults && element.nodeName === INPUT_TAG) {\n\t\tvar input = /** @type {HTMLInputElement} */ (element);\n\t\tvar attribute = input.type === 'checkbox' ? 'defaultChecked' : 'defaultValue';\n\n\t\tif (!(attribute in next)) {\n\t\t\tremove_input_defaults(input);\n\t\t}\n\t}\n\n\tvar attributes = get_attributes(element);\n\n\tvar is_custom_element = attributes[IS_CUSTOM_ELEMENT];\n\tvar preserve_attribute_case = !attributes[IS_HTML];\n\n\t// If we're hydrating but the custom element is from Svelte, and it already scaffolded,\n\t// then it might run block logic in hydration mode, which we have to prevent.\n\tlet is_hydrating_custom_element = hydrating && is_custom_element;\n\tif (is_hydrating_custom_element) {\n\t\tset_hydrating(false);\n\t}\n\n\tvar current = prev || {};\n\tvar is_option_element = element.nodeName === OPTION_TAG;\n\n\tfor (var key in prev) {\n\t\tif (!(key in next)) {\n\t\t\tnext[key] = null;\n\t\t}\n\t}\n\n\tif (next.class) {\n\t\tnext.class = clsx(next.class);\n\t} else if (css_hash || next[CLASS]) {\n\t\tnext.class = null; /* force call to set_class() */\n\t}\n\n\tif (next[STYLE]) {\n\t\tnext.style ??= null; /* force call to set_style() */\n\t}\n\n\tvar setters = get_setters(element);\n\n\t// since key is captured we use const\n\tfor (const key in next) {\n\t\t// let instead of var because referenced in a closure\n\t\tlet value = next[key];\n\n\t\t// Up here because we want to do this for the initial value, too, even if it's undefined,\n\t\t// and this wouldn't be reached in case of undefined because of the equality check below\n\t\tif (is_option_element && key === 'value' && value == null) {\n\t\t\t// The <option> element is a special case because removing the value attribute means\n\t\t\t// the value is set to the text content of the option element, and setting the value\n\t\t\t// to null or undefined means the value is set to the string \"null\" or \"undefined\".\n\t\t\t// To align with how we handle this case in non-spread-scenarios, this logic is needed.\n\t\t\t// There's a super-edge-case bug here that is left in in favor of smaller code size:\n\t\t\t// Because of the \"set missing props to null\" logic above, we can't differentiate\n\t\t\t// between a missing value and an explicitly set value of null or undefined. That means\n\t\t\t// that once set, the value attribute of an <option> element can't be removed. This is\n\t\t\t// a very rare edge case, and removing the attribute altogether isn't possible either\n\t\t\t// for the <option value={undefined}> case, so we're not losing any functionality here.\n\t\t\t// @ts-ignore\n\t\t\telement.value = element.__value = '';\n\t\t\tcurrent[key] = value;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (key === 'class') {\n\t\t\tvar is_html = element.namespaceURI === 'http://www.w3.org/1999/xhtml';\n\t\t\tset_class(element, is_html, value, css_hash, prev?.[CLASS], next[CLASS]);\n\t\t\tcurrent[key] = value;\n\t\t\tcurrent[CLASS] = next[CLASS];\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (key === 'style') {\n\t\t\tset_style(element, value, prev?.[STYLE], next[STYLE]);\n\t\t\tcurrent[key] = value;\n\t\t\tcurrent[STYLE] = next[STYLE];\n\t\t\tcontinue;\n\t\t}\n\n\t\tvar prev_value = current[key];\n\n\t\t// Skip if value is unchanged, unless it's `undefined` and the element still has the attribute\n\t\tif (value === prev_value && !(value === undefined && element.hasAttribute(key))) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tcurrent[key] = value;\n\n\t\tvar prefix = key[0] + key[1]; // this is faster than key.slice(0, 2)\n\t\tif (prefix === '$$') continue;\n\n\t\tif (prefix === 'on') {\n\t\t\t/** @type {{ capture?: true }} */\n\t\t\tconst opts = {};\n\t\t\tconst event_handle_key = '$$' + key;\n\t\t\tlet event_name = key.slice(2);\n\t\t\tvar is_delegated = can_delegate_event(event_name);\n\n\t\t\tif (is_capture_event(event_name)) {\n\t\t\t\tevent_name = event_name.slice(0, -7);\n\t\t\t\topts.capture = true;\n\t\t\t}\n\n\t\t\tif (!is_delegated && prev_value) {\n\t\t\t\t// Listening to same event but different handler -> our handle function below takes care of this\n\t\t\t\t// If we were to remove and add listeners in this case, it could happen that the event is \"swallowed\"\n\t\t\t\t// (the browser seems to not know yet that a new one exists now) and doesn't reach the handler\n\t\t\t\t// https://github.com/sveltejs/svelte/issues/11903\n\t\t\t\tif (value != null) continue;\n\n\t\t\t\telement.removeEventListener(event_name, current[event_handle_key], opts);\n\t\t\t\tcurrent[event_handle_key] = null;\n\t\t\t}\n\n\t\t\tif (is_delegated) {\n\t\t\t\tdelegated(event_name, element, value);\n\t\t\t\tdelegate([event_name]);\n\t\t\t} else if (value != null) {\n\t\t\t\t/**\n\t\t\t\t * @this {any}\n\t\t\t\t * @param {Event} evt\n\t\t\t\t */\n\t\t\t\tfunction handle(evt) {\n\t\t\t\t\tcurrent[key].call(this, evt);\n\t\t\t\t}\n\n\t\t\t\tcurrent[event_handle_key] = create_event(event_name, element, handle, opts);\n\t\t\t}\n\t\t} else if (key === 'style') {\n\t\t\t// avoid using the setter\n\t\t\tset_attribute(element, key, value);\n\t\t} else if (key === 'autofocus') {\n\t\t\tautofocus(/** @type {HTMLElement} */ (element), Boolean(value));\n\t\t} else if (!is_custom_element && (key === '__value' || (key === 'value' && value != null))) {\n\t\t\t// @ts-ignore We're not running this for custom elements because __value is actually\n\t\t\t// how Lit stores the current value on the element, and messing with that would break things.\n\t\t\telement.value = element.__value = value;\n\t\t} else if (key === 'selected' && is_option_element) {\n\t\t\tset_selected(/** @type {HTMLOptionElement} */ (element), value);\n\t\t} else {\n\t\t\tvar name = key;\n\t\t\tif (!preserve_attribute_case) {\n\t\t\t\tname = normalize_attribute(name);\n\t\t\t}\n\n\t\t\tvar is_default = name === 'defaultValue' || name === 'defaultChecked';\n\n\t\t\tif (value == null && !is_custom_element && !is_default) {\n\t\t\t\tattributes[key] = null;\n\n\t\t\t\tif (name === 'value' || name === 'checked') {\n\t\t\t\t\t// removing value/checked also removes defaultValue/defaultChecked — preserve\n\t\t\t\t\tlet input = /** @type {HTMLInputElement} */ (element);\n\t\t\t\t\tconst use_default = prev === undefined;\n\t\t\t\t\tif (name === 'value') {\n\t\t\t\t\t\tlet previous = input.defaultValue;\n\t\t\t\t\t\tinput.removeAttribute(name);\n\t\t\t\t\t\tinput.defaultValue = previous;\n\t\t\t\t\t\t// @ts-ignore\n\t\t\t\t\t\tinput.value = input.__value = use_default ? previous : null;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tlet previous = input.defaultChecked;\n\t\t\t\t\t\tinput.removeAttribute(name);\n\t\t\t\t\t\tinput.defaultChecked = previous;\n\t\t\t\t\t\tinput.checked = use_default ? previous : false;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\telement.removeAttribute(key);\n\t\t\t\t}\n\t\t\t} else if (\n\t\t\t\tis_default ||\n\t\t\t\t(setters.includes(name) && (is_custom_element || typeof value !== 'string'))\n\t\t\t) {\n\t\t\t\t// @ts-ignore\n\t\t\t\telement[name] = value;\n\t\t\t\t// remove it from attributes's cache\n\t\t\t\tif (name in attributes) attributes[name] = UNINITIALIZED;\n\t\t\t} else if (typeof value !== 'function') {\n\t\t\t\tset_attribute(element, name, value, skip_warning);\n\t\t\t}\n\t\t}\n\t}\n\n\tif (is_hydrating_custom_element) {\n\t\tset_hydrating(true);\n\t}\n\n\treturn current;\n}\n\n/**\n * @param {Element & ElementCSSInlineStyle} element\n * @param {(...expressions: any) => Record<string | symbol, any>} fn\n * @param {Array<() => any>} sync\n * @param {Array<() => Promise<any>>} async\n * @param {Blocker[]} blockers\n * @param {string} [css_hash]\n * @param {boolean} [should_remove_defaults]\n * @param {boolean} [skip_warning]\n */\nexport function attribute_effect(\n\telement,\n\tfn,\n\tsync = [],\n\tasync = [],\n\tblockers = [],\n\tcss_hash,\n\tshould_remove_defaults = false,\n\tskip_warning = false\n) {\n\tflatten(blockers, sync, async, (values) => {\n\t\t/** @type {Record<string | symbol, any> | undefined} */\n\t\tvar prev = undefined;\n\n\t\t/** @type {Record<symbol, Effect>} */\n\t\tvar effects = {};\n\n\t\tvar is_select = element.nodeName === SELECT_TAG;\n\t\tvar inited = false;\n\n\t\tmanaged(() => {\n\t\t\tvar next = fn(...values.map(get));\n\t\t\t/** @type {Record<string | symbol, any>} */\n\t\t\tvar current = set_attributes(\n\t\t\t\telement,\n\t\t\t\tprev,\n\t\t\t\tnext,\n\t\t\t\tcss_hash,\n\t\t\t\tshould_remove_defaults,\n\t\t\t\tskip_warning\n\t\t\t);\n\n\t\t\tif (inited && is_select && 'value' in next) {\n\t\t\t\tselect_option(/** @type {HTMLSelectElement} */ (element), next.value);\n\t\t\t}\n\n\t\t\tfor (let symbol of Object.getOwnPropertySymbols(effects)) {\n\t\t\t\tif (!next[symbol]) destroy_effect(effects[symbol]);\n\t\t\t}\n\n\t\t\tfor (let symbol of Object.getOwnPropertySymbols(next)) {\n\t\t\t\tvar n = next[symbol];\n\n\t\t\t\tif (symbol.description === ATTACHMENT_KEY && (!prev || n !== prev[symbol])) {\n\t\t\t\t\tif (effects[symbol]) destroy_effect(effects[symbol]);\n\t\t\t\t\teffects[symbol] = branch(() => attach(element, () => n));\n\t\t\t\t}\n\n\t\t\t\tcurrent[symbol] = n;\n\t\t\t}\n\n\t\t\tprev = current;\n\t\t});\n\n\t\tif (is_select) {\n\t\t\tvar select = /** @type {HTMLSelectElement} */ (element);\n\n\t\t\teffect(() => {\n\t\t\t\tselect_option(select, /** @type {Record<string | symbol, any>} */ (prev).value, true);\n\t\t\t\tinit_select(select);\n\t\t\t});\n\t\t}\n\n\t\tinited = true;\n\t});\n}\n\n/**\n *\n * @param {Element} element\n */\nfunction get_attributes(element) {\n\treturn /** @type {Record<string | symbol, unknown>} **/ (\n\t\t// @ts-expect-error\n\t\telement.__attributes ??= {\n\t\t\t[IS_CUSTOM_ELEMENT]: element.nodeName.includes('-'),\n\t\t\t[IS_HTML]: element.namespaceURI === NAMESPACE_HTML\n\t\t}\n\t);\n}\n\n/** @type {Map<string, string[]>} */\nvar setters_cache = new Map();\n\n/** @param {Element} element */\nfunction get_setters(element) {\n\tvar cache_key = element.getAttribute('is') || element.nodeName;\n\tvar setters = setters_cache.get(cache_key);\n\tif (setters) return setters;\n\tsetters_cache.set(cache_key, (setters = []));\n\n\tvar descriptors;\n\tvar proto = element; // In the case of custom elements there might be setters on the instance\n\tvar element_proto = Element.prototype;\n\n\t// Stop at Element, from there on there's only unnecessary setters we're not interested in\n\t// Do not use contructor.name here as that's unreliable in some browser environments\n\twhile (element_proto !== proto) {\n\t\tdescriptors = get_descriptors(proto);\n\n\t\tfor (var key in descriptors) {\n\t\t\tif (descriptors[key].set) {\n\t\t\t\tsetters.push(key);\n\t\t\t}\n\t\t}\n\n\t\tproto = get_prototype_of(proto);\n\t}\n\n\treturn setters;\n}\n\n/**\n * @param {any} element\n * @param {string} attribute\n * @param {string} value\n */\nfunction check_src_in_dev_hydration(element, attribute, value) {\n\tif (!DEV) return;\n\tif (attribute === 'srcset' && srcset_url_equal(element, value)) return;\n\tif (src_url_equal(element.getAttribute(attribute) ?? '', value)) return;\n\n\tw.hydration_attribute_changed(\n\t\tattribute,\n\t\telement.outerHTML.replace(element.innerHTML, element.innerHTML && '...'),\n\t\tString(value)\n\t);\n}\n\n/**\n * @param {string} element_src\n * @param {string} url\n * @returns {boolean}\n */\nfunction src_url_equal(element_src, url) {\n\tif (element_src === url) return true;\n\treturn new URL(element_src, document.baseURI).href === new URL(url, document.baseURI).href;\n}\n\n/** @param {string} srcset */\nfunction split_srcset(srcset) {\n\treturn srcset.split(',').map((src) => src.trim().split(' ').filter(Boolean));\n}\n\n/**\n * @param {HTMLSourceElement | HTMLImageElement} element\n * @param {string} srcset\n * @returns {boolean}\n */\nfunction srcset_url_equal(element, srcset) {\n\tvar element_urls = split_srcset(element.srcset);\n\tvar urls = split_srcset(srcset);\n\n\treturn (\n\t\turls.length === element_urls.length &&\n\t\turls.every(\n\t\t\t([url, width], i) =>\n\t\t\t\twidth === element_urls[i][1] &&\n\t\t\t\t// We need to test both ways because Vite will create an a full URL with\n\t\t\t\t// `new URL(asset, import.meta.url).href` for the client when `base: './'`, and the\n\t\t\t\t// relative URLs inside srcset are not automatically resolved to absolute URLs by\n\t\t\t\t// browsers (in contrast to img.src). This means both SSR and DOM code could\n\t\t\t\t// contain relative or absolute URLs.\n\t\t\t\t(src_url_equal(element_urls[i][0], url) || src_url_equal(url, element_urls[i][0]))\n\t\t)\n\t);\n}\n","/** @import { Batch } from '../../../reactivity/batch.js' */\nimport { DEV } from 'esm-env';\nimport { render_effect, teardown } from '../../../reactivity/effects.js';\nimport { listen_to_event_and_reset_event } from './shared.js';\nimport * as e from '../../../errors.js';\nimport { is } from '../../../proxy.js';\nimport { queue_micro_task } from '../../task.js';\nimport { hydrating } from '../../hydration.js';\nimport { tick, untrack } from '../../../runtime.js';\nimport { is_runes } from '../../../context.js';\nimport { current_batch, previous_batch } from '../../../reactivity/batch.js';\nimport { async_mode_flag } from '../../../../flags/index.js';\n\n/**\n * @param {HTMLInputElement} input\n * @param {() => unknown} get\n * @param {(value: unknown) => void} set\n * @returns {void}\n */\nexport function bind_value(input, get, set = get) {\n\tvar batches = new WeakSet();\n\n\tlisten_to_event_and_reset_event(input, 'input', async (is_reset) => {\n\t\tif (DEV && input.type === 'checkbox') {\n\t\t\t// TODO should this happen in prod too?\n\t\t\te.bind_invalid_checkbox_value();\n\t\t}\n\n\t\t/** @type {any} */\n\t\tvar value = is_reset ? input.defaultValue : input.value;\n\t\tvalue = is_numberlike_input(input) ? to_number(value) : value;\n\t\tset(value);\n\n\t\tif (current_batch !== null) {\n\t\t\tbatches.add(current_batch);\n\t\t}\n\n\t\t// Because `{#each ...}` blocks work by updating sources inside the flush,\n\t\t// we need to wait a tick before checking to see if we should forcibly\n\t\t// update the input and reset the selection state\n\t\tawait tick();\n\n\t\t// Respect any validation in accessors\n\t\tif (value !== (value = get())) {\n\t\t\tvar start = input.selectionStart;\n\t\t\tvar end = input.selectionEnd;\n\t\t\tvar length = input.value.length;\n\n\t\t\t// the value is coerced on assignment\n\t\t\tinput.value = value ?? '';\n\n\t\t\t// Restore selection\n\t\t\tif (end !== null) {\n\t\t\t\tvar new_length = input.value.length;\n\t\t\t\t// If cursor was at end and new input is longer, move cursor to new end\n\t\t\t\tif (start === end && end === length && new_length > length) {\n\t\t\t\t\tinput.selectionStart = new_length;\n\t\t\t\t\tinput.selectionEnd = new_length;\n\t\t\t\t} else {\n\t\t\t\t\tinput.selectionStart = start;\n\t\t\t\t\tinput.selectionEnd = Math.min(end, new_length);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t});\n\n\tif (\n\t\t// If we are hydrating and the value has since changed,\n\t\t// then use the updated value from the input instead.\n\t\t(hydrating && input.defaultValue !== input.value) ||\n\t\t// If defaultValue is set, then value == defaultValue\n\t\t// TODO Svelte 6: remove input.value check and set to empty string?\n\t\t(untrack(get) == null && input.value)\n\t) {\n\t\tset(is_numberlike_input(input) ? to_number(input.value) : input.value);\n\n\t\tif (current_batch !== null) {\n\t\t\tbatches.add(current_batch);\n\t\t}\n\t}\n\n\trender_effect(() => {\n\t\tif (DEV && input.type === 'checkbox') {\n\t\t\t// TODO should this happen in prod too?\n\t\t\te.bind_invalid_checkbox_value();\n\t\t}\n\n\t\tvar value = get();\n\n\t\tif (input === document.activeElement) {\n\t\t\t// In sync mode render effects are executed during tree traversal -> needs current_batch\n\t\t\t// In async mode render effects are flushed once batch resolved, at which point current_batch is null -> needs previous_batch\n\t\t\tvar batch = /** @type {Batch} */ (async_mode_flag ? previous_batch : current_batch);\n\n\t\t\t// Never rewrite the contents of a focused input. We can get here if, for example,\n\t\t\t// an update is deferred because of async work depending on the input:\n\t\t\t//\n\t\t\t// <input bind:value={query}>\n\t\t\t// <p>{await find(query)}</p>\n\t\t\tif (batches.has(batch)) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tif (is_numberlike_input(input) && value === to_number(input.value)) {\n\t\t\t// handles 0 vs 00 case (see https://github.com/sveltejs/svelte/issues/9959)\n\t\t\treturn;\n\t\t}\n\n\t\tif (input.type === 'date' && !value && !input.value) {\n\t\t\t// Handles the case where a temporarily invalid date is set (while typing, for example with a leading 0 for the day)\n\t\t\t// and prevents this state from clearing the other parts of the date input (see https://github.com/sveltejs/svelte/issues/7897)\n\t\t\treturn;\n\t\t}\n\n\t\t// don't set the value of the input if it's the same to allow\n\t\t// minlength to work properly\n\t\tif (value !== input.value) {\n\t\t\t// @ts-expect-error the value is coerced on assignment\n\t\t\tinput.value = value ?? '';\n\t\t}\n\t});\n}\n\n/** @type {Set<HTMLInputElement[]>} */\nconst pending = new Set();\n\n/**\n * @param {HTMLInputElement[]} inputs\n * @param {null | [number]} group_index\n * @param {HTMLInputElement} input\n * @param {() => unknown} get\n * @param {(value: unknown) => void} set\n * @returns {void}\n */\nexport function bind_group(inputs, group_index, input, get, set = get) {\n\tvar is_checkbox = input.getAttribute('type') === 'checkbox';\n\tvar binding_group = inputs;\n\n\t// needs to be let or related code isn't treeshaken out if it's always false\n\tlet hydration_mismatch = false;\n\n\tif (group_index !== null) {\n\t\tfor (var index of group_index) {\n\t\t\t// @ts-expect-error\n\t\t\tbinding_group = binding_group[index] ??= [];\n\t\t}\n\t}\n\n\tbinding_group.push(input);\n\n\tlisten_to_event_and_reset_event(\n\t\tinput,\n\t\t'change',\n\t\t() => {\n\t\t\t// @ts-ignore\n\t\t\tvar value = input.__value;\n\n\t\t\tif (is_checkbox) {\n\t\t\t\tvalue = get_binding_group_value(binding_group, value, input.checked);\n\t\t\t}\n\n\t\t\tset(value);\n\t\t},\n\t\t// TODO better default value handling\n\t\t() => set(is_checkbox ? [] : null)\n\t);\n\n\trender_effect(() => {\n\t\tvar value = get();\n\n\t\t// If we are hydrating and the value has since changed, then use the update value\n\t\t// from the input instead.\n\t\tif (hydrating && input.defaultChecked !== input.checked) {\n\t\t\thydration_mismatch = true;\n\t\t\treturn;\n\t\t}\n\n\t\tif (is_checkbox) {\n\t\t\tvalue = value || [];\n\t\t\t// @ts-ignore\n\t\t\tinput.checked = value.includes(input.__value);\n\t\t} else {\n\t\t\t// @ts-ignore\n\t\t\tinput.checked = is(input.__value, value);\n\t\t}\n\t});\n\n\tteardown(() => {\n\t\tvar index = binding_group.indexOf(input);\n\n\t\tif (index !== -1) {\n\t\t\tbinding_group.splice(index, 1);\n\t\t}\n\t});\n\n\tif (!pending.has(binding_group)) {\n\t\tpending.add(binding_group);\n\n\t\tqueue_micro_task(() => {\n\t\t\t// necessary to maintain binding group order in all insertion scenarios\n\t\t\tbinding_group.sort((a, b) => (a.compareDocumentPosition(b) === 4 ? -1 : 1));\n\t\t\tpending.delete(binding_group);\n\t\t});\n\t}\n\n\tqueue_micro_task(() => {\n\t\tif (hydration_mismatch) {\n\t\t\tvar value;\n\n\t\t\tif (is_checkbox) {\n\t\t\t\tvalue = get_binding_group_value(binding_group, value, input.checked);\n\t\t\t} else {\n\t\t\t\tvar hydration_input = binding_group.find((input) => input.checked);\n\t\t\t\t// @ts-ignore\n\t\t\t\tvalue = hydration_input?.__value;\n\t\t\t}\n\n\t\t\tset(value);\n\t\t}\n\t});\n}\n\n/**\n * @param {HTMLInputElement} input\n * @param {() => unknown} get\n * @param {(value: unknown) => void} set\n * @returns {void}\n */\nexport function bind_checked(input, get, set = get) {\n\tlisten_to_event_and_reset_event(input, 'change', (is_reset) => {\n\t\tvar value = is_reset ? input.defaultChecked : input.checked;\n\t\tset(value);\n\t});\n\n\tif (\n\t\t// If we are hydrating and the value has since changed,\n\t\t// then use the update value from the input instead.\n\t\t(hydrating && input.defaultChecked !== input.checked) ||\n\t\t// If defaultChecked is set, then checked == defaultChecked\n\t\tuntrack(get) == null\n\t) {\n\t\tset(input.checked);\n\t}\n\n\trender_effect(() => {\n\t\tvar value = get();\n\t\tinput.checked = Boolean(value);\n\t});\n}\n\n/**\n * @template V\n * @param {Array<HTMLInputElement>} group\n * @param {V} __value\n * @param {boolean} checked\n * @returns {V[]}\n */\nfunction get_binding_group_value(group, __value, checked) {\n\t/** @type {Set<V>} */\n\tvar value = new Set();\n\n\tfor (var i = 0; i < group.length; i += 1) {\n\t\tif (group[i].checked) {\n\t\t\t// @ts-ignore\n\t\t\tvalue.add(group[i].__value);\n\t\t}\n\t}\n\n\tif (!checked) {\n\t\tvalue.delete(__value);\n\t}\n\n\treturn Array.from(value);\n}\n\n/**\n * @param {HTMLInputElement} input\n */\nfunction is_numberlike_input(input) {\n\tvar type = input.type;\n\treturn type === 'number' || type === 'range';\n}\n\n/**\n * @param {string} value\n */\nfunction to_number(value) {\n\treturn value === '' ? null : +value;\n}\n\n/**\n * @param {HTMLInputElement} input\n * @param {() => FileList | null} get\n * @param {(value: FileList | null) => void} set\n */\nexport function bind_files(input, get, set = get) {\n\tlisten_to_event_and_reset_event(input, 'change', () => {\n\t\tset(input.files);\n\t});\n\n\tif (\n\t\t// If we are hydrating and the value has since changed,\n\t\t// then use the updated value from the input instead.\n\t\thydrating &&\n\t\tinput.files\n\t) {\n\t\tset(input.files);\n\t}\n\n\trender_effect(() => {\n\t\tinput.files = get();\n\t});\n}\n","import { teardown } from '../../../reactivity/effects.js';\nimport { get_descriptor } from '../../../../shared/utils.js';\n\n/**\n * Makes an `export`ed (non-prop) variable available on the `$$props` object\n * so that consumers can do `bind:x` on the component.\n * @template V\n * @param {Record<string, unknown>} props\n * @param {string} prop\n * @param {V} value\n * @returns {void}\n */\nexport function bind_prop(props, prop, value) {\n\tvar desc = get_descriptor(props, prop);\n\n\tif (desc && desc.set) {\n\t\tprops[prop] = value;\n\t\tteardown(() => {\n\t\t\tprops[prop] = null;\n\t\t});\n\t}\n}\n","/** @import { ComponentContext, Effect } from '#client' */\nimport { DESTROYING, STATE_SYMBOL } from '#client/constants';\nimport { component_context } from '../../../context.js';\nimport { effect, render_effect } from '../../../reactivity/effects.js';\nimport { active_effect, untrack } from '../../../runtime.js';\n\n/**\n * @param {any} bound_value\n * @param {Element} element_or_component\n * @returns {boolean}\n */\nfunction is_bound_this(bound_value, element_or_component) {\n\treturn (\n\t\tbound_value === element_or_component || bound_value?.[STATE_SYMBOL] === element_or_component\n\t);\n}\n\n/**\n * @param {any} element_or_component\n * @param {(value: unknown, ...parts: unknown[]) => void} update\n * @param {(...parts: unknown[]) => unknown} get_value\n * @param {() => unknown[]} [get_parts] Set if the this binding is used inside an each block,\n * \t\t\t\t\t\t\t\t\t\treturns all the parts of the each block context that are used in the expression\n * @returns {void}\n */\nexport function bind_this(element_or_component = {}, update, get_value, get_parts) {\n\tvar component_effect = /** @type {ComponentContext} */ (component_context).r;\n\tvar parent = /** @type {Effect} */ (active_effect);\n\n\teffect(() => {\n\t\t/** @type {unknown[]} */\n\t\tvar old_parts;\n\n\t\t/** @type {unknown[]} */\n\t\tvar parts;\n\n\t\trender_effect(() => {\n\t\t\told_parts = parts;\n\t\t\t// We only track changes to the parts, not the value itself to avoid unnecessary reruns.\n\t\t\tparts = get_parts?.() || [];\n\n\t\t\tuntrack(() => {\n\t\t\t\tif (element_or_component !== get_value(...parts)) {\n\t\t\t\t\tupdate(element_or_component, ...parts);\n\t\t\t\t\t// If this is an effect rerun (cause: each block context changes), then nullify the binding at\n\t\t\t\t\t// the previous position if it isn't already taken over by a different effect.\n\t\t\t\t\tif (old_parts && is_bound_this(get_value(...old_parts), element_or_component)) {\n\t\t\t\t\t\tupdate(null, ...old_parts);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\n\t\treturn () => {\n\t\t\t// When the bind:this effect is destroyed, we go up the effect parent chain until we find the last parent effect that is destroyed,\n\t\t\t// or the effect containing the component bind:this is in (whichever comes first). That way we can time the nulling of the binding\n\t\t\t// as close to user/developer expectation as possible.\n\t\t\t// TODO Svelte 6: Decide if we want to keep this logic or just always null the binding in the component effect's teardown\n\t\t\t// (which would be simpler, but less intuitive in some cases, and breaks the `ondestroy-before-cleanup` test)\n\t\t\tlet p = parent;\n\t\t\twhile (p !== component_effect && p.parent !== null && p.parent.f & DESTROYING) {\n\t\t\t\tp = p.parent;\n\t\t\t}\n\t\t\tconst teardown = () => {\n\t\t\t\tif (parts && is_bound_this(get_value(...parts), element_or_component)) {\n\t\t\t\t\tupdate(null, ...parts);\n\t\t\t\t}\n\t\t\t};\n\t\t\tconst original_teardown = p.teardown;\n\t\t\tp.teardown = () => {\n\t\t\t\tteardown();\n\t\t\t\toriginal_teardown?.();\n\t\t\t};\n\t\t};\n\t});\n\n\treturn element_or_component;\n}\n","import { noop } from '../../../shared/utils.js';\nimport { user_pre_effect } from '../../reactivity/effects.js';\nimport { on } from '../elements/events.js';\n\n/**\n * Substitute for the `trusted` event modifier\n * @deprecated\n * @param {(event: Event, ...args: Array<unknown>) => void} fn\n * @returns {(event: Event, ...args: unknown[]) => void}\n */\nexport function trusted(fn) {\n\treturn function (...args) {\n\t\tvar event = /** @type {Event} */ (args[0]);\n\t\tif (event.isTrusted) {\n\t\t\t// @ts-ignore\n\t\t\tfn?.apply(this, args);\n\t\t}\n\t};\n}\n\n/**\n * Substitute for the `self` event modifier\n * @deprecated\n * @param {(event: Event, ...args: Array<unknown>) => void} fn\n * @returns {(event: Event, ...args: unknown[]) => void}\n */\nexport function self(fn) {\n\treturn function (...args) {\n\t\tvar event = /** @type {Event} */ (args[0]);\n\t\t// @ts-ignore\n\t\tif (event.target === this) {\n\t\t\t// @ts-ignore\n\t\t\tfn?.apply(this, args);\n\t\t}\n\t};\n}\n\n/**\n * Substitute for the `stopPropagation` event modifier\n * @deprecated\n * @param {(event: Event, ...args: Array<unknown>) => void} fn\n * @returns {(event: Event, ...args: unknown[]) => void}\n */\nexport function stopPropagation(fn) {\n\treturn function (...args) {\n\t\tvar event = /** @type {Event} */ (args[0]);\n\t\tevent.stopPropagation();\n\t\t// @ts-ignore\n\t\treturn fn?.apply(this, args);\n\t};\n}\n\n/**\n * Substitute for the `once` event modifier\n * @deprecated\n * @param {(event: Event, ...args: Array<unknown>) => void} fn\n * @returns {(event: Event, ...args: unknown[]) => void}\n */\nexport function once(fn) {\n\tvar ran = false;\n\n\treturn function (...args) {\n\t\tif (ran) return;\n\t\tran = true;\n\n\t\t// @ts-ignore\n\t\treturn fn?.apply(this, args);\n\t};\n}\n\n/**\n * Substitute for the `stopImmediatePropagation` event modifier\n * @deprecated\n * @param {(event: Event, ...args: Array<unknown>) => void} fn\n * @returns {(event: Event, ...args: unknown[]) => void}\n */\nexport function stopImmediatePropagation(fn) {\n\treturn function (...args) {\n\t\tvar event = /** @type {Event} */ (args[0]);\n\t\tevent.stopImmediatePropagation();\n\t\t// @ts-ignore\n\t\treturn fn?.apply(this, args);\n\t};\n}\n\n/**\n * Substitute for the `preventDefault` event modifier\n * @deprecated\n * @param {(event: Event, ...args: Array<unknown>) => void} fn\n * @returns {(event: Event, ...args: unknown[]) => void}\n */\nexport function preventDefault(fn) {\n\treturn function (...args) {\n\t\tvar event = /** @type {Event} */ (args[0]);\n\t\tevent.preventDefault();\n\t\t// @ts-ignore\n\t\treturn fn?.apply(this, args);\n\t};\n}\n\n/**\n * Substitute for the `passive` event modifier, implemented as an action\n * @deprecated\n * @param {HTMLElement} node\n * @param {[event: string, handler: () => EventListener]} options\n */\nexport function passive(node, [event, handler]) {\n\tuser_pre_effect(() => {\n\t\treturn on(node, event, handler() ?? noop, {\n\t\t\tpassive: true\n\t\t});\n\t});\n}\n\n/**\n * Substitute for the `nonpassive` event modifier, implemented as an action\n * @deprecated\n * @param {HTMLElement} node\n * @param {[event: string, handler: () => EventListener]} options\n */\nexport function nonpassive(node, [event, handler]) {\n\tuser_pre_effect(() => {\n\t\treturn on(node, event, handler() ?? noop, {\n\t\t\tpassive: false\n\t\t});\n\t});\n}\n","/** @import { ComponentContextLegacy } from '#client' */\nimport { run, run_all } from '../../../shared/utils.js';\nimport { component_context } from '../../context.js';\nimport { derived } from '../../reactivity/deriveds.js';\nimport { user_pre_effect, user_effect } from '../../reactivity/effects.js';\nimport { deep_read_state, get, untrack } from '../../runtime.js';\n\n/**\n * Legacy-mode only: Call `onMount` callbacks and set up `beforeUpdate`/`afterUpdate` effects\n * @param {boolean} [immutable]\n */\nexport function init(immutable = false) {\n\tconst context = /** @type {ComponentContextLegacy} */ (component_context);\n\n\tconst callbacks = context.l.u;\n\tif (!callbacks) return;\n\n\tlet props = () => deep_read_state(context.s);\n\n\tif (immutable) {\n\t\tlet version = 0;\n\t\tlet prev = /** @type {Record<string, any>} */ ({});\n\n\t\t// In legacy immutable mode, before/afterUpdate only fire if the object identity of a prop changes\n\t\tconst d = derived(() => {\n\t\t\tlet changed = false;\n\t\t\tconst props = context.s;\n\t\t\tfor (const key in props) {\n\t\t\t\tif (props[key] !== prev[key]) {\n\t\t\t\t\tprev[key] = props[key];\n\t\t\t\t\tchanged = true;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (changed) version++;\n\t\t\treturn version;\n\t\t});\n\n\t\tprops = () => get(d);\n\t}\n\n\t// beforeUpdate\n\tif (callbacks.b.length) {\n\t\tuser_pre_effect(() => {\n\t\t\tobserve_all(context, props);\n\t\t\trun_all(callbacks.b);\n\t\t});\n\t}\n\n\t// onMount (must run before afterUpdate)\n\tuser_effect(() => {\n\t\tconst fns = untrack(() => callbacks.m.map(run));\n\t\treturn () => {\n\t\t\tfor (const fn of fns) {\n\t\t\t\tif (typeof fn === 'function') {\n\t\t\t\t\tfn();\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t});\n\n\t// afterUpdate\n\tif (callbacks.a.length) {\n\t\tuser_effect(() => {\n\t\t\tobserve_all(context, props);\n\t\t\trun_all(callbacks.a);\n\t\t});\n\t}\n}\n\n/**\n * Invoke the getter of all signals associated with a component\n * so they can be registered to the effect this function is called in.\n * @param {ComponentContextLegacy} context\n * @param {(() => void)} props\n */\nfunction observe_all(context, props) {\n\tif (context.l.s) {\n\t\tfor (const signal of context.l.s) get(signal);\n\t}\n\n\tprops();\n}\n","import { set, source } from '../../reactivity/sources.js';\nimport { get } from '../../runtime.js';\nimport { is_array } from '../../../shared/utils.js';\n\n/**\n * Under some circumstances, imports may be reactive in legacy mode. In that case,\n * they should be using `reactive_import` as part of the transformation\n * @param {() => any} fn\n */\nexport function reactive_import(fn) {\n\tvar s = source(0);\n\n\treturn function () {\n\t\tif (arguments.length === 1) {\n\t\t\tset(s, get(s) + 1);\n\t\t\treturn arguments[0];\n\t\t} else {\n\t\t\tget(s);\n\t\t\treturn fn();\n\t\t}\n\t};\n}\n\n/**\n * @this {any}\n * @param {Record<string, unknown>} $$props\n * @param {Event} event\n * @returns {void}\n */\nexport function bubble_event($$props, event) {\n\tvar events = /** @type {Record<string, Function[] | Function>} */ ($$props.$$events)?.[\n\t\tevent.type\n\t];\n\n\tvar callbacks = is_array(events) ? events.slice() : events == null ? [] : [events];\n\n\tfor (var fn of callbacks) {\n\t\t// Preserve \"this\" context\n\t\tfn.call(this, event);\n\t}\n}\n\n/**\n * Used to simulate `$on` on a component instance when `compatibility.componentApi === 4`\n * @param {Record<string, any>} $$props\n * @param {string} event_name\n * @param {Function} event_callback\n */\nexport function add_legacy_event_listener($$props, event_name, event_callback) {\n\t$$props.$$events ||= {};\n\t$$props.$$events[event_name] ||= [];\n\t$$props.$$events[event_name].push(event_callback);\n}\n\n/**\n * Used to simulate `$set` on a component instance when `compatibility.componentApi === 4`.\n * Needs component accessors so that it can call the setter of the prop. Therefore doesn't\n * work for updating props in `$$props` or `$$restProps`.\n * @this {Record<string, any>}\n * @param {Record<string, any>} $$new_props\n */\nexport function update_legacy_props($$new_props) {\n\tfor (var key in $$new_props) {\n\t\tif (key in this) {\n\t\t\tthis[key] = $$new_props[key];\n\t\t}\n\t}\n}\n","/** @import { Effect, Source } from './types.js' */\nimport { DEV } from 'esm-env';\nimport {\n\tPROPS_IS_BINDABLE,\n\tPROPS_IS_IMMUTABLE,\n\tPROPS_IS_LAZY_INITIAL,\n\tPROPS_IS_RUNES,\n\tPROPS_IS_UPDATED\n} from '../../../constants.js';\nimport { get_descriptor, is_function } from '../../shared/utils.js';\nimport { set, source, update } from './sources.js';\nimport { derived, derived_safe_equal } from './deriveds.js';\nimport {\n\tactive_effect,\n\tget,\n\tis_destroying_effect,\n\tset_active_effect,\n\tuntrack\n} from '../runtime.js';\nimport * as e from '../errors.js';\nimport { DESTROYED, LEGACY_PROPS, STATE_SYMBOL } from '#client/constants';\nimport { proxy } from '../proxy.js';\nimport { capture_store_binding } from './store.js';\nimport { legacy_mode_flag } from '../../flags/index.js';\nimport { effect, render_effect } from './effects.js';\n\n/**\n * @param {((value?: number) => number)} fn\n * @param {1 | -1} [d]\n * @returns {number}\n */\nexport function update_prop(fn, d = 1) {\n\tconst value = fn();\n\tfn(value + d);\n\treturn value;\n}\n\n/**\n * @param {((value?: number) => number)} fn\n * @param {1 | -1} [d]\n * @returns {number}\n */\nexport function update_pre_prop(fn, d = 1) {\n\tconst value = fn() + d;\n\tfn(value);\n\treturn value;\n}\n\n/**\n * The proxy handler for rest props (i.e. `const { x, ...rest } = $props()`).\n * Is passed the full `$$props` object and excludes the named props.\n * @type {ProxyHandler<{ props: Record<string | symbol, unknown>, exclude: Array<string | symbol>, name?: string }>}}\n */\nconst rest_props_handler = {\n\tget(target, key) {\n\t\tif (target.exclude.includes(key)) return;\n\t\treturn target.props[key];\n\t},\n\tset(target, key) {\n\t\tif (DEV) {\n\t\t\t// TODO should this happen in prod too?\n\t\t\te.props_rest_readonly(`${target.name}.${String(key)}`);\n\t\t}\n\n\t\treturn false;\n\t},\n\tgetOwnPropertyDescriptor(target, key) {\n\t\tif (target.exclude.includes(key)) return;\n\t\tif (key in target.props) {\n\t\t\treturn {\n\t\t\t\tenumerable: true,\n\t\t\t\tconfigurable: true,\n\t\t\t\tvalue: target.props[key]\n\t\t\t};\n\t\t}\n\t},\n\thas(target, key) {\n\t\tif (target.exclude.includes(key)) return false;\n\t\treturn key in target.props;\n\t},\n\townKeys(target) {\n\t\treturn Reflect.ownKeys(target.props).filter((key) => !target.exclude.includes(key));\n\t}\n};\n\n/**\n * @param {Record<string, unknown>} props\n * @param {string[]} exclude\n * @param {string} [name]\n * @returns {Record<string, unknown>}\n */\n/*#__NO_SIDE_EFFECTS__*/\nexport function rest_props(props, exclude, name) {\n\treturn new Proxy(\n\t\tDEV ? { props, exclude, name, other: {}, to_proxy: [] } : { props, exclude },\n\t\trest_props_handler\n\t);\n}\n\n/**\n * The proxy handler for legacy $$restProps and $$props\n * @type {ProxyHandler<{ props: Record<string | symbol, unknown>, exclude: Array<string | symbol>, special: Record<string | symbol, (v?: unknown) => unknown>, version: Source<number>, parent_effect: Effect }>}}\n */\nconst legacy_rest_props_handler = {\n\tget(target, key) {\n\t\tif (target.exclude.includes(key)) return;\n\t\tget(target.version);\n\t\treturn key in target.special ? target.special[key]() : target.props[key];\n\t},\n\tset(target, key, value) {\n\t\tif (!(key in target.special)) {\n\t\t\tvar previous_effect = active_effect;\n\n\t\t\ttry {\n\t\t\t\tset_active_effect(target.parent_effect);\n\n\t\t\t\t// Handle props that can temporarily get out of sync with the parent\n\t\t\t\t/** @type {Record<string, (v?: unknown) => unknown>} */\n\t\t\t\ttarget.special[key] = prop(\n\t\t\t\t\t{\n\t\t\t\t\t\tget [key]() {\n\t\t\t\t\t\t\treturn target.props[key];\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\t/** @type {string} */ (key),\n\t\t\t\t\tPROPS_IS_UPDATED\n\t\t\t\t);\n\t\t\t} finally {\n\t\t\t\tset_active_effect(previous_effect);\n\t\t\t}\n\t\t}\n\n\t\ttarget.special[key](value);\n\t\tupdate(target.version); // $$props is coarse-grained: when $$props.x is updated, usages of $$props.y etc are also rerun\n\t\treturn true;\n\t},\n\tgetOwnPropertyDescriptor(target, key) {\n\t\tif (target.exclude.includes(key)) return;\n\t\tif (key in target.props) {\n\t\t\treturn {\n\t\t\t\tenumerable: true,\n\t\t\t\tconfigurable: true,\n\t\t\t\tvalue: target.props[key]\n\t\t\t};\n\t\t}\n\t},\n\tdeleteProperty(target, key) {\n\t\t// Svelte 4 allowed for deletions on $$restProps\n\t\tif (target.exclude.includes(key)) return true;\n\t\ttarget.exclude.push(key);\n\t\tupdate(target.version);\n\t\treturn true;\n\t},\n\thas(target, key) {\n\t\tif (target.exclude.includes(key)) return false;\n\t\treturn key in target.props;\n\t},\n\townKeys(target) {\n\t\treturn Reflect.ownKeys(target.props).filter((key) => !target.exclude.includes(key));\n\t}\n};\n\n/**\n * @param {Record<string, unknown>} props\n * @param {string[]} exclude\n * @returns {Record<string, unknown>}\n */\nexport function legacy_rest_props(props, exclude) {\n\treturn new Proxy(\n\t\t{\n\t\t\tprops,\n\t\t\texclude,\n\t\t\tspecial: {},\n\t\t\tversion: source(0),\n\t\t\t// TODO this is only necessary because we need to track component\n\t\t\t// destruction inside `prop`, because of `bind:this`, but it\n\t\t\t// seems likely that we can simplify `bind:this` instead\n\t\t\tparent_effect: /** @type {Effect} */ (active_effect)\n\t\t},\n\t\tlegacy_rest_props_handler\n\t);\n}\n\n/**\n * The proxy handler for spread props. Handles the incoming array of props\n * that looks like `() => { dynamic: props }, { static: prop }, ..` and wraps\n * them so that the whole thing is passed to the component as the `$$props` argument.\n * @type {ProxyHandler<{ props: Array<Record<string | symbol, unknown> | (() => Record<string | symbol, unknown>)> }>}}\n */\nconst spread_props_handler = {\n\tget(target, key) {\n\t\tlet i = target.props.length;\n\t\twhile (i--) {\n\t\t\tlet p = target.props[i];\n\t\t\tif (is_function(p)) p = p();\n\t\t\tif (typeof p === 'object' && p !== null && key in p) return p[key];\n\t\t}\n\t},\n\tset(target, key, value) {\n\t\tlet i = target.props.length;\n\t\twhile (i--) {\n\t\t\tlet p = target.props[i];\n\t\t\tif (is_function(p)) p = p();\n\t\t\tconst desc = get_descriptor(p, key);\n\t\t\tif (desc && desc.set) {\n\t\t\t\tdesc.set(value);\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t},\n\tgetOwnPropertyDescriptor(target, key) {\n\t\tlet i = target.props.length;\n\t\twhile (i--) {\n\t\t\tlet p = target.props[i];\n\t\t\tif (is_function(p)) p = p();\n\t\t\tif (typeof p === 'object' && p !== null && key in p) {\n\t\t\t\tconst descriptor = get_descriptor(p, key);\n\t\t\t\tif (descriptor && !descriptor.configurable) {\n\t\t\t\t\t// Prevent a \"Non-configurability Report Error\": The target is an array, it does\n\t\t\t\t\t// not actually contain this property. If it is now described as non-configurable,\n\t\t\t\t\t// the proxy throws a validation error. Setting it to true avoids that.\n\t\t\t\t\tdescriptor.configurable = true;\n\t\t\t\t}\n\t\t\t\treturn descriptor;\n\t\t\t}\n\t\t}\n\t},\n\thas(target, key) {\n\t\t// To prevent a false positive `is_entry_props` in the `prop` function\n\t\tif (key === STATE_SYMBOL || key === LEGACY_PROPS) return false;\n\n\t\tfor (let p of target.props) {\n\t\t\tif (is_function(p)) p = p();\n\t\t\tif (p != null && key in p) return true;\n\t\t}\n\n\t\treturn false;\n\t},\n\townKeys(target) {\n\t\t/** @type {Array<string | symbol>} */\n\t\tconst keys = [];\n\n\t\tfor (let p of target.props) {\n\t\t\tif (is_function(p)) p = p();\n\t\t\tif (!p) continue;\n\n\t\t\tfor (const key in p) {\n\t\t\t\tif (!keys.includes(key)) keys.push(key);\n\t\t\t}\n\n\t\t\tfor (const key of Object.getOwnPropertySymbols(p)) {\n\t\t\t\tif (!keys.includes(key)) keys.push(key);\n\t\t\t}\n\t\t}\n\n\t\treturn keys;\n\t}\n};\n\n/**\n * @param {Array<Record<string, unknown> | (() => Record<string, unknown>)>} props\n * @returns {any}\n */\nexport function spread_props(...props) {\n\treturn new Proxy({ props }, spread_props_handler);\n}\n\n/**\n * This function is responsible for synchronizing a possibly bound prop with the inner component state.\n * It is used whenever the compiler sees that the component writes to the prop, or when it has a default prop_value.\n * @template V\n * @param {Record<string, unknown>} props\n * @param {string} key\n * @param {number} flags\n * @param {V | (() => V)} [fallback]\n * @returns {(() => V | ((arg: V) => V) | ((arg: V, mutation: boolean) => V))}\n */\nexport function prop(props, key, flags, fallback) {\n\tvar runes = !legacy_mode_flag || (flags & PROPS_IS_RUNES) !== 0;\n\tvar bindable = (flags & PROPS_IS_BINDABLE) !== 0;\n\tvar lazy = (flags & PROPS_IS_LAZY_INITIAL) !== 0;\n\n\tvar fallback_value = /** @type {V} */ (fallback);\n\tvar fallback_dirty = true;\n\n\tvar get_fallback = () => {\n\t\tif (fallback_dirty) {\n\t\t\tfallback_dirty = false;\n\n\t\t\tfallback_value = lazy\n\t\t\t\t? untrack(/** @type {() => V} */ (fallback))\n\t\t\t\t: /** @type {V} */ (fallback);\n\t\t}\n\n\t\treturn fallback_value;\n\t};\n\n\t/** @type {((v: V) => void) | undefined} */\n\tlet setter;\n\n\tif (bindable) {\n\t\t// Can be the case when someone does `mount(Component, props)` with `let props = $state({...})`\n\t\t// or `createClassComponent(Component, props)`\n\t\tvar is_entry_props = STATE_SYMBOL in props || LEGACY_PROPS in props;\n\n\t\tsetter =\n\t\t\tget_descriptor(props, key)?.set ??\n\t\t\t(is_entry_props && key in props ? (v) => (props[key] = v) : undefined);\n\t}\n\n\t/** @type {V} */\n\tvar initial_value;\n\tvar is_store_sub = false;\n\n\tif (bindable) {\n\t\t[initial_value, is_store_sub] = capture_store_binding(() => /** @type {V} */ (props[key]));\n\t} else {\n\t\tinitial_value = /** @type {V} */ (props[key]);\n\t}\n\n\tif (initial_value === undefined && fallback !== undefined) {\n\t\tinitial_value = get_fallback();\n\n\t\tif (setter) {\n\t\t\tif (runes) e.props_invalid_value(key);\n\t\t\tsetter(initial_value);\n\t\t}\n\t}\n\n\t/** @type {() => V} */\n\tvar getter;\n\n\tif (runes) {\n\t\tgetter = () => {\n\t\t\tvar value = /** @type {V} */ (props[key]);\n\t\t\tif (value === undefined) return get_fallback();\n\t\t\tfallback_dirty = true;\n\t\t\treturn value;\n\t\t};\n\t} else {\n\t\tgetter = () => {\n\t\t\tvar value = /** @type {V} */ (props[key]);\n\n\t\t\tif (value !== undefined) {\n\t\t\t\t// in legacy mode, we don't revert to the fallback value\n\t\t\t\t// if the prop goes from defined to undefined. The easiest\n\t\t\t\t// way to model this is to make the fallback undefined\n\t\t\t\t// as soon as the prop has a value\n\t\t\t\tfallback_value = /** @type {V} */ (undefined);\n\t\t\t}\n\n\t\t\treturn value === undefined ? fallback_value : value;\n\t\t};\n\t}\n\n\t// prop is never written to — we only need a getter\n\tif (runes && (flags & PROPS_IS_UPDATED) === 0) {\n\t\treturn getter;\n\t}\n\n\t// prop is written to, but the parent component had `bind:foo` which\n\t// means we can just call `$$props.foo = value` directly\n\tif (setter) {\n\t\tvar legacy_parent = props.$$legacy;\n\t\treturn /** @type {() => V} */ (\n\t\t\tfunction (/** @type {V} */ value, /** @type {boolean} */ mutation) {\n\t\t\t\tif (arguments.length > 0) {\n\t\t\t\t\t// We don't want to notify if the value was mutated and the parent is in runes mode.\n\t\t\t\t\t// In that case the state proxy (if it exists) should take care of the notification.\n\t\t\t\t\t// If the parent is not in runes mode, we need to notify on mutation, too, that the prop\n\t\t\t\t\t// has changed because the parent will not be able to detect the change otherwise.\n\t\t\t\t\tif (!runes || !mutation || legacy_parent || is_store_sub) {\n\t\t\t\t\t\t/** @type {Function} */ (setter)(mutation ? getter() : value);\n\t\t\t\t\t}\n\n\t\t\t\t\treturn value;\n\t\t\t\t}\n\n\t\t\t\treturn getter();\n\t\t\t}\n\t\t);\n\t}\n\n\t// Either prop is written to, but there's no binding, which means we\n\t// create a derived that we can write to locally.\n\t// Or we are in legacy mode where we always create a derived to replicate that\n\t// Svelte 4 did not trigger updates when a primitive value was updated to the same value.\n\tvar overridden = false;\n\n\tvar d = ((flags & PROPS_IS_IMMUTABLE) !== 0 ? derived : derived_safe_equal)(() => {\n\t\toverridden = false;\n\t\treturn getter();\n\t});\n\n\tif (DEV) {\n\t\td.label = key;\n\t}\n\n\t// Capture the initial value if it's bindable\n\tif (bindable) get(d);\n\n\tvar parent_effect = /** @type {Effect} */ (active_effect);\n\n\treturn /** @type {() => V} */ (\n\t\tfunction (/** @type {any} */ value, /** @type {boolean} */ mutation) {\n\t\t\tif (arguments.length > 0) {\n\t\t\t\tconst new_value = mutation ? get(d) : runes && bindable ? proxy(value) : value;\n\n\t\t\t\tset(d, new_value);\n\t\t\t\toverridden = true;\n\n\t\t\t\tif (fallback_value !== undefined) {\n\t\t\t\t\tfallback_value = new_value;\n\t\t\t\t}\n\n\t\t\t\treturn value;\n\t\t\t}\n\n\t\t\t// special case — avoid recalculating the derived if we're in a\n\t\t\t// teardown function and the prop was overridden locally, or the\n\t\t\t// component was already destroyed (people could access props in a timeout)\n\t\t\tif ((is_destroying_effect && overridden) || (parent_effect.f & DESTROYED) !== 0) {\n\t\t\t\treturn d.v;\n\t\t\t}\n\n\t\t\treturn get(d);\n\t\t}\n\t);\n}\n","/**\n * Create a lightweight debug function to log output into the browser console.\n *\n * Inspired by https://github.com/visionmedia/debug (some code is copied below)\n *\n * Usage:\n *\n * import { createDebug } from './debug.js'\n *\n * const debug = createDebug('my:namespace')\n *\n * debug('testing:', 2 + 2)\n *\n * By default, logging is only enabled when a property DEBUG is set in the\n * localStorage of your browser:\n *\n * localStorage['debug'] = '*'\n * localStorage['debug'] = 'jsoneditor:*'\n * localStorage['debug'] = 'jsoneditor:TreeMode'\n *\n * The actual value of 'debug' is used to filter the debug messages.\n * The value can end with a '*' wild card to match any remaining text.\n *\n * By providing a value for `enabled`, you can choose conditions to\n * enable/disable debugging if you want, for example some flag determining\n * whether in development or production.\n */\nexport function createDebug(\n namespace: string,\n enabled = enableDebug(namespace)\n): (...args: unknown[]) => void {\n if (!enabled) {\n return noop\n }\n\n const color = selectColor(namespace)\n\n return function debug(...args) {\n console.log(`%c${namespace}`, `color:${color}`, ...args)\n }\n}\n\nfunction enableDebug(namespace: string) {\n const debug = tryReadLocalStorage('debug')\n\n return debug?.endsWith('*') ? namespace.startsWith(debug.slice(0, -1)) : namespace === debug\n}\n\nfunction noop() {\n // no operation\n}\n\n/**\n * Try read a specific key from localStorage\n */\nfunction tryReadLocalStorage(key: string): string | undefined {\n try {\n if (typeof window !== 'undefined' && typeof window.localStorage !== 'undefined') {\n // reading local storage can fail for example because of security restrictions\n return window.localStorage[key]\n }\n } catch {\n // we do nothing with the error, not needed in this specific case\n }\n\n return undefined\n}\n\n/**\n * Selects a color for a debug namespace\n *\n * Code is copied from the following source: https://github.com/visionmedia/debug\n *\n * @param namespace The namespace string for the debug instance to be colored\n * @return An ANSI color code for the given namespace\n */\nfunction selectColor(namespace: string): string {\n let hash = 0\n\n for (let i = 0; i < namespace.length; i++) {\n hash = (hash << 5) - hash + namespace.charCodeAt(i)\n hash |= 0 // Convert to 32bit integer\n }\n\n return colors[Math.abs(hash) % colors.length]\n}\n\nconst colors = [\n '#0000CC',\n '#0099FF',\n '#009400',\n '#8dd200',\n '#CCCC00',\n '#CC9933',\n '#ae04e7',\n '#ff35d7',\n '#FF3333',\n '#FF6600',\n '#FF9933',\n '#FFCC33'\n]\n","let id = 0\n\nexport function uniqueId(): number {\n id++\n return id\n}\n","export function int(value: string): number {\n return parseInt(value, 10)\n}\n\nexport function isDigit(char: string): boolean {\n return DIGIT_REGEX.test(char)\n}\n\nconst DIGIT_REGEX = /^[0-9]$/\n\n// TODO: unit test\nexport function containsNumber(value: string): boolean {\n return NUMBER_REGEX.test(value)\n}\n\nconst NUMBER_REGEX = /^-?(?:0|[1-9]\\d*)(?:\\.\\d+)?(?:[eE][+-]?\\d+)?$/\n","// TODO: unit test typeUtils.js\n\nimport { containsNumber } from './numberUtils.js'\nimport type { JSONParser } from '../types.js'\n\n/**\n * Test whether a value is an Object (and not an Array or Class)\n */\nexport function isObject(value: unknown): value is Record<string, unknown> {\n // note that we check constructor.name, not constructor === Object,\n // so we can use objects created in a different JS realm like an iframe.\n return (\n typeof value === 'object' &&\n value !== null &&\n (value.constructor === undefined || value.constructor.name === 'Object')\n )\n}\n\n/**\n * Test whether a value is an Object or an Array (and not a Class)\n */\nexport function isObjectOrArray(value: unknown): value is object | Array<unknown> {\n // Note that we check constructor.name, not constructor === Object,\n // so we can use objects created in a different JS realm like an iframe.\n return (\n typeof value === 'object' &&\n value !== null &&\n (value.constructor === undefined ||\n value.constructor.name === 'Object' ||\n value.constructor.name === 'Array')\n )\n}\n\n/**\n * Test whether a value is a boolean\n *\n * @param {*} value\n * @return {boolean}\n */\nexport function isBoolean(value: unknown): value is boolean {\n return value === true || value === false\n}\n\n/**\n * Test whether a value is a timestamp in milliseconds after the year 2000.\n */\nexport function isTimestamp(value: unknown): boolean {\n const YEAR_2000 = 946684800000\n\n if (typeof value === 'number') {\n return (\n value > YEAR_2000 &&\n isFinite(value) &&\n Math.floor(value) === value &&\n !isNaN(new Date(value).valueOf())\n )\n }\n\n if (typeof value === 'bigint') {\n return isTimestamp(Number(value))\n }\n\n // try getting the primitive value if that is different. For example when having a LosslessNumber\n try {\n const valueOf = value ? value.valueOf() : value\n if (valueOf !== value) {\n return isTimestamp(valueOf)\n }\n } catch {\n return false\n }\n\n return false\n}\n\n/**\n * Get the applied color given a color name or code\n * Returns the color if the input is a valid color, and returns null otherwise.\n *\n * Example output:\n *\n * 'rgba(255,0,0,0.7)' or 'rgb(255,0,0)'\n *\n * Source: https://stackoverflow.com/questions/6386090/validating-css-color-names/33184805\n */\nexport function getColorCSS(color: string): string | undefined {\n colorTestDiv = colorTestDiv || window.document.createElement('div')\n\n colorTestDiv.style.color = ''\n colorTestDiv.style.color = color\n\n const applied = colorTestDiv.style.color\n return applied !== '' ? applied.replace(/\\s+/g, '').toLowerCase() : undefined\n}\nlet colorTestDiv: HTMLDivElement | undefined = undefined\n\n/**\n * Test if a string contains a valid color name or code.\n * Returns true if a valid color, false otherwise\n */\nexport function isColor(value: unknown): boolean {\n const maxColorLength = 99\n return typeof value === 'string' && value.length < maxColorLength && !!getColorCSS(value)\n}\n\n/**\n * Get the type of the value\n */\nexport function valueType(value: unknown, parser: JSONParser): string {\n // primitive types\n if (\n typeof value === 'number' ||\n typeof value === 'string' ||\n typeof value === 'boolean' ||\n typeof value === 'undefined'\n ) {\n return typeof value\n }\n if (typeof value === 'bigint') {\n return 'number' // we return number here, not bigint: all numeric types should return the same name\n }\n if (value === null) {\n return 'null'\n }\n\n if (Array.isArray(value)) {\n return 'array'\n }\n if (isObject(value)) {\n // plain object only\n return 'object'\n }\n\n // unknown type (like a LosslessNumber). Try out what stringfying results in\n const valueStr = parser.stringify(value)\n if (valueStr && containsNumber(valueStr)) {\n return 'number'\n }\n if (valueStr === 'true' || valueStr === 'false') {\n return 'boolean'\n }\n if (valueStr === 'null') {\n return 'null'\n }\n\n return 'unknown'\n}\n\n/**\n * Test whether a text contains a url (matches when a string starts\n * with 'http://*' or 'https://*' and has no whitespace characters)\n */\nconst isUrlRegex = /^https?:\\/\\/\\S+$/\nexport function isUrl(text: unknown): boolean {\n return typeof text === 'string' && isUrlRegex.test(text)\n}\n\n/**\n * Convert contents of a string to the correct JSON type. This can be a string,\n * a number, a boolean, etc\n */\nexport function stringConvert(str: string, parser: JSONParser): unknown {\n if (str === '') {\n return ''\n }\n\n const strTrim = str.trim()\n\n if (strTrim === 'null') {\n return null\n }\n\n if (strTrim === 'true') {\n return true\n }\n\n if (strTrim === 'false') {\n return false\n }\n\n if (containsNumber(strTrim)) {\n return parser.parse(strTrim)\n }\n\n return str\n}\n\n/**\n * Test whether a string contains a numeric, boolean, or null value.\n * Returns true when the string contains a number, boolean, or null.\n */\nexport function isStringContainingPrimitiveValue(str: unknown): boolean {\n // note that we can safely use JSON parser here instead of the configured JSONParser,\n // since we do not actually use the parsed number, just want to check that it is not a string\n return typeof str === 'string' && typeof stringConvert(str, JSON) !== 'string'\n}\n\n/**\n * Test whether a string contains an integer number\n */\nexport function isInteger(value: string): boolean {\n return INTEGER_REGEX.test(value)\n}\n\nconst INTEGER_REGEX = /^-?[0-9]+$/\n","import { isObject } from './typeUtils.js'\nimport type { JSONPath } from 'immutable-json-patch'\nimport { compileJSONPointer, parseJSONPointer } from 'immutable-json-patch'\nimport { isEqual } from 'lodash-es'\n\nconst MAX_ITEM_PATHS_COLLECTION = 10000\nconst ROOT_PATH: JSONPath = []\n\n/**\n * Comparator to sort an array in ascending order\n *\n * Usage:\n * [4,2,5].sort(compareAsc) // [2,4,5]\n */\nexport function compareAsc<T>(a: T, b: T): number {\n return a > b ? 1 : a < b ? -1 : 0\n}\n\n/**\n * Comparator to sort an array in ascending order\n *\n * Usage:\n * [4,2,5].sort(compareDesc) // [5,4,2]\n */\nexport function compareDesc<T>(a: T, b: T): number {\n return a > b ? -1 : a < b ? 1 : 0\n}\n\n/**\n * Test whether all items of an array are strictly equal\n */\nexport function strictShallowEqual<T>(a: Array<T>, b: Array<T>): boolean {\n if (a.length !== b.length) {\n return false\n }\n\n for (let i = 0; i < a.length; i++) {\n if (a[i] !== b[i]) {\n return false\n }\n }\n\n return true\n}\n\nexport function compareArrays<T>(a: Array<T>, b: Array<T>): number {\n const minLength = Math.min(a.length, b.length)\n\n for (let i = 0; i < minLength; i++) {\n if (a[i] < b[i]) {\n return -1\n }\n\n if (a[i] > b[i]) {\n return 1\n }\n }\n\n return a.length - b.length\n}\n\n/**\n * Get the paths of all nested properties in the items of an array\n * @param array\n * @param includeObjects If true, object and array paths are returned as well\n */\nexport function getNestedPaths(array: unknown, includeObjects = false): JSONPath[] {\n const pointersMap: Record<string, boolean> = {}\n\n if (!Array.isArray(array)) {\n throw new TypeError('Array expected')\n }\n\n function recurseNestedPaths(obj: unknown, path: JSONPath) {\n const isValue = !Array.isArray(obj) && !isObject(obj)\n\n if (isValue || (includeObjects && path.length > 0)) {\n pointersMap[compileJSONPointer(path)] = true\n }\n\n if (isObject(obj)) {\n Object.keys(obj).forEach((key) => {\n recurseNestedPaths(obj[key], path.concat(key))\n })\n }\n }\n\n const max = Math.min(array.length, MAX_ITEM_PATHS_COLLECTION)\n for (let i = 0; i < max; i++) {\n const item = array[i]\n recurseNestedPaths(item, ROOT_PATH)\n }\n\n const pathsArray = Object.keys(pointersMap).sort()\n\n return pathsArray.map(parseJSONPointer)\n}\n\n/**\n * Invoke the callback with\n * @param start Included start index\n * @param end Excluded end index. End must be larger or equal to start\n * @param iteratee\n */\n// TODO: write tests\nexport function forEachIndex(start: number, end: number, iteratee: (index: number) => void) {\n if (end <= start) {\n return\n }\n\n for (let index = start; index < end; index++) {\n iteratee(index)\n }\n}\n\n/**\n * Limit the number of items in an array\n */\n// TODO: write unit test\nexport function limit<T>(array: Array<T>, max: number): Array<T> {\n return array.length > max ? array.slice(0, max) : array\n}\n\n/**\n * Convert an array into an object having the array indices as keys\n */\nexport function arrayToObject<T>(array: Array<T>): Record<number, T> {\n return {\n ...array\n }\n}\n\n/**\n * Get the values of an object as an array\n */\nexport function objectToArray<T>(object: Record<string, T>): Array<T> {\n return Object.values(object)\n}\n\n/**\n * Test whether an array starts with a sub array\n */\nexport function arrayStartsWith<T>(\n array: T[],\n searchArray: T[],\n equal: (a: T, b: T) => boolean = isEqual\n): boolean {\n for (let i = 0; i < searchArray.length; i++) {\n if (!equal(array[i], searchArray[i])) {\n return false\n }\n }\n\n return true\n}\n\n/**\n * Move a set of items inside an array\n */\nexport function moveItems<T>(array: T[], index: number, count: number, offset: number): T[] {\n // TODO: check boundaries: index+offset >= 0, index+offset+count<array.length, index+count<array.length, etc\n const copy = array.slice(0)\n const moving: T[] = copy.splice(index, count)\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n copy.splice.apply(copy, [index + offset, 0, ...moving])\n return copy\n}\n\n/**\n * Take samples out of a large array, equally spread from start till end\n */\nexport function forEachSample<T>(\n array: T[],\n maxSampleCount: number,\n callback: (item: T, index: number, array: T[]) => void\n) {\n if (array.length < maxSampleCount) {\n array.forEach(callback)\n } else {\n const step = maxSampleCount > 1 ? (array.length - 1) / (maxSampleCount - 1) : array.length\n for (let i = 0; i < maxSampleCount; i++) {\n const index = Math.floor(i * step)\n callback(array[index], index, array)\n }\n }\n}\n\nexport function insertItemsAt<T>(array: T[], index: number, items: T[]): T[] {\n return array.slice(0, index).concat(items).concat(array.slice(index))\n}\n","import type { JSONPath } from 'immutable-json-patch'\nimport { compileJSONPointer } from 'immutable-json-patch'\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore\nimport jsonSourceMap from 'json-source-map'\nimport { jsonrepair } from 'jsonrepair'\nimport { isObject, isObjectOrArray, valueType } from './typeUtils.js'\nimport { arrayToObject, objectToArray } from './arrayUtils.js'\nimport type {\n Content,\n JSONContent,\n JSONParser,\n ParseError,\n TextContent,\n TextLocation\n} from '../types'\nimport { int } from './numberUtils.js'\n\n/**\n * Parse the JSON. if this fails, try to repair and parse.\n * Throws an exception when the JSON is invalid and could not be parsed.\n */\nexport function parseAndRepair(jsonText: string, parser: JSONParser): unknown {\n try {\n return parser.parse(jsonText)\n } catch {\n // this can also throw\n return parser.parse(jsonrepair(jsonText))\n }\n}\n\n/**\n * Parse the JSON and if needed repair it.\n * When not valid, undefined is returned.\n */\nexport function parseAndRepairOrUndefined(\n partialJson: string,\n parser: JSONParser\n): unknown | undefined {\n try {\n return parseAndRepair(partialJson, parser)\n } catch {\n return undefined\n }\n}\n\n// TODO: deduplicate the logic in repairPartialJson and parseAndRepairPartialJson ?\nexport function parsePartialJson(partialJson: string, parse: (text: string) => unknown): unknown {\n // for now: dumb brute force approach: simply try out a few things...\n\n // remove trailing comma\n partialJson = partialJson.replace(END_WITH_COMMA_AND_OPTIONAL_WHITESPACES_REGEX, '')\n\n try {\n return parse(partialJson)\n } catch {\n // we ignore the error on purpose\n }\n\n try {\n return parse('{' + partialJson + '}')\n } catch {\n // we ignore the error on purpose\n }\n\n try {\n return parse('[' + partialJson + ']')\n } catch {\n // we ignore the error on purpose\n }\n\n throw new Error('Failed to parse partial JSON')\n}\n\n/**\n * Repair partial JSON\n */\nexport function repairPartialJson(partialJson: string): string {\n // for now: dumb brute force approach: simply try out a few things...\n\n // remove trailing comma\n partialJson = partialJson.replace(END_WITH_COMMA_AND_OPTIONAL_WHITESPACES_REGEX, '')\n\n try {\n return jsonrepair(partialJson)\n } catch {\n // we ignore the error on purpose\n }\n\n try {\n const repaired = jsonrepair('[' + partialJson + ']')\n return repaired.substring(1, repaired.length - 1) // remove the outer [...] again\n } catch {\n // we ignore the error on purpose\n }\n\n try {\n const repaired = jsonrepair('{' + partialJson + '}')\n return repaired.substring(1, repaired.length - 1) // remove the outer {...} again\n } catch {\n // we ignore the error on purpose\n }\n\n throw new Error('Failed to repair partial JSON')\n}\n\n// test whether a string ends with a comma, followed by zero or more white space characters\nconst END_WITH_COMMA_AND_OPTIONAL_WHITESPACES_REGEX = /,\\s*$/\n\n/**\n * Normalize a parse error message like\n * \"Unexpected token i in JSON at position 4\"\n * or\n * \"JSON.parse: expected property name or '}' at line 2 column 3 of the JSON data\"\n * and return the line and column numbers in an object\n *\n * Note that the returned line and column number in the object are zero-based,\n * and in the message are one based (human-readable)\n */\nexport function normalizeJsonParseError(jsonText: string, parseErrorMessage: string): ParseError {\n const positionMatch = POSITION_REGEX.exec(parseErrorMessage)\n\n if (positionMatch) {\n // a message from Chrome, like \"Unexpected token i in JSON at line 2 column 3\"\n const position = int(positionMatch[2])\n\n const line = countCharacterOccurrences(jsonText, '\\n', 0, position)\n const lastIndex = jsonText.lastIndexOf('\\n', position)\n const column = position - lastIndex - 1\n\n return {\n position,\n line,\n column,\n message: parseErrorMessage.replace(POSITION_REGEX, () => {\n return `line ${line + 1} column ${column + 1}`\n })\n }\n } else {\n // a message from Firefox, like \"JSON.parse: expected property name or '}' at line 2 column 3 of the JSON data\"\n const lineMatch = LINE_REGEX.exec(parseErrorMessage)\n const lineOneBased = lineMatch ? int(lineMatch[1]) : undefined\n const line = lineOneBased !== undefined ? lineOneBased - 1 : undefined\n\n const columnMatch = COLUMN_REGEX.exec(parseErrorMessage)\n const columnOneBased = columnMatch ? int(columnMatch[1]) : undefined\n const column = columnOneBased !== undefined ? columnOneBased - 1 : undefined\n\n const position =\n line !== undefined && column !== undefined\n ? calculatePosition(jsonText, line, column)\n : undefined\n\n // line and column are one based in the message\n return {\n position,\n line,\n column,\n message: parseErrorMessage.replace(/^JSON.parse: /, '').replace(/ of the JSON data$/, '')\n }\n }\n}\n\n/**\n * Calculate the position in the text based on a line and column number\n * @param text\n * @param line Zero-based line number\n * @param column Zero-based column number\n */\nexport function calculatePosition(text: string, line: number, column: number): number | undefined {\n let index = text.indexOf('\\n')\n let i = 1\n\n while (i < line && index !== -1) {\n index = text.indexOf('\\n', index + 1)\n i++\n }\n\n return index !== -1\n ? index + column + 1 // +1 for the return character itself\n : undefined\n}\n\nexport function countCharacterOccurrences(\n text: string,\n character: string,\n start = 0,\n end = text.length\n) {\n let count = 0\n\n for (let i = start; i < end; i++) {\n if (text.charAt(i) === character) {\n count++\n }\n }\n\n return count\n}\n\n/**\n * Find the text location of a JSON path\n */\n// TODO: write unit tests\nexport function findTextLocation(text: string, path: JSONPath): TextLocation {\n try {\n const jsmap = jsonSourceMap.parse(text)\n\n const pointerName = compileJSONPointer(path)\n const pointer = jsmap.pointers[pointerName]\n if (pointer) {\n return {\n path,\n line: pointer.key ? pointer.key.line : pointer.value ? pointer.value.line : 0,\n column: pointer.key ? pointer.key.column : pointer.value ? pointer.value.column : 0,\n from: pointer.key ? pointer.key.pos : pointer.value ? pointer.value.pos : 0,\n to: pointer.keyEnd ? pointer.keyEnd.pos : pointer.valueEnd ? pointer.valueEnd.pos : 0\n }\n }\n } catch (err) {\n console.error(err)\n }\n\n return {\n path,\n line: 0,\n column: 0,\n from: 0,\n to: 0\n }\n}\n\n/**\n * Convert a JSON object, array, or value to another type\n * If it cannot be converted, an error is thrown\n */\nexport function convertValue(\n value: unknown,\n type: 'value' | 'object' | 'array',\n parser: JSONParser\n): unknown {\n // FIXME: improve the TypeScript here, there are a couple of conversions\n if (type === 'array') {\n if (Array.isArray(value)) {\n // nothing to do\n return value\n }\n\n if (isObject(value)) {\n return objectToArray(value)\n }\n\n if (typeof value === 'string') {\n try {\n const parsedValue = parser.parse(value)\n\n if (Array.isArray(parsedValue)) {\n return parsedValue\n }\n\n if (isObject(parsedValue)) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n return objectToArray(parsedValue)\n }\n } catch {\n //we could not parse the string, so we return the string as the first key of the array\n return [value]\n }\n }\n\n //all other cases, we return the value as the first key of the array, same as the parsing error under the string case\n return [value]\n }\n\n if (type === 'object') {\n if (Array.isArray(value)) {\n return arrayToObject(value)\n }\n\n if (isObject(value)) {\n // nothing to do\n return value\n }\n\n if (typeof value === 'string') {\n try {\n const parsedValue = parser.parse(value)\n\n if (isObject(parsedValue)) {\n return parsedValue\n }\n\n if (Array.isArray(parsedValue)) {\n return arrayToObject(parsedValue)\n }\n } catch {\n //we could not parse the string, so we return the string as the first value of the object with key 'value'\n return { value: value }\n }\n }\n\n //all other cases, we return the value keyed under \"value\", same as the parsing error under the string case\n return { value: value }\n }\n\n if (type === 'value') {\n if (isObjectOrArray(value)) {\n return parser.stringify(value)\n }\n\n // nothing to do\n return value\n }\n\n throw new Error(`Cannot convert ${valueType(value, parser)} to ${type}`)\n}\n\n/**\n * Check whether provided value is valid a content type for JSONEditor\n * Returns a string with validation error message when there is an issue,\n * or null otherwise\n */\nexport function validateContentType(content: unknown): string | undefined {\n if (!isObject(content)) {\n return 'Content must be an object'\n }\n\n if (content.json !== undefined) {\n if (content.text !== undefined) {\n return 'Content must contain either a property \"json\" or a property \"text\" but not both'\n } else {\n return undefined\n }\n } else {\n if (content.text === undefined) {\n return 'Content must contain either a property \"json\" or a property \"text\"'\n } else if (typeof content.text !== 'string') {\n return (\n 'Content \"text\" property must be a string containing a JSON document. ' +\n 'Did you mean to use the \"json\" property instead?'\n )\n } else {\n return undefined\n }\n }\n}\n\n/**\n * Check whether a value is Content (TextContent or JSONContent)\n */\nexport function isContent(content: unknown): content is Content {\n return (\n isObject(content) && (typeof content.json !== 'undefined' || typeof content.text === 'string')\n )\n}\n\n/**\n * Check whether content contains text (and not JSON)\n */\nexport function isTextContent(content: unknown): content is TextContent {\n return isObject(content) && typeof content.text === 'string'\n}\n\n/**\n * Check whether content contains json\n */\nexport function isJSONContent(content: unknown): content is JSONContent {\n return isObject(content) && typeof content.json !== 'undefined'\n}\n\n/**\n * Convert Content into TextContent if it is JSONContent, else leave it as is\n */\nexport function toTextContent(\n content: Content,\n indentation: number | string | undefined = undefined,\n parser: JSONParser = JSON\n): TextContent {\n return isTextContent(content)\n ? content\n : { text: parser.stringify(content.json, null, indentation) as string }\n}\n\n/**\n * Convert Content into JSONContent if it is TextContent, else leave it as is\n * @throws {SyntaxError} Will throw a parse error when the text contents does not contain valid JSON\n */\nexport function toJSONContent(content: Content, parser: JSONParser = JSON): JSONContent {\n return isJSONContent(content) ? content : { json: parser.parse(content.text) }\n}\n\n/**\n * Get the contents as Text. If the contents is JSON, the JSON will be parsed.\n */\nexport function getText(content: Content, indentation: number | string, parser: JSONParser) {\n return toTextContent(content, indentation, parser).text\n}\n\n/**\n * Returns true when the (estimated) size of the contents exceeds the\n * provided maxSize.\n * @param content\n * @param maxSize Maximum content size in bytes\n */\nexport function isLargeContent(content: Content, maxSize: number): boolean {\n return estimateSerializedSize(content, maxSize) > maxSize\n}\n\n/**\n * A rough, fast estimation on whether a document is larger than given size\n * when serialized.\n *\n * maxSize is an optional max size in bytes. When reached, size estimation will\n * be cancelled. This is useful when you're only interested in knowing whether\n * the size exceeds a certain maximum size.\n */\nexport function estimateSerializedSize(content: Content, maxSize = Infinity): number {\n if (isTextContent(content)) {\n return content.text.length\n }\n\n const json = content.json\n\n let estimatedSize = 0\n\n function recurse(json: unknown) {\n if (Array.isArray(json)) {\n // open and close bracket, commas between items\n estimatedSize += 2 + (json.length - 1)\n\n if (estimatedSize > maxSize) {\n return\n }\n\n for (let i = 0; i < json.length; i++) {\n const item = json[i]\n\n recurse(item)\n\n if (estimatedSize > maxSize) {\n return\n }\n }\n } else if (isObject(json)) {\n const keys = Object.keys(json)\n\n // open and close brackets, separators between all keys and values, comma's between key/value pairs\n estimatedSize += 2 + keys.length + (keys.length - 1)\n\n for (let k = 0; k < keys.length; k++) {\n const key = keys[k]\n const value = json[key]\n\n // key length and double quotes around it\n estimatedSize += key.length + 2\n\n recurse(value)\n }\n } else if (typeof json === 'string') {\n estimatedSize += json.length + 2 // string length plus two for the double quote characters\n } else {\n // true, false, null, number\n estimatedSize += String(json).length\n }\n }\n\n recurse(json)\n\n return estimatedSize\n}\n\nconst POSITION_REGEX = /(position|char) (\\d+)/\nconst LINE_REGEX = /line (\\d+)/\nconst COLUMN_REGEX = /column (\\d+)/\n\n/**\n * Check whether the actual functions of parse and stringify are strictly equal.\n * The object holding the functions may be a differing instance.\n */\nexport function isEqualParser(a: JSONParser, b: JSONParser): boolean {\n return a.parse === b.parse && a.stringify === b.stringify\n}\n\n/**\n * Apply a fast and cheap heuristic to determine whether the content needs formatting (i.e. is compact).\n */\nexport function needsFormatting(jsonText: string): boolean {\n const maxLength = 999\n const head = jsonText.substring(0, maxLength).trim()\n return !head.includes('\\n') && DELIMITER_WITHOUT_SPACING_REGEX.test(head)\n}\n\n// This regex matches cases of a comma or colon NOT followed by a whitespace\nconst DELIMITER_WITHOUT_SPACING_REGEX = /[,:]\\S/\n","import type { JSONPatchDocument, JSONPath } from 'immutable-json-patch'\nimport type { Component, SvelteComponent } from 'svelte'\nimport type { IconDefinition } from '@fortawesome/free-solid-svg-icons'\nimport type { Action } from 'svelte/action'\n\nexport type TextContent = { text: string }\n\nexport type JSONContent = { json: unknown }\n\nexport type Content = JSONContent | TextContent\n\n// The `JSONParser` interface is compatible with `JSON`,\n// except that JSON.stringify is wrongly defined to return a string whilst it can return a string or undefined\n// see: https://stackoverflow.com/questions/74461780/is-the-official-type-definition-for-json-stringify-wrong\nexport interface JSONParser {\n parse(\n text: string,\n reviver?: ((this: unknown, key: string, value: unknown) => unknown) | null\n ): unknown\n\n stringify(\n value: unknown,\n replacer?:\n | ((this: unknown, key: string, value: unknown) => unknown)\n | Array<number | string>\n | null,\n space?: string | number\n ): string | undefined\n}\n\nexport interface JSONPathParser {\n parse: (pathStr: string) => JSONPath\n stringify: (path: JSONPath) => string\n}\n\nexport interface VisibleSection {\n start: number\n end: number\n}\n\nexport enum Mode {\n text = 'text',\n tree = 'tree',\n table = 'table'\n}\n\nexport enum SelectionType {\n after = 'after',\n inside = 'inside',\n key = 'key',\n value = 'value',\n multi = 'multi',\n text = 'text' // in text mode\n}\n\nexport enum CaretType {\n after = 'after',\n key = 'key',\n value = 'value',\n inside = 'inside'\n}\n\nexport interface PathOption {\n value: JSONPath\n label: string\n}\n\nexport interface NumberOption {\n value: 1 | -1\n label: string\n}\n\nexport interface CaretPosition {\n path: JSONPath\n type: CaretType // TODO: refactor this to use SelectionType here, then we can simplify the util functions to turn this into a selection\n}\n\nexport interface ObjectRecursiveState {\n type: 'object'\n properties: Record<string, RecursiveState | undefined>\n}\n\nexport interface ArrayRecursiveState {\n type: 'array'\n items: Array<RecursiveState | undefined>\n}\n\nexport interface ValueRecursiveState {\n type: 'value'\n}\n\nexport type RecursiveState = ObjectRecursiveState | ArrayRecursiveState | ValueRecursiveState\n\nexport interface RecursiveStateFactory {\n createObjectDocumentState: () => ObjectRecursiveState\n createArrayDocumentState: () => ArrayRecursiveState\n createValueDocumentState: () => ValueRecursiveState\n}\n\nexport interface ObjectDocumentState extends ObjectRecursiveState {\n type: 'object'\n properties: Record<string, DocumentState | undefined>\n expanded: boolean\n}\n\nexport interface ArrayDocumentState extends ArrayRecursiveState {\n type: 'array'\n items: Array<DocumentState | undefined>\n expanded: boolean\n visibleSections: VisibleSection[]\n}\n\nexport interface ValueDocumentState extends ValueRecursiveState {\n type: 'value'\n enforceString?: boolean\n}\n\nexport type DocumentState = ObjectDocumentState | ArrayDocumentState | ValueDocumentState\n\nexport interface ObjectSearchResults extends ObjectRecursiveState {\n type: 'object'\n properties: Record<string, SearchResults | undefined>\n searchResults?: ExtendedSearchResultItem[]\n}\n\nexport interface ArraySearchResults extends ArrayRecursiveState {\n type: 'array'\n items: Array<SearchResults | undefined>\n searchResults?: ExtendedSearchResultItem[]\n}\n\nexport interface ValueSearchResults extends ValueRecursiveState {\n type: 'value'\n searchResults?: ExtendedSearchResultItem[]\n}\n\nexport type SearchResults = ObjectSearchResults | ArraySearchResults | ValueSearchResults\n\nexport type WithSearchResults = SearchResults & {\n searchResults: ExtendedSearchResultItem[]\n}\n\nexport interface ObjectValidationErrors extends ObjectRecursiveState {\n type: 'object'\n properties: Record<string, ValidationErrors | undefined>\n validationError?: NestedValidationError\n}\n\nexport interface ArrayValidationErrors extends ArrayRecursiveState {\n type: 'array'\n items: Array<ValidationErrors | undefined>\n validationError?: NestedValidationError\n}\n\nexport interface ValueValidationErrors extends ValueRecursiveState {\n type: 'value'\n validationError?: NestedValidationError\n}\n\nexport type ValidationErrors =\n | ObjectValidationErrors\n | ArrayValidationErrors\n | ValueValidationErrors\n\nexport interface JSONPatchResult {\n json: unknown\n previousJson: unknown\n undo: JSONPatchDocument\n redo: JSONPatchDocument\n}\n\nexport type AfterPatchCallback = (\n patchedJson: unknown,\n patchedState: DocumentState | undefined,\n patchedSelection: JSONSelection | undefined\n) =>\n | {\n json?: unknown\n state?: DocumentState | undefined\n selection?: JSONSelection | undefined\n sortedColumn?: SortedColumn | undefined\n }\n | undefined\n\nexport interface MultiSelection {\n type: SelectionType.multi\n anchorPath: JSONPath\n focusPath: JSONPath\n}\n\nexport interface AfterSelection {\n type: SelectionType.after\n path: JSONPath\n}\n\nexport interface InsideSelection {\n type: SelectionType.inside\n path: JSONPath\n}\n\nexport interface KeySelection {\n type: SelectionType.key\n path: JSONPath\n}\n\nexport interface EditKeySelection extends KeySelection {\n type: SelectionType.key\n path: JSONPath\n edit: true\n initialValue?: string\n}\n\nexport type ValueSelection = {\n type: SelectionType.value\n path: JSONPath\n}\n\nexport interface EditValueSelection extends ValueSelection {\n type: SelectionType.value\n path: JSONPath\n edit: true\n initialValue?: string\n}\n\nexport type JSONSelection =\n | MultiSelection\n | AfterSelection\n | InsideSelection\n | KeySelection\n | EditKeySelection\n | ValueSelection\n | EditValueSelection\n\n// TextSelection is the result of EditorSelection.toJSON() from CodeMirror,\n// with an additional `type` property\nexport interface TextSelection {\n type: SelectionType.text\n ranges: { anchor: number; head: number }[]\n main: number\n}\n\nexport type JSONEditorSelection = JSONSelection | TextSelection\n\nexport interface ScrollToOptions {\n scrollToWhenVisible?: boolean\n element?: Element\n}\n\nexport type ClipboardValues = Array<{ key: string; value: unknown }>\n\nexport interface MenuButton {\n type: 'button'\n onClick: (event: MouseEvent) => void\n icon?: IconDefinition\n text?: string\n title?: string\n className?: string\n disabled?: boolean\n}\n\nexport interface MenuDropDownButton {\n type: 'dropdown-button'\n main: MenuButton\n width?: string\n items: MenuButton[]\n}\n\nexport interface MenuLabel {\n type: 'label'\n text: string\n}\n\nexport interface MenuSeparator {\n type: 'separator'\n}\n\nexport interface MenuSpace {\n type: 'space'\n}\n\nexport type MenuItem = MenuButton | MenuSeparator | MenuSpace\n\nexport interface ContextMenuColumn {\n type: 'column'\n items: Array<MenuButton | MenuDropDownButton | MenuLabel | MenuSeparator>\n}\nexport interface ContextMenuRow {\n type: 'row'\n items: Array<MenuButton | MenuDropDownButton | ContextMenuColumn>\n}\nexport type ContextMenuItem = MenuButton | MenuDropDownButton | MenuSeparator | ContextMenuRow\n\nexport interface MessageAction {\n text: string\n title: string\n icon?: IconDefinition\n onClick?: () => void\n onMouseDown?: () => void\n disabled?: boolean\n}\n\nexport enum ValidationSeverity {\n info = 'info',\n warning = 'warning',\n error = 'error'\n}\n\nexport interface ValidationError {\n path: JSONPath\n message: string\n severity: ValidationSeverity\n}\n\nexport interface NestedValidationError extends ValidationError {\n isChildError?: boolean\n}\n\nexport type Validator = (json: unknown) => ValidationError[]\n\nexport interface ParseError {\n position: number | undefined\n line: number | undefined\n column: number | undefined\n message: string\n}\n\nexport interface ContentParseError {\n parseError: ParseError\n isRepairable: boolean\n}\n\nexport interface ContentValidationErrors {\n validationErrors: ValidationError[]\n}\n\nexport type ContentErrors = ContentParseError | ContentValidationErrors\n\nexport interface RichValidationError extends ValidationError {\n line: number | undefined\n column: number | undefined\n from: number | undefined\n to: number | undefined\n actions: Array<{ name: string; apply: () => void }> | undefined\n}\n\nexport interface TextLocation {\n path: JSONPath\n line: number\n column: number\n from: number\n to: number\n}\n\nexport interface Section {\n start: number // start included\n end: number // end excluded\n}\n\nexport interface QueryLanguage {\n id: string\n name: string\n description: string\n createQuery: (json: unknown, queryOptions: QueryLanguageOptions) => string\n executeQuery: (json: unknown, query: string, parser: JSONParser) => unknown\n}\n\nexport interface QueryLanguageOptions {\n filter?: {\n path?: JSONPath\n relation?: '==' | '!=' | '<' | '<=' | '>' | '>='\n value?: string\n }\n sort?: {\n path?: JSONPath\n direction?: 'asc' | 'desc'\n }\n projection?: {\n paths?: JSONPath[]\n }\n}\n\nexport type OnChangeQueryLanguage = (queryLanguageId: string) => void\nexport interface OnChangeStatus {\n contentErrors: ContentErrors | undefined\n patchResult: JSONPatchResult | undefined\n}\nexport type OnChange =\n | ((content: Content, previousContent: Content, status: OnChangeStatus) => void)\n | undefined\nexport type OnJSONSelect = (selection: JSONSelection) => void\nexport type OnSelect = (selection: JSONEditorSelection | undefined) => void\nexport type OnUndo = (item: HistoryItem | undefined) => void\nexport type OnRedo = (item: HistoryItem | undefined) => void\nexport type OnPatch = (\n operations: JSONPatchDocument,\n afterPatch?: AfterPatchCallback\n) => JSONPatchResult\nexport type OnChangeText = (updatedText: string, afterPatch?: AfterPatchCallback) => void\nexport type OnSort = (params: {\n operations: JSONPatchDocument\n rootPath: JSONPath\n itemPath: JSONPath\n direction: 1 | -1\n}) => void\nexport type OnFind = (findAndReplace: boolean) => void\nexport type OnPaste = (pastedText: string) => void\nexport type OnPasteJson = (pastedJson: PastedJson) => void\nexport type OnExpand = (relativePath: JSONPath) => boolean\nexport type OnRenderValue = (props: RenderValueProps) => RenderValueComponentDescription[]\nexport type OnClassName = (path: JSONPath, value: unknown) => string | undefined\nexport type OnChangeMode = (mode: Mode) => void\nexport type OnContextMenu = (contextMenuProps: AbsolutePopupOptions) => void\nexport type RenderMenuContext = {\n mode: Mode\n modal: boolean\n readOnly: boolean\n}\nexport type OnRenderMenu = (items: MenuItem[], context: RenderMenuContext) => MenuItem[] | undefined\nexport type OnRenderMenuInternal = (items: MenuItem[]) => MenuItem[] | undefined\nexport type RenderContextMenuContext = RenderMenuContext & {\n selection: JSONEditorSelection | undefined\n}\nexport type OnRenderContextMenu = (\n items: ContextMenuItem[],\n context: RenderContextMenuContext\n) => ContextMenuItem[] | false | undefined\nexport type OnRenderContextMenuInternal = (\n items: ContextMenuItem[]\n) => ContextMenuItem[] | false | undefined\nexport type OnError = (error: Error) => void\nexport type OnFocus = () => void\nexport type OnBlur = () => void\nexport type OnSortModal = (props: SortModalCallback) => void\nexport type OnTransformModal = (props: TransformModalCallback) => void\nexport type OnJSONEditorModal = (props: JSONEditorModalCallback) => void\nexport type FindNextInside = (path: JSONPath) => JSONSelection | undefined\n\nexport interface SearchResultDetails {\n items: ExtendedSearchResultItem[]\n activeItem: ExtendedSearchResultItem | undefined\n activeIndex: number | -1\n}\n\nexport enum SearchField {\n key = 'key',\n value = 'value'\n}\n\nexport interface SearchOptions {\n maxResults?: number\n columns?: JSONPath[]\n}\n\nexport interface SearchResultItem {\n path: JSONPath\n field: SearchField\n fieldIndex: number\n start: number\n end: number\n}\n\nexport interface ExtendedSearchResultItem extends SearchResultItem {\n resultIndex: number\n active: boolean\n}\n\nexport type EscapeValue = (value: unknown) => string\n\nexport type UnescapeValue = (escapedValue: string) => string\n\nexport interface ValueNormalization {\n escapeValue: EscapeValue\n unescapeValue: UnescapeValue\n}\n\nexport type PastedJson = {\n path: JSONPath\n contents: unknown\n onPasteAsJson: () => void\n}\n\nexport interface DragInsideProps {\n json: unknown\n selection: JSONSelection\n deltaY: number\n items: Array<{ path: JSONPath; height: number }>\n}\n\nexport type DragInsideAction =\n | { beforePath: JSONPath; offset: number }\n | { append: true; offset: number }\n\nexport interface RenderedItem {\n path: JSONPath\n height: number\n}\n\nexport interface TreeHistoryItem {\n type: 'tree'\n undo: {\n patch: JSONPatchDocument | undefined\n json: unknown | undefined\n text: string | undefined\n documentState: DocumentState | undefined\n selection: JSONSelection | undefined\n sortedColumn: SortedColumn | undefined\n textIsRepaired: boolean\n }\n redo: {\n patch: JSONPatchDocument | undefined\n json: unknown | undefined\n text: string | undefined\n documentState: DocumentState | undefined\n selection: JSONSelection | undefined\n sortedColumn: SortedColumn | undefined\n textIsRepaired: boolean\n }\n}\n\nexport type TextChanges = Array<number | [number, ...string[]]>\n\nexport interface TextHistoryItem {\n type: 'text'\n undo: {\n changes: TextChanges\n selection: TextSelection\n }\n redo: {\n changes: TextChanges\n selection: TextSelection\n }\n}\n\nexport interface ModeHistoryItem {\n type: 'mode'\n undo: {\n mode: Mode\n selection: undefined // selection can be restored used the corresponding sibling HistoryItem\n }\n redo: {\n mode: Mode\n selection: undefined // selection can be restored used the corresponding sibling HistoryItem\n }\n}\n\nexport type HistoryItem = TreeHistoryItem | TextHistoryItem | ModeHistoryItem\n\nexport interface HistoryInstance<T> {\n get: () => History<T>\n}\n\nexport interface History<T> {\n canUndo: boolean\n canRedo: boolean\n items: () => T[]\n add: (item: T) => void\n clear: () => void\n undo: () => T | undefined\n redo: () => T | undefined\n}\n\nexport type ConvertType = 'value' | 'object' | 'array'\nexport type InsertType = ConvertType | 'structure'\n\nexport interface PopupEntry {\n id: number\n component: typeof SvelteComponent<Record<string, unknown>>\n props: Record<string, unknown>\n options: AbsolutePopupOptions\n}\n\nexport interface AbsolutePopupOptions {\n anchor?: Element\n position?: 'top' | 'left'\n left?: number\n top?: number\n width?: number\n height?: number\n offsetTop?: number\n offsetLeft?: number\n showTip?: boolean\n closeOnOuterClick?: boolean\n onClose?: () => void\n}\n\nexport interface AbsolutePopupContext {\n openAbsolutePopup: (\n component: typeof SvelteComponent<Record<string, unknown>>,\n props: Record<string, unknown>,\n options: AbsolutePopupOptions\n ) => number\n closeAbsolutePopup: (popupId: number | undefined) => void\n}\n\nexport interface JSONEditorPropsOptional {\n content?: Content\n selection?: JSONEditorSelection\n readOnly?: boolean\n indentation?: number | string\n tabSize?: number\n truncateTextSize?: number\n mode?: Mode\n mainMenuBar?: boolean\n navigationBar?: boolean\n statusBar?: boolean\n askToFormat?: boolean\n escapeControlCharacters?: boolean\n escapeUnicodeCharacters?: boolean\n flattenColumns?: boolean\n parser?: JSONParser\n validator?: Validator | undefined\n validationParser?: JSONParser\n pathParser?: JSONPathParser\n maxDocumentSizeTextMode?: number\n\n queryLanguages?: QueryLanguage[]\n queryLanguageId?: string\n\n onChangeQueryLanguage?: OnChangeQueryLanguage\n onChange?: OnChange\n onRenderValue?: OnRenderValue\n onClassName?: OnClassName\n onRenderMenu?: OnRenderMenu\n onRenderContextMenu?: OnRenderContextMenu\n onChangeMode?: OnChangeMode\n onSelect?: OnSelect\n onError?: OnError\n onFocus?: OnFocus\n onBlur?: OnBlur\n}\n\nexport interface JSONEditorModalProps {\n content: Content\n path: JSONPath\n onPatch: OnPatch\n\n readOnly: boolean\n indentation: number | string\n tabSize: number\n truncateTextSize: number\n mainMenuBar: boolean\n navigationBar: boolean\n statusBar: boolean\n askToFormat: boolean\n escapeControlCharacters: boolean\n escapeUnicodeCharacters: boolean\n maxDocumentSizeTextMode: number\n flattenColumns: boolean\n parser: JSONParser\n validator: Validator | undefined\n validationParser: JSONParser\n pathParser: JSONPathParser\n\n onRenderValue: OnRenderValue\n onClassName: OnClassName\n onRenderMenu: OnRenderMenu\n onRenderContextMenu: OnRenderContextMenu\n onSortModal: (props: SortModalCallback) => void\n onTransformModal: (props: TransformModalCallback) => void\n onClose: () => void\n}\n\nexport interface JSONEditorContext {\n mode: Mode\n readOnly: boolean\n truncateTextSize: number\n parser: JSONParser\n normalization: ValueNormalization\n getJson: () => unknown | undefined\n getDocumentState: () => DocumentState | undefined\n findElement: (path: JSONPath) => Element | undefined\n findNextInside: FindNextInside\n focus: () => void\n onPatch: OnPatch\n onSelect: OnJSONSelect\n onFind: OnFind\n onPasteJson: (newPastedJson: PastedJson) => void\n onRenderValue: OnRenderValue\n}\n\nexport interface TreeModeContext extends JSONEditorContext {\n getJson: () => unknown | undefined\n getDocumentState: () => DocumentState | undefined\n getSelection: () => JSONSelection | undefined\n findElement: (path: JSONPath) => Element | undefined\n onInsert: (type: InsertType) => void\n onExpand: (path: JSONPath, expanded: boolean, recursive?: boolean) => void\n onExpandSection: (path: JSONPath, section: Section) => void\n onContextMenu: OnContextMenu\n onClassName: OnClassName\n onDrag: (event: MouseEvent) => void\n onDragEnd: () => void\n}\n\nexport interface RenderValueProps extends Record<string, unknown> {\n path: JSONPath\n value: unknown\n mode: Mode\n truncateTextSize: number\n readOnly: boolean\n enforceString: boolean\n selection: JSONSelection | undefined\n searchResultItems: ExtendedSearchResultItem[] | undefined\n isEditing: boolean\n parser: JSONParser\n normalization: ValueNormalization\n onPatch: OnPatch\n onPasteJson: OnPasteJson\n onSelect: OnJSONSelect\n onFind: OnFind\n findNextInside: FindNextInside\n focus: () => void\n}\n\nexport type RenderValuePropsOptional = Partial<RenderValueProps>\n\nexport interface DraggingState {\n initialTarget: Element\n initialClientY: number\n initialContentTop: number\n selectionStartIndex: number\n selectionItemsCount: number\n items: RenderedItem[]\n offset: number\n didMoveItems: boolean\n}\n\nexport type RenderValueComponentDescription = SvelteComponentRenderer | SvelteActionRenderer\n\nexport interface SvelteComponentRenderer {\n component:\n | typeof SvelteComponent<RenderValuePropsOptional> // Classic Svelte component\n | Component<RenderValueProps> // Runes\n props: RenderValueProps\n}\n\nexport interface SvelteActionRenderer {\n action: Action<HTMLElement, Record<string, unknown>>\n props: Record<string, unknown>\n}\n\nexport interface TransformModalOptions {\n id?: string\n rootPath?: JSONPath\n onTransform?: (state: {\n operations: JSONPatchDocument\n json: unknown\n transformedJson: unknown\n }) => void\n onClose?: () => void\n}\n\nexport interface TransformModalCallback {\n id: string\n json: unknown\n rootPath: JSONPath\n onTransform: (operations: JSONPatchDocument) => void\n onClose: () => void\n}\n\nexport interface TransformModalProps extends TransformModalCallback {\n id: string\n json: unknown\n rootPath: JSONPath\n indentation: number | string\n truncateTextSize: number\n escapeControlCharacters: boolean\n escapeUnicodeCharacters: boolean\n parser: JSONParser\n parseMemoizeOne: JSONParser['parse']\n validationParser: JSONParser\n pathParser: JSONPathParser\n\n queryLanguages: QueryLanguage[]\n queryLanguageId: string\n onChangeQueryLanguage: OnChangeQueryLanguage\n\n onRenderValue: OnRenderValue\n onRenderMenu: OnRenderMenuInternal\n onRenderContextMenu: OnRenderContextMenuInternal\n onClassName: OnClassName\n\n onTransform: (operations: JSONPatchDocument) => void\n onClose: () => void\n}\n\nexport interface SortModalCallback {\n id: string\n json: unknown\n rootPath: JSONPath\n onSort: OnSort\n onClose: () => void\n}\n\nexport interface JSONRepairModalProps {\n text: string\n onParse: (text: string) => void\n onRepair: (text: string) => string\n onApply: (repairedText: string) => void\n onClose: () => void\n}\n\nexport interface JSONEditorModalCallback {\n content: Content\n path: JSONPath\n onPatch: OnPatch\n onClose: () => void\n}\n\nexport enum SortDirection {\n asc = 'asc',\n desc = 'desc'\n}\n\nexport enum UpdateSelectionAfterChange {\n no = 'no',\n self = 'self',\n nextInside = 'nextInside'\n}\n\nexport interface TableCellIndex {\n rowIndex: number\n columnIndex: number\n}\n\nexport interface SortedColumn {\n path: JSONPath\n sortDirection: SortDirection\n}\n\n// TODO: work out the JSONSchema type in detail.\n// Ideally, we use use Schema from Ajv, but this interface isn't worked out either\nexport type JSONSchema = Record<string, unknown>\nexport type JSONSchemaDefinitions = Record<string, JSONSchema>\nexport type JSONSchemaEnum = Array<unknown>\n","import type { ValueNormalization } from '$lib/types.js'\nimport { SelectionType } from '$lib/types.js'\nimport type { JSONPath } from 'immutable-json-patch'\nimport { compileJSONPointer, parseJSONPointer } from 'immutable-json-patch'\nimport { map, minBy } from 'lodash-es'\n\n/**\n * Create serialization functions to escape and stringify text,\n * and the other way around: to parse and unescape text.\n */\nexport function createNormalizationFunctions({\n escapeControlCharacters,\n escapeUnicodeCharacters\n}: {\n escapeControlCharacters: boolean\n escapeUnicodeCharacters: boolean\n}): ValueNormalization {\n if (escapeControlCharacters) {\n if (escapeUnicodeCharacters) {\n return normalizeControlAndUnicode\n } else {\n return normalizeControl\n }\n } else {\n if (escapeUnicodeCharacters) {\n return normalizeUnicode\n } else {\n return normalizeNothing\n }\n }\n}\n\nconst normalizeControlAndUnicode = {\n escapeValue: (value: unknown) => jsonEscapeUnicode(jsonEscapeControl(String(value))),\n unescapeValue: (value: string) => jsonUnescapeControl(jsonUnescapeUnicode(value))\n}\n\nconst normalizeControl = {\n escapeValue: (value: unknown) => jsonEscapeControl(String(value)),\n unescapeValue: (value: string) => jsonUnescapeControl(value)\n}\n\nconst normalizeUnicode = {\n escapeValue: (value: unknown) => jsonEscapeUnicode(String(value)),\n unescapeValue: (value: string) => jsonUnescapeUnicode(value)\n}\n\nconst normalizeNothing = {\n escapeValue: (value: unknown) => String(value),\n unescapeValue: (value: string) => value\n}\n\n/**\n * Source: https://stackoverflow.com/questions/12271547/shouldnt-json-stringify-escape-unicode-characters\n */\nexport function jsonEscapeUnicode(value: string): string {\n return value.replace(/[^\\x20-\\x7F]/g, (x) => {\n if (x === '\\b' || x === '\\f' || x === '\\n' || x === '\\r' || x === '\\t') {\n return x\n }\n\n return '\\\\u' + ('000' + x.codePointAt(0)?.toString(16)).slice(-4)\n })\n}\n\nexport function jsonUnescapeUnicode(value: string): string {\n return value.replace(/\\\\u[a-fA-F0-9]{4}/g, (x) => {\n try {\n const unescaped: string = JSON.parse('\"' + x + '\"')\n // the resolved character can be a control character like \" or \\n,\n // that would result in invalid JSON, so we need to keep that escaped\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n return controlCharacters[unescaped] || unescaped\n } catch {\n return x\n }\n })\n}\n\nconst controlCharacters = {\n '\"': '\\\\\"',\n '\\\\': '\\\\\\\\',\n // escaped forward slash '\\/' is the same as '/', we can't escape/unescape it\n '\\b': '\\\\b',\n '\\f': '\\\\f',\n '\\n': '\\\\n',\n '\\r': '\\\\r',\n '\\t': '\\\\t'\n // unicode is handled separately\n}\n\nconst escapedControlCharacters = {\n '\\\\\"': '\"',\n '\\\\\\\\': '\\\\',\n // escaped forward slash '\\/' is the same as '/', we can't escape/unescape it\n '\\\\/': '/',\n '\\\\b': '\\b',\n '\\\\f': '\\f',\n '\\\\n': '\\n',\n '\\\\r': '\\r',\n '\\\\t': '\\t'\n // unicode is handled separately\n}\n\nexport function jsonEscapeControl(value: string): string {\n return value.replace(/[\"\\b\\f\\n\\r\\t\\\\]/g, (x) => {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n return controlCharacters[x] || x\n })\n}\n\nexport function jsonUnescapeControl(value: string): string {\n return value.replace(/\\\\[\"bfnrt\\\\]/g, (x) => {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n return escapedControlCharacters[x] || x\n })\n}\n\nexport function addNewLineSuffix(value: unknown): string {\n if (typeof value !== 'string') {\n return String(value)\n }\n\n if (value.endsWith('\\n')) {\n // DOM innerText strips the last \\n, therefore we add an extra \\n here\n return value + '\\n'\n }\n\n return value\n}\n\n/**\n * Remove a newline suffix from text returned by element.innerText, it adds\n * one return too much.\n */\nexport function removeNewLineSuffix(text: string): string {\n return text.replace(/\\n$/, '')\n}\n\n// regular expression matching one or multiple return characters with all their\n// enclosing white spaces\nexport function removeReturnsAndSurroundingWhitespace(text: string): string {\n return text.replace(/(\\b|^)\\s*(\\b|$)/g, (match) => {\n return /\\n/.exec(match) ? '' : match\n })\n}\n\nexport function isChildOfNodeName(element: Element, nodeName: string): boolean {\n return isChildOf(element, (e) => e.nodeName.toUpperCase() === nodeName.toUpperCase())\n}\n\nexport function isChildOfAttribute(element: Element, name: string, value: string): boolean {\n return isChildOf(element, (e) => hasAttribute(e, name, value))\n}\n\n// test whether a DOM element is a content editable div\nexport function isContentEditableDiv(element: HTMLElement): boolean {\n return element.nodeName === 'DIV' && element.contentEditable === 'true'\n}\n\n// test whether a DOM element is an \"input\" with type \"text\"\nexport function isTextInput(element: HTMLInputElement): boolean {\n return (\n element.nodeName === 'INPUT' &&\n element.type !== undefined &&\n element.type.toLowerCase() === 'text'\n )\n}\n\nfunction hasAttribute(element: Element, name: string, value: string): boolean {\n return typeof element.getAttribute === 'function' && element.getAttribute(name) === value\n}\n\n/**\n * Test if the element or one of its parents has a certain predicate\n * Can be use for example to check whether the element or it's parent has\n * a specific attribute or nodeName.\n */\nexport function isChildOf(element: Element, predicate: (element: Element) => boolean): boolean {\n return !!findParent(element, predicate)\n}\n\n/**\n * Test if the element or one of its parents has a certain predicate\n * Can be use for example to check whether the element or it's parent has\n * a specific attribute or nodeName.\n * @param {HTMLElement} element\n * @param {function (element: HTMLElement) : boolean} predicate\n * @returns {HTMLElement | undefined}\n */\nexport function findParent(\n element: Element,\n predicate: (element: Element) => boolean\n): Element | undefined {\n let e: Element | undefined = element\n\n while (e && !predicate(e)) {\n e = e.parentNode as Element\n }\n\n return e\n}\n\n/**\n * Set the cursor to the end of a content editable div\n * Source: https://stackoverflow.com/questions/13513329/set-cursor-to-the-end-of-contenteditable-div\n * @param {HTMLElement} element\n */\nexport function setCursorToEnd(element: HTMLElement) {\n if (element.firstChild == null) {\n element.focus()\n return\n }\n\n const range = document.createRange()\n const selection = window.getSelection()\n range.setStart(element, 1)\n range.collapse(true)\n selection?.removeAllRanges()\n selection?.addRange(range)\n}\n\n/**\n * Gets a DOM element's Window. This is normally just the global `window`\n * variable, but if we opened a child window, it may be different.\n */\nexport function getWindow(element: Element): Window | undefined {\n return element?.ownerDocument?.defaultView ?? undefined\n}\n\nexport function activeElementIsChildOf(element: Element) {\n const window = getWindow(element)\n const activeElement = window?.document.activeElement\n return activeElement ? isChildOf(activeElement, (e) => e === element) : false\n}\n\n/**\n * Traverse over the parents of the element until a node is found with the\n * searched for node name. If the element itself contains the nodeName, the\n * element itself will be returned\n */\nexport function findParentWithNodeName(element: Element, nodeName: string): Element | undefined {\n return findParent(element, (e) => e.nodeName === nodeName)\n}\n\nexport function getSelectionTypeFromTarget(target: Element): SelectionType {\n if (isChildOfAttribute(target, 'data-type', 'selectable-key')) {\n return SelectionType.key\n }\n\n if (isChildOfAttribute(target, 'data-type', 'selectable-value')) {\n return SelectionType.value\n }\n\n if (isChildOfAttribute(target, 'data-type', 'insert-selection-area-inside')) {\n return SelectionType.inside\n }\n\n if (isChildOfAttribute(target, 'data-type', 'insert-selection-area-after')) {\n return SelectionType.after\n }\n\n return SelectionType.multi\n}\n\n/**\n * Encode a path into a string that can be used as attribute in HTML\n */\nexport function encodeDataPath(path: JSONPath): string {\n return encodeURIComponent(compileJSONPointer(path))\n}\n\n/**\n * Decode a path that was stringified for use as an HTML attribute\n */\nexport function decodeDataPath(pathStr: string): JSONPath {\n return parseJSONPointer(decodeURIComponent(pathStr))\n}\n\n/**\n * Find the data path of the given element. Traverses the parent nodes until find\n */\nexport function getDataPathFromTarget(target: Element): JSONPath | undefined {\n const parent = findParent(target, (element) => {\n return element?.hasAttribute ? element.hasAttribute('data-path') : false\n })\n\n const dataPath = parent?.getAttribute('data-path') ?? undefined\n return dataPath ? decodeDataPath(dataPath) : undefined\n}\n\n/**\n * Find the nearest element in a given context menu with buttons or inputs\n */\n// TODO: unit test\nexport function findNearestElement<T extends Element>({\n allElements,\n currentElement,\n direction,\n hasPrio = () => true,\n margin = 10\n}: {\n allElements: T[]\n currentElement: T\n direction: 'Up' | 'Down' | 'Left' | 'Right'\n margin?: number\n hasPrio?: (element: T) => boolean\n}): T | undefined {\n const all = map(allElements.filter(isVisible), calculateCenter)\n const current = calculateCenter(currentElement)\n\n interface CenterLocation {\n x: number\n y: number\n rect: DOMRect\n element: T\n }\n\n function isVisible(element: T): boolean {\n const rect = element.getBoundingClientRect()\n return rect.width > 0 && rect.height > 0\n }\n\n function calculateCenter(element: T): CenterLocation {\n const rect = element.getBoundingClientRect()\n return {\n x: rect.left + rect.width / 2,\n y: rect.top + rect.height / 2,\n rect,\n element\n }\n }\n\n const isOnSameRow = (a: CenterLocation, b: CenterLocation) => Math.abs(a.y - b.y) < margin\n const isLeft = (a: CenterLocation, b: CenterLocation) => a.rect.left + margin < b.rect.left\n const isRight = (a: CenterLocation, b: CenterLocation) => a.rect.right > b.rect.right + margin\n const isAbove = (a: CenterLocation, b: CenterLocation) => a.y + margin < b.y\n const isBelow = (a: CenterLocation, b: CenterLocation) => a.y > b.y + margin\n\n function distance(a: CenterLocation, b: CenterLocation, weightY = 1): number {\n const diffX = a.x - b.x\n const diffY = (a.y - b.y) * weightY\n return Math.sqrt(diffX * diffX + diffY * diffY)\n }\n const distanceToCurrent = (candidate: CenterLocation) => distance(candidate, current)\n const distanceToCurrentWeighted = (candidate: CenterLocation) => distance(candidate, current, 10)\n\n if (direction === 'Left' || direction === 'Right') {\n // First we find the first button left from the current button on the same row\n // if not found, search the closest button left/right from current button\n const candidatesLeft =\n direction === 'Left'\n ? all.filter((button) => isLeft(button, current))\n : all.filter((button) => isRight(button, current))\n const candidatesLeftOnRow = candidatesLeft.filter((button) => isOnSameRow(button, current))\n const nearest =\n minBy(candidatesLeftOnRow, distanceToCurrent) ||\n minBy(candidatesLeft, distanceToCurrentWeighted)\n\n return nearest?.element\n }\n\n if (direction === 'Up' || direction === 'Down') {\n // first we only search through the prio buttons\n // if there were no matching prio buttons, search all matching buttons\n const candidates =\n direction === 'Up'\n ? all.filter((button) => isAbove(button, current))\n : all.filter((button) => isBelow(button, current))\n const prioCandidates = candidates.filter((button) => hasPrio(button.element))\n const nearest = minBy(prioCandidates, distanceToCurrent) || minBy(candidates, distanceToCurrent)\n\n return nearest?.element\n }\n\n return undefined\n}\n","declare global {\n // extend with the userAgentData: NavigatorUAData property (currently experimental)\n // see https://developer.mozilla.org/en-US/docs/Web/API/Navigator/userAgentData\n interface Navigator {\n userAgentData?: {\n platform: string\n }\n }\n}\n\nexport function isMacDevice() {\n return (\n typeof navigator !== 'undefined' &&\n (navigator?.platform?.toUpperCase().includes('MAC') ??\n navigator?.userAgentData?.platform?.toUpperCase().includes('MAC') ??\n false)\n )\n}\n","// inspiration: https://github.com/andrepolischuk/keycomb\n\nimport { isMacDevice } from './navigatorUtils.js'\n\n// KeyComboEvent is a subset of KeyboardEvent\nexport interface KeyComboEvent {\n ctrlKey: boolean\n metaKey: boolean\n altKey: boolean\n shiftKey: boolean\n key: string\n}\n\n/**\n * Get the active key combination from a keyboard event.\n * For example returns \"Ctrl+Shift+ArrowUp\" or \"Ctrl+A\"\n *\n * Returns the same output on both Windows and Mac:\n * meta keys \"Ctrl\" (\"Command\" on Mac), and \"Alt\" (\"Alt\" or \"Option\" on Mac)\n * So pressing \"Command\" and \"A\"on Mac will return \"Ctrl+A\"\n */\nexport function keyComboFromEvent(\n event: KeyComboEvent,\n separator = '+',\n isMac = isMacDevice\n): string {\n const combi = []\n\n if (isCtrlKeyDown(event, isMac)) {\n // on Mac this is called Command or Cmd\n combi.push('Ctrl')\n }\n if (event.altKey) {\n // on Mac this is called Option\n combi.push('Alt')\n }\n if (event.shiftKey) {\n combi.push('Shift')\n }\n\n const keyName = event.key.length === 1 ? event.key.toUpperCase() : event.key\n if (!(keyName in metaKeys)) {\n // prevent output like 'Ctrl+Ctrl'\n combi.push(keyName)\n }\n\n return combi.join(separator)\n}\n\n/**\n * Test whether the Ctrl key (windows, linux) or Command key (mac) is down\n */\nexport function isCtrlKeyDown(\n event: { ctrlKey: boolean; metaKey: boolean },\n isMac = isMacDevice\n): boolean {\n // metaKey is the Command key ⌘ on a Mac (but the Windows Key ⊞ on Windows)\n return event.ctrlKey || (event.metaKey && isMac())\n}\n\nconst metaKeys = {\n Ctrl: true,\n Command: true,\n Control: true,\n Alt: true,\n Option: true,\n Shift: true\n}\n","function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nexport default styleInject;\n","<script lang=\"ts\">\n import type { AbsolutePopupOptions, PopupEntry } from '$lib/types.js'\n import { onMount } from 'svelte'\n import { isChildOf } from '$lib/utils/domUtils.js'\n import { keyComboFromEvent } from '$lib/utils/keyBindings.js'\n\n export let popup: PopupEntry\n export let closeAbsolutePopup: (popupId: number) => void\n\n let refRootPopup: HTMLDivElement\n let refHiddenInput: HTMLInputElement\n\n onMount(focus)\n\n function closeWhenOutside(event: Event) {\n if (\n popup.options &&\n popup.options.closeOnOuterClick &&\n !isChildOf(event.target as HTMLElement, (e) => e === refRootPopup)\n ) {\n closeAbsolutePopup(popup.id)\n }\n }\n\n function handleWindowMouseDown(event: Event) {\n closeWhenOutside(event)\n }\n\n function handleMouseDownInside(event: Event) {\n event.stopPropagation()\n }\n\n function handleKeyDown(event: KeyboardEvent) {\n const combo = keyComboFromEvent(event)\n if (combo === 'Escape') {\n event.preventDefault()\n event.stopPropagation()\n closeAbsolutePopup(popup.id)\n }\n }\n\n function handleScrollWheel(event: Event) {\n closeWhenOutside(event)\n }\n\n function calculateStyle(refRootPopup: HTMLDivElement, options: AbsolutePopupOptions) {\n function calculatePosition() {\n if (options.anchor) {\n const { anchor, width = 0, height = 0, offsetTop = 0, offsetLeft = 0, position } = options\n const { left, top, bottom, right } = anchor.getBoundingClientRect()\n\n const positionAbove =\n position === 'top' || (top + height > window.innerHeight && top > height)\n const positionLeft =\n position === 'left' || (left + width > window.innerWidth && left > width)\n\n return {\n left: positionLeft ? right - offsetLeft : left + offsetLeft,\n top: positionAbove ? top - offsetTop : bottom + offsetTop,\n positionAbove,\n positionLeft\n }\n } else if (typeof options.left === 'number' && typeof options.top === 'number') {\n const { left, top, width = 0, height = 0 } = options\n\n const positionAbove = top + height > window.innerHeight && top > height\n const positionLeft = left + width > window.innerWidth && left > width\n\n return {\n left,\n top,\n positionAbove,\n positionLeft\n }\n } else {\n throw new Error('Invalid config: pass either \"left\" and \"top\", or pass \"anchor\"')\n }\n }\n\n const rootRect = refRootPopup.getBoundingClientRect()\n const { left, top, positionAbove, positionLeft } = calculatePosition()\n\n const verticalStyling = positionAbove\n ? `bottom: ${rootRect.top - top}px;`\n : `top: ${top - rootRect.top}px;`\n\n const horizontalStyling = positionLeft\n ? `right: ${rootRect.left - left}px;`\n : `left: ${left - rootRect.left}px;`\n\n return verticalStyling + horizontalStyling\n }\n\n function focus() {\n if (refHiddenInput) {\n refHiddenInput.focus()\n }\n }\n</script>\n\n<svelte:window\n on:mousedown|capture={handleWindowMouseDown}\n on:keydown|capture={handleKeyDown}\n on:wheel|capture={handleScrollWheel}\n/>\n\n<div\n role=\"none\"\n bind:this={refRootPopup}\n class=\"jse-absolute-popup\"\n on:mousedown={handleMouseDownInside}\n on:keydown={handleKeyDown}\n>\n {#if refRootPopup}\n <div class=\"jse-absolute-popup-content\" style={calculateStyle(refRootPopup, popup.options)}>\n <input\n type=\"text\"\n readonly\n tabindex=\"-1\"\n class=\"jse-hidden-input\"\n bind:this={refHiddenInput}\n />\n <svelte:component this={popup.component} {...popup.props} />\n </div>\n {/if}\n</div>\n\n<style src=\"./AbsolutePopupEntry.scss\"></style>\n","<svelte:options immutable={true} />\n\n<script lang=\"ts\">\n import { createDebug } from '$lib/utils/debug.js'\n import { setContext, type SvelteComponent } from 'svelte'\n import type { AbsolutePopupOptions, PopupEntry, AbsolutePopupContext } from '$lib/types'\n import { uniqueId } from '$lib/utils/uniqueId.js'\n import AbsolutePopupEntry from './AbsolutePopupEntry.svelte'\n\n const debug = createDebug('jsoneditor:AbsolutePopup')\n\n let popups: PopupEntry[] = []\n\n function openAbsolutePopup(\n component: typeof SvelteComponent<Record<string, unknown>>,\n props: Record<string, unknown>,\n options: AbsolutePopupOptions\n ): number {\n debug('open...', props, options)\n\n const popup: PopupEntry = {\n id: uniqueId(),\n component: component,\n props: props || {},\n options: options || {}\n }\n\n popups = [...popups, popup]\n\n return popup.id\n }\n\n function closeAbsolutePopup(popupId: number | undefined) {\n const popupIndex = popups.findIndex((popup) => popup.id === popupId)\n\n if (popupIndex !== -1) {\n const popup = popups[popupIndex]\n if (popup.options.onClose) {\n popup.options.onClose()\n }\n\n popups = popups.filter((popup) => popup.id !== popupId)\n }\n }\n\n $: debug('popups', popups)\n\n setContext<AbsolutePopupContext>('absolute-popup', { openAbsolutePopup, closeAbsolutePopup })\n</script>\n\n{#each popups as popup}\n <AbsolutePopupEntry {popup} {closeAbsolutePopup} />\n{/each}\n\n<slot />\n","/**\n * Find a unique name. Suffix the name with ' (copy)', '(copy 2)', etc\n * until a unique name is found\n * @param name Proposed name\n * @param keys Array with existing keys\n */\nexport function findUniqueName(name: string, keys: string[]): string {\n const keysSet = new Set(keys)\n\n // remove any \" (copy)\" or \" (copy 2)\" suffix from the name\n const nameWithoutCopySuffix = name.replace(/ \\(copy( \\d+)?\\)$/, '')\n\n let validName = name\n let i = 1\n\n while (keysSet.has(validName)) {\n const copy = 'copy' + (i > 1 ? ' ' + i : '')\n validName = `${nameWithoutCopySuffix} (${copy})`\n i++\n }\n\n return validName\n}\n\n/**\n * Transform a text into lower case with the first character upper case\n */\nexport function toCapital(text: string): string {\n return text && text.length > 0 ? text[0].toUpperCase() + text.substring(1).toLowerCase() : text\n}\n\nexport function compareStrings(a: string, b: string): -1 | 0 | 1 {\n return a < b ? -1 : a > b ? 1 : 0\n}\n\n/**\n * Duplicate a piece of text\n */\nexport function duplicateInText(text: string, anchorOffset: number, focusOffset: number): string {\n const startOffset = Math.min(anchorOffset, focusOffset)\n const endOffset = Math.max(anchorOffset, focusOffset)\n\n return (\n text.slice(0, endOffset) +\n text.slice(startOffset, endOffset) + // the duplicated piece of the text\n text.slice(endOffset)\n )\n}\n\n/**\n * Truncate a text to a maximum length.\n * When truncated, the text will pe appended with ellipsis '...'\n * @param text Text to be truncated\n * @param maxLength Maximum allowed length for the text including ellipsis\n */\nexport function truncate(text: string, maxLength: number): string {\n const ellipsis = '...'\n const maxTextLength = maxLength - ellipsis.length\n\n return text.length > maxLength ? text.substring(0, maxTextLength) + ellipsis : text\n}\n\n/**\n * Cast contents of a string to the correct type.\n * This can be a string, a number, a boolean, null, undefined, etc\n * @param str\n * @return parsed string\n */\nexport function parseString(str: string): string | number | boolean | null | undefined {\n if (str === '') {\n return ''\n }\n\n const lower = str.toLowerCase()\n if (lower === 'null') {\n return null\n }\n if (lower === 'true') {\n return true\n }\n if (lower === 'false') {\n return false\n }\n if (lower === 'undefined') {\n return undefined\n }\n\n const num = Number(str) // will nicely fail with '123ab'\n const numFloat = parseFloat(str) // will nicely fail with ' '\n if (!isNaN(num) && !isNaN(numFloat)) {\n return num\n }\n\n return str\n}\n","import { jsonquery, type JSONQuery, parse, stringify } from '@jsonquerylang/jsonquery'\nimport { parseString } from '$lib/utils/stringUtils.js'\nimport type { JSONParser, QueryLanguage, QueryLanguageOptions } from '$lib/types.js'\nimport type { JSONPath } from 'immutable-json-patch'\nimport { isEqualParser } from '$lib/utils/jsonUtils'\n\nconst description = `\n<p>\n 输入一个 <a href=\"https://jsonquerylang.org\" target=\"_blank\" \n rel=\"noopener noreferrer\">JSON Query(jsonquerylang.org)</a> 函数来过滤、排序或转换数据。\n 你可以使用诸如 <code>get</code>、<code>filter</code>、\n <code>sort</code>、<code>pick</code>、<code>groupBy</code>、<code>uniq</code> 等函数。\n 示例查询:<code>filter(.age >= 18)</code>\n</p>\n`\n\nexport const jsonQueryLanguage: QueryLanguage = {\n id: 'jsonquery',\n name: 'JSONQuery',\n description,\n createQuery,\n executeQuery\n}\n\nfunction createQuery(_json: unknown, queryOptions: QueryLanguageOptions): string {\n const { filter, sort, projection } = queryOptions\n const queryFunctions: JSONQuery[] = []\n\n if (filter && filter.path && filter.relation && filter.value) {\n queryFunctions.push([\n 'filter',\n [\n getOperatorName(filter.relation),\n getter(filter.path),\n parseString(filter.value) as JSONQuery\n ]\n ])\n }\n\n if (sort && sort.path && sort.direction) {\n queryFunctions.push(['sort', getter(sort.path), sort.direction === 'desc' ? 'desc' : 'asc'])\n }\n\n if (projection && projection.paths) {\n if (projection.paths.length > 1) {\n queryFunctions.push(['pick', ...projection.paths.map(getter)])\n } else {\n queryFunctions.push(['map', getter(projection.paths[0])])\n }\n }\n\n return stringify(['pipe', ...queryFunctions])\n}\n\nfunction getter(path: JSONPath): ['get', ...path: JSONPath] {\n return ['get', ...path]\n}\n\nfunction executeQuery(json: unknown, query: string, parser: JSONParser): unknown {\n function stringifyAndParse(json: unknown) {\n const text = parser.stringify(json)\n return text !== undefined ? JSON.parse(text) : undefined\n }\n\n const preprocessedJson = isEqualParser(parser, JSON) ? json : stringifyAndParse(json)\n\n return query.trim() !== '' ? jsonquery(preprocessedJson, query) : preprocessedJson\n}\n\nfunction getOperatorName(operator: string): string {\n // a trick to get the name of the operator by parsing the operator in a temporary query\n return (parse(`1 ${operator} 1`) as [string, number, number])[0]\n}\n","<g>\n {@html raw}\n</g>\n\n<script lang=\"ts\">\n import type { IconData } from '../Icon.svelte';\n\n let cursor = 0xd4937;\n function getId() {\n cursor += 1;\n return `fa-${cursor.toString(16)}`;\n }\n\n let raw = '';\n\n export let data: IconData;\n\n function getRaw(data: IconData) {\n if (!data || !data.raw) {\n return '';\n }\n let rawData = data.raw;\n const ids: Record<string, string> = {};\n rawData = rawData.replace(/\\s(?:xml:)?id=[\"']?([^\"')\\s]+)/g, (match, id) => {\n const uniqueId = getId();\n ids[id] = uniqueId;\n return ` id=\"${uniqueId}\"`;\n });\n\n rawData = rawData.replace(\n /#(?:([^'\")\\s]+)|xpointer\\(id\\((['\"]?)([^')]+)\\2\\)\\))/g,\n (match, rawId, _, pointerId) => {\n const id = rawId || pointerId;\n if (!id || !ids[id]) {\n return match;\n }\n return `#${ids[id]}`;\n }\n );\n return rawData;\n }\n\n $: raw = getRaw(data);\n</script>\n","<Svg\n {label}\n {width}\n {height}\n {box}\n style={combinedStyle}\n {spin}\n {flip}\n {inverse}\n {pulse}\n class={className}\n {...$$restProps}\n>\n <slot>\n {#each iconData?.paths || [] as path}\n <path {...path} />\n {/each}\n {#each iconData?.polygons || [] as polygon}\n <polygon {...polygon} />\n {/each}\n {#if iconData?.raw}\n <Raw bind:data={iconData} />\n {/if}\n </slot>\n</Svg>\n\n<script context=\"module\" lang=\"ts\">\n export interface FaIconDefinition {\n prefix: string;\n iconName: string;\n icon: [\n number, // width\n number, // height\n string[], // ligatures\n string, // unicode\n string | string[] // svgPathData\n ];\n }\n\n export interface IconPath {\n id?: string;\n d: string;\n style?: string;\n stroke?: string;\n }\n\n export interface IconPolygon {\n points: string;\n style?: string;\n }\n\n export interface IconData {\n width: number;\n height: number;\n paths?: IconPath[];\n polygons?: IconPolygon[];\n raw?: string;\n }\n\n export type IconType = Record<string, IconData> | FaIconDefinition;\n</script>\n\n<script lang=\"ts\">\n import Raw from './svg/Raw.svelte';\n import Svg from './svg/Svg.svelte';\n\n let className = '';\n\n export let data: IconType;\n let iconData: IconData | undefined;\n export let scale = 1;\n export let spin = false;\n export let inverse = false;\n export let pulse = false;\n export let flip: 'horizontal' | 'vertical' | undefined = undefined;\n export let label: string = '';\n export let style: string = '';\n export { className as class };\n\n // internal\n let childrenHeight = 0;\n let childrenWidth = 0;\n let outerScale = 1;\n\n let width: number = 10;\n let height: number = 10;\n let combinedStyle: string;\n let box: string;\n\n function normaliseData(data: IconType): IconData | undefined {\n let name: string;\n let iconData: IconData;\n if (!data) {\n return undefined;\n } else if ('definition' in data) {\n console.error(\n \"`import faIconName from '@fortawesome/package-name/faIconName` not supported - Please use `import { faIconName } from '@fortawesome/package-name/faIconName'` instead\"\n );\n return undefined;\n } else if ('iconName' in data && 'icon' in data) {\n name = data.iconName as string;\n // fontawesome v5/6 icon imported with:\n // import { iconName } from '@fortawesome/packagename/iconName';\n // import { iconName } from '@fortawesome/packagename';\n const [width, height, , , path] = data.icon as Exclude<IconType['icon'], IconData>;\n const paths = Array.isArray(path) ? path : [path];\n iconData = {\n width,\n height,\n paths: paths.map((path) => {\n return { d: path };\n })\n };\n } else {\n // inbuilt icons\n name = Object.keys(data)[0];\n iconData = data[name];\n }\n return iconData;\n }\n\n function normalisedScale() {\n let numScale = 1;\n if (typeof scale !== 'undefined') {\n numScale = Number(scale);\n }\n if (isNaN(numScale) || numScale <= 0) {\n console.warn('Invalid prop: prop \"scale\" should be a number over 0.');\n return outerScale;\n }\n return numScale * outerScale;\n }\n\n function calculateBox() {\n if (iconData) {\n return `0 0 ${iconData.width} ${iconData.height}`;\n }\n return `0 0 ${width} ${height}`;\n }\n\n function calculateRatio() {\n if (!iconData) {\n return 1;\n }\n return Math.max(iconData.width, iconData.height) / 16;\n }\n\n function calculateWidth() {\n if (childrenWidth) {\n return childrenWidth;\n }\n if (iconData) {\n return (iconData.width / calculateRatio()) * normalisedScale();\n }\n return 0;\n }\n\n function calculateHeight() {\n if (childrenHeight) {\n return childrenHeight;\n }\n if (iconData) {\n return (iconData.height / calculateRatio()) * normalisedScale();\n }\n return 0;\n }\n\n function calculateStyle() {\n let combined = '';\n if (style !== null) {\n combined += style;\n }\n let size = normalisedScale();\n if (size === 1) {\n if (combined.length === 0) {\n return '';\n }\n return combined;\n }\n if (combined !== '' && !combined.endsWith(';')) {\n combined += '; ';\n }\n return `${combined}font-size: ${size}em`;\n }\n\n $: {\n iconData = normaliseData(data);\n style;\n scale;\n width = calculateWidth();\n height = calculateHeight();\n combinedStyle = calculateStyle();\n box = calculateBox();\n }\n</script>\n\n<svelte:options namespace=\"svg\" />\n","<svg\n version=\"1.1\"\n class=\"fa-icon {className}\"\n class:fa-spin={spin}\n class:fa-pulse={pulse}\n class:fa-inverse={inverse}\n class:fa-flip-horizontal={flip === 'horizontal'}\n class:fa-flip-vertical={flip === 'vertical'}\n {width}\n {height}\n aria-label={label}\n role={label ? 'img' : 'presentation'}\n viewBox={box}\n {style}\n {...$$restProps}\n>\n <slot />\n</svg>\n\n<style>\n .fa-icon {\n display: inline-block;\n fill: currentColor;\n }\n .fa-flip-horizontal {\n transform: scale(-1, 1);\n }\n .fa-flip-vertical {\n transform: scale(1, -1);\n }\n .fa-spin {\n animation: fa-spin 1s 0s infinite linear;\n }\n .fa-inverse {\n color: #fff;\n }\n .fa-pulse {\n animation: fa-spin 1s infinite steps(8);\n }\n @keyframes fa-spin {\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n }\n</style>\n\n<script lang=\"ts\">\n let className: string = '';\n\n export { className as class };\n\n export let width: number;\n export let height: number;\n export let box: string = '0 0 0 0';\n\n export let spin = false;\n export let inverse = false;\n export let pulse = false;\n export let flip: string = 'none';\n\n // optionals\n export let style: string = '';\n export let label: string = '';\n</script>\n","<svelte:options immutable={true} />\n\n<script lang=\"ts\">\n import { faCheckSquare, faSquare } from '@fortawesome/free-regular-svg-icons'\n import type { JSONPath } from 'immutable-json-patch'\n import { compileJSONPointer } from 'immutable-json-patch'\n import Icon from 'svelte-awesome'\n import type { OnPatch } from '$lib/types.js'\n\n export let path: JSONPath\n export let value: unknown\n export let readOnly: boolean\n export let onPatch: OnPatch\n export let focus: () => void\n\n function toggleBooleanValue(event: MouseEvent) {\n event.stopPropagation()\n\n if (readOnly) {\n return\n }\n\n onPatch([\n {\n op: 'replace',\n path: compileJSONPointer(path),\n value: !value\n }\n ])\n\n focus()\n }\n</script>\n\n<div\n role=\"checkbox\"\n tabindex=\"-1\"\n aria-checked={value === true}\n class=\"jse-boolean-toggle\"\n class:jse-readonly={readOnly}\n on:mousedown={toggleBooleanValue}\n title={!readOnly ? 'Click to toggle this boolean value' : `Boolean value ${value}`}\n>\n <Icon data={value === true ? faCheckSquare : faSquare} />\n</div>\n\n<style src=\"./BooleanToggle.scss\"></style>\n","<script lang=\"ts\">\n import { onDestroy, onMount } from 'svelte'\n\n export let color: string\n export let onChange: (newColor: string) => void\n export let showOnTop: boolean\n\n let ref: HTMLElement | undefined\n let destroyColorPicker = () => {}\n\n onMount(async () => {\n // Dynamically import VanillaPicker, because it requires `document` to be defined,\n // and that is not supported server side\n const VanillaPicker = (await import('vanilla-picker'))?.default\n\n const colorPicker = new VanillaPicker({\n parent: ref,\n color,\n popup: showOnTop ? 'top' : 'bottom',\n onDone: function (color) {\n const alpha = color.rgba[3]\n const hex =\n alpha === 1\n ? color.hex.substring(0, 7) // return #RRGGBB\n : color.hex // return #RRGGBBAA\n onChange(hex)\n }\n })\n\n colorPicker.show()\n\n destroyColorPicker = () => {\n colorPicker.destroy()\n }\n })\n\n onDestroy(() => {\n destroyColorPicker()\n })\n</script>\n\n<div class=\"jse-color-picker-popup\" bind:this={ref}></div>\n\n<style src=\"./ColorPickerPopup.scss\"></style>\n","<svelte:options immutable={true} />\n\n<script lang=\"ts\">\n import { getColorCSS } from '$lib/utils/typeUtils.js'\n import { getWindow } from '$lib/utils/domUtils.js'\n import type { JSONPath } from 'immutable-json-patch'\n import { compileJSONPointer } from 'immutable-json-patch'\n import { getContext } from 'svelte'\n import ColorPickerPopup from '../../../components/controls/ColorPickerPopup.svelte'\n import type { AbsolutePopupContext, OnPatch } from '$lib/types.js'\n\n const { openAbsolutePopup } = getContext<AbsolutePopupContext>('absolute-popup')\n\n export let path: JSONPath\n export let value: string\n export let readOnly: boolean\n export let onPatch: OnPatch\n export let focus: () => void\n\n $: color = getColorCSS(value)\n $: title = !readOnly ? 'Click to open a color picker' : `Color ${value}`\n\n function onChange(color: string) {\n onPatch([\n {\n op: 'replace',\n path: compileJSONPointer(path),\n value: color\n }\n ])\n\n onClose()\n }\n\n function onClose() {\n focus()\n }\n\n function openColorPicker(event: MouseEvent) {\n if (readOnly) {\n return\n }\n\n // estimate of the color picker height\n // we'll render the color picker on top\n // when there is not enough space below, and there is enough space above\n const height = 300\n\n const target = event.target as Element\n const top = target.getBoundingClientRect().top\n const windowHeight = getWindow(target)?.innerHeight ?? 0\n const showOnTop = windowHeight - top < height && top > height\n\n const props = {\n color: value,\n onChange,\n showOnTop\n }\n\n openAbsolutePopup(ColorPickerPopup, props, {\n anchor: target,\n closeOnOuterClick: true,\n onClose,\n offsetTop: 18,\n offsetLeft: -8,\n height\n })\n }\n</script>\n\n<button\n type=\"button\"\n class=\"jse-color-picker-button\"\n class:jse-readonly={readOnly}\n style=\"background: {color}\"\n {title}\n aria-label={title}\n on:click={openColorPicker}\n></button>\n\n<style src=\"./ColorPicker.scss\"></style>\n","import type { Section } from './types'\nimport { SortDirection } from './types.js'\n\nexport const SCROLL_DURATION = 300 // ms\nexport const DEBOUNCE_DELAY = 300 // ms\nexport const TEXT_MODE_ONCHANGE_DELAY = 300 // ms\nexport const AUTO_SCROLL_INTERVAL = 50 // ms\nexport const AUTO_SCROLL_SPEED_SLOW = 200 // pixels per second\nexport const AUTO_SCROLL_SPEED_NORMAL = 400 // pixels per second\nexport const AUTO_SCROLL_SPEED_FAST = 1200 // pixels per second\nexport const MAX_SEARCH_RESULTS = 1000\nexport const ARRAY_SECTION_SIZE = 100\nexport const MAX_VALIDATION_ERRORS = 100\nexport const MAX_CHARACTERS_TEXT_PREVIEW = 20000\nexport const MAX_INLINE_OBJECT_CHARS = 50\nexport const MAX_HEADER_NAME_CHARACTERS = 50\nexport const DEFAULT_VISIBLE_SECTIONS: Section[] = [{ start: 0, end: ARRAY_SECTION_SIZE }]\nexport const MAX_VALIDATABLE_SIZE = 100 * 1024 * 1024 // 1 MB\nexport const MAX_AUTO_REPAIRABLE_SIZE = 1024 * 1024 // 1 MB\nexport const MAX_MULTILINE_PASTE_SIZE = 1024 * 1024 // 1 MB\nexport const MAX_DOCUMENT_SIZE_EXPAND_ALL = 10 * 1024 // 10 KB\n\nexport const INSERT_EXPLANATION =\n '插入或复制内容, ' +\n '输入 [ 插入一个新的数组, ' +\n '输入 { 插入一个新的对象, ' +\n '或者直接输入一个新的值'\n\nexport const CONTEXT_MENU_EXPLANATION =\n '打开上下文菜单 ' + '(点击这里, ' + '右键点击选择内容, ' + '或者使用上下文菜单按钮或Ctrl+Q)'\n\nexport const HOVER_INSERT_INSIDE = 'hover-insert-inside'\nexport const HOVER_INSERT_AFTER = 'hover-insert-after'\nexport const HOVER_COLLECTION = 'hover-collection'\n\nexport const JSON_STATUS_VALID = 'valid'\nexport const JSON_STATUS_REPAIRABLE = 'repairable'\nexport const JSON_STATUS_INVALID = 'invalid'\n\n// TODO: can we dynamically calculate the size?\nexport const CONTEXT_MENU_HEIGHT = (40 + 2) * 8 // px\nexport const CONTEXT_MENU_WIDTH = 260 // px\nexport const SEARCH_BOX_HEIGHT = 100 // px for search and replace\n\nexport const SORT_DIRECTION_NAMES = {\n [SortDirection.asc]: '升序',\n [SortDirection.desc]: '降序'\n}\n","import { sortBy } from 'lodash-es'\nimport { ARRAY_SECTION_SIZE } from '../constants.js'\nimport type { Section } from '$lib/types.js'\n\n/**\n * Create sections that can be expanded.\n * Used to display a button like \"Show items 100-200\"\n */\nexport function getExpandItemsSections(startIndex: number, endIndex: number): Section[] {\n // expand the start of the section\n const section1 = {\n start: startIndex,\n end: Math.min(nextRoundNumber(startIndex), endIndex)\n }\n\n // expand the middle of the section\n const start2 = Math.max(currentRoundNumber((startIndex + endIndex) / 2), startIndex)\n const section2 = {\n start: start2,\n end: Math.min(nextRoundNumber(start2), endIndex)\n }\n\n // expand the end of the section\n const currentIndex = currentRoundNumber(endIndex)\n const previousIndex = currentIndex === endIndex ? currentIndex - ARRAY_SECTION_SIZE : currentIndex\n const section3 = {\n start: Math.max(previousIndex, startIndex),\n end: endIndex\n }\n\n const sections = [section1]\n\n const showSection2 = section2.start >= section1.end && section2.end <= section3.start\n if (showSection2) {\n sections.push(section2)\n }\n\n const showSection3 = section3.start >= (showSection2 ? section2.end : section1.end)\n if (showSection3) {\n sections.push(section3)\n }\n\n return sections\n}\n\n/**\n * Sort and merge a list with sections\n */\nexport function mergeSections(sections: Section[]): Section[] {\n const sortedSections = sortBy(sections, (section) => section.start)\n\n const mergedSections = [sortedSections[0]]\n\n for (let sortedIndex = 0; sortedIndex < sortedSections.length; sortedIndex++) {\n const mergedIndex = mergedSections.length - 1\n const previous = mergedSections[mergedIndex]\n const current = sortedSections[sortedIndex]\n\n if (current.start <= previous.end) {\n // there is overlap -> replace the previous item\n mergedSections[mergedIndex] = {\n start: Math.min(previous.start, current.start),\n end: Math.max(previous.end, current.end)\n }\n } else {\n // no overlap, just add the item\n mergedSections.push(current)\n }\n }\n\n return mergedSections\n}\n\n// TODO: write unit test\nexport function inVisibleSection(sections: Section[], index: number): boolean {\n return sections.some((section) => {\n return index >= section.start && index < section.end\n })\n}\n\nexport function nextRoundNumber(index: number): number {\n return currentRoundNumber(index) + ARRAY_SECTION_SIZE\n}\n\nexport function currentRoundNumber(index: number): number {\n return Math.floor(index / ARRAY_SECTION_SIZE) * ARRAY_SECTION_SIZE\n}\n","import type {\n ContentParseError,\n ContentValidationErrors,\n ContextMenuColumn,\n ContextMenuRow,\n MenuButton,\n MenuDropDownButton,\n MenuLabel,\n MenuSeparator,\n MenuSpace,\n ValidationError,\n NestedValidationError,\n SvelteActionRenderer,\n SvelteComponentRenderer,\n RecursiveState,\n ArrayRecursiveState,\n ObjectRecursiveState,\n ValueRecursiveState,\n SearchResults,\n WithSearchResults,\n TreeHistoryItem,\n HistoryItem,\n TextHistoryItem,\n ModeHistoryItem\n} from './types.js'\nimport { isObject } from '$lib/utils/typeUtils.js'\n\nexport function isMenuSpace(item: unknown): item is MenuSpace {\n // checking the .space property is for backward compatibility\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n return item ? item['type'] === 'space' || item['space'] === true : false\n}\n\nexport function isMenuSeparator(item: unknown): item is MenuSeparator {\n // checking the .separator property is for backward compatibility\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n return item ? item['type'] === 'separator' || item['separator'] === true : false\n}\n\nexport function isMenuLabel(item: unknown): item is MenuLabel {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n return item ? item['type'] === 'label' && typeof item['text'] === 'string' : false\n}\n\nexport function isMenuButton(item: unknown): item is MenuButton {\n // for backward compatibility, we only check .onClick here and not item['type'] === 'button'\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n return item ? typeof item['onClick'] === 'function' : false\n}\n\nexport function isMenuDropDownButton(item: unknown): item is MenuDropDownButton {\n return item\n ? // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n item['type'] === 'dropdown-button' &&\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n isMenuButton(item['main']) &&\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n Array.isArray(item['items'])\n : false\n}\n\nexport function isContextMenuRow(item: unknown): item is ContextMenuRow {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n return item ? item['type'] === 'row' && Array.isArray(item['items']) : false\n}\n\nexport function isContextMenuColumn(item: unknown): item is ContextMenuColumn {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n return item ? item['type'] === 'column' && Array.isArray(item['items']) : false\n}\n\nexport function isContentParseError(contentErrors: unknown): contentErrors is ContentParseError {\n return isObject(contentErrors) && isObject(contentErrors['parseError'])\n}\n\nexport function isContentValidationErrors(\n contentErrors: unknown\n): contentErrors is ContentValidationErrors {\n return isObject(contentErrors) && Array.isArray(contentErrors['validationErrors'])\n}\n\nexport function isValidationError(value: unknown): value is ValidationError {\n return (\n isObject(value) &&\n Array.isArray(value.path) &&\n typeof value.message === 'string' &&\n 'severity' in value\n )\n}\n\nexport function isNestedValidationError(value: unknown): value is NestedValidationError {\n return isObject(value) && isValidationError(value) && typeof value.isChildError === 'boolean'\n}\n\nexport function isSvelteComponentRenderer(value: unknown): value is SvelteComponentRenderer {\n return isObject(value) && 'component' in value && isObject(value.props)\n}\n\nexport function isSvelteActionRenderer(value: unknown): value is SvelteActionRenderer {\n return isObject(value) && typeof value.action === 'function' && isObject(value.props)\n}\n\nexport function isObjectRecursiveState(\n state: RecursiveState | undefined\n): state is ObjectRecursiveState {\n return state !== undefined && state.type === 'object'\n}\n\nexport function isArrayRecursiveState(\n state: RecursiveState | undefined\n): state is ArrayRecursiveState {\n return state !== undefined && state.type === 'array'\n}\n\nexport function isValueRecursiveState(\n state: RecursiveState | undefined\n): state is ValueRecursiveState {\n return state !== undefined && state.type === 'value'\n}\n\nexport function isExpandableState(\n state: RecursiveState | undefined\n): state is ObjectRecursiveState | ArrayRecursiveState {\n return isObjectRecursiveState(state) || isArrayRecursiveState(state)\n}\n\nexport function hasSearchResults(state: SearchResults | undefined): state is WithSearchResults {\n return (\n state !== undefined &&\n Array.isArray((state as unknown as Record<string, unknown>).searchResults)\n )\n}\n\nexport function isTreeHistoryItem(\n historyItem: HistoryItem | undefined\n): historyItem is TreeHistoryItem {\n return historyItem ? historyItem.type === 'tree' : false\n}\n\nexport function isTextHistoryItem(\n historyItem: HistoryItem | undefined\n): historyItem is TextHistoryItem {\n return historyItem ? historyItem.type === 'text' : false\n}\n\nexport function isModeHistoryItem(\n historyItem: HistoryItem | undefined\n): historyItem is ModeHistoryItem {\n return historyItem ? historyItem.type === 'mode' : false\n}\n","import {\n compileJSONPointer,\n deleteIn,\n existsIn,\n getIn,\n immutableJSONPatch,\n isJSONArray,\n isJSONObject,\n isJSONPatchAdd,\n isJSONPatchCopy,\n isJSONPatchMove,\n isJSONPatchRemove,\n isJSONPatchReplace,\n type JSONPatchAdd,\n type JSONPatchCopy,\n type JSONPatchDocument,\n type JSONPatchMove,\n type JSONPatchOperation,\n type JSONPatchRemove,\n type JSONPath,\n parsePath,\n setIn,\n updateIn\n} from 'immutable-json-patch'\nimport { initial, last } from 'lodash-es'\nimport { DEFAULT_VISIBLE_SECTIONS, MAX_DOCUMENT_SIZE_EXPAND_ALL } from '../constants.js'\nimport { forEachIndex, insertItemsAt, strictShallowEqual } from '../utils/arrayUtils.js'\nimport { isObject, isStringContainingPrimitiveValue } from '../utils/typeUtils.js'\nimport {\n currentRoundNumber,\n inVisibleSection,\n mergeSections,\n nextRoundNumber\n} from './expandItemsSections.js'\nimport type {\n ArrayDocumentState,\n CaretPosition,\n DocumentState,\n ObjectDocumentState,\n OnExpand,\n ArrayRecursiveState,\n RecursiveState,\n RecursiveStateFactory,\n Section,\n ValueDocumentState,\n VisibleSection\n} from '$lib/types'\nimport { CaretType } from '$lib/types.js'\nimport { int } from '../utils/numberUtils.js'\nimport { isLargeContent } from '$lib/utils/jsonUtils.js'\nimport {\n isArrayRecursiveState,\n isExpandableState,\n isObjectRecursiveState,\n isValueRecursiveState\n} from '$lib/typeguards.js'\n\nexport type CreateRecursiveStateProps = {\n json: unknown | undefined\n factory: RecursiveStateFactory\n}\n\nexport function createRecursiveState({\n json,\n factory\n}: CreateRecursiveStateProps): RecursiveState | undefined {\n return Array.isArray(json)\n ? factory.createArrayDocumentState()\n : isObject(json)\n ? factory.createObjectDocumentState()\n : json !== undefined\n ? factory.createValueDocumentState()\n : undefined\n}\n\nexport type CreateDocumentStateProps = {\n json: unknown | undefined\n expand?: OnExpand\n}\n\nexport function createDocumentState({\n json,\n expand\n}: CreateDocumentStateProps): DocumentState | undefined {\n const documentState: DocumentState | undefined = createRecursiveState({\n json,\n factory: documentStateFactory\n }) as DocumentState\n\n return expand && documentState ? expandPath(json, documentState, [], expand) : documentState\n}\n\nexport function createArrayDocumentState({ expanded } = { expanded: false }): ArrayDocumentState {\n return { type: 'array', expanded, visibleSections: DEFAULT_VISIBLE_SECTIONS, items: [] }\n}\n\nexport function createObjectDocumentState({ expanded } = { expanded: false }): ObjectDocumentState {\n return { type: 'object', expanded, properties: {} }\n}\n\nexport function createValueDocumentState(): ValueDocumentState {\n return { type: 'value' }\n}\n\nexport const documentStateFactory: RecursiveStateFactory = {\n createObjectDocumentState,\n createArrayDocumentState,\n createValueDocumentState\n}\n\nexport function ensureRecursiveState<T extends RecursiveState>(\n json: unknown,\n documentState: T | undefined,\n path: JSONPath,\n {\n createObjectDocumentState,\n createArrayDocumentState,\n createValueDocumentState\n }: RecursiveStateFactory\n): T {\n function recurse(value: unknown, state: T | undefined, path: JSONPath): T {\n if (Array.isArray(value)) {\n const arrayState: ArrayRecursiveState = isArrayRecursiveState(state)\n ? state\n : createArrayDocumentState()\n if (path.length === 0) {\n return arrayState as T\n }\n\n const index = int(path[0])\n const itemState = recurse(value[index], arrayState.items[index] as T, path.slice(1))\n return setIn(arrayState, ['items', path[0]], itemState)\n }\n\n if (isObject(value)) {\n const objectState = isObjectRecursiveState(state) ? state : createObjectDocumentState()\n if (path.length === 0) {\n return objectState as T\n }\n\n const key = path[0]\n const itemState = recurse(value[key], objectState.properties[key] as T, path.slice(1))\n return setIn(objectState, ['properties', key], itemState)\n }\n\n return isValueRecursiveState(state) ? state : (createValueDocumentState() as T)\n }\n\n return recurse(json, documentState, path)\n}\n\nexport function syncDocumentState(\n json: unknown,\n documentState: DocumentState | undefined,\n path: JSONPath = []\n): DocumentState | undefined {\n return _transformDocumentState(\n json,\n documentState,\n path,\n (nestedJson, nestedState) => {\n if (nestedJson === undefined || nestedState === undefined) {\n return undefined\n }\n\n if (Array.isArray(nestedJson)) {\n if (isArrayRecursiveState(nestedState)) {\n return nestedState\n }\n\n const expanded = isExpandableState(nestedState) ? nestedState.expanded : false\n return createArrayDocumentState({ expanded })\n }\n\n if (isObject(nestedJson)) {\n if (isObjectRecursiveState(nestedState)) {\n return nestedState\n }\n\n const expanded = isExpandableState(nestedState) ? nestedState.expanded : false\n return createObjectDocumentState({ expanded })\n }\n\n // json is of type value\n if (isValueRecursiveState(nestedState)) {\n return nestedState\n }\n\n // type of state does not match the actual type of the json\n return undefined\n },\n () => true\n )\n}\n\nfunction _transformDocumentState(\n json: unknown,\n documentState: DocumentState | undefined,\n path: JSONPath,\n callback: (\n nestedJson: unknown,\n nestedState: DocumentState | undefined,\n path: JSONPath\n ) => DocumentState | undefined,\n recurse: (nestedState: DocumentState | undefined) => boolean\n): DocumentState | undefined {\n const updatedState = callback(json, documentState, path)\n\n if (Array.isArray(json) && isArrayRecursiveState(updatedState) && recurse(updatedState)) {\n const items: (DocumentState | undefined)[] = []\n\n forEachVisibleIndex(json, updatedState.visibleSections, (index) => {\n const itemPath = path.concat(String(index))\n const value = json[index]\n const item = updatedState.items[index]\n const updatedItem = _transformDocumentState(value, item, itemPath, callback, recurse)\n if (updatedItem !== undefined) {\n items[index] = updatedItem\n }\n })\n\n const changed = !strictShallowEqual(items, updatedState.items)\n\n return changed ? { ...updatedState, items } : updatedState\n }\n\n if (isObject(json) && isObjectRecursiveState(updatedState) && recurse(updatedState)) {\n const properties: ObjectDocumentState['properties'] = {}\n Object.keys(json).forEach((key) => {\n const propPath = path.concat(key)\n const value = json[key]\n const prop = updatedState.properties[key]\n const updatedProp = _transformDocumentState(value, prop, propPath, callback, recurse)\n if (updatedProp !== undefined) {\n properties[key] = updatedProp\n }\n })\n\n const changed = !strictShallowEqual(\n Object.values(properties),\n Object.values(updatedState.properties)\n )\n\n return changed ? { ...updatedState, properties } : updatedState\n }\n\n return updatedState\n}\n\n/**\n * Invoke a callback function for every visible item in the array\n */\nexport function forEachVisibleIndex(\n jsonArray: Array<unknown>,\n visibleSections: VisibleSection[],\n callback: (index: number) => void\n) {\n visibleSections.forEach(({ start, end }) => {\n forEachIndex(start, Math.min(jsonArray.length, end), callback)\n })\n}\n\nexport function expandVisibleSection(state: ArrayDocumentState, index: number): ArrayDocumentState {\n if (inVisibleSection(state.visibleSections, index)) {\n return state\n }\n\n const start = currentRoundNumber(index)\n const end = nextRoundNumber(start)\n const newVisibleSection = { start, end }\n\n return {\n ...state,\n visibleSections: mergeSections(state.visibleSections.concat(newVisibleSection))\n }\n}\n\nexport function toRecursiveStatePath(json: unknown, path: JSONPath): JSONPath {\n let value = json\n const recursiveStatePath: JSONPath = []\n\n let i = 0\n while (i < path.length) {\n if (Array.isArray(value)) {\n const index = path[i]\n recursiveStatePath.push('items', index)\n value = value[int(index)]\n } else if (isObject(value)) {\n const key = path[i]\n recursiveStatePath.push('properties', key)\n value = (value as Record<string, unknown>)[key]\n } else {\n throw new Error(`Cannot convert path: Object or Array expected at index ${i}`)\n }\n\n i++\n }\n\n return recursiveStatePath\n}\n\n/**\n * Expand all nodes along the given path, and expand invisible array sections if needed.\n * Then, optionally expand child nodes according to the provided callback.\n */\nexport function expandPath(\n json: unknown | undefined,\n documentState: DocumentState | undefined,\n path: JSONPath,\n callback: OnExpand\n): DocumentState | undefined {\n let updatedState = documentState\n\n // Step 1: expand all nodes along the path, and update visibleSections if needed\n for (let i = 0; i < path.length; i++) {\n const partialPath = path.slice(0, i)\n\n updatedState = updateInDocumentState(json, updatedState, partialPath, (_, nestedState) => {\n const updatedState =\n isExpandableState(nestedState) && !nestedState.expanded\n ? { ...nestedState, expanded: true }\n : nestedState\n\n if (isArrayRecursiveState(updatedState)) {\n const index = int(path[i])\n return expandVisibleSection(updatedState, index)\n }\n\n return updatedState\n })\n }\n\n // Step 2: recursively expand child nodes tested with the callback\n return updateInDocumentState(json, updatedState, path, (nestedValue, nestedState) => {\n const relativePath: JSONPath = []\n return _expandRecursively(nestedValue, nestedState, relativePath, callback)\n })\n}\n\nfunction _expandRecursively(\n json: unknown,\n documentState: DocumentState | undefined,\n path: JSONPath,\n callback: OnExpand\n): DocumentState | undefined {\n return _transformDocumentState(\n json,\n documentState,\n path,\n (nestedJson, nestedState, nestedPath) => {\n if (Array.isArray(nestedJson) && callback(nestedPath)) {\n return isArrayRecursiveState(nestedState)\n ? nestedState.expanded\n ? nestedState\n : { ...nestedState, expanded: true }\n : createArrayDocumentState({ expanded: true })\n }\n\n if (isObject(nestedJson) && callback(nestedPath)) {\n return isObjectRecursiveState(nestedState)\n ? nestedState.expanded\n ? nestedState\n : { ...nestedState, expanded: true }\n : createObjectDocumentState({ expanded: true })\n }\n\n return nestedState\n },\n (nestedState) => isExpandableState(nestedState) && nestedState.expanded\n )\n}\n\nexport function collapsePath(\n json: unknown,\n documentState: DocumentState | undefined,\n path: JSONPath,\n recursive: boolean\n): DocumentState | undefined {\n return updateInDocumentState(json, documentState, path, (nestedJson, nestedState) => {\n return recursive ? _collapseRecursively(nestedJson, nestedState, path) : _collapse(nestedState)\n })\n}\n\nfunction _collapse<T extends DocumentState | undefined>(documentState: T): T {\n if (isArrayRecursiveState(documentState) && documentState.expanded) {\n return { ...documentState, expanded: false, visibleSections: DEFAULT_VISIBLE_SECTIONS }\n }\n\n if (isObjectRecursiveState(documentState) && documentState.expanded) {\n return { ...documentState, expanded: false }\n }\n\n return documentState\n}\n\nfunction _collapseRecursively(\n json: unknown,\n documentState: DocumentState | undefined,\n path: JSONPath\n): DocumentState | undefined {\n return _transformDocumentState(\n json,\n documentState,\n path,\n (_, nestedState) => _collapse(nestedState),\n () => true\n )\n}\n\n/**\n * Expand a section of items in an array\n */\nexport function expandSection(\n json: unknown,\n documentState: DocumentState | undefined,\n path: JSONPath,\n section: Section\n): DocumentState | undefined {\n return updateInDocumentState(json, documentState, path, (_value, state) => {\n if (!isArrayRecursiveState(state)) {\n return state\n }\n\n const visibleSections = mergeSections(state.visibleSections.concat(section))\n\n return { ...state, visibleSections }\n })\n}\n\nexport function syncKeys(actualKeys: string[], prevKeys?: string[]): string[] {\n if (!prevKeys) {\n return actualKeys\n }\n\n // copy the keys that still exist\n const actualKeysSet = new Set(actualKeys)\n const keys = prevKeys.filter((key) => actualKeysSet.has(key))\n\n // add new keys\n const keysSet = new Set(keys)\n actualKeys.filter((key) => !keysSet.has(key)).forEach((key) => keys.push(key))\n\n return keys\n}\n\n/**\n * Apply patch operations to both json and state\n */\nexport function documentStatePatch(\n json: unknown,\n documentState: DocumentState | undefined,\n operations: JSONPatchDocument\n): { json: unknown; documentState: DocumentState | undefined } {\n const initial = { json, documentState }\n\n const result = operations.reduce((current, operation) => {\n return {\n json: immutableJSONPatch(current.json, [operation]),\n documentState: _documentStatePatch(current.json, current.documentState, operation)\n }\n }, initial)\n\n return {\n json: result.json,\n documentState: syncDocumentState(result.json, result.documentState) // sync to clean up leftover state\n }\n}\n\nfunction _documentStatePatch(\n json: unknown,\n documentState: DocumentState | undefined,\n operation: JSONPatchOperation\n): DocumentState | undefined {\n if (isJSONPatchAdd(operation)) {\n return documentStateAdd(json, documentState, operation, undefined)\n }\n\n if (isJSONPatchRemove(operation)) {\n return documentStateRemove(json, documentState, operation)\n }\n\n if (isJSONPatchReplace(operation)) {\n const path = parsePath(json, operation.path)\n const enforceString = getEnforceString(json, documentState, path)\n if (enforceString) {\n // ensure the enforceString setting is not lost when for example changing \"123\"\n // into \"abc\" and later back to \"123\", so we now make it explicit.\n return setInDocumentState(json, documentState, path, { type: 'value', enforceString })\n }\n\n // nothing special to do (all is handled by syncDocumentState)\n return documentState\n }\n\n if (isJSONPatchCopy(operation) || isJSONPatchMove(operation)) {\n return documentStateMoveOrCopy(json, documentState, operation)\n }\n\n return documentState\n}\n\nexport function getInRecursiveState<T extends RecursiveState>(\n json: unknown,\n documentState: T | undefined,\n path: JSONPath\n): T | undefined {\n try {\n return getIn(documentState, toRecursiveStatePath(json, path))\n } catch {\n return undefined\n }\n}\n\nexport function setInRecursiveState<T extends RecursiveState>(\n json: unknown,\n recursiveState: T | undefined,\n path: JSONPath,\n value: unknown,\n factory: RecursiveStateFactory\n): T | undefined {\n const ensuredState = ensureRecursiveState(json, recursiveState, path, factory)\n return setIn(ensuredState, toRecursiveStatePath(json, path), value)\n}\n\nexport function updateInRecursiveState<T extends RecursiveState>(\n json: unknown,\n documentState: T | undefined,\n path: JSONPath,\n transform: (value: unknown, state: T) => T | undefined,\n factory: RecursiveStateFactory\n): T {\n const ensuredState: T = ensureRecursiveState(json, documentState, path, factory)\n return updateIn(ensuredState, toRecursiveStatePath(json, path), (nestedState: T) => {\n const value = getIn(json, path)\n return transform(value, nestedState)\n })\n}\n\nexport function setInDocumentState<T extends RecursiveState>(\n json: unknown | undefined,\n documentState: T | undefined,\n path: JSONPath,\n value: unknown\n): T | undefined {\n return setInRecursiveState(json, documentState, path, value, documentStateFactory)\n}\n\nexport function updateInDocumentState<T extends RecursiveState>(\n json: unknown | undefined,\n documentState: T | undefined,\n path: JSONPath,\n transform: (value: unknown, state: T) => T | undefined\n): T {\n return updateInRecursiveState(json, documentState, path, transform, documentStateFactory)\n}\n\nexport function deleteInDocumentState<T extends RecursiveState>(\n json: unknown | undefined,\n documentState: T | undefined,\n path: JSONPath\n): T | undefined {\n const recursivePath = toRecursiveStatePath(json, path)\n\n return existsIn(documentState, recursivePath)\n ? deleteIn(documentState, toRecursiveStatePath(json, path))\n : documentState\n}\n\nexport function documentStateAdd(\n json: unknown,\n documentState: DocumentState | undefined,\n operation: JSONPatchAdd,\n stateValue: DocumentState | undefined\n): DocumentState | undefined {\n const path = parsePath(json, operation.path)\n const parentPath = initial(path)\n\n let updatedState = documentState\n\n updatedState = updateInDocumentState(json, updatedState, parentPath, (_parent, arrayState) => {\n if (!isArrayRecursiveState(arrayState)) {\n return arrayState\n }\n\n const index = int(last(path) as string)\n const { items, visibleSections } = arrayState\n return {\n ...arrayState,\n items:\n index < items.length\n ? insertItemsAt(items, index, stateValue !== undefined ? [stateValue] : Array(1))\n : items,\n visibleSections: shiftVisibleSections(visibleSections, index, 1)\n }\n })\n\n // object property added, nothing to do\n return setInDocumentState(json, updatedState, path, stateValue)\n}\n\nexport function documentStateRemove(\n json: unknown,\n documentState: DocumentState | undefined,\n operation: JSONPatchRemove\n): DocumentState | undefined {\n const path = parsePath(json, operation.path)\n const parentPath = initial(path)\n const parent = getIn(json, parentPath)\n\n if (Array.isArray(parent)) {\n return updateInDocumentState(json, documentState, parentPath, (_parent, arrayState) => {\n if (!isArrayRecursiveState(arrayState)) {\n return arrayState\n }\n\n const index = int(last(path) as string)\n const { items, visibleSections } = arrayState\n\n return {\n ...arrayState,\n items: items.slice(0, index).concat(items.slice(index + 1)),\n visibleSections: shiftVisibleSections(visibleSections, index, -1)\n }\n })\n }\n\n return deleteInDocumentState(json, documentState, path)\n}\n\nexport function documentStateMoveOrCopy(\n json: unknown,\n documentState: DocumentState | undefined,\n operation: JSONPatchCopy | JSONPatchMove\n): DocumentState | undefined {\n if (isJSONPatchMove(operation) && operation.from === operation.path) {\n // nothing to do\n return documentState\n }\n\n let updatedState = documentState\n\n // get the state that we will move or copy\n const from = parsePath(json, operation.from)\n const stateValue = getInRecursiveState(json, updatedState, from)\n\n if (isJSONPatchMove(operation)) {\n updatedState = documentStateRemove(json, updatedState, {\n op: 'remove',\n path: operation.from\n })\n }\n\n updatedState = documentStateAdd(\n json,\n updatedState,\n {\n op: 'add',\n path: operation.path,\n value: null // note that the value is not actually used, so we just use null instead of getting the actual value from the json\n },\n stateValue\n )\n\n return updatedState\n}\n\n/**\n * Shift visible sections in an Array with a specified offset\n */\nexport function shiftVisibleSections(\n visibleSections: VisibleSection[],\n index: number,\n offset: number\n): VisibleSection[] {\n const shiftedSections = visibleSections.map((section) => {\n return {\n start: section.start > index ? section.start + offset : section.start,\n end: section.end > index ? section.end + offset : section.end\n }\n })\n\n return mergeAdjacentSections(shiftedSections)\n}\n\n// merge adjacent sections like [{start:0, end:100}, {start:100, end:200}] into [{start:0, end:200}]\nfunction mergeAdjacentSections(visibleSections: VisibleSection[]): VisibleSection[] {\n const merged = visibleSections.slice(0)\n\n let i = 1\n while (i < merged.length) {\n if (merged[i - 1].end === merged[i].start) {\n merged[i - 1] = {\n start: merged[i - 1].start,\n end: merged[i].end\n }\n merged.splice(i)\n }\n i++\n }\n\n return merged\n}\n\nexport function getEnforceString(\n json: unknown,\n documentState: DocumentState | undefined,\n path: JSONPath\n): boolean {\n const value = getIn(json, path)\n const nestedState = getInRecursiveState(json, documentState, path)\n const enforceString = isValueRecursiveState(nestedState) ? nestedState.enforceString : undefined\n\n if (typeof enforceString === 'boolean') {\n return enforceString\n }\n\n return isStringContainingPrimitiveValue(value)\n}\n\nexport function getNextKeys(keys: string[], key: string, includeKey = false): string[] {\n const index = keys.indexOf(key)\n if (index !== -1) {\n return includeKey ? keys.slice(index) : keys.slice(index + 1)\n } else {\n // a new key, that doesn't have next keys\n return []\n }\n}\n\n/**\n * Get all paths which are visible and rendered\n */\n// TODO: create memoized version of getVisiblePaths which remembers just the previous result if json and state are the same\nexport function getVisiblePaths(\n json: unknown,\n documentState: DocumentState | undefined\n): JSONPath[] {\n const paths: JSONPath[] = []\n\n function _recurse(value: unknown, state: DocumentState | undefined, path: JSONPath) {\n paths.push(path)\n\n if (isJSONArray(value) && isArrayRecursiveState(state) && state.expanded) {\n forEachVisibleIndex(value, state.visibleSections, (index) => {\n _recurse(value[index], state.items[index], path.concat(String(index)))\n })\n }\n\n if (isJSONObject(value) && isObjectRecursiveState(state) && state.expanded) {\n Object.keys(value).forEach((key) => {\n _recurse(value[key], state.properties[key], path.concat(key))\n })\n }\n }\n\n _recurse(json, documentState, [])\n\n return paths\n}\n\n/**\n * Get all caret position which are visible and rendered:\n * before a node, at a key, at a value, appending an object/array\n */\n// TODO: create memoized version of getVisibleCaretPositions which remembers just the previous result if json and state are the same\nexport function getVisibleCaretPositions(\n json: unknown,\n documentState: DocumentState | undefined,\n includeInside = true\n): CaretPosition[] {\n const paths: CaretPosition[] = []\n\n function _recurse(value: unknown, path: JSONPath) {\n paths.push({ path, type: CaretType.value })\n\n const valueState = getInRecursiveState(json, documentState, path)\n if (value && isExpandableState(valueState) && valueState.expanded) {\n if (includeInside) {\n paths.push({ path, type: CaretType.inside })\n }\n\n if (isJSONArray(value)) {\n const visibleSections = isArrayRecursiveState(valueState)\n ? valueState.visibleSections\n : DEFAULT_VISIBLE_SECTIONS\n forEachVisibleIndex(value, visibleSections, (index) => {\n const itemPath = path.concat(String(index))\n\n _recurse(value[index], itemPath)\n\n if (includeInside) {\n paths.push({ path: itemPath, type: CaretType.after })\n }\n })\n }\n\n if (isJSONObject(value)) {\n const keys = Object.keys(value)\n keys.forEach((key) => {\n const propertyPath = path.concat(key)\n\n paths.push({ path: propertyPath, type: CaretType.key })\n\n _recurse(value[key], propertyPath)\n\n if (includeInside) {\n paths.push({ path: propertyPath, type: CaretType.after })\n }\n })\n }\n }\n }\n\n _recurse(json, [])\n\n return paths\n}\n\n/**\n * Find the previous visible path.\n * This can be the last child of the previous object or array, or the parent of a first entry.\n */\n// TODO: write tests for getPreviousVisiblePath\nexport function getPreviousVisiblePath(\n json: unknown,\n documentState: DocumentState | undefined,\n path: JSONPath\n): JSONPath | undefined {\n const visiblePaths = getVisiblePaths(json, documentState)\n const visiblePathPointers = visiblePaths.map(compileJSONPointer)\n const pathPointer = compileJSONPointer(path)\n const index = visiblePathPointers.indexOf(pathPointer)\n\n if (index !== -1 && index > 0) {\n return visiblePaths[index - 1]\n }\n\n return undefined\n}\n\n/**\n * Find the next visible path.\n * This can be the next parent entry.\n */\n// TODO: write tests for getNextVisiblePath\nexport function getNextVisiblePath(\n json: unknown,\n documentState: DocumentState | undefined,\n path: JSONPath\n): JSONPath | undefined {\n const visiblePaths = getVisiblePaths(json, documentState)\n const visiblePathPointers = visiblePaths.map(compileJSONPointer)\n const index = visiblePathPointers.indexOf(compileJSONPointer(path))\n\n if (index !== -1 && index < visiblePaths.length - 1) {\n return visiblePaths[index + 1]\n }\n\n return undefined\n}\n\n/**\n * Expand recursively when the expanded contents is small enough,\n * else expand in a minimalistic way\n */\nexport function expandSmart(\n json: unknown | undefined,\n documentState: DocumentState | undefined,\n path: JSONPath,\n maxSize: number = MAX_DOCUMENT_SIZE_EXPAND_ALL\n): DocumentState | undefined {\n const nestedJson = getIn(json, path)\n const callback = isLargeContent({ json: nestedJson }, maxSize) ? expandMinimal : expandAll\n\n return expandPath(json, documentState, path, callback)\n}\n\nexport function expandSmartIfCollapsed(\n json: unknown | undefined,\n documentState: DocumentState | undefined,\n path: JSONPath\n) {\n const nestedState = getInRecursiveState(json, documentState, path)\n const isExpanded = isExpandableState(nestedState) ? nestedState.expanded : false\n\n return isExpanded ? documentState : expandSmart(json, documentState, path)\n}\n\n/**\n * Expand the root array or object, and in case of an array, expand the first array item\n */\nexport function expandMinimal(relativePath: JSONPath): boolean {\n // first item of an array\n return relativePath.length === 0 ? true : relativePath.length === 1 && relativePath[0] === '0'\n}\n\n/**\n * Expand the root array or object\n */\nexport function expandSelf(relativePath: JSONPath): boolean {\n return relativePath.length === 0\n}\n\nexport function expandAll(): boolean {\n return true\n}\n\nexport function expandNone(): boolean {\n return false\n}\n","import {\n getIn,\n isJSONArray,\n isJSONObject,\n isJSONPatchCopy,\n isJSONPatchMove,\n type JSONPatchDocument,\n type JSONPatchOperation,\n type JSONPath,\n parsePath\n} from 'immutable-json-patch'\nimport { first, initial, isEmpty, isEqual, last } from 'lodash-es'\nimport { isObjectOrArray } from '$lib/utils/typeUtils.js'\nimport {\n collapsePath,\n getNextVisiblePath,\n getPreviousVisiblePath,\n getVisibleCaretPositions,\n getVisiblePaths\n} from './documentState.js'\nimport type {\n AfterSelection,\n CaretPosition,\n DocumentState,\n EditKeySelection,\n EditValueSelection,\n InsideSelection,\n JSONEditorSelection,\n JSONParser,\n JSONSelection,\n KeySelection,\n MultiSelection,\n TextSelection,\n ValueSelection\n} from '../types.js'\nimport { CaretType, SelectionType } from '$lib/types.js'\nimport { int } from '$lib/utils/numberUtils.js'\n\nexport function isAfterSelection(\n selection: JSONEditorSelection | undefined\n): selection is AfterSelection {\n return (selection && selection.type === SelectionType.after) || false\n}\n\nexport function isInsideSelection(\n selection: JSONEditorSelection | undefined\n): selection is InsideSelection {\n return (selection && selection.type === SelectionType.inside) || false\n}\n\nexport function isKeySelection(\n selection: JSONEditorSelection | undefined\n): selection is KeySelection {\n return (selection && selection.type === SelectionType.key) || false\n}\n\nexport function isValueSelection(\n selection: JSONEditorSelection | undefined\n): selection is ValueSelection {\n return (selection && selection.type === SelectionType.value) || false\n}\n\nexport function isMultiSelection(\n selection: JSONEditorSelection | undefined\n): selection is MultiSelection {\n return (selection && selection.type === SelectionType.multi) || false\n}\n\nexport function isMultiSelectionWithOneItem(\n selection: JSONEditorSelection | undefined\n): selection is MultiSelection {\n return isMultiSelection(selection) && isEqual(selection.focusPath, selection.anchorPath)\n}\n\nexport function isJSONSelection(\n selection: JSONEditorSelection | undefined\n): selection is JSONSelection {\n return (\n isMultiSelection(selection) ||\n isAfterSelection(selection) ||\n isInsideSelection(selection) ||\n isKeySelection(selection) ||\n isValueSelection(selection)\n )\n}\n\nexport function isTextSelection(\n selection: JSONEditorSelection | undefined\n): selection is TextSelection {\n return (selection && selection.type === SelectionType.text) || false\n}\n\n/**\n * Expand a selection start and end into an array containing all paths\n * between (and including) start and end\n */\nexport function getSelectionPaths(json: unknown, selection: JSONSelection): JSONPath[] {\n const paths: JSONPath[] = []\n\n iterateOverSelection(json, selection, (path) => {\n paths.push(path)\n })\n\n return paths\n}\n\n/**\n * Expand a selection start and end into an array containing all paths\n * between (and including) start and end.\n *\n * The function iterates always from start to end, independent of the order\n * of focusPath and anchorPath.\n *\n * When the callback returns something other than undefined, the iteration is\n * canceled and the value returned by the callback is returned by iterateOverSelection.\n */\nexport function iterateOverSelection<T>(\n json: unknown | undefined,\n selection: JSONSelection | undefined,\n callback: (path: JSONPath) => void | undefined | T\n): void | undefined | T {\n if (!selection) {\n return undefined\n }\n\n const anchorPath = getAnchorPath(selection)\n const focusPath = getFocusPath(selection)\n\n if (isEqual(anchorPath, focusPath)) {\n // just a single node\n return callback(anchorPath)\n } else {\n // multiple nodes\n if (json === undefined) {\n return undefined\n }\n\n const sharedPath = findSharedPath(anchorPath, focusPath)\n\n if (anchorPath.length === sharedPath.length || focusPath.length === sharedPath.length) {\n // a parent and a child, like ['arr', 1] and ['arr']\n return callback(sharedPath)\n }\n\n const selection = createMultiSelection(anchorPath, focusPath)\n const startPath = getStartPath(json, selection)\n const endPath = getEndPath(json, selection)\n\n const startIndex = getChildIndex(json, selection, startPath)\n const endIndex = getChildIndex(json, selection, endPath)\n\n if (startIndex === -1 || endIndex === -1) {\n return undefined\n }\n\n const value = getIn(json, sharedPath)\n\n if (isJSONObject(value)) {\n const keys = Object.keys(value)\n\n for (let i = startIndex; i <= endIndex; i++) {\n const value = callback(sharedPath.concat(keys[i]))\n if (value !== undefined) {\n return value\n }\n }\n\n return undefined\n }\n\n if (isJSONArray(value)) {\n for (let i = startIndex; i <= endIndex; i++) {\n const value = callback(sharedPath.concat(String(i)))\n if (value !== undefined) {\n return value\n }\n }\n\n return undefined\n }\n }\n\n throw new Error('Failed to create selection')\n}\n\nexport function getParentPath(selection: JSONSelection): JSONPath {\n if (isInsideSelection(selection)) {\n return selection.path\n } else {\n return initial(getFocusPath(selection))\n }\n}\n\nexport function getStartPath(json: unknown, selection: JSONSelection): JSONPath {\n if (!isMultiSelection(selection)) {\n return selection.path\n }\n\n const anchorIndex = getChildIndex(json, selection, selection.anchorPath)\n const focusIndex = getChildIndex(json, selection, selection.focusPath)\n\n return focusIndex < anchorIndex ? selection.focusPath : selection.anchorPath\n}\n\nexport function getEndPath(json: unknown, selection: JSONSelection): JSONPath {\n if (!isMultiSelection(selection)) {\n return selection.path\n }\n\n const anchorIndex = getChildIndex(json, selection, selection.anchorPath)\n const focusIndex = getChildIndex(json, selection, selection.focusPath)\n\n return focusIndex > anchorIndex ? selection.focusPath : selection.anchorPath\n}\n\n// TODO: write unit test\nexport function isSelectionInsidePath(selection: JSONSelection, path: JSONPath): boolean {\n return (\n pathStartsWith(getFocusPath(selection), path) &&\n (getFocusPath(selection).length > path.length || isInsideSelection(selection))\n )\n}\n\nexport function getSelectionUp(\n json: unknown,\n documentState: DocumentState | undefined,\n selection: JSONSelection | undefined,\n keepAnchorPath = false\n): JSONSelection | undefined {\n if (!selection) {\n return undefined\n }\n\n const focusPath = keepAnchorPath ? getFocusPath(selection) : getStartPath(json, selection)\n const previousPath = getPreviousVisiblePath(json, documentState, focusPath)\n\n if (keepAnchorPath) {\n // create a multi-selection with multiple nodes\n if (isInsideSelection(selection) || isAfterSelection(selection)) {\n return previousPath !== undefined ? createMultiSelection(focusPath, focusPath) : undefined\n }\n\n return previousPath !== undefined\n ? createMultiSelection(getAnchorPath(selection), previousPath)\n : undefined\n }\n\n if (isAfterSelection(selection)) {\n // select the node itself, not the previous node,\n // FIXME: when after an expanded object/array, should go to the last item inside the object/array\n return createValueSelection(focusPath)\n }\n\n if (isInsideSelection(selection)) {\n // select the node itself, not the previous node,\n return createValueSelection(focusPath)\n }\n\n if (isKeySelection(selection)) {\n if (previousPath === undefined || previousPath.length === 0) {\n return undefined\n }\n\n const parentPath = initial(previousPath)\n const parent = getIn(json, parentPath)\n if (Array.isArray(parent) || isEmpty(previousPath)) {\n // switch to value selection: array has no keys, and root object also not\n return createValueSelection(previousPath)\n } else {\n return createKeySelection(previousPath)\n }\n }\n\n if (isValueSelection(selection)) {\n return previousPath !== undefined ? createValueSelection(previousPath) : undefined\n }\n\n if (previousPath !== undefined) {\n return createValueSelection(previousPath)\n }\n\n return undefined\n}\n\nexport function getSelectionDown(\n json: unknown,\n documentState: DocumentState | undefined,\n selection: JSONSelection | undefined,\n keepAnchorPath = false\n): JSONSelection | undefined {\n if (!selection) {\n return undefined\n }\n const focusPath = keepAnchorPath ? getFocusPath(selection) : getEndPath(json, selection)\n\n // if the focusPath is an Array or object, we must not step into it but\n // over it, we pass state with this array/object collapsed\n const collapsedState = isObjectOrArray(getIn(json, focusPath))\n ? collapsePath(json, documentState, focusPath, true)\n : documentState\n\n const nextPath = getNextVisiblePath(json, documentState, focusPath)\n const nextPathAfter = getNextVisiblePath(json, collapsedState, focusPath)\n\n if (keepAnchorPath) {\n // create a multi-selection with multiple nodes\n if (isInsideSelection(selection)) {\n return nextPath !== undefined ? createMultiSelection(nextPath, nextPath) : undefined\n }\n\n if (isAfterSelection(selection)) {\n return nextPathAfter !== undefined\n ? createMultiSelection(nextPathAfter, nextPathAfter)\n : undefined\n }\n\n return nextPathAfter !== undefined\n ? createMultiSelection(getAnchorPath(selection), nextPathAfter)\n : undefined\n }\n\n if (isAfterSelection(selection)) {\n return nextPathAfter !== undefined ? createValueSelection(nextPathAfter) : undefined\n }\n\n if (isInsideSelection(selection)) {\n return nextPath !== undefined ? createValueSelection(nextPath) : undefined\n }\n\n if (isValueSelection(selection)) {\n return nextPath !== undefined ? createValueSelection(nextPath) : undefined\n }\n\n if (isKeySelection(selection)) {\n if (nextPath === undefined || nextPath.length === 0) {\n return undefined\n }\n\n const parentPath = initial(nextPath) // not nextPathAfter!\n const parent = getIn(json, parentPath)\n if (Array.isArray(parent)) {\n // switch to value selection: array has no keys\n return createValueSelection(nextPath)\n } else {\n return createKeySelection(nextPath)\n }\n }\n\n if (isMultiSelection(selection)) {\n return nextPathAfter !== undefined\n ? createValueSelection(nextPathAfter)\n : nextPath !== undefined\n ? createValueSelection(nextPath)\n : undefined\n }\n\n return undefined\n}\n\n/**\n * Get the next selection for a value inside the current object/array\n * If there is no next value, select AFTER.\n * Only applicable for ValueSelection\n */\nexport function getSelectionNextInside(\n json: unknown,\n documentState: DocumentState | undefined,\n path: JSONPath\n): JSONSelection | undefined {\n // TODO: write unit tests for getSelectionNextInside\n const parentPath = initial(path)\n const childPath = [last(path) as string]\n\n const parent: unknown | undefined = getIn(json, parentPath)\n const nextPathInside = parent ? getNextVisiblePath(parent, documentState, childPath) : undefined\n\n if (nextPathInside) {\n return createValueSelection(parentPath.concat(nextPathInside))\n } else {\n return createAfterSelection(path)\n }\n}\n\n/**\n * Find the caret position and its siblings for a given selection\n */\n// TODO: unit test\nexport function findCaretAndSiblings(\n json: unknown,\n documentState: DocumentState | undefined,\n selection: JSONSelection | undefined,\n includeInside: boolean\n): {\n next: CaretPosition | undefined\n caret: CaretPosition | undefined\n previous: CaretPosition | undefined\n} {\n if (!selection) {\n return { caret: undefined, previous: undefined, next: undefined }\n }\n const visibleCaretPositions = getVisibleCaretPositions(json, documentState, includeInside)\n\n const index = visibleCaretPositions.findIndex((caret) => {\n return (\n isEqual(caret.path, getFocusPath(selection)) && String(caret.type) === String(selection.type)\n )\n })\n\n return {\n caret: index !== -1 ? visibleCaretPositions[index] : undefined,\n\n previous: index !== -1 && index > 0 ? visibleCaretPositions[index - 1] : undefined,\n\n next:\n index !== -1 && index < visibleCaretPositions.length - 1\n ? visibleCaretPositions[index + 1]\n : undefined\n }\n}\n\nexport function getSelectionLeft(\n json: unknown,\n documentState: DocumentState | undefined,\n selection: JSONSelection | undefined,\n keepAnchorPath = false,\n includeInside = true\n): JSONSelection | undefined {\n if (!selection) {\n return undefined\n }\n\n const { caret, previous } = findCaretAndSiblings(json, documentState, selection, includeInside)\n\n if (keepAnchorPath) {\n if (!isMultiSelection(selection)) {\n return createMultiSelection(selection.path, selection.path)\n }\n\n return undefined\n }\n\n if (caret && previous) {\n return fromCaretPosition(previous)\n }\n\n const parentPath = initial(getFocusPath(selection))\n const parent = getIn(json, parentPath)\n\n if (isValueSelection(selection) && Array.isArray(parent)) {\n return createMultiSelection(selection.path, selection.path)\n }\n\n if (isMultiSelection(selection) && !Array.isArray(parent)) {\n return createKeySelection(selection.focusPath)\n }\n\n return undefined\n}\n\nexport function getSelectionRight(\n json: unknown,\n documentState: DocumentState | undefined,\n selection: JSONSelection | undefined,\n keepAnchorPath = false,\n includeInside = true\n): JSONSelection | undefined {\n if (!selection) {\n return undefined\n }\n\n const { caret, next } = findCaretAndSiblings(json, documentState, selection, includeInside)\n\n if (keepAnchorPath) {\n if (!isMultiSelection(selection)) {\n return createMultiSelection(selection.path, selection.path)\n }\n\n return undefined\n }\n\n if (caret && next) {\n return fromCaretPosition(next)\n }\n\n if (isMultiSelection(selection)) {\n return createValueSelection(selection.focusPath)\n }\n\n return undefined\n}\n\n/**\n * Get a proper initial selection based on what is visible\n */\nexport function getInitialSelection(\n json: unknown,\n documentState: DocumentState | undefined\n): JSONSelection {\n const visiblePaths = getVisiblePaths(json, documentState)\n\n // find the first, deepest nested entry (normally a value, not an Object/Array)\n let index = 0\n while (\n index < visiblePaths.length - 1 &&\n visiblePaths[index + 1].length > visiblePaths[index].length\n ) {\n index++\n }\n\n const path = visiblePaths[index]\n return path === undefined || path.length === 0 || Array.isArray(getIn(json, initial(path)))\n ? createValueSelection(path) // Array items and root object/array do not have a key, so select value in that case\n : createKeySelection(path)\n}\n\nexport function createSelectionFromOperations(\n json: unknown,\n operations: JSONPatchDocument\n): JSONSelection | undefined {\n if (operations.length === 1) {\n const operation = first(operations) as JSONPatchOperation\n if (operation.op === 'replace') {\n // a replaced value\n const path = parsePath(json, operation.path)\n\n return createValueSelection(path)\n }\n }\n\n if (!isEmpty(operations) && operations.every((operation) => operation.op === 'move')) {\n const firstOp = first(operations)\n const otherOps = operations.slice(1)\n\n if (\n (isJSONPatchCopy(firstOp) || isJSONPatchMove(firstOp)) &&\n firstOp.from !== firstOp.path &&\n otherOps.every((op) => (isJSONPatchCopy(op) || isJSONPatchMove(op)) && op.from === op.path)\n ) {\n // a renamed key\n const path = parsePath(json, firstOp.path)\n\n return createKeySelection(path)\n }\n }\n\n const paths = operations\n .filter((operation) => {\n return (\n operation.op !== 'test' &&\n operation.op !== 'remove' &&\n (operation.op !== 'move' || operation.from !== operation.path) &&\n typeof operation.path === 'string'\n )\n })\n .map((operation) => parsePath(json, operation.path))\n\n if (isEmpty(paths)) {\n return undefined\n }\n\n // TODO: make this function robust against operations which do not have consecutive paths or have wrongly ordered paths\n\n return {\n type: SelectionType.multi,\n anchorPath: first(paths) as JSONPath,\n focusPath: last(paths) as JSONPath\n }\n}\n\n/**\n * Find the common path of two paths.\n * For example findCommonRoot(['arr', '1', 'name'], ['arr', '1', 'address', 'contact']) returns ['arr', '1']\n */\n// TODO: write unit tests for findSharedPath\nexport function findSharedPath(path1: JSONPath, path2: JSONPath): JSONPath {\n let i = 0\n while (i < path1.length && i < path2.length && path1[i] === path2[i]) {\n i++\n }\n\n return path1.slice(0, i)\n}\n\nexport function singleItemSelected(selection: JSONSelection | undefined): boolean {\n return (\n isKeySelection(selection) ||\n isValueSelection(selection) ||\n isMultiSelectionWithOneItem(selection)\n )\n}\n\nexport function findRootPath(json: unknown, selection: JSONSelection): JSONPath {\n return singleItemSelected(selection) && isObjectOrArray(getIn(json, getFocusPath(selection)))\n ? getFocusPath(selection)\n : initial(getFocusPath(selection)) // the parent path of the paths\n}\n\nexport function pathStartsWith(path: JSONPath, parentPath: JSONPath): boolean {\n if (path.length < parentPath.length) {\n return false\n }\n\n for (let i = 0; i < parentPath.length; i++) {\n if (path[i] !== parentPath[i]) {\n return false\n }\n }\n\n return true\n}\n\n// TODO: write unit tests\nexport function removeEditModeFromSelection(\n selection: JSONSelection | undefined\n): JSONSelection | undefined {\n if (isEditingSelection(selection)) {\n const { type, path } = selection\n return { type, path } as KeySelection | ValueSelection\n }\n\n return selection\n}\n\nexport function createKeySelection(path: JSONPath): KeySelection {\n return { type: SelectionType.key, path }\n}\n\nexport function createEditKeySelection(path: JSONPath, initialValue?: string): EditKeySelection {\n return { type: SelectionType.key, path, edit: true, initialValue }\n}\n\nexport function createValueSelection(path: JSONPath): ValueSelection {\n return { type: SelectionType.value, path }\n}\n\nexport function createEditValueSelection(\n path: JSONPath,\n initialValue?: string\n): EditValueSelection {\n return { type: SelectionType.value, path, edit: true, initialValue }\n}\n\nexport function createInsideSelection(path: JSONPath): InsideSelection {\n return {\n type: SelectionType.inside,\n path\n }\n}\n\nexport function createAfterSelection(path: JSONPath): AfterSelection {\n return {\n type: SelectionType.after,\n path\n }\n}\n\nexport function createMultiSelection(anchorPath: JSONPath, focusPath: JSONPath): MultiSelection {\n // normalize the paths to both be a child of a shared parent\n const sharedPath = findSharedPath(anchorPath, focusPath)\n const isParent = anchorPath.length > sharedPath.length && focusPath.length > sharedPath.length\n\n return {\n type: SelectionType.multi,\n anchorPath: isParent ? sharedPath.concat(anchorPath[sharedPath.length]) : sharedPath,\n focusPath: isParent ? sharedPath.concat(focusPath[sharedPath.length]) : sharedPath\n }\n}\n\n/**\n * Turn selected contents into plain text partial JSON, usable for copying to\n * clipboard for example.\n */\nexport function selectionToPartialJson(\n json: unknown,\n selection: JSONSelection | undefined,\n indentation: number | string | undefined,\n parser: JSONParser\n): string | undefined {\n if (isKeySelection(selection)) {\n return String(last(selection.path))\n }\n\n if (isValueSelection(selection)) {\n const value = getIn(json, selection.path)\n return typeof value === 'string' ? value : parser.stringify(value, null, indentation) // TODO: customizable indentation?\n }\n\n if (isMultiSelection(selection)) {\n if (isEmpty(selection.focusPath)) {\n // root object -> does not have a parent key/index\n return parser.stringify(json, null, indentation)\n }\n\n const parentPath = getParentPath(selection)\n const parent = getIn(json, parentPath)\n if (Array.isArray(parent)) {\n if (isMultiSelectionWithOneItem(selection)) {\n // do not suffix a single selected array item with a comma\n const item = getIn(json, selection.focusPath)\n return parser.stringify(item, null, indentation)\n } else {\n return getSelectionPaths(json, selection)\n .map((path) => {\n const item = getIn(json, path)\n return `${parser.stringify(item, null, indentation)},`\n })\n .join('\\n')\n }\n } else {\n // parent is Object\n return getSelectionPaths(json, selection)\n .map((path) => {\n const key = last(path)\n const value = getIn(json, path)\n return `${parser.stringify(key)}: ${parser.stringify(value, null, indentation)},`\n })\n .join('\\n')\n }\n }\n\n return undefined\n}\n\nexport function isEditingSelection(\n selection: JSONSelection | undefined\n): selection is EditKeySelection | EditValueSelection {\n return (\n (isKeySelection(selection) || isValueSelection(selection)) &&\n (selection as Record<string, unknown>).edit === true\n )\n}\n\n/**\n * Create a selection which selects the root of the document\n */\n// TODO: write unit tests\nexport function selectAll(): JSONSelection {\n return createValueSelection([])\n}\n\n// TODO: write unit tests\nexport function hasSelectionContents(selection: JSONSelection | undefined): boolean {\n return isKeySelection(selection) || isValueSelection(selection) || isMultiSelection(selection)\n}\n\n/**\n * Test whether the current selection can be converted.\n * That is the case when the selection is a key/value, or a multi selection with only one path\n */\nexport function canConvert(selection: JSONSelection | undefined): boolean {\n return (\n isKeySelection(selection) ||\n isValueSelection(selection) ||\n isMultiSelectionWithOneItem(selection)\n )\n}\n\n// TODO: unit test\n// eslint-disable-next-line consistent-return\nexport function fromCaretPosition(caretPosition: CaretPosition): JSONSelection {\n switch (caretPosition.type) {\n case CaretType.key:\n return createKeySelection(caretPosition.path)\n case CaretType.value:\n return createValueSelection(caretPosition.path)\n case CaretType.after:\n return createAfterSelection(caretPosition.path)\n case CaretType.inside:\n return createInsideSelection(caretPosition.path)\n }\n}\n\n// TODO: unit test\n// eslint-disable-next-line consistent-return\nexport function fromSelectionType(selectionType: SelectionType, path: JSONPath): JSONSelection {\n switch (selectionType) {\n case SelectionType.key:\n return createKeySelection(path)\n case SelectionType.value:\n return createValueSelection(path)\n case SelectionType.after:\n return createAfterSelection(path)\n case SelectionType.inside:\n return createInsideSelection(path)\n case SelectionType.multi:\n case SelectionType.text: // type `text` is not applicable, but we need to handle all types\n return createMultiSelection(path, path)\n }\n}\n\nexport function selectionIfOverlapping(\n json: unknown | undefined,\n selection: JSONSelection | undefined,\n path: JSONPath\n): JSONSelection | undefined {\n if (!selection) {\n return undefined\n }\n\n if (pathInSelection(json, selection, path)) {\n return selection\n }\n\n const sharedPath = isMultiSelection(selection) ? initial(selection.focusPath) : selection.path\n if (pathStartsWith(sharedPath, path)) {\n return selection\n }\n\n return undefined\n}\n\nexport function pathInSelection(\n json: unknown | undefined,\n selection: JSONSelection | undefined,\n path: JSONPath\n): boolean {\n if (json === undefined || !selection) {\n return false\n }\n\n if (isKeySelection(selection) || isInsideSelection(selection) || isAfterSelection(selection)) {\n return isEqual(selection.path, path)\n }\n\n if (isValueSelection(selection)) {\n return pathStartsWith(path, selection.path)\n }\n\n if (isMultiSelection(selection)) {\n const startPath = getStartPath(json, selection)\n const endPath = getEndPath(json, selection)\n const parentPath = initial(selection.focusPath)\n\n if (!pathStartsWith(path, parentPath) || path.length <= parentPath.length) {\n return false\n }\n\n const startIndex = getChildIndex(json, selection, startPath)\n const endIndex = getChildIndex(json, selection, endPath)\n const pathIndex = getChildIndex(json, selection, path)\n return pathIndex !== -1 && pathIndex >= startIndex && pathIndex <= endIndex\n }\n\n return false\n}\n\nfunction getChildIndex(json: unknown, selection: MultiSelection, path: JSONPath): number {\n const parentPath = initial(selection.focusPath)\n if (!pathStartsWith(path, parentPath) || path.length <= parentPath.length) {\n return -1\n }\n\n const key = path[parentPath.length]\n const parent = getIn(json, parentPath)\n\n if (isJSONObject(parent)) {\n const keys = Object.keys(parent)\n return keys.indexOf(key)\n }\n\n if (isJSONArray(parent)) {\n const index = int(key)\n if (index < parent.length) {\n return index\n }\n }\n\n return -1\n}\n\n// TODO: write some unit tests\nexport function getFocusPath(selection: JSONSelection): JSONPath {\n return isMultiSelection(selection) ? selection.focusPath : selection.path\n}\n\n// TODO: write some unit tests\nexport function getAnchorPath(selection: JSONSelection): JSONPath {\n return isMultiSelection(selection) ? selection.anchorPath : selection.path\n}\n","/**\n * A simplified version of https://github.com/JedWatson/classnames\n *\n * Example usage:\n *\n * classnames('primary-button', { selected: true }, 'left')\n *\n */\nexport function classnames(...args: Array<string | Record<string, boolean> | undefined>): string {\n const classes = []\n\n for (const arg of args) {\n if (typeof arg === 'string') {\n classes.push(arg)\n }\n\n if (arg && typeof arg === 'object') {\n for (const key in arg) {\n if (Object.hasOwnProperty.call(arg, key) && arg[key]) {\n classes.push(key)\n }\n }\n }\n }\n\n return classes.join(' ')\n}\n","import { isUrl, valueType } from '$lib/utils/typeUtils.js'\nimport { type JSONParser, Mode } from '$lib/types.js'\nimport { classnames } from '$lib/utils/cssUtils.js'\n\nexport function getValueClass(value: unknown, mode: Mode, parser: JSONParser): string {\n const type = valueType(value, parser)\n\n return classnames('jse-value', 'jse-' + type, {\n 'jse-url': isUrl(value),\n 'jse-empty': typeof value === 'string' && value.length === 0,\n 'jse-table-cell': mode === Mode.table\n })\n}\n","<svelte:options immutable={true} />\n\n<script lang=\"ts\">\n import { onDestroy, onMount } from 'svelte'\n import { addNewLineSuffix, removeNewLineSuffix, setCursorToEnd } from '$lib/utils/domUtils.js'\n import { keyComboFromEvent } from '$lib/utils/keyBindings.js'\n import { createDebug } from '$lib/utils/debug.js'\n import { noop } from 'lodash-es'\n import type { OnFind, OnPaste } from '$lib/types'\n import { UpdateSelectionAfterChange } from '$lib/types'\n import { classnames } from '$lib/utils/cssUtils.js'\n\n const debug = createDebug('jsoneditor:EditableDiv')\n\n export let value: string\n export let initialValue: string | undefined\n export let shortText = false\n export let label: string\n export let onChange: (newValue: string, updateSelection: UpdateSelectionAfterChange) => void\n export let onCancel: () => void\n export let onFind: OnFind\n export let onPaste: OnPaste = noop\n export let onValueClass: (value: string) => string = () => ''\n\n let domValue: HTMLDivElement | undefined\n let valueClass: string\n $: valueClass = onValueClass(value)\n let closed = false\n\n onMount(() => {\n debug('onMount', { value, initialValue })\n setDomValue(initialValue !== undefined ? initialValue : value)\n\n // focus\n if (domValue) {\n setCursorToEnd(domValue)\n }\n })\n\n onDestroy(() => {\n const newValue = getDomValue()\n\n debug('onDestroy', { closed, value, newValue })\n\n if (!closed && newValue !== value) {\n onChange(newValue, UpdateSelectionAfterChange.no)\n }\n })\n\n function getDomValue(): string {\n if (!domValue) {\n return ''\n }\n return removeNewLineSuffix(domValue.innerText)\n }\n\n function setDomValue(updatedValue: string) {\n if (!domValue) {\n return\n }\n domValue.innerText = addNewLineSuffix(updatedValue)\n }\n\n function handleValueInput() {\n const newValue = getDomValue()\n\n if (newValue === '') {\n // immediately update to clean up any left over <br/>\n setDomValue('')\n }\n\n // update class\n valueClass = onValueClass(newValue)\n }\n\n function handleCancel() {\n // cancel changes (needed to prevent triggering a change onDestroy)\n closed = true\n\n onCancel()\n }\n\n function handleValueKeyDown(event: KeyboardEvent) {\n event.stopPropagation()\n\n const combo = keyComboFromEvent(event)\n\n if (combo === 'Escape') {\n event.preventDefault()\n\n handleCancel()\n }\n\n if (combo === 'Enter' || combo === 'Tab') {\n // apply changes\n event.preventDefault()\n\n closed = true\n\n const newValue = getDomValue()\n onChange(newValue, UpdateSelectionAfterChange.nextInside)\n }\n\n if (combo === 'Ctrl+F') {\n event.preventDefault()\n onFind(false)\n }\n\n if (combo === 'Ctrl+H') {\n event.preventDefault()\n onFind(true)\n }\n }\n\n function handleValuePaste(event: ClipboardEvent) {\n event.stopPropagation()\n\n if (!onPaste || !event.clipboardData) {\n return\n }\n\n const clipboardText = event.clipboardData.getData('text/plain')\n onPaste(clipboardText)\n }\n\n function handleBlur() {\n const hasFocus = document.hasFocus()\n const newValue = getDomValue()\n\n debug('handleBlur', { hasFocus, closed, value, newValue })\n\n // we only want to close the editable div when the focus did go to another\n // element on the same page, but not when the user switches to another\n // application or browser tab to copy/paste something whilst still editing\n // the value, hence the check for document.hasFocus()\n if (document.hasFocus() && !closed) {\n closed = true\n if (newValue !== value) {\n onChange(newValue, UpdateSelectionAfterChange.self)\n } else {\n // Note that we do not fire an onCancel here: a blur action\n // is caused by the user clicking somewhere else. If we apply\n // onCancel now, we would override the selection that the user\n // wants by clicking somewhere else in the editor (since `blur`\n // is occurring *after* `mousedown`).\n }\n }\n }\n</script>\n\n<div\n role=\"textbox\"\n aria-label={label}\n tabindex=\"0\"\n class={classnames('jse-editable-div', valueClass, { 'jse-short-text': shortText })}\n contenteditable=\"true\"\n spellcheck=\"false\"\n on:input={handleValueInput}\n on:keydown={handleValueKeyDown}\n on:paste={handleValuePaste}\n on:blur={handleBlur}\n bind:this={domValue}\n></div>\n\n<style src=\"./EditableDiv.scss\"></style>\n","<svelte:options immutable={true} />\n\n<script lang=\"ts\">\n import type { JSONPatchDocument, JSONPath } from 'immutable-json-patch'\n import { compileJSONPointer } from 'immutable-json-patch'\n import { isObjectOrArray, stringConvert } from '$lib/utils/typeUtils.js'\n import { createValueSelection, getFocusPath, isEditingSelection } from '$lib/logic/selection.js'\n import { getValueClass } from '$lib/plugins/value/components/utils/getValueClass.js'\n import EditableDiv from '../../../components/controls/EditableDiv.svelte'\n import {\n type FindNextInside,\n type JSONParser,\n type JSONSelection,\n Mode,\n type OnFind,\n type OnJSONSelect,\n type OnPasteJson,\n type OnPatch,\n UpdateSelectionAfterChange,\n type ValueNormalization\n } from '$lib/types.js'\n import { isEqual } from 'lodash-es'\n import { expandSmart } from '$lib/logic/documentState'\n\n export let path: JSONPath\n export let value: unknown\n export let selection: JSONSelection | undefined\n export let mode: Mode\n export let parser: JSONParser\n export let normalization: ValueNormalization\n export let enforceString: boolean\n export let onPatch: OnPatch\n export let onPasteJson: OnPasteJson\n export let onSelect: OnJSONSelect\n export let onFind: OnFind\n export let focus: () => void\n export let findNextInside: FindNextInside\n\n function convert(value: string): unknown {\n return enforceString ? value : stringConvert(value, parser)\n }\n\n function handleChangeValue(newValue: string, updateSelection: UpdateSelectionAfterChange) {\n onPatch(\n [\n {\n op: 'replace',\n path: compileJSONPointer(path),\n value: convert(normalization.unescapeValue(newValue))\n }\n ],\n (_, patchedState, patchedSelection) => {\n // Leave the selection as is when it is no longer the path that we were editing here\n // This happens for example when the user clicks or double-clicks on another value\n // whilst editing a value\n if (patchedSelection && !isEqual(path, getFocusPath(patchedSelection))) {\n return undefined\n }\n\n const selection =\n updateSelection === UpdateSelectionAfterChange.nextInside\n ? findNextInside(path)\n : createValueSelection(path)\n\n return {\n state: patchedState,\n selection\n }\n }\n )\n\n focus()\n }\n\n function handleCancelChange() {\n onSelect(createValueSelection(path))\n focus()\n }\n\n function handlePaste(pastedText: string): void {\n try {\n const pastedJson = parser.parse(pastedText)\n if (isObjectOrArray(pastedJson)) {\n onPasteJson({\n path,\n contents: pastedJson,\n onPasteAsJson: () => {\n // exit edit mode\n handleCancelChange()\n\n // replace the value with the JSON object/array\n const operations: JSONPatchDocument = [\n {\n op: 'replace',\n path: compileJSONPointer(path),\n value: pastedJson\n }\n ]\n\n onPatch(operations, (patchedJson, patchedState) => ({\n state: expandSmart(patchedJson, patchedState, path)\n }))\n }\n })\n }\n } catch {\n // silently ignore: thee pasted text is no valid JSON object or array,\n // no need to do anything\n }\n }\n\n function handleOnValueClass(value: string): string {\n return getValueClass(convert(normalization.unescapeValue(value)), mode, parser)\n }\n</script>\n\n<EditableDiv\n value={normalization.escapeValue(value)}\n initialValue={isEditingSelection(selection) ? selection.initialValue : undefined}\n label=\"编辑值\"\n onChange={handleChangeValue}\n onCancel={handleCancelChange}\n onPaste={handlePaste}\n {onFind}\n onValueClass={handleOnValueClass}\n/>\n","import { cloneDeepWith, first, initial, isEmpty, isEqual, last, times } from 'lodash-es'\nimport {\n compileJSONPointer,\n existsIn,\n getIn,\n isJSONArray,\n isJSONObject,\n isJSONPatchMove,\n isJSONPatchRemove,\n isJSONPatchReplace,\n type JSONPatchAdd,\n type JSONPatchCopy,\n type JSONPatchDocument,\n type JSONPatchMove,\n type JSONPatchOperation,\n type JSONPath,\n parseJSONPointer,\n revertJSONPatch\n} from 'immutable-json-patch'\nimport { parseAndRepair, parseAndRepairOrUndefined, parsePartialJson } from '../utils/jsonUtils.js'\nimport { findUniqueName } from '../utils/stringUtils.js'\nimport { isObject, isObjectOrArray } from '../utils/typeUtils.js'\nimport { getNextKeys } from './documentState.js'\nimport {\n createAfterSelection,\n createInsideSelection,\n createSelectionFromOperations,\n createValueSelection,\n getEndPath,\n getFocusPath,\n getParentPath,\n getSelectionPaths,\n getStartPath,\n isAfterSelection,\n isInsideSelection,\n isKeySelection,\n isMultiSelection,\n isValueSelection,\n pathStartsWith\n} from './selection.js'\nimport type { ClipboardValues, DragInsideAction, JSONParser, JSONSelection } from '$lib/types'\nimport { int } from '../utils/numberUtils.js'\n\n/**\n * Create a JSONPatch for an insert operation.\n *\n * This function needs the current data in order to be able to determine\n * a unique property name for the inserted node in case of duplicating\n * and object property\n */\n// TODO: write tests\nexport function insertBefore(\n json: unknown,\n path: JSONPath,\n values: ClipboardValues\n): JSONPatchDocument {\n const parentPath = initial(path)\n const parent = getIn(json, parentPath)\n\n if (isJSONArray(parent)) {\n // the path is parsed from a JSONPatch operation,\n // so array indices are a string which we have to parse into a number\n const offset = int(last(path) as string)\n return values.map((entry, index) => ({\n op: 'add',\n path: compileJSONPointer(parentPath.concat(String(offset + index))),\n value: entry.value\n }))\n } else if (isJSONObject(parent)) {\n // 'object'\n const afterKey = last(path)\n const keys = Object.keys(parent)\n const nextKeys = afterKey !== undefined ? getNextKeys(keys, afterKey, true) : []\n\n return [\n // insert new values\n ...values.map((entry) => {\n const newProp = findUniqueName(entry.key, keys)\n return {\n op: 'add',\n path: compileJSONPointer(parentPath.concat(newProp)),\n value: entry.value\n } as JSONPatchAdd\n }),\n\n // move all lower down keys so the inserted key will maintain its position\n ...nextKeys.map((key) => moveDown(parentPath, key))\n ]\n } else {\n throw new Error('Cannot create insert operations: parent must be an Object or Array')\n }\n}\n\n/**\n * Create a JSONPatch for an append operation. The values will be appended\n * to the end of the array or object.\n *\n * This function needs the current data in order to be able to determine\n * a unique property name for the inserted node in case of duplicating\n * and object property\n */\nexport function append(json: unknown, path: JSONPath, values: ClipboardValues): JSONPatchDocument {\n const parent = getIn(json, path)\n\n if (Array.isArray(parent)) {\n const offset = parent.length\n return values.map((entry, index) => ({\n op: 'add',\n path: compileJSONPointer(path.concat(String(offset + index))),\n value: entry.value\n }))\n } else {\n // 'object'\n return values.map((entry) => {\n const newProp = findUniqueName(entry.key, Object.keys(parent as Record<string, unknown>))\n return {\n op: 'add',\n path: compileJSONPointer(path.concat(newProp)),\n value: entry.value\n }\n })\n }\n}\n\n/**\n * Rename an object key\n * Not applicable to arrays\n */\nexport function rename(\n parentPath: JSONPath,\n keys: string[],\n oldKey: string,\n newKey: string\n): JSONPatchDocument {\n const filteredKeys = keys.filter((key) => key !== oldKey)\n const newKeyUnique = findUniqueName(newKey, filteredKeys)\n const nextKeys = getNextKeys(keys, oldKey, false)\n\n return [\n // rename a key\n {\n op: 'move',\n from: compileJSONPointer(parentPath.concat(oldKey)),\n path: compileJSONPointer(parentPath.concat(newKeyUnique))\n },\n\n // move all lower down keys so the renamed key will maintain it's position\n ...nextKeys.map((key) => moveDown(parentPath, key))\n ]\n}\n\n/**\n * Create a JSONPatch for an insert operation.\n *\n * This function needs the current data in order to be able to determine\n * a unique property name for the inserted node in case of duplicating\n * and object property\n */\nexport function replace(\n json: unknown,\n paths: JSONPath[],\n values: ClipboardValues\n): JSONPatchDocument {\n const firstPath = first(paths)\n const parentPath = initial(firstPath)\n const parent = getIn(json, parentPath)\n\n if (isJSONArray(parent)) {\n const firstPath = first(paths)\n const offset = firstPath ? int(last(firstPath) as string) : 0\n\n return [\n // remove operations\n ...removeAll(paths),\n\n // insert operations\n ...values.map((entry, index) => {\n const operation: JSONPatchOperation = {\n op: 'add',\n path: compileJSONPointer(parentPath.concat(String(index + offset))),\n value: entry.value\n }\n\n return operation\n })\n ]\n } else if (isJSONObject(parent)) {\n // parent is Object\n // if we're going to replace an existing object with key \"a\" with a new\n // key \"a\", we must not create a new unique name \"a (copy)\".\n const lastPath = last(paths)\n const parentPath = initial(lastPath)\n const beforeKey = last(lastPath)\n const keys: string[] = Object.keys(parent)\n const nextKeys = beforeKey !== undefined ? getNextKeys(keys, beforeKey, false) : []\n const removeKeys = new Set(paths.map((path) => last(path)))\n const filteredKeys = keys.filter((key) => !removeKeys.has(key))\n\n return [\n // remove operations\n ...removeAll(paths),\n\n // insert operations\n ...values.map((entry) => {\n const newProp = findUniqueName(entry.key, filteredKeys)\n return {\n op: 'add',\n path: compileJSONPointer(parentPath.concat(newProp)),\n value: entry.value\n } as JSONPatchAdd\n }),\n\n // move down operations\n // move all lower down keys so the renamed key will maintain its position\n ...nextKeys.map((key) => moveDown(parentPath, key))\n ]\n } else {\n throw new Error('Cannot create replace operations: parent must be an Object or Array')\n }\n}\n\n/**\n * Create a JSONPatch for a duplicate action.\n *\n * This function needs the current data in order to be able to determine\n * a unique property name for the duplicated node in case of duplicating\n * and object property\n */\nexport function duplicate(json: unknown, paths: JSONPath[]): JSONPatchDocument {\n // FIXME: here we assume paths is sorted correctly, that's a dangerous assumption\n const lastPath = last(paths)\n\n if (isEmpty(lastPath)) {\n throw new Error('Cannot duplicate root object')\n }\n\n const parentPath = initial(lastPath)\n const beforeKey = last(lastPath)\n const parent = getIn(json, parentPath)\n\n if (isJSONArray(parent)) {\n const lastPath = last(paths)\n const offset = lastPath ? int(last(lastPath) as string) + 1 : 0\n\n return [\n // copy operations\n ...paths.map((path, index) => {\n const operation: JSONPatchOperation = {\n op: 'copy',\n from: compileJSONPointer(path),\n path: compileJSONPointer(parentPath.concat(String(index + offset)))\n }\n\n return operation\n })\n ]\n } else if (isJSONObject(parent)) {\n // 'object'\n const keys = Object.keys(parent)\n const nextKeys = beforeKey !== undefined ? getNextKeys(keys, beforeKey, false) : []\n\n return [\n // copy operations\n ...paths.map((path) => {\n const prop = last(path) as string\n const newProp = findUniqueName(prop, keys)\n\n return {\n op: 'copy',\n from: compileJSONPointer(path),\n path: compileJSONPointer(parentPath.concat(newProp))\n } as JSONPatchCopy\n }),\n\n // move down operations\n // move all lower down keys so the renamed key will maintain it's position\n ...nextKeys.map((key) => moveDown(parentPath, key))\n ]\n } else {\n throw new Error('Cannot create duplicate operations: parent must be an Object or Array')\n }\n}\n\n/**\n * Create a JSONPatch for an extract action.\n */\n// TODO: write unit tests\nexport function extract(json: unknown, selection: JSONSelection): JSONPatchDocument {\n if (isValueSelection(selection)) {\n return [\n {\n op: 'move',\n from: compileJSONPointer(selection.path),\n path: ''\n }\n ]\n }\n\n if (isMultiSelection(selection)) {\n const parentPath = initial(selection.focusPath)\n const parent = getIn(json, parentPath)\n\n if (isJSONArray(parent)) {\n const value = getSelectionPaths(json, selection).map((path) => {\n const index = int(last(path) as string)\n return parent[index]\n })\n\n return [\n {\n op: 'replace',\n path: '',\n value\n }\n ]\n } else if (isJSONObject(parent)) {\n // object\n const value: Record<string, unknown> = {}\n getSelectionPaths(json, selection).forEach((path) => {\n const key = String(last(path))\n value[key] = parent[key]\n })\n\n return [\n {\n op: 'replace',\n path: '',\n value\n }\n ]\n }\n } else {\n throw new Error('Cannot create extract operations: parent must be an Object or Array')\n }\n\n // this should never happen\n throw new Error('Cannot extract: unsupported type of selection ' + JSON.stringify(selection))\n}\n\n// TODO: write unit tests\nexport function insert(\n json: unknown,\n selection: JSONSelection | undefined,\n clipboardText: string,\n parser: JSONParser\n): JSONPatchDocument {\n if (isKeySelection(selection)) {\n // rename key\n const clipboard = parseAndRepairOrUndefined(clipboardText, parser)\n const parentPath = initial(selection.path)\n const parent = getIn(json, parentPath)\n const keys = Object.keys(parent as Record<string, unknown>)\n const oldKey = last(selection.path) as string\n const newKey = typeof clipboard === 'string' ? clipboard : clipboardText\n\n return rename(parentPath, keys, oldKey, newKey)\n }\n\n if (\n isValueSelection(selection) ||\n (isMultiSelection(selection) && isEmpty(selection.focusPath)) // root selected\n ) {\n // replace selected value (new value can be primitive or an array/object with contents)\n try {\n return [\n {\n op: 'replace',\n path: compileJSONPointer(getFocusPath(selection)),\n value: parsePartialJson(clipboardText, (text) => parseAndRepair(text, parser))\n }\n ]\n } catch {\n // parsing failed -> just paste the raw text as value\n return [\n {\n op: 'replace',\n path: compileJSONPointer(getFocusPath(selection)),\n value: clipboardText\n }\n ]\n }\n }\n\n if (isMultiSelection(selection)) {\n const newValues = clipboardToValues(clipboardText, parser)\n\n return replace(json, getSelectionPaths(json, selection), newValues)\n }\n\n if (isAfterSelection(selection)) {\n const newValues = clipboardToValues(clipboardText, parser)\n const path = selection.path\n const parentPath = initial(path)\n const parent = getIn(json, parentPath)\n\n if (isJSONArray(parent)) {\n const index = int(last(path) as string)\n const nextItemPath = parentPath.concat(String(index + 1))\n\n return insertBefore(json, nextItemPath, newValues)\n } else if (isJSONObject(parent)) {\n // value is an Object\n const key = String(last(path))\n const keys: string[] = Object.keys(parent)\n if (isEmpty(keys) || last(keys) === key) {\n return append(json, parentPath, newValues)\n } else {\n const index = keys.indexOf(key)\n const nextKey = keys[index + 1]\n const nextKeyPath = parentPath.concat(nextKey)\n\n return insertBefore(json, nextKeyPath, newValues)\n }\n } else {\n throw new Error('Cannot create insert operations: parent must be an Object or Array')\n }\n }\n\n if (isInsideSelection(selection)) {\n const newValues = clipboardToValues(clipboardText, parser)\n const path = selection.path\n const value = getIn(json, path)\n\n if (isJSONArray(value)) {\n const firstItemPath = path.concat('0')\n return insertBefore(json, firstItemPath, newValues)\n } else if (isJSONObject(value)) {\n // value is an Object\n const keys = Object.keys(value)\n if (isEmpty(keys)) {\n return append(json, path, newValues)\n } else {\n const firstKey = first(keys) as string\n const firstKeyPath = path.concat(firstKey)\n\n return insertBefore(json, firstKeyPath, newValues)\n }\n } else {\n throw new Error('Cannot create insert operations: parent must be an Object or Array')\n }\n }\n\n // this should never happen\n throw new Error('Cannot insert: unsupported type of selection ' + JSON.stringify(selection))\n}\n\nexport function moveInsideParent(\n json: unknown,\n selection: JSONSelection | undefined,\n dragInsideAction: DragInsideAction\n): JSONPatchDocument {\n if (!selection) {\n return []\n }\n\n const beforePath = 'beforePath' in dragInsideAction ? dragInsideAction['beforePath'] : undefined\n const append = 'append' in dragInsideAction ? dragInsideAction['append'] : undefined\n\n const parentPath = initial(getFocusPath(selection))\n const parent = getIn(json, parentPath)\n\n if (\n !append &&\n !(beforePath && pathStartsWith(beforePath, parentPath) && beforePath.length > parentPath.length)\n ) {\n return []\n }\n\n const startPath = getStartPath(json, selection)\n const endPath = getEndPath(json, selection)\n const startKey = last(startPath) as string\n const endKey = last(endPath) as string\n const toKey: string | undefined = beforePath ? beforePath[parentPath.length] : undefined\n\n if (isJSONObject(parent)) {\n const keys = Object.keys(parent)\n const startIndex = keys.indexOf(startKey)\n const endIndex = keys.indexOf(endKey)\n const toIndex = append ? keys.length : toKey !== undefined ? keys.indexOf(toKey) : -1\n\n if (startIndex !== -1 && endIndex !== -1 && toIndex !== -1) {\n if (toIndex > startIndex) {\n // moving down\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n return [...keys.slice(startIndex, endIndex + 1), ...keys.slice(toIndex, keys.length)].map(\n (key) => moveDown(parentPath, key)\n )\n } else {\n // moving up\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n return [...keys.slice(toIndex, startIndex), ...keys.slice(endIndex + 1, keys.length)].map(\n (key) => moveDown(parentPath, key)\n )\n }\n }\n } else if (isJSONArray(parent)) {\n // array\n const startIndex = int(startKey)\n const endIndex = int(endKey)\n const toIndex = toKey !== undefined ? int(toKey) : parent.length\n const count = endIndex - startIndex + 1\n\n if (toIndex < startIndex) {\n // move up\n return times(count, (offset) => {\n return {\n op: 'move',\n from: compileJSONPointer(parentPath.concat(String(startIndex + offset))),\n path: compileJSONPointer(parentPath.concat(String(toIndex + offset)))\n }\n })\n } else {\n // move down\n return times(count, () => {\n return {\n op: 'move',\n from: compileJSONPointer(parentPath.concat(String(startIndex))),\n path: compileJSONPointer(parentPath.concat(String(toIndex)))\n }\n })\n }\n } else {\n throw new Error('Cannot create move operations: parent must be an Object or Array')\n }\n\n return []\n}\n\nexport function createNewValue(\n json: unknown | undefined,\n selection: JSONSelection | undefined,\n valueType: 'object' | 'array' | 'structure' | 'value'\n): unknown {\n if (valueType === 'object') {\n return {}\n }\n\n if (valueType === 'array') {\n return []\n }\n\n if (valueType === 'structure' && json !== undefined) {\n const parentPath = selection ? getParentPath(selection) : []\n const parent = getIn(json, parentPath)\n\n if (Array.isArray(parent) && !isEmpty(parent)) {\n const jsonExample = first(parent)\n if (isObjectOrArray(jsonExample)) {\n return cloneDeepWith(jsonExample, (value) => {\n return Array.isArray(value)\n ? []\n : isObject(value)\n ? undefined // leave object as is, will recurse into it\n : ''\n })\n } else {\n // just a primitive value\n return ''\n }\n }\n }\n\n // type === value,\n // or type === structure but the parent is no array or an array containing\n // primitive values (and no objects having any structure).\n return ''\n}\n\n/**\n * Create a JSONPatch for a remove operation\n */\nexport function remove(path: JSONPath): JSONPatchDocument {\n return [\n {\n op: 'remove',\n path: compileJSONPointer(path)\n }\n ]\n}\n\n/**\n * Create a JSONPatch for a multiple remove operation\n */\nexport function removeAll(paths: JSONPath[]): JSONPatchDocument {\n return paths\n .map((path) => {\n const operation: JSONPatchOperation = {\n op: 'remove',\n path: compileJSONPointer(path)\n }\n\n return operation\n })\n .reverse() // reverse is needed for arrays: delete the last index first\n}\n\n// helper function to move a key down in an object,\n// so another key can get positioned before the moved down keys\nfunction moveDown(parentPath: JSONPath, key: string): JSONPatchOperation {\n return {\n op: 'move',\n from: compileJSONPointer(parentPath.concat(key)),\n path: compileJSONPointer(parentPath.concat(key))\n }\n}\n\nexport function clipboardToValues(clipboardText: string, parser: JSONParser): ClipboardValues {\n const textIsObject = /^\\s*{/.test(clipboardText)\n const textIsArray = /^\\s*\\[/.test(clipboardText)\n\n const clipboardOriginal = parseAndRepairOrUndefined(clipboardText, parser)\n const clipboardRepaired =\n clipboardOriginal !== undefined\n ? clipboardOriginal\n : parsePartialJson(clipboardText, (text) => parseAndRepair(text, parser))\n\n if (\n (textIsObject && isObject(clipboardRepaired)) ||\n (textIsArray && Array.isArray(clipboardRepaired))\n ) {\n return [{ key: 'New item', value: clipboardRepaired }]\n }\n\n if (Array.isArray(clipboardRepaired)) {\n return clipboardRepaired.map((value, index) => {\n return { key: 'New item ' + index, value }\n })\n }\n\n if (isObject(clipboardRepaired)) {\n return Object.keys(clipboardRepaired).map((key) => {\n return { key, value: clipboardRepaired[key] }\n })\n }\n\n // regular value\n return [{ key: 'New item', value: clipboardRepaired }]\n}\n\n// TODO: write unit tests\nexport function createRemoveOperations(\n json: unknown,\n selection: JSONSelection\n): { newSelection: JSONSelection | undefined; operations: JSONPatchDocument } {\n if (isKeySelection(selection)) {\n // FIXME: DOESN'T work yet\n const parentPath = initial(selection.path)\n const parent = getIn(json, parentPath)\n const keys = Object.keys(parent as Record<string, unknown>)\n const oldKey = last(selection.path) as string\n const newKey = ''\n\n const operations = rename(parentPath, keys, oldKey, newKey)\n const newSelection = createSelectionFromOperations(json, operations)\n\n return { operations, newSelection }\n }\n\n if (isValueSelection(selection)) {\n const operations: JSONPatchDocument = [\n {\n op: 'replace',\n path: compileJSONPointer(selection.path),\n value: ''\n }\n ]\n\n return { operations, newSelection: selection }\n }\n\n if (isMultiSelection(selection)) {\n const paths = getSelectionPaths(json, selection)\n const operations = removeAll(paths)\n const lastPath = last(paths)\n\n if (isEmpty(lastPath)) {\n // there is no parent, this is the root document\n const operations: JSONPatchDocument = [{ op: 'replace', path: '', value: '' }]\n\n const newSelection = createValueSelection([])\n\n return { operations, newSelection }\n }\n\n const parentPath = initial(lastPath)\n const parent = getIn(json, parentPath)\n\n if (isJSONArray(parent)) {\n const firstPath = first(paths)\n const index = int(last(firstPath) as string)\n const newSelection =\n index === 0\n ? createInsideSelection(parentPath)\n : createAfterSelection(parentPath.concat(String(index - 1)))\n\n return { operations, newSelection }\n } else if (isJSONObject(parent)) {\n // parent is object\n const keys = Object.keys(parent)\n const firstPath = first(paths)\n const key = last(firstPath) as string\n const index = keys.indexOf(key)\n const previousKey = keys[index - 1]\n const newSelection =\n index === 0\n ? createInsideSelection(parentPath)\n : createAfterSelection(parentPath.concat(previousKey))\n\n return { operations, newSelection }\n } else {\n throw new Error('Cannot create remove operations: parent must be an Object or Array')\n }\n }\n\n // this should never happen\n throw new Error('Cannot remove: unsupported type of selection ' + JSON.stringify(selection))\n}\n\nexport function revertJSONPatchWithMoveOperations(\n json: unknown,\n operations: JSONPatchDocument\n): JSONPatchDocument {\n // first, we merge series of move operations inside an object. These move operations are used\n // to ensure a specific ordering of the keys in the object. Reverting those move events one by\n // one would explode the amount of move operations in the revert operations and contain mostly\n // duplicates.\n const filteredOperations = _filterRedundantMoveOperations(json, operations)\n\n return revertJSONPatch(json, filteredOperations, {\n before: (json, operation, revertOperations) => {\n if (isJSONPatchRemove(operation)) {\n // we must restore the key order when reverting removing of an object key\n const path = parseJSONPointer(operation.path)\n return {\n revertOperations: [...revertOperations, ...createRevertMoveOperations(json, path)]\n }\n }\n\n if (isJSONPatchMove(operation)) {\n const from = parseJSONPointer(operation.from)\n return {\n revertOperations:\n operation.from === operation.path\n ? [operation, ...createRevertMoveOperations(json, from)] // move in-place (just for re-ordering object keys)\n : [...revertOperations, ...createRevertMoveOperations(json, from)]\n }\n }\n\n return { document: json }\n }\n })\n}\n\n/**\n * Filter move operations which are redundant when creating the reverse patch operations.\n *\n * This is a preprocessing step for creating the revert patch operations. For example, having\n * json {b:2, a:1, c:3} and the following move operations (this will reorder the keys):\n *\n * [\n * { op: 'move', from: '/a', path: '/a' },\n * { op: 'move', from: '/b', path: '/b' },\n * { op: 'move', from: '/c', path: '/c' }\n * ]\n *\n * This function will return only moving of b, since that is the first of all the moved keys:\n *\n * [\n * { op: 'move', from: '/b', path: '/b' }\n * ]\n *\n * So, when creating the reverse operations, this single operation is enough to create the needed\n * move operations for all lower down keys to restore the original order of the keys.\n */\nfunction _filterRedundantMoveOperations(\n json: unknown,\n operations: JSONPatchOperation[]\n): JSONPatchOperation[] {\n // check whether this is a set of move operations (cheap check)\n if (isEmpty(operations) || !operations.every(isJSONPatchMove)) {\n return operations\n }\n\n // parse the JSON pointers once and split them in parent paths and keys\n const processedOps: ProcessedOperation[] = []\n for (const operation of operations) {\n const from = splitParentKey(parseJSONPointer(operation.from))\n const path = splitParentKey(parseJSONPointer(operation.path))\n if (!from || !path) {\n return operations\n }\n processedOps.push({ from, path, operation })\n }\n\n // check whether the first movement is inside an object (and not an array)\n const parentPath = processedOps[0].path.parent\n const parent = getIn(json, parentPath)\n if (!isJSONObject(parent)) {\n return operations\n }\n\n // check whether all movements are within the same parent object\n if (!processedOps.every((op) => _equalParentPath(op, parentPath))) {\n return operations\n }\n\n const firstKey = _findKeyWithLowestKeyIndex(processedOps, json)\n const getOperation = (op: ProcessedOperation) => op.operation\n\n // only return the operation moving the firstKey back, and all rename operations\n const renameOps = processedOps.filter((op) => op.operation.from !== op.operation.path)\n return renameOps.some((op) => op.path.key === firstKey)\n ? renameOps.map(getOperation) // no need to add the firstKey move operation\n : [moveDown(parentPath, firstKey), ...renameOps.map(getOperation)]\n}\n\ninterface ParentKey {\n parent: string[]\n key: string\n}\n\ninterface ProcessedOperation {\n from: ParentKey\n path: ParentKey\n operation: JSONPatchMove\n}\n\nfunction splitParentKey(path: JSONPath): ParentKey | undefined {\n return path.length > 0 ? { parent: initial(path), key: last(path) as string } : undefined\n}\n\n/**\n * Test whether a move operation has a specific parent path for both `from` and `path`\n */\nfunction _equalParentPath(\n operation: ProcessedOperation,\n parentPath: JSONPath | undefined\n): boolean {\n return isEqual(operation.from.parent, parentPath) && isEqual(operation.path.parent, parentPath)\n}\n\nfunction _findKeyWithLowestKeyIndex(processedOps: ProcessedOperation[], json: unknown): string {\n const keys = Object.keys(json as Record<string, unknown>)\n const movedKeys = keys.slice()\n\n // first execute all move operations on the list with keys\n // here we assume all move operations have the same parent and are keys in an object\n for (const op of processedOps) {\n const index = movedKeys.indexOf(op.from.key)\n if (index !== -1) {\n movedKeys.splice(index, 1)\n movedKeys.push(op.path.key)\n }\n }\n\n // find the first changed key\n let i = 0\n while (i < keys.length && keys[i] === movedKeys[i]) {\n i++\n }\n\n return movedKeys[i]\n}\n\nfunction createRevertMoveOperations(json: unknown, path: JSONPath): JSONPatchOperation[] {\n const parentPath = initial(path)\n const afterKey = last(path) as string\n const parent = getIn(json, parentPath)\n if (isJSONObject(parent)) {\n const keys = Object.keys(parent)\n const nextKeys = getNextKeys(keys, afterKey, false)\n\n // move all lower down keys so the inserted key will maintain its position\n return nextKeys.map((key) => moveDown(parentPath, key))\n }\n\n return []\n}\n\n/**\n * Add operations to create parent objects when missing before replacing a nested value\n */\nexport function createNestedValueOperations(operations: JSONPatchOperation[], json: unknown) {\n return operations.flatMap((operation) => {\n if (isJSONPatchReplace(operation)) {\n const path = parseJSONPointer(operation.path)\n if (path.length > 0) {\n const extendedOperations: JSONPatchOperation[] = [operation]\n\n let parentPath = initial(path)\n while (parentPath.length > 0 && !existsIn(json, parentPath)) {\n extendedOperations.unshift({\n op: 'add',\n path: compileJSONPointer(parentPath),\n value: {}\n })\n\n parentPath = initial(parentPath)\n }\n\n return extendedOperations\n }\n }\n\n return operation\n })\n}\n","import type { JSONPatchDocument, JSONPatchOperation, JSONPath } from 'immutable-json-patch'\nimport { compileJSONPointer, getIn, isJSONArray, isJSONObject } from 'immutable-json-patch'\nimport { forEachRight, initial, isEqual, last } from 'lodash-es'\nimport { getEnforceString, updateInRecursiveState } from './documentState.js'\nimport { createSelectionFromOperations } from './selection.js'\nimport { rename } from './operations.js'\nimport { stringConvert } from '../utils/typeUtils.js'\nimport type {\n DocumentState,\n ExtendedSearchResultItem,\n JSONParser,\n JSONSelection,\n RecursiveStateFactory,\n SearchOptions,\n SearchResultDetails,\n SearchResultItem,\n SearchResults\n} from '$lib/types'\nimport { SearchField } from '$lib/types.js'\nimport {\n hasSearchResults,\n isArrayRecursiveState,\n isObjectRecursiveState\n} from 'svelte-jsoneditor/typeguards.js'\n\n// TODO: comment\n// TODO: unit test\nexport function updateSearchResult(\n newResultItems: SearchResultItem[],\n previousResult: SearchResultDetails | undefined\n): SearchResultDetails {\n const activePath = previousResult?.activeItem\n ? getSearchResultPath(previousResult.activeItem)\n : undefined\n\n const matchingActiveIndex = newResultItems.findIndex((item) => {\n return isEqual(activePath, getSearchResultPath(item))\n })\n\n const activeIndex =\n matchingActiveIndex !== -1\n ? matchingActiveIndex\n : previousResult?.activeIndex !== undefined &&\n previousResult?.activeIndex < newResultItems.length\n ? previousResult?.activeIndex\n : newResultItems.length > 0\n ? 0\n : -1\n\n const items: ExtendedSearchResultItem[] = newResultItems.map((item, resultIndex) => {\n return { resultIndex, ...item, active: resultIndex === activeIndex }\n })\n\n const activeItem = items[activeIndex]\n\n return {\n items,\n activeItem,\n activeIndex\n }\n}\n\n// TODO: unit test\nexport function searchNext(searchResult: SearchResultDetails): SearchResultDetails {\n const nextActiveIndex =\n searchResult.activeIndex < searchResult.items.length - 1\n ? searchResult.activeIndex + 1\n : searchResult.items.length > 0\n ? 0\n : -1\n\n const nextActiveItem = searchResult.items[nextActiveIndex]\n\n const items: ExtendedSearchResultItem[] = searchResult.items.map((item, index) => {\n return { ...item, active: index === nextActiveIndex }\n })\n\n return {\n ...searchResult,\n items,\n activeItem: nextActiveItem,\n activeIndex: nextActiveIndex\n }\n}\n\n// TODO: unit test\nexport function searchPrevious(searchResult: SearchResultDetails): SearchResultDetails {\n const previousActiveIndex =\n searchResult.activeIndex > 0 ? searchResult.activeIndex - 1 : searchResult.items.length - 1\n\n const previousActiveItem = searchResult.items[previousActiveIndex]\n\n const items: ExtendedSearchResultItem[] = searchResult.items.map((item, index) => {\n return { ...item, active: index === previousActiveIndex }\n })\n\n return {\n ...searchResult,\n items,\n activeItem: previousActiveItem,\n activeIndex: previousActiveIndex\n }\n}\n\n// TODO: comment\nexport function search(\n searchText: string,\n json: unknown,\n options: SearchOptions = {}\n): SearchResultItem[] {\n const searchTextLowerCase = searchText.toLowerCase()\n const maxResults = options?.maxResults ?? Infinity\n const columns = options?.columns\n const results: SearchResultItem[] = []\n const path: JSONPath = [] // we reuse the same Array recursively, this is *much* faster than creating a new path every time\n\n function onMatch(match: SearchResultItem) {\n if (results.length >= maxResults) {\n return\n }\n\n results.push(match)\n }\n\n function searchRecursive(searchTextLowerCase: string, value: unknown) {\n if (isJSONArray(value)) {\n const level = path.length\n path.push('0')\n\n for (let i = 0; i < value.length; i++) {\n path[level] = String(i)\n\n searchRecursive(searchTextLowerCase, value[i])\n\n if (results.length >= maxResults) {\n return\n }\n }\n\n path.pop()\n } else if (isJSONObject(value)) {\n const keys = Object.keys(value)\n const level = path.length\n\n path.push('')\n\n for (const key of keys) {\n path[level] = key\n\n findCaseInsensitiveMatches(key, searchTextLowerCase, path, SearchField.key, onMatch)\n\n searchRecursive(searchTextLowerCase, value[key])\n\n if (results.length >= maxResults) {\n return\n }\n }\n\n path.pop()\n } else {\n // type is a value\n findCaseInsensitiveMatches(\n String(value),\n searchTextLowerCase,\n path,\n SearchField.value,\n onMatch\n )\n }\n }\n\n if (searchText === '') {\n return []\n } else if (columns) {\n if (!Array.isArray(json)) {\n throw new Error('json must be an Array when option columns is defined')\n }\n\n for (let i = 0; i < json.length; i++) {\n path[0] = String(i)\n\n const item = json[i]\n\n for (let c = 0; c < columns.length; c++) {\n const column = columns[c]\n\n if (column.length === 1) {\n path[1] = column[0]\n } else {\n for (let p = 0; p < column.length; p++) {\n path[p + 1] = column[p]\n }\n }\n while (path.length > column.length + 1) {\n path.pop()\n }\n\n const value = getIn(item, column)\n\n searchRecursive(searchTextLowerCase, value)\n }\n\n if (results.length >= maxResults) {\n break\n }\n }\n\n return results\n } else {\n searchRecursive(searchTextLowerCase, json)\n return results\n }\n}\n\n/**\n * Do a case-insensitive search for a search text in a text\n */\nexport function findCaseInsensitiveMatches(\n text: string,\n searchTextLowerCase: string,\n path: JSONPath,\n field: SearchField,\n onMatch: (searchResultItem: SearchResultItem) => void\n): void {\n const textLower = text.toLowerCase()\n\n let fieldIndex = 0\n let position = -1\n let index = -1\n\n do {\n index = textLower.indexOf(searchTextLowerCase, position)\n\n if (index !== -1) {\n position = index + searchTextLowerCase.length\n\n onMatch({\n path: path.slice(0), // path may be mutated in a later stage, therefore we store a copy\n field,\n fieldIndex,\n start: index,\n end: position\n })\n\n fieldIndex++\n }\n } while (index !== -1)\n}\n\n/**\n * Replace a search result item with a replacement text\n */\nexport function replaceText(text: string, replacementText: string, start: number, end: number) {\n return text.substring(0, start) + replacementText + text.substring(end)\n}\n\n/**\n * Replace all matches with a replacement text\n */\nexport function replaceAllText(\n text: string,\n replacementText: string,\n occurrences: Array<{ start: number; end: number }>\n): string {\n let updatedText = text\n\n forEachRight(occurrences, (occurrence) => {\n updatedText = replaceText(updatedText, replacementText, occurrence.start, occurrence.end)\n })\n\n return updatedText\n}\n\nexport function createSearchAndReplaceOperations(\n json: unknown,\n documentState: DocumentState | undefined,\n replacementText: string,\n searchResultItem: SearchResultItem,\n parser: JSONParser\n): { newSelection: JSONSelection | undefined; operations: JSONPatchDocument } {\n const { field, path, start, end } = searchResultItem\n\n if (field === SearchField.key) {\n // replace a key\n const parentPath = initial(path)\n const parent = getIn(json, parentPath)\n const oldKey = last(path) as string\n const keys = Object.keys(parent as Record<string, unknown>)\n const newKey = replaceText(oldKey, replacementText, start, end)\n\n const operations = rename(parentPath, keys, oldKey, newKey)\n const newSelection = createSelectionFromOperations(json, operations)\n\n return {\n newSelection,\n operations\n }\n } else if (field === SearchField.value) {\n // replace a value\n const currentValue: unknown | undefined = getIn(json, path)\n if (currentValue === undefined) {\n throw new Error(`Cannot replace: path not found ${compileJSONPointer(path)}`)\n }\n const currentValueText = typeof currentValue === 'string' ? currentValue : String(currentValue)\n\n const enforceString = getEnforceString(json, documentState, path)\n const value = replaceText(currentValueText, replacementText, start, end)\n\n const operations: JSONPatchOperation[] = [\n {\n op: 'replace',\n path: compileJSONPointer(path),\n value: enforceString ? value : stringConvert(value, parser)\n }\n ]\n\n const newSelection = createSelectionFromOperations(json, operations)\n\n return {\n newSelection,\n operations\n }\n } else {\n throw new Error(`Cannot replace: unknown type of search result field ${field}`)\n }\n}\n\nexport function createSearchAndReplaceAllOperations(\n json: unknown,\n documentState: DocumentState | undefined,\n searchText: string,\n replacementText: string,\n parser: JSONParser\n): { newSelection: JSONSelection | undefined; operations: JSONPatchDocument } {\n // TODO: to improve performance, we could reuse existing search results (except when hitting a maxResult limit)\n const searchResultItems = search(searchText, json, { maxResults: Infinity })\n\n interface Match {\n path: JSONPath\n field: string\n items: SearchResultItem[]\n }\n\n // step 1: deduplicate matches inside the same field/value\n // (filter, map, and group)\n const deduplicatedMatches: Match[] = []\n for (let i = 0; i < searchResultItems.length; i++) {\n const previousItem = searchResultItems[i - 1]\n const item = searchResultItems[i]\n if (i === 0 || item.field !== previousItem.field || !isEqual(item.path, previousItem.path)) {\n deduplicatedMatches.push({\n path: item.path,\n field: item.field,\n items: [item]\n })\n } else {\n ;(last(deduplicatedMatches) as Match).items.push(item)\n }\n }\n\n // step 2: sort from deepest nested to least nested\n // this is needed to replace in that order because paths may change\n // if there are replacements in keys\n deduplicatedMatches.sort((a, b) => {\n // sort values first, properties next\n if (a.field !== b.field) {\n if (a.field === SearchField.key) {\n return 1\n } else {\n return -1\n }\n }\n\n // sort longest paths first, shortest last\n return b.path.length - a.path.length\n })\n\n // step 3: call createSearchAndReplaceOperations for each of the matches\n let allOperations: JSONPatchDocument = []\n let lastNewSelection: JSONSelection | undefined\n deduplicatedMatches.forEach((match) => {\n // TODO: there is overlap with the logic of createSearchAndReplaceOperations. Can we extract and reuse this logic?\n const { field, path, items } = match\n\n if (field === SearchField.key) {\n // replace a key\n const parentPath = initial(path)\n const parent = getIn(json, parentPath)\n const oldKey = last(path) as string\n const keys = Object.keys(parent as Record<string, unknown>)\n const newKey = replaceAllText(oldKey, replacementText, items)\n\n const operations = rename(parentPath, keys, oldKey, newKey)\n allOperations = allOperations.concat(operations)\n\n lastNewSelection = createSelectionFromOperations(json, operations)\n } else if (field === SearchField.value) {\n // replace a value\n const currentValue: unknown | undefined = getIn(json, path)\n if (currentValue === undefined) {\n throw new Error(`Cannot replace: path not found ${compileJSONPointer(path)}`)\n }\n const currentValueText =\n typeof currentValue === 'string' ? currentValue : String(currentValue)\n const enforceString = getEnforceString(json, documentState, path)\n const value = replaceAllText(currentValueText, replacementText, items)\n\n const operations: JSONPatchOperation[] = [\n {\n op: 'replace',\n path: compileJSONPointer(path),\n value: enforceString ? value : stringConvert(value, parser)\n }\n ]\n allOperations = allOperations.concat(operations)\n\n lastNewSelection = createSelectionFromOperations(json, operations)\n } else {\n throw new Error(`Cannot replace: unknown type of search result field ${field}`)\n }\n })\n\n return {\n operations: allOperations,\n newSelection: lastNewSelection\n }\n}\n\nexport interface SplitValuePart {\n text: string\n type: 'normal' | 'highlight'\n resultIndex: number | undefined\n active: boolean\n}\n\n/**\n * Split the text into separate parts for each search result and the text\n * in between.\n */\nexport function splitValue(text: string, matches: ExtendedSearchResultItem[]): SplitValuePart[] {\n const parts: SplitValuePart[] = []\n\n let previousEnd = 0\n\n for (const match of matches) {\n const precedingText = text.slice(previousEnd, match.start)\n if (precedingText !== '') {\n parts.push({\n resultIndex: undefined,\n type: 'normal',\n text: precedingText,\n active: false\n })\n }\n\n const matchingText = text.slice(match.start, match.end)\n parts.push({\n resultIndex: match.resultIndex,\n type: 'highlight',\n text: matchingText,\n active: match.active\n })\n\n previousEnd = match.end\n }\n\n const lastMatch = last(matches)\n if (lastMatch && lastMatch.end < text.length) {\n parts.push({\n type: 'normal',\n text: text.slice(lastMatch.end),\n resultIndex: undefined,\n active: false\n })\n }\n\n return parts\n}\n\n/**\n * Get the path of the search result property on a nested search result\n */\nfunction getSearchResultPath(searchResultItem: SearchResultItem): JSONPath {\n return searchResultItem.path.concat(searchResultItem.field, String(searchResultItem.fieldIndex))\n}\n\n/**\n * Filter key search results.\n * Returns a non-empty array, or undefined if there are no key search results\n */\nexport function filterKeySearchResults(\n searchResult: SearchResults | undefined\n): ExtendedSearchResultItem[] | undefined {\n const filtered = hasSearchResults(searchResult)\n ? searchResult.searchResults.filter((result) => result.field === SearchField.key)\n : undefined\n\n return filtered && filtered.length > 0 ? filtered : undefined\n}\n\n/**\n * Filter value search results.\n * Returns a non-empty array, or undefined if there are no value search results\n */\nexport function filterValueSearchResults(\n searchResult: SearchResults | undefined\n): ExtendedSearchResultItem[] | undefined {\n const filtered = hasSearchResults(searchResult)\n ? searchResult.searchResults.filter((result) => result.field === SearchField.value)\n : undefined\n\n return filtered && filtered.length > 0 ? filtered : undefined\n}\n\nexport const searchResultsFactory: RecursiveStateFactory = {\n createObjectDocumentState: () => ({ type: 'object', properties: {} }),\n createArrayDocumentState: () => ({ type: 'array', items: [] }),\n createValueDocumentState: () => ({ type: 'value' })\n}\n\nexport function updateInSearchResults(\n json: unknown,\n searchResults: SearchResults | undefined,\n path: JSONPath,\n transform: (value: unknown, state: SearchResults) => SearchResults\n): SearchResults {\n return updateInRecursiveState(json, searchResults, path, transform, searchResultsFactory)\n}\n\nexport function toRecursiveSearchResults(\n json: unknown,\n searchResultItems: ExtendedSearchResultItem[]\n): SearchResults | undefined {\n return searchResultItems.reduce(\n (recursiveState, searchResult) => {\n return updateInSearchResults(json, recursiveState, searchResult.path, (_, nestedState) => ({\n ...nestedState,\n searchResults: nestedState.searchResults\n ? nestedState.searchResults.concat(searchResult)\n : [searchResult]\n }))\n },\n undefined as SearchResults | undefined\n )\n}\n\nexport function flattenSearchResults(node: SearchResults | undefined): ExtendedSearchResultItem[] {\n const self = node?.searchResults ?? []\n\n const nested = isObjectRecursiveState(node)\n ? Object.values(node.properties).flatMap(flattenSearchResults)\n : isArrayRecursiveState(node)\n ? node.items.flatMap(flattenSearchResults)\n : []\n\n return self.concat(nested)\n}\n","<script lang=\"ts\">\n import { splitValue } from '$lib/logic/search.js'\n import { addNewLineSuffix } from '$lib/utils/domUtils.js'\n import type { ExtendedSearchResultItem } from '$lib/types'\n\n export let text: string\n export let searchResultItems: ExtendedSearchResultItem[]\n\n $: parts = splitValue(String(text), searchResultItems)\n</script>\n\n{#each parts as part}\n {#if part.type === 'normal'}\n {part.text}\n {:else}\n <span\n class=\"jse-highlight\"\n class:jse-active={part.active}\n data-search-result-index={String(part.resultIndex)}>{addNewLineSuffix(part.text)}</span\n >\n {/if}\n{/each}\n\n<style src=\"./SearchResultHighlighter.scss\"></style>\n","/**\n * Return a human-readable document size\n * For example formatSize(7570718) outputs '7.6 MB'\n * This function uses 1000 for kilo (not 1024)\n * @param size\n * @return Returns a human-readable size\n */\nexport function formatSize(size: number): string {\n const kilo = 1000\n const factor = 0.9\n\n if (size < factor * kilo) {\n return size.toFixed() + ' B'\n }\n\n const KB = size / kilo\n if (KB < factor * kilo) {\n return KB.toFixed(1) + ' KB'\n }\n\n const MB = KB / kilo\n if (MB < factor * kilo) {\n return MB.toFixed(1) + ' MB'\n }\n\n const GB = MB / kilo\n if (GB < factor * kilo) {\n return GB.toFixed(1) + ' GB'\n }\n\n const TB = GB / kilo\n return TB.toFixed(1) + ' TB'\n}\n","<script lang=\"ts\">\n import type { Snippet } from 'svelte'\n\n interface Props {\n onclick?: () => void\n children?: Snippet\n }\n\n const { onclick, children }: Props = $props()\n\n const handleClick = $derived.by(() => {\n return onclick\n ? (event: MouseEvent) => {\n event.preventDefault()\n event.stopPropagation()\n onclick()\n }\n : undefined\n })\n</script>\n\n<button type=\"button\" class=\"jse-tag\" class:disabled={!onclick} onclick={handleClick}>\n {@render children?.()}\n</button>\n\n<style lang=\"scss\">\n @use '../../styles';\n @use '../../themes/defaults';\n\n .jse-tag {\n border: none;\n font-size: 80%;\n font-family: defaults.$font-family;\n color: defaults.$tag-color;\n background: defaults.$tag-background;\n border-radius: 2px;\n cursor: pointer;\n display: inline-block;\n padding: 0 4px;\n line-height: normal;\n margin: 1px 0;\n\n &:hover {\n opacity: 0.8;\n }\n\n &.disabled {\n opacity: 0.7;\n cursor: inherit;\n }\n }\n</style>\n","/** @import { Snippet } from 'svelte' */\n/** @import { TemplateNode } from '#client' */\n/** @import { Getters } from '#shared' */\nimport { EFFECT_TRANSPARENT, ELEMENT_NODE } from '#client/constants';\nimport { block, teardown } from '../../reactivity/effects.js';\nimport {\n\tdev_current_component_function,\n\tset_dev_current_component_function\n} from '../../context.js';\nimport { hydrate_next, hydrate_node, hydrating } from '../hydration.js';\nimport { create_fragment_from_html } from '../reconciler.js';\nimport { assign_nodes } from '../template.js';\nimport * as w from '../../warnings.js';\nimport * as e from '../../errors.js';\nimport { DEV } from 'esm-env';\nimport { get_first_child, get_next_sibling } from '../operations.js';\nimport { prevent_snippet_stringification } from '../../../shared/validate.js';\nimport { BranchManager } from './branches.js';\n\n/**\n * @template {(node: TemplateNode, ...args: any[]) => void} SnippetFn\n * @param {TemplateNode} node\n * @param {() => SnippetFn | null | undefined} get_snippet\n * @param {(() => any)[]} args\n * @returns {void}\n */\nexport function snippet(node, get_snippet, ...args) {\n\tvar branches = new BranchManager(node);\n\n\tblock(() => {\n\t\tconst snippet = get_snippet() ?? null;\n\n\t\tif (DEV && snippet == null) {\n\t\t\te.invalid_snippet();\n\t\t}\n\n\t\tbranches.ensure(snippet, snippet && ((anchor) => snippet(anchor, ...args)));\n\t}, EFFECT_TRANSPARENT);\n}\n\n/**\n * In development, wrap the snippet function so that it passes validation, and so that the\n * correct component context is set for ownership checks\n * @param {any} component\n * @param {(node: TemplateNode, ...args: any[]) => void} fn\n */\nexport function wrap_snippet(component, fn) {\n\tconst snippet = (/** @type {TemplateNode} */ node, /** @type {any[]} */ ...args) => {\n\t\tvar previous_component_function = dev_current_component_function;\n\t\tset_dev_current_component_function(component);\n\n\t\ttry {\n\t\t\treturn fn(node, ...args);\n\t\t} finally {\n\t\t\tset_dev_current_component_function(previous_component_function);\n\t\t}\n\t};\n\n\tprevent_snippet_stringification(snippet);\n\n\treturn snippet;\n}\n\n/**\n * Create a snippet programmatically\n * @template {unknown[]} Params\n * @param {(...params: Getters<Params>) => {\n * render: () => string\n * setup?: (element: Element) => void | (() => void)\n * }} fn\n * @returns {Snippet<Params>}\n */\nexport function createRawSnippet(fn) {\n\t// @ts-expect-error the types are a lie\n\treturn (/** @type {TemplateNode} */ anchor, /** @type {Getters<Params>} */ ...params) => {\n\t\tvar snippet = fn(...params);\n\n\t\t/** @type {Element} */\n\t\tvar element;\n\n\t\tif (hydrating) {\n\t\t\telement = /** @type {Element} */ (hydrate_node);\n\t\t\thydrate_next();\n\t\t} else {\n\t\t\tvar html = snippet.render().trim();\n\t\t\tvar fragment = create_fragment_from_html(html);\n\t\t\telement = /** @type {Element} */ (get_first_child(fragment));\n\n\t\t\tif (DEV && (get_next_sibling(element) !== null || element.nodeType !== ELEMENT_NODE)) {\n\t\t\t\tw.invalid_raw_snippet_render();\n\t\t\t}\n\n\t\t\tanchor.before(element);\n\t\t}\n\n\t\tconst result = snippet.setup?.(element);\n\t\tassign_nodes(element, element);\n\n\t\tif (typeof result === 'function') {\n\t\t\tteardown(result);\n\t\t}\n\t};\n}\n","<script lang=\"ts\">\n import { isUrl } from '$lib/utils/typeUtils.js'\n import { createEditValueSelection } from '$lib/logic/selection.js'\n import SearchResultHighlighter from '../../../components/modes/treemode/highlight/SearchResultHighlighter.svelte'\n import { getValueClass } from './utils/getValueClass.js'\n import { addNewLineSuffix } from '$lib/utils/domUtils.js'\n import { type RenderValueProps } from '$lib/types.js'\n import { isCtrlKeyDown } from 'svelte-jsoneditor/utils/keyBindings'\n import { formatSize } from '$lib/utils/fileUtils'\n import Tag from '../../../components/controls/Tag.svelte'\n\n const {\n path,\n value,\n mode,\n truncateTextSize,\n readOnly,\n normalization,\n parser,\n onSelect,\n searchResultItems\n }: RenderValueProps = $props()\n\n let doTruncate = $state(true)\n const isTruncated = $derived(\n doTruncate &&\n typeof value === 'string' &&\n value.length > truncateTextSize &&\n (!searchResultItems ||\n !searchResultItems.some((item) => item.active && item.end > truncateTextSize))\n )\n const truncatedValue = $derived(\n isTruncated && typeof value === 'string' ? value.substring(0, truncateTextSize).trim() : value\n )\n const valueIsUrl = $derived(isUrl(value))\n\n function handleValueClick(event: MouseEvent) {\n if (typeof value === 'string' && valueIsUrl && isCtrlKeyDown(event)) {\n event.preventDefault()\n event.stopPropagation()\n\n window.open(value, '_blank')\n }\n }\n\n function handleValueDoubleClick(event: MouseEvent) {\n if (!readOnly) {\n event.preventDefault()\n onSelect(createEditValueSelection(path))\n }\n }\n\n function handleShowMore() {\n doTruncate = false\n }\n</script>\n\n<!-- svelte-ignore a11y_click_events_have_key_events -->\n<div\n role=\"button\"\n tabindex=\"-1\"\n data-type=\"selectable-value\"\n class={getValueClass(value, mode, parser)}\n onclick={handleValueClick}\n ondblclick={handleValueDoubleClick}\n title={valueIsUrl ? 'Ctrl+Click or Ctrl+Enter to open url in new window' : undefined}\n>\n {#if searchResultItems}\n <SearchResultHighlighter text={normalization.escapeValue(truncatedValue)} {searchResultItems} />\n {:else}\n {addNewLineSuffix(normalization.escapeValue(truncatedValue))}\n {/if}\n {#if isTruncated && typeof value === 'string'}\n <Tag onclick={handleShowMore}>\n Show more ({formatSize(value.length)})\n </Tag>\n {/if}\n</div>\n\n<style src=\"./ReadonlyValue.scss\"></style>\n","<script lang=\"ts\">\n export let text: string\n</script>\n\n<div class=\"jse-tooltip\">\n {text}\n</div>\n\n<style src=\"./Tooltip.scss\"></style>\n","import Tooltip from './Tooltip.svelte'\nimport type { SvelteComponent } from 'svelte'\nimport type { AbsolutePopupOptions } from '$lib/types'\n\nexport interface TooltipOptions {\n text: string\n openAbsolutePopup: (\n component: typeof SvelteComponent<Record<string, unknown>>,\n props: Record<string, unknown>,\n options: AbsolutePopupOptions\n ) => number\n closeAbsolutePopup: (popupId: number | undefined) => void\n}\n\nexport function tooltip(\n node: Element,\n { text, openAbsolutePopup, closeAbsolutePopup }: TooltipOptions\n) {\n let popupId: number | undefined\n\n function handleMouseEnter() {\n const props = {\n text\n }\n\n // opening popup will fail if there is already a popup open\n popupId = openAbsolutePopup(Tooltip, props, {\n position: 'top',\n width: 10 * text.length, // rough estimate of the width of the message\n offsetTop: 3,\n anchor: node,\n closeOnOuterClick: true\n })\n }\n\n function handleMouseLeave() {\n closeAbsolutePopup(popupId)\n }\n\n node.addEventListener('mouseenter', handleMouseEnter)\n node.addEventListener('mouseleave', handleMouseLeave)\n\n return {\n destroy() {\n node.removeEventListener('mouseenter', handleMouseEnter)\n node.removeEventListener('mouseleave', handleMouseLeave)\n }\n }\n}\n","<svelte:options immutable={true} />\n\n<script lang=\"ts\">\n import Icon from 'svelte-awesome'\n import { faClock } from '@fortawesome/free-regular-svg-icons'\n import { getContext } from 'svelte'\n import { tooltip } from '$lib/components/controls/tooltip/tooltip.js'\n import type { AbsolutePopupContext } from '$lib/types'\n\n const absolutePopupContext = getContext<AbsolutePopupContext>('absolute-popup')\n\n export let value: number\n\n $: text = `Time: ${new Date(value).toString()}`\n</script>\n\n<div class=\"jse-timestamp\" use:tooltip={{ text, ...absolutePopupContext }}>\n <Icon data={faClock} />\n</div>\n\n<style src=\"./TimestampTag.scss\"></style>\n","import { isBoolean, isColor, isTimestamp } from '$lib/utils/typeUtils.js'\nimport type { RenderValueComponentDescription, RenderValueProps } from '$lib/types'\nimport BooleanToggle from './components/BooleanToggle.svelte'\nimport ColorPicker from './components/ColorPicker.svelte'\nimport EditableValue from './components/EditableValue.svelte'\nimport ReadonlyValue from './components/ReadonlyValue.svelte'\nimport TimestampTag from './components/TimestampTag.svelte'\n\nexport function renderValue(props: RenderValueProps): RenderValueComponentDescription[] {\n const renderers: RenderValueComponentDescription[] = []\n\n if (!props.isEditing && isBoolean(props.value)) {\n renderers.push({ component: BooleanToggle, props })\n }\n\n if (!props.isEditing && isColor(props.value)) {\n renderers.push({ component: ColorPicker, props })\n }\n\n if (props.isEditing) {\n renderers.push({ component: EditableValue, props })\n }\n\n if (!props.isEditing) {\n renderers.push({ component: ReadonlyValue, props })\n }\n\n if (!props.isEditing && isTimestamp(props.value)) {\n renderers.push({ component: TimestampTag, props })\n }\n\n return renderers\n}\n","import { isEmpty } from 'lodash-es'\nimport type { JSONPath } from 'immutable-json-patch'\nimport type { PathOption } from '$lib/types.js'\n\n/**\n **\n * Stringify an array with a path like ['items', '3', 'name'] into string like 'items[3].name'\n * Note that we allow all characters in a property name, like \"item with spaces[3].name\",\n * so this path is not usable as-is in JavaScript.\n */\nexport function stringifyJSONPath(path: JSONPath): string {\n return path\n .map((p, index) => {\n return integerNumberRegex.test(p)\n ? '[' + p + ']'\n : /[.[\\]]/.test(p) || p === '' // match any character . or [ or ] and handle an empty string\n ? '[\"' + escapeQuotes(p) + '\"]'\n : (index > 0 ? '.' : '') + p\n })\n .join('')\n}\n\nfunction escapeQuotes(prop: string): string {\n return prop.replace(/\"/g, '\\\\\"')\n}\n\n/**\n * Parse a JSON path like 'items[3].name' into a path like ['items', '3', 'name']\n */\nexport function parseJSONPath(pathStr: string): JSONPath {\n const path: JSONPath = []\n let i = 0\n\n while (i < pathStr.length) {\n if (pathStr[i] === '.') {\n i++\n }\n\n if (pathStr[i] === '[') {\n i++\n\n if (pathStr[i] === '\"') {\n i++\n path.push(parseProp((c) => c === '\"', true))\n eatCharacter('\"')\n } else {\n path.push(parseProp((c) => c === ']'))\n }\n\n eatCharacter(']')\n } else {\n path.push(parseProp((c) => c === '.' || c === '['))\n }\n }\n\n function parseProp(isEnd: (char: string) => boolean, unescape = false) {\n let prop = ''\n\n while (i < pathStr.length && !isEnd(pathStr[i])) {\n if (unescape && pathStr[i] === '\\\\' && pathStr[i + 1] === '\"') {\n // escaped double quote\n prop += '\"'\n i += 2\n } else {\n prop += pathStr[i]\n i++\n }\n }\n\n return prop\n }\n\n function eatCharacter(char: string) {\n if (pathStr[i] !== char) {\n throw new SyntaxError(`Invalid JSON path: ${char} expected at position ${i}`)\n }\n i++\n }\n\n return path\n}\n\n/**\n * Convert a JSONPath into an option for use in a select box\n */\nexport function pathToOption(path: JSONPath): PathOption {\n return {\n value: path,\n label: isEmpty(path) ? '(item root)' : stringifyJSONPath(path)\n }\n}\n\n/**\n * Stringify a JSON path into a lodash path like:\n *\n * [\"data\", 2, \"nested property\", \"name\"]\n *\n * into a lodash path like:\n *\n * \"data[2].nested.name\"\n *\n */\nexport function createLodashPropertySelector(path: JSONPath): string {\n return path.length === 0\n ? ''\n : path.every((prop) => integerNumberRegex.test(prop) || javaScriptPropertyRegex.test(prop))\n ? \"'\" + path.map(stringifyLodashProperty).join('').replace(/^\\./, '') + \"'\"\n : JSON.stringify(path)\n}\n\n/**\n * Stringify a single property of a JSON path. See also createLodashPropertySelector\n */\nfunction stringifyLodashProperty(prop: string): string {\n if (integerNumberRegex.test(prop)) {\n return '[' + prop + ']'\n } else if (javaScriptPropertyRegex.test(prop)) {\n return '.' + prop\n } else {\n const propStr = JSON.stringify(prop)\n // remove enclosing double quotes, and unescape escaped double quotes \\\"\n const jsonPathStr = propStr.substring(1, propStr.length - 1).replace(/\\\\\"/g, '\"')\n return \"['\" + jsonPathStr + \"']\"\n }\n}\n\n/**\n * Create a JavaScript property selector\n *\n * Turn a paths like:\n *\n * ['location', 'latitude']\n * ['address', 'full name']\n *\n * into a JavaScript selector (string) like:\n *\n * '?.location?.latitude'\n * '?.address?.[\"full name\"]'\n */\nexport function createPropertySelector(path: JSONPath): string {\n return path\n .map((prop) => {\n if (integerNumberRegex.test(prop)) {\n // an index\n return `?.[${prop}]`\n } else if (javaScriptPropertyRegex.test(prop)) {\n // a key without special characters\n return `?.${prop}`\n } else {\n // a key that may have special characters (like spaces or so)\n return `?.[${JSON.stringify(prop)}]`\n }\n })\n .join('')\n}\n\n// https://developer.mozilla.org/en-US/docs/Glossary/Identifier\n// Note: We can extend this regex to allow unicode characters too.\n// I'm too lazy to figure that out right now\nconst javaScriptPropertyRegex = /^[a-zA-Z$_][a-zA-Z$_\\d]*$/\nconst integerNumberRegex = /^\\d+$/\n","import type { QueryLanguageOptions } from '$lib/types.js'\n\nexport interface TransformModalState {\n queryLanguageId: string\n queryOptions: QueryLanguageOptions\n query: string\n isManual: boolean\n}\n\nexport const transformModalStates: Record<string, TransformModalState> = {}\n\nexport interface TransformModalStateShared {\n showWizard: boolean\n showOriginal: boolean\n}\n\nexport const transformModalStateShared: TransformModalStateShared = {\n showWizard: true,\n showOriginal: true\n}\n","/**\n * Custom positioning reference element.\n * @see https://floating-ui.com/docs/virtual-elements\n */\n\nconst sides = ['top', 'right', 'bottom', 'left'];\nconst alignments = ['start', 'end'];\nconst placements = /*#__PURE__*/sides.reduce((acc, side) => acc.concat(side, side + \"-\" + alignments[0], side + \"-\" + alignments[1]), []);\nconst min = Math.min;\nconst max = Math.max;\nconst round = Math.round;\nconst floor = Math.floor;\nconst createCoords = v => ({\n x: v,\n y: v\n});\nconst oppositeSideMap = {\n left: 'right',\n right: 'left',\n bottom: 'top',\n top: 'bottom'\n};\nfunction clamp(start, value, end) {\n return max(start, min(value, end));\n}\nfunction evaluate(value, param) {\n return typeof value === 'function' ? value(param) : value;\n}\nfunction getSide(placement) {\n return placement.split('-')[0];\n}\nfunction getAlignment(placement) {\n return placement.split('-')[1];\n}\nfunction getOppositeAxis(axis) {\n return axis === 'x' ? 'y' : 'x';\n}\nfunction getAxisLength(axis) {\n return axis === 'y' ? 'height' : 'width';\n}\nfunction getSideAxis(placement) {\n const firstChar = placement[0];\n return firstChar === 't' || firstChar === 'b' ? 'y' : 'x';\n}\nfunction getAlignmentAxis(placement) {\n return getOppositeAxis(getSideAxis(placement));\n}\nfunction getAlignmentSides(placement, rects, rtl) {\n if (rtl === void 0) {\n rtl = false;\n }\n const alignment = getAlignment(placement);\n const alignmentAxis = getAlignmentAxis(placement);\n const length = getAxisLength(alignmentAxis);\n let mainAlignmentSide = alignmentAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top';\n if (rects.reference[length] > rects.floating[length]) {\n mainAlignmentSide = getOppositePlacement(mainAlignmentSide);\n }\n return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];\n}\nfunction getExpandedPlacements(placement) {\n const oppositePlacement = getOppositePlacement(placement);\n return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];\n}\nfunction getOppositeAlignmentPlacement(placement) {\n return placement.includes('start') ? placement.replace('start', 'end') : placement.replace('end', 'start');\n}\nconst lrPlacement = ['left', 'right'];\nconst rlPlacement = ['right', 'left'];\nconst tbPlacement = ['top', 'bottom'];\nconst btPlacement = ['bottom', 'top'];\nfunction getSideList(side, isStart, rtl) {\n switch (side) {\n case 'top':\n case 'bottom':\n if (rtl) return isStart ? rlPlacement : lrPlacement;\n return isStart ? lrPlacement : rlPlacement;\n case 'left':\n case 'right':\n return isStart ? tbPlacement : btPlacement;\n default:\n return [];\n }\n}\nfunction getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {\n const alignment = getAlignment(placement);\n let list = getSideList(getSide(placement), direction === 'start', rtl);\n if (alignment) {\n list = list.map(side => side + \"-\" + alignment);\n if (flipAlignment) {\n list = list.concat(list.map(getOppositeAlignmentPlacement));\n }\n }\n return list;\n}\nfunction getOppositePlacement(placement) {\n const side = getSide(placement);\n return oppositeSideMap[side] + placement.slice(side.length);\n}\nfunction expandPaddingObject(padding) {\n return {\n top: 0,\n right: 0,\n bottom: 0,\n left: 0,\n ...padding\n };\n}\nfunction getPaddingObject(padding) {\n return typeof padding !== 'number' ? expandPaddingObject(padding) : {\n top: padding,\n right: padding,\n bottom: padding,\n left: padding\n };\n}\nfunction rectToClientRect(rect) {\n const {\n x,\n y,\n width,\n height\n } = rect;\n return {\n width,\n height,\n top: y,\n left: x,\n right: x + width,\n bottom: y + height,\n x,\n y\n };\n}\n\nexport { alignments, clamp, createCoords, evaluate, expandPaddingObject, floor, getAlignment, getAlignmentAxis, getAlignmentSides, getAxisLength, getExpandedPlacements, getOppositeAlignmentPlacement, getOppositeAxis, getOppositeAxisPlacements, getOppositePlacement, getPaddingObject, getSide, getSideAxis, max, min, placements, rectToClientRect, round, sides };\n","import { getSideAxis, getAlignmentAxis, getAxisLength, getSide, getAlignment, evaluate, getPaddingObject, rectToClientRect, min, clamp, placements, getAlignmentSides, getOppositeAlignmentPlacement, getOppositePlacement, getExpandedPlacements, getOppositeAxisPlacements, sides, max, getOppositeAxis } from '@floating-ui/utils';\nexport { rectToClientRect } from '@floating-ui/utils';\n\nfunction computeCoordsFromPlacement(_ref, placement, rtl) {\n let {\n reference,\n floating\n } = _ref;\n const sideAxis = getSideAxis(placement);\n const alignmentAxis = getAlignmentAxis(placement);\n const alignLength = getAxisLength(alignmentAxis);\n const side = getSide(placement);\n const isVertical = sideAxis === 'y';\n const commonX = reference.x + reference.width / 2 - floating.width / 2;\n const commonY = reference.y + reference.height / 2 - floating.height / 2;\n const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;\n let coords;\n switch (side) {\n case 'top':\n coords = {\n x: commonX,\n y: reference.y - floating.height\n };\n break;\n case 'bottom':\n coords = {\n x: commonX,\n y: reference.y + reference.height\n };\n break;\n case 'right':\n coords = {\n x: reference.x + reference.width,\n y: commonY\n };\n break;\n case 'left':\n coords = {\n x: reference.x - floating.width,\n y: commonY\n };\n break;\n default:\n coords = {\n x: reference.x,\n y: reference.y\n };\n }\n switch (getAlignment(placement)) {\n case 'start':\n coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);\n break;\n case 'end':\n coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1);\n break;\n }\n return coords;\n}\n\n/**\n * Resolves with an object of overflow side offsets that determine how much the\n * element is overflowing a given clipping boundary on each side.\n * - positive = overflowing the boundary by that number of pixels\n * - negative = how many pixels left before it will overflow\n * - 0 = lies flush with the boundary\n * @see https://floating-ui.com/docs/detectOverflow\n */\nasync function detectOverflow(state, options) {\n var _await$platform$isEle;\n if (options === void 0) {\n options = {};\n }\n const {\n x,\n y,\n platform,\n rects,\n elements,\n strategy\n } = state;\n const {\n boundary = 'clippingAncestors',\n rootBoundary = 'viewport',\n elementContext = 'floating',\n altBoundary = false,\n padding = 0\n } = evaluate(options, state);\n const paddingObject = getPaddingObject(padding);\n const altContext = elementContext === 'floating' ? 'reference' : 'floating';\n const element = elements[altBoundary ? altContext : elementContext];\n const clippingClientRect = rectToClientRect(await platform.getClippingRect({\n element: ((_await$platform$isEle = await (platform.isElement == null ? void 0 : platform.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || (await (platform.getDocumentElement == null ? void 0 : platform.getDocumentElement(elements.floating))),\n boundary,\n rootBoundary,\n strategy\n }));\n const rect = elementContext === 'floating' ? {\n x,\n y,\n width: rects.floating.width,\n height: rects.floating.height\n } : rects.reference;\n const offsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating));\n const offsetScale = (await (platform.isElement == null ? void 0 : platform.isElement(offsetParent))) ? (await (platform.getScale == null ? void 0 : platform.getScale(offsetParent))) || {\n x: 1,\n y: 1\n } : {\n x: 1,\n y: 1\n };\n const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({\n elements,\n rect,\n offsetParent,\n strategy\n }) : rect);\n return {\n top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,\n bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,\n left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,\n right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x\n };\n}\n\n// Maximum number of resets that can occur before bailing to avoid infinite reset loops.\nconst MAX_RESET_COUNT = 50;\n\n/**\n * Computes the `x` and `y` coordinates that will place the floating element\n * next to a given reference element.\n *\n * This export does not have any `platform` interface logic. You will need to\n * write one for the platform you are using Floating UI with.\n */\nconst computePosition = async (reference, floating, config) => {\n const {\n placement = 'bottom',\n strategy = 'absolute',\n middleware = [],\n platform\n } = config;\n const platformWithDetectOverflow = platform.detectOverflow ? platform : {\n ...platform,\n detectOverflow\n };\n const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));\n let rects = await platform.getElementRects({\n reference,\n floating,\n strategy\n });\n let {\n x,\n y\n } = computeCoordsFromPlacement(rects, placement, rtl);\n let statefulPlacement = placement;\n let resetCount = 0;\n const middlewareData = {};\n for (let i = 0; i < middleware.length; i++) {\n const currentMiddleware = middleware[i];\n if (!currentMiddleware) {\n continue;\n }\n const {\n name,\n fn\n } = currentMiddleware;\n const {\n x: nextX,\n y: nextY,\n data,\n reset\n } = await fn({\n x,\n y,\n initialPlacement: placement,\n placement: statefulPlacement,\n strategy,\n middlewareData,\n rects,\n platform: platformWithDetectOverflow,\n elements: {\n reference,\n floating\n }\n });\n x = nextX != null ? nextX : x;\n y = nextY != null ? nextY : y;\n middlewareData[name] = {\n ...middlewareData[name],\n ...data\n };\n if (reset && resetCount < MAX_RESET_COUNT) {\n resetCount++;\n if (typeof reset === 'object') {\n if (reset.placement) {\n statefulPlacement = reset.placement;\n }\n if (reset.rects) {\n rects = reset.rects === true ? await platform.getElementRects({\n reference,\n floating,\n strategy\n }) : reset.rects;\n }\n ({\n x,\n y\n } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));\n }\n i = -1;\n }\n }\n return {\n x,\n y,\n placement: statefulPlacement,\n strategy,\n middlewareData\n };\n};\n\n/**\n * Provides data to position an inner element of the floating element so that it\n * appears centered to the reference element.\n * @see https://floating-ui.com/docs/arrow\n */\nconst arrow = options => ({\n name: 'arrow',\n options,\n async fn(state) {\n const {\n x,\n y,\n placement,\n rects,\n platform,\n elements,\n middlewareData\n } = state;\n // Since `element` is required, we don't Partial<> the type.\n const {\n element,\n padding = 0\n } = evaluate(options, state) || {};\n if (element == null) {\n return {};\n }\n const paddingObject = getPaddingObject(padding);\n const coords = {\n x,\n y\n };\n const axis = getAlignmentAxis(placement);\n const length = getAxisLength(axis);\n const arrowDimensions = await platform.getDimensions(element);\n const isYAxis = axis === 'y';\n const minProp = isYAxis ? 'top' : 'left';\n const maxProp = isYAxis ? 'bottom' : 'right';\n const clientProp = isYAxis ? 'clientHeight' : 'clientWidth';\n const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];\n const startDiff = coords[axis] - rects.reference[axis];\n const arrowOffsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(element));\n let clientSize = arrowOffsetParent ? arrowOffsetParent[clientProp] : 0;\n\n // DOM platform can return `window` as the `offsetParent`.\n if (!clientSize || !(await (platform.isElement == null ? void 0 : platform.isElement(arrowOffsetParent)))) {\n clientSize = elements.floating[clientProp] || rects.floating[length];\n }\n const centerToReference = endDiff / 2 - startDiff / 2;\n\n // If the padding is large enough that it causes the arrow to no longer be\n // centered, modify the padding so that it is centered.\n const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1;\n const minPadding = min(paddingObject[minProp], largestPossiblePadding);\n const maxPadding = min(paddingObject[maxProp], largestPossiblePadding);\n\n // Make sure the arrow doesn't overflow the floating element if the center\n // point is outside the floating element's bounds.\n const min$1 = minPadding;\n const max = clientSize - arrowDimensions[length] - maxPadding;\n const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;\n const offset = clamp(min$1, center, max);\n\n // If the reference is small enough that the arrow's padding causes it to\n // to point to nothing for an aligned placement, adjust the offset of the\n // floating element itself. To ensure `shift()` continues to take action,\n // a single reset is performed when this is true.\n const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset && rects.reference[length] / 2 - (center < min$1 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;\n const alignmentOffset = shouldAddOffset ? center < min$1 ? center - min$1 : center - max : 0;\n return {\n [axis]: coords[axis] + alignmentOffset,\n data: {\n [axis]: offset,\n centerOffset: center - offset - alignmentOffset,\n ...(shouldAddOffset && {\n alignmentOffset\n })\n },\n reset: shouldAddOffset\n };\n }\n});\n\nfunction getPlacementList(alignment, autoAlignment, allowedPlacements) {\n const allowedPlacementsSortedByAlignment = alignment ? [...allowedPlacements.filter(placement => getAlignment(placement) === alignment), ...allowedPlacements.filter(placement => getAlignment(placement) !== alignment)] : allowedPlacements.filter(placement => getSide(placement) === placement);\n return allowedPlacementsSortedByAlignment.filter(placement => {\n if (alignment) {\n return getAlignment(placement) === alignment || (autoAlignment ? getOppositeAlignmentPlacement(placement) !== placement : false);\n }\n return true;\n });\n}\n/**\n * Optimizes the visibility of the floating element by choosing the placement\n * that has the most space available automatically, without needing to specify a\n * preferred placement. Alternative to `flip`.\n * @see https://floating-ui.com/docs/autoPlacement\n */\nconst autoPlacement = function (options) {\n if (options === void 0) {\n options = {};\n }\n return {\n name: 'autoPlacement',\n options,\n async fn(state) {\n var _middlewareData$autoP, _middlewareData$autoP2, _placementsThatFitOnE;\n const {\n rects,\n middlewareData,\n placement,\n platform,\n elements\n } = state;\n const {\n crossAxis = false,\n alignment,\n allowedPlacements = placements,\n autoAlignment = true,\n ...detectOverflowOptions\n } = evaluate(options, state);\n const placements$1 = alignment !== undefined || allowedPlacements === placements ? getPlacementList(alignment || null, autoAlignment, allowedPlacements) : allowedPlacements;\n const overflow = await platform.detectOverflow(state, detectOverflowOptions);\n const currentIndex = ((_middlewareData$autoP = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP.index) || 0;\n const currentPlacement = placements$1[currentIndex];\n if (currentPlacement == null) {\n return {};\n }\n const alignmentSides = getAlignmentSides(currentPlacement, rects, await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)));\n\n // Make `computeCoords` start from the right place.\n if (placement !== currentPlacement) {\n return {\n reset: {\n placement: placements$1[0]\n }\n };\n }\n const currentOverflows = [overflow[getSide(currentPlacement)], overflow[alignmentSides[0]], overflow[alignmentSides[1]]];\n const allOverflows = [...(((_middlewareData$autoP2 = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP2.overflows) || []), {\n placement: currentPlacement,\n overflows: currentOverflows\n }];\n const nextPlacement = placements$1[currentIndex + 1];\n\n // There are more placements to check.\n if (nextPlacement) {\n return {\n data: {\n index: currentIndex + 1,\n overflows: allOverflows\n },\n reset: {\n placement: nextPlacement\n }\n };\n }\n const placementsSortedByMostSpace = allOverflows.map(d => {\n const alignment = getAlignment(d.placement);\n return [d.placement, alignment && crossAxis ?\n // Check along the mainAxis and main crossAxis side.\n d.overflows.slice(0, 2).reduce((acc, v) => acc + v, 0) :\n // Check only the mainAxis.\n d.overflows[0], d.overflows];\n }).sort((a, b) => a[1] - b[1]);\n const placementsThatFitOnEachSide = placementsSortedByMostSpace.filter(d => d[2].slice(0,\n // Aligned placements should not check their opposite crossAxis\n // side.\n getAlignment(d[0]) ? 2 : 3).every(v => v <= 0));\n const resetPlacement = ((_placementsThatFitOnE = placementsThatFitOnEachSide[0]) == null ? void 0 : _placementsThatFitOnE[0]) || placementsSortedByMostSpace[0][0];\n if (resetPlacement !== placement) {\n return {\n data: {\n index: currentIndex + 1,\n overflows: allOverflows\n },\n reset: {\n placement: resetPlacement\n }\n };\n }\n return {};\n }\n };\n};\n\n/**\n * Optimizes the visibility of the floating element by flipping the `placement`\n * in order to keep it in view when the preferred placement(s) will overflow the\n * clipping boundary. Alternative to `autoPlacement`.\n * @see https://floating-ui.com/docs/flip\n */\nconst flip = function (options) {\n if (options === void 0) {\n options = {};\n }\n return {\n name: 'flip',\n options,\n async fn(state) {\n var _middlewareData$arrow, _middlewareData$flip;\n const {\n placement,\n middlewareData,\n rects,\n initialPlacement,\n platform,\n elements\n } = state;\n const {\n mainAxis: checkMainAxis = true,\n crossAxis: checkCrossAxis = true,\n fallbackPlacements: specifiedFallbackPlacements,\n fallbackStrategy = 'bestFit',\n fallbackAxisSideDirection = 'none',\n flipAlignment = true,\n ...detectOverflowOptions\n } = evaluate(options, state);\n\n // If a reset by the arrow was caused due to an alignment offset being\n // added, we should skip any logic now since `flip()` has already done its\n // work.\n // https://github.com/floating-ui/floating-ui/issues/2549#issuecomment-1719601643\n if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {\n return {};\n }\n const side = getSide(placement);\n const initialSideAxis = getSideAxis(initialPlacement);\n const isBasePlacement = getSide(initialPlacement) === initialPlacement;\n const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));\n const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));\n const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== 'none';\n if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) {\n fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));\n }\n const placements = [initialPlacement, ...fallbackPlacements];\n const overflow = await platform.detectOverflow(state, detectOverflowOptions);\n const overflows = [];\n let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];\n if (checkMainAxis) {\n overflows.push(overflow[side]);\n }\n if (checkCrossAxis) {\n const sides = getAlignmentSides(placement, rects, rtl);\n overflows.push(overflow[sides[0]], overflow[sides[1]]);\n }\n overflowsData = [...overflowsData, {\n placement,\n overflows\n }];\n\n // One or more sides is overflowing.\n if (!overflows.every(side => side <= 0)) {\n var _middlewareData$flip2, _overflowsData$filter;\n const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;\n const nextPlacement = placements[nextIndex];\n if (nextPlacement) {\n const ignoreCrossAxisOverflow = checkCrossAxis === 'alignment' ? initialSideAxis !== getSideAxis(nextPlacement) : false;\n if (!ignoreCrossAxisOverflow ||\n // We leave the current main axis only if every placement on that axis\n // overflows the main axis.\n overflowsData.every(d => getSideAxis(d.placement) === initialSideAxis ? d.overflows[0] > 0 : true)) {\n // Try next placement and re-run the lifecycle.\n return {\n data: {\n index: nextIndex,\n overflows: overflowsData\n },\n reset: {\n placement: nextPlacement\n }\n };\n }\n }\n\n // First, find the candidates that fit on the mainAxis side of overflow,\n // then find the placement that fits the best on the main crossAxis side.\n let resetPlacement = (_overflowsData$filter = overflowsData.filter(d => d.overflows[0] <= 0).sort((a, b) => a.overflows[1] - b.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement;\n\n // Otherwise fallback.\n if (!resetPlacement) {\n switch (fallbackStrategy) {\n case 'bestFit':\n {\n var _overflowsData$filter2;\n const placement = (_overflowsData$filter2 = overflowsData.filter(d => {\n if (hasFallbackAxisSideDirection) {\n const currentSideAxis = getSideAxis(d.placement);\n return currentSideAxis === initialSideAxis ||\n // Create a bias to the `y` side axis due to horizontal\n // reading directions favoring greater width.\n currentSideAxis === 'y';\n }\n return true;\n }).map(d => [d.placement, d.overflows.filter(overflow => overflow > 0).reduce((acc, overflow) => acc + overflow, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$filter2[0];\n if (placement) {\n resetPlacement = placement;\n }\n break;\n }\n case 'initialPlacement':\n resetPlacement = initialPlacement;\n break;\n }\n }\n if (placement !== resetPlacement) {\n return {\n reset: {\n placement: resetPlacement\n }\n };\n }\n }\n return {};\n }\n };\n};\n\nfunction getSideOffsets(overflow, rect) {\n return {\n top: overflow.top - rect.height,\n right: overflow.right - rect.width,\n bottom: overflow.bottom - rect.height,\n left: overflow.left - rect.width\n };\n}\nfunction isAnySideFullyClipped(overflow) {\n return sides.some(side => overflow[side] >= 0);\n}\n/**\n * Provides data to hide the floating element in applicable situations, such as\n * when it is not in the same clipping context as the reference element.\n * @see https://floating-ui.com/docs/hide\n */\nconst hide = function (options) {\n if (options === void 0) {\n options = {};\n }\n return {\n name: 'hide',\n options,\n async fn(state) {\n const {\n rects,\n platform\n } = state;\n const {\n strategy = 'referenceHidden',\n ...detectOverflowOptions\n } = evaluate(options, state);\n switch (strategy) {\n case 'referenceHidden':\n {\n const overflow = await platform.detectOverflow(state, {\n ...detectOverflowOptions,\n elementContext: 'reference'\n });\n const offsets = getSideOffsets(overflow, rects.reference);\n return {\n data: {\n referenceHiddenOffsets: offsets,\n referenceHidden: isAnySideFullyClipped(offsets)\n }\n };\n }\n case 'escaped':\n {\n const overflow = await platform.detectOverflow(state, {\n ...detectOverflowOptions,\n altBoundary: true\n });\n const offsets = getSideOffsets(overflow, rects.floating);\n return {\n data: {\n escapedOffsets: offsets,\n escaped: isAnySideFullyClipped(offsets)\n }\n };\n }\n default:\n {\n return {};\n }\n }\n }\n };\n};\n\nfunction getBoundingRect(rects) {\n const minX = min(...rects.map(rect => rect.left));\n const minY = min(...rects.map(rect => rect.top));\n const maxX = max(...rects.map(rect => rect.right));\n const maxY = max(...rects.map(rect => rect.bottom));\n return {\n x: minX,\n y: minY,\n width: maxX - minX,\n height: maxY - minY\n };\n}\nfunction getRectsByLine(rects) {\n const sortedRects = rects.slice().sort((a, b) => a.y - b.y);\n const groups = [];\n let prevRect = null;\n for (let i = 0; i < sortedRects.length; i++) {\n const rect = sortedRects[i];\n if (!prevRect || rect.y - prevRect.y > prevRect.height / 2) {\n groups.push([rect]);\n } else {\n groups[groups.length - 1].push(rect);\n }\n prevRect = rect;\n }\n return groups.map(rect => rectToClientRect(getBoundingRect(rect)));\n}\n/**\n * Provides improved positioning for inline reference elements that can span\n * over multiple lines, such as hyperlinks or range selections.\n * @see https://floating-ui.com/docs/inline\n */\nconst inline = function (options) {\n if (options === void 0) {\n options = {};\n }\n return {\n name: 'inline',\n options,\n async fn(state) {\n const {\n placement,\n elements,\n rects,\n platform,\n strategy\n } = state;\n // A MouseEvent's client{X,Y} coords can be up to 2 pixels off a\n // ClientRect's bounds, despite the event listener being triggered. A\n // padding of 2 seems to handle this issue.\n const {\n padding = 2,\n x,\n y\n } = evaluate(options, state);\n const nativeClientRects = Array.from((await (platform.getClientRects == null ? void 0 : platform.getClientRects(elements.reference))) || []);\n const clientRects = getRectsByLine(nativeClientRects);\n const fallback = rectToClientRect(getBoundingRect(nativeClientRects));\n const paddingObject = getPaddingObject(padding);\n function getBoundingClientRect() {\n // There are two rects and they are disjoined.\n if (clientRects.length === 2 && clientRects[0].left > clientRects[1].right && x != null && y != null) {\n // Find the first rect in which the point is fully inside.\n return clientRects.find(rect => x > rect.left - paddingObject.left && x < rect.right + paddingObject.right && y > rect.top - paddingObject.top && y < rect.bottom + paddingObject.bottom) || fallback;\n }\n\n // There are 2 or more connected rects.\n if (clientRects.length >= 2) {\n if (getSideAxis(placement) === 'y') {\n const firstRect = clientRects[0];\n const lastRect = clientRects[clientRects.length - 1];\n const isTop = getSide(placement) === 'top';\n const top = firstRect.top;\n const bottom = lastRect.bottom;\n const left = isTop ? firstRect.left : lastRect.left;\n const right = isTop ? firstRect.right : lastRect.right;\n const width = right - left;\n const height = bottom - top;\n return {\n top,\n bottom,\n left,\n right,\n width,\n height,\n x: left,\n y: top\n };\n }\n const isLeftSide = getSide(placement) === 'left';\n const maxRight = max(...clientRects.map(rect => rect.right));\n const minLeft = min(...clientRects.map(rect => rect.left));\n const measureRects = clientRects.filter(rect => isLeftSide ? rect.left === minLeft : rect.right === maxRight);\n const top = measureRects[0].top;\n const bottom = measureRects[measureRects.length - 1].bottom;\n const left = minLeft;\n const right = maxRight;\n const width = right - left;\n const height = bottom - top;\n return {\n top,\n bottom,\n left,\n right,\n width,\n height,\n x: left,\n y: top\n };\n }\n return fallback;\n }\n const resetRects = await platform.getElementRects({\n reference: {\n getBoundingClientRect\n },\n floating: elements.floating,\n strategy\n });\n if (rects.reference.x !== resetRects.reference.x || rects.reference.y !== resetRects.reference.y || rects.reference.width !== resetRects.reference.width || rects.reference.height !== resetRects.reference.height) {\n return {\n reset: {\n rects: resetRects\n }\n };\n }\n return {};\n }\n };\n};\n\nconst originSides = /*#__PURE__*/new Set(['left', 'top']);\n\n// For type backwards-compatibility, the `OffsetOptions` type was also\n// Derivable.\n\nasync function convertValueToCoords(state, options) {\n const {\n placement,\n platform,\n elements\n } = state;\n const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));\n const side = getSide(placement);\n const alignment = getAlignment(placement);\n const isVertical = getSideAxis(placement) === 'y';\n const mainAxisMulti = originSides.has(side) ? -1 : 1;\n const crossAxisMulti = rtl && isVertical ? -1 : 1;\n const rawValue = evaluate(options, state);\n\n // eslint-disable-next-line prefer-const\n let {\n mainAxis,\n crossAxis,\n alignmentAxis\n } = typeof rawValue === 'number' ? {\n mainAxis: rawValue,\n crossAxis: 0,\n alignmentAxis: null\n } : {\n mainAxis: rawValue.mainAxis || 0,\n crossAxis: rawValue.crossAxis || 0,\n alignmentAxis: rawValue.alignmentAxis\n };\n if (alignment && typeof alignmentAxis === 'number') {\n crossAxis = alignment === 'end' ? alignmentAxis * -1 : alignmentAxis;\n }\n return isVertical ? {\n x: crossAxis * crossAxisMulti,\n y: mainAxis * mainAxisMulti\n } : {\n x: mainAxis * mainAxisMulti,\n y: crossAxis * crossAxisMulti\n };\n}\n\n/**\n * Modifies the placement by translating the floating element along the\n * specified axes.\n * A number (shorthand for `mainAxis` or distance), or an axes configuration\n * object may be passed.\n * @see https://floating-ui.com/docs/offset\n */\nconst offset = function (options) {\n if (options === void 0) {\n options = 0;\n }\n return {\n name: 'offset',\n options,\n async fn(state) {\n var _middlewareData$offse, _middlewareData$arrow;\n const {\n x,\n y,\n placement,\n middlewareData\n } = state;\n const diffCoords = await convertValueToCoords(state, options);\n\n // If the placement is the same and the arrow caused an alignment offset\n // then we don't need to change the positioning coordinates.\n if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {\n return {};\n }\n return {\n x: x + diffCoords.x,\n y: y + diffCoords.y,\n data: {\n ...diffCoords,\n placement\n }\n };\n }\n };\n};\n\n/**\n * Optimizes the visibility of the floating element by shifting it in order to\n * keep it in view when it will overflow the clipping boundary.\n * @see https://floating-ui.com/docs/shift\n */\nconst shift = function (options) {\n if (options === void 0) {\n options = {};\n }\n return {\n name: 'shift',\n options,\n async fn(state) {\n const {\n x,\n y,\n placement,\n platform\n } = state;\n const {\n mainAxis: checkMainAxis = true,\n crossAxis: checkCrossAxis = false,\n limiter = {\n fn: _ref => {\n let {\n x,\n y\n } = _ref;\n return {\n x,\n y\n };\n }\n },\n ...detectOverflowOptions\n } = evaluate(options, state);\n const coords = {\n x,\n y\n };\n const overflow = await platform.detectOverflow(state, detectOverflowOptions);\n const crossAxis = getSideAxis(getSide(placement));\n const mainAxis = getOppositeAxis(crossAxis);\n let mainAxisCoord = coords[mainAxis];\n let crossAxisCoord = coords[crossAxis];\n if (checkMainAxis) {\n const minSide = mainAxis === 'y' ? 'top' : 'left';\n const maxSide = mainAxis === 'y' ? 'bottom' : 'right';\n const min = mainAxisCoord + overflow[minSide];\n const max = mainAxisCoord - overflow[maxSide];\n mainAxisCoord = clamp(min, mainAxisCoord, max);\n }\n if (checkCrossAxis) {\n const minSide = crossAxis === 'y' ? 'top' : 'left';\n const maxSide = crossAxis === 'y' ? 'bottom' : 'right';\n const min = crossAxisCoord + overflow[minSide];\n const max = crossAxisCoord - overflow[maxSide];\n crossAxisCoord = clamp(min, crossAxisCoord, max);\n }\n const limitedCoords = limiter.fn({\n ...state,\n [mainAxis]: mainAxisCoord,\n [crossAxis]: crossAxisCoord\n });\n return {\n ...limitedCoords,\n data: {\n x: limitedCoords.x - x,\n y: limitedCoords.y - y,\n enabled: {\n [mainAxis]: checkMainAxis,\n [crossAxis]: checkCrossAxis\n }\n }\n };\n }\n };\n};\n/**\n * Built-in `limiter` that will stop `shift()` at a certain point.\n */\nconst limitShift = function (options) {\n if (options === void 0) {\n options = {};\n }\n return {\n options,\n fn(state) {\n const {\n x,\n y,\n placement,\n rects,\n middlewareData\n } = state;\n const {\n offset = 0,\n mainAxis: checkMainAxis = true,\n crossAxis: checkCrossAxis = true\n } = evaluate(options, state);\n const coords = {\n x,\n y\n };\n const crossAxis = getSideAxis(placement);\n const mainAxis = getOppositeAxis(crossAxis);\n let mainAxisCoord = coords[mainAxis];\n let crossAxisCoord = coords[crossAxis];\n const rawOffset = evaluate(offset, state);\n const computedOffset = typeof rawOffset === 'number' ? {\n mainAxis: rawOffset,\n crossAxis: 0\n } : {\n mainAxis: 0,\n crossAxis: 0,\n ...rawOffset\n };\n if (checkMainAxis) {\n const len = mainAxis === 'y' ? 'height' : 'width';\n const limitMin = rects.reference[mainAxis] - rects.floating[len] + computedOffset.mainAxis;\n const limitMax = rects.reference[mainAxis] + rects.reference[len] - computedOffset.mainAxis;\n if (mainAxisCoord < limitMin) {\n mainAxisCoord = limitMin;\n } else if (mainAxisCoord > limitMax) {\n mainAxisCoord = limitMax;\n }\n }\n if (checkCrossAxis) {\n var _middlewareData$offse, _middlewareData$offse2;\n const len = mainAxis === 'y' ? 'width' : 'height';\n const isOriginSide = originSides.has(getSide(placement));\n const limitMin = rects.reference[crossAxis] - rects.floating[len] + (isOriginSide ? ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse[crossAxis]) || 0 : 0) + (isOriginSide ? 0 : computedOffset.crossAxis);\n const limitMax = rects.reference[crossAxis] + rects.reference[len] + (isOriginSide ? 0 : ((_middlewareData$offse2 = middlewareData.offset) == null ? void 0 : _middlewareData$offse2[crossAxis]) || 0) - (isOriginSide ? computedOffset.crossAxis : 0);\n if (crossAxisCoord < limitMin) {\n crossAxisCoord = limitMin;\n } else if (crossAxisCoord > limitMax) {\n crossAxisCoord = limitMax;\n }\n }\n return {\n [mainAxis]: mainAxisCoord,\n [crossAxis]: crossAxisCoord\n };\n }\n };\n};\n\n/**\n * Provides data that allows you to change the size of the floating element —\n * for instance, prevent it from overflowing the clipping boundary or match the\n * width of the reference element.\n * @see https://floating-ui.com/docs/size\n */\nconst size = function (options) {\n if (options === void 0) {\n options = {};\n }\n return {\n name: 'size',\n options,\n async fn(state) {\n var _state$middlewareData, _state$middlewareData2;\n const {\n placement,\n rects,\n platform,\n elements\n } = state;\n const {\n apply = () => {},\n ...detectOverflowOptions\n } = evaluate(options, state);\n const overflow = await platform.detectOverflow(state, detectOverflowOptions);\n const side = getSide(placement);\n const alignment = getAlignment(placement);\n const isYAxis = getSideAxis(placement) === 'y';\n const {\n width,\n height\n } = rects.floating;\n let heightSide;\n let widthSide;\n if (side === 'top' || side === 'bottom') {\n heightSide = side;\n widthSide = alignment === ((await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating))) ? 'start' : 'end') ? 'left' : 'right';\n } else {\n widthSide = side;\n heightSide = alignment === 'end' ? 'top' : 'bottom';\n }\n const maximumClippingHeight = height - overflow.top - overflow.bottom;\n const maximumClippingWidth = width - overflow.left - overflow.right;\n const overflowAvailableHeight = min(height - overflow[heightSide], maximumClippingHeight);\n const overflowAvailableWidth = min(width - overflow[widthSide], maximumClippingWidth);\n const noShift = !state.middlewareData.shift;\n let availableHeight = overflowAvailableHeight;\n let availableWidth = overflowAvailableWidth;\n if ((_state$middlewareData = state.middlewareData.shift) != null && _state$middlewareData.enabled.x) {\n availableWidth = maximumClippingWidth;\n }\n if ((_state$middlewareData2 = state.middlewareData.shift) != null && _state$middlewareData2.enabled.y) {\n availableHeight = maximumClippingHeight;\n }\n if (noShift && !alignment) {\n const xMin = max(overflow.left, 0);\n const xMax = max(overflow.right, 0);\n const yMin = max(overflow.top, 0);\n const yMax = max(overflow.bottom, 0);\n if (isYAxis) {\n availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max(overflow.left, overflow.right));\n } else {\n availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max(overflow.top, overflow.bottom));\n }\n }\n await apply({\n ...state,\n availableWidth,\n availableHeight\n });\n const nextDimensions = await platform.getDimensions(elements.floating);\n if (width !== nextDimensions.width || height !== nextDimensions.height) {\n return {\n reset: {\n rects: true\n }\n };\n }\n return {};\n }\n };\n};\n\nexport { arrow, autoPlacement, computePosition, detectOverflow, flip, hide, inline, limitShift, offset, shift, size };\n","function hasWindow() {\n return typeof window !== 'undefined';\n}\nfunction getNodeName(node) {\n if (isNode(node)) {\n return (node.nodeName || '').toLowerCase();\n }\n // Mocked nodes in testing environments may not be instances of Node. By\n // returning `#document` an infinite loop won't occur.\n // https://github.com/floating-ui/floating-ui/issues/2317\n return '#document';\n}\nfunction getWindow(node) {\n var _node$ownerDocument;\n return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;\n}\nfunction getDocumentElement(node) {\n var _ref;\n return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;\n}\nfunction isNode(value) {\n if (!hasWindow()) {\n return false;\n }\n return value instanceof Node || value instanceof getWindow(value).Node;\n}\nfunction isElement(value) {\n if (!hasWindow()) {\n return false;\n }\n return value instanceof Element || value instanceof getWindow(value).Element;\n}\nfunction isHTMLElement(value) {\n if (!hasWindow()) {\n return false;\n }\n return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;\n}\nfunction isShadowRoot(value) {\n if (!hasWindow() || typeof ShadowRoot === 'undefined') {\n return false;\n }\n return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;\n}\nfunction isOverflowElement(element) {\n const {\n overflow,\n overflowX,\n overflowY,\n display\n } = getComputedStyle(element);\n return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && display !== 'inline' && display !== 'contents';\n}\nfunction isTableElement(element) {\n return /^(table|td|th)$/.test(getNodeName(element));\n}\nfunction isTopLayer(element) {\n try {\n if (element.matches(':popover-open')) {\n return true;\n }\n } catch (_e) {\n // no-op\n }\n try {\n return element.matches(':modal');\n } catch (_e) {\n return false;\n }\n}\nconst willChangeRe = /transform|translate|scale|rotate|perspective|filter/;\nconst containRe = /paint|layout|strict|content/;\nconst isNotNone = value => !!value && value !== 'none';\nlet isWebKitValue;\nfunction isContainingBlock(elementOrCss) {\n const css = isElement(elementOrCss) ? getComputedStyle(elementOrCss) : elementOrCss;\n\n // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block\n // https://drafts.csswg.org/css-transforms-2/#individual-transforms\n return isNotNone(css.transform) || isNotNone(css.translate) || isNotNone(css.scale) || isNotNone(css.rotate) || isNotNone(css.perspective) || !isWebKit() && (isNotNone(css.backdropFilter) || isNotNone(css.filter)) || willChangeRe.test(css.willChange || '') || containRe.test(css.contain || '');\n}\nfunction getContainingBlock(element) {\n let currentNode = getParentNode(element);\n while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {\n if (isContainingBlock(currentNode)) {\n return currentNode;\n } else if (isTopLayer(currentNode)) {\n return null;\n }\n currentNode = getParentNode(currentNode);\n }\n return null;\n}\nfunction isWebKit() {\n if (isWebKitValue == null) {\n isWebKitValue = typeof CSS !== 'undefined' && CSS.supports && CSS.supports('-webkit-backdrop-filter', 'none');\n }\n return isWebKitValue;\n}\nfunction isLastTraversableNode(node) {\n return /^(html|body|#document)$/.test(getNodeName(node));\n}\nfunction getComputedStyle(element) {\n return getWindow(element).getComputedStyle(element);\n}\nfunction getNodeScroll(element) {\n if (isElement(element)) {\n return {\n scrollLeft: element.scrollLeft,\n scrollTop: element.scrollTop\n };\n }\n return {\n scrollLeft: element.scrollX,\n scrollTop: element.scrollY\n };\n}\nfunction getParentNode(node) {\n if (getNodeName(node) === 'html') {\n return node;\n }\n const result =\n // Step into the shadow DOM of the parent of a slotted node.\n node.assignedSlot ||\n // DOM Element detected.\n node.parentNode ||\n // ShadowRoot detected.\n isShadowRoot(node) && node.host ||\n // Fallback.\n getDocumentElement(node);\n return isShadowRoot(result) ? result.host : result;\n}\nfunction getNearestOverflowAncestor(node) {\n const parentNode = getParentNode(node);\n if (isLastTraversableNode(parentNode)) {\n return node.ownerDocument ? node.ownerDocument.body : node.body;\n }\n if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {\n return parentNode;\n }\n return getNearestOverflowAncestor(parentNode);\n}\nfunction getOverflowAncestors(node, list, traverseIframes) {\n var _node$ownerDocument2;\n if (list === void 0) {\n list = [];\n }\n if (traverseIframes === void 0) {\n traverseIframes = true;\n }\n const scrollableAncestor = getNearestOverflowAncestor(node);\n const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);\n const win = getWindow(scrollableAncestor);\n if (isBody) {\n const frameElement = getFrameElement(win);\n return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);\n } else {\n return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));\n }\n}\nfunction getFrameElement(win) {\n return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;\n}\n\nexport { getComputedStyle, getContainingBlock, getDocumentElement, getFrameElement, getNearestOverflowAncestor, getNodeName, getNodeScroll, getOverflowAncestors, getParentNode, getWindow, isContainingBlock, isElement, isHTMLElement, isLastTraversableNode, isNode, isOverflowElement, isShadowRoot, isTableElement, isTopLayer, isWebKit };\n","import { rectToClientRect, arrow as arrow$1, autoPlacement as autoPlacement$1, detectOverflow as detectOverflow$1, flip as flip$1, hide as hide$1, inline as inline$1, limitShift as limitShift$1, offset as offset$1, shift as shift$1, size as size$1, computePosition as computePosition$1 } from '@floating-ui/core';\nimport { round, createCoords, max, min, floor } from '@floating-ui/utils';\nimport { getComputedStyle as getComputedStyle$1, isHTMLElement, isElement, getWindow, isWebKit, getFrameElement, getNodeScroll, getDocumentElement, isTopLayer, getNodeName, isOverflowElement, getOverflowAncestors, getParentNode, isLastTraversableNode, isContainingBlock, isTableElement, getContainingBlock } from '@floating-ui/utils/dom';\nexport { getOverflowAncestors } from '@floating-ui/utils/dom';\n\nfunction getCssDimensions(element) {\n const css = getComputedStyle$1(element);\n // In testing environments, the `width` and `height` properties are empty\n // strings for SVG elements, returning NaN. Fallback to `0` in this case.\n let width = parseFloat(css.width) || 0;\n let height = parseFloat(css.height) || 0;\n const hasOffset = isHTMLElement(element);\n const offsetWidth = hasOffset ? element.offsetWidth : width;\n const offsetHeight = hasOffset ? element.offsetHeight : height;\n const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;\n if (shouldFallback) {\n width = offsetWidth;\n height = offsetHeight;\n }\n return {\n width,\n height,\n $: shouldFallback\n };\n}\n\nfunction unwrapElement(element) {\n return !isElement(element) ? element.contextElement : element;\n}\n\nfunction getScale(element) {\n const domElement = unwrapElement(element);\n if (!isHTMLElement(domElement)) {\n return createCoords(1);\n }\n const rect = domElement.getBoundingClientRect();\n const {\n width,\n height,\n $\n } = getCssDimensions(domElement);\n let x = ($ ? round(rect.width) : rect.width) / width;\n let y = ($ ? round(rect.height) : rect.height) / height;\n\n // 0, NaN, or Infinity should always fallback to 1.\n\n if (!x || !Number.isFinite(x)) {\n x = 1;\n }\n if (!y || !Number.isFinite(y)) {\n y = 1;\n }\n return {\n x,\n y\n };\n}\n\nconst noOffsets = /*#__PURE__*/createCoords(0);\nfunction getVisualOffsets(element) {\n const win = getWindow(element);\n if (!isWebKit() || !win.visualViewport) {\n return noOffsets;\n }\n return {\n x: win.visualViewport.offsetLeft,\n y: win.visualViewport.offsetTop\n };\n}\nfunction shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {\n if (isFixed === void 0) {\n isFixed = false;\n }\n if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {\n return false;\n }\n return isFixed;\n}\n\nfunction getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {\n if (includeScale === void 0) {\n includeScale = false;\n }\n if (isFixedStrategy === void 0) {\n isFixedStrategy = false;\n }\n const clientRect = element.getBoundingClientRect();\n const domElement = unwrapElement(element);\n let scale = createCoords(1);\n if (includeScale) {\n if (offsetParent) {\n if (isElement(offsetParent)) {\n scale = getScale(offsetParent);\n }\n } else {\n scale = getScale(element);\n }\n }\n const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);\n let x = (clientRect.left + visualOffsets.x) / scale.x;\n let y = (clientRect.top + visualOffsets.y) / scale.y;\n let width = clientRect.width / scale.x;\n let height = clientRect.height / scale.y;\n if (domElement) {\n const win = getWindow(domElement);\n const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;\n let currentWin = win;\n let currentIFrame = getFrameElement(currentWin);\n while (currentIFrame && offsetParent && offsetWin !== currentWin) {\n const iframeScale = getScale(currentIFrame);\n const iframeRect = currentIFrame.getBoundingClientRect();\n const css = getComputedStyle$1(currentIFrame);\n const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;\n const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;\n x *= iframeScale.x;\n y *= iframeScale.y;\n width *= iframeScale.x;\n height *= iframeScale.y;\n x += left;\n y += top;\n currentWin = getWindow(currentIFrame);\n currentIFrame = getFrameElement(currentWin);\n }\n }\n return rectToClientRect({\n width,\n height,\n x,\n y\n });\n}\n\n// If <html> has a CSS width greater than the viewport, then this will be\n// incorrect for RTL.\nfunction getWindowScrollBarX(element, rect) {\n const leftScroll = getNodeScroll(element).scrollLeft;\n if (!rect) {\n return getBoundingClientRect(getDocumentElement(element)).left + leftScroll;\n }\n return rect.left + leftScroll;\n}\n\nfunction getHTMLOffset(documentElement, scroll) {\n const htmlRect = documentElement.getBoundingClientRect();\n const x = htmlRect.left + scroll.scrollLeft - getWindowScrollBarX(documentElement, htmlRect);\n const y = htmlRect.top + scroll.scrollTop;\n return {\n x,\n y\n };\n}\n\nfunction convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {\n let {\n elements,\n rect,\n offsetParent,\n strategy\n } = _ref;\n const isFixed = strategy === 'fixed';\n const documentElement = getDocumentElement(offsetParent);\n const topLayer = elements ? isTopLayer(elements.floating) : false;\n if (offsetParent === documentElement || topLayer && isFixed) {\n return rect;\n }\n let scroll = {\n scrollLeft: 0,\n scrollTop: 0\n };\n let scale = createCoords(1);\n const offsets = createCoords(0);\n const isOffsetParentAnElement = isHTMLElement(offsetParent);\n if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {\n if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {\n scroll = getNodeScroll(offsetParent);\n }\n if (isOffsetParentAnElement) {\n const offsetRect = getBoundingClientRect(offsetParent);\n scale = getScale(offsetParent);\n offsets.x = offsetRect.x + offsetParent.clientLeft;\n offsets.y = offsetRect.y + offsetParent.clientTop;\n }\n }\n const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);\n return {\n width: rect.width * scale.x,\n height: rect.height * scale.y,\n x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x,\n y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y\n };\n}\n\nfunction getClientRects(element) {\n return Array.from(element.getClientRects());\n}\n\n// Gets the entire size of the scrollable document area, even extending outside\n// of the `<html>` and `<body>` rect bounds if horizontally scrollable.\nfunction getDocumentRect(element) {\n const html = getDocumentElement(element);\n const scroll = getNodeScroll(element);\n const body = element.ownerDocument.body;\n const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);\n const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);\n let x = -scroll.scrollLeft + getWindowScrollBarX(element);\n const y = -scroll.scrollTop;\n if (getComputedStyle$1(body).direction === 'rtl') {\n x += max(html.clientWidth, body.clientWidth) - width;\n }\n return {\n width,\n height,\n x,\n y\n };\n}\n\n// Safety check: ensure the scrollbar space is reasonable in case this\n// calculation is affected by unusual styles.\n// Most scrollbars leave 15-18px of space.\nconst SCROLLBAR_MAX = 25;\nfunction getViewportRect(element, strategy) {\n const win = getWindow(element);\n const html = getDocumentElement(element);\n const visualViewport = win.visualViewport;\n let width = html.clientWidth;\n let height = html.clientHeight;\n let x = 0;\n let y = 0;\n if (visualViewport) {\n width = visualViewport.width;\n height = visualViewport.height;\n const visualViewportBased = isWebKit();\n if (!visualViewportBased || visualViewportBased && strategy === 'fixed') {\n x = visualViewport.offsetLeft;\n y = visualViewport.offsetTop;\n }\n }\n const windowScrollbarX = getWindowScrollBarX(html);\n // <html> `overflow: hidden` + `scrollbar-gutter: stable` reduces the\n // visual width of the <html> but this is not considered in the size\n // of `html.clientWidth`.\n if (windowScrollbarX <= 0) {\n const doc = html.ownerDocument;\n const body = doc.body;\n const bodyStyles = getComputedStyle(body);\n const bodyMarginInline = doc.compatMode === 'CSS1Compat' ? parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight) || 0 : 0;\n const clippingStableScrollbarWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline);\n if (clippingStableScrollbarWidth <= SCROLLBAR_MAX) {\n width -= clippingStableScrollbarWidth;\n }\n } else if (windowScrollbarX <= SCROLLBAR_MAX) {\n // If the <body> scrollbar is on the left, the width needs to be extended\n // by the scrollbar amount so there isn't extra space on the right.\n width += windowScrollbarX;\n }\n return {\n width,\n height,\n x,\n y\n };\n}\n\n// Returns the inner client rect, subtracting scrollbars if present.\nfunction getInnerBoundingClientRect(element, strategy) {\n const clientRect = getBoundingClientRect(element, true, strategy === 'fixed');\n const top = clientRect.top + element.clientTop;\n const left = clientRect.left + element.clientLeft;\n const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);\n const width = element.clientWidth * scale.x;\n const height = element.clientHeight * scale.y;\n const x = left * scale.x;\n const y = top * scale.y;\n return {\n width,\n height,\n x,\n y\n };\n}\nfunction getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {\n let rect;\n if (clippingAncestor === 'viewport') {\n rect = getViewportRect(element, strategy);\n } else if (clippingAncestor === 'document') {\n rect = getDocumentRect(getDocumentElement(element));\n } else if (isElement(clippingAncestor)) {\n rect = getInnerBoundingClientRect(clippingAncestor, strategy);\n } else {\n const visualOffsets = getVisualOffsets(element);\n rect = {\n x: clippingAncestor.x - visualOffsets.x,\n y: clippingAncestor.y - visualOffsets.y,\n width: clippingAncestor.width,\n height: clippingAncestor.height\n };\n }\n return rectToClientRect(rect);\n}\nfunction hasFixedPositionAncestor(element, stopNode) {\n const parentNode = getParentNode(element);\n if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {\n return false;\n }\n return getComputedStyle$1(parentNode).position === 'fixed' || hasFixedPositionAncestor(parentNode, stopNode);\n}\n\n// A \"clipping ancestor\" is an `overflow` element with the characteristic of\n// clipping (or hiding) child elements. This returns all clipping ancestors\n// of the given element up the tree.\nfunction getClippingElementAncestors(element, cache) {\n const cachedResult = cache.get(element);\n if (cachedResult) {\n return cachedResult;\n }\n let result = getOverflowAncestors(element, [], false).filter(el => isElement(el) && getNodeName(el) !== 'body');\n let currentContainingBlockComputedStyle = null;\n const elementIsFixed = getComputedStyle$1(element).position === 'fixed';\n let currentNode = elementIsFixed ? getParentNode(element) : element;\n\n // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block\n while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {\n const computedStyle = getComputedStyle$1(currentNode);\n const currentNodeIsContaining = isContainingBlock(currentNode);\n if (!currentNodeIsContaining && computedStyle.position === 'fixed') {\n currentContainingBlockComputedStyle = null;\n }\n const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && (currentContainingBlockComputedStyle.position === 'absolute' || currentContainingBlockComputedStyle.position === 'fixed') || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);\n if (shouldDropCurrentNode) {\n // Drop non-containing blocks.\n result = result.filter(ancestor => ancestor !== currentNode);\n } else {\n // Record last containing block for next iteration.\n currentContainingBlockComputedStyle = computedStyle;\n }\n currentNode = getParentNode(currentNode);\n }\n cache.set(element, result);\n return result;\n}\n\n// Gets the maximum area that the element is visible in due to any number of\n// clipping ancestors.\nfunction getClippingRect(_ref) {\n let {\n element,\n boundary,\n rootBoundary,\n strategy\n } = _ref;\n const elementClippingAncestors = boundary === 'clippingAncestors' ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);\n const clippingAncestors = [...elementClippingAncestors, rootBoundary];\n const firstRect = getClientRectFromClippingAncestor(element, clippingAncestors[0], strategy);\n let top = firstRect.top;\n let right = firstRect.right;\n let bottom = firstRect.bottom;\n let left = firstRect.left;\n for (let i = 1; i < clippingAncestors.length; i++) {\n const rect = getClientRectFromClippingAncestor(element, clippingAncestors[i], strategy);\n top = max(rect.top, top);\n right = min(rect.right, right);\n bottom = min(rect.bottom, bottom);\n left = max(rect.left, left);\n }\n return {\n width: right - left,\n height: bottom - top,\n x: left,\n y: top\n };\n}\n\nfunction getDimensions(element) {\n const {\n width,\n height\n } = getCssDimensions(element);\n return {\n width,\n height\n };\n}\n\nfunction getRectRelativeToOffsetParent(element, offsetParent, strategy) {\n const isOffsetParentAnElement = isHTMLElement(offsetParent);\n const documentElement = getDocumentElement(offsetParent);\n const isFixed = strategy === 'fixed';\n const rect = getBoundingClientRect(element, true, isFixed, offsetParent);\n let scroll = {\n scrollLeft: 0,\n scrollTop: 0\n };\n const offsets = createCoords(0);\n\n // If the <body> scrollbar appears on the left (e.g. RTL systems). Use\n // Firefox with layout.scrollbar.side = 3 in about:config to test this.\n function setLeftRTLScrollbarOffset() {\n offsets.x = getWindowScrollBarX(documentElement);\n }\n if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {\n if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {\n scroll = getNodeScroll(offsetParent);\n }\n if (isOffsetParentAnElement) {\n const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);\n offsets.x = offsetRect.x + offsetParent.clientLeft;\n offsets.y = offsetRect.y + offsetParent.clientTop;\n } else if (documentElement) {\n setLeftRTLScrollbarOffset();\n }\n }\n if (isFixed && !isOffsetParentAnElement && documentElement) {\n setLeftRTLScrollbarOffset();\n }\n const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);\n const x = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x;\n const y = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y;\n return {\n x,\n y,\n width: rect.width,\n height: rect.height\n };\n}\n\nfunction isStaticPositioned(element) {\n return getComputedStyle$1(element).position === 'static';\n}\n\nfunction getTrueOffsetParent(element, polyfill) {\n if (!isHTMLElement(element) || getComputedStyle$1(element).position === 'fixed') {\n return null;\n }\n if (polyfill) {\n return polyfill(element);\n }\n let rawOffsetParent = element.offsetParent;\n\n // Firefox returns the <html> element as the offsetParent if it's non-static,\n // while Chrome and Safari return the <body> element. The <body> element must\n // be used to perform the correct calculations even if the <html> element is\n // non-static.\n if (getDocumentElement(element) === rawOffsetParent) {\n rawOffsetParent = rawOffsetParent.ownerDocument.body;\n }\n return rawOffsetParent;\n}\n\n// Gets the closest ancestor positioned element. Handles some edge cases,\n// such as table ancestors and cross browser bugs.\nfunction getOffsetParent(element, polyfill) {\n const win = getWindow(element);\n if (isTopLayer(element)) {\n return win;\n }\n if (!isHTMLElement(element)) {\n let svgOffsetParent = getParentNode(element);\n while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {\n if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {\n return svgOffsetParent;\n }\n svgOffsetParent = getParentNode(svgOffsetParent);\n }\n return win;\n }\n let offsetParent = getTrueOffsetParent(element, polyfill);\n while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {\n offsetParent = getTrueOffsetParent(offsetParent, polyfill);\n }\n if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) {\n return win;\n }\n return offsetParent || getContainingBlock(element) || win;\n}\n\nconst getElementRects = async function (data) {\n const getOffsetParentFn = this.getOffsetParent || getOffsetParent;\n const getDimensionsFn = this.getDimensions;\n const floatingDimensions = await getDimensionsFn(data.floating);\n return {\n reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),\n floating: {\n x: 0,\n y: 0,\n width: floatingDimensions.width,\n height: floatingDimensions.height\n }\n };\n};\n\nfunction isRTL(element) {\n return getComputedStyle$1(element).direction === 'rtl';\n}\n\nconst platform = {\n convertOffsetParentRelativeRectToViewportRelativeRect,\n getDocumentElement,\n getClippingRect,\n getOffsetParent,\n getElementRects,\n getClientRects,\n getDimensions,\n getScale,\n isElement,\n isRTL\n};\n\nfunction rectsAreEqual(a, b) {\n return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;\n}\n\n// https://samthor.au/2021/observing-dom/\nfunction observeMove(element, onMove) {\n let io = null;\n let timeoutId;\n const root = getDocumentElement(element);\n function cleanup() {\n var _io;\n clearTimeout(timeoutId);\n (_io = io) == null || _io.disconnect();\n io = null;\n }\n function refresh(skip, threshold) {\n if (skip === void 0) {\n skip = false;\n }\n if (threshold === void 0) {\n threshold = 1;\n }\n cleanup();\n const elementRectForRootMargin = element.getBoundingClientRect();\n const {\n left,\n top,\n width,\n height\n } = elementRectForRootMargin;\n if (!skip) {\n onMove();\n }\n if (!width || !height) {\n return;\n }\n const insetTop = floor(top);\n const insetRight = floor(root.clientWidth - (left + width));\n const insetBottom = floor(root.clientHeight - (top + height));\n const insetLeft = floor(left);\n const rootMargin = -insetTop + \"px \" + -insetRight + \"px \" + -insetBottom + \"px \" + -insetLeft + \"px\";\n const options = {\n rootMargin,\n threshold: max(0, min(1, threshold)) || 1\n };\n let isFirstUpdate = true;\n function handleObserve(entries) {\n const ratio = entries[0].intersectionRatio;\n if (ratio !== threshold) {\n if (!isFirstUpdate) {\n return refresh();\n }\n if (!ratio) {\n // If the reference is clipped, the ratio is 0. Throttle the refresh\n // to prevent an infinite loop of updates.\n timeoutId = setTimeout(() => {\n refresh(false, 1e-7);\n }, 1000);\n } else {\n refresh(false, ratio);\n }\n }\n if (ratio === 1 && !rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) {\n // It's possible that even though the ratio is reported as 1, the\n // element is not actually fully within the IntersectionObserver's root\n // area anymore. This can happen under performance constraints. This may\n // be a bug in the browser's IntersectionObserver implementation. To\n // work around this, we compare the element's bounding rect now with\n // what it was at the time we created the IntersectionObserver. If they\n // are not equal then the element moved, so we refresh.\n refresh();\n }\n isFirstUpdate = false;\n }\n\n // Older browsers don't support a `document` as the root and will throw an\n // error.\n try {\n io = new IntersectionObserver(handleObserve, {\n ...options,\n // Handle <iframe>s\n root: root.ownerDocument\n });\n } catch (_e) {\n io = new IntersectionObserver(handleObserve, options);\n }\n io.observe(element);\n }\n refresh(true);\n return cleanup;\n}\n\n/**\n * Automatically updates the position of the floating element when necessary.\n * Should only be called when the floating element is mounted on the DOM or\n * visible on the screen.\n * @returns cleanup function that should be invoked when the floating element is\n * removed from the DOM or hidden from the screen.\n * @see https://floating-ui.com/docs/autoUpdate\n */\nfunction autoUpdate(reference, floating, update, options) {\n if (options === void 0) {\n options = {};\n }\n const {\n ancestorScroll = true,\n ancestorResize = true,\n elementResize = typeof ResizeObserver === 'function',\n layoutShift = typeof IntersectionObserver === 'function',\n animationFrame = false\n } = options;\n const referenceEl = unwrapElement(reference);\n const ancestors = ancestorScroll || ancestorResize ? [...(referenceEl ? getOverflowAncestors(referenceEl) : []), ...(floating ? getOverflowAncestors(floating) : [])] : [];\n ancestors.forEach(ancestor => {\n ancestorScroll && ancestor.addEventListener('scroll', update, {\n passive: true\n });\n ancestorResize && ancestor.addEventListener('resize', update);\n });\n const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null;\n let reobserveFrame = -1;\n let resizeObserver = null;\n if (elementResize) {\n resizeObserver = new ResizeObserver(_ref => {\n let [firstEntry] = _ref;\n if (firstEntry && firstEntry.target === referenceEl && resizeObserver && floating) {\n // Prevent update loops when using the `size` middleware.\n // https://github.com/floating-ui/floating-ui/issues/1740\n resizeObserver.unobserve(floating);\n cancelAnimationFrame(reobserveFrame);\n reobserveFrame = requestAnimationFrame(() => {\n var _resizeObserver;\n (_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating);\n });\n }\n update();\n });\n if (referenceEl && !animationFrame) {\n resizeObserver.observe(referenceEl);\n }\n if (floating) {\n resizeObserver.observe(floating);\n }\n }\n let frameId;\n let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;\n if (animationFrame) {\n frameLoop();\n }\n function frameLoop() {\n const nextRefRect = getBoundingClientRect(reference);\n if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) {\n update();\n }\n prevRefRect = nextRefRect;\n frameId = requestAnimationFrame(frameLoop);\n }\n update();\n return () => {\n var _resizeObserver2;\n ancestors.forEach(ancestor => {\n ancestorScroll && ancestor.removeEventListener('scroll', update);\n ancestorResize && ancestor.removeEventListener('resize', update);\n });\n cleanupIo == null || cleanupIo();\n (_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect();\n resizeObserver = null;\n if (animationFrame) {\n cancelAnimationFrame(frameId);\n }\n };\n}\n\n/**\n * Resolves with an object of overflow side offsets that determine how much the\n * element is overflowing a given clipping boundary on each side.\n * - positive = overflowing the boundary by that number of pixels\n * - negative = how many pixels left before it will overflow\n * - 0 = lies flush with the boundary\n * @see https://floating-ui.com/docs/detectOverflow\n */\nconst detectOverflow = detectOverflow$1;\n\n/**\n * Modifies the placement by translating the floating element along the\n * specified axes.\n * A number (shorthand for `mainAxis` or distance), or an axes configuration\n * object may be passed.\n * @see https://floating-ui.com/docs/offset\n */\nconst offset = offset$1;\n\n/**\n * Optimizes the visibility of the floating element by choosing the placement\n * that has the most space available automatically, without needing to specify a\n * preferred placement. Alternative to `flip`.\n * @see https://floating-ui.com/docs/autoPlacement\n */\nconst autoPlacement = autoPlacement$1;\n\n/**\n * Optimizes the visibility of the floating element by shifting it in order to\n * keep it in view when it will overflow the clipping boundary.\n * @see https://floating-ui.com/docs/shift\n */\nconst shift = shift$1;\n\n/**\n * Optimizes the visibility of the floating element by flipping the `placement`\n * in order to keep it in view when the preferred placement(s) will overflow the\n * clipping boundary. Alternative to `autoPlacement`.\n * @see https://floating-ui.com/docs/flip\n */\nconst flip = flip$1;\n\n/**\n * Provides data that allows you to change the size of the floating element —\n * for instance, prevent it from overflowing the clipping boundary or match the\n * width of the reference element.\n * @see https://floating-ui.com/docs/size\n */\nconst size = size$1;\n\n/**\n * Provides data to hide the floating element in applicable situations, such as\n * when it is not in the same clipping context as the reference element.\n * @see https://floating-ui.com/docs/hide\n */\nconst hide = hide$1;\n\n/**\n * Provides data to position an inner element of the floating element so that it\n * appears centered to the reference element.\n * @see https://floating-ui.com/docs/arrow\n */\nconst arrow = arrow$1;\n\n/**\n * Provides improved positioning for inline reference elements that can span\n * over multiple lines, such as hyperlinks or range selections.\n * @see https://floating-ui.com/docs/inline\n */\nconst inline = inline$1;\n\n/**\n * Built-in `limiter` that will stop `shift()` at a certain point.\n */\nconst limitShift = limitShift$1;\n\n/**\n * Computes the `x` and `y` coordinates that will place the floating element\n * next to a given reference element.\n */\nconst computePosition = (reference, floating, options) => {\n // This caches the expensive `getClippingElementAncestors` function so that\n // multiple lifecycle resets re-use the same result. It only lives for a\n // single call. If other functions become expensive, we can add them as well.\n const cache = new Map();\n const mergedOptions = {\n platform,\n ...options\n };\n const platformWithCache = {\n ...mergedOptions.platform,\n _c: cache\n };\n return computePosition$1(reference, floating, {\n ...mergedOptions,\n platform: platformWithCache\n });\n};\n\nexport { arrow, autoPlacement, autoUpdate, computePosition, detectOverflow, flip, hide, inline, limitShift, offset, platform, shift, size };\n","//@ts-ignore\nimport { arrow as arrowCore } from \"./core\";\nimport { autoUpdate as _autoUpdate, computePosition } from \"./dom/index.js\";\nimport { get } from \"svelte/store\";\nimport { onDestroy, tick } from 'svelte';\nexport function createFloatingActions(initOptions) {\n let referenceElement;\n let floatingElement;\n const defaultOptions = {\n autoUpdate: true\n };\n let options = initOptions;\n const getOptions = (mixin) => {\n return { ...defaultOptions, ...(initOptions || {}), ...(mixin || {}) };\n };\n const updatePosition = (updateOptions) => {\n if (referenceElement && floatingElement) {\n options = getOptions(updateOptions);\n computePosition(referenceElement, floatingElement, options)\n .then(v => {\n Object.assign(floatingElement.style, {\n position: v.strategy,\n left: `${v.x}px`,\n top: `${v.y}px`,\n });\n options?.onComputed && options.onComputed(v);\n });\n }\n };\n const referenceAction = node => {\n if ('subscribe' in node) {\n setupVirtualElementObserver(node);\n return {};\n }\n else {\n referenceElement = node;\n updatePosition();\n }\n };\n const contentAction = (node, contentOptions) => {\n let autoUpdateDestroy;\n floatingElement = node;\n options = getOptions(contentOptions);\n setTimeout(() => updatePosition(contentOptions), 0); //tick doesn't work\n updatePosition(contentOptions);\n const destroyAutoUpdate = () => {\n if (autoUpdateDestroy) {\n autoUpdateDestroy();\n autoUpdateDestroy = undefined;\n }\n };\n const initAutoUpdate = ({ autoUpdate } = options || {}) => {\n destroyAutoUpdate();\n if (autoUpdate !== false) {\n tick().then(() => {\n return _autoUpdate(referenceElement, floatingElement, () => updatePosition(options), (autoUpdate === true ? {} : autoUpdate));\n });\n }\n return;\n };\n autoUpdateDestroy = initAutoUpdate();\n return {\n update(contentOptions) {\n updatePosition(contentOptions);\n autoUpdateDestroy = initAutoUpdate(contentOptions);\n },\n destroy() {\n destroyAutoUpdate();\n }\n };\n };\n const setupVirtualElementObserver = (node) => {\n const unsubscribe = node.subscribe(($node) => {\n if (referenceElement === undefined) {\n referenceElement = $node;\n updatePosition();\n }\n else {\n // Preserve the reference to the virtual element.\n Object.assign(referenceElement, $node);\n updatePosition();\n }\n });\n onDestroy(unsubscribe);\n };\n return [\n referenceAction,\n contentAction,\n updatePosition\n ];\n}\nexport function arrow(options) {\n return {\n name: \"arrow\",\n options,\n fn(args) {\n const element = get(options.element);\n if (element) {\n return arrowCore({\n element,\n padding: options.padding\n }).fn(args);\n }\n return {};\n }\n };\n}\n","export default function filter({\n loadOptions,\n filterText,\n items,\n multiple,\n value,\n itemId,\n groupBy,\n filterSelectedItems,\n itemFilter,\n convertStringItemsToObjects,\n filterGroupedItems,\n label,\n}) {\n if (items && loadOptions) return items;\n if (!items) return [];\n\n if (items && items.length > 0 && typeof items[0] !== 'object') {\n items = convertStringItemsToObjects(items);\n }\n\n let filterResults = items.filter((item) => {\n let matchesFilter = itemFilter(item[label], filterText, item);\n if (matchesFilter && multiple && value?.length) {\n matchesFilter = !value.some((x) => {\n return filterSelectedItems ? x[itemId] === item[itemId] : false;\n });\n }\n\n return matchesFilter;\n });\n\n if (groupBy) {\n filterResults = filterGroupedItems(filterResults);\n }\n\n return filterResults;\n}\n","export default async function getItems({ dispatch, loadOptions, convertStringItemsToObjects, filterText }) {\n let res = await loadOptions(filterText).catch((err) => {\n console.warn('svelte-select loadOptions error :>> ', err);\n dispatch('error', { type: 'loadOptions', details: err });\n });\n\n if (res && !res.cancelled) { \n if (res) {\n if (res && res.length > 0 && typeof res[0] !== 'object') {\n res = convertStringItemsToObjects(res);\n }\n \n dispatch('loaded', { items: res });\n } else {\n res = [];\n }\n\n return {\n filteredItems: res,\n loading: false,\n focused: true,\n listOpen: true,\n };\n }\n}\n","<svg\n width=\"100%\"\n height=\"100%\"\n viewBox=\"-2 -2 50 50\"\n focusable=\"false\"\n aria-hidden=\"true\"\n role=\"presentation\"\n>\n <path\n fill=\"currentColor\"\n d=\"M34.923,37.251L24,26.328L13.077,37.251L9.436,33.61l10.923-10.923L9.436,11.765l3.641-3.641L24,19.047L34.923,8.124\n l3.641,3.641L27.641,22.688L38.564,33.61L34.923,37.251z\"\n />\n</svg>\n\n<style>\n svg {\n width: var(--clear-icon-width, 20px);\n height: var(--clear-icon-width, 20px);\n color: var(--clear-icon-color, currentColor);\n }\n</style>","<script>\n import { beforeUpdate, createEventDispatcher, onDestroy, onMount } from 'svelte';\n import { offset, flip, shift } from 'svelte-floating-ui/dom';\n import { createFloatingActions } from 'svelte-floating-ui';\n\n const dispatch = createEventDispatcher();\n\n import _filter from './filter';\n import _getItems from './get-items';\n\n import ChevronIcon from './ChevronIcon.svelte';\n import ClearIcon from './ClearIcon.svelte';\n import LoadingIcon from './LoadingIcon.svelte';\n\n export let justValue = null; // read-only\n\n export let filter = _filter;\n export let getItems = _getItems;\n\n export let id = null;\n export let name = null;\n export let container = undefined;\n export let input = undefined;\n export let multiple = false;\n export let multiFullItemClearable = false;\n export let disabled = false;\n export let focused = false;\n export let value = null;\n export let filterText = '';\n export let placeholder = 'Please select';\n export let placeholderAlwaysShow = false;\n export let items = null;\n export let label = 'label';\n export let itemFilter = (label, filterText, option) => `${label}`.toLowerCase().includes(filterText.toLowerCase());\n export let groupBy = undefined;\n export let groupFilter = (groups) => groups;\n export let groupHeaderSelectable = false;\n export let itemId = 'value';\n export let loadOptions = undefined;\n export let containerStyles = '';\n export let hasError = false;\n export let filterSelectedItems = true;\n export let required = false;\n export let closeListOnChange = true;\n export let clearFilterTextOnBlur = true;\n\n export let createGroupHeaderItem = (groupValue, item) => {\n return {\n value: groupValue,\n [label]: groupValue,\n };\n };\n\n export const getFilteredItems = () => {\n return filteredItems;\n };\n\n export let searchable = true;\n export let inputStyles = '';\n export let clearable = true;\n export let loading = false;\n export let listOpen = false;\n\n let timeout;\n export let debounce = (fn, wait = 1) => {\n clearTimeout(timeout);\n timeout = setTimeout(fn, wait);\n };\n\n export let debounceWait = 300;\n export let hideEmptyState = false;\n export let inputAttributes = {};\n export let listAutoWidth = true;\n export let showChevron = false;\n export let listOffset = 5;\n export let hoverItemIndex = 0;\n export let floatingConfig = {};\n\n export { containerClasses as class };\n\n let containerClasses = '';\n let activeValue;\n let prev_value;\n let prev_filterText;\n let prev_multiple;\n\n function setValue() {\n if (typeof value === 'string') {\n let item = (items || []).find((item) => item[itemId] === value);\n value = item || {\n [itemId]: value,\n label: value,\n };\n } else if (multiple && Array.isArray(value) && value.length > 0) {\n value = value.map((item) => (typeof item === 'string' ? { value: item, label: item } : item));\n }\n }\n\n let _inputAttributes;\n function assignInputAttributes() {\n _inputAttributes = Object.assign(\n {\n autocapitalize: 'none',\n autocomplete: 'off',\n autocorrect: 'off',\n spellcheck: false,\n tabindex: 0,\n type: 'text',\n 'aria-autocomplete': 'list',\n },\n inputAttributes\n );\n\n if (id) {\n _inputAttributes['id'] = id;\n }\n\n if (!searchable) {\n _inputAttributes['readonly'] = true;\n }\n }\n\n function convertStringItemsToObjects(_items) {\n return _items.map((item, index) => {\n return {\n index,\n value: item,\n label: `${item}`,\n };\n });\n }\n\n function filterGroupedItems(_items) {\n const groupValues = [];\n const groups = {};\n\n _items.forEach((item) => {\n const groupValue = groupBy(item);\n\n if (!groupValues.includes(groupValue)) {\n groupValues.push(groupValue);\n groups[groupValue] = [];\n\n if (groupValue) {\n groups[groupValue].push(\n Object.assign(createGroupHeaderItem(groupValue, item), {\n id: groupValue,\n groupHeader: true,\n selectable: groupHeaderSelectable,\n })\n );\n }\n }\n\n groups[groupValue].push(Object.assign({ groupItem: !!groupValue }, item));\n });\n\n const sortedGroupedItems = [];\n\n groupFilter(groupValues).forEach((groupValue) => {\n if (groups[groupValue]) sortedGroupedItems.push(...groups[groupValue]);\n });\n\n return sortedGroupedItems;\n }\n\n function dispatchSelectedItem() {\n if (multiple) {\n if (JSON.stringify(value) !== JSON.stringify(prev_value)) {\n if (checkValueForDuplicates()) {\n dispatch('input', value);\n }\n }\n return;\n }\n\n if (!prev_value || JSON.stringify(value[itemId]) !== JSON.stringify(prev_value[itemId])) {\n dispatch('input', value);\n }\n }\n\n function setupMulti() {\n if (value) {\n if (Array.isArray(value)) {\n value = [...value];\n } else {\n value = [value];\n }\n }\n }\n\n function setupSingle() {\n if (value) value = null;\n }\n\n $: if ((items, value)) setValue();\n $: if (inputAttributes || !searchable) assignInputAttributes();\n $: if (multiple) setupMulti();\n $: if (prev_multiple && !multiple) setupSingle();\n $: if (multiple && value && value.length > 1) checkValueForDuplicates();\n $: if (value) dispatchSelectedItem();\n $: if (!value && multiple && prev_value) dispatch('input', value);\n $: if (!focused && input) closeList();\n $: if (filterText !== prev_filterText) setupFilterText();\n $: if (!multiple && listOpen && value && filteredItems) setValueIndexAsHoverIndex();\n $: dispatchHover(hoverItemIndex);\n\n function setValueIndexAsHoverIndex() {\n const valueIndex = filteredItems.findIndex((i) => {\n return i[itemId] === value[itemId];\n });\n\n checkHoverSelectable(valueIndex, true);\n }\n\n function dispatchHover(i) {\n dispatch('hoverItem', i);\n }\n\n function checkHoverSelectable(startingIndex = 0, ignoreGroup) {\n hoverItemIndex = startingIndex < 0 ? 0 : startingIndex;\n if (!ignoreGroup && groupBy && filteredItems[hoverItemIndex] && !filteredItems[hoverItemIndex].selectable) {\n setHoverIndex(1);\n }\n }\n\n function setupFilterText() {\n if (!loadOptions && filterText.length === 0) return;\n\n if (loadOptions) {\n debounce(async function () {\n loading = true;\n let res = await getItems({\n dispatch,\n loadOptions,\n convertStringItemsToObjects,\n filterText,\n });\n\n if (res) {\n loading = res.loading;\n listOpen = listOpen ? res.listOpen : filterText.length > 0 ? true : false;\n focused = listOpen && res.focused;\n items = groupBy ? filterGroupedItems(res.filteredItems) : res.filteredItems;\n } else {\n loading = false;\n focused = true;\n listOpen = true;\n }\n }, debounceWait);\n } else {\n listOpen = true;\n\n if (multiple) {\n activeValue = undefined;\n }\n }\n }\n\n $: hasValue = multiple ? value && value.length > 0 : value;\n $: hideSelectedItem = hasValue && filterText.length > 0;\n $: showClear = hasValue && clearable && !disabled && !loading;\n $: placeholderText =\n placeholderAlwaysShow && multiple\n ? placeholder\n : multiple && value?.length === 0\n ? placeholder\n : value\n ? ''\n : placeholder;\n $: ariaSelection = value ? handleAriaSelection(multiple) : '';\n $: ariaContext = handleAriaContent({ filteredItems, hoverItemIndex, focused, listOpen });\n $: updateValueDisplay(items);\n $: justValue = computeJustValue(multiple, value, itemId);\n $: if (!multiple && prev_value && !value) dispatch('input', value);\n $: filteredItems = filter({\n loadOptions,\n filterText,\n items,\n multiple,\n value,\n itemId,\n groupBy,\n label,\n filterSelectedItems,\n itemFilter,\n convertStringItemsToObjects,\n filterGroupedItems,\n });\n $: if (listOpen && filteredItems && !multiple && !value) checkHoverSelectable();\n $: handleFilterEvent(filteredItems);\n $: if (container && floatingConfig) floatingUpdate(Object.assign(_floatingConfig, floatingConfig));\n $: listDom = !!list;\n $: listMounted(list, listOpen);\n $: if (listOpen && container && list) setListWidth();\n $: scrollToHoverItem = hoverItemIndex;\n $: if (listOpen && multiple) hoverItemIndex = 0;\n $: if (input && listOpen && !focused) handleFocus();\n $: if (filterText) hoverItemIndex = 0;\n\n function handleFilterEvent(items) {\n if (listOpen) dispatch('filter', items);\n }\n\n beforeUpdate(async () => {\n prev_value = value;\n prev_filterText = filterText;\n prev_multiple = multiple;\n });\n\n function computeJustValue() {\n if (multiple) return value ? value.map((item) => item[itemId]) : null;\n return value ? value[itemId] : value;\n }\n\n function checkValueForDuplicates() {\n let noDuplicates = true;\n if (value) {\n const ids = [];\n const uniqueValues = [];\n\n value.forEach((val) => {\n if (!ids.includes(val[itemId])) {\n ids.push(val[itemId]);\n uniqueValues.push(val);\n } else {\n noDuplicates = false;\n }\n });\n\n if (!noDuplicates) value = uniqueValues;\n }\n return noDuplicates;\n }\n\n function findItem(selection) {\n let matchTo = selection ? selection[itemId] : value[itemId];\n return items.find((item) => item[itemId] === matchTo);\n }\n\n function updateValueDisplay(items) {\n if (!items || items.length === 0 || items.some((item) => typeof item !== 'object')) return;\n if (!value || (multiple ? value.some((selection) => !selection || !selection[itemId]) : !value[itemId])) return;\n\n if (Array.isArray(value)) {\n value = value.map((selection) => findItem(selection) || selection);\n } else {\n value = findItem() || value;\n }\n }\n\n async function handleMultiItemClear(i) {\n const itemToRemove = value[i];\n\n if (value.length === 1) {\n value = undefined;\n } else {\n value = value.filter((item) => {\n return item !== itemToRemove;\n });\n }\n\n dispatch('clear', itemToRemove);\n }\n\n function handleKeyDown(e) {\n if (!focused) return;\n e.stopPropagation();\n switch (e.key) {\n case 'Escape':\n e.preventDefault();\n closeList();\n break;\n case 'Enter':\n e.preventDefault();\n\n if (listOpen) {\n if (filteredItems.length === 0) break;\n const hoverItem = filteredItems[hoverItemIndex];\n\n if (value && !multiple && value[itemId] === hoverItem[itemId]) {\n closeList();\n break;\n } else {\n handleSelect(filteredItems[hoverItemIndex]);\n }\n }\n\n break;\n case 'ArrowDown':\n e.preventDefault();\n\n if (listOpen) {\n setHoverIndex(1);\n } else {\n listOpen = true;\n activeValue = undefined;\n }\n\n break;\n case 'ArrowUp':\n e.preventDefault();\n\n if (listOpen) {\n setHoverIndex(-1);\n } else {\n listOpen = true;\n activeValue = undefined;\n }\n\n break;\n case 'Tab':\n if (listOpen && focused) {\n if (\n filteredItems.length === 0 ||\n (value && value[itemId] === filteredItems[hoverItemIndex][itemId])\n )\n return closeList();\n\n e.preventDefault();\n handleSelect(filteredItems[hoverItemIndex]);\n closeList();\n }\n\n break;\n case 'Backspace':\n if (!multiple || filterText.length > 0) return;\n\n if (multiple && value && value.length > 0) {\n handleMultiItemClear(activeValue !== undefined ? activeValue : value.length - 1);\n if (activeValue === 0 || activeValue === undefined) break;\n activeValue = value.length > activeValue ? activeValue - 1 : undefined;\n }\n\n break;\n case 'ArrowLeft':\n if (!value || !multiple || filterText.length > 0) return;\n if (activeValue === undefined) {\n activeValue = value.length - 1;\n } else if (value.length > activeValue && activeValue !== 0) {\n activeValue -= 1;\n }\n break;\n case 'ArrowRight':\n if (!value || !multiple || filterText.length > 0 || activeValue === undefined) return;\n if (activeValue === value.length - 1) {\n activeValue = undefined;\n } else if (activeValue < value.length - 1) {\n activeValue += 1;\n }\n break;\n }\n }\n\n function handleFocus(e) {\n if (focused && input === document?.activeElement) return;\n if (e) dispatch('focus', e);\n input?.focus();\n focused = true;\n }\n\n async function handleBlur(e) {\n if (isScrolling) return;\n if (listOpen || focused) {\n dispatch('blur', e);\n closeList();\n focused = false;\n activeValue = undefined;\n input?.blur();\n }\n }\n\n function handleClick() {\n if (disabled) return;\n if (filterText.length > 0) return listOpen = true;\n listOpen = !listOpen;\n }\n\n export function handleClear() {\n dispatch('clear', value);\n value = undefined;\n closeList();\n handleFocus();\n }\n\n onMount(() => {\n if (listOpen) focused = true;\n if (focused && input) input.focus();\n });\n\n function itemSelected(selection) {\n if (selection) {\n filterText = '';\n const item = Object.assign({}, selection);\n\n if (item.groupHeader && !item.selectable) return;\n value = multiple ? (value ? value.concat([item]) : [item]) : (value = item);\n\n setTimeout(() => {\n if (closeListOnChange) closeList();\n activeValue = undefined;\n dispatch('change', value);\n dispatch('select', selection);\n });\n }\n }\n\n function closeList() {\n if (clearFilterTextOnBlur) {\n filterText = '';\n }\n listOpen = false;\n }\n\n export let ariaValues = (values) => {\n return `Option ${values}, selected.`;\n };\n\n export let ariaListOpen = (label, count) => {\n return `You are currently focused on option ${label}. There are ${count} results available.`;\n };\n\n export let ariaFocused = () => {\n return `Select is focused, type to refine list, press down to open the menu.`;\n };\n\n function handleAriaSelection(_multiple) {\n let selected = undefined;\n\n if (_multiple && value.length > 0) {\n selected = value.map((v) => v[label]).join(', ');\n } else {\n selected = value[label];\n }\n\n return ariaValues(selected);\n }\n\n function handleAriaContent() {\n if (!filteredItems || filteredItems.length === 0) return '';\n let _item = filteredItems[hoverItemIndex];\n if (listOpen && _item) {\n let count = filteredItems ? filteredItems.length : 0;\n return ariaListOpen(_item[label], count);\n } else {\n return ariaFocused();\n }\n }\n\n let list = null;\n\n let isScrollingTimer;\n function handleListScroll() {\n clearTimeout(isScrollingTimer);\n isScrollingTimer = setTimeout(() => {\n isScrolling = false;\n }, 100);\n }\n\n function handleClickOutside(event) {\n if (!listOpen && !focused && container && !container.contains(event.target) && !list?.contains(event.target)) {\n handleBlur();\n }\n }\n\n onDestroy(() => {\n list?.remove();\n });\n\n let isScrolling = false;\n\n function handleSelect(item) {\n if (!item || item.selectable === false) return;\n itemSelected(item);\n }\n\n function handleHover(i) {\n if (isScrolling) return;\n hoverItemIndex = i;\n }\n\n function handleItemClick(args) {\n const { item, i } = args;\n if (item?.selectable === false) return;\n if (value && !multiple && value[itemId] === item[itemId]) return closeList();\n if (isItemSelectable(item)) {\n hoverItemIndex = i;\n handleSelect(item);\n }\n }\n\n function setHoverIndex(increment) {\n let selectableFilteredItems = filteredItems.filter(\n (item) => !Object.hasOwn(item, 'selectable') || item.selectable === true\n );\n\n if (selectableFilteredItems.length === 0) {\n return (hoverItemIndex = 0);\n }\n\n if (increment > 0 && hoverItemIndex === filteredItems.length - 1) {\n hoverItemIndex = 0;\n } else if (increment < 0 && hoverItemIndex === 0) {\n hoverItemIndex = filteredItems.length - 1;\n } else {\n hoverItemIndex = hoverItemIndex + increment;\n }\n\n const hover = filteredItems[hoverItemIndex];\n\n if (hover && hover.selectable === false) {\n if (increment === 1 || increment === -1) setHoverIndex(increment);\n return;\n }\n }\n\n function isItemActive(item, value, itemId) {\n if (multiple) return;\n return value && value[itemId] === item[itemId];\n }\n\n function isItemFirst(itemIndex) {\n return itemIndex === 0;\n }\n\n function isItemSelectable(item) {\n return (item.groupHeader && item.selectable) || item.selectable || !item.hasOwnProperty('selectable');\n }\n\n const activeScroll = scrollAction;\n const hoverScroll = scrollAction;\n\n function scrollAction(node) {\n return {\n update(args) {\n if (args.scroll) {\n handleListScroll();\n node.scrollIntoView({ behavior: 'auto', block: 'nearest' });\n }\n },\n };\n }\n\n function setListWidth() {\n const { width } = container.getBoundingClientRect();\n list.style.width = listAutoWidth ? width + 'px' : 'auto';\n }\n\n let _floatingConfig = {\n strategy: 'absolute',\n placement: 'bottom-start',\n middleware: [offset(listOffset), flip(), shift()],\n autoUpdate: false,\n };\n\n const [floatingRef, floatingContent, floatingUpdate] = createFloatingActions(_floatingConfig);\n\n $: if (container && floatingConfig?.autoUpdate === undefined) {\n _floatingConfig.autoUpdate = true;\n }\n\n let prefloat = true;\n function listMounted(list, listOpen) {\n if (!list || !listOpen) return (prefloat = true);\n setTimeout(() => {\n prefloat = false;\n }, 0);\n }\n</script>\n\n<svelte:window on:click={handleClickOutside} on:keydown={handleKeyDown} />\n\n<div\n class=\"svelte-select {containerClasses}\"\n class:multi={multiple}\n class:disabled\n class:focused\n class:list-open={listOpen}\n class:show-chevron={showChevron}\n class:error={hasError}\n style={containerStyles}\n on:pointerup|preventDefault={handleClick}\n bind:this={container}\n use:floatingRef\n role=\"none\">\n {#if listOpen}\n <div\n use:floatingContent\n bind:this={list}\n class=\"svelte-select-list\"\n class:prefloat\n on:scroll={handleListScroll}\n on:pointerup|preventDefault|stopPropagation\n on:mousedown|preventDefault|stopPropagation\n\t\t\trole=\"none\">\n {#if $$slots['list-prepend']}<slot name=\"list-prepend\" />{/if}\n {#if $$slots.list}<slot name=\"list\" {filteredItems} />\n {:else if filteredItems.length > 0}\n {#each filteredItems as item, i}\n <div\n on:mouseover={() => handleHover(i)}\n on:focus={() => handleHover(i)}\n on:click|stopPropagation={() => handleItemClick({ item, i })}\n on:keydown|preventDefault|stopPropagation\n class=\"list-item\"\n tabindex=\"-1\"\n role=\"none\">\n <div\n use:activeScroll={{ scroll: isItemActive(item, value, itemId), listDom }}\n use:hoverScroll={{ scroll: scrollToHoverItem === i, listDom }}\n class=\"item\"\n class:list-group-title={item.groupHeader}\n class:active={isItemActive(item, value, itemId)}\n class:first={isItemFirst(i)}\n class:hover={hoverItemIndex === i}\n class:group-item={item.groupItem}\n class:not-selectable={item?.selectable === false}>\n <slot name=\"item\" {item} index={i}>\n {item?.[label]}\n </slot>\n </div>\n </div>\n {/each}\n {:else if !hideEmptyState}\n <slot name=\"empty\">\n <div class=\"empty\">No options</div>\n </slot>\n {/if}\n {#if $$slots['list-append']}<slot name=\"list-append\" />{/if}\n </div>\n {/if}\n\n <span aria-live=\"polite\" aria-atomic=\"false\" aria-relevant=\"additions text\" class=\"a11y-text\">\n {#if focused}\n <span id=\"aria-selection\">{ariaSelection}</span>\n <span id=\"aria-context\">\n {ariaContext}\n </span>\n {/if}\n </span>\n\n <div class=\"prepend\">\n <slot name=\"prepend\" />\n </div>\n\n <div class=\"value-container\">\n {#if hasValue}\n {#if multiple}\n {#each value as item, i}\n <div\n class=\"multi-item\"\n class:active={activeValue === i}\n class:disabled\n on:click|preventDefault={() => (multiFullItemClearable ? handleMultiItemClear(i) : {})}\n on:keydown|preventDefault|stopPropagation\n role=\"none\">\n <span class=\"multi-item-text\">\n <slot name=\"selection\" selection={item} index={i}>\n {item[label]}\n </slot>\n </span>\n\n {#if !disabled && !multiFullItemClearable && ClearIcon}\n <div\n class=\"multi-item-clear\"\n on:pointerup|preventDefault|stopPropagation={() => handleMultiItemClear(i)}>\n <slot name=\"multi-clear-icon\">\n <ClearIcon />\n </slot>\n </div>\n {/if}\n </div>\n {/each}\n {:else}\n <div class=\"selected-item\" class:hide-selected-item={hideSelectedItem}>\n <slot name=\"selection\" selection={value}>\n {value[label]}\n </slot>\n </div>\n {/if}\n {/if}\n\n <input\n on:keydown={handleKeyDown}\n on:blur={handleBlur}\n on:focus={handleFocus}\n readOnly={!searchable}\n {..._inputAttributes}\n bind:this={input}\n bind:value={filterText}\n placeholder={placeholderText}\n style={inputStyles}\n {disabled} />\n </div>\n\n <div class=\"indicators\">\n {#if loading}\n <div class=\"icon loading\" aria-hidden=\"true\">\n <slot name=\"loading-icon\">\n <LoadingIcon />\n </slot>\n </div>\n {/if}\n\n {#if showClear}\n <button type=\"button\" class=\"icon clear-select\" on:click={handleClear}>\n <slot name=\"clear-icon\">\n <ClearIcon />\n </slot>\n </button>\n {/if}\n\n {#if showChevron}\n <div class=\"icon chevron\" aria-hidden=\"true\">\n <slot name=\"chevron-icon\" {listOpen}>\n <ChevronIcon />\n </slot>\n </div>\n {/if}\n </div>\n\n <slot name=\"input-hidden\" {value}>\n <input {name} type=\"hidden\" value={value ? JSON.stringify(value) : null} />\n </slot>\n\n {#if required && (!value || value.length === 0)}\n <slot name=\"required\" {value}>\n <select class=\"required\" required tabindex=\"-1\" aria-hidden=\"true\" />\n </slot>\n {/if}\n</div>\n\n<style>\n .svelte-select {\n /* deprecating camelCase custom props in favour of kebab-case for v5 */\n --borderRadius: var(--border-radius);\n --clearSelectColor: var(--clear-select-color);\n --clearSelectWidth: var(--clear-select-width);\n --disabledBackground: var(--disabled-background);\n --disabledBorderColor: var(--disabled-border-color);\n --disabledColor: var(--disabled-color);\n --disabledPlaceholderColor: var(--disabled-placeholder-color);\n --disabledPlaceholderOpacity: var(--disabled-placeholder-opacity);\n --errorBackground: var(--error-background);\n --errorBorder: var(--error-border);\n --groupItemPaddingLeft: var(--group-item-padding-left);\n --groupTitleColor: var(--group-title-color);\n --groupTitleFontSize: var(--group-title-font-size);\n --groupTitleFontWeight: var(--group-title-font-weight);\n --groupTitlePadding: var(--group-title-padding);\n --groupTitleTextTransform: var(--group-title-text-transform);\n --groupTitleBorderColor: var(--group-title-border-color);\n --groupTitleBorderWidth: var(--group-title-border-width);\n --groupTitleBorderStyle: var(--group-title-border-style);\n --indicatorColor: var(--chevron-color);\n --indicatorHeight: var(--chevron-height);\n --indicatorWidth: var(--chevron-width);\n --inputColor: var(--input-color);\n --inputLeft: var(--input-left);\n --inputLetterSpacing: var(--input-letter-spacing);\n --inputMargin: var(--input-margin);\n --inputPadding: var(--input-padding);\n --itemActiveBackground: var(--item-active-background);\n --itemColor: var(--item-color);\n --itemFirstBorderRadius: var(--item-first-border-radius);\n --itemHoverBG: var(--item-hover-bg);\n --itemHoverColor: var(--item-hover-color);\n --itemIsActiveBG: var(--item-is-active-bg);\n --itemIsActiveColor: var(--item-is-active-color);\n --itemIsNotSelectableColor: var(--item-is-not-selectable-color);\n --itemPadding: var(--item-padding);\n --listBackground: var(--list-background);\n --listBorder: var(--list-border);\n --listBorderRadius: var(--list-border-radius);\n --listEmptyColor: var(--list-empty-color);\n --listEmptyPadding: var(--list-empty-padding);\n --listEmptyTextAlign: var(--list-empty-text-align);\n --listMaxHeight: var(--list-max-height);\n --listPosition: var(--list-position);\n --listShadow: var(--list-shadow);\n --listZIndex: var(--list-z-index);\n --multiItemBG: var(--multi-item-bg);\n --multiItemBorderRadius: var(--multi-item-border-radius);\n --multiItemDisabledHoverBg: var(--multi-item-disabled-hover-bg);\n --multiItemDisabledHoverColor: var(--multi-item-disabled-hover-color);\n --multiItemHeight: var(--multi-item-height);\n --multiItemMargin: var(--multi-item-margin);\n --multiItemPadding: var(--multi-item-padding);\n --multiSelectInputMargin: var(--multi-select-input-margin);\n --multiSelectInputPadding: var(--multi-select-input-padding);\n --multiSelectPadding: var(--multi-select-padding);\n --placeholderColor: var(--placeholder-color);\n --placeholderOpacity: var(--placeholder-opacity);\n --selectedItemPadding: var(--selected-item-padding);\n --spinnerColor: var(--spinner-color);\n --spinnerHeight: var(--spinner-height);\n --spinnerWidth: var(--spinner-width);\n\n --internal-padding: 0 0 0 16px;\n\n border: var(--border, 1px solid #d8dbdf);\n border-radius: var(--border-radius, 6px);\n min-height: var(--height, 42px);\n position: relative;\n display: flex;\n align-items: stretch;\n padding: var(--padding, var(--internal-padding));\n background: var(--background, #fff);\n margin: var(--margin, 0);\n width: var(--width, 100%);\n font-size: var(--font-size, 16px);\n max-height: var(--max-height);\n }\n\n * {\n box-sizing: var(--box-sizing, border-box);\n }\n\n .svelte-select:hover {\n border: var(--border-hover, 1px solid #b2b8bf);\n }\n\n .value-container {\n display: flex;\n flex: 1 1 0%;\n flex-wrap: wrap;\n align-items: center;\n gap: 5px 10px;\n padding: var(--value-container-padding, 5px 0);\n position: relative;\n overflow: var(--value-container-overflow, hidden);\n align-self: stretch;\n }\n\n .prepend,\n .indicators {\n display: flex;\n flex-shrink: 0;\n align-items: center;\n }\n\n .indicators {\n position: var(--indicators-position);\n top: var(--indicators-top);\n right: var(--indicators-right);\n bottom: var(--indicators-bottom);\n }\n\n input {\n position: absolute;\n cursor: default;\n border: none;\n color: var(--input-color, var(--item-color));\n padding: var(--input-padding, 0);\n letter-spacing: var(--input-letter-spacing, inherit);\n margin: var(--input-margin, 0);\n min-width: 10px;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n background: transparent;\n font-size: var(--font-size, 16px);\n }\n\n :not(.multi) > .value-container > input {\n width: 100%;\n height: 100%;\n }\n\n input::placeholder {\n color: var(--placeholder-color, #78848f);\n opacity: var(--placeholder-opacity, 1);\n }\n\n input:focus {\n outline: none;\n }\n\n .svelte-select.focused {\n border: var(--border-focused, 1px solid #006fe8);\n border-radius: var(--border-radius-focused, var(--border-radius, 6px));\n }\n\n .disabled {\n background: var(--disabled-background, #ebedef);\n border-color: var(--disabled-border-color, #ebedef);\n color: var(--disabled-color, #c1c6cc);\n }\n\n .disabled input::placeholder {\n color: var(--disabled-placeholder-color, #c1c6cc);\n opacity: var(--disabled-placeholder-opacity, 1);\n }\n\n .selected-item {\n position: relative;\n overflow: var(--selected-item-overflow, hidden);\n padding: var(--selected-item-padding, 0 20px 0 0);\n text-overflow: ellipsis;\n white-space: nowrap;\n color: var(--selected-item-color, inherit);\n font-size: var(--font-size, 16px);\n }\n\n .multi .selected-item {\n position: absolute;\n line-height: var(--height, 42px);\n height: var(--height, 42px);\n }\n\n .selected-item:focus {\n outline: none;\n }\n\n .hide-selected-item {\n opacity: 0;\n }\n\n .icon {\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n .clear-select {\n all: unset;\n display: flex;\n align-items: center;\n justify-content: center;\n width: var(--clear-select-width, 40px);\n height: var(--clear-select-height, 100%);\n color: var(--clear-select-color, var(--icons-color));\n margin: var(--clear-select-margin, 0);\n pointer-events: all;\n flex-shrink: 0;\n }\n\n .clear-select:focus {\n outline: var(--clear-select-focus-outline, 1px solid #006fe8);\n }\n\n .loading {\n width: var(--loading-width, 40px);\n height: var(--loading-height);\n color: var(--loading-color, var(--icons-color));\n margin: var(--loading--margin, 0);\n flex-shrink: 0;\n }\n\n .chevron {\n width: var(--chevron-width, 40px);\n height: var(--chevron-height, 40px);\n background: var(--chevron-background, transparent);\n pointer-events: var(--chevron-pointer-events, none);\n color: var(--chevron-color, var(--icons-color));\n border: var(--chevron-border, 0 0 0 1px solid #d8dbdf);\n flex-shrink: 0;\n }\n\n .multi {\n padding: var(--multi-select-padding, var(--internal-padding));\n }\n\n .multi input {\n padding: var(--multi-select-input-padding, 0);\n position: relative;\n margin: var(--multi-select-input-margin, 5px 0);\n flex: 1 1 40px;\n }\n\n .svelte-select.error {\n border: var(--error-border, 1px solid #ff2d55);\n background: var(--error-background, #fff);\n }\n\n .a11y-text {\n z-index: 9999;\n border: 0px;\n clip: rect(1px, 1px, 1px, 1px);\n height: 1px;\n width: 1px;\n position: absolute;\n overflow: hidden;\n padding: 0px;\n white-space: nowrap;\n }\n\n .multi-item {\n background: var(--multi-item-bg, #ebedef);\n margin: var(--multi-item-margin, 0);\n outline: var(--multi-item-outline, 1px solid #ddd);\n border-radius: var(--multi-item-border-radius, 4px);\n height: var(--multi-item-height, 25px);\n line-height: var(--multi-item-height, 25px);\n display: flex;\n cursor: default;\n padding: var(--multi-item-padding, 0 5px);\n overflow: hidden;\n gap: var(--multi-item-gap, 4px);\n outline-offset: -1px;\n max-width: var(--multi-max-width, none);\n color: var(--multi-item-color, var(--item-color));\n }\n\n .multi-item.disabled:hover {\n background: var(--multi-item-disabled-hover-bg, #ebedef);\n color: var(--multi-item-disabled-hover-color, #c1c6cc);\n }\n\n .multi-item-text {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n .multi-item-clear {\n display: flex;\n align-items: center;\n justify-content: center;\n --clear-icon-color: var(--multi-item-clear-icon-color, #000);\n }\n\n .multi-item.active {\n outline: var(--multi-item-active-outline, 1px solid #006fe8);\n }\n\n .svelte-select-list {\n box-shadow: var(--list-shadow, 0 2px 3px 0 rgba(44, 62, 80, 0.24));\n border-radius: var(--list-border-radius, 4px);\n max-height: var(--list-max-height, 252px);\n overflow-y: auto;\n background: var(--list-background, #fff);\n position: var(--list-position, absolute);\n z-index: var(--list-z-index, 2);\n border: var(--list-border);\n }\n\n .prefloat {\n opacity: 0;\n pointer-events: none;\n }\n\n .list-group-title {\n color: var(--group-title-color, #8f8f8f);\n cursor: default;\n font-size: var(--group-title-font-size, 16px);\n font-weight: var(--group-title-font-weight, 600);\n height: var(--height, 42px);\n line-height: var(--height, 42px);\n padding: var(--group-title-padding, 0 20px);\n text-overflow: ellipsis;\n overflow-x: hidden;\n white-space: nowrap;\n text-transform: var(--group-title-text-transform, uppercase);\n border-width: var(--group-title-border-width, medium);\n border-style: var(--group-title-border-style, none);\n border-color: var(--group-title-border-color, color);\n }\n\n .empty {\n text-align: var(--list-empty-text-align, center);\n padding: var(--list-empty-padding, 20px 0);\n color: var(--list-empty-color, #78848f);\n }\n\n .item {\n cursor: default;\n height: var(--item-height, var(--height, 42px));\n line-height: var(--item-line-height, var(--height, 42px));\n padding: var(--item-padding, 0 20px);\n color: var(--item-color, inherit);\n text-overflow: ellipsis;\n overflow: hidden;\n white-space: nowrap;\n transition: var(--item-transition, all 0.2s);\n align-items: center;\n width: 100%;\n }\n\n .item.group-item {\n padding-left: var(--group-item-padding-left, 40px);\n }\n\n .item:active {\n background: var(--item-active-background, #b9daff);\n }\n\n .item.active {\n background: var(--item-is-active-bg, #007aff);\n color: var(--item-is-active-color, #fff);\n }\n\n .item.first {\n border-radius: var(--item-first-border-radius, 4px 4px 0 0);\n }\n\n .item.hover:not(.active) {\n background: var(--item-hover-bg, #e7f2ff);\n color: var(--item-hover-color, inherit);\n }\n\n .item.not-selectable,\n .item.hover.item.not-selectable,\n .item.active.item.not-selectable,\n .item.not-selectable:active {\n color: var(--item-is-not-selectable-color, #999);\n background: transparent;\n }\n\n .required {\n opacity: 0;\n z-index: -1;\n position: absolute;\n top: 0;\n left: 0;\n bottom: 0;\n right: 0;\n }\n</style>\n","<svg class=\"loading\" viewBox=\"25 25 50 50\">\n <circle\n class=\"circle_path\"\n cx=\"50\"\n cy=\"50\"\n r=\"20\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"5\"\n stroke-miterlimit=\"10\" />\n</svg>\n\n<style>\n .loading {\n width: var(--spinner-width, 20px);\n height: var(--spinner-height, 20px);\n color: var(--spinner-color, var(--icons-color));\n animation: rotate 0.75s linear infinite;\n transform-origin: center center;\n transform: none;\n }\n\n .circle_path {\n stroke-dasharray: 90;\n stroke-linecap: round;\n }\n\n @keyframes rotate {\n 100% {\n transform: rotate(360deg);\n }\n }\n</style>","<svg\n width=\"100%\"\n height=\"100%\"\n viewBox=\"0 0 20 20\"\n focusable=\"false\"\n aria-hidden=\"true\">\n <path\n fill=\"currentColor\"\n d=\"M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747\n 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0\n 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502\n 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0\n 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z\" />\n</svg>\n\n<style>\n svg {\n width: var(--chevron-icon-width, 20px);\n height: var(--chevron-icon-width, 20px);\n color: var(--chevron-icon-colour, currentColor);\n }\n</style>","<svelte:options immutable={true} />\n\n<script lang=\"ts\">\n import Select from 'svelte-select'\n import { getNestedPaths } from '$lib/utils/arrayUtils.js'\n import { pathToOption } from '$lib/utils/pathUtils.js'\n import { createDebug } from '$lib/utils/debug.js'\n import { isEqual } from 'lodash-es'\n import type { JSONPath } from 'immutable-json-patch'\n import { setIn } from 'immutable-json-patch'\n import type { PathOption, QueryLanguageOptions } from '$lib/types.js'\n\n const debug = createDebug('jsoneditor:TransformWizard')\n\n export let json: unknown\n export let queryOptions: QueryLanguageOptions = {}\n export let onChange: (queryOptions: QueryLanguageOptions) => void\n\n // options\n $: jsonIsArray = Array.isArray(json)\n $: paths = jsonIsArray ? getNestedPaths(json) : []\n $: pathsIncludingObjects = jsonIsArray ? getNestedPaths(json, true) : []\n $: fieldOptions = paths.map(pathToOption)\n $: projectionOptions = pathsIncludingObjects ? pathsIncludingObjects.map(pathToOption) : []\n\n const filterRelationOptions = ['==', '!=', '<', '<=', '>', '>='].map((relation) => ({\n value: relation,\n label: relation\n }))\n\n const sortDirectionOptions = [\n { value: 'asc', label: '升序' },\n { value: 'desc', label: '降序' }\n ]\n\n // TODO: the binding with the select boxes is very cumbersome. Can we simplify this?\n let filterPath = queryOptions?.filter?.path ? pathToOption(queryOptions.filter.path) : undefined\n let filterRelation =\n filterRelationOptions.find((option) => option.value === queryOptions.filter?.relation) ??\n filterRelationOptions[0]\n let filterValue = queryOptions?.filter?.value || ''\n let sortPath = queryOptions?.sort?.path ? pathToOption(queryOptions.sort.path) : undefined\n let sortDirection =\n sortDirectionOptions.find((option) => option.value === queryOptions.sort?.direction) ??\n sortDirectionOptions[0]\n\n $: projectionPaths =\n queryOptions?.projection?.paths && projectionOptions\n ? (queryOptions.projection.paths\n .map((path) => projectionOptions.find((option) => isEqual(option.value, path)))\n .filter((option) => !!option) as PathOption[])\n : undefined\n\n function changeFilterPath(path: JSONPath | undefined) {\n if (!isEqual(queryOptions?.filter?.path, path)) {\n debug('changeFilterPath', path)\n queryOptions = setIn(queryOptions, ['filter', 'path'], path, true)\n onChange(queryOptions)\n }\n }\n\n function changeFilterRelation(relation: string | undefined) {\n if (!isEqual(queryOptions?.filter?.relation, relation)) {\n debug('changeFilterRelation', relation)\n queryOptions = setIn(queryOptions, ['filter', 'relation'], relation, true)\n onChange(queryOptions)\n }\n }\n\n function changeFilterValue(value: string | undefined) {\n if (!isEqual(queryOptions?.filter?.value, value)) {\n debug('changeFilterValue', value)\n queryOptions = setIn(queryOptions, ['filter', 'value'], value, true)\n onChange(queryOptions)\n }\n }\n\n function changeSortPath(path: JSONPath | undefined) {\n if (!isEqual(queryOptions?.sort?.path, path)) {\n debug('changeSortPath', path)\n queryOptions = setIn(queryOptions, ['sort', 'path'], path, true)\n onChange(queryOptions)\n }\n }\n\n function changeSortDirection(direction: string | undefined) {\n if (!isEqual(queryOptions?.sort?.direction, direction)) {\n debug('changeSortDirection', direction)\n queryOptions = setIn(queryOptions, ['sort', 'direction'], direction, true)\n onChange(queryOptions)\n }\n }\n\n function changeProjectionPaths(paths: JSONPath[] | unknown) {\n if (!isEqual(queryOptions?.projection?.paths, paths)) {\n debug('changeProjectionPaths', paths)\n queryOptions = setIn(queryOptions, ['projection', 'paths'], paths, true)\n onChange(queryOptions)\n }\n }\n\n $: changeFilterPath(filterPath?.value)\n $: changeFilterRelation(filterRelation?.value)\n $: changeFilterValue(filterValue)\n $: changeSortPath(sortPath?.value)\n $: changeSortDirection(sortDirection?.value)\n $: changeProjectionPaths(projectionPaths ? projectionPaths.map((item) => item.value) : undefined)\n</script>\n\n<table class=\"jse-transform-wizard\">\n <tbody>\n <tr>\n <th>Filter</th>\n <td>\n <div class=\"jse-horizontal\">\n <Select\n class=\"jse-filter-path\"\n showChevron\n items={fieldOptions}\n bind:value={filterPath}\n />\n <Select\n class=\"jse-filter-relation\"\n showChevron\n clearable={false}\n items={filterRelationOptions}\n bind:value={filterRelation}\n />\n <input class=\"jse-filter-value\" bind:value={filterValue} />\n </div>\n </td>\n </tr>\n <tr>\n <th>Sort</th>\n <td>\n <div class=\"jse-horizontal\">\n <Select class=\"jse-sort-path\" showChevron items={fieldOptions} bind:value={sortPath} />\n <Select\n class=\"jse-sort-direction\"\n showChevron\n clearable={false}\n items={sortDirectionOptions}\n bind:value={sortDirection}\n />\n </div>\n </td>\n </tr>\n <tr>\n <th>Pick</th>\n <td>\n <div class=\"jse-horizontal\">\n <Select\n class=\"jse-projection-paths\"\n multiple\n showChevron\n items={projectionOptions}\n bind:value={projectionPaths}\n />\n </div>\n </td>\n </tr>\n </tbody>\n</table>\n\n<style src=\"./TransformWizard.scss\"></style>\n","<script lang=\"ts\">\n import Icon from 'svelte-awesome'\n import { faCheckSquare, faSquare } from '@fortawesome/free-regular-svg-icons'\n import type { QueryLanguage, OnChangeQueryLanguage } from '$lib/types.js'\n\n export let queryLanguages: QueryLanguage[]\n export let queryLanguageId: string\n export let onChangeQueryLanguage: OnChangeQueryLanguage\n\n function handleChangeQueryLanguage(newQueryLanguageId: string) {\n queryLanguageId = newQueryLanguageId\n onChangeQueryLanguage(newQueryLanguageId)\n }\n</script>\n\n<div class=\"jse-select-query-language\">\n <div class=\"jse-select-query-language-container\">\n {#each queryLanguages as queryLanguage}\n <button\n type=\"button\"\n on:click={() => handleChangeQueryLanguage(queryLanguage.id)}\n class=\"jse-query-language\"\n class:selected={queryLanguage.id === queryLanguageId}\n title={`选择 ${queryLanguage.name} 作为查询语言`}\n >\n {#if queryLanguage.id === queryLanguageId}\n <Icon data={faCheckSquare} />\n {:else}\n <Icon data={faSquare} />\n {/if}\n {queryLanguage.name}\n </button>\n {/each}\n </div>\n</div>\n\n<style src=\"./SelectQueryLanguage.scss\"></style>\n","<svelte:options immutable={true} />\n\n<script lang=\"ts\">\n import Icon from 'svelte-awesome'\n import {\n faDownLeftAndUpRightToCenter,\n faTimes,\n faUpRightAndDownLeftFromCenter\n } from '@fortawesome/free-solid-svg-icons'\n\n export let title = 'Modal'\n export let fullScreenButton: boolean = false\n export let fullscreen: boolean = false\n export let onClose: (() => void) | undefined = undefined\n</script>\n\n<div class=\"jse-header\">\n <div class=\"jse-title\">\n {title}\n </div>\n <slot name=\"actions\" />\n {#if fullScreenButton}\n <button\n type=\"button\"\n class=\"jse-fullscreen\"\n title=\"切换全屏\"\n on:click={() => (fullscreen = !fullscreen)}\n >\n <Icon data={fullscreen ? faDownLeftAndUpRightToCenter : faUpRightAndDownLeftFromCenter} />\n </button>\n {/if}\n <button type=\"button\" class=\"jse-close\" on:click={() => onClose?.()}>\n <Icon data={faTimes} />\n </button>\n</div>\n\n<style src=\"./Header.scss\"></style>\n","import { createDebug } from '$lib/utils/debug.js'\nimport {\n AUTO_SCROLL_INTERVAL,\n AUTO_SCROLL_SPEED_FAST,\n AUTO_SCROLL_SPEED_NORMAL,\n AUTO_SCROLL_SPEED_SLOW\n} from '$lib/constants.js'\n\nconst debug = createDebug('jsoneditor:AutoScrollHandler')\n\nexport function createAutoScrollHandler(scrollableElement: Element) {\n debug('createAutoScrollHandler', scrollableElement)\n\n let autoScrollSpeed: number | undefined // pixels per second\n let autoScrollTimer: number | undefined\n\n function calculateSpeed(diff: number) {\n return diff < 20\n ? AUTO_SCROLL_SPEED_SLOW\n : diff < 50\n ? AUTO_SCROLL_SPEED_NORMAL\n : AUTO_SCROLL_SPEED_FAST\n }\n\n function autoScrollCallback() {\n if (scrollableElement) {\n // debug('auto scroll...')\n const diff = (autoScrollSpeed || 0) * (AUTO_SCROLL_INTERVAL / 1000)\n\n scrollableElement.scrollTop += diff\n }\n }\n\n function startAutoScroll(speed: number) {\n if (!autoScrollTimer || speed !== autoScrollSpeed) {\n stopAutoScroll()\n\n debug('startAutoScroll', speed)\n autoScrollSpeed = speed\n autoScrollTimer = setInterval(autoScrollCallback, AUTO_SCROLL_INTERVAL) as unknown as number\n }\n }\n\n function stopAutoScroll() {\n if (autoScrollTimer) {\n debug('stopAutoScroll')\n\n clearInterval(autoScrollTimer)\n autoScrollTimer = undefined\n autoScrollSpeed = undefined\n }\n }\n\n function onDrag(event: MouseEvent) {\n if (scrollableElement) {\n const y = event.clientY\n const { top, bottom } = scrollableElement.getBoundingClientRect()\n\n if (y < top) {\n const speed = calculateSpeed(top - y)\n startAutoScroll(-speed)\n } else if (y > bottom) {\n const speed = calculateSpeed(y - bottom)\n startAutoScroll(speed)\n } else {\n stopAutoScroll()\n }\n }\n }\n\n function onDragEnd() {\n stopAutoScroll()\n }\n\n return {\n onDrag,\n onDragEnd\n }\n}\n","// Robert Penner's easeInOutQuad\n\n// find the rest of his easing functions here: http://robertpenner.com/easing/\n// find them exported for ES6 consumption here: https://github.com/jaxgeller/ez.js\n\nexport default (t: number, b: number, c: number, d: number): number => {\n t /= d / 2\n if (t < 1) {\n return (c / 2) * t * t + b\n }\n t--\n return (-c / 2) * (t * (t - 2) - 1) + b\n}\n","import easeInOutQuad from './easing.js'\n\ntype Easing = (t: number, b: number, c: number, d: number) => number\ntype Duration = number | ((distance: number) => number)\n\ninterface JumpOptions {\n duration?: Duration\n offset?: number\n callback?: () => void\n easing?: Easing\n a11y?: boolean\n container?: Element | string\n}\n\nexport const createJump = () => {\n // private variable cache\n // no variables are created during a jump, preventing memory leaks\n\n let container: Element // container element to be scrolled (node)\n let element: Element | undefined // element to scroll to (node)\n\n let start: number // where scroll starts (px)\n let stop: number // where scroll stops (px)\n\n let offset // adjustment from the stop position (px)\n let easing: Easing // easing function (function)\n let a11y: boolean // accessibility support flag (boolean)\n\n let distance: number // distance of scroll (px)\n let duration: number // scroll duration (ms)\n\n let timeStart: number // time scroll started (ms)\n let timeElapsed: number // time spent scrolling thus far (ms)\n\n let next: number // next scroll position (px)\n\n let callback: (() => void) | undefined // to call when done scrolling (function)\n\n let scrolling: boolean // true whilst scrolling (boolean)\n\n // scroll position helper\n\n function location() {\n return container.scrollTop\n }\n\n // element offset helper\n\n function top(element: Element) {\n const elementTop = element.getBoundingClientRect().top\n const containerTop = container.getBoundingClientRect ? container.getBoundingClientRect().top : 0\n\n return elementTop - containerTop + start\n }\n\n // scrollTo helper\n\n function scrollTo(top: number) {\n if (container.scrollTo) {\n container.scrollTo(container.scrollLeft, top) // window\n } else {\n container.scrollTop = top // custom container\n }\n }\n\n // rAF loop helper\n\n function loop(timeCurrent: number) {\n // store time scroll started, if not started already\n if (!timeStart) {\n timeStart = timeCurrent\n }\n\n // determine time spent scrolling so far\n timeElapsed = timeCurrent - timeStart\n\n // calculate next scroll position\n next = easing(timeElapsed, start, distance, duration)\n\n // scroll to it\n scrollTo(next)\n\n scrolling = true\n\n // check progress\n if (timeElapsed < duration) {\n requestAnimationFrame(loop) // continue scroll loop\n } else {\n done() // scrolling is done\n }\n }\n\n // scroll finished helper\n\n function done() {\n // account for rAF time rounding inaccuracies\n scrollTo(start + distance)\n\n // if scrolling to an element, and accessibility is enabled\n if (element && a11y) {\n // add tabindex indicating programmatic focus\n element.setAttribute('tabindex', '-1')\n\n // focus the element\n const htmlElement = element as HTMLElement\n htmlElement.focus()\n }\n\n // if it exists, fire the callback\n if (typeof callback === 'function') {\n callback()\n }\n\n // reset time for next jump\n timeStart = 0\n\n // we're done scrolling\n scrolling = false\n }\n\n // API\n\n function jump(target: Element | number | string, options: JumpOptions = {}) {\n // resolve options, or use defaults\n duration = 1000\n offset = options.offset || 0\n callback = options.callback // \"undefined\" is a suitable default, and won't be called\n easing = options.easing || easeInOutQuad\n a11y = options.a11y || false\n\n // resolve container\n switch (typeof options.container) {\n case 'object':\n // we assume container is an HTML element (Node)\n container = options.container\n break\n\n case 'string':\n container = document.querySelector(options.container) as Element\n break\n\n default:\n container = window.document.documentElement\n }\n\n // cache starting position\n start = location()\n\n // resolve target\n switch (typeof target) {\n // scroll from current position\n case 'number':\n element = undefined // no element to scroll to\n a11y = false // make sure accessibility is off\n stop = start + target\n break\n\n // scroll to element (node)\n // bounding rect is relative to the viewport\n case 'object':\n element = target\n stop = top(element)\n break\n\n // scroll to element (selector)\n // bounding rect is relative to the viewport\n case 'string':\n element = document.querySelector(target) as unknown as Element\n stop = top(element)\n break\n\n default:\n }\n\n // resolve scroll distance, accounting for offset\n distance = stop - start + offset\n\n // resolve duration\n switch (typeof options.duration) {\n // number in ms\n case 'number':\n duration = options.duration\n break\n\n // function passed the distance of the scroll\n case 'function':\n duration = options.duration(distance)\n break\n\n default:\n }\n\n // start the loop if we're not already scrolling\n if (!scrolling) {\n requestAnimationFrame(loop)\n } else {\n // reset time for next jump\n timeStart = 0\n }\n }\n\n // expose only the jump method\n return jump\n}\n\n// export singleton\n\nconst singleton = createJump()\n\nexport default singleton\n","/**\n * Measure how long a callback takes to execute.\n * Returns the response from the callback\n * The measured duration is returned via the onDuration callback\n */\nexport function measure<T>(callback: () => T, onDuration: (duration: number) => void): T {\n const start = Date.now()\n const result = callback()\n const end = Date.now()\n\n onDuration(end - start)\n\n return result\n}\n","import { initial, isEmpty } from 'lodash-es'\nimport type {\n ContentErrors,\n JSONParser,\n RecursiveStateFactory,\n ValidationErrors,\n ValidationError,\n Validator\n} from '$lib/types.js'\nimport { ValidationSeverity } from '$lib/types.js'\nimport { MAX_AUTO_REPAIRABLE_SIZE, MAX_VALIDATABLE_SIZE } from '../constants.js'\nimport { measure } from '../utils/timeUtils.js'\nimport { normalizeJsonParseError } from '../utils/jsonUtils.js'\nimport { createDebug } from '../utils/debug.js'\nimport { jsonrepair } from 'jsonrepair'\nimport { updateInRecursiveState } from './documentState.js'\nimport type { JSONPath } from 'immutable-json-patch'\n\nconst debug = createDebug('validation')\n\nexport const validationErrorsFactory: RecursiveStateFactory = {\n createObjectDocumentState: () => ({ type: 'object', properties: {} }),\n createArrayDocumentState: () => ({ type: 'array', items: [] }),\n createValueDocumentState: () => ({ type: 'value' })\n}\n\nexport function updateInValidationErrors(\n json: unknown,\n errors: ValidationErrors | undefined,\n path: JSONPath,\n transform: (value: unknown, state: ValidationErrors) => ValidationErrors\n): ValidationErrors {\n return updateInRecursiveState(json, errors, path, transform, validationErrorsFactory)\n}\n\n/**\n * Create a flat map with validation errors, where the key is the stringified path\n * and also create error messages for the parent nodes of the nodes having an error.\n *\n * Returns a nested object containing the validation errors\n */\nexport function toRecursiveValidationErrors(\n json: unknown,\n validationErrors: ValidationError[]\n): ValidationErrors | undefined {\n let output: ValidationErrors | undefined\n\n // first generate the errors themselves\n validationErrors.forEach((validationError) => {\n output = updateInValidationErrors(json, output, validationError.path, (_, state) => ({\n ...state,\n validationError\n }))\n })\n\n // create error entries for all parent nodes (displayed when the node is collapsed)\n validationErrors.forEach((validationError) => {\n let parentPath = validationError.path\n\n while (parentPath.length > 0) {\n parentPath = initial(parentPath)\n\n output = updateInValidationErrors(json, output, parentPath, (_, state) => {\n return state.validationError\n ? state\n : {\n ...state,\n validationError: {\n isChildError: true,\n path: parentPath,\n message: 'Contains invalid data',\n severity: ValidationSeverity.warning\n }\n }\n })\n }\n })\n\n return output\n}\n\nexport function validateJSON(\n json: unknown,\n validator: Validator | undefined,\n parser: JSONParser,\n validationParser: JSONParser\n): ValidationError[] {\n debug('validateJSON')\n\n if (!validator) {\n return []\n }\n\n if (parser !== validationParser) {\n // if needed, convert for example Lossless JSON to native JSON\n // (like replace bigint or LosslessNumber into regular numbers)\n const text = parser.stringify(json)\n const convertedJSON = text !== undefined ? validationParser.parse(text) : undefined\n return validator(convertedJSON)\n } else {\n return validator(json)\n }\n}\n\nexport function validateText(\n text: string,\n validator: Validator | undefined,\n parser: JSONParser,\n validationParser: JSONParser\n): ContentErrors | undefined {\n debug('validateText')\n\n if (text.length > MAX_VALIDATABLE_SIZE) {\n const validationError: ValidationError = {\n path: [],\n message: 'Validation turned off: the document is too large',\n severity: ValidationSeverity.info\n }\n\n return {\n validationErrors: [validationError]\n }\n }\n\n if (text.length === 0) {\n // new, empty document, do not try to parse\n return undefined\n }\n\n try {\n // parse with the \"main\" parser (not the validation parser) to get parse errors\n // (like syntax errors and duplicate keys errors)\n const json = measure(\n () => parser.parse(text),\n (duration) => debug(`validate: parsed json in ${duration} ms`)\n )\n\n if (!validator) {\n return undefined\n }\n\n // if needed, parse with the validationParser to be able to feed the json to the validator\n const convertedJSON =\n parser === validationParser\n ? json\n : measure(\n () => validationParser.parse(text),\n (duration) => debug(`validate: parsed json with the validationParser in ${duration} ms`)\n )\n\n // actually validate the json\n const validationErrors = measure(\n () => validator(convertedJSON),\n (duration) => debug(`validate: validated json in ${duration} ms`)\n )\n\n return !isEmpty(validationErrors) ? { validationErrors } : undefined\n } catch (err) {\n const isRepairable = measure(\n () => canAutoRepair(text, parser),\n (duration) => debug(`validate: checked whether repairable in ${duration} ms`)\n )\n\n const parseError = normalizeJsonParseError(\n text,\n (err as Error).message || (err as Error).toString()\n )\n\n return {\n parseError,\n isRepairable\n }\n }\n}\n\nfunction canAutoRepair(text: string, parser: JSONParser): boolean {\n if (text.length > MAX_AUTO_REPAIRABLE_SIZE) {\n return false\n }\n\n try {\n parser.parse(jsonrepair(text))\n\n return true\n } catch {\n return false\n }\n}\n","import { createDebug } from '$lib/utils/debug.js'\n\nconst debug = createDebug('jsoneditor:FocusTracker')\n\nexport interface FocusTrackerProps {\n onMount: (callback: () => void) => void\n onDestroy: (callback: () => void) => void\n getWindow: () => Window | undefined\n hasFocus: () => boolean\n onFocus: () => void\n onBlur: () => void\n}\n\nexport function createFocusTracker({\n onMount,\n onDestroy,\n getWindow,\n hasFocus,\n onFocus,\n onBlur\n}: FocusTrackerProps) {\n let blurTimeoutHandle: number | undefined\n let focus = false\n\n function handleFocusIn() {\n const newFocus = hasFocus()\n\n if (newFocus) {\n clearTimeout(blurTimeoutHandle)\n if (!focus) {\n debug('focus')\n onFocus()\n focus = newFocus\n }\n }\n }\n\n function handleFocusOut() {\n if (focus) {\n // We set focus to false after timeout. Often, you get a blur and directly\n // another focus when moving focus from one button to another.\n // The focusIn handler will cancel any pending blur timer in those cases\n clearTimeout(blurTimeoutHandle)\n blurTimeoutHandle = setTimeout(() => {\n if (!hasFocus()) {\n debug('blur')\n focus = false\n onBlur()\n }\n }) as unknown as number\n }\n }\n\n onMount(() => {\n debug('mount FocusTracker')\n const window = getWindow()\n if (window) {\n window.addEventListener('focusin', handleFocusIn, true)\n window.addEventListener('focusout', handleFocusOut, true)\n }\n })\n\n onDestroy(() => {\n debug('destroy FocusTracker')\n const window = getWindow()\n if (window) {\n window.removeEventListener('focusin', handleFocusIn, true)\n window.removeEventListener('focusout', handleFocusOut, true)\n }\n })\n}\n","<svelte:options immutable={true} />\n\n<script lang=\"ts\">\n import Icon from 'svelte-awesome'\n import type { MessageAction } from '$lib/types'\n import type { IconDefinition } from '@fortawesome/free-solid-svg-icons'\n import { onDestroy } from 'svelte'\n\n export let type: 'success' | 'error' | 'warning' | 'info' = 'success'\n export let icon: IconDefinition | undefined = undefined\n export let message: string | undefined = undefined\n export let actions: MessageAction[] = []\n export let onClick: (() => void) | undefined = undefined\n export let onClose: (() => void) | undefined = undefined\n\n if (onClose) {\n onDestroy(onClose)\n }\n\n function handleClick() {\n if (onClick) {\n onClick()\n }\n }\n</script>\n\n<div class=\"jse-message jse-{type}\">\n <!-- svelte-ignore a11y-click-events-have-key-events -->\n <div\n role=\"button\"\n tabindex=\"-1\"\n class=\"jse-text\"\n class:jse-clickable={!!onClick}\n on:click={handleClick}\n >\n <div class=\"jse-text-centered\">\n {#if icon}\n <Icon data={icon} />\n {/if}\n {message}\n </div>\n </div>\n <div class=\"jse-actions\">\n {#each actions as action}\n <button\n type=\"button\"\n on:click={() => {\n if (action.onClick) {\n action.onClick()\n }\n }}\n on:mousedown={() => {\n if (action.onMouseDown) {\n action.onMouseDown()\n }\n }}\n class=\"jse-button jse-action jse-primary\"\n title={action.title}\n disabled={action.disabled}\n >\n {#if action.icon}\n <Icon data={action.icon} />\n {/if}\n {action.text}\n </button>\n {/each}\n </div>\n</div>\n\n<style src=\"./Message.scss\"></style>\n","<svelte:options immutable={true} />\n\n<script lang=\"ts\">\n import {\n faAngleDown,\n faAngleRight,\n faExclamationTriangle\n } from '@fortawesome/free-solid-svg-icons'\n import { isEmpty } from 'lodash-es'\n import Icon from 'svelte-awesome'\n import { stringifyJSONPath } from '$lib/utils/pathUtils.js'\n import { ValidationSeverity, type ValidationError } from '$lib/types.js'\n import { MAX_VALIDATION_ERRORS } from '$lib/constants.js'\n import { limit } from '$lib/utils/arrayUtils.js'\n\n export let validationErrors: ValidationError[]\n export let selectError: (error: ValidationError) => void\n\n $: count = validationErrors.length\n\n let expanded = true\n\n function collapse() {\n expanded = false\n }\n\n function expand() {\n expanded = true\n }\n\n function getMaxSeverity(errors: ValidationError[]): ValidationSeverity | undefined {\n const severities = [\n ValidationSeverity.error,\n ValidationSeverity.warning,\n ValidationSeverity.info\n ]\n\n return severities.find((severity) => errors.some((error) => error.severity === severity))\n }\n</script>\n\n{#if !isEmpty(validationErrors)}\n <div class=\"jse-validation-errors-overview\">\n {#if expanded || count === 1}\n <table class=\"jse-validation-errors-overview-expanded\">\n <tbody>\n {#each limit(validationErrors, MAX_VALIDATION_ERRORS) as validationError, index}\n <tr\n class=\"jse-validation-{validationError.severity}\"\n tabindex=\"0\"\n on:click={() => {\n // trigger on the next tick to prevent the editor not getting focus\n setTimeout(() => selectError(validationError))\n }}\n >\n <td class=\"jse-validation-error-icon\">\n <Icon data={faExclamationTriangle} />\n </td>\n <td class=\"jse-validation-error-path\">\n {stringifyJSONPath(validationError.path)}\n </td>\n <td class=\"jse-validation-error-message\">\n {validationError.message}\n </td>\n <td class=\"jse-validation-error-action\">\n {#if index === 0 && validationErrors.length > 1}\n <button\n type=\"button\"\n class=\"jse-validation-errors-collapse\"\n on:click|stopPropagation={collapse}\n title=\"折叠验证错误\"\n >\n <Icon data={faAngleDown} />\n </button>\n {/if}\n </td>\n </tr>\n {/each}\n\n {#if count > MAX_VALIDATION_ERRORS}\n <tr class=\"jse-validation-error\">\n <td></td>\n <td></td>\n <td>(and {count - MAX_VALIDATION_ERRORS} more errors)</td>\n <td></td>\n </tr>\n {/if}\n </tbody>\n </table>\n {:else}\n <table class=\"jse-validation-errors-overview-collapsed\">\n <tbody>\n <tr class=\"jse-validation-{getMaxSeverity(validationErrors)}\" on:click={expand}>\n <td class=\"jse-validation-error-icon\">\n <Icon data={faExclamationTriangle} />\n </td>\n <td class=\"jse-validation-error-count\">\n {count} validation errors\n <div class=\"jse-validation-errors-expand\">\n <Icon data={faAngleRight} />\n </div>\n </td>\n </tr>\n </tbody>\n </table>\n {/if}\n </div>\n{/if}\n\n<style src=\"./ValidationErrorsOverview.scss\"></style>\n","type Callback = () => void\n\n/**\n * The provided callback is invoked when the user presses Escape, and then stops propagation of the event.\n */\nexport function onEscape(element: HTMLElement | undefined, callback: Callback) {\n if (!element) {\n return undefined\n }\n\n function handleKeyDown(event: KeyboardEvent) {\n if (event.key === 'Escape') {\n event.preventDefault()\n event.stopPropagation()\n callback()\n }\n }\n\n element.addEventListener('keydown', handleKeyDown)\n\n return {\n destroy() {\n element.removeEventListener('keydown', handleKeyDown)\n }\n }\n}\n","<script lang=\"ts\">\n // code based on: https://svelte.dev/examples/modal\n import { onEscape } from '$lib/actions/onEscape.js'\n import { onDestroy, onMount } from 'svelte'\n import { classnames } from '$lib/utils/cssUtils.js'\n\n export let className: string | undefined = undefined\n export let fullscreen = false\n export let onClose: () => void\n\n let dialog: HTMLDialogElement\n\n onMount(() => dialog.showModal())\n onDestroy(() => dialog.close())\n\n function close() {\n onClose()\n }\n</script>\n\n<dialog\n bind:this={dialog}\n on:close={close}\n on:pointerdown|self={close}\n on:cancel|preventDefault\n use:onEscape={close}\n class={classnames('jse-modal', className)}\n class:jse-fullscreen={fullscreen}\n>\n <div class=\"jse-modal-inner\">\n <slot />\n </div>\n</dialog>\n\n<style lang=\"scss\">\n @use '../../themes/defaults.scss';\n @use '../../styles.scss';\n\n dialog.jse-modal {\n border-radius: styles.$border-radius;\n font-size: defaults.$padding; // for some reason that I don't understand, the font-size of the dialog is used as margin around the dialog\n border: none;\n padding: 0;\n display: flex;\n min-width: 0;\n margin: auto;\n overflow: visible;\n transition:\n width 0.1s ease-in-out,\n height 0.1s ease-in-out;\n\n &.jse-sort-modal {\n width: 400px;\n }\n\n &.jse-repair-modal {\n width: 600px;\n height: 500px;\n }\n\n &.jse-jsoneditor-modal {\n width: 800px;\n height: 600px;\n }\n\n &.jse-transform-modal {\n width: 1200px;\n height: 800px;\n }\n\n &.jse-fullscreen {\n width: 100%;\n height: 100%;\n }\n\n &::backdrop {\n background: defaults.$modal-overlay-background;\n }\n\n &[open] {\n animation: zoom 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);\n }\n\n &[open]::backdrop {\n animation: fade 0.2s ease-out;\n }\n\n & .jse-modal-inner {\n @include styles.jse-modal-style;\n }\n\n @keyframes zoom {\n from {\n transform: scale(0.95);\n }\n to {\n transform: scale(1);\n }\n }\n\n @keyframes fade {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n }\n\n // styling for the select box, svelte-select\n // see docs: https://github.com/rob-balfre/svelte-select#css-custom-properties-variables\n :global(.svelte-select) {\n --border: #{defaults.$svelte-select-border};\n --item-is-active-bg: #{defaults.$svelte-select-item-is-active-bg};\n --border-radius: #{defaults.$svelte-select-border-radius};\n --background: #{defaults.$svelte-select-background};\n --padding: #{defaults.$svelte-select-padding};\n --multi-select-padding: #{defaults.$svelte-select-multi-select-padding};\n --font-size: #{defaults.$svelte-select-font-size};\n --height: 36px;\n --multi-item-height: 28px;\n --multi-item-margin: 2px;\n --multi-item-padding: 2px 8px;\n --multi-item-border-radius: 6px;\n --indicator-top: 8px;\n }\n }\n</style>\n","<svelte:options immutable={true} />\n\n<script lang=\"ts\">\n import { isMacDevice } from '$lib/utils/navigatorUtils.js'\n import Header from './Header.svelte'\n import Modal from './Modal.svelte'\n\n export let onClose: () => void\n\n const ctrl = isMacDevice() ? '⌘' : 'Ctrl'\n</script>\n\n<Modal {onClose} className=\"jse-copy-paste\">\n <Header title=\"复制和粘贴\" {onClose} />\n\n <div class=\"jse-modal-contents\">\n <div>剪贴板权限被浏览器禁用。你可以使用:</div>\n\n <div class=\"jse-shortcuts\">\n <div class=\"jse-shortcut\">\n <div class=\"jse-key\">\n {ctrl}+C\n </div>\n 复制\n </div>\n <div class=\"jse-shortcut\">\n <div class=\"jse-key\">\n {ctrl}+X\n </div>\n 剪切\n </div>\n <div class=\"jse-shortcut\">\n <div class=\"jse-key\">\n {ctrl}+V\n </div>\n 粘贴\n </div>\n </div>\n\n <div class=\"jse-actions\">\n <button type=\"button\" class=\"jse-primary\" on:click={onClose}> 关闭 </button>\n </div>\n </div>\n</Modal>\n\n<style src=\"./CopyPasteModal.scss\"></style>\n","<svelte:options immutable={true} />\n\n<script lang=\"ts\">\n import Icon from 'svelte-awesome'\n import type { MenuItem } from '$lib/types'\n import { isMenuButton, isMenuSeparator, isMenuSpace } from '$lib/typeguards.js'\n\n export let items: MenuItem[] = []\n\n function unknownMenuItem(item: MenuItem): string {\n console.error('Unknown type of menu item', item)\n return '???'\n }\n</script>\n\n<div class=\"jse-menu\">\n <slot name=\"left\" />\n\n {#each items as item}\n {#if isMenuSeparator(item)}\n <div class=\"jse-separator\"></div>\n {:else if isMenuSpace(item)}\n <div class=\"jse-space\"></div>\n {:else if isMenuButton(item)}\n <button\n type=\"button\"\n class=\"jse-button {item.className}\"\n on:click={item.onClick}\n title={item.title}\n disabled={item.disabled || false}\n >\n {#if item.icon}\n <Icon data={item.icon} />\n {/if}\n {#if item.text}\n {item.text}\n {/if}\n </button>\n {:else}\n {unknownMenuItem(item)}\n {/if}\n {/each}\n\n <slot name=\"right\" />\n</div>\n\n<style src=\"./Menu.scss\"></style>\n","<svelte:options immutable={true} />\n\n<script lang=\"ts\">\n import {\n faArrowDown,\n faCheck,\n faExclamationTriangle,\n faTimes,\n faWrench\n } from '@fortawesome/free-solid-svg-icons'\n import { createDebug } from '$lib/utils/debug.js'\n import Message from '../../controls/Message.svelte'\n import { normalizeJsonParseError } from '$lib/utils/jsonUtils.js'\n import Menu from '../../controls/Menu.svelte'\n import type { MenuItem, ParseError } from '$lib/types.js'\n\n export let text = ''\n export let readOnly = false\n export let onParse: (text: string) => void\n export let onRepair: (text: string) => string\n export let onChange: ((updatedText: string) => void) | undefined = undefined\n export let onApply: (repairedText: string) => void\n export let onCancel: () => void\n\n const debug = createDebug('jsoneditor:JSONRepair')\n\n let domTextArea: HTMLTextAreaElement\n\n $: error = getErrorMessage(text)\n $: repairable = isRepairable(text)\n\n $: debug('error', error)\n\n function getErrorMessage(jsonText: string): ParseError | undefined {\n try {\n onParse(jsonText)\n return undefined\n } catch (err) {\n return normalizeJsonParseError(jsonText, (err as Error).message)\n }\n }\n\n function isRepairable(jsonText: string) {\n try {\n onRepair(jsonText)\n return true\n } catch {\n return false\n }\n }\n\n function goToError() {\n if (domTextArea && error) {\n const position = error.position !== undefined ? error.position : 0\n domTextArea.setSelectionRange(position, position)\n domTextArea.focus()\n }\n }\n\n function handleChange(event: Event & { currentTarget: EventTarget & HTMLTextAreaElement }) {\n debug('handleChange')\n\n const value = (event.target as HTMLTextAreaElement).value\n\n if (text === value) {\n return\n }\n\n text = value\n\n if (onChange) {\n onChange(text)\n }\n }\n\n function handleApply() {\n onApply(text)\n }\n\n function handleRepair() {\n try {\n // TODO: simpleJsonRepair should also partially apply fixes. Now it's all or nothing\n text = onRepair(text)\n\n if (onChange) {\n onChange(text)\n }\n } catch {\n // no need to do something with the error\n }\n }\n\n let items: MenuItem[]\n $: items = [\n {\n type: 'space'\n },\n {\n type: 'button',\n icon: faTimes,\n title: 'Cancel repair',\n className: 'jse-cancel',\n onClick: onCancel\n }\n ]\n\n $: gotoAction = {\n icon: faArrowDown,\n text: '一键定位',\n title: '跳转到解析错误位置',\n onClick: goToError\n }\n\n $: repairAction = {\n icon: faWrench,\n text: '自动修复',\n title: '自动修复JSON',\n onClick: handleRepair\n }\n\n $: errorActions = repairable ? [gotoAction, repairAction] : [gotoAction]\n\n $: successActions = [\n {\n icon: faCheck,\n text: '应用',\n title: '应用修复完成的JSON',\n disabled: readOnly,\n onClick: handleApply\n }\n ]\n</script>\n\n<div class=\"jse-json-repair-component\">\n <Menu {items}>\n <div slot=\"left\" class=\"jse-info\">修复无效的 JSON,然后单击 “应用”</div>\n </Menu>\n\n {#if error}\n <Message\n type=\"error\"\n icon={faExclamationTriangle}\n message={`无法解析 JSON: ${error.message}`}\n actions={errorActions}\n />\n {:else}\n <Message type=\"success\" message=\"JSON 现在有效,可以解析。\" actions={successActions} />\n {/if}\n <textarea\n bind:this={domTextArea}\n on:input={handleChange}\n readonly={readOnly}\n class=\"jse-json-text\"\n autocomplete=\"off\"\n autocapitalize=\"off\"\n spellcheck=\"false\">{text}</textarea\n >\n</div>\n\n<style src=\"./JSONRepairComponent.scss\"></style>\n","<svelte:options immutable={true} />\n\n<script lang=\"ts\">\n import JSONRepairComponent from './repair/JSONRepairComponent.svelte'\n import Modal from './Modal.svelte'\n\n export let text: string\n export let onParse: (text: string) => void\n export let onRepair: (text: string) => string\n export let onApply: (repairedText: string) => void\n export let onClose: () => void\n\n function handleApply(repairedText: string) {\n onApply(repairedText)\n onClose()\n }\n\n function handleCancel() {\n onClose()\n }\n</script>\n\n<Modal {onClose} className=\"jse-repair-modal\">\n <JSONRepairComponent\n bind:text\n {onParse}\n {onRepair}\n onApply={handleApply}\n onCancel={handleCancel}\n />\n</Modal>\n","<svelte:options immutable={true} />\n\n<script lang=\"ts\">\n import { getExpandItemsSections } from '$lib/logic/expandItemsSections.js'\n import type { JSONSelection, Section, VisibleSection, JSONEditorContext } from '$lib/types.js'\n import type { JSONPath } from 'immutable-json-patch'\n import { pathInSelection } from '$lib/logic/selection.js'\n\n export let visibleSections: VisibleSection[]\n export let sectionIndex: number\n export let total: number\n export let path: JSONPath\n export let selection: JSONSelection | undefined\n export let onExpandSection: (path: JSONPath, section: Section) => void\n export let context: JSONEditorContext\n\n $: visibleSection = visibleSections[sectionIndex]\n\n $: startIndex = visibleSection.end\n $: endIndex = visibleSections[sectionIndex + 1] ? visibleSections[sectionIndex + 1].start : total\n\n $: selected = pathInSelection(context.getJson(), selection, path.concat(String(startIndex)))\n\n $: expandItemsSections = getExpandItemsSections(startIndex, endIndex)\n\n function handleMouseMove(event: MouseEvent) {\n // prevent the whole array from being selected whilst dragging over\n // a section with collapsed items\n event.stopPropagation()\n }\n</script>\n\n<div\n role=\"none\"\n class=\"jse-collapsed-items\"\n class:jse-selected={selected}\n on:mousemove={handleMouseMove}\n style:--level={path.length + 2}\n>\n <div>\n <div class=\"jse-text\">Items {startIndex}-{endIndex}</div>\n {#each expandItemsSections as expandItemsSection}<button\n type=\"button\"\n class=\"jse-expand-items\"\n on:click={() => onExpandSection(path, expandItemsSection)}\n >\n show {expandItemsSection.start}-{expandItemsSection.end}\n </button>\n {/each}\n </div>\n</div>\n\n<style src=\"./CollapsedItems.scss\"></style>\n","<svelte:options immutable={true} />\n\n<script lang=\"ts\">\n import { faCaretDown } from '@fortawesome/free-solid-svg-icons'\n import Icon from 'svelte-awesome'\n import {\n CONTEXT_MENU_EXPLANATION,\n CONTEXT_MENU_HEIGHT,\n CONTEXT_MENU_WIDTH\n } from '$lib/constants.js'\n import type { OnContextMenu } from '$lib/types'\n\n export let root: boolean = false\n export let insert: boolean = false\n export let selected: boolean\n export let onContextMenu: OnContextMenu\n\n function handleClick(event: MouseEvent & { currentTarget: EventTarget & HTMLButtonElement }) {\n let buttonElem: Element | undefined = event.target as HTMLButtonElement\n while (buttonElem && buttonElem.nodeName !== 'BUTTON') {\n buttonElem = buttonElem.parentNode as Element\n }\n\n if (buttonElem) {\n onContextMenu({\n anchor: buttonElem,\n left: 0,\n top: 0,\n width: CONTEXT_MENU_WIDTH,\n height: CONTEXT_MENU_HEIGHT,\n offsetTop: 2,\n offsetLeft: 0,\n showTip: true\n })\n }\n }\n</script>\n\n<button\n type=\"button\"\n class=\"jse-context-menu-pointer\"\n class:jse-root={root}\n class:jse-insert={insert}\n class:jse-selected={selected}\n title={CONTEXT_MENU_EXPLANATION}\n on:click={handleClick}\n>\n <Icon data={faCaretDown} />\n</button>\n\n<style src=\"./ContextMenuPointer.scss\"></style>\n","<script lang=\"ts\">\n import type { ExtendedSearchResultItem, JSONEditorContext, JSONSelection } from '$lib/types.js'\n import type { JSONPath } from 'immutable-json-patch'\n import { isEditingSelection, isValueSelection } from '$lib/logic/selection.js'\n import { isSvelteActionRenderer } from '$lib/typeguards.js'\n\n interface Props {\n path: JSONPath\n value: unknown\n context: JSONEditorContext\n enforceString: boolean\n selection: JSONSelection | undefined\n searchResultItems: ExtendedSearchResultItem[] | undefined\n }\n\n const { path, value, context, enforceString, selection, searchResultItems }: Props = $props()\n\n const isEditing = $derived(isValueSelection(selection) && isEditingSelection(selection))\n\n const renderers = $derived(\n context.onRenderValue({\n path,\n value,\n mode: context.mode,\n truncateTextSize: context.truncateTextSize,\n readOnly: context.readOnly,\n enforceString,\n isEditing,\n parser: context.parser,\n normalization: context.normalization,\n selection,\n searchResultItems,\n onPatch: context.onPatch,\n onPasteJson: context.onPasteJson,\n onSelect: context.onSelect,\n onFind: context.onFind,\n findNextInside: context.findNextInside,\n focus: context.focus\n })\n )\n</script>\n\n{#each renderers as renderer}\n {#if isSvelteActionRenderer(renderer)}\n {@const action = renderer.action}\n <div\n role=\"button\"\n tabindex=\"-1\"\n class=\"jse-value\"\n data-type=\"selectable-value\"\n use:action={renderer.props}\n ></div>\n {:else}\n {@const Component = renderer.component}\n <Component {...renderer.props} />\n {/if}\n{/each}\n","// used by JSONNode during dragging\nimport type { JSONPath } from 'immutable-json-patch'\n\nexport const singleton: Singleton = {\n selecting: false,\n selectionAnchor: undefined, // Path\n selectionAnchorType: undefined, // Selection type\n selectionFocus: undefined, // Path\n\n dragging: false\n}\n\ninterface Singleton {\n selecting: boolean\n selectionAnchor: JSONPath | undefined\n selectionAnchorType: string | undefined\n selectionFocus: JSONPath | undefined\n\n dragging: boolean\n}\n","import { createMultiSelection, getEndPath, getStartPath } from './selection.js'\nimport { initial, isEqual } from 'lodash-es'\nimport type { JSONPatchDocument } from 'immutable-json-patch'\nimport { getIn } from 'immutable-json-patch'\nimport { moveInsideParent } from './operations.js'\nimport type {\n DragInsideAction,\n DragInsideProps,\n JSONSelection,\n MultiSelection,\n RenderedItem\n} from '$lib/types'\n\nexport interface MoveSelectionProps {\n json: unknown\n selection: JSONSelection | undefined\n deltaY: number\n items: RenderedItem[]\n}\n\nexport interface MoveSelectionResult {\n operations: JSONPatchDocument | undefined\n updatedSelection: JSONSelection | undefined\n offset: number\n}\n\nexport function onMoveSelection({\n json,\n selection,\n deltaY,\n items\n}: MoveSelectionProps): MoveSelectionResult {\n if (!selection) {\n return {\n operations: undefined,\n updatedSelection: undefined,\n offset: 0\n }\n }\n\n const dragInsideAction =\n deltaY < 0\n ? findSwapPathUp({ json, selection, deltaY, items })\n : findSwapPathDown({ json, selection, deltaY, items })\n\n if (!dragInsideAction || dragInsideAction.offset === 0) {\n return {\n operations: undefined,\n updatedSelection: undefined,\n offset: 0\n }\n }\n\n const operations = moveInsideParent(json, selection, dragInsideAction)\n\n const path = initial(getStartPath(json, selection))\n const value = getIn(json, path)\n if (Array.isArray(value)) {\n const updatedSelection = createUpdatedArraySelection({\n items,\n json,\n selection,\n offset: dragInsideAction.offset\n })\n\n return {\n operations,\n updatedSelection,\n offset: dragInsideAction.offset\n }\n } else {\n // object\n return {\n operations,\n updatedSelection: undefined,\n offset: dragInsideAction.offset\n }\n }\n}\n\nfunction findSwapPathUp({\n json,\n items,\n selection,\n deltaY\n}: DragInsideProps): DragInsideAction | undefined {\n const initialPath = getStartPath(json, selection)\n const initialIndex = items.findIndex((item) => isEqual(item.path, initialPath))\n\n const prevHeight = () => items[index - 1]?.height\n\n let index = initialIndex\n let cumulativeHeight = 0\n\n while (prevHeight() !== undefined && Math.abs(deltaY) > cumulativeHeight + prevHeight() / 2) {\n cumulativeHeight += prevHeight()\n index -= 1\n }\n\n const beforePath = items[index].path\n const offset = index - initialIndex\n\n return index !== initialIndex && items[index] !== undefined ? { beforePath, offset } : undefined\n}\n\nfunction findSwapPathDown({\n json,\n items,\n selection,\n deltaY\n}: DragInsideProps): DragInsideAction | undefined {\n const initialPath = getEndPath(json, selection)\n const initialIndex = items.findIndex((item) => isEqual(item.path, initialPath))\n\n let cumulativeHeight = 0\n let index = initialIndex\n\n const nextHeight = () => items[index + 1]?.height\n\n while (nextHeight() !== undefined && Math.abs(deltaY) > cumulativeHeight + nextHeight() / 2) {\n cumulativeHeight += nextHeight()\n index += 1\n }\n\n const parentPath = initial(initialPath)\n const parent = getIn(json, parentPath)\n const isArray = Array.isArray(parent)\n const beforeIndex = isArray ? index : index + 1\n const beforePath = items[beforeIndex]?.path\n const offset = index - initialIndex\n\n return beforePath ? { beforePath, offset } : { append: true, offset }\n}\n\ninterface UpdatedArraySelectionProps {\n items: RenderedItem[]\n json: unknown\n selection: JSONSelection\n offset: number\n}\n\nfunction createUpdatedArraySelection({\n items,\n json,\n selection,\n offset\n}: UpdatedArraySelectionProps): MultiSelection {\n const startPath = getStartPath(json, selection)\n const endPath = getEndPath(json, selection)\n\n const startIndex = items.findIndex((item) => isEqual(item.path, startPath))\n const endIndex = items.findIndex((item) => isEqual(item.path, endPath))\n\n const anchorPath = items[startIndex + offset]?.path\n const focusPath = items[endIndex + offset]?.path\n\n return createMultiSelection(anchorPath, focusPath)\n}\n","<script lang=\"ts\">\n import { faExclamationTriangle } from '@fortawesome/free-solid-svg-icons'\n import Icon from 'svelte-awesome'\n import { getContext } from 'svelte'\n import { tooltip } from '../../controls/tooltip/tooltip.js'\n import type { AbsolutePopupContext, NestedValidationError, ValidationError } from '$lib/types.js'\n import { isNestedValidationError } from '$lib/typeguards.js'\n\n const absolutePopupContext = getContext<AbsolutePopupContext>('absolute-popup')\n\n export let validationError: NestedValidationError | ValidationError\n export let onExpand: (event: MouseEvent) => void\n\n $: text =\n isNestedValidationError(validationError) && validationError.isChildError\n ? 'Contains invalid data'\n : validationError.message\n</script>\n\n<button\n type=\"button\"\n class=\"jse-validation-{validationError.severity}\"\n on:click={onExpand}\n use:tooltip={{ text, ...absolutePopupContext }}\n>\n <Icon data={faExclamationTriangle} />\n</button>\n\n<style src=\"./ValidationErrorIcon.scss\"></style>\n","<svelte:options immutable={true} />\n\n<script lang=\"ts\">\n import { faCaretDown, faCaretRight } from '@fortawesome/free-solid-svg-icons'\n import type { JSONPath, JSONPointer } from 'immutable-json-patch'\n import { appendToJSONPointer, parseJSONPointer } from 'immutable-json-patch'\n import { initial, isEqual, last, range } from 'lodash-es'\n import Icon from 'svelte-awesome'\n import {\n DEFAULT_VISIBLE_SECTIONS,\n HOVER_COLLECTION,\n HOVER_INSERT_AFTER,\n HOVER_INSERT_INSIDE,\n INSERT_EXPLANATION\n } from '$lib/constants.js'\n import { getEnforceString, getVisibleCaretPositions } from '$lib/logic/documentState.js'\n import { rename } from '$lib/logic/operations.js'\n import {\n createAfterSelection,\n createInsideSelection,\n createMultiSelection,\n fromCaretPosition,\n fromSelectionType,\n getAnchorPath,\n getEndPath,\n getFocusPath,\n getSelectionPaths,\n getStartPath,\n isAfterSelection,\n isEditingSelection,\n isInsideSelection,\n isKeySelection,\n isMultiSelection,\n isValueSelection,\n pathInSelection,\n selectionIfOverlapping\n } from '$lib/logic/selection.js'\n import {\n getDataPathFromTarget,\n getSelectionTypeFromTarget,\n isChildOfAttribute,\n isChildOfNodeName,\n isContentEditableDiv\n } from '$lib/utils/domUtils.js'\n import CollapsedItems from './CollapsedItems.svelte'\n import ContextMenuPointer from '../../../components/controls/contextmenu/ContextMenuPointer.svelte'\n import JSONKey from './JSONKey.svelte'\n import JSONValue from './JSONValue.svelte'\n import { singleton } from './singleton.js'\n import { createDebug } from '$lib/utils/debug.js'\n import { onMoveSelection } from '$lib/logic/dragging.js'\n import { forEachIndex, moveItems } from '$lib/utils/arrayUtils.js'\n import type {\n AbsolutePopupOptions,\n CaretPosition,\n DocumentState,\n DraggingState,\n JSONSelection,\n NestedValidationError,\n SearchResults,\n ValidationErrors,\n RenderedItem,\n TreeModeContext,\n VisibleSection\n } from '$lib/types'\n import { SelectionType } from '$lib/types.js'\n import {\n isArrayRecursiveState,\n isExpandableState,\n isObjectRecursiveState\n } from '$lib/typeguards.js'\n import { filterKeySearchResults, filterValueSearchResults } from '$lib/logic/search.js'\n import ValidationErrorIcon from './ValidationErrorIcon.svelte'\n import { isObject } from '$lib/utils/typeUtils.js'\n import { classnames } from '$lib/utils/cssUtils.js'\n import { isCtrlKeyDown } from 'svelte-jsoneditor/utils/keyBindings'\n import Tag from '../../../components/controls/Tag.svelte'\n import { flushSync } from 'svelte'\n\n // We pass `pointer` instead of `path` because pointer (a string) is immutable.\n // Without it, *all* nodes would re-render on *every* change in JSON or DocumentState,\n // because the path changes every time by re-creating it.\n export let pointer: JSONPointer\n export let value: unknown\n export let state: DocumentState | undefined\n export let validationErrors: ValidationErrors | undefined\n export let searchResults: SearchResults | undefined\n export let selection: JSONSelection | undefined\n export let context: TreeModeContext\n export let onDragSelectionStart: (\n event: MouseEvent & { currentTarget: EventTarget & HTMLDivElement }\n ) => void\n\n const debug = createDebug('jsoneditor:JSONNode')\n\n let hover: string | undefined = undefined\n let hoverTimer: number | undefined = undefined\n let dragging: DraggingState | undefined = undefined\n\n let path: JSONPath\n $: path = parseJSONPointer(pointer)\n $: dataPath = encodeURIComponent(pointer) // This is the same as encodeDataPath(path) but faster\n\n let expanded: boolean\n $: expanded = isExpandableState(state) ? state.expanded : false\n\n let enforceString: boolean\n $: enforceString = getEnforceString(value, state, [])\n\n let visibleSections: VisibleSection[] | undefined\n $: visibleSections = isArrayRecursiveState(state) ? state.visibleSections : undefined\n\n let validationError: NestedValidationError | undefined\n $: validationError = validationErrors?.validationError\n\n let isNodeSelected: boolean\n // eslint-disable-next-line svelte/no-unused-svelte-ignore\n // svelte-ignore reactive_declaration_non_reactive_property\n $: isNodeSelected = pathInSelection(context.getJson(), selection, path)\n\n $: root = path.length === 0\n\n /**\n * Get sorted keys, applying dragging order\n */\n function getKeys(object: Record<string, unknown>, dragging: DraggingState | undefined): string[] {\n const keys = Object.keys(object)\n\n // reorder the keys whilst dragging\n if (dragging && dragging.offset !== 0) {\n return moveItems(\n keys,\n dragging.selectionStartIndex,\n dragging.selectionItemsCount,\n dragging.offset\n )\n }\n\n return keys\n }\n\n interface ItemIndex {\n index: number\n gutterIndex: number\n }\n\n function getItems(\n array: Array<unknown>,\n visibleSection: VisibleSection,\n dragging: DraggingState | undefined\n ): ItemIndex[] {\n const start = visibleSection.start\n const end = Math.min(visibleSection.end, array.length)\n const indices = range(start, end)\n\n // reorder the items whilst dragging\n if (dragging && dragging.offset !== 0) {\n return moveItems(\n indices,\n dragging.selectionStartIndex,\n dragging.selectionItemsCount,\n dragging.offset\n ).map((index, gutterIndex) => ({ index, gutterIndex }))\n }\n\n return indices.map((index) => ({ index, gutterIndex: index }))\n }\n\n function toggleExpand(event: MouseEvent) {\n event.stopPropagation()\n\n const recursive = isCtrlKeyDown(event)\n context.onExpand(path, !expanded, recursive)\n }\n\n function handleExpand() {\n context.onExpand(path, true)\n }\n\n function handleUpdateKey(oldKey: string, newKey: string): string {\n const operations = rename(path, Object.keys(value as Record<string, unknown>), oldKey, newKey)\n context.onPatch(operations)\n\n // It is possible that the applied key differs from newKey,\n // to prevent duplicate keys. Here we figure out the actually applied key\n return last(parseJSONPointer(operations[0].path)) as string\n }\n\n function handleMouseDown(event: MouseEvent & { currentTarget: EventTarget & HTMLDivElement }) {\n // only handle when the left or right mouse button is pressed, not the middle mouse button (scroll wheel)\n if (event.buttons !== 1 && event.buttons !== 2) {\n return\n }\n\n // check if the mouse down is not happening in the key or value input fields or on a button\n if (\n isContentEditableDiv(event.target as HTMLElement) ||\n (event.buttons === 1 && isChildOfNodeName(event.target as Element, 'BUTTON')) // left mouse on a button\n ) {\n return\n }\n\n event.stopPropagation()\n event.preventDefault()\n\n // due to event.stopPropagation here and there, the focus tracker does not receive this mouse event.\n // make sure the editor has focus\n context.focus()\n\n // we attach the mousemove and mouseup event listeners to the global document,\n // so we will not miss if the mouse events happen outside the editor\n document.addEventListener('mousemove', handleMouseMoveGlobal, true)\n document.addEventListener('mouseup', handleMouseUpGlobal)\n\n const anchorType = getSelectionTypeFromTarget(event.target as Element)\n const json = context.getJson()\n const documentState = context.getDocumentState()\n\n if (\n selection &&\n anchorType !== SelectionType.after &&\n anchorType !== SelectionType.inside &&\n (selection.type === anchorType || selection.type === SelectionType.multi) &&\n pathInSelection(json, selection, path)\n ) {\n // when right-clicking inside the current selection, do nothing: context menu will open\n // when left-clicking inside the current selection, do nothing: it can be the start of dragging\n if (event.button === 0) {\n onDragSelectionStart(event)\n }\n\n return\n }\n\n // TODO: refactor dragging, there are now two separate mechanisms handling mouse movement: with dragging.* and with singleton.*\n singleton.selecting = true\n singleton.selectionAnchor = path\n singleton.selectionAnchorType = anchorType\n singleton.selectionFocus = path\n\n if (event.shiftKey) {\n // Shift+Click will select multiple entries\n const fullSelection = context.getSelection()\n if (fullSelection) {\n context.onSelect(createMultiSelection(getAnchorPath(fullSelection), path))\n }\n } else {\n if (anchorType === SelectionType.multi) {\n if (root && (event.target as Element).hasAttribute('data-path')) {\n const lastCaretPosition = last(\n getVisibleCaretPositions(value, documentState)\n ) as CaretPosition\n context.onSelect(fromCaretPosition(lastCaretPosition))\n } else {\n context.onSelect(createMultiSelection(path, path))\n }\n } else if (json !== undefined) {\n context.onSelect(fromSelectionType(anchorType, path))\n }\n }\n }\n\n function handleMouseMove(event: MouseEvent & { currentTarget: EventTarget & HTMLDivElement }) {\n if (singleton.selecting) {\n event.preventDefault()\n event.stopPropagation()\n\n if (singleton.selectionFocus === undefined) {\n // First move event, no selection yet.\n // Clear the default selection of the browser\n if (window.getSelection) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n window.getSelection().empty()\n }\n }\n\n const selectionType = getSelectionTypeFromTarget(event.target as Element)\n\n if (\n !isEqual(path, singleton.selectionFocus) ||\n selectionType !== singleton.selectionAnchorType\n ) {\n singleton.selectionFocus = path\n singleton.selectionAnchorType = selectionType // TODO: this is a bit ugly\n\n context.onSelect(\n createMultiSelection(\n singleton.selectionAnchor || singleton.selectionFocus,\n singleton.selectionFocus\n )\n )\n }\n }\n }\n\n function handleMouseMoveGlobal(event: MouseEvent) {\n context.onDrag(event)\n }\n\n function handleMouseUpGlobal(event: Event) {\n if (singleton.selecting) {\n singleton.selecting = false\n\n event.stopPropagation()\n }\n\n context.onDragEnd()\n\n document.removeEventListener('mousemove', handleMouseMoveGlobal, true)\n document.removeEventListener('mouseup', handleMouseUpGlobal)\n }\n\n function findContentTop() {\n return context.findElement([])?.getBoundingClientRect()?.top || 0\n }\n\n function calculateDeltaY(dragging: DraggingState, event: MouseEvent) {\n // calculate the contentOffset, this changes when scrolling\n const contentTop = findContentTop()\n const contentOffset = contentTop - dragging.initialContentTop\n\n // calculate the vertical mouse movement\n const clientOffset = event.clientY - dragging.initialClientY\n\n return clientOffset - contentOffset\n }\n\n function handleDragSelectionStart(\n event: MouseEvent & { currentTarget: EventTarget & HTMLDivElement }\n ) {\n if (context.readOnly || !selection) {\n return\n }\n\n const selectionParentPath = initial(getFocusPath(selection))\n if (!isEqual(path, selectionParentPath)) {\n // pass to parent\n onDragSelectionStart(event)\n\n return\n }\n\n // note that the returned items will be of one section only,\n // and when the selection is spread over multiple sections,\n // no items will be returned: this is not (yet) supported\n const items = getVisibleItemsWithHeights(selection, visibleSections || DEFAULT_VISIBLE_SECTIONS)\n\n debug('dragSelectionStart', { selection, items })\n\n if (!items) {\n debug('Cannot drag the current selection (probably spread over multiple sections)')\n return\n }\n\n const json = context.getJson()\n if (json === undefined) {\n return\n }\n const initialPath = getStartPath(json, selection)\n const selectionStartIndex = items.findIndex((item) => isEqual(item.path, initialPath))\n const { offset } = onMoveSelection({\n json,\n selection: context.getSelection(),\n deltaY: 0,\n items\n })\n\n dragging = {\n initialTarget: event.target as Element,\n initialClientY: event.clientY,\n initialContentTop: findContentTop(),\n selectionStartIndex,\n selectionItemsCount: getSelectionPaths(json, selection).length,\n items,\n offset,\n didMoveItems: false // whether items have been moved during dragging or not\n }\n singleton.dragging = true\n\n document.addEventListener('mousemove', handleDragSelection, true)\n document.addEventListener('mouseup', handleDragSelectionEnd)\n }\n\n function handleDragSelection(event: MouseEvent) {\n if (dragging) {\n const json = context.getJson()\n if (json === undefined) {\n return\n }\n\n const deltaY = calculateDeltaY(dragging, event)\n const { offset } = onMoveSelection({\n json,\n selection: context.getSelection(),\n deltaY,\n items: dragging.items\n })\n\n if (offset !== dragging.offset) {\n debug('drag selection', offset, deltaY)\n\n dragging = {\n ...dragging,\n offset,\n didMoveItems: true\n }\n }\n }\n }\n\n function handleDragSelectionEnd(event: MouseEvent) {\n if (dragging) {\n const json = context.getJson()\n if (json === undefined) {\n return\n }\n const deltaY = calculateDeltaY(dragging, event)\n const { operations, updatedSelection } = onMoveSelection({\n json,\n selection: context.getSelection(),\n deltaY,\n items: dragging.items\n })\n\n if (operations) {\n context.onPatch(operations, (_, patchedState) => ({\n state: patchedState,\n selection: updatedSelection ?? selection\n }))\n } else {\n // the user did click inside the selection and no contents have been dragged,\n // select the clicked item\n if (event.target === dragging.initialTarget && !dragging.didMoveItems) {\n const selectionType = getSelectionTypeFromTarget(event.target as Element)\n const path = getDataPathFromTarget(event.target as Element)\n if (path) {\n context.onSelect(fromSelectionType(selectionType, path))\n }\n }\n }\n\n dragging = undefined\n singleton.dragging = false\n\n document.removeEventListener('mousemove', handleDragSelection, true)\n document.removeEventListener('mouseup', handleDragSelectionEnd)\n }\n }\n\n /**\n * Get a list with all visible items and their rendered heights inside\n * this object or array\n */\n // TODO: extract and unit test getVisibleItemsWithHeights\n function getVisibleItemsWithHeights(\n selection: JSONSelection,\n visibleSections: VisibleSection[]\n ): RenderedItem[] | undefined {\n const items: RenderedItem[] = []\n\n function addHeight(prop: string) {\n const itemPath = path.concat(prop)\n const element = context.findElement(itemPath)\n if (element !== undefined) {\n items.push({\n path: itemPath,\n height: element.clientHeight\n })\n }\n }\n\n if (Array.isArray(value)) {\n const json = context.getJson()\n if (json === undefined) {\n return undefined\n }\n const startPath = getStartPath(json, selection)\n const endPath = getEndPath(json, selection)\n const startIndex = parseInt(last(startPath) as string, 10)\n const endIndex = parseInt(last(endPath) as string, 10)\n\n // find the section where the selection is\n // if the selection is spread over multiple visible sections,\n // we will not return any items, so dragging will not work there.\n // We do this to keep things simple for now.\n const currentSection = visibleSections.find((visibleSection) => {\n return startIndex >= visibleSection.start && endIndex <= visibleSection.end\n })\n\n if (!currentSection) {\n return undefined\n }\n\n const { start, end } = currentSection\n forEachIndex(start, Math.min(value.length, end), (index) => addHeight(String(index)))\n } else {\n // value is Object\n Object.keys(value as Record<string, unknown>).forEach(addHeight)\n }\n\n return items\n }\n\n function handleMouseOver(event: MouseEvent & { currentTarget: EventTarget & HTMLDivElement }) {\n if (singleton.selecting || singleton.dragging) {\n return\n }\n\n event.stopPropagation()\n\n if (isChildOfAttribute(event.target as Element, 'data-type', 'selectable-value')) {\n hover = HOVER_COLLECTION\n } else if (isChildOfAttribute(event.target as Element, 'data-type', 'selectable-key')) {\n hover = undefined\n } else if (\n isChildOfAttribute(event.target as Element, 'data-type', 'insert-selection-area-inside')\n ) {\n hover = HOVER_INSERT_INSIDE\n } else if (\n isChildOfAttribute(event.target as Element, 'data-type', 'insert-selection-area-after')\n ) {\n hover = HOVER_INSERT_AFTER\n }\n\n clearTimeout(hoverTimer)\n }\n\n function handleMouseOut(event: MouseEvent & { currentTarget: EventTarget & HTMLDivElement }) {\n event.stopPropagation()\n\n // to prevent \"flickering\" in the hovering state when hovering on the edge\n // of the insert area context menu button: it's visibility toggles when\n // `hover` toggles, which will alternating mouseout and mouseover events\n hoverTimer = window.setTimeout(() => (hover = undefined))\n }\n\n function handleInsertInside(event: MouseEvent) {\n if (!event.shiftKey) {\n event.stopPropagation()\n event.preventDefault()\n\n context.onSelect(createInsideSelection(path))\n }\n }\n\n function handleInsertAfter(event: MouseEvent) {\n if (!event.shiftKey) {\n event.stopPropagation()\n event.preventDefault()\n\n context.onSelect(createAfterSelection(path))\n }\n }\n\n function handleInsertInsideOpenContextMenu(contextMenuProps: AbsolutePopupOptions) {\n context.onSelect(createInsideSelection(path))\n\n // ensure the updated selection is propagated to JSONEditorRoot\n flushSync()\n\n context.onContextMenu(contextMenuProps)\n }\n\n function handleInsertAfterOpenContextMenu(contextMenuProps: AbsolutePopupOptions) {\n context.onSelect(createAfterSelection(path))\n\n // ensure the updated selection is propagated to JSONEditorRoot\n flushSync()\n\n context.onContextMenu(contextMenuProps)\n }\n</script>\n\n<!-- svelte-ignore a11y-mouse-events-have-key-events -->\n<div\n role=\"treeitem\"\n tabindex=\"-1\"\n class={classnames(\n 'jse-json-node',\n { 'jse-expanded': expanded },\n context.onClassName(path, value)\n )}\n data-path={dataPath}\n aria-selected={isNodeSelected}\n style:--level={path.length}\n class:jse-root={root}\n class:jse-selected={isNodeSelected && isMultiSelection(selection)}\n class:jse-selected-value={isNodeSelected && isValueSelection(selection)}\n class:jse-readonly={context.readOnly}\n class:jse-hovered={hover === HOVER_COLLECTION}\n on:mousedown={handleMouseDown}\n on:mousemove={handleMouseMove}\n on:mouseover={handleMouseOver}\n on:mouseout={handleMouseOut}\n>\n {#if Array.isArray(value)}\n <div class=\"jse-header-outer\">\n <div class=\"jse-header\">\n <button\n type=\"button\"\n class=\"jse-expand\"\n on:click={toggleExpand}\n title=\"展开或折叠该数组 (Ctrl+Click)\"\n >\n {#if expanded}\n <Icon data={faCaretDown} />\n {:else}\n <Icon data={faCaretRight} />\n {/if}\n </button>\n <slot name=\"identifier\" />\n {#if !root}\n <div class=\"jse-separator\">:</div>\n {/if}\n <div class=\"jse-meta\">\n <div class=\"jse-meta-inner\" data-type=\"selectable-value\">\n {#if expanded}\n <div class=\"jse-bracket\">[</div>\n <Tag>\n {value.length}\n {value.length === 1 ? 'item' : 'items'}\n </Tag>\n &nbsp;\n {:else}\n <div class=\"jse-bracket\">[</div>\n <Tag onclick={handleExpand}>\n {value.length}\n {value.length === 1 ? 'item' : 'items'}\n </Tag>\n <div class=\"jse-bracket\">]</div>\n {/if}\n </div>\n </div>\n {#if !context.readOnly && isNodeSelected && selection && (isValueSelection(selection) || isMultiSelection(selection)) && !isEditingSelection(selection) && isEqual(getFocusPath(selection), path)}\n <div class=\"jse-context-menu-pointer-anchor\">\n <ContextMenuPointer {root} selected={true} onContextMenu={context.onContextMenu} />\n </div>\n {/if}\n </div>\n {#if validationError && (!expanded || !validationError.isChildError)}\n <ValidationErrorIcon {validationError} onExpand={handleExpand} />\n {/if}\n {#if expanded}\n <div\n role=\"none\"\n class=\"jse-insert-selection-area jse-inside\"\n data-type=\"insert-selection-area-inside\"\n on:click={handleInsertInside}\n ></div>\n {:else}\n <div\n role=\"none\"\n class=\"jse-insert-selection-area jse-after\"\n data-type=\"insert-selection-area-after\"\n on:click={handleInsertAfter}\n ></div>\n {/if}\n </div>\n {#if expanded}\n <div class=\"jse-items\">\n {#if !context.readOnly && (hover === HOVER_INSERT_INSIDE || (isNodeSelected && isInsideSelection(selection)))}\n <div\n class=\"jse-insert-area jse-inside\"\n class:jse-hovered={hover === HOVER_INSERT_INSIDE}\n class:jse-selected={isNodeSelected && isInsideSelection(selection)}\n data-type=\"insert-selection-area-inside\"\n style:--level={path.length + 1}\n title={INSERT_EXPLANATION}\n >\n <ContextMenuPointer\n insert={true}\n selected={isNodeSelected && isInsideSelection(selection)}\n onContextMenu={handleInsertInsideOpenContextMenu}\n />\n </div>\n {/if}\n {#each visibleSections || DEFAULT_VISIBLE_SECTIONS as visibleSection, sectionIndex (sectionIndex)}\n {#each getItems(value, visibleSection, dragging) as item (item.index)}\n {@const nestedValidationErrors = isArrayRecursiveState(validationErrors)\n ? validationErrors.items[item.index]\n : undefined}\n\n {@const nestedSelection = selectionIfOverlapping(\n context.getJson(),\n selection,\n path.concat(String(item.index))\n )}\n\n <svelte:self\n value={value[item.index]}\n pointer={appendToJSONPointer(pointer, item.index)}\n state={isArrayRecursiveState(state) ? state.items[item.index] : undefined}\n validationErrors={nestedValidationErrors}\n searchResults={isArrayRecursiveState(searchResults)\n ? searchResults.items[item.index]\n : undefined}\n selection={nestedSelection}\n {context}\n onDragSelectionStart={handleDragSelectionStart}\n >\n <div slot=\"identifier\" class=\"jse-identifier\">\n <div class=\"jse-index\">{item.gutterIndex}</div>\n </div>\n </svelte:self>\n {/each}\n {#if visibleSection.end < value.length}\n <CollapsedItems\n visibleSections={visibleSections || DEFAULT_VISIBLE_SECTIONS}\n {sectionIndex}\n total={value.length}\n {path}\n onExpandSection={context.onExpandSection}\n {selection}\n {context}\n />\n {/if}\n {/each}\n </div>\n <div class=\"jse-footer-outer\">\n <div data-type=\"selectable-value\" class=\"jse-footer\">\n <span class=\"jse-bracket\">]</span>\n </div>\n {#if !root}\n <div\n role=\"none\"\n class=\"jse-insert-selection-area jse-after\"\n data-type=\"insert-selection-area-after\"\n on:click={handleInsertAfter}\n ></div>\n {/if}\n </div>\n {/if}\n {:else if isObject(value)}\n <div class=\"jse-header-outer\">\n <div class=\"jse-header\">\n <button type=\"button\" class=\"jse-expand\" on:click={toggleExpand} title=\"展开或折叠该对象\">\n {#if expanded}\n <Icon data={faCaretDown} />\n {:else}\n <Icon data={faCaretRight} />\n {/if}\n </button>\n <slot name=\"identifier\" />\n {#if !root}\n <div class=\"jse-separator\">:</div>\n {/if}\n <div class=\"jse-meta\" data-type=\"selectable-value\">\n <div class=\"jse-meta-inner\">\n {#if expanded}\n <div class=\"jse-bracket jse-expanded\">&lbrace;</div>\n {:else}\n <div class=\"jse-bracket\">&lbrace;</div>\n <Tag onclick={handleExpand}>\n {Object.keys(value).length}\n {Object.keys(value).length === 1 ? 'prop' : 'props'}\n </Tag>\n <div class=\"jse-bracket\">&rbrace;</div>\n {/if}\n </div>\n </div>\n {#if !context.readOnly && isNodeSelected && selection && (isValueSelection(selection) || isMultiSelection(selection)) && !isEditingSelection(selection) && isEqual(getFocusPath(selection), path)}\n <div class=\"jse-context-menu-pointer-anchor\">\n <ContextMenuPointer {root} selected={true} onContextMenu={context.onContextMenu} />\n </div>\n {/if}\n </div>\n {#if validationError && (!expanded || !validationError.isChildError)}\n <ValidationErrorIcon {validationError} onExpand={handleExpand} />\n {/if}\n {#if expanded}\n <div\n role=\"none\"\n class=\"jse-insert-selection-area jse-inside\"\n data-type=\"insert-selection-area-inside\"\n on:click={handleInsertInside}\n ></div>\n {:else if !root}\n <div\n role=\"none\"\n class=\"jse-insert-selection-area jse-after\"\n data-type=\"insert-selection-area-after\"\n on:click={handleInsertAfter}\n ></div>\n {/if}\n </div>\n {#if expanded}\n <div class=\"jse-props\">\n {#if !context.readOnly && (hover === HOVER_INSERT_INSIDE || (isNodeSelected && isInsideSelection(selection)))}\n <div\n class=\"jse-insert-area jse-inside\"\n class:jse-hovered={hover === HOVER_INSERT_INSIDE}\n class:jse-selected={isNodeSelected && isInsideSelection(selection)}\n data-type=\"insert-selection-area-inside\"\n style:--level={path.length + 1}\n title={INSERT_EXPLANATION}\n >\n <ContextMenuPointer\n insert={true}\n selected={isNodeSelected && isInsideSelection(selection)}\n onContextMenu={handleInsertInsideOpenContextMenu}\n />\n </div>\n {/if}\n {#each getKeys(value, dragging) as key}\n {@const propPointer = appendToJSONPointer(pointer, key)}\n\n {@const nestedSearchResults = isObjectRecursiveState(searchResults)\n ? searchResults.properties[key]\n : undefined}\n\n {@const nestedValidationErrors = isObjectRecursiveState(validationErrors)\n ? validationErrors.properties[key]\n : undefined}\n\n {@const nestedPath = path.concat(key)}\n\n {@const nestedSelection = selectionIfOverlapping(\n context.getJson(),\n selection,\n nestedPath\n )}\n\n <svelte:self\n value={value[key]}\n pointer={propPointer}\n state={isObjectRecursiveState(state) ? state.properties[key] : undefined}\n validationErrors={nestedValidationErrors}\n searchResults={nestedSearchResults}\n selection={nestedSelection}\n {context}\n onDragSelectionStart={handleDragSelectionStart}\n >\n <div\n slot=\"identifier\"\n class=\"jse-key-outer\"\n class:jse-selected-key={isKeySelection(nestedSelection) &&\n isEqual(nestedSelection.path, nestedPath)}\n >\n <JSONKey\n pointer={propPointer}\n {key}\n selection={nestedSelection}\n searchResultItems={filterKeySearchResults(nestedSearchResults)}\n {context}\n onUpdateKey={handleUpdateKey}\n />\n </div>\n </svelte:self>\n {/each}\n </div>\n <div class=\"jse-footer-outer\">\n <div data-type=\"selectable-value\" class=\"jse-footer\">\n <div class=\"jse-bracket\">&rbrace;</div>\n </div>\n {#if !root}\n <div\n role=\"none\"\n class=\"jse-insert-selection-area jse-after\"\n data-type=\"insert-selection-area-after\"\n on:click={handleInsertAfter}\n ></div>\n {/if}\n </div>\n {/if}\n {:else}\n <div class=\"jse-contents-outer\">\n <div class=\"jse-contents\">\n <slot name=\"identifier\" />\n {#if !root}\n <div class=\"jse-separator\">:</div>\n {/if}\n <div class=\"jse-value-outer\">\n <JSONValue\n {path}\n {value}\n {enforceString}\n selection={isNodeSelected ? selection : undefined}\n searchResultItems={filterValueSearchResults(searchResults)}\n {context}\n />\n </div>\n {#if !context.readOnly && isNodeSelected && selection && (isValueSelection(selection) || isMultiSelection(selection)) && !isEditingSelection(selection) && isEqual(getFocusPath(selection), path)}\n <div class=\"jse-context-menu-pointer-anchor\">\n <ContextMenuPointer {root} selected={true} onContextMenu={context.onContextMenu} />\n </div>\n {/if}\n </div>\n {#if validationError}\n <ValidationErrorIcon {validationError} onExpand={handleExpand} />\n {/if}\n {#if !root}\n <div\n role=\"none\"\n class=\"jse-insert-selection-area jse-after\"\n data-type=\"insert-selection-area-after\"\n on:click={handleInsertAfter}\n ></div>\n {/if}\n </div>\n {/if}\n {#if !context.readOnly && (hover === HOVER_INSERT_AFTER || (isNodeSelected && isAfterSelection(selection)))}\n <div\n class=\"jse-insert-area jse-after\"\n class:jse-hovered={hover === HOVER_INSERT_AFTER}\n class:jse-selected={isNodeSelected && isAfterSelection(selection)}\n data-type=\"insert-selection-area-after\"\n title={INSERT_EXPLANATION}\n >\n <ContextMenuPointer\n insert={true}\n selected={isNodeSelected && isAfterSelection(selection)}\n onContextMenu={handleInsertAfterOpenContextMenu}\n />\n </div>\n {/if}\n</div>\n\n<style src=\"./JSONNode.scss\"></style>\n","<svelte:options immutable={true} />\n\n<script lang=\"ts\">\n import { initial, isEqual } from 'lodash-es'\n import {\n createEditKeySelection,\n createKeySelection,\n createValueSelection,\n isEditingSelection,\n isKeySelection\n } from '$lib/logic/selection.js'\n import SearchResultHighlighter from './highlight/SearchResultHighlighter.svelte'\n import EditableDiv from '../../controls/EditableDiv.svelte'\n import { addNewLineSuffix } from '$lib/utils/domUtils.js'\n import type { ExtendedSearchResultItem, JSONSelection, TreeModeContext } from '$lib/types.js'\n import { UpdateSelectionAfterChange } from '$lib/types.js'\n import { type JSONPath, type JSONPointer, parseJSONPointer } from 'immutable-json-patch'\n import ContextMenuPointer from '../../../components/controls/contextmenu/ContextMenuPointer.svelte'\n\n export let pointer: JSONPointer\n export let key: string\n export let selection: JSONSelection | undefined\n export let searchResultItems: ExtendedSearchResultItem[] | undefined\n export let onUpdateKey: (oldKey: string, newKey: string) => string\n\n export let context: TreeModeContext\n\n let path: JSONPath\n $: path = parseJSONPointer(pointer)\n\n $: isKeySelected = isKeySelection(selection) && isEqual(selection.path, path)\n $: isEditingKey = isKeySelected && isEditingSelection(selection)\n\n function handleKeyDoubleClick(\n event: MouseEvent & { currentTarget: EventTarget & HTMLDivElement }\n ) {\n if (!isEditingKey && !context.readOnly) {\n event.preventDefault()\n context.onSelect(createEditKeySelection(path))\n }\n }\n\n function handleChangeValue(newKey: string, updateSelection: UpdateSelectionAfterChange) {\n const updatedKey = onUpdateKey(key, context.normalization.unescapeValue(newKey))\n const updatedPath = initial(path).concat(updatedKey)\n\n context.onSelect(\n updateSelection === UpdateSelectionAfterChange.nextInside\n ? createValueSelection(updatedPath)\n : createKeySelection(updatedPath)\n )\n\n if (updateSelection !== UpdateSelectionAfterChange.self) {\n context.focus()\n }\n }\n\n function handleCancelChange() {\n context.onSelect(createKeySelection(path))\n context.focus()\n }\n</script>\n\n{#if !context.readOnly && isEditingKey}\n <EditableDiv\n value={context.normalization.escapeValue(key)}\n initialValue={isEditingSelection(selection) ? selection.initialValue : undefined}\n label=\"编辑键\"\n shortText\n onChange={handleChangeValue}\n onCancel={handleCancelChange}\n onFind={context.onFind}\n />\n{:else}\n <div\n role=\"none\"\n data-type=\"selectable-key\"\n class=\"jse-key\"\n class:jse-empty={key === ''}\n on:dblclick={handleKeyDoubleClick}\n >\n {#if searchResultItems}\n <SearchResultHighlighter text={context.normalization.escapeValue(key)} {searchResultItems} />\n {:else}\n {addNewLineSuffix(context.normalization.escapeValue(key))}\n {/if}\n </div>\n{/if}\n{#if !context.readOnly && isKeySelected && !isEditingKey}\n <ContextMenuPointer selected={true} onContextMenu={context.onContextMenu} />\n{/if}\n\n<style src=\"./JSONKey.scss\"></style>\n","import type { IconDefinition } from '@fortawesome/free-solid-svg-icons'\nimport type { IconName } from '@fortawesome/fontawesome-common-types'\n\nexport const faJSONEditorExpand: IconDefinition = {\n prefix: 'fas',\n iconName: 'jsoneditor-expand' as IconName,\n icon: [\n 512,\n 512,\n [],\n '',\n 'M 0,448 V 512 h 512 v -64 z ' +\n 'M 0,0 V 64 H 512 V 0 Z ' +\n 'M 256,96 128,224 h 256 z ' +\n 'M 256,416 384,288 H 128 Z'\n ]\n}\n\nexport const faJSONEditorCollapse: IconDefinition = {\n prefix: 'fas',\n iconName: 'jsoneditor-collapse' as IconName,\n icon: [\n 512,\n 512,\n [],\n '',\n 'm 0,224 v 64 h 512 v -64 z ' + 'M 256,192 384,64 H 128 Z ' + 'M 256,320 128,448 h 256 z'\n ]\n}\n\nexport const faJSONEditorFormat: IconDefinition = {\n prefix: 'fas',\n iconName: 'jsoneditor-format' as IconName,\n icon: [\n 512,\n 512,\n [],\n '',\n 'M 0,32 v 64 h 416 v -64 z ' +\n 'M 160,160 v 64 h 352 v -64 z ' +\n 'M 160,288 v 64 h 288 v -64 z ' +\n 'M 0,416 v 64 h 320 v -64 z'\n ]\n}\n\nexport const faJSONEditorCompact: IconDefinition = {\n prefix: 'fas',\n iconName: 'jsoneditor-compact' as IconName,\n icon: [\n 512,\n 512,\n [],\n '',\n 'M 0,32 v 64 h 512 v -64 z ' + 'M 0,160 v 64 h 512 v -64 z ' + 'M 0,288 v 64 h 352 v -64 z'\n ]\n}\n","import diffSequence from '../generated/diffSequence.js'\nimport type { JSONPatchDocument, JSONPatchOperation, JSONPath } from 'immutable-json-patch'\nimport {\n compileJSONPointer,\n getIn,\n isJSONArray,\n isJSONPatchCopy,\n isJSONPatchMove,\n parseFrom,\n parsePath,\n setIn\n} from 'immutable-json-patch'\nimport { first, initial, isEmpty, isEqual, last } from 'lodash-es'\nimport naturalCompare from 'natural-compare-lite'\nimport { int } from '../utils/numberUtils.js'\nimport { isObject, isObjectOrArray } from '../utils/typeUtils.js'\n\nexport function caseInsensitiveNaturalCompare(a: unknown, b: unknown) {\n const aLower = typeof a === 'string' ? a.toLowerCase() : a\n const bLower = typeof b === 'string' ? b.toLowerCase() : b\n\n // @ts-expect-error The type definition expects strings\n return naturalCompare(aLower, bLower)\n}\n\n/**\n * Sort a JSON object or array\n * @param json The the JSON containing the (optionally nested)\n * object to be sorted\n * @param [rootPath=[]] Relative path when the array was located\n * @param [itemPath=[]] Item path by which to sort items in case of an array\n * @param [direction=1] Pass 1 to sort ascending, -1 to sort descending\n * @return Returns a JSONPatch document with move operation\n * to get the array sorted.\n */\nexport function sortJson(\n json: unknown,\n rootPath: JSONPath = [],\n itemPath: JSONPath = [],\n direction: 1 | -1 = 1\n): JSONPatchDocument {\n const value = getIn(json, rootPath)\n\n if (isJSONArray(value)) {\n if (itemPath === undefined) {\n throw new Error('Cannot sort: no property selected by which to sort the array')\n }\n\n return sortArray(json, rootPath, itemPath, direction)\n }\n\n if (isObject(value)) {\n return sortObjectKeys(json, rootPath, direction)\n }\n\n throw new Error('Cannot sort: no array or object')\n}\n\n/**\n * Sort the keys of an object\n * @param json The the JSON containing the (optionally nested)\n * object to be sorted\n * @param [rootPath=[]] Relative path when the array was located\n * @param [direction=1] Pass 1 to sort ascending, -1 to sort descending\n * @return Returns a JSONPatch document with operations\n * to get the array sorted.\n */\nexport function sortObjectKeys(\n json: unknown,\n rootPath: JSONPath = [],\n direction: 1 | -1 = 1\n): JSONPatchDocument {\n const object = getIn(json, rootPath) as Record<string, unknown>\n const keys = Object.keys(object as unknown as Record<string, unknown>)\n const sortedKeys = keys.slice()\n\n sortedKeys.sort((keyA, keyB) => {\n return direction * caseInsensitiveNaturalCompare(keyA, keyB)\n })\n\n // for performance reasons, do a full replace (we could also create a move operation for every key)\n const sortedObject: Record<string, unknown> = {}\n sortedKeys.forEach((key) => (sortedObject[key] = object[key]))\n\n return [\n {\n op: 'replace',\n path: compileJSONPointer(rootPath),\n value: sortedObject\n }\n ]\n}\n\n/**\n * Sort the items of an array\n * @param json The document containing (optionally nested)\n * the array to be sorted.\n * @param [rootPath=[]] Relative path when the array was located\n * @param [propertyPath=[]] Nested path to the property on which to sort the contents\n * @param [direction=1] Pass 1 to sort ascending, -1 to sort descending\n * @return Returns a JSONPatch document with move operation\n * to get the array sorted.\n */\nexport function sortArray(\n json: unknown,\n rootPath: JSONPath = [],\n propertyPath: JSONPath = [],\n direction: 1 | -1 = 1\n): JSONPatchDocument {\n const comparator = createObjectComparator(propertyPath, direction)\n\n // TODO: make the mechanism to sort configurable? Like use sortOperationsMove and sortOperationsMoveAdvanced\n const array = getIn(json, rootPath) as Array<unknown>\n return [\n {\n op: 'replace',\n path: compileJSONPointer(rootPath),\n value: array.slice(0).sort(comparator)\n }\n ]\n}\n\n/**\n * Create a comparator function to compare nested properties in an array\n */\nfunction createObjectComparator(propertyPath: JSONPath, direction: 1 | -1) {\n const sortableTypes: Record<string, number> = { boolean: 0, number: 1, string: 2, undefined: 4 }\n const otherTypes = 3\n\n return function comparator(a: unknown, b: unknown) {\n const valueA = getIn(a, propertyPath)\n const valueB = getIn(b, propertyPath)\n\n // Order mixed types\n if (typeof valueA !== typeof valueB) {\n const aIndex = sortableTypes[typeof valueA] ?? otherTypes\n const bIndex = sortableTypes[typeof valueB] ?? otherTypes\n\n return aIndex > bIndex ? direction : aIndex < bIndex ? -direction : 0\n }\n\n // Order two numbers, two strings, or two booleans\n if (typeof valueA === 'number' || typeof valueA === 'boolean') {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n return valueA > valueB ? direction : valueA < valueB ? -direction : 0\n }\n\n // Leave objects and arrays unsorted\n if (isObjectOrArray(valueA)) {\n return 0\n }\n\n // sort strings and non-primitive types\n return direction * caseInsensitiveNaturalCompare(valueA, valueB)\n }\n}\n\n/**\n * Create a list with JSON Patch move operations\n * needed to sort the array contents.\n */\nexport function sortOperationsMove<T>(\n array: T[],\n comparator: (a: T, b: T) => number\n): JSONPatchOperation[] {\n const operations: JSONPatchOperation[] = []\n const sorted = []\n\n // TODO: rewrite the function to pass a callback instead of returning an array?\n for (let i = 0; i < array.length; i++) {\n // TODO: can we simplify the following code?\n const item = array[i]\n if (i > 0 && comparator(sorted[i - 1], item) > 0) {\n let j = i - 1\n while (j > 0 && comparator(sorted[j - 1], item) > 0) {\n j--\n }\n\n operations.push({\n op: 'move',\n from: '/' + i,\n path: '/' + j\n })\n\n sorted.splice(j, 0, item)\n } else {\n sorted.push(item)\n }\n }\n\n return operations\n}\n\n/**\n * Create an array containing all move operations\n * needed to sort the array contents.\n */\nexport function sortOperationsMoveAdvanced<T>(\n array: T[],\n comparator: (a: T, b: T) => number\n): JSONPatchOperation[] {\n const moves: { from: number; to: number }[] = []\n\n const sortedIndices = array\n .map((item, index) => ({ item, index }))\n .sort((a, b) => comparator(a.item, b.item))\n .map((entry) => entry.index)\n\n let bIndex = 0\n\n function foundSubsequence(nCommon: number, aCommon: number, bCommon: number) {\n for (let b = bIndex; b < bCommon; b++) {\n moves.push({\n from: sortedIndices[b],\n to: aCommon\n })\n }\n\n bIndex = bCommon + nCommon\n }\n\n const size = array.length\n\n function isCommon(aIndex: number, bIndex: number) {\n return aIndex === sortedIndices[bIndex]\n }\n\n diffSequence(size, size, isCommon, foundSubsequence)\n foundSubsequence(0, size, size)\n\n // every move will change the actual indices, so we've to adjust for that\n // in all moves that still have to be executed\n for (let i = 0; i < moves.length; i++) {\n if (moves[i].to > moves[i].from) {\n moves[i].to--\n }\n\n const { from, to } = moves[i]\n\n for (let j = i + 1; j < moves.length; j++) {\n const other = moves[j]\n if (other.from >= from) {\n other.from--\n }\n if (other.to >= from) {\n other.to--\n }\n if (other.from >= to) {\n other.from++\n }\n if (other.to >= to) {\n other.to++\n }\n }\n }\n\n return moves.map(({ from, to }) => {\n return {\n op: 'move',\n from: '/' + from,\n path: '/' + to\n }\n })\n}\n\n/**\n * Fast solution to apply many JSON patch move operations inside a single array,\n * like applying all moves needed to sort an array.\n *\n * Throws an error when not all operations are move operation inside the same\n * array.\n */\n// TODO: write unit tests\nexport function fastPatchSort(json: unknown, operations: JSONPatchDocument): unknown {\n if (isEmpty(operations)) {\n // nothing to do :)\n return json\n }\n\n // validate whether all operations are \"move\" operations\n const invalidOp = operations.find((operation) => {\n return operation.op !== 'move'\n })\n if (invalidOp) {\n throw new Error(\n 'Cannot apply fastPatchSort: not a \"move\" operation ' +\n '(actual: ' +\n JSON.stringify(invalidOp) +\n ')'\n )\n }\n\n // parse all paths\n const parsedOperations: Array<{ from: JSONPath | undefined; path: JSONPath }> = operations.map(\n (operation) => ({\n from:\n isJSONPatchCopy(operation) || isJSONPatchMove(operation)\n ? parseFrom(operation.from)\n : undefined,\n path: parsePath(json, operation.path)\n })\n )\n\n // validate whether the move actions take place in an array\n const arrayPath = initial(first(parsedOperations)?.path)\n const array = getIn(json, arrayPath)\n if (!Array.isArray(array)) {\n throw new Error(\n 'Cannot apply fastPatchSort: not an Array ' + '(path: ' + JSON.stringify(arrayPath) + ')'\n )\n }\n\n // validate whether all paths are in the same array\n const invalidPath = parsedOperations.find((parsedOperation) => {\n return (\n !isEqual(arrayPath, initial(parsedOperation.path)) ||\n !isEqual(arrayPath, initial(parsedOperation.from))\n )\n })\n if (invalidPath) {\n throw new Error(\n 'Cannot apply fastPatchSort: not all move operations are in the same array ' +\n '(expected: ' +\n JSON.stringify(arrayPath) +\n ', actual: ' +\n JSON.stringify(invalidPath) +\n ')'\n )\n }\n\n // apply the actual operations on the same array. Only copy the only array once\n const updatedArray = array.slice(0)\n parsedOperations.forEach((parsedOperation) => {\n const toIndex = int(last(parsedOperation.path) || '-1')\n const fromIndex = int(last(parsedOperation.from) || '-1')\n\n const value = updatedArray.splice(fromIndex, 1)[0]\n updatedArray.splice(toIndex, 0, value)\n })\n\n return setIn(json, arrayPath, updatedArray)\n}\n","<svelte:options immutable={true} />\n\n<script lang=\"ts\">\n import { limit } from '$lib/utils/arrayUtils.js'\n import { truncate } from '$lib/utils/stringUtils.js'\n\n export let items: (string | number)[]\n export let selectedItem: string | number\n export let onSelect: (item: string | number) => void\n\n const MAX_ITEMS = 100\n const MAX_ITEM_CHARACTERS = 30\n</script>\n\n<div class=\"jse-navigation-bar-dropdown\">\n {#each limit(items, MAX_ITEMS) as item (item)}\n <button\n type=\"button\"\n class=\"jse-navigation-bar-dropdown-item\"\n class:jse-selected={item === selectedItem}\n on:click|stopPropagation={() => onSelect(item)}\n title={item.toString()}\n >\n {truncate(item.toString(), MAX_ITEM_CHARACTERS)}\n </button>\n {/each}\n {#if items.length > MAX_ITEMS}\n <button type=\"button\" class=\"jse-navigation-bar-dropdown-item\" title=\"限制为 {MAX_ITEMS} 项\">\n ...\n </button>\n {/if}\n</div>\n\n<style src=\"./NavigationBarDropdown.scss\"></style>\n","<svelte:options immutable={true} />\n\n<script lang=\"ts\">\n import Icon from 'svelte-awesome'\n import { faAngleRight } from '@fortawesome/free-solid-svg-icons'\n import NavigationBarDropdown from '../../../components/controls/navigationBar/NavigationBarDropdown.svelte'\n import { getContext } from 'svelte'\n import type { JSONPath } from 'immutable-json-patch'\n import type { AbsolutePopupContext } from '$lib/types'\n\n const { openAbsolutePopup, closeAbsolutePopup } =\n getContext<AbsolutePopupContext>('absolute-popup')\n\n export let path: JSONPath\n export let index: number\n export let onSelect: (path: JSONPath) => void\n export let getItems: (path: JSONPath) => string[]\n\n let refNavigationBarItem: Element | undefined\n let open = false\n let popupId: number | undefined\n\n $: itemPath = path.slice(0, index)\n $: selectedItem = path[index]\n\n function handleSelectItem(item: string) {\n closeAbsolutePopup(popupId)\n onSelect(itemPath.concat(item))\n }\n\n function openDropdown() {\n if (refNavigationBarItem) {\n open = true\n\n const props = {\n items: getItems(itemPath),\n selectedItem,\n onSelect: handleSelectItem\n }\n\n popupId = openAbsolutePopup(NavigationBarDropdown, props, {\n anchor: refNavigationBarItem,\n closeOnOuterClick: true,\n onClose: () => {\n open = false\n }\n })\n }\n }\n</script>\n\n<div class=\"jse-navigation-bar-item\" bind:this={refNavigationBarItem}>\n <button\n type=\"button\"\n class=\"jse-navigation-bar-button jse-navigation-bar-arrow\"\n class:jse-open={open}\n on:click={openDropdown}\n >\n <Icon data={faAngleRight} />\n </button>\n {#if selectedItem !== undefined}\n <button\n type=\"button\"\n class=\"jse-navigation-bar-button\"\n on:click={() => handleSelectItem(selectedItem)}\n >\n {selectedItem}\n </button>\n {/if}\n</div>\n\n<style src=\"./NavigationBarItem.scss\"></style>\n","export default function copyToClipBoard(text: string): Promise<void> {\n if (navigator.clipboard) {\n return navigator.clipboard.writeText(text)\n }\n // Compatible with old browsers such as Chrome <=65, Edge <=18 & IE\n // Compatible with HTTP\n else if (document.queryCommandSupported?.('copy')) {\n const textarea = document.createElement('textarea')\n textarea.value = text\n\n textarea.style.position = 'fixed' // Avoid scrolling to bottom\n textarea.style.opacity = '0'\n\n document.body.appendChild(textarea)\n textarea.select()\n\n // Security exception may be thrown by some browsers\n try {\n document.execCommand('copy')\n } catch (e) {\n console.error(e)\n } finally {\n document.body.removeChild(textarea)\n }\n\n return Promise.resolve()\n } else {\n console.error('Copy failed.')\n\n return Promise.resolve()\n }\n}\n","<script lang=\"ts\">\n import type { JSONPath } from 'immutable-json-patch'\n import { getContext, onDestroy, onMount } from 'svelte'\n import copyToClipBoard from '$lib/utils/copyToClipboard.js'\n import { faCopy, faExclamationTriangle } from '@fortawesome/free-solid-svg-icons'\n import Icon from 'svelte-awesome'\n import { keyComboFromEvent } from '$lib/utils/keyBindings.js'\n import { tooltip } from '../../controls/tooltip/tooltip.js'\n import type { AbsolutePopupContext, JSONPathParser, OnError } from '$lib/types.js'\n\n const absolutePopupContext = getContext<AbsolutePopupContext>('absolute-popup')\n\n export let path: JSONPath\n export let pathParser: JSONPathParser\n export let onChange: (updatedPath: JSONPath) => void\n export let onClose: () => void\n export let onError: OnError\n export let pathExists: (path: JSONPath) => boolean\n\n let inputRef: HTMLInputElement\n let inputPath: string\n let validationActive = false\n $: inputPath = pathParser.stringify(path)\n $: inputValidationError = validationActive ? parseAndValidate(inputPath).error : undefined\n\n let copiedTimer: number | undefined = undefined\n let copied = false\n const copiedDelay = 1000 // ms\n\n onMount(() => {\n focus()\n })\n\n onDestroy(() => {\n clearTimeout(copiedTimer)\n })\n\n function focus() {\n inputRef.focus()\n }\n\n function parseAndValidate(pathStr: string): {\n path: JSONPath | undefined\n error: Error | undefined\n } {\n try {\n const path = pathParser.parse(pathStr)\n validatePathExists(path)\n return {\n path,\n error: undefined\n }\n } catch (error) {\n return {\n path: undefined,\n error: error as Error\n }\n }\n }\n\n function validatePathExists(path: JSONPath) {\n if (!pathExists(path)) {\n throw new Error('Path does not exist in current document')\n }\n }\n\n function handleInput(event: Event & { currentTarget: EventTarget & HTMLInputElement }) {\n inputPath = event.currentTarget.value\n }\n\n function handleKeyDown(event: KeyboardEvent) {\n const combo = keyComboFromEvent(event)\n\n if (combo === 'Escape') {\n event.preventDefault()\n onClose()\n }\n\n if (combo === 'Enter') {\n event.preventDefault()\n\n validationActive = true\n const result = parseAndValidate(inputPath)\n if (result.path !== undefined) {\n onChange(result.path)\n } else {\n onError(result.error as Error)\n }\n }\n }\n\n function handleCopy() {\n copyToClipBoard(inputPath)\n copied = true\n copiedTimer = window.setTimeout(() => (copied = false), copiedDelay)\n focus()\n }\n</script>\n\n<div class=\"jse-navigation-bar-path-editor\" class:error={inputValidationError}>\n <input\n type=\"text\"\n class=\"jse-navigation-bar-text\"\n value={inputPath}\n bind:this={inputRef}\n on:keydown|stopPropagation={handleKeyDown}\n on:input={handleInput}\n />\n {#if inputValidationError}\n <button\n type=\"button\"\n class=\"jse-navigation-bar-validation-error\"\n use:tooltip={{\n text: String(inputValidationError || ''),\n ...absolutePopupContext\n }}\n >\n <Icon data={faExclamationTriangle} />\n </button>\n {/if}\n {#if copied}\n <div class=\"jse-copied-text\">Copied!</div>\n {/if}\n <button\n type=\"button\"\n class=\"jse-navigation-bar-copy\"\n class:copied\n title=\"将选中的路径复制到剪贴板\"\n on:click={handleCopy}\n >\n <Icon data={faCopy} />\n </button>\n</div>\n\n<style src=\"./NavigationBarPathEditor.scss\"></style>\n","<svelte:options immutable={true} />\n\n<script lang=\"ts\">\n import type { JSONPath } from 'immutable-json-patch'\n import { existsIn, getIn } from 'immutable-json-patch'\n import { range } from 'lodash-es'\n import { isObject, isObjectOrArray } from '$lib/utils/typeUtils.js'\n import { createMultiSelection, getFocusPath } from '$lib/logic/selection.js'\n import { createDebug } from '$lib/utils/debug.js'\n import { caseInsensitiveNaturalCompare } from '$lib/logic/sort.js'\n import type { JSONPathParser, JSONSelection, OnError, OnJSONSelect } from '$lib/types.js'\n import Icon from 'svelte-awesome'\n import { faClose, faEdit } from '@fortawesome/free-solid-svg-icons'\n import NavigationBarItem from './NavigationBarItem.svelte'\n import NavigationBarPathEditor from './NavigationBarPathEditor.svelte'\n\n const debug = createDebug('jsoneditor:NavigationBar')\n\n export let json: unknown\n export let selection: JSONSelection | undefined\n export let onSelect: OnJSONSelect\n export let onError: OnError\n export let pathParser: JSONPathParser\n\n let refNavigationBar: Element | undefined\n let editing = false\n\n $: path = selection ? getFocusPath(selection) : []\n $: hasNextItem = isObjectOrArray(getIn(json, path))\n\n // we have an unused parameter path to trigger scrollToLastItem when path changes,\n // see $: scrollToLastItem(path)\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n function scrollToLastItem(path: JSONPath) {\n setTimeout(() => {\n if (refNavigationBar && refNavigationBar.scrollTo) {\n const left = refNavigationBar.scrollWidth - refNavigationBar.clientWidth\n if (left > 0) {\n debug('scrollTo ', left)\n refNavigationBar.scrollTo({ left, behavior: 'smooth' })\n }\n }\n })\n }\n\n // trigger scrollToLastItem when path changes\n $: scrollToLastItem(path)\n\n function getItems(path: JSONPath): string[] {\n debug('get items for path', path)\n\n const node = getIn(json, path)\n if (Array.isArray(node)) {\n return range(0, node.length).map(String)\n } else if (isObject(node)) {\n const keys = Object.keys(node)\n\n const sortedKeys = keys.slice(0)\n sortedKeys.sort(caseInsensitiveNaturalCompare)\n\n return sortedKeys\n } else {\n // never happens but just for robustness...\n return []\n }\n }\n\n function pathExists(path: JSONPath): boolean {\n return existsIn(json, path)\n }\n\n function handleSelect(path: JSONPath) {\n debug('select path', JSON.stringify(path))\n\n onSelect(createMultiSelection(path, path))\n }\n\n function toggleEditing() {\n editing = !editing\n }\n\n function handleCloseEditor() {\n editing = false\n }\n\n function handleChangePath(path: JSONPath) {\n handleCloseEditor()\n handleSelect(path)\n }\n</script>\n\n<div class=\"jse-navigation-bar\" bind:this={refNavigationBar}>\n {#if !editing}\n <!-- eslint-disable-next-line @typescript-eslint/no-unused-vars -->\n {#each path as item, index (index)}\n <NavigationBarItem {getItems} {path} {index} onSelect={handleSelect} />\n {/each}\n {#if hasNextItem}\n <NavigationBarItem {getItems} {path} index={path.length} onSelect={handleSelect} />\n {/if}\n {:else}\n <NavigationBarPathEditor\n {path}\n onClose={handleCloseEditor}\n onChange={handleChangePath}\n {onError}\n {pathExists}\n {pathParser}\n />\n {/if}\n\n <button\n type=\"button\"\n class=\"jse-navigation-bar-edit\"\n class:flex={!editing}\n class:editing\n title={editing ? 'Cancel editing the selected path' : 'Edit the selected path'}\n on:click={toggleEditing}\n >\n <span class=\"jse-navigation-bar-space\">\n <!-- ensure the right height (arrows have less height than the text) -->\n {!isObjectOrArray(json) && !editing ? '导航栏' : '\\u00A0'}\n </span>\n\n <Icon data={editing ? faClose : faEdit} />\n </button>\n</div>\n\n<style src=\"./NavigationBar.scss\"></style>\n","<svelte:options immutable={true} />\n\n<script lang=\"ts\">\n import { debounce } from 'lodash-es'\n import Icon from 'svelte-awesome'\n import {\n faCaretDown,\n faCaretRight,\n faChevronDown,\n faChevronUp,\n faCircleNotch,\n faSearch,\n faTimes\n } from '@fortawesome/free-solid-svg-icons'\n import { DEBOUNCE_DELAY, MAX_SEARCH_RESULTS } from '$lib/constants.js'\n import { keyComboFromEvent } from '$lib/utils/keyBindings.js'\n import { createDebug } from '$lib/utils/debug.js'\n import type { DocumentState, JSONParser, OnPatch, SearchResultDetails } from '$lib/types.js'\n import {\n createSearchAndReplaceAllOperations,\n createSearchAndReplaceOperations,\n search,\n searchNext,\n searchPrevious,\n updateSearchResult\n } from '$lib/logic/search.js'\n import type { JSONPath } from 'immutable-json-patch'\n import { flushSync } from 'svelte'\n\n const debug = createDebug('jsoneditor:SearchBox')\n\n export let json: unknown\n export let documentState: DocumentState | undefined\n export let parser: JSONParser\n export let showSearch: boolean\n export let showReplace: boolean\n export let readOnly: boolean\n export let columns: JSONPath[] | undefined\n export let onSearch: (result: SearchResultDetails | undefined) => void\n export let onFocus: (path: JSONPath, resultIndex: number) => Promise<void>\n export let onPatch: OnPatch\n export let onClose: () => void\n\n let text = ''\n let appliedText = ''\n let replaceText = ''\n let searching = false\n let searchResult: SearchResultDetails | undefined\n\n $: resultCount = searchResult?.items?.length || 0\n $: activeIndex = searchResult?.activeIndex || 0\n $: formattedResultCount =\n resultCount >= MAX_SEARCH_RESULTS ? `${MAX_SEARCH_RESULTS - 1}+` : String(resultCount)\n\n $: onSearch(searchResult)\n\n // eslint-disable-next-line svelte/no-unused-svelte-ignore\n // svelte-ignore reactive_declaration_non_reactive_property\n $: applyChangedShowSearch(showSearch)\n\n const applyChangedSearchTextDebounced = debounce(applyChangedSearchText, DEBOUNCE_DELAY)\n $: applyChangedSearchTextDebounced(text)\n\n const applyChangedJsonDebounced = debounce(applyChangedJson, DEBOUNCE_DELAY)\n $: applyChangedJsonDebounced(json)\n\n function toggleShowReplace() {\n showReplace = !showReplace && !readOnly\n }\n\n function handleKeyDown(event: KeyboardEvent) {\n // key events must not be handled by the generic keydown handler of the\n // whole JSONEditor.\n event.stopPropagation()\n const combo = keyComboFromEvent(event)\n\n if (combo === 'Enter') {\n event.preventDefault()\n\n const pendingChanges = text !== appliedText\n if (pendingChanges) {\n applyChangedSearchTextDebounced.flush()\n } else {\n handleNext()\n }\n }\n\n if (combo === 'Shift+Enter') {\n event.preventDefault()\n handlePrevious()\n }\n\n if (combo === 'Ctrl+Enter') {\n event.preventDefault()\n\n if (showReplace) {\n handleReplace()\n } else {\n handleNext()\n // TODO: move focus to the active element so you can start editing?\n }\n }\n\n if (combo === 'Ctrl+H') {\n event.preventDefault()\n toggleShowReplace()\n }\n\n if (combo === 'Escape') {\n event.preventDefault()\n\n handleClose()\n }\n }\n\n function handleReplaceKeyDown(event: KeyboardEvent) {\n const combo = keyComboFromEvent(event)\n\n if (combo === 'Enter') {\n event.preventDefault()\n event.stopPropagation()\n\n handleReplace()\n }\n }\n\n async function handlePaste() {\n flushSync()\n await applyChangedSearchTextDebounced.flush()\n }\n\n async function handleReplace() {\n if (readOnly) {\n return\n }\n\n const activeItem = searchResult?.activeItem\n debug('handleReplace', { replaceText, activeItem })\n\n if (!searchResult || !activeItem || json === undefined) {\n return\n }\n\n // move to the next search result *before* applying the replacement\n searchResult = {\n ...searchNext(searchResult),\n activeIndex // trick to prevent shortly flickering of index from 1 to 2 and then to 1 again after the next search\n }\n\n const { operations, newSelection } = createSearchAndReplaceOperations(\n json,\n documentState,\n replaceText,\n activeItem,\n parser\n )\n\n onPatch(operations, (_, patchedState) => ({\n state: patchedState,\n selection: newSelection\n }))\n\n // immediately trigger updating the search results\n flushSync()\n await applyChangedJsonDebounced.flush()\n\n // focus to the next search result\n await handleFocus()\n }\n\n async function handleReplaceAll() {\n if (readOnly) {\n return\n }\n\n debug('handleReplaceAll', { text, replaceText })\n\n const { operations, newSelection } = createSearchAndReplaceAllOperations(\n json,\n documentState,\n text,\n replaceText,\n parser\n )\n\n onPatch(operations, (_, patchedState) => ({\n state: patchedState,\n selection: newSelection\n }))\n\n await handleFocus()\n }\n\n function initSearchInput(element: HTMLInputElement) {\n element.select()\n }\n\n async function handleNext() {\n searchResult = searchResult ? searchNext(searchResult) : undefined\n\n await handleFocus()\n }\n\n async function handlePrevious() {\n searchResult = searchResult ? searchPrevious(searchResult) : undefined\n\n await handleFocus()\n }\n\n async function handleFocus() {\n debug('handleFocus', searchResult)\n\n const activeItem = searchResult?.activeItem\n if (activeItem && json !== undefined) {\n await onFocus(activeItem.path, activeItem.resultIndex)\n }\n }\n\n async function applyChangedShowSearch(showSearch: boolean) {\n await applySearch(showSearch, text, json)\n }\n\n async function applyChangedSearchText(text: string) {\n await applySearch(showSearch, text, json)\n await handleFocus()\n }\n\n async function applyChangedJson(json: unknown) {\n await applySearch(showSearch, text, json)\n }\n\n // we pass searchText and json as argument to trigger search when these variables change,\n // via various listeners like applyChangedSearchText\n async function applySearch(showSearch: boolean, text: string, json: unknown): Promise<void> {\n if (!showSearch) {\n if (searchResult) {\n searchResult = undefined\n }\n\n return Promise.resolve()\n }\n\n debug('applySearch', { showSearch, text })\n\n if (text === '') {\n debug('clearing search result')\n\n if (searchResult !== undefined) {\n searchResult = undefined\n }\n\n return Promise.resolve()\n }\n\n appliedText = text\n searching = true\n\n return new Promise<void>((resolve) => {\n setTimeout(() => {\n // wait until the search icon has been rendered\n const newResultItems = search(text, json, { maxResults: MAX_SEARCH_RESULTS, columns })\n searchResult = updateSearchResult(newResultItems, searchResult)\n\n searching = false\n resolve()\n })\n })\n }\n\n function handleClose() {\n debug('handleClose')\n applyChangedSearchTextDebounced.cancel()\n applyChangedJsonDebounced.cancel()\n applySearch(false, text, json) // will clear the search results\n onClose()\n }\n</script>\n\n{#if showSearch}\n <div class=\"jse-search-box\">\n <!-- svelte-ignore a11y-no-noninteractive-element-interactions -->\n <form class=\"jse-search-form\" on:keydown={handleKeyDown}>\n {#if !readOnly}\n <button\n type=\"button\"\n class=\"jse-replace-toggle\"\n title=\"切换替换选项的可见性(Ctrl+H)\"\n on:click={toggleShowReplace}\n >\n <Icon data={showReplace ? faCaretDown : faCaretRight} />\n </button>\n {/if}\n <div class=\"jse-search-contents\">\n <div class=\"jse-search-section\">\n <div class=\"jse-search-icon\">\n {#if searching}\n <Icon data={faCircleNotch} spin />\n {:else}\n <Icon data={faSearch} />\n {/if}\n </div>\n <label class=\"jse-search-input-label\" about=\"jse-search input\">\n <input\n class=\"jse-search-input\"\n title=\"输入要搜索的文本\"\n type=\"text\"\n placeholder=\"查找\"\n bind:value={text}\n use:initSearchInput\n on:paste={handlePaste}\n />\n </label>\n <div class=\"jse-search-count\" class:jse-visible={text !== ''}>\n {activeIndex !== -1 && activeIndex < resultCount\n ? `${activeIndex + 1}/`\n : ''}{formattedResultCount}\n </div>\n <button\n type=\"button\"\n class=\"jse-search-next\"\n title=\"转到下一个搜索结果(回车键)\"\n on:click={handleNext}\n >\n <Icon data={faChevronDown} />\n </button>\n <button\n type=\"button\"\n class=\"jse-search-previous\"\n title=\"转到上一个搜索结果(Shift+Enter)\"\n on:click={handlePrevious}\n >\n <Icon data={faChevronUp} />\n </button>\n <button\n type=\"button\"\n class=\"jse-search-clear\"\n title=\"关闭搜索框 (Esc)\"\n on:click={handleClose}\n >\n <Icon data={faTimes} />\n </button>\n </div>\n {#if showReplace && !readOnly}\n <div class=\"jse-replace-section\">\n <input\n class=\"jse-replace-input\"\n title=\"输入替换文本\"\n type=\"text\"\n placeholder=\"替换\"\n bind:value={replaceText}\n on:keydown={handleReplaceKeyDown}\n />\n <button type=\"button\" title=\"替换当前出现的内容(Ctrl+Enter)\" on:click={handleReplace}\n >替换</button\n >\n <button type=\"button\" title=\"替换所有出现\" on:click={handleReplaceAll}>全部替换</button>\n </div>\n {/if}\n </div>\n </form>\n </div>\n{/if}\n\n<style src=\"./SearchBox.scss\"></style>\n","import type { JSONPatchOperation, JSONPath } from 'immutable-json-patch'\nimport {\n compileJSONPointer,\n isJSONArray,\n isJSONObject,\n parseJSONPointer\n} from 'immutable-json-patch'\nimport { groupBy, isEmpty, isEqual, mapValues, partition } from 'lodash-es'\nimport type { JSONSelection, SortedColumn, TableCellIndex, ValidationError } from '$lib/types.js'\nimport { ValidationSeverity } from '$lib/types.js'\nimport { createValueSelection, getFocusPath, pathStartsWith } from './selection.js'\nimport { containsNumber } from '../utils/numberUtils.js'\nimport type { Dictionary } from 'lodash'\nimport { stringifyJSONPath } from '$lib/utils/pathUtils.js'\nimport { forEachSample } from '$lib/utils/arrayUtils.js'\nimport { isObject } from '$lib/utils/typeUtils.js'\n\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore\ntype NestedObject = Record<string, NestedObject>\n\nconst endOfPath = Symbol('path')\n\nexport function getColumns(\n array: Array<unknown>,\n flatten: boolean,\n maxSampleCount = Infinity\n): JSONPath[] {\n const merged: NestedObject = {}\n\n if (Array.isArray(array)) {\n // We read samples spread through the whole array, from begin to end.\n // When the array is sorted, and a specific field is present only at the last\n // couple of items of the array or in the middle, we want to pick that up too.\n forEachSample(array, maxSampleCount, (item) => {\n if (isObject(item)) {\n _recurseObject(item, merged, flatten)\n } else {\n merged[endOfPath] = true\n }\n })\n }\n\n const paths: JSONPath[] = []\n if (endOfPath in merged) {\n paths.push([])\n }\n _collectPaths(merged, [], paths, flatten)\n\n return paths\n}\n\n// internal function for getColumns\n// mutates the argument merged\nfunction _recurseObject(object: NestedObject, merged: NestedObject, flatten: boolean): void {\n for (const key in object) {\n const value = object[key]\n const valueMerged = merged[key] || (merged[key] = {})\n\n if (isObject(value) && flatten) {\n _recurseObject(value, valueMerged, flatten)\n } else {\n if (valueMerged[endOfPath] === undefined) {\n valueMerged[endOfPath] = true\n }\n }\n }\n}\n\n// internal function for getColumns\n// mutates the argument paths\nfunction _collectPaths(\n object: NestedObject,\n parentPath: JSONPath,\n paths: JSONPath[],\n flatten: boolean\n): void {\n for (const key in object) {\n const path = parentPath.concat(key)\n const value = object[key]\n\n if (value && value[endOfPath] === true) {\n paths.push(path)\n }\n\n if (isJSONObject(value) && flatten) {\n _collectPaths(value, path, paths, flatten)\n }\n }\n}\n\nexport function maintainColumnOrder(\n newColumns: JSONPath[],\n previousColumns: JSONPath[]\n): JSONPath[] {\n const orderedColumns = new Set(previousColumns.map(compileJSONPointer))\n const newColumnsSet = new Set(newColumns.map(compileJSONPointer))\n\n // delete the columns that are gone now\n for (const column of orderedColumns) {\n if (!newColumnsSet.has(column)) {\n orderedColumns.delete(column)\n }\n }\n\n // append the new columns to the end\n for (const column of newColumnsSet) {\n if (!orderedColumns.has(column)) {\n orderedColumns.add(column)\n }\n }\n\n return [...orderedColumns].map(parseJSONPointer)\n}\n\nexport function getShallowKeys(value: unknown): JSONPath[] {\n return isJSONObject(value) ? Object.keys(value).map((key) => [key]) : [[]]\n}\n\nexport function getRecursiveKeys(value: unknown): JSONPath[] {\n const paths: JSONPath[] = []\n\n function recurse(value: unknown, path: JSONPath) {\n if (isJSONObject(value)) {\n Object.keys(value).forEach((key) => {\n recurse(value[key], path.concat(key))\n })\n } else {\n // array or primitive value like string or number\n paths.push(path)\n }\n }\n\n recurse(value, [])\n\n return paths\n}\n\nexport interface VisibleSection {\n startIndex: number\n endIndex: number\n startHeight: number\n visibleHeight: number\n endHeight: number\n averageItemHeight: number\n visibleItems: Array<unknown>\n}\n\n// TODO: write unit tests\nexport function calculateVisibleSection(\n scrollTop: number,\n viewPortHeight: number,\n json: unknown | undefined,\n itemHeights: Record<number, number>,\n defaultItemHeight: number,\n searchBoxOffset: number,\n margin = 80\n): VisibleSection {\n const itemCount = isJSONArray(json) ? json.length : 0\n const averageItemHeight = calculateAverageItemHeight(itemHeights, defaultItemHeight)\n const viewPortTop = scrollTop - margin\n const viewPortBottom = viewPortHeight + 2 * margin\n\n const getItemHeight = (index: number) => itemHeights[index] || defaultItemHeight\n\n let startIndex = 0\n let startHeight = searchBoxOffset\n while (startHeight < viewPortTop && startIndex < itemCount) {\n startHeight += getItemHeight(startIndex)\n startIndex++\n }\n if (startIndex > 0) {\n // go one item back, else there is white space at the top for up to 1 missing item\n startIndex--\n startHeight -= getItemHeight(startIndex)\n }\n\n let endIndex = startIndex\n let visibleHeight = 0\n while (visibleHeight < viewPortBottom && endIndex < itemCount) {\n visibleHeight += getItemHeight(endIndex)\n endIndex++\n }\n\n let endHeight = 0\n for (let i = endIndex; i < itemCount; i++) {\n endHeight += getItemHeight(i)\n }\n\n const visibleItems = isJSONArray(json) ? json.slice(startIndex, endIndex) : []\n\n return {\n startIndex,\n endIndex,\n startHeight,\n endHeight,\n averageItemHeight,\n visibleHeight,\n visibleItems\n }\n}\n\n// TODO: cleanup if we will not use it in the end\n// TODO: write unit tests\nexport function calculateVisibleSectionApprox(\n scrollTop: number,\n viewPortHeight: number,\n json: unknown | undefined,\n defaultItemHeight: number\n): VisibleSection {\n const itemCount = isJSONArray(json) ? json.length : 0\n const averageItemHeight = defaultItemHeight\n\n const viewPortTop = scrollTop\n const startIndex = Math.floor(viewPortTop / defaultItemHeight)\n const startHeight = startIndex * defaultItemHeight\n const endIndex = Math.ceil((viewPortTop + viewPortHeight) / defaultItemHeight)\n const visibleHeight = (endIndex - startIndex) * defaultItemHeight\n const endHeight = (itemCount - endIndex) * defaultItemHeight\n\n const visibleItems = isJSONArray(json) ? json.slice(startIndex, endIndex) : []\n\n return {\n startIndex,\n endIndex,\n startHeight,\n endHeight,\n averageItemHeight,\n visibleHeight,\n visibleItems\n }\n}\n\n// TODO: write unit tests\nexport function calculateAbsolutePosition(\n path: JSONPath,\n columns: JSONPath[],\n itemHeights: Record<number, number>,\n defaultItemHeight: number\n): number {\n const { rowIndex } = toTableCellPosition(path, columns)\n\n let top = 0\n for (let currentIndex = 0; currentIndex < rowIndex; currentIndex++) {\n top += itemHeights[currentIndex] || defaultItemHeight\n }\n\n // TODO: also calculate left\n return top\n}\n\nfunction calculateAverageItemHeight(\n itemHeights: Record<number, number>,\n defaultItemHeight: number\n): number {\n const values = Object.values(itemHeights) // warning: itemHeights is mutated and not updated itself, we can't watch it!\n if (isEmpty(values)) {\n return defaultItemHeight\n }\n\n const add = (a: number, b: number) => a + b\n const total = values.reduce(add)\n return total / values.length\n}\n\nexport function selectPreviousRow(columns: JSONPath[], selection: JSONSelection): JSONSelection {\n const { rowIndex, columnIndex } = toTableCellPosition(getFocusPath(selection), columns)\n\n if (rowIndex > 0) {\n const previousPosition = { rowIndex: rowIndex - 1, columnIndex }\n const previousPath = fromTableCellPosition(previousPosition, columns)\n return createValueSelection(previousPath)\n }\n\n return selection\n}\n\nexport function selectNextRow(\n json: unknown,\n columns: JSONPath[],\n selection: JSONSelection\n): JSONSelection {\n const { rowIndex, columnIndex } = toTableCellPosition(getFocusPath(selection), columns)\n\n if (rowIndex < (json as Array<unknown>).length - 1) {\n const nextPosition = { rowIndex: rowIndex + 1, columnIndex }\n const nextPath = fromTableCellPosition(nextPosition, columns)\n return createValueSelection(nextPath)\n }\n\n return selection\n}\n\nexport function selectPreviousColumn(columns: JSONPath[], selection: JSONSelection): JSONSelection {\n const { rowIndex, columnIndex } = toTableCellPosition(getFocusPath(selection), columns)\n\n if (columnIndex > 0) {\n const previousPosition = { rowIndex, columnIndex: columnIndex - 1 }\n const previousPath = fromTableCellPosition(previousPosition, columns)\n return createValueSelection(previousPath)\n }\n\n return selection\n}\n\nexport function selectNextColumn(columns: JSONPath[], selection: JSONSelection): JSONSelection {\n const { rowIndex, columnIndex } = toTableCellPosition(getFocusPath(selection), columns)\n\n if (columnIndex < columns.length - 1) {\n const nextPosition = { rowIndex, columnIndex: columnIndex + 1 }\n const nextPath = fromTableCellPosition(nextPosition, columns)\n return createValueSelection(nextPath)\n }\n\n return selection\n}\n\nexport function toTableCellPosition(path: JSONPath, columns: JSONPath[]): TableCellIndex {\n const [index, ...column] = path\n\n const rowIndex = parseInt(index, 10)\n\n return {\n rowIndex: !isNaN(rowIndex) ? rowIndex : -1,\n columnIndex: columns.findIndex((c) => pathStartsWith(column, c))\n }\n}\n\nexport function fromTableCellPosition(position: TableCellIndex, columns: JSONPath[]): JSONPath {\n const { rowIndex, columnIndex } = position\n\n return [String(rowIndex), ...columns[columnIndex]]\n}\n\nexport function stringifyTableCellPosition(position: TableCellIndex): string {\n const { rowIndex, columnIndex } = position\n\n return `${rowIndex}:${columnIndex}`\n}\n\ninterface GroupedValidationErrorsByRow {\n row: ValidationError[]\n columns: Dictionary<ValidationError[]>\n}\n\nexport interface GroupedValidationErrors {\n root: ValidationError[]\n rows: Dictionary<GroupedValidationErrorsByRow>\n}\n\n/**\n * Group validation errors for use in the Table view: per column, and a group for the row as a whole\n */\nexport function groupValidationErrors(\n validationErrors: ValidationError[],\n columns: JSONPath[]\n): GroupedValidationErrors {\n const [arrayErrors, rootErrors] = partition(validationErrors, (validationError) =>\n containsNumber(validationError.path[0])\n )\n\n const errorsByRow: Dictionary<ValidationError[]> = groupBy(arrayErrors, findRowIndex)\n\n const groupedErrorsByRow = mapValues(errorsByRow, (errors) => {\n const groupByRow: GroupedValidationErrorsByRow = {\n row: [],\n columns: {}\n }\n\n errors.forEach((error) => {\n const columnIndex = findColumnIndex(error, columns)\n\n if (columnIndex !== -1) {\n if (groupByRow.columns[columnIndex] === undefined) {\n groupByRow.columns[columnIndex] = []\n }\n groupByRow.columns[columnIndex].push(error)\n } else {\n groupByRow.row.push(error)\n }\n })\n\n return groupByRow\n })\n\n return {\n root: rootErrors,\n rows: groupedErrorsByRow\n }\n}\n\nexport function mergeValidationErrors(\n path: JSONPath,\n validationErrors: ValidationError[] | undefined\n): ValidationError | undefined {\n if (!validationErrors || validationErrors.length === 0) {\n return undefined\n }\n\n if (validationErrors.length === 1) {\n return validationErrors[0]\n }\n\n return {\n path,\n message:\n 'Multiple validation issues: ' +\n validationErrors\n .map((error) => {\n return stringifyJSONPath(error.path) + ' ' + error.message\n })\n .join(', '),\n severity: ValidationSeverity.warning\n }\n}\n\nfunction findRowIndex(error: ValidationError): number {\n return parseInt(error.path[0], 10)\n}\n\nfunction findColumnIndex(error: ValidationError, columns: JSONPath[]): number {\n const position = toTableCellPosition(error.path, columns)\n\n if (position.columnIndex !== -1) {\n return position.columnIndex\n }\n\n return -1\n}\n\n/**\n * Clear the sorted column from the documentState when it is affected by the operations\n */\nexport function clearSortedColumnWhenAffectedByOperations(\n sortedColumn: SortedColumn | undefined,\n operations: JSONPatchOperation[],\n columms: JSONPath[]\n): SortedColumn | undefined {\n const mustBeCleared = operations.some((operation) =>\n operationAffectsSortedColumn(sortedColumn, operation, columms)\n )\n\n return mustBeCleared ? undefined : sortedColumn\n}\n\nexport function operationAffectsSortedColumn(\n sortedColumn: SortedColumn | undefined,\n operation: JSONPatchOperation,\n columns: JSONPath[]\n): boolean {\n if (!sortedColumn) {\n return false\n }\n\n // an operation of replacing a value in a different column does not affect the currently sorted order\n if (operation.op === 'replace') {\n const path = parseJSONPointer(operation.path)\n const { rowIndex, columnIndex } = toTableCellPosition(path, columns)\n const selectedColumnIndex = columns.findIndex((column) => isEqual(column, sortedColumn.path))\n\n if (rowIndex !== -1 && columnIndex !== -1 && columnIndex !== selectedColumnIndex) {\n return false\n }\n }\n\n // TODO: there are more cases where we can known an operation does not affect the sorted order, improve this\n // For example adding a nested value in a different column, or removing a full row.\n\n return true\n}\n\n/**\n * Find nested arrays inside a JSON object\n */\nexport function findNestedArrays(json: unknown, maxLevel = 2): JSONPath[] {\n const props: JSONPath[] = []\n\n function recurse(value: unknown, path: JSONPath) {\n if (isJSONObject(value) && path.length < maxLevel) {\n Object.keys(value).forEach((key) => {\n recurse(value[key], path.concat(key))\n })\n }\n\n if (isJSONArray(value)) {\n props.push(path)\n }\n }\n\n recurse(json, [])\n\n return props\n}\n","import {\n createEditKeySelection,\n createEditValueSelection,\n createInsideSelection,\n createMultiSelection,\n createValueSelection,\n getFocusPath,\n hasSelectionContents,\n isKeySelection,\n isValueSelection,\n selectionToPartialJson\n} from '$lib/logic/selection.js'\nimport copyToClipboard from '$lib/utils/copyToClipboard.js'\nimport {\n append,\n createNewValue,\n createRemoveOperations,\n duplicate,\n insert,\n insertBefore,\n removeAll\n} from '$lib/logic/operations.js'\nimport type {\n AfterPatchCallback,\n InsertType,\n JSONParser,\n JSONSelection,\n OnChange,\n OnChangeText,\n OnJSONSelect,\n OnPatch\n} from '$lib/types'\nimport { createDebug } from '$lib/utils/debug.js'\nimport {\n getIn,\n isJSONObject,\n isJSONPatchAdd,\n isJSONPatchReplace,\n type JSONPatchOperation,\n type JSONPath,\n parsePath\n} from 'immutable-json-patch'\nimport { isObject, isObjectOrArray } from '$lib/utils/typeUtils.js'\nimport { expandAll, expandNone, expandPath, expandSmart } from '$lib/logic/documentState.js'\nimport { initial, isEmpty, last } from 'lodash-es'\nimport { fromTableCellPosition, toTableCellPosition } from '$lib/logic/table.js'\nimport { parsePartialJson } from '$lib/utils/jsonUtils'\nimport { MAX_MULTILINE_PASTE_SIZE } from '$lib/constants'\n\nconst debug = createDebug('jsoneditor:actions')\n\nexport interface OnCutAction {\n json: unknown | undefined\n selection: JSONSelection | undefined\n indentation: string | number | undefined\n readOnly: boolean\n parser: JSONParser\n onPatch: OnPatch\n}\n\n// TODO: write unit tests\nexport async function onCut({\n json,\n selection,\n indentation,\n readOnly,\n parser,\n onPatch\n}: OnCutAction) {\n if (readOnly || json === undefined || !selection || !hasSelectionContents(selection)) {\n return\n }\n\n const clipboard = selectionToPartialJson(json, selection, indentation, parser)\n if (clipboard === undefined) {\n return\n }\n\n debug('cut', { selection, clipboard, indentation })\n\n await copyToClipboard(clipboard)\n\n const { operations, newSelection } = createRemoveOperations(json, selection)\n\n onPatch(operations, (_, patchedState) => ({\n state: patchedState,\n selection: newSelection\n }))\n}\n\nexport interface OnCopyAction {\n json: unknown\n selection: JSONSelection | undefined\n indentation: string | number | undefined\n parser: JSONParser\n}\n\n// TODO: write unit tests\nexport async function onCopy({ json, selection, indentation, parser }: OnCopyAction) {\n const clipboard = selectionToPartialJson(json, selection, indentation, parser)\n if (clipboard === undefined) {\n return\n }\n\n debug('copy', { clipboard, indentation })\n\n await copyToClipboard(clipboard)\n}\n\ntype RepairModalCallback = (text: string, onApply: (repairedText: string) => void) => void\n\ninterface OnPasteAction {\n clipboardText: string\n json: unknown | undefined\n selection: JSONSelection | undefined\n readOnly: boolean\n parser: JSONParser\n onPatch: OnPatch\n onChangeText: OnChangeText\n onPasteMultilineText: (pastedText: string) => void\n openRepairModal: RepairModalCallback\n}\n\n// TODO: write unit tests\nexport function onPaste({\n clipboardText,\n json,\n selection,\n readOnly,\n parser,\n onPatch,\n onChangeText,\n onPasteMultilineText,\n openRepairModal\n}: OnPasteAction) {\n if (readOnly) {\n return\n }\n\n function doPaste(pastedText: string) {\n if (json !== undefined) {\n const ensureSelection = selection || createValueSelection([])\n\n const operations = insert(json, ensureSelection, pastedText, parser)\n\n const pasteMultilineText = isMultilineTextPastedAsArray(clipboardText, operations, parser)\n\n debug('paste', { pastedText, operations, ensureSelection, pasteMultilineText })\n\n onPatch(operations, (patchedJson, patchedState) => {\n let updatedState = patchedState\n\n // expand newly inserted object/array\n operations\n .filter(\n (operation) =>\n (isJSONPatchAdd(operation) || isJSONPatchReplace(operation)) &&\n isObjectOrArray(operation.value)\n )\n .forEach((operation) => {\n const path = parsePath(json, operation.path)\n updatedState = expandSmart(patchedJson, updatedState, path)\n })\n\n return {\n state: updatedState\n }\n })\n\n if (pasteMultilineText) {\n onPasteMultilineText(pastedText)\n }\n } else {\n // no json: empty document, or the contents is invalid text\n debug('paste text', { pastedText })\n\n onChangeText(clipboardText, (patchedJson, patchedState) => {\n if (patchedJson) {\n const path: JSONPath = []\n return {\n state: expandSmart(patchedJson, patchedState, path)\n }\n }\n\n return undefined\n })\n }\n }\n\n try {\n doPaste(clipboardText)\n } catch {\n openRepairModal(clipboardText, (repairedText) => {\n debug('repaired pasted text: ', repairedText)\n doPaste(repairedText)\n })\n }\n}\n\n/**\n * When pasting text, we cannot always know how whether the text was intended as\n * a list with items that should be parsed into a JSON Array (after jsonrepair),\n * or a text with multiple lines that should be parsed into a single string.\n *\n * This function checks whether we're dealing with such a case, after which\n * we can show a message to the user asking about the intended behavior.\n */\nexport function isMultilineTextPastedAsArray(\n clipboardText: string,\n operators: JSONPatchOperation[],\n parser: JSONParser,\n maxSize = MAX_MULTILINE_PASTE_SIZE\n): boolean {\n if (clipboardText.length > maxSize) {\n // we don't want this feature detecting multiline text to impact performance, hence this max\n return false\n }\n\n const containsNewline = /\\n/.test(clipboardText)\n if (!containsNewline) {\n return false\n }\n\n const replaceArrayOperation = operators.some(\n (operator) => operator.op === 'replace' && Array.isArray(operator.value)\n )\n const multipleAddOperations = operators.filter((operator) => operator.op === 'add').length > 1\n const pastingArray = replaceArrayOperation || multipleAddOperations\n if (!pastingArray) {\n return false\n }\n\n try {\n parsePartialJson(clipboardText, parser.parse)\n\n return false\n } catch {\n return true\n }\n}\n\nexport interface OnRemoveAction {\n json: unknown | undefined\n text: string | undefined\n selection: JSONSelection | undefined\n keepSelection: boolean\n readOnly: boolean\n onChange: OnChange\n onPatch: OnPatch\n}\n\n// TODO: write unit tests\nexport function onRemove({\n json,\n text,\n selection,\n keepSelection,\n readOnly,\n onChange,\n onPatch\n}: OnRemoveAction) {\n if (readOnly || !selection) {\n return\n }\n\n // in case of a selected key or value, we change the selection to the whole\n // entry to remove this, we do not want to clear a key or value only.\n const removeSelection =\n json !== undefined && (isKeySelection(selection) || isValueSelection(selection))\n ? createMultiSelection(selection.path, selection.path)\n : selection\n\n if (isEmpty(getFocusPath(selection))) {\n // root selected -> clear complete document\n debug('remove root', { selection })\n\n if (onChange) {\n onChange(\n { text: '', json: undefined },\n json !== undefined ? { text: undefined, json } : { text: text || '', json },\n {\n contentErrors: undefined,\n patchResult: undefined\n }\n )\n }\n } else {\n // remove selection\n if (json !== undefined) {\n const { operations, newSelection } = createRemoveOperations(json, removeSelection)\n\n debug('remove', { operations, selection, newSelection })\n\n onPatch(operations, (_, patchedState) => ({\n state: patchedState,\n selection: keepSelection ? selection : newSelection\n }))\n }\n }\n}\n\nexport interface OnDuplicateRowAction {\n json: unknown | undefined\n selection: JSONSelection | undefined\n columns: JSONPath[]\n readOnly: boolean\n onPatch: OnPatch\n}\n\n/**\n * This function assumes that the json holds the Array that we're duplicating a row for,\n * it cannot duplicate something in some nested array\n */\n// TODO: write unit tests\nexport function onDuplicateRow({\n json,\n selection,\n columns,\n readOnly,\n onPatch\n}: OnDuplicateRowAction) {\n if (readOnly || json === undefined || !selection || !hasSelectionContents(selection)) {\n return\n }\n\n const { rowIndex, columnIndex } = toTableCellPosition(getFocusPath(selection), columns)\n\n debug('duplicate row', { rowIndex })\n\n const rowPath = [String(rowIndex)]\n const operations = duplicate(json, [rowPath])\n\n onPatch(operations, (_, patchedState) => {\n const newRowIndex = rowIndex < (json as Array<unknown>).length ? rowIndex + 1 : rowIndex\n const newPath = fromTableCellPosition({ rowIndex: newRowIndex, columnIndex }, columns)\n const newSelection = createValueSelection(newPath)\n\n return {\n state: patchedState,\n selection: newSelection\n }\n })\n}\n\nexport interface OnInsertBeforeRowAction {\n json: unknown | undefined\n selection: JSONSelection | undefined\n columns: JSONPath[]\n readOnly: boolean\n onPatch: OnPatch\n}\n\n/**\n * This function assumes that the json holds the Array that we're duplicating a row for,\n * it cannot duplicate something in some nested array\n */\n// TODO: write unit tests\nexport function onInsertBeforeRow({\n json,\n selection,\n columns,\n readOnly,\n onPatch\n}: OnInsertBeforeRowAction) {\n if (readOnly || json === undefined || !selection || !hasSelectionContents(selection)) {\n return\n }\n\n const { rowIndex } = toTableCellPosition(getFocusPath(selection), columns)\n\n debug('insert before row', { rowIndex })\n\n const rowPath = [String(rowIndex)]\n const newValue = isJSONObject((json as Array<unknown>)[0]) ? {} : ''\n const values = [{ key: '', value: newValue }]\n const operations = insertBefore(json, rowPath, values)\n\n onPatch(operations)\n}\n\nexport interface OnInsertAfterRowAction {\n json: unknown | undefined\n selection: JSONSelection | undefined\n columns: JSONPath[]\n readOnly: boolean\n onPatch: OnPatch\n}\n\n/**\n * This function assumes that the json holds the Array that we're duplicating a row for,\n * it cannot duplicate something in some nested array\n */\n// TODO: write unit tests\nexport function onInsertAfterRow({\n json,\n selection,\n columns,\n readOnly,\n onPatch\n}: OnInsertAfterRowAction) {\n if (readOnly || json === undefined || !selection || !hasSelectionContents(selection)) {\n return\n }\n\n const { rowIndex, columnIndex } = toTableCellPosition(getFocusPath(selection), columns)\n\n debug('insert after row', { rowIndex })\n\n const nextRowIndex = rowIndex + 1\n const nextRowPath = [String(nextRowIndex)]\n const newValue = isJSONObject((json as Array<unknown>)[0]) ? {} : ''\n const values = [{ key: '', value: newValue }]\n\n const operations =\n nextRowIndex < (json as Array<unknown>).length\n ? insertBefore(json, nextRowPath, values)\n : append(json, [], values)\n\n onPatch(operations, (_, patchedState) => {\n const nextPath = fromTableCellPosition({ rowIndex: nextRowIndex, columnIndex }, columns)\n const newSelection = createValueSelection(nextPath)\n\n return {\n state: patchedState,\n selection: newSelection\n }\n })\n}\n\nexport interface OnRemoveRowAction {\n json: unknown | undefined\n selection: JSONSelection | undefined\n columns: JSONPath[]\n readOnly: boolean\n onPatch: OnPatch\n}\n\n/**\n * This function assumes that the json holds the Array that we're duplicating a row for,\n * it cannot duplicate something in some nested array\n */\n// TODO: write unit tests\nexport function onRemoveRow({ json, selection, columns, readOnly, onPatch }: OnRemoveRowAction) {\n if (readOnly || json === undefined || !selection || !hasSelectionContents(selection)) {\n return\n }\n\n const { rowIndex, columnIndex } = toTableCellPosition(getFocusPath(selection), columns)\n\n debug('remove row', { rowIndex })\n\n const rowPath = [String(rowIndex)]\n const operations = removeAll([rowPath])\n\n onPatch(operations, (patchedJson, patchedState) => {\n const newRowIndex =\n rowIndex < (patchedJson as Array<unknown>).length\n ? rowIndex\n : rowIndex > 0\n ? rowIndex - 1\n : undefined\n\n const newSelection =\n newRowIndex !== undefined\n ? createValueSelection(\n fromTableCellPosition({ rowIndex: newRowIndex, columnIndex }, columns)\n )\n : undefined\n\n debug('remove row new selection', { rowIndex, newRowIndex, newSelection })\n\n return {\n state: patchedState,\n selection: newSelection\n }\n })\n}\n\nexport interface OnInsert {\n insertType: InsertType\n selectInside: boolean\n json: unknown | undefined\n selection: JSONSelection | undefined\n initialValue: string | undefined\n readOnly: boolean\n parser: JSONParser\n onPatch: OnPatch\n onReplaceJson: (updatedJson: unknown, afterPatch: AfterPatchCallback) => void\n}\n\n// TODO: write unit tests\nexport function onInsert({\n insertType,\n selectInside,\n initialValue,\n json,\n selection,\n readOnly,\n parser,\n onPatch,\n onReplaceJson\n}: OnInsert): void {\n if (readOnly) {\n return\n }\n\n const newValue = createNewValue(json, selection, insertType)\n\n if (json !== undefined) {\n const data = parser.stringify(newValue) as string\n const operations = insert(json, selection, data, parser)\n debug('onInsert', { insertType, operations, newValue, data })\n\n const operation = last(\n operations.filter((operation) => operation.op === 'add' || operation.op === 'replace')\n )\n\n onPatch(operations, (patchedJson, patchedState, patchedSelection) => {\n // TODO: extract determining the newSelection in a separate function\n if (operation) {\n const path = parsePath(patchedJson, operation.path)\n\n if (isObjectOrArray(newValue)) {\n return {\n state: expandPath(patchedJson, patchedState, path, expandAll),\n selection: selectInside ? createInsideSelection(path) : patchedSelection\n }\n }\n\n if (newValue === '') {\n // open the newly inserted value in edit mode\n const parent = !isEmpty(path) ? getIn(patchedJson, initial(path)) : undefined\n\n return {\n state: expandPath(patchedJson, patchedState, path, expandNone),\n selection: isObject(parent)\n ? createEditKeySelection(path, initialValue)\n : createEditValueSelection(path, initialValue)\n }\n }\n }\n\n return undefined\n })\n\n debug('after patch')\n } else {\n // document is empty or invalid (in that case it has text but no json)\n debug('onInsert', { insertType, newValue })\n\n const path: JSONPath = []\n onReplaceJson(newValue, (patchedJson, patchedState) => ({\n state: expandSmart(patchedJson, patchedState, path),\n selection: isObjectOrArray(newValue)\n ? createInsideSelection(path)\n : createEditValueSelection(path)\n }))\n }\n}\n\nexport interface OnInsertCharacter {\n char: string\n selectInside: boolean\n json: unknown | undefined\n selection: JSONSelection | undefined\n readOnly: boolean\n parser: JSONParser\n onPatch: OnPatch\n onReplaceJson: (updatedJson: unknown, afterPatch: AfterPatchCallback) => void\n onSelect: OnJSONSelect\n}\n\n// TODO: write unit tests\nexport async function onInsertCharacter({\n char,\n selectInside,\n json,\n selection,\n readOnly,\n parser,\n onPatch,\n onReplaceJson,\n onSelect\n}: OnInsertCharacter) {\n // a regular key like a, A, _, etc. is entered.\n // Replace selected contents with a new value having this first character as text\n if (readOnly) {\n return\n }\n\n if (isKeySelection(selection)) {\n onSelect({ ...selection, edit: true, initialValue: char })\n return\n }\n\n if (char === '{') {\n onInsert({\n insertType: 'object',\n selectInside,\n initialValue: undefined, // not relevant\n json,\n selection,\n readOnly,\n parser,\n onPatch,\n onReplaceJson\n })\n } else if (char === '[') {\n onInsert({\n insertType: 'array',\n selectInside,\n initialValue: undefined, // not relevant\n json,\n selection,\n readOnly,\n parser,\n onPatch,\n onReplaceJson\n })\n } else {\n if (isValueSelection(selection) && json !== undefined) {\n if (!isObjectOrArray(getIn(json, selection.path))) {\n onSelect({ ...selection, edit: true, initialValue: char })\n } else {\n // TODO: replace the object/array with editing a text in edit mode?\n // (Ideally this this should not create an entry in history though,\n // which isn't really possible right now since we have to apply\n // a patch to change the object/array into a value)\n }\n } else {\n debug('onInsertValueWithCharacter', { char })\n await onInsertValueWithCharacter({\n char,\n json,\n selection,\n readOnly,\n parser,\n onPatch,\n onReplaceJson\n })\n }\n }\n}\n\ninterface OnInsertValueWithCharacter {\n char: string\n json: unknown | undefined\n selection: JSONSelection | undefined\n readOnly: boolean\n parser: JSONParser\n onPatch: OnPatch\n onReplaceJson: (updatedJson: unknown, afterPatch: AfterPatchCallback) => void\n}\n\nasync function onInsertValueWithCharacter({\n char,\n json,\n selection,\n readOnly,\n parser,\n onPatch,\n onReplaceJson\n}: OnInsertValueWithCharacter) {\n if (readOnly) {\n return\n }\n\n // first insert a new value\n onInsert({\n insertType: 'value',\n selectInside: false, // not relevant, we insert a value, not an object or array\n initialValue: char,\n json,\n selection,\n readOnly,\n parser,\n onPatch,\n onReplaceJson\n })\n}\n","<script lang=\"ts\">\n import type { JSONParser } from '$lib/types'\n import { truncate } from '$lib/utils/stringUtils.js'\n import { getText } from '$lib/utils/jsonUtils.js'\n import { MAX_CHARACTERS_TEXT_PREVIEW } from '$lib/constants.js'\n\n export let text: string | undefined\n export let json: unknown | undefined\n export let indentation: number | string\n export let parser: JSONParser\n\n $: content = json !== undefined ? { json } : { text: text || '' }\n $: truncated = truncate(getText(content, indentation, parser), MAX_CHARACTERS_TEXT_PREVIEW)\n</script>\n\n<div class=\"jse-json-preview\">\n {truncated}\n</div>\n\n<style src=\"./JSONPreview.scss\"></style>\n","<script lang=\"ts\">\n import type { MenuButton } from '$lib/types'\n import Icon from 'svelte-awesome'\n import { classnames } from '$lib/utils/cssUtils.js'\n\n export let item: MenuButton\n export let className: string | undefined = undefined\n export let onRequestClose: () => void\n</script>\n\n<button\n type=\"button\"\n class={classnames('jse-context-menu-button', className, item.className)}\n on:click={(event) => {\n onRequestClose()\n item.onClick(event)\n }}\n title={item.title}\n disabled={item.disabled || false}\n>\n {#if item.icon}\n <Icon data={item.icon} />\n {/if}\n {#if item.text}\n {item.text}\n {/if}\n</button>\n\n<style src=\"./ContextMenuButton.scss\"></style>\n","<script lang=\"ts\">\n import type { MenuDropDownButton } from '$lib/types'\n import DropdownButton from '../DropdownButton.svelte'\n import Icon from 'svelte-awesome'\n import { classnames } from '$lib/utils/cssUtils.js'\n\n export let item: MenuDropDownButton\n export let className: string | undefined = undefined\n export let onRequestClose: () => void\n\n $: items = item.items.map((item) => ({\n ...item,\n onClick: (event: MouseEvent) => {\n onRequestClose()\n item.onClick(event)\n }\n }))\n</script>\n\n<DropdownButton width={item.width} {items}>\n <button\n class={classnames('jse-context-menu-button', className, item.main.className)}\n type=\"button\"\n slot=\"defaultItem\"\n title={item.main.title}\n on:click={(event) => {\n onRequestClose()\n item.main.onClick(event)\n }}\n disabled={item.main.disabled || false}\n >\n {#if item.main.icon}\n <Icon data={item.main.icon} />\n {/if}\n {item.main.text}\n </button>\n</DropdownButton>\n\n<style src=\"./ContextMenuDropDownButton.scss\"></style>\n","<svelte:options immutable={true} />\n\n<script lang=\"ts\">\n import Icon from 'svelte-awesome'\n import { faCaretDown } from '@fortawesome/free-solid-svg-icons'\n import { onDestroy, onMount } from 'svelte'\n import { keyComboFromEvent } from '$lib/utils/keyBindings.js'\n import type { MenuButton } from '$lib/types.js'\n\n export let items: MenuButton[] = []\n export let title: string | undefined = undefined\n export let width = '120px'\n\n let visible = false\n\n $: allItemsDisabled = items.every((item) => item.disabled === true)\n\n function toggleShow() {\n const wasVisible = visible\n\n // trigger *after* the handleClick which changes visibility to false\n setTimeout(() => (visible = !wasVisible))\n }\n\n function handleClick() {\n visible = false\n }\n\n function handleKeyDown(event: KeyboardEvent) {\n const combo = keyComboFromEvent(event)\n if (combo === 'Escape') {\n event.preventDefault()\n visible = false\n }\n }\n\n onMount(() => {\n document.addEventListener('click', handleClick)\n document.addEventListener('keydown', handleKeyDown)\n })\n\n onDestroy(() => {\n document.removeEventListener('click', handleClick)\n document.removeEventListener('keydown', handleKeyDown)\n })\n</script>\n\n<!-- svelte-ignore a11y-click-events-have-key-events -->\n<div role=\"button\" tabindex=\"0\" class=\"jse-dropdown-button\" {title} on:click={handleClick}>\n <slot name=\"defaultItem\" />\n\n <button\n type=\"button\"\n class=\"jse-open-dropdown\"\n data-type=\"jse-open-dropdown\"\n class:jse-visible={visible}\n on:click={toggleShow}\n disabled={allItemsDisabled}\n >\n <Icon data={faCaretDown} />\n </button>\n\n <div class=\"jse-dropdown-items\" class:jse-visible={visible} style=\"width: {width};\">\n <ul>\n {#each items as item}\n <li>\n <button\n type=\"button\"\n on:click={(event) => item.onClick(event)}\n title={item.title}\n disabled={item.disabled}\n class={item.className}\n >\n {#if item.icon}\n <Icon data={item.icon} />\n {/if}\n {item.text}\n </button>\n </li>\n {/each}\n </ul>\n </div>\n</div>\n\n<style src=\"./DropdownButton.scss\"></style>\n","<svelte:options immutable={true} />\n\n<script lang=\"ts\">\n import { onMount } from 'svelte'\n import Icon from 'svelte-awesome'\n import { keyComboFromEvent } from '$lib/utils/keyBindings.js'\n import { faLightbulb } from '@fortawesome/free-regular-svg-icons'\n import { findNearestElement } from '$lib/utils/domUtils.js'\n import type { ContextMenuItem, MenuItem } from '$lib/types.js'\n import {\n isContextMenuColumn,\n isContextMenuRow,\n isMenuButton,\n isMenuDropDownButton,\n isMenuLabel,\n isMenuSeparator\n } from '$lib/typeguards.js'\n import ContextMenuButton from './ContextMenuButton.svelte'\n import ContextMenuDropDownButton from './ContextMenuDropDownButton.svelte'\n\n export let items: ContextMenuItem[]\n export let onRequestClose: () => void\n export let tip: string | undefined\n\n let refContextMenu: HTMLDivElement\n\n onMount(() => {\n const firstEnabledButton = Array.from(refContextMenu.querySelectorAll('button')).find(\n (button) => !button.disabled\n )\n\n if (firstEnabledButton) {\n firstEnabledButton.focus()\n }\n })\n\n const directionByCombo: Record<string, 'Up' | 'Down' | 'Left' | 'Right'> = {\n ArrowUp: 'Up',\n ArrowDown: 'Down',\n ArrowLeft: 'Left',\n ArrowRight: 'Right'\n }\n\n function handleKeyDown(event: KeyboardEvent & { currentTarget: EventTarget & HTMLDivElement }) {\n const combo = keyComboFromEvent(event)\n const direction: 'Up' | 'Down' | 'Left' | 'Right' | undefined = directionByCombo[combo]\n\n if (direction && event.target) {\n event.preventDefault()\n\n const buttons: HTMLButtonElement[] = Array.from(\n refContextMenu.querySelectorAll('button:not([disabled])')\n )\n const nearest = findNearestElement<HTMLButtonElement>({\n allElements: buttons,\n currentElement: event.target as unknown as HTMLButtonElement,\n direction,\n hasPrio: (element: HTMLButtonElement) => {\n return element.getAttribute('data-type') !== 'jse-open-dropdown'\n }\n })\n if (nearest) {\n nearest.focus()\n }\n }\n }\n\n function unknownMenuItem(item: MenuItem): string {\n console.error('Unknown type of context menu item', item)\n return '???'\n }\n</script>\n\n<div\n role=\"menu\"\n tabindex=\"-1\"\n class=\"jse-contextmenu\"\n bind:this={refContextMenu}\n on:keydown={handleKeyDown}\n>\n {#each items as item}\n {#if isMenuButton(item)}\n <ContextMenuButton {item} {onRequestClose} />\n {:else if isMenuDropDownButton(item)}\n <ContextMenuDropDownButton {item} {onRequestClose} />\n {:else if isContextMenuRow(item)}\n <div class=\"jse-row\">\n {#each item.items as rowItem}\n {#if isMenuButton(rowItem)}\n <ContextMenuButton item={rowItem} {onRequestClose} />\n {:else if isMenuDropDownButton(rowItem)}\n <ContextMenuDropDownButton item={rowItem} {onRequestClose} />\n {:else if isContextMenuColumn(rowItem)}\n <div class=\"jse-column\">\n {#each rowItem.items as columnItem}\n {#if isMenuButton(columnItem)}\n <ContextMenuButton className=\"left\" item={columnItem} {onRequestClose} />\n {:else if isMenuDropDownButton(columnItem)}\n <ContextMenuDropDownButton className=\"left\" item={columnItem} {onRequestClose} />\n {:else if isMenuSeparator(columnItem)}\n <div class=\"jse-separator\"></div>\n {:else if isMenuLabel(columnItem)}\n <div class=\"jse-label\">\n {columnItem.text}\n </div>\n {:else}\n {unknownMenuItem(columnItem)}\n {/if}\n {/each}\n </div>\n {:else if isMenuSeparator(rowItem)}\n <div class=\"jse-separator\"></div>\n {:else}\n {unknownMenuItem(rowItem)}\n {/if}\n {/each}\n </div>\n {:else if isMenuSeparator(item)}\n <div class=\"jse-separator\"></div>\n {:else}\n {unknownMenuItem(item)}\n {/if}\n {/each}\n\n {#if tip}\n <div class=\"jse-row\">\n <div class=\"jse-tip\">\n <div class=\"jse-tip-icon\">\n <Icon data={faLightbulb} />\n </div>\n <div class=\"jse-tip-text\">{tip}</div>\n </div>\n </div>\n {/if}\n</div>\n\n<style src=\"./ContextMenu.scss\"></style>\n","<svelte:options immutable={true} />\n\n<script lang=\"ts\">\n import type { JSONPath } from 'immutable-json-patch'\n import { compileJSONPointer } from 'immutable-json-patch'\n import { getValueClass } from '$lib/plugins/value/components/utils/getValueClass.js'\n import { type JSONParser, type JSONSelection, Mode, type OnPatch } from '$lib/types.js'\n import { isValueSelection } from '$lib/logic/selection.js'\n\n export let path: JSONPath\n export let value: unknown\n export let mode: Mode\n export let parser: JSONParser\n export let readOnly: boolean\n export let selection: JSONSelection | undefined\n export let onPatch: OnPatch\n\n export let options: Array<{ value: unknown; text: string }>\n\n let refSelect: HTMLSelectElement | undefined\n\n let bindValue: unknown = value\n $: bindValue = value\n\n function applyFocus(selection: JSONSelection | undefined) {\n if (selection) {\n if (refSelect) {\n refSelect.focus()\n }\n }\n }\n\n $: applyFocus(selection)\n\n function handleSelect(event: Event) {\n event.stopPropagation()\n\n if (readOnly) {\n return\n }\n\n onPatch([\n {\n op: 'replace',\n path: compileJSONPointer(path),\n value: bindValue\n }\n ])\n }\n\n function handleMouseDown(event: MouseEvent) {\n // stop propagation to prevent selecting the whole line\n event.stopPropagation()\n }\n</script>\n\n<select\n class={`jse-enum-value ${getValueClass(bindValue, mode, parser)}`}\n class:jse-selected={isValueSelection(selection)}\n bind:value={bindValue}\n bind:this={refSelect}\n on:change={handleSelect}\n on:mousedown={handleMouseDown}\n>\n {#each options as option}\n <option value={option.value}>{option.text}</option>\n {/each}\n</select>\n\n<style src=\"./EnumValue.scss\"></style>\n","import type { JSONPath } from 'immutable-json-patch'\nimport type { JSONSchema, JSONSchemaDefinitions, JSONSchemaEnum } from '$lib/types'\n\n/**\n * Find enum options for given path in a JSONSchema\n */\nexport function getJSONSchemaOptions(\n schema: JSONSchema,\n schemaDefinitions: JSONSchemaDefinitions | undefined,\n path: JSONPath\n): JSONSchemaEnum | undefined {\n const schemaForPath = findSchema(schema, schemaDefinitions || {}, path)\n\n return schemaForPath ? findEnum(schemaForPath) : undefined\n}\n\n/**\n * find an enum definition in a JSON schema, as property `enum` or inside\n * one of the schemas composites (`oneOf`, `anyOf`, `allOf`)\n *\n * Source: https://github.com/josdejong/jsoneditor/blob/develop/src/js/Node.js\n */\nexport function findEnum(schema: JSONSchema): JSONSchemaEnum | undefined {\n if (Array.isArray(schema['enum'])) {\n return schema['enum']\n }\n\n const composite = schema['oneOf'] || schema['anyOf'] || schema['allOf']\n if (Array.isArray(composite)) {\n const match = composite.filter((entry) => entry.enum)\n if (match.length > 0) {\n return match[0].enum\n }\n }\n\n return undefined\n}\n\n/**\n * Return the part of a JSON schema matching given path.\n *\n * Source: https://github.com/josdejong/jsoneditor/blob/develop/src/js/Node.js\n */\nexport function findSchema(\n topLevelSchema: JSONSchema,\n schemaDefinitions: JSONSchemaDefinitions,\n path: JSONPath,\n currentSchema = topLevelSchema\n): JSONSchema | undefined {\n const nextPath = path.slice(1, path.length)\n const nextKey = path[0]\n\n let possibleSchemas = [currentSchema]\n for (const subSchemas of [currentSchema.oneOf, currentSchema.anyOf, currentSchema.allOf]) {\n if (Array.isArray(subSchemas)) {\n possibleSchemas = possibleSchemas.concat(subSchemas)\n }\n }\n\n for (const schema of possibleSchemas) {\n currentSchema = schema\n\n if ('$ref' in currentSchema && typeof currentSchema.$ref === 'string') {\n const ref = currentSchema.$ref\n if (ref in schemaDefinitions) {\n currentSchema = schemaDefinitions[ref]\n } else if (ref.startsWith('#/')) {\n const refPath = ref.substring(2).split('/')\n currentSchema = topLevelSchema\n for (const segment of refPath) {\n if (segment in currentSchema) {\n currentSchema = currentSchema[segment] as JSONSchema\n } else {\n throw Error(`Unable to resolve reference ${ref}`)\n }\n }\n } else if (ref.match(/#\\//g)?.length === 1) {\n const [schemaUrl, relativePath] = ref.split('#/')\n if (schemaUrl in schemaDefinitions) {\n const referencedSchema = schemaDefinitions[schemaUrl]\n const reference = { $ref: '#/'.concat(relativePath) }\n const auxNextPath = []\n auxNextPath.push(nextKey)\n if (nextPath.length > 0) {\n auxNextPath.push(...nextPath)\n }\n return findSchema(referencedSchema, schemaDefinitions, auxNextPath, reference)\n } else {\n throw Error(`Unable to resolve reference ${ref}`)\n }\n } else {\n throw Error(`Unable to resolve reference ${ref}`)\n }\n }\n\n // We have no more path segments to resolve, return the currently found schema\n // We do this here, after resolving references, in case of the leaf schema beeing a reference\n if (nextKey === undefined) {\n return currentSchema\n }\n\n if (\n typeof currentSchema.properties === 'object' &&\n currentSchema.properties &&\n nextKey in currentSchema.properties\n ) {\n currentSchema = (currentSchema.properties as Record<string, JSONSchema>)[nextKey]\n return findSchema(topLevelSchema, schemaDefinitions, nextPath, currentSchema)\n }\n\n if (typeof currentSchema.patternProperties === 'object' && currentSchema.patternProperties) {\n for (const prop in currentSchema.patternProperties) {\n if (nextKey.match(prop)) {\n currentSchema = (currentSchema.patternProperties as Record<string, JSONSchema>)[prop]\n return findSchema(topLevelSchema, schemaDefinitions, nextPath, currentSchema)\n }\n }\n }\n\n if (typeof currentSchema.additionalProperties === 'object') {\n currentSchema = currentSchema.additionalProperties as JSONSchema\n return findSchema(topLevelSchema, schemaDefinitions, nextPath, currentSchema)\n }\n\n if (typeof currentSchema.items === 'object' && currentSchema.items) {\n currentSchema = currentSchema.items as JSONSchema\n return findSchema(topLevelSchema, schemaDefinitions, nextPath, currentSchema)\n }\n }\n\n return undefined\n}\n","import EnumValue from './components/EnumValue.svelte'\nimport { getJSONSchemaOptions } from '$lib/utils/jsonSchemaUtils.js'\nimport type {\n JSONSchema,\n JSONSchemaDefinitions,\n RenderValueComponentDescription,\n RenderValueProps\n} from '$lib/types'\n\n/**\n * Search the JSON schema for enums defined at given props.path. If found,\n * return an EnumValue renderer. If not found, return null. In that case you\n * have to fallback on the default valueRender function\n */\nexport function renderJSONSchemaEnum(\n props: RenderValueProps,\n schema: JSONSchema,\n schemaDefinitions?: JSONSchemaDefinitions\n): RenderValueComponentDescription[] | undefined {\n const enumValues = getJSONSchemaOptions(schema, schemaDefinitions, props.path)\n\n if (enumValues) {\n const options = enumValues.map((enumValue) => ({\n value: enumValue,\n text: enumValue\n }))\n\n // make sure the current value is also added as one of the options,\n // else it would look as if the first option is the current value\n const optionsWithValue = enumValues.includes(props.value)\n ? options\n : [{ value: props.value, text: props.value }].concat(options)\n\n return [\n {\n component: EnumValue,\n props: {\n ...props,\n options: optionsWithValue\n }\n }\n ]\n }\n\n return undefined\n}\n","import type Ajv from 'ajv'\nimport type { Options, Schema, ErrorObject, ValidateFunction, AsyncSchema } from 'ajv'\nimport AjvDist from 'ajv'\nimport { parsePath } from 'immutable-json-patch'\nimport type { JSONSchema, JSONSchemaDefinitions, ValidationError, Validator } from '$lib/types'\nimport { ValidationSeverity } from '$lib/types.js'\n\nexport interface AjvValidatorOptions {\n /**\n * The JSON schema to validate (required).\n */\n schema: JSONSchema\n\n /**\n * An object containing JSON Schema definitions which can be referenced using $ref.\n */\n schemaDefinitions?: JSONSchemaDefinitions\n\n /**\n * Optional extra options for Ajv.\n */\n ajvOptions?: Options\n\n /**\n * An optional callback function allowing to apply additional configuration on the provided Ajv instance, or return\n * your own Ajv instance and ignore the provided one.\n */\n onCreateAjv?: (ajv: Ajv) => Ajv | void\n\n /**\n * The severity of the validation error.\n *\n * @default ValidationSeverity.warning\n */\n errorSeverity?: ValidationSeverity\n}\n\n/**\n * Create a JSON Schema validator powered by Ajv.\n */\nexport function createAjvValidator(options: AjvValidatorOptions): Validator {\n const ajv = createAjvInstance(options)\n\n const validateAjv = ajv.compile(options.schema as Schema)\n\n return createValidateFunction(validateAjv, options)\n}\n\n/**\n * Create a JSON Schema validator powered by Ajv.\n *\n * Same as `createAjvValidator`, but allows for remote schema resolution through `ajvOptions`'s `loadSchema(uri)`\n * function.\n *\n * Note that `ajvOptions.loadSchema` *must* be set, or Ajv throws an error on initialization!\n *\n * ### Example\n *\n * const validate = await createAjvValidatorAsync({\n * schema: {\n * $ref: '/schema.json'\n * },\n * ajvOptions: {\n * loadSchema(uri) {\n * return fetch(uri).then((res) => res.json())\n * }\n * }\n * })\n */\nexport async function createAjvValidatorAsync(options: AjvValidatorOptions): Promise<Validator> {\n const ajv = createAjvInstance(options)\n\n const validateAjv = await ajv.compileAsync(options.schema as AsyncSchema)\n\n return createValidateFunction(validateAjv, options)\n}\n\nfunction createAjvInstance(options: AjvValidatorOptions): Ajv {\n const { schemaDefinitions, ajvOptions } = options\n\n let ajv = new AjvDist({\n allErrors: true,\n verbose: true,\n $data: true,\n ...ajvOptions\n })\n\n if (schemaDefinitions) {\n Object.keys(schemaDefinitions).forEach((ref) => {\n ajv.addSchema(schemaDefinitions[ref] as Schema, ref)\n })\n }\n\n ajv = options.onCreateAjv?.(ajv) ?? ajv\n\n // validate whether ajv is configured correctly (this is needed to enhance error messages)\n if (ajv.opts.verbose === false) {\n throw new Error('Ajv must be configured with the option verbose=true')\n }\n\n return ajv\n}\n\nfunction createValidateFunction(\n ajvValidator: ValidateFunction<unknown>,\n options: AjvValidatorOptions\n): Validator {\n if (ajvValidator.errors) {\n throw ajvValidator.errors[0]\n }\n\n return function validate(json: unknown): ValidationError[] {\n ajvValidator(json)\n const ajvErrors = ajvValidator.errors ?? []\n\n return ajvErrors.map(improveAjvError).map((error) => normalizeAjvError(json, error, options))\n }\n}\n\nfunction normalizeAjvError(\n json: unknown,\n ajvError: ErrorObject,\n options: AjvValidatorOptions\n): ValidationError {\n return {\n path: parsePath(json, ajvError.instancePath),\n message: ajvError.message ?? 'Unknown error',\n severity: options.errorSeverity ?? ValidationSeverity.warning\n }\n}\n\n/**\n * Improve the error message of a JSON schema error,\n * for example list the available values of an enum.\n */\nfunction improveAjvError(ajvError: ErrorObject): ErrorObject {\n let message: string | undefined = undefined\n\n if (ajvError.keyword === 'enum' && Array.isArray(ajvError.schema)) {\n let enums = ajvError.schema\n if (enums) {\n enums = enums.map((value) => JSON.stringify(value))\n\n if (enums.length > 5) {\n const more = ['(' + (enums.length - 5) + ' more...)']\n enums = enums.slice(0, 5)\n enums.push(more)\n }\n message = 'should be equal to one of: ' + enums.join(', ')\n }\n }\n\n if (ajvError.keyword === 'additionalProperties') {\n message = 'should NOT have additional property: ' + ajvError.params.additionalProperty\n }\n\n return message ? { ...ajvError, message } : ajvError\n}\n","import jmespath from 'jmespath'\nimport type { JSONPath } from 'immutable-json-patch'\nimport { getIn } from 'immutable-json-patch'\nimport { parseString } from '$lib/utils/stringUtils.js'\nimport type { JSONParser, QueryLanguage, QueryLanguageOptions } from '$lib/types'\nimport { isEqualParser } from '$lib/utils/jsonUtils.js'\n\nconst description = `\n<p>\n 输入一个 <a href=\"https://jmespath.org\" target=\"_blank\" rel=\"noopener noreferrer\">JMESPath(jmespath.org)</a> 查询\n 来过滤、排序或转换 JSON 数据。\n 要学习 JMESPath,请访问<a href=\"https://jmespath.org/tutorial.html\" target=\"_blank\" rel=\"noopener noreferrer\">交互式教程</a>。\n</p>\n`\n\nexport const jmespathQueryLanguage: QueryLanguage = {\n id: 'jmespath',\n name: 'JMESPath',\n description: description,\n createQuery,\n executeQuery\n}\n\n/**\n * Build a JMESPath query based on query options coming from the wizard\n * @param json The JSON document for which to build the query.\n * Used for context information like determining\n * the type of values (string or number)\n * @param queryOptions\n * @return Returns a query (as string)\n */\nfunction createQuery(json: unknown, queryOptions: QueryLanguageOptions): string {\n const { sort, filter, projection } = queryOptions\n let query = ''\n\n if (filter && filter.path && filter.relation && filter.value) {\n const examplePath = ['0'].concat(filter.path)\n const exampleValue = getIn(json, examplePath)\n const filterValue = parseString(filter.value)\n const filterValueStr =\n typeof exampleValue === 'string' && filterValue !== null && filterValue !== undefined\n ? `\"${filter.value}\"`\n : filterValue\n\n query +=\n '[? ' +\n stringifyPathForJmespath(filter.path) +\n ' ' +\n filter.relation +\n ' ' +\n '`' +\n filterValueStr +\n '`' +\n ']'\n } else {\n query += Array.isArray(json) ? '[*]' : '@'\n }\n\n if (sort && sort.path && sort.direction) {\n if (sort.direction === 'desc') {\n query += ' | reverse(sort_by(@, &' + stringifyPathForJmespath(sort.path) + '))'\n } else {\n query += ' | sort_by(@, &' + stringifyPathForJmespath(sort.path) + ')'\n }\n }\n\n if (projection && projection.paths) {\n if (query[query.length - 1] !== ']') {\n query += ' | [*]'\n }\n\n if (projection.paths.length === 1) {\n const path = projection.paths[0]\n\n query +=\n path.length === 0\n ? '' // edge case, selecting projection of the item root\n : '.' + stringifyPathForJmespath(path)\n } else if (projection.paths.length > 1) {\n query +=\n '.{' +\n projection.paths\n .map((path) => {\n const name = path[path.length - 1]\n return stringifyProp(name) + ': ' + stringifyPathForJmespath(path)\n })\n .join(', ') +\n '}'\n } else {\n // values.length === 0\n // ignore\n }\n }\n\n return query\n}\n\n/**\n * Execute a JMESPath query, returns the transformed JSON\n */\nfunction executeQuery(json: unknown, query: string, parser: JSONParser): unknown {\n // JMESPath cannot handle non-native JSON data types like LosslessNumber\n\n function stringifyAndParse(json: unknown) {\n const text = parser.stringify(json)\n return text !== undefined ? JSON.parse(text) : undefined\n }\n\n const preprocessedJson = isEqualParser(parser, JSON) ? json : stringifyAndParse(json)\n\n return jmespath.search(preprocessedJson, query)\n}\n\n// TODO: unit test stringifyPathForJmespath\n// TODO: Isn't there a helper function exposed by the JMESPath library?\nexport function stringifyPathForJmespath(path: JSONPath): string {\n if (path.length === 0) {\n return '@'\n }\n\n const str = path\n .map((prop) => {\n if (typeof prop === 'number') {\n return '[' + prop + ']'\n } else {\n return '.' + stringifyProp(String(prop))\n }\n })\n .join('')\n\n return str[0] === '.'\n ? str.slice(1) // remove first dot\n : str\n}\n\nfunction stringifyProp(prop: string): string {\n return prop.match(/^[A-Za-z\\d_$]+$/) ? prop : JSON.stringify(prop)\n}\n","import { JSONPath as JSONPathPlus } from 'jsonpath-plus'\nimport { parseString } from '$lib/utils/stringUtils'\nimport type { QueryLanguage, QueryLanguageOptions } from '$lib/types'\nimport type { JSONPath } from 'immutable-json-patch'\n\nconst description = `\n<p>\n Enter a <a href=\"https://github.com/JSONPath-Plus/JSONPath\" target=\"_blank\" \n rel=\"noopener noreferrer\"><code>JSONPath</code></a> expression to filter, sort, or transform the data.\n</p>`\n\nexport const jsonpathQueryLanguage: QueryLanguage = {\n id: 'jsonpath',\n name: 'JSONPath',\n description,\n createQuery,\n executeQuery\n}\n\nfunction createQuery(_json: unknown, queryOptions: QueryLanguageOptions): string {\n const { filter, sort, projection } = queryOptions\n let expression = '$'\n\n if (filter && filter.path && filter.relation && filter.value) {\n const filterValue = parseString(filter.value)\n const filterValueStr = JSON.stringify(filterValue)\n\n expression += `[?(@${pathToString(filter.path)} ${filter.relation} ${filterValueStr})]`\n }\n\n if (sort && sort.path && sort.direction) {\n throw new Error('Sorting is not supported by JSONPath. Please clear the sorting fields')\n }\n\n if (projection && projection.paths) {\n if (projection.paths.length > 1) {\n throw new Error(\n 'Picking multiple fields is not supported by JSONPath. Please select only one field'\n )\n }\n\n if (!expression.endsWith(']')) {\n expression += '[*]'\n }\n expression += `${pathToString(projection.paths[0])}`.replace(/^\\.\\.\\./, '..')\n }\n\n return expression\n}\n\nfunction executeQuery(json: unknown, path: string): unknown {\n const output = JSONPathPlus({ json: json as JSON, path })\n return output !== undefined ? output : null\n}\n\nfunction pathToString(path: JSONPath): JSONPath | string {\n const lettersOnlyRegex = /^[A-z]+$/\n\n return path\n .map((prop) => {\n return lettersOnlyRegex.test(prop) ? `.${prop}` : JSON.stringify([prop])\n })\n .join('')\n}\n","import * as _ from 'lodash-es'\nimport { last } from 'lodash-es'\nimport { createLodashPropertySelector, createPropertySelector } from '$lib/utils/pathUtils.js'\nimport { parseString } from '$lib/utils/stringUtils.js'\nimport type { QueryLanguage, QueryLanguageOptions } from '$lib/types.js'\nimport { isInteger } from '$lib/utils/typeUtils.js'\n\nconst description = `\n<p>\n 使用JavaScript函数来过滤、排序或转换数据。\n You can use <a href=\"https://lodash.com\" target=\"_blank\" rel=\"noopener noreferrer\">Lodash</a>\n functions like <code>_.map</code>, <code>_.filter</code>,\n <code>_.orderBy</code>, <code>_.sortBy</code>, <code>_.groupBy</code>,\n <code>_.pick</code>, <code>_.uniq</code>, <code>_.get</code>, etcetera.\n</p>\n`\n\nexport const lodashQueryLanguage: QueryLanguage = {\n id: 'lodash',\n name: 'Lodash',\n description,\n createQuery,\n executeQuery\n}\n\nfunction createQuery(json: unknown, queryOptions: QueryLanguageOptions): string {\n const { filter, sort, projection } = queryOptions\n const queryParts = [' return _.chain(data)\\n']\n\n if (filter && filter.path && filter.relation && filter.value) {\n // Note that the comparisons embrace type coercion,\n // so a filter value like '5' (text) will match numbers like 5 too.\n const actualValueGetter = `item => item${createPropertySelector(filter.path)}`\n\n const filterValue = parseString(filter.value)\n const filterValueStr =\n typeof filterValue === 'string'\n ? `'${filter.value}'`\n : isInteger(filter.value) && !Number.isSafeInteger(filterValue)\n ? `${filter.value}n` // bigint\n : filter.value\n\n queryParts.push(` .filter(${actualValueGetter} ${filter.relation} ${filterValueStr})\\n`)\n }\n\n if (sort && sort.path && sort.direction) {\n queryParts.push(\n ` .orderBy([${createLodashPropertySelector(sort.path)}], ['${sort.direction}'])\\n`\n )\n }\n\n if (projection && projection.paths) {\n // It is possible to make a util function \"pickFlat\"\n // and use that when building the query to make it more readable.\n if (projection.paths.length > 1) {\n // Note that we do not use _.pick() here because this function doesn't flatten the results\n const paths = projection.paths.map((path) => {\n const name = last(path) || 'item' // 'item' in case of having selected the item root\n return ` ${JSON.stringify(name)}: item${createPropertySelector(path)}`\n })\n queryParts.push(` .map(item => ({\\n${paths.join(',\\n')}\\n }))\\n`)\n } else {\n const path = projection.paths[0]\n queryParts.push(` .map(item => item${createPropertySelector(path)})\\n`)\n }\n }\n\n queryParts.push(' .value()\\n')\n\n return `function query (data) {\\n${queryParts.join('')}}`\n}\n\nfunction executeQuery(json: unknown, query: string): unknown {\n validate(query)\n\n // TODO: only import the most relevant subset of lodash instead of the full library?\n const queryFn = new Function(\n '_',\n '\"use strict\";\\n' +\n '\\n' +\n query +\n '\\n' +\n '\\n' +\n 'if (typeof query !== \"function\") {\\n' +\n ' throw new Error(\"Cannot execute query: expecting a function named \\'query\\' but is undefined\")\\n' +\n '}\\n' +\n '\\n' +\n 'return query;\\n'\n )(_)\n\n const output = queryFn(json)\n return output !== undefined ? output : null\n}\n\nfunction validate(query: string) {\n // It is very common to forget to end a lodash chain with .value()\n // This lets the JSON Editor crash though.\n // Therefore, we do a simple validation (not a guarantee)\n const chainCount = query.match(/_\\.chain\\(/g)?.length\n const valueCount = query.match(/\\.value\\(\\)/g)?.length\n\n if (chainCount !== valueCount) {\n throw new Error('Cannot execute query: Lodash _.chain(...) must end with .value()')\n }\n}\n","import { createPropertySelector } from '$lib/utils/pathUtils.js'\nimport { parseString } from '$lib/utils/stringUtils.js'\nimport type { QueryLanguage, QueryLanguageOptions } from '$lib/types.js'\nimport { isInteger } from '$lib/utils/typeUtils.js'\n\nconst description = `\n<p>\n 使用JavaScript函数来过滤、排序或转换数据。\n</p>\n`\n\nexport const javascriptQueryLanguage: QueryLanguage = {\n id: 'javascript',\n name: 'JavaScript',\n description,\n createQuery,\n executeQuery\n}\n\nfunction createQuery(json: unknown, queryOptions: QueryLanguageOptions): string {\n const { filter, sort, projection } = queryOptions\n const queryParts = [' return data\\n']\n\n if (filter && filter.path && filter.relation && filter.value) {\n // Note that the comparisons embrace type coercion,\n // so a filter value like '5' (text) will match numbers like 5 too.\n const actualValueGetter = `item => item${createPropertySelector(filter.path)}`\n\n const filterValue = parseString(filter.value)\n const filterValueStr =\n typeof filterValue === 'string'\n ? `'${filter.value}'`\n : isInteger(filter.value) && !Number.isSafeInteger(filterValue)\n ? `${filter.value}n` // bigint\n : filter.value\n\n queryParts.push(` .filter(${actualValueGetter} ${filter.relation} ${filterValueStr})\\n`)\n }\n\n if (sort && sort.path && sort.direction) {\n if (sort.direction === 'desc') {\n queryParts.push(\n ` .slice()\\n` +\n ` .sort((a, b) => {\\n` +\n ` // sort descending\\n` +\n ` const valueA = a${createPropertySelector(sort.path)}\\n` +\n ` const valueB = b${createPropertySelector(sort.path)}\\n` +\n ` return valueA > valueB ? -1 : valueA < valueB ? 1 : 0\\n` +\n ` })\\n`\n )\n } else {\n // sort direction 'asc'\n queryParts.push(\n ` .slice()\\n` +\n ` .sort((a, b) => {\\n` +\n ` // sort ascending\\n` +\n ` const valueA = a${createPropertySelector(sort.path)}\\n` +\n ` const valueB = b${createPropertySelector(sort.path)}\\n` +\n ` return valueA > valueB ? 1 : valueA < valueB ? -1 : 0\\n` +\n ` })\\n`\n )\n }\n }\n\n if (projection && projection.paths) {\n // It is possible to make a util function \"pickFlat\"\n // and use that when building the query to make it more readable.\n if (projection.paths.length > 1) {\n const paths = projection.paths.map((path) => {\n const name = path[path.length - 1] || 'item' // 'item' in case of having selected the item root\n const item = `item${createPropertySelector(path)}`\n return ` ${JSON.stringify(name)}: ${item}`\n })\n\n queryParts.push(` .map(item => ({\\n${paths.join(',\\n')}})\\n )\\n`)\n } else {\n const item = `item${createPropertySelector(projection.paths[0])}`\n\n queryParts.push(` .map(item => ${item})\\n`)\n }\n }\n\n return `function query (data) {\\n${queryParts.join('')}}`\n}\n\nfunction executeQuery(json: unknown, query: string): unknown {\n // TODO: only import the most relevant subset of lodash instead of the full library?\n const queryFn = new Function(\n '\"use strict\";\\n' +\n '\\n' +\n query +\n '\\n' +\n '\\n' +\n 'if (typeof query !== \"function\") {\\n' +\n ' throw new Error(\"Cannot execute query: expecting a function named \\'query\\' but is undefined\")\\n' +\n '}\\n' +\n '\\n' +\n 'return query;\\n'\n )()\n\n const output = queryFn(json)\n return output !== undefined ? output : null\n}\n","// source: https://github.com/sveltejs/svelte/issues/7583\n\nlet observer: ResizeObserver\nlet callbacks: WeakMap<Element, (element: Element) => void>\n\n/**\n * Example usage:\n *\n * <script lang=\"ts\">\n * let clientWidth = 0\n * </script>\n *\n * <div use:resizeObserver={element => clientWidth = element.clientWidth}>\n * My width is: {clientWidth}\n * </div>\n */\nexport function resizeObserver(element: Element, onResize: (element: Element) => void) {\n if (!observer) {\n callbacks = new WeakMap()\n observer = new ResizeObserver((entries) => {\n for (const entry of entries) {\n const onResize = callbacks.get(entry.target)\n if (onResize) {\n onResize(entry.target)\n }\n }\n })\n }\n\n callbacks.set(element, onResize)\n observer.observe(element)\n\n return {\n destroy: () => {\n callbacks.delete(element)\n observer.unobserve(element)\n }\n }\n}\n","<svelte:options immutable={true} />\n\n<script lang=\"ts\">\n import { createAutoScrollHandler } from '../../controls/createAutoScrollHandler.js'\n import { faCheck, faCode, faWrench } from '@fortawesome/free-solid-svg-icons'\n import { createDebug } from '$lib/utils/debug.js'\n import {\n compileJSONPointer,\n existsIn,\n getIn,\n immutableJSONPatch,\n type JSONPatchDocument,\n type JSONPath\n } from 'immutable-json-patch'\n import { jsonrepair } from 'jsonrepair'\n import { initial, isEmpty, isEqual, noop, uniqueId } from 'lodash-es'\n import { flushSync, getContext, onDestroy, onMount } from 'svelte'\n import { createJump } from '$lib/assets/jump.js/src/jump.js'\n import {\n CONTEXT_MENU_HEIGHT,\n CONTEXT_MENU_WIDTH,\n SCROLL_DURATION,\n SEARCH_BOX_HEIGHT\n } from '$lib/constants.js'\n import {\n collapsePath,\n createDocumentState,\n documentStatePatch,\n expandAll,\n expandMinimal,\n expandNone,\n expandPath,\n expandSection,\n expandSelf,\n expandSmart,\n expandSmartIfCollapsed,\n getEnforceString,\n setInDocumentState,\n syncDocumentState\n } from '$lib/logic/documentState.js'\n import { duplicate, extract, revertJSONPatchWithMoveOperations } from '$lib/logic/operations.js'\n import {\n canConvert,\n createAfterSelection,\n createEditKeySelection,\n createEditValueSelection,\n createInsideSelection,\n createSelectionFromOperations,\n createValueSelection,\n findRootPath,\n getAnchorPath,\n getEndPath,\n getFocusPath,\n getInitialSelection,\n getSelectionDown,\n getSelectionLeft,\n getSelectionNextInside,\n getSelectionPaths,\n getSelectionRight,\n getSelectionUp,\n hasSelectionContents,\n isAfterSelection,\n isEditingSelection,\n isInsideSelection,\n isJSONSelection,\n isKeySelection,\n isMultiSelection,\n isMultiSelectionWithOneItem,\n isSelectionInsidePath,\n isValueSelection,\n removeEditModeFromSelection,\n selectAll\n } from '$lib/logic/selection.js'\n import { toRecursiveValidationErrors, validateJSON } from '$lib/logic/validation.js'\n import {\n activeElementIsChildOf,\n createNormalizationFunctions,\n encodeDataPath,\n findParentWithNodeName,\n getWindow,\n isChildOf,\n isChildOfNodeName\n } from '$lib/utils/domUtils.js'\n import {\n convertValue,\n isJSONContent,\n isTextContent,\n normalizeJsonParseError,\n parseAndRepair,\n parsePartialJson,\n repairPartialJson\n } from '$lib/utils/jsonUtils.js'\n import { keyComboFromEvent } from '$lib/utils/keyBindings.js'\n import { isObjectOrArray, isUrl, stringConvert } from '$lib/utils/typeUtils.js'\n import { createFocusTracker } from '../../controls/createFocusTracker.js'\n import Message from '../../controls/Message.svelte'\n import ValidationErrorsOverview from '../../controls/ValidationErrorsOverview.svelte'\n import CopyPasteModal from '../../modals/CopyPasteModal.svelte'\n import JSONRepairModal from '../../modals/JSONRepairModal.svelte'\n import JSONNode from './JSONNode.svelte'\n import TreeMenu from './menu/TreeMenu.svelte'\n import Welcome from './Welcome.svelte'\n import NavigationBar from '../../controls/navigationBar/NavigationBar.svelte'\n import SearchBox from '../../controls/SearchBox.svelte'\n import type {\n AbsolutePopupContext,\n AbsolutePopupOptions,\n AfterPatchCallback,\n Content,\n ContentErrors,\n ContextMenuItem,\n ConvertType,\n DocumentState,\n History,\n HistoryItem,\n InsertType,\n JSONEditorSelection,\n JSONParser,\n JSONPatchResult,\n JSONPathParser,\n JSONRepairModalProps,\n JSONSelection,\n OnBlur,\n OnChange,\n OnChangeMode,\n OnClassName,\n OnError,\n OnExpand,\n OnFocus,\n OnJSONEditorModal,\n OnRedo,\n OnRenderContextMenuInternal,\n OnRenderMenuInternal,\n OnRenderValue,\n OnSelect,\n OnSortModal,\n OnTransformModal,\n OnUndo,\n ParseError,\n PastedJson,\n ScrollToOptions,\n SearchResultDetails,\n SearchResults,\n Section,\n TransformModalOptions,\n TreeModeContext,\n ValidationError,\n ValidationErrors,\n Validator,\n ValueNormalization\n } from '$lib/types'\n import { Mode, ValidationSeverity } from '$lib/types.js'\n import memoizeOne from 'memoize-one'\n import { measure } from '$lib/utils/timeUtils.js'\n import {\n onCopy,\n onCut,\n onInsert,\n onInsertCharacter,\n onPaste,\n onRemove\n } from '$lib/logic/actions.js'\n import JSONPreview from '../../controls/JSONPreview.svelte'\n import ContextMenu from '../../controls/contextmenu/ContextMenu.svelte'\n import createTreeContextMenuItems from './contextmenu/createTreeContextMenuItems'\n import { toRecursiveSearchResults as toRecursiveSearchResults } from 'svelte-jsoneditor/logic/search.js'\n import { isTreeHistoryItem } from 'svelte-jsoneditor'\n\n const debug = createDebug('jsoneditor:TreeMode')\n\n const isSSR = typeof window === 'undefined'\n debug('isSSR:', isSSR)\n\n const sortModalId = uniqueId()\n const transformModalId = uniqueId()\n\n const { openAbsolutePopup, closeAbsolutePopup } =\n getContext<AbsolutePopupContext>('absolute-popup')\n\n let refContents: HTMLDivElement | undefined\n let refHiddenInput: HTMLInputElement\n let refJsonEditor: HTMLDivElement\n let hasFocus = false\n const jump = createJump()\n\n export let readOnly: boolean\n export let externalContent: Content\n export let externalSelection: JSONEditorSelection | undefined\n export let history: History<HistoryItem>\n export let truncateTextSize: number\n export let mainMenuBar: boolean\n export let navigationBar: boolean\n export let escapeControlCharacters: boolean\n export let escapeUnicodeCharacters: boolean\n export let parser: JSONParser\n export let parseMemoizeOne: JSONParser['parse']\n export let validator: Validator | undefined\n export let validationParser: JSONParser\n export let pathParser: JSONPathParser\n export let indentation: number | string\n export let onError: OnError\n export let onChange: OnChange\n export let onChangeMode: OnChangeMode\n export let onSelect: OnSelect\n export let onUndo: OnUndo\n export let onRedo: OnRedo\n export let onRenderValue: OnRenderValue\n export let onRenderMenu: OnRenderMenuInternal\n export let onRenderContextMenu: OnRenderContextMenuInternal\n export let onClassName: OnClassName | undefined\n export let onFocus: OnFocus\n export let onBlur: OnBlur\n export let onSortModal: OnSortModal\n export let onTransformModal: OnTransformModal\n export let onJSONEditorModal: OnJSONEditorModal\n\n // modalOpen is true when one of the modals is open.\n // This is used to track whether the editor still has focus\n let modalOpen = false\n let copyPasteModalOpen = false\n let jsonRepairModalProps: JSONRepairModalProps | undefined = undefined\n\n createFocusTracker({\n onMount,\n onDestroy,\n getWindow: () => getWindow(refJsonEditor),\n hasFocus: () => (modalOpen && document.hasFocus()) || activeElementIsChildOf(refJsonEditor),\n onFocus: () => {\n hasFocus = true\n if (onFocus) {\n onFocus()\n }\n },\n onBlur: () => {\n hasFocus = false\n if (onBlur) {\n onBlur()\n }\n }\n })\n\n let json: unknown | undefined\n let text: string | undefined\n let parseError: ParseError | undefined = undefined\n\n let documentStateInitialized = false\n let documentState: DocumentState | undefined = createDocumentState({ json })\n let selection: JSONSelection | undefined = isJSONSelection(externalSelection)\n ? externalSelection\n : undefined\n\n onMount(() => {\n if (selection) {\n const path = getFocusPath(selection)\n documentState = expandPath(json, documentState, path, expandNone)\n setTimeout(() => scrollIntoView(path))\n }\n })\n\n function handleSelect(updatedSelection: JSONSelection | undefined) {\n selection = updatedSelection\n }\n\n function emitOnSelect(updatedSelection: JSONSelection | undefined) {\n if (!isEqual(updatedSelection, externalSelection)) {\n debug('onSelect', updatedSelection)\n onSelect(updatedSelection)\n }\n }\n\n // eslint-disable-next-line svelte/no-unused-svelte-ignore\n // svelte-ignore reactive_declaration_non_reactive_property\n $: emitOnSelect(selection)\n\n let normalization: ValueNormalization\n $: normalization = createNormalizationFunctions({\n escapeControlCharacters,\n escapeUnicodeCharacters\n })\n\n let pastedJson: PastedJson | undefined\n let pastedMultilineText: string | undefined\n\n let searchResultDetails: SearchResultDetails | undefined\n let searchResults: SearchResults | undefined\n let showSearch = false\n let showReplace = false\n\n // eslint-disable-next-line svelte/no-unused-svelte-ignore\n // svelte-ignore reactive_declaration_non_reactive_property\n $: applySearchBoxSpacing(showSearch)\n\n function applySearchBoxSpacing(showSearch: boolean) {\n if (!refContents) {\n return\n }\n\n if (showSearch && refContents.scrollTop === 0) {\n refContents.style.overflowAnchor = 'none'\n refContents.scrollTop += SEARCH_BOX_HEIGHT\n setTimeout(() => {\n if (refContents) {\n refContents.style.overflowAnchor = ''\n }\n })\n }\n }\n\n function handleSearch(result: SearchResultDetails | undefined) {\n searchResultDetails = result\n searchResults = searchResultDetails\n ? toRecursiveSearchResults(json, searchResultDetails.items)\n : undefined\n }\n\n async function handleFocusSearch(path: JSONPath, resultIndex: number) {\n documentState = expandPath(json, documentState, path, expandNone)\n\n const element = findSearchResult(resultIndex)\n\n await scrollTo(path, { element })\n }\n\n function handleCloseSearch() {\n showSearch = false\n showReplace = false\n focus()\n }\n\n function handleSelectValidationError(error: ValidationError) {\n debug('select validation error', error)\n\n selection = createValueSelection(error.path)\n scrollTo(error.path)\n }\n\n export function expand(path: JSONPath, callback: OnExpand = expandSelf) {\n debug('expand')\n\n documentState = expandPath(json, documentState, path, callback)\n }\n\n export function collapse(path: JSONPath, recursive: boolean) {\n documentState = collapsePath(json, documentState, path, recursive)\n\n if (selection) {\n // check whether the selection is still visible and not collapsed\n if (isSelectionInsidePath(selection, path)) {\n // remove selection when not visible anymore\n selection = undefined\n }\n }\n }\n\n // two-way binding of externalContent and internal json and text (\n // when receiving an updated prop, we have to update state for example\n // eslint-disable-next-line svelte/no-unused-svelte-ignore\n // svelte-ignore reactive_declaration_non_reactive_property\n $: applyExternalContent(externalContent)\n\n // eslint-disable-next-line svelte/no-unused-svelte-ignore\n // svelte-ignore reactive_declaration_non_reactive_property\n $: applyExternalSelection(externalSelection)\n\n let textIsRepaired = false\n\n let validationErrorList: ValidationError[] = []\n let validationErrors: ValidationErrors | undefined\n\n // eslint-disable-next-line svelte/no-unused-svelte-ignore\n // svelte-ignore reactive_declaration_non_reactive_property\n $: updateValidationErrors(json, validator, parser, validationParser)\n\n // because onChange returns the validation errors and there is also a separate listener,\n // we would execute validation twice. Memoizing the last result solves this.\n const memoizedValidate = memoizeOne(validateJSON)\n\n function updateValidationErrors(\n json: unknown,\n validator: Validator | undefined,\n parser: JSONParser,\n validationParser: JSONParser\n ) {\n measure(\n () => {\n let newValidationErrorList: ValidationError[]\n try {\n newValidationErrorList = memoizedValidate(json, validator, parser, validationParser)\n } catch (err) {\n newValidationErrorList = [\n {\n path: [],\n message: '验证失败: ' + (err as Error).message,\n severity: ValidationSeverity.warning\n }\n ]\n }\n\n if (!isEqual(newValidationErrorList, validationErrorList)) {\n debug('validationErrors changed:', newValidationErrorList)\n validationErrorList = newValidationErrorList\n validationErrors = toRecursiveValidationErrors(json, validationErrorList)\n }\n },\n (duration) => debug(`validationErrors updated in ${duration} ms`)\n )\n }\n\n export function validate(): ContentErrors | undefined {\n debug('validate')\n\n if (parseError) {\n return {\n parseError,\n isRepairable: false // not applicable, if repairable, we will not have a parseError\n }\n }\n\n // make sure the validation results are up-to-date\n // normally, they are only updated on the next tick after the json is changed\n updateValidationErrors(json, validator, parser, validationParser)\n return !isEmpty(validationErrorList) ? { validationErrors: validationErrorList } : undefined\n }\n\n export function getJson() {\n return json\n }\n\n function getDocumentState(): DocumentState | undefined {\n return documentState\n }\n\n function getSelection(): JSONSelection | undefined {\n return selection\n }\n\n function applyExternalContent(updatedContent: Content) {\n debug('applyExternalContent', { updatedContent })\n\n if (isJSONContent(updatedContent)) {\n applyExternalJson(updatedContent.json)\n } else if (isTextContent(updatedContent)) {\n applyExternalText(updatedContent.text)\n }\n }\n\n function applyExternalJson(updatedJson: unknown | undefined) {\n if (updatedJson === undefined) {\n return\n }\n\n // TODO: this is inefficient. Make an optional flag promising that the updates are immutable so we don't have to do a deep equality check? First do some profiling!\n const isChanged = !isEqual(json, updatedJson)\n\n debug('update external json', { isChanged, currentlyText: json === undefined })\n\n if (!isChanged) {\n // no actual change, don't do anything\n return\n }\n\n const previousState = { documentState, selection, json, text, textIsRepaired }\n\n json = updatedJson\n documentState = syncDocumentState(updatedJson, documentState)\n expandWhenNotInitialized(json)\n text = undefined\n textIsRepaired = false\n parseError = undefined\n clearSelectionWhenNotExisting(json)\n\n addHistoryItem(previousState)\n }\n\n function applyExternalText(updatedText: string | undefined) {\n if (updatedText === undefined || isJSONContent(externalContent)) {\n return\n }\n\n const isChanged = updatedText !== text\n\n debug('update external text', { isChanged })\n\n if (!isChanged) {\n // no actual change, don't do anything\n return\n }\n\n const previousState = { documentState, selection, json, text, textIsRepaired }\n\n try {\n json = parseMemoizeOne(updatedText)\n documentState = syncDocumentState(json, documentState)\n expandWhenNotInitialized(json)\n text = updatedText\n textIsRepaired = false\n parseError = undefined\n } catch (err) {\n try {\n json = parseMemoizeOne(jsonrepair(updatedText))\n documentState = syncDocumentState(json, documentState)\n expandWhenNotInitialized(json)\n text = updatedText\n textIsRepaired = true\n parseError = undefined\n clearSelectionWhenNotExisting(json)\n } catch {\n // no valid JSON, will show empty document or invalid json\n json = undefined\n documentState = undefined\n text = externalContent['text']\n textIsRepaired = false\n parseError =\n text !== undefined && text !== ''\n ? normalizeJsonParseError(text, (err as Error).message || String(err))\n : undefined\n }\n }\n\n clearSelectionWhenNotExisting(json)\n\n addHistoryItem(previousState)\n }\n\n function applyExternalSelection(externalSelection: JSONEditorSelection | undefined) {\n if (isEqual(selection, externalSelection)) {\n return\n }\n\n debug('applyExternalSelection', { selection, externalSelection })\n\n if (isJSONSelection(externalSelection)) {\n selection = externalSelection\n }\n }\n\n function expandWhenNotInitialized(json: unknown) {\n if (!documentStateInitialized) {\n documentStateInitialized = true\n documentState = expandSmart(json, documentState, [])\n }\n }\n\n function clearSelectionWhenNotExisting(json: unknown) {\n if (!selection) {\n return\n }\n\n if (existsIn(json, getAnchorPath(selection)) && existsIn(json, getFocusPath(selection))) {\n return\n }\n\n debug('clearing selection: path does not exist anymore', selection)\n selection = getInitialSelection(json, documentState)\n }\n\n interface PreviousState {\n json: unknown | undefined\n text: string | undefined\n documentState: DocumentState | undefined\n selection: JSONSelection | undefined\n textIsRepaired: boolean\n }\n\n function addHistoryItem(previous: PreviousState) {\n if (previous.json === undefined && previous.text === undefined) {\n // initialization -> do not create a history item\n return\n }\n\n const canPatch = json !== undefined && previous.json !== undefined\n\n history.add({\n type: 'tree',\n undo: {\n patch: canPatch ? [{ op: 'replace', path: '', value: previous.json }] : undefined,\n json: previous.json,\n text: previous.text,\n documentState: previous.documentState,\n textIsRepaired: previous.textIsRepaired,\n selection: removeEditModeFromSelection(previous.selection),\n sortedColumn: undefined\n },\n redo: {\n patch: canPatch ? [{ op: 'replace', path: '', value: json }] : undefined,\n json,\n text,\n documentState,\n textIsRepaired,\n selection: removeEditModeFromSelection(selection),\n sortedColumn: undefined\n }\n })\n }\n\n function createDefaultSelection() {\n debug('createDefaultSelection')\n\n selection = createValueSelection([])\n }\n\n export function patch(\n operations: JSONPatchDocument,\n afterPatch?: AfterPatchCallback\n ): JSONPatchResult {\n debug('patch', operations, afterPatch)\n\n if (json === undefined) {\n throw new Error('Cannot apply patch: no JSON')\n }\n\n const previousJson = json\n const previousState = {\n json: undefined, // not needed: we use patch to reconstruct the json\n text,\n documentState,\n selection: removeEditModeFromSelection(selection),\n textIsRepaired,\n sortedColumn: undefined\n }\n\n // execute the patch operations\n const undo: JSONPatchDocument = revertJSONPatchWithMoveOperations(\n json,\n operations\n ) as JSONPatchDocument\n const patched = documentStatePatch(json, documentState, operations)\n\n // update the selection based on the operations\n const updatedSelection = createSelectionFromOperations(json, operations) ?? selection\n\n const callback =\n typeof afterPatch === 'function'\n ? afterPatch(patched.json, patched.documentState, updatedSelection)\n : undefined\n\n json = callback?.json !== undefined ? callback.json : patched.json\n documentState = callback?.state !== undefined ? callback.state : patched.documentState\n selection = callback?.selection !== undefined ? callback.selection : updatedSelection\n text = undefined\n textIsRepaired = false\n pastedJson = undefined\n pastedMultilineText = undefined\n parseError = undefined\n\n // ensure the selection is valid\n clearSelectionWhenNotExisting(json)\n\n history.add({\n type: 'tree',\n undo: {\n patch: undo,\n ...previousState\n },\n redo: {\n patch: operations,\n json: undefined, // not needed, we use patch to reconstruct\n text,\n documentState,\n selection: removeEditModeFromSelection(selection),\n sortedColumn: undefined,\n textIsRepaired\n }\n })\n\n return {\n json,\n previousJson,\n undo,\n redo: operations\n }\n }\n\n function handleEditKey() {\n if (readOnly || !selection) {\n return\n }\n\n selection = createEditKeySelection(getFocusPath(selection))\n }\n\n function handleEditValue() {\n if (readOnly || !selection) {\n return\n }\n\n const path = getFocusPath(selection)\n const value = getIn(json, path)\n if (isObjectOrArray(value)) {\n openJSONEditorModal(path, value)\n } else {\n selection = createEditValueSelection(path)\n }\n }\n\n function handleToggleEnforceString() {\n if (readOnly || !isValueSelection(selection)) {\n return\n }\n\n const path = getFocusPath(selection)\n const pointer = compileJSONPointer(path)\n const value = getIn(json, path)\n const enforceString = !getEnforceString(json, documentState, path)\n const updatedValue = enforceString ? String(value) : stringConvert(String(value), parser)\n\n debug('handleToggleEnforceString', { enforceString, value, updatedValue })\n\n handlePatch(\n [\n {\n op: 'replace',\n path: pointer,\n value: updatedValue\n }\n ],\n (_, patchedState) => {\n return {\n state: setInDocumentState(json, patchedState, path, { type: 'value', enforceString })\n }\n }\n )\n }\n\n export function acceptAutoRepair(): Content {\n if (textIsRepaired && json !== undefined) {\n handleReplaceJson(json)\n }\n\n return json !== undefined ? { json } : { text: text || '' }\n }\n\n async function handleCut(indent = true) {\n await onCut({\n json,\n selection,\n indentation: indent ? indentation : undefined,\n readOnly,\n parser,\n onPatch: handlePatch\n })\n }\n\n async function handleCopy(indent = true) {\n if (json === undefined) {\n return\n }\n\n await onCopy({\n json,\n selection,\n indentation: indent ? indentation : undefined,\n parser\n })\n }\n\n function handlePaste(event: ClipboardEvent) {\n event.preventDefault()\n\n const clipboardText = event.clipboardData?.getData('text/plain')\n\n _paste(clipboardText)\n }\n\n async function handlePasteFromMenu() {\n try {\n const clipboardText = await navigator.clipboard.readText()\n\n _paste(clipboardText)\n } catch (err) {\n console.error(err)\n\n copyPasteModalOpen = true\n }\n }\n\n function _paste(clipboardText: string | undefined) {\n if (clipboardText === undefined) {\n return\n }\n\n onPaste({\n clipboardText,\n json,\n selection,\n readOnly,\n parser,\n onPatch: handlePatch,\n onChangeText: handleChangeText,\n onPasteMultilineText: handlePasteMultilineText,\n openRepairModal\n })\n }\n\n function openRepairModal(text: string, onApply: (repairedText: string) => void) {\n jsonRepairModalProps = {\n text,\n onParse: (text) => parsePartialJson(text, (t) => parseAndRepair(t, parser)),\n onRepair: repairPartialJson,\n onApply,\n onClose: focus\n }\n }\n\n function handleRemove() {\n onRemove({\n json,\n text,\n selection,\n keepSelection: false,\n readOnly,\n onChange,\n onPatch: handlePatch\n })\n }\n\n function handleDuplicate() {\n if (\n readOnly ||\n json === undefined ||\n !selection ||\n !hasSelectionContents ||\n isEmpty(getFocusPath(selection)) // root selected, cannot duplicate\n ) {\n return\n }\n\n debug('duplicate', { selection })\n\n const operations = duplicate(json, getSelectionPaths(json, selection))\n\n handlePatch(operations)\n }\n\n function handleExtract() {\n if (\n readOnly ||\n !selection ||\n (!isMultiSelection(selection) && !isValueSelection(selection)) ||\n isEmpty(getFocusPath(selection)) // root selected, cannot extract\n ) {\n return\n }\n\n debug('extract', { selection })\n\n const operations = extract(json, selection)\n\n handlePatch(operations, (patchedJson, patchedState) => {\n if (isObjectOrArray(patchedJson)) {\n // expand extracted object/array\n const path: JSONPath = []\n return {\n state: expandSmartIfCollapsed(patchedJson, patchedState, path)\n }\n }\n\n return undefined\n })\n }\n\n function handleInsert(insertType: InsertType): void {\n onInsert({\n insertType,\n selectInside: true,\n initialValue: undefined,\n json,\n selection,\n readOnly,\n parser,\n onPatch: handlePatch,\n onReplaceJson: handleReplaceJson\n })\n }\n\n function handleInsertFromContextMenu(type: InsertType) {\n if (isKeySelection(selection)) {\n // in this case, we do not want to rename the key, but replace the property\n selection = createValueSelection(selection.path)\n }\n\n if (!selection) {\n selection = getInitialSelection(json, documentState)\n }\n\n handleInsert(type)\n }\n\n function handleConvert(type: ConvertType) {\n if (readOnly || !selection) {\n return\n }\n\n if (!canConvert(selection)) {\n onError(new Error(`无法将当前选择转换为 ${type}`))\n return\n }\n\n try {\n const path = getAnchorPath(selection)\n const currentValue: unknown = getIn(json, path)\n const convertedValue = convertValue(\n currentValue,\n type as 'value' | 'object' | 'array',\n parser\n )\n if (convertedValue === currentValue) {\n // no change, do nothing\n return\n }\n\n const operations: JSONPatchDocument = [\n { op: 'replace', path: compileJSONPointer(path), value: convertedValue }\n ]\n\n debug('handleConvert', { selection, path, type, operations })\n\n handlePatch(operations, (patchedJson, patchedState) => {\n // expand converted object/array\n return {\n state: selection\n ? expandSmart(patchedJson, patchedState, getFocusPath(selection))\n : documentState\n }\n })\n } catch (err) {\n onError(err as Error)\n }\n }\n\n function handleInsertBefore() {\n if (!selection) {\n return\n }\n\n const selectionBefore = getSelectionUp(json, documentState, selection, false)\n const parentPath = initial(getFocusPath(selection))\n\n if (\n selectionBefore &&\n !isEmpty(getFocusPath(selectionBefore)) &&\n isEqual(parentPath, initial(getFocusPath(selectionBefore)))\n ) {\n selection = createAfterSelection(getFocusPath(selectionBefore))\n } else {\n selection = createInsideSelection(parentPath)\n }\n\n debug('insert before', { selection, selectionBefore, parentPath })\n\n flushSync()\n handleContextMenu()\n }\n\n function handleInsertAfter() {\n if (!selection) {\n return\n }\n\n const path = getEndPath(json, selection)\n\n debug('insert after', path)\n\n selection = createAfterSelection(path)\n\n flushSync()\n handleContextMenu()\n }\n\n async function handleInsertCharacter(char: string) {\n await onInsertCharacter({\n char,\n selectInside: true,\n json,\n selection,\n readOnly,\n parser,\n onPatch: handlePatch,\n onReplaceJson: handleReplaceJson,\n onSelect: handleSelect\n })\n }\n\n function handleUndo() {\n if (readOnly) {\n return\n }\n\n if (!history.canUndo) {\n return\n }\n\n const item = history.undo()\n if (!isTreeHistoryItem(item)) {\n onUndo(item)\n\n return\n }\n\n const previousContent = { json, text }\n\n json = item.undo.patch ? immutableJSONPatch(json, item.undo.patch) : item.undo.json\n documentState = item.undo.documentState\n selection = item.undo.selection\n text = item.undo.text\n textIsRepaired = item.undo.textIsRepaired\n parseError = undefined\n\n debug('undo', { item, json, documentState, selection })\n\n const patchResult =\n item.undo.patch && item.redo.patch\n ? {\n json,\n previousJson: previousContent.json,\n redo: item.undo.patch,\n undo: item.redo.patch\n }\n : undefined\n\n emitOnChange(previousContent, patchResult)\n\n focus()\n if (selection) {\n scrollTo(getFocusPath(selection), { scrollToWhenVisible: false })\n }\n }\n\n function handleRedo() {\n if (readOnly) {\n return\n }\n\n if (!history.canRedo) {\n return\n }\n\n const item = history.redo()\n if (!isTreeHistoryItem(item)) {\n onRedo(item)\n\n return\n }\n\n const previousContent = { json, text }\n\n json = item.redo.patch ? immutableJSONPatch(json, item.redo.patch) : item.redo.json\n documentState = item.redo.documentState\n selection = item.redo.selection\n text = item.redo.text\n textIsRepaired = item.redo.textIsRepaired\n parseError = undefined\n\n debug('redo', { item, json, documentState, selection })\n\n const patchResult =\n item.undo.patch && item.redo.patch\n ? {\n json,\n previousJson: previousContent.json,\n redo: item.redo.patch,\n undo: item.undo.patch\n }\n : undefined\n\n emitOnChange(previousContent, patchResult)\n\n focus()\n if (selection) {\n scrollTo(getFocusPath(selection), { scrollToWhenVisible: false })\n }\n }\n\n function openSortModal(rootPath: JSONPath) {\n if (readOnly || json === undefined) {\n return\n }\n\n modalOpen = true\n\n onSortModal({\n id: sortModalId,\n json,\n rootPath,\n onSort: async ({ operations }) => {\n debug('onSort', rootPath, operations)\n\n handlePatch(operations, (patchedJson, patchedState) => ({\n // expand the newly replaced array if needed, and select it\n state: expandSmartIfCollapsed(patchedJson, patchedState, rootPath),\n selection: createValueSelection(rootPath)\n }))\n },\n onClose: () => {\n modalOpen = false\n setTimeout(focus)\n }\n })\n }\n\n function handleSortSelection() {\n if (!selection) {\n return\n }\n\n const rootPath = findRootPath(json, selection)\n openSortModal(rootPath)\n }\n\n function handleSortAll() {\n const rootPath: JSONPath = []\n openSortModal(rootPath)\n }\n\n /**\n * This method is exposed via JSONEditor.transform\n */\n export function openTransformModal(options: TransformModalOptions) {\n if (json === undefined) {\n return\n }\n\n const { id, onTransform, onClose } = options\n const rootPath = options.rootPath || []\n\n modalOpen = true\n\n onTransformModal({\n id: id || transformModalId,\n json,\n rootPath,\n onTransform: (operations) => {\n if (onTransform) {\n onTransform({\n operations,\n json,\n transformedJson: immutableJSONPatch(json, operations)\n })\n } else {\n debug('onTransform', rootPath, operations)\n\n handlePatch(operations, (patchedJson, patchedState) => ({\n // expand the newly replaced array if needed and select it\n state: expandSmartIfCollapsed(patchedJson, patchedState, rootPath),\n selection: createValueSelection(rootPath)\n }))\n }\n },\n onClose: () => {\n modalOpen = false\n setTimeout(focus)\n if (onClose) {\n onClose()\n }\n }\n })\n }\n\n function handleTransformSelection() {\n if (!selection) {\n return\n }\n\n const rootPath = findRootPath(json, selection)\n openTransformModal({\n rootPath\n })\n }\n\n function handleTransformAll() {\n openTransformModal({\n rootPath: []\n })\n }\n\n function openJSONEditorModal(path: JSONPath, value: unknown) {\n debug('openJSONEditorModal', { path, value })\n\n modalOpen = true\n\n // open a popup where you can edit the nested object/array\n onJSONEditorModal({\n content: {\n json: value\n },\n path,\n onPatch: context.onPatch,\n onClose: () => {\n modalOpen = false\n setTimeout(focus)\n }\n })\n }\n\n /**\n * Scroll the window vertically to the node with given path.\n * Expand the path when needed.\n */\n export async function scrollTo(\n path: JSONPath,\n { scrollToWhenVisible = true, element }: ScrollToOptions = {}\n ): Promise<void> {\n documentState = expandPath(json, documentState, path, expandNone)\n\n const elem = element ?? findElement(path)\n\n debug('scrollTo', { path, elem, refContents })\n\n if (!elem || !refContents) {\n return Promise.resolve()\n }\n\n const viewPortRect = refContents.getBoundingClientRect()\n const elemRect = elem.getBoundingClientRect()\n if (!scrollToWhenVisible) {\n if (elemRect.bottom > viewPortRect.top && elemRect.top < viewPortRect.bottom) {\n // element is fully or partially visible, don't scroll to it\n return Promise.resolve()\n }\n }\n\n const offset = -(viewPortRect.height / 4)\n\n return new Promise<void>((resolve) => {\n jump(elem, {\n container: refContents,\n offset,\n duration: SCROLL_DURATION,\n callback: () => resolve()\n })\n })\n }\n\n /**\n * Find the DOM element of a given path.\n * Note that the path can only be found when the node is expanded.\n */\n export function findElement(path: JSONPath): Element | undefined {\n flushSync() // flush any changes, else the element we want to scroll to may not yet exist\n\n return refContents?.querySelector(`div[data-path=\"${encodeDataPath(path)}\"]`) ?? undefined\n }\n\n /**\n * Find the DOM element of a given search result.\n * Note that the path can only be found when the node is expanded.\n */\n export function findSearchResult(resultIndex: number): Element | undefined {\n flushSync() // flush any changes, else the element we want to scroll to may not yet exist\n\n return (\n refContents?.querySelector(`span[data-search-result-index=\"${resultIndex}\"]`) ?? undefined\n )\n }\n\n /**\n * If given path is outside the visible viewport, scroll up/down.\n * When the path is already in view, nothing is done\n */\n function scrollIntoView(path: JSONPath) {\n const elem = findElement(path)\n\n if (!elem || !refContents) {\n return\n }\n\n const viewPortRect = refContents.getBoundingClientRect()\n const elemRect = elem.getBoundingClientRect()\n const margin = 20\n const elemHeight = isObjectOrArray(getIn(json, path))\n ? margin // do not use real height when array or object\n : elemRect.height\n\n if (elemRect.top < viewPortRect.top + margin) {\n // scroll down\n jump(elem, {\n container: refContents,\n offset: -margin,\n duration: 0\n })\n } else if (elemRect.top + elemHeight > viewPortRect.bottom - margin) {\n // scroll up\n jump(elem, {\n container: refContents,\n offset: -(viewPortRect.height - elemHeight - margin),\n duration: 0\n })\n }\n }\n\n function emitOnChange(previousContent: Content, patchResult: JSONPatchResult | undefined) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n if (previousContent.json === undefined && previousContent?.text === undefined) {\n // initialization -> do not fire an onChange event\n return\n }\n\n // make sure we cannot send an invalid contents like having both\n // json and text defined, or having none defined\n if (text !== undefined) {\n const content = { text, json: undefined }\n onChange?.(content, previousContent, {\n contentErrors: validate(),\n patchResult\n })\n } else if (json !== undefined) {\n const content = { text: undefined, json }\n onChange?.(content, previousContent, {\n contentErrors: validate(),\n patchResult\n })\n }\n }\n\n function handlePatch(\n operations: JSONPatchDocument,\n afterPatch?: AfterPatchCallback\n ): JSONPatchResult {\n debug('handlePatch', operations, afterPatch)\n\n const previousContent = { json, text }\n const patchResult = patch(operations, afterPatch)\n\n emitOnChange(previousContent, patchResult)\n\n return patchResult\n }\n\n function handleReplaceJson(updatedJson: unknown, afterPatch?: AfterPatchCallback) {\n const previousContent = { json, text }\n const previousState = { documentState, selection, json, text, textIsRepaired }\n\n const updatedState = expandPath(\n json,\n syncDocumentState(updatedJson, documentState),\n [],\n expandMinimal\n )\n\n const callback =\n typeof afterPatch === 'function'\n ? afterPatch(updatedJson, updatedState, selection)\n : undefined\n\n json = callback?.json !== undefined ? callback.json : updatedJson\n documentState = callback?.state !== undefined ? callback.state : updatedState\n selection = callback?.selection !== undefined ? callback.selection : selection\n text = undefined\n textIsRepaired = false\n parseError = undefined\n\n // make sure the selection is valid\n clearSelectionWhenNotExisting(json)\n\n addHistoryItem(previousState)\n\n // we could work out a patchResult, or use patch(), but only when the previous and new\n // contents are both json and not text. We go for simplicity and consistency here and\n // do _not_ return a patchResult ever.\n const patchResult = undefined\n\n emitOnChange(previousContent, patchResult)\n }\n\n function handleChangeText(updatedText: string, afterPatch?: AfterPatchCallback) {\n debug('handleChangeText')\n\n const previousContent = { json, text }\n const previousState = { documentState, selection, json, text, textIsRepaired }\n\n try {\n json = parseMemoizeOne(updatedText)\n documentState = expandPath(json, syncDocumentState(json, documentState), [], expandMinimal)\n text = undefined\n textIsRepaired = false\n parseError = undefined\n } catch (err) {\n try {\n json = parseMemoizeOne(jsonrepair(updatedText))\n documentState = expandPath(json, syncDocumentState(json, documentState), [], expandMinimal)\n text = updatedText\n textIsRepaired = true\n parseError = undefined\n } catch {\n // no valid JSON, will show empty document or invalid json\n json = undefined\n documentState = createDocumentState({ json, expand: expandMinimal })\n text = updatedText\n textIsRepaired = false\n parseError =\n text !== ''\n ? normalizeJsonParseError(text, (err as Error).message || String(err))\n : undefined\n }\n }\n\n if (typeof afterPatch === 'function') {\n const callback = afterPatch(json, documentState, selection)\n\n json = callback?.json !== undefined ? callback.json : json\n documentState = callback?.state !== undefined ? callback.state : documentState\n selection = callback?.selection !== undefined ? callback.selection : selection\n }\n\n // ensure the selection is valid\n clearSelectionWhenNotExisting(json)\n\n addHistoryItem(previousState)\n\n // no JSON patch actions available in text mode\n const patchResult = undefined\n\n emitOnChange(previousContent, patchResult)\n }\n\n /**\n * Toggle expanded state of a node\n * @param path The path to be expanded\n * @param expanded True if currently expanded, false when currently collapsed\n * @param [recursive=false] Only applicable when expanding\n */\n function handleExpand(path: JSONPath, expanded: boolean, recursive = false): void {\n debug('handleExpand', { path, expanded, recursive })\n\n if (expanded) {\n expand(path, recursive ? expandAll : expandSelf)\n } else {\n collapse(path, recursive)\n }\n\n // set focus to the hidden input, so we can capture quick keys like Ctrl+X, Ctrl+C, Ctrl+V\n focus()\n }\n\n function handleExpandAll() {\n handleExpand([], true, true)\n }\n\n function handleCollapseAll() {\n handleExpand([], false, true)\n }\n\n function openFind(findAndReplace: boolean): void {\n debug('openFind', { findAndReplace })\n\n showSearch = false\n showReplace = false\n\n flushSync()\n\n // trick to make sure the focus goes to the search box\n showSearch = true\n showReplace = findAndReplace\n }\n\n function handleExpandSection(path: JSONPath, section: Section) {\n debug('handleExpandSection', path, section)\n\n documentState = expandSection(json, documentState, path, section)\n }\n\n function handlePasteJson(newPastedJson: PastedJson) {\n debug('pasted json as text', newPastedJson)\n\n pastedJson = newPastedJson\n }\n\n function handlePasteMultilineText(pastedText: string) {\n debug('pasted multiline text', { pastedText })\n\n pastedMultilineText = pastedText\n }\n\n function handleKeyDown(event: KeyboardEvent) {\n const combo = keyComboFromEvent(event)\n const keepAnchorPath = event.shiftKey\n debug('keydown', { combo, key: event.key })\n\n if (combo === 'Ctrl+X') {\n // cut formatted\n event.preventDefault()\n handleCut(true)\n }\n if (combo === 'Ctrl+Shift+X') {\n // cut compact\n event.preventDefault()\n handleCut(false)\n }\n if (combo === 'Ctrl+C') {\n // copy formatted\n event.preventDefault()\n handleCopy(true)\n }\n if (combo === 'Ctrl+Shift+C') {\n // copy compact\n event.preventDefault()\n handleCopy(false)\n }\n // Note: Ctrl+V (paste) is handled by the on:paste event\n\n if (combo === 'Ctrl+D') {\n event.preventDefault()\n handleDuplicate()\n }\n if (combo === 'Delete' || combo === 'Backspace') {\n event.preventDefault()\n handleRemove()\n }\n if (combo === 'Insert') {\n event.preventDefault()\n handleInsert('structure')\n }\n if (combo === 'Ctrl+A') {\n event.preventDefault()\n selection = selectAll()\n }\n\n if (combo === 'Ctrl+Q') {\n handleContextMenu(event)\n }\n\n if (combo === 'ArrowUp' || combo === 'Shift+ArrowUp') {\n event.preventDefault()\n\n const newSelection = selection\n ? getSelectionUp(json, documentState, selection, keepAnchorPath) || selection\n : getInitialSelection(json, documentState)\n\n selection = newSelection\n scrollIntoView(getFocusPath(newSelection))\n }\n if (combo === 'ArrowDown' || combo === 'Shift+ArrowDown') {\n event.preventDefault()\n\n const newSelection = selection\n ? getSelectionDown(json, documentState, selection, keepAnchorPath) || selection\n : getInitialSelection(json, documentState)\n\n selection = newSelection\n scrollIntoView(getFocusPath(newSelection))\n }\n if (combo === 'ArrowLeft' || combo === 'Shift+ArrowLeft') {\n event.preventDefault()\n\n const newSelection = selection\n ? getSelectionLeft(json, documentState, selection, keepAnchorPath, !readOnly) || selection\n : getInitialSelection(json, documentState)\n\n selection = newSelection\n scrollIntoView(getFocusPath(newSelection))\n }\n if (combo === 'ArrowRight' || combo === 'Shift+ArrowRight') {\n event.preventDefault()\n\n const newSelection =\n selection && json !== undefined\n ? getSelectionRight(json, documentState, selection, keepAnchorPath, !readOnly) ||\n selection\n : getInitialSelection(json, documentState)\n\n selection = newSelection\n scrollIntoView(getFocusPath(newSelection))\n }\n\n if (combo === 'Enter' && selection) {\n // when the selection consists of a single Array item, change selection to editing its value\n if (isMultiSelectionWithOneItem(selection)) {\n const path = selection.focusPath\n const parent = getIn(json, initial(path))\n if (Array.isArray(parent)) {\n // change into selection of the value\n event.preventDefault()\n selection = createValueSelection(path)\n }\n }\n\n if (isKeySelection(selection)) {\n // go to key edit mode\n event.preventDefault()\n selection = { ...selection, edit: true }\n }\n\n if (isValueSelection(selection)) {\n event.preventDefault()\n\n const value = getIn(json, selection.path)\n if (isObjectOrArray(value)) {\n // expand object/array\n handleExpand(selection.path, true)\n } else {\n // go to value edit mode\n selection = { ...selection, edit: true }\n }\n }\n }\n\n const normalizedCombo = combo.replace(/^Shift\\+/, '') // replace 'Shift+A' with 'A'\n if (normalizedCombo.length === 1 && selection) {\n // a regular key like a, A, _, etc is entered.\n // Replace selected contents with a new value having this first character as text\n event.preventDefault()\n handleInsertCharacter(event.key)\n return\n }\n\n if (combo === 'Enter' && (isAfterSelection(selection) || isInsideSelection(selection))) {\n // Enter on an insert area -> open the area in edit mode\n event.preventDefault()\n handleInsertCharacter('')\n return\n }\n\n if (combo === 'Ctrl+Enter' && isValueSelection(selection)) {\n const value = getIn(json, selection.path)\n\n if (isUrl(value)) {\n // open url in new page\n window.open(String(value), '_blank')\n }\n }\n\n if (combo === 'Escape' && selection) {\n event.preventDefault()\n selection = undefined\n }\n\n if (combo === 'Ctrl+F') {\n event.preventDefault()\n openFind(false)\n }\n\n if (combo === 'Ctrl+H') {\n event.preventDefault()\n openFind(true)\n }\n\n if (combo === 'Ctrl+Z') {\n event.preventDefault()\n handleUndo()\n }\n\n if (combo === 'Ctrl+Shift+Z') {\n event.preventDefault()\n handleRedo()\n }\n }\n\n function handleMouseDown(event: Event) {\n debug('handleMouseDown', event)\n\n const target = event.target as HTMLElement\n\n if (!isChildOfNodeName(target, 'BUTTON') && !target.isContentEditable) {\n // for example when clicking on the empty area in the main menu\n focus()\n\n if (!selection && json === undefined && (text === '' || text === undefined)) {\n createDefaultSelection()\n }\n }\n }\n\n function openContextMenu({\n anchor,\n left,\n top,\n width,\n height,\n offsetTop,\n offsetLeft,\n showTip\n }: AbsolutePopupOptions) {\n const defaultItems: ContextMenuItem[] = createTreeContextMenuItems({\n json,\n documentState,\n selection,\n readOnly,\n\n onEditKey: handleEditKey,\n onEditValue: handleEditValue,\n onToggleEnforceString: handleToggleEnforceString,\n\n onCut: handleCut,\n onCopy: handleCopy,\n onPaste: handlePasteFromMenu,\n\n onRemove: handleRemove,\n onDuplicate: handleDuplicate,\n onExtract: handleExtract,\n\n onInsertBefore: handleInsertBefore,\n onInsert: handleInsertFromContextMenu,\n onInsertAfter: handleInsertAfter,\n onConvert: handleConvert,\n\n onSort: handleSortSelection,\n onTransform: handleTransformSelection\n })\n\n const items = onRenderContextMenu(defaultItems) ?? defaultItems\n\n if (items === false) {\n return\n }\n\n const props = {\n tip: showTip ? '提示:您可以通过右键或 Ctrl+Q 打开右键菜单' : undefined,\n items,\n onRequestClose: () => closeAbsolutePopup(popupId)\n }\n\n const options = {\n left,\n top,\n offsetTop,\n offsetLeft,\n width,\n height,\n anchor,\n closeOnOuterClick: true,\n onClose: () => {\n modalOpen = false\n focus()\n }\n }\n\n modalOpen = true\n\n const popupId = openAbsolutePopup(ContextMenu, props, options)\n }\n\n function handleContextMenu(event?: Event) {\n if (isEditingSelection(selection)) {\n return\n }\n\n if (event) {\n event.stopPropagation()\n event.preventDefault()\n }\n\n if (event && event.type === 'contextmenu' && event.target !== refHiddenInput) {\n // right mouse click to open context menu\n openContextMenu({\n left: (event as MouseEvent).clientX,\n top: (event as MouseEvent).clientY,\n width: CONTEXT_MENU_WIDTH,\n height: CONTEXT_MENU_HEIGHT,\n showTip: false\n })\n } else {\n // type === 'keydown' (from the quick key Ctrl+Q)\n // or target is hidden input -> context menu button on keyboard\n const anchor = refContents?.querySelector('.jse-context-menu-pointer.jse-selected')\n if (anchor) {\n openContextMenu({\n anchor,\n offsetTop: 2,\n width: CONTEXT_MENU_WIDTH,\n height: CONTEXT_MENU_HEIGHT,\n showTip: false\n })\n } else {\n // fallback on just displaying the TreeContextMenu top left\n const rect = refContents?.getBoundingClientRect()\n if (rect) {\n openContextMenu({\n top: rect.top + 2,\n left: rect.left + 2,\n width: CONTEXT_MENU_WIDTH,\n height: CONTEXT_MENU_HEIGHT,\n showTip: false\n })\n }\n }\n }\n }\n\n function handleContextMenuFromTreeMenu(event: MouseEvent) {\n openContextMenu({\n anchor: findParentWithNodeName(event.target as HTMLElement, 'BUTTON'),\n offsetTop: 0,\n width: CONTEXT_MENU_WIDTH,\n height: CONTEXT_MENU_HEIGHT,\n showTip: true\n })\n }\n\n async function handleParsePastedJson() {\n debug('apply pasted json', pastedJson)\n if (!pastedJson) {\n return\n }\n\n const { onPasteAsJson } = pastedJson\n pastedJson = undefined\n\n onPasteAsJson()\n\n // TODO: get rid of the setTimeout here\n setTimeout(focus)\n }\n\n async function handleParsePastedMultilineText() {\n debug('apply pasted multiline text', pastedMultilineText)\n if (!pastedMultilineText) {\n return\n }\n\n _paste(JSON.stringify(pastedMultilineText))\n\n // TODO: get rid of the setTimeout here\n setTimeout(focus)\n }\n\n function handleClearPastedJson() {\n debug('clear pasted json')\n pastedJson = undefined\n focus()\n }\n\n function handleClearPastedMultilineText() {\n debug('clear pasted multiline text')\n pastedMultilineText = undefined\n focus()\n }\n\n function handleRequestRepair() {\n onChangeMode(Mode.text)\n }\n\n function handleNavigationBarSelect(newSelection: JSONSelection) {\n selection = newSelection\n\n focus()\n scrollTo(getFocusPath(newSelection))\n }\n\n export function focus() {\n debug('focus')\n // with just .focus(), sometimes the input doesn't react on onpaste events\n // in Chrome when having a large document open and then doing cut/paste.\n // Calling both .focus() and .select() did solve this issue.\n if (refHiddenInput) {\n refHiddenInput.focus()\n refHiddenInput.select()\n }\n }\n\n function handleWindowMouseDown(event: MouseEvent & { currentTarget: EventTarget & Window }) {\n const outsideEditor = !isChildOf(\n event.target as Element,\n (element) => element === refJsonEditor\n )\n if (outsideEditor) {\n if (isEditingSelection(selection)) {\n debug('click outside the editor, exit edit mode')\n selection = removeEditModeFromSelection(selection)\n\n if (hasFocus && refHiddenInput) {\n refHiddenInput.focus()\n refHiddenInput.blur()\n }\n\n debug('blur (outside editor)')\n if (refHiddenInput) {\n refHiddenInput.blur()\n }\n }\n }\n }\n\n function findNextInside(path: JSONPath): JSONSelection | undefined {\n return getSelectionNextInside(json, documentState, path)\n }\n\n $: autoScrollHandler = refContents ? createAutoScrollHandler(refContents) : undefined\n\n function handleDrag(event: MouseEvent) {\n if (autoScrollHandler) {\n autoScrollHandler.onDrag(event)\n }\n }\n\n function handleDragEnd() {\n if (autoScrollHandler) {\n autoScrollHandler.onDragEnd()\n }\n }\n\n // Note that we want the context to change as little as possible since it forces all nodes to re-render,\n // it should only change when a config option like readOnly or onClassName is changed\n let context: TreeModeContext\n $: context = {\n mode: Mode.tree,\n readOnly,\n truncateTextSize,\n parser,\n normalization,\n getJson,\n getDocumentState,\n getSelection,\n findElement,\n findNextInside,\n focus,\n onPatch: handlePatch,\n onInsert: handleInsert,\n onExpand: handleExpand,\n onSelect: handleSelect,\n onFind: openFind,\n onExpandSection: handleExpandSection,\n onPasteJson: handlePasteJson,\n onRenderValue,\n onContextMenu: openContextMenu,\n onClassName: onClassName || (() => undefined),\n onDrag: handleDrag,\n onDragEnd: handleDragEnd\n }\n\n $: debug('context changed', context)\n</script>\n\n<svelte:window on:mousedown={handleWindowMouseDown} />\n\n<div\n role=\"tree\"\n tabindex=\"-1\"\n class=\"jse-tree-mode\"\n class:no-main-menu={!mainMenuBar}\n on:keydown={handleKeyDown}\n on:mousedown={handleMouseDown}\n on:contextmenu={handleContextMenu}\n bind:this={refJsonEditor}\n>\n {#if mainMenuBar}\n <TreeMenu\n {json}\n {selection}\n {readOnly}\n {history}\n bind:showSearch\n onExpandAll={handleExpandAll}\n onCollapseAll={handleCollapseAll}\n onUndo={handleUndo}\n onRedo={handleRedo}\n onSort={handleSortAll}\n onTransform={handleTransformAll}\n onContextMenu={handleContextMenuFromTreeMenu}\n onCopy={handleCopy}\n {onRenderMenu}\n />\n {/if}\n\n {#if navigationBar}\n <NavigationBar {json} {selection} onSelect={handleNavigationBarSelect} {onError} {pathParser} />\n {/if}\n\n {#if !isSSR}\n <label class=\"jse-hidden-input-label\">\n <input\n type=\"text\"\n readonly={true}\n tabindex=\"-1\"\n class=\"jse-hidden-input\"\n bind:this={refHiddenInput}\n on:paste={handlePaste}\n />\n </label>\n {#if json === undefined}\n {#if text === '' || text === undefined}\n <Welcome\n {readOnly}\n onCreateObject={() => {\n focus()\n handleInsertCharacter('{')\n }}\n onCreateArray={() => {\n focus()\n handleInsertCharacter('[')\n }}\n onClick={() => {\n // FIXME: this is a workaround for the editor not putting the focus on refHiddenInput\n // when clicking in the welcome screen so you cannot paste a document from clipboard.\n focus()\n }}\n />\n {:else}\n <Message\n type=\"error\"\n message=\"加载的JSON文档无效,无法自动修复。\"\n actions={!readOnly\n ? [\n {\n icon: faCode,\n text: '手动修复',\n title: '以 \"文本视图\" 模式打开文档并手动修复',\n onClick: handleRequestRepair\n }\n ]\n : []}\n />\n <JSONPreview {text} {json} {indentation} {parser} />\n {/if}\n {:else}\n <div class=\"jse-search-box-container\">\n <SearchBox\n {json}\n {documentState}\n {parser}\n {showSearch}\n {showReplace}\n {readOnly}\n columns={undefined}\n onSearch={handleSearch}\n onFocus={handleFocusSearch}\n onPatch={handlePatch}\n onClose={handleCloseSearch}\n />\n </div>\n <div class=\"jse-contents\" data-jsoneditor-scrollable-contents={true} bind:this={refContents}>\n {#if showSearch}\n <div class=\"jse-search-box-background\"></div>\n {/if}\n <JSONNode\n value={json}\n pointer={''}\n state={documentState}\n {validationErrors}\n {searchResults}\n {selection}\n {context}\n onDragSelectionStart={noop}\n />\n </div>\n\n {#if pastedJson}\n <Message\n type=\"info\"\n message={`你粘贴了一个 JSON ${\n Array.isArray(pastedJson.contents) ? '数组' : '对象'\n } 作为文本`}\n actions={[\n {\n icon: faWrench,\n text: '请粘贴为 JSON 格式',\n title: '用粘贴的 JSON 替换值',\n // We use mousedown here instead of click: this message pops up\n // whilst the user is editing a value. When clicking this button,\n // the actual value is applied and the event is not propagated\n // and an onClick on this button never happens.\n onMouseDown: handleParsePastedJson\n },\n {\n text: '保持原样',\n title: '将 JSON 嵌入值中',\n onClick: handleClearPastedJson\n }\n ]}\n />\n {/if}\n\n {#if pastedMultilineText}\n <Message\n type=\"info\"\n message=\"多行文本已作为数组粘贴\"\n actions={[\n {\n icon: faWrench,\n text: '改为粘贴为字符串',\n title: '将剪贴板数据粘贴为单个字符串值,而不是数组',\n onClick: handleParsePastedMultilineText\n },\n {\n text: '保持原样',\n title: '保留粘贴的数组',\n onClick: handleClearPastedMultilineText\n }\n ]}\n />\n {/if}\n\n {#if textIsRepaired}\n <Message\n type=\"success\"\n message=\"加载的 JSON 文档无效,但已成功修复。\"\n actions={!readOnly\n ? [\n {\n icon: faCheck,\n text: '确认',\n title: '接受修复后的文档',\n onClick: acceptAutoRepair\n },\n {\n icon: faCode,\n text: '改为手动修复',\n title: '保持文件不变,改为手动修复',\n onClick: handleRequestRepair\n }\n ]\n : []}\n onClose={focus}\n />\n {/if}\n\n <ValidationErrorsOverview\n validationErrors={validationErrorList}\n selectError={handleSelectValidationError}\n />\n {/if}\n {:else}\n <div class=\"jse-contents\">\n <div class=\"jse-loading-space\"></div>\n <div class=\"jse-loading\">加载中...</div>\n </div>\n {/if}\n</div>\n\n{#if copyPasteModalOpen}\n <CopyPasteModal onClose={() => (copyPasteModalOpen = false)} />\n{/if}\n\n{#if jsonRepairModalProps}\n <JSONRepairModal\n {...jsonRepairModalProps}\n onClose={() => {\n jsonRepairModalProps?.onClose()\n jsonRepairModalProps = undefined\n }}\n />\n{/if}\n\n<style src=\"./TreeMode.scss\"></style>\n","import {\n faArrowRightArrowLeft,\n faCaretSquareDown,\n faCaretSquareUp,\n faCheckSquare,\n faClone,\n faCopy,\n faCropAlt,\n faCut,\n faFilter,\n faPaste,\n faPen,\n faPlus,\n faSortAmountDownAlt,\n faSquare,\n faTrashCan\n} from '@fortawesome/free-solid-svg-icons'\nimport {\n canConvert,\n getFocusPath,\n isAfterSelection,\n isInsideSelection,\n isKeySelection,\n isMultiSelection,\n isValueSelection,\n singleItemSelected\n} from '$lib/logic/selection'\nimport type {\n ConvertType,\n DocumentState,\n InsertType,\n JSONSelection,\n ContextMenuItem\n} from '$lib/types'\nimport { initial, isEmpty } from 'lodash-es'\nimport { getIn } from 'immutable-json-patch'\nimport { isObject, isObjectOrArray } from '$lib/utils/typeUtils'\nimport { getEnforceString } from '$lib/logic/documentState'\n\nexport default function ({\n json,\n documentState,\n selection,\n readOnly,\n onEditKey,\n onEditValue,\n onToggleEnforceString,\n onCut,\n onCopy,\n onPaste,\n onRemove,\n onDuplicate,\n onExtract,\n onInsertBefore,\n onInsert,\n onConvert,\n onInsertAfter,\n onSort,\n onTransform\n}: {\n json: unknown\n documentState: DocumentState | undefined\n selection: JSONSelection | undefined\n readOnly: boolean\n onEditKey: () => void\n onEditValue: () => void\n onToggleEnforceString: () => void\n onCut: (indent: boolean) => void\n onCopy: (indent: boolean) => void\n onPaste: () => void\n onRemove: () => void\n onDuplicate: () => void\n onExtract: () => void\n onInsertBefore: () => void\n onInsert: (type: InsertType) => void\n onConvert: (type: ConvertType) => void\n onInsertAfter: () => void\n onSort: () => void\n onTransform: () => void\n}): ContextMenuItem[] {\n const hasJson = json !== undefined\n const hasSelection = !!selection\n const rootSelected = selection ? isEmpty(getFocusPath(selection)) : false\n const focusValue = selection ? getIn(json, getFocusPath(selection)) : undefined\n const editValueText = Array.isArray(focusValue)\n ? '编辑数组'\n : isObject(focusValue)\n ? '编辑对象'\n : '编辑值'\n\n const hasSelectionContents =\n hasJson &&\n (isMultiSelection(selection) || isKeySelection(selection) || isValueSelection(selection))\n\n const parent =\n selection && !rootSelected ? getIn(json, initial(getFocusPath(selection))) : undefined\n\n const canEditKey =\n !readOnly && hasJson && singleItemSelected(selection) && !rootSelected && !Array.isArray(parent)\n\n const canEditValue =\n !readOnly && hasJson && selection !== undefined && singleItemSelected(selection)\n const canEnforceString = canEditValue && !isObjectOrArray(focusValue)\n\n const canCut = !readOnly && hasSelectionContents\n const canCopy = hasSelectionContents\n const canPaste = !readOnly && hasSelection\n const canDuplicate = !readOnly && hasJson && hasSelectionContents && !rootSelected // must not be root\n const canExtract =\n !readOnly &&\n hasJson &&\n selection !== undefined &&\n (isMultiSelection(selection) || isValueSelection(selection)) &&\n !rootSelected // must not be root\n\n const convertMode = hasSelectionContents\n const insertOrConvertText = convertMode ? '转换:' : '插入:'\n\n const canInsertOrConvertStructure =\n !readOnly &&\n ((isInsideSelection(selection) && Array.isArray(focusValue)) ||\n (isAfterSelection(selection) && Array.isArray(parent)))\n const canInsertOrConvertObject =\n !readOnly && (convertMode ? canConvert(selection) && !isObject(focusValue) : hasSelection)\n const canInsertOrConvertArray =\n !readOnly && (convertMode ? canConvert(selection) && !Array.isArray(focusValue) : hasSelection)\n const canInsertOrConvertValue =\n !readOnly && (convertMode ? canConvert(selection) && isObjectOrArray(focusValue) : hasSelection)\n\n const enforceString =\n selection !== undefined ? getEnforceString(json, documentState, getFocusPath(selection)) : false\n\n function handleInsertOrConvert(type: InsertType) {\n if (hasSelectionContents) {\n if (type !== 'structure') {\n onConvert(type)\n }\n } else {\n onInsert(type)\n }\n }\n\n return [\n {\n type: 'row',\n items: [\n {\n type: 'button',\n onClick: () => onEditKey(),\n icon: faPen,\n text: '编辑键',\n title: '编辑键 (双击编辑该键)',\n disabled: !canEditKey\n },\n {\n type: 'dropdown-button',\n main: {\n type: 'button',\n onClick: () => onEditValue(),\n icon: faPen,\n text: editValueText,\n title: '编辑值 (双击编辑该值)',\n disabled: !canEditValue\n },\n width: '11em',\n items: [\n {\n type: 'button',\n icon: faPen,\n text: editValueText,\n title: '编辑值 (双击编辑该值)',\n onClick: () => onEditValue(),\n disabled: !canEditValue\n },\n {\n type: 'button',\n icon: enforceString ? faCheckSquare : faSquare,\n text: '强制转为字符串',\n title: '数字强制转成字符串',\n onClick: () => onToggleEnforceString(),\n disabled: !canEnforceString\n }\n ]\n }\n ]\n },\n { type: 'separator' },\n {\n type: 'row',\n items: [\n {\n type: 'dropdown-button',\n main: {\n type: 'button',\n onClick: () => onCut(true),\n icon: faCut,\n text: '剪切',\n title: '剪切选择内容,并格式化 (Ctrl+X)',\n disabled: !canCut\n },\n width: '10em',\n items: [\n {\n type: 'button',\n icon: faCut,\n text: '格式化剪切',\n title: '剪切选择内容,并格式化 (Ctrl+X)',\n onClick: () => onCut(true),\n disabled: !canCut\n },\n {\n type: 'button',\n icon: faCut,\n text: '压缩剪切',\n title: '剪切选择内容,去除空格 (Ctrl+Shift+X)',\n onClick: () => onCut(false),\n disabled: !canCut\n }\n ]\n },\n {\n type: 'dropdown-button',\n main: {\n type: 'button',\n onClick: () => onCopy(true),\n icon: faCopy,\n text: '复制',\n title: '复制选择内容,并格式化 (Ctrl+C)',\n disabled: !canCopy\n },\n width: '12em',\n items: [\n {\n type: 'button',\n icon: faCopy,\n text: '格式化复制',\n title: '复制选择内容,并格式化 (Ctrl+C)',\n onClick: () => onCopy(true),\n disabled: !canCopy\n },\n {\n type: 'button',\n icon: faCopy,\n text: '压缩复制',\n title: '复制选择内容,去除空格 (Ctrl+Shift+C)',\n onClick: () => onCopy(false),\n disabled: !canCopy\n }\n ]\n },\n {\n type: 'button',\n onClick: () => onPaste(),\n icon: faPaste,\n text: '粘贴',\n title: '粘贴内容 (Ctrl+V)',\n disabled: !canPaste\n }\n ]\n },\n { type: 'separator' },\n {\n type: 'row',\n items: [\n {\n type: 'column',\n items: [\n {\n type: 'button',\n onClick: () => onDuplicate(),\n icon: faClone,\n text: '复制',\n title: '复制所选内容 (Ctrl+D)',\n disabled: !canDuplicate\n },\n {\n type: 'button',\n onClick: () => onExtract(),\n icon: faCropAlt,\n text: '提取',\n title: '提取所选内容',\n disabled: !canExtract\n },\n {\n type: 'button',\n onClick: () => onSort(),\n icon: faSortAmountDownAlt,\n text: '排序',\n title: '重新排序对象或数组',\n disabled: readOnly || !hasSelectionContents\n },\n {\n type: 'button',\n onClick: () => onTransform(),\n icon: faFilter,\n text: '转换',\n title: '转换对象或数组',\n disabled: readOnly || !hasSelectionContents\n },\n {\n type: 'button',\n onClick: () => onRemove(),\n icon: faTrashCan,\n text: '删除',\n title: '删除所选内容 (Delete)',\n disabled: readOnly || !hasSelectionContents\n }\n ]\n },\n {\n type: 'column',\n items: [\n { type: 'label', text: insertOrConvertText },\n {\n type: 'button',\n onClick: () => handleInsertOrConvert('structure'),\n icon: convertMode ? faArrowRightArrowLeft : faPlus,\n text: '结构体',\n title: insertOrConvertText + ' 结构类似于数组中的第一个元素',\n disabled: !canInsertOrConvertStructure\n },\n {\n type: 'button',\n onClick: () => handleInsertOrConvert('object'),\n icon: convertMode ? faArrowRightArrowLeft : faPlus,\n text: '对象',\n title: insertOrConvertText + ' 结构体',\n disabled: !canInsertOrConvertObject\n },\n {\n type: 'button',\n onClick: () => handleInsertOrConvert('array'),\n icon: convertMode ? faArrowRightArrowLeft : faPlus,\n text: '数组',\n title: insertOrConvertText + ' 数组',\n disabled: !canInsertOrConvertArray\n },\n {\n type: 'button',\n onClick: () => handleInsertOrConvert('value'),\n icon: convertMode ? faArrowRightArrowLeft : faPlus,\n text: '值',\n title: insertOrConvertText + ' 值',\n disabled: !canInsertOrConvertValue\n }\n ]\n }\n ]\n },\n {\n type: 'separator'\n },\n {\n type: 'row',\n items: [\n {\n type: 'button',\n onClick: () => onInsertBefore(),\n icon: faCaretSquareUp,\n text: '在前面插入',\n title: '在选择前面插入或粘贴内容',\n disabled: readOnly || !hasSelectionContents || rootSelected\n },\n {\n type: 'button',\n onClick: () => onInsertAfter(),\n icon: faCaretSquareDown,\n text: '在后面插入',\n title: '在选择后面插入或粘贴内容',\n disabled: readOnly || !hasSelectionContents || rootSelected\n }\n ]\n }\n ]\n}\n","<svelte:options immutable={true} />\n\n<script lang=\"ts\">\n import {\n faCopy,\n faEllipsisV,\n faFilter,\n faRedo,\n faSearch,\n faSortAmountDownAlt,\n faUndo\n } from '@fortawesome/free-solid-svg-icons'\n import { CONTEXT_MENU_EXPLANATION } from '$lib/constants.js'\n import { faJSONEditorCollapse, faJSONEditorExpand } from '$lib/img/customFontawesomeIcons.js'\n import { isObjectOrArray } from '$lib/utils/typeUtils.js'\n import Menu from '../../../controls/Menu.svelte'\n import type {\n HistoryItem,\n History,\n JSONSelection,\n MenuItem,\n OnRenderMenuInternal\n } from '$lib/types'\n import { isKeySelection, isMultiSelection, isValueSelection } from '$lib/logic/selection.js'\n\n export let json: unknown\n export let selection: JSONSelection | undefined\n\n export let readOnly: boolean\n export let showSearch = false\n export let history: History<HistoryItem>\n\n export let onExpandAll: () => void\n export let onCollapseAll: () => void\n export let onUndo: () => void\n export let onRedo: () => void\n export let onSort: () => void\n export let onTransform: () => void\n export let onContextMenu: (event: MouseEvent) => void\n export let onCopy: () => void\n export let onRenderMenu: OnRenderMenuInternal\n\n function handleToggleSearch() {\n showSearch = !showSearch\n }\n\n $: hasJson = json !== undefined\n $: hasSelectionContents =\n hasJson &&\n (isMultiSelection(selection) || isKeySelection(selection) || isValueSelection(selection))\n\n let expandMenuItem: MenuItem\n $: expandMenuItem = {\n type: 'button',\n icon: faJSONEditorExpand,\n title: '展开所有',\n className: 'jse-expand-all',\n onClick: onExpandAll,\n disabled: !isObjectOrArray(json)\n }\n\n let collapseMenuItem: MenuItem\n $: collapseMenuItem = {\n type: 'button',\n icon: faJSONEditorCollapse,\n title: '折叠所有',\n className: 'jse-collapse-all',\n onClick: onCollapseAll,\n disabled: !isObjectOrArray(json)\n }\n\n let searchMenuItem: MenuItem\n $: searchMenuItem = {\n type: 'button',\n icon: faSearch,\n title: '搜索 (Ctrl+F)',\n className: 'jse-search',\n onClick: handleToggleSearch,\n disabled: json === undefined\n }\n\n let defaultItems: MenuItem[]\n $: defaultItems = !readOnly\n ? [\n expandMenuItem,\n collapseMenuItem,\n {\n type: 'separator'\n },\n {\n type: 'button',\n icon: faSortAmountDownAlt,\n title: '排序',\n className: 'jse-sort',\n onClick: onSort,\n disabled: readOnly || json === undefined\n },\n {\n type: 'button',\n icon: faFilter,\n title: '转换内容 (过滤, 排序, 分类)',\n className: 'jse-transform',\n onClick: onTransform,\n disabled: readOnly || json === undefined\n },\n searchMenuItem,\n {\n type: 'button',\n icon: faEllipsisV,\n title: CONTEXT_MENU_EXPLANATION,\n className: 'jse-contextmenu',\n onClick: onContextMenu\n },\n {\n type: 'separator'\n },\n {\n type: 'button',\n icon: faUndo,\n title: '撤销 (Ctrl+Z)',\n className: 'jse-undo',\n onClick: onUndo,\n disabled: !history.canUndo\n },\n {\n type: 'button',\n icon: faRedo,\n title: '重做 (Ctrl+Shift+Z)',\n className: 'jse-redo',\n onClick: onRedo,\n disabled: !history.canRedo\n },\n {\n type: 'space'\n }\n ]\n : [\n expandMenuItem,\n collapseMenuItem,\n {\n type: 'separator'\n },\n {\n type: 'button',\n icon: faCopy,\n title: '复制 (Ctrl+C)',\n className: 'jse-copy',\n onClick: onCopy,\n disabled: !hasSelectionContents\n },\n {\n type: 'separator'\n },\n searchMenuItem,\n {\n type: 'space'\n }\n ]\n\n // eslint-disable-next-line svelte/no-unused-svelte-ignore\n // svelte-ignore reactive_declaration_non_reactive_property\n $: items = onRenderMenu(defaultItems) || defaultItems\n</script>\n\n<Menu {items} />\n","<script lang=\"ts\">\n interface Props {\n readOnly: boolean\n onCreateArray: () => void\n onCreateObject: () => void\n onClick: () => void\n }\n\n const { readOnly, onCreateArray, onCreateObject, onClick }: Props = $props()\n\n function handleCreateObject(event: MouseEvent) {\n event.stopPropagation()\n onCreateObject()\n }\n\n function handleCreateArray(event: MouseEvent) {\n event.stopPropagation()\n onCreateArray()\n }\n</script>\n\n<div class=\"jse-welcome\" onclick={() => onClick()} role=\"none\">\n <div class=\"jse-space jse-before\"></div>\n <div class=\"jse-contents\">\n <div class=\"jse-welcome-title\">空文档</div>\n {#if !readOnly}\n <div class=\"jse-welcome-info\">\n 你可以使用 <b>Ctrl+V</b> 粘贴剪贴板数据,或使用以下选项:\n </div>\n <button title={\"创建一个空的 JSON 对象(按 '{')\"} onclick={handleCreateObject}\n >创建对象</button\n >\n <button title={\"创建一个空的 JSON 数组(按 '[')\"} onclick={handleCreateArray}\n >创建数组</button\n >\n {/if}\n </div>\n <div class=\"jse-space jse-after\"></div>\n</div>\n\n<style src=\"./Welcome.scss\"></style>\n","/**\n * Create a readonly proxy around an object or array.\n *\n * Will throw an error when trying to mutate the object or array\n *\n * Inspired by: https://github.com/kourge/readonly-proxy/\n */\nexport function readonlyProxy(target: unknown): unknown {\n if (!isObject(target)) {\n return target\n }\n\n return new Proxy(target, {\n get(target, property, receiver) {\n const value = Reflect.get(target, property, receiver)\n\n return readonlyProxy(value)\n },\n\n set() {\n return false\n },\n\n deleteProperty() {\n return false\n }\n })\n}\n\nfunction isObject(value: unknown): value is object {\n return typeof value === 'object' && value !== null\n}\n","import { createDebug } from '../utils/debug.js'\nimport type { HistoryInstance, History } from 'svelte-jsoneditor'\n\nconst MAX_HISTORY_ITEMS = 1000\n\nconst debug = createDebug('jsoneditor:History')\n\nexport interface HistoryOptions<T> {\n maxItems?: number\n onChange?: (state: History<T>) => void\n}\n\nexport function createHistoryInstance<T>(options: HistoryOptions<T> = {}): HistoryInstance<T> {\n const maxItems = options.maxItems || MAX_HISTORY_ITEMS\n\n /**\n * items in history are sorted from newest first to oldest last\n */\n let reverseItems: T[] = []\n\n let index = 0\n\n function canUndo(): boolean {\n return index < reverseItems.length\n }\n\n function canRedo(): boolean {\n return index > 0\n }\n\n function get(): History<T> {\n return {\n canUndo: canUndo(),\n canRedo: canRedo(),\n items: () => reverseItems.slice().reverse(),\n add,\n undo,\n redo,\n clear\n }\n }\n\n function handleChange() {\n if (options.onChange) {\n options.onChange(get())\n }\n }\n\n function add(item: T) {\n debug('add', item)\n\n reverseItems = [item].concat(reverseItems.slice(index)).slice(0, maxItems)\n\n index = 0\n\n handleChange()\n }\n\n function clear() {\n debug('clear')\n\n reverseItems = []\n index = 0\n\n handleChange()\n }\n\n function undo(): T | undefined {\n if (canUndo()) {\n const item = reverseItems[index]\n index += 1\n\n debug('undo', item)\n\n handleChange()\n\n return item\n }\n\n return undefined\n }\n\n function redo(): T | undefined {\n if (canRedo()) {\n index -= 1\n\n debug('redo', reverseItems[index])\n\n handleChange()\n\n return reverseItems[index]\n }\n\n return undefined\n }\n\n return {\n get\n }\n}\n","<svelte:options immutable={true} />\n\n<script lang=\"ts\">\n import { uniqueId } from '$lib/utils/uniqueId.js'\n import { faCaretDown, faCaretRight } from '@fortawesome/free-solid-svg-icons'\n import { debounce, isEmpty, noop } from 'lodash-es'\n import Icon from 'svelte-awesome'\n import { DEBOUNCE_DELAY } from '$lib/constants.js'\n import type { JSONPatchDocument, JSONPath } from 'immutable-json-patch'\n import { compileJSONPointer, getIn } from 'immutable-json-patch'\n import { stringifyJSONPath } from '$lib/utils/pathUtils.js'\n import { transformModalStates, transformModalStateShared } from './transformModalStates.js'\n import TransformWizard from './TransformWizard.svelte'\n import TransformModalHeader from './TransformModalHeader.svelte'\n import AbsolutePopup from './popup/AbsolutePopup.svelte'\n import { createDebug } from '$lib/utils/debug.js'\n import TreeMode from '../modes/treemode/TreeMode.svelte'\n import type {\n Content,\n HistoryItem,\n History,\n JSONParser,\n JSONPathParser,\n OnChangeQueryLanguage,\n OnClassName,\n OnRenderContextMenuInternal,\n OnRenderMenuInternal,\n OnRenderValue,\n QueryLanguage,\n QueryLanguageOptions\n } from '$lib/types.js'\n import { onEscape } from '$lib/actions/onEscape.js'\n import { readonlyProxy } from '$lib/utils/readonlyProxy.js'\n import Modal from './Modal.svelte'\n import { onMount } from 'svelte'\n import { createHistoryInstance } from '$lib/logic/history'\n\n const debug = createDebug('jsoneditor:TransformModal')\n\n export let id = 'transform-modal-' + uniqueId()\n export let json: unknown\n export let rootPath: JSONPath = []\n\n export let indentation: number | string\n export let truncateTextSize: number\n export let escapeControlCharacters: boolean\n export let escapeUnicodeCharacters: boolean\n export let parser: JSONParser\n export let parseMemoizeOne: JSONParser['parse']\n export let validationParser: JSONParser\n export let pathParser: JSONPathParser\n\n export let queryLanguages: QueryLanguage[]\n export let queryLanguageId: string\n export let onChangeQueryLanguage: OnChangeQueryLanguage\n\n export let onRenderValue: OnRenderValue\n export let onRenderMenu: OnRenderMenuInternal\n export let onRenderContextMenu: OnRenderContextMenuInternal\n export let onClassName: OnClassName\n\n export let onTransform: (operations: JSONPatchDocument) => void\n export let onClose: () => void\n\n let refQueryInput: HTMLTextAreaElement\n\n const historyInstance = createHistoryInstance<HistoryItem>({\n onChange: (updatedHistory) => (history = updatedHistory)\n })\n\n let history: History<HistoryItem> = historyInstance.get()\n\n let selectedJson: unknown | undefined\n $: selectedJson = readonlyProxy(getIn(json, rootPath))\n let selectedContent: Content\n $: selectedContent = selectedJson ? { json: selectedJson } : { text: '' }\n\n let fullscreen = false\n\n const stateId = `${id}:${compileJSONPointer(rootPath)}`\n const state = transformModalStates[stateId] ?? {}\n\n // showWizard is not stored inside a stateId\n let showWizard = transformModalStateShared.showWizard !== false\n let showOriginal = transformModalStateShared.showOriginal !== false\n\n let queryOptions = state.queryOptions ?? {}\n let query = queryLanguageId === state.queryLanguageId && state.query ? state.query : ''\n let isManual = state.isManual ?? false\n let queryError: string | undefined = undefined\n\n let previewError: string | undefined = undefined\n let previewContent: Content = { text: '' }\n\n if (!isManual) {\n updateQueryByWizard(queryOptions)\n }\n\n onMount(() => {\n refQueryInput?.focus()\n })\n\n function getSelectedQueryLanguage(queryLanguageId: string): QueryLanguage {\n return queryLanguages.find((item) => item.id === queryLanguageId) ?? queryLanguages[0]\n }\n\n function updateQueryByWizard(newQueryOptions: QueryLanguageOptions) {\n try {\n queryOptions = newQueryOptions\n\n query = getSelectedQueryLanguage(queryLanguageId).createQuery(selectedJson, newQueryOptions)\n queryError = undefined\n isManual = false\n\n debug('updateQueryByWizard', { queryOptions, query, isManual })\n } catch (err) {\n queryError = String(err)\n }\n }\n\n function handleChangeQuery(event: Event) {\n query = (event.target as HTMLTextAreaElement).value\n isManual = true\n debug('handleChangeQuery', { query, isManual })\n }\n\n function previewTransform(previewJson: unknown | undefined, query: string) {\n if (previewJson === undefined) {\n previewContent = { text: '' }\n previewError = 'Error: No JSON'\n return\n }\n\n if (query.trim() === '') {\n previewContent = { json: previewJson }\n return\n }\n\n try {\n debug('previewTransform', {\n query\n })\n\n const jsonTransformed = getSelectedQueryLanguage(queryLanguageId).executeQuery(\n previewJson,\n query,\n parser\n )\n\n previewContent = { json: jsonTransformed }\n previewError = undefined\n } catch (err) {\n previewContent = { text: '' }\n previewError = String(err)\n }\n }\n\n const previewTransformDebounced = debounce(previewTransform, DEBOUNCE_DELAY)\n\n $: {\n previewTransformDebounced(selectedJson, query)\n }\n\n $: {\n // remember the selected values for the next time we open the SortModal\n // just in memory, not persisted\n transformModalStates[stateId] = {\n queryOptions,\n query,\n queryLanguageId,\n isManual\n }\n\n debug('store state in memory', stateId, transformModalStates[stateId])\n }\n\n function handleTransform() {\n if (selectedJson === undefined) {\n previewContent = { text: '' }\n previewError = 'Error: No JSON'\n return\n }\n\n try {\n debug('handleTransform', { query })\n const jsonTransformed = getSelectedQueryLanguage(queryLanguageId).executeQuery(\n selectedJson,\n query,\n parser\n )\n\n onTransform([\n {\n op: 'replace',\n path: compileJSONPointer(rootPath),\n value: jsonTransformed\n }\n ])\n\n onClose()\n } catch (err) {\n // this should never occur since we can only press the Transform\n // button when creating a preview was successful\n console.error(err)\n previewContent = { text: '' }\n previewError = String(err)\n }\n }\n\n function toggleShowWizard() {\n showWizard = !showWizard\n\n // not stored inside a stateId\n transformModalStateShared.showWizard = showWizard\n }\n\n function toggleShowOriginal() {\n showOriginal = !showOriginal\n\n // not stored inside a stateId\n transformModalStateShared.showOriginal = showOriginal\n }\n\n function focus(element: HTMLElement) {\n element.focus()\n }\n\n function handleChangeQueryLanguage(newQueryLanguageId: string) {\n debug('handleChangeQueryLanguage', newQueryLanguageId)\n queryLanguageId = newQueryLanguageId\n onChangeQueryLanguage(newQueryLanguageId)\n\n updateQueryByWizard(queryOptions)\n }\n\n function handleEscape() {\n if (fullscreen) {\n fullscreen = !fullscreen\n } else {\n onClose()\n }\n }\n</script>\n\n<Modal {onClose} className=\"jse-transform-modal\" {fullscreen}>\n <div class=\"jse-transform-modal-inner\" use:onEscape={handleEscape}>\n <AbsolutePopup>\n <TransformModalHeader\n {queryLanguages}\n {queryLanguageId}\n onChangeQueryLanguage={handleChangeQueryLanguage}\n {onClose}\n bind:fullscreen\n />\n <div class=\"jse-modal-contents\">\n <div class=\"jse-main-contents\">\n <div class=\"jse-query-contents\">\n <div class=\"jse-label\">\n <div class=\"jse-label-inner\">语言</div>\n </div>\n <div class=\"jse-description\">\n <!-- eslint-disable-next-line svelte/no-at-html-tags -->\n {@html getSelectedQueryLanguage(queryLanguageId).description}\n </div>\n\n <div class=\"jse-label\">\n <div class=\"jse-label-inner\">路径</div>\n </div>\n <input\n class=\"jse-path\"\n type=\"text\"\n readonly\n title=\"选中的路径\"\n value={!isEmpty(rootPath) ? stringifyJSONPath(rootPath) : '(整个文档)'}\n />\n\n <div class=\"jse-label\">\n <div class=\"jse-label-inner\">\n <button type=\"button\" on:click={toggleShowWizard}>\n <Icon data={showWizard ? faCaretDown : faCaretRight} />\n 向导\n </button>\n </div>\n </div>\n {#if showWizard}\n {#if Array.isArray(selectedJson)}\n <TransformWizard\n {queryOptions}\n json={selectedJson}\n onChange={updateQueryByWizard}\n />\n {#if queryError}\n <div class=\"query-error\">\n {queryError}\n </div>\n {/if}\n {:else}\n (仅对数组生效,对象无效)\n {/if}\n {/if}\n\n <div class=\"jse-label\">\n <div class=\"jse-label-inner\">查询</div>\n </div>\n <textarea\n bind:this={refQueryInput}\n class=\"jse-query\"\n spellcheck=\"false\"\n on:input={handleChangeQuery}>{query}</textarea\n >\n </div>\n <div class=\"jse-data-contents\" class:jse-hide-original-data={!showOriginal}>\n <div class=\"jse-original-data\" class:jse-hide={!showOriginal}>\n <div class=\"jse-label\">\n <div class=\"jse-label-inner\">\n <button type=\"button\" on:click={toggleShowOriginal}>\n <Icon data={showOriginal ? faCaretDown : faCaretRight} />\n 源数据\n </button>\n </div>\n </div>\n {#if showOriginal}\n <TreeMode\n externalContent={selectedContent}\n externalSelection={undefined}\n {history}\n readOnly={true}\n {truncateTextSize}\n mainMenuBar={false}\n navigationBar={false}\n {indentation}\n {escapeControlCharacters}\n {escapeUnicodeCharacters}\n {parser}\n {parseMemoizeOne}\n {onRenderValue}\n {onRenderMenu}\n {onRenderContextMenu}\n onError={console.error}\n onChange={noop}\n onChangeMode={noop}\n onSelect={noop}\n onUndo={noop}\n onRedo={noop}\n onFocus={noop}\n onBlur={noop}\n onSortModal={noop}\n onTransformModal={noop}\n onJSONEditorModal={noop}\n {onClassName}\n validator={undefined}\n {validationParser}\n {pathParser}\n />\n {/if}\n </div>\n <div class=\"jse-preview-data\">\n <div class=\"jse-label\">\n <div class=\"jse-label-inner\">预览</div>\n </div>\n {#if !previewError}\n <TreeMode\n externalContent={previewContent}\n externalSelection={undefined}\n {history}\n readOnly={true}\n {truncateTextSize}\n mainMenuBar={false}\n navigationBar={false}\n {indentation}\n {escapeControlCharacters}\n {escapeUnicodeCharacters}\n {parser}\n {parseMemoizeOne}\n {onRenderValue}\n {onRenderMenu}\n {onRenderContextMenu}\n onError={console.error}\n onChange={noop}\n onChangeMode={noop}\n onSelect={noop}\n onUndo={noop}\n onRedo={noop}\n onFocus={noop}\n onBlur={noop}\n onSortModal={noop}\n onTransformModal={noop}\n onJSONEditorModal={noop}\n {onClassName}\n validator={undefined}\n {validationParser}\n {pathParser}\n />\n {:else}\n <div class=\"jse-preview jse-error\">\n {previewError}\n </div>\n {/if}\n </div>\n </div>\n </div>\n\n <div class=\"jse-actions\">\n <button\n type=\"button\"\n class=\"jse-primary\"\n on:click={handleTransform}\n use:focus\n disabled={!!previewError}\n >\n 转换\n </button>\n </div>\n </div>\n </AbsolutePopup>\n </div>\n</Modal>\n\n<style src=\"./TransformModal.scss\"></style>\n","<svelte:options immutable={true} />\n\n<script lang=\"ts\">\n import { getContext } from 'svelte'\n import Icon from 'svelte-awesome'\n import { faCog } from '@fortawesome/free-solid-svg-icons'\n import SelectQueryLanguage from '../controls/selectQueryLanguage/SelectQueryLanguage.svelte'\n import type { AbsolutePopupContext, OnChangeQueryLanguage, QueryLanguage } from '$lib/types.js'\n import Header from './Header.svelte'\n\n export let queryLanguages: QueryLanguage[]\n export let queryLanguageId: string\n export let fullscreen: boolean\n export let onChangeQueryLanguage: OnChangeQueryLanguage\n export let onClose: () => void\n\n let refConfigButton: HTMLButtonElement | undefined\n let popupId: number | undefined\n\n const { openAbsolutePopup, closeAbsolutePopup } =\n getContext<AbsolutePopupContext>('absolute-popup')\n\n function openConfig() {\n const props = {\n queryLanguages,\n queryLanguageId,\n onChangeQueryLanguage: (queryLanguageId: string) => {\n closeAbsolutePopup(popupId)\n onChangeQueryLanguage(queryLanguageId)\n }\n }\n\n popupId = openAbsolutePopup(SelectQueryLanguage, props, {\n offsetTop: -2,\n offsetLeft: 0,\n anchor: refConfigButton,\n closeOnOuterClick: true\n })\n }\n</script>\n\n<Header title=\"转换内容\" fullScreenButton={true} bind:fullscreen {onClose}>\n <button\n slot=\"actions\"\n type=\"button\"\n bind:this={refConfigButton}\n class=\"jse-config\"\n class:hide={queryLanguages.length <= 1}\n on:click={openConfig}\n title=\"选择查询语言\"\n >\n <Icon data={faCog} />\n </button>\n</Header>\n\n<style src=\"./TransformModalHeader.scss\"></style>\n","export function noop() {\n return undefined\n}\n","/**\nThe default maximum length of a `TreeBuffer` node.\n*/\nconst DefaultBufferLength = 1024;\nlet nextPropID = 0;\nclass Range {\n constructor(from, to) {\n this.from = from;\n this.to = to;\n }\n}\n/**\nEach [node type](#common.NodeType) or [individual tree](#common.Tree)\ncan have metadata associated with it in props. Instances of this\nclass represent prop names.\n*/\nclass NodeProp {\n /**\n Create a new node prop type.\n */\n constructor(config = {}) {\n this.id = nextPropID++;\n this.perNode = !!config.perNode;\n this.deserialize = config.deserialize || (() => {\n throw new Error(\"This node type doesn't define a deserialize function\");\n });\n this.combine = config.combine || null;\n }\n /**\n This is meant to be used with\n [`NodeSet.extend`](#common.NodeSet.extend) or\n [`LRParser.configure`](#lr.ParserConfig.props) to compute\n prop values for each node type in the set. Takes a [match\n object](#common.NodeType^match) or function that returns undefined\n if the node type doesn't get this prop, and the prop's value if\n it does.\n */\n add(match) {\n if (this.perNode)\n throw new RangeError(\"Can't add per-node props to node types\");\n if (typeof match != \"function\")\n match = NodeType.match(match);\n return (type) => {\n let result = match(type);\n return result === undefined ? null : [this, result];\n };\n }\n}\n/**\nProp that is used to describe matching delimiters. For opening\ndelimiters, this holds an array of node names (written as a\nspace-separated string when declaring this prop in a grammar)\nfor the node types of closing delimiters that match it.\n*/\nNodeProp.closedBy = new NodeProp({ deserialize: str => str.split(\" \") });\n/**\nThe inverse of [`closedBy`](#common.NodeProp^closedBy). This is\nattached to closing delimiters, holding an array of node names\nof types of matching opening delimiters.\n*/\nNodeProp.openedBy = new NodeProp({ deserialize: str => str.split(\" \") });\n/**\nUsed to assign node types to groups (for example, all node\ntypes that represent an expression could be tagged with an\n`\"Expression\"` group).\n*/\nNodeProp.group = new NodeProp({ deserialize: str => str.split(\" \") });\n/**\nAttached to nodes to indicate these should be\n[displayed](https://codemirror.net/docs/ref/#language.syntaxTree)\nin a bidirectional text isolate, so that direction-neutral\ncharacters on their sides don't incorrectly get associated with\nsurrounding text. You'll generally want to set this for nodes\nthat contain arbitrary text, like strings and comments, and for\nnodes that appear _inside_ arbitrary text, like HTML tags. When\nnot given a value, in a grammar declaration, defaults to\n`\"auto\"`.\n*/\nNodeProp.isolate = new NodeProp({ deserialize: value => {\n if (value && value != \"rtl\" && value != \"ltr\" && value != \"auto\")\n throw new RangeError(\"Invalid value for isolate: \" + value);\n return value || \"auto\";\n } });\n/**\nThe hash of the [context](#lr.ContextTracker.constructor)\nthat the node was parsed in, if any. Used to limit reuse of\ncontextual nodes.\n*/\nNodeProp.contextHash = new NodeProp({ perNode: true });\n/**\nThe distance beyond the end of the node that the tokenizer\nlooked ahead for any of the tokens inside the node. (The LR\nparser only stores this when it is larger than 25, for\nefficiency reasons.)\n*/\nNodeProp.lookAhead = new NodeProp({ perNode: true });\n/**\nThis per-node prop is used to replace a given node, or part of a\nnode, with another tree. This is useful to include trees from\ndifferent languages in mixed-language parsers.\n*/\nNodeProp.mounted = new NodeProp({ perNode: true });\n/**\nA mounted tree, which can be [stored](#common.NodeProp^mounted) on\na tree node to indicate that parts of its content are\nrepresented by another tree.\n*/\nclass MountedTree {\n constructor(\n /**\n The inner tree.\n */\n tree, \n /**\n If this is null, this tree replaces the entire node (it will\n be included in the regular iteration instead of its host\n node). If not, only the given ranges are considered to be\n covered by this tree. This is used for trees that are mixed in\n a way that isn't strictly hierarchical. Such mounted trees are\n only entered by [`resolveInner`](#common.Tree.resolveInner)\n and [`enter`](#common.SyntaxNode.enter).\n */\n overlay, \n /**\n The parser used to create this subtree.\n */\n parser, \n /**\n [Indicates](#common.IterMode.EnterBracketed) that the nested\n content is delineated with some kind\n of bracket token.\n */\n bracketed = false) {\n this.tree = tree;\n this.overlay = overlay;\n this.parser = parser;\n this.bracketed = bracketed;\n }\n /**\n @internal\n */\n static get(tree) {\n return tree && tree.props && tree.props[NodeProp.mounted.id];\n }\n}\nconst noProps = Object.create(null);\n/**\nEach node in a syntax tree has a node type associated with it.\n*/\nclass NodeType {\n /**\n @internal\n */\n constructor(\n /**\n The name of the node type. Not necessarily unique, but if the\n grammar was written properly, different node types with the\n same name within a node set should play the same semantic\n role.\n */\n name, \n /**\n @internal\n */\n props, \n /**\n The id of this node in its set. Corresponds to the term ids\n used in the parser.\n */\n id, \n /**\n @internal\n */\n flags = 0) {\n this.name = name;\n this.props = props;\n this.id = id;\n this.flags = flags;\n }\n /**\n Define a node type.\n */\n static define(spec) {\n let props = spec.props && spec.props.length ? Object.create(null) : noProps;\n let flags = (spec.top ? 1 /* NodeFlag.Top */ : 0) | (spec.skipped ? 2 /* NodeFlag.Skipped */ : 0) |\n (spec.error ? 4 /* NodeFlag.Error */ : 0) | (spec.name == null ? 8 /* NodeFlag.Anonymous */ : 0);\n let type = new NodeType(spec.name || \"\", props, spec.id, flags);\n if (spec.props)\n for (let src of spec.props) {\n if (!Array.isArray(src))\n src = src(type);\n if (src) {\n if (src[0].perNode)\n throw new RangeError(\"Can't store a per-node prop on a node type\");\n props[src[0].id] = src[1];\n }\n }\n return type;\n }\n /**\n Retrieves a node prop for this type. Will return `undefined` if\n the prop isn't present on this node.\n */\n prop(prop) { return this.props[prop.id]; }\n /**\n True when this is the top node of a grammar.\n */\n get isTop() { return (this.flags & 1 /* NodeFlag.Top */) > 0; }\n /**\n True when this node is produced by a skip rule.\n */\n get isSkipped() { return (this.flags & 2 /* NodeFlag.Skipped */) > 0; }\n /**\n Indicates whether this is an error node.\n */\n get isError() { return (this.flags & 4 /* NodeFlag.Error */) > 0; }\n /**\n When true, this node type doesn't correspond to a user-declared\n named node, for example because it is used to cache repetition.\n */\n get isAnonymous() { return (this.flags & 8 /* NodeFlag.Anonymous */) > 0; }\n /**\n Returns true when this node's name or one of its\n [groups](#common.NodeProp^group) matches the given string.\n */\n is(name) {\n if (typeof name == 'string') {\n if (this.name == name)\n return true;\n let group = this.prop(NodeProp.group);\n return group ? group.indexOf(name) > -1 : false;\n }\n return this.id == name;\n }\n /**\n Create a function from node types to arbitrary values by\n specifying an object whose property names are node or\n [group](#common.NodeProp^group) names. Often useful with\n [`NodeProp.add`](#common.NodeProp.add). You can put multiple\n names, separated by spaces, in a single property name to map\n multiple node names to a single value.\n */\n static match(map) {\n let direct = Object.create(null);\n for (let prop in map)\n for (let name of prop.split(\" \"))\n direct[name] = map[prop];\n return (node) => {\n for (let groups = node.prop(NodeProp.group), i = -1; i < (groups ? groups.length : 0); i++) {\n let found = direct[i < 0 ? node.name : groups[i]];\n if (found)\n return found;\n }\n };\n }\n}\n/**\nAn empty dummy node type to use when no actual type is available.\n*/\nNodeType.none = new NodeType(\"\", Object.create(null), 0, 8 /* NodeFlag.Anonymous */);\n/**\nA node set holds a collection of node types. It is used to\ncompactly represent trees by storing their type ids, rather than a\nfull pointer to the type object, in a numeric array. Each parser\n[has](#lr.LRParser.nodeSet) a node set, and [tree\nbuffers](#common.TreeBuffer) can only store collections of nodes\nfrom the same set. A set can have a maximum of 2**16 (65536) node\ntypes in it, so that the ids fit into 16-bit typed array slots.\n*/\nclass NodeSet {\n /**\n Create a set with the given types. The `id` property of each\n type should correspond to its position within the array.\n */\n constructor(\n /**\n The node types in this set, by id.\n */\n types) {\n this.types = types;\n for (let i = 0; i < types.length; i++)\n if (types[i].id != i)\n throw new RangeError(\"Node type ids should correspond to array positions when creating a node set\");\n }\n /**\n Create a copy of this set with some node properties added. The\n arguments to this method can be created with\n [`NodeProp.add`](#common.NodeProp.add).\n */\n extend(...props) {\n let newTypes = [];\n for (let type of this.types) {\n let newProps = null;\n for (let source of props) {\n let add = source(type);\n if (add) {\n if (!newProps)\n newProps = Object.assign({}, type.props);\n let value = add[1], prop = add[0];\n if (prop.combine && prop.id in newProps)\n value = prop.combine(newProps[prop.id], value);\n newProps[prop.id] = value;\n }\n }\n newTypes.push(newProps ? new NodeType(type.name, newProps, type.id, type.flags) : type);\n }\n return new NodeSet(newTypes);\n }\n}\nconst CachedNode = new WeakMap(), CachedInnerNode = new WeakMap();\n/**\nOptions that control iteration. Can be combined with the `|`\noperator to enable multiple ones.\n*/\nvar IterMode;\n(function (IterMode) {\n /**\n When enabled, iteration will only visit [`Tree`](#common.Tree)\n objects, not nodes packed into\n [`TreeBuffer`](#common.TreeBuffer)s.\n */\n IterMode[IterMode[\"ExcludeBuffers\"] = 1] = \"ExcludeBuffers\";\n /**\n Enable this to make iteration include anonymous nodes (such as\n the nodes that wrap repeated grammar constructs into a balanced\n tree).\n */\n IterMode[IterMode[\"IncludeAnonymous\"] = 2] = \"IncludeAnonymous\";\n /**\n By default, regular [mounted](#common.NodeProp^mounted) nodes\n replace their base node in iteration. Enable this to ignore them\n instead.\n */\n IterMode[IterMode[\"IgnoreMounts\"] = 4] = \"IgnoreMounts\";\n /**\n This option only applies in\n [`enter`](#common.SyntaxNode.enter)-style methods. It tells the\n library to not enter mounted overlays if one covers the given\n position.\n */\n IterMode[IterMode[\"IgnoreOverlays\"] = 8] = \"IgnoreOverlays\";\n /**\n When set, positions on the boundary of a mounted overlay tree\n that has its [`bracketed`](#common.NestedParse.bracketed) flag\n set will enter that tree regardless of side. Only supported in\n [`enter`](#common.SyntaxNode.enter), not in cursors.\n */\n IterMode[IterMode[\"EnterBracketed\"] = 16] = \"EnterBracketed\";\n})(IterMode || (IterMode = {}));\n/**\nA piece of syntax tree. There are two ways to approach these\ntrees: the way they are actually stored in memory, and the\nconvenient way.\n\nSyntax trees are stored as a tree of `Tree` and `TreeBuffer`\nobjects. By packing detail information into `TreeBuffer` leaf\nnodes, the representation is made a lot more memory-efficient.\n\nHowever, when you want to actually work with tree nodes, this\nrepresentation is very awkward, so most client code will want to\nuse the [`TreeCursor`](#common.TreeCursor) or\n[`SyntaxNode`](#common.SyntaxNode) interface instead, which provides\na view on some part of this data structure, and can be used to\nmove around to adjacent nodes.\n*/\nclass Tree {\n /**\n Construct a new tree. See also [`Tree.build`](#common.Tree^build).\n */\n constructor(\n /**\n The type of the top node.\n */\n type, \n /**\n This node's child nodes.\n */\n children, \n /**\n The positions (offsets relative to the start of this tree) of\n the children.\n */\n positions, \n /**\n The total length of this tree\n */\n length, \n /**\n Per-node [node props](#common.NodeProp) to associate with this node.\n */\n props) {\n this.type = type;\n this.children = children;\n this.positions = positions;\n this.length = length;\n /**\n @internal\n */\n this.props = null;\n if (props && props.length) {\n this.props = Object.create(null);\n for (let [prop, value] of props)\n this.props[typeof prop == \"number\" ? prop : prop.id] = value;\n }\n }\n /**\n @internal\n */\n toString() {\n let mounted = MountedTree.get(this);\n if (mounted && !mounted.overlay)\n return mounted.tree.toString();\n let children = \"\";\n for (let ch of this.children) {\n let str = ch.toString();\n if (str) {\n if (children)\n children += \",\";\n children += str;\n }\n }\n return !this.type.name ? children :\n (/\\W/.test(this.type.name) && !this.type.isError ? JSON.stringify(this.type.name) : this.type.name) +\n (children.length ? \"(\" + children + \")\" : \"\");\n }\n /**\n Get a [tree cursor](#common.TreeCursor) positioned at the top of\n the tree. Mode can be used to [control](#common.IterMode) which\n nodes the cursor visits.\n */\n cursor(mode = 0) {\n return new TreeCursor(this.topNode, mode);\n }\n /**\n Get a [tree cursor](#common.TreeCursor) pointing into this tree\n at the given position and side (see\n [`moveTo`](#common.TreeCursor.moveTo).\n */\n cursorAt(pos, side = 0, mode = 0) {\n let scope = CachedNode.get(this) || this.topNode;\n let cursor = new TreeCursor(scope);\n cursor.moveTo(pos, side);\n CachedNode.set(this, cursor._tree);\n return cursor;\n }\n /**\n Get a [syntax node](#common.SyntaxNode) object for the top of the\n tree.\n */\n get topNode() {\n return new TreeNode(this, 0, 0, null);\n }\n /**\n Get the [syntax node](#common.SyntaxNode) at the given position.\n If `side` is -1, this will move into nodes that end at the\n position. If 1, it'll move into nodes that start at the\n position. With 0, it'll only enter nodes that cover the position\n from both sides.\n \n Note that this will not enter\n [overlays](#common.MountedTree.overlay), and you often want\n [`resolveInner`](#common.Tree.resolveInner) instead.\n */\n resolve(pos, side = 0) {\n let node = resolveNode(CachedNode.get(this) || this.topNode, pos, side, false);\n CachedNode.set(this, node);\n return node;\n }\n /**\n Like [`resolve`](#common.Tree.resolve), but will enter\n [overlaid](#common.MountedTree.overlay) nodes, producing a syntax node\n pointing into the innermost overlaid tree at the given position\n (with parent links going through all parent structure, including\n the host trees).\n */\n resolveInner(pos, side = 0) {\n let node = resolveNode(CachedInnerNode.get(this) || this.topNode, pos, side, true);\n CachedInnerNode.set(this, node);\n return node;\n }\n /**\n In some situations, it can be useful to iterate through all\n nodes around a position, including those in overlays that don't\n directly cover the position. This method gives you an iterator\n that will produce all nodes, from small to big, around the given\n position.\n */\n resolveStack(pos, side = 0) {\n return stackIterator(this, pos, side);\n }\n /**\n Iterate over the tree and its children, calling `enter` for any\n node that touches the `from`/`to` region (if given) before\n running over such a node's children, and `leave` (if given) when\n leaving the node. When `enter` returns `false`, that node will\n not have its children iterated over (or `leave` called).\n */\n iterate(spec) {\n let { enter, leave, from = 0, to = this.length } = spec;\n let mode = spec.mode || 0, anon = (mode & IterMode.IncludeAnonymous) > 0;\n for (let c = this.cursor(mode | IterMode.IncludeAnonymous);;) {\n let entered = false;\n if (c.from <= to && c.to >= from && (!anon && c.type.isAnonymous || enter(c) !== false)) {\n if (c.firstChild())\n continue;\n entered = true;\n }\n for (;;) {\n if (entered && leave && (anon || !c.type.isAnonymous))\n leave(c);\n if (c.nextSibling())\n break;\n if (!c.parent())\n return;\n entered = true;\n }\n }\n }\n /**\n Get the value of the given [node prop](#common.NodeProp) for this\n node. Works with both per-node and per-type props.\n */\n prop(prop) {\n return !prop.perNode ? this.type.prop(prop) : this.props ? this.props[prop.id] : undefined;\n }\n /**\n Returns the node's [per-node props](#common.NodeProp.perNode) in a\n format that can be passed to the [`Tree`](#common.Tree)\n constructor.\n */\n get propValues() {\n let result = [];\n if (this.props)\n for (let id in this.props)\n result.push([+id, this.props[id]]);\n return result;\n }\n /**\n Balance the direct children of this tree, producing a copy of\n which may have children grouped into subtrees with type\n [`NodeType.none`](#common.NodeType^none).\n */\n balance(config = {}) {\n return this.children.length <= 8 /* Balance.BranchFactor */ ? this :\n balanceRange(NodeType.none, this.children, this.positions, 0, this.children.length, 0, this.length, (children, positions, length) => new Tree(this.type, children, positions, length, this.propValues), config.makeTree || ((children, positions, length) => new Tree(NodeType.none, children, positions, length)));\n }\n /**\n Build a tree from a postfix-ordered buffer of node information,\n or a cursor over such a buffer.\n */\n static build(data) { return buildTree(data); }\n}\n/**\nThe empty tree\n*/\nTree.empty = new Tree(NodeType.none, [], [], 0);\nclass FlatBufferCursor {\n constructor(buffer, index) {\n this.buffer = buffer;\n this.index = index;\n }\n get id() { return this.buffer[this.index - 4]; }\n get start() { return this.buffer[this.index - 3]; }\n get end() { return this.buffer[this.index - 2]; }\n get size() { return this.buffer[this.index - 1]; }\n get pos() { return this.index; }\n next() { this.index -= 4; }\n fork() { return new FlatBufferCursor(this.buffer, this.index); }\n}\n/**\nTree buffers contain (type, start, end, endIndex) quads for each\nnode. In such a buffer, nodes are stored in prefix order (parents\nbefore children, with the endIndex of the parent indicating which\nchildren belong to it).\n*/\nclass TreeBuffer {\n /**\n Create a tree buffer.\n */\n constructor(\n /**\n The buffer's content.\n */\n buffer, \n /**\n The total length of the group of nodes in the buffer.\n */\n length, \n /**\n The node set used in this buffer.\n */\n set) {\n this.buffer = buffer;\n this.length = length;\n this.set = set;\n }\n /**\n @internal\n */\n get type() { return NodeType.none; }\n /**\n @internal\n */\n toString() {\n let result = [];\n for (let index = 0; index < this.buffer.length;) {\n result.push(this.childString(index));\n index = this.buffer[index + 3];\n }\n return result.join(\",\");\n }\n /**\n @internal\n */\n childString(index) {\n let id = this.buffer[index], endIndex = this.buffer[index + 3];\n let type = this.set.types[id], result = type.name;\n if (/\\W/.test(result) && !type.isError)\n result = JSON.stringify(result);\n index += 4;\n if (endIndex == index)\n return result;\n let children = [];\n while (index < endIndex) {\n children.push(this.childString(index));\n index = this.buffer[index + 3];\n }\n return result + \"(\" + children.join(\",\") + \")\";\n }\n /**\n @internal\n */\n findChild(startIndex, endIndex, dir, pos, side) {\n let { buffer } = this, pick = -1;\n for (let i = startIndex; i != endIndex; i = buffer[i + 3]) {\n if (checkSide(side, pos, buffer[i + 1], buffer[i + 2])) {\n pick = i;\n if (dir > 0)\n break;\n }\n }\n return pick;\n }\n /**\n @internal\n */\n slice(startI, endI, from) {\n let b = this.buffer;\n let copy = new Uint16Array(endI - startI), len = 0;\n for (let i = startI, j = 0; i < endI;) {\n copy[j++] = b[i++];\n copy[j++] = b[i++] - from;\n let to = copy[j++] = b[i++] - from;\n copy[j++] = b[i++] - startI;\n len = Math.max(len, to);\n }\n return new TreeBuffer(copy, len, this.set);\n }\n}\nfunction checkSide(side, pos, from, to) {\n switch (side) {\n case -2 /* Side.Before */: return from < pos;\n case -1 /* Side.AtOrBefore */: return to >= pos && from < pos;\n case 0 /* Side.Around */: return from < pos && to > pos;\n case 1 /* Side.AtOrAfter */: return from <= pos && to > pos;\n case 2 /* Side.After */: return to > pos;\n case 4 /* Side.DontCare */: return true;\n }\n}\nfunction resolveNode(node, pos, side, overlays) {\n var _a;\n // Move up to a node that actually holds the position, if possible\n while (node.from == node.to ||\n (side < 1 ? node.from >= pos : node.from > pos) ||\n (side > -1 ? node.to <= pos : node.to < pos)) {\n let parent = !overlays && node instanceof TreeNode && node.index < 0 ? null : node.parent;\n if (!parent)\n return node;\n node = parent;\n }\n let mode = overlays ? 0 : IterMode.IgnoreOverlays;\n // Must go up out of overlays when those do not overlap with pos\n if (overlays)\n for (let scan = node, parent = scan.parent; parent; scan = parent, parent = scan.parent) {\n if (scan instanceof TreeNode && scan.index < 0 && ((_a = parent.enter(pos, side, mode)) === null || _a === void 0 ? void 0 : _a.from) != scan.from)\n node = parent;\n }\n for (;;) {\n let inner = node.enter(pos, side, mode);\n if (!inner)\n return node;\n node = inner;\n }\n}\nclass BaseNode {\n cursor(mode = 0) { return new TreeCursor(this, mode); }\n getChild(type, before = null, after = null) {\n let r = getChildren(this, type, before, after);\n return r.length ? r[0] : null;\n }\n getChildren(type, before = null, after = null) {\n return getChildren(this, type, before, after);\n }\n resolve(pos, side = 0) {\n return resolveNode(this, pos, side, false);\n }\n resolveInner(pos, side = 0) {\n return resolveNode(this, pos, side, true);\n }\n matchContext(context) {\n return matchNodeContext(this.parent, context);\n }\n enterUnfinishedNodesBefore(pos) {\n let scan = this.childBefore(pos), node = this;\n while (scan) {\n let last = scan.lastChild;\n if (!last || last.to != scan.to)\n break;\n if (last.type.isError && last.from == last.to) {\n node = scan;\n scan = last.prevSibling;\n }\n else {\n scan = last;\n }\n }\n return node;\n }\n get node() { return this; }\n get next() { return this.parent; }\n}\nclass TreeNode extends BaseNode {\n constructor(_tree, from, \n // Index in parent node, set to -1 if the node is not a direct child of _parent.node (overlay)\n index, _parent) {\n super();\n this._tree = _tree;\n this.from = from;\n this.index = index;\n this._parent = _parent;\n }\n get type() { return this._tree.type; }\n get name() { return this._tree.type.name; }\n get to() { return this.from + this._tree.length; }\n nextChild(i, dir, pos, side, mode = 0) {\n for (let parent = this;;) {\n for (let { children, positions } = parent._tree, e = dir > 0 ? children.length : -1; i != e; i += dir) {\n let next = children[i], start = positions[i] + parent.from, mounted;\n if (!((mode & IterMode.EnterBracketed) && next instanceof Tree &&\n (mounted = MountedTree.get(next)) && !mounted.overlay && mounted.bracketed &&\n pos >= start && pos <= start + next.length) &&\n !checkSide(side, pos, start, start + next.length))\n continue;\n if (next instanceof TreeBuffer) {\n if (mode & IterMode.ExcludeBuffers)\n continue;\n let index = next.findChild(0, next.buffer.length, dir, pos - start, side);\n if (index > -1)\n return new BufferNode(new BufferContext(parent, next, i, start), null, index);\n }\n else if ((mode & IterMode.IncludeAnonymous) || (!next.type.isAnonymous || hasChild(next))) {\n let mounted;\n if (!(mode & IterMode.IgnoreMounts) && (mounted = MountedTree.get(next)) && !mounted.overlay)\n return new TreeNode(mounted.tree, start, i, parent);\n let inner = new TreeNode(next, start, i, parent);\n return (mode & IterMode.IncludeAnonymous) || !inner.type.isAnonymous ? inner\n : inner.nextChild(dir < 0 ? next.children.length - 1 : 0, dir, pos, side, mode);\n }\n }\n if ((mode & IterMode.IncludeAnonymous) || !parent.type.isAnonymous)\n return null;\n if (parent.index >= 0)\n i = parent.index + dir;\n else\n i = dir < 0 ? -1 : parent._parent._tree.children.length;\n parent = parent._parent;\n if (!parent)\n return null;\n }\n }\n get firstChild() { return this.nextChild(0, 1, 0, 4 /* Side.DontCare */); }\n get lastChild() { return this.nextChild(this._tree.children.length - 1, -1, 0, 4 /* Side.DontCare */); }\n childAfter(pos) { return this.nextChild(0, 1, pos, 2 /* Side.After */); }\n childBefore(pos) { return this.nextChild(this._tree.children.length - 1, -1, pos, -2 /* Side.Before */); }\n prop(prop) { return this._tree.prop(prop); }\n enter(pos, side, mode = 0) {\n let mounted;\n if (!(mode & IterMode.IgnoreOverlays) && (mounted = MountedTree.get(this._tree)) && mounted.overlay) {\n let rPos = pos - this.from, enterBracketed = (mode & IterMode.EnterBracketed) && mounted.bracketed;\n for (let { from, to } of mounted.overlay) {\n if ((side > 0 || enterBracketed ? from <= rPos : from < rPos) &&\n (side < 0 || enterBracketed ? to >= rPos : to > rPos))\n return new TreeNode(mounted.tree, mounted.overlay[0].from + this.from, -1, this);\n }\n }\n return this.nextChild(0, 1, pos, side, mode);\n }\n nextSignificantParent() {\n let val = this;\n while (val.type.isAnonymous && val._parent)\n val = val._parent;\n return val;\n }\n get parent() {\n return this._parent ? this._parent.nextSignificantParent() : null;\n }\n get nextSibling() {\n return this._parent && this.index >= 0 ? this._parent.nextChild(this.index + 1, 1, 0, 4 /* Side.DontCare */) : null;\n }\n get prevSibling() {\n return this._parent && this.index >= 0 ? this._parent.nextChild(this.index - 1, -1, 0, 4 /* Side.DontCare */) : null;\n }\n get tree() { return this._tree; }\n toTree() { return this._tree; }\n /**\n @internal\n */\n toString() { return this._tree.toString(); }\n}\nfunction getChildren(node, type, before, after) {\n let cur = node.cursor(), result = [];\n if (!cur.firstChild())\n return result;\n if (before != null)\n for (let found = false; !found;) {\n found = cur.type.is(before);\n if (!cur.nextSibling())\n return result;\n }\n for (;;) {\n if (after != null && cur.type.is(after))\n return result;\n if (cur.type.is(type))\n result.push(cur.node);\n if (!cur.nextSibling())\n return after == null ? result : [];\n }\n}\nfunction matchNodeContext(node, context, i = context.length - 1) {\n for (let p = node; i >= 0; p = p.parent) {\n if (!p)\n return false;\n if (!p.type.isAnonymous) {\n if (context[i] && context[i] != p.name)\n return false;\n i--;\n }\n }\n return true;\n}\nclass BufferContext {\n constructor(parent, buffer, index, start) {\n this.parent = parent;\n this.buffer = buffer;\n this.index = index;\n this.start = start;\n }\n}\nclass BufferNode extends BaseNode {\n get name() { return this.type.name; }\n get from() { return this.context.start + this.context.buffer.buffer[this.index + 1]; }\n get to() { return this.context.start + this.context.buffer.buffer[this.index + 2]; }\n constructor(context, _parent, index) {\n super();\n this.context = context;\n this._parent = _parent;\n this.index = index;\n this.type = context.buffer.set.types[context.buffer.buffer[index]];\n }\n child(dir, pos, side) {\n let { buffer } = this.context;\n let index = buffer.findChild(this.index + 4, buffer.buffer[this.index + 3], dir, pos - this.context.start, side);\n return index < 0 ? null : new BufferNode(this.context, this, index);\n }\n get firstChild() { return this.child(1, 0, 4 /* Side.DontCare */); }\n get lastChild() { return this.child(-1, 0, 4 /* Side.DontCare */); }\n childAfter(pos) { return this.child(1, pos, 2 /* Side.After */); }\n childBefore(pos) { return this.child(-1, pos, -2 /* Side.Before */); }\n prop(prop) { return this.type.prop(prop); }\n enter(pos, side, mode = 0) {\n if (mode & IterMode.ExcludeBuffers)\n return null;\n let { buffer } = this.context;\n let index = buffer.findChild(this.index + 4, buffer.buffer[this.index + 3], side > 0 ? 1 : -1, pos - this.context.start, side);\n return index < 0 ? null : new BufferNode(this.context, this, index);\n }\n get parent() {\n return this._parent || this.context.parent.nextSignificantParent();\n }\n externalSibling(dir) {\n return this._parent ? null : this.context.parent.nextChild(this.context.index + dir, dir, 0, 4 /* Side.DontCare */);\n }\n get nextSibling() {\n let { buffer } = this.context;\n let after = buffer.buffer[this.index + 3];\n if (after < (this._parent ? buffer.buffer[this._parent.index + 3] : buffer.buffer.length))\n return new BufferNode(this.context, this._parent, after);\n return this.externalSibling(1);\n }\n get prevSibling() {\n let { buffer } = this.context;\n let parentStart = this._parent ? this._parent.index + 4 : 0;\n if (this.index == parentStart)\n return this.externalSibling(-1);\n return new BufferNode(this.context, this._parent, buffer.findChild(parentStart, this.index, -1, 0, 4 /* Side.DontCare */));\n }\n get tree() { return null; }\n toTree() {\n let children = [], positions = [];\n let { buffer } = this.context;\n let startI = this.index + 4, endI = buffer.buffer[this.index + 3];\n if (endI > startI) {\n let from = buffer.buffer[this.index + 1];\n children.push(buffer.slice(startI, endI, from));\n positions.push(0);\n }\n return new Tree(this.type, children, positions, this.to - this.from);\n }\n /**\n @internal\n */\n toString() { return this.context.buffer.childString(this.index); }\n}\nfunction iterStack(heads) {\n if (!heads.length)\n return null;\n let pick = 0, picked = heads[0];\n for (let i = 1; i < heads.length; i++) {\n let node = heads[i];\n if (node.from > picked.from || node.to < picked.to) {\n picked = node;\n pick = i;\n }\n }\n let next = picked instanceof TreeNode && picked.index < 0 ? null : picked.parent;\n let newHeads = heads.slice();\n if (next)\n newHeads[pick] = next;\n else\n newHeads.splice(pick, 1);\n return new StackIterator(newHeads, picked);\n}\nclass StackIterator {\n constructor(heads, node) {\n this.heads = heads;\n this.node = node;\n }\n get next() { return iterStack(this.heads); }\n}\nfunction stackIterator(tree, pos, side) {\n let inner = tree.resolveInner(pos, side), layers = null;\n for (let scan = inner instanceof TreeNode ? inner : inner.context.parent; scan; scan = scan.parent) {\n if (scan.index < 0) { // This is an overlay root\n let parent = scan.parent;\n (layers || (layers = [inner])).push(parent.resolve(pos, side));\n scan = parent;\n }\n else {\n let mount = MountedTree.get(scan.tree);\n // Relevant overlay branching off\n if (mount && mount.overlay && mount.overlay[0].from <= pos && mount.overlay[mount.overlay.length - 1].to >= pos) {\n let root = new TreeNode(mount.tree, mount.overlay[0].from + scan.from, -1, scan);\n (layers || (layers = [inner])).push(resolveNode(root, pos, side, false));\n }\n }\n }\n return layers ? iterStack(layers) : inner;\n}\n/**\nA tree cursor object focuses on a given node in a syntax tree, and\nallows you to move to adjacent nodes.\n*/\nclass TreeCursor {\n /**\n Shorthand for `.type.name`.\n */\n get name() { return this.type.name; }\n /**\n @internal\n */\n constructor(node, mode = 0) {\n /**\n @internal\n */\n this.buffer = null;\n this.stack = [];\n /**\n @internal\n */\n this.index = 0;\n this.bufferNode = null;\n this.mode = mode & ~IterMode.EnterBracketed;\n if (node instanceof TreeNode) {\n this.yieldNode(node);\n }\n else {\n this._tree = node.context.parent;\n this.buffer = node.context;\n for (let n = node._parent; n; n = n._parent)\n this.stack.unshift(n.index);\n this.bufferNode = node;\n this.yieldBuf(node.index);\n }\n }\n yieldNode(node) {\n if (!node)\n return false;\n this._tree = node;\n this.type = node.type;\n this.from = node.from;\n this.to = node.to;\n return true;\n }\n yieldBuf(index, type) {\n this.index = index;\n let { start, buffer } = this.buffer;\n this.type = type || buffer.set.types[buffer.buffer[index]];\n this.from = start + buffer.buffer[index + 1];\n this.to = start + buffer.buffer[index + 2];\n return true;\n }\n /**\n @internal\n */\n yield(node) {\n if (!node)\n return false;\n if (node instanceof TreeNode) {\n this.buffer = null;\n return this.yieldNode(node);\n }\n this.buffer = node.context;\n return this.yieldBuf(node.index, node.type);\n }\n /**\n @internal\n */\n toString() {\n return this.buffer ? this.buffer.buffer.childString(this.index) : this._tree.toString();\n }\n /**\n @internal\n */\n enterChild(dir, pos, side) {\n if (!this.buffer)\n return this.yield(this._tree.nextChild(dir < 0 ? this._tree._tree.children.length - 1 : 0, dir, pos, side, this.mode));\n let { buffer } = this.buffer;\n let index = buffer.findChild(this.index + 4, buffer.buffer[this.index + 3], dir, pos - this.buffer.start, side);\n if (index < 0)\n return false;\n this.stack.push(this.index);\n return this.yieldBuf(index);\n }\n /**\n Move the cursor to this node's first child. When this returns\n false, the node has no child, and the cursor has not been moved.\n */\n firstChild() { return this.enterChild(1, 0, 4 /* Side.DontCare */); }\n /**\n Move the cursor to this node's last child.\n */\n lastChild() { return this.enterChild(-1, 0, 4 /* Side.DontCare */); }\n /**\n Move the cursor to the first child that ends after `pos`.\n */\n childAfter(pos) { return this.enterChild(1, pos, 2 /* Side.After */); }\n /**\n Move to the last child that starts before `pos`.\n */\n childBefore(pos) { return this.enterChild(-1, pos, -2 /* Side.Before */); }\n /**\n Move the cursor to the child around `pos`. If side is -1 the\n child may end at that position, when 1 it may start there. This\n will also enter [overlaid](#common.MountedTree.overlay)\n [mounted](#common.NodeProp^mounted) trees unless `overlays` is\n set to false.\n */\n enter(pos, side, mode = this.mode) {\n if (!this.buffer)\n return this.yield(this._tree.enter(pos, side, mode));\n return mode & IterMode.ExcludeBuffers ? false : this.enterChild(1, pos, side);\n }\n /**\n Move to the node's parent node, if this isn't the top node.\n */\n parent() {\n if (!this.buffer)\n return this.yieldNode((this.mode & IterMode.IncludeAnonymous) ? this._tree._parent : this._tree.parent);\n if (this.stack.length)\n return this.yieldBuf(this.stack.pop());\n let parent = (this.mode & IterMode.IncludeAnonymous) ? this.buffer.parent : this.buffer.parent.nextSignificantParent();\n this.buffer = null;\n return this.yieldNode(parent);\n }\n /**\n @internal\n */\n sibling(dir) {\n if (!this.buffer)\n return !this._tree._parent ? false\n : this.yield(this._tree.index < 0 ? null\n : this._tree._parent.nextChild(this._tree.index + dir, dir, 0, 4 /* Side.DontCare */, this.mode));\n let { buffer } = this.buffer, d = this.stack.length - 1;\n if (dir < 0) {\n let parentStart = d < 0 ? 0 : this.stack[d] + 4;\n if (this.index != parentStart)\n return this.yieldBuf(buffer.findChild(parentStart, this.index, -1, 0, 4 /* Side.DontCare */));\n }\n else {\n let after = buffer.buffer[this.index + 3];\n if (after < (d < 0 ? buffer.buffer.length : buffer.buffer[this.stack[d] + 3]))\n return this.yieldBuf(after);\n }\n return d < 0 ? this.yield(this.buffer.parent.nextChild(this.buffer.index + dir, dir, 0, 4 /* Side.DontCare */, this.mode)) : false;\n }\n /**\n Move to this node's next sibling, if any.\n */\n nextSibling() { return this.sibling(1); }\n /**\n Move to this node's previous sibling, if any.\n */\n prevSibling() { return this.sibling(-1); }\n atLastNode(dir) {\n let index, parent, { buffer } = this;\n if (buffer) {\n if (dir > 0) {\n if (this.index < buffer.buffer.buffer.length)\n return false;\n }\n else {\n for (let i = 0; i < this.index; i++)\n if (buffer.buffer.buffer[i + 3] < this.index)\n return false;\n }\n ({ index, parent } = buffer);\n }\n else {\n ({ index, _parent: parent } = this._tree);\n }\n for (; parent; { index, _parent: parent } = parent) {\n if (index > -1)\n for (let i = index + dir, e = dir < 0 ? -1 : parent._tree.children.length; i != e; i += dir) {\n let child = parent._tree.children[i];\n if ((this.mode & IterMode.IncludeAnonymous) ||\n child instanceof TreeBuffer ||\n !child.type.isAnonymous ||\n hasChild(child))\n return false;\n }\n }\n return true;\n }\n move(dir, enter) {\n if (enter && this.enterChild(dir, 0, 4 /* Side.DontCare */))\n return true;\n for (;;) {\n if (this.sibling(dir))\n return true;\n if (this.atLastNode(dir) || !this.parent())\n return false;\n }\n }\n /**\n Move to the next node in a\n [pre-order](https://en.wikipedia.org/wiki/Tree_traversal#Pre-order,_NLR)\n traversal, going from a node to its first child or, if the\n current node is empty or `enter` is false, its next sibling or\n the next sibling of the first parent node that has one.\n */\n next(enter = true) { return this.move(1, enter); }\n /**\n Move to the next node in a last-to-first pre-order traversal. A\n node is followed by its last child or, if it has none, its\n previous sibling or the previous sibling of the first parent\n node that has one.\n */\n prev(enter = true) { return this.move(-1, enter); }\n /**\n Move the cursor to the innermost node that covers `pos`. If\n `side` is -1, it will enter nodes that end at `pos`. If it is 1,\n it will enter nodes that start at `pos`.\n */\n moveTo(pos, side = 0) {\n // Move up to a node that actually holds the position, if possible\n while (this.from == this.to ||\n (side < 1 ? this.from >= pos : this.from > pos) ||\n (side > -1 ? this.to <= pos : this.to < pos))\n if (!this.parent())\n break;\n // Then scan down into child nodes as far as possible\n while (this.enterChild(1, pos, side)) { }\n return this;\n }\n /**\n Get a [syntax node](#common.SyntaxNode) at the cursor's current\n position.\n */\n get node() {\n if (!this.buffer)\n return this._tree;\n let cache = this.bufferNode, result = null, depth = 0;\n if (cache && cache.context == this.buffer) {\n scan: for (let index = this.index, d = this.stack.length; d >= 0;) {\n for (let c = cache; c; c = c._parent)\n if (c.index == index) {\n if (index == this.index)\n return c;\n result = c;\n depth = d + 1;\n break scan;\n }\n index = this.stack[--d];\n }\n }\n for (let i = depth; i < this.stack.length; i++)\n result = new BufferNode(this.buffer, result, this.stack[i]);\n return this.bufferNode = new BufferNode(this.buffer, result, this.index);\n }\n /**\n Get the [tree](#common.Tree) that represents the current node, if\n any. Will return null when the node is in a [tree\n buffer](#common.TreeBuffer).\n */\n get tree() {\n return this.buffer ? null : this._tree._tree;\n }\n /**\n Iterate over the current node and all its descendants, calling\n `enter` when entering a node and `leave`, if given, when leaving\n one. When `enter` returns `false`, any children of that node are\n skipped, and `leave` isn't called for it.\n */\n iterate(enter, leave) {\n for (let depth = 0;;) {\n let mustLeave = false;\n if (this.type.isAnonymous || enter(this) !== false) {\n if (this.firstChild()) {\n depth++;\n continue;\n }\n if (!this.type.isAnonymous)\n mustLeave = true;\n }\n for (;;) {\n if (mustLeave && leave)\n leave(this);\n mustLeave = this.type.isAnonymous;\n if (!depth)\n return;\n if (this.nextSibling())\n break;\n this.parent();\n depth--;\n mustLeave = true;\n }\n }\n }\n /**\n Test whether the current node matches a given context—a sequence\n of direct parent node names. Empty strings in the context array\n are treated as wildcards.\n */\n matchContext(context) {\n if (!this.buffer)\n return matchNodeContext(this.node.parent, context);\n let { buffer } = this.buffer, { types } = buffer.set;\n for (let i = context.length - 1, d = this.stack.length - 1; i >= 0; d--) {\n if (d < 0)\n return matchNodeContext(this._tree, context, i);\n let type = types[buffer.buffer[this.stack[d]]];\n if (!type.isAnonymous) {\n if (context[i] && context[i] != type.name)\n return false;\n i--;\n }\n }\n return true;\n }\n}\nfunction hasChild(tree) {\n return tree.children.some(ch => ch instanceof TreeBuffer || !ch.type.isAnonymous || hasChild(ch));\n}\nfunction buildTree(data) {\n var _a;\n let { buffer, nodeSet, maxBufferLength = DefaultBufferLength, reused = [], minRepeatType = nodeSet.types.length } = data;\n let cursor = Array.isArray(buffer) ? new FlatBufferCursor(buffer, buffer.length) : buffer;\n let types = nodeSet.types;\n let contextHash = 0, lookAhead = 0;\n function takeNode(parentStart, minPos, children, positions, inRepeat, depth) {\n let { id, start, end, size } = cursor;\n let lookAheadAtStart = lookAhead, contextAtStart = contextHash;\n if (size < 0) {\n cursor.next();\n if (size == -1 /* SpecialRecord.Reuse */) {\n let node = reused[id];\n children.push(node);\n positions.push(start - parentStart);\n return;\n }\n else if (size == -3 /* SpecialRecord.ContextChange */) { // Context change\n contextHash = id;\n return;\n }\n else if (size == -4 /* SpecialRecord.LookAhead */) {\n lookAhead = id;\n return;\n }\n else {\n throw new RangeError(`Unrecognized record size: ${size}`);\n }\n }\n let type = types[id], node, buffer;\n let startPos = start - parentStart;\n if (end - start <= maxBufferLength && (buffer = findBufferSize(cursor.pos - minPos, inRepeat))) {\n // Small enough for a buffer, and no reused nodes inside\n let data = new Uint16Array(buffer.size - buffer.skip);\n let endPos = cursor.pos - buffer.size, index = data.length;\n while (cursor.pos > endPos)\n index = copyToBuffer(buffer.start, data, index);\n node = new TreeBuffer(data, end - buffer.start, nodeSet);\n startPos = buffer.start - parentStart;\n }\n else { // Make it a node\n let endPos = cursor.pos - size;\n cursor.next();\n let localChildren = [], localPositions = [];\n let localInRepeat = id >= minRepeatType ? id : -1;\n let lastGroup = 0, lastEnd = end;\n while (cursor.pos > endPos) {\n if (localInRepeat >= 0 && cursor.id == localInRepeat && cursor.size >= 0) {\n if (cursor.end <= lastEnd - maxBufferLength) {\n makeRepeatLeaf(localChildren, localPositions, start, lastGroup, cursor.end, lastEnd, localInRepeat, lookAheadAtStart, contextAtStart);\n lastGroup = localChildren.length;\n lastEnd = cursor.end;\n }\n cursor.next();\n }\n else if (depth > 2500 /* CutOff.Depth */) {\n takeFlatNode(start, endPos, localChildren, localPositions);\n }\n else {\n takeNode(start, endPos, localChildren, localPositions, localInRepeat, depth + 1);\n }\n }\n if (localInRepeat >= 0 && lastGroup > 0 && lastGroup < localChildren.length)\n makeRepeatLeaf(localChildren, localPositions, start, lastGroup, start, lastEnd, localInRepeat, lookAheadAtStart, contextAtStart);\n localChildren.reverse();\n localPositions.reverse();\n if (localInRepeat > -1 && lastGroup > 0) {\n let make = makeBalanced(type, contextAtStart);\n node = balanceRange(type, localChildren, localPositions, 0, localChildren.length, 0, end - start, make, make);\n }\n else {\n node = makeTree(type, localChildren, localPositions, end - start, lookAheadAtStart - end, contextAtStart);\n }\n }\n children.push(node);\n positions.push(startPos);\n }\n function takeFlatNode(parentStart, minPos, children, positions) {\n let nodes = []; // Temporary, inverted array of leaf nodes found, with absolute positions\n let nodeCount = 0, stopAt = -1;\n while (cursor.pos > minPos) {\n let { id, start, end, size } = cursor;\n if (size > 4) { // Not a leaf\n cursor.next();\n }\n else if (stopAt > -1 && start < stopAt) {\n break;\n }\n else {\n if (stopAt < 0)\n stopAt = end - maxBufferLength;\n nodes.push(id, start, end);\n nodeCount++;\n cursor.next();\n }\n }\n if (nodeCount) {\n let buffer = new Uint16Array(nodeCount * 4);\n let start = nodes[nodes.length - 2];\n for (let i = nodes.length - 3, j = 0; i >= 0; i -= 3) {\n buffer[j++] = nodes[i];\n buffer[j++] = nodes[i + 1] - start;\n buffer[j++] = nodes[i + 2] - start;\n buffer[j++] = j;\n }\n children.push(new TreeBuffer(buffer, nodes[2] - start, nodeSet));\n positions.push(start - parentStart);\n }\n }\n function makeBalanced(type, contextHash) {\n return (children, positions, length) => {\n let lookAhead = 0, lastI = children.length - 1, last, lookAheadProp;\n if (lastI >= 0 && (last = children[lastI]) instanceof Tree) {\n if (!lastI && last.type == type && last.length == length)\n return last;\n if (lookAheadProp = last.prop(NodeProp.lookAhead))\n lookAhead = positions[lastI] + last.length + lookAheadProp;\n }\n return makeTree(type, children, positions, length, lookAhead, contextHash);\n };\n }\n function makeRepeatLeaf(children, positions, base, i, from, to, type, lookAhead, contextHash) {\n let localChildren = [], localPositions = [];\n while (children.length > i) {\n localChildren.push(children.pop());\n localPositions.push(positions.pop() + base - from);\n }\n children.push(makeTree(nodeSet.types[type], localChildren, localPositions, to - from, lookAhead - to, contextHash));\n positions.push(from - base);\n }\n function makeTree(type, children, positions, length, lookAhead, contextHash, props) {\n if (contextHash) {\n let pair = [NodeProp.contextHash, contextHash];\n props = props ? [pair].concat(props) : [pair];\n }\n if (lookAhead > 25) {\n let pair = [NodeProp.lookAhead, lookAhead];\n props = props ? [pair].concat(props) : [pair];\n }\n return new Tree(type, children, positions, length, props);\n }\n function findBufferSize(maxSize, inRepeat) {\n // Scan through the buffer to find previous siblings that fit\n // together in a TreeBuffer, and don't contain any reused nodes\n // (which can't be stored in a buffer).\n // If `inRepeat` is > -1, ignore node boundaries of that type for\n // nesting, but make sure the end falls either at the start\n // (`maxSize`) or before such a node.\n let fork = cursor.fork();\n let size = 0, start = 0, skip = 0, minStart = fork.end - maxBufferLength;\n let result = { size: 0, start: 0, skip: 0 };\n scan: for (let minPos = fork.pos - maxSize; fork.pos > minPos;) {\n let nodeSize = fork.size;\n // Pretend nested repeat nodes of the same type don't exist\n if (fork.id == inRepeat && nodeSize >= 0) {\n // Except that we store the current state as a valid return\n // value.\n result.size = size;\n result.start = start;\n result.skip = skip;\n skip += 4;\n size += 4;\n fork.next();\n continue;\n }\n let startPos = fork.pos - nodeSize;\n if (nodeSize < 0 || startPos < minPos || fork.start < minStart)\n break;\n let localSkipped = fork.id >= minRepeatType ? 4 : 0;\n let nodeStart = fork.start;\n fork.next();\n while (fork.pos > startPos) {\n if (fork.size < 0) {\n if (fork.size == -3 /* SpecialRecord.ContextChange */ || fork.size == -4 /* SpecialRecord.LookAhead */)\n localSkipped += 4;\n else\n break scan;\n }\n else if (fork.id >= minRepeatType) {\n localSkipped += 4;\n }\n fork.next();\n }\n start = nodeStart;\n size += nodeSize;\n skip += localSkipped;\n }\n if (inRepeat < 0 || size == maxSize) {\n result.size = size;\n result.start = start;\n result.skip = skip;\n }\n return result.size > 4 ? result : undefined;\n }\n function copyToBuffer(bufferStart, buffer, index) {\n let { id, start, end, size } = cursor;\n cursor.next();\n if (size >= 0 && id < minRepeatType) {\n let startIndex = index;\n if (size > 4) {\n let endPos = cursor.pos - (size - 4);\n while (cursor.pos > endPos)\n index = copyToBuffer(bufferStart, buffer, index);\n }\n buffer[--index] = startIndex;\n buffer[--index] = end - bufferStart;\n buffer[--index] = start - bufferStart;\n buffer[--index] = id;\n }\n else if (size == -3 /* SpecialRecord.ContextChange */) {\n contextHash = id;\n }\n else if (size == -4 /* SpecialRecord.LookAhead */) {\n lookAhead = id;\n }\n return index;\n }\n let children = [], positions = [];\n while (cursor.pos > 0)\n takeNode(data.start || 0, data.bufferStart || 0, children, positions, -1, 0);\n let length = (_a = data.length) !== null && _a !== void 0 ? _a : (children.length ? positions[0] + children[0].length : 0);\n return new Tree(types[data.topID], children.reverse(), positions.reverse(), length);\n}\nconst nodeSizeCache = new WeakMap;\nfunction nodeSize(balanceType, node) {\n if (!balanceType.isAnonymous || node instanceof TreeBuffer || node.type != balanceType)\n return 1;\n let size = nodeSizeCache.get(node);\n if (size == null) {\n size = 1;\n for (let child of node.children) {\n if (child.type != balanceType || !(child instanceof Tree)) {\n size = 1;\n break;\n }\n size += nodeSize(balanceType, child);\n }\n nodeSizeCache.set(node, size);\n }\n return size;\n}\nfunction balanceRange(\n// The type the balanced tree's inner nodes.\nbalanceType, \n// The direct children and their positions\nchildren, positions, \n// The index range in children/positions to use\nfrom, to, \n// The start position of the nodes, relative to their parent.\nstart, \n// Length of the outer node\nlength, \n// Function to build the top node of the balanced tree\nmkTop, \n// Function to build internal nodes for the balanced tree\nmkTree) {\n let total = 0;\n for (let i = from; i < to; i++)\n total += nodeSize(balanceType, children[i]);\n let maxChild = Math.ceil((total * 1.5) / 8 /* Balance.BranchFactor */);\n let localChildren = [], localPositions = [];\n function divide(children, positions, from, to, offset) {\n for (let i = from; i < to;) {\n let groupFrom = i, groupStart = positions[i], groupSize = nodeSize(balanceType, children[i]);\n i++;\n for (; i < to; i++) {\n let nextSize = nodeSize(balanceType, children[i]);\n if (groupSize + nextSize >= maxChild)\n break;\n groupSize += nextSize;\n }\n if (i == groupFrom + 1) {\n if (groupSize > maxChild) {\n let only = children[groupFrom]; // Only trees can have a size > 1\n divide(only.children, only.positions, 0, only.children.length, positions[groupFrom] + offset);\n continue;\n }\n localChildren.push(children[groupFrom]);\n }\n else {\n let length = positions[i - 1] + children[i - 1].length - groupStart;\n localChildren.push(balanceRange(balanceType, children, positions, groupFrom, i, groupStart, length, null, mkTree));\n }\n localPositions.push(groupStart + offset - start);\n }\n }\n divide(children, positions, from, to, 0);\n return (mkTop || mkTree)(localChildren, localPositions, length);\n}\n/**\nProvides a way to associate values with pieces of trees. As long\nas that part of the tree is reused, the associated values can be\nretrieved from an updated tree.\n*/\nclass NodeWeakMap {\n constructor() {\n this.map = new WeakMap();\n }\n setBuffer(buffer, index, value) {\n let inner = this.map.get(buffer);\n if (!inner)\n this.map.set(buffer, inner = new Map);\n inner.set(index, value);\n }\n getBuffer(buffer, index) {\n let inner = this.map.get(buffer);\n return inner && inner.get(index);\n }\n /**\n Set the value for this syntax node.\n */\n set(node, value) {\n if (node instanceof BufferNode)\n this.setBuffer(node.context.buffer, node.index, value);\n else if (node instanceof TreeNode)\n this.map.set(node.tree, value);\n }\n /**\n Retrieve value for this syntax node, if it exists in the map.\n */\n get(node) {\n return node instanceof BufferNode ? this.getBuffer(node.context.buffer, node.index)\n : node instanceof TreeNode ? this.map.get(node.tree) : undefined;\n }\n /**\n Set the value for the node that a cursor currently points to.\n */\n cursorSet(cursor, value) {\n if (cursor.buffer)\n this.setBuffer(cursor.buffer.buffer, cursor.index, value);\n else\n this.map.set(cursor.tree, value);\n }\n /**\n Retrieve the value for the node that a cursor currently points\n to.\n */\n cursorGet(cursor) {\n return cursor.buffer ? this.getBuffer(cursor.buffer.buffer, cursor.index) : this.map.get(cursor.tree);\n }\n}\n\n/**\nTree fragments are used during [incremental\nparsing](#common.Parser.startParse) to track parts of old trees\nthat can be reused in a new parse. An array of fragments is used\nto track regions of an old tree whose nodes might be reused in new\nparses. Use the static\n[`applyChanges`](#common.TreeFragment^applyChanges) method to\nupdate fragments for document changes.\n*/\nclass TreeFragment {\n /**\n Construct a tree fragment. You'll usually want to use\n [`addTree`](#common.TreeFragment^addTree) and\n [`applyChanges`](#common.TreeFragment^applyChanges) instead of\n calling this directly.\n */\n constructor(\n /**\n The start of the unchanged range pointed to by this fragment.\n This refers to an offset in the _updated_ document (as opposed\n to the original tree).\n */\n from, \n /**\n The end of the unchanged range.\n */\n to, \n /**\n The tree that this fragment is based on.\n */\n tree, \n /**\n The offset between the fragment's tree and the document that\n this fragment can be used against. Add this when going from\n document to tree positions, subtract it to go from tree to\n document positions.\n */\n offset, openStart = false, openEnd = false) {\n this.from = from;\n this.to = to;\n this.tree = tree;\n this.offset = offset;\n this.open = (openStart ? 1 /* Open.Start */ : 0) | (openEnd ? 2 /* Open.End */ : 0);\n }\n /**\n Whether the start of the fragment represents the start of a\n parse, or the end of a change. (In the second case, it may not\n be safe to reuse some nodes at the start, depending on the\n parsing algorithm.)\n */\n get openStart() { return (this.open & 1 /* Open.Start */) > 0; }\n /**\n Whether the end of the fragment represents the end of a\n full-document parse, or the start of a change.\n */\n get openEnd() { return (this.open & 2 /* Open.End */) > 0; }\n /**\n Create a set of fragments from a freshly parsed tree, or update\n an existing set of fragments by replacing the ones that overlap\n with a tree with content from the new tree. When `partial` is\n true, the parse is treated as incomplete, and the resulting\n fragment has [`openEnd`](#common.TreeFragment.openEnd) set to\n true.\n */\n static addTree(tree, fragments = [], partial = false) {\n let result = [new TreeFragment(0, tree.length, tree, 0, false, partial)];\n for (let f of fragments)\n if (f.to > tree.length)\n result.push(f);\n return result;\n }\n /**\n Apply a set of edits to an array of fragments, removing or\n splitting fragments as necessary to remove edited ranges, and\n adjusting offsets for fragments that moved.\n */\n static applyChanges(fragments, changes, minGap = 128) {\n if (!changes.length)\n return fragments;\n let result = [];\n let fI = 1, nextF = fragments.length ? fragments[0] : null;\n for (let cI = 0, pos = 0, off = 0;; cI++) {\n let nextC = cI < changes.length ? changes[cI] : null;\n let nextPos = nextC ? nextC.fromA : 1e9;\n if (nextPos - pos >= minGap)\n while (nextF && nextF.from < nextPos) {\n let cut = nextF;\n if (pos >= cut.from || nextPos <= cut.to || off) {\n let fFrom = Math.max(cut.from, pos) - off, fTo = Math.min(cut.to, nextPos) - off;\n cut = fFrom >= fTo ? null : new TreeFragment(fFrom, fTo, cut.tree, cut.offset + off, cI > 0, !!nextC);\n }\n if (cut)\n result.push(cut);\n if (nextF.to > nextPos)\n break;\n nextF = fI < fragments.length ? fragments[fI++] : null;\n }\n if (!nextC)\n break;\n pos = nextC.toA;\n off = nextC.toA - nextC.toB;\n }\n return result;\n }\n}\n/**\nA superclass that parsers should extend.\n*/\nclass Parser {\n /**\n Start a parse, returning a [partial parse](#common.PartialParse)\n object. [`fragments`](#common.TreeFragment) can be passed in to\n make the parse incremental.\n \n By default, the entire input is parsed. You can pass `ranges`,\n which should be a sorted array of non-empty, non-overlapping\n ranges, to parse only those ranges. The tree returned in that\n case will start at `ranges[0].from`.\n */\n startParse(input, fragments, ranges) {\n if (typeof input == \"string\")\n input = new StringInput(input);\n ranges = !ranges ? [new Range(0, input.length)] : ranges.length ? ranges.map(r => new Range(r.from, r.to)) : [new Range(0, 0)];\n return this.createParse(input, fragments || [], ranges);\n }\n /**\n Run a full parse, returning the resulting tree.\n */\n parse(input, fragments, ranges) {\n let parse = this.startParse(input, fragments, ranges);\n for (;;) {\n let done = parse.advance();\n if (done)\n return done;\n }\n }\n}\nclass StringInput {\n constructor(string) {\n this.string = string;\n }\n get length() { return this.string.length; }\n chunk(from) { return this.string.slice(from); }\n get lineChunks() { return false; }\n read(from, to) { return this.string.slice(from, to); }\n}\n\n/**\nCreate a parse wrapper that, after the inner parse completes,\nscans its tree for mixed language regions with the `nest`\nfunction, runs the resulting [inner parses](#common.NestedParse),\nand then [mounts](#common.NodeProp^mounted) their results onto the\ntree.\n*/\nfunction parseMixed(nest) {\n return (parse, input, fragments, ranges) => new MixedParse(parse, nest, input, fragments, ranges);\n}\nclass InnerParse {\n constructor(parser, parse, overlay, bracketed, target, from) {\n this.parser = parser;\n this.parse = parse;\n this.overlay = overlay;\n this.bracketed = bracketed;\n this.target = target;\n this.from = from;\n }\n}\nfunction checkRanges(ranges) {\n if (!ranges.length || ranges.some(r => r.from >= r.to))\n throw new RangeError(\"Invalid inner parse ranges given: \" + JSON.stringify(ranges));\n}\nclass ActiveOverlay {\n constructor(parser, predicate, mounts, index, start, bracketed, target, prev) {\n this.parser = parser;\n this.predicate = predicate;\n this.mounts = mounts;\n this.index = index;\n this.start = start;\n this.bracketed = bracketed;\n this.target = target;\n this.prev = prev;\n this.depth = 0;\n this.ranges = [];\n }\n}\nconst stoppedInner = new NodeProp({ perNode: true });\nclass MixedParse {\n constructor(base, nest, input, fragments, ranges) {\n this.nest = nest;\n this.input = input;\n this.fragments = fragments;\n this.ranges = ranges;\n this.inner = [];\n this.innerDone = 0;\n this.baseTree = null;\n this.stoppedAt = null;\n this.baseParse = base;\n }\n advance() {\n if (this.baseParse) {\n let done = this.baseParse.advance();\n if (!done)\n return null;\n this.baseParse = null;\n this.baseTree = done;\n this.startInner();\n if (this.stoppedAt != null)\n for (let inner of this.inner)\n inner.parse.stopAt(this.stoppedAt);\n }\n if (this.innerDone == this.inner.length) {\n let result = this.baseTree;\n if (this.stoppedAt != null)\n result = new Tree(result.type, result.children, result.positions, result.length, result.propValues.concat([[stoppedInner, this.stoppedAt]]));\n return result;\n }\n let inner = this.inner[this.innerDone], done = inner.parse.advance();\n if (done) {\n this.innerDone++;\n // This is a somewhat dodgy but super helpful hack where we\n // patch up nodes created by the inner parse (and thus\n // presumably not aliased anywhere else) to hold the information\n // about the inner parse.\n let props = Object.assign(Object.create(null), inner.target.props);\n props[NodeProp.mounted.id] = new MountedTree(done, inner.overlay, inner.parser, inner.bracketed);\n inner.target.props = props;\n }\n return null;\n }\n get parsedPos() {\n if (this.baseParse)\n return 0;\n let pos = this.input.length;\n for (let i = this.innerDone; i < this.inner.length; i++) {\n if (this.inner[i].from < pos)\n pos = Math.min(pos, this.inner[i].parse.parsedPos);\n }\n return pos;\n }\n stopAt(pos) {\n this.stoppedAt = pos;\n if (this.baseParse)\n this.baseParse.stopAt(pos);\n else\n for (let i = this.innerDone; i < this.inner.length; i++)\n this.inner[i].parse.stopAt(pos);\n }\n startInner() {\n let fragmentCursor = new FragmentCursor(this.fragments);\n let overlay = null;\n let covered = null;\n let cursor = new TreeCursor(new TreeNode(this.baseTree, this.ranges[0].from, 0, null), IterMode.IncludeAnonymous | IterMode.IgnoreMounts);\n scan: for (let nest, isCovered;;) {\n let enter = true, range;\n if (this.stoppedAt != null && cursor.from >= this.stoppedAt) {\n enter = false;\n }\n else if (fragmentCursor.hasNode(cursor)) {\n if (overlay) {\n let match = overlay.mounts.find(m => m.frag.from <= cursor.from && m.frag.to >= cursor.to && m.mount.overlay);\n if (match)\n for (let r of match.mount.overlay) {\n let from = r.from + match.pos, to = r.to + match.pos;\n if (from >= cursor.from && to <= cursor.to && !overlay.ranges.some(r => r.from < to && r.to > from))\n overlay.ranges.push({ from, to });\n }\n }\n enter = false;\n }\n else if (covered && (isCovered = checkCover(covered.ranges, cursor.from, cursor.to))) {\n enter = isCovered != 2 /* Cover.Full */;\n }\n else if (!cursor.type.isAnonymous && (nest = this.nest(cursor, this.input)) &&\n (cursor.from < cursor.to || !nest.overlay)) {\n if (!cursor.tree) {\n materialize(cursor);\n // materialize create one more level of nesting\n // we need to add depth to active overlay for going backwards\n if (overlay)\n overlay.depth++;\n if (covered)\n covered.depth++;\n }\n let oldMounts = fragmentCursor.findMounts(cursor.from, nest.parser);\n if (typeof nest.overlay == \"function\") {\n overlay = new ActiveOverlay(nest.parser, nest.overlay, oldMounts, this.inner.length, cursor.from, !!nest.bracketed, cursor.tree, overlay);\n }\n else {\n let ranges = punchRanges(this.ranges, nest.overlay ||\n (cursor.from < cursor.to ? [new Range(cursor.from, cursor.to)] : []));\n if (ranges.length)\n checkRanges(ranges);\n if (ranges.length || !nest.overlay)\n this.inner.push(new InnerParse(nest.parser, ranges.length ? nest.parser.startParse(this.input, enterFragments(oldMounts, ranges), ranges)\n : nest.parser.startParse(\"\"), nest.overlay ? nest.overlay.map(r => new Range(r.from - cursor.from, r.to - cursor.from)) : null, !!nest.bracketed, cursor.tree, ranges.length ? ranges[0].from : cursor.from));\n if (!nest.overlay)\n enter = false;\n else if (ranges.length)\n covered = { ranges, depth: 0, prev: covered };\n }\n }\n else if (overlay && (range = overlay.predicate(cursor))) {\n if (range === true)\n range = new Range(cursor.from, cursor.to);\n if (range.from < range.to) {\n let last = overlay.ranges.length - 1;\n if (last >= 0 && overlay.ranges[last].to == range.from)\n overlay.ranges[last] = { from: overlay.ranges[last].from, to: range.to };\n else\n overlay.ranges.push(range);\n }\n }\n if (enter && cursor.firstChild()) {\n if (overlay)\n overlay.depth++;\n if (covered)\n covered.depth++;\n }\n else {\n for (;;) {\n if (cursor.nextSibling())\n break;\n if (!cursor.parent())\n break scan;\n if (overlay && !--overlay.depth) {\n let ranges = punchRanges(this.ranges, overlay.ranges);\n if (ranges.length) {\n checkRanges(ranges);\n this.inner.splice(overlay.index, 0, new InnerParse(overlay.parser, overlay.parser.startParse(this.input, enterFragments(overlay.mounts, ranges), ranges), overlay.ranges.map(r => new Range(r.from - overlay.start, r.to - overlay.start)), overlay.bracketed, overlay.target, ranges[0].from));\n }\n overlay = overlay.prev;\n }\n if (covered && !--covered.depth)\n covered = covered.prev;\n }\n }\n }\n }\n}\nfunction checkCover(covered, from, to) {\n for (let range of covered) {\n if (range.from >= to)\n break;\n if (range.to > from)\n return range.from <= from && range.to >= to ? 2 /* Cover.Full */ : 1 /* Cover.Partial */;\n }\n return 0 /* Cover.None */;\n}\n// Take a piece of buffer and convert it into a stand-alone\n// TreeBuffer.\nfunction sliceBuf(buf, startI, endI, nodes, positions, off) {\n if (startI < endI) {\n let from = buf.buffer[startI + 1];\n nodes.push(buf.slice(startI, endI, from));\n positions.push(from - off);\n }\n}\n// This function takes a node that's in a buffer, and converts it, and\n// its parent buffer nodes, into a Tree. This is again acting on the\n// assumption that the trees and buffers have been constructed by the\n// parse that was ran via the mix parser, and thus aren't shared with\n// any other code, making violations of the immutability safe.\nfunction materialize(cursor) {\n let { node } = cursor, stack = [];\n let buffer = node.context.buffer;\n // Scan up to the nearest tree\n do {\n stack.push(cursor.index);\n cursor.parent();\n } while (!cursor.tree);\n // Find the index of the buffer in that tree\n let base = cursor.tree, i = base.children.indexOf(buffer);\n let buf = base.children[i], b = buf.buffer, newStack = [i];\n // Split a level in the buffer, putting the nodes before and after\n // the child that contains `node` into new buffers.\n function split(startI, endI, type, innerOffset, length, stackPos) {\n let targetI = stack[stackPos];\n let children = [], positions = [];\n sliceBuf(buf, startI, targetI, children, positions, innerOffset);\n let from = b[targetI + 1], to = b[targetI + 2];\n newStack.push(children.length);\n let child = stackPos\n ? split(targetI + 4, b[targetI + 3], buf.set.types[b[targetI]], from, to - from, stackPos - 1)\n : node.toTree();\n children.push(child);\n positions.push(from - innerOffset);\n sliceBuf(buf, b[targetI + 3], endI, children, positions, innerOffset);\n return new Tree(type, children, positions, length);\n }\n base.children[i] = split(0, b.length, NodeType.none, 0, buf.length, stack.length - 1);\n // Move the cursor back to the target node\n for (let index of newStack) {\n let tree = cursor.tree.children[index], pos = cursor.tree.positions[index];\n cursor.yield(new TreeNode(tree, pos + cursor.from, index, cursor._tree));\n }\n}\nclass StructureCursor {\n constructor(root, offset) {\n this.offset = offset;\n this.done = false;\n this.cursor = root.cursor(IterMode.IncludeAnonymous | IterMode.IgnoreMounts);\n }\n // Move to the first node (in pre-order) that starts at or after `pos`.\n moveTo(pos) {\n let { cursor } = this, p = pos - this.offset;\n while (!this.done && cursor.from < p) {\n if (cursor.to >= pos && cursor.enter(p, 1, IterMode.IgnoreOverlays | IterMode.ExcludeBuffers)) ;\n else if (!cursor.next(false))\n this.done = true;\n }\n }\n hasNode(cursor) {\n this.moveTo(cursor.from);\n if (!this.done && this.cursor.from + this.offset == cursor.from && this.cursor.tree) {\n for (let tree = this.cursor.tree;;) {\n if (tree == cursor.tree)\n return true;\n if (tree.children.length && tree.positions[0] == 0 && tree.children[0] instanceof Tree)\n tree = tree.children[0];\n else\n break;\n }\n }\n return false;\n }\n}\nclass FragmentCursor {\n constructor(fragments) {\n var _a;\n this.fragments = fragments;\n this.curTo = 0;\n this.fragI = 0;\n if (fragments.length) {\n let first = this.curFrag = fragments[0];\n this.curTo = (_a = first.tree.prop(stoppedInner)) !== null && _a !== void 0 ? _a : first.to;\n this.inner = new StructureCursor(first.tree, -first.offset);\n }\n else {\n this.curFrag = this.inner = null;\n }\n }\n hasNode(node) {\n while (this.curFrag && node.from >= this.curTo)\n this.nextFrag();\n return this.curFrag && this.curFrag.from <= node.from && this.curTo >= node.to && this.inner.hasNode(node);\n }\n nextFrag() {\n var _a;\n this.fragI++;\n if (this.fragI == this.fragments.length) {\n this.curFrag = this.inner = null;\n }\n else {\n let frag = this.curFrag = this.fragments[this.fragI];\n this.curTo = (_a = frag.tree.prop(stoppedInner)) !== null && _a !== void 0 ? _a : frag.to;\n this.inner = new StructureCursor(frag.tree, -frag.offset);\n }\n }\n findMounts(pos, parser) {\n var _a;\n let result = [];\n if (this.inner) {\n this.inner.cursor.moveTo(pos, 1);\n for (let pos = this.inner.cursor.node; pos; pos = pos.parent) {\n let mount = (_a = pos.tree) === null || _a === void 0 ? void 0 : _a.prop(NodeProp.mounted);\n if (mount && mount.parser == parser) {\n for (let i = this.fragI; i < this.fragments.length; i++) {\n let frag = this.fragments[i];\n if (frag.from >= pos.to)\n break;\n if (frag.tree == this.curFrag.tree)\n result.push({\n frag,\n pos: pos.from - frag.offset,\n mount\n });\n }\n }\n }\n }\n return result;\n }\n}\nfunction punchRanges(outer, ranges) {\n let copy = null, current = ranges;\n for (let i = 1, j = 0; i < outer.length; i++) {\n let gapFrom = outer[i - 1].to, gapTo = outer[i].from;\n for (; j < current.length; j++) {\n let r = current[j];\n if (r.from >= gapTo)\n break;\n if (r.to <= gapFrom)\n continue;\n if (!copy)\n current = copy = ranges.slice();\n if (r.from < gapFrom) {\n copy[j] = new Range(r.from, gapFrom);\n if (r.to > gapTo)\n copy.splice(j + 1, 0, new Range(gapTo, r.to));\n }\n else if (r.to > gapTo) {\n copy[j--] = new Range(gapTo, r.to);\n }\n else {\n copy.splice(j--, 1);\n }\n }\n }\n return current;\n}\nfunction findCoverChanges(a, b, from, to) {\n let iA = 0, iB = 0, inA = false, inB = false, pos = -1e9;\n let result = [];\n for (;;) {\n let nextA = iA == a.length ? 1e9 : inA ? a[iA].to : a[iA].from;\n let nextB = iB == b.length ? 1e9 : inB ? b[iB].to : b[iB].from;\n if (inA != inB) {\n let start = Math.max(pos, from), end = Math.min(nextA, nextB, to);\n if (start < end)\n result.push(new Range(start, end));\n }\n pos = Math.min(nextA, nextB);\n if (pos == 1e9)\n break;\n if (nextA == pos) {\n if (!inA)\n inA = true;\n else {\n inA = false;\n iA++;\n }\n }\n if (nextB == pos) {\n if (!inB)\n inB = true;\n else {\n inB = false;\n iB++;\n }\n }\n }\n return result;\n}\n// Given a number of fragments for the outer tree, and a set of ranges\n// to parse, find fragments for inner trees mounted around those\n// ranges, if any.\nfunction enterFragments(mounts, ranges) {\n let result = [];\n for (let { pos, mount, frag } of mounts) {\n let startPos = pos + (mount.overlay ? mount.overlay[0].from : 0), endPos = startPos + mount.tree.length;\n let from = Math.max(frag.from, startPos), to = Math.min(frag.to, endPos);\n if (mount.overlay) {\n let overlay = mount.overlay.map(r => new Range(r.from + pos, r.to + pos));\n let changes = findCoverChanges(ranges, overlay, from, to);\n for (let i = 0, pos = from;; i++) {\n let last = i == changes.length, end = last ? to : changes[i].from;\n if (end > pos)\n result.push(new TreeFragment(pos, end, mount.tree, -startPos, frag.from >= pos || frag.openStart, frag.to <= end || frag.openEnd));\n if (last)\n break;\n pos = changes[i].to;\n }\n }\n else {\n result.push(new TreeFragment(from, to, mount.tree, -startPos, frag.from >= startPos || frag.openStart, frag.to <= endPos || frag.openEnd));\n }\n }\n return result;\n}\n\nexport { DefaultBufferLength, IterMode, MountedTree, NodeProp, NodeSet, NodeType, NodeWeakMap, Parser, Tree, TreeBuffer, TreeCursor, TreeFragment, parseMixed };\n","import { HighlightStyle, syntaxHighlighting } from '@codemirror/language'\nimport { tags } from '@lezer/highlight'\n\nconst highlightStyle = HighlightStyle.define([\n { tag: tags.propertyName, color: 'var(--internal-key-color)' }, // keys\n { tag: tags.number, color: 'var(--internal-value-color-number)' },\n { tag: tags.bool, color: 'var(--internal-value-color-boolean)' },\n { tag: tags.string, color: 'var(--internal-value-color-string)' },\n { tag: tags.keyword, color: 'var(--internal-value-color-null)' } // null\n])\n\nexport const highlighter = syntaxHighlighting(highlightStyle)\n\n// TODO: remove workaround when not needed anymore\n// Workaround for the error \"CodeMirror plugin crashed: TypeError: tags3 is undefined\"\n// thrown when using the json() language from '@codemirror/lang-json'\n//\n// Note that a plain CodeSandbox with parcel and code mirror v6.0.0,\n// so it is maybe related to Vite\n//\n// See https://discuss.codemirror.net/t/highlighting-that-seems-ignored-in-cm6/4320/15\nconst originalStyle = highlightStyle.style\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore\n// noinspection JSConstantReassignment\nhighlightStyle.style = (tags) => originalStyle(tags || [])\n","import { getIndentUnit } from \"@codemirror/language\";\nimport { RangeSetBuilder } from \"@codemirror/state\";\nimport { Decoration, ViewPlugin, } from \"@codemirror/view\";\nclass WrappedLineIndent {\n constructor(view) {\n this.view = view;\n this.indentUnit = getIndentUnit(view.state);\n this.initialPaddingLeft = null;\n this.isChrome = window === null || window === void 0 ? void 0 : window.navigator.userAgent.includes(\"Chrome\");\n this.generate(view.state);\n }\n update(update) {\n const indentUnit = getIndentUnit(update.state);\n if (indentUnit !== this.indentUnit ||\n update.docChanged ||\n update.viewportChanged) {\n this.indentUnit = indentUnit;\n this.generate(update.state);\n }\n }\n generate(state) {\n const builder = new RangeSetBuilder();\n if (this.initialPaddingLeft) {\n this.addStyleToBuilder(builder, state, this.initialPaddingLeft);\n }\n else {\n this.view.requestMeasure({\n read: (view) => {\n const lineElement = view.contentDOM.querySelector(\".cm-line\");\n if (lineElement) {\n this.initialPaddingLeft = window\n .getComputedStyle(lineElement)\n .getPropertyValue(\"padding-left\");\n this.addStyleToBuilder(builder, view.state, this.initialPaddingLeft);\n }\n this.decorations = builder.finish();\n },\n });\n }\n this.decorations = builder.finish();\n }\n addStyleToBuilder(builder, state, initialPaddingLeft) {\n const visibleLines = this.getVisibleLines(state);\n for (const line of visibleLines) {\n const { numColumns, containsTab } = this.numColumns(line.text, state.tabSize);\n const paddingValue = `calc(${numColumns + this.indentUnit}ch + ${initialPaddingLeft})`;\n const textIndentValue = this.isChrome\n ? `calc(-${numColumns + this.indentUnit}ch - ${containsTab ? 1 : 0}px)`\n : `-${numColumns + this.indentUnit}ch`;\n builder.add(line.from, line.from, Decoration.line({\n attributes: {\n style: `padding-left: ${paddingValue}; text-indent: ${textIndentValue};`,\n },\n }));\n }\n }\n // Get all lines that are currently visible in the viewport.\n getVisibleLines(state) {\n const lines = new Set();\n let lastLine = null;\n for (const { from, to } of this.view.visibleRanges) {\n let pos = from;\n while (pos <= to) {\n const line = state.doc.lineAt(pos);\n if (lastLine !== line) {\n lines.add(line);\n lastLine = line;\n }\n pos = line.to + 1;\n }\n }\n return lines;\n }\n numColumns(str, tabSize) {\n let cols = 0;\n let containsTab = false;\n loop: for (let i = 0; i < str.length; i++) {\n switch (str[i]) {\n case \" \": {\n cols += 1;\n continue loop;\n }\n case \"\\t\": {\n cols += tabSize - (cols % tabSize);\n containsTab = true;\n continue loop;\n }\n case \"\\r\": {\n continue loop;\n }\n default: {\n break loop;\n }\n }\n }\n return { numColumns: cols, containsTab };\n }\n}\nexport const wrappedLineIndent = [\n ViewPlugin.fromClass(WrappedLineIndent, {\n decorations: (v) => v.decorations,\n }),\n];\n","<svelte:options immutable={true} />\n\n<script lang=\"ts\">\n import {\n faExclamationTriangle,\n faEye,\n faTimes,\n faWrench\n } from '@fortawesome/free-solid-svg-icons'\n import { type SyntaxNode, type SyntaxNodeRef, type Tree, type NodeIterator } from '@lezer/common'\n import { createDebug } from '$lib/utils/debug.js'\n import type { JSONPatchDocument, JSONPath } from 'immutable-json-patch'\n import { immutableJSONPatch, revertJSONPatch } from 'immutable-json-patch'\n import { jsonrepair } from 'jsonrepair'\n import { debounce, isEqual, uniqueId } from 'lodash-es'\n import { flushSync, onDestroy, onMount } from 'svelte'\n import {\n JSON_STATUS_INVALID,\n JSON_STATUS_REPAIRABLE,\n JSON_STATUS_VALID,\n MAX_CHARACTERS_TEXT_PREVIEW,\n TEXT_MODE_ONCHANGE_DELAY\n } from '$lib/constants.js'\n import {\n activeElementIsChildOf,\n createNormalizationFunctions,\n getWindow\n } from '$lib/utils/domUtils.js'\n import { formatSize } from '$lib/utils/fileUtils.js'\n import { findTextLocation, getText, needsFormatting } from '$lib/utils/jsonUtils.js'\n import { expandSelf } from '$lib/logic/documentState.js'\n import { createFocusTracker } from '../../controls/createFocusTracker.js'\n import Message from '../../controls/Message.svelte'\n import ValidationErrorsOverview from '../../controls/ValidationErrorsOverview.svelte'\n import TextMenu from './menu/TextMenu.svelte'\n import {\n Annotation,\n ChangeSet,\n Compartment,\n EditorSelection,\n EditorState,\n type Extension\n } from '@codemirror/state'\n import {\n crosshairCursor,\n drawSelection,\n dropCursor,\n EditorView,\n highlightActiveLine,\n highlightActiveLineGutter,\n highlightSpecialChars,\n keymap,\n lineNumbers,\n rectangularSelection,\n type ViewUpdate\n } from '@codemirror/view'\n import { defaultKeymap, indentWithTab } from '@codemirror/commands'\n import type { Diagnostic } from '@codemirror/lint'\n import { linter, lintGutter, lintKeymap } from '@codemirror/lint'\n import { json as jsonLang } from '@codemirror/lang-json'\n import {\n bracketMatching,\n defaultHighlightStyle,\n foldGutter,\n foldKeymap,\n indentOnInput,\n indentUnit,\n syntaxHighlighting,\n foldable,\n foldService,\n ensureSyntaxTree,\n foldEffect,\n unfoldCode,\n unfoldAll,\n foldNodeProp\n } from '@codemirror/language'\n import {\n closeSearchPanel,\n highlightSelectionMatches,\n openSearchPanel,\n search,\n searchKeymap\n } from '@codemirror/search'\n import {\n autocompletion,\n closeBrackets,\n closeBracketsKeymap,\n completionKeymap\n } from '@codemirror/autocomplete'\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n import jsonSourceMap from 'json-source-map'\n import StatusBar from './StatusBar.svelte'\n import { highlighter } from './codemirror/codemirror-theme.js'\n import type {\n Content,\n ContentErrors,\n History,\n HistoryItem,\n JSONEditorSelection,\n JSONParser,\n JSONPatchResult,\n OnBlur,\n OnChange,\n OnChangeMode,\n OnError,\n OnExpand,\n OnFocus,\n OnRedo,\n OnRenderMenuInternal,\n OnSelect,\n OnSortModal,\n OnTransformModal,\n OnUndo,\n ParseError,\n RichValidationError,\n TextHistoryItem,\n TextSelection,\n TransformModalOptions,\n ValidationError,\n Validator\n } from '$lib/types.js'\n import { Mode, SelectionType, ValidationSeverity } from '$lib/types.js'\n import {\n isContentParseError,\n isContentValidationErrors,\n isTextHistoryItem\n } from '$lib/typeguards.js'\n import memoizeOne from 'memoize-one'\n import { validateText } from '$lib/logic/validation.js'\n import { truncate } from '$lib/utils/stringUtils.js'\n import { faJSONEditorFormat } from '$lib/img/customFontawesomeIcons.js'\n import { indentationMarkers } from '@replit/codemirror-indentation-markers'\n import { isTextSelection } from '$lib/logic/selection.js'\n import { wrappedLineIndent } from 'codemirror-wrapped-line-indent/dist/index.js' // ensure loading ESM, otherwise the vitest test fail\n\n export let readOnly: boolean\n export let mainMenuBar: boolean\n export let statusBar: boolean\n export let askToFormat: boolean\n export let externalContent: Content\n export let externalSelection: JSONEditorSelection | undefined\n export let history: History<HistoryItem>\n export let indentation: number | string\n export let tabSize: number\n export let escapeUnicodeCharacters: boolean\n export let maxDocumentSize: number\n export let parser: JSONParser\n export let validator: Validator | undefined\n export let validationParser: JSONParser\n export let onChange: OnChange\n export let onChangeMode: OnChangeMode\n export let onSelect: OnSelect\n export let onUndo: OnUndo\n export let onRedo: OnRedo\n export let onError: OnError\n export let onFocus: OnFocus\n export let onBlur: OnBlur\n export let onRenderMenu: OnRenderMenuInternal\n export let onSortModal: OnSortModal\n export let onTransformModal: OnTransformModal\n\n const debug = createDebug('jsoneditor:TextMode')\n\n const formatCompactKeyBinding = {\n key: 'Mod-i',\n run: handleFormat,\n shift: handleCompact,\n preventDefault: true\n }\n\n const isSSR = typeof window === 'undefined'\n debug('isSSR:', isSSR)\n\n let codeMirrorRef: HTMLDivElement\n let domTextMode: HTMLDivElement\n let codeMirrorView: EditorView\n let editorState: EditorState\n\n let acceptTooLarge = false\n let askToFormatApplied = askToFormat\n\n let validationErrors: ValidationError[] = []\n\n // collapse state\n let isFolding = false\n let foldProgress = 0\n let foldTotal = 0\n let foldCancelController: AbortController | null = null\n const collapseBatchSize = 100 // number of ranges to collapse in one batch\n const showCollapseProgressSize = 5000 // if the number of ranges is larger than this, show progress\n const linterCompartment = new Compartment()\n const readOnlyCompartment = new Compartment()\n const indentCompartment = new Compartment()\n const tabSizeCompartment = new Compartment()\n const themeCompartment = new Compartment()\n\n let content: Content = externalContent\n let text = getText(content, indentation, parser) // text is just a cached version of content.text or parsed content.json\n\n let historyAnnotation = Annotation.define()\n\n let historyUpdatesQueue: ViewUpdate[] | null = null\n\n function addHistoryItem(): boolean {\n if (!historyUpdatesQueue || historyUpdatesQueue.length === 0) {\n return false\n }\n\n // merge changes and create the inverse changes\n const startState = historyUpdatesQueue[0].startState\n const endState = historyUpdatesQueue[historyUpdatesQueue.length - 1].state\n const mergedChanges = historyUpdatesQueue\n .map((update) => update.changes)\n .reduce((mergedChanges, change) => mergedChanges.compose(change))\n const inverseChanges = mergedChanges.invert(startState.doc)\n\n // create a history item with undo/redo actions\n const item: TextHistoryItem = {\n type: 'text',\n undo: {\n changes: inverseChanges.toJSON(),\n selection: toTextSelection(startState.selection)\n },\n redo: {\n changes: mergedChanges.toJSON(),\n selection: toTextSelection(endState.selection)\n }\n }\n\n debug('add history item', item)\n\n history.add(item)\n\n historyUpdatesQueue = null\n return true\n }\n\n $: normalization = createNormalizationFunctions({\n escapeControlCharacters: false,\n escapeUnicodeCharacters\n })\n\n // eslint-disable-next-line svelte/no-unused-svelte-ignore\n // svelte-ignore reactive_declaration_non_reactive_property\n $: setCodeMirrorContent(externalContent, false, false)\n $: applyExternalSelection(externalSelection)\n $: updateLinter(validator)\n $: updateIndentation(indentation)\n $: updateTabSize(tabSize)\n $: updateReadOnly(readOnly)\n\n // force updating the text when escapeUnicodeCharacters changes\n let previousEscapeUnicodeCharacters = escapeUnicodeCharacters\n $: {\n if (previousEscapeUnicodeCharacters !== escapeUnicodeCharacters) {\n previousEscapeUnicodeCharacters = escapeUnicodeCharacters\n forceUpdateText()\n }\n }\n\n onMount(async () => {\n if (isSSR) {\n return\n }\n\n try {\n codeMirrorView = createCodeMirrorView({\n target: codeMirrorRef,\n initialText: !disableTextEditor(text, maxDocumentSize, acceptTooLarge)\n ? normalization.escapeValue(text)\n : '',\n readOnly,\n indentation\n })\n } catch (err) {\n // TODO: report error to the user\n console.error(err)\n }\n })\n\n onDestroy(() => {\n flush()\n\n if (codeMirrorView) {\n debug('Destroy CodeMirror editor')\n codeMirrorView.destroy()\n }\n handleCancelFolding()\n })\n\n const sortModalId = uniqueId()\n const transformModalId = uniqueId()\n\n export function focus() {\n if (codeMirrorView) {\n debug('focus')\n codeMirrorView.focus()\n }\n }\n\n export function collapse(path: JSONPath, recursive: boolean) {\n if (!codeMirrorView) {\n return\n }\n try {\n foldRecursive(path, recursive)\n } catch (err) {\n onError(err as Error)\n }\n }\n // customFoldService CodeMirror foldable syntaxFolding use syntaxTree, Under large json, it will cause the tree to be incomplete\n // so we use ensureSyntaxTree get the full tree\n // https://github.com/codemirror/language/blob/ca8d6bec5463fa17eea0b893e4a2670e4df110d4/src/fold.ts#L31\n function createCustomFoldService() {\n return foldService.of((state, start, end) => {\n const tree = ensureSyntaxTree(state, state.doc.length, Infinity)\n if (!tree || tree.length < end) return null\n\n let stack = tree.resolveStack(end, 1)\n let found: null | { from: number; to: number } = null\n\n for (let iter: NodeIterator | null = stack; iter; iter = iter.next) {\n let cur = iter.node\n if (cur.to <= end || cur.from > end) continue\n if (found && cur.from < start) break\n\n let prop = cur.type.prop(foldNodeProp)\n if (\n prop &&\n (cur.to < tree.length - 50 || tree.length == state.doc.length || !isUnfinished(cur))\n ) {\n let value = prop(cur, state)\n if (value && value.from <= end && value.from >= start && value.to > end) {\n found = value\n }\n }\n }\n return found\n })\n }\n function isUnfinished(node: SyntaxNode) {\n let ch = node.lastChild\n return ch && ch.to == node.to && ch.type.isError\n }\n\n function getFoldRanges(\n tree: Tree,\n state: EditorState,\n startPos?: number,\n recursive: boolean = true\n ) {\n const foldRanges: { from: number; to: number }[] = []\n const processedRanges = new Set<string>()\n\n tree.iterate({\n enter(node: SyntaxNodeRef) {\n // If startPos is defined, only consider nodes after it\n if (startPos === undefined || node.from >= startPos) {\n const isFoldable = foldable(state, node.from, node.to)\n if (isFoldable) {\n const rangeKey = `${isFoldable.from}-${isFoldable.to}`\n\n if (!processedRanges.has(rangeKey)) {\n // If not recursive, only add top-level foldable nodes\n if (!recursive) {\n // Check if this node is not nested inside another foldable node we've already added\n const isNested = foldRanges.some(\n (range) => range.from <= isFoldable.from && range.to >= isFoldable.to\n )\n if (!isNested) {\n foldRanges.push({ from: isFoldable.from, to: isFoldable.to })\n processedRanges.add(rangeKey)\n }\n } else {\n // Recursive mode: add all foldable nodes\n foldRanges.push({ from: isFoldable.from, to: isFoldable.to })\n processedRanges.add(rangeKey)\n }\n }\n }\n }\n }\n })\n\n return foldRanges\n }\n async function foldRangesAnimated(foldRanges: { from: number; to: number }[]) {\n if (foldRanges.length === 0) return\n\n // if the number of ranges is large, show progress\n const shouldShowProgress = foldRanges.length > showCollapseProgressSize\n\n if (shouldShowProgress) {\n isFolding = true\n foldProgress = 0\n foldTotal = foldRanges.length\n foldCancelController = new AbortController()\n }\n\n const processBatch = (startIndex: number): Promise<void> => {\n return new Promise<void>((resolve) => {\n // check if folding was cancelled\n if (shouldShowProgress && foldCancelController?.signal.aborted) {\n resolve()\n return\n }\n requestAnimationFrame(() => {\n const endIndex = Math.min(startIndex + collapseBatchSize, foldRanges.length)\n const batch = foldRanges.slice(startIndex, endIndex)\n codeMirrorView.dispatch({\n effects: batch.map((range) => foldEffect.of({ from: range.from, to: range.to }))\n })\n\n if (shouldShowProgress) {\n foldProgress = endIndex\n }\n\n if (endIndex < foldRanges.length) {\n processBatch(endIndex).then(resolve)\n } else {\n resolve()\n }\n })\n })\n }\n\n await processBatch(0)\n if (shouldShowProgress) {\n isFolding = false\n foldProgress = 0\n foldTotal = 0\n foldCancelController = null\n }\n }\n\n function foldRecursive(path: JSONPath = [], recursive: boolean = true) {\n const state = codeMirrorView.state\n const docLength = state.doc.length\n const tree = ensureSyntaxTree(state, docLength, Infinity)\n if (!tree) {\n return\n }\n\n let foldRanges: { from: number; to: number }[] = []\n if (path.length === 0) {\n foldRanges = getFoldRanges(tree, state, undefined, recursive)\n } else {\n // If path is not empty, get the position of the specified path and fold content under it\n const { from: pathStartPos } = findTextLocation(normalization.escapeValue(text), path)\n if (pathStartPos !== undefined && pathStartPos !== 0) {\n foldRanges = getFoldRanges(tree, state, pathStartPos, recursive)\n }\n }\n\n if (foldRanges.length > 0) {\n foldRangesAnimated(foldRanges)\n }\n }\n\n function handleCancelFolding() {\n if (foldCancelController) {\n foldCancelController.abort()\n }\n }\n\n export function expand(path: JSONPath, callback: OnExpand = expandSelf) {\n if (!codeMirrorView) {\n return\n }\n\n try {\n if (path && path.length > 0) {\n // Find the text location of the given JSON path\n const { from } = findTextLocation(normalization.escapeValue(text), path)\n\n if (from !== undefined) {\n // Set selection to the position we want to unfold\n codeMirrorView.dispatch({\n selection: { anchor: from, head: from }\n })\n // Use CodeMirror's unfoldCode command for specific path\n unfoldCode(codeMirrorView)\n }\n } else {\n // When path is empty (expand all)\n unfoldAll(codeMirrorView)\n }\n callback?.(path)\n } catch (err) {\n onError(err as Error)\n }\n }\n\n function handleExpandAll() {\n expand([], () => true)\n }\n\n function handleCollapseAll() {\n collapse([], true)\n }\n\n // modalOpen is true when one of the modals is open.\n // This is used to track whether the editor still has focus\n let modalOpen = false\n\n createFocusTracker({\n onMount,\n onDestroy,\n getWindow: () => getWindow(domTextMode),\n hasFocus: () => (modalOpen && document.hasFocus()) || activeElementIsChildOf(domTextMode),\n onFocus,\n onBlur: () => {\n flush()\n onBlur()\n }\n })\n\n export function patch(operations: JSONPatchDocument): JSONPatchResult {\n return handlePatch(operations, false)\n }\n\n export function handlePatch(operations: JSONPatchDocument, emitChange: boolean): JSONPatchResult {\n debug('handlePatch', operations, emitChange)\n\n const previousJson = parser.parse(text)\n const updatedJson = immutableJSONPatch(previousJson, operations)\n const undo = revertJSONPatch(previousJson, operations)\n const updatedContent = {\n text: parser.stringify(updatedJson, null, indentation) as string\n }\n\n setCodeMirrorContent(updatedContent, emitChange, false)\n\n return {\n json: updatedJson,\n previousJson,\n undo,\n redo: operations\n }\n }\n\n function handleFormat(): boolean {\n debug('format')\n\n if (readOnly) {\n return false\n }\n\n try {\n const updatedJson = parser.parse(text)\n const updatedContent = {\n text: parser.stringify(updatedJson, null, indentation) as string\n }\n\n setCodeMirrorContent(updatedContent, true, false)\n\n askToFormatApplied = askToFormat // reset to the original value\n\n return true\n } catch (err) {\n onError(err as Error)\n }\n\n return false\n }\n\n function handleCompact(): boolean {\n debug('compact')\n\n if (readOnly) {\n return false\n }\n\n try {\n const updatedJson = parser.parse(text)\n const updatedContent = {\n text: parser.stringify(updatedJson) as string\n }\n\n setCodeMirrorContent(updatedContent, true, false)\n\n askToFormatApplied = false\n\n return true\n } catch (err) {\n onError(err as Error)\n }\n\n return false\n }\n\n function handleRepair() {\n debug('repair')\n\n if (readOnly) {\n return\n }\n\n try {\n const updatedContent = {\n text: jsonrepair(text)\n }\n\n setCodeMirrorContent(updatedContent, true, false)\n\n jsonStatus = JSON_STATUS_VALID\n jsonParseError = undefined\n } catch (err) {\n onError(err as Error)\n }\n }\n\n function handleSort() {\n if (readOnly) {\n return\n }\n\n try {\n const json = parser.parse(text)\n\n modalOpen = true\n\n onSortModal({\n id: sortModalId,\n json,\n rootPath: [],\n onSort: async ({ operations }) => {\n debug('onSort', operations)\n handlePatch(operations, true)\n },\n onClose: () => {\n modalOpen = false\n focus()\n }\n })\n } catch (err) {\n onError(err as Error)\n }\n }\n\n /**\n * This method is exposed via JSONEditor.transform\n */\n export function openTransformModal({\n id,\n rootPath,\n onTransform,\n onClose\n }: TransformModalOptions) {\n try {\n const json = parser.parse(text)\n\n modalOpen = true\n\n onTransformModal({\n id: id || transformModalId,\n json,\n rootPath: rootPath || [],\n onTransform: (operations) => {\n if (onTransform) {\n onTransform({\n operations,\n json,\n transformedJson: immutableJSONPatch(json, operations)\n })\n } else {\n debug('onTransform', operations)\n handlePatch(operations, true)\n }\n },\n onClose: () => {\n modalOpen = false\n focus()\n if (onClose) {\n onClose()\n }\n }\n })\n } catch (err) {\n onError(err as Error)\n }\n }\n\n function handleTransform() {\n if (readOnly) {\n return\n }\n\n openTransformModal({\n rootPath: []\n })\n }\n\n function handleToggleSearch() {\n if (codeMirrorView) {\n // TODO: figure out the proper way to detect whether the search panel is open\n if (codeMirrorRef && codeMirrorRef.querySelector('.cm-search')) {\n closeSearchPanel(codeMirrorView)\n } else {\n openSearchPanel(codeMirrorView)\n }\n }\n }\n\n function handleUndo(): boolean {\n if (readOnly) {\n return false\n }\n\n // first flush any pending changes\n flush()\n\n const item = history.undo()\n debug('undo', item)\n if (!isTextHistoryItem(item)) {\n onUndo(item)\n\n return false\n }\n\n codeMirrorView.dispatch({\n annotations: historyAnnotation.of('undo'),\n changes: ChangeSet.fromJSON(item.undo.changes),\n selection: EditorSelection.fromJSON(item.undo.selection),\n scrollIntoView: true\n })\n\n return true\n }\n\n function handleRedo(): boolean {\n if (readOnly) {\n return false\n }\n\n // first flush any pending changes\n flush()\n\n const item = history.redo()\n debug('redo', item)\n if (!isTextHistoryItem(item)) {\n onRedo(item)\n\n return false\n }\n\n codeMirrorView.dispatch({\n annotations: historyAnnotation.of('redo'),\n changes: ChangeSet.fromJSON(item.redo.changes),\n selection: EditorSelection.fromJSON(item.redo.selection),\n scrollIntoView: true\n })\n\n return true\n }\n\n function handleAcceptTooLarge() {\n acceptTooLarge = true\n setCodeMirrorContent(externalContent, true, true)\n }\n\n function handleSwitchToTreeMode() {\n onChangeMode(Mode.tree)\n }\n\n function cancelLoadTooLarge() {\n // copy the latest contents of the text editor again into text\n onChangeCodeMirrorValue()\n }\n\n function handleSelectValidationError(validationError: ValidationError) {\n debug('select validation error', validationError)\n\n const { from, to } = toRichValidationError(validationError)\n if (from === undefined || to === undefined) {\n return\n }\n\n // we take \"to\" as head, not as anchor, because the scrollIntoView will\n // move to the head, and when a large whole object is selected as a whole,\n // we want to scroll to the start of the object and not the end\n setSelection(from, to)\n\n focus()\n }\n\n function handleSelectParseError(parseError: ParseError) {\n debug('select parse error', parseError)\n\n const richParseError = toRichParseError(parseError, false)\n const from = richParseError.from != null ? richParseError.from : 0\n const to = richParseError.to != null ? richParseError.to : 0\n\n // we take \"to\" as head, not as anchor, because the scrollIntoView will\n // move to the head, and when a large whole object is selected as a whole,\n // we want to scroll to the start of the object and not the end\n setSelection(from, to)\n\n focus()\n }\n\n function setSelection(anchor: number, head: number) {\n debug('setSelection', { anchor, head })\n\n if (codeMirrorView) {\n codeMirrorView.dispatch(\n codeMirrorView.state.update({\n selection: { anchor, head },\n scrollIntoView: true\n })\n )\n }\n }\n\n function handleDoubleClick(_event: MouseEvent, view: EditorView) {\n // When the user double-clicked right from a bracket [ or {,\n // select the contents of the array or object\n if (view.state.selection.ranges.length === 1) {\n const range = view.state.selection.ranges[0]\n const selectedText = text.slice(range.from, range.to)\n if (selectedText === '{' || selectedText === '[') {\n const jsmap = jsonSourceMap.parse(text)\n const path = Object.keys(jsmap.pointers).find((path) => {\n const pointer = jsmap.pointers[path]\n return pointer.value?.pos === range.from\n })\n const pointer = jsmap.pointers[path]\n\n if (path && pointer && pointer.value && pointer.valueEnd) {\n debug('pointer found, selecting inner contents of path:', path, pointer)\n const anchor = pointer.value.pos + 1\n const head = pointer.valueEnd.pos - 1\n setSelection(anchor, head)\n }\n }\n }\n }\n\n function createLinter() {\n return linter(linterCallback, { delay: TEXT_MODE_ONCHANGE_DELAY })\n }\n\n function createCodeMirrorView({\n target,\n initialText,\n readOnly,\n indentation\n }: {\n target: HTMLDivElement\n initialText: string\n readOnly: boolean\n indentation: number | string\n }): EditorView {\n debug('Create CodeMirror editor', { readOnly, indentation })\n\n const selection = isValidSelection(externalSelection, initialText)\n ? fromTextSelection(externalSelection)\n : undefined\n\n const state = EditorState.create({\n doc: initialText,\n selection,\n extensions: [\n keymap.of([indentWithTab, formatCompactKeyBinding]),\n linterCompartment.of(createLinter()),\n lintGutter(),\n lineNumbers(),\n highlightActiveLineGutter(),\n highlightSpecialChars(),\n foldGutter(),\n createCustomFoldService(), // custom fold service to handle folding\n drawSelection(),\n dropCursor(),\n EditorState.allowMultipleSelections.of(true),\n indentOnInput(),\n syntaxHighlighting(defaultHighlightStyle, { fallback: true }),\n bracketMatching(),\n closeBrackets(),\n autocompletion(),\n rectangularSelection(),\n crosshairCursor(),\n highlightActiveLine(),\n highlightSelectionMatches(),\n keymap.of([\n ...closeBracketsKeymap,\n ...defaultKeymap,\n ...searchKeymap,\n { key: 'Mod-z', run: handleUndo, preventDefault: true },\n { key: 'Mod-y', mac: 'Mod-Shift-z', run: handleRedo, preventDefault: true },\n { key: 'Ctrl-Shift-z', run: handleRedo, preventDefault: true },\n ...foldKeymap,\n ...completionKeymap,\n ...lintKeymap\n ]),\n highlighter,\n indentationMarkers({ hideFirstIndent: true }),\n EditorView.domEventHandlers({\n dblclick: handleDoubleClick\n }),\n EditorView.updateListener.of((update) => {\n editorState = update.state\n\n if (update.docChanged) {\n const isCustomHistoryEvent = update.transactions.some(\n (transaction) => !!transaction.annotation(historyAnnotation)\n )\n\n if (!isCustomHistoryEvent) {\n historyUpdatesQueue = [...(historyUpdatesQueue ?? []), update]\n }\n\n onChangeCodeMirrorValueDebounced()\n }\n\n if (update.selectionSet) {\n // note that emitOnSelect is invoked in onChangeCodeMirrorValue too,\n // right after firing onChange. Hence, the else if here, we do not want to fire it twice.\n emitOnSelect()\n }\n }),\n jsonLang(),\n search({\n top: true\n }),\n EditorView.lineWrapping,\n readOnlyCompartment.of(EditorState.readOnly.of(readOnly)),\n tabSizeCompartment.of(EditorState.tabSize.of(tabSize)),\n indentCompartment.of(createIndent(indentation)),\n themeCompartment.of(EditorView.theme({}, { dark: hasDarkTheme() }))\n ]\n })\n\n codeMirrorView = new EditorView({\n state,\n parent: target\n })\n\n if (selection) {\n // important to do via dispatch, since that is executed on the next tick.\n // Otherwise, the editor is not scrolled down enough when the statusbar is rendered on the next tick\n codeMirrorView.dispatch(\n codeMirrorView.state.update({\n selection: selection.main,\n scrollIntoView: true // FIXME: scrollIntoView also affects scroll of the main page, possibly causing the main page to scroll when jsoneditor has an initial selection\n })\n )\n }\n\n return codeMirrorView\n }\n\n function getCodeMirrorValue() {\n return codeMirrorView ? normalization.unescapeValue(codeMirrorView.state.doc.toString()) : ''\n }\n\n function hasDarkTheme() {\n return codeMirrorRef\n ? getComputedStyle(codeMirrorRef).getPropertyValue('--jse-theme').includes('dark')\n : false\n }\n\n function isValidSelection(selection: JSONEditorSelection | undefined, text: string): boolean {\n if (!isTextSelection(selection)) {\n return false\n }\n\n return selection.ranges.every((range) => range.anchor < text.length && range.head < text.length)\n }\n\n function toRichValidationError(validationError: ValidationError): RichValidationError {\n const { path, message, severity } = validationError\n const { line, column, from, to } = findTextLocation(normalization.escapeValue(text), path)\n\n return {\n path,\n line,\n column,\n from,\n to,\n message,\n severity,\n actions: []\n }\n }\n\n function toRichParseError(parseError: ParseError, isRepairable: boolean): RichValidationError {\n const { line, column, position, message } = parseError\n\n return {\n path: [] as JSONPath,\n line,\n column,\n from: position,\n to: position,\n severity: ValidationSeverity.error,\n message,\n actions:\n isRepairable && !readOnly\n ? [\n {\n name: '自动修复',\n apply: () => handleRepair()\n }\n ]\n : undefined\n }\n }\n\n function toDiagnostic(error: RichValidationError): Diagnostic {\n return {\n from: error.from || 0,\n to: error.to || 0,\n message: error.message || '',\n actions: error.actions as Diagnostic['actions'],\n severity: error.severity\n }\n }\n\n function setCodeMirrorContent(newContent: Content, emitChange: boolean, forceUpdate: boolean) {\n const newText = getText(newContent, indentation, parser)\n const isChanged = !isEqual(newContent, content)\n const previousContent = content\n\n debug('setCodeMirrorContent', { isChanged, emitChange, forceUpdate })\n\n if (!codeMirrorView || (!isChanged && !forceUpdate)) {\n return\n }\n\n content = newContent\n text = newText\n\n if (!disableTextEditor(text, maxDocumentSize, acceptTooLarge)) {\n // keep state\n // to reset state: codeMirrorView.setState(EditorState.create({doc: text, extensions: ...}))\n codeMirrorView.dispatch({\n changes: {\n from: 0,\n to: codeMirrorView.state.doc.length,\n insert: normalization.escapeValue(text)\n }\n })\n }\n\n addHistoryItem()\n\n if (isChanged && emitChange) {\n emitOnChange(content, previousContent)\n }\n }\n\n function applyExternalSelection(externalSelection: JSONEditorSelection | undefined) {\n if (!isTextSelection(externalSelection)) {\n return\n }\n\n const selection = fromTextSelection(externalSelection)\n if (codeMirrorView && selection && (!editorState || !editorState.selection.eq(selection))) {\n debug('applyExternalSelection', selection)\n\n // note that we cannot clear the selection (we could maybe set the cursor to 0 but that's not really what we want)\n codeMirrorView.dispatch({ selection })\n }\n }\n\n function fromTextSelection(\n selection: JSONEditorSelection | undefined\n ): EditorSelection | undefined {\n return isTextSelection(selection) ? EditorSelection.fromJSON(selection) : undefined\n }\n\n /**\n * Force refreshing the editor, for example after changing the font size\n * to update the positioning of the line numbers in the gutter\n */\n export async function refresh(): Promise<void> {\n debug('refresh')\n\n // update the theme (light/dark), but also, as a side effect,\n // refresh the font size of the line numbers in the gutter\n await updateTheme()\n }\n\n function forceUpdateText() {\n debug('forceUpdateText', { escapeUnicodeCharacters })\n\n if (codeMirrorView) {\n codeMirrorView.dispatch({\n changes: {\n from: 0,\n to: codeMirrorView.state.doc.length,\n insert: normalization.escapeValue(text)\n }\n })\n }\n }\n\n function onChangeCodeMirrorValue() {\n if (!codeMirrorView) {\n return\n }\n\n const codeMirrorText = getCodeMirrorValue()\n\n const isChanged = codeMirrorText !== text\n debug('onChangeCodeMirrorValue', { isChanged })\n if (!isChanged) {\n return\n }\n\n const previousContent = content\n text = codeMirrorText\n content = { text }\n\n addHistoryItem()\n\n emitOnChange(content, previousContent)\n\n // We emit OnSelect on the next tick to cater for the case where\n // the user changes the content directly inside the OnChange callback.\n // This change will be dispatched by Svelte on the next tick. Before\n // that tick, emitOnSelect would be fired based on the \"old\" contents,\n // which may be out of range when the replacement by the user is shorter.\n flushSync()\n emitOnSelect()\n }\n\n function updateLinter(validator: Validator | undefined) {\n debug('updateLinter', validator)\n\n if (!codeMirrorView) {\n return\n }\n\n codeMirrorView.dispatch({\n effects: linterCompartment.reconfigure(createLinter())\n })\n }\n\n function updateIndentation(indentation: number | string) {\n if (codeMirrorView) {\n debug('updateIndentation', indentation)\n\n codeMirrorView.dispatch({\n effects: indentCompartment.reconfigure(createIndent(indentation))\n })\n }\n }\n\n function updateTabSize(tabSize: number) {\n if (codeMirrorView) {\n debug('updateTabSize', tabSize)\n\n codeMirrorView.dispatch({\n effects: tabSizeCompartment.reconfigure(EditorState.tabSize.of(tabSize))\n })\n }\n }\n\n function updateReadOnly(readOnly: boolean) {\n if (codeMirrorView) {\n debug('updateReadOnly', readOnly)\n\n codeMirrorView.dispatch({\n effects: [readOnlyCompartment.reconfigure(EditorState.readOnly.of(readOnly))]\n })\n }\n }\n\n async function updateTheme(): Promise<void> {\n // we check the theme on the next tick, to make sure the page\n // is re-rendered with (possibly) changed CSS variables\n flushSync()\n\n if (codeMirrorView) {\n const dark = hasDarkTheme()\n debug('updateTheme', { dark })\n\n codeMirrorView.dispatch({\n effects: [themeCompartment.reconfigure(EditorView.theme({}, { dark }))]\n })\n\n // resolve on next tick, when code mirror rendering is updated\n return new Promise((resolve) => setTimeout(resolve))\n }\n\n return Promise.resolve()\n }\n\n function createIndent(indentation: number | string): Extension[] {\n const indent = indentUnit.of(\n typeof indentation === 'number' ? ' '.repeat(indentation) : indentation\n )\n\n // We disable wrappedLineIndent in case of tabs to work around a bug:\n // https://github.com/fauzi9331/codemirror-wrapped-line-indent/issues/2\n return indentation === '\\t' ? [indent] : [indent, wrappedLineIndent]\n }\n\n // debounce the input: when pressing Enter at the end of a line, two change\n // events are fired: one with the new Return character, and a second with\n // indentation added on the new line. This causes a race condition when used\n // for example in React. Debouncing the onChange events also results in not\n // firing a change event with every character that a user types, but only as\n // soon as the user stops typing.\n const onChangeCodeMirrorValueDebounced = debounce(\n onChangeCodeMirrorValue,\n TEXT_MODE_ONCHANGE_DELAY\n )\n\n export function flush() {\n onChangeCodeMirrorValueDebounced.flush()\n }\n\n function emitOnChange(content: Content, previousContent: Content) {\n if (onChange) {\n onChange(content, previousContent, {\n contentErrors: validate(),\n patchResult: undefined\n })\n }\n }\n\n function emitOnSelect() {\n onSelect(toTextSelection(editorState.selection))\n }\n\n function toTextSelection(selection: EditorSelection): TextSelection {\n return {\n type: SelectionType.text,\n ...selection.toJSON()\n }\n }\n\n function disableTextEditor(\n text: string,\n maxDocumentSize: number,\n acceptTooLarge: boolean\n ): boolean {\n const tooLarge = text ? text.length > maxDocumentSize : false\n return tooLarge && !acceptTooLarge\n }\n\n let jsonStatus = JSON_STATUS_VALID\n\n let jsonParseError: ParseError | undefined\n\n function linterCallback(): Diagnostic[] {\n if (disableTextEditor(text, maxDocumentSize, acceptTooLarge)) {\n return []\n }\n\n const contentErrors = validate()\n\n if (isContentParseError(contentErrors)) {\n const { parseError, isRepairable } = contentErrors\n\n return [toDiagnostic(toRichParseError(parseError, isRepairable))]\n }\n\n if (isContentValidationErrors(contentErrors)) {\n return contentErrors.validationErrors.map(toRichValidationError).map(toDiagnostic)\n }\n\n return []\n }\n\n export function validate(): ContentErrors | undefined {\n debug('validate:start')\n\n flush()\n\n const contentErrors = memoizedValidateText(\n normalization.escapeValue(text),\n validator,\n parser,\n validationParser\n )\n\n if (isContentParseError(contentErrors)) {\n jsonStatus = contentErrors.isRepairable ? JSON_STATUS_REPAIRABLE : JSON_STATUS_INVALID\n jsonParseError = contentErrors.parseError\n validationErrors = []\n } else {\n jsonStatus = JSON_STATUS_VALID\n jsonParseError = undefined\n validationErrors = contentErrors?.validationErrors || []\n }\n\n debug('validate:end')\n\n return contentErrors\n }\n\n // because onChange returns the validation errors and there is also a separate listener,\n // we would execute validation twice. Memoizing the last result solves this.\n const memoizedValidateText = memoizeOne(validateText)\n\n function handleShowMe() {\n if (jsonParseError) {\n handleSelectParseError(jsonParseError)\n }\n }\n\n const repairActionShowMe = {\n icon: faEye,\n text: '一键定位',\n title: '跳转到解析错误位置',\n onClick: handleShowMe\n }\n\n $: repairActions =\n jsonStatus === JSON_STATUS_REPAIRABLE && !readOnly\n ? [\n {\n icon: faWrench,\n text: '自动修复',\n title: '自动修复JSON',\n onClick: handleRepair\n },\n repairActionShowMe\n ]\n : [repairActionShowMe]\n</script>\n\n<div class=\"jse-text-mode\" class:no-main-menu={!mainMenuBar} bind:this={domTextMode}>\n {#if mainMenuBar}\n {@const isNewDocument = text.length === 0}\n\n <TextMenu\n {readOnly}\n onExpandAll={handleExpandAll}\n onCollapseAll={handleCollapseAll}\n onFormat={handleFormat}\n onCompact={handleCompact}\n onSort={handleSort}\n onTransform={handleTransform}\n onToggleSearch={handleToggleSearch}\n onUndo={handleUndo}\n onRedo={handleRedo}\n canExpandAll={!isNewDocument}\n canCollapseAll={!isNewDocument}\n canFormat={!isNewDocument}\n canCompact={!isNewDocument}\n canSort={!isNewDocument}\n canTransform={!isNewDocument}\n canUndo={history.canUndo}\n canRedo={history.canRedo}\n {onRenderMenu}\n />\n {/if}\n {#if isFolding}\n <div class=\"jse-fold-progress\">\n <span class=\"jse-fold-tip\">正在折叠</span>\n <div class=\"jse-fold-progress-track\">\n <div\n class=\"jse-fold-progress-fill\"\n style=\"width: {foldTotal > 0 ? (foldProgress / foldTotal) * 100 : 0}%\"\n ></div>\n </div>\n <button\n class=\"jse-fold-cancel-button\"\n type=\"button\"\n title=\"取消折叠\"\n on:click={handleCancelFolding}\n >\n 取消\n </button>\n </div>\n {/if}\n {#if !isSSR}\n {@const editorDisabled = disableTextEditor(text, maxDocumentSize, acceptTooLarge)}\n\n <div class=\"jse-contents\" class:jse-hidden={editorDisabled} bind:this={codeMirrorRef}></div>\n\n {#if editorDisabled}\n <Message\n icon={faExclamationTriangle}\n type=\"error\"\n message={`JSON 文档的大小超过了 ${formatSize(maxDocumentSize)},` +\n `可能会在以文本模式加载时导致程序崩溃。实际大小: ${formatSize(text.length)}。`}\n actions={[\n {\n text: '仍然打开',\n title: '在文本模式下打开文档。这可能导致浏览器冻结或崩溃。',\n onClick: handleAcceptTooLarge\n },\n {\n text: '在树形模式下打开',\n title: '在树形模式下打开文档。树形模式可以处理大型文档。',\n onClick: handleSwitchToTreeMode\n },\n {\n text: '取消',\n title: '取消打开此大型文档。',\n onClick: cancelLoadTooLarge\n }\n ]}\n onClose={focus}\n />\n\n <div class=\"jse-contents jse-preview\">\n {truncate(text || '', MAX_CHARACTERS_TEXT_PREVIEW)}\n </div>\n {/if}\n\n {#if !editorDisabled}\n {#if statusBar}\n <StatusBar {editorState} />\n {/if}\n\n {#if jsonParseError}\n <Message\n type=\"error\"\n icon={faExclamationTriangle}\n message={jsonParseError.message}\n actions={repairActions}\n onClick={handleShowMe}\n onClose={focus}\n />\n {/if}\n\n {#if !jsonParseError && askToFormatApplied && needsFormatting(text)}\n <Message\n type=\"success\"\n message=\"您是否想格式化 JSON?\"\n actions={[\n {\n icon: faJSONEditorFormat,\n text: '格式化',\n title: '格式化 JSON:添加适当的缩进和换行 (Ctrl+I)',\n onClick: handleFormat\n },\n {\n icon: faTimes,\n text: '不了,谢谢',\n title: '关闭此消息',\n onClick: () => (askToFormatApplied = false)\n }\n ]}\n onClose={focus}\n />\n {/if}\n\n <ValidationErrorsOverview {validationErrors} selectError={handleSelectValidationError} />\n {/if}\n {:else}\n <div class=\"jse-contents\">\n <div class=\"jse-loading-space\"></div>\n <div class=\"jse-loading\">加载中...</div>\n </div>\n {/if}\n</div>\n\n<style src=\"./TextMode.scss\"></style>\n","<svelte:options immutable={true} />\n\n<script lang=\"ts\">\n import {\n faFilter,\n faRedo,\n faSearch,\n faSortAmountDownAlt,\n faUndo\n } from '@fortawesome/free-solid-svg-icons'\n import {\n faJSONEditorCollapse,\n faJSONEditorCompact,\n faJSONEditorExpand,\n faJSONEditorFormat\n } from '$lib/img/customFontawesomeIcons.js'\n import Menu from '../../../controls/Menu.svelte'\n import type { MenuItem, OnRenderMenuInternal } from '$lib/types'\n\n export let readOnly = false\n export let onExpandAll: () => void\n export let onCollapseAll: () => void\n export let onFormat: () => boolean\n export let onCompact: () => boolean\n export let onSort: () => void\n export let onTransform: () => void\n export let onToggleSearch: () => void\n export let onUndo: () => void\n export let onRedo: () => void\n export let canExpandAll: boolean\n export let canCollapseAll: boolean\n export let canUndo: boolean\n export let canRedo: boolean\n export let canFormat: boolean\n export let canCompact: boolean\n export let canSort: boolean\n export let canTransform: boolean\n export let onRenderMenu: OnRenderMenuInternal\n\n let expandMenuItem: MenuItem\n $: expandMenuItem = {\n type: 'button',\n icon: faJSONEditorExpand,\n title: '展开所有',\n className: 'jse-expand-all',\n onClick: onExpandAll,\n disabled: !canExpandAll\n }\n\n let collapseMenuItem: MenuItem\n $: collapseMenuItem = {\n type: 'button',\n icon: faJSONEditorCollapse,\n title: '折叠所有',\n className: 'jse-collapse-all',\n onClick: onCollapseAll,\n disabled: !canCollapseAll\n }\n\n const searchItem: MenuItem = {\n type: 'button',\n icon: faSearch,\n title: '搜索 (Ctrl+F)',\n className: 'jse-search',\n onClick: onToggleSearch\n }\n\n let defaultItems: MenuItem[]\n $: defaultItems = !readOnly\n ? [\n expandMenuItem,\n collapseMenuItem,\n {\n type: 'separator'\n },\n {\n type: 'button',\n icon: faJSONEditorFormat,\n title: '格式化JSON:添加适当的缩进和新行 (Ctrl+I)',\n className: 'jse-format',\n onClick: onFormat,\n disabled: readOnly || !canFormat\n },\n {\n type: 'button',\n icon: faJSONEditorCompact,\n title: '压缩JSON:删除所有空格和换行 (Ctrl+Shift+I)',\n className: 'jse-compact',\n onClick: onCompact,\n disabled: readOnly || !canCompact\n },\n {\n type: 'separator'\n },\n {\n type: 'button',\n icon: faSortAmountDownAlt,\n title: '排序',\n className: 'jse-sort',\n onClick: onSort,\n disabled: readOnly || !canSort\n },\n {\n type: 'button',\n icon: faFilter,\n title: '转换内容 (过滤, 排序, 分类)',\n className: 'jse-transform',\n onClick: onTransform,\n disabled: readOnly || !canTransform\n },\n searchItem,\n {\n type: 'separator'\n },\n {\n type: 'button',\n icon: faUndo,\n title: '撤销 (Ctrl+Z)',\n className: 'jse-undo',\n onClick: onUndo,\n disabled: !canUndo\n },\n {\n type: 'button',\n icon: faRedo,\n title: '重做 (Ctrl+Shift+Z)',\n className: 'jse-redo',\n onClick: onRedo,\n disabled: !canRedo\n },\n {\n type: 'space'\n }\n ]\n : [\n expandMenuItem,\n collapseMenuItem,\n {\n type: 'separator'\n },\n searchItem,\n {\n type: 'space'\n }\n ]\n\n // eslint-disable-next-line svelte/no-unused-svelte-ignore\n // svelte-ignore reactive_declaration_non_reactive_property\n $: items = onRenderMenu(defaultItems) || defaultItems\n</script>\n\n<Menu {items} />\n","<script lang=\"ts\">\n import type { EditorState, Line } from '@codemirror/state'\n\n export let editorState: EditorState | undefined\n\n let pos: number | undefined\n $: pos = editorState?.selection?.main?.head\n\n let line: Line | undefined\n $: line = pos !== undefined ? editorState?.doc?.lineAt(pos) : undefined\n\n let lineNumber: number | undefined\n $: lineNumber = line !== undefined ? line.number : undefined\n\n let columnNumber: number | undefined\n $: columnNumber = line !== undefined && pos !== undefined ? pos - line.from + 1 : undefined\n\n let charCount: number | undefined\n $: charCount = editorState?.selection?.ranges?.reduce((count, range) => {\n return count + range.to - range.from\n }, 0)\n</script>\n\n<div class=\"jse-status-bar\">\n {#if lineNumber !== undefined}\n <div class=\"jse-status-bar-info\">行: {lineNumber}</div>\n {/if}\n\n {#if columnNumber !== undefined}\n <div class=\"jse-status-bar-info\">列: {columnNumber}</div>\n {/if}\n\n {#if charCount !== undefined && charCount > 0}\n <div class=\"jse-status-bar-info\">选择: {charCount} 个字符</div>\n {/if}\n</div>\n\n<style src=\"./StatusBar.scss\"></style>\n","<script lang=\"ts\">\n import type { JSONPath } from 'immutable-json-patch'\n import { getIn, isJSONArray, isJSONObject } from 'immutable-json-patch'\n import type { JSONParser, OnChangeMode } from '$lib/types.js'\n import { Mode } from '$lib/types.js'\n import { valueType } from '$lib/utils/typeUtils.js'\n import { findNestedArrays } from '$lib/logic/table.js'\n import { isEmpty } from 'lodash-es'\n import { stringifyJSONPath } from '$lib/utils/pathUtils.js'\n\n interface Props {\n text: string | undefined\n json: unknown | undefined\n readOnly: boolean\n parser: JSONParser\n openJSONEditorModal: (path: JSONPath) => void\n extractPath: (path: JSONPath) => void\n onChangeMode: OnChangeMode\n onClick: () => void\n }\n\n const {\n text,\n json,\n readOnly,\n parser,\n openJSONEditorModal,\n extractPath,\n onChangeMode,\n onClick\n }: Props = $props()\n\n const nestedArrayPaths: JSONPath[] = $derived(\n json\n ? findNestedArrays(json)\n .slice(0, 99)\n .filter((path) => path.length > 0)\n : []\n )\n const hasNestedArrays = $derived(!isEmpty(nestedArrayPaths))\n const isEmptyDocument = $derived(json === undefined && (text === '' || text === undefined))\n\n const documentType = $derived(\n hasNestedArrays\n ? '包含嵌套数组的对象'\n : isEmptyDocument\n ? '空文档'\n : isJSONObject(json)\n ? '对象'\n : isJSONArray(json)\n ? '空数组' // note: can also be an array with objects but without properties\n : `${valueType(json, parser)}`\n )\n\n function countItems(nestedArrayPath: JSONPath): number {\n return (getIn(json, nestedArrayPath) as JSONPath).length\n }\n</script>\n\n<div class=\"jse-table-mode-welcome\" onclick={() => onClick()} role=\"none\">\n <div class=\"jse-space jse-before\"></div>\n\n <div class=\"jse-nested-arrays\">\n <div class=\"jse-nested-arrays-title\">{documentType}</div>\n <div class=\"jse-nested-arrays-info\">\n {#if hasNestedArrays}\n 对象无法在表格模式下打开。你可以打开嵌套的数组,或者在树形模式下打开文档。\n {:else if isEmptyDocument && !readOnly}\n 空文档无法在表格模式下打开。你可以切换到树形模式,或使用 <b>Ctrl+V</b> 粘贴 JSON 数组。\n {:else}\n {documentType} 无法在表格模式下打开。你可以在树形模式下打开文档。\n {/if}\n </div>\n {#each nestedArrayPaths as nestedArrayPath}\n {@const count = countItems(nestedArrayPath)}\n\n <div class=\"jse-nested-property\">\n <div class=\"jse-nested-property-path\">\n \"{stringifyJSONPath(nestedArrayPath)}\"\n <span class=\"jse-nested-property-count\">({count} 项)</span>\n </div>\n\n <button\n type=\"button\"\n class=\"jse-nested-array-action\"\n onclick={() => openJSONEditorModal(nestedArrayPath)}\n >\n {readOnly ? '查看' : '编辑'}\n </button>\n {#if !readOnly}\n <button\n type=\"button\"\n class=\"jse-nested-array-action\"\n onclick={() => extractPath(nestedArrayPath)}\n >\n 提取\n </button>\n {/if}\n </div>\n {/each}\n <button type=\"button\" class=\"jse-nested-array-action\" onclick={() => onChangeMode(Mode.tree)}>\n 切换到树形模式\n </button>\n </div>\n\n <div class=\"jse-space jse-after\"></div>\n</div>\n\n<style src=\"./TableModeWelcome.scss\"></style>\n","<svelte:options immutable={true} />\n\n<script lang=\"ts\">\n import type {\n AbsolutePopupContext,\n AbsolutePopupOptions,\n AfterPatchCallback,\n Content,\n ContentErrors,\n ContextMenuItem,\n DocumentState,\n History,\n HistoryItem,\n JSONEditorContext,\n JSONEditorSelection,\n JSONParser,\n JSONPatchResult,\n JSONRepairModalProps,\n JSONSelection,\n OnBlur,\n OnChange,\n OnChangeMode,\n OnFocus,\n OnJSONEditorModal,\n OnRedo,\n OnRenderContextMenuInternal,\n OnRenderMenuInternal,\n OnRenderValue,\n OnSelect,\n OnSortModal,\n OnTransformModal,\n OnUndo,\n ParseError,\n PastedJson,\n ScrollToOptions,\n SearchResultDetails,\n SearchResults,\n SortedColumn,\n TransformModalOptions,\n ValidationError,\n Validator,\n ValueNormalization\n } from '$lib/types'\n import { Mode, SortDirection, ValidationSeverity } from '$lib/types.js'\n import TableMenu from './menu/TableMenu.svelte'\n import {\n compileJSONPointer,\n existsIn,\n getIn,\n immutableJSONPatch,\n isJSONArray,\n type JSONPatchDocument,\n type JSONPath\n } from 'immutable-json-patch'\n import {\n isTextContent,\n normalizeJsonParseError,\n parseAndRepair,\n parsePartialJson,\n repairPartialJson\n } from '../../../utils/jsonUtils.js'\n import {\n calculateAbsolutePosition,\n calculateVisibleSection,\n clearSortedColumnWhenAffectedByOperations,\n getColumns,\n groupValidationErrors,\n maintainColumnOrder,\n mergeValidationErrors,\n selectNextColumn,\n selectNextRow,\n selectPreviousColumn,\n selectPreviousRow,\n toTableCellPosition\n } from '$lib/logic/table.js'\n import { isEmpty, isEqual, uniqueId } from 'lodash-es'\n import {\n activeElementIsChildOf,\n createNormalizationFunctions,\n encodeDataPath,\n findParentWithNodeName,\n getDataPathFromTarget,\n getWindow,\n isChildOf\n } from '$lib/utils/domUtils.js'\n import { createDebug } from '$lib/utils/debug.js'\n import {\n createDocumentState,\n documentStatePatch,\n getEnforceString,\n getInRecursiveState,\n setInDocumentState,\n syncDocumentState\n } from '$lib/logic/documentState.js'\n import { isObjectOrArray, isUrl, stringConvert } from '$lib/utils/typeUtils.js'\n import InlineValue from './tag/InlineValue.svelte'\n import {\n createNestedValueOperations,\n extract,\n revertJSONPatchWithMoveOperations\n } from '$lib/logic/operations.js'\n import {\n createValueSelection,\n getAnchorPath,\n getFocusPath,\n isEditingSelection,\n isJSONSelection,\n isValueSelection,\n pathInSelection,\n pathStartsWith,\n removeEditModeFromSelection\n } from '$lib/logic/selection.js'\n import ColumnHeader from './ColumnHeader.svelte'\n import { sortJson } from '$lib/logic/sort.js'\n import { keyComboFromEvent } from '$lib/utils/keyBindings.js'\n import { createFocusTracker } from '$lib/components/controls/createFocusTracker.js'\n import { flushSync, getContext, onDestroy, onMount } from 'svelte'\n import { jsonrepair } from 'jsonrepair'\n import Message from '../../controls/Message.svelte'\n import { faCheck, faCode, faWrench } from '@fortawesome/free-solid-svg-icons'\n import { measure } from '$lib/utils/timeUtils.js'\n import memoizeOne from 'memoize-one'\n import { validateJSON } from '$lib/logic/validation.js'\n import ValidationErrorsOverview from '../../controls/ValidationErrorsOverview.svelte'\n import {\n CONTEXT_MENU_HEIGHT,\n CONTEXT_MENU_WIDTH,\n SCROLL_DURATION,\n SEARCH_BOX_HEIGHT\n } from '$lib/constants.js'\n import { noop } from '$lib/utils/noop.js'\n import { createJump } from '$lib/assets/jump.js/src/jump.js'\n import ValidationErrorIcon from '../treemode/ValidationErrorIcon.svelte'\n import {\n onCopy,\n onCut,\n onDuplicateRow,\n onInsertAfterRow,\n onInsertBeforeRow,\n onInsertCharacter,\n onPaste,\n onRemove,\n onRemoveRow\n } from '$lib/logic/actions.js'\n import JSONRepairModal from '../../modals/JSONRepairModal.svelte'\n import { resizeObserver } from '$lib/actions/resizeObserver.js'\n import CopyPasteModal from '../../../components/modals/CopyPasteModal.svelte'\n import ContextMenuPointer from '../../../components/controls/contextmenu/ContextMenuPointer.svelte'\n import SearchBox from '../../controls/SearchBox.svelte'\n import TableModeWelcome from './TableModeWelcome.svelte'\n import JSONPreview from '../../controls/JSONPreview.svelte'\n import RefreshColumnHeader from './RefreshColumnHeader.svelte'\n import createTableContextMenuItems from './contextmenu/createTableContextMenuItems'\n import ContextMenu from '../../controls/contextmenu/ContextMenu.svelte'\n import { flattenSearchResults, toRecursiveSearchResults } from '$lib/logic/search.js'\n import JSONValue from '../treemode/JSONValue.svelte'\n import { isTreeHistoryItem } from 'svelte-jsoneditor'\n\n const debug = createDebug('jsoneditor:TableMode')\n const { openAbsolutePopup, closeAbsolutePopup } =\n getContext<AbsolutePopupContext>('absolute-popup')\n const jump = createJump()\n const sortModalId = uniqueId()\n const transformModalId = uniqueId()\n\n const isSSR = typeof window === 'undefined'\n debug('isSSR:', isSSR)\n\n export let readOnly: boolean\n export let externalContent: Content\n export let externalSelection: JSONEditorSelection | undefined\n export let history: History<HistoryItem>\n export let truncateTextSize: number\n export let mainMenuBar: boolean\n export let escapeControlCharacters: boolean\n export let escapeUnicodeCharacters: boolean\n export let flattenColumns: boolean\n export let parser: JSONParser\n export let parseMemoizeOne: JSONParser['parse']\n export let validator: Validator | undefined\n export let validationParser: JSONParser\n export let indentation: number | string\n export let onChange: OnChange\n export let onChangeMode: OnChangeMode\n export let onSelect: OnSelect\n export let onUndo: OnUndo\n export let onRedo: OnRedo\n export let onRenderValue: OnRenderValue\n export let onRenderMenu: OnRenderMenuInternal\n export let onRenderContextMenu: OnRenderContextMenuInternal\n export let onFocus: OnFocus\n export let onBlur: OnBlur\n export let onSortModal: OnSortModal\n export let onTransformModal: OnTransformModal\n export let onJSONEditorModal: OnJSONEditorModal\n\n let normalization: ValueNormalization\n $: normalization = createNormalizationFunctions({\n escapeControlCharacters,\n escapeUnicodeCharacters\n })\n\n let refJsonEditor: HTMLDivElement\n let refContents: HTMLDivElement | undefined\n let refHiddenInput: HTMLInputElement\n\n let jsonRepairModalProps: JSONRepairModalProps | undefined = undefined\n\n createFocusTracker({\n onMount,\n onDestroy,\n getWindow: () => getWindow(refJsonEditor),\n hasFocus: () => (modalOpen && document.hasFocus()) || activeElementIsChildOf(refJsonEditor),\n onFocus: () => {\n hasFocus = true\n if (onFocus) {\n onFocus()\n }\n },\n onBlur: () => {\n hasFocus = false\n if (onBlur) {\n onBlur()\n }\n }\n })\n\n let json: unknown | undefined\n let text: string | undefined\n let parseError: ParseError | undefined = undefined\n\n let pastedJson: PastedJson | undefined\n let pastedMultilineText: string | undefined\n\n let searchResultDetails: SearchResultDetails | undefined\n let searchResults: SearchResults | undefined\n let showSearch = false\n let showReplace = false\n\n $: applySearchBoxSpacing(showSearch)\n\n function applySearchBoxSpacing(showSearch: boolean) {\n if (!refContents) {\n return\n }\n\n const offset = showSearch ? SEARCH_BOX_HEIGHT : -SEARCH_BOX_HEIGHT\n refContents.scrollTo({\n top: (refContents.scrollTop += offset),\n left: refContents.scrollLeft\n })\n }\n\n function handleSearch(result: SearchResultDetails | undefined) {\n searchResultDetails = result\n searchResults = searchResultDetails\n ? toRecursiveSearchResults(json, searchResultDetails.items)\n : undefined\n }\n\n async function handleFocusSearch(path: JSONPath) {\n selection = undefined // navigation path of current selection would be confusing\n await scrollTo(path)\n }\n\n function handleCloseSearch() {\n showSearch = false\n showReplace = false\n focus()\n }\n\n $: applyExternalContent(externalContent)\n $: applyExternalSelection(externalSelection)\n\n let maxSampleCount = 10_000\n let columns: JSONPath[] = []\n $: columns = isJSONArray(json)\n ? maintainColumnOrder(getColumns(json, flattenColumns, maxSampleCount), columns)\n : []\n\n let containsValidArray: boolean\n $: containsValidArray = !!(json && !isEmpty(columns))\n $: showRefreshButton = Array.isArray(json) && json.length > maxSampleCount\n\n // modalOpen is true when one of the modals is open.\n // This is used to track whether the editor still has focus\n let modalOpen = false\n\n let hasFocus = false\n let copyPasteModalOpen = false\n\n let itemHeightsCache: Record<number, number> = {}\n\n let viewPortHeight = 600\n let scrollTop = 0\n let defaultItemHeight = 18 // px\n\n $: visibleSection = calculateVisibleSection(\n scrollTop,\n viewPortHeight,\n json,\n itemHeightsCache, // warning: itemHeightsCache is mutated and is not responsive itself\n defaultItemHeight,\n showSearch ? SEARCH_BOX_HEIGHT : 0\n )\n\n $: refreshScrollTop(json)\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n function refreshScrollTop(_json: unknown | undefined) {\n // When the contents go from lots of items and scrollable contents to only a few items and\n // no vertical scroll, the actual scrollTop changes to 0 but there is no on:scroll event\n // triggered, so the internal scrollTop variable is not up-to-date.\n // This is a workaround to update the scrollTop by triggering an on:scroll event\n if (refContents) {\n refContents.scrollTo({\n top: refContents.scrollTop,\n left: refContents.scrollLeft\n })\n }\n }\n\n function handleSelect(updatedSelection: JSONSelection | undefined) {\n selection = updatedSelection\n }\n\n function emitOnSelect(updatedSelection: JSONSelection | undefined) {\n if (!isEqual(updatedSelection, externalSelection)) {\n debug('onSelect', updatedSelection)\n onSelect(updatedSelection)\n }\n }\n\n $: emitOnSelect(selection)\n\n function clearSelectionWhenNotExisting(json: unknown | undefined) {\n if (!selection || json === undefined) {\n return\n }\n\n if (existsIn(json, getAnchorPath(selection)) && existsIn(json, getFocusPath(selection))) {\n return\n }\n\n debug('clearing selection: path does not exist anymore', selection)\n selection = undefined // TODO: try find the closest cell that still exists (similar to getInitialSelection)\n }\n\n let documentState: DocumentState | undefined =\n json !== undefined ? createDocumentState({ json }) : undefined\n let selection: JSONSelection | undefined = isJSONSelection(externalSelection)\n ? externalSelection\n : undefined\n let sortedColumn: SortedColumn | undefined\n let textIsRepaired = false\n\n onMount(() => {\n if (selection) {\n scrollIntoView(getFocusPath(selection))\n }\n })\n\n function onSortByHeader(newSortedColumn: SortedColumn) {\n if (readOnly) {\n return\n }\n\n debug('onSortByHeader', newSortedColumn)\n\n const rootPath: JSONPath = []\n const direction = newSortedColumn.sortDirection === SortDirection.desc ? -1 : 1\n const operations = sortJson(json, rootPath, newSortedColumn.path, direction)\n handlePatch(operations, (_, patchedState) => {\n return {\n state: patchedState,\n sortedColumn: newSortedColumn\n }\n })\n }\n\n let context: JSONEditorContext\n $: context = {\n mode: Mode.table,\n readOnly,\n truncateTextSize,\n parser,\n normalization,\n getJson: () => json,\n getDocumentState: () => documentState,\n findElement,\n findNextInside,\n focus,\n onPatch: (operations, afterPatch) => {\n // When having flattened table columns and having inserted a new row, it is possible that\n // we edit a nested value of which the parent object is not existing. Therefore, we call\n // replaceNestedValue to create the parent object(s) first.\n return handlePatch(createNestedValueOperations(operations, json), afterPatch)\n },\n onSelect: handleSelect,\n onFind: openFind,\n onPasteJson: handlePasteJson,\n onRenderValue\n }\n\n function applyExternalContent(content: Content) {\n const currentContent = { json }\n const isChanged = isTextContent(content)\n ? content.text !== text\n : !isEqual(currentContent.json, content.json)\n\n debug('update external content', { isChanged })\n\n if (!isChanged) {\n // no actual change, don't do anything\n return\n }\n\n const previousState = { json, documentState, selection, sortedColumn, text, textIsRepaired }\n\n if (isTextContent(content)) {\n try {\n json = parseMemoizeOne(content.text)\n documentState = syncDocumentState(json, documentState)\n text = content.text\n textIsRepaired = false\n parseError = undefined\n } catch (err) {\n try {\n json = parseMemoizeOne(jsonrepair(content.text))\n documentState = syncDocumentState(json, documentState)\n text = content.text\n textIsRepaired = true\n parseError = undefined\n } catch {\n // no valid JSON, will show empty document or invalid json\n json = undefined\n documentState = undefined\n text = content.text\n textIsRepaired = false\n parseError =\n text !== ''\n ? normalizeJsonParseError(text, (err as Error).message || String(err))\n : undefined\n }\n }\n } else {\n json = content.json\n documentState = syncDocumentState(json, documentState)\n text = undefined\n textIsRepaired = false\n parseError = undefined\n }\n\n // make sure the selection is valid\n clearSelectionWhenNotExisting(json)\n\n // reset the sorting order (we don't know...)\n sortedColumn = undefined\n\n addHistoryItem(previousState)\n }\n\n function applyExternalSelection(externalSelection: JSONEditorSelection | undefined) {\n if (isEqual(selection, externalSelection)) {\n return\n }\n\n debug('applyExternalSelection', { selection, externalSelection })\n\n if (isJSONSelection(externalSelection)) {\n selection = externalSelection\n }\n }\n\n interface PreviousState {\n json: unknown | undefined\n text: string | undefined\n documentState: DocumentState | undefined\n selection: JSONSelection | undefined\n textIsRepaired: boolean\n sortedColumn: SortedColumn | undefined\n }\n\n function addHistoryItem(previous: PreviousState) {\n if (previous.json === undefined && previous.text === undefined) {\n // initialization -> do not create a history item\n return\n }\n\n const canPatch = json !== undefined && previous.json !== undefined\n\n history.add({\n type: 'tree',\n undo: {\n patch: canPatch ? [{ op: 'replace', path: '', value: previous.json }] : undefined,\n json: previous.json,\n text: previous.text,\n documentState: previous.documentState,\n textIsRepaired: previous.textIsRepaired,\n selection: removeEditModeFromSelection(previous.selection),\n sortedColumn: previous.sortedColumn\n },\n redo: {\n patch: canPatch ? [{ op: 'replace', path: '', value: json }] : undefined,\n json,\n text,\n documentState,\n textIsRepaired,\n selection: removeEditModeFromSelection(selection),\n sortedColumn\n }\n })\n }\n\n let validationErrors: ValidationError[] = []\n $: updateValidationErrors(json, validator, parser, validationParser)\n $: groupedValidationErrors = groupValidationErrors(validationErrors, columns)\n\n // because onChange returns the validation errors and there is also a separate listener,\n // we would execute validation twice. Memoizing the last result solves this.\n const memoizedValidate = memoizeOne(validateJSON)\n\n function updateValidationErrors(\n json: unknown,\n validator: Validator | undefined,\n parser: JSONParser,\n validationParser: JSONParser\n ) {\n measure(\n () => {\n let newValidationErrors: ValidationError[]\n try {\n newValidationErrors = memoizedValidate(json, validator, parser, validationParser)\n } catch (err) {\n newValidationErrors = [\n {\n path: [],\n message: '验证失败: ' + (err as Error).message,\n severity: ValidationSeverity.warning\n }\n ]\n }\n\n if (!isEqual(newValidationErrors, validationErrors)) {\n debug('validationErrors changed:', newValidationErrors)\n validationErrors = newValidationErrors\n }\n },\n (duration) => debug(`validationErrors updated in ${duration} ms`)\n )\n }\n\n export function validate(): ContentErrors | undefined {\n debug('validate')\n\n if (parseError) {\n return {\n parseError,\n isRepairable: false // not applicable, if repairable, we will not have a parseError\n }\n }\n\n // make sure the validation results are up-to-date\n // normally, they are only updated on the next tick after the json is changed\n updateValidationErrors(json, validator, parser, validationParser)\n return !isEmpty(validationErrors) ? { validationErrors } : undefined\n }\n\n export function patch(\n operations: JSONPatchDocument,\n afterPatch?: AfterPatchCallback\n ): JSONPatchResult {\n debug('patch', operations, afterPatch)\n\n if (json === undefined) {\n throw new Error('Cannot apply patch: no JSON')\n }\n\n const previousJson = json\n const previousState: PreviousState = {\n json: undefined, // not needed: we use patch to reconstruct the json\n text,\n documentState,\n selection: removeEditModeFromSelection(selection),\n sortedColumn,\n textIsRepaired\n }\n\n // execute the patch operations\n const undo: JSONPatchDocument = revertJSONPatchWithMoveOperations(\n json,\n operations\n ) as JSONPatchDocument\n const patched = documentStatePatch(json, documentState, operations)\n\n // Clear the sorted column when needed. We need to do this before `afterPatch`,\n // else we clear any changed made in the callback. It is a bit odd that\n // afterPatch does not receive the actual previousDocumentState. Better ideas?\n const patchedSortedColumn = clearSortedColumnWhenAffectedByOperations(\n sortedColumn,\n operations,\n columns\n )\n\n const callback =\n typeof afterPatch === 'function'\n ? afterPatch(patched.json, patched.documentState, selection)\n : undefined\n\n json = callback?.json !== undefined ? callback.json : patched.json\n documentState = callback?.state !== undefined ? callback.state : patched.documentState\n selection = callback?.selection !== undefined ? callback.selection : selection\n sortedColumn =\n callback?.sortedColumn !== undefined ? callback.sortedColumn : patchedSortedColumn\n text = undefined\n textIsRepaired = false\n pastedJson = undefined\n pastedMultilineText = undefined\n parseError = undefined\n\n history.add({\n type: 'tree',\n undo: {\n patch: undo,\n ...previousState\n },\n redo: {\n patch: operations,\n json: undefined, // not needed: we use patch to reconstruct the json\n text: undefined,\n documentState,\n selection: removeEditModeFromSelection(selection),\n sortedColumn,\n textIsRepaired\n }\n })\n\n return {\n json,\n previousJson,\n undo,\n redo: operations\n }\n }\n\n function handlePatch(\n operations: JSONPatchDocument,\n afterPatch?: AfterPatchCallback\n ): JSONPatchResult {\n debug('handlePatch', operations, afterPatch)\n\n const previousContent = { json, text }\n const patchResult = patch(operations, afterPatch)\n\n emitOnChange(previousContent, patchResult)\n\n return patchResult\n }\n\n function emitOnChange(previousContent: Content, patchResult: JSONPatchResult | undefined) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n if (previousContent.json === undefined && previousContent?.text === undefined) {\n // initialization -> do not fire an onChange event\n return\n }\n\n // make sure we cannot send an invalid contents like having both\n // json and text defined, or having none defined\n if (onChange) {\n if (text !== undefined) {\n const content = { text, json: undefined }\n onChange(content, previousContent, {\n contentErrors: validate(),\n patchResult\n })\n } else if (json !== undefined) {\n const content = { text: undefined, json }\n onChange(content, previousContent, {\n contentErrors: validate(),\n patchResult\n })\n }\n }\n }\n\n function handlePasteJson(newPastedJson: PastedJson) {\n debug('pasted json as text', newPastedJson)\n\n pastedJson = newPastedJson\n }\n\n function handlePasteMultilineText(pastedText: string) {\n debug('pasted multiline text', { pastedText })\n\n pastedMultilineText = pastedText\n }\n\n function findNextInside(path: JSONPath): JSONSelection {\n const index = parseInt(path[0], 10)\n const nextPath = [String(index + 1), ...path.slice(1)]\n\n return existsIn(json, nextPath) ? createValueSelection(nextPath) : createValueSelection(path)\n }\n\n export function focus() {\n debug('focus')\n // with just .focus(), sometimes the input doesn't react on onpaste events\n // in Chrome when having a large document open and then doing cut/paste.\n // Calling both .focus() and .select() did solve this issue.\n if (refHiddenInput) {\n refHiddenInput.focus()\n refHiddenInput.select()\n }\n }\n\n function handleWindowMouseDown(event: MouseEvent & { currentTarget: EventTarget & Window }) {\n const outsideEditor = !isChildOf(\n event.target as Element,\n (element) => element === refJsonEditor\n )\n if (outsideEditor) {\n if (isEditingSelection(selection)) {\n debug('click outside the editor, exit edit mode')\n selection = removeEditModeFromSelection(selection)\n\n if (hasFocus && refHiddenInput) {\n refHiddenInput.focus()\n refHiddenInput.blur()\n }\n\n debug('blur (outside editor)')\n if (refHiddenInput) {\n refHiddenInput.blur()\n }\n }\n }\n }\n\n function handleScroll(event: Event) {\n scrollTop = (event.target as HTMLElement)['scrollTop']\n }\n\n function handleMouseDown(event: MouseEvent) {\n // only handle when the left or right mouse button is pressed, not the middle mouse button (scroll wheel)\n if (event.buttons !== 1 && event.buttons !== 2) {\n return\n }\n\n const target = event.target as HTMLElement\n if (!target.isContentEditable) {\n focus()\n }\n\n const path = getDataPathFromTarget(target)\n if (path) {\n // when clicking inside the current selection, editing a value, do nothing\n if (isEditingSelection(selection) && pathInSelection(json, selection, path)) {\n return\n }\n\n selection = createValueSelection(path)\n\n event.preventDefault()\n }\n }\n\n function createDefaultSelection(): JSONSelection | undefined {\n if (isJSONArray(json) && !isEmpty(json) && !isEmpty(columns)) {\n // Select the first row, first column\n const path = ['0', ...columns[0]]\n\n return createValueSelection(path)\n } else {\n return undefined\n }\n }\n\n function createDefaultSelectionWhenUndefined() {\n if (!selection) {\n selection = createDefaultSelection()\n }\n }\n\n export function acceptAutoRepair() {\n if (textIsRepaired && json !== undefined) {\n const previousContent = { json, text }\n const previousState = { json, documentState, selection, sortedColumn, text, textIsRepaired }\n\n // json stays as is\n text = undefined\n textIsRepaired = false\n\n clearSelectionWhenNotExisting(json)\n\n addHistoryItem(previousState)\n\n // we could work out a patchResult, or use patch(), but only when the previous and new\n // contents are both json and not text. We go for simplicity and consistency here and\n // do _not_ return a patchResult ever.\n const patchResult = undefined\n\n emitOnChange(previousContent, patchResult)\n }\n\n return { json, text }\n }\n\n /**\n * Scroll the window vertically to the node with given path.\n * Expand the path when needed.\n */\n export function scrollTo(\n path: JSONPath,\n { scrollToWhenVisible = true }: ScrollToOptions = {}\n ): Promise<void> {\n const searchBoxHeight = showSearch ? SEARCH_BOX_HEIGHT : 0\n const top = calculateAbsolutePosition(path, columns, itemHeightsCache, defaultItemHeight)\n const roughDistance = top - scrollTop + searchBoxHeight + defaultItemHeight\n const elem = findElement(path)\n\n debug('scrollTo', { path, top, scrollTop, elem })\n\n if (!refContents) {\n return Promise.resolve()\n }\n\n const viewPortRect = refContents.getBoundingClientRect()\n if (elem && !scrollToWhenVisible) {\n const elemRect = elem.getBoundingClientRect()\n if (elemRect.bottom > viewPortRect.top && elemRect.top < viewPortRect.bottom) {\n // element is fully or partially visible, don't scroll to it\n return Promise.resolve()\n }\n }\n\n const offset = -Math.max(searchBoxHeight + 2 * defaultItemHeight, viewPortRect.height / 4)\n\n if (elem) {\n return new Promise((resolve) => {\n jump(elem, {\n container: refContents,\n offset,\n duration: SCROLL_DURATION,\n callback: () => {\n // TODO: improve horizontal scrolling: animate and integrate with the vertical scrolling (jump)\n scrollToHorizontal(path)\n resolve()\n }\n })\n })\n } else {\n return new Promise((resolve) => {\n jump(roughDistance, {\n container: refContents,\n offset,\n duration: SCROLL_DURATION,\n callback: () => {\n // ensure the element is rendered now that it is scrolled into view\n flushSync()\n\n // TODO: improve horizontal scrolling: animate and integrate with the vertical scrolling (jump)\n scrollToHorizontal(path)\n resolve()\n }\n })\n })\n }\n }\n\n function scrollToVertical(path: JSONPath) {\n if (!refContents) {\n return\n }\n\n const { rowIndex } = toTableCellPosition(path, columns)\n const top = calculateAbsolutePosition(path, columns, itemHeightsCache, defaultItemHeight)\n const bottom = top + (itemHeightsCache[rowIndex] || defaultItemHeight)\n\n const headerHeight = defaultItemHeight\n const viewPortRect = refContents.getBoundingClientRect()\n const viewPortTop = scrollTop\n const viewPortBottom = scrollTop + viewPortRect.height - headerHeight\n\n if (bottom > viewPortBottom) {\n const diff = bottom - viewPortBottom\n refContents.scrollTop += diff\n }\n\n if (top < viewPortTop) {\n const diff = viewPortTop - top\n refContents.scrollTop -= diff\n }\n }\n\n function scrollToHorizontal(path: JSONPath) {\n const elem = findElement(path)\n if (!elem || !refContents) {\n return\n }\n\n const viewPortRect = refContents.getBoundingClientRect()\n const elemRect = elem.getBoundingClientRect() // TODO: scroll to column instead of item (is always rendered)\n\n if (elemRect.right > viewPortRect.right) {\n const diff = elemRect.right - viewPortRect.right\n refContents.scrollLeft += diff\n }\n\n if (elemRect.left < viewPortRect.left) {\n const diff = viewPortRect.left - elemRect.left\n refContents.scrollLeft -= diff\n }\n }\n\n function scrollIntoView(path: JSONPath) {\n scrollToVertical(path)\n scrollToHorizontal(path)\n }\n\n /**\n * Find the DOM element of a given path.\n * Note that the path can only be found when the node is expanded.\n */\n export function findElement(path: JSONPath): Element | undefined {\n const column = columns.find((c) => pathStartsWith(path.slice(1), c))\n\n const resolvedPath = column ? path.slice(0, 1).concat(column) : path\n\n return (\n refContents?.querySelector(`td[data-path=\"${encodeDataPath(resolvedPath)}\"]`) ?? undefined\n )\n }\n\n function openContextMenu({\n anchor,\n left,\n top,\n width,\n height,\n offsetTop,\n offsetLeft,\n showTip\n }: AbsolutePopupOptions) {\n const defaultItems: ContextMenuItem[] = createTableContextMenuItems({\n json,\n documentState,\n selection,\n readOnly,\n\n onEditValue: handleEditValue,\n onEditRow: handleEditRow,\n onToggleEnforceString: handleToggleEnforceString,\n\n onCut: handleCut,\n onCopy: handleCopy,\n onPaste: handlePasteFromMenu,\n\n onRemove: handleRemove,\n onDuplicateRow: handleDuplicateRow,\n onInsertBeforeRow: handleInsertBeforeRow,\n onInsertAfterRow: handleInsertAfterRow,\n onRemoveRow: handleRemoveRow\n })\n\n const items = onRenderContextMenu(defaultItems) ?? defaultItems\n\n if (items === false) {\n return\n }\n\n const props = {\n tip: showTip ? '提示:您可以通过右键或 Ctrl+Q 打开右键菜单' : undefined,\n items,\n onRequestClose: function () {\n closeAbsolutePopup(popupId)\n focus()\n }\n }\n\n const options = {\n left,\n top,\n offsetTop,\n offsetLeft,\n width,\n height,\n anchor,\n closeOnOuterClick: true,\n onClose: () => {\n modalOpen = false\n focus()\n }\n }\n\n modalOpen = true\n\n const popupId = openAbsolutePopup(ContextMenu, props, options)\n }\n\n function handleContextMenu(event: Event) {\n if (isEditingSelection(selection)) {\n return\n }\n\n if (event) {\n event.stopPropagation()\n event.preventDefault()\n }\n\n if (event && event.type === 'contextmenu' && event.target !== refHiddenInput) {\n // right mouse click to open context menu\n openContextMenu({\n left: (event as MouseEvent).clientX,\n top: (event as MouseEvent).clientY,\n width: CONTEXT_MENU_WIDTH,\n height: CONTEXT_MENU_HEIGHT,\n showTip: false\n })\n } else {\n // type === 'keydown' (from the quick key Ctrl+Q)\n // or target is hidden input -> context menu button on keyboard\n const anchor = refContents?.querySelector('.jse-table-cell.jse-selected-value')\n if (anchor) {\n openContextMenu({\n anchor,\n offsetTop: 2,\n width: CONTEXT_MENU_WIDTH,\n height: CONTEXT_MENU_HEIGHT,\n showTip: false\n })\n } else {\n // fallback on just displaying the TreeContextMenu top left\n const rect = refContents?.getBoundingClientRect()\n if (rect) {\n openContextMenu({\n top: rect.top + 2,\n left: rect.left + 2,\n width: CONTEXT_MENU_WIDTH,\n height: CONTEXT_MENU_HEIGHT,\n showTip: false\n })\n }\n }\n }\n }\n\n function handleContextMenuFromTableMenu(event: MouseEvent) {\n openContextMenu({\n anchor: findParentWithNodeName(event.target as HTMLElement, 'BUTTON'),\n offsetTop: 0,\n width: CONTEXT_MENU_WIDTH,\n height: CONTEXT_MENU_HEIGHT,\n showTip: true\n })\n }\n\n function handleEditValue() {\n if (readOnly || !selection) {\n return\n }\n\n const path = getFocusPath(selection)\n const value = getIn(json, path)\n if (isObjectOrArray(value)) {\n openJSONEditorModal(path)\n } else {\n selection = createValueSelection(path)\n }\n }\n\n function handleEditRow() {\n if (readOnly || !selection) {\n return\n }\n\n const path = getFocusPath(selection)\n const pathRow = path.slice(0, 1)\n openJSONEditorModal(pathRow)\n }\n\n function handleToggleEnforceString() {\n if (readOnly || !isValueSelection(selection)) {\n return\n }\n\n const path = selection.path\n const pointer = compileJSONPointer(path)\n const value = getIn(json, path)\n const enforceString = !getEnforceString(json, documentState, path)\n const updatedValue = enforceString ? String(value) : stringConvert(String(value), parser)\n\n debug('handleToggleEnforceString', { enforceString, value, updatedValue })\n\n handlePatch(\n [\n {\n op: 'replace',\n path: pointer,\n value: updatedValue\n }\n ],\n (_, patchedState) => {\n return {\n state: setInDocumentState(json, patchedState, path, { type: 'value', enforceString })\n }\n }\n )\n }\n\n async function handleParsePastedJson() {\n debug('apply pasted json', pastedJson)\n if (!pastedJson) {\n return\n }\n\n const { onPasteAsJson } = pastedJson\n onPasteAsJson()\n\n // TODO: get rid of the setTimeout here\n setTimeout(focus)\n }\n\n async function handlePasteFromMenu() {\n try {\n const clipboardText = await navigator.clipboard.readText()\n\n _paste(clipboardText)\n } catch (err) {\n console.error(err)\n\n copyPasteModalOpen = true\n }\n }\n\n async function handleParsePastedMultilineText() {\n debug('apply pasted multiline text', pastedMultilineText)\n if (!pastedMultilineText) {\n return\n }\n\n _paste(JSON.stringify(pastedMultilineText))\n\n // TODO: get rid of the setTimeout here\n setTimeout(focus)\n }\n\n function handleClearPastedJson() {\n debug('clear pasted json')\n pastedJson = undefined\n focus()\n }\n\n function handleClearPastedMultilineText() {\n debug('clear pasted multiline text')\n pastedMultilineText = undefined\n focus()\n }\n\n function handleRequestRepair() {\n onChangeMode(Mode.text)\n }\n\n async function handleCut(indent: boolean) {\n await onCut({\n json,\n selection,\n indentation: indent ? indentation : undefined,\n readOnly,\n parser,\n onPatch: handlePatch\n })\n }\n\n async function handleCopy(indent = true) {\n if (json === undefined) {\n return\n }\n\n await onCopy({\n json,\n selection,\n indentation: indent ? indentation : undefined,\n parser\n })\n }\n\n function handleRemove() {\n onRemove({\n json,\n text,\n selection,\n keepSelection: true,\n readOnly,\n onChange,\n onPatch: handlePatch\n })\n }\n\n function handleExtract(path: JSONPath) {\n if (readOnly) {\n return\n }\n\n debug('extract', { path })\n\n const operations = extract(json, createValueSelection(path))\n\n handlePatch(operations)\n }\n\n function handleDuplicateRow() {\n onDuplicateRow({ json, selection, columns, readOnly, onPatch: handlePatch })\n }\n\n function handleInsertBeforeRow() {\n onInsertBeforeRow({ json, selection, columns, readOnly, onPatch: handlePatch })\n }\n\n function handleInsertAfterRow() {\n onInsertAfterRow({ json, selection, columns, readOnly, onPatch: handlePatch })\n }\n\n function handleRemoveRow() {\n onRemoveRow({ json, selection, columns, readOnly, onPatch: handlePatch })\n }\n\n async function handleInsertCharacter(char: string) {\n await onInsertCharacter({\n char,\n selectInside: false,\n json,\n selection: selection,\n readOnly,\n parser,\n onPatch: handlePatch,\n onReplaceJson: handleReplaceJson,\n onSelect: handleSelect\n })\n }\n\n function handleKeyDown(event: KeyboardEvent) {\n const combo = keyComboFromEvent(event)\n debug('keydown', { combo, key: event.key })\n\n if (combo === 'Ctrl+X') {\n // cut formatted\n event.preventDefault()\n handleCut(true)\n }\n if (combo === 'Ctrl+Shift+X') {\n // cut compact\n event.preventDefault()\n handleCut(false)\n }\n if (combo === 'Ctrl+C') {\n // copy formatted\n event.preventDefault()\n handleCopy(true)\n }\n if (combo === 'Ctrl+Shift+C') {\n // copy compact\n event.preventDefault()\n handleCopy(false)\n }\n // Note: Ctrl+V (paste) is handled by the on:paste event\n\n if (combo === 'Ctrl+D') {\n event.preventDefault()\n handleDuplicateRow()\n }\n if (combo === 'Delete' || combo === 'Backspace') {\n event.preventDefault()\n handleRemove()\n }\n if (combo === 'Insert') {\n event.preventDefault()\n // TODO: implement insert\n }\n if (combo === 'Ctrl+A') {\n event.preventDefault()\n // selection = selectAll()\n // TODO: implement select all\n }\n\n if (combo === 'Ctrl+Q') {\n handleContextMenu(event)\n }\n\n if (combo === 'ArrowLeft') {\n event.preventDefault()\n\n createDefaultSelectionWhenUndefined()\n\n if (selection) {\n const newSelection = selectPreviousColumn(columns, selection)\n selection = newSelection\n scrollIntoView(getFocusPath(newSelection))\n }\n }\n\n if (combo === 'ArrowRight') {\n event.preventDefault()\n\n createDefaultSelectionWhenUndefined()\n\n if (selection) {\n const newSelection = selectNextColumn(columns, selection)\n selection = newSelection\n scrollIntoView(getFocusPath(newSelection))\n }\n }\n\n if (combo === 'ArrowUp') {\n event.preventDefault()\n\n createDefaultSelectionWhenUndefined()\n\n if (selection) {\n const newSelection = selectPreviousRow(columns, selection)\n selection = newSelection\n scrollIntoView(getFocusPath(newSelection))\n }\n }\n\n if (combo === 'ArrowDown') {\n event.preventDefault()\n\n createDefaultSelectionWhenUndefined()\n\n if (selection) {\n const newSelection = selectNextRow(json, columns, selection)\n selection = newSelection\n scrollIntoView(getFocusPath(newSelection))\n }\n }\n\n if (combo === 'Enter' && selection) {\n if (isValueSelection(selection)) {\n event.preventDefault()\n\n const path = selection.path\n const value = getIn(json, path)\n if (isObjectOrArray(value)) {\n // edit nested object/array\n openJSONEditorModal(path)\n } else {\n if (!readOnly) {\n // go to value edit mode\n selection = { ...selection, edit: true }\n }\n }\n }\n }\n\n const normalizedCombo = combo.replace(/^Shift\\+/, '') // replace 'Shift+A' with 'A'\n if (normalizedCombo.length === 1 && selection) {\n // a regular key like a, A, _, etc is entered.\n // Replace selected contents with a new value having this first character as text\n event.preventDefault()\n handleInsertCharacter(event.key)\n return\n }\n\n if (combo === 'Ctrl+Enter' && isValueSelection(selection)) {\n event.preventDefault()\n\n const value = getIn(json, selection.path)\n\n if (isUrl(value)) {\n // open url in new page\n window.open(String(value), '_blank')\n }\n }\n\n if (combo === 'Escape' && selection) {\n event.preventDefault()\n selection = undefined\n }\n\n if (combo === 'Ctrl+F') {\n event.preventDefault()\n openFind(false)\n }\n\n if (combo === 'Ctrl+H') {\n event.preventDefault()\n openFind(true)\n }\n\n if (combo === 'Ctrl+Z') {\n event.preventDefault()\n\n handleUndo()\n }\n\n if (combo === 'Ctrl+Shift+Z') {\n event.preventDefault()\n\n handleRedo()\n }\n }\n\n function handlePaste(event: ClipboardEvent) {\n event.preventDefault()\n\n const clipboardText = event.clipboardData?.getData('text/plain')\n\n _paste(clipboardText)\n }\n\n function _paste(clipboardText: string | undefined) {\n if (clipboardText === undefined) {\n return\n }\n\n onPaste({\n clipboardText,\n json,\n selection,\n readOnly,\n parser,\n onPatch: handlePatch,\n onChangeText: handleChangeText,\n onPasteMultilineText: handlePasteMultilineText,\n openRepairModal\n })\n }\n\n // TODO: this function is duplicated from TreeMode. See if we can reuse the code instead\n function handleReplaceJson(updatedJson: unknown, afterPatch?: AfterPatchCallback) {\n const previousContent = { json, text }\n const previousState = { json, documentState, selection, sortedColumn, text, textIsRepaired }\n\n const updatedState = syncDocumentState(updatedJson, documentState)\n\n const callback =\n typeof afterPatch === 'function'\n ? afterPatch(updatedJson, updatedState, selection)\n : undefined\n\n json = callback?.json !== undefined ? callback.json : updatedJson\n documentState = callback?.state !== undefined ? callback.state : updatedState\n selection = callback?.selection !== undefined ? callback.selection : selection\n sortedColumn = undefined // we can't know whether the new json is still sorted or not\n text = undefined\n textIsRepaired = false\n parseError = undefined\n\n // make sure the selection is valid\n clearSelectionWhenNotExisting(json)\n\n addHistoryItem(previousState)\n\n // we could work out a patchResult, or use patch(), but only when the previous and new\n // contents are both json and not text. We go for simplicity and consistency here and\n // do _not_ return a patchResult ever.\n const patchResult = undefined\n\n emitOnChange(previousContent, patchResult)\n }\n\n // TODO: this function is duplicated from TreeMode. See if we can reuse the code instead\n function handleChangeText(updatedText: string, afterPatch?: AfterPatchCallback) {\n debug('handleChangeText')\n\n const previousContent = { json, text }\n const previousState = { json, documentState, selection, sortedColumn, text, textIsRepaired }\n\n try {\n json = parseMemoizeOne(updatedText)\n documentState = syncDocumentState(json, documentState)\n text = undefined\n textIsRepaired = false\n parseError = undefined\n } catch (err) {\n try {\n json = parseMemoizeOne(jsonrepair(updatedText))\n documentState = syncDocumentState(json, documentState)\n text = updatedText\n textIsRepaired = true\n parseError = undefined\n } catch {\n // no valid JSON, will show empty document or invalid json\n json = undefined\n documentState = undefined\n text = updatedText\n textIsRepaired = false\n parseError =\n text !== ''\n ? normalizeJsonParseError(text, (err as Error).message || String(err))\n : undefined\n }\n }\n\n if (typeof afterPatch === 'function') {\n const callback = afterPatch(json, documentState, selection)\n\n json = callback?.json !== undefined ? callback.json : json\n documentState = callback?.state !== undefined ? callback.state : documentState\n selection = callback?.selection !== undefined ? callback.selection : selection\n }\n\n // ensure the selection is valid\n clearSelectionWhenNotExisting(json)\n\n addHistoryItem(previousState)\n\n // no JSON patch actions available in text mode\n const patchResult = undefined\n\n emitOnChange(previousContent, patchResult)\n }\n\n function handleSelectValidationError(error: ValidationError) {\n debug('select validation error', error)\n\n selection = createValueSelection(error.path)\n\n scrollTo(error.path)\n }\n\n function openSortModal(rootPath: JSONPath) {\n if (readOnly || json === undefined) {\n return\n }\n\n modalOpen = true\n\n onSortModal({\n id: sortModalId,\n json,\n rootPath,\n onSort: ({ operations, itemPath, direction }) => {\n debug('onSort', operations, rootPath, itemPath, direction)\n\n handlePatch(operations, (_, patchedState) => {\n return {\n state: patchedState,\n sortedColumn: {\n path: itemPath,\n sortDirection: direction === -1 ? SortDirection.desc : SortDirection.asc\n }\n }\n })\n },\n onClose: () => {\n modalOpen = false\n setTimeout(focus)\n }\n })\n }\n\n /**\n * This method is exposed via JSONEditor.transform\n */\n export function openTransformModal(options: TransformModalOptions) {\n if (json === undefined) {\n return\n }\n\n const { id, onTransform, onClose } = options\n const rootPath = options.rootPath || []\n\n modalOpen = true\n\n onTransformModal({\n id: id || transformModalId,\n json,\n rootPath: rootPath || [],\n onTransform: (operations) => {\n if (onTransform) {\n onTransform({\n operations,\n json: json,\n transformedJson: immutableJSONPatch(json, operations)\n })\n } else {\n debug('onTransform', rootPath, operations)\n\n handlePatch(operations)\n }\n },\n onClose: () => {\n modalOpen = false\n setTimeout(focus)\n if (onClose) {\n onClose()\n }\n }\n })\n }\n\n function openJSONEditorModal(path: JSONPath) {\n debug('openJSONEditorModal', { path })\n\n modalOpen = true\n\n // open a popup where you can edit the nested object/array\n onJSONEditorModal({\n content: {\n json: getIn(json, path)\n },\n path,\n onPatch: handlePatch,\n onClose: () => {\n modalOpen = false\n setTimeout(focus)\n }\n })\n }\n\n function openRepairModal(text: string, onApply: (repairedText: string) => void) {\n jsonRepairModalProps = {\n text,\n onParse: (text) => parsePartialJson(text, (t) => parseAndRepair(t, parser)),\n onRepair: repairPartialJson,\n onApply,\n onClose: focus\n }\n }\n\n function handleSortAll() {\n const rootPath: JSONPath = []\n openSortModal(rootPath)\n }\n\n function handleTransformAll() {\n openTransformModal({\n rootPath: []\n })\n }\n\n function openFind(findAndReplace: boolean): void {\n debug('openFind', { findAndReplace })\n\n showSearch = false\n showReplace = false\n\n flushSync()\n\n // trick to make sure the focus goes to the search box\n showSearch = true\n showReplace = findAndReplace\n }\n\n function handleUndo() {\n if (readOnly) {\n return\n }\n\n if (!history.canUndo) {\n return\n }\n\n const item = history.undo()\n if (!isTreeHistoryItem(item)) {\n onUndo(item)\n return\n }\n\n const previousContent = { json, text }\n\n json = item.undo.patch ? immutableJSONPatch(json, item.undo.patch) : item.undo.json\n documentState = item.undo.documentState\n selection = item.undo.selection\n sortedColumn = item.undo.sortedColumn\n text = item.undo.text\n textIsRepaired = item.undo.textIsRepaired\n parseError = undefined\n\n debug('undo', { item, json })\n\n const patchResult =\n item.undo.patch && item.redo.patch\n ? {\n json,\n previousJson: previousContent.json,\n redo: item.undo.patch,\n undo: item.redo.patch\n }\n : undefined\n\n emitOnChange(previousContent, patchResult)\n\n focus()\n if (selection) {\n scrollTo(getFocusPath(selection), { scrollToWhenVisible: false })\n }\n }\n\n function handleRedo() {\n if (readOnly) {\n return\n }\n\n if (!history.canRedo) {\n return\n }\n\n const item = history.redo()\n if (!isTreeHistoryItem(item)) {\n onRedo(item)\n return\n }\n\n const previousContent = { json, text }\n\n json = item.redo.patch ? immutableJSONPatch(json, item.redo.patch) : item.redo.json\n documentState = item.redo.documentState\n selection = item.redo.selection\n sortedColumn = item.redo.sortedColumn\n text = item.redo.text\n textIsRepaired = item.redo.textIsRepaired\n parseError = undefined\n\n debug('redo', { item, json })\n\n const patchResult =\n item.undo.patch && item.redo.patch\n ? {\n json,\n previousJson: previousContent.json,\n redo: item.redo.patch,\n undo: item.undo.patch\n }\n : undefined\n\n emitOnChange(previousContent, patchResult)\n\n focus()\n if (selection) {\n scrollTo(getFocusPath(selection), { scrollToWhenVisible: false })\n }\n }\n\n function handleResizeContents(element: Element) {\n viewPortHeight = element.getBoundingClientRect().height\n }\n\n function handleResizeRow(element: Element, rowIndex: number) {\n itemHeightsCache[rowIndex] = element.getBoundingClientRect().height\n }\n</script>\n\n<svelte:window on:mousedown={handleWindowMouseDown} />\n\n<!-- svelte-ignore a11y-no-noninteractive-element-interactions -->\n<div\n role=\"table\"\n class=\"jse-table-mode\"\n class:no-main-menu={!mainMenuBar}\n on:mousedown={handleMouseDown}\n on:keydown={handleKeyDown}\n on:contextmenu={handleContextMenu}\n bind:this={refJsonEditor}\n>\n {#if mainMenuBar}\n <TableMenu\n {containsValidArray}\n {readOnly}\n bind:showSearch\n {history}\n onSort={handleSortAll}\n onTransform={handleTransformAll}\n onUndo={handleUndo}\n onRedo={handleRedo}\n onContextMenu={handleContextMenuFromTableMenu}\n {onRenderMenu}\n />\n {/if}\n\n {#if !isSSR}\n <label class=\"jse-hidden-input-label\">\n <input\n type=\"text\"\n readonly={true}\n tabindex=\"-1\"\n class=\"jse-hidden-input\"\n bind:this={refHiddenInput}\n on:paste={handlePaste}\n />\n </label>\n {#if containsValidArray}\n <div class=\"jse-search-box-container\">\n <SearchBox\n {json}\n {documentState}\n {parser}\n {showSearch}\n {showReplace}\n {readOnly}\n {columns}\n onSearch={handleSearch}\n onFocus={handleFocusSearch}\n onPatch={handlePatch}\n onClose={handleCloseSearch}\n />\n </div>\n <div\n class=\"jse-contents\"\n bind:this={refContents}\n use:resizeObserver={handleResizeContents}\n on:scroll={handleScroll}\n >\n <table class=\"jse-table-main\">\n <tbody>\n <tr class=\"jse-table-row jse-table-row-header\">\n <th class=\"jse-table-cell jse-table-cell-header\">\n {#if !isEmpty(groupedValidationErrors?.root)}\n {@const validationError = mergeValidationErrors(\n [],\n groupedValidationErrors?.root\n )}\n {#if validationError}\n <div class=\"jse-table-root-error\">\n <ValidationErrorIcon {validationError} onExpand={noop} />\n </div>\n {/if}\n {/if}\n </th>\n {#each columns as column}\n <th class=\"jse-table-cell jse-table-cell-header\">\n <ColumnHeader path={column} {sortedColumn} {readOnly} onSort={onSortByHeader} />\n </th>\n {/each}\n {#if showRefreshButton}\n <th class=\"jse-table-cell jse-table-cell-header\">\n <RefreshColumnHeader\n count={Array.isArray(json) ? json.length : 0}\n {maxSampleCount}\n {readOnly}\n onRefresh={() => (maxSampleCount = Infinity)}\n />\n </th>\n {/if}\n </tr>\n <tr\n class=\"jse-table-invisible-start-section\"\n class:jse-search-box-background={showSearch}\n >\n <td style:height={visibleSection.startHeight + 'px'} colspan={columns.length}></td>\n </tr>\n {#each visibleSection.visibleItems as item, visibleIndex}\n {@const rowIndex = visibleSection.startIndex + visibleIndex}\n {@const validationErrorsByRow = groupedValidationErrors.rows[rowIndex]}\n {@const validationError = mergeValidationErrors(\n [String(rowIndex)],\n validationErrorsByRow?.row\n )}\n {@const searchResultByRow = getInRecursiveState(json, searchResults, [\n String(rowIndex)\n ])}\n <tr class=\"jse-table-row\">\n {#key rowIndex}\n <th\n class=\"jse-table-cell jse-table-cell-gutter\"\n use:resizeObserver={(element) => handleResizeRow(element, rowIndex)}\n >\n {rowIndex}\n {#if validationError}\n <ValidationErrorIcon {validationError} onExpand={noop} />\n {/if}\n </th>\n {/key}\n {#each columns as column, columnIndex}\n {@const path = [String(rowIndex)].concat(column)}\n {@const value = getIn(item, column)}\n {@const isSelected =\n isValueSelection(selection) && pathStartsWith(selection.path, path)}\n {@const validationErrorsByColumn = validationErrorsByRow?.columns[columnIndex]}\n {@const validationError = mergeValidationErrors(path, validationErrorsByColumn)}\n <td class=\"jse-table-cell\" data-path={encodeDataPath(path)}>\n <div class=\"jse-value-outer\" class:jse-selected-value={isSelected}>\n {#if isObjectOrArray(value)}\n {@const searchResultsByCell = flattenSearchResults(\n getInRecursiveState(item, searchResultByRow, column)\n )}\n\n {@const containsActiveSearchResult = searchResultsByCell\n ? searchResultsByCell.some((item) => item.active)\n : false}\n\n <InlineValue\n {path}\n {value}\n {parser}\n {isSelected}\n containsSearchResult={!isEmpty(searchResultsByCell)}\n {containsActiveSearchResult}\n onEdit={openJSONEditorModal}\n />{:else}\n {@const searchResultItemsByCell = getInRecursiveState(\n json,\n searchResults,\n path\n )?.searchResults}\n\n <JSONValue\n {path}\n value={value !== undefined ? value : ''}\n enforceString={getEnforceString(json, documentState, path)}\n selection={isSelected ? selection : undefined}\n searchResultItems={searchResultItemsByCell}\n {context}\n />{/if}{#if !readOnly && isSelected && !isEditingSelection(selection)}\n <div class=\"jse-context-menu-anchor\">\n <ContextMenuPointer selected={true} onContextMenu={openContextMenu} />\n </div>\n {/if}\n </div>\n {#if validationError}\n <ValidationErrorIcon {validationError} onExpand={noop} />\n {/if}\n </td>\n {/each}\n {#if showRefreshButton}\n <td class=\"jse-table-cell\"></td>\n {/if}\n </tr>\n {/each}\n\n <tr class=\"jse-table-invisible-end-section\">\n <td style:height={visibleSection.endHeight + 'px'} colspan={columns.length}></td>\n </tr>\n </tbody>\n </table>\n </div>\n\n {#if pastedJson}\n <Message\n type=\"info\"\n message={`你粘贴了一个 JSON ${\n Array.isArray(pastedJson.contents) ? '数组' : '对象'\n } 作为文本`}\n actions={[\n {\n icon: faWrench,\n text: '请粘贴为 JSON 格式',\n title: '将文本粘贴为 JSON 格式,而不是单个值',\n // We use mousedown here instead of click: this message pops up\n // whilst the user is editing a value. When clicking this button,\n // the actual value is applied and the event is not propagated\n // and an onClick on this button never happens.\n onMouseDown: handleParsePastedJson\n },\n {\n text: '保持原样',\n title: '将粘贴的内容保留为单一值',\n onClick: handleClearPastedJson\n }\n ]}\n />\n {/if}\n\n {#if pastedMultilineText}\n <Message\n type=\"info\"\n message=\"多行文本已作为数组粘贴\"\n actions={[\n {\n icon: faWrench,\n text: '改为粘贴为字符串',\n title: '将剪贴板数据粘贴为单个字符串值,而不是数组',\n onClick: handleParsePastedMultilineText\n },\n {\n text: '保持原样',\n title: '保留粘贴的数组',\n onClick: handleClearPastedMultilineText\n }\n ]}\n />\n {/if}\n\n {#if textIsRepaired}\n <Message\n type=\"success\"\n message=\"加载的 JSON 文档无效,但已成功修复。\"\n actions={!readOnly\n ? [\n {\n icon: faCheck,\n text: '确认',\n title: '接受修复后的文件',\n onClick: acceptAutoRepair\n },\n {\n icon: faCode,\n text: '改为手动修复',\n title: '保持文件不变,改为手动修复',\n onClick: handleRequestRepair\n }\n ]\n : []}\n onClose={focus}\n />\n {/if}\n\n <ValidationErrorsOverview {validationErrors} selectError={handleSelectValidationError} />\n {:else if parseError && text !== undefined && text !== ''}\n <Message\n type=\"error\"\n message=\"加载的JSON文档无效,无法自动修复。\"\n actions={!readOnly\n ? [\n {\n icon: faCode,\n text: '手动修复',\n title: '以 \"文本视图\" 模式打开文档并手动修复',\n onClick: handleRequestRepair\n }\n ]\n : []}\n />\n <JSONPreview {text} {json} {indentation} {parser} />\n {:else}\n <TableModeWelcome\n {text}\n {json}\n {readOnly}\n {parser}\n {openJSONEditorModal}\n extractPath={handleExtract}\n {onChangeMode}\n onClick={() => {\n // FIXME: this is a workaround for the editor not putting the focus on refHiddenInput\n // when clicking in the welcome screen so you cannot paste a document from clipboard.\n focus()\n }}\n />\n {/if}\n {:else}\n <div class=\"jse-contents jse-contents-loading\">\n <div class=\"jse-loading-space\"></div>\n <div class=\"jse-loading\">加载中...</div>\n </div>\n {/if}\n</div>\n\n{#if copyPasteModalOpen}\n <CopyPasteModal onClose={() => (copyPasteModalOpen = false)} />\n{/if}\n\n{#if jsonRepairModalProps}\n <JSONRepairModal\n {...jsonRepairModalProps}\n onClose={() => {\n jsonRepairModalProps?.onClose()\n jsonRepairModalProps = undefined\n }}\n />\n{/if}\n\n<style src=\"./TableMode.scss\"></style>\n","import type { ContextMenuItem, DocumentState, JSONSelection } from 'svelte-jsoneditor'\nimport {\n faCheckSquare,\n faClone,\n faCopy,\n faCut,\n faPaste,\n faPen,\n faPlus,\n faSquare,\n faTrashCan\n} from '@fortawesome/free-solid-svg-icons'\nimport { isKeySelection, isMultiSelection, isValueSelection } from '$lib/logic/selection'\nimport { getIn } from 'immutable-json-patch'\nimport { getFocusPath, singleItemSelected } from '$lib/logic/selection'\nimport { isObjectOrArray } from '$lib/utils/typeUtils'\nimport { getEnforceString } from '$lib/logic/documentState'\n\nexport default function ({\n json,\n documentState,\n selection,\n readOnly,\n onEditValue,\n onEditRow,\n onToggleEnforceString,\n onCut,\n onCopy,\n onPaste,\n onRemove,\n onDuplicateRow,\n onInsertBeforeRow,\n onInsertAfterRow,\n onRemoveRow\n}: {\n json: unknown | undefined\n documentState: DocumentState | undefined\n selection: JSONSelection | undefined\n readOnly: boolean\n onEditValue: () => void\n onEditRow: () => void\n onToggleEnforceString: () => void\n onCut: (indent: boolean) => void\n onCopy: (indent: boolean) => void\n onPaste: () => void\n onRemove: () => void\n onDuplicateRow: () => void\n onInsertBeforeRow: () => void\n onInsertAfterRow: () => void\n onRemoveRow: () => void\n}): ContextMenuItem[] {\n const hasJson = json !== undefined\n const hasSelection = !!selection\n const focusValue =\n json !== undefined && selection ? getIn(json, getFocusPath(selection)) : undefined\n\n const hasSelectionContents =\n hasJson &&\n (isMultiSelection(selection) || isKeySelection(selection) || isValueSelection(selection))\n\n const canEditValue =\n !readOnly && hasJson && selection !== undefined && singleItemSelected(selection)\n const canEnforceString = canEditValue && !isObjectOrArray(focusValue)\n\n const canCut = !readOnly && hasSelectionContents\n\n const enforceString =\n selection !== undefined ? getEnforceString(json, documentState, getFocusPath(selection)) : false\n\n return [\n { type: 'separator' },\n {\n type: 'row',\n items: [\n {\n type: 'column',\n items: [\n { type: 'label', text: '表格单元格:' },\n {\n type: 'dropdown-button',\n main: {\n type: 'button',\n onClick: () => onEditValue(),\n icon: faPen,\n text: '编辑',\n title: '编辑值(双击编辑该值)',\n disabled: !canEditValue\n },\n width: '11em',\n items: [\n {\n type: 'button',\n icon: faPen,\n text: '编辑',\n title: '编辑值(双击编辑该值)',\n onClick: () => onEditValue(),\n disabled: !canEditValue\n },\n {\n type: 'button',\n icon: enforceString ? faCheckSquare : faSquare,\n text: '强制转为字符串',\n title: '当数值包含数值时,强制将数值转为字符串',\n onClick: () => onToggleEnforceString(),\n disabled: !canEnforceString\n }\n ]\n },\n {\n type: 'dropdown-button',\n main: {\n type: 'button',\n onClick: () => onCut(true),\n icon: faCut,\n text: '剪贴',\n title: '剪切选定内容,格式为缩进(Ctrl+X)',\n disabled: !canCut\n },\n width: '10em',\n items: [\n {\n type: 'button',\n icon: faCut,\n text: '剪切并格式化',\n title: '剪切选定内容,格式为缩进(Ctrl+X)',\n onClick: () => onCut(true),\n disabled: readOnly || !hasSelectionContents\n },\n {\n type: 'button',\n icon: faCut,\n text: '剪切并压缩',\n title: '剪切选中内容,不缩进 (Ctrl+Shift+X)',\n onClick: () => onCut(false),\n disabled: readOnly || !hasSelectionContents\n }\n ]\n },\n {\n type: 'dropdown-button',\n main: {\n type: 'button',\n onClick: () => onCopy(true),\n icon: faCopy,\n text: '复制',\n title: '复制所选内容,格式为缩进 (Ctrl+C)',\n disabled: !hasSelectionContents\n },\n width: '12em',\n items: [\n {\n type: 'button',\n icon: faCopy,\n text: '复制并格式化',\n title: '复制所选内容,格式为缩进 (Ctrl+C)',\n onClick: () => onCopy(false),\n disabled: !hasSelectionContents\n },\n {\n type: 'button',\n icon: faCopy,\n text: '复制并压缩',\n title: '复制选定内容,不缩进 (Ctrl+Shift+C)',\n onClick: () => onCopy(false),\n disabled: !hasSelectionContents\n }\n ]\n },\n {\n type: 'button',\n onClick: () => onPaste(),\n icon: faPaste,\n text: '粘贴',\n title: '粘贴剪贴板内容 (Ctrl+V)',\n disabled: readOnly || !hasSelection\n },\n {\n type: 'button',\n onClick: () => onRemove(),\n icon: faTrashCan,\n text: '删除',\n title: '删除选定的内容(删除)',\n disabled: readOnly || !hasSelectionContents\n }\n ]\n },\n {\n type: 'column',\n items: [\n { type: 'label', text: '表格行:' },\n {\n type: 'button',\n onClick: () => onEditRow(),\n icon: faPen,\n text: '编辑行',\n title: '编辑当前行',\n disabled: readOnly || !hasSelection || !hasJson\n },\n {\n type: 'button',\n onClick: () => onDuplicateRow(),\n icon: faClone,\n text: '复制当前行',\n title: '复制当前行 (Ctrl+D)',\n disabled: readOnly || !hasSelection || !hasJson\n },\n {\n type: 'button',\n onClick: () => onInsertBeforeRow(),\n icon: faPlus,\n text: '在当前行之前插入',\n title: '在当前行之前插入一行',\n disabled: readOnly || !hasSelection || !hasJson\n },\n {\n type: 'button',\n onClick: () => onInsertAfterRow(),\n icon: faPlus,\n text: '在当前行之后插入',\n title: '在当前行之后插入一行',\n disabled: readOnly || !hasSelection || !hasJson\n },\n {\n type: 'button',\n onClick: () => onRemoveRow(),\n icon: faTrashCan,\n text: '删除行',\n title: '删除当前行',\n disabled: readOnly || !hasSelection || !hasJson\n }\n ]\n }\n ]\n }\n ]\n}\n","<svelte:options immutable={true} />\n\n<script lang=\"ts\">\n import type { HistoryItem, History, MenuItem, OnRenderMenuInternal } from '$lib/types'\n import Menu from '../../../controls/Menu.svelte'\n import {\n faEllipsisV,\n faFilter,\n faRedo,\n faSearch,\n faSortAmountDownAlt,\n faUndo\n } from '@fortawesome/free-solid-svg-icons'\n import { CONTEXT_MENU_EXPLANATION } from '$lib/constants.js'\n\n export let containsValidArray: boolean\n export let readOnly: boolean\n export let showSearch = false\n export let history: History<HistoryItem>\n export let onSort: () => void\n export let onTransform: () => void\n export let onContextMenu: (event: MouseEvent) => void\n export let onUndo: () => void\n export let onRedo: () => void\n export let onRenderMenu: OnRenderMenuInternal\n\n function handleToggleSearch() {\n showSearch = !showSearch\n }\n\n let defaultItems: MenuItem[]\n $: defaultItems = !readOnly\n ? [\n {\n type: 'button',\n icon: faSortAmountDownAlt,\n title: '排序',\n className: 'jse-sort',\n onClick: onSort,\n disabled: readOnly || !containsValidArray\n },\n {\n type: 'button',\n icon: faFilter,\n title: '转换内容 (过滤, 排序, 分类)',\n className: 'jse-transform',\n onClick: onTransform,\n disabled: readOnly || !containsValidArray\n },\n {\n type: 'button',\n icon: faSearch,\n title: '搜索 (Ctrl+F)',\n className: 'jse-search',\n onClick: handleToggleSearch,\n disabled: !containsValidArray\n },\n {\n type: 'button',\n icon: faEllipsisV,\n title: CONTEXT_MENU_EXPLANATION,\n className: 'jse-contextmenu',\n onClick: onContextMenu\n },\n {\n type: 'separator'\n },\n {\n type: 'button',\n icon: faUndo,\n title: '撤销 (Ctrl+Z)',\n className: 'jse-undo',\n onClick: onUndo,\n disabled: !history.canUndo\n },\n {\n type: 'button',\n icon: faRedo,\n title: '重做 (Ctrl+Shift+Z)',\n className: 'jse-redo',\n onClick: onRedo,\n disabled: !history.canRedo\n },\n {\n type: 'space'\n }\n ]\n : [\n {\n type: 'space'\n }\n ]\n\n let items: MenuItem[]\n $: items = onRenderMenu(defaultItems) || defaultItems\n</script>\n\n<Menu {items} />\n","<svelte:options immutable={true} />\n\n<script lang=\"ts\">\n import type { JSONPath } from 'immutable-json-patch'\n import type { SortedColumn } from '$lib/types.js'\n import { SortDirection } from '$lib/types.js'\n import { stringifyJSONPath } from '$lib/utils/pathUtils.js'\n import Icon from 'svelte-awesome'\n import { faCaretDown, faCaretUp } from '@fortawesome/free-solid-svg-icons'\n import { isEmpty, isEqual } from 'lodash-es'\n import { MAX_HEADER_NAME_CHARACTERS, SORT_DIRECTION_NAMES } from '$lib/constants.js'\n import { truncate } from '$lib/utils/stringUtils.js'\n\n export let path: JSONPath\n export let sortedColumn: SortedColumn | undefined\n export let readOnly: boolean\n export let onSort: (sortedColumn: SortedColumn) => void\n\n // TODO: improve truncating of long column names when they are a deeply nested path: the last item from the path should be visible, and halfway the path is least interesting\n $: columnName = !isEmpty(path) ? stringifyJSONPath(path) : 'values'\n\n $: sortDirection =\n sortedColumn && isEqual(path, sortedColumn?.path) ? sortedColumn.sortDirection : undefined\n\n $: sortDirectionName = sortDirection ? SORT_DIRECTION_NAMES[sortDirection] : undefined\n\n function handleSort() {\n if (readOnly) {\n return\n }\n\n onSort({\n path,\n sortDirection: sortDirection === SortDirection.asc ? SortDirection.desc : SortDirection.asc\n })\n }\n</script>\n\n<button\n type=\"button\"\n class=\"jse-column-header\"\n class:jse-readonly={readOnly}\n on:click={handleSort}\n title={!readOnly ? columnName + ' (点击根据该列排序)' : columnName}\n>\n <span class=\"jse-column-name\">\n {truncate(columnName, MAX_HEADER_NAME_CHARACTERS)}\n </span>\n {#if sortDirection !== undefined}\n <span class=\"jse-column-sort-icon\" title={`当前为${sortDirectionName}`}>\n <Icon data={sortDirection === SortDirection.asc ? faCaretDown : faCaretUp} />\n </span>\n {/if}\n</button>\n\n<style src=\"./ColumnHeader.scss\"></style>\n","<svelte:options immutable={true} />\n\n<script lang=\"ts\">\n import Icon from 'svelte-awesome'\n import { faRotate } from '@fortawesome/free-solid-svg-icons'\n\n export let count: number\n export let maxSampleCount: number\n export let readOnly: boolean\n export let onRefresh: () => void\n</script>\n\n<button\n type=\"button\"\n class=\"jse-column-header\"\n class:jse-readonly={readOnly}\n title={`列是通过从 ${count} 个项目中抽样 ${maxSampleCount} 个创建的。` +\n '如果缺少某列,请点击此处对所有项目进行采样。' +\n '这会比较慢。'}\n on:click={() => onRefresh()}\n>\n <Icon data={faRotate} />\n</button>\n\n<style src=\"./RefreshColumnHeader.scss\"></style>\n","<svelte:options immutable={true} />\n\n<script lang=\"ts\">\n import type { JSONPath } from 'immutable-json-patch'\n import type { JSONParser } from '$lib/types'\n import { truncate } from '$lib/utils/stringUtils.js'\n import { MAX_INLINE_OBJECT_CHARS } from '$lib/constants.js'\n\n export let path: JSONPath\n export let value: unknown\n export let parser: JSONParser\n export let isSelected: boolean\n export let containsSearchResult: boolean\n export let containsActiveSearchResult: boolean\n export let onEdit: (path: JSONPath) => void\n</script>\n\n<button\n type=\"button\"\n class=\"jse-inline-value\"\n class:jse-selected={isSelected}\n class:jse-highlight={containsSearchResult}\n class:jse-active={containsActiveSearchResult}\n on:dblclick={() => onEdit(path)}\n>\n {truncate(parser.stringify(value) ?? '', MAX_INLINE_OBJECT_CHARS)}\n</button>\n\n<style src=\"./InlineValue.scss\"></style>\n","<script lang=\"ts\">\n import type {\n Content,\n ContentErrors,\n ContextMenuItem,\n HistoryItem,\n History,\n JSONEditorSelection,\n JSONParser,\n JSONPatchResult,\n JSONPathParser,\n MenuItem,\n MenuSeparator,\n OnBlur,\n OnChange,\n OnChangeMode,\n OnClassName,\n OnError,\n OnExpand,\n OnFocus,\n OnJSONEditorModal,\n OnRenderContextMenu,\n OnRenderContextMenuInternal,\n OnRenderMenu,\n OnRenderMenuInternal,\n OnRenderValue,\n OnSelect,\n OnSortModal,\n OnTransformModal,\n TransformModalOptions,\n Validator,\n ModeHistoryItem\n } from '$lib/types'\n import { Mode } from '$lib/types.js'\n import TextMode from './textmode/TextMode.svelte'\n import TableMode from './tablemode/TableMode.svelte'\n import TreeMode from './treemode/TreeMode.svelte'\n import type { JSONPatchDocument, JSONPath } from 'immutable-json-patch'\n import { isMenuSpace, isModeHistoryItem } from '$lib/typeguards.js'\n import { cloneDeep } from 'lodash-es'\n import { createHistoryInstance } from '$lib/logic/history'\n import { createDebug } from '$lib/utils/debug'\n\n export let content: Content\n export let selection: JSONEditorSelection | undefined\n\n export let readOnly: boolean\n export let indentation: number | string\n export let tabSize: number\n export let truncateTextSize: number\n export let externalMode: Mode\n export let mainMenuBar: boolean\n export let navigationBar: boolean\n export let statusBar: boolean\n export let askToFormat: boolean\n export let escapeControlCharacters: boolean\n export let escapeUnicodeCharacters: boolean\n export let maxDocumentSizeTextMode: number\n export let flattenColumns: boolean\n export let parser: JSONParser\n export let parseMemoizeOne: JSONParser['parse']\n export let validator: Validator | undefined\n export let validationParser: JSONParser\n export let pathParser: JSONPathParser\n export let insideModal: boolean\n\n export let onChange: OnChange\n export let onChangeMode: OnChangeMode\n export let onSelect: OnSelect\n export let onRenderValue: OnRenderValue\n export let onClassName: OnClassName\n export let onRenderMenu: OnRenderMenu\n export let onRenderContextMenu: OnRenderContextMenu\n export let onError: OnError\n export let onFocus: OnFocus\n export let onBlur: OnBlur\n export let onSortModal: OnSortModal\n export let onTransformModal: OnTransformModal\n export let onJSONEditorModal: OnJSONEditorModal\n\n let refTreeMode: TreeMode | undefined\n let refTableMode: TableMode | undefined\n let refTextMode: TextMode | undefined\n\n const debug = createDebug('jsoneditor:JSONEditorRoot')\n\n const historyInstance = createHistoryInstance<HistoryItem>({\n onChange: (updatedHistory) => (history = updatedHistory)\n })\n\n let history: History<HistoryItem> = historyInstance.get()\n\n let mode = externalMode\n\n function applyExternalMode(externalMode: Mode) {\n if (externalMode === mode) {\n return\n }\n\n const item: ModeHistoryItem = {\n type: 'mode',\n undo: { mode, selection: undefined },\n redo: { mode: externalMode, selection: undefined }\n }\n\n if (mode === 'text' && refTextMode) {\n // flush pending changes before adding a new history item\n refTextMode.flush()\n }\n\n debug('add history item', item)\n history.add(item)\n\n mode = externalMode\n }\n\n // eslint-disable-next-line svelte/no-unused-svelte-ignore\n // svelte-ignore reactive_declaration_non_reactive_property\n $: applyExternalMode(externalMode)\n\n function handleUndo(item: HistoryItem | undefined) {\n if (isModeHistoryItem(item)) {\n mode = item.undo.mode // important to prevent a new history item from being created\n\n // find the selection of the previous history item (if any), and use that as initial selection\n const items = history.items()\n const index = items.findIndex((i) => i === item)\n const prevItem = index !== -1 ? items[index - 1] : undefined\n debug('handleUndo', { index, item, items, prevItem })\n if (prevItem) {\n selection = prevItem.redo.selection\n }\n\n onChangeMode(mode)\n }\n }\n\n function handleRedo(item: HistoryItem | undefined) {\n if (isModeHistoryItem(item)) {\n // prevent a new history item from being created\n mode = item.redo.mode\n\n // find the selection of the next history item (if any), and use that as initial selection\n const items = history.items()\n const index = items.findIndex((i) => i === item)\n const nextItem = index !== -1 ? items[index + 1] : undefined\n debug('handleRedo', { index, item, items, nextItem })\n if (nextItem) {\n selection = nextItem.undo.selection\n }\n\n onChangeMode(mode)\n }\n }\n\n let modeMenuItems: MenuItem[]\n $: modeMenuItems = [\n {\n type: 'button',\n text: '文本视图',\n title: `切换到文本视图 (当前模式: ${mode})`,\n className: 'jse-group-button jse-first' + (mode === Mode.text ? ' jse-selected' : ''),\n onClick: () => onChangeMode(Mode.text)\n },\n {\n type: 'button',\n text: '树形视图',\n title: `切换到树形视图 (当前模式: ${mode})`,\n className: 'jse-group-button ' + (mode === Mode.tree ? ' jse-selected' : ''),\n onClick: () => onChangeMode(Mode.tree)\n },\n {\n type: 'button',\n text: '表格视图',\n title: `切换到表格视图 (当前模式: ${mode})`,\n className: 'jse-group-button jse-last' + (mode === Mode.table ? ' jse-selected' : ''),\n onClick: () => onChangeMode(Mode.table)\n }\n ]\n\n const separatorMenuItem: MenuSeparator = {\n type: 'separator'\n }\n\n let handleRenderMenu: OnRenderMenuInternal\n $: handleRenderMenu = (items: MenuItem[]) => {\n const updatedItems = isMenuSpace(items[0])\n ? modeMenuItems.concat(items) // menu is empty, readOnly mode\n : modeMenuItems.concat(separatorMenuItem, items)\n\n const updatedItemsOriginal = cloneDeep(updatedItems) // the user may change updatedItems in the callback\n\n return (\n onRenderMenu(updatedItems, { mode, modal: insideModal, readOnly }) || updatedItemsOriginal\n )\n }\n\n let handleRenderContextMenu: OnRenderContextMenuInternal\n $: handleRenderContextMenu = (items: ContextMenuItem[]) => {\n const itemsOriginal = cloneDeep(items) // the user may change items in the callback\n\n return (\n onRenderContextMenu(items, { mode, modal: insideModal, readOnly, selection }) ??\n (readOnly ? false : itemsOriginal)\n )\n }\n\n export function patch(operations: JSONPatchDocument): JSONPatchResult {\n if (refTreeMode) {\n // Note that tree mode has an optional afterPatch callback.\n // right now we don's support this in the public API.\n return refTreeMode.patch(operations)\n }\n\n if (refTableMode) {\n // Note that tree mode has an optional afterPatch callback.\n // right now we don's support this in the public API.\n return refTableMode.patch(operations)\n }\n\n if (refTextMode) {\n return refTextMode.patch(operations)\n }\n\n throw new Error(`Method patch is not available in mode \"${mode}\"`)\n }\n\n export function expand(path: JSONPath, callback?: OnExpand): void {\n if (refTreeMode) {\n return refTreeMode.expand(path, callback)\n } else if (refTextMode) {\n return refTextMode.expand(path, callback)\n } else {\n throw new Error(`Method expand is not available in mode \"${mode}\"`)\n }\n }\n\n export function collapse(path: JSONPath, recursive: boolean): void {\n if (refTreeMode) {\n return refTreeMode.collapse(path, recursive)\n } else if (refTextMode) {\n return refTextMode.collapse(path, recursive)\n } else {\n throw new Error(`Method collapse is not available in mode \"${mode}\"`)\n }\n }\n\n /**\n * Open the transform modal\n */\n export function transform(options: TransformModalOptions): void {\n if (refTextMode) {\n refTextMode.openTransformModal(options)\n } else if (refTreeMode) {\n refTreeMode.openTransformModal(options)\n } else if (refTableMode) {\n refTableMode.openTransformModal(options)\n } else {\n throw new Error(`Method transform is not available in mode \"${mode}\"`)\n }\n }\n\n /**\n * Validate the contents of the editor using the configured validator.\n * Returns a parse error or a list with validation warnings\n */\n export function validate(): ContentErrors | undefined {\n if (refTextMode) {\n return refTextMode.validate()\n } else if (refTreeMode) {\n return refTreeMode.validate()\n } else if (refTableMode) {\n return refTableMode.validate()\n } else {\n throw new Error(`Method validate is not available in mode \"${mode}\"`)\n }\n }\n\n /**\n * In tree mode, invalid JSON is automatically repaired when loaded. When the\n * repair was successful, the repaired contents are rendered but not yet\n * applied to the document itself until the user clicks \"Ok\" or starts editing\n * the data. Instead of accepting the repair, the user can also click\n * \"Repair manually instead\". Invoking `.acceptAutoRepair()` will\n * programmatically accept the repair. This will trigger an update,\n * and the method itself also returns the updated contents. In case of text\n * mode or when the editor is not in an \"accept auto repair\" status, nothing\n * will happen, and the contents will be returned as is.\n */\n export function acceptAutoRepair(): Content {\n if (refTreeMode) {\n return refTreeMode.acceptAutoRepair()\n } else {\n return content\n }\n }\n\n export function scrollTo(path: JSONPath): Promise<void> {\n if (refTreeMode) {\n return refTreeMode.scrollTo(path)\n } else if (refTableMode) {\n return refTableMode.scrollTo(path)\n } else {\n // TODO: implement scrollTo for text mode\n throw new Error(`Method scrollTo is not available in mode \"${mode}\"`)\n }\n }\n\n export function findElement(path: JSONPath): Element | undefined {\n if (refTreeMode) {\n return refTreeMode.findElement(path)\n } else if (refTableMode) {\n return refTableMode.findElement(path)\n } else {\n throw new Error(`Method findElement is not available in mode \"${mode}\"`)\n }\n }\n\n export function focus() {\n if (refTextMode) {\n refTextMode.focus()\n } else if (refTreeMode) {\n refTreeMode.focus()\n } else if (refTableMode) {\n refTableMode.focus()\n }\n }\n\n export async function refresh(): Promise<void> {\n if (refTextMode) {\n await refTextMode.refresh()\n } else {\n // nothing to do in tree or table mode (also: don't throw an exception or so,\n // that annoying having to reckon with that when using .refresh()).\n }\n }\n</script>\n\n{#if mode === Mode.text || String(mode) === 'code'}\n <TextMode\n bind:this={refTextMode}\n externalContent={content}\n externalSelection={selection}\n {history}\n {readOnly}\n {indentation}\n {tabSize}\n {mainMenuBar}\n {statusBar}\n {askToFormat}\n {escapeUnicodeCharacters}\n maxDocumentSize={maxDocumentSizeTextMode}\n {parser}\n {validator}\n {validationParser}\n {onChange}\n {onChangeMode}\n {onSelect}\n onUndo={handleUndo}\n onRedo={handleRedo}\n {onError}\n {onFocus}\n {onBlur}\n onRenderMenu={handleRenderMenu}\n {onSortModal}\n {onTransformModal}\n />\n{:else if mode === Mode.table}\n <TableMode\n bind:this={refTableMode}\n externalContent={content}\n externalSelection={selection}\n {history}\n {readOnly}\n {truncateTextSize}\n {mainMenuBar}\n {escapeControlCharacters}\n {escapeUnicodeCharacters}\n {flattenColumns}\n {parser}\n {parseMemoizeOne}\n {validator}\n {validationParser}\n {indentation}\n {onChange}\n {onChangeMode}\n {onSelect}\n onUndo={handleUndo}\n onRedo={handleRedo}\n {onRenderValue}\n {onFocus}\n {onBlur}\n onRenderMenu={handleRenderMenu}\n onRenderContextMenu={handleRenderContextMenu}\n {onSortModal}\n {onTransformModal}\n {onJSONEditorModal}\n />\n{:else}\n <!-- mode === Mode.tree -->\n <TreeMode\n bind:this={refTreeMode}\n externalContent={content}\n externalSelection={selection}\n {history}\n {readOnly}\n {indentation}\n {truncateTextSize}\n {mainMenuBar}\n {navigationBar}\n {escapeControlCharacters}\n {escapeUnicodeCharacters}\n {parser}\n {parseMemoizeOne}\n {validator}\n {validationParser}\n {pathParser}\n {onError}\n {onChange}\n {onChangeMode}\n {onSelect}\n onUndo={handleUndo}\n onRedo={handleRedo}\n {onRenderValue}\n {onClassName}\n {onFocus}\n {onBlur}\n onRenderMenu={handleRenderMenu}\n onRenderContextMenu={handleRenderContextMenu}\n {onSortModal}\n {onTransformModal}\n {onJSONEditorModal}\n />\n{/if}\n","import type { NumberOption, PathOption } from '$lib/types.js'\n\nexport interface SortModalState {\n selectedProperty: PathOption\n selectedDirection: NumberOption\n}\n\nexport const sortModalStates: Record<string, SortModalState> = {}\n","<svelte:options accessors={false} immutable={true} />\n\n<script lang=\"ts\">\n import { createDebug } from '../utils/debug.js'\n import { uniqueId } from '../utils/uniqueId.js'\n import { isEqualParser, isJSONContent, validateContentType } from '../utils/jsonUtils.js'\n import AbsolutePopup from './modals/popup/AbsolutePopup.svelte'\n import { jsonQueryLanguage } from '$lib/plugins/query/jsonQueryLanguage.js'\n import { renderValue } from '$lib/plugins/value/renderValue.js'\n import { flushSync } from 'svelte'\n import TransformModal from './modals/TransformModal.svelte'\n import type {\n Content,\n ContentErrors,\n ContextMenuItem,\n JSONEditorModalCallback,\n JSONEditorModalProps,\n JSONEditorPropsOptional,\n JSONEditorSelection,\n JSONParser,\n JSONPatchResult,\n JSONPathParser,\n MenuItem,\n OnBlur,\n OnChange,\n OnChangeMode,\n OnChangeQueryLanguage,\n OnChangeStatus,\n OnClassName,\n OnError,\n OnExpand,\n OnFocus,\n OnRenderMenu,\n OnRenderValue,\n OnSelect,\n QueryLanguage,\n SortModalCallback,\n TransformModalCallback,\n TransformModalOptions,\n TransformModalProps,\n Validator\n } from '$lib/types'\n import type { OnRenderContextMenu } from '$lib/types.js'\n import { Mode } from '$lib/types.js'\n import type { JSONPatchDocument, JSONPath } from 'immutable-json-patch'\n import { noop } from '../utils/noop.js'\n import { parseJSONPath, stringifyJSONPath } from '$lib/utils/pathUtils.js'\n import JSONEditorRoot from './modes/JSONEditorRoot.svelte'\n import JSONEditorModal from './modals/JSONEditorModal.svelte'\n import memoizeOne from 'memoize-one'\n import { cloneDeep } from 'lodash-es'\n import SortModal from './modals/SortModal.svelte'\n\n // TODO: document how to enable debugging in the readme: localStorage.debug=\"jsoneditor:*\", then reload\n const debug = createDebug('jsoneditor:JSONEditor')\n\n const contentDefault = { text: '' }\n const selectionDefault = undefined\n const readOnlyDefault = false\n const indentationDefault = 2\n const tabSizeDefault = 4\n const truncateTextSizeDefault = 1000\n const modeDefault = Mode.tree\n const mainMenuBarDefault = true\n const navigationBarDefault = true\n const statusBarDefault = true\n const askToFormatDefault = true\n const escapeControlCharactersDefault = false\n const escapeUnicodeCharactersDefault = false\n const maxDocumentSizeTextModeDefault = 10 * 1024 * 1024 // 10MB\n const flattenColumnsDefault = true\n const parserDefault = JSON\n const validatorDefault = undefined\n const validationParserDefault = JSON\n const pathParserDefault = {\n parse: parseJSONPath,\n stringify: stringifyJSONPath\n }\n const queryLanguagesDefault = [jsonQueryLanguage]\n const queryLanguageIdDefault = queryLanguagesDefault[0].id\n const onChangeQueryLanguageDefault = noop\n const onChangeDefault = undefined\n const onSelectDefault = undefined\n const onRenderValueDefault = renderValue\n const onClassNameDefault = noop\n const onRenderMenuDefault = noop\n const onRenderContextMenuDefault = noop\n const onChangeModeDefault = noop\n const onErrorDefault: OnError = (err) => {\n console.error(err)\n alert(err.toString()) // TODO: create a nice alert modal\n }\n const onFocusDefault = noop\n const onBlurDefault = noop\n\n export let content: Content = contentDefault\n export let selection: JSONEditorSelection | undefined = selectionDefault\n export let readOnly: boolean = readOnlyDefault\n export let indentation: number | string = indentationDefault\n export let tabSize: number = tabSizeDefault\n export let truncateTextSize: number = truncateTextSizeDefault\n export let mode: Mode = modeDefault\n export let mainMenuBar: boolean = mainMenuBarDefault\n export let navigationBar: boolean = navigationBarDefault\n export let statusBar: boolean = statusBarDefault\n export let askToFormat: boolean = askToFormatDefault\n export let escapeControlCharacters: boolean = escapeControlCharactersDefault\n export let escapeUnicodeCharacters: boolean = escapeUnicodeCharactersDefault\n export let maxDocumentSizeTextMode: number = maxDocumentSizeTextModeDefault\n export let flattenColumns: boolean = flattenColumnsDefault\n export let parser: JSONParser = parserDefault\n export let validator: Validator | undefined = validatorDefault\n export let validationParser: JSONParser = validationParserDefault\n export let pathParser: JSONPathParser = pathParserDefault\n export let queryLanguages: QueryLanguage[] = queryLanguagesDefault\n export let queryLanguageId: string = queryLanguageIdDefault\n export let onChangeQueryLanguage: OnChangeQueryLanguage = onChangeQueryLanguageDefault\n export let onChange: OnChange | undefined = onChangeDefault\n export let onSelect: OnSelect | undefined = onSelectDefault\n export let onRenderValue: OnRenderValue = onRenderValueDefault\n export let onClassName: OnClassName = onClassNameDefault\n export let onRenderMenu: OnRenderMenu = onRenderMenuDefault\n export let onRenderContextMenu: OnRenderContextMenu = onRenderContextMenuDefault\n export let onChangeMode: OnChangeMode = onChangeModeDefault\n export let onError: OnError = onErrorDefault\n export let onFocus: OnFocus = onFocusDefault\n export let onBlur: OnBlur = onBlurDefault\n\n let instanceId = uniqueId()\n let hasFocus = false\n let refJSONEditorRoot: JSONEditorRoot\n let jsonEditorModalProps: JSONEditorModalProps | undefined = undefined\n let sortModalProps: SortModalCallback | undefined\n let transformModalProps: TransformModalProps | undefined\n\n $: {\n const contentError = validateContentType(content)\n if (contentError) {\n console.error('Error: ' + contentError)\n }\n }\n\n // backward compatibility warning since v1.0.0\n $: if (selection === null) {\n console.warn('selection is invalid: it is null but should be undefined')\n }\n\n // We memoize the last parse result for the case when the content is text and very large.\n // In that case parsing takes a few seconds. When the user switches between tree and table mode,\n // without having made a change, we do not want to parse the text again.\n $: parseMemoizeOne = memoizeOne(parser.parse)\n\n // rerender the full editor when the parser changes. This is needed because\n // numeric state is hold at many places in the editor.\n let previousParser = parser\n $: {\n if (!isEqualParser(parser, previousParser)) {\n debug('parser changed, recreate editor')\n\n if (isJSONContent(content)) {\n const text = previousParser.stringify(content.json)\n content = {\n json: text !== undefined ? parser.parse(text) : undefined\n }\n }\n\n previousParser = parser\n\n // new editor id -> will re-create the editor\n instanceId = uniqueId()\n }\n }\n\n export function get(): Content {\n return content\n }\n\n export function set(newContent: Content): void {\n debug('set')\n\n const contentError = validateContentType(newContent)\n if (contentError) {\n throw new Error(contentError)\n }\n\n // new editor id -> will re-create the editor\n instanceId = uniqueId()\n\n // update content *after* re-render, so that the new editor will trigger an onChange event\n content = newContent\n\n flushSync()\n }\n\n export function update(updatedContent: Content): void {\n debug('update')\n\n const contentError = validateContentType(updatedContent)\n if (contentError) {\n throw new Error(contentError)\n }\n\n content = updatedContent\n\n flushSync()\n }\n\n export function patch(operations: JSONPatchDocument): JSONPatchResult {\n // Note that patch has an optional afterPatch callback.\n // right now we don's support this in the public API.\n const result = refJSONEditorRoot.patch(operations)\n\n flushSync()\n\n return result\n }\n\n export function select(newSelection: JSONEditorSelection | undefined): void {\n selection = newSelection\n\n flushSync()\n }\n\n export function expand(path: JSONPath, callback?: OnExpand): void {\n refJSONEditorRoot.expand(path, callback)\n\n flushSync()\n }\n\n export function collapse(path: JSONPath, recursive = false): void {\n refJSONEditorRoot.collapse(path, recursive)\n\n flushSync()\n }\n\n /**\n * Open the transform modal\n */\n export function transform(options: TransformModalOptions = {}): void {\n refJSONEditorRoot.transform(options)\n\n flushSync()\n }\n\n /**\n * Validate the contents of the editor using the configured validator.\n * Returns a parse error or a list with validation warnings\n */\n export function validate(): ContentErrors | undefined {\n return refJSONEditorRoot.validate()\n }\n\n /**\n * In tree mode, invalid JSON is automatically repaired when loaded. When the\n * repair was successful, the repaired contents are rendered but not yet\n * applied to the document itself until the user clicks \"Ok\" or starts editing\n * the data. Instead of accepting the repair, the user can also click\n * \"Repair manually instead\". Invoking `.acceptAutoRepair()` will\n * programmatically accept the repair. This will trigger an update,\n * and the method itself also returns the updated contents. In case of text\n * mode or when the editor is not in an \"accept auto repair\" status, nothing\n * will happen, and the contents will be returned as is.\n */\n export function acceptAutoRepair(): Content {\n const content = refJSONEditorRoot.acceptAutoRepair()\n\n flushSync()\n\n return content\n }\n\n export async function scrollTo(path: JSONPath): Promise<void> {\n await refJSONEditorRoot.scrollTo(path)\n }\n\n export function findElement(path: JSONPath): Element | undefined {\n return refJSONEditorRoot.findElement(path)\n }\n\n export function focus(): void {\n refJSONEditorRoot.focus()\n\n flushSync()\n }\n\n export async function refresh(): Promise<void> {\n await refJSONEditorRoot.refresh()\n }\n\n export function updateProps(props: JSONEditorPropsOptional): void {\n const names = Object.keys(props) as (keyof JSONEditorPropsOptional)[]\n\n for (const name of names) {\n switch (name) {\n case 'content':\n content = props[name] ?? contentDefault\n break\n case 'selection':\n selection = props[name] ?? selectionDefault\n break\n case 'readOnly':\n readOnly = props[name] ?? readOnlyDefault\n break\n case 'indentation':\n indentation = props[name] ?? indentationDefault\n break\n case 'tabSize':\n tabSize = props[name] ?? tabSizeDefault\n break\n case 'truncateTextSize':\n truncateTextSize = props[name] ?? truncateTextSizeDefault\n break\n case 'mode':\n mode = props[name] ?? modeDefault\n break\n case 'mainMenuBar':\n mainMenuBar = props[name] ?? mainMenuBarDefault\n break\n case 'navigationBar':\n navigationBar = props[name] ?? navigationBarDefault\n break\n case 'statusBar':\n statusBar = props[name] ?? statusBarDefault\n break\n case 'askToFormat':\n askToFormat = props[name] ?? askToFormatDefault\n break\n case 'escapeControlCharacters':\n escapeControlCharacters = props[name] ?? escapeControlCharactersDefault\n break\n case 'escapeUnicodeCharacters':\n escapeUnicodeCharacters = props[name] ?? escapeUnicodeCharactersDefault\n break\n case 'maxDocumentSizeTextMode':\n maxDocumentSizeTextMode = props[name] ?? maxDocumentSizeTextModeDefault\n break\n case 'flattenColumns':\n flattenColumns = props[name] ?? flattenColumnsDefault\n break\n case 'parser':\n parser = props[name] ?? parserDefault\n break\n case 'validator':\n validator = props[name] ?? validatorDefault\n break\n case 'validationParser':\n validationParser = props[name] ?? validationParserDefault\n break\n case 'pathParser':\n pathParser = props[name] ?? pathParserDefault\n break\n case 'queryLanguages':\n queryLanguages = props[name] ?? queryLanguagesDefault\n break\n case 'queryLanguageId':\n queryLanguageId = props[name] ?? queryLanguageIdDefault\n break\n case 'onChangeQueryLanguage':\n onChangeQueryLanguage = props[name] ?? onChangeQueryLanguageDefault\n break\n case 'onChange':\n onChange = props[name] ?? onChangeDefault\n break\n case 'onRenderValue':\n onRenderValue = props[name] ?? onRenderValueDefault\n break\n case 'onClassName':\n onClassName = props[name] ?? onClassNameDefault\n break\n case 'onRenderMenu':\n onRenderMenu = props[name] ?? onRenderMenuDefault\n break\n case 'onRenderContextMenu':\n onRenderContextMenu = props[name] ?? onRenderContextMenuDefault\n break\n case 'onChangeMode':\n onChangeMode = props[name] ?? onChangeModeDefault\n break\n case 'onSelect':\n onSelect = props[name] ?? onSelectDefault\n break\n case 'onError':\n onError = props[name] ?? onErrorDefault\n break\n case 'onFocus':\n onFocus = props[name] ?? onFocusDefault\n break\n case 'onBlur':\n onBlur = props[name] ?? onBlurDefault\n break\n\n default:\n // We should never reach this default case\n unknownProperty(name)\n }\n }\n\n if (!queryLanguages.some((queryLanguage) => queryLanguage.id === queryLanguageId)) {\n queryLanguageId = queryLanguages[0].id\n }\n\n function unknownProperty(name: never) {\n debug(`Unknown property \"${name}\"`)\n }\n\n flushSync()\n }\n\n export async function destroy() {\n throw new Error(\n 'class method destroy() is deprecated. ' +\n 'It is replaced with a method destroy() in the vanilla library.'\n )\n }\n\n function handleChange(updatedContent: Content, previousContent: Content, status: OnChangeStatus) {\n content = updatedContent\n\n if (onChange) {\n onChange(updatedContent, previousContent, status)\n }\n }\n\n function handleSelect(updatedSelection: JSONEditorSelection | undefined) {\n selection = updatedSelection\n\n if (onSelect) {\n onSelect(cloneDeep(updatedSelection))\n }\n }\n\n function handleFocus() {\n hasFocus = true\n if (onFocus) {\n onFocus()\n }\n }\n\n function handleBlur() {\n hasFocus = false\n if (onBlur) {\n onBlur()\n }\n }\n\n async function toggleMode(newMode: Mode) {\n if (mode === newMode) {\n return\n }\n\n mode = newMode\n\n flushSync()\n focus()\n\n onChangeMode(newMode)\n }\n\n function handleChangeQueryLanguage(newQueryLanguageId: string) {\n debug('handleChangeQueryLanguage', newQueryLanguageId)\n queryLanguageId = newQueryLanguageId\n onChangeQueryLanguage(newQueryLanguageId)\n }\n\n // The onTransformModal method is located in JSONEditor to prevent circular references:\n // TreeMode -> TransformModal -> TreeMode\n function onTransformModal({ id, json, rootPath, onTransform, onClose }: TransformModalCallback) {\n if (readOnly) {\n return\n }\n\n transformModalProps = {\n id,\n json,\n rootPath,\n indentation,\n truncateTextSize,\n escapeControlCharacters,\n escapeUnicodeCharacters,\n parser,\n parseMemoizeOne,\n validationParser,\n pathParser,\n queryLanguages,\n queryLanguageId,\n onChangeQueryLanguage: handleChangeQueryLanguage,\n onRenderValue,\n onRenderMenu: (items: MenuItem[]) => onRenderMenu(items, { mode, modal: true, readOnly }),\n onRenderContextMenu: (items: ContextMenuItem[]) =>\n onRenderContextMenu(items, { mode, modal: true, readOnly, selection }),\n onClassName,\n onTransform,\n onClose\n }\n }\n\n // The onSortModal is positioned here for consistency with TransformModal\n function onSortModal(props: SortModalCallback) {\n if (readOnly) {\n return\n }\n\n sortModalProps = props\n }\n\n // The onJSONEditorModal method is located in JSONEditor to prevent circular references:\n // JSONEditor -> TableMode -> JSONEditorModal -> JSONEditor\n function onJSONEditorModal({ content, path, onPatch, onClose }: JSONEditorModalCallback) {\n debug('onJSONEditorModal', { content, path })\n\n jsonEditorModalProps = {\n content,\n path,\n onPatch,\n\n readOnly,\n indentation,\n tabSize,\n truncateTextSize,\n mainMenuBar,\n navigationBar,\n statusBar,\n askToFormat,\n escapeControlCharacters,\n escapeUnicodeCharacters,\n maxDocumentSizeTextMode,\n flattenColumns,\n parser,\n validator: undefined, // TODO: support partial JSON validation?\n validationParser,\n pathParser,\n onRenderValue,\n onClassName,\n onRenderMenu,\n onRenderContextMenu,\n onSortModal,\n onTransformModal,\n onClose\n }\n }\n\n function handleKeyDown(event: KeyboardEvent) {\n // prevent browser addons from reacting to keyboard inputs inside the editor\n // see https://github.com/josdejong/svelte-jsoneditor/issues/512\n event.stopPropagation()\n }\n\n $: debug('mode changed to', mode)\n</script>\n\n<AbsolutePopup>\n <div class=\"jse-main\" class:jse-focus={hasFocus} on:keydown={handleKeyDown} role=\"none\">\n {#key instanceId}\n <JSONEditorRoot\n bind:this={refJSONEditorRoot}\n externalMode={mode}\n {content}\n {selection}\n {readOnly}\n {indentation}\n {tabSize}\n {truncateTextSize}\n {statusBar}\n {askToFormat}\n {mainMenuBar}\n {navigationBar}\n {maxDocumentSizeTextMode}\n {escapeControlCharacters}\n {escapeUnicodeCharacters}\n {flattenColumns}\n {parser}\n {parseMemoizeOne}\n {validator}\n {validationParser}\n {pathParser}\n insideModal={false}\n {onError}\n onChange={handleChange}\n onChangeMode={toggleMode}\n onSelect={handleSelect}\n {onRenderValue}\n {onClassName}\n onFocus={handleFocus}\n onBlur={handleBlur}\n {onRenderMenu}\n {onRenderContextMenu}\n {onSortModal}\n {onTransformModal}\n {onJSONEditorModal}\n />\n {/key}\n </div>\n\n {#if sortModalProps}\n <SortModal\n {...sortModalProps}\n onClose={() => {\n sortModalProps?.onClose()\n sortModalProps = undefined\n }}\n />\n {/if}\n\n {#if transformModalProps}\n <TransformModal\n {...transformModalProps}\n onClose={() => {\n transformModalProps?.onClose()\n transformModalProps = undefined\n }}\n />\n {/if}\n\n {#if jsonEditorModalProps}\n <JSONEditorModal\n {...jsonEditorModalProps}\n onClose={() => {\n jsonEditorModalProps?.onClose()\n jsonEditorModalProps = undefined\n }}\n />\n {/if}\n</AbsolutePopup>\n\n<style src=\"./JSONEditor.scss\"></style>\n","<svelte:options immutable={true} />\n\n<script lang=\"ts\">\n import { isEmpty } from 'lodash-es'\n import Select from 'svelte-select'\n import Header from './Header.svelte'\n import { getNestedPaths } from '$lib/utils/arrayUtils.js'\n import { pathToOption, stringifyJSONPath } from '$lib/utils/pathUtils.js'\n import { sortJson } from '$lib/logic/sort.js'\n import { sortModalStates } from './sortModalStates'\n import type { JSONPath } from 'immutable-json-patch'\n import { compileJSONPointer, getIn } from 'immutable-json-patch'\n import { createDebug } from '$lib/utils/debug.js'\n import type { OnSort } from '$lib/types.js'\n import Modal from './Modal.svelte'\n\n const debug = createDebug('jsoneditor:SortModal')\n\n export let id: string\n export let json: unknown // the whole document\n export let rootPath: JSONPath\n export let onSort: OnSort\n export let onClose: () => void\n\n $: selectedJson = getIn(json, rootPath)\n $: jsonIsArray = Array.isArray(selectedJson)\n $: paths = jsonIsArray ? getNestedPaths(selectedJson) : undefined\n $: properties = paths ? paths.map(pathToOption) : undefined\n\n const asc = {\n value: 1,\n label: '降序'\n }\n const desc = {\n value: -1,\n label: '升序'\n }\n const directions = [asc, desc]\n\n const stateId = `${id}:${compileJSONPointer(rootPath)}`\n let selectedProperty = sortModalStates[stateId]?.selectedProperty\n let selectedDirection = sortModalStates[stateId]?.selectedDirection || asc\n let sortError: string | undefined = undefined\n\n $: {\n // remember the selected values for the next time we open the SortModal\n // just in memory, not persisted\n sortModalStates[stateId] = {\n selectedProperty,\n selectedDirection\n }\n\n debug('store state in memory', stateId, sortModalStates[stateId])\n }\n\n function handleSort() {\n try {\n sortError = undefined\n\n const itemPath: JSONPath = selectedProperty?.value || properties?.[0]?.value || []\n const direction = selectedDirection?.value\n const operations = sortJson(json, rootPath, itemPath, direction)\n if (onSort !== undefined && rootPath !== undefined) {\n onSort({ operations, rootPath, itemPath, direction })\n }\n\n onClose()\n } catch (err) {\n sortError = String(err)\n }\n }\n\n function focus(element: HTMLElement) {\n element.focus()\n }\n</script>\n\n<Modal {onClose} className=\"jse-sort-modal\">\n <Header title={jsonIsArray ? '数组排序' : '对象排序'} {onClose} />\n\n <div class=\"jse-modal-contents\">\n <table>\n <colgroup>\n <col width=\"25%\" />\n <col width=\"75%\" />\n </colgroup>\n <tbody>\n <tr>\n <th>节点</th>\n <td>\n <input\n class=\"jse-path\"\n type=\"text\"\n readonly\n title=\"选择的节点\"\n value={rootPath && !isEmpty(rootPath) ? stringifyJSONPath(rootPath) : '(整个文档)'}\n />\n </td>\n </tr>\n {#if jsonIsArray && properties && properties?.length > 1}\n <tr>\n <th>属性</th>\n <td>\n <Select showChevron items={properties} bind:value={selectedProperty} />\n </td>\n </tr>\n {/if}\n <tr>\n <th>排序</th>\n <td>\n <Select\n showChevron\n clearable={false}\n items={directions}\n bind:value={selectedDirection}\n />\n </td>\n </tr>\n </tbody>\n </table>\n\n <div class=\"jse-space\">\n {#if sortError}\n <div class=\"jse-error\">\n {sortError}\n </div>\n {/if}\n </div>\n\n <div class=\"jse-actions\">\n <button\n type=\"button\"\n class=\"jse-primary\"\n on:click={handleSort}\n use:focus\n disabled={jsonIsArray && properties && properties?.length > 1 ? !selectedProperty : false}\n >\n 排序\n </button>\n </div>\n </div>\n</Modal>\n\n<style src=\"./SortModal.scss\"></style>\n","<svelte:options immutable={true} />\n\n<script lang=\"ts\">\n import { flushSync, onMount } from 'svelte'\n import Header from './Header.svelte'\n import type { JSONPatchDocument, JSONPath } from 'immutable-json-patch'\n import { compileJSONPointer, immutableJSONPatch, isJSONArray } from 'immutable-json-patch'\n import { createDebug } from '$lib/utils/debug.js'\n import type {\n Content,\n JSONEditorModalCallback,\n JSONEditorSelection,\n JSONParser,\n JSONPathParser,\n OnClassName,\n OnPatch,\n OnRenderContextMenu,\n OnRenderMenu,\n OnRenderValue,\n OnSortModal,\n OnTransformModal,\n Validator\n } from '$lib/types'\n import { Mode } from '$lib/types.js'\n import JSONEditorRoot from '../modes/JSONEditorRoot.svelte'\n import { noop } from '$lib/utils/noop.js'\n import { stringifyJSONPath } from '$lib/utils/pathUtils.js'\n import { initial, isEmpty, last } from 'lodash-es'\n import { isJSONContent, toJSONContent } from '$lib/utils/jsonUtils.js'\n import Icon from 'svelte-awesome'\n import { faCaretLeft } from '@fortawesome/free-solid-svg-icons'\n import memoizeOne from 'memoize-one'\n import { getFocusPath, isJSONSelection } from '$lib/logic/selection.js'\n import Modal from './Modal.svelte'\n import AbsolutePopup from './popup/AbsolutePopup.svelte'\n\n const debug = createDebug('jsoneditor:JSONEditorModal')\n\n export let content: Content // the nested document\n export let path: JSONPath\n export let onPatch: OnPatch\n\n export let readOnly: boolean\n export let indentation: number | string\n export let tabSize: number\n export let truncateTextSize: number\n export let mainMenuBar: boolean\n export let navigationBar: boolean\n export let statusBar: boolean\n export let askToFormat: boolean\n export let escapeControlCharacters: boolean\n export let escapeUnicodeCharacters: boolean\n export let maxDocumentSizeTextMode: number\n export let flattenColumns: boolean\n export let parser: JSONParser\n export let validator: Validator | undefined\n export let validationParser: JSONParser\n export let pathParser: JSONPathParser\n\n export let onRenderValue: OnRenderValue\n export let onClassName: OnClassName\n export let onRenderMenu: OnRenderMenu\n export let onRenderContextMenu: OnRenderContextMenu\n\n export let onSortModal: OnSortModal\n export let onTransformModal: OnTransformModal\n\n export let onClose: () => void\n\n interface ModalState {\n mode: Mode\n content: Content\n selection: JSONEditorSelection | undefined\n relativePath: JSONPath\n }\n\n let refEditor: JSONEditorRoot\n let fullscreen: boolean\n\n const rootState: ModalState = {\n mode: determineMode(content),\n content,\n selection: undefined,\n relativePath: path\n }\n let stack: ModalState[] = [rootState]\n\n $: currentState = last(stack) || rootState\n $: absolutePath = stack.flatMap((state) => state.relativePath)\n $: pathDescription = !isEmpty(absolutePath) ? stringifyJSONPath(absolutePath) : '(整个文档)'\n\n // not relevant in this Modal setting, but well\n $: parseMemoizeOne = memoizeOne(parser.parse)\n\n let error: string | undefined = undefined\n\n onMount(() => {\n refEditor?.focus()\n })\n\n function determineMode(content: Content): Mode {\n return isJSONContent(content) && isJSONArray(content.json) ? Mode.table : Mode.tree\n }\n\n function scrollToSelection() {\n const selection: JSONEditorSelection | undefined = last(stack)?.selection\n if (isJSONSelection(selection)) {\n refEditor.scrollTo(getFocusPath(selection))\n }\n }\n\n function handleApply() {\n debug('handleApply')\n\n if (readOnly) {\n return\n }\n\n try {\n error = undefined\n\n const path = currentState.relativePath\n const content = currentState.content\n const operations: JSONPatchDocument = [\n {\n op: 'replace',\n path: compileJSONPointer(path),\n value: toJSONContent(content, parser).json // this can throw an error\n }\n ]\n\n if (stack.length > 1) {\n const parentContent = stack[stack.length - 2].content\n const parentJson = toJSONContent(parentContent, parser).json\n const updatedParentContent = {\n json: immutableJSONPatch(parentJson, operations)\n }\n\n // after successfully updated, remove from the stack and apply the change to the parent\n const parentState = stack[stack.length - 2] || rootState\n const updatedParentState: ModalState = { ...parentState, content: updatedParentContent }\n stack = [...stack.slice(0, stack.length - 2), updatedParentState]\n flushSync()\n scrollToSelection()\n } else {\n onPatch(operations)\n\n onClose()\n }\n } catch (err) {\n error = String(err)\n }\n }\n\n function handleClose() {\n debug('handleClose')\n\n if (stack.length > 1) {\n // remove the last item from the stack\n stack = initial(stack)\n flushSync()\n refEditor?.focus()\n scrollToSelection()\n\n // clear any error from the just closed state\n error = undefined\n } else {\n // this is the first modal, the root state, close the modal\n onClose()\n }\n }\n\n function handleChange(updatedContent: Content) {\n debug('handleChange', updatedContent)\n updateState((state) => ({ ...state, content: updatedContent }))\n }\n\n function handleChangeSelection(newSelection: JSONEditorSelection | undefined) {\n debug('handleChangeSelection', newSelection)\n updateState((state) => ({ ...state, selection: newSelection }))\n }\n\n function handleChangeMode(newMode: Mode) {\n debug('handleChangeMode', newMode)\n updateState((state) => ({ ...state, mode: newMode }))\n }\n\n function updateState(callback: (state: ModalState) => ModalState) {\n const state = last(stack) as ModalState\n const updatedState = callback(state)\n stack = [...initial(stack), updatedState]\n }\n\n function handleError(newError: Error) {\n error = newError.toString()\n console.error(newError)\n }\n\n function handleJSONEditorModal({ content, path }: JSONEditorModalCallback) {\n debug('handleJSONEditorModal', { content, path })\n\n const nestedModalState = {\n mode: determineMode(content),\n content,\n selection: undefined,\n relativePath: path\n }\n stack = [...stack, nestedModalState]\n\n flushSync()\n refEditor?.focus()\n }\n\n function focus(element: HTMLElement) {\n element.focus()\n }\n</script>\n\n<Modal onClose={handleClose} className=\"jse-jsoneditor-modal\" {fullscreen}>\n <div class=\"jse-modal-wrapper\">\n <AbsolutePopup>\n <Header\n title=\"编辑嵌套内容 {stack.length > 1 ? ` (${stack.length})` : ''}\"\n fullScreenButton={true}\n bind:fullscreen\n onClose={handleClose}\n />\n\n <div class=\"jse-modal-contents\">\n <div class=\"jse-label\">\n <div class=\"jse-label-inner\">路径</div>\n </div>\n <input class=\"jse-path\" type=\"text\" readonly title=\"选择路径\" value={pathDescription} />\n\n <div class=\"jse-label\">\n <div class=\"jse-label-inner\">内容</div>\n </div>\n\n <div class=\"jse-modal-inline-editor\">\n <JSONEditorRoot\n bind:this={refEditor}\n externalMode={currentState.mode}\n content={currentState.content}\n selection={currentState.selection}\n {readOnly}\n {indentation}\n {tabSize}\n {truncateTextSize}\n {statusBar}\n {askToFormat}\n {mainMenuBar}\n {navigationBar}\n {escapeControlCharacters}\n {escapeUnicodeCharacters}\n {maxDocumentSizeTextMode}\n {flattenColumns}\n {parser}\n {parseMemoizeOne}\n {validator}\n {validationParser}\n {pathParser}\n insideModal={true}\n onError={handleError}\n onChange={handleChange}\n onChangeMode={handleChangeMode}\n onSelect={handleChangeSelection}\n {onRenderValue}\n {onClassName}\n onFocus={noop}\n onBlur={noop}\n {onRenderMenu}\n {onRenderContextMenu}\n {onSortModal}\n {onTransformModal}\n onJSONEditorModal={handleJSONEditorModal}\n />\n </div>\n\n <div class=\"jse-actions\">\n {#if error}\n <div class=\"jse-error\">\n {error}\n </div>\n {/if}\n\n {#if stack.length > 1}\n <button type=\"button\" class=\"jse-secondary\" on:click={handleClose}>\n <Icon data={faCaretLeft} /> 返回\n </button>\n {/if}\n {#if !readOnly}\n <button type=\"button\" class=\"jse-primary\" on:click={handleApply} use:focus>\n 应用\n </button>\n {:else}\n <button type=\"button\" class=\"jse-primary\" on:click={handleClose}> 关闭 </button>\n {/if}\n </div>\n </div>\n </AbsolutePopup>\n </div>\n</Modal>\n\n<style src=\"./JSONEditorModal.scss\"></style>\n","import JsonEditor from './components/JSONEditor.svelte'\nimport type { JSONEditorPropsOptional } from '$lib/types'\nimport { flushSync, mount, unmount } from 'svelte'\n\n// Note: index.ts exports `JSONEditor`, but we will override this on purpose\n// since we cannot use it in the vanilla environment starting in Svelte 5.\nexport * from './index'\n\nexport interface CreateJSONEditorProps {\n target: HTMLDivElement\n props: JSONEditorPropsOptional\n}\n\nexport { JsonEditor }\n\nexport function createJSONEditor({ target, props }: Parameters<typeof mount>[1]): JsonEditor {\n const editor = mount(JsonEditor, { target, props })\n\n editor.destroy = async () => unmount(editor)\n\n flushSync()\n\n return editor as JsonEditor\n}\n\n/**\n * @deprecated The constructor \"new JSONEditor(...)\" is deprecated. Please use \"createJSONEditor(...)\" instead.\n */\nexport function JSONEditor({ target, props }: CreateJSONEditorProps) {\n // TODO: deprecation warning since v1. Remove some day\n console.warn(\n 'WARNING: the constructor \"new JSONEditor(...)\" is deprecated since v1. ' +\n 'Please use \"createJSONEditor(...)\" instead.'\n )\n\n return createJSONEditor({ target, props })\n}\n"],"names":["_window$__svelte","_window$__svelte$v","_window","_window$__svelte2","window","__svelte","v","Set","add","legacy_mode_flag","UNINITIALIZED","Symbol","NAMESPACE_HTML","is_array","Array","isArray","index_of","prototype","indexOf","includes","array_from","from","define_property","Object","defineProperty","get_descriptor","getOwnPropertyDescriptor","get_descriptors","getOwnPropertyDescriptors","object_prototype","array_prototype","get_prototype_of","getPrototypeOf","is_extensible","isExtensible","is_function","thing","noop","noop$2","run","fn","run_all","arr","i","length","deferred","resolve","reject","promise","Promise","res","rej","MANAGED_EFFECT","BLOCK_EFFECT","BRANCH_EFFECT","ROOT_EFFECT","CONNECTED","CLEAN","DIRTY","MAYBE_DIRTY","INERT","DESTROYED","REACTION_RAN","DESTROYING","EFFECT_TRANSPARENT","EAGER_EFFECT","EFFECT_PRESERVED","EFFECT_OFFSCREEN","WAS_MARKED","REACTION_IS_UPDATING","ERROR_VALUE","STATE_SYMBOL","LEGACY_PROPS","LOADING_ATTR_SYMBOL","STALE_REACTION","Error","constructor","arguments","_defineProperty","this","IS_XHTML","_globalThis$document","globalThis","document","contentType","lifecycle_outside_component","name","equals","value","safe_not_equal","a","b","safe_equals","component_context","set_component_context","context","getContext","key","get_or_init_context_map","get","push","props","p","c","e","s","x","r","l","undefined","u","$","pop","component","effects","create_user_effect","is_runes","_component_context","_component_context$c","e.lifecycle_outside_component","Map","parent","context_map","get_parent_context","micro_tasks","run_micro_tasks","tasks","queue_micro_task","is_flushing_sync","queueMicrotask","flush_tasks","handle_error","error","effect","active_effect","active_reaction","f","invoke_error_boundary","STATUS_MASK","set_signal_status","signal","status","update_derived_status","derived","deps","clear_marked","dep","defer_effect","dirty_effects","maybe_dirty_effects","is_store_binding","batches","current_batch","batch_values","last_scheduled_effect","is_processing","collected_effects","legacy_updates","flush_count","uid","_commit_callbacks","WeakMap","_discard_callbacks","_pending","_blocking_pending","_deferred","_roots","_new_effects","_dirty_effects","_maybe_dirty_effects","_skipped_branches","_decrement_queued","_blockers","_Batch_brand","WeakSet","Batch","_classPrivateMethodInitSpec","_classPrivateFieldInitSpec","skip_effect","_classPrivateFieldGet","has","set","d","m","unskip_effect","tracked","delete","schedule","capture","source","old_value","_batch_values","is_derived","previous","current","activate","deactivate","flush","_assertClassBrand","_process","call","old_values","clear","discard","register_created_effect","increment","blocking","_classPrivateFieldGet2","pending_count","_classPrivateFieldGet3","blocking_pending_count","decrement","skip","_classPrivateFieldGet4","_classPrivateFieldGet5","_classPrivateFieldSet","transfer_effects","oncommit","ondiscard","settled","_classPrivateFieldGet6","ensure","batch","apply","_effect$b","is_pending","flags","_is_deferred","is_fork","size","_is_blocked","keys","skipped","e.effect_update_depth_exceeded","infinite_loop_guard","roots","render_effects","updates","root","_traverse","reset_all","t","_defer_effects","reset_branch","_classPrivateFieldGet7","flush_queued_effects","_next_batch","next_batch","filter","_commit","first","is_branch","is_dirty","update_effect","child","next","is_earlier","id","sources","batch_value","others","marked","checked","mark_effects","current_unequal","depends_on","flushSync","was_flushing_sync","_Batch","eager_block_effects","_eager_block_effects","nodes","teardown","ac","unlink_effect","ordered_effects","ancestor","j","reactions","reaction","schedule_effect","depends","_anchor","_hydrate_open","_props","_children","_effect","_main_effect","_pending_effect","_failed_effect","_offscreen_fragment","_local_pending_count","_pending_count","_pending_count_update_queued","_dirty_effects2","_maybe_dirty_effects2","_effect_pending","_effect_pending_subscriber","_Boundary_brand","Boundary","node","children","transform_error","_ref2","_this$parent2","start","stop","subscribers","version","effect_tracking","render_effect","untrack","_stop","anchor","block","_render","is_rendered","has_pending_snippet","pending","update_pending_count","_update_pending_count","internal_set","get_effect_pending","onerror","failed","destroy_effect","did_reset","calling_on_error","reset","console","warn","e.svelte_boundary_reset_onerror","pause_effect","_run","handle_error_result","transformed_error","branch","result","then","fragment","createDocumentFragment","move_effect","_resolve","previous_effect","previous_reaction","previous_ctx","set_active_effect","set_active_reaction","ctx","_this$parent","before","flatten","blockers","sync","async","derived_safe_equal","previous_component_context","previous_batch","restore","activate_batch","blocker_promise","all","map","decrement_pending","increment_pending","unset_context","finish","values","expression","e.async_derived_orphan","should_suspend","deferreds","create_effect","ASYNC","async_effect","finally","_deferreds$get","handler","fulfil","go","async_derived","catch","_current_batch","deactivate_batch","boundary","parent_derived","DERIVED","rv","wv","user_derived","push_reaction_value","execute_derived","prev_active_effect","get_derived_parent_effect","destroy_derived_effects","update_reaction","update_derived","_current_batch2","_current_batch3","_current_batch4","increment_write_version","is_destroying_effect","unfreeze_derived_effects","$window","is_firefox","first_child_getter","next_sibling_getter","eager_effects","eager_effects_deferred","stack","state","mutable_source","initial_value","_component_context$l","_component_context$l$","immutable","trackable","mutate","should_proxy","untracking","current_sources","e.state_unsafe_mutation","proxy","updated_during_traversal","mark_reactions","untracked_writes","set_untracked_writes","flush_eager_effects","update","runes","not_dirty","_batch_values2","is_proxied_array","parent_version","update_version","with_parent","set_update_version","Proxy","_","prop","descriptor","configurable","enumerable","writable","e.state_descriptors_fixed","deleteProperty","target","receiver","_get_descriptor","exists","Reflect","_get_descriptor2","_get_descriptor3","other_s","ls","n","Number","isInteger","ownKeys","own_keys","setPrototypeOf","e.state_prototype_fixed","get_proxied_value","_unused","is","create_text","createTextNode","get_first_child","get_next_sibling","is_text","first_child","Comment","data","sibling","count","next_sibling","create_element","tag","namespace","createElementNS","listening_to_form_reset","without_reactive_context","listen_to_event_and_reset_event","element","event","on_reset","addEventListener","prev","__on_r","evt","defaultPrevented","elements","_e$__on_r","validate_effect","rune","e.effect_orphan","e.effect_in_unowned_derived","e.effect_in_teardown","type","_current_batch5","last","parent_effect","parent_last","push_effect","_derived$effects","user_effect","_context$e","EFFECT","legacy_pre_effect","token","ran","legacy_pre_effect_reset","template_effect","managed","execute_effect_teardown","previously_destroying_effect","set_is_destroying_effect","destroy_effect_children","remove_dom","_loop","controller","abort","removed","end","remove_effect_dom","remove_reactions","transitions","transition","remove","callback","destroy","pause_children","remaining","check","out","local","is_global","resume_effect","resume_children","in","append","is_updating_effect","new_deps","skipped_deps","write_version","read_version","dependencies","dependency","schedule_possible_effect_self_invalidation","previous_deps","previous_skipped_deps","previous_untracked_writes","previous_sources","previous_untracking","previous_update_version","_current_batch6","_deps$i","_deps$i$reactions","remove_reaction","index","new_length","_e$teardown","_e$ac","freeze_derived_effects","start_index","was_updating_effect","destroy_block_effect_children","tick","_tick","_asyncToGenerator","_batch_values3","_active_reaction","_active_reaction$deps","depends_on_old_values","should_connect","is_new","reconnect","_dep$reactions","deep_read_state","EventTarget","deep_read","visited","Date","getTime","proto","descriptors","event_symbol","all_registered_events","root_event_handles","create_event","event_name","dom","options","target_handler","handle_event_propagation","cancelBubble","startsWith","passive","body","HTMLMediaElement","removeEventListener","delegated","_element$event_symbol","delegate","events","_event$composedPath","handler_element","owner_document","ownerDocument","path","composedPath","current_target","path_idx","handled_at","at_idx","handler_idx","throw_error","other_errors","parent_element","assignedSlot","parentNode","host","_current_target$event","_loop2","currentTarget","policy","_globalThis$window","trustedTypes","createPolicy","createHTML","html","create_fragment_from_html","elem","innerHTML","_policy$createHTML","create_trusted_html","replaceAll","content","assign_nodes","from_html","is_fragment","use_import_node","has_start","clone","importNode","cloneNode","lastChild","from_svg","ns","wrapped","concat","appendChild","from_namespace","text","comment","frag","createComment","DELEGATED_EVENTS","ATTRIBUTE_ALIASES","formnovalidate","ismap","nomodule","playsinline","readonly","defaultvalue","defaultchecked","srcobject","novalidate","allowfullscreen","disablepictureinpicture","disableremoteplayback","PASSIVE_EVENTS","is_passive_event","set_text","_text$__t","str","__t","nodeValue","mount","Component","_ref3","intro","transformError","test","navigator","userAgent","element_prototype","Element","node_prototype","Node","text_prototype","Text","__click","__className","__attributes","__style","__e","init_operations","unmount","outro","component_root","anchor_node","$$events","registered_events","event_handle","counts","listeners","_anchor_node$parentNo","removeChild","mounted_components","_mount","_batches","_onscreen","_offscreen","_outroing","_transition","_commit2","_discard","BranchManager","_this","onscreen","offscreen","k","_loop3","_k","_effect3","on_destroy","onMount","init_update_callbacks","cleanup","onDestroy","createEventDispatcher","active_component_context","detail","_active_component_con","callbacks","slice","bubbles","cancelable","CustomEvent","create_custom_event","beforeUpdate","e.lifecycle_legacy_only","_l$u","if_block","elseif","branches","update_branch","has_branch","offscreen_anchor","NAN","get_key","render_fn","legacy","destroy_effects","to_destroy","preserved_effects","items","_preserved_effects","each","get_collection","fallback_fn","array","fallback","each_array","collection","first_run","commit","seen","to_animate","is_animated","skip_to_branch","matched","stashed","_effect$nodes","measure","outrogroups","group","done","_effect$nodes2","unfix","link","move","_state$outrogroups2","destroy_length","controlled_anchor","_to_destroy$i$nodes","_to_destroy$i$nodes2","fix","_loop4","groups","fast_path","parent_node","textContent","_state$outrogroups","pause_effects","_effect$nodes3","reconcile","item","create_item","e.each_key_duplicate","dest","next_node","get_value","is_controlled","svg","mathml","_get_value","wrapper","slot","$$props","slot_props","_$$props$$$slots","slot_fn","$$slots","is_interop","get_component","_get_component","action","payload","inited","attach","get_fn","o","clsx","_clsx","whitespace","append_styles","styles","separator","css","to_css_name","toLowerCase","set_class","is_html","hash","prev_classes","next_classes","next_class_name","directives","classname","len","substring","to_class","removeAttribute","className","setAttribute","is_present","classList","toggle","update_styles","priority","style","removeProperty","setProperty","set_style","prev_styles","next_styles","next_style_attr","normal_styles","important_styles","new_style","String","trim","in_str","in_apo","in_comment","reserved_names","name_index","to_style","cssText","select_option","select","mounting","multiple","option","selected","get_option_value","selectedIndex","init_select","observer","MutationObserver","__value","observe","childList","subtree","attributes","attributeFilter","disconnect","CLASS","STYLE","IS_CUSTOM_ELEMENT","IS_HTML","OPTION_TAG","SELECT_TAG","PROGRESS_TAG","set_value","get_attributes","nodeName","set_attribute","attribute","skip_warning","get_setters","set_attributes","css_hash","_next$style","is_custom_element","preserve_attribute_case","is_option_element","class","prev_value","prefix","is_delegated","is_default","setters","_loop5","_key8","namespaceURI","hasAttribute","opts","event_handle_key","can_delegate_event","endsWith","is_capture_event","handle","autofocus","activeElement","focus","Boolean","set_selected","_ATTRIBUTE_ALIASES$na","normalize_attribute","input","use_default","defaultValue","defaultChecked","attribute_effect","should_remove_defaults","is_select","symbol","getOwnPropertySymbols","description","_element$__attributes","setters_cache","cache_key","getAttribute","element_proto","bind_value","_ref4","is_reset","is_numberlike_input","to_number","selectionStart","selectionEnd","Math","min","_x","bind_prop","desc","is_bound_this","bound_value","element_or_component","bind_this","component_effect","old_parts","parts","original_teardown","stopPropagation","_len3","args","_key0","preventDefault","_len4","_key1","init","changed","observe_all","RENDER_EFFECT","fns","reactive_import","bubble_event","_$$props$$$events","legacy_rest_props_handler","exclude","special","legacy_rest_props","spread_props_handler","spread_props","_len5","_key13","setter","bindable","lazy","fallback_value","fallback_dirty","get_fallback","_get_descriptor$set","_get_descriptor4","is_entry_props","getter","is_store_sub","previous_is_store_binding","capture_store_binding","e.props_invalid_value","legacy_parent","$$legacy","mutation","overridden","new_value","createDebug","enabled","debug","localStorage","_unused2","tryReadLocalStorage","enableDebug","color","charCodeAt","colors","abs","selectColor","_len6","_key14","log","uniqueId","int","parseInt","containsNumber","NUMBER_REGEX","isObject","isObjectOrArray","isBoolean","isTimestamp","isFinite","floor","isNaN","valueOf","_unused3","getColorCSS","colorTestDiv","createElement","applied","replace","isColor","valueType","parser","valueStr","stringify","isUrlRegex","isUrl","stringConvert","strTrim","parse","INTEGER_REGEX","ROOT_PATH","strictShallowEqual","getNestedPaths","includeObjects","pointersMap","TypeError","recurseNestedPaths","obj","compileJSONPointer","forEach","max","sort","parseJSONPointer","forEachIndex","iteratee","limit","arrayToObject","_objectSpread","objectToArray","object","moveItems","offset","copy","moving","splice","insertItemsAt","parseAndRepair","jsonText","_unused4","jsonrepair","parseAndRepairOrUndefined","partialJson","_unused5","parsePartialJson","END_WITH_COMMA_AND_OPTIONAL_WHITESPACES_REGEX","_unused6","_unused7","_unused8","repairPartialJson","_unused9","repaired","_unused0","_unused1","normalizeJsonParseError","parseErrorMessage","positionMatch","POSITION_REGEX","exec","position","line","character","charAt","countCharacterOccurrences","column","lastIndexOf","message","lineMatch","LINE_REGEX","lineOneBased","columnMatch","COLUMN_REGEX","columnOneBased","calculatePosition","findTextLocation","jsmap","jsonSourceMap","pointerName","pointer","pointers","pos","to","keyEnd","valueEnd","err","validateContentType","json","isContent","isTextContent","isJSONContent","toTextContent","indentation","JSON","toJSONContent","getText","isLargeContent","maxSize","estimateSerializedSize","Infinity","estimatedSize","recurse","isEqualParser","needsFormatting","head","DELIMITER_WITHOUT_SPACING_REGEX","Mode","SelectionType","CaretType","ValidationSeverity","SearchField","SortDirection","UpdateSelectionAfterChange","createNormalizationFunctions","_ref5","escapeControlCharacters","escapeUnicodeCharacters","normalizeControlAndUnicode","normalizeControl","normalizeUnicode","normalizeNothing","escapeValue","jsonEscapeUnicode","jsonEscapeControl","unescapeValue","jsonUnescapeControl","jsonUnescapeUnicode","_x$codePointAt","codePointAt","toString","unescaped","controlCharacters","_unused12","escapedControlCharacters","addNewLineSuffix","isChildOfNodeName","isChildOf","toUpperCase","isChildOfAttribute","predicate","findParent","getWindow","_element$ownerDocumen","_element$ownerDocumen2","defaultView","activeElementIsChildOf","findParentWithNodeName","getSelectionTypeFromTarget","inside","after","multi","encodeDataPath","encodeURIComponent","getDataPathFromTarget","_parent$getAttribute","dataPath","decodeURIComponent","findNearestElement","_ref6","allElements","currentElement","direction","hasPrio","margin","rect","getBoundingClientRect","width","height","calculateCenter","left","y","top","distance","weightY","diffX","diffY","sqrt","distanceToCurrent","candidate","candidatesLeft","button","isLeft","isRight","right","candidatesLeftOnRow","isOnSameRow","nearest","minBy","candidates","isAbove","isBelow","prioCandidates","isMacDevice","_ref7","_navigator$platform$t","_navigator","_navigator2","platform","userAgentData","keyComboFromEvent","combi","isCtrlKeyDown","altKey","shiftKey","keyName","metaKeys","join","isMac","ctrlKey","metaKey","Ctrl","Command","Control","Alt","Option","Shift","styleInject","ref","insertAt","getElementsByTagName","firstChild","insertBefore","styleSheet","popup","$.prop","closeAbsolutePopup","refRootPopup","$.mutable_source","refHiddenInput","closeWhenOutside","closeOnOuterClick","$.get","handleKeyDown","div","$.child","div_1","root_1","$$value","$.set","$.component","$.sibling","$$anchor","$$component","$.spread_props","$0","$.untrack","rootRect","positionAbove","positionLeft","offsetTop","offsetLeft","bottom","innerHeight","innerWidth","calculateStyle","$$render","consequent","$.event","$.append","popups","popupId","popupIndex","findIndex","onClose","setContext","openAbsolutePopup","$.each","AbsolutePopupEntry","findUniqueName","keysSet","nameWithoutCopySuffix","validName","truncate","maxLength","maxTextLength","ellipsis","parseString","lower","num","numFloat","parseFloat","jsonQueryLanguage","_json","queryOptions","projection","queryFunctions","relation","operator","paths","query","preprocessedJson","stringifyAndParse","jsonquery","cursor","raw","getRaw","rawData","ids","match","rawId","pointerId","g","$.html","iconData","scale","spin","inverse","pulse","flip","label","combinedStyle","box","normalisedScale","numScale","calculateRatio","iconName","icon","normaliseData","combined","_className","$$restProps","Svg","_get2","path_1","root_3","$.attribute_effect","_get3","polygons","polygon","polygon_1","root_4","Raw","_get4","readOnly","onPatch","$.derived_safe_equal","faCheckSquare","faSquare","Icon","classes","$.set_class","$.set_attribute","op","onChange","showOnTop","destroyColorPicker","_yield$import","colorPicker","default","onDone","hex","rgba","show","title","$.set_style","_get5","_getWindow$1$innerHei","_getWindow$","ColorPickerPopup","MAX_SEARCH_RESULTS","ARRAY_SECTION_SIZE","MAX_VALIDATION_ERRORS","MAX_CHARACTERS_TEXT_PREVIEW","DEFAULT_VISIBLE_SECTIONS","MAX_AUTO_REPAIRABLE_SIZE","MAX_MULTILINE_PASTE_SIZE","INSERT_EXPLANATION","CONTEXT_MENU_EXPLANATION","HOVER_INSERT_INSIDE","HOVER_INSERT_AFTER","HOVER_COLLECTION","JSON_STATUS_VALID","JSON_STATUS_REPAIRABLE","CONTEXT_MENU_HEIGHT","CONTEXT_MENU_WIDTH","SEARCH_BOX_HEIGHT","SORT_DIRECTION_NAMES","asc","mergeSections","sections","sortedSections","sortBy","section","mergedSections","sortedIndex","mergedIndex","nextRoundNumber","currentRoundNumber","isMenuSpace","isMenuSeparator","isMenuLabel","isMenuButton","isMenuDropDownButton","isContextMenuRow","isContextMenuColumn","isContentParseError","contentErrors","isContentValidationErrors","isValidationError","isNestedValidationError","isChildError","isSvelteComponentRenderer","isSvelteActionRenderer","isObjectRecursiveState","isArrayRecursiveState","isValueRecursiveState","isExpandableState","hasSearchResults","searchResults","isTreeHistoryItem","historyItem","isTextHistoryItem","isModeHistoryItem","createDocumentState","_ref0","expand","documentState","_ref9","factory","createArrayDocumentState","createObjectDocumentState","createValueDocumentState","createRecursiveState","documentStateFactory","expandPath","expanded","visibleSections","properties","ensureRecursiveState","_ref1","arrayState","itemState","setIn","objectState","syncDocumentState","_transformDocumentState","nestedJson","nestedState","updatedState","forEachVisibleIndex","itemPath","updatedItem","propPath","updatedProp","jsonArray","_ref10","toRecursiveStatePath","recursiveStatePath","partialPath","updateInDocumentState","some","inVisibleSection","newVisibleSection","expandVisibleSection","_loop6","nestedValue","nestedPath","_expandRecursively","collapsePath","recursive","_collapse","_collapseRecursively","documentStatePatch","operations","initial","reduce","operation","immutableJSONPatch","_documentStatePatch","isJSONPatchAdd","documentStateAdd","isJSONPatchRemove","documentStateRemove","isJSONPatchReplace","parsePath","enforceString","getEnforceString","setInDocumentState","isJSONPatchCopy","isJSONPatchMove","stateValue","getInRecursiveState","documentStateMoveOrCopy","getIn","_unused13","updateInRecursiveState","transform","ensuredState","updateIn","recursiveState","setInRecursiveState","_parent","shiftVisibleSections","parentPath","recursivePath","existsIn","deleteIn","deleteInDocumentState","merged","mergeAdjacentSections","getNextKeys","includeKey","getVisiblePaths","_recurse","isJSONArray","isJSONObject","getVisibleCaretPositions","includeInside","valueState","propertyPath","getNextVisiblePath","visiblePaths","expandSmart","expandMinimal","expandAll","expandSmartIfCollapsed","relativePath","expandSelf","expandNone","isAfterSelection","selection","isInsideSelection","isKeySelection","isValueSelection","isMultiSelection","isMultiSelectionWithOneItem","isEqual","focusPath","anchorPath","isJSONSelection","isTextSelection","getSelectionPaths","getAnchorPath","getFocusPath","sharedPath","findSharedPath","createMultiSelection","startPath","getStartPath","endPath","getEndPath","startIndex","getChildIndex","endIndex","iterateOverSelection","getParentPath","anchorIndex","getSelectionUp","keepAnchorPath","previousPath","visiblePathPointers","pathPointer","getPreviousVisiblePath","createValueSelection","isEmpty","createKeySelection","findCaretAndSiblings","caret","visibleCaretPositions","getInitialSelection","createSelectionFromOperations","every","firstOp","otherOps","path1","path2","singleItemSelected","findRootPath","pathStartsWith","removeEditModeFromSelection","isEditingSelection","createEditKeySelection","initialValue","edit","createEditValueSelection","createInsideSelection","createAfterSelection","isParent","selectionToPartialJson","hasSelectionContents","canConvert","fromCaretPosition","caretPosition","fromSelectionType","selectionType","selectionIfOverlapping","pathInSelection","pathIndex","classnames","_len7","_key18","arg","hasOwnProperty","getValueClass","mode","table","shortText","onCancel","onFind","onPaste","onValueClass","domValue","valueClass","closed","getDomValue","removeNewLineSuffix","innerText","setDomValue","updatedValue","$.mutate","range","createRange","getSelection","setStart","collapse","removeAllRanges","addRange","setCursorToEnd","newValue","no","combo","nextInside","clipboardData","clipboardText","getData","hasFocus","self","normalization","onPasteJson","onSelect","findNextInside","convert","handleCancelChange","EditableDiv","updateSelection","patchedState","patchedSelection","pastedText","pastedJson","contents","onPasteAsJson","patchedJson","_unused14","entry","afterKey","nextKeys","newProp","moveDown","rename","oldKey","newKey","filteredKeys","newKeyUnique","duplicate","lastPath","beforeKey","extract","insert","clipboard","_unused15","newValues","clipboardToValues","firstPath","removeAll","removeKeys","nextKey","firstKey","reverse","textIsObject","textIsArray","clipboardOriginal","clipboardRepaired","createRemoveOperations","newSelection","previousKey","revertJSONPatchWithMoveOperations","filteredOperations","processedOps","splitParentKey","_equalParentPath","movedKeys","_findKeyWithLowestKeyIndex","getOperation","renameOps","_filterRedundantMoveOperations","revertJSONPatch","revertOperations","createRevertMoveOperations","searchNext","searchResult","nextActiveIndex","activeIndex","nextActiveItem","active","activeItem","search","searchText","_options$maxResults","searchTextLowerCase","maxResults","columns","results","onMatch","searchRecursive","level","findCaseInsensitiveMatches","field","textLower","fieldIndex","replaceText","replacementText","replaceAllText","occurrences","updatedText","forEachRight","occurrence","createSearchAndReplaceOperations","searchResultItem","currentValue","currentValueText","getSearchResultPath","filterKeySearchResults","filtered","filterValueSearchResults","searchResultsFactory","toRecursiveSearchResults","searchResultItems","updateInSearchResults","flattenSearchResults","_node$searchResults","nested","flatMap","matches","previousEnd","precedingText","resultIndex","matchingText","lastMatch","splitValue","part","span","text_2","alternate","formatSize","kilo","factor","toFixed","KB","MB","GB","handleClick","$.derived","get_snippet","_len","_key4","_get_snippet","snippet","disabled","onclick","_get6","_len8","$$args","_key23","doTruncate","$.state","isTruncated","truncateTextSize","truncatedValue","valueIsUrl","handleShowMore","SearchResultHighlighter","Tag","$.template_effect","$.set_text","text_1","consequent_1","$.delegated","open","tooltip","_ref11","handleMouseEnter","Tooltip","handleMouseLeave","absolutePopupContext","faClock","$.action","$$node","$$action_arg","renderValue","renderers","isEditing","BooleanToggle","ColorPicker","EditableValue","ReadonlyValue","TimestampTag","stringifyJSONPath","integerNumberRegex","escapeQuotes","parseJSONPath","pathStr","parseProp","eatCharacter","isEnd","unescape","char","SyntaxError","pathToOption","stringifyLodashProperty","javaScriptPropertyRegex","propStr","createPropertySelector","transformModalStates","transformModalStateShared","showWizard","showOriginal","round","createCoords","oppositeSideMap","clamp","evaluate","param","getSide","placement","split","getAlignment","getOppositeAxis","axis","getAxisLength","getSideAxis","firstChar","getAlignmentAxis","getOppositeAlignmentPlacement","lrPlacement","rlPlacement","tbPlacement","btPlacement","getOppositeAxisPlacements","flipAlignment","rtl","alignment","list","side","isStart","getSideList","getOppositePlacement","getPaddingObject","padding","expandPaddingObject","rectToClientRect","computeCoordsFromPlacement","_ref","coords","reference","floating","sideAxis","alignmentAxis","alignLength","isVertical","commonX","commonY","commonAlign","detectOverflow","_x2","_x3","_detectOverflow","_await$platform$isEle","rects","strategy","rootBoundary","elementContext","altBoundary","paddingObject","clippingClientRect","getClippingRect","isElement","contextElement","getDocumentElement","offsetParent","getOffsetParent","offsetScale","getScale","elementClientRect","convertOffsetParentRelativeRectToViewportRelativeRect","computePosition","_ref12","config","middleware","platformWithDetectOverflow","isRTL","getElementRects","statefulPlacement","resetCount","middlewareData","currentMiddleware","nextX","nextY","initialPlacement","_x4","_x5","_x6","originSides","_convertValueToCoords","mainAxisMulti","crossAxisMulti","rawValue","mainAxis","crossAxis","hasWindow","getNodeName","isNode","_node$ownerDocument","documentElement","isHTMLElement","HTMLElement","isShadowRoot","ShadowRoot","isOverflowElement","overflow","overflowX","overflowY","display","getComputedStyle","isTableElement","isTopLayer","_e","isWebKitValue","willChangeRe","containRe","isNotNone","isContainingBlock","elementOrCss","translate","rotate","perspective","isWebKit","backdropFilter","willChange","contain","CSS","supports","isLastTraversableNode","getNodeScroll","scrollLeft","scrollTop","scrollX","scrollY","getParentNode","getNearestOverflowAncestor","getOverflowAncestors","traverseIframes","_node$ownerDocument2","scrollableAncestor","isBody","win","frameElement","getFrameElement","visualViewport","getCssDimensions","getComputedStyle$1","hasOffset","offsetWidth","offsetHeight","shouldFallback","unwrapElement","domElement","noOffsets","getVisualOffsets","includeScale","isFixedStrategy","clientRect","visualOffsets","isFixed","floatingOffsetParent","shouldAddVisualOffsets","offsetWin","currentWin","currentIFrame","iframeScale","iframeRect","clientLeft","paddingLeft","clientTop","paddingTop","getWindowScrollBarX","leftScroll","getHTMLOffset","scroll","htmlRect","getClientRectFromClippingAncestor","clippingAncestor","clientWidth","clientHeight","visualViewportBased","windowScrollbarX","doc","bodyStyles","bodyMarginInline","compatMode","marginLeft","marginRight","clippingStableScrollbarWidth","getViewportRect","scrollWidth","scrollHeight","getDocumentRect","getInnerBoundingClientRect","hasFixedPositionAncestor","stopNode","getRectRelativeToOffsetParent","isOffsetParentAnElement","offsets","setLeftRTLScrollbarOffset","offsetRect","htmlOffset","isStaticPositioned","getTrueOffsetParent","polyfill","rawOffsetParent","svgOffsetParent","currentNode","getContainingBlock","topLayer","elementClippingAncestors","cache","cachedResult","el","currentContainingBlockComputedStyle","elementIsFixed","computedStyle","currentNodeIsContaining","getClippingElementAncestors","_c","clippingAncestors","firstRect","_ref13","getOffsetParentFn","getDimensionsFn","getDimensions","floatingDimensions","_x9","getClientRects","rectsAreEqual","autoUpdate","ancestorScroll","ancestorResize","elementResize","ResizeObserver","layoutShift","IntersectionObserver","animationFrame","referenceEl","ancestors","frameId","cleanupIo","onMove","timeoutId","io","_io","clearTimeout","refresh","threshold","elementRectForRootMargin","rootMargin","isFirstUpdate","handleObserve","entries","ratio","intersectionRatio","setTimeout","observeMove","reobserveFrame","resizeObserver","firstEntry","unobserve","cancelAnimationFrame","requestAnimationFrame","_resizeObserver","prevRefRect","frameLoop","nextRefRect","_resizeObserver2","_middlewareData$offse","_middlewareData$arrow","diffCoords","_x7","_x8","convertValueToCoords","arrow","alignmentOffset","shift","_evaluate2","checkMainAxis","checkCrossAxis","limiter","detectOverflowOptions","_objectWithoutProperties","_excluded2","mainAxisCoord","crossAxisCoord","maxSide","limitedCoords","_middlewareData$flip","_evaluate","fallbackPlacements","specifiedFallbackPlacements","fallbackStrategy","fallbackAxisSideDirection","_excluded","initialSideAxis","isBasePlacement","oppositePlacement","getExpandedPlacements","hasFallbackAxisSideDirection","placements","overflows","overflowsData","sides","mainAlignmentSide","getAlignmentSides","_middlewareData$flip2","_overflowsData$filter","nextIndex","nextPlacement","resetPlacement","_overflowsData$filter2","currentSideAxis","acc","createFloatingActions","initOptions","referenceElement","floatingElement","defaultOptions","getOptions","mixin","updatePosition","updateOptions","mergedOptions","platformWithCache","computePosition$1","_options","assign","onComputed","setupVirtualElementObserver","subscribe","$node","contentAction","contentOptions","autoUpdateDestroy","destroyAutoUpdate","initAutoUpdate","_autoUpdate","_ref14","loadOptions","filterText","itemId","groupBy","filterSelectedItems","itemFilter","convertStringItemsToObjects","filterGroupedItems","filterResults","matchesFilter","getItems","_x0","_getItems","_ref15","dispatch","details","cancelled","filteredItems","loading","focused","listOpen","sanitized","timeout","justValue","_filter","container","multiFullItemClearable","placeholder","placeholderAlwaysShow","groupFilter","groupHeaderSelectable","containerStyles","hasError","required","closeListOnChange","clearFilterTextOnBlur","createGroupHeaderItem","groupValue","getFilteredItems","searchable","inputStyles","clearable","debounce","wait","debounceWait","hideEmptyState","inputAttributes","listAutoWidth","showChevron","listOffset","hoverItemIndex","floatingConfig","containerClasses","activeValue","prev_filterText","prev_multiple","_inputAttributes","_items","groupValues","groupHeader","selectable","groupItem","sortedGroupedItems","checkHoverSelectable","startingIndex","ignoreGroup","setHoverIndex","checkValueForDuplicates","noDuplicates","uniqueValues","val","findItem","matchTo","find","handleMultiItemClear","_x1","_handleMultiItemClear","itemToRemove","closeList","hoverItem","handleSelect","handleFocus","_document","_input","handleBlur","_x10","_handleBlur","_input2","isScrolling","blur","handleClear","ariaValues","ariaListOpen","ariaFocused","isScrollingTimer","handleListScroll","_get8","itemSelected","handleHover","hasOwn","hover","isItemActive","activeScroll","scrollAction","hoverScroll","scrollIntoView","behavior","_floatingConfig","floatingRef","floatingContent","floatingUpdate","prefloat","setValue","autocapitalize","autocomplete","autocorrect","spellcheck","tabindex","hasValue","hideSelectedItem","showClear","placeholderText","_value5","_multiple","ariaSelection","ariaContext","_item","handleAriaContent","updateValueDisplay","handleFilterEvent","listDom","listMounted","setListWidth","scrollToHoverItem","_floatingConfig2","_get7","contains","node_1","node_2","div_2","root_5","div_3","_get9","classes_2","itemIndex","_get0","$.stopPropagation","isItemSelectable","handleItemClick","$.preventDefault","$$arg","root_8","consequent_3","consequent_4","$.effect","classes_1","consequent_5","span_1","$.first_child","fragment_6","consequent_6","div_5","div_6","div_7","root_13","span_3","div_8","root_15","ClearIcon","consequent_7","classes_3","div_9","root_17","classes_4","consequent_8","consequent_9","input_1","node_13","div_10","div_11","root_19","LoadingIcon","consequent_10","root_21","consequent_11","div_12","root_23","ChevronIcon","consequent_12","input_2","root_25","root_27","_containerClasses","$.bind_value","_queryOptions","_filterRelationOption","_queryOptions2","_queryOptions3","_sortDirectionOptions","filterRelationOptions","sortDirectionOptions","filterPath","filterRelation","_queryOptions$filter","filterValue","sortPath","sortDirection","_queryOptions$sort","jsonIsArray","pathsIncludingObjects","fieldOptions","projectionOptions","projectionPaths","_queryOptions0","_queryOptions4","_get1","_queryOptions5","_get10","_queryOptions6","_queryOptions7","_get11","_queryOptions8","_get12","_queryOptions9","changeProjectionPaths","tbody","tr","td","Select","tr_1","td_1","tr_2","td_2","queryLanguages","queryLanguageId","onChangeQueryLanguage","$.index","queryLanguage","_ref18","handleChangeQueryLanguage","newQueryLanguageId","fullScreenButton","fullscreen","faDownLeftAndUpRightToCenter","faUpRightAndDownLeftFromCenter","button_1","faTimes","_onClose","createAutoScrollHandler","scrollableElement","autoScrollSpeed","autoScrollTimer","calculateSpeed","diff","autoScrollCallback","startAutoScroll","speed","stopAutoScroll","setInterval","clearInterval","onDrag","clientY","onDragEnd","easeInOutQuad","createJump","easing","a11y","duration","timeStart","timeElapsed","scrolling","scrollTo","loop","timeCurrent","querySelector","onDuration","now","validationErrorsFactory","updateInValidationErrors","errors","validateJSON","validator","validationParser","validateText","validationErrors","severity","info","convertedJSON","isRepairable","_unused16","canAutoRepair","parseError","createFocusTracker","_ref19","blurTimeoutHandle","onFocus","onBlur","handleFocusIn","newFocus","handleFocusOut","actions","onClick","root_2","_ref20","onMouseDown","_type","_message","selectError","validationError","faExclamationTriangle","faAngleDown","_ref21","td_4","table_1","root_6","tbody_1","td_5","text_3","faAngleRight","_get13","getMaxSeverity","warning","consequent_2","onEscape","dialog","close","showModal","dialog_1","_len2","_key9","ctrl","Modal","Header","div_4","_onClose2","_len9","_key24","node_3","_ref22","_get$onClick","_len0","_key25","unknownMenuItem","onParse","onRepair","onApply","domTextArea","goToError","setSelectionRange","handleApply","handleRepair","_unused18","getErrorMessage","repairable","_unused17","gotoAction","faArrowDown","repairAction","faWrench","errorActions","successActions","faCheck","Menu","Message","textarea","$.set_value","repairedText","handleCancel","JSONRepairComponent","sectionIndex","total","onExpandSection","visibleSection","getJson","expandItemsSections","section1","start2","section2","currentIndex","previousIndex","section3","showSection2","getExpandItemsSections","expandItemsSection","_ref23","_ref24","_get14","_get15","onContextMenu","faCaretDown","buttonElem","showTip","onRenderValue","renderer","_get16","Component_1","singleton","selecting","selectionAnchor","selectionAnchorType","selectionFocus","dragging","onMoveSelection","_ref25","deltaY","updatedSelection","dragInsideAction","_ref26","initialPath","initialIndex","prevHeight","_items2","cumulativeHeight","beforePath","findSwapPathUp","_ref27","_items$beforeIndex","nextHeight","_items3","beforeIndex","findSwapPathDown","startKey","endKey","toKey","toIndex","times","moveInsideParent","_ref28","_items4","_items5","createUpdatedArraySelection","onExpand","_onExpand","_len1","_key26","_ref29","onDragSelectionStart","hoverTimer","isNodeSelected","toggleExpand","handleExpand","handleUpdateKey","handleMouseMoveGlobal","handleMouseUpGlobal","$$_import_singleton","findContentTop","_context$findElement","findElement","calculateDeltaY","contentOffset","initialContentTop","initialClientY","handleDragSelectionStart","selectionParentPath","addHeight","currentSection","getVisibleItemsWithHeights","selectionStartIndex","initialTarget","selectionItemsCount","didMoveItems","handleDragSelection","handleDragSelectionEnd","handleInsertInside","handleInsertAfter","handleInsertInsideOpenContextMenu","contextMenuProps","handleInsertAfterOpenContextMenu","_validationErrors","faCaretRight","_ref30","_ref31","_ref32","_ref33","alternate_1","root_10","ContextMenuPointer","ValidationErrorIcon","root_12","alternate_2","fragment_8","styles_1","indices","gutterIndex","nestedValidationErrors","nestedSelection","appendToJSONPointer","JSONNode","node_16","root_18","CollapsedItems","div_13","div_14","root_20","div_15","fragment_12","div_16","alternate_3","root_24","div_18","node_21","div_19","consequent_13","alternate_4","div_21","root_28","div_22","root_30","div_23","root_31","consequent_17","div_24","fragment_18","div_25","root_33","node_30","styles_2","getKeys","propPointer","nestedSearchResults","node_32","div_26","root_35","node_33","onUpdateKey","handleKeyDoubleClick","isEditingKey","handleChangeValue","updatedKey","updatedPath","isKeySelected","JSONKey","div_27","div_28","root_36","consequent_19","consequent_20","div_29","root_37","div_30","root_38","consequent_22","div_32","node_36","JSONValue","node_37","div_33","root_39","consequent_24","div_34","root_41","consequent_25","div_35","root_42","node_43","$1","onClassName","buttons","contentEditable","anchorType","getDocumentState","fullSelection","lastCaretPosition","empty","faJSONEditorExpand","faJSONEditorCollapse","faJSONEditorFormat","faJSONEditorCompact","caseInsensitiveNaturalCompare","aLower","bLower","naturalCompare","sortJson","rootPath","comparator","sortableTypes","boolean","number","string","otherTypes","valueA","valueB","_sortableTypes$valueA","_sortableTypes$valueB","aIndex","bIndex","createObjectComparator","sortArray","sortedKeys","keyA","keyB","sortedObject","sortObjectKeys","selectedItem","refNavigationBarItem","handleSelectItem","NavigationBarDropdown","copyToClipBoard","_document$queryComman","_document2","writeText","queryCommandSupported","opacity","execCommand","pathParser","onError","pathExists","inputRef","inputPath","validationActive","copiedTimer","copied","parseAndValidate","validatePathExists","inputValidationError","faCopy","refNavigationBar","editing","handleCloseEditor","handleChangePath","hasNextItem","NavigationBarItem","NavigationBarPathEditor","faClose","faEdit","node_4","flex","showSearch","showReplace","onSearch","appliedText","searching","applyChangedSearchTextDebounced","_x12","_applyChangedSearchText","applyChangedJsonDebounced","_x13","_applyChangedJson","toggleShowReplace","handleNext","handlePrevious","handleReplace","handleClose","handleReplaceKeyDown","handlePaste","_handlePaste","_handleReplace","_get20","handleReplaceAll","_handleReplaceAll","deduplicatedMatches","previousItem","lastNewSelection","allOperations","createSearchAndReplaceAllOperations","initSearchInput","_handleNext","_handlePrevious","previousActiveIndex","previousActiveItem","searchPrevious","_handleFocus","_get21","_applyChangedShowSearch","applySearch","_x14","_x15","_x16","_applySearch","newResultItems","previousResult","activePath","matchingActiveIndex","updateSearchResult","cancel","resultCount","_get17","_get18","formattedResultCount","_x11","applyChangedShowSearch","form","faCircleNotch","faSearch","faChevronDown","button_2","faChevronUp","button_3","button_4","button_5","_get19","endOfPath","getColumns","maxSampleCount","step","forEachSample","_recurseObject","_collectPaths","valueMerged","calculateVisibleSection","viewPortHeight","itemHeights","defaultItemHeight","searchBoxOffset","itemCount","averageItemHeight","calculateAverageItemHeight","viewPortTop","viewPortBottom","getItemHeight","startHeight","visibleHeight","endHeight","visibleItems","calculateAbsolutePosition","rowIndex","toTableCellPosition","columnIndex","fromTableCellPosition","groupValidationErrors","arrayErrors","rootErrors","partition","errorsByRow","findRowIndex","groupedErrorsByRow","mapValues","groupByRow","row","findColumnIndex","rows","mergeValidationErrors","clearSortedColumnWhenAffectedByOperations","sortedColumn","columms","mustBeCleared","selectedColumnIndex","operationAffectsSortedColumn","onCut","_x17","_onCut","_ref34","copyToClipboard","onCopy","_x18","_onCopy","_ref35","_ref36","onChangeText","onPasteMultilineText","openRepairModal","doPaste","_unused19","ensureSelection","pasteMultilineText","operators","containsNewline","replaceArrayOperation","multipleAddOperations","_unused20","isMultilineTextPastedAsArray","onRemove","_ref37","keepSelection","removeSelection","patchResult","onInsert","_ref42","insertType","selectInside","onReplaceJson","jsonExample","cloneDeepWith","createNewValue","onInsertCharacter","_x19","_onInsertCharacter","_ref43","_x20","_onInsertValueWithCharacter","onInsertValueWithCharacter","_ref44","truncated","onRequestClose","$.deep_read_state","visible","allItemsDisabled","li","$.clsx","_ref45","_width3","wasVisible","DropdownButton","main","_ref46","tip","refContextMenu","firstEnabledButton","querySelectorAll","directionByCombo","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","ContextMenuButton","ContextMenuDropDownButton","rowItem","columnItem","faLightbulb","refSelect","bindValue","applyFocus","option_1","_option_1$__value","_select$querySelector","selected_option","getJSONSchemaOptions","schema","schemaDefinitions","schemaForPath","findSchema","composite","enum","findEnum","topLevelSchema","currentSchema","nextPath","possibleSchemas","subSchemas","oneOf","anyOf","allOf","$ref","_ref$match","schemaUrl","referencedSchema","auxNextPath","refPath","segment","patternProperties","additionalProperties","renderJSONSchemaEnum","enumValues","enumValue","optionsWithValue","EnumValue","createAjvValidator","createValidateFunction","createAjvInstance","compile","createAjvValidatorAsync","_x21","_createAjvValidatorAsync","ajv","compileAsync","_options$onCreateAjv","_options$onCreateAjv2","ajvOptions","AjvDist","allErrors","verbose","$data","addSchema","onCreateAjv","ajvValidator","_ajvValidator$errors","improveAjvError","ajvError","_ajvError$message","_options$errorSeverit","instancePath","errorSeverity","normalizeAjvError","keyword","enums","more","params","additionalProperty","jmespathQueryLanguage","examplePath","exampleValue","filterValueStr","stringifyPathForJmespath","stringifyProp","jmespath","jsonpathQueryLanguage","pathToString","output","JSONPathPlus","lettersOnlyRegex","lodashQueryLanguage","queryParts","actualValueGetter","isSafeInteger","createLodashPropertySelector","_query$match","_query$match2","chainCount","valueCount","validate","Function","queryFn","javascriptQueryLanguage","createQuery","executeQuery","onResize","isSSR","sortModalId","transformModalId","refContents","refJsonEditor","jump","externalContent","externalSelection","history","mainMenuBar","navigationBar","parseMemoizeOne","onChangeMode","onUndo","onRedo","onRenderMenu","onRenderContextMenu","onSortModal","onTransformModal","onJSONEditorModal","modalOpen","copyPasteModalOpen","jsonRepairModalProps","documentStateInitialized","searchResultDetails","pastedMultilineText","handleSearch","handleFocusSearch","_x22","_x23","_handleFocusSearch","findSearchResult","handleCloseSearch","handleSelectValidationError","isSelectionInsidePath","textIsRepaired","validationErrorList","memoizedValidate","memoizeOne","updateValidationErrors","newValidationErrorList","toRecursiveValidationErrors","applyExternalContent","updatedContent","updatedJson","isChanged","currentlyText","previousState","expandWhenNotInitialized","clearSelectionWhenNotExisting","addHistoryItem","applyExternalJson","_unused21","applyExternalText","canPatch","undo","patch","redo","afterPatch","_createSelectionFromO","previousJson","patched","handleEditKey","handleEditValue","openJSONEditorModal","handleToggleEnforceString","handlePatch","acceptAutoRepair","handleReplaceJson","handleCut","_handleCut","indent","handleCopy","_handleCopy","_event$clipboardData","_paste","handlePasteFromMenu","_handlePasteFromMenu","readText","handleChangeText","handlePasteMultilineText","handleRemove","handleDuplicate","handleExtract","handleInsert","handleInsertFromContextMenu","handleConvert","convertedValue","parsedValue","_unused10","_unused11","convertValue","handleInsertBefore","selectionBefore","handleContextMenu","handleInsertCharacter","_x24","_handleInsertCharacter","handleUndo","canUndo","previousContent","emitOnChange","scrollToWhenVisible","handleRedo","canRedo","openSortModal","_onSort","onSort","_ref48","_x25","handleSortSelection","handleSortAll","openTransformModal","onTransform","transformedJson","handleTransformSelection","handleTransformAll","_x26","_scrollTo","viewPortRect","elemRect","_get$querySelector","_get22","_get$querySelector2","_get23","elemHeight","_onChange","_onChange2","_unused22","handleExpandAll","handleCollapseAll","openFind","findAndReplace","handleExpandSection","_value","expandSection","handlePasteJson","newPastedJson","openContextMenu","_ref49","_onRenderContextMenu","defaultItems","_ref47","onEditKey","onEditValue","onToggleEnforceString","onDuplicate","onExtract","onInsertBefore","onConvert","onInsertAfter","hasJson","hasSelection","rootSelected","focusValue","editValueText","canEditKey","canEditValue","canEnforceString","canCut","canCopy","canPaste","canDuplicate","canExtract","convertMode","insertOrConvertText","canInsertOrConvertStructure","canInsertOrConvertObject","canInsertOrConvertArray","canInsertOrConvertValue","handleInsertOrConvert","faPen","faCut","faPaste","faClone","faCropAlt","faSortAmountDownAlt","faFilter","faTrashCan","faArrowRightArrowLeft","faPlus","faCaretSquareUp","faCaretSquareDown","createTreeContextMenuItems","ContextMenu","clientX","_get24","_get25","handleContextMenuFromTreeMenu","handleParsePastedJson","_handleParsePastedJson","handleParsePastedMultilineText","_handleParsePastedMultilineText","handleClearPastedJson","handleClearPastedMultilineText","handleRequestRepair","handleNavigationBarSelect","childPath","nextPathInside","getSelectionNextInside","handleDrag","autoScrollHandler","handleDragEnd","overflowAnchor","applySearchBoxSpacing","applyExternalSelection","tree","onExpandAll","onCollapseAll","handleToggleSearch","expandMenuItem","collapseMenuItem","searchMenuItem","faEllipsisV","faUndo","faRedo","TreeMenu","NavigationBar","fragment_3","handleCreateObject","handleCreateArray","Welcome","onCreateObject","onCreateArray","faCode","node_5","JSONPreview","fragment_7","SearchBox","ValidationErrorsOverview","node_14","CopyPasteModal","JSONRepairModal","_get26","collapsedState","nextPathAfter","getSelectionDown","getSelectionLeft","getSelectionRight","isContentEditable","readonlyProxy","property","createHistoryInstance","maxItems","reverseItems","handleChange","_$$_import_transformM","_state$queryOptions","_state$isManual","refQueryInput","updatedHistory","selectedJson","selectedContent","stateId","$$_import_transformModalStateShared","isManual","queryError","previewError","previewContent","getSelectedQueryLanguage","_queryLanguages$find","updateQueryByWizard","newQueryOptions","handleChangeQuery","_get27","previewTransformDebounced","previewJson","jsonTransformed","handleTransform","toggleShowWizard","toggleShowOriginal","handleEscape","AbsolutePopup","refConfigButton","openConfig","SelectQueryLanguage","faCog","hide","TransformModalHeader","TransformWizard","node_7","TreeMode","root_9","nextPropID","NodeProp","perNode","deserialize","combine","RangeError","NodeType","closedBy","openedBy","isolate","contextHash","lookAhead","mounted","IterMode","noProps","create","define","spec","src","isTop","isSkipped","isError","isAnonymous","direct","found","none","highlightStyle","HighlightStyle","tags","propertyName","bool","highlighter","syntaxHighlighting","originalStyle","wrappedLineIndent","ViewPlugin","fromClass","view","indentUnit","getIndentUnit","initialPaddingLeft","isChrome","generate","docChanged","viewportChanged","builder","RangeSetBuilder","addStyleToBuilder","requestMeasure","read","lineElement","contentDOM","getPropertyValue","decorations","visibleLines","getVisibleLines","numColumns","containsTab","tabSize","paddingValue","textIndentValue","Decoration","lines","lastLine","visibleRanges","lineAt","cols","statusBar","askToFormat","maxDocumentSize","formatCompactKeyBinding","handleFormat","handleCompact","codeMirrorView","codeMirrorRef","domTextMode","editorState","acceptTooLarge","askToFormatApplied","isFolding","foldProgress","foldTotal","foldCancelController","linterCompartment","Compartment","readOnlyCompartment","indentCompartment","tabSizeCompartment","themeCompartment","historyAnnotation","Annotation","historyUpdatesQueue","startState","endState","mergedChanges","changes","change","compose","invert","toJSON","toTextSelection","previousEscapeUnicodeCharacters","_ref53","initialText","ranges","isValidSelection","fromTextSelection","EditorState","extensions","keymap","of","indentWithTab","createLinter","lintGutter","lineNumbers","highlightActiveLineGutter","highlightSpecialChars","foldGutter","createCustomFoldService","drawSelection","dropCursor","allowMultipleSelections","indentOnInput","defaultHighlightStyle","bracketMatching","closeBrackets","autocompletion","rectangularSelection","crosshairCursor","highlightActiveLine","highlightSelectionMatches","closeBracketsKeymap","defaultKeymap","searchKeymap","mac","foldKeymap","completionKeymap","lintKeymap","indentationMarkers","hideFirstIndent","EditorView","domEventHandlers","dblclick","handleDoubleClick","updateListener","transactions","transaction","annotation","onChangeCodeMirrorValueDebounced","selectionSet","emitOnSelect","jsonLang","lineWrapping","createIndent","theme","dark","hasDarkTheme","createCodeMirrorView","disableTextEditor","handleCancelFolding","docLength","ensureSyntaxTree","foldRanges","getFoldRanges","pathStartPos","_x27","_foldRangesAnimated","foldRangesAnimated","foldRecursive","foldService","iter","resolveStack","cur","foldNodeProp","isUnfinished","ch","startPos","processedRanges","iterate","enter","isFoldable","foldable","rangeKey","isNested","shouldShowProgress","AbortController","processBatch","_foldCancelController","aborted","foldEffect","unfoldCode","unfoldAll","emitChange","setCodeMirrorContent","jsonStatus","jsonParseError","handleSort","_onSort2","_ref51","_x28","_ref52","closeSearchPanel","openSearchPanel","annotations","ChangeSet","fromJSON","EditorSelection","handleAcceptTooLarge","handleSwitchToTreeMode","cancelLoadTooLarge","onChangeCodeMirrorValue","toRichValidationError","setSelection","_event","selectedText","_pointer$value","linter","linterCallback","delay","toRichParseError","toDiagnostic","newContent","forceUpdate","newText","_refresh","_updateTheme","updateTheme","codeMirrorText","reconfigure","repeat","memoizedValidateText","handleShowMe","richParseError","handleSelectParseError","repairActionShowMe","faEye","eq","updateLinter","updateIndentation","updateTabSize","updateReadOnly","repairActions","isNewDocument","onFormat","onCompact","onToggleSearch","canExpandAll","canCollapseAll","canFormat","canCompact","canSort","canTransform","searchItem","TextMenu","editorDisabled","fragment_1","lineNumber","columnNumber","charCount","_editorState","_editorState2","_editorState3","_get28","_get29","_get30","StatusBar","nestedArrayPaths","maxLevel","findNestedArrays","hasNestedArrays","isEmptyDocument","documentType","_get31","nestedArrayPath","countItems","text_4","text_6","extractPath","_get32","flattenColumns","_x29","_handleFocusSearch2","containsValidArray","itemHeightsCache","onSortByHeader","newSortedColumn","newValidationErrors","patchedSortedColumn","handleScroll","createDefaultSelectionWhenUndefined","createDefaultSelection","searchBoxHeight","roughDistance","scrollToHorizontal","headerHeight","scrollToVertical","_get$querySelector3","_get33","resolvedPath","_ref55","_onRenderContextMenu2","_ref54","onEditRow","onDuplicateRow","onInsertBeforeRow","onInsertAfterRow","onRemoveRow","createTableContextMenuItems","handleEditRow","handleDuplicateRow","handleInsertBeforeRow","handleInsertAfterRow","handleRemoveRow","_get34","_get35","handleContextMenuFromTableMenu","_handleParsePastedJson2","_handlePasteFromMenu2","_handleParsePastedMultilineText2","_x30","_handleCut2","_handleCopy2","_ref38","rowPath","_ref39","_ref40","nextRowIndex","nextRowPath","_ref41","newRowIndex","_handleInsertCharacter2","_event$clipboardData2","_unused24","_ref56","handleResizeContents","currentContent","_unused23","newColumns","previousColumns","orderedColumns","newColumnsSet","maintainColumnOrder","showRefreshButton","extendedOperations","unshift","createNestedValueOperations","groupedValidationErrors","TableMenu","fragment_2","th","_get36","_get37","th_1","columnName","_sortedColumn","sortDirectionName","faCaretUp","ColumnHeader","th_2","root_7","onRefresh","faRotate","RefreshColumnHeader","node_10","node_11","visibleIndex","validationErrorsByRow","_get38","searchResultByRow","th_3","handleResizeRow","_get39","$$array","isSelected","validationErrorsByColumn","_get40","root_11","searchResultsByCell","containsActiveSearchResult","containsSearchResult","onEdit","_parser$stringify","InlineValue","searchResultItemsByCell","_getInRecursiveState","root_14","root_16","td_3","node_20","node_24","TableModeWelcome","root_22","consequent_14","node_26","consequent_15","_get41","consequent_16","selectPreviousColumn","selectNextColumn","selectPreviousRow","selectNextRow","_x31","externalMode","maxDocumentSizeTextMode","insideModal","refTreeMode","refTableMode","refTextMode","prevItem","nextItem","modeMenuItems","separatorMenuItem","handleRenderMenu","handleRenderContextMenu","_refresh2","applyExternalMode","updatedItems","updatedItemsOriginal","cloneDeep","modal","_onRenderContextMenu3","itemsOriginal","TextMode","TableMode","sortModalStates","contentDefault","selectionDefault","readOnlyDefault","modeDefault","mainMenuBarDefault","navigationBarDefault","statusBarDefault","askToFormatDefault","escapeControlCharactersDefault","escapeUnicodeCharactersDefault","maxDocumentSizeTextModeDefault","flattenColumnsDefault","parserDefault","validatorDefault","validationParserDefault","pathParserDefault","queryLanguagesDefault","queryLanguageIdDefault","onChangeQueryLanguageDefault","onChangeDefault","onSelectDefault","onRenderValueDefault","onClassNameDefault","onRenderMenuDefault","onRenderContextMenuDefault","onChangeModeDefault","onErrorDefault","alert","onFocusDefault","onBlurDefault","instanceId","refJSONEditorRoot","jsonEditorModalProps","sortModalProps","transformModalProps","previousParser","contentError","_x32","_scrollTo2","_refresh3","updateProps","_props$name","_props$name2","_props$name3","_props$name4","_props$name5","_props$name6","_props$name7","_props$name8","_props$name9","_props$name0","_props$name1","_props$name10","_props$name11","_props$name12","_props$name13","_props$name14","_props$name15","_props$name16","_props$name17","_props$name18","_props$name19","_props$name20","_props$name21","_props$name22","_props$name23","_props$name24","_props$name25","_props$name26","_props$name27","_props$name28","_props$name29","_props$name30","names","unknownProperty","_destroy","toggleMode","_x33","_toggleMode","newMode","_ref58","_ref59","JSONEditorRoot","_$$_import_sortModalS","_$$_import_sortModalS2","directions","selectedProperty","$$_import_sortModalStates","selectedDirection","sortError","_get46","_get47","_get48","_get49","_get50","SortModal","_get51","TransformModal","_get52","refEditor","rootState","determineMode","scrollToSelection","_last","currentState","parentJson","updatedParentContent","updatedParentState","_get43","updateState","handleChangeSelection","handleChangeMode","handleError","newError","handleJSONEditorModal","_ref57","_get44","nestedModalState","_get42","absolutePath","pathDescription","faCaretLeft","JSONEditorModal","_get53","createJSONEditor","_ref60","editor","JsonEditor","JSONEditor","_ref62"],"mappings":"y3KAOO,ICL4BA,GAAAC,GAAAC,GAAAC,GAAb,oBAAXC,SAEiB,QAA3BH,IAACD,GAAgB,QAAhBG,IAACD,GAAAE,QAAOC,gBAAQ,IAAAF,GAAAA,GAAfD,GAAOG,SAAa,CAAA,GAAIC,SAAC,IAAAL,GAAAA,GAA1BD,GAAyBM,EAAM,IAAIC,KAAOC,IDGd,KEJvB,IAAIC,IAAmB,EAc7BA,IAAmB,ECjBb,IAkCMC,GAAgBC,SAMhBC,GAAiB,+BCtCnBC,GAAWC,MAAMC,QACjBC,GAAWF,MAAMG,UAAUC,QAC3BC,GAAWL,MAAMG,UAAUE,SAC3BC,GAAaN,MAAMO,KAEnBC,GAAkBC,OAAOC,eACzBC,GAAiBF,OAAOG,yBACxBC,GAAkBJ,OAAOK,0BACzBC,GAAmBN,OAAON,UAC1Ba,GAAkBhB,MA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d,GAClC,IAAMxiB,EAAK6pB,GAAmBlmB,IAAIc,GAElC,OAAIzE,GACH6pB,GAAmB3gB,OAAOzE,GACnBzE,EAAGwiB,IAWJ/hB,QAAQH,SAChB,C0J5T+B4oB,CAAQqqG,EAAO,GAE5CrlH,KAEOqlH,CACT,UAKgBE,GAAUC,GAAyC,IAAxCp6G,OAAEA,EAAMzV,MAAEA,GAA8B6vH,EAOjE,OALAzhH,QAAQC,KACN,sHAIKmhH,GAAiB,CAAE/5G,SAAQzV,SACpC","x_google_ignoreList":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,66,71,72,73,91,99,100,101,102,103,104,105,106,107,108,109,168,170]}