@sakuzu/maplibre-gl-draw-ui 1.0.0

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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"maplibre-gl-draw-ui.js","names":["listeners","index","clsx","_clsx","w.select_multiple_invalid_value","ArrowLeft","ArrowUpRight","ChevronDown","ChevronLeft","ChevronRight","CircleAlert","CircleCheck","CornerUpRight","GripVertical","Settings2","Share2","Trash2","TriangleAlert","EyeOff","LockOpen","Undo2"],"sources":["../../node_modules/svelte/src/internal/shared/utils.js","../../node_modules/svelte/src/internal/client/constants.js","../../node_modules/svelte/src/constants.js","../../node_modules/svelte/src/internal/client/warnings.js","../../node_modules/svelte/src/internal/client/dom/hydration.js","../../node_modules/svelte/src/internal/client/reactivity/equality.js","../../node_modules/svelte/src/internal/shared/errors.js","../../node_modules/svelte/src/internal/client/errors.js","../../node_modules/svelte/src/internal/flags/index.js","../../node_modules/svelte/src/internal/client/dev/tracing.js","../../node_modules/svelte/src/internal/shared/dev.js","../../node_modules/svelte/src/internal/shared/context.js","../../node_modules/svelte/src/internal/client/context.js","../../node_modules/svelte/src/internal/client/dom/task.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/dom/elements/misc.js","../../node_modules/svelte/src/internal/client/dom/elements/bindings/shared.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/batch.js","../../node_modules/svelte/src/internal/client/reactivity/sources.js","../../node_modules/svelte/src/internal/client/proxy.js","../../node_modules/svelte/src/internal/client/dev/equality.js","../../node_modules/svelte/src/internal/client/dom/operations.js","../../node_modules/svelte/src/internal/client/error-handling.js","../../node_modules/svelte/src/internal/client/reactivity/effects.js","../../node_modules/svelte/src/internal/client/legacy.js","../../node_modules/svelte/src/internal/client/runtime.js","../../node_modules/svelte/src/utils.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/reactivity/create-subscriber.js","../../node_modules/svelte/src/internal/client/dom/blocks/boundary.js","../../node_modules/svelte/src/internal/client/render.js","../../node_modules/svelte/src/internal/client/dom/blocks/branches.js","../../node_modules/svelte/src/internal/client/dom/blocks/if.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/snippet.js","../../node_modules/svelte/src/internal/client/dom/blocks/svelte-component.js","../../node_modules/svelte/src/internal/client/dom/elements/transitions.js","../../node_modules/svelte/src/internal/client/dom/blocks/svelte-element.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/size.js","../../node_modules/svelte/src/internal/client/dom/elements/bindings/this.js","../../node_modules/svelte/src/internal/client/reactivity/store.js","../../node_modules/svelte/src/internal/client/reactivity/props.js","../../node_modules/svelte/src/legacy/legacy-client.js","../../node_modules/svelte/src/internal/client/dom/elements/custom-element.js","../../node_modules/svelte/src/index-client.js","../../node_modules/svelte/src/internal/disclose-version.js","../../node_modules/@lucide/svelte/dist/utils/defaultAttributes.js","../../node_modules/@lucide/svelte/dist/utils/mergeClasses.js","../../node_modules/@lucide/svelte/dist/utils/buildLucideIconNode.js","../../node_modules/@lucide/svelte/dist/utils/hasA11yProp.js","../../node_modules/@lucide/svelte/dist/context.js","../../node_modules/@lucide/svelte/dist/Icon.svelte","../../node_modules/@lucide/svelte/dist/icons/layers.svelte","../../node_modules/@lucide/svelte/dist/icons/moon.svelte","../../node_modules/@lucide/svelte/dist/icons/sun.svelte","../../node_modules/@sakuzu/kata/dist/svelte/components/Actions.svelte","../../node_modules/svelte/src/reactivity/map.js","../../node_modules/@sakuzu/kata/dist/svelte/messages.js","../../node_modules/@sakuzu/kata/dist/svelte/components/Counter.svelte","../../node_modules/@lucide/svelte/dist/icons/arrow-left.svelte","../../node_modules/@lucide/svelte/dist/icons/arrow-up-right.svelte","../../node_modules/@lucide/svelte/dist/icons/check.svelte","../../node_modules/@lucide/svelte/dist/icons/chevron-down.svelte","../../node_modules/@lucide/svelte/dist/icons/chevron-left.svelte","../../node_modules/@lucide/svelte/dist/icons/chevron-right.svelte","../../node_modules/@lucide/svelte/dist/icons/circle-alert.svelte","../../node_modules/@lucide/svelte/dist/icons/circle-check.svelte","../../node_modules/@lucide/svelte/dist/icons/copy.svelte","../../node_modules/@lucide/svelte/dist/icons/corner-up-right.svelte","../../node_modules/@lucide/svelte/dist/icons/ellipsis.svelte","../../node_modules/@lucide/svelte/dist/icons/eye.svelte","../../node_modules/@lucide/svelte/dist/icons/eye-off.svelte","../../node_modules/@lucide/svelte/dist/icons/funnel.svelte","../../node_modules/@lucide/svelte/dist/icons/globe.svelte","../../node_modules/@lucide/svelte/dist/icons/grip-vertical.svelte","../../node_modules/@lucide/svelte/dist/icons/image.svelte","../../node_modules/@lucide/svelte/dist/icons/info.svelte","../../node_modules/@lucide/svelte/dist/icons/lock.svelte","../../node_modules/@lucide/svelte/dist/icons/lock-open.svelte","../../node_modules/@lucide/svelte/dist/icons/pencil.svelte","../../node_modules/@lucide/svelte/dist/icons/pipette.svelte","../../node_modules/@lucide/svelte/dist/icons/plus.svelte","../../node_modules/@lucide/svelte/dist/icons/search.svelte","../../node_modules/@lucide/svelte/dist/icons/settings-2.svelte","../../node_modules/@lucide/svelte/dist/icons/share-2.svelte","../../node_modules/@lucide/svelte/dist/icons/trash.svelte","../../node_modules/@lucide/svelte/dist/icons/triangle-alert.svelte","../../node_modules/@lucide/svelte/dist/icons/undo-2.svelte","../../node_modules/@lucide/svelte/dist/icons/ungroup.svelte","../../node_modules/@lucide/svelte/dist/icons/x.svelte","../../node_modules/@sakuzu/kata/dist/svelte/glyphs/Arrow.svelte","../../node_modules/@sakuzu/kata/dist/svelte/glyphs/Point.svelte","../../node_modules/@sakuzu/kata/dist/svelte/glyphs/Polygon.svelte","../../node_modules/@sakuzu/kata/dist/svelte/glyphs/Polyline.svelte","../../node_modules/@sakuzu/kata/dist/svelte/glyphs/StickyNote.svelte","../../node_modules/@sakuzu/kata/dist/svelte/icons.js","../../node_modules/@sakuzu/kata/dist/svelte/components/Icon.svelte","../../node_modules/@sakuzu/kata/dist/svelte/lib/host.js","../../node_modules/@sakuzu/kata/dist/svelte/lib/tipPlace.js","../../node_modules/@sakuzu/kata/dist/svelte/components/Tooltip.svelte","../../node_modules/@sakuzu/kata/dist/svelte/components/Button.svelte","../../node_modules/@sakuzu/kata/dist/svelte/components/Dropdown.svelte","../../node_modules/@sakuzu/kata/dist/svelte/lib/menuModel.js","../../node_modules/@sakuzu/kata/dist/svelte/lib/viewport.svelte.js","../../node_modules/@sakuzu/kata/dist/svelte/components/Menu.svelte","../../node_modules/@sakuzu/kata/dist/svelte/components/MenuDivider.svelte","../../node_modules/@sakuzu/kata/dist/svelte/components/MenuHead.svelte","../../node_modules/@sakuzu/kata/dist/svelte/components/MenuItem.svelte","../../node_modules/@sakuzu/kata/dist/svelte/components/MenuList.svelte","../../node_modules/@sakuzu/kata/dist/svelte/components/Block.svelte","../../node_modules/@sakuzu/kata/dist/svelte/components/InlineEdit.svelte","../../node_modules/@sakuzu/kata/dist/svelte/components/Pair.svelte","../../node_modules/@sakuzu/kata/dist/svelte/components/Kv.svelte","../../node_modules/@sakuzu/kata/dist/svelte/components/LinkAction.svelte","../../node_modules/@sakuzu/kata/dist/svelte/lib/clampTip.js","../../node_modules/@sakuzu/kata/dist/svelte/components/Text.svelte","../../node_modules/@sakuzu/kata/dist/svelte/components/TextInput.svelte","../../node_modules/@sakuzu/kata/dist/svelte/components/AttributeList.svelte","../../node_modules/@sakuzu/kata/dist/svelte/components/Banner.svelte","../../node_modules/@sakuzu/kata/dist/svelte/components/Stack.svelte","../../node_modules/@sakuzu/kata/dist/svelte/components/ColorGrid.svelte","../../node_modules/@sakuzu/kata/dist/svelte/components/NumberInput.svelte","../../node_modules/@sakuzu/kata/dist/svelte/components/Row.svelte","../../node_modules/@sakuzu/kata/dist/svelte/components/Select.svelte","../../node_modules/@sakuzu/kata/dist/svelte/components/ColorPicker.svelte","../../node_modules/@sakuzu/kata/dist/svelte/components/Spinner.svelte","../../node_modules/@sakuzu/kata/dist/svelte/components/State.svelte","../../node_modules/@sakuzu/kata/dist/svelte/components/Footer.svelte","../../node_modules/@sakuzu/kata/dist/svelte/components/Toolbar.svelte","../../node_modules/@sakuzu/kata/dist/svelte/components/Modal.svelte","../../node_modules/@sakuzu/kata/dist/svelte/lib/fitBar.js","../../node_modules/@sakuzu/kata/dist/svelte/components/Drawbar.svelte","../../node_modules/@sakuzu/kata/dist/svelte/components/InspectorRow.svelte","../../node_modules/@sakuzu/kata/dist/svelte/components/NativeSelect.svelte","../../node_modules/@sakuzu/kata/dist/svelte/components/ReadValue.svelte","../../node_modules/@sakuzu/kata/dist/svelte/components/Segmented.svelte","../../node_modules/@sakuzu/kata/dist/svelte/components/Slider.svelte","../../node_modules/@sakuzu/kata/dist/svelte/components/Swatch.svelte","../../node_modules/@sakuzu/kata/dist/svelte/components/Toggle.svelte","../../node_modules/@sakuzu/kata/dist/svelte/components/FieldList.svelte","../../node_modules/@sakuzu/kata/dist/svelte/components/Floating.svelte","../../node_modules/@sakuzu/kata/dist/svelte/components/Panel.svelte","../../node_modules/@sakuzu/kata/dist/svelte/components/Tabs.svelte","../../node_modules/@sakuzu/kata/dist/svelte/components/InspectorFrame.svelte","../../node_modules/@sakuzu/kata/dist/svelte/components/SectionHeader.svelte","../../node_modules/@sakuzu/kata/dist/svelte/components/InspectorSection.svelte","../../node_modules/@sakuzu/kata/dist/svelte/components/Kbd.svelte","../../node_modules/sortablejs/modular/sortable.esm.js","../../node_modules/@sakuzu/kata/dist/svelte/sortable.js","../../node_modules/@sakuzu/kata/dist/svelte/components/Markbox.svelte","../../node_modules/@sakuzu/kata/dist/svelte/components/Tree.svelte","../../node_modules/@sakuzu/kata/dist/svelte/components/ListItem.svelte","../../node_modules/@sakuzu/kata/dist/svelte/components/TreeRow.svelte","../../node_modules/@sakuzu/kata/dist/svelte/components/LayerTree.svelte","../../node_modules/@sakuzu/kata/dist/svelte/components/List.svelte","../../node_modules/@sakuzu/kata/dist/svelte/components/Sheet.svelte","../../node_modules/@sakuzu/kata/dist/svelte/components/Progress.svelte","../../node_modules/@sakuzu/kata/dist/svelte/components/ProcessDialog.svelte","../../node_modules/@sakuzu/kata/dist/svelte/components/Section.svelte","../../node_modules/@sakuzu/kata/dist/svelte/components/Stat.svelte","../../node_modules/@sakuzu/kata/dist/svelte/components/Stats.svelte","../../node_modules/@sakuzu/kata/dist/svelte/components/SelectionSummary.svelte","../../node_modules/@sakuzu/kata/dist/svelte/lib/shortcuts.js","../../node_modules/@sakuzu/kata/dist/svelte/components/ShortcutsModal.svelte","../../node_modules/@sakuzu/kata/dist/svelte/components/Veil.svelte","../../node_modules/@sakuzu/kata/dist/svelte/components/Shell.svelte","../../node_modules/@lucide/svelte/dist/icons/circle.svelte","../../node_modules/@lucide/svelte/dist/icons/magnet.svelte","../../node_modules/@lucide/svelte/dist/icons/mouse-pointer-2.svelte","../src/components/MarkupIcon.svelte","../src/tools.ts","../src/shortcuts.ts","../src/store.ts","../src/inspector/sections.ts","../src/inspector/attributes.ts","../src/inspector/measure.ts","../src/inspector/operations.ts","../src/inspector/style.ts","../src/inspector/view.ts","../src/locales/en.ts","../src/locales/ja.ts","../src/messages.ts","../src/components/BufferDialog.svelte","../src/components/CustomSection.svelte","../src/components/StyleFields.svelte","../src/components/FeatureInspector.svelte","../src/components/GroupInspector.svelte","../src/components/LayerInspector.svelte","../src/components/SelectionInspector.svelte","../src/components/Inspector.svelte","../../node_modules/@lucide/svelte/dist/icons/pen-line.svelte","../../node_modules/@lucide/svelte/dist/icons/group.svelte","../../node_modules/@lucide/svelte/dist/icons/shapes.svelte","../src/layers/tree.ts","../src/layers/move.ts","../src/components/LayerPanel.svelte","../src/layers/legend.ts","../src/components/Legend.svelte","../src/components/LeftPanel.svelte","../src/components/Toolbar.svelte","../src/components/DrawUI.svelte","../src/controls.ts","../src/padding.ts","../src/theme.ts","../src/index.ts"],"sourcesContent":["// 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 * Set on the effect that `pause_effect` was called on, i.e. the root of a paused subtree,\n * as opposed to its descendants which are merely `INERT`. This allows `resume_effect` on\n * an ancestor to skip subtrees that were paused for their own reasons (such as a block\n * whose condition is still false) rather than resurrecting them\n */\nexport const PAUSED = 1 << 8;\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 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');\n/** Marks component export objects, so that `proxy(...)` leaves them untouched */\nexport const COMPONENT_SYMBOL = Symbol('component');\nexport const LEGACY_PROPS = Symbol('legacy props');\nexport const LOADING_ATTR_SYMBOL = Symbol('');\nexport const PROXY_PATH_SYMBOL = Symbol('proxy path');\nexport const ATTRIBUTES_CACHE = Symbol('attributes');\nexport const CLASS_CACHE = Symbol('class');\nexport const STYLE_CACHE = Symbol('style');\nexport const TEXT_CACHE = Symbol('text');\nexport const FORM_RESET_HANDLER = Symbol('form reset');\n/** An anchor might change, via this symbol on the original anchor we can tell HMR about the updated anchor */\nexport const HMR_ANCHOR = Symbol('hmr anchor');\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","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('uninitialized');\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","/* 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 * Reading a derived belonging to a now-destroyed effect may result in stale values\n */\nexport function derived_inert() {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] derived_inert\\n%cReading a derived belonging to a now-destroyed effect may result in stale values\\nhttps://svelte.dev/e/derived_inert`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/derived_inert`);\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 * 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 { TemplateNode } from '#client' */\n\nimport { COMMENT_NODE } from '#client/constants';\nimport {\n\tHYDRATION_END,\n\tHYDRATION_ERROR,\n\tHYDRATION_START,\n\tHYDRATION_START_ELSE\n} from '../../../constants.js';\nimport * as w from '../warnings.js';\nimport { get_next_sibling } from './operations.js';\n\n/**\n * Use this variable to guard everything related to hydration code so it can be treeshaken out\n * if the user doesn't use the `hydrate` method and these code paths are therefore not needed.\n */\nexport let hydrating = false;\n\n/** @param {boolean} value */\nexport function set_hydrating(value) {\n\thydrating = value;\n}\n\n/**\n * The node that is currently being hydrated. This starts out as the first node inside the opening\n * <!--[--> comment, and updates each time a component calls `$.child(...)` or `$.sibling(...)`.\n * When entering a block (e.g. `{#if ...}`), `hydrate_node` is the block opening comment; by the\n * time we leave the block it is the closing comment, which serves as the block's anchor.\n * @type {TemplateNode}\n */\nexport let hydrate_node;\n\n/** @param {TemplateNode | null} node */\nexport function set_hydrate_node(node) {\n\tif (node === null) {\n\t\tw.hydration_mismatch();\n\t\tthrow HYDRATION_ERROR;\n\t}\n\n\treturn (hydrate_node = node);\n}\n\nexport function hydrate_next() {\n\treturn set_hydrate_node(get_next_sibling(hydrate_node));\n}\n\n/** @param {TemplateNode} node */\nexport function reset(node) {\n\tif (!hydrating) return;\n\n\t// If the node has remaining siblings, something has gone wrong\n\tif (get_next_sibling(hydrate_node) !== null) {\n\t\tw.hydration_mismatch();\n\t\tthrow HYDRATION_ERROR;\n\t}\n\n\thydrate_node = node;\n}\n\n/**\n * @param {HTMLTemplateElement} template\n */\nexport function hydrate_template(template) {\n\tif (hydrating) {\n\t\t// @ts-expect-error TemplateNode doesn't include DocumentFragment, but it's actually fine\n\t\thydrate_node = template.content;\n\t}\n}\n\nexport function next(count = 1) {\n\tif (hydrating) {\n\t\tvar i = count;\n\t\tvar node = hydrate_node;\n\n\t\twhile (i--) {\n\t\t\tnode = /** @type {TemplateNode} */ (get_next_sibling(node));\n\t\t}\n\n\t\thydrate_node = node;\n\t}\n}\n\n/**\n * Skips or removes (depending on {@link remove}) all nodes starting at `hydrate_node` up until the next hydration end comment\n * @param {boolean} remove\n */\nexport function skip_nodes(remove = true) {\n\tvar depth = 0;\n\tvar node = hydrate_node;\n\n\twhile (true) {\n\t\tif (node.nodeType === COMMENT_NODE) {\n\t\t\tvar data = /** @type {Comment} */ (node).data;\n\n\t\t\tif (data === HYDRATION_END) {\n\t\t\t\tif (depth === 0) return node;\n\t\t\t\tdepth -= 1;\n\t\t\t} else if (\n\t\t\t\tdata === HYDRATION_START ||\n\t\t\t\tdata === HYDRATION_START_ELSE ||\n\t\t\t\t// \"[1\", \"[2\", etc. for if blocks\n\t\t\t\t(data[0] === '[' && !isNaN(Number(data.slice(1))))\n\t\t\t) {\n\t\t\t\tdepth += 1;\n\t\t\t}\n\t\t}\n\n\t\tvar next = /** @type {TemplateNode} */ (get_next_sibling(node));\n\t\tif (remove) node.remove();\n\t\tnode = next;\n\t}\n}\n\n/**\n *\n * @param {TemplateNode} node\n */\nexport function read_hydration_instruction(node) {\n\tif (!node || node.nodeType !== COMMENT_NODE) {\n\t\tw.hydration_mismatch();\n\t\tthrow HYDRATION_ERROR;\n\t}\n\n\treturn /** @type {Comment} */ (node).data;\n}\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","/* 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 the current component or any of its ancestors\n * @returns {never}\n */\nexport function missing_context() {\n\tif (DEV) {\n\t\tconst error = new Error(`missing_context\\nContext was not set in the current component or any of its ancestors\\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 * `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 * 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}","/* 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 * 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}","/** 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","/** @import { Derived, Reaction, Value } from '#client' */\nimport { UNINITIALIZED } from '../../../constants.js';\nimport { snapshot } from '../../shared/clone.js';\nimport { DERIVED, ASYNC, PROXY_PATH_SYMBOL, STATE_SYMBOL } from '#client/constants';\nimport { effect_tracking } from '../reactivity/effects.js';\nimport { active_reaction, untrack } from '../runtime.js';\n\n/**\n * @typedef {{\n * traces: Error[];\n * }} TraceEntry\n */\n\n/** @type {{ reaction: Reaction | null, entries: Map<Value, TraceEntry> } | null} */\nexport let tracing_expressions = null;\n\n/**\n * @param {Value} signal\n * @param {TraceEntry} [entry]\n */\nfunction log_entry(signal, entry) {\n\tconst value = signal.v;\n\n\tif (value === UNINITIALIZED) {\n\t\treturn;\n\t}\n\n\tconst type = get_type(signal);\n\tconst current_reaction = /** @type {Reaction} */ (active_reaction);\n\tconst dirty = signal.wv > current_reaction.wv || current_reaction.wv === 0;\n\tconst style = dirty\n\t\t? 'color: CornflowerBlue; font-weight: bold'\n\t\t: 'color: grey; font-weight: normal';\n\n\t// eslint-disable-next-line no-console\n\tconsole.groupCollapsed(\n\t\tsignal.label ? `%c${type}%c ${signal.label}` : `%c${type}%c`,\n\t\tstyle,\n\t\tdirty ? 'font-weight: normal' : style,\n\t\ttypeof value === 'object' && value !== null && STATE_SYMBOL in value\n\t\t\t? snapshot(value, true)\n\t\t\t: value\n\t);\n\n\tif (type === '$derived') {\n\t\tconst deps = new Set(/** @type {Derived} */ (signal).deps);\n\t\tfor (const dep of deps) {\n\t\t\tlog_entry(dep);\n\t\t}\n\t}\n\n\tif (signal.created) {\n\t\t// eslint-disable-next-line no-console\n\t\tconsole.log(signal.created);\n\t}\n\n\tif (dirty && signal.updated) {\n\t\tfor (const updated of signal.updated.values()) {\n\t\t\tif (updated.error) {\n\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\tconsole.log(updated.error);\n\t\t\t}\n\t\t}\n\t}\n\n\tif (entry) {\n\t\tfor (var trace of entry.traces) {\n\t\t\t// eslint-disable-next-line no-console\n\t\t\tconsole.log(trace);\n\t\t}\n\t}\n\n\t// eslint-disable-next-line no-console\n\tconsole.groupEnd();\n}\n\n/**\n * @param {Value} signal\n * @returns {'$state' | '$derived' | 'store'}\n */\nfunction get_type(signal) {\n\tif ((signal.f & (DERIVED | ASYNC)) !== 0) return '$derived';\n\treturn signal.label?.startsWith('$') ? 'store' : '$state';\n}\n\n/**\n * @template T\n * @param {() => string} label\n * @param {() => T} fn\n */\nexport function trace(label, fn) {\n\tvar previously_tracing_expressions = tracing_expressions;\n\n\ttry {\n\t\ttracing_expressions = { entries: new Map(), reaction: active_reaction };\n\n\t\tvar start = performance.now();\n\t\tvar value = fn();\n\t\tvar time = (performance.now() - start).toFixed(2);\n\n\t\tvar prefix = untrack(label);\n\n\t\tif (!effect_tracking()) {\n\t\t\t// eslint-disable-next-line no-console\n\t\t\tconsole.log(`${prefix} %cran outside of an effect (${time}ms)`, 'color: grey');\n\t\t} else if (tracing_expressions.entries.size === 0) {\n\t\t\t// eslint-disable-next-line no-console\n\t\t\tconsole.log(`${prefix} %cno reactive dependencies (${time}ms)`, 'color: grey');\n\t\t} else {\n\t\t\t// eslint-disable-next-line no-console\n\t\t\tconsole.group(`${prefix} %c(${time}ms)`, 'color: grey');\n\n\t\t\tvar entries = tracing_expressions.entries;\n\n\t\t\tuntrack(() => {\n\t\t\t\tfor (const [signal, traces] of entries) {\n\t\t\t\t\tlog_entry(signal, traces);\n\t\t\t\t}\n\t\t\t});\n\n\t\t\ttracing_expressions = null;\n\n\t\t\t// eslint-disable-next-line no-console\n\t\t\tconsole.groupEnd();\n\t\t}\n\n\t\treturn value;\n\t} finally {\n\t\ttracing_expressions = previously_tracing_expressions;\n\t}\n}\n\n/**\n * @param {Value} source\n * @param {string} label\n */\nexport function tag(source, label) {\n\tsource.label = label;\n\ttag_proxy(source.v, label);\n\n\treturn source;\n}\n\n/**\n * @param {unknown} value\n * @param {string} label\n */\nexport function tag_proxy(value, label) {\n\t// @ts-expect-error\n\tvalue?.[PROXY_PATH_SYMBOL]?.(label);\n\treturn value;\n}\n\n/**\n * @param {unknown} value\n */\nexport function label(value) {\n\tif (typeof value === 'symbol') return `Symbol(${value.description})`;\n\tif (typeof value === 'function') return '<function>';\n\tif (typeof value === 'object' && value) return '<object>';\n\treturn String(value);\n}\n","import { DEV } from 'esm-env';\nimport { define_property } from './utils.js';\nimport * as e from './errors.js';\n\n/**\n * @param {string} label\n * @returns {Error & { stack: string } | null}\n */\nexport function get_error(label) {\n\tconst error = new Error();\n\tconst stack = get_stack();\n\n\tif (stack.length === 0) {\n\t\treturn null;\n\t}\n\n\tstack.unshift('\\n');\n\n\tdefine_property(error, 'stack', {\n\t\tvalue: stack.join('\\n')\n\t});\n\n\tdefine_property(error, 'name', {\n\t\tvalue: label\n\t});\n\n\treturn /** @type {Error & { stack: string }} */ (error);\n}\n\n/**\n * @returns {string[]}\n */\nexport function get_stack() {\n\t// @ts-ignore - doesn't exist everywhere\n\tconst limit = Error.stackTraceLimit;\n\t// @ts-ignore - doesn't exist everywhere\n\tError.stackTraceLimit = Infinity;\n\tconst stack = new Error().stack;\n\t// @ts-ignore - doesn't exist everywhere\n\tError.stackTraceLimit = limit;\n\n\tif (!stack) return [];\n\n\tconst lines = stack.split('\\n');\n\tconst new_lines = [];\n\n\tfor (let i = 0; i < lines.length; i++) {\n\t\tconst line = lines[i];\n\t\tconst posixified = line.replaceAll('\\\\', '/');\n\n\t\tif (line.trim() === 'Error') {\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (line.includes('validate_each_keys')) {\n\t\t\treturn [];\n\t\t}\n\n\t\tif (posixified.includes('svelte/src/internal') || posixified.includes('node_modules/.vite')) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tnew_lines.push(line);\n\t}\n\n\treturn new_lines;\n}\n\n/**\n * @param {boolean} condition\n * @param {string} message\n */\nexport function invariant(condition, message) {\n\tif (!DEV) {\n\t\tthrow new Error('invariant(...) was not guarded by if (DEV)');\n\t}\n\n\tif (!condition) e.invariant_violation(message);\n}\n","import { lifecycle_outside_component, missing_context } from './errors.js';\n\n/**\n * @template T\n * @param {(key: object) => T} get_context\n * @param {(key: object, context: T) => T} set_context\n * @param {(key: object) => boolean} has_context\n * @returns {[() => T, (context: T) => T, () => boolean]}\n */\nexport function create_context(get_context, set_context, has_context) {\n\tconst key = {};\n\n\treturn [\n\t\t() => {\n\t\t\tif (!has_context(key)) {\n\t\t\t\tmissing_context();\n\t\t\t}\n\n\t\t\treturn get_context(key);\n\t\t},\n\t\t(context) => set_context(key, context),\n\t\t() => has_context(key)\n\t];\n}\n\n/**\n * @typedef {{ p: Context | null, c: Map<unknown, unknown> | null }} Context\n */\n\n/**\n * @param {Context} context\n * @returns {Map<unknown, unknown> | null}\n */\nfunction get_parent_context(context) {\n\tlet parent = context.p;\n\twhile (parent !== null && parent.c === null) {\n\t\tparent = parent.p;\n\t}\n\treturn parent?.c ?? null;\n}\n\n/**\n * @param {Context | null} context\n * @param {string} name\n * @returns {Map<unknown, unknown>}\n */\nexport function get_or_init_context_map(context, name) {\n\tif (context === null) {\n\t\tlifecycle_outside_component(name);\n\t}\n\n\treturn (context.c ??= new Map(get_parent_context(context) || undefined));\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, COMPONENT_SYMBOL } from './constants.js';\nimport { define_property } from '../shared/utils.js';\nimport { create_context, get_or_init_context_map } from '../shared/context.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, has]` triplet of functions for working with context in a type-safe way.\n *\n * `get` will throw an error if `set` has not yet been called in the current component or any of\n * its ancestors.\n *\n * @template T\n * @returns {[() => T, (context: T) => T, () => boolean]}\n * @since 5.40.0\n */\nexport function createContext() {\n\treturn /** @type {[() => T, (context: T) => T, () => boolean]} */ (\n\t\tcreate_context(getContext, setContext, hasContext)\n\t);\n}\n\n/**\n * Retrieves the context set with the specified `key` in the current component or any of its\n * ancestors. If multiple components set the same key, the value from the closest one is returned.\n * A `setContext` call in the current component is only visible to `getContext` calls that run after it.\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(component_context, '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 the component itself and all of its\n * descendants (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(component_context, '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 the current component or any of\n * its ancestors. 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(component_context, 'hasContext');\n\treturn context_map.has(key);\n}\n\n/**\n * Retrieves the whole context map that belongs to the current component, including entries\n * inherited from its ancestors. Must be called during component initialisation. Useful, for\n * example, if you 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(component_context, '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 mark_as_component(component);\n}\n\n/**\n * Add a symbol to the object (or create one if undefined) to mark it as a component so it isn't proxified.\n * @param {any} component\n */\nexport function mark_as_component(component = {}) {\n\tdefine_property(component, COMPONENT_SYMBOL, { value: true });\n\treturn component;\n}\n\n/** @returns {boolean} */\nexport function is_runes() {\n\treturn !legacy_mode_flag || (component_context !== null && component_context.l === 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, 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 { Effect } from '#client' */\nimport { CLEAN, DIRTY, MAYBE_DIRTY } from '#client/constants';\nimport { set_signal_status } from './status.js';\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// mark as clean so they get scheduled if they depend on pending async state\n\tset_signal_status(effect, CLEAN);\n}\n","import { hydrating } from '../hydration.js';\nimport { clear_text_content, get_first_child } from '../operations.js';\nimport { queue_micro_task } from '../task.js';\nimport { FORM_RESET_HANDLER } from '../../constants.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/** @type {any} */ (e)[FORM_RESET_HANDLER]?.();\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 { FORM_RESET_HANDLER } from '../../../constants.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\tconst prev = /** @type {any} */ (element)[FORM_RESET_HANDLER];\n\tif (prev) {\n\t\t// special case for checkbox that can have multiple binds (group & checked)\n\t\t/** @type {any} */ (element)[FORM_RESET_HANDLER] = () => {\n\t\t\tprev();\n\t\t\ton_reset(true);\n\t\t};\n\t} else {\n\t\t/** @type {any} */ (element)[FORM_RESET_HANDLER] = () => on_reset(true);\n\t}\n\n\tadd_form_reset_listener();\n}\n","/** @import { Blocker, Effect, Source, 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 { 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\tvar deriveds = sync.map(d);\n\n\tif (DEV) {\n\t\tderiveds.forEach((d, i) => {\n\t\t\t// TODO this is kinda useful for debugging but a lousy implementation —\n\t\t\t// maybe the compiler could pass through the template string\n\t\t\td.label = sync[i]\n\t\t\t\t.toString()\n\t\t\t\t.replace('() => ', '')\n\t\t\t\t.replaceAll('$.eager(() => ', '$state.eager(')\n\t\t\t\t.replace(/\\$\\.get\\((.+?)\\)/g, (_, id) => id);\n\t\t});\n\t}\n\n\tif (async.length === 0 && pending.length === 0) {\n\t\tfn(deriveds);\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/**\n\t * @param {Source[]} async\n\t */\n\tfunction finish(async) {\n\t\tif ((parent.f & DESTROYED) !== 0) {\n\t\t\treturn;\n\t\t}\n\n\t\trestore();\n\n\t\ttry {\n\t\t\tfn([...deriveds, ...async]);\n\t\t} catch (error) {\n\t\t\tinvoke_error_boundary(error, parent);\n\t\t}\n\n\t\tunset_context();\n\t}\n\n\tvar decrement_pending = increment_pending();\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([])).finally(decrement_pending);\n\t\treturn;\n\t}\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(finish)\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/** `true` between a `save` thunk restoring a context and the end of that synchronous segment */\nvar restored = false;\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\t// the context restored by an earlier `save` in this expression must not\n\t// outlive the synchronous segment that is about to end at this `await`\n\tunsave();\n\tvar value = await promise;\n\n\treturn () => {\n\t\trestore();\n\t\trestored = true;\n\t\treturn value;\n\t};\n}\n\n/**\n * Unset the context if a `save` thunk restored it in the current synchronous segment,\n * so that a foreign microtask can never run inside a restored reaction context.\n * Called at every suspension point, and at the end of async expression bodies —\n * `async () => (await $.save(a))().b` becomes `async () => { try { return (await $.save(a))().b; } finally { $.unsave(); } }`\n * @template T\n * @param {T} [value]\n * @returns {T}\n */\nexport function unsave(value) {\n\tif (restored) unset_context();\n\treturn /** @type {T} */ (value);\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\tunsave();\n\tvar previous_reactivity_loss_tracker = reactivity_loss_tracker;\n\t// Ensure that unrelated reads after an async operation is kicked off don't cause false positives\n\tqueueMicrotask(() => {\n\t\tif (reactivity_loss_tracker === previous_reactivity_loss_tracker) {\n\t\t\tset_reactivity_loss_tracker(null);\n\t\t}\n\t});\n\n\tvar value = await promise;\n\n\treturn () => {\n\t\tset_reactivity_loss_tracker(previous_reactivity_loss_tracker);\n\t\t// While this can result in false negatives it also guards against the more important\n\t\t// false positives that would occur if this is the last in a chain of async operations,\n\t\t// and the reactivity_loss_tracker would then stay around until the next async operation happens.\n\t\tqueueMicrotask(() => {\n\t\t\tif (reactivity_loss_tracker === previous_reactivity_loss_tracker) {\n\t\t\t\tset_reactivity_loss_tracker(null);\n\t\t\t}\n\t\t});\n\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// eslint-disable-next-line no-useless-assignment\n\tlet invoke_return = true;\n\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\tinvoke_return = false;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tvar prev = reactivity_loss_tracker;\n\t\t\ttry {\n\t\t\t\tyield value;\n\t\t\t} catch (e) {\n\t\t\t\tset_reactivity_loss_tracker(prev);\n\t\t\t\t// If the yield throws, we need to call `return` but not return its value, instead rethrow\n\t\t\t\tif (iterator.return !== undefined) {\n\t\t\t\t\t(await track_reactivity_loss(iterator.return()))();\n\t\t\t\t}\n\t\t\t\tthrow e;\n\t\t\t}\n\t\t\tset_reactivity_loss_tracker(prev);\n\t\t}\n\t} catch (error) {\n\t\tinvoke_return = false;\n\t\tthrow error;\n\t} finally {\n\t\t// If the iterator had an abrupt completion (break) and `return` is defined on the iterator, call it and return the value\n\t\tif (invoke_return && 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\trestored = false;\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\trestore();\n\n\t\t\t\ttry {\n\t\t\t\t\tif (errored) {\n\t\t\t\t\t\tthrow errored.error;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (aborted(active)) {\n\t\t\t\t\t\tthrow STALE_REACTION;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn fn();\n\t\t\t\t} finally {\n\t\t\t\t\t// We gotta unset context directly in case the function returns a promise, in which case\n\t\t\t\t\t// unset_context in .finally() would be too late ...\n\t\t\t\t\tunset_context();\n\t\t\t\t}\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\t// ... but we also need it after such a promise has resolved in case it restores our context\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 = effect.b; // undefined if called outside the render tree, e.g. a standalone $effect.root\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 () => {\n\t\tboundary?.update_pending_count(-1, batch);\n\t\tbatch.decrement(blocking, effect);\n\t};\n}\n","/** @import { Derived, Effect, Reaction, Source, Value } 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\tDESTROYED,\n\tCLEAN,\n\tREACTION_RAN,\n\tINERT\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\tskipped_deps,\n\tnew_deps\n} from '../runtime.js';\nimport { without_reactive_context } from '../dom/elements/bindings/shared.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, previous_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, effect_deps: Set<Value>, warned: boolean } | null}\n */\nexport let reactivity_loss_tracker = null;\n\n/** @param {{ effect: Effect, effect_deps: Set<Value>, 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\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: 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\nexport const OBSOLETE = Symbol('obsolete');\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 ?? fn.toString();\n\n\t// only suspend in async deriveds created on initialisation\n\tvar should_suspend = !active_reaction;\n\n\t/** @type {Set<ReturnType<typeof deferred<V>>>} */\n\tvar deferreds = new Set();\n\n\tasync_effect(() => {\n\t\tvar effect = /** @type {Effect} */ (active_effect);\n\n\t\tif (DEV) {\n\t\t\treactivity_loss_tracker = { effect, effect_deps: new Set(), warned: false };\n\t\t}\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())\n\t\t\t\t.then(d.resolve, (e) => {\n\t\t\t\t\t// if the promise was rejected by the user, via `getAbortSignal`, then\n\t\t\t\t\t// wait for a subsequent resolution instead of flushing the batch\n\t\t\t\t\tif (e !== STALE_REACTION) d.reject(e);\n\t\t\t\t})\n\t\t\t\t.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\tif (reactivity_loss_tracker) {\n\t\t\t\t// Reused deps from previous run (indices 0 to skipped_deps-1)\n\t\t\t\t// We deliberately only track direct dependencies of the async expression to encourage\n\t\t\t\t// dependencies being directly visible at the point of the expression\n\t\t\t\tif (effect.deps !== null) {\n\t\t\t\t\tfor (let i = 0; i < skipped_deps; i += 1) {\n\t\t\t\t\t\treactivity_loss_tracker.effect_deps.add(effect.deps[i]);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// New deps discovered this run\n\t\t\t\tif (new_deps !== null) {\n\t\t\t\t\tfor (let i = 0; i < new_deps.length; i += 1) {\n\t\t\t\t\t\treactivity_loss_tracker.effect_deps.add(new_deps[i]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\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 (\n\t\t\t\t// boundary can be null if the async derived is inside an $effect.root not connected to the component render tree\n\t\t\t\tparent.b?.is_rendered()\n\t\t\t) {\n\t\t\t\tbatch.async_deriveds.get(effect)?.reject(OBSOLETE);\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(OBSOLETE);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tdeferreds.add(d);\n\t\t\tbatch.async_deriveds.set(effect, 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\tdecrement_pending?.();\n\t\t\tdeferreds.delete(d);\n\n\t\t\tif (error === OBSOLETE) return;\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\tif (DEV && location !== undefined && !signal.equals(value)) {\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) && (effect.f & DESTROYED) === 0) {\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\n\t\t\t\tinternal_set(signal, value);\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) {\n\t\t\td.reject(OBSOLETE);\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 * @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\tvar parent = derived.parent;\n\n\tif (\n\t\t!is_destroying_effect &&\n\t\tparent !== null &&\n\t\tderived.v !== UNINITIALIZED && // if it was never evaluated before, it's guaranteed to fail downstream, so we try to execute instead\n\t\t(parent.f & (DESTROYED | INERT)) !== 0\n\t) {\n\t\tw.derived_inert();\n\n\t\treturn derived.v;\n\t}\n\n\tset_active_effect(parent);\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\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\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 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\tif (current_batch !== null) {\n\t\t\t\t// We also write to previous_batch because if it exists, it is a sign that we're\n\t\t\t\t// currently in the process of flushing effects. These updates to deriveds may belong\n\t\t\t\t// to the previous batch, not the new one (which can already exist if an earlier\n\t\t\t\t// effect wrote to a source). This can cause bugs when running batch.#commit() later,\n\t\t\t\t// but not adding it to current_batch can, too, so we add it to both.\n\t\t\t\t// See https://github.com/sveltejs/svelte/pull/18117 for more details.\n\t\t\t\tcurrent_batch.capture(derived, value, true);\n\t\t\t\tprevious_batch?.capture(derived, value, true);\n\t\t\t} else {\n\t\t\t\tderived.v = value;\n\t\t\t}\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\tif (e.ac !== null) {\n\t\t\t\twithout_reactive_context(() => {\n\t\t\t\t\t/** @type {AbortController} */ (e.ac).abort(STALE_REACTION);\n\t\t\t\t\te.ac = null;\n\t\t\t\t});\n\t\t\t}\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 (but not for teardown-only effects)\n\t\t\tif (e.fn !== null) e.teardown = noop;\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 && e.fn !== null) {\n\t\t\tupdate_effect(e);\n\t\t}\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\tDESTROYING\n} from '#client/constants';\nimport { async_mode_flag } from '../../flags/index.js';\nimport { deferred, define_property, includes } from '../../shared/utils.js';\nimport {\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, teardown, unlink_effect } from './effects.js';\nimport { defer_effect } from './utils.js';\nimport { UNINITIALIZED } from '../../../constants.js';\nimport { set_signal_status } from './status.js';\nimport { invariant } from '../../shared/dev.js';\nimport { log_effect_tree } from '../dev/debug.js';\nimport { OBSOLETE } from './deriveds.js';\n\n/** @type {Batch | null} */\nlet first_batch = null;\n\n/** @type {Batch | null} */\nlet last_batch = null;\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;\n\n/** @type {Set<Value>} */\nvar source_stacks = new Set();\n\nlet uid = 1;\n\nexport class Batch {\n\tid = uid++;\n\n\t/** True as soon as `#process` was called */\n\t#started = false;\n\n\tlinked = true;\n\n\t/** @type {Batch | null} */\n\t#prev = null;\n\n\t/** @type {Batch | null} */\n\t#next = null;\n\n\t/** @type {Map<Effect, ReturnType<typeof deferred<any>>>} */\n\tasync_deriveds = new Map();\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 * The number of async effects that are currently in flight\n\t */\n\t#pending = 0;\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 * Effects that were scheduled in this batch but not yet 'resolved' into the\n\t * root effects that need to be flushed. Resolving — the upwards traversal that\n\t * marks the path to each effect on the shared effect tree (see #resolve) — is\n\t * deferred until the batch is processed, so that the markers are created and\n\t * consumed within a single traversal. Scheduling into other batches (which can\n\t * happen concurrently, e.g. while a batch is committed) can therefore never\n\t * observe (and be confused by) this batch's markers.\n\t * May contain duplicates — deduplication happens during resolving\n\t * @type {Effect[]}\n\t */\n\t#scheduled = [];\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\t/**\n\t * Inverse of #skipped_branches which we need to tell prior batches to unskip them when committing\n\t * @type {Set<Effect>}\n\t */\n\t#unskipped_branches = new Set();\n\n\tis_fork = false;\n\n\t#decrement_queued = false;\n\n\tconstructor() {\n\t\t// link batch\n\t\tif (last_batch === null) {\n\t\t\tfirst_batch = last_batch = this;\n\t\t} else {\n\t\t\tlast_batch.#next = this;\n\t\t\tthis.#prev = last_batch;\n\t\t}\n\n\t\tlast_batch = this;\n\t}\n\n\t#is_deferred() {\n\t\tif (this.is_fork) return true;\n\n\t\tfor (const effect of this.#blocking_pending.keys()) {\n\t\t\tvar e = effect;\n\t\t\tvar skipped = false;\n\n\t\t\twhile (e.parent !== null) {\n\t\t\t\tif (this.#skipped_branches.has(e)) {\n\t\t\t\t\tskipped = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\te = e.parent;\n\t\t\t}\n\n\t\t\tif (!skipped) {\n\t\t\t\treturn true;\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\tthis.#unskipped_branches.delete(effect);\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 * @param {(e: Effect) => void} callback\n\t */\n\tunskip_effect(effect, callback = (e) => this.schedule(e)) {\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\tcallback(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\tcallback(e);\n\t\t\t}\n\t\t}\n\t\tthis.#unskipped_branches.add(effect);\n\t}\n\n\t/**\n\t * Convert the effects that were scheduled in this batch into the root effects\n\t * that need to be traversed, marking the path to each effect (by clearing the\n\t * `CLEAN` flag on ancestor branches) so that the traversal can find them.\n\t * This happens right before traversal rather than at scheduling time, so that\n\t * the markers left on the (shared) effect tree are created and consumed within\n\t * a single traversal — scheduling into other batches can never observe them\n\t * @returns {Effect[]}\n\t */\n\t#resolve() {\n\t\t/** @type {Effect[]} */\n\t\tvar roots = [];\n\n\t\tfor (const effect of this.#scheduled) {\n\t\t\t// skip effects that are destroyed, or that already ran (e.g. because\n\t\t\t// they were reached by the traversal that preceded a drain iteration,\n\t\t\t// or because they were scheduled twice)\n\t\t\tif ((effect.f & DESTROYED) !== 0 || (effect.f & (DIRTY | MAYBE_DIRTY)) === 0) continue;\n\n\t\t\tvar e = effect;\n\t\t\tvar covered = false;\n\n\t\t\twhile (e.parent !== null) {\n\t\t\t\te = e.parent;\n\t\t\t\tvar flags = e.f;\n\n\t\t\t\tif ((flags & (ROOT_EFFECT | BRANCH_EFFECT)) !== 0) {\n\t\t\t\t\tif ((flags & CLEAN) === 0) {\n\t\t\t\t\t\t// the path to the root was already marked, meaning the\n\t\t\t\t\t\t// root was already collected — nothing left to do\n\t\t\t\t\t\tcovered = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\te.f ^= CLEAN;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (!covered) {\n\t\t\t\troots.push(e);\n\t\t\t}\n\t\t}\n\n\t\tthis.#scheduled = [];\n\n\t\treturn roots;\n\t}\n\n\t#process() {\n\t\tthis.#started = true;\n\n\t\tif (DEV) {\n\t\t\t// track all the values that were updated during this flush,\n\t\t\t// so that they can be reset afterwards\n\t\t\tfor (const value of this.current.keys()) {\n\t\t\t\tsource_stacks.add(value);\n\t\t\t}\n\t\t}\n\n\t\t// We always reschedule previously-deferred effects, not just when\n\t\t// #is_deferred() is true, because traversing the tree could make\n\t\t// an if block that contains the last blocking pending effect falsy,\n\t\t// causing the block to no longer be deferred.\n\t\tfor (const e of this.#dirty_effects) {\n\t\t\tthis.#maybe_dirty_effects.delete(e);\n\t\t\tset_signal_status(e, DIRTY);\n\t\t\tthis.schedule(e);\n\t\t}\n\n\t\tfor (const e of this.#maybe_dirty_effects) {\n\t\t\tset_signal_status(e, MAYBE_DIRTY);\n\t\t\tthis.schedule(e);\n\t\t}\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\t// Effects can be scheduled during traversal (e.g. because a parent each/await/etc\n\t\t// block updated an internal source, or because an effect invalidated itself)\n\t\t// hence we loop until there are no more scheduled effects.\n\t\twhile (this.#scheduled.length > 0) {\n\t\t\tif (flush_count++ > 1000) {\n\t\t\t\tthis.#unlink();\n\t\t\t\tinfinite_loop_guard(); // TODO try to reset_all() here?\n\t\t\t}\n\n\t\t\tfor (const root of this.#resolve()) {\n\t\t\t\ttry {\n\t\t\t\t\tthis.#traverse(root, effects, render_effects);\n\t\t\t\t} catch (e) {\n\t\t\t\t\treset_all(root);\n\t\t\t\t\t// If there's no async work left, this branch is now dead and needs\n\t\t\t\t\t// to be discarded to not become a zombie that is never cleaned up.\n\t\t\t\t\t// See https://github.com/sveltejs/svelte/issues/18221#issuecomment-4497918414\n\t\t\t\t\t// for a (non-minimal) reproduction that demonstrates a case where this is necessary\n\t\t\t\t\t// to not get follow-up false-positives via \"batch has scheduled roots\" invariant errors.\n\t\t\t\t\tif (!this.#is_deferred()) this.discard();\n\t\t\t\t\tthrow e;\n\t\t\t\t}\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\t// if the batch has outstanding pending work, stash effects and bail\n\t\tif (this.#is_deferred()) {\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\n\t\t\tif (updates.length > 0) {\n\t\t\t\t/** @type {Batch} */ (/** @type {unknown} */ (current_batch)).#process();\n\t\t\t}\n\n\t\t\treturn;\n\t\t}\n\n\t\tconst earlier_batch = this.#find_earlier_batch();\n\n\t\tif (earlier_batch) {\n\t\t\t// If this batch collected deferred effects during traversal, they still need\n\t\t\t// to run after being merged into the earlier batch.\n\t\t\tthis.#defer_effects(render_effects);\n\t\t\tthis.#defer_effects(effects);\n\t\t\tearlier_batch.#merge(this);\n\t\t\treturn;\n\t\t}\n\n\t\t// clear effects. Those that are still needed will be rescheduled through unskipping the skipped branches.\n\t\tthis.#dirty_effects.clear();\n\t\tthis.#maybe_dirty_effects.clear();\n\n\t\t// append/remove branches\n\t\tfor (const fn of this.#commit_callbacks) fn(this);\n\t\tthis.#commit_callbacks.clear();\n\n\t\tprevious_batch = this;\n\t\tflush_queued_effects(render_effects);\n\t\tflush_queued_effects(effects);\n\t\tprevious_batch = null;\n\n\t\tthis.#deferred?.resolve();\n\n\t\tvar next_batch = /** @type {Batch | null} */ (/** @type {unknown} */ (current_batch));\n\n\t\tif (this.#pending === 0 && (this.#scheduled.length === 0 || next_batch !== null)) {\n\t\t\tthis.#unlink();\n\n\t\t\t// Order matters here - we need to commit and THEN continue flushing new batches, not the other way around,\n\t\t\t// else we could start flushing a new batch and then, if it has pending work, rebase it right afterwards, which is wrong.\n\t\t\t// In sync mode flushSync can cause #commit to wrongfully think that there needs to be a rebase, so we only do it in async mode\n\t\t\t// TODO fix the underlying cause, otherwise this will likely regress when non-async mode is removed\n\t\t\tif (async_mode_flag) {\n\t\t\t\tthis.#commit();\n\t\t\t\t// Rebases can activate other batches or null it out, therefore restore the new one here\n\t\t\t\tcurrent_batch = next_batch;\n\t\t\t}\n\t\t}\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 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.#scheduled.length > 0) {\n\t\t\tif (next_batch !== null) {\n\t\t\t\tfor (const e of this.#scheduled) {\n\t\t\t\t\tnext_batch.#scheduled.push(e);\n\t\t\t\t}\n\n\t\t\t\tthis.#scheduled = [];\n\t\t\t} else {\n\t\t\t\tnext_batch = this;\n\t\t\t}\n\t\t}\n\n\t\tif (next_batch !== null) {\n\t\t\told_values.clear();\n\t\t\tnext_batch.#process();\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#find_earlier_batch() {\n\t\tvar batch = this.#prev;\n\n\t\twhile (batch !== null) {\n\t\t\tif (!batch.is_fork) {\n\t\t\t\t// if the batches are connected, break\n\t\t\t\tfor (const [value, [, is_derived]] of this.current) {\n\t\t\t\t\tif (batch.current.has(value) && !is_derived) {\n\t\t\t\t\t\treturn batch;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tbatch = batch.#prev;\n\t\t}\n\n\t\treturn null;\n\t}\n\n\t/**\n\t * @param {Batch} batch\n\t */\n\t#merge(batch) {\n\t\tfor (const [source, value] of batch.current) {\n\t\t\tif (!this.previous.has(source) && batch.previous.has(source)) {\n\t\t\t\tthis.previous.set(source, batch.previous.get(source));\n\t\t\t}\n\n\t\t\tthis.current.set(source, value);\n\t\t}\n\n\t\tfor (const [effect, deferred] of batch.async_deriveds) {\n\t\t\tconst d = this.async_deriveds.get(effect);\n\t\t\tif (d) deferred.promise.then(d.resolve).catch(d.reject);\n\t\t}\n\n\t\t// Clear them or else those that are still pending might get rejected on discard (after merged-into batch is done).\n\t\t// This can happen when batch Y merged into X and Y has a pending boundary and therefore still-pending async deriveds inside.\n\t\tbatch.async_deriveds.clear();\n\n\t\t// Mark is not guaranteed not touch these, so we transfer them\n\t\tthis.transfer_effects(batch.#dirty_effects, batch.#maybe_dirty_effects);\n\n\t\t/**\n\t\t * mark all effects that depend on `batch.current`, except the\n\t\t * async effects that we just resolved (TODO unless they depend\n\t\t * on values in this batch that are NOT in the later batch?).\n\t\t * Through this we also will populate the correct #skipped_branches,\n\t\t * oncommit callbacks etc, so we don't need to merge them separately.\n\t\t * @param {Value} value\n\t\t */\n\t\tconst mark = (value) => {\n\t\t\tvar reactions = value.reactions;\n\t\t\tif (reactions === null) return;\n\t\t\t// skip if value is derived and is neither dirty nor maybe dirty. transitive\n\t\t\t// deriveds (a derived depending on another derived) are only MAYBE_DIRTY, so\n\t\t\t// we must continue traversing them to reach the effects that depend on them\n\t\t\tif ((value.f & DERIVED) !== 0 && (value.f & (DIRTY | MAYBE_DIRTY)) === 0) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tfor (const reaction of reactions) {\n\t\t\t\tvar flags = reaction.f;\n\n\t\t\t\tif ((flags & DERIVED) !== 0) {\n\t\t\t\t\tmark(/** @type {Derived} */ (reaction));\n\t\t\t\t} else {\n\t\t\t\t\tvar effect = /** @type {Effect} */ (reaction);\n\n\t\t\t\t\tif (flags & (ASYNC | BLOCK_EFFECT) && !this.async_deriveds.has(effect)) {\n\t\t\t\t\t\tthis.#maybe_dirty_effects.delete(effect);\n\t\t\t\t\t\tset_signal_status(effect, DIRTY);\n\t\t\t\t\t\tthis.schedule(effect);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\tfor (const source of this.current.keys()) {\n\t\t\tmark(source);\n\t\t}\n\n\t\tthis.oncommit(() => batch.discard());\n\t\tbatch.#unlink();\n\n\t\tcurrent_batch = this;\n\t\tthis.#process();\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} value\n\t * @param {boolean} [is_derived]\n\t */\n\tcapture(source, value, is_derived = false) {\n\t\tif (source.v !== UNINITIALIZED && !this.previous.has(source)) {\n\t\t\tthis.previous.set(source, source.v);\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, [value, is_derived]);\n\t\t\tbatch_values?.set(source, value);\n\t\t}\n\n\t\tif (!this.is_fork) {\n\t\t\tsource.v = value;\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\ttry {\n\t\t\tif (DEV) {\n\t\t\t\tsource_stacks.clear();\n\t\t\t}\n\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 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\tfor (const deferred of this.async_deriveds.values()) {\n\t\t\tdeferred.reject(OBSOLETE);\n\t\t}\n\n\t\tthis.#unlink();\n\t\tthis.#deferred?.resolve();\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 (let batch = first_batch; batch !== null; batch = batch.#next) {\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\tif (is_earlier) {\n\t\t\t\t// TODO do we need to restart these in some cases, instead of\n\t\t\t\t// immediately resolving them? Likely not because of how this.apply() works.\n\t\t\t\tfor (const [effect, deferred] of this.async_deriveds) {\n\t\t\t\t\tconst d = batch.async_deriveds.get(effect);\n\t\t\t\t\tif (d) deferred.promise.then(d.resolve).catch(d.reject);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tvar current = [...batch.current.keys()].filter(\n\t\t\t\t(source) => !(/** @type {[any, boolean]} */ (batch.current.get(source))[1])\n\t\t\t);\n\n\t\t\t// If not started yet or no sources to update (which is e.g. possible for the very first batch) then bail\n\t\t\tif (!batch.#started || current.length === 0) continue;\n\n\t\t\t// Re-run async/block effects that depend on distinct values changed in both batches (ignoring deriveds)\n\t\t\tvar others = current.filter((source) => !this.current.has(source));\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\t// The microtask queue can contain the batch already scheduled to run right\n\t\t\t\t// after this one is finished, so throwing the invariant would be wrong here.\n\t\t\t\tif (DEV && !batch.#decrement_queued) {\n\t\t\t\t\tinvariant(batch.#scheduled.length === 0, 'Batch has scheduled effects');\n\t\t\t\t}\n\n\t\t\t\t// A batch was unskipped in a later batch -> tell prior batches to unskip it, too\n\t\t\t\tif (is_earlier) {\n\t\t\t\t\tfor (const unskipped of this.#unskipped_branches) {\n\t\t\t\t\t\tbatch.unskip_effect(unskipped, (e) => {\n\t\t\t\t\t\t\tif ((e.f & (BLOCK_EFFECT | ASYNC)) !== 0) {\n\t\t\t\t\t\t\t\tbatch.schedule(e);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tbatch.#defer_effects([e]);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t}\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]\n\t\t\t\t\t.filter(([c, v1]) => {\n\t\t\t\t\t\tconst v2 = this.current.get(c);\n\t\t\t\t\t\tif (!v2) return true;\n\t\t\t\t\t\t// Either their values are different or one is a derived but not the other\n\t\t\t\t\t\treturn v2[0] !== v1[0] || v2[1] !== v1[1];\n\t\t\t\t\t})\n\t\t\t\t\t.map(([c]) => c);\n\n\t\t\t\tif (current_unequal.length > 0) {\n\t\t\t\t\tfor (const effect of this.#new_effects) {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t(effect.f & (DESTROYED | INERT | EAGER_EFFECT)) === 0 &&\n\t\t\t\t\t\t\tdepends_on(effect, current_unequal, checked)\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tif ((effect.f & (ASYNC | BLOCK_EFFECT)) !== 0) {\n\t\t\t\t\t\t\t\tset_signal_status(effect, DIRTY);\n\t\t\t\t\t\t\t\tbatch.schedule(effect);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tbatch.#dirty_effects.add(effect);\n\t\t\t\t\t\t\t}\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\t// and know this won't run anyway right afterwards\n\t\t\t\tif (batch.#scheduled.length > 0 && !batch.#decrement_queued) {\n\t\t\t\t\tbatch.apply();\n\n\t\t\t\t\tfor (var root of batch.#resolve()) {\n\t\t\t\t\t\tbatch.#traverse(root, [], []);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tbatch.deactivate();\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\tthis.#pending += 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 */\n\tdecrement(blocking, effect) {\n\t\tthis.#pending -= 1;\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) return;\n\t\tthis.#decrement_queued = true;\n\n\t\tqueue_micro_task(() => {\n\t\t\tthis.#decrement_queued = false;\n\n\t\t\tif (this.linked) {\n\t\t\t\tthis.flush();\n\t\t\t}\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 && !is_flushing_sync) {\n\t\t\t\tqueue_micro_task(() => {\n\t\t\t\t\tif (!batch.#started) {\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 && this.#prev === null && this.#next === null)) {\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 intersect\n\t\tfor (let batch = first_batch; batch !== null; batch = batch.#next) {\n\t\t\tif (batch === this || batch.is_fork) continue;\n\n\t\t\t// If two batches intersect, the latter batch will be merged into the earlier batch,\n\t\t\t// and we should treat them as a single set of changes\n\t\t\tvar intersects = 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 intersection 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\tif (this.current.has(source)) {\n\t\t\t\t\t\tintersects = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Since the latter batch merges into the earlier (if it resolves before the earlier one),\n\t\t\t// we treat the earlier values as \"already applied\". This way we don't need to rerun async\n\t\t\t// effects of the earlier batch in case they are merged.\n\t\t\t// As a result you can think of batch_values as having the latest values of all intersecting\n\t\t\t// batches up until this batch.\n\t\t\tif (!intersects) {\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\tthis.#scheduled.push(effect);\n\t}\n\n\t#unlink() {\n\t\t// #merge calls #unlink, discard later on does it again - prevent\n\t\t// running it multiple times to not corrupt the linked list\n\t\tif (!this.linked) return;\n\n\t\tvar prev = this.#prev;\n\t\tvar next = this.#next;\n\n\t\tif (prev === null) {\n\t\t\tfirst_batch = next;\n\t\t} else {\n\t\t\tprev.#next = next;\n\t\t}\n\n\t\tif (next === null) {\n\t\t\tlast_batch = prev;\n\t\t} else {\n\t\t\tnext.#prev = prev;\n\t\t}\n\n\t\tthis.linked = false;\n\t}\n}\n\n// TODO Svelte@6 think about removing the callback argument.\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\tflushSync(() => {\n\t\tconst eager = eager_versions;\n\t\teager_versions = [];\n\t\tfor (const version of eager) {\n\t\t\tupdate(version);\n\t\t}\n\t});\n}\n\n/** @type {Map<Reaction, Source<number>>} */\nvar version_map = new Map();\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 initial = true;\n\tvar value = /** @type {T} */ (undefined);\n\n\tif (active_reaction === null) {\n\t\treturn fn();\n\t}\n\n\tlet parent = active_reaction;\n\n\tlet version = version_map.get(parent) ?? source(0);\n\tversion_map.set(parent, version);\n\n\tteardown(() => {\n\t\tif (parent.f & DESTROYING) version_map.delete(parent);\n\t});\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\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 (!batch.linked) {\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 && batch.linked) {\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\tfirst_batch = last_batch = null;\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} from '#client/constants';\nimport * as e from '../errors.js';\nimport { legacy_mode_flag, tracing_mode_flag } from '../../flags/index.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<Effect>} */\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 || !current_sources.has(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 * A set of signals we have already seen while traversing in mark_reactions.\n * Not always set to balance the common case of sources only having a couple\n * of (transitive) dependencies (where always creating a Set would be bad for perf)\n * with the edge case of extremely deep or wide dependency arrays with cycles.\n * @type {Set<any> | null}\n */\nvar seen = null;\n/** Number of transitive dependencies, see {@link seen} for more info */\nvar count_deps = 0;\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\tif (is_destroying_effect) {\n\t\t\told_values.set(source, value);\n\t\t} else if (!old_values.has(source)) {\n\t\t\t// only record the value from before the first write in this flush, otherwise a\n\t\t\t// teardown would see the value from before whichever write happened to be last\n\t\t\told_values.set(source, source.v);\n\t\t}\n\n\t\tvar batch = Batch.ensure();\n\t\tbatch.capture(source, 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\tseen = null;\n\t\tcount_deps = 0;\n\t\tmark_reactions(source, DIRTY, updated_during_traversal);\n\t\tseen = null;\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\tlet dirty;\n\n\t\ttry {\n\t\t\tdirty = is_dirty(effect);\n\t\t} catch {\n\t\t\t// Dirty-checking can evaluate derived dependencies and throw in cases where\n\t\t\t// parent effects are about to destroy this eager effect. Run the effect so\n\t\t\t// its own error handling can deal with transient failures.\n\t\t\tdirty = true;\n\t\t}\n\n\t\tif (dirty) {\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\tcount_deps += length;\n\t// Activate the `seen` Set if we think from the unusually high number of deps that\n\t// there might be cycles in the graph, to avoid repeated lookups for reactions\n\t// Example: https://github.com/sveltejs/svelte/issues/16658 has a graph with one source\n\t// reaching ~10000 distinct deriveds/effects each, resulting in 65 million walks through repeated visits.\n\tif (count_deps > 100000 && seen === null) seen = new Set();\n\n\tif (seen !== null) {\n\t\tif (seen.has(signal)) return;\n\t\tseen.add(signal);\n\t}\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\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 & EAGER_EFFECT) !== 0) {\n\t\t\t// Eager effects need to run immediately:\n\t\t\t// - for $inspect so that the stack trace makes sense\n\t\t\t// - for $state.eager because they might be without an effect parent\n\t\t\teager_effects.add(/** @type {Effect} */ (reaction));\n\t\t} else if ((flags & DERIVED) !== 0) {\n\t\t\tvar derived = /** @type {Derived} */ (reaction);\n\n\t\t\tbatch_values?.delete(derived);\n\t\t\tmark_reactions(derived, MAYBE_DIRTY, updated_during_traversal);\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 { 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 { COMPONENT_SYMBOL, 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, a component instance, or already a proxy, return `value`\n\tif (\n\t\ttypeof value !== 'object' ||\n\t\tvalue === null ||\n\t\tSTATE_SYMBOL in value ||\n\t\tCOMPONENT_SYMBOL in value\n\t) {\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\tthis.has?.(target, prop);\n\n\t\t\tvar descriptor = Reflect.getOwnPropertyDescriptor(target, prop);\n\t\t\tvar s = sources.get(prop);\n\n\t\t\tif (s !== undefined) {\n\t\t\t\tvar value = get(s);\n\n\t\t\t\tif (value === UNINITIALIZED) {\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\n\t\t\t\tif (descriptor && 'value' in descriptor) {\n\t\t\t\t\tdescriptor.value = value;\n\t\t\t\t} else {\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 * as w from '../warnings.js';\nimport { get_proxied_value } from '../proxy.js';\n\nexport function init_array_prototype_warnings() {\n\tconst array_prototype = Array.prototype;\n\t// The REPL ends up here over and over, and this prevents it from adding more and more patches\n\t// of the same kind to the prototype, which would slow down everything over time.\n\t// @ts-expect-error\n\tconst cleanup = Array.__svelte_cleanup;\n\tif (cleanup) {\n\t\tcleanup();\n\t}\n\n\tconst { indexOf, lastIndexOf, includes } = array_prototype;\n\n\tarray_prototype.indexOf = function (item, from_index) {\n\t\tconst index = indexOf.call(this, item, from_index);\n\n\t\tif (index === -1) {\n\t\t\tfor (let i = from_index ?? 0; i < this.length; i += 1) {\n\t\t\t\tif (get_proxied_value(this[i]) === item) {\n\t\t\t\t\tw.state_proxy_equality_mismatch('array.indexOf(...)');\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn index;\n\t};\n\n\tarray_prototype.lastIndexOf = function (item, from_index) {\n\t\t// we need to specify this.length - 1 because it's probably using something like\n\t\t// `arguments` inside so passing undefined is different from not passing anything\n\t\tconst index = lastIndexOf.call(this, item, from_index ?? this.length - 1);\n\n\t\tif (index === -1) {\n\t\t\tfor (let i = 0; i <= (from_index ?? this.length - 1); i += 1) {\n\t\t\t\tif (get_proxied_value(this[i]) === item) {\n\t\t\t\t\tw.state_proxy_equality_mismatch('array.lastIndexOf(...)');\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn index;\n\t};\n\n\tarray_prototype.includes = function (item, from_index) {\n\t\tconst has = includes.call(this, item, from_index);\n\n\t\tif (!has) {\n\t\t\tfor (let i = 0; i < this.length; i += 1) {\n\t\t\t\tif (get_proxied_value(this[i]) === item) {\n\t\t\t\t\tw.state_proxy_equality_mismatch('array.includes(...)');\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn has;\n\t};\n\n\t// @ts-expect-error\n\tArray.__svelte_cleanup = () => {\n\t\tarray_prototype.indexOf = indexOf;\n\t\tarray_prototype.lastIndexOf = lastIndexOf;\n\t\tarray_prototype.includes = includes;\n\t};\n}\n\n/**\n * @param {any} a\n * @param {any} b\n * @param {boolean} equal\n * @returns {boolean}\n */\nexport function strict_equals(a, b, equal = true) {\n\t// try-catch needed because this tries to read properties of `a` and `b`,\n\t// which could be disallowed for example in a secure context\n\ttry {\n\t\tif ((a === b) !== (get_proxied_value(a) === get_proxied_value(b))) {\n\t\t\tw.state_proxy_equality_mismatch(equal ? '===' : '!==');\n\t\t}\n\t} catch {}\n\n\treturn (a === b) === equal;\n}\n\n/**\n * @param {any} a\n * @param {any} b\n * @param {boolean} equal\n * @returns {boolean}\n */\nexport function equals(a, b, equal = true) {\n\tif ((a == b) !== (get_proxied_value(a) == get_proxied_value(b))) {\n\t\tw.state_proxy_equality_mismatch(equal ? '==' : '!=');\n\t}\n\n\treturn (a == b) === equal;\n}\n","/** @import { Effect, TemplateNode } from '#client' */\nimport { hydrate_node, hydrating, reset, 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 {\n\tATTRIBUTES_CACHE,\n\tCLASS_CACHE,\n\tREACTION_RAN,\n\tSTYLE_CACHE,\n\tTEXT_CACHE,\n\tTEXT_NODE\n} 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/** @type {any} */ (element_prototype)[CLASS_CACHE] = undefined;\n\t\t/** @type {any} */ (element_prototype)[ATTRIBUTES_CACHE] = null;\n\t\t/** @type {any} */ (element_prototype)[STYLE_CACHE] = 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/** @type {any} */ (text_prototype)[TEXT_CACHE] = 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 * `child`, for the very common case of an element with exactly one child. Resetting the\n * hydration cursor is part of the same step, so the compiler doesn't have to emit a\n * separate `reset` call for every `<p>{text}</p>` in an app.\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 only_child(node, is_text = false) {\n\tif (!hydrating) {\n\t\treturn get_first_child(node);\n\t}\n\n\tvar first = child(node, is_text);\n\treset(node);\n\n\treturn first;\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 * Branching here is intentional and load-bearing for perf. `createElement(tag)`\n * hits a fast path in Blink that `createElementNS(NAMESPACE_HTML, tag)` doesn't,\n * and passing an explicit `undefined` as the trailing options arg measurably\n * slows both APIs. Funnelling every case through a single `createElementNS(ns,\n * tag, options)` call would be smaller but slower on the HTML path.\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\tif (namespace == null || namespace === NAMESPACE_HTML) {\n\t\treturn /** @type {T extends keyof HTMLElementTagNameMap ? HTMLElementTagNameMap[T] : Element} */ (\n\t\t\tis ? document.createElement(tag, { is }) : document.createElement(tag)\n\t\t);\n\t}\n\treturn /** @type {T extends keyof HTMLElementTagNameMap ? HTMLElementTagNameMap[T] : Element} */ (\n\t\tis ? document.createElementNS(namespace, tag, { is }) : document.createElementNS(namespace, tag)\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 } 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 {\n\tERROR_VALUE,\n\tBOUNDARY_EFFECT,\n\tREACTION_RAN,\n\tEFFECT,\n\tDESTROYED,\n\tDESTROYING\n} 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\tif (effect !== null && (effect.f & DESTROYED) !== 0) {\n\t\treturn;\n\t}\n\n\twhile (effect !== null) {\n\t\t// Skip boundaries that are destroyed/destroying and cannot meaningfully handle the error.\n\t\tif ((effect.f & BOUNDARY_EFFECT) !== 0 && (effect.f & (DESTROYED | DESTROYING)) === 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 { 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\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\tPAUSED\n} from '#client/constants';\nimport { invoke_error_boundary } from '../error-handling.js';\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 } 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 =\n\t\t!active_reaction &&\n\t\t(flags & BRANCH_EFFECT) !== 0 &&\n\t\tcomponent_context !== null &&\n\t\t!component_context.i;\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, () => {\n\t\t\tfn(...values.map(get));\n\t\t});\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\tflatten(blockers, sync, async, (values) => {\n\t\tcreate_effect(EFFECT, () => fn(...values.map(get)));\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} catch (error) {\n\t\t\t// Route teardown errors through the boundary system so that a live\n\t\t\t// ancestor <svelte:boundary> can handle them. Boundaries that are\n\t\t\t// themselves mid-teardown are skipped by invoke_error_boundary.\n\t\t\tinvoke_error_boundary(error, effect.parent);\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\teffect.f |= 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\teffect.f |= PAUSED;\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\n\t\t// If this child is a root effect, then it will become an independent root when its parent\n\t\t// is destroyed, it should therefore not become inert nor partake in transitions.\n\t\tif ((child.f & ROOT_EFFECT) === 0) {\n\t\t\tvar transparent =\n\t\t\t\t(child.f & EFFECT_TRANSPARENT) !== 0 ||\n\t\t\t\t// If this is a branch effect without a block effect parent,\n\t\t\t\t// it means the parent block effect was pruned. In that case,\n\t\t\t\t// transparency information was transferred to the branch effect.\n\t\t\t\t((child.f & BRANCH_EFFECT) !== 0 && (effect.f & BLOCK_EFFECT) !== 0);\n\t\t\t// TODO we don't need to call pause_children recursively with a linked list in place\n\t\t\t// it's slightly more involved though as we have to account for `transparent` changing\n\t\t\t// through the tree.\n\t\t\tpause_children(child, transitions, transparent ? local : false);\n\t\t}\n\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\teffect.f &= ~PAUSED;\n\tresume_children(effect, true);\n}\n\n/**\n * @param {Effect} effect\n * @param {boolean} local\n */\nfunction resume_children(effect, local) {\n\t// this subtree was paused for its own reasons (e.g. a block whose condition\n\t// is still false) — its controller will resume or destroy it\n\tif ((effect.f & PAUSED) !== 0) return;\n\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 { Value } from '#client' */\nimport { internal_set } from './reactivity/sources.js';\nimport { untrack } from './runtime.js';\n\n/**\n * @type {Set<Value> | null}\n * @deprecated\n */\nexport let captured_signals = null;\n\n/**\n * Capture an array of all the signals that are read when `fn` is called\n * @template T\n * @param {() => T} fn\n */\nfunction capture_signals(fn) {\n\tvar previous_captured_signals = captured_signals;\n\n\ttry {\n\t\tcaptured_signals = new Set();\n\n\t\tuntrack(fn);\n\n\t\tif (previous_captured_signals !== null) {\n\t\t\tfor (var signal of captured_signals) {\n\t\t\t\tprevious_captured_signals.add(signal);\n\t\t\t}\n\t\t}\n\n\t\treturn captured_signals;\n\t} finally {\n\t\tcaptured_signals = previous_captured_signals;\n\t}\n}\n\n/**\n * Invokes a function and captures all signals that are read during the invocation,\n * then invalidates them.\n * @param {() => any} fn\n * @deprecated\n */\nexport function invalidate_inner_signals(fn) {\n\tfor (var signal of capture_signals(fn)) {\n\t\tinternal_set(signal, signal.v);\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\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\tprevious_batch,\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\n/**\n * True if updating in an effect context that is reactive (i.e. not branch/root effects)\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 | Set<Source>}\n */\nexport let current_sources = null;\n\n/** @param {Value} value */\nexport function push_reaction_value(value) {\n\tif (\n\t\tactive_reaction !== null &&\n\t\t((!async_mode_flag && (active_reaction.f & REACTION_IS_UPDATING) !== 0) ||\n\t\t\t(active_reaction.f & DERIVED) !== 0)\n\t) {\n\t\t(current_sources ??= new Set()).add(value);\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 */\nexport let new_deps = null;\n\nexport let 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 dependencies 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 & 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 && current_sources.has(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 = update_dependencies(reaction);\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 (var 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\t// still commit the deps read before the throw, otherwise deriveds connected by this run keep no reader and the reaction never re-runs when they change\n\t\tupdate_dependencies(reaction);\n\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 * @param {Reaction} reaction\n */\nfunction update_dependencies(reaction) {\n\tvar deps = reaction.deps;\n\n\t// Don't remove reactions during fork;\n\t// they must remain for when fork is discarded\n\tvar is_fork = current_batch?.is_fork;\n\n\tif (new_deps !== null) {\n\t\tvar i;\n\n\t\tif (!is_fork) {\n\t\t\tremove_reactions(reaction, skipped_deps);\n\t\t}\n\n\t\tif (deps !== null && skipped_deps > 0) {\n\t\t\tdeps.length = skipped_deps + new_deps.length;\n\t\t\tfor (i = 0; i < new_deps.length; i++) {\n\t\t\t\tdeps[skipped_deps + i] = new_deps[i];\n\t\t\t}\n\t\t} else {\n\t\t\treaction.deps = deps = new_deps;\n\t\t}\n\n\t\tif (effect_tracking() && (reaction.f & CONNECTED) !== 0) {\n\t\t\tfor (i = skipped_deps; i < deps.length; i++) {\n\t\t\t\t(deps[i].reactions ??= []).push(reaction);\n\t\t\t}\n\t\t}\n\t} else if (!is_fork && deps !== null && skipped_deps < deps.length) {\n\t\tremove_reactions(reaction, skipped_deps);\n\t\tdeps.length = skipped_deps;\n\t}\n\n\treturn deps;\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\tif ((derived.f & CONNECTED) !== 0) {\n\t\t\tderived.f ^= CONNECTED;\n\t\t}\n\n\t\t// In a fork it's possible that a derived is executed and gets reactions, then commits, but is\n\t\t// never re-executed. This is possible when the derived is only executed once in the context\n\t\t// of a new branch which happens before fork.commit() runs. In this case, the derived still has\n\t\t// UNINITIALIZED as its value, and then when it's loosing its reactions we need to ensure it stays\n\t\t// DIRTY so it is reexecuted once someone wants its value again.\n\t\tif (derived.v !== UNINITIALIZED) {\n\t\t\tupdate_derived_status(derived);\n\t\t}\n\n\t\t// Call abort controller, noone's listening to this derived anymore\n\t\tif (derived.ac !== null) {\n\t\t\twithout_reactive_context(() => {\n\t\t\t\t/** @type {AbortController} */ (derived.ac).abort(STALE_REACTION);\n\t\t\t\tderived.ac = null;\n\t\t\t\t// ensure it reruns right away next time instead of potentially returning a rejected promise as its value\n\t\t\t\tset_signal_status(derived, DIRTY);\n\t\t\t});\n\t\t}\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 = (flags & (BRANCH_EFFECT | ROOT_EFFECT)) === 0; // Branch/root effects are not reactive contexts\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 || !current_sources.has(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 (i.e. after an `await`).\n\t\t\t\t// We have to deduplicate deps/reactions in this case or remove_reactions could\n\t\t\t\t// disconnect deps/reactions that are actually still in use (if skip_deps says\n\t\t\t\t// \"disconnect all after this index\" and some of the signals are also present in\n\t\t\t\t// list prior to the cutoff index, i.e. that should be kept).\n\t\t\t\tactive_reaction.deps ??= [];\n\t\t\t\tif (!includes.call(active_reaction.deps, signal)) {\n\t\t\t\t\tactive_reaction.deps.push(signal);\n\t\t\t\t}\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// By checking that current/previous batch are null we filter out false positives.\n\t\t\t// reactivity_loss_tracker is only reset after a microtask, so if a flush happens\n\t\t\t// before that, we get warnings for things we shouldn't warn on.\n\t\t\tcurrent_batch === null &&\n\t\t\tprevious_batch === null &&\n\t\t\t!reactivity_loss_tracker.warned &&\n\t\t\t(reactivity_loss_tracker.effect.f & REACTION_IS_UPDATING) === 0 &&\n\t\t\t!reactivity_loss_tracker.effect_deps.has(signal)\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","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\nexport const 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 { 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\ttarget_handler.__removed = false;\n\t\tqueue_micro_task(() => {\n\t\t\tif (!target_handler.__removed) {\n\t\t\t\tdom.addEventListener(event_name, target_handler, options);\n\t\t\t}\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\ttarget_handler.__removed = true;\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\ttarget_handler.__removed = true;\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 (<= 141)\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// whether a task is already queued to clear `last_propagated_event`\nlet last_propagated_event_clear_scheduled = false;\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// The reference is only needed while the event can still reach another\n\t// delegated root, i.e. during the current (synchronous) dispatch and its\n\t// microtask checkpoints. Clearing it in a later task preserves the\n\t// Firefox workaround while making sure the slot doesn't retain the last\n\t// event forever — through `event.target` it would otherwise keep the\n\t// entire detached subtree of whatever the user last clicked in alive\n\t// until the next delegated event happens to arrive.\n\tif (!last_propagated_event_clear_scheduled) {\n\t\tlast_propagated_event_clear_scheduled = true;\n\t\tsetTimeout(() => {\n\t\t\tlast_propagated_event_clear_scheduled = false;\n\t\t\tlast_propagated_event = null;\n\t\t});\n\t}\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 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 events 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\tif (current_target === handler_element) break;\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) break;\n\n\t\t\tpath_idx++;\n\t\t\tcurrent_target = path_idx < path.length ? /** @type {Element} */ (path[path_idx]) : null;\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","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","/** @import { Effect, Source, TemplateNode, } from '#client' */\nimport { BOUNDARY_EFFECT, EFFECT_PRESERVED, EFFECT_TRANSPARENT } from '#client/constants';\nimport { HYDRATION_START_ELSE, HYDRATION_START_FAILED } from '../../../../constants.js';\nimport { component_context, set_component_context } from '../../context.js';\nimport { 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 } 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';\n\n/**\n * @typedef {{\n * \t onerror?: ((error: unknown, reset: () => void) => void) | null;\n * failed?: ((anchor: Node, error: () => unknown, reset: () => () => void) => void) | null;\n * pending?: ((anchor: Node) => void) | null;\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\tconst { reset, invoke_onerror } = this.#create_reset(error);\n\n\t\t// `onerror` may mutate state, which is disallowed while hydrating\n\t\tqueue_micro_task(invoke_onerror);\n\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() => reset\n\t\t\t);\n\t\t});\n\t}\n\n\t/**\n\t * Creates the `reset` function for a failed boundary, along with a function\n\t * that invokes `onerror` with it (if provided)\n\t * @param {unknown} error\n\t * @returns {{ reset: () => void, invoke_onerror: () => void }}\n\t */\n\t#create_reset(error) {\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\tconst invoke_onerror = () => {\n\t\t\ttry {\n\t\t\t\tcalling_on_error = true;\n\t\t\t\tthis.#props.onerror?.(error, reset);\n\t\t\t\tcalling_on_error = false;\n\t\t\t} catch (err) {\n\t\t\t\tinvoke_error_boundary(err, this.#effect && this.#effect.parent);\n\t\t\t}\n\t\t};\n\n\t\treturn { reset, invoke_onerror };\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\t\t\tvar handled = false;\n\n\t\t\tfragment.append(anchor);\n\n\t\t\tthis.#main_effect = this.#run(() => {\n\t\t\t\ttry {\n\t\t\t\t\treturn branch(() => this.#children(anchor));\n\t\t\t\t} catch (error) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tthis.error(error);\n\t\t\t\t\t\thandled = true;\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tinvoke_error_boundary(error, this.#effect.parent);\n\t\t\t\t\t}\n\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tif (this.#main_effect === null) {\n\t\t\t\tthis.#offscreen_fragment = null;\n\t\t\t\tif (handled) this.#resolve(/** @type {Batch} */ (current_batch));\n\t\t\t\treturn;\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} 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\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 (!this.#props.onerror && !this.#props.failed) {\n\t\t\tthrow error;\n\t\t}\n\n\t\tif (current_batch?.is_fork) {\n\t\t\tif (this.#main_effect) current_batch.skip_effect(this.#main_effect);\n\t\t\tif (this.#pending_effect) current_batch.skip_effect(this.#pending_effect);\n\t\t\tif (this.#failed_effect) current_batch.skip_effect(this.#failed_effect);\n\n\t\t\tcurrent_batch.oncommit(() => {\n\t\t\t\tthis.#handle_error(error);\n\t\t\t});\n\t\t} else {\n\t\t\tthis.#handle_error(error);\n\t\t}\n\t}\n\n\t/**\n\t * @param {unknown} error\n\t */\n\t#handle_error(error) {\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\tlet failed = this.#props.failed;\n\n\t\t/** @param {unknown} transformed_error */\n\t\tconst handle_error_result = (transformed_error) => {\n\t\t\tconst { reset, invoke_onerror } = this.#create_reset(transformed_error);\n\n\t\t\tinvoke_onerror();\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 { 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, mark_as_component } 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, TEXT_CACHE } 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// prettier-ignore\n\tif (str !== (/** @type {any} */ (text)[TEXT_CACHE] ??= text.nodeValue)) {\n\t\t/** @type {any} */ (text)[TEXT_CACHE] = 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) || mark_as_component();\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\tw.lifecycle_double_unmount();\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 { HMR_ANCHOR } from '../../constants.js';\nimport { hydrate_node, hydrating } from '../hydration.js';\nimport { create_text, should_defer_append } from '../operations.js';\nimport { DEV } from 'esm-env';\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\t// effect could have been outro'ed before through a prior batch — resume if necessary\n\t\t\t\tresume_effect(offscreen.effect);\n\t\t\t\tthis.#onscreen.set(key, offscreen.effect);\n\t\t\t\tthis.#offscreen.delete(key);\n\n\t\t\t\tif (DEV) {\n\t\t\t\t\t// Tell hmr.js about the anchor it should use for updates,\n\t\t\t\t\t// since the initial one will be removed\n\t\t\t\t\t/** @type {any} */ (offscreen.fragment.lastChild)[HMR_ANCHOR] = this.anchor;\n\t\t\t\t}\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 { 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 { 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';\nimport { tag } from '../../dev/tracing.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\t// Skip the fast path when another batch is still pending on this each block:\n\t\t// that batch's keys still reference EachItems in `state.items`, which\n\t\t// `destroy_effects` needs to preserve offscreen (see #18610).\n\t\tvar fast_path =\n\t\t\ttransitions.length === 0 && controlled_anchor !== null && state.pending.size === 0;\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 /** @type {V[]} */ (\n\t\t\tis_array(collection) ? collection : collection == null ? [] : array_from(collection)\n\t\t);\n\t});\n\n\tif (DEV) {\n\t\ttag(each_array, '{#each ...}');\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 { 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","/** @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 { AnimateFn, Animation, AnimationConfig, EachItem, Effect, EffectNodes, TransitionFn, TransitionManager } from '#client' */\nimport { noop, is_function } from '../../../shared/utils.js';\nimport { effect } from '../../reactivity/effects.js';\nimport { active_effect, untrack } from '../../runtime.js';\nimport { loop } from '../../loop.js';\nimport { should_intro } from '../../render.js';\nimport { TRANSITION_GLOBAL, TRANSITION_IN, TRANSITION_OUT } from '../../../../constants.js';\nimport { BLOCK_EFFECT, REACTION_RAN, EFFECT_TRANSPARENT } from '#client/constants';\nimport { queue_micro_task } from '../task.js';\nimport { without_reactive_context } from './bindings/shared.js';\n\n/**\n * @param {Element} element\n * @param {'introstart' | 'introend' | 'outrostart' | 'outroend'} type\n * @returns {void}\n */\nfunction dispatch_event(element, type) {\n\twithout_reactive_context(() => {\n\t\telement.dispatchEvent(new CustomEvent(type));\n\t});\n}\n\n/**\n * Converts a property to the camel-case format expected by Element.animate(), KeyframeEffect(), and KeyframeEffect.setKeyframes().\n * @param {string} style\n * @returns {string}\n */\nfunction css_property_to_camelcase(style) {\n\t// in compliance with spec\n\tif (style === 'float') return 'cssFloat';\n\tif (style === 'offset') return 'cssOffset';\n\n\t// do not rename custom @properties\n\tif (style.startsWith('--')) return style;\n\n\tconst parts = style.split('-');\n\tif (parts.length === 1) return parts[0];\n\treturn (\n\t\tparts[0] +\n\t\tparts\n\t\t\t.slice(1)\n\t\t\t.map(/** @param {any} word */ (word) => word[0].toUpperCase() + word.slice(1))\n\t\t\t.join('')\n\t);\n}\n\n/**\n * @param {string} css\n * @returns {Keyframe}\n */\nfunction css_to_keyframe(css) {\n\t/** @type {Keyframe} */\n\tconst keyframe = {};\n\tconst parts = css.split(';');\n\tfor (const part of parts) {\n\t\tconst [property, value] = part.split(':');\n\t\tif (!property || value === undefined) break;\n\n\t\tconst formatted_property = css_property_to_camelcase(property.trim());\n\t\tkeyframe[formatted_property] = value.trim();\n\t}\n\treturn keyframe;\n}\n\n/** @param {number} t */\nconst linear = (t) => t;\n\n/** @type {Effect | null} */\nlet animation_effect_override = null;\n\n/** @param {Effect | null} v */\nexport function set_animation_effect_override(v) {\n\tanimation_effect_override = v;\n}\n\n/**\n * Called inside keyed `{#each ...}` blocks (as `$.animation(...)`). This creates an animation manager\n * and attaches it to the block, so that moves can be animated following reconciliation.\n * @template P\n * @param {Element} element\n * @param {() => AnimateFn<P | undefined>} get_fn\n * @param {(() => P) | null} get_params\n */\nexport function animation(element, get_fn, get_params) {\n\tvar effect = animation_effect_override ?? /** @type {Effect} */ (active_effect);\n\tvar nodes = /** @type {EffectNodes} */ (effect.nodes);\n\n\t/** @type {DOMRect} */\n\tvar from;\n\n\t/** @type {DOMRect} */\n\tvar to;\n\n\t/** @type {Animation | undefined} */\n\tvar animation;\n\n\t/** @type {null | { position: string, width: string, height: string, transform: string }} */\n\tvar original_styles = null;\n\n\tnodes.a ??= {\n\t\telement,\n\t\tmeasure() {\n\t\t\tfrom = this.element.getBoundingClientRect();\n\t\t},\n\t\tapply() {\n\t\t\tanimation?.abort();\n\n\t\t\tto = this.element.getBoundingClientRect();\n\n\t\t\tif (\n\t\t\t\tfrom.left !== to.left ||\n\t\t\t\tfrom.right !== to.right ||\n\t\t\t\tfrom.top !== to.top ||\n\t\t\t\tfrom.bottom !== to.bottom\n\t\t\t) {\n\t\t\t\tconst options = get_fn()(this.element, { from, to }, get_params?.());\n\n\t\t\t\tanimation = animate(\n\t\t\t\t\tthis.element,\n\t\t\t\t\toptions,\n\t\t\t\t\tundefined,\n\t\t\t\t\t1,\n\t\t\t\t\t() => {},\n\t\t\t\t\t() => {\n\t\t\t\t\t\tanimation?.abort();\n\t\t\t\t\t\tanimation = undefined;\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t\tfix() {\n\t\t\t// If an animation is already running, transforming the element is likely to fail,\n\t\t\t// because the styles applied by the animation take precedence. In the case of crossfade,\n\t\t\t// that means the `translate(...)` of the crossfade transition overrules the `translate(...)`\n\t\t\t// we would apply below, leading to the element jumping somewhere to the top left.\n\t\t\tif (element.getAnimations().length) return;\n\n\t\t\t// It's important to destructure these to get fixed values - the object itself has getters,\n\t\t\t// and changing the style to 'absolute' can for example influence the width.\n\t\t\tvar { position, width, height } = getComputedStyle(element);\n\n\t\t\tif (position !== 'absolute' && position !== 'fixed') {\n\t\t\t\tvar style = /** @type {HTMLElement | SVGElement} */ (element).style;\n\n\t\t\t\toriginal_styles = {\n\t\t\t\t\tposition: style.position,\n\t\t\t\t\twidth: style.width,\n\t\t\t\t\theight: style.height,\n\t\t\t\t\ttransform: style.transform\n\t\t\t\t};\n\n\t\t\t\tstyle.position = 'absolute';\n\t\t\t\tstyle.width = width;\n\t\t\t\tstyle.height = height;\n\t\t\t\tvar to = element.getBoundingClientRect();\n\n\t\t\t\tif (from.left !== to.left || from.top !== to.top) {\n\t\t\t\t\tvar transform = `translate(${from.left - to.left}px, ${from.top - to.top}px)`;\n\t\t\t\t\tstyle.transform = style.transform ? `${style.transform} ${transform}` : transform;\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\tunfix() {\n\t\t\tif (original_styles) {\n\t\t\t\tvar style = /** @type {HTMLElement | SVGElement} */ (element).style;\n\n\t\t\t\tstyle.position = original_styles.position;\n\t\t\t\tstyle.width = original_styles.width;\n\t\t\t\tstyle.height = original_styles.height;\n\t\t\t\tstyle.transform = original_styles.transform;\n\t\t\t}\n\t\t}\n\t};\n\n\t// in the case of a `<svelte:element>`, it's possible for `$.animation(...)` to be called\n\t// when an animation manager already exists, if the tag changes. in that case, we need to\n\t// swap out the element rather than creating a new manager, in case it happened at the same\n\t// moment as a reconciliation\n\tnodes.a.element = element;\n}\n\n/**\n * Called inside block effects as `$.transition(...)`. This creates a transition manager and\n * attaches it to the current effect — later, inside `pause_effect` and `resume_effect`, we\n * use this to create `intro` and `outro` transitions.\n * @template P\n * @param {number} flags\n * @param {HTMLElement} element\n * @param {() => TransitionFn<P | undefined>} get_fn\n * @param {(() => P) | null} get_params\n * @returns {void}\n */\nexport function transition(flags, element, get_fn, get_params) {\n\tvar is_intro = (flags & TRANSITION_IN) !== 0;\n\tvar is_outro = (flags & TRANSITION_OUT) !== 0;\n\tvar is_both = is_intro && is_outro;\n\tvar is_global = (flags & TRANSITION_GLOBAL) !== 0;\n\n\t/** @type {'in' | 'out' | 'both'} */\n\tvar direction = is_both ? 'both' : is_intro ? 'in' : 'out';\n\n\t/** @type {AnimationConfig | ((opts: { direction: 'in' | 'out' }) => AnimationConfig) | undefined} */\n\tvar current_options;\n\n\tvar inert = element.inert;\n\n\t/**\n\t * The default overflow style, stashed so we can revert changes during the transition\n\t * that are necessary to work around a Safari <18 bug\n\t * TODO 6.0 remove this, if older versions of Safari have died out enough\n\t */\n\tvar overflow = element.style.overflow;\n\n\t/** @type {Animation | undefined} */\n\tvar intro;\n\n\t/** @type {Animation | undefined} */\n\tvar outro;\n\n\tfunction get_options() {\n\t\treturn without_reactive_context(() => {\n\t\t\t// If a transition is still ongoing, we use the existing options rather than generating\n\t\t\t// new ones. This ensures that reversible transitions reverse smoothly, rather than\n\t\t\t// jumping to a new spot because (for example) a different `duration` was used\n\t\t\treturn (current_options ??= get_fn()(element, get_params?.() ?? /** @type {P} */ ({}), {\n\t\t\t\tdirection\n\t\t\t}));\n\t\t});\n\t}\n\n\t/** @type {TransitionManager} */\n\tvar transition = {\n\t\tis_global,\n\t\tin() {\n\t\t\telement.inert = inert;\n\n\t\t\tif (!is_intro) {\n\t\t\t\toutro?.abort();\n\t\t\t\toutro?.reset?.();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (!is_outro) {\n\t\t\t\t// if we intro then outro then intro again, we want to abort the first intro,\n\t\t\t\t// if it's not a bidirectional transition\n\t\t\t\tintro?.abort();\n\t\t\t}\n\n\t\t\tintro = animate(\n\t\t\t\telement,\n\t\t\t\tget_options(),\n\t\t\t\toutro,\n\t\t\t\t1,\n\t\t\t\t() => {\n\t\t\t\t\tdispatch_event(element, 'introstart');\n\t\t\t\t},\n\t\t\t\t() => {\n\t\t\t\t\tdispatch_event(element, 'introend');\n\n\t\t\t\t\t// Ensure we cancel the animation to prevent leaking\n\t\t\t\t\tintro?.abort();\n\t\t\t\t\tintro = current_options = undefined;\n\n\t\t\t\t\telement.style.overflow = overflow;\n\t\t\t\t}\n\t\t\t);\n\t\t},\n\t\tout(fn) {\n\t\t\tif (!is_outro) {\n\t\t\t\tfn?.();\n\t\t\t\tcurrent_options = undefined;\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\telement.inert = true;\n\n\t\t\toutro = animate(\n\t\t\t\telement,\n\t\t\t\tget_options(),\n\t\t\t\tintro,\n\t\t\t\t0,\n\t\t\t\t() => {\n\t\t\t\t\tdispatch_event(element, 'outrostart');\n\t\t\t\t},\n\t\t\t\t() => {\n\t\t\t\t\tdispatch_event(element, 'outroend');\n\t\t\t\t\tfn?.();\n\t\t\t\t}\n\t\t\t);\n\t\t},\n\t\tstop: () => {\n\t\t\tintro?.abort();\n\t\t\toutro?.abort();\n\t\t}\n\t};\n\n\tvar e = /** @type {Effect & { nodes: EffectNodes }} */ (active_effect);\n\n\t(e.nodes.t ??= []).push(transition);\n\n\t// if this is a local transition, we only want to run it if the parent (branch) effect's\n\t// parent (block) effect is where the state change happened. we can determine that by\n\t// looking at whether the block effect is currently initializing\n\tif (is_intro && should_intro) {\n\t\tvar run = is_global;\n\n\t\tif (!run) {\n\t\t\tvar block = /** @type {Effect | null} */ (e.parent);\n\n\t\t\t// skip over transparent blocks (e.g. snippets, else-if blocks)\n\t\t\twhile (block && (block.f & EFFECT_TRANSPARENT) !== 0) {\n\t\t\t\twhile ((block = block.parent)) {\n\t\t\t\t\tif ((block.f & BLOCK_EFFECT) !== 0) break;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\trun = !block || (block.f & REACTION_RAN) !== 0;\n\t\t}\n\n\t\tif (run) {\n\t\t\teffect(() => {\n\t\t\t\tuntrack(() => transition.in());\n\t\t\t});\n\t\t}\n\t}\n}\n\n/**\n * Animates an element, according to the provided configuration\n * @param {Element} element\n * @param {AnimationConfig | ((opts: { direction: 'in' | 'out' }) => AnimationConfig)} options\n * @param {Animation | undefined} counterpart The corresponding intro/outro to this outro/intro\n * @param {number} t2 The target `t` value — `1` for intro, `0` for outro\n * @param {(() => void)} on_begin Called just before beginning the animation\n * @param {(() => void)} on_finish Called after successfully completing the animation\n * @returns {Animation}\n */\nfunction animate(element, options, counterpart, t2, on_begin, on_finish) {\n\tvar is_intro = t2 === 1;\n\tvar aborted = false;\n\n\tif (is_function(options)) {\n\t\t// In the case of a deferred transition (such as `crossfade`), `option` will be\n\t\t// a function rather than an `AnimationConfig`. We need to call this function\n\t\t// once the DOM has been updated...\n\t\t/** @type {Animation} */\n\t\tvar a;\n\n\t\tqueue_micro_task(() => {\n\t\t\tif (aborted) return;\n\t\t\tvar o = options({ direction: is_intro ? 'in' : 'out' });\n\t\t\ta = animate(element, o, counterpart, t2, on_begin, on_finish);\n\t\t});\n\n\t\t// ...but we want to do so without using `async`/`await` everywhere, so\n\t\t// we return a facade that allows everything to remain synchronous\n\t\treturn {\n\t\t\tabort: () => {\n\t\t\t\taborted = true;\n\t\t\t\ta?.abort();\n\t\t\t},\n\t\t\tdeactivate: () => a.deactivate(),\n\t\t\treset: () => a.reset(),\n\t\t\tt: () => a.t()\n\t\t};\n\t}\n\n\tcounterpart?.deactivate();\n\n\tif (!options?.duration && !options?.delay) {\n\t\ton_begin();\n\t\ton_finish();\n\n\t\treturn {\n\t\t\tabort: noop,\n\t\t\tdeactivate: noop,\n\t\t\treset: noop,\n\t\t\tt: () => t2\n\t\t};\n\t}\n\n\tconst { delay = 0, css, tick, easing = linear } = options;\n\n\t/** @type {globalThis.Animation} */\n\tvar animation;\n\n\tvar get_t = () => 1 - t2;\n\n\t// wait a microtask before applying the initial styles and creating the dummy animation,\n\t// so that transitions created in the same batch (e.g. on nested elements) all measure\n\t// the DOM first (#18421). this still happens before the next paint, so the element\n\t// won't be rendered without styles applied (#14732)\n\tqueue_micro_task(() => {\n\t\tif (aborted) return;\n\n\t\tvar keyframes = [];\n\n\t\tif (is_intro && counterpart === undefined) {\n\t\t\tif (tick) {\n\t\t\t\ttick(0, 1); // TODO put in nested effect, to avoid interleaved reads/writes?\n\t\t\t}\n\n\t\t\tif (css) {\n\t\t\t\tvar styles = css_to_keyframe(css(0, 1));\n\t\t\t\tkeyframes.push(styles, styles);\n\t\t\t}\n\t\t}\n\n\t\t// create a dummy animation that lasts as long as the delay (but with whatever devtools\n\t\t// multiplier is in effect). in the common case that it is `0`, we keep it anyway so that\n\t\t// the CSS keyframes aren't created until the DOM is updated\n\t\t//\n\t\t// fill forwards to prevent the element from rendering without styles applied\n\t\t// see https://github.com/sveltejs/svelte/issues/14732\n\t\tanimation = element.animate(keyframes, { duration: delay, fill: 'forwards' });\n\n\t\tanimation.onfinish = () => {\n\t\t\t// remove dummy animation from the stack to prevent conflict with main animation\n\t\t\tanimation.cancel();\n\n\t\t\ton_begin();\n\n\t\t\t// for bidirectional transitions, we start from the current position,\n\t\t\t// rather than doing a full intro/outro\n\t\t\tvar t1 = counterpart?.t() ?? 1 - t2;\n\t\t\tcounterpart?.abort();\n\n\t\t\tvar delta = t2 - t1;\n\t\t\tvar duration = /** @type {number} */ (options.duration) * Math.abs(delta);\n\t\t\tvar keyframes = [];\n\n\t\t\tif (duration > 0) {\n\t\t\t\t/**\n\t\t\t\t * Whether or not the CSS includes `overflow: hidden`, in which case we need to\n\t\t\t\t * add it as an inline style to work around a Safari <18 bug\n\t\t\t\t * TODO 6.0 remove this, if possible\n\t\t\t\t */\n\t\t\t\tvar needs_overflow_hidden = false;\n\n\t\t\t\tif (css) {\n\t\t\t\t\tvar n = Math.ceil(duration / (1000 / 60)); // `n` must be an integer, or we risk missing the `t2` value\n\n\t\t\t\t\tfor (var i = 0; i <= n; i += 1) {\n\t\t\t\t\t\tvar t = t1 + delta * easing(i / n);\n\t\t\t\t\t\tvar styles = css_to_keyframe(css(t, 1 - t));\n\t\t\t\t\t\tkeyframes.push(styles);\n\n\t\t\t\t\t\tneeds_overflow_hidden ||= styles.overflow === 'hidden';\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (needs_overflow_hidden) {\n\t\t\t\t\t/** @type {HTMLElement} */ (element).style.overflow = 'hidden';\n\t\t\t\t}\n\n\t\t\t\tget_t = () => {\n\t\t\t\t\tvar time = /** @type {number} */ (\n\t\t\t\t\t\t/** @type {globalThis.Animation} */ (animation).currentTime\n\t\t\t\t\t);\n\n\t\t\t\t\treturn t1 + delta * easing(time / duration);\n\t\t\t\t};\n\n\t\t\t\tif (tick) {\n\t\t\t\t\tloop(() => {\n\t\t\t\t\t\tif (animation.playState !== 'running') return false;\n\n\t\t\t\t\t\tvar t = get_t();\n\t\t\t\t\t\ttick(t, 1 - t);\n\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tanimation = element.animate(keyframes, { duration, fill: 'forwards' });\n\n\t\t\tanimation.onfinish = () => {\n\t\t\t\tget_t = () => t2;\n\t\t\t\ttick?.(t2, 1 - t2);\n\t\t\t\ton_finish();\n\t\t\t};\n\t\t};\n\t});\n\n\treturn {\n\t\tabort: () => {\n\t\t\taborted = true;\n\n\t\t\tif (animation) {\n\t\t\t\tanimation.cancel();\n\t\t\t\t// This prevents memory leaks in Chromium\n\t\t\t\tanimation.effect = null;\n\t\t\t\t// This prevents onfinish to be launched after cancel(),\n\t\t\t\t// which can happen in some rare cases\n\t\t\t\t// see https://github.com/sveltejs/svelte/issues/13681\n\t\t\t\tanimation.onfinish = noop;\n\t\t\t}\n\t\t},\n\t\tdeactivate: () => {\n\t\t\ton_finish = noop;\n\t\t},\n\t\treset: () => {\n\t\t\tif (t2 === 0) {\n\t\t\t\ttick?.(1, 0);\n\t\t\t}\n\t\t},\n\t\tt: () => get_t()\n\t};\n}\n","/** @import { Effect, EffectNodes, TemplateNode } from '#client' */\nimport { FILENAME, NAMESPACE_SVG } from '../../../../constants.js';\nimport {\n\thydrate_next,\n\thydrate_node,\n\thydrating,\n\tset_hydrate_node,\n\tset_hydrating\n} from '../hydration.js';\nimport { create_element, create_text, get_first_child } from '../operations.js';\nimport { block, teardown } from '../../reactivity/effects.js';\nimport { set_should_intro } from '../../render.js';\nimport { active_effect } from '../../runtime.js';\nimport { component_context, dev_stack } from '../../context.js';\nimport { DEV } from 'esm-env';\nimport { EFFECT_TRANSPARENT, ELEMENT_NODE } from '#client/constants';\nimport { assign_nodes } from '../template.js';\nimport { is_raw_text_element } from '../../../../utils.js';\nimport { BranchManager } from './branches.js';\nimport { set_animation_effect_override } from '../elements/transitions.js';\n\n/**\n * @param {Comment | Element} node\n * @param {() => string} get_tag\n * @param {boolean} is_svg\n * @param {undefined | ((element: Element, anchor: Node | null) => void)} render_fn,\n * @param {undefined | (() => string)} get_namespace\n * @param {undefined | [number, number]} location\n * @returns {void}\n */\nexport function element(node, get_tag, is_svg, render_fn, get_namespace, location) {\n\tlet was_hydrating = hydrating;\n\n\tif (hydrating) {\n\t\thydrate_next();\n\t}\n\n\tvar filename = DEV && location && component_context?.function[FILENAME];\n\n\t/** @type {null | Element} */\n\tvar element = null;\n\n\tif (hydrating && hydrate_node.nodeType === ELEMENT_NODE) {\n\t\telement = /** @type {Element} */ (hydrate_node);\n\t\thydrate_next();\n\t}\n\n\tvar anchor = /** @type {TemplateNode} */ (hydrating ? hydrate_node : node);\n\n\t/**\n\t * We track this so we can set it when changing the element, allowing any\n\t * `animate:` directive to bind itself to the correct block\n\t */\n\tvar parent_effect = /** @type {Effect} */ (active_effect);\n\n\tvar branches = new BranchManager(anchor, false);\n\n\tblock(() => {\n\t\tconst next_tag = get_tag() || null;\n\t\tvar ns = get_namespace\n\t\t\t? get_namespace()\n\t\t\t: is_svg || next_tag === 'svg'\n\t\t\t\t? NAMESPACE_SVG\n\t\t\t\t: undefined;\n\n\t\tif (next_tag === null) {\n\t\t\tbranches.ensure(null, null);\n\t\t\tset_should_intro(true);\n\t\t\treturn;\n\t\t}\n\n\t\tbranches.ensure(next_tag, (anchor) => {\n\t\t\tif (next_tag) {\n\t\t\t\telement = hydrating ? /** @type {Element} */ (element) : create_element(next_tag, ns);\n\n\t\t\t\tif (DEV && location) {\n\t\t\t\t\t// @ts-expect-error\n\t\t\t\t\telement.__svelte_meta = {\n\t\t\t\t\t\tparent: dev_stack,\n\t\t\t\t\t\tloc: {\n\t\t\t\t\t\t\tfile: filename,\n\t\t\t\t\t\t\tline: location[0],\n\t\t\t\t\t\t\tcolumn: location[1]\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tassign_nodes(element, element);\n\n\t\t\t\tif (render_fn) {\n\t\t\t\t\tvar tmp_comment = null;\n\n\t\t\t\t\tif (hydrating && is_raw_text_element(next_tag)) {\n\t\t\t\t\t\t// prevent hydration glitches (code just below expects an anchor)\n\t\t\t\t\t\telement.append((tmp_comment = document.createComment('')));\n\t\t\t\t\t}\n\n\t\t\t\t\t// If hydrating, use the existing ssr comment as the anchor so that the\n\t\t\t\t\t// inner open and close methods can pick up the existing nodes correctly\n\t\t\t\t\tvar child_anchor = hydrating\n\t\t\t\t\t\t? get_first_child(element)\n\t\t\t\t\t\t: element.appendChild(create_text());\n\n\t\t\t\t\tif (hydrating) {\n\t\t\t\t\t\tif (child_anchor === null) {\n\t\t\t\t\t\t\tset_hydrating(false);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tset_hydrate_node(child_anchor);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tset_animation_effect_override(parent_effect);\n\n\t\t\t\t\t// `child_anchor` is undefined if this is a void element, but we still\n\t\t\t\t\t// need to call `render_fn` in order to run actions etc. If the element\n\t\t\t\t\t// contains children, it's a user error (which is warned on elsewhere)\n\t\t\t\t\t// and the DOM will be silently discarded\n\t\t\t\t\trender_fn(element, child_anchor);\n\t\t\t\t\ttmp_comment?.remove();\n\t\t\t\t\tset_animation_effect_override(null);\n\t\t\t\t}\n\n\t\t\t\t// we do this after calling `render_fn` so that child effects don't override `nodes.end`\n\t\t\t\t/** @type {Effect & { nodes: EffectNodes }} */ (active_effect).nodes.end = element;\n\n\t\t\t\tanchor.before(element);\n\t\t\t}\n\n\t\t\tif (hydrating) {\n\t\t\t\tset_hydrate_node(anchor);\n\t\t\t}\n\t\t});\n\n\t\t// revert to the default state after the effect has been created\n\t\tset_should_intro(true);\n\n\t\treturn () => {\n\t\t\tif (next_tag) {\n\t\t\t\t// if we're in this callback because we're re-running the effect,\n\t\t\t\t// disable intros (unless no element is currently displayed)\n\t\t\t\tset_should_intro(false);\n\t\t\t}\n\t\t};\n\t}, EFFECT_TRANSPARENT);\n\n\tteardown(() => {\n\t\tset_should_intro(true);\n\t});\n\n\tif (was_hydrating) {\n\t\tset_hydrating(true);\n\t\tset_hydrate_node(anchor);\n\t}\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\t// `''` is a present boolean attribute, as it is in markup and on the client\n\tif (value == null || (is_boolean && !value && value !== '')) 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\t// strip comments; surrounding whitespace is handled by the trims below (which is much faster than doing it through regex)\n\t\t\tvalue = String(value)\n\t\t\t\t.replaceAll(/\\/\\*.*?\\*\\//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 { CLASS_CACHE } from '../../constants.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\tvar prev = /** @type {any} */ (dom)[CLASS_CACHE];\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/** @type {any} */ (dom)[CLASS_CACHE] = 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 { STYLE_CACHE } from '../../constants.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\tvar prev = /** @type {any} */ (dom)[STYLE_CACHE];\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/** @type {any} */ (dom)[STYLE_CACHE] = 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 * Sets the `selected` attribute on an option so form reset can restore it.\n * @param {HTMLOptionElement} option\n * @param {boolean} selected\n */\nexport function set_selected(option, selected) {\n\tif (selected) {\n\t\tif (!option.hasAttribute('selected')) option.setAttribute('selected', '');\n\t} else {\n\t\toption.removeAttribute('selected');\n\t}\n}\n\n/**\n * Sets the options a form reset should restore. The first call selects\n * them if nothing has set a value, later calls leave the current selection alone.\n * @param {HTMLSelectElement} select\n * @param {any} value\n */\nexport function set_default_select_value(select, value) {\n\tvar mounting = !('__defaultValue' in select);\n\t// @ts-expect-error\n\tif (!mounting && select.__defaultValue === value) return;\n\t// @ts-expect-error\n\tselect.__defaultValue = value;\n\tapply_default_select_value(select, !mounting || '__value' in select);\n}\n\n/**\n * Marks the options matching `__defaultValue` as selected. Without `preserve`\n * a newly matching option gets selected, as an inserted `<option selected>` would.\n * @param {HTMLSelectElement} select\n * @param {boolean} preserve\n */\nfunction apply_default_select_value(select, preserve) {\n\t// @ts-expect-error\n\tvar value = select.__defaultValue;\n\tvar multiple = select.multiple;\n\tvar values = multiple ? value ?? [] : null;\n\n\tif (multiple && !is_array(values)) return;\n\n\tvar index = select.selectedIndex;\n\tvar selected = preserve && multiple ? new Set(select.selectedOptions) : null;\n\n\tfor (var option of select.options) {\n\t\tvar option_value = get_option_value(option);\n\t\tset_selected(\n\t\t\toption,\n\t\t\tmultiple ? /** @type {any[]} */ (values).includes(option_value) : is(option_value, value)\n\t\t);\n\t}\n\n\tif (!preserve) return;\n\n\tif (selected !== null) {\n\t\tfor (option of select.options) {\n\t\t\tvar was_selected = selected.has(option);\n\t\t\tif (option.selected !== was_selected) option.selected = was_selected;\n\t\t}\n\t} else if (select.selectedIndex !== index) {\n\t\tselect.selectedIndex = index;\n\t}\n}\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 * Sets up a mutation observer to sync the current selection\n * and default to the dom when the options change, for example\n * when they are inside an `#each` block. Called once per `<select>`,\n * by the compiled output or by `attribute_effect` for spreads.\n * @param {HTMLSelectElement} select\n */\nexport function init_select(select) {\n\tvar observer = new MutationObserver((entries) => {\n\t\t// Mutations related to `<selectedcontent>` can never affect the option list.\n\t\t// Reacting to them could revert a user-initiated selection change, because the\n\t\t// records are delivered as soon as any listener returns (e.g. a delegated `input`\n\t\t// handler), which can happen before the `change` handler has updated `__value`\n\t\tif (entries.every(is_selectedcontent_mutation)) return;\n\n\t\tif ('__defaultValue' in select) {\n\t\t\tapply_default_select_value(select, false);\n\t\t}\n\n\t\tif ('__value' in select) {\n\t\t\tselect_option(select, select.__value);\n\t\t}\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\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\n/**\n * Returns `true` if the mutation stems from the browser mirroring the selected\n * option's content into `<selectedcontent>`, or from us replacing the\n * `<selectedcontent>` element with a clone of itself\n * @param {MutationRecord} entry\n */\nfunction is_selectedcontent_mutation(entry) {\n\tif (/** @type {Element} */ (entry.target).closest('selectedcontent') !== null) {\n\t\treturn true;\n\t}\n\n\tif (entry.type === 'childList') {\n\t\tvar nodes = [...entry.addedNodes, ...entry.removedNodes];\n\t\treturn nodes.length > 0 && nodes.every((node) => node.nodeName === 'SELECTEDCONTENT');\n\t}\n\n\treturn false;\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 {\n\tATTRIBUTES_CACHE,\n\tFORM_RESET_HANDLER,\n\tIS_XHTML,\n\tLOADING_ATTR_SYMBOL\n} 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 {\n\tinit_select,\n\tselect_option,\n\tset_default_select_value,\n\tset_selected\n} 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/** @type {any} */ (input)[FORM_RESET_HANDLER] = 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 * 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).has(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).has(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\tif (!('defaultValue' in next || 'defaultChecked' in next)) {\n\t\t\tremove_input_defaults(/** @type {HTMLInputElement} */ (element));\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\tvar is_select_element = element.nodeName === SELECT_TAG;\n\n\tfor (var key in prev) {\n\t\t// don't null our internal $$onX listeners\n\t\tif (!(key in next) && key[0] + key[1] !== '$$') {\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\tif (element.nodeName === INPUT_TAG && 'type' in next && ('value' in next || '__value' in next)) {\n\t\tvar type = next.type;\n\n\t\tif (type !== current.type || (type === undefined && element.hasAttribute('type'))) {\n\t\t\tcurrent.type = type;\n\t\t\tset_attribute(element, 'type', type, skip_warning);\n\t\t}\n\t}\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\t// A select's default value is represented by selected options, not a property.\n\t\t\tif (is_select_element && name === 'defaultValue') continue;\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((is_custom_element || typeof value !== 'string') && setters.has(name))\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) {\n\t\t\t\tvar select = /** @type {HTMLSelectElement} */ (element);\n\n\t\t\t\tif ('defaultValue' in next) {\n\t\t\t\t\tset_default_select_value(select, next.defaultValue);\n\t\t\t\t}\n\n\t\t\t\tif ('value' in next) {\n\t\t\t\t\tselect_option(select, next.value);\n\t\t\t\t}\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\tvar attrs = /** @type {Record<string | symbol, any>} */ (prev);\n\n\t\t\t\tif ('defaultValue' in attrs) {\n\t\t\t\t\tset_default_select_value(select, attrs.defaultValue);\n\t\t\t\t}\n\n\t\t\t\tselect_option(select, attrs.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/** @type {any} */ (element)[ATTRIBUTES_CACHE] ??= {\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, Set<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 = new Set()));\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 (and dangerous, like innerHTML) setters we're not interested in\n\t// Do not use constructor.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 (\n\t\t\t\tdescriptors[key].set &&\n\t\t\t\t// better safe than sorry, we don't want spread attributes to mess with HTML content\n\t\t\t\tkey !== 'innerHTML' &&\n\t\t\t\tkey !== 'textContent' &&\n\t\t\t\tkey !== 'innerText'\n\t\t\t) {\n\t\t\t\tsetters.add(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 { 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 { effect, teardown } from '../../../reactivity/effects.js';\nimport { untrack } from '../../../runtime.js';\n\n/**\n * We create one listener for all elements\n * @see {@link https://groups.google.com/a/chromium.org/g/blink-dev/c/z6ienONUb5A/m/F5-VcUZtBAAJ Explanation}\n */\nclass ResizeObserverSingleton {\n\t/** */\n\t#listeners = new WeakMap();\n\n\t/** @type {ResizeObserver | undefined} */\n\t#observer;\n\n\t/** @type {ResizeObserverOptions} */\n\t#options;\n\n\t/** @static */\n\tstatic entries = new WeakMap();\n\n\t/** @param {ResizeObserverOptions} options */\n\tconstructor(options) {\n\t\tthis.#options = options;\n\t}\n\n\t/**\n\t * @param {Element} element\n\t * @param {(entry: ResizeObserverEntry) => any} listener\n\t */\n\tobserve(element, listener) {\n\t\tvar listeners = this.#listeners.get(element) || new Set();\n\t\tlisteners.add(listener);\n\n\t\tthis.#listeners.set(element, listeners);\n\t\tthis.#getObserver().observe(element, this.#options);\n\n\t\treturn () => {\n\t\t\tvar listeners = this.#listeners.get(element);\n\t\t\tlisteners.delete(listener);\n\n\t\t\tif (listeners.size === 0) {\n\t\t\t\tthis.#listeners.delete(element);\n\t\t\t\t/** @type {ResizeObserver} */ (this.#observer).unobserve(element);\n\t\t\t}\n\t\t};\n\t}\n\n\t#getObserver() {\n\t\treturn (\n\t\t\tthis.#observer ??\n\t\t\t(this.#observer = new ResizeObserver(\n\t\t\t\t/** @param {any} entries */ (entries) => {\n\t\t\t\t\tfor (var entry of entries) {\n\t\t\t\t\t\tResizeObserverSingleton.entries.set(entry.target, entry);\n\t\t\t\t\t\tfor (var listener of this.#listeners.get(entry.target) || []) {\n\t\t\t\t\t\t\tlistener(entry);\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\nvar resize_observer_content_box = /* @__PURE__ */ new ResizeObserverSingleton({\n\tbox: 'content-box'\n});\n\nvar resize_observer_border_box = /* @__PURE__ */ new ResizeObserverSingleton({\n\tbox: 'border-box'\n});\n\nvar resize_observer_device_pixel_content_box = /* @__PURE__ */ new ResizeObserverSingleton({\n\tbox: 'device-pixel-content-box'\n});\n\n/**\n * @param {Element} element\n * @param {'contentRect' | 'contentBoxSize' | 'borderBoxSize' | 'devicePixelContentBoxSize'} type\n * @param {(entry: keyof ResizeObserverEntry) => void} set\n */\nexport function bind_resize_observer(element, type, set) {\n\tvar observer =\n\t\ttype === 'contentRect' || type === 'contentBoxSize'\n\t\t\t? resize_observer_content_box\n\t\t\t: type === 'borderBoxSize'\n\t\t\t\t? resize_observer_border_box\n\t\t\t\t: resize_observer_device_pixel_content_box;\n\n\tvar unsub = observer.observe(element, /** @param {any} entry */ (entry) => set(entry[type]));\n\tteardown(unsub);\n}\n\n/**\n * @param {HTMLElement} element\n * @param {'clientWidth' | 'clientHeight' | 'offsetWidth' | 'offsetHeight'} type\n * @param {(size: number) => void} set\n */\nexport function bind_element_size(element, type, set) {\n\tvar unsub = resize_observer_border_box.observe(element, () => set(element[type]));\n\n\teffect(() => {\n\t\t// The update could contain reads which should be ignored\n\t\tuntrack(() => set(element[type]));\n\t\treturn unsub;\n\t});\n}\n","/** @import { ComponentContext, Effect } from '#client' */\nimport { DESTROYING, STATE_SYMBOL } from '#client/constants';\nimport { component_context, mark_as_component } 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(\n\telement_or_component = mark_as_component(),\n\tupdate,\n\tget_value,\n\tget_parts\n) {\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 (!is_bound_this(get_value(...parts), element_or_component)) {\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 { 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('unmounted');\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 { Derived, 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: Set<string | symbol>, name?: string }>}}\n */\nconst rest_props_handler = {\n\tget(target, key) {\n\t\tif (target.exclude.has(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.has(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.has(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.has(key));\n\t}\n};\n\n/**\n * @param {Record<string, unknown>} props\n * @param {Set<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(DEV ? { props, exclude, name } : { props, exclude }, rest_props_handler);\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\tvar fallback_signal = /** @type {Derived<V> | undefined} */ (undefined);\n\n\tvar get_fallback = () => {\n\t\tif (lazy && runes) {\n\t\t\tfallback_signal ??= derived(/** @type {() => V} */ (fallback));\n\t\t\treturn get(fallback_signal);\n\t\t}\n\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","/** @import { ComponentConstructorOptions, ComponentType, SvelteComponent, Component } from 'svelte' */\nimport { DIRTY, LEGACY_PROPS, MAYBE_DIRTY } from '../internal/client/constants.js';\nimport { user_pre_effect } from '../internal/client/reactivity/effects.js';\nimport { mutable_source, set } from '../internal/client/reactivity/sources.js';\nimport { hydrate, mount, unmount } from '../internal/client/render.js';\nimport { active_effect, get } from '../internal/client/runtime.js';\nimport { flushSync } from '../internal/client/reactivity/batch.js';\nimport { define_property, is_array } from '../internal/shared/utils.js';\nimport * as e from '../internal/client/errors.js';\nimport * as w from '../internal/client/warnings.js';\nimport { DEV } from 'esm-env';\nimport { FILENAME } from '../constants.js';\nimport { component_context, dev_current_component_function } from '../internal/client/context.js';\nimport { async_mode_flag } from '../internal/flags/index.js';\nimport { set_signal_status } from '../internal/client/reactivity/status.js';\n\n/**\n * Takes the same options as a Svelte 4 component and the component function and returns a Svelte 4 compatible component.\n *\n * @deprecated Use this only as a temporary solution to migrate your imperative component code to Svelte 5.\n *\n * @template {Record<string, any>} Props\n * @template {Record<string, any>} Exports\n * @template {Record<string, any>} Events\n * @template {Record<string, any>} Slots\n *\n * @param {ComponentConstructorOptions<Props> & {\n * \tcomponent: ComponentType<SvelteComponent<Props, Events, Slots>> | Component<Props>;\n * }} options\n * @returns {SvelteComponent<Props, Events, Slots> & Exports}\n */\nexport function createClassComponent(options) {\n\t// @ts-expect-error $$prop_def etc are not actually defined\n\treturn new Svelte4Component(options);\n}\n\n/**\n * Takes the component function and returns a Svelte 4 compatible component constructor.\n *\n * @deprecated Use this only as a temporary solution to migrate your imperative component code to Svelte 5.\n *\n * @template {Record<string, any>} Props\n * @template {Record<string, any>} Exports\n * @template {Record<string, any>} Events\n * @template {Record<string, any>} Slots\n *\n * @param {SvelteComponent<Props, Events, Slots> | Component<Props>} component\n * @returns {ComponentType<SvelteComponent<Props, Events, Slots> & Exports>}\n */\nexport function asClassComponent(component) {\n\t// @ts-expect-error $$prop_def etc are not actually defined\n\treturn class extends Svelte4Component {\n\t\t/** @param {any} options */\n\t\tconstructor(options) {\n\t\t\tsuper({\n\t\t\t\tcomponent,\n\t\t\t\t...options\n\t\t\t});\n\t\t}\n\t};\n}\n\n/**\n * Support using the component as both a class and function during the transition period\n * @typedef {{new (o: ComponentConstructorOptions): SvelteComponent;(...args: Parameters<Component<Record<string, any>>>): ReturnType<Component<Record<string, any>, Record<string, any>>>;}} LegacyComponentType\n */\n\nclass Svelte4Component {\n\t/** @type {any} */\n\t#events;\n\n\t/** @type {Record<string, any>} */\n\t#instance;\n\n\t/**\n\t * @param {ComponentConstructorOptions & {\n\t * component: any;\n\t * }} options\n\t */\n\tconstructor(options) {\n\t\tvar sources = new Map();\n\n\t\t/**\n\t\t * @param {string | symbol} key\n\t\t * @param {unknown} value\n\t\t */\n\t\tvar add_source = (key, value) => {\n\t\t\tvar s = mutable_source(value, false, false);\n\t\t\tsources.set(key, s);\n\t\t\treturn s;\n\t\t};\n\n\t\t// Replicate coarse-grained props through a proxy that has a version source for\n\t\t// each property, which is incremented on updates to the property itself. Do not\n\t\t// use our $state proxy because that one has fine-grained reactivity.\n\t\tconst props = new Proxy(\n\t\t\t{ ...(options.props || {}), $$events: {} },\n\t\t\t{\n\t\t\t\tget(target, prop) {\n\t\t\t\t\treturn get(sources.get(prop) ?? add_source(prop, Reflect.get(target, prop)));\n\t\t\t\t},\n\t\t\t\thas(target, prop) {\n\t\t\t\t\t// Necessary to not throw \"invalid binding\" validation errors on the component side\n\t\t\t\t\tif (prop === LEGACY_PROPS) return true;\n\n\t\t\t\t\tget(sources.get(prop) ?? add_source(prop, Reflect.get(target, prop)));\n\t\t\t\t\treturn Reflect.has(target, prop);\n\t\t\t\t},\n\t\t\t\tset(target, prop, value) {\n\t\t\t\t\tset(sources.get(prop) ?? add_source(prop, value), value);\n\t\t\t\t\treturn Reflect.set(target, prop, value);\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\n\t\tthis.#instance = (options.hydrate ? hydrate : mount)(options.component, {\n\t\t\ttarget: options.target,\n\t\t\tanchor: options.anchor,\n\t\t\tprops,\n\t\t\tcontext: options.context,\n\t\t\tintro: options.intro ?? false,\n\t\t\trecover: options.recover,\n\t\t\ttransformError: options.transformError\n\t\t});\n\n\t\t// We don't flushSync for custom element wrappers or if the user doesn't want it,\n\t\t// or if we're in async mode since `flushSync()` will fail\n\t\tif (!async_mode_flag && (!options?.props?.$$host || options.sync === false)) {\n\t\t\tflushSync();\n\t\t}\n\n\t\tthis.#events = props.$$events;\n\n\t\tfor (const key of Object.keys(this.#instance)) {\n\t\t\tif (key === '$set' || key === '$destroy' || key === '$on') continue;\n\t\t\tdefine_property(this, key, {\n\t\t\t\tget() {\n\t\t\t\t\treturn this.#instance[key];\n\t\t\t\t},\n\t\t\t\t/** @param {any} value */\n\t\t\t\tset(value) {\n\t\t\t\t\tthis.#instance[key] = value;\n\t\t\t\t},\n\t\t\t\tenumerable: true\n\t\t\t});\n\t\t}\n\n\t\tthis.#instance.$set = /** @param {Record<string, any>} next */ (next) => {\n\t\t\tObject.assign(props, next);\n\t\t};\n\n\t\tthis.#instance.$destroy = () => {\n\t\t\tunmount(this.#instance);\n\t\t};\n\t}\n\n\t/** @param {Record<string, any>} props */\n\t$set(props) {\n\t\tthis.#instance.$set(props);\n\t}\n\n\t/**\n\t * @param {string} event\n\t * @param {(...args: any[]) => any} callback\n\t * @returns {any}\n\t */\n\t$on(event, callback) {\n\t\tthis.#events[event] = this.#events[event] || [];\n\n\t\t/** @param {any[]} args */\n\t\tconst cb = (...args) => callback.call(this, ...args);\n\t\tthis.#events[event].push(cb);\n\t\treturn () => {\n\t\t\tthis.#events[event] = this.#events[event].filter(/** @param {any} fn */ (fn) => fn !== cb);\n\t\t};\n\t}\n\n\t$destroy() {\n\t\tthis.#instance.$destroy();\n\t}\n}\n\n/**\n * Runs the given function once immediately on the server, and works like `$effect.pre` on the client.\n *\n * @deprecated Use this only as a temporary solution to migrate your component code to Svelte 5.\n * @param {() => void | (() => void)} fn\n * @returns {void}\n */\nexport function run(fn) {\n\tuser_pre_effect(() => {\n\t\tfn();\n\t\tvar effect = /** @type {import('#client').Effect} */ (active_effect);\n\t\t// If the effect is immediately made dirty again, mark it as maybe dirty to emulate legacy behaviour\n\t\tif ((effect.f & DIRTY) !== 0) {\n\t\t\tlet filename = \"a file (we can't know which one)\";\n\t\t\tif (DEV) {\n\t\t\t\t// @ts-ignore\n\t\t\t\tfilename = dev_current_component_function?.[FILENAME] ?? filename;\n\t\t\t}\n\t\t\tw.legacy_recursive_reactive_block(filename);\n\t\t\tset_signal_status(effect, MAYBE_DIRTY);\n\t\t}\n\t});\n}\n\n/**\n * Function to mimic the multiple listeners available in svelte 4\n * @deprecated\n * @param {EventListener[]} handlers\n * @returns {EventListener}\n */\nexport function handlers(...handlers) {\n\treturn function (event) {\n\t\tconst { stopImmediatePropagation } = event;\n\t\tlet stopped = false;\n\n\t\tevent.stopImmediatePropagation = () => {\n\t\t\tstopped = true;\n\t\t\tstopImmediatePropagation.call(event);\n\t\t};\n\n\t\tconst errors = [];\n\n\t\tfor (const handler of handlers) {\n\t\t\ttry {\n\t\t\t\t// @ts-expect-error `this` is not typed\n\t\t\t\thandler?.call(this, event);\n\t\t\t} catch (e) {\n\t\t\t\terrors.push(e);\n\t\t\t}\n\n\t\t\tif (stopped) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tfor (let error of errors) {\n\t\t\tqueueMicrotask(() => {\n\t\t\t\tthrow error;\n\t\t\t});\n\t\t}\n\t};\n}\n\n/**\n * Function to create a `bubble` function that mimic the behavior of `on:click` without handler available in svelte 4.\n * @deprecated Use this only as a temporary solution to migrate your automatically delegated events in Svelte 5.\n */\nexport function createBubbler() {\n\tconst active_component_context = component_context;\n\tif (active_component_context === null) {\n\t\te.lifecycle_outside_component('createBubbler');\n\t}\n\n\treturn (/**@type {string}*/ type) => (/**@type {Event}*/ event) => {\n\t\tconst events = /** @type {Record<string, Function | Function[]>} */ (\n\t\t\tactive_component_context.s.$$events\n\t\t)?.[/** @type {any} */ (type)];\n\n\t\tif (events) {\n\t\t\tconst callbacks = is_array(events) ? events.slice() : [events];\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\t\treturn true;\n\t};\n}\n\nexport {\n\tonce,\n\tpreventDefault,\n\tself,\n\tstopImmediatePropagation,\n\tstopPropagation,\n\ttrusted,\n\tpassive,\n\tnonpassive\n} from '../internal/client/dom/legacy/event-modifiers.js';\n","import { createClassComponent } from '../../../../legacy/legacy-client.js';\nimport { effect_root, render_effect } from '../../reactivity/effects.js';\nimport { append } from '../template.js';\nimport { define_property, get_descriptor, object_keys } from '../../../shared/utils.js';\nimport { create_element } from '../operations.js';\n\n/**\n * @typedef {Object} CustomElementPropDefinition\n * @property {string} [attribute]\n * @property {boolean} [reflect]\n * @property {'String'|'Boolean'|'Number'|'Array'|'Object'} [type]\n */\n\n/** @type {any} */\nlet SvelteElement;\n\nif (typeof HTMLElement === 'function') {\n\tSvelteElement = class extends HTMLElement {\n\t\t/** The Svelte component constructor */\n\t\t$$ctor;\n\t\t/** Slots */\n\t\t$$s;\n\t\t/** @type {any} The Svelte component instance */\n\t\t$$c;\n\t\t/** Whether or not the custom element is connected */\n\t\t$$cn = false;\n\t\t/** @type {Record<string, any>} Component props data */\n\t\t$$d = {};\n\t\t/** `true` if currently in the process of reflecting component props back to attributes */\n\t\t$$r = false;\n\t\t/** @type {Record<string, CustomElementPropDefinition>} Props definition (name, reflected, type etc) */\n\t\t$$p_d = {};\n\t\t/** @type {Record<string, EventListenerOrEventListenerObject[]>} Event listeners */\n\t\t$$l = {};\n\t\t/** @type {Map<EventListenerOrEventListenerObject, Function>} Event listener unsubscribe functions */\n\t\t$$l_u = new Map();\n\t\t/** @type {any} The managed render effect for reflecting attributes */\n\t\t$$me;\n\t\t/** @type {ShadowRoot | null} The ShadowRoot of the custom element */\n\t\t$$shadowRoot = null;\n\n\t\t/**\n\t\t * @param {*} $$componentCtor\n\t\t * @param {*} $$slots\n\t\t * @param {ShadowRootInit | undefined} shadow_root_init\n\t\t */\n\t\tconstructor($$componentCtor, $$slots, shadow_root_init) {\n\t\t\tsuper();\n\t\t\tthis.$$ctor = $$componentCtor;\n\t\t\tthis.$$s = $$slots;\n\n\t\t\tif (shadow_root_init) {\n\t\t\t\t// We need to store the reference to shadow root, because `closed` shadow root cannot be\n\t\t\t\t// accessed with `this.shadowRoot`.\n\t\t\t\tthis.$$shadowRoot = this.attachShadow(shadow_root_init);\n\t\t\t}\n\t\t}\n\n\t\t/**\n\t\t * @param {string} type\n\t\t * @param {EventListenerOrEventListenerObject} listener\n\t\t * @param {boolean | AddEventListenerOptions} [options]\n\t\t */\n\t\taddEventListener(type, listener, options) {\n\t\t\t// We can't determine upfront if the event is a custom event or not, so we have to\n\t\t\t// listen to both. If someone uses a custom event with the same name as a regular\n\t\t\t// browser event, this fires twice - we can't avoid that.\n\t\t\tthis.$$l[type] = this.$$l[type] || [];\n\t\t\tthis.$$l[type].push(listener);\n\t\t\tif (this.$$c) {\n\t\t\t\tconst unsub = this.$$c.$on(type, listener);\n\t\t\t\tthis.$$l_u.set(listener, unsub);\n\t\t\t}\n\t\t\tsuper.addEventListener(type, listener, options);\n\t\t}\n\n\t\t/**\n\t\t * @param {string} type\n\t\t * @param {EventListenerOrEventListenerObject} listener\n\t\t * @param {boolean | AddEventListenerOptions} [options]\n\t\t */\n\t\tremoveEventListener(type, listener, options) {\n\t\t\tsuper.removeEventListener(type, listener, options);\n\t\t\tif (this.$$c) {\n\t\t\t\tconst unsub = this.$$l_u.get(listener);\n\t\t\t\tif (unsub) {\n\t\t\t\t\tunsub();\n\t\t\t\t\tthis.$$l_u.delete(listener);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tasync connectedCallback() {\n\t\t\tthis.$$cn = true;\n\t\t\tif (!this.$$c) {\n\t\t\t\t// We wait one tick to let possible child slot elements be created/mounted\n\t\t\t\tawait Promise.resolve();\n\t\t\t\tif (!this.$$cn || this.$$c) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\t/** @param {string} name */\n\t\t\t\tfunction create_slot(name) {\n\t\t\t\t\t/**\n\t\t\t\t\t * @param {Element} anchor\n\t\t\t\t\t */\n\t\t\t\t\treturn (anchor) => {\n\t\t\t\t\t\tconst slot = create_element('slot');\n\t\t\t\t\t\tif (name !== 'default') slot.name = name;\n\n\t\t\t\t\t\tappend(anchor, slot);\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\t/** @type {Record<string, any>} */\n\t\t\t\tconst $$slots = {};\n\t\t\t\tconst existing_slots = get_custom_elements_slots(this);\n\t\t\t\tfor (const name of this.$$s) {\n\t\t\t\t\tif (name in existing_slots) {\n\t\t\t\t\t\tif (name === 'default' && !this.$$d.children) {\n\t\t\t\t\t\t\tthis.$$d.children = create_slot(name);\n\t\t\t\t\t\t\t$$slots.default = true;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t$$slots[name] = create_slot(name);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfor (const attribute of this.attributes) {\n\t\t\t\t\t// this.$$data takes precedence over this.attributes\n\t\t\t\t\tconst name = this.$$g_p(attribute.name);\n\t\t\t\t\tif (!(name in this.$$d)) {\n\t\t\t\t\t\tthis.$$d[name] = get_custom_element_value(name, attribute.value, this.$$p_d, 'toProp');\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// Port over props that were set programmatically before ce was initialized\n\t\t\t\tfor (const key in this.$$p_d) {\n\t\t\t\t\t// @ts-expect-error\n\t\t\t\t\tif (!(key in this.$$d) && this[key] !== undefined) {\n\t\t\t\t\t\t// @ts-expect-error\n\t\t\t\t\t\tthis.$$d[key] = this[key]; // don't transform, these were set through JavaScript\n\t\t\t\t\t\t// @ts-expect-error\n\t\t\t\t\t\tdelete this[key]; // remove the property that shadows the getter/setter\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tthis.$$c = createClassComponent({\n\t\t\t\t\tcomponent: this.$$ctor,\n\t\t\t\t\ttarget: this.$$shadowRoot || this,\n\t\t\t\t\tprops: {\n\t\t\t\t\t\t...this.$$d,\n\t\t\t\t\t\t$$slots,\n\t\t\t\t\t\t$$host: this\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\t// Reflect component props as attributes\n\t\t\t\tthis.$$me = effect_root(() => {\n\t\t\t\t\trender_effect(() => {\n\t\t\t\t\t\tthis.$$r = true;\n\t\t\t\t\t\tfor (const key of object_keys(this.$$c)) {\n\t\t\t\t\t\t\tif (!this.$$p_d[key]?.reflect) continue;\n\t\t\t\t\t\t\tthis.$$d[key] = this.$$c[key];\n\t\t\t\t\t\t\tconst attribute_value = get_custom_element_value(\n\t\t\t\t\t\t\t\tkey,\n\t\t\t\t\t\t\t\tthis.$$d[key],\n\t\t\t\t\t\t\t\tthis.$$p_d,\n\t\t\t\t\t\t\t\t'toAttribute'\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tif (attribute_value == null) {\n\t\t\t\t\t\t\t\tthis.removeAttribute(this.$$p_d[key].attribute || key);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tthis.setAttribute(this.$$p_d[key].attribute || key, attribute_value);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tthis.$$r = false;\n\t\t\t\t\t});\n\t\t\t\t});\n\n\t\t\t\tfor (const type in this.$$l) {\n\t\t\t\t\tfor (const listener of this.$$l[type]) {\n\t\t\t\t\t\tconst unsub = this.$$c.$on(type, listener);\n\t\t\t\t\t\tthis.$$l_u.set(listener, unsub);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tthis.$$l = {};\n\t\t\t}\n\t\t}\n\n\t\t// We don't need this when working within Svelte code, but for compatibility of people using this outside of Svelte\n\t\t// and setting attributes through setAttribute etc, this is helpful\n\n\t\t/**\n\t\t * @param {string} attr\n\t\t * @param {string} _oldValue\n\t\t * @param {string} newValue\n\t\t */\n\t\tattributeChangedCallback(attr, _oldValue, newValue) {\n\t\t\tif (this.$$r) return;\n\t\t\tattr = this.$$g_p(attr);\n\t\t\tthis.$$d[attr] = get_custom_element_value(attr, newValue, this.$$p_d, 'toProp');\n\t\t\tthis.$$c?.$set({ [attr]: this.$$d[attr] });\n\t\t}\n\n\t\tdisconnectedCallback() {\n\t\t\tthis.$$cn = false;\n\t\t\t// In a microtask, because this could be a move within the DOM\n\t\t\tPromise.resolve().then(() => {\n\t\t\t\tif (!this.$$cn && this.$$c) {\n\t\t\t\t\tthis.$$c.$destroy();\n\t\t\t\t\tthis.$$me();\n\t\t\t\t\tthis.$$c = undefined;\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\t/**\n\t\t * @param {string} attribute_name\n\t\t */\n\t\t$$g_p(attribute_name) {\n\t\t\treturn (\n\t\t\t\tobject_keys(this.$$p_d).find(\n\t\t\t\t\t(key) =>\n\t\t\t\t\t\tthis.$$p_d[key].attribute === attribute_name ||\n\t\t\t\t\t\t(!this.$$p_d[key].attribute && key.toLowerCase() === attribute_name)\n\t\t\t\t) || attribute_name\n\t\t\t);\n\t\t}\n\t};\n}\n\n/**\n * @param {string} prop\n * @param {any} value\n * @param {Record<string, CustomElementPropDefinition>} props_definition\n * @param {'toAttribute' | 'toProp'} [transform]\n */\nfunction get_custom_element_value(prop, value, props_definition, transform) {\n\tconst type = props_definition[prop]?.type;\n\tvalue = type === 'Boolean' && typeof value !== 'boolean' ? value != null : value;\n\tif (!transform || !props_definition[prop]) {\n\t\treturn value;\n\t} else if (transform === 'toAttribute') {\n\t\tswitch (type) {\n\t\t\tcase 'Object':\n\t\t\tcase 'Array':\n\t\t\t\treturn value == null ? null : JSON.stringify(value);\n\t\t\tcase 'Boolean':\n\t\t\t\treturn value ? '' : null;\n\t\t\tcase 'Number':\n\t\t\t\treturn value == null ? null : value;\n\t\t\tdefault:\n\t\t\t\treturn value;\n\t\t}\n\t} else {\n\t\tswitch (type) {\n\t\t\tcase 'Object':\n\t\t\tcase 'Array':\n\t\t\t\treturn value && JSON.parse(value);\n\t\t\tcase 'Boolean':\n\t\t\t\treturn value; // conversion already handled above\n\t\t\tcase 'Number':\n\t\t\t\treturn value != null ? +value : value;\n\t\t\tdefault:\n\t\t\t\treturn value;\n\t\t}\n\t}\n}\n\n/**\n * @param {HTMLElement} element\n */\nfunction get_custom_elements_slots(element) {\n\t/** @type {Record<string, true>} */\n\tconst result = {};\n\telement.childNodes.forEach((node) => {\n\t\tresult[/** @type {Element} node */ (node).slot || 'default'] = true;\n\t});\n\treturn result;\n}\n\n/**\n * @internal\n *\n * Turn a Svelte component into a custom element.\n * @param {any} Component A Svelte component function\n * @param {Record<string, CustomElementPropDefinition>} props_definition The props to observe\n * @param {string[]} slots The slots to create\n * @param {string[]} exports Explicitly exported values, other than props\n * @param {ShadowRootInit | undefined} shadow_root_init Options passed to shadow DOM constructor\n * @param {(ce: new () => HTMLElement) => new () => HTMLElement} [extend]\n */\nexport function create_custom_element(\n\tComponent,\n\tprops_definition,\n\tslots,\n\texports,\n\tshadow_root_init,\n\textend\n) {\n\tlet Class = class extends SvelteElement {\n\t\tconstructor() {\n\t\t\tsuper(Component, slots, shadow_root_init);\n\t\t\tthis.$$p_d = props_definition;\n\t\t}\n\t\tstatic get observedAttributes() {\n\t\t\treturn object_keys(props_definition).map((key) =>\n\t\t\t\t(props_definition[key].attribute || key).toLowerCase()\n\t\t\t);\n\t\t}\n\t};\n\tobject_keys(props_definition).forEach((prop) => {\n\t\tdefine_property(Class.prototype, prop, {\n\t\t\tget() {\n\t\t\t\treturn this.$$c && prop in this.$$c ? this.$$c[prop] : this.$$d[prop];\n\t\t\t},\n\t\t\tset(value) {\n\t\t\t\tvalue = get_custom_element_value(prop, value, props_definition);\n\t\t\t\tthis.$$d[prop] = value;\n\t\t\t\tvar component = this.$$c;\n\n\t\t\t\tif (component) {\n\t\t\t\t\t// // If the instance has an accessor, use that instead\n\t\t\t\t\tvar setter = get_descriptor(component, prop)?.get;\n\n\t\t\t\t\tif (setter) {\n\t\t\t\t\t\tcomponent[prop] = value;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tcomponent.$set({ [prop]: value });\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t});\n\texports.forEach((property) => {\n\t\tdefine_property(Class.prototype, property, {\n\t\t\tget() {\n\t\t\t\treturn this.$$c?.[property];\n\t\t\t}\n\t\t});\n\t});\n\tif (extend) {\n\t\t// @ts-expect-error - assigning here is fine\n\t\tClass = extend(Class);\n\t}\n\tComponent.element = /** @type {any} */ Class;\n\treturn Class;\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 { 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","/**\n * @file\n * @license @lucide/svelte v1.49.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\nconst defaultAttributes = {\n xmlns: 'http://www.w3.org/2000/svg',\n width: 24,\n height: 24,\n viewBox: '0 0 24 24',\n fill: 'none',\n stroke: 'currentColor',\n 'stroke-width': 2,\n 'stroke-linecap': 'round',\n 'stroke-linejoin': 'round',\n};\nexport default defaultAttributes;\n","/**\n * @file\n * @license @lucide/svelte v1.49.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n/**\n * Merges classes into a single string\n *\n * @param {array} classes\n * @returns {string} A string of classes\n */\nexport const mergeClasses = (...classes) => classes\n .filter((className, index, array) => {\n return (Boolean(className) &&\n className.trim() !== '' &&\n array.indexOf(className) === index);\n})\n .join(' ')\n .trim();\n","/**\n * @file\n * @license @lucide/svelte v1.49.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\nimport defaultAttributes from './defaultAttributes.js';\nimport { mergeClasses } from '../utils/mergeClasses.js';\nfunction isDefined(value) {\n return value !== null && value !== undefined;\n}\n/**\n * Creates a Lucide icon node (an svgson-like format) from a Lucide icon object.\n *\n * @param icon The icon to build.\n * @param params Additional build parameters.\n */\nfunction buildLucideIconNode(icon, params = {}) {\n const attributeNames = params.attributeNames ?? {};\n const getAttributeName = (attributeName) => attributeNames[attributeName] ?? attributeName;\n const viewBoxWidth = icon.size ?? icon.width ?? defaultAttributes['width'];\n const viewBoxHeight = icon.size ?? icon.height ?? defaultAttributes['height'];\n const aliasClassNames = icon.aliases\n ?.filter((alias) => typeof alias === 'string' && alias.trim() !== '')\n .map((alias) => `lucide-${alias}`) ?? [];\n const iconClassNames = [...(icon.name ? [`lucide-${icon.name}`] : []), ...aliasClassNames];\n const classNamesFromClassName = params.className?.split(' ').filter(Boolean) ?? [];\n const className = params.includeDefaultClasses === false\n ? mergeClasses(...classNamesFromClassName)\n : mergeClasses('lucide', ...iconClassNames, ...classNamesFromClassName);\n const calculatedStrokeWidth = params.absoluteStrokeWidth\n ? (Number(params.strokeWidth ?? defaultAttributes['stroke-width']) *\n Number(icon.size ?? icon.width ?? defaultAttributes['width'])) /\n Number(params.size ?? params.width ?? defaultAttributes['width'])\n : (params.strokeWidth ?? defaultAttributes['stroke-width']);\n const attributes = {\n ...Object.entries(defaultAttributes).reduce((attrs, [attrName, value]) => {\n attrs[getAttributeName(attrName)] = value;\n return attrs;\n }, {}),\n ...('color' in params &&\n params.color && {\n [getAttributeName('stroke')]: params.color,\n }),\n ...('size' in params &&\n isDefined(params.size) && {\n [getAttributeName('width')]: params.size,\n [getAttributeName('height')]: params.size,\n }),\n ...('width' in params &&\n isDefined(params.width) && {\n [getAttributeName('width')]: params.width,\n }),\n ...('height' in params &&\n isDefined(params.height) && {\n [getAttributeName('height')]: params.height,\n }),\n [getAttributeName('stroke-width')]: calculatedStrokeWidth,\n ...(className && {\n [getAttributeName('class')]: className,\n }),\n [getAttributeName('viewBox')]: `0 0 ${viewBoxWidth} ${viewBoxHeight}`,\n ...(params.hasA11yProp === false\n ? {\n [getAttributeName('aria-hidden')]: 'true',\n }\n : {}),\n ...('attributes' in params && params.attributes),\n };\n return [\n 'svg',\n attributes,\n icon.node.map((child) => {\n const [name, attrs, children] = child;\n const nextAttrs = params.nonScalingStroke\n ? { [getAttributeName('vector-effect')]: 'non-scaling-stroke', ...attrs }\n : attrs;\n return children ? [name, nextAttrs, children] : [name, nextAttrs];\n }),\n ];\n}\nexport default buildLucideIconNode;\n","/**\n * @file\n * @license @lucide/svelte v1.49.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n/**\n * Check if a component has an accessibility prop\n *\n * @param {object} props\n * @returns {boolean} Whether the component has an accessibility prop\n */\nexport const hasA11yProp = (props) => {\n for (const prop in props) {\n if (prop.startsWith('aria-') || prop === 'role' || prop === 'title') {\n return true;\n }\n }\n return false;\n};\n","/**\n * @file\n * @license @lucide/svelte v1.49.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\nimport { getContext, setContext } from 'svelte';\nconst LucideContext = Symbol('lucide-context');\nexport const setLucideProps = (globalProps) => setContext(LucideContext, globalProps);\nexport const getLucideContext = () => getContext(LucideContext);\n","<script lang=\"ts\">import buildLucideIconNode from './utils/buildLucideIconNode.js';\nimport { hasA11yProp } from './utils/hasA11yProp.js';\nimport { getLucideContext } from './context.js';\nimport { mergeClasses } from './utils/mergeClasses.js';\nconst globalProps = getLucideContext() ?? {};\nconst { color = globalProps.color ?? 'currentColor', size = globalProps.size ?? 24, width = size, height = size, strokeWidth = globalProps.strokeWidth ?? 2, absoluteStrokeWidth = globalProps.absoluteStrokeWidth ?? false, nonScalingStroke = globalProps.nonScalingStroke ?? false, iconNode = [], icon = {\n node: iconNode,\n aliases: [],\n size: 24,\n}, class: propsClass, children, ...props } = $props();\nconst hasAccessibleProp = $derived(Boolean(children) || hasA11yProp(props));\nconst [, svgAttributes, builtIconNode = []] = $derived(buildLucideIconNode(icon, {\n color,\n width,\n height,\n strokeWidth,\n absoluteStrokeWidth,\n nonScalingStroke,\n // @TODO: maybe drop the extra `lucide-icon` class altogether.\n className: mergeClasses('lucide-icon', globalProps.class),\n hasA11yProp: hasAccessibleProp,\n attributes: props,\n}));\nconst iconAttributes = $derived({\n ...svgAttributes,\n class: [...svgAttributes.class.split(' '), propsClass],\n});\n</script>\n\n<svg {...iconAttributes}>\n {#each builtIconNode as [tag, attrs]}\n <svelte:element\n this={tag as string}\n {...attrs}\n />\n {/each}\n {@render children?.()}\n</svg>\n","<!--\n@lucide/svelte v1.49.0 - ISC\n\nThis source code is licensed under the ISC license.\nSee the LICENSE file in the root directory of this source tree.\n-->\n\n\n<script lang=\"ts\">import Icon from '../Icon.svelte';\nlet props = $props();\nconst iconData = { \"name\": \"layers\", \"size\": 24, \"node\": [[\"path\", { \"d\": \"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z\" }], [\"path\", { \"d\": \"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12\" }], [\"path\", { \"d\": \"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17\" }]], \"aliases\": [\"layers-3\"] };\n</script>\n\n<!--\n@component\n\nLucide SVG icon component, renders SVG Element with children.\n\n@preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMTIuODMgMi4xOGEyIDIgMCAwIDAtMS42NiAwTDIuNiA2LjA4YTEgMSAwIDAgMCAwIDEuODNsOC41OCAzLjkxYTIgMiAwIDAgMCAxLjY2IDBsOC41OC0zLjlhMSAxIDAgMCAwIDAtMS44M3oiIC8+CiAgPHBhdGggZD0iTTIgMTJhMSAxIDAgMCAwIC41OC45MWw4LjYgMy45MWEyIDIgMCAwIDAgMS42NSAwbDguNTgtMy45QTEgMSAwIDAgMCAyMiAxMiIgLz4KICA8cGF0aCBkPSJNMiAxN2ExIDEgMCAwIDAgLjU4LjkxbDguNiAzLjkxYTIgMiAwIDAgMCAxLjY1IDBsOC41OC0zLjlBMSAxIDAgMCAwIDIyIDE3IiAvPgo8L3N2Zz4K) - https://lucide.dev/icons/layers\n@see https://lucide.dev/guide/packages/lucide-svelte - Documentation\n-->\n\n<Icon {...props} icon={iconData} />\n","<!--\n@lucide/svelte v1.49.0 - ISC\n\nThis source code is licensed under the ISC license.\nSee the LICENSE file in the root directory of this source tree.\n-->\n\n\n<script lang=\"ts\">import Icon from '../Icon.svelte';\nlet props = $props();\nconst iconData = { \"name\": \"moon\", \"size\": 24, \"node\": [[\"path\", { \"d\": \"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401\" }]] };\n</script>\n\n<!--\n@component\n\nLucide SVG icon component, renders SVG Element with children.\n\n@preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMjAuOTg1IDEyLjQ4NmE5IDkgMCAxIDEtOS40NzMtOS40NzJjLjQwNS0uMDIyLjYxNy40Ni40MDIuODAzYTYgNiAwIDAgMCA4LjI2OCA4LjI2OGMuMzQ0LS4yMTUuODI1LS4wMDQuODAzLjQwMSIgLz4KPC9zdmc+Cg==) - https://lucide.dev/icons/moon\n@see https://lucide.dev/guide/packages/lucide-svelte - Documentation\n-->\n\n<Icon {...props} icon={iconData} />\n","<!--\n@lucide/svelte v1.49.0 - ISC\n\nThis source code is licensed under the ISC license.\nSee the LICENSE file in the root directory of this source tree.\n-->\n\n\n<script lang=\"ts\">import Icon from '../Icon.svelte';\nlet props = $props();\nconst iconData = { \"name\": \"sun\", \"size\": 24, \"node\": [[\"circle\", { \"cx\": \"12\", \"cy\": \"12\", \"r\": \"4\" }], [\"path\", { \"d\": \"M12 2v2\" }], [\"path\", { \"d\": \"M12 20v2\" }], [\"path\", { \"d\": \"m4.93 4.93 1.41 1.41\" }], [\"path\", { \"d\": \"m17.66 17.66 1.41 1.41\" }], [\"path\", { \"d\": \"M2 12h2\" }], [\"path\", { \"d\": \"M20 12h2\" }], [\"path\", { \"d\": \"m6.34 17.66-1.41 1.41\" }], [\"path\", { \"d\": \"m19.07 4.93-1.41 1.41\" }]] };\n</script>\n\n<!--\n@component\n\nLucide SVG icon component, renders SVG Element with children.\n\n@preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8Y2lyY2xlIGN4PSIxMiIgY3k9IjEyIiByPSI0IiAvPgogIDxwYXRoIGQ9Ik0xMiAydjIiIC8+CiAgPHBhdGggZD0iTTEyIDIwdjIiIC8+CiAgPHBhdGggZD0ibTQuOTMgNC45MyAxLjQxIDEuNDEiIC8+CiAgPHBhdGggZD0ibTE3LjY2IDE3LjY2IDEuNDEgMS40MSIgLz4KICA8cGF0aCBkPSJNMiAxMmgyIiAvPgogIDxwYXRoIGQ9Ik0yMCAxMmgyIiAvPgogIDxwYXRoIGQ9Im02LjM0IDE3LjY2LTEuNDEgMS40MSIgLz4KICA8cGF0aCBkPSJtMTkuMDcgNC45My0xLjQxIDEuNDEiIC8+Cjwvc3ZnPgo=) - https://lucide.dev/icons/sun\n@see https://lucide.dev/guide/packages/lucide-svelte - Documentation\n-->\n\n<Icon {...props} icon={iconData} />\n","<script lang=\"ts\">\n import '../styles/components.css';\n import type { Snippet } from 'svelte';\n\n // Actions: a row of actions at the end of a container that has no Footer. The actions sit at the\n // right end, secondary then primary; lead sits at the left end (a status, or a third outcome). It\n // has no height of its own and no line, unlike Footer. Neighbours are gap-sm apart.\n //\n // <Actions>\n // {#snippet secondary()}<Button>Cancel</Button>{/snippet}\n // {#snippet primary()}<Button variant=\"primary\">Save</Button>{/snippet}\n // </Actions>\n let {\n lead,\n secondary,\n primary,\n }: {\n /** A status or an action at the left end */\n lead?: Snippet;\n secondary?: Snippet;\n primary?: Snippet;\n } = $props();\n</script>\n\n<div class=\"actions\" data-role=\"actions\">\n {#if lead}<div class=\"lead\">{@render lead()}</div>{/if}\n {@render secondary?.()}\n {@render primary?.()}\n</div>\n\n<style>.actions {\n display: flex;\n justify-content: flex-end;\n align-items: center;\n flex-wrap: wrap;\n gap: var(--kata-gap-sm);\n min-width: 0;\n}\n\n.lead {\n margin-right: auto;\n display: flex;\n align-items: center;\n min-width: 0;\n}</style>\n","/** @import { Source } from '#client' */\nimport { DEV } from 'esm-env';\nimport { set, source, state, increment } from '../internal/client/reactivity/sources.js';\nimport { label, tag } from '../internal/client/dev/tracing.js';\nimport { get, update_version } from '../internal/client/runtime.js';\n\n/**\n * A reactive version of the built-in [`Map`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map) object.\n * Reading contents of the map (by iterating, or by reading `map.size` or calling `map.get(...)` or `map.has(...)` as in the [tic-tac-toe example](https://svelte.dev/playground/0b0ff4aa49c9443f9b47fe5203c78293) below) in an [effect](https://svelte.dev/docs/svelte/$effect) or [derived](https://svelte.dev/docs/svelte/$derived)\n * will cause it to be re-evaluated as necessary when the map is updated.\n *\n * Note that values in a reactive map are _not_ made [deeply reactive](https://svelte.dev/docs/svelte/$state#Deep-state).\n *\n * ```svelte\n * <script>\n * \timport { SvelteMap } from 'svelte/reactivity';\n * \timport { result } from './game.js';\n *\n * \tlet board = new SvelteMap();\n * \tlet player = $state('x');\n * \tlet winner = $derived(result(board));\n *\n * \tfunction reset() {\n * \t\tplayer = 'x';\n * \t\tboard.clear();\n * \t}\n * </script>\n *\n * <div class=\"board\">\n * \t{#each Array(9), i}\n * \t\t<button\n * \t\t\tdisabled={board.has(i) || winner}\n * \t\t\tonclick={() => {\n * \t\t\t\tboard.set(i, player);\n * \t\t\t\tplayer = player === 'x' ? 'o' : 'x';\n * \t\t\t}}\n * \t\t>{board.get(i)}</button>\n * \t{/each}\n * </div>\n *\n * {#if winner}\n * \t<p>{winner} wins!</p>\n * \t<button onclick={reset}>reset</button>\n * {:else}\n * \t<p>{player} is next</p>\n * {/if}\n * ```\n *\n * @template K\n * @template V\n * @extends {Map<K, V>}\n */\nexport class SvelteMap extends Map {\n\t/** @type {Map<K, Source<number>>} */\n\t#sources = new Map();\n\t#version = state(0);\n\t#size = state(0);\n\t#update_version = update_version || -1;\n\n\t/**\n\t * @param {Iterable<readonly [K, V]> | null | undefined} [value]\n\t */\n\tconstructor(value) {\n\t\tsuper();\n\n\t\tif (DEV) {\n\t\t\t// If the value is invalid then the native exception will fire here\n\t\t\tvalue = new Map(value);\n\n\t\t\ttag(this.#version, 'SvelteMap version');\n\t\t\ttag(this.#size, 'SvelteMap.size');\n\t\t}\n\n\t\tif (value) {\n\t\t\tfor (var [key, v] of value) {\n\t\t\t\tsuper.set(key, v);\n\t\t\t}\n\t\t\tthis.#size.v = super.size;\n\t\t}\n\t}\n\n\t/**\n\t * If the source is being created inside the same reaction as the SvelteMap instance,\n\t * we use `state` so that it will not be a dependency of the reaction. Otherwise we\n\t * use `source` so it will be.\n\t *\n\t * @template T\n\t * @param {T} value\n\t * @returns {Source<T>}\n\t */\n\t#source(value) {\n\t\treturn update_version === this.#update_version ? state(value) : source(value);\n\t}\n\n\t/** @param {K} key */\n\thas(key) {\n\t\tvar sources = this.#sources;\n\t\tvar s = sources.get(key);\n\n\t\tif (s === undefined) {\n\t\t\tif (super.has(key)) {\n\t\t\t\ts = this.#source(0);\n\n\t\t\t\tif (DEV) {\n\t\t\t\t\ttag(s, `SvelteMap get(${label(key)})`);\n\t\t\t\t}\n\n\t\t\t\tsources.set(key, s);\n\t\t\t} else {\n\t\t\t\t// We should always track the version in case\n\t\t\t\t// the Set ever gets this value in the future.\n\t\t\t\tget(this.#version);\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\tget(s);\n\t\treturn true;\n\t}\n\n\t/**\n\t * @param {(value: V, key: K, map: Map<K, V>) => void} callbackfn\n\t * @param {any} [this_arg]\n\t */\n\tforEach(callbackfn, this_arg) {\n\t\tthis.#read_all();\n\t\tsuper.forEach(callbackfn, this_arg);\n\t}\n\n\t/** @param {K} key */\n\tget(key) {\n\t\tvar sources = this.#sources;\n\t\tvar s = sources.get(key);\n\n\t\tif (s === undefined) {\n\t\t\tif (super.has(key)) {\n\t\t\t\ts = this.#source(0);\n\n\t\t\t\tif (DEV) {\n\t\t\t\t\ttag(s, `SvelteMap get(${label(key)})`);\n\t\t\t\t}\n\n\t\t\t\tsources.set(key, s);\n\t\t\t} else {\n\t\t\t\t// We should always track the version in case\n\t\t\t\t// the Set ever gets this value in the future.\n\t\t\t\tget(this.#version);\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t}\n\n\t\tget(s);\n\t\treturn super.get(key);\n\t}\n\n\t/**\n\t * @param {K} key\n\t * @param {V} value\n\t * */\n\tgetOrInsert(key, value) {\n\t\tif (!super.has(key)) {\n\t\t\tthis.set(key, value);\n\t\t}\n\t\treturn /** @type {V} */ (this.get(key));\n\t}\n\n\t/**\n\t * @param {K} key\n\t * @param {(key: K) => V} callbackFn\n\t */\n\tgetOrInsertComputed(key, callbackFn) {\n\t\tif (!super.has(key)) {\n\t\t\tthis.set(key, callbackFn(key));\n\t\t}\n\t\treturn /** @type {V} */ (this.get(key));\n\t}\n\n\t/**\n\t * @param {K} key\n\t * @param {V} value\n\t * */\n\tset(key, value) {\n\t\tvar sources = this.#sources;\n\t\tvar s = sources.get(key);\n\t\tvar prev_res = super.get(key);\n\t\tvar res = super.set(key, value);\n\t\tvar version = this.#version;\n\n\t\tif (s === undefined) {\n\t\t\ts = this.#source(0);\n\n\t\t\tif (DEV) {\n\t\t\t\ttag(s, `SvelteMap get(${label(key)})`);\n\t\t\t}\n\n\t\t\tsources.set(key, s);\n\t\t\tset(this.#size, super.size);\n\t\t\tincrement(version);\n\t\t} else if (prev_res !== value) {\n\t\t\tincrement(s);\n\n\t\t\t// if not every reaction of s is a reaction of version we need to also include version\n\t\t\tvar v_reactions = version.reactions === null ? null : new Set(version.reactions);\n\t\t\tvar needs_version_increase =\n\t\t\t\tv_reactions === null ||\n\t\t\t\t!s.reactions?.every((r) =>\n\t\t\t\t\t/** @type {NonNullable<typeof v_reactions>} */ (v_reactions).has(r)\n\t\t\t\t);\n\t\t\tif (needs_version_increase) {\n\t\t\t\tincrement(version);\n\t\t\t}\n\t\t}\n\n\t\treturn res;\n\t}\n\n\t/** @param {K} key */\n\tdelete(key) {\n\t\tvar sources = this.#sources;\n\t\tvar s = sources.get(key);\n\t\tvar res = super.delete(key);\n\n\t\tif (s !== undefined) {\n\t\t\tsources.delete(key);\n\t\t\tset(s, -1);\n\t\t}\n\n\t\tif (res) {\n\t\t\tset(this.#size, super.size);\n\t\t\tincrement(this.#version);\n\t\t}\n\n\t\treturn res;\n\t}\n\n\tclear() {\n\t\tif (super.size === 0) {\n\t\t\treturn;\n\t\t}\n\t\t// Clear first, so we get nice console.log outputs with $inspect\n\t\tsuper.clear();\n\t\tvar sources = this.#sources;\n\t\tset(this.#size, 0);\n\t\tfor (var s of sources.values()) {\n\t\t\tset(s, -1);\n\t\t}\n\t\tincrement(this.#version);\n\t\tsources.clear();\n\t}\n\n\t#read_all() {\n\t\tget(this.#version);\n\n\t\tvar sources = this.#sources;\n\t\tif (this.#size.v !== sources.size) {\n\t\t\tfor (var key of super.keys()) {\n\t\t\t\tif (!sources.has(key)) {\n\t\t\t\t\tvar s = this.#source(0);\n\t\t\t\t\tif (DEV) {\n\t\t\t\t\t\ttag(s, `SvelteMap get(${label(key)})`);\n\t\t\t\t\t}\n\n\t\t\t\t\tsources.set(key, s);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor ([, s] of this.#sources) {\n\t\t\tget(s);\n\t\t}\n\t}\n\n\tkeys() {\n\t\tget(this.#version);\n\t\treturn super.keys();\n\t}\n\n\tvalues() {\n\t\tthis.#read_all();\n\t\treturn super.values();\n\t}\n\n\tentries() {\n\t\tthis.#read_all();\n\t\treturn super.entries();\n\t}\n\n\t[Symbol.iterator]() {\n\t\treturn this.entries();\n\t}\n\n\tget size() {\n\t\tget(this.#size);\n\t\treturn super.size;\n\t}\n}\n","// The strings that components show on their own (the names of built-in actions, accessible names,\n// the labels of settings). kata ships English defaults. An application replaces any of them with\n// setMessages(), once at startup and again when its language changes. Components read them through\n// getMessages(), which is reactive: setMessages() updates the components already on screen.\nimport { createSubscriber } from 'svelte/reactivity';\nconst english = {\n close: 'Close',\n color: 'Color',\n colorRed: 'Red',\n colorOrange: 'Orange',\n colorGold: 'Gold',\n colorGreen: 'Green',\n colorBlue: 'Blue',\n colorPurple: 'Purple',\n colorBlack: 'Black',\n colorBrown: 'Brown',\n colorWhite: 'White',\n colorCode: 'Color code',\n eyedropper: 'Eyedropper',\n hue: 'Hue',\n saturation: 'Saturation',\n lightness: 'Lightness',\n saturationValue: 'Saturation and value',\n saturationValueText: ({ s, v }) => `Saturation ${s}%, value ${v}%`,\n fontScaleDefault: 'Default',\n fontScaleLarge: 'Large',\n fontScaleLarger: 'Larger',\n fontScaleLargest: 'Largest',\n fontScaleMax: 'Maximum',\n removeValue: 'Remove',\n pagination: 'Pages',\n previousPage: 'Previous page',\n nextPage: 'Next page',\n page: ({ page }) => `Page ${page}`,\n participants: ({ count }) => (count === 1 ? '1 participant' : `${count} participants`),\n showMore: ({ count }) => `Show ${count} more`,\n searchByName: 'Search by name',\n searchParticipants: 'Search the participants',\n noParticipants: 'No one matches.',\n you: '(you)',\n roleEditor: 'Can edit',\n roleViewer: 'Can view',\n sortAscending: 'Sort ascending',\n sortDescending: 'Sort descending',\n clearSort: 'Clear the sort',\n back: 'Back',\n cancel: 'Cancel',\n confirm: 'Confirm',\n sheetHeight: 'Sheet height',\n actions: 'Actions',\n settings: 'Settings',\n share: 'Share',\n linkShare: 'Link sharing',\n duplicate: 'Duplicate',\n move: 'Move',\n ungroup: 'Ungroup',\n delete: 'Delete',\n expand: 'Expand',\n collapse: 'Collapse',\n filters: 'Filters',\n removeFilter: ({ label }) => `Remove ${label}`,\n more: 'More',\n hide: 'Hide',\n show: 'Show',\n lock: 'Lock',\n unlock: 'Unlock',\n rename: 'Name',\n add: 'Add',\n menu: 'Menu',\n comments: 'Comments',\n noComments: 'No comments yet.',\n openThread: 'Open',\n resolve: 'Resolve',\n reopen: 'Reopen',\n resolved: 'Resolved',\n replies: ({ count }) => (count === 1 ? '1 reply' : `${count} replies`),\n writeComment: 'Write a comment',\n post: 'Post',\n search: 'Search',\n noMatches: 'Nothing matches.',\n versions: 'Versions',\n noVersions: 'No versions yet.',\n restore: 'Restore',\n backToLatest: 'Back to the latest',\n selected: ({ count }) => `${count} selected`,\n run: 'Run',\n running: 'Running',\n keyboardShortcuts: 'Keyboard shortcuts',\n dockHeight: 'Dock height',\n closePanes: 'Close the panels',\n addName: 'Add a name',\n mixed: 'Mixed',\n noAttributes: 'No attributes.',\n attributeName: 'Attribute name',\n attributeValue: 'Value',\n addValue: 'Add a value',\n addAttribute: 'Add an attribute',\n removeAttribute: ({ key }) => `Remove ${key}`,\n locked: 'Locked',\n};\n/** The English defaults */\nexport const defaultMessages = Object.freeze({ ...english });\nlet current = { ...english };\nconst listeners = new Set();\nconst subscribe = createSubscriber((update) => {\n listeners.add(update);\n return () => listeners.delete(update);\n});\n/**\n * Replaces some or all of the strings. The keys that are not given keep their current value; with\n * `{ reset: true }` they return to the English defaults first.\n */\nexport function setMessages(partial, options = {}) {\n current = { ...(options.reset ? defaultMessages : current), ...partial };\n for (const notify of listeners)\n notify();\n}\n/** The strings in effect. Read inside a component or an effect, it tracks later changes. */\nexport function getMessages() {\n subscribe();\n return current;\n}\n","<script lang=\"ts\">\n import '../styles/components.css';\n import type { Snippet } from 'svelte';\n\n // Counter: a count on the solid surface, such as the number of unread items. Its height and its\n // least width are the square of an icon; with two digits it grows sideways only (pad-2xs at the\n // sides). The application rounds 100 and more to \"99+\". The text is a glyph, trimmed to its ink and\n // centred. A ring of two lines in the panel color separates it from an icon it sits on; alone,\n // the ring does not show.\n //\n // <Counter>3</Counter> <Counter>99+</Counter>\n let { children }: { children: Snippet } = $props();\n</script>\n\n<span data-role=\"mark\" data-h=\"icon\" class=\"counter\"><span class=\"t\">{@render children()}</span></span>\n\n<style>.counter {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n min-width: var(--kata-height-icon);\n height: var(--kata-height-icon);\n padding-inline: var(--kata-pad-2xs);\n background: var(--kata-color-solid);\n font-size: var(--kata-text-size-glyph);\n line-height: var(--kata-text-leading-glyph);\n letter-spacing: var(--kata-text-tracking-glyph);\n font-weight: 600;\n color: var(--kata-color-on-solid);\n font-variant-numeric: tabular-nums;\n flex: none;\n box-shadow: 0 0 0 calc(var(--kata-border-width) * 2) var(--kata-color-panel);\n}\n\n.t {\n display: block;\n text-box: trim-both cap alphabetic;\n padding-top: calc(var(--kata-ink-over) * 1em);\n padding-bottom: calc(var(--kata-ink-under) * 1em);\n}</style>\n","<!--\n@lucide/svelte v1.49.0 - ISC\n\nThis source code is licensed under the ISC license.\nSee the LICENSE file in the root directory of this source tree.\n-->\n\n\n<script lang=\"ts\">import Icon from '../Icon.svelte';\nlet props = $props();\nconst iconData = { \"name\": \"arrow-left\", \"size\": 24, \"node\": [[\"path\", { \"d\": \"m12 19-7-7 7-7\" }], [\"path\", { \"d\": \"M19 12H5\" }]] };\n</script>\n\n<!--\n@component\n\nLucide SVG icon component, renders SVG Element with children.\n\n@preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJtMTIgMTktNy03IDctNyIgLz4KICA8cGF0aCBkPSJNMTkgMTJINSIgLz4KPC9zdmc+Cg==) - https://lucide.dev/icons/arrow-left\n@see https://lucide.dev/guide/packages/lucide-svelte - Documentation\n-->\n\n<Icon {...props} icon={iconData} />\n","<!--\n@lucide/svelte v1.49.0 - ISC\n\nThis source code is licensed under the ISC license.\nSee the LICENSE file in the root directory of this source tree.\n-->\n\n\n<script lang=\"ts\">import Icon from '../Icon.svelte';\nlet props = $props();\nconst iconData = { \"name\": \"arrow-up-right\", \"size\": 24, \"node\": [[\"path\", { \"d\": \"M7 7h10v10\" }], [\"path\", { \"d\": \"M7 17 17 7\" }]] };\n</script>\n\n<!--\n@component\n\nLucide SVG icon component, renders SVG Element with children.\n\n@preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNNyA3aDEwdjEwIiAvPgogIDxwYXRoIGQ9Ik03IDE3IDE3IDciIC8+Cjwvc3ZnPgo=) - https://lucide.dev/icons/arrow-up-right\n@see https://lucide.dev/guide/packages/lucide-svelte - Documentation\n-->\n\n<Icon {...props} icon={iconData} />\n","<!--\n@lucide/svelte v1.49.0 - ISC\n\nThis source code is licensed under the ISC license.\nSee the LICENSE file in the root directory of this source tree.\n-->\n\n\n<script lang=\"ts\">import Icon from '../Icon.svelte';\nlet props = $props();\nconst iconData = { \"name\": \"check\", \"size\": 24, \"node\": [[\"path\", { \"d\": \"M20 6 9 17l-5-5\" }]] };\n</script>\n\n<!--\n@component\n\nLucide SVG icon component, renders SVG Element with children.\n\n@preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMjAgNiA5IDE3bC01LTUiIC8+Cjwvc3ZnPgo=) - https://lucide.dev/icons/check\n@see https://lucide.dev/guide/packages/lucide-svelte - Documentation\n-->\n\n<Icon {...props} icon={iconData} />\n","<!--\n@lucide/svelte v1.49.0 - ISC\n\nThis source code is licensed under the ISC license.\nSee the LICENSE file in the root directory of this source tree.\n-->\n\n\n<script lang=\"ts\">import Icon from '../Icon.svelte';\nlet props = $props();\nconst iconData = { \"name\": \"chevron-down\", \"size\": 24, \"node\": [[\"path\", { \"d\": \"m6 9 6 6 6-6\" }]] };\n</script>\n\n<!--\n@component\n\nLucide SVG icon component, renders SVG Element with children.\n\n@preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJtNiA5IDYgNiA2LTYiIC8+Cjwvc3ZnPgo=) - https://lucide.dev/icons/chevron-down\n@see https://lucide.dev/guide/packages/lucide-svelte - Documentation\n-->\n\n<Icon {...props} icon={iconData} />\n","<!--\n@lucide/svelte v1.49.0 - ISC\n\nThis source code is licensed under the ISC license.\nSee the LICENSE file in the root directory of this source tree.\n-->\n\n\n<script lang=\"ts\">import Icon from '../Icon.svelte';\nlet props = $props();\nconst iconData = { \"name\": \"chevron-left\", \"size\": 24, \"node\": [[\"path\", { \"d\": \"m15 18-6-6 6-6\" }]] };\n</script>\n\n<!--\n@component\n\nLucide SVG icon component, renders SVG Element with children.\n\n@preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJtMTUgMTgtNi02IDYtNiIgLz4KPC9zdmc+Cg==) - https://lucide.dev/icons/chevron-left\n@see https://lucide.dev/guide/packages/lucide-svelte - Documentation\n-->\n\n<Icon {...props} icon={iconData} />\n","<!--\n@lucide/svelte v1.49.0 - ISC\n\nThis source code is licensed under the ISC license.\nSee the LICENSE file in the root directory of this source tree.\n-->\n\n\n<script lang=\"ts\">import Icon from '../Icon.svelte';\nlet props = $props();\nconst iconData = { \"name\": \"chevron-right\", \"size\": 24, \"node\": [[\"path\", { \"d\": \"m9 18 6-6-6-6\" }]] };\n</script>\n\n<!--\n@component\n\nLucide SVG icon component, renders SVG Element with children.\n\n@preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJtOSAxOCA2LTYtNi02IiAvPgo8L3N2Zz4K) - https://lucide.dev/icons/chevron-right\n@see https://lucide.dev/guide/packages/lucide-svelte - Documentation\n-->\n\n<Icon {...props} icon={iconData} />\n","<!--\n@lucide/svelte v1.49.0 - ISC\n\nThis source code is licensed under the ISC license.\nSee the LICENSE file in the root directory of this source tree.\n-->\n\n\n<script lang=\"ts\">import Icon from '../Icon.svelte';\nlet props = $props();\nconst iconData = { \"name\": \"circle-alert\", \"size\": 24, \"node\": [[\"circle\", { \"cx\": \"12\", \"cy\": \"12\", \"r\": \"10\" }], [\"line\", { \"x1\": \"12\", \"x2\": \"12\", \"y1\": \"8\", \"y2\": \"12\" }], [\"line\", { \"x1\": \"12\", \"x2\": \"12.01\", \"y1\": \"16\", \"y2\": \"16\" }]], \"aliases\": [\"alert-circle\"] };\n</script>\n\n<!--\n@component\n\nLucide SVG icon component, renders SVG Element with children.\n\n@preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8Y2lyY2xlIGN4PSIxMiIgY3k9IjEyIiByPSIxMCIgLz4KICA8bGluZSB4MT0iMTIiIHgyPSIxMiIgeTE9IjgiIHkyPSIxMiIgLz4KICA8bGluZSB4MT0iMTIiIHgyPSIxMi4wMSIgeTE9IjE2IiB5Mj0iMTYiIC8+Cjwvc3ZnPgo=) - https://lucide.dev/icons/circle-alert\n@see https://lucide.dev/guide/packages/lucide-svelte - Documentation\n-->\n\n<Icon {...props} icon={iconData} />\n","<!--\n@lucide/svelte v1.49.0 - ISC\n\nThis source code is licensed under the ISC license.\nSee the LICENSE file in the root directory of this source tree.\n-->\n\n\n<script lang=\"ts\">import Icon from '../Icon.svelte';\nlet props = $props();\nconst iconData = { \"name\": \"circle-check\", \"size\": 24, \"node\": [[\"circle\", { \"cx\": \"12\", \"cy\": \"12\", \"r\": \"10\" }], [\"path\", { \"d\": \"m16 9-5.5 5.5L8 12\" }]], \"aliases\": [\"check-circle-2\"] };\n</script>\n\n<!--\n@component\n\nLucide SVG icon component, renders SVG Element with children.\n\n@preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8Y2lyY2xlIGN4PSIxMiIgY3k9IjEyIiByPSIxMCIgLz4KICA8cGF0aCBkPSJtMTYgOS01LjUgNS41TDggMTIiIC8+Cjwvc3ZnPgo=) - https://lucide.dev/icons/circle-check\n@see https://lucide.dev/guide/packages/lucide-svelte - Documentation\n-->\n\n<Icon {...props} icon={iconData} />\n","<!--\n@lucide/svelte v1.49.0 - ISC\n\nThis source code is licensed under the ISC license.\nSee the LICENSE file in the root directory of this source tree.\n-->\n\n\n<script lang=\"ts\">import Icon from '../Icon.svelte';\nlet props = $props();\nconst iconData = { \"name\": \"copy\", \"size\": 24, \"node\": [[\"rect\", { \"width\": \"14\", \"height\": \"14\", \"x\": \"8\", \"y\": \"8\", \"rx\": \"2\", \"ry\": \"2\" }], [\"path\", { \"d\": \"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2\" }]] };\n</script>\n\n<!--\n@component\n\nLucide SVG icon component, renders SVG Element with children.\n\n@preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cmVjdCB3aWR0aD0iMTQiIGhlaWdodD0iMTQiIHg9IjgiIHk9IjgiIHJ4PSIyIiByeT0iMiIgLz4KICA8cGF0aCBkPSJNNCAxNmMtMS4xIDAtMi0uOS0yLTJWNGMwLTEuMS45LTIgMi0yaDEwYzEuMSAwIDIgLjkgMiAyIiAvPgo8L3N2Zz4K) - https://lucide.dev/icons/copy\n@see https://lucide.dev/guide/packages/lucide-svelte - Documentation\n-->\n\n<Icon {...props} icon={iconData} />\n","<!--\n@lucide/svelte v1.49.0 - ISC\n\nThis source code is licensed under the ISC license.\nSee the LICENSE file in the root directory of this source tree.\n-->\n\n\n<script lang=\"ts\">import Icon from '../Icon.svelte';\nlet props = $props();\nconst iconData = { \"name\": \"corner-up-right\", \"size\": 24, \"node\": [[\"path\", { \"d\": \"m15 14 5-5-5-5\" }], [\"path\", { \"d\": \"M4 20v-7a4 4 0 0 1 4-4h12\" }]] };\n</script>\n\n<!--\n@component\n\nLucide SVG icon component, renders SVG Element with children.\n\n@preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJtMTUgMTQgNS01LTUtNSIgLz4KICA8cGF0aCBkPSJNNCAyMHYtN2E0IDQgMCAwIDEgNC00aDEyIiAvPgo8L3N2Zz4K) - https://lucide.dev/icons/corner-up-right\n@see https://lucide.dev/guide/packages/lucide-svelte - Documentation\n-->\n\n<Icon {...props} icon={iconData} />\n","<!--\n@lucide/svelte v1.49.0 - ISC\n\nThis source code is licensed under the ISC license.\nSee the LICENSE file in the root directory of this source tree.\n-->\n\n\n<script lang=\"ts\">import Icon from '../Icon.svelte';\nlet props = $props();\nconst iconData = { \"name\": \"ellipsis\", \"size\": 24, \"node\": [[\"circle\", { \"cx\": \"12\", \"cy\": \"12\", \"r\": \"1\" }], [\"circle\", { \"cx\": \"19\", \"cy\": \"12\", \"r\": \"1\" }], [\"circle\", { \"cx\": \"5\", \"cy\": \"12\", \"r\": \"1\" }]], \"aliases\": [\"more-horizontal\"] };\n</script>\n\n<!--\n@component\n\nLucide SVG icon component, renders SVG Element with children.\n\n@preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8Y2lyY2xlIGN4PSIxMiIgY3k9IjEyIiByPSIxIiAvPgogIDxjaXJjbGUgY3g9IjE5IiBjeT0iMTIiIHI9IjEiIC8+CiAgPGNpcmNsZSBjeD0iNSIgY3k9IjEyIiByPSIxIiAvPgo8L3N2Zz4K) - https://lucide.dev/icons/ellipsis\n@see https://lucide.dev/guide/packages/lucide-svelte - Documentation\n-->\n\n<Icon {...props} icon={iconData} />\n","<!--\n@lucide/svelte v1.49.0 - ISC\n\nThis source code is licensed under the ISC license.\nSee the LICENSE file in the root directory of this source tree.\n-->\n\n\n<script lang=\"ts\">import Icon from '../Icon.svelte';\nlet props = $props();\nconst iconData = { \"name\": \"eye\", \"size\": 24, \"node\": [[\"path\", { \"d\": \"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0\" }], [\"circle\", { \"cx\": \"12\", \"cy\": \"12\", \"r\": \"3\" }]] };\n</script>\n\n<!--\n@component\n\nLucide SVG icon component, renders SVG Element with children.\n\n@preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMi4wNjIgMTIuMzQ4YTEgMSAwIDAgMSAwLS42OTYgMTAuNzUgMTAuNzUgMCAwIDEgMTkuODc2IDAgMSAxIDAgMCAxIDAgLjY5NiAxMC43NSAxMC43NSAwIDAgMS0xOS44NzYgMCIgLz4KICA8Y2lyY2xlIGN4PSIxMiIgY3k9IjEyIiByPSIzIiAvPgo8L3N2Zz4K) - https://lucide.dev/icons/eye\n@see https://lucide.dev/guide/packages/lucide-svelte - Documentation\n-->\n\n<Icon {...props} icon={iconData} />\n","<!--\n@lucide/svelte v1.49.0 - ISC\n\nThis source code is licensed under the ISC license.\nSee the LICENSE file in the root directory of this source tree.\n-->\n\n\n<script lang=\"ts\">import Icon from '../Icon.svelte';\nlet props = $props();\nconst iconData = { \"name\": \"eye-off\", \"size\": 24, \"node\": [[\"path\", { \"d\": \"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49\" }], [\"path\", { \"d\": \"M14.084 14.158a3 3 0 0 1-4.242-4.242\" }], [\"path\", { \"d\": \"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143\" }], [\"path\", { \"d\": \"m2 2 20 20\" }]] };\n</script>\n\n<!--\n@component\n\nLucide SVG icon component, renders SVG Element with children.\n\n@preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMTAuNzMzIDUuMDc2YTEwLjc0NCAxMC43NDQgMCAwIDEgMTEuMjA1IDYuNTc1IDEgMSAwIDAgMSAwIC42OTYgMTAuNzQ3IDEwLjc0NyAwIDAgMS0xLjQ0NCAyLjQ5IiAvPgogIDxwYXRoIGQ9Ik0xNC4wODQgMTQuMTU4YTMgMyAwIDAgMS00LjI0Mi00LjI0MiIgLz4KICA8cGF0aCBkPSJNMTcuNDc5IDE3LjQ5OWExMC43NSAxMC43NSAwIDAgMS0xNS40MTctNS4xNTEgMSAxIDAgMCAxIDAtLjY5NiAxMC43NSAxMC43NSAwIDAgMSA0LjQ0Ni01LjE0MyIgLz4KICA8cGF0aCBkPSJtMiAyIDIwIDIwIiAvPgo8L3N2Zz4K) - https://lucide.dev/icons/eye-off\n@see https://lucide.dev/guide/packages/lucide-svelte - Documentation\n-->\n\n<Icon {...props} icon={iconData} />\n","<!--\n@lucide/svelte v1.49.0 - ISC\n\nThis source code is licensed under the ISC license.\nSee the LICENSE file in the root directory of this source tree.\n-->\n\n\n<script lang=\"ts\">import Icon from '../Icon.svelte';\nlet props = $props();\nconst iconData = { \"name\": \"funnel\", \"size\": 24, \"node\": [[\"path\", { \"d\": \"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z\" }]], \"aliases\": [\"filter\"] };\n</script>\n\n<!--\n@component\n\nLucide SVG icon component, renders SVG Element with children.\n\n@preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMTAgMjBhMSAxIDAgMCAwIC41NTMuODk1bDIgMUExIDEgMCAwIDAgMTQgMjF2LTdhMiAyIDAgMCAxIC41MTctMS4zNDFMMjEuNzQgNC42N0ExIDEgMCAwIDAgMjEgM0gzYTEgMSAwIDAgMC0uNzQyIDEuNjdsNy4yMjUgNy45ODlBMiAyIDAgMCAxIDEwIDE0eiIgLz4KPC9zdmc+Cg==) - https://lucide.dev/icons/funnel\n@see https://lucide.dev/guide/packages/lucide-svelte - Documentation\n-->\n\n<Icon {...props} icon={iconData} />\n","<!--\n@lucide/svelte v1.49.0 - ISC\n\nThis source code is licensed under the ISC license.\nSee the LICENSE file in the root directory of this source tree.\n-->\n\n\n<script lang=\"ts\">import Icon from '../Icon.svelte';\nlet props = $props();\nconst iconData = { \"name\": \"globe\", \"size\": 24, \"node\": [[\"circle\", { \"cx\": \"12\", \"cy\": \"12\", \"r\": \"10\" }], [\"path\", { \"d\": \"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20\" }], [\"path\", { \"d\": \"M2 12h20\" }]] };\n</script>\n\n<!--\n@component\n\nLucide SVG icon component, renders SVG Element with children.\n\n@preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8Y2lyY2xlIGN4PSIxMiIgY3k9IjEyIiByPSIxMCIgLz4KICA8cGF0aCBkPSJNMTIgMmExNC41IDE0LjUgMCAwIDAgMCAyMCAxNC41IDE0LjUgMCAwIDAgMC0yMCIgLz4KICA8cGF0aCBkPSJNMiAxMmgyMCIgLz4KPC9zdmc+Cg==) - https://lucide.dev/icons/globe\n@see https://lucide.dev/guide/packages/lucide-svelte - Documentation\n-->\n\n<Icon {...props} icon={iconData} />\n","<!--\n@lucide/svelte v1.49.0 - ISC\n\nThis source code is licensed under the ISC license.\nSee the LICENSE file in the root directory of this source tree.\n-->\n\n\n<script lang=\"ts\">import Icon from '../Icon.svelte';\nlet props = $props();\nconst iconData = { \"name\": \"grip-vertical\", \"size\": 24, \"node\": [[\"circle\", { \"cx\": \"9\", \"cy\": \"12\", \"r\": \"1\" }], [\"circle\", { \"cx\": \"9\", \"cy\": \"5\", \"r\": \"1\" }], [\"circle\", { \"cx\": \"9\", \"cy\": \"19\", \"r\": \"1\" }], [\"circle\", { \"cx\": \"15\", \"cy\": \"12\", \"r\": \"1\" }], [\"circle\", { \"cx\": \"15\", \"cy\": \"5\", \"r\": \"1\" }], [\"circle\", { \"cx\": \"15\", \"cy\": \"19\", \"r\": \"1\" }]] };\n</script>\n\n<!--\n@component\n\nLucide SVG icon component, renders SVG Element with children.\n\n@preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8Y2lyY2xlIGN4PSI5IiBjeT0iMTIiIHI9IjEiIC8+CiAgPGNpcmNsZSBjeD0iOSIgY3k9IjUiIHI9IjEiIC8+CiAgPGNpcmNsZSBjeD0iOSIgY3k9IjE5IiByPSIxIiAvPgogIDxjaXJjbGUgY3g9IjE1IiBjeT0iMTIiIHI9IjEiIC8+CiAgPGNpcmNsZSBjeD0iMTUiIGN5PSI1IiByPSIxIiAvPgogIDxjaXJjbGUgY3g9IjE1IiBjeT0iMTkiIHI9IjEiIC8+Cjwvc3ZnPgo=) - https://lucide.dev/icons/grip-vertical\n@see https://lucide.dev/guide/packages/lucide-svelte - Documentation\n-->\n\n<Icon {...props} icon={iconData} />\n","<!--\n@lucide/svelte v1.49.0 - ISC\n\nThis source code is licensed under the ISC license.\nSee the LICENSE file in the root directory of this source tree.\n-->\n\n\n<script lang=\"ts\">import Icon from '../Icon.svelte';\nlet props = $props();\nconst iconData = { \"name\": \"image\", \"size\": 24, \"node\": [[\"rect\", { \"width\": \"18\", \"height\": \"18\", \"x\": \"3\", \"y\": \"3\", \"rx\": \"2\", \"ry\": \"2\" }], [\"circle\", { \"cx\": \"9\", \"cy\": \"9\", \"r\": \"2\" }], [\"path\", { \"d\": \"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21\" }]] };\n</script>\n\n<!--\n@component\n\nLucide SVG icon component, renders SVG Element with children.\n\n@preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cmVjdCB3aWR0aD0iMTgiIGhlaWdodD0iMTgiIHg9IjMiIHk9IjMiIHJ4PSIyIiByeT0iMiIgLz4KICA8Y2lyY2xlIGN4PSI5IiBjeT0iOSIgcj0iMiIgLz4KICA8cGF0aCBkPSJtMjEgMTUtMy4wODYtMy4wODZhMiAyIDAgMCAwLTIuODI4IDBMNiAyMSIgLz4KPC9zdmc+Cg==) - https://lucide.dev/icons/image\n@see https://lucide.dev/guide/packages/lucide-svelte - Documentation\n-->\n\n<Icon {...props} icon={iconData} />\n","<!--\n@lucide/svelte v1.49.0 - ISC\n\nThis source code is licensed under the ISC license.\nSee the LICENSE file in the root directory of this source tree.\n-->\n\n\n<script lang=\"ts\">import Icon from '../Icon.svelte';\nlet props = $props();\nconst iconData = { \"name\": \"info\", \"size\": 24, \"node\": [[\"circle\", { \"cx\": \"12\", \"cy\": \"12\", \"r\": \"10\" }], [\"path\", { \"d\": \"M12 16v-4\" }], [\"path\", { \"d\": \"M12 8h.01\" }]] };\n</script>\n\n<!--\n@component\n\nLucide SVG icon component, renders SVG Element with children.\n\n@preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8Y2lyY2xlIGN4PSIxMiIgY3k9IjEyIiByPSIxMCIgLz4KICA8cGF0aCBkPSJNMTIgMTZ2LTQiIC8+CiAgPHBhdGggZD0iTTEyIDhoLjAxIiAvPgo8L3N2Zz4K) - https://lucide.dev/icons/info\n@see https://lucide.dev/guide/packages/lucide-svelte - Documentation\n-->\n\n<Icon {...props} icon={iconData} />\n","<!--\n@lucide/svelte v1.49.0 - ISC\n\nThis source code is licensed under the ISC license.\nSee the LICENSE file in the root directory of this source tree.\n-->\n\n\n<script lang=\"ts\">import Icon from '../Icon.svelte';\nlet props = $props();\nconst iconData = { \"name\": \"lock\", \"size\": 24, \"node\": [[\"rect\", { \"width\": \"18\", \"height\": \"11\", \"x\": \"3\", \"y\": \"11\", \"rx\": \"2\", \"ry\": \"2\" }], [\"path\", { \"d\": \"M7 11V7a5 5 0 0 1 10 0v4\" }]] };\n</script>\n\n<!--\n@component\n\nLucide SVG icon component, renders SVG Element with children.\n\n@preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cmVjdCB3aWR0aD0iMTgiIGhlaWdodD0iMTEiIHg9IjMiIHk9IjExIiByeD0iMiIgcnk9IjIiIC8+CiAgPHBhdGggZD0iTTcgMTFWN2E1IDUgMCAwIDEgMTAgMHY0IiAvPgo8L3N2Zz4K) - https://lucide.dev/icons/lock\n@see https://lucide.dev/guide/packages/lucide-svelte - Documentation\n-->\n\n<Icon {...props} icon={iconData} />\n","<!--\n@lucide/svelte v1.49.0 - ISC\n\nThis source code is licensed under the ISC license.\nSee the LICENSE file in the root directory of this source tree.\n-->\n\n\n<script lang=\"ts\">import Icon from '../Icon.svelte';\nlet props = $props();\nconst iconData = { \"name\": \"lock-open\", \"size\": 24, \"node\": [[\"rect\", { \"width\": \"18\", \"height\": \"11\", \"x\": \"3\", \"y\": \"11\", \"rx\": \"2\", \"ry\": \"2\" }], [\"path\", { \"d\": \"M7 11V7a5 5 0 0 1 9.9-1\" }]], \"aliases\": [\"unlock\"] };\n</script>\n\n<!--\n@component\n\nLucide SVG icon component, renders SVG Element with children.\n\n@preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cmVjdCB3aWR0aD0iMTgiIGhlaWdodD0iMTEiIHg9IjMiIHk9IjExIiByeD0iMiIgcnk9IjIiIC8+CiAgPHBhdGggZD0iTTcgMTFWN2E1IDUgMCAwIDEgOS45LTEiIC8+Cjwvc3ZnPgo=) - https://lucide.dev/icons/lock-open\n@see https://lucide.dev/guide/packages/lucide-svelte - Documentation\n-->\n\n<Icon {...props} icon={iconData} />\n","<!--\n@lucide/svelte v1.49.0 - ISC\n\nThis source code is licensed under the ISC license.\nSee the LICENSE file in the root directory of this source tree.\n-->\n\n\n<script lang=\"ts\">import Icon from '../Icon.svelte';\nlet props = $props();\nconst iconData = { \"name\": \"pencil\", \"size\": 24, \"node\": [[\"path\", { \"d\": \"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z\" }], [\"path\", { \"d\": \"m15 5 4 4\" }]] };\n</script>\n\n<!--\n@component\n\nLucide SVG icon component, renders SVG Element with children.\n\n@preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMjEuMTc0IDYuODEyYTEgMSAwIDAgMC0zLjk4Ni0zLjk4N0wzLjg0MiAxNi4xNzRhMiAyIDAgMCAwLS41LjgzbC0xLjMyMSA0LjM1MmEuNS41IDAgMCAwIC42MjMuNjIybDQuMzUzLTEuMzJhMiAyIDAgMCAwIC44My0uNDk3eiIgLz4KICA8cGF0aCBkPSJtMTUgNSA0IDQiIC8+Cjwvc3ZnPgo=) - https://lucide.dev/icons/pencil\n@see https://lucide.dev/guide/packages/lucide-svelte - Documentation\n-->\n\n<Icon {...props} icon={iconData} />\n","<!--\n@lucide/svelte v1.49.0 - ISC\n\nThis source code is licensed under the ISC license.\nSee the LICENSE file in the root directory of this source tree.\n-->\n\n\n<script lang=\"ts\">import Icon from '../Icon.svelte';\nlet props = $props();\nconst iconData = { \"name\": \"pipette\", \"size\": 24, \"node\": [[\"path\", { \"d\": \"m12 9-8.414 8.414A2 2 0 0 0 3 18.828v1.344a2 2 0 0 1-.586 1.414A2 2 0 0 1 3.828 21h1.344a2 2 0 0 0 1.414-.586L15 12\" }], [\"path\", { \"d\": \"m18 9 .4.4a1 1 0 1 1-3 3l-3.8-3.8a1 1 0 1 1 3-3l.4.4 3.4-3.4a1 1 0 1 1 3 3z\" }], [\"path\", { \"d\": \"m2 22 .414-.414\" }]] };\n</script>\n\n<!--\n@component\n\nLucide SVG icon component, renders SVG Element with children.\n\n@preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJtMTIgOS04LjQxNCA4LjQxNEEyIDIgMCAwIDAgMyAxOC44Mjh2MS4zNDRhMiAyIDAgMCAxLS41ODYgMS40MTRBMiAyIDAgMCAxIDMuODI4IDIxaDEuMzQ0YTIgMiAwIDAgMCAxLjQxNC0uNTg2TDE1IDEyIiAvPgogIDxwYXRoIGQ9Im0xOCA5IC40LjRhMSAxIDAgMSAxLTMgM2wtMy44LTMuOGExIDEgMCAxIDEgMy0zbC40LjQgMy40LTMuNGExIDEgMCAxIDEgMyAzeiIgLz4KICA8cGF0aCBkPSJtMiAyMiAuNDE0LS40MTQiIC8+Cjwvc3ZnPgo=) - https://lucide.dev/icons/pipette\n@see https://lucide.dev/guide/packages/lucide-svelte - Documentation\n-->\n\n<Icon {...props} icon={iconData} />\n","<!--\n@lucide/svelte v1.49.0 - ISC\n\nThis source code is licensed under the ISC license.\nSee the LICENSE file in the root directory of this source tree.\n-->\n\n\n<script lang=\"ts\">import Icon from '../Icon.svelte';\nlet props = $props();\nconst iconData = { \"name\": \"plus\", \"size\": 24, \"node\": [[\"path\", { \"d\": \"M5 12h14\" }], [\"path\", { \"d\": \"M12 5v14\" }]] };\n</script>\n\n<!--\n@component\n\nLucide SVG icon component, renders SVG Element with children.\n\n@preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNNSAxMmgxNCIgLz4KICA8cGF0aCBkPSJNMTIgNXYxNCIgLz4KPC9zdmc+Cg==) - https://lucide.dev/icons/plus\n@see https://lucide.dev/guide/packages/lucide-svelte - Documentation\n-->\n\n<Icon {...props} icon={iconData} />\n","<!--\n@lucide/svelte v1.49.0 - ISC\n\nThis source code is licensed under the ISC license.\nSee the LICENSE file in the root directory of this source tree.\n-->\n\n\n<script lang=\"ts\">import Icon from '../Icon.svelte';\nlet props = $props();\nconst iconData = { \"name\": \"search\", \"size\": 24, \"node\": [[\"path\", { \"d\": \"m21 21-4.34-4.34\" }], [\"circle\", { \"cx\": \"11\", \"cy\": \"11\", \"r\": \"8\" }]] };\n</script>\n\n<!--\n@component\n\nLucide SVG icon component, renders SVG Element with children.\n\n@preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJtMjEgMjEtNC4zNC00LjM0IiAvPgogIDxjaXJjbGUgY3g9IjExIiBjeT0iMTEiIHI9IjgiIC8+Cjwvc3ZnPgo=) - https://lucide.dev/icons/search\n@see https://lucide.dev/guide/packages/lucide-svelte - Documentation\n-->\n\n<Icon {...props} icon={iconData} />\n","<!--\n@lucide/svelte v1.49.0 - ISC\n\nThis source code is licensed under the ISC license.\nSee the LICENSE file in the root directory of this source tree.\n-->\n\n\n<script lang=\"ts\">import Icon from '../Icon.svelte';\nlet props = $props();\nconst iconData = { \"name\": \"settings-2\", \"size\": 24, \"node\": [[\"path\", { \"d\": \"M14 17H5\" }], [\"path\", { \"d\": \"M19 7h-9\" }], [\"circle\", { \"cx\": \"17\", \"cy\": \"17\", \"r\": \"3\" }], [\"circle\", { \"cx\": \"7\", \"cy\": \"7\", \"r\": \"3\" }]] };\n</script>\n\n<!--\n@component\n\nLucide SVG icon component, renders SVG Element with children.\n\n@preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMTQgMTdINSIgLz4KICA8cGF0aCBkPSJNMTkgN2gtOSIgLz4KICA8Y2lyY2xlIGN4PSIxNyIgY3k9IjE3IiByPSIzIiAvPgogIDxjaXJjbGUgY3g9IjciIGN5PSI3IiByPSIzIiAvPgo8L3N2Zz4K) - https://lucide.dev/icons/settings-2\n@see https://lucide.dev/guide/packages/lucide-svelte - Documentation\n-->\n\n<Icon {...props} icon={iconData} />\n","<!--\n@lucide/svelte v1.49.0 - ISC\n\nThis source code is licensed under the ISC license.\nSee the LICENSE file in the root directory of this source tree.\n-->\n\n\n<script lang=\"ts\">import Icon from '../Icon.svelte';\nlet props = $props();\nconst iconData = { \"name\": \"share-2\", \"size\": 24, \"node\": [[\"circle\", { \"cx\": \"18\", \"cy\": \"5\", \"r\": \"3\" }], [\"circle\", { \"cx\": \"6\", \"cy\": \"12\", \"r\": \"3\" }], [\"circle\", { \"cx\": \"18\", \"cy\": \"19\", \"r\": \"3\" }], [\"line\", { \"x1\": \"8.59\", \"x2\": \"15.42\", \"y1\": \"13.51\", \"y2\": \"17.49\" }], [\"line\", { \"x1\": \"15.41\", \"x2\": \"8.59\", \"y1\": \"6.51\", \"y2\": \"10.49\" }]] };\n</script>\n\n<!--\n@component\n\nLucide SVG icon component, renders SVG Element with children.\n\n@preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8Y2lyY2xlIGN4PSIxOCIgY3k9IjUiIHI9IjMiIC8+CiAgPGNpcmNsZSBjeD0iNiIgY3k9IjEyIiByPSIzIiAvPgogIDxjaXJjbGUgY3g9IjE4IiBjeT0iMTkiIHI9IjMiIC8+CiAgPGxpbmUgeDE9IjguNTkiIHgyPSIxNS40MiIgeTE9IjEzLjUxIiB5Mj0iMTcuNDkiIC8+CiAgPGxpbmUgeDE9IjE1LjQxIiB4Mj0iOC41OSIgeTE9IjYuNTEiIHkyPSIxMC40OSIgLz4KPC9zdmc+Cg==) - https://lucide.dev/icons/share-2\n@see https://lucide.dev/guide/packages/lucide-svelte - Documentation\n-->\n\n<Icon {...props} icon={iconData} />\n","<!--\n@lucide/svelte v1.49.0 - ISC\n\nThis source code is licensed under the ISC license.\nSee the LICENSE file in the root directory of this source tree.\n-->\n\n\n<script lang=\"ts\">import Icon from '../Icon.svelte';\nlet props = $props();\nconst iconData = { \"name\": \"trash\", \"size\": 24, \"node\": [[\"path\", { \"d\": \"M10 11v6\" }], [\"path\", { \"d\": \"M14 11v6\" }], [\"path\", { \"d\": \"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6\" }], [\"path\", { \"d\": \"M3 6h18\" }], [\"path\", { \"d\": \"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2\" }]], \"aliases\": [\"trash-2\"] };\n</script>\n\n<!--\n@component\n\nLucide SVG icon component, renders SVG Element with children.\n\n@preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMTAgMTF2NiIgLz4KICA8cGF0aCBkPSJNMTQgMTF2NiIgLz4KICA8cGF0aCBkPSJNMTkgNnYxNGEyIDIgMCAwIDEtMiAySDdhMiAyIDAgMCAxLTItMlY2IiAvPgogIDxwYXRoIGQ9Ik0zIDZoMTgiIC8+CiAgPHBhdGggZD0iTTggNlY0YTIgMiAwIDAgMSAyLTJoNGEyIDIgMCAwIDEgMiAydjIiIC8+Cjwvc3ZnPgo=) - https://lucide.dev/icons/trash\n@see https://lucide.dev/guide/packages/lucide-svelte - Documentation\n-->\n\n<Icon {...props} icon={iconData} />\n","<!--\n@lucide/svelte v1.49.0 - ISC\n\nThis source code is licensed under the ISC license.\nSee the LICENSE file in the root directory of this source tree.\n-->\n\n\n<script lang=\"ts\">import Icon from '../Icon.svelte';\nlet props = $props();\nconst iconData = { \"name\": \"triangle-alert\", \"size\": 24, \"node\": [[\"path\", { \"d\": \"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3\" }], [\"path\", { \"d\": \"M12 9v4\" }], [\"path\", { \"d\": \"M12 17h.01\" }]], \"aliases\": [\"alert-triangle\"] };\n</script>\n\n<!--\n@component\n\nLucide SVG icon component, renders SVG Element with children.\n\n@preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJtMjEuNzMgMTgtOC0xNGEyIDIgMCAwIDAtMy40OCAwbC04IDE0QTIgMiAwIDAgMCA0IDIxaDE2YTIgMiAwIDAgMCAxLjczLTMiIC8+CiAgPHBhdGggZD0iTTEyIDl2NCIgLz4KICA8cGF0aCBkPSJNMTIgMTdoLjAxIiAvPgo8L3N2Zz4K) - https://lucide.dev/icons/triangle-alert\n@see https://lucide.dev/guide/packages/lucide-svelte - Documentation\n-->\n\n<Icon {...props} icon={iconData} />\n","<!--\n@lucide/svelte v1.49.0 - ISC\n\nThis source code is licensed under the ISC license.\nSee the LICENSE file in the root directory of this source tree.\n-->\n\n\n<script lang=\"ts\">import Icon from '../Icon.svelte';\nlet props = $props();\nconst iconData = { \"name\": \"undo-2\", \"size\": 24, \"node\": [[\"path\", { \"d\": \"M9 14 4 9l5-5\" }], [\"path\", { \"d\": \"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11\" }]] };\n</script>\n\n<!--\n@component\n\nLucide SVG icon component, renders SVG Element with children.\n\n@preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNOSAxNCA0IDlsNS01IiAvPgogIDxwYXRoIGQ9Ik00IDloMTAuNWE1LjUgNS41IDAgMCAxIDUuNSA1LjVhNS41IDUuNSAwIDAgMS01LjUgNS41SDExIiAvPgo8L3N2Zz4K) - https://lucide.dev/icons/undo-2\n@see https://lucide.dev/guide/packages/lucide-svelte - Documentation\n-->\n\n<Icon {...props} icon={iconData} />\n","<!--\n@lucide/svelte v1.49.0 - ISC\n\nThis source code is licensed under the ISC license.\nSee the LICENSE file in the root directory of this source tree.\n-->\n\n\n<script lang=\"ts\">import Icon from '../Icon.svelte';\nlet props = $props();\nconst iconData = { \"name\": \"ungroup\", \"size\": 24, \"node\": [[\"rect\", { \"x\": \"11\", \"y\": \"14\", \"width\": \"10\", \"height\": \"7\", \"rx\": \"2\" }], [\"rect\", { \"x\": \"3\", \"y\": \"3\", \"width\": \"10\", \"height\": \"7\", \"rx\": \"2\" }]] };\n</script>\n\n<!--\n@component\n\nLucide SVG icon component, renders SVG Element with children.\n\n@preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cmVjdCB4PSIxMSIgeT0iMTQiIHdpZHRoPSIxMCIgaGVpZ2h0PSI3IiByeD0iMiIgLz4KICA8cmVjdCB4PSIzIiB5PSIzIiB3aWR0aD0iMTAiIGhlaWdodD0iNyIgcng9IjIiIC8+Cjwvc3ZnPgo=) - https://lucide.dev/icons/ungroup\n@see https://lucide.dev/guide/packages/lucide-svelte - Documentation\n-->\n\n<Icon {...props} icon={iconData} />\n","<!--\n@lucide/svelte v1.49.0 - ISC\n\nThis source code is licensed under the ISC license.\nSee the LICENSE file in the root directory of this source tree.\n-->\n\n\n<script lang=\"ts\">import Icon from '../Icon.svelte';\nlet props = $props();\nconst iconData = { \"name\": \"x\", \"size\": 24, \"node\": [[\"path\", { \"d\": \"M18 6 6 18\" }], [\"path\", { \"d\": \"m6 6 12 12\" }]] };\n</script>\n\n<!--\n@component\n\nLucide SVG icon component, renders SVG Element with children.\n\n@preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMTggNiA2IDE4IiAvPgogIDxwYXRoIGQ9Im02IDYgMTIgMTIiIC8+Cjwvc3ZnPgo=) - https://lucide.dev/icons/x\n@see https://lucide.dev/guide/packages/lucide-svelte - Documentation\n-->\n\n<Icon {...props} icon={iconData} />\n","<script lang=\"ts\">\n // An arrow: a line with a dot at its tail and a filled triangle at its head (Lucide's\n // arrow-up-right reads as an external link).\n // A 24-unit grid like Lucide's; Icon passes the class that sizes it.\n let {\n size = 24,\n strokeWidth = 1.75,\n style,\n class: cls,\n }: { size?: number; strokeWidth?: number; style?: string; class?: string } = $props();\n</script>\n\n<svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width={size}\n height={size}\n {style}\n class={cls}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width={strokeWidth}\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n>\n <line x1=\"4\" y1=\"20\" x2=\"16.5\" y2=\"7.5\" />\n <circle cx=\"4\" cy=\"20\" r=\"1.7\" fill=\"currentColor\" stroke=\"none\" />\n <polygon points=\"21 3 19.2 11.2 12.8 4.8\" fill=\"currentColor\" stroke=\"none\" />\n</svg>\n","<script lang=\"ts\">\n // A point: a small filled circle, as a drawing tool draws a point. It differs from the circle\n // tool (a hollow ring) by fill and size.\n // A 24-unit grid like Lucide's; Icon passes the class that sizes it.\n let {\n size = 24,\n strokeWidth = 1.75,\n style,\n class: cls,\n }: { size?: number; strokeWidth?: number; style?: string; class?: string } = $props();\n</script>\n\n<svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width={size}\n height={size}\n {style}\n class={cls}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n aria-hidden=\"true\"\n>\n <circle cx=\"12\" cy=\"12\" r=\"5.5\" fill=\"currentColor\" />\n</svg>\n","<script lang=\"ts\">\n // An irregular polygon with its vertices shown as dots, so that it does not read as a square.\n // A 24-unit grid like Lucide's; Icon passes the class that sizes it.\n let {\n size = 24,\n strokeWidth = 1.75,\n style,\n class: cls,\n }: { size?: number; strokeWidth?: number; style?: string; class?: string } = $props();\n</script>\n\n<svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width={size}\n height={size}\n {style}\n class={cls}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width={strokeWidth}\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n>\n <polygon points=\"11 3 21 9 17 21 6 20 3 9\" />\n <circle cx=\"11\" cy=\"3\" r=\"1.7\" fill=\"currentColor\" stroke=\"none\" />\n <circle cx=\"21\" cy=\"9\" r=\"1.7\" fill=\"currentColor\" stroke=\"none\" />\n <circle cx=\"17\" cy=\"21\" r=\"1.7\" fill=\"currentColor\" stroke=\"none\" />\n <circle cx=\"6\" cy=\"20\" r=\"1.7\" fill=\"currentColor\" stroke=\"none\" />\n <circle cx=\"3\" cy=\"9\" r=\"1.7\" fill=\"currentColor\" stroke=\"none\" />\n</svg>\n","<script lang=\"ts\">\n // A polyline: straight segments between vertices, with the vertices shown as dots.\n // A 24-unit grid like Lucide's; Icon passes the class that sizes it.\n let {\n size = 24,\n strokeWidth = 1.75,\n style,\n class: cls,\n }: { size?: number; strokeWidth?: number; style?: string; class?: string } = $props();\n</script>\n\n<svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width={size}\n height={size}\n {style}\n class={cls}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width={strokeWidth}\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n>\n <polyline points=\"3 17 8 11 14 14 21 6\" />\n <circle cx=\"3\" cy=\"17\" r=\"1.7\" fill=\"currentColor\" stroke=\"none\" />\n <circle cx=\"8\" cy=\"11\" r=\"1.7\" fill=\"currentColor\" stroke=\"none\" />\n <circle cx=\"14\" cy=\"14\" r=\"1.7\" fill=\"currentColor\" stroke=\"none\" />\n <circle cx=\"21\" cy=\"6\" r=\"1.7\" fill=\"currentColor\" stroke=\"none\" />\n</svg>\n","<script lang=\"ts\">\n // A sticky note: a square with a folded corner and two lines of writing.\n // A 24-unit grid like Lucide's; Icon passes the class that sizes it.\n let {\n size = 24,\n strokeWidth = 1.75,\n style,\n class: cls,\n }: { size?: number; strokeWidth?: number; style?: string; class?: string } = $props();\n</script>\n\n<svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width={size}\n height={size}\n {style}\n class={cls}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width={strokeWidth}\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n>\n <path d=\"M5 3h14a2 2 0 0 1 2 2v9l-7 7H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2Z\" />\n <path d=\"M21 14h-5a2 2 0 0 0-2 2v5\" />\n <line x1=\"8\" y1=\"8.5\" x2=\"17\" y2=\"8.5\" />\n <line x1=\"8\" y1=\"12.5\" x2=\"13\" y2=\"12.5\" />\n</svg>\n","// The icons that the components draw on their own, by name. Each Lucide icon is imported on its own\n// so that a bundle keeps only the icons in use. The drawing glyphs (point, polyline, polygon, arrow,\n// sticky-note) are kata's own, drawn on the same grid, for the shapes Lucide does not have.\n//\n// Icon and the components that take an icon accept a name from this list or any icon component\n// (a Lucide icon, or a component that accepts `class`).\nimport ArrowLeft from '@lucide/svelte/icons/arrow-left';\nimport ArrowUpRight from '@lucide/svelte/icons/arrow-up-right';\nimport Check from '@lucide/svelte/icons/check';\nimport ChevronDown from '@lucide/svelte/icons/chevron-down';\nimport ChevronLeft from '@lucide/svelte/icons/chevron-left';\nimport ChevronRight from '@lucide/svelte/icons/chevron-right';\nimport CircleAlert from '@lucide/svelte/icons/circle-alert';\nimport CircleCheck from '@lucide/svelte/icons/circle-check';\nimport Copy from '@lucide/svelte/icons/copy';\nimport CornerUpRight from '@lucide/svelte/icons/corner-up-right';\nimport Ellipsis from '@lucide/svelte/icons/ellipsis';\nimport Eye from '@lucide/svelte/icons/eye';\nimport EyeOff from '@lucide/svelte/icons/eye-off';\nimport Funnel from '@lucide/svelte/icons/funnel';\nimport Globe from '@lucide/svelte/icons/globe';\nimport GripVertical from '@lucide/svelte/icons/grip-vertical';\nimport Image from '@lucide/svelte/icons/image';\nimport Info from '@lucide/svelte/icons/info';\nimport Lock from '@lucide/svelte/icons/lock';\nimport LockOpen from '@lucide/svelte/icons/lock-open';\nimport Pencil from '@lucide/svelte/icons/pencil';\nimport Pipette from '@lucide/svelte/icons/pipette';\nimport Plus from '@lucide/svelte/icons/plus';\nimport Search from '@lucide/svelte/icons/search';\nimport Settings2 from '@lucide/svelte/icons/settings-2';\nimport Share2 from '@lucide/svelte/icons/share-2';\nimport Trash2 from '@lucide/svelte/icons/trash-2';\nimport TriangleAlert from '@lucide/svelte/icons/triangle-alert';\nimport Undo2 from '@lucide/svelte/icons/undo-2';\nimport Ungroup from '@lucide/svelte/icons/ungroup';\nimport X from '@lucide/svelte/icons/x';\nimport Arrow from './glyphs/Arrow.svelte';\nimport Point from './glyphs/Point.svelte';\nimport Polygon from './glyphs/Polygon.svelte';\nimport Polyline from './glyphs/Polyline.svelte';\nimport StickyNote from './glyphs/StickyNote.svelte';\nexport const icons = {\n 'arrow-left': ArrowLeft,\n 'arrow-up-right': ArrowUpRight,\n check: Check,\n 'chevron-down': ChevronDown,\n 'chevron-left': ChevronLeft,\n 'chevron-right': ChevronRight,\n 'circle-alert': CircleAlert,\n 'circle-check': CircleCheck,\n copy: Copy,\n 'corner-up-right': CornerUpRight,\n ellipsis: Ellipsis,\n funnel: Funnel,\n globe: Globe,\n 'grip-vertical': GripVertical,\n image: Image,\n info: Info,\n pencil: Pencil,\n pipette: Pipette,\n plus: Plus,\n search: Search,\n 'settings-2': Settings2,\n 'share-2': Share2,\n 'trash-2': Trash2,\n 'triangle-alert': TriangleAlert,\n ungroup: Ungroup,\n x: X,\n eye: Eye,\n 'eye-off': EyeOff,\n lock: Lock,\n 'lock-open': LockOpen,\n 'undo-2': Undo2,\n point: Point,\n polyline: Polyline,\n polygon: Polygon,\n arrow: Arrow,\n 'sticky-note': StickyNote,\n};\n/** The component for a name or a component */\nexport function iconComponent(source) {\n return typeof source === 'string' ? icons[source] : source;\n}\n","<script lang=\"ts\">\n import '../styles/components.css';\n import { type IconSource, iconComponent } from '../icons.js';\n\n // Icon: a line icon, a square of the root size, in the current text color. In a list item or a\n // line of text it is centred by the flex layout; its white space is never cancelled with a\n // negative margin. A button with an icon and no text is an icon button with an aria-label.\n //\n // <Icon name=\"image\" /> <Icon name={Search} tone=\"muted\" />\n let {\n name,\n tone,\n }: {\n /** A name from the icons list, or an icon component */\n name: IconSource;\n /** A hue (blue: in progress or done, yellow: warning, red: failure, green: success) or muted */\n tone?: 'blue' | 'yellow' | 'red' | 'green' | 'muted';\n } = $props();\n const Cmp = $derived(iconComponent(name));\n</script>\n\n<Cmp class={tone ? `kata-icon tone-${tone}` : 'kata-icon'} />\n\n<style>:global(svg.kata-icon) {\n width: var(--kata-height-icon);\n height: var(--kata-height-icon);\n flex: none;\n stroke-width: 1.5;\n display: block;\n}\n\n:global(svg.kata-icon.tone-blue) {\n color: var(--kata-color-blue-ink);\n}\n\n:global(svg.kata-icon.tone-yellow) {\n color: var(--kata-color-yellow-ink);\n}\n\n:global(svg.kata-icon.tone-red) {\n color: var(--kata-color-red-ink);\n}\n\n:global(svg.kata-icon.tone-green) {\n color: var(--kata-color-green-ink);\n}\n\n:global(svg.kata-icon.tone-muted) {\n color: var(--kata-color-muted);\n}</style>\n","// The element that kata puts things into when they have to leave the component that shows them:\n// the tooltips (Tooltip, clampTip) and the hidden probes that measure a token.\n//\n// On a page that kata owns, it is the body. When kata is embedded in a page it does not own, the\n// tokens are scoped to a root element instead of :root, and that root declares itself with the\n// attribute data-kata-root: everything kata appends outside a component goes into the nearest such\n// root, where the tokens, the language and the theme apply.\n//\n// <div class=\"app-root\" data-kata-root lang=\"en\">…</div>\n/** The attribute that marks the root element of kata embedded in a page it does not own */\nexport const KATA_ROOT_ATTRIBUTE = 'data-kata-root';\n/**\n * The host of what kata appends outside a component on behalf of an element: the nearest ancestor\n * (or the element itself) with data-kata-root, else the body.\n */\nexport function hostOf(el) {\n return el?.closest(`[${KATA_ROOT_ATTRIBUTE}]`) ?? document.body;\n}\n","// Places a tooltip next to its anchor. The description tooltip and the full text of a clipped line\n// (clampTip) share this one rule.\n//\n// The tooltip goes above the anchor, centred, gap-sm away. When it does not fit above it goes below,\n// then to the right, then to the left; it never covers the anchor or the pointer. Below, the gap is\n// gap-lg, because the pointer's image hangs about one line below its hot spot.\n//\n// \"Fits\" means inside the nearest ancestor with data-tip-bounds, or inside the window. The distances\n// are read from the tokens at run time, so they follow the text size setting.\nimport { hostOf } from './host.js';\n/**\n * Where to insert the tooltip: the host of its anchor (hostOf: the nearest data-kata-root, else the\n * body). Inside an open modal dialog that is in the host it goes into the dialog: a dialog opened\n * with showModal() is drawn in the top layer, above everything in the body whatever its z-index.\n */\nexport function tipHost(anchorEl) {\n const host = hostOf(anchorEl);\n const dialog = anchorEl?.closest('dialog[open]');\n return dialog && host.contains(dialog) ? dialog : host;\n}\n/**\n * The rectangle a pointer can hit. A borderless icon button is hit in the square of a small button,\n * which is larger than the icon it shows, so its visible rectangle is grown to that square.\n */\nexport function hitRect(el, role) {\n const r = el.getBoundingClientRect();\n if (role !== 'icon-button')\n return r;\n const h = tokenPx('--kata-height-button-sm', el);\n const top = Math.min(r.top, r.top + r.height / 2 - h / 2);\n const left = Math.min(r.left, r.left + r.width / 2 - h / 2);\n return new DOMRect(left, top, Math.max(r.width, h), Math.max(r.height, h));\n}\n/** The rectangle of the nearest ancestor with data-tip-bounds, or undefined for the window */\nexport function tipBounds(anchorEl) {\n return anchorEl.closest('[data-tip-bounds]')?.getBoundingClientRect();\n}\n/**\n * The length of a token in px, measured with a hidden element, so that calc and rem resolve. The\n * probe goes into the host of the element it measures for, where the tokens are defined.\n */\nexport function tokenPx(name, context) {\n const probe = document.createElement('div');\n probe.style.cssText = `position:fixed;left:-9999px;top:0;width:0;visibility:hidden;height:var(${name})`;\n hostOf(context).appendChild(probe);\n const h = probe.getBoundingClientRect().height;\n probe.remove();\n return h;\n}\nconst clamp = (v, min, max) => Math.max(min, Math.min(v, max));\n/**\n * Places a tooltip (an element with position: fixed) outside its anchor and returns the side it\n * chose.\n */\nexport function placeTip(node, anchor, bounds) {\n const gap = tokenPx('--kata-gap-sm', node);\n const gapDown = tokenPx('--kata-gap-lg', node);\n // Fix the position before measuring; the width is bounded by max-width, so the height does not\n // depend on where it is measured\n node.style.position = 'fixed';\n node.style.left = '0px';\n node.style.top = '0px';\n const t = node.getBoundingClientRect();\n const bx = Math.max(0, bounds?.left ?? 0);\n const by = Math.max(0, bounds?.top ?? 0);\n const vw = Math.min(window.innerWidth, bounds?.right ?? Number.POSITIVE_INFINITY);\n const vh = Math.min(window.innerHeight, bounds?.bottom ?? Number.POSITIVE_INFINITY);\n const cx = anchor.left + anchor.width / 2 - t.width / 2;\n const cy = anchor.top + anchor.height / 2 - t.height / 2;\n const candidates = [\n {\n side: 'top',\n left: cx,\n top: anchor.top - t.height - gap,\n fits: anchor.top - t.height - gap >= by + gap,\n },\n {\n side: 'bottom',\n left: cx,\n top: anchor.bottom + gapDown,\n fits: anchor.bottom + gapDown + t.height <= vh - gap,\n },\n {\n side: 'right',\n left: anchor.right + gap,\n top: cy,\n fits: anchor.right + gap + t.width <= vw - gap,\n },\n {\n side: 'left',\n left: anchor.left - t.width - gap,\n top: cy,\n fits: anchor.left - t.width - gap >= bx + gap,\n },\n ];\n // Nothing fits only when the window is narrower than the tooltip: take the side with more room\n const fallback = anchor.top > vh - anchor.bottom ? candidates[0] : candidates[1];\n const pick = candidates.find((c) => c.fits) ?? fallback;\n node.style.left = `${clamp(pick.left, bx + gap, Math.max(bx + gap, vw - gap - t.width))}px`;\n node.style.top = `${clamp(pick.top, by + gap, Math.max(by + gap, vh - gap - t.height))}px`;\n return pick.side;\n}\n","<script lang=\"ts\">\n import '../styles/components.css';\n import { type Snippet, untrack } from 'svelte';\n import type { Action } from 'svelte/action';\n import { hitRect, placeTip, tipBounds, tipHost } from '../lib/tipPlace.js';\n\n // Tooltip: a short word that explains the control it wraps, with an optional key hint. It is the\n // inverse of the page (the text color as the surface), in the caption role, as high as a small\n // button with pad-sm at the sides. The name belongs to the control inside (its aria-label), so\n // the tooltip is aria-hidden and is not read twice. The application passes the words; the component\n // has none of its own.\n //\n // It shows on hover after a short wait, so a pointer that only passes by does not show it, and\n // at once on keyboard focus. It hides at once: on leaving, on a press, on a scroll and on a\n // resize. It goes above its control, or below, right or left, whichever fits first, and never\n // covers the control. It is moved to the body (or to the open modal dialog it is in, or to the\n // nearest data-kata-root when kata is embedded in a page it does not own), so that no container\n // clips it or moves its reference.\n //\n // The wrapper only holds its content, so it shows the layout the content's role: box for a\n // control with a line, icon-button for a borderless icon button (whose area of the pointer is\n // larger than its icon). inline draws the tooltip beside its control, always shown, for\n // documentation.\n //\n // <Tooltip text=\"Share\" shortcut=\"⇧S\"><Button …>…</Button></Tooltip>\n let {\n text,\n shortcut,\n role = 'block',\n keep = false,\n inline = false,\n children,\n }: {\n /** The word; without it nothing shows */\n text?: string;\n /** A key hint, already written for the platform (⌘Z) */\n shortcut?: string;\n /** The role shown to the layout: box for a control, icon-button for an icon button */\n role?: 'block' | 'box' | 'icon-button';\n /** Copies data-keep to the wrapper, for a container that shows its content only on hover */\n keep?: boolean;\n /** Always shown beside its control, in the flow of the page, for documentation */\n inline?: boolean;\n children: Snippet;\n } = $props();\n\n // The wait before it shows on hover, in ms\n const DELAY = 400;\n\n // Read only in event handlers and actions, never in the template, so it is not state (as state,\n // clearing bind:this while the template tears down would be a write during rendering)\n // svelte-ignore non_reactive_update\n let wrap: HTMLElement | undefined;\n let anchor = $state<DOMRect | null>(null);\n let gone = false;\n let timer: ReturnType<typeof setTimeout> | undefined;\n\n function clearTimer() {\n if (timer === undefined) return;\n clearTimeout(timer);\n timer = undefined;\n }\n\n const hasText = $derived(!!text?.trim());\n function show() {\n clearTimer();\n if (gone || !wrap || !hasText) return;\n anchor = hitRect(wrap, role);\n }\n\n // Also called while the wrapper is being removed (its content leaves the page and fires\n // pointerleave or focusout), so the write is untracked\n function hide() {\n clearTimer();\n if (gone || anchor === null) return;\n untrack(() => {\n anchor = null;\n });\n }\n\n // Keyboard focus only (:focus-visible): a press also focuses, and the tooltip should not stay\n // after it\n const watch: Action<HTMLElement> = (node) => {\n const onEnter = () => {\n clearTimer();\n timer = setTimeout(show, DELAY);\n };\n const onFocusIn = (e: FocusEvent) => {\n if ((e.target as HTMLElement | null)?.matches?.(':focus-visible')) show();\n };\n node.addEventListener('pointerenter', onEnter);\n node.addEventListener('pointerleave', hide);\n node.addEventListener('pointerdown', hide);\n node.addEventListener('focusin', onFocusIn);\n node.addEventListener('focusout', hide);\n return {\n destroy() {\n gone = true;\n clearTimer();\n node.removeEventListener('pointerenter', onEnter);\n node.removeEventListener('pointerleave', hide);\n node.removeEventListener('pointerdown', hide);\n node.removeEventListener('focusin', onFocusIn);\n node.removeEventListener('focusout', hide);\n },\n };\n };\n\n // Moves the tooltip to its host and places it; a scroll or a resize hides it\n const tip: Action<HTMLElement, DOMRect> = (node, rect) => {\n tipHost(wrap).appendChild(node);\n placeTip(node, rect, wrap ? tipBounds(wrap) : undefined);\n const close = () => hide();\n document.addEventListener('scroll', close, true);\n window.addEventListener('resize', close);\n return {\n update(next: DOMRect) {\n placeTip(node, next, wrap ? tipBounds(wrap) : undefined);\n },\n destroy() {\n document.removeEventListener('scroll', close, true);\n window.removeEventListener('resize', close);\n node.remove();\n },\n };\n };\n</script>\n\n{#snippet face()}\n <span class=\"t\">{text}</span>{#if shortcut}<span class=\"kbd\"><span class=\"t\">{shortcut}</span></span>{/if}\n{/snippet}\n\n{#if inline}\n <span class=\"pair\">\n <span class=\"seat\" data-role={role}>{@render children()}</span>\n {#if hasText}<span class=\"tip inline\" data-h=\"button-sm\" aria-hidden=\"true\">{@render face()}</span>{/if}\n </span>\n{:else}\n <span class=\"seat\" data-role={role} data-keep={keep ? '' : undefined} bind:this={wrap} use:watch>\n {@render children()}\n {#if anchor && hasText}\n <span class=\"tip\" data-h=\"button-sm\" aria-hidden=\"true\" use:tip={anchor}>{@render face()}</span>\n {/if}\n </span>\n{/if}\n\n<style>.seat {\n display: inline-flex;\n align-items: center;\n min-width: 0;\n}\n\n.tip {\n position: fixed;\n z-index: var(--kata-z-menu);\n pointer-events: none;\n display: inline-flex;\n align-items: center;\n gap: var(--kata-gap-sm);\n width: max-content;\n flex: none;\n height: var(--kata-height-button-sm);\n padding: 0 var(--kata-pad-sm);\n background: var(--kata-color-text);\n font-size: var(--kata-text-size-caption);\n line-height: var(--kata-text-leading-caption);\n letter-spacing: var(--kata-text-tracking-caption);\n color: var(--kata-color-ground);\n white-space: nowrap;\n}\n\n.pair {\n display: inline-flex;\n align-items: center;\n gap: var(--kata-gap-sm);\n max-width: 100%;\n}\n\n.tip.inline {\n position: static;\n}\n\n.t {\n display: block;\n min-width: 0;\n text-box: trim-both cap alphabetic;\n padding-top: calc(var(--kata-ink-over) * 1em);\n padding-bottom: calc(var(--kata-ink-under) * 1em);\n}\n\n.kbd {\n display: inline-flex;\n align-items: center;\n height: var(--kata-height-badge);\n padding: 0 var(--kata-pad-2xs);\n border: var(--kata-border-width) solid color-mix(in srgb, var(--kata-color-ground) 40%, transparent);\n color: inherit;\n font-family: var(--kata-font-mono);\n white-space: nowrap;\n}\n.kbd > .t {\n font-family: inherit;\n}</style>\n","<script lang=\"ts\">\n import '../styles/components.css';\n import type { Snippet } from 'svelte';\n import type { HTMLAttributes } from 'svelte/elements';\n import type { IconSource } from '../icons.js';\n import Counter from './Counter.svelte';\n import Icon from './Icon.svelte';\n import Tooltip from './Tooltip.svelte';\n\n // Button: a control that is pressed. Its height is the ink of its text, pad-md above and below\n // and a line on each side. Inside a list item, a toolbar or a bar of bulk actions the container\n // declares the small button (pad-sm above and below); the author never writes a size.\n //\n // variant: outline (the default), primary (one per screen), ghost (no line; the surface shows on\n // hover; for icon buttons only, since a text button without a line does not look pressable),\n // danger (a red line) and danger-fill (the primary action of a confirmation). An icon button has\n // no text: icon and an aria-label, and it is a square small button. block is for the primary\n // action of a one-column form. The area that is pressed, the hover surface, the line and the\n // focus ring are all this control's own.\n //\n // <Button variant=\"primary\" onclick={save}>Save</Button>\n // <Button leading=\"plus\">New document</Button> an icon before the text\n // <Button trailing=\"chevron-down\">Sort</Button> the trigger of a menu\n // <Button icon aria-label=\"Close\"><Icon name=\"x\" /></Button>\n // <Button kbd=\"⌘⏎\">Send</Button> a key hint after the text\n // <Button trailing=\"chevron-down\">{#snippet mark()}<Swatch color={c} />{/snippet}#FF0077</Button>\n // <Button icon badge={3} aria-label=\"Notifications\"><Icon name={Bell} /></Button>\n // <Button icon aria-label=\"Undo\" shortcut=\"⌘Z\"><Icon name={Undo} /></Button>\n // <Button tip=\"Export as a file\">Export</Button> a tooltip on a text button\n //\n // The children of a text button are text only; icons go in leading and trailing. An icon button\n // shows its aria-label in a Tooltip, with shortcut as the key hint inside it; tip gives a text\n // button a tooltip, or turns the tooltip of an icon button off (false).\n let {\n variant = 'outline',\n icon = false,\n block = false,\n busy = false,\n disabled = false,\n on = false,\n tone,\n leading,\n trailing,\n kbd,\n mark,\n clamp = false,\n mono = false,\n type = 'button',\n href,\n target,\n onclick,\n shortcut,\n tip,\n badge,\n 'aria-label': ariaLabel,\n children,\n ...rest\n }: Omit<HTMLAttributes<HTMLElement>, 'class' | 'style' | 'onclick'> & {\n variant?: 'outline' | 'primary' | 'ghost' | 'danger' | 'danger-fill';\n /** A square button with an icon and no text; it needs an aria-label */\n icon?: boolean;\n /** The full width of its container */\n block?: boolean;\n /** An action in progress: dimmed and not pressable */\n busy?: boolean;\n disabled?: boolean;\n /** Selected (a tool in a toolbar) */\n on?: boolean;\n /** A ghost button that removes something: its text turns red on hover */\n tone?: 'danger';\n /** An icon before the text */\n leading?: IconSource;\n /** An icon after the text (the chevron of a menu trigger) */\n trailing?: IconSource;\n /** A kbd hint after the text */\n kbd?: string;\n /** A mark of the value before the text (a color swatch), for the trigger of a value */\n mark?: Snippet;\n /** The trigger of a value: the text is one line with an ellipsis */\n clamp?: boolean;\n /** The text in the monospace font (a code, an identifier) */\n mono?: boolean;\n type?: 'button' | 'submit';\n /** Renders a link with the same look */\n href?: string;\n /** Opens the link in another tab; the component adds rel */\n target?: '_blank';\n /** The key hint inside the tooltip */\n shortcut?: string;\n /** The text of the tooltip (an icon button's aria-label by default); false shows none */\n tip?: string | false;\n /** A count over the top right of an icon button; 100 and more shows 99+ */\n badge?: number;\n 'aria-label'?: string;\n onclick?: (e: MouseEvent) => void;\n children: Snippet;\n } = $props();\n const badged = $derived(badge !== undefined && badge > 0);\n const tipText = $derived(tip === false ? undefined : (tip ?? (icon ? ariaLabel : undefined)));\n // A container that shows an icon button only on hover reads data-keep on the wrapper too\n const keep = $derived(rest['data-keep' as keyof typeof rest] !== undefined);\n // A full-width button with a trailing icon is a chooser: the text on the left, the icon at the\n // right end\n const spread = $derived(block && !!trailing);\n</script>\n\n{#snippet inner()}\n {#if icon}{@render children()}{:else}{#if leading}<Icon name={leading} />{:else if mark}{@render mark()}{/if}<span\n class=\"t\"\n class:clamp\n class:mono>{@render children()}</span\n >{#if kbd}<span class=\"kbd t\">{kbd}</span>{/if}{#if trailing}<Icon name={trailing} />{/if}{/if}\n{/snippet}\n\n{#snippet unread()}\n {#if badged}<span class=\"unread\" aria-hidden=\"true\"\n ><Counter>{(badge ?? 0) > 99 ? '99+' : badge}</Counter></span\n >{/if}\n{/snippet}\n\n{#snippet control()}\n {#if href}\n <a\n class=\"btn {variant}\"\n class:icon\n class:block\n class:spread\n class:busy\n class:on\n class:badged\n data-tone={tone}\n data-role=\"box\"\n data-h={icon ? 'icon-button' : 'button'}\n {href}\n {onclick}\n aria-label={ariaLabel}\n {target}\n rel={target ? 'noopener' : undefined}\n {...rest}\n >\n {@render inner()}{@render unread()}\n </a>\n {:else}\n <button\n class=\"btn {variant}\"\n class:icon\n class:block\n class:spread\n class:busy\n class:on\n class:badged\n data-tone={tone}\n data-role=\"box\"\n data-h={icon ? 'icon-button' : 'button'}\n {type}\n disabled={disabled || busy}\n {onclick}\n aria-label={ariaLabel}\n {...rest}\n >\n {@render inner()}{@render unread()}\n </button>\n {/if}\n{/snippet}\n\n{#if tipText}\n <Tooltip text={tipText} {shortcut} role=\"box\" {keep}>{@render control()}</Tooltip>\n{:else}\n {@render control()}\n{/if}\n\n<style>.btn {\n display: inline-flex;\n align-items: center;\n gap: var(--kata-gap-sm);\n height: var(--kata-box, var(--kata-height-button));\n padding-block: 0;\n padding-inline: var(--kata-pad-md);\n border: var(--kata-border-width) solid var(--kata-color-line-strong);\n border-radius: 0;\n background: transparent;\n color: var(--kata-color-text);\n white-space: nowrap;\n font: inherit;\n font-size: var(--kata-text-size-body);\n line-height: var(--kata-text-leading-body);\n letter-spacing: var(--kata-text-tracking-body);\n transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease;\n position: relative;\n color: var(--kata-color-text);\n cursor: pointer;\n text-decoration: none;\n flex: 0 1 auto;\n max-width: 100%;\n}\n.btn:hover {\n background: var(--kata-color-raise);\n text-decoration: none;\n}\n.btn:active {\n background: var(--kata-color-raise-2);\n transition: none;\n}\n.btn:disabled {\n opacity: var(--kata-opacity-dim);\n cursor: default;\n}\n.btn > :global(svg) {\n flex: none;\n}\n.btn .t {\n display: block;\n min-width: 0;\n text-box: trim-both cap alphabetic;\n padding-top: calc(var(--kata-ink-over) * 1em);\n padding-bottom: calc(var(--kata-ink-under) * 1em);\n white-space: nowrap;\n overflow: clip;\n overflow-clip-margin: 0.382em;\n text-overflow: ellipsis;\n min-width: 0;\n}\n.btn .t.mono {\n font-family: var(--kata-font-mono);\n}\n.btn .kbd {\n font-family: var(--kata-font-mono);\n font-size: var(--kata-text-size-caption);\n line-height: var(--kata-text-leading-caption);\n letter-spacing: var(--kata-text-tracking-caption);\n color: var(--kata-color-muted);\n flex: none;\n}\n\n.unread {\n position: absolute;\n left: calc(50% + var(--kata-pad-2xs));\n bottom: calc(50% + var(--kata-pad-2xs));\n pointer-events: none;\n line-height: 0;\n}\n\n.primary {\n background: var(--kata-color-solid);\n border-color: var(--kata-color-solid);\n color: var(--kata-color-on-solid);\n}\n.primary:hover {\n background: var(--kata-color-solid-hover);\n border-color: var(--kata-color-solid-hover);\n}\n.primary:active {\n background: var(--kata-color-solid-active);\n border-color: var(--kata-color-solid-active);\n}\n\n.btn.primary .kbd {\n color: var(--kata-color-on-solid);\n}\n\n.ghost {\n border-color: transparent;\n background: transparent;\n}\n\n.danger {\n color: var(--kata-color-red-ink);\n border-color: var(--kata-color-red-ink);\n}\n.danger:hover {\n background: var(--kata-color-red-wash);\n}\n\n.danger-fill {\n background: var(--kata-color-red-fill);\n border-color: var(--kata-color-red-fill);\n color: var(--kata-color-on-red);\n}\n.danger-fill:hover {\n background: var(--kata-color-red-fill-hover);\n border-color: var(--kata-color-red-fill-hover);\n}\n.danger-fill:active {\n background: var(--kata-color-red-fill-active);\n border-color: var(--kata-color-red-fill-active);\n}\n\n.icon {\n width: var(--kata-height-icon-button);\n height: var(--kata-height-icon-button);\n padding: 0;\n justify-content: center;\n}\n\n.block {\n width: 100%;\n justify-content: center;\n}\n\n.spread {\n justify-content: space-between;\n}\n.spread .t {\n flex: 1 1 auto;\n text-align: start;\n}\n\n.busy {\n opacity: var(--kata-opacity-dim);\n cursor: progress;\n}\n\n.on {\n background: var(--kata-color-raise-2);\n}\n\n.on.icon > :global(svg) {\n color: var(--kata-color-blue-ink);\n}\n\n.ghost[data-tone=danger]:hover:not(:disabled) {\n color: var(--kata-color-red-ink);\n}\n\n.btn[aria-expanded=true][aria-haspopup] {\n background: var(--kata-color-raise);\n}</style>\n","<script lang=\"ts\">\n import '../styles/components.css';\n import type { Snippet } from 'svelte';\n import { tick, untrack } from 'svelte';\n\n // Dropdown: a place that opens below a trigger, for a menu or a small picker. It is a popover, so\n // it shows in the top layer, above everything, also when it opens from inside a modal or a panel.\n //\n // With menu, the content is a list of MenuItem: the place wears the surface of a Menu, has\n // role=\"menu\", focuses the first item when it opens, and the arrow keys, Home and End move the\n // focus between the items. With bare, the content brings its own container (a picker, a list).\n //\n // It is placed from the trigger's rectangle: below it, or above when there is no room below, and\n // pushed inside the window at the sides. A press outside, Escape or Tab closes it; Escape and Tab\n // return the focus to the trigger of a menu.\n //\n // <Dropdown menu>\n // {#snippet trigger(toggle, open)}\n // <Button trailing=\"chevron-down\" aria-haspopup=\"menu\" aria-expanded={open} onclick={toggle}>\n // Sort\n // </Button>\n // {/snippet}\n // {#snippet panel(close)}<MenuItem onclick={close}>Name</MenuItem>{/snippet}\n // </Dropdown>\n let {\n trigger,\n panel,\n align = 'end',\n openInitially = false,\n menuMaxWidth,\n menu = false,\n bare = false,\n block = false,\n role = 'anchor',\n onOpenChange,\n }: {\n /** The trigger; it receives the toggle function and whether the place is open */\n trigger: Snippet<[() => void, boolean]>;\n /** The content; it receives the close function */\n panel: Snippet<[() => void]>;\n /** The edge of the trigger the place lines up with (it moves back inside the window) */\n align?: 'start' | 'end';\n /** Open from the start */\n openInitially?: boolean;\n /** The widest the place gets (a CSS length); long names end with an ellipsis */\n menuMaxWidth?: string;\n /** The content is a list of MenuItem */\n menu?: boolean;\n /** The content has its own container; the place has no surface */\n bare?: boolean;\n /** The trigger is as wide as its container (a list item) */\n block?: boolean;\n /** The role the trigger's wrapper shows to the layout: box for a control, icon-button for an icon button */\n role?: 'anchor' | 'box' | 'icon-button';\n /** Called whenever the place opens or closes, also by a press outside or Escape */\n onOpenChange?: (open: boolean) => void;\n } = $props();\n\n let open = $state(untrack(() => openInitially));\n\n $effect(() => {\n onOpenChange?.(open);\n });\n\n let anchor = $state<HTMLElement>();\n let panelEl = $state<HTMLElement>();\n let placed = $state(false);\n let pos = $state({ top: 0, left: 0, maxHeight: 0 });\n // Focus the first item once the place shows (menus only)\n let focusFirst = false;\n // Where the focus returns when Escape or Tab closes a menu\n let returnFocusEl: HTMLElement | null = null;\n\n // The distance from the trigger, the least distance from the window's edge, and the least height\n // below which the place opens on the other side\n const GAP = 4;\n const EDGE = 8;\n const MIN_HEIGHT = 120;\n\n function place() {\n if (!anchor || !panelEl) return;\n const r = anchor.getBoundingClientRect();\n const vw = window.innerWidth;\n const vh = window.innerHeight;\n const width = panelEl.offsetWidth;\n // The natural height is measured without the limit, or the direction would change each time\n const keep = panelEl.style.maxHeight;\n panelEl.style.maxHeight = '';\n const natural = panelEl.scrollHeight;\n panelEl.style.maxHeight = keep;\n const below = vh - r.bottom - GAP - EDGE;\n const above = r.top - GAP - EDGE;\n const up = below < Math.min(natural, MIN_HEIGHT) && above > below;\n const maxHeight = Math.max(MIN_HEIGHT, up ? above : below);\n const shown = Math.min(natural, maxHeight);\n const top = up ? r.top - GAP - shown : r.bottom + GAP;\n let left = align === 'end' ? r.right - width : r.left;\n left = Math.max(EDGE, Math.min(left, vw - width - EDGE));\n pos = { top: Math.round(top), left: Math.round(left), maxHeight: Math.round(maxHeight) };\n }\n\n function toggle() {\n open = !open;\n if (open) {\n returnFocusEl = menu ? (document.activeElement as HTMLElement | null) : null;\n focusFirst = menu;\n placed = false;\n }\n }\n\n function close() {\n open = false;\n }\n\n // Without the popover API (a test environment) the place is a plain fixed element; the attribute\n // is left out, since [popover] without showPopover() is never shown\n const canPopover =\n typeof HTMLElement !== 'undefined' && typeof HTMLElement.prototype.showPopover === 'function';\n\n function isShown(el: HTMLElement): boolean {\n try {\n return el.matches(':popover-open');\n } catch {\n return false;\n }\n }\n\n // The place is measured once it is open (until then it has no size), and the focus moves once it\n // is visible\n $effect(() => {\n if (!open || !panelEl) return;\n const el = panelEl;\n if (canPopover && !isShown(el)) {\n try {\n el.showPopover();\n } catch {\n // Already open\n }\n }\n void (async () => {\n await tick();\n place();\n placed = true;\n if (!focusFirst) return;\n focusFirst = false;\n await tick();\n focusItemAt(0);\n })();\n });\n\n function menuItems(): HTMLElement[] {\n if (!panelEl) return [];\n return [...panelEl.querySelectorAll<HTMLElement>('[role=\"menuitem\"]')];\n }\n function focusItemAt(index: number) {\n const items = menuItems();\n if (items.length === 0) return;\n items[((index % items.length) + items.length) % items.length]?.focus();\n }\n function closeAndReturnFocus() {\n open = false;\n returnFocusEl?.focus?.();\n }\n\n function onMenuKeyDown(e: KeyboardEvent) {\n if (!menu) return;\n const items = menuItems();\n if (items.length === 0) return;\n const at = items.indexOf(document.activeElement as HTMLElement);\n if (e.key === 'ArrowDown') {\n e.preventDefault();\n focusItemAt(at < 0 ? 0 : at + 1);\n } else if (e.key === 'ArrowUp') {\n e.preventDefault();\n focusItemAt(at < 0 ? items.length - 1 : at - 1);\n } else if (e.key === 'Home') {\n e.preventDefault();\n focusItemAt(0);\n } else if (e.key === 'End') {\n e.preventDefault();\n focusItemAt(items.length - 1);\n } else if (e.key === 'Tab') {\n closeAndReturnFocus();\n }\n }\n\n // A press outside the trigger and the place closes it; read in the capture phase, so that a\n // container that stops propagation does not keep it open\n function onPointerDown(e: PointerEvent) {\n if (!open) return;\n const target = e.target as Node;\n if (anchor?.contains(target) || panelEl?.contains(target)) return;\n open = false;\n }\n\n // Escape closes the place while it is open and goes no further (a modal around it stays open)\n function onKeyDown(e: KeyboardEvent) {\n if (e.key !== 'Escape' || !open) return;\n e.stopPropagation();\n if (menu) closeAndReturnFocus();\n else open = false;\n }\n</script>\n\n<svelte:window\n onkeydowncapture={onKeyDown}\n onpointerdowncapture={onPointerDown}\n onresize={() => open && place()}\n onscroll={() => open && place()}\n/>\n\n<span class=\"anchor\" class:block bind:this={anchor} data-role={role}>\n {@render trigger(toggle, open)}\n</span>\n{#if open}\n <div\n class=\"seat\"\n class:menu={!bare}\n class:placed\n popover={canPopover ? 'manual' : undefined}\n bind:this={panelEl}\n role={menu ? 'menu' : undefined}\n aria-orientation={menu ? 'vertical' : undefined}\n onkeydown={menu ? onMenuKeyDown : undefined}\n style:top={`${pos.top}px`}\n style:left={`${pos.left}px`}\n style:max-height={`${pos.maxHeight}px`}\n style:max-width={menuMaxWidth}\n >\n {@render panel(close)}\n </div>\n{/if}\n\n<style>.anchor {\n display: inline-flex;\n max-width: 100%;\n min-width: 0;\n}\n\n.anchor:not(.block) {\n flex: none;\n}\n\n.anchor.block {\n display: flex;\n width: 100%;\n}\n.anchor.block > :global(*) {\n flex: 1 1 auto;\n min-width: 0;\n}\n\n.seat {\n position: fixed;\n inset: auto;\n margin: 0;\n padding: 0;\n border: 0;\n background: transparent;\n color: inherit;\n overflow: auto;\n visibility: hidden;\n}\n.seat:popover-open {\n display: flex;\n flex-direction: column;\n}\n\n.seat.placed {\n visibility: visible;\n}\n\n.menu {\n background: var(--kata-color-panel);\n color: var(--kata-color-text);\n border: var(--kata-border-width) solid var(--kata-color-line-strong);\n min-width: min(12rem, 100vw - var(--kata-gap-md) * 2);\n max-width: calc(100vw - var(--kata-gap-md) * 2);\n}</style>\n","/** Whether an entry of a menu is an item */\nexport function isMenuItem(entry) {\n return 'id' in entry;\n}\n","// The widths of the layout, measured in script. The CSS side measures the size container `app`\n// against 24, 48 and 64rem: the Shell's root inside a Shell, else the body (base.css). This\n// measures the same thing in the same way, in rem, so that a larger text size makes the same width\n// count as narrower: inside a Shell the Shell's element, elsewhere the window.\nimport { getContext, setContext } from 'svelte';\n/** The widths the CSS measures against, in rem: tiny, narrow and mid */\nexport const WIDTHS = { tiny: 24, narrow: 48, mid: 64 };\nfunction rootFontSize() {\n const px = Number.parseFloat(getComputedStyle(document.documentElement).fontSize);\n return Number.isFinite(px) && px > 0 ? px : 16;\n}\n/**\n * The width in px that the layouts measure: the element's, or the window's when there is no\n * element or the element has no box yet (not in the page, or hidden).\n */\nfunction widthOf(el) {\n const w = el?.getBoundingClientRect().width ?? 0;\n return w > 0 ? w : window.innerWidth;\n}\n/**\n * Whether the window, or an element when one is given, is narrower than a width in rem. Without a\n * window (on a server) it is not.\n */\nexport function isNarrowerThan(remLimit, el) {\n if (typeof window === 'undefined')\n return false;\n return widthOf(el) / rootFontSize() < remLimit;\n}\n// ---- The container of the application ----\n// A Shell is the size container `app` of everything inside it. It hands its element down through\n// a context, so that a component inside it measures the Shell, as its container queries do.\nconst APP = Symbol('kata-app');\n/** Called by the Shell: the components inside measure this element instead of the window */\nexport function setAppContainer(container) {\n setContext(APP, container);\n}\nfunction appContainer() {\n try {\n return getContext(APP);\n }\n catch {\n // Called outside the initialisation of a component: there is no Shell around it\n return undefined;\n }\n}\n// One ResizeObserver for every element that is measured, however many flags watch it\nlet observer;\nconst watchers = new Map();\nfunction watchSize(el, run) {\n observer ??= new ResizeObserver((entries) => {\n for (const entry of entries)\n for (const fn of watchers.get(entry.target) ?? [])\n fn();\n });\n let set = watchers.get(el);\n if (!set) {\n set = new Set();\n watchers.set(el, set);\n observer.observe(el);\n }\n set.add(run);\n return () => {\n set.delete(run);\n if (set.size > 0)\n return;\n watchers.delete(el);\n observer?.unobserve(el);\n };\n}\n/**\n * A reactive flag: whether the window is narrower than a width in rem. Call start() in an $effect\n * and return what it returns. It measures again when the window is resized and when the text size\n * setting (data-font-scale on the root element) changes.\n *\n * Inside a Shell it measures the Shell's element instead, as the container queries do. start(el)\n * measures the element it is given. An element is followed with a ResizeObserver; where there is\n * none, the window is measured.\n */\nexport function createNarrow(remLimit) {\n let narrow = $state(false);\n const app = appContainer();\n return {\n get current() {\n return narrow;\n },\n start(el) {\n if (typeof window === 'undefined')\n return () => { };\n // Read in the effect that calls start(), so that it starts again once the Shell has its element\n const own = el instanceof Element ? el : undefined;\n const target = typeof ResizeObserver === 'undefined' ? undefined : (own ?? app?.el ?? undefined);\n const measure = () => {\n narrow = isNarrowerThan(remLimit, target);\n };\n measure();\n const unwatch = target ? watchSize(target, measure) : undefined;\n window.addEventListener('resize', measure);\n const mo = new MutationObserver(measure);\n mo.observe(document.documentElement, {\n attributes: true,\n attributeFilter: ['data-font-scale'],\n });\n return () => {\n unwatch?.();\n window.removeEventListener('resize', measure);\n mo.disconnect();\n };\n },\n };\n}\n","<script lang=\"ts\">\n import '../styles/components.css';\n import type { Snippet } from 'svelte';\n\n // Menu: the surface of a menu: the panel color, a strong line and a least width of 12rem, never\n // wider than the window. It has no padding, so the hover surface of each MenuItem reaches the\n // edges and the dividers. Dropdown with menu wears this surface itself; Menu is for a menu placed\n // by the application, such as a submenu that opens to the right. The roles and the keys belong to the\n // content.\n //\n // An item is as high as its content plus pad-md above and below. rows raises the least height of\n // every item, for a menu whose items hold different content and should line up.\n //\n // <Menu><div role=\"menu\">…MenuItem…</div></Menu>\n let {\n rows,\n children,\n }: {\n /** The least height of the items: mark, box, thumb or two lines */\n rows?: 'mark' | 'box' | 'thumb' | 'two';\n children: Snippet;\n } = $props();\n</script>\n\n<div class=\"menu\" data-role=\"menu\" data-rows={rows}>{@render children()}</div>\n\n<style>.menu {\n background: var(--kata-color-panel);\n color: var(--kata-color-text);\n border: var(--kata-border-width) solid var(--kata-color-line-strong);\n min-width: min(12rem, 100vw - var(--kata-gap-md) * 2);\n max-width: calc(100vw - var(--kata-gap-md) * 2);\n display: flex;\n flex-direction: column;\n}\n.menu[data-rows=mark] {\n --kata-list-item-height: var(--kata-height-list-item-mark);\n}\n.menu[data-rows=box] {\n --kata-list-item-height: var(--kata-height-list-item-lg);\n}\n.menu[data-rows=thumb] {\n --kata-list-item-height: var(--kata-height-thumbnail-row);\n}\n.menu[data-rows=two] {\n --kata-list-item-height: var(--kata-height-list-item-two);\n}</style>\n","<script lang=\"ts\">\n import '../styles/components.css';\n\n // MenuDivider: the line between groups of items in a menu. It has no space above or below, so the\n // hover surface of the items meets the line; the padding of the items is the distance. A\n // destructive item goes after it.\n //\n // <MenuDivider />\n</script>\n\n<div class=\"sep\" data-role=\"rule\" role=\"separator\"></div>\n\n<style>.sep {\n height: var(--kata-border-width);\n background: var(--kata-color-line);\n flex: none;\n}</style>\n","<script lang=\"ts\">\n import '../styles/components.css';\n import type { Snippet } from 'svelte';\n\n // MenuHead: the name of a group of items in a menu. It is an item that cannot be pressed: as high\n // as a MenuItem, pad-md at the sides, the name in the label role, trimmed to its ink and centred,\n // so it keeps the same distance to a divider or an edge as an item. What is not a name (a name\n // and an address, a list of people) goes in a Block.\n //\n // <MenuHead>Text size</MenuHead>\n let { children }: { children: Snippet } = $props();\n</script>\n\n<div class=\"head\" data-role=\"list-item\" data-h=\"list-item\">\n <span class=\"label\">{@render children()}</span>\n</div>\n\n<style>.head {\n display: flex;\n align-items: center;\n min-height: var(--kata-height-list-item);\n padding-inline: var(--kata-pad-md);\n min-width: 0;\n flex: none;\n font-size: var(--kata-text-size-body);\n line-height: var(--kata-text-leading-body);\n letter-spacing: var(--kata-text-tracking-body);\n --kata-box: var(--kata-height-button-sm);\n}\n\n.label {\n flex: 1;\n min-width: 0;\n font-size: var(--kata-text-size-label);\n line-height: var(--kata-text-leading-label);\n letter-spacing: var(--kata-text-tracking-label);\n font-weight: 600;\n text-box: trim-both cap alphabetic;\n padding-top: calc(var(--kata-ink-over) * 1em);\n padding-bottom: calc(var(--kata-ink-under) * 1em);\n white-space: nowrap;\n overflow: clip;\n overflow-clip-margin: 0.382em;\n text-overflow: ellipsis;\n min-width: 0;\n}</style>\n","<script lang=\"ts\">\n import '../styles/components.css';\n import type { Snippet } from 'svelte';\n import type { HTMLAttributes } from 'svelte/elements';\n import type { IconSource } from '../icons.js';\n import Icon from './Icon.svelte';\n\n // MenuItem: one item of a menu. It is as high as a list item, with pad-md at the sides and gap-sm\n // between its columns: an icon or a check mark on the left, the name in the rest, and a key hint\n // (plain monospace) or a chevron for a submenu at the right end. danger turns the text red; a\n // destructive item goes last, after a MenuDivider.\n //\n // It is a <button> (an <a> with href), always with role=\"menuitem\" and tabindex=\"-1\": the menu\n // moves the focus with the arrow keys. Other attributes (data-*, aria-*, onmouseenter) go to the\n // element. An item grows with its content: a Stack with a second line of description makes it\n // two lines high.\n //\n // <MenuItem icon=\"copy\" kbd=\"⌘D\" onclick={duplicate}>Duplicate</MenuItem>\n // <MenuItem checked={sort === 'name'} onclick={() => (sort = 'name')}>Name</MenuItem>\n // <MenuItem sub on={openSub === i} onmouseenter={open}>Arrange</MenuItem>\n let {\n icon,\n kbd,\n danger = false,\n disabled = false,\n checked,\n sub = false,\n on = false,\n href,\n onclick,\n children,\n ...rest\n }: Omit<HTMLAttributes<HTMLElement>, 'class' | 'style' | 'onclick'> & {\n /** An icon on the left (a name or a component) */\n icon?: IconSource;\n /** A key hint at the right end (⌘Z) */\n kbd?: string;\n /** A destructive action: red text */\n danger?: boolean;\n /** Shown but not chosen: dimmed, with no hover */\n disabled?: boolean;\n /** The column of check marks on the left; without it the column is not drawn */\n checked?: boolean;\n /** The item opens a submenu: a chevron at the right end */\n sub?: boolean;\n /** The submenu of this item is open: it keeps the hover surface */\n on?: boolean;\n /** Renders a link */\n href?: string;\n onclick?: (e: MouseEvent) => void;\n children: Snippet;\n } = $props();\n\n function fire(e: MouseEvent) {\n e.stopPropagation();\n if (disabled) return;\n onclick?.(e);\n }\n</script>\n\n{#snippet inner()}\n {#if icon}\n <Icon name={icon} />\n {:else if checked !== undefined}\n <span class=\"chk\">{#if checked}<Icon name=\"check\" />{/if}</span>\n {/if}\n <span class=\"grow t\">{@render children()}</span>\n {#if kbd}<span class=\"kbd t\">{kbd}</span>{/if}\n {#if sub}<span class=\"sub\"><Icon name=\"chevron-right\" /></span>{/if}\n{/snippet}\n\n{#if href && !disabled}\n <a\n class=\"item\"\n class:danger\n class:on\n data-role=\"list-item\"\n data-h=\"list-item\"\n {href}\n role=\"menuitem\"\n tabindex=\"-1\"\n onclick={fire}\n {...rest}\n >\n {@render inner()}\n </a>\n{:else}\n <button\n type=\"button\"\n class=\"item\"\n class:danger\n class:disabled\n class:on\n data-role=\"list-item\"\n data-h=\"list-item\"\n role=\"menuitem\"\n tabindex=\"-1\"\n aria-disabled={disabled ? 'true' : undefined}\n onclick={fire}\n {...rest}\n >\n {@render inner()}\n </button>\n{/if}\n\n<style>.item {\n display: flex;\n align-items: center;\n gap: var(--kata-gap-sm);\n width: 100%;\n min-height: var(--kata-list-item-height, var(--kata-height-list-item));\n padding-inline: var(--kata-pad-md);\n border: 0;\n background: none;\n color: inherit;\n font-size: var(--kata-text-size-body);\n line-height: var(--kata-text-leading-body);\n letter-spacing: var(--kata-text-tracking-body);\n text-align: start;\n text-decoration: none;\n cursor: pointer;\n flex: none;\n}\n.item:hover {\n background: var(--kata-color-raise);\n text-decoration: none;\n}\n.item:focus-visible {\n outline: 2px solid var(--kata-color-focus);\n outline-offset: -2px;\n}\n.item > :global(svg) {\n flex: none;\n}\n.item :global([data-role='mark'][data-h]:not([data-h='icon'])),\n.item :global([data-role='mark'][data-kata-tall]),\n.item :global([data-role='box'][data-h]:not(.ghost)),\n.item :global(input:not([type='checkbox']):not([type='radio'])),\n.item :global(select),\n.item :global(textarea) {\n margin-block: var(--kata-text-size-body);\n}\n.item :global([data-role='stack']) {\n padding-block: var(--kata-text-size-body);\n}\n.item :global([data-role='stack'] [data-role='stack']) {\n padding-block: 0;\n}\n.item :global([data-role='stack'] [data-role='mark'][data-h]:not([data-h='icon'])),\n.item :global([data-role='stack'] [data-role='mark'][data-kata-tall]),\n.item :global([data-role='stack'] [data-role='box'][data-h]:not(.ghost)),\n.item :global([data-role='stack'] input:not([type='checkbox']):not([type='radio'])),\n.item :global([data-role='stack'] select),\n.item :global([data-role='stack'] textarea),\n.item :global([data-role='box'] input:not([type='checkbox']):not([type='radio'])),\n.item :global([data-role='box'] select),\n.item :global([data-role='box'] textarea) {\n margin-block: 0;\n}\n\n.t {\n display: block;\n min-width: 0;\n text-box: trim-both cap alphabetic;\n padding-top: calc(var(--kata-ink-over) * 1em);\n padding-bottom: calc(var(--kata-ink-under) * 1em);\n}\n\n.on {\n background: var(--kata-color-raise);\n}\n\n.danger {\n color: var(--kata-color-red-ink);\n}\n\n.disabled {\n opacity: var(--kata-opacity-dim);\n cursor: default;\n}\n.disabled:hover {\n background: transparent;\n}\n\n.grow {\n flex: 1;\n min-width: 0;\n white-space: nowrap;\n overflow: clip;\n overflow-clip-margin: 0.382em;\n text-overflow: ellipsis;\n min-width: 0;\n}\n\n.chk {\n display: flex;\n width: var(--kata-height-icon);\n flex: none;\n}\n\n.kbd,\n.sub {\n margin-left: auto;\n color: var(--kata-color-muted);\n flex: none;\n}\n\n.kbd {\n font-family: var(--kata-font-mono);\n font-size: var(--kata-text-size-caption);\n line-height: var(--kata-text-leading-caption);\n letter-spacing: var(--kata-text-tracking-caption);\n white-space: nowrap;\n}\n\n.sub {\n display: flex;\n}</style>\n","<script lang=\"ts\">\n import '../styles/components.css';\n import { tick } from 'svelte';\n import { isMenuItem, type MenuModel, type MenuModelItem } from '../lib/menuModel.js';\n import { createNarrow, WIDTHS } from '../lib/viewport.svelte.js';\n import Menu from './Menu.svelte';\n import MenuDivider from './MenuDivider.svelte';\n import MenuHead from './MenuHead.svelte';\n import MenuItem from './MenuItem.svelte';\n import MenuList from './MenuList.svelte';\n\n // MenuList: the items of a menu drawn from its model (MenuModel[]): MenuItem for an item,\n // MenuDivider for a divider and MenuHead for a heading. It goes in a Dropdown with menu, or in a\n // Menu inside an element with role=\"menu\"; AppMenu, MenuSheet, Kebab, Topbar and LayerTree use it.\n //\n // An item with items opens a submenu: on hover or a press, next to its row, in a Menu of its own\n // that moves back inside the window. On a narrow screen, and with inline, the submenu takes the\n // place of the list instead, under a row that goes back. When one item of a level has checked, the\n // items of that level keep the column of check marks.\n //\n // Keys: the up and down arrows, Home and End move between the items of the level shown (and wrap),\n // the right arrow opens a submenu and moves into it, the left arrow goes back to its parent row.\n //\n // <Dropdown menu>\n // {#snippet trigger(toggle, open)}…{/snippet}\n // {#snippet panel(close)}<MenuList items={menu} onselect={run} onclose={close} />{/snippet}\n // </Dropdown>\n let {\n items,\n onselect,\n onclose,\n inline = false,\n level = 'root',\n backLabel,\n onexit,\n }: {\n /** The model of the menu */\n items: MenuModel[];\n /** Called with the id of the item that was chosen (not for a link) */\n onselect?: (id: string) => void;\n /** Called after an item was chosen, to close the menu */\n onclose?: () => void;\n /** Submenus take the place of the list at every width (a sheet) */\n inline?: boolean;\n /** Used by the submenus: the root, a submenu next to its row, or one in place */\n level?: 'root' | 'floating' | 'in-place';\n /** Used by the submenus in place: the name of the row that goes back */\n backLabel?: string;\n /** Used by the submenus: goes back to the parent row */\n onexit?: () => void;\n } = $props();\n\n const narrow = createNarrow(WIDTHS.narrow);\n $effect(narrow.start);\n const inPlace = $derived(inline || narrow.current);\n\n // The items of this level keep the column of check marks when one of them has a mark\n const hasCheck = $derived(items.some((e) => isMenuItem(e) && e.checked !== undefined));\n\n // The submenu open next to its row, and the one open in place of the list\n let openSub = $state<number | null>(null);\n let inPlaceSub = $state<number | null>(null);\n let subPos = $state({ top: 0, left: 0 });\n let listEl = $state<HTMLElement>();\n let subEl = $state<HTMLElement>();\n\n // The least distance from the window's edge, as a Dropdown keeps\n const EDGE = 8;\n\n // Next to the row, on its right; on its left when there is no room; inside the window below\n function place(row: HTMLElement) {\n const r = row.getBoundingClientRect();\n subPos = { top: r.top, left: r.right };\n void tick().then(() => {\n if (!subEl) return;\n const w = subEl.offsetWidth;\n const h = subEl.offsetHeight;\n let left = r.right;\n if (left + w > window.innerWidth - EDGE) left = Math.max(EDGE, r.left - w);\n let top = r.top;\n if (top + h > window.innerHeight - EDGE) top = Math.max(EDGE, window.innerHeight - EDGE - h);\n subPos = { top, left };\n });\n }\n\n function openAt(index: number, row: HTMLElement, focus = false) {\n if (inPlace) inPlaceSub = index;\n else {\n openSub = index;\n place(row);\n }\n if (!focus) return;\n void tick().then(() => {\n const box = inPlace ? listEl : subEl;\n box?.querySelector<HTMLElement>('[role=\"menuitem\"]')?.focus();\n });\n }\n\n function toggleAt(index: number, row: HTMLElement) {\n if (inPlace) inPlaceSub = inPlaceSub === index ? null : index;\n else if (openSub === index) openSub = null;\n else openAt(index, row);\n }\n\n // The rows of this level, in order\n function rows(): HTMLElement[] {\n if (!listEl) return [];\n return [...listEl.querySelectorAll<HTMLElement>(':scope > [role=\"menuitem\"]')];\n }\n\n // Closes the submenu and returns the focus to its row\n function exitSub() {\n const index = openSub ?? inPlaceSub;\n openSub = null;\n inPlaceSub = null;\n if (index !== null) focusRow(index);\n }\n\n function focusRow(index: number) {\n void tick().then(() => {\n rows()\n .find((el) => el.getAttribute('data-index') === String(index))\n ?.focus();\n });\n }\n\n function onkeydown(e: KeyboardEvent) {\n const list = rows();\n const at = list.indexOf(e.target as HTMLElement);\n if (at === -1) return;\n const el = list[at];\n const go = (i: number) => {\n e.preventDefault();\n e.stopPropagation();\n list[((i % list.length) + list.length) % list.length]?.focus();\n };\n if (e.key === 'ArrowDown') go(at + 1);\n else if (e.key === 'ArrowUp') go(at - 1);\n else if (e.key === 'Home') go(0);\n else if (e.key === 'End') go(list.length - 1);\n else if (e.key === 'ArrowRight' && el.getAttribute('aria-haspopup') === 'menu') {\n e.preventDefault();\n e.stopPropagation();\n openAt(Number(el.getAttribute('data-index')), el, true);\n } else if (e.key === 'ArrowLeft' && onexit) {\n e.preventDefault();\n e.stopPropagation();\n onexit();\n }\n }\n\n function choose(item: MenuModelItem) {\n if (item.disabled) return;\n if (!item.href) onselect?.(item.id);\n onclose?.();\n }\n\n const floating = $derived(openSub === null ? null : items[openSub]);\n const replaced = $derived(inPlaceSub === null ? null : items[inPlaceSub]);\n</script>\n\n{#snippet entries()}\n {#if level === 'in-place' && onexit}\n <MenuItem icon=\"arrow-left\" onclick={() => onexit?.()}>{backLabel}</MenuItem>\n <MenuDivider />\n {/if}\n {#each items as entry, i (i)}\n {#if 'divider' in entry}\n <MenuDivider />\n {:else if 'heading' in entry}\n <MenuHead>{entry.heading}</MenuHead>\n {:else if entry.items}\n <MenuItem\n sub\n icon={entry.icon}\n disabled={entry.disabled}\n on={openSub === i}\n checked={hasCheck ? (entry.checked ?? false) : undefined}\n data-index={i}\n aria-haspopup=\"menu\"\n aria-expanded={openSub === i || inPlaceSub === i}\n onmouseenter={(e: MouseEvent) => {\n if (!inPlace && !entry.disabled) openAt(i, e.currentTarget as HTMLElement);\n }}\n onclick={(e: MouseEvent) => {\n if (!entry.disabled) toggleAt(i, e.currentTarget as HTMLElement);\n }}>{entry.label}</MenuItem\n >\n {:else}\n <MenuItem\n icon={entry.icon}\n kbd={entry.kbd}\n danger={entry.danger}\n disabled={entry.disabled}\n href={entry.href}\n checked={hasCheck ? (entry.checked ?? false) : undefined}\n data-index={i}\n onmouseenter={() => {\n if (!inPlace) openSub = null;\n }}\n onclick={() => choose(entry)}>{entry.label}</MenuItem\n >\n {/if}\n {/each}\n{/snippet}\n\n<div\n class=\"level\"\n role={level === 'floating' ? 'menu' : 'group'}\n aria-label={level === 'in-place' ? backLabel : undefined}\n bind:this={listEl}\n {onkeydown}\n>\n {#if replaced && !('divider' in replaced) && !('heading' in replaced)}\n <MenuList\n items={replaced.items ?? []}\n level=\"in-place\"\n backLabel={replaced.label}\n {onselect}\n {onclose}\n {inline}\n onexit={exitSub}\n />\n {:else}\n {@render entries()}\n {/if}\n</div>\n\n{#if floating && !('divider' in floating) && !('heading' in floating)}\n <div class=\"sub\" bind:this={subEl} style:top={`${subPos.top}px`} style:left={`${subPos.left}px`}>\n <Menu>\n <MenuList\n items={floating.items ?? []}\n level=\"floating\"\n {onselect}\n {onclose}\n onexit={exitSub}\n />\n </Menu>\n </div>\n{/if}\n\n<style>.level {\n display: flex;\n flex-direction: column;\n min-width: 0;\n}\n\n.sub {\n position: fixed;\n z-index: var(--kata-z-menu);\n}</style>\n","<script lang=\"ts\">\n import '../styles/components.css';\n import type { Snippet } from 'svelte';\n\n // Block: a wrapper with padding (md on all sides). Inside a container without padding (a panel,\n // a menu), it holds what does not reach the edges: text, fields, name and value pairs. Lists,\n // trees, tables and section headers reach the edges and do not go in a Block. Its content is a\n // Stack.\n //\n // <Block><Stack gap=\"sm\">…</Stack></Block>\n let { children }: { children: Snippet } = $props();\n</script>\n\n<div class=\"block\" data-inset data-role=\"block\">{@render children()}</div>\n\n<style>.block {\n padding: var(--kata-pad-md);\n --kata-inset: 0px;\n --kata-at-start: 1;\n --kata-at-end: 1;\n min-width: 0;\n flex: none;\n}</style>\n","<script lang=\"ts\">\n import '../styles/components.css';\n import { tick, untrack } from 'svelte';\n import Icon from './Icon.svelte';\n\n // InlineEdit: text that is changed where it stands. Read, it is a control without a line (the\n // height its container declares, no padding at the sides, so its edge lines up with the text\n // around it), with a surface and a pencil on hover. Edited, it becomes a control with a blue line\n // and pad-sm at the sides. Enter commits and Escape restores. When the text is emptied, the\n // application decides the name that takes its place.\n //\n // Three states:\n // empty and editable a text action, \"+ placeholder\"\n // a value and editable the text and a pencil; pressing it edits\n // not editable the text alone (nothing when empty)\n // Without a pencil or an action, the text cannot be changed.\n //\n // <InlineEdit bind:value={name} placeholder=\"Add a description\" onCommit={save} />\n let {\n value = $bindable(''),\n placeholder,\n editable = true,\n title = false,\n multiline = false,\n editing = $bindable(false),\n onCommit,\n label,\n }: {\n value?: string;\n /** The action shown when empty (for example Add a description); the component adds the + */\n placeholder: string;\n /** false shows the text only */\n editable?: boolean;\n /** A title, at the size and weight of h2 */\n title?: boolean;\n /** Several lines: Enter adds a line; blur or ⌘/Ctrl+Enter commits */\n multiline?: boolean;\n /** Called when the value has changed, with the text trimmed at both ends */\n onCommit: (v: string) => void;\n /** The accessible name of the input and of the text (the placeholder by default) */\n label?: string;\n /** Whether it is being edited, for an application that holds back updates meanwhile */\n editing?: boolean;\n } = $props();\n\n let draft = $state('');\n let inputEl = $state<HTMLInputElement | HTMLTextAreaElement | undefined>();\n // blur also fires after Escape; this says whether the edit may still be committed. It is a plain\n // variable, so that it does not depend on the order in which the input is removed.\n let armed = false;\n\n const a11yLabel = $derived(label ?? placeholder);\n\n function start() {\n if (!editable || editing) return;\n begin();\n }\n\n function begin() {\n draft = value;\n editing = true;\n armed = true;\n tick().then(() => {\n inputEl?.focus();\n inputEl?.select();\n });\n }\n\n // editing set to true by the application (a key such as F2) starts an edit as a press does\n $effect(() => {\n if (editing && !armed && editable) untrack(begin);\n });\n\n function commit() {\n if (!armed) return;\n armed = false;\n editing = false;\n const next = draft.trim();\n if (next === value) return;\n value = next;\n onCommit(next);\n }\n\n function cancel() {\n armed = false;\n editing = false;\n }\n\n function onkeydown(e: KeyboardEvent) {\n // The Enter that ends a composition (an input method) does not commit\n if (e.isComposing || e.keyCode === 229) return;\n if (e.key === 'Escape') {\n e.preventDefault();\n // Escape ends the edit here and does not reach a panel or a modal around it\n e.stopPropagation();\n cancel();\n return;\n }\n if (e.key === 'Enter' && (!multiline || e.metaKey || e.ctrlKey)) {\n e.preventDefault();\n commit();\n }\n }\n</script>\n\n{#if editing}\n <span\n class=\"ie editing\"\n class:title\n class:multi={multiline}\n data-role=\"box\"\n data-h={multiline ? undefined : 'button'}\n >\n {#if multiline}\n <textarea\n rows={1}\n bind:this={inputEl}\n bind:value={draft}\n aria-label={a11yLabel}\n onblur={commit}\n {onkeydown}\n ></textarea>\n {:else}\n <input\n type=\"text\"\n bind:this={inputEl}\n bind:value={draft}\n aria-label={a11yLabel}\n onblur={commit}\n {onkeydown}\n />\n {/if}\n </span>\n{:else if !editable}\n {#if value !== ''}\n <span\n class=\"ie read\"\n class:title\n class:multi={multiline}\n data-role=\"box\"\n data-h={multiline ? undefined : 'button'}><span class=\"t clamp\">{value}</span></span\n >\n {/if}\n{:else if value !== ''}\n <button\n class=\"ie\"\n class:title\n class:multi={multiline}\n type=\"button\"\n aria-label={a11yLabel}\n onclick={start}\n data-role=\"box\"\n data-h={multiline ? undefined : 'button'}\n >\n <span class=\"t clamp\">{value}</span>\n <span class=\"pen\"><Icon name=\"pencil\" /></span>\n </button>\n{:else}\n <button class=\"add\" type=\"button\" aria-label={a11yLabel} onclick={start} data-role=\"box\" data-h=\"button\">\n <Icon name=\"plus\" /><span class=\"t\">{placeholder}</span>\n </button>\n{/if}\n\n<style>.ie {\n display: inline-flex;\n align-items: center;\n gap: var(--kata-gap-sm);\n height: var(--kata-box, var(--kata-height-button));\n max-width: 100%;\n padding: 0;\n border: var(--kata-border-width) solid transparent;\n background: none;\n color: inherit;\n font-size: var(--kata-text-size-body);\n line-height: var(--kata-text-leading-body);\n letter-spacing: var(--kata-text-tracking-body);\n text-align: start;\n cursor: text;\n min-width: 0;\n}\n\n.title {\n font-size: var(--kata-text-size-h2);\n line-height: var(--kata-text-leading-h2);\n letter-spacing: var(--kata-text-tracking-h2);\n font-weight: 600;\n}\n\n.t {\n display: block;\n min-width: 0;\n text-box: trim-both cap alphabetic;\n padding-top: calc(var(--kata-ink-over) * 1em);\n padding-bottom: calc(var(--kata-ink-under) * 1em);\n}\n\n.clamp {\n white-space: nowrap;\n overflow: clip;\n overflow-clip-margin: 0.382em;\n text-overflow: ellipsis;\n min-width: 0;\n}\n\nbutton.ie {\n cursor: pointer;\n}\nbutton.ie:hover {\n background: var(--kata-color-raise);\n}\nbutton.ie:hover .pen {\n color: var(--kata-color-muted);\n}\n\n.pen {\n display: flex;\n flex: none;\n color: var(--kata-color-faint);\n}\n\n.read {\n cursor: default;\n}\n\n.editing {\n border-color: var(--kata-color-blue-ink);\n padding-inline: var(--kata-pad-sm);\n}\n\n.ie input,\n.ie textarea {\n border: 0;\n background: transparent;\n padding: 0;\n margin: 0;\n min-width: 0;\n outline: none;\n color: inherit;\n font: inherit;\n appearance: none;\n}\n.ie input:focus-visible,\n.ie textarea:focus-visible {\n outline: none;\n}\n.ie input,\n.ie textarea {\n flex: 1;\n width: 100%;\n align-self: stretch;\n}\n\n.multi {\n --kata-inline-edit-pad: calc((var(--kata-box, var(--kata-height-button)) - var(--kata-border-width) * 2 - var(--kata-text-size-body) * var(--kata-text-leading-body)) / 2);\n height: auto;\n min-height: var(--kata-box, var(--kata-height-button));\n align-items: flex-start;\n white-space: normal;\n}\n\n.multi .clamp {\n text-box: none;\n padding-top: 0;\n padding-bottom: 0;\n white-space: pre-wrap;\n overflow: visible;\n text-overflow: clip;\n padding-block: var(--kata-inline-edit-pad);\n}\n\n.multi:not(.editing) {\n display: block;\n}\n.multi:not(.editing) .clamp {\n display: inline;\n}\n.multi:not(.editing) .pen {\n display: inline-flex;\n vertical-align: middle;\n margin-left: var(--kata-pad-sm);\n}\n\n.ie textarea {\n resize: none;\n field-sizing: content;\n line-height: var(--kata-text-leading-body);\n padding-block: var(--kata-inline-edit-pad);\n}\n\n.add {\n display: inline-flex;\n align-items: center;\n gap: var(--kata-gap-sm);\n height: var(--kata-box, var(--kata-height-button));\n padding: 0;\n border: 0;\n background: none;\n color: var(--kata-color-blue-ink);\n font-size: var(--kata-text-size-body);\n line-height: var(--kata-text-leading-body);\n letter-spacing: var(--kata-text-tracking-body);\n cursor: pointer;\n}\n.add:hover {\n text-decoration: underline;\n}</style>\n","<script lang=\"ts\">\n import '../styles/components.css';\n import type { Snippet } from 'svelte';\n import { createNarrow } from '../lib/viewport.svelte.js';\n\n // Pair: a name and a value side by side. The name column is 7.5rem wide and muted; gap-sm lies\n // between the name and the value. It has three forms.\n //\n // edit (the default) the value is a control; the height is a button's\n // read the value is text to read (a summary, the attributes of a thing); the\n // height follows the content and the pair is not a control\n // top the value has several lines (a Textarea); aligned at the top\n //\n // The name is trimmed to its ink and level with the first line of the value (with a control,\n // with the text inside it). Edit and read pairs are not mixed in one column. Pairs are gap-sm\n // apart in a Stack; a column of read pairs is a Kv. The pair owns the padding at its sides: the\n // inset its container declares (none inside a container with padding).\n //\n // <Pair label=\"Line width\"><NumberInput bind:value unit=\"px\" /></Pair>\n // <Pair read label=\"Length\">13.1 km</Pair>\n // <Pair read label=\"ID\" mono clamp>ab12…</Pair>\n let {\n label,\n for: htmlFor,\n href,\n read = false,\n top = false,\n note,\n tight = false,\n indent = 0,\n muted = false,\n mono = false,\n clamp = false,\n children,\n }: {\n label: string;\n /** The id of the control the name labels */\n for?: string;\n /** Makes the name a link (a read pair opened by its name, as in a table of contents) */\n href?: string;\n /** A value to read, not a control */\n read?: boolean;\n /** A value of several lines: aligned at the top, the height follows the content */\n top?: boolean;\n /** A caption under the value, gap-xs from it */\n note?: string;\n /** The name column takes the width of its content (a narrow container) */\n tight?: boolean;\n /** The depth of a read name in a tree of values: md × depth */\n indent?: number;\n /** A weaker read value (empty or inherited) */\n muted?: boolean;\n /** The monospace font (identifiers) */\n mono?: boolean;\n /** The value on one line with an ellipsis */\n clamp?: boolean;\n children: Snippet;\n } = $props();\n // Below 24rem the name sits above the value, and the pair no longer has a control's height\n const tiny = createNarrow(24);\n $effect(tiny.start);\n // A read pair has no line and no surface: it is not a control, so it declares no height\n const h = $derived(top || tiny.current || read ? undefined : 'button');\n</script>\n\n<div\n class=\"pair\"\n class:read\n class:top\n class:tight\n class:noted={!!note}\n data-role=\"pair\"\n data-h={note ? undefined : h}\n>\n {#if htmlFor}\n <label class=\"k\" for={htmlFor} style:--kata-pair-depth={indent}>{label}</label>\n {:else if href}\n <a class=\"k link\" {href} style:--kata-pair-depth={indent}>{label}</a>\n {:else}\n <span class=\"k\" style:--kata-pair-depth={indent}>{label}</span>\n {/if}\n {#if read}\n <span class=\"v\" class:muted class:mono class:clamp>{@render children()}</span>\n {:else}\n <div class=\"row\">{@render children()}</div>\n {/if}\n {#if note}<span class=\"note\">{note}</span>{/if}\n</div>\n\n<style>.pair {\n --kata-pair-name: 7.5rem;\n display: grid;\n grid-template-columns: var(--kata-pair-cols, var(--kata-pair-name) minmax(0, 1fr));\n grid-column: 1/-1;\n align-items: center;\n column-gap: var(--kata-gap-sm);\n min-width: 0;\n flex: none;\n height: var(--kata-box, var(--kata-height-button));\n padding-inline: var(--kata-inset, 0px);\n font-size: var(--kata-text-size-body);\n line-height: var(--kata-text-leading-body);\n letter-spacing: var(--kata-text-tracking-body);\n}\n\n.read {\n height: auto;\n align-items: baseline;\n}\n\n.tight {\n grid-template-columns: var(--kata-pair-cols, max-content minmax(0, 1fr));\n}\n\n.k {\n display: block;\n color: var(--kata-color-muted);\n padding-inline-start: calc(var(--kata-pair-depth, 0) * var(--kata-pad-md));\n text-box: trim-both cap alphabetic;\n padding-top: calc(var(--kata-ink-over) * 1em);\n padding-bottom: calc(var(--kata-ink-under) * 1em);\n white-space: nowrap;\n overflow: clip;\n overflow-clip-margin: 0.382em;\n text-overflow: ellipsis;\n min-width: 0;\n}\n\n.k.link {\n color: var(--kata-color-blue-ink);\n text-decoration: none;\n}\n.k.link:hover {\n text-decoration: underline;\n}\n\n.row {\n display: flex;\n align-items: center;\n min-width: 0;\n}\n.row > :global(*) {\n flex: 1 1 auto;\n min-width: 0;\n}\n\n.v {\n display: block;\n min-width: 0;\n font-variant-numeric: tabular-nums;\n overflow-wrap: anywhere;\n text-box: trim-both cap alphabetic;\n padding-top: calc(var(--kata-ink-over) * 1em);\n padding-bottom: calc(var(--kata-ink-under) * 1em);\n}\n\n.v.muted {\n color: var(--kata-color-muted);\n}\n\n.mono {\n font-family: var(--kata-font-mono);\n}\n\n.v.clamp {\n white-space: nowrap;\n overflow: clip;\n overflow-clip-margin: 0.382em;\n text-overflow: ellipsis;\n min-width: 0;\n overflow-wrap: normal;\n}\n\n.note {\n grid-column: 2;\n font-size: var(--kata-text-size-caption);\n line-height: var(--kata-text-leading-caption);\n letter-spacing: var(--kata-text-tracking-caption);\n}\n\n.top {\n align-items: start;\n height: auto;\n}\n.top .k {\n padding-top: calc((var(--kata-box, var(--kata-height-button)) - 1em * var(--kata-ink)) / 2 + var(--kata-ink-over) * 1em);\n}\n\n.noted {\n height: auto;\n row-gap: var(--kata-gap-xs);\n}\n\n@container app (width < 24rem) {\n .pair {\n grid-template-columns: minmax(0, 1fr);\n align-items: start;\n row-gap: var(--kata-gap-xs);\n height: auto;\n }\n .note {\n grid-column: 1;\n }\n}</style>\n","<script lang=\"ts\">\n import '../styles/components.css';\n import Pair from './Pair.svelte';\n\n // Kv: a column of read pairs. The pairs sit on one grid, so their names line up in one column:\n // 7.5rem wide, or the width of the longest name with tight (a narrow container such as a tile).\n // Pairs are gap-sm apart. Below 24rem each name sits above its value.\n //\n // <Kv items={[{ k: 'Length', v: '13.1 km' }, { k: 'ID', v: 'ab12', mono: true }]} />\n // <Kv tight items={…} />\n let {\n items,\n tight = false,\n }: {\n items: {\n /** The name */\n k: string;\n /** The value */\n v: string;\n mono?: boolean;\n /** The depth in a tree of values */\n indent?: number;\n muted?: boolean;\n clamp?: boolean;\n /** Makes the name a link */\n href?: string;\n /** A caption under the value */\n note?: string;\n }[];\n /** The name column takes the width of the longest name */\n tight?: boolean;\n } = $props();\n</script>\n\n<div class=\"kv\" class:tight data-role=\"list\">\n {#each items as item, i (i)}\n <Pair\n read\n label={item.k}\n href={item.href}\n note={item.note}\n {tight}\n indent={item.indent ?? 0}\n muted={item.muted}\n mono={item.mono}\n clamp={item.clamp}>{item.v}</Pair\n >\n {/each}\n</div>\n\n<style>.kv {\n --kata-pair-name: 7.5rem;\n --kata-pair-cols: subgrid;\n display: grid;\n grid-template-columns: var(--kata-pair-name) minmax(0, 1fr);\n row-gap: var(--kata-gap-sm);\n column-gap: var(--kata-gap-sm);\n min-width: 0;\n}\n\n.tight {\n grid-template-columns: max-content minmax(0, 1fr);\n}\n\n@container app (width < 24rem) {\n .kv,\n .tight {\n grid-template-columns: minmax(0, 1fr);\n }\n}</style>\n","<script lang=\"ts\">\n import '../styles/components.css';\n import type { Snippet } from 'svelte';\n import type { IconSource } from '../icons.js';\n import Icon from './Icon.svelte';\n\n // LinkAction: an action that is text only, for an action that does not call for a control with a\n // line (\"Add a description\", \"Show all\"). In a layout its height is the line box of its text, so\n // it is measured like the text around it; the area that is pressed reaches the square of an icon\n // button above and below it. No padding at the sides, so its edge lines up with the text around\n // it. The color is blue-ink, underlined on hover. An action that opens a modal or changes the\n // screen is a Button.\n //\n // <LinkAction icon=\"plus\" onclick={add}>Add a description</LinkAction>\n // <LinkAction href={url} external>Terms of use</LinkAction> opens in a new tab\n let {\n icon,\n href,\n onclick,\n disabled = false,\n external = false,\n children,\n }: {\n /** An icon before the text */\n icon?: IconSource;\n /** Renders a link */\n href?: string;\n onclick?: (e: MouseEvent) => void;\n /** Keeps its place but cannot be pressed (not with href) */\n disabled?: boolean;\n /** A destination outside the application: a new tab and an arrow after the text (with href) */\n external?: boolean;\n children: Snippet;\n } = $props();\n</script>\n\n{#snippet inner()}\n {#if icon}<Icon name={icon} />{/if}<span class=\"t\">{@render children()}</span>{#if external}<Icon\n name=\"arrow-up-right\"\n />{/if}\n{/snippet}\n\n{#if href}\n <a\n class=\"link\"\n data-role=\"box\"\n {href}\n target={external ? '_blank' : undefined}\n rel={external ? 'noreferrer' : undefined}\n {onclick}>{@render inner()}</a\n >\n{:else}\n <button type=\"button\" class=\"link\" data-role=\"box\" {disabled} {onclick}>{@render inner()}</button>\n{/if}\n\n<style>.link {\n display: inline-flex;\n align-items: center;\n gap: var(--kata-gap-sm);\n position: relative;\n padding: 0;\n border: 0;\n background: none;\n color: var(--kata-color-blue-ink);\n font-size: var(--kata-text-size-body);\n line-height: var(--kata-text-leading-body);\n letter-spacing: var(--kata-text-tracking-body);\n text-align: start;\n text-decoration: none;\n cursor: pointer;\n flex: none;\n}\n.link:hover {\n text-decoration: underline;\n}\n.link::after {\n content: \"\";\n position: absolute;\n inset-inline: 0;\n top: 50%;\n height: var(--kata-height-icon-button);\n translate: 0 -50%;\n}\n.link:disabled {\n color: var(--kata-color-text);\n opacity: var(--kata-opacity-dim);\n cursor: default;\n text-decoration: none;\n}\n.link > :global(svg) {\n flex: none;\n}\n\n.t {\n display: block;\n min-width: 0;\n}\n\n:global([data-h]) .t {\n text-box: trim-both cap alphabetic;\n padding-top: calc(var(--kata-ink-over) * 1em);\n padding-bottom: calc(var(--kata-ink-under) * 1em);\n}</style>\n","import { placeTip, tipBounds, tipHost } from './tipPlace.js';\nconst LOOK = [\n 'background: var(--kata-color-text)',\n 'color: var(--kata-color-ground)',\n 'padding: var(--kata-gap-2xs) var(--kata-gap-sm)',\n 'font-size: var(--kata-text-size-caption)',\n 'line-height: var(--kata-height-badge)',\n 'min-height: var(--kata-height-button-sm)',\n 'display: inline-flex',\n 'align-items: center',\n];\n// The widest line; the gap to the edge of the window is the same as in the placement\nconst MAX_WIDTH = 'min(var(--kata-width-panel), calc(100vw - 2 * var(--kata-gap-sm)))';\nfunction clipped(node) {\n return node.scrollWidth > node.clientWidth;\n}\nfunction makeTip(node) {\n const text = node.textContent?.trim();\n if (!text)\n return null;\n const tip = document.createElement('span');\n tip.setAttribute('aria-hidden', 'true');\n tip.style.cssText = [\n ...LOOK,\n 'position: fixed',\n 'z-index: var(--kata-z-menu)',\n `max-width: ${MAX_WIDTH}`,\n 'white-space: normal',\n 'overflow-wrap: anywhere',\n 'pointer-events: none',\n ].join(';');\n tip.textContent = text;\n tipHost(node).appendChild(tip);\n placeTip(tip, node.getBoundingClientRect(), tipBounds(node));\n return tip;\n}\nexport const clampTip = (node) => {\n let tip = null;\n function hide() {\n tip?.remove();\n tip = null;\n }\n function onEnter() {\n if (tip || !clipped(node))\n return;\n tip = makeTip(node);\n }\n function onFocusIn(e) {\n // Keyboard focus only, so that the tooltip does not stay after a click\n if (!e.target?.matches?.(':focus-visible'))\n return;\n onEnter();\n }\n node.addEventListener('pointerenter', onEnter);\n node.addEventListener('pointerleave', hide);\n node.addEventListener('focusin', onFocusIn);\n node.addEventListener('focusout', hide);\n // A press or a scroll moves things; hide at once\n node.addEventListener('pointerdown', hide);\n document.addEventListener('scroll', hide, true);\n return {\n destroy() {\n hide();\n node.removeEventListener('pointerenter', onEnter);\n node.removeEventListener('pointerleave', hide);\n node.removeEventListener('focusin', onFocusIn);\n node.removeEventListener('focusout', hide);\n node.removeEventListener('pointerdown', hide);\n document.removeEventListener('scroll', hide, true);\n },\n };\n};\n","<script lang=\"ts\">\n import '../styles/components.css';\n import type { Snippet } from 'svelte';\n import type { Action } from 'svelte/action';\n import { clampTip } from '../lib/clampTip.js';\n\n // Text: text in one of the nine type roles, each with its size, leading, tracking, weight and\n // element. Text outside a control keeps its line box (it is not trimmed); the distance to its\n // neighbours is the gap of a Stack or a Row. Inside a component that declares its height\n // (a list item, a toolbar) it is trimmed to its ink and clipped to one line.\n //\n // <Text role=\"h1\">The title of a screen</Text> an h1\n // <Text role=\"caption\">A note</Text> a span shown as a block\n // <Text role=\"prose\">A paragraph to read</Text> a p\n // <Text role=\"caption\" mono clamp>name@example.com</Text>\n // <Text as=\"a\" href=\"/files/1\" clamp>A name</Text> a link that keeps the color around it\n type Role = 'num' | 'title' | 'h1' | 'h2' | 'prose' | 'body' | 'caption' | 'label' | 'glyph';\n let {\n role = 'body',\n as,\n clamp = false,\n lines,\n wrap = false,\n muted = false,\n mono = false,\n tabular = false,\n id,\n for: htmlFor,\n href,\n children,\n }: {\n /** The type role (default body) */\n role?: Role;\n /** Another element than the role's own: h1 (title, h1), h2 (h2), p (body, prose) or span */\n as?: 'span' | 'p' | 'div' | 'h1' | 'h2' | 'h3' | 'label' | 'dt' | 'dd' | 'a';\n /** One line with an ellipsis; the full text shows on hover when it is clipped */\n clamp?: boolean;\n /** Two lines with an ellipsis */\n lines?: 2;\n /** Keep line breaks and wrap long words (text that people wrote) */\n wrap?: boolean;\n /** The muted text color */\n muted?: boolean;\n /** The monospace font, at the role's size */\n mono?: boolean;\n /** Figures of equal width, for columns of numbers and times */\n tabular?: boolean;\n id?: string;\n /** The labelled control, with as=\"label\" */\n for?: string;\n /** The target, with as=\"a\" */\n href?: string;\n children: Snippet;\n } = $props();\n const tag = $derived(\n as ??\n (role === 'h1' || role === 'title'\n ? 'h1'\n : role === 'h2'\n ? 'h2'\n : role === 'prose' || role === 'body'\n ? 'p'\n : 'span'),\n );\n const dataRole = $derived(role === 'body' || role === 'prose' ? 'p' : role);\n // The full text of a clipped line shows as a tooltip (clampTip), only while clamp is on\n const clampTipIf: Action<HTMLElement, boolean> = (node, on) => {\n let inner: ReturnType<typeof clampTip> | undefined = on ? clampTip(node) : undefined;\n return {\n update(next: boolean) {\n if (next && !inner) inner = clampTip(node);\n else if (!next && inner) {\n inner?.destroy?.();\n inner = undefined;\n }\n },\n destroy() {\n inner?.destroy?.();\n },\n };\n };\n</script>\n\n<svelte:element\n this={tag}\n class=\"kata-text {role}\"\n class:clamp\n class:clamp2={lines === 2}\n class:wrap\n class:muted\n class:mono\n class:tabular\n data-role={dataRole}\n {id}\n for={tag === 'label' ? htmlFor : undefined}\n href={tag === 'a' ? href : undefined}\n use:clampTipIf={clamp}\n>\n {@render children()}\n</svelte:element>\n\n<style>.kata-text {\n display: block;\n margin: 0;\n min-width: 0;\n}\n\n@container style(--kata-in-control: 1) {\n .kata-text {\n text-box: trim-both cap alphabetic;\n padding-top: calc(var(--kata-ink-over) * 1em);\n padding-bottom: calc(var(--kata-ink-under) * 1em);\n }\n .kata-text:not(.clamp2):not(.wrap) {\n white-space: nowrap;\n overflow: clip;\n overflow-clip-margin: 0.382em;\n text-overflow: ellipsis;\n min-width: 0;\n }\n}\n:global(td) .kata-text,\n:global(th) .kata-text {\n text-box: trim-both cap alphabetic;\n padding-top: calc(var(--kata-ink-over) * 1em);\n padding-bottom: calc(var(--kata-ink-under) * 1em);\n}\n\n.num {\n font-size: var(--kata-text-size-num);\n line-height: var(--kata-text-leading-num);\n letter-spacing: var(--kata-text-tracking-num);\n font-weight: 600;\n font-variant-numeric: tabular-nums;\n}\n\n.title {\n font-size: var(--kata-text-size-title);\n line-height: var(--kata-text-leading-title);\n letter-spacing: var(--kata-text-tracking-title);\n font-weight: 600;\n}\n\n.h1 {\n font-size: var(--kata-text-size-h1);\n line-height: var(--kata-text-leading-h1);\n letter-spacing: var(--kata-text-tracking-h1);\n font-weight: 600;\n}\n\n.h2 {\n font-size: var(--kata-text-size-h2);\n line-height: var(--kata-text-leading-h2);\n letter-spacing: var(--kata-text-tracking-h2);\n font-weight: 600;\n}\n\n.body {\n font-size: var(--kata-text-size-body);\n line-height: var(--kata-text-leading-body);\n letter-spacing: var(--kata-text-tracking-body);\n}\n\n.prose {\n font-size: var(--kata-text-size-prose);\n line-height: var(--kata-text-leading-prose);\n letter-spacing: var(--kata-text-tracking-prose);\n}\n\n.caption {\n font-size: var(--kata-text-size-caption);\n line-height: var(--kata-text-leading-caption);\n letter-spacing: var(--kata-text-tracking-caption);\n}\n\n.label {\n font-size: var(--kata-text-size-label);\n line-height: var(--kata-text-leading-label);\n letter-spacing: var(--kata-text-tracking-label);\n font-weight: 600;\n}\n\n.glyph {\n font-size: var(--kata-text-size-glyph);\n line-height: var(--kata-text-leading-glyph);\n letter-spacing: var(--kata-text-tracking-glyph);\n font-weight: 600;\n}\n\n.kata-text.mono {\n font-family: var(--kata-font-mono);\n font-variant-numeric: tabular-nums;\n}\n\na.kata-text {\n color: inherit;\n text-decoration: none;\n}\na.kata-text:hover {\n text-decoration: underline;\n}\n\n.tabular {\n font-variant-numeric: tabular-nums;\n}\n\n.muted {\n color: var(--kata-color-muted);\n}\n\n.clamp {\n white-space: nowrap;\n overflow: clip;\n overflow-clip-margin: 0.382em;\n text-overflow: ellipsis;\n min-width: 0;\n}\n\n.wrap {\n white-space: pre-wrap;\n word-break: break-word;\n overflow-wrap: anywhere;\n}\n\n.kata-text.clamp2 {\n text-box: none;\n padding-top: 0;\n padding-bottom: 0;\n}\n\n.clamp2 {\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 2;\n line-clamp: 2;\n overflow: hidden;\n white-space: pre-wrap;\n word-break: break-word;\n overflow-wrap: anywhere;\n}</style>\n","<script lang=\"ts\">\n import '../styles/components.css';\n import type { HTMLInputAttributes } from 'svelte/elements';\n\n // TextInput: a one-line input. The control (a <label>) draws the line, holds the height and the\n // padding at the sides; the bare input inside has no line and no ring. Focus shows once, as the\n // control's line turns blue-ink; an error turns it red-ink; the placeholder is faint. The height is\n // the one the container declares (a button's, or a small button's in a list item or a cell), so\n // the author writes no size. The whole control is a <label>, so a press anywhere on it focuses the\n // input; the name of the field is Field's own <label for>. The width is the application's.\n //\n // <Field label=\"Name\" for=\"n\"><TextInput id=\"n\" bind:value={name} /></Field>\n let {\n value = $bindable(''),\n type = 'text',\n placeholder,\n id,\n name,\n autocomplete,\n disabled = false,\n error = false,\n title = false,\n mono = false,\n unit,\n suggestions,\n readonly = false,\n oninput,\n onchange,\n onkeydown,\n onblur,\n ...rest\n }: Omit<\n HTMLInputAttributes,\n | 'class'\n | 'style'\n | 'value'\n | 'type'\n | 'title'\n | 'placeholder'\n | 'name'\n | 'autocomplete'\n | 'disabled'\n | 'readonly'\n | 'oninput'\n | 'onchange'\n | 'onkeydown'\n | 'onblur'\n | 'list'\n > & {\n value?: string;\n type?: 'text' | 'email' | 'password' | 'url';\n placeholder?: string;\n id?: string;\n name?: string;\n autocomplete?: HTMLInputAttributes['autocomplete'];\n disabled?: boolean;\n /** The line turns red-ink */\n error?: boolean;\n /** The input of a name, at the size and weight of h2 */\n title?: boolean;\n /** A code or an identifier: the monospace font with figures of equal width */\n mono?: boolean;\n /** A unit, muted, on the right inside the control */\n unit?: string;\n /** Suggestions: the value may be typed or picked, and need not be one of them */\n suggestions?: string[];\n readonly?: boolean;\n oninput?: (e: Event & { currentTarget: HTMLInputElement }) => void;\n onchange?: (e: Event & { currentTarget: HTMLInputElement }) => void;\n onkeydown?: (e: KeyboardEvent) => void;\n onblur?: (e: FocusEvent) => void;\n } = $props();\n\n // One list of suggestions per control, named by the component\n const listId = $props.id();\n const hasList = $derived((suggestions?.length ?? 0) > 0);\n\n // type is dynamic, which bind:value does not allow, so the value is copied by hand\n function relay(e: Event & { currentTarget: HTMLInputElement }) {\n value = e.currentTarget.value;\n oninput?.(e);\n }\n</script>\n\n<label class=\"input\" class:err={error} class:disabled={disabled} class:title data-role=\"box\" data-h=\"button\">\n <input\n class:mono\n {type}\n {value}\n {placeholder}\n {id}\n {name}\n {autocomplete}\n {disabled}\n {readonly}\n aria-invalid={error || undefined}\n list={hasList ? listId : undefined}\n oninput={relay}\n {onchange}\n {onkeydown}\n {onblur}\n {...rest}\n />\n {#if hasList}\n <datalist id={listId}>\n {#each suggestions ?? [] as s (s)}<option value={s}></option>{/each}\n </datalist>\n {/if}\n {#if unit}<span class=\"unit\">{unit}</span>{/if}\n</label>\n\n<style>.input {\n display: inline-flex;\n align-items: center;\n gap: var(--kata-gap-sm);\n height: var(--kata-box, var(--kata-height-button));\n padding-block: 0;\n padding-inline: var(--kata-pad-md);\n border: var(--kata-border-width) solid var(--kata-color-line-strong);\n border-radius: 0;\n background: transparent;\n color: var(--kata-color-text);\n white-space: nowrap;\n font: inherit;\n font-size: var(--kata-text-size-body);\n line-height: var(--kata-text-leading-body);\n letter-spacing: var(--kata-text-tracking-body);\n transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease;\n width: 100%;\n min-width: 0;\n justify-content: flex-start;\n cursor: text;\n}\n.input:focus-within {\n border-color: var(--kata-color-blue-ink);\n}\n\n.input input {\n border: 0;\n background: transparent;\n padding: 0;\n margin: 0;\n min-width: 0;\n outline: none;\n color: inherit;\n font: inherit;\n appearance: none;\n}\n.input input:focus-visible {\n outline: none;\n}\n.input input {\n flex: 1;\n align-self: stretch;\n}\n.input input::placeholder {\n color: var(--kata-color-faint);\n}\n\n.unit {\n color: var(--kata-color-muted);\n flex: none;\n text-box: trim-both cap alphabetic;\n padding-top: calc(var(--kata-ink-over) * 1em);\n padding-bottom: calc(var(--kata-ink-under) * 1em);\n}\n\n.title {\n font-size: var(--kata-text-size-h2);\n line-height: var(--kata-text-leading-h2);\n letter-spacing: var(--kata-text-tracking-h2);\n font-weight: 600;\n}\n\n.input input.mono {\n font-family: var(--kata-font-mono);\n font-variant-numeric: tabular-nums;\n}\n\n.err {\n border-color: var(--kata-color-red-ink);\n}\n\n.disabled {\n opacity: var(--kata-opacity-dim);\n cursor: default;\n}\n.disabled .unit {\n color: inherit;\n}</style>\n","<script lang=\"ts\" module>\n /** One attribute of an AttributeList */\n export interface AttributeItem {\n key: string;\n value: string;\n }\n</script>\n\n<script lang=\"ts\">\n import '../styles/components.css';\n import { tick } from 'svelte';\n import { getMessages } from '../messages.js';\n import Block from './Block.svelte';\n import Button from './Button.svelte';\n import Icon from './Icon.svelte';\n import InlineEdit from './InlineEdit.svelte';\n import Kv from './Kv.svelte';\n import LinkAction from './LinkAction.svelte';\n import Text from './Text.svelte';\n import TextInput from './TextInput.svelte';\n\n // AttributeList: the attributes of a thing, names and values that the user writes. It reaches the\n // edges of its container, as a list does (a flush section, a panel's content). Read only, it is\n // a Kv in a Block. Editable, each row is the name and the value, each changed where it stands\n // (InlineEdit), and a remove button; the rows are a button tall and touch, as list items do. A\n // locked name is shown with a lock and cannot be changed or removed. The add action opens a row of two inputs at the end: Enter or leaving the row adds\n // the attribute, Escape drops it, and a row without a name is dropped.\n //\n // The list shows items; the changes are reported by index into items, and the application\n // updates items (at once), or the row goes back to what items holds. hide leaves out the names\n // the application keeps to itself.\n //\n // <AttributeList {items} locked={['id']} onchange={(i, item) => …} onadd={(item) => …}\n // onremove={(i) => …} />\n let {\n items,\n onchange,\n onadd,\n onremove,\n readonly = false,\n locked = [],\n hide,\n }: {\n /** The attributes, in order */\n items: AttributeItem[];\n /** Called with the index and the new name and value of an attribute changed */\n onchange?: (index: number, item: AttributeItem) => void;\n /** Called with an attribute to add; shows the add action */\n onadd?: (item: AttributeItem) => void;\n /** Called with the index of an attribute to remove; shows the remove buttons */\n onremove?: (index: number) => void;\n /** Only read: the list is a Kv */\n readonly?: boolean;\n /** The names shown but not changed or removed */\n locked?: string[];\n /** Leaves out the attributes whose name it returns true for */\n hide?: (key: string) => boolean;\n } = $props();\n\n // The attributes shown, with their index in items\n const shown = $derived(\n items.map((item, index) => ({ ...item, index })).filter((a) => !hide?.(a.key)),\n );\n // Raised to draw the rows again from items, after a change the application did not take\n let rev = $state(0);\n // The row being added, or null\n let draft = $state<AttributeItem | null>(null);\n let draftRow = $state<HTMLElement>();\n\n function change(index: number, next: AttributeItem) {\n if (next.key !== '') onchange?.(index, next);\n const now = items[index];\n if (!now || now.key !== next.key || now.value !== next.value) rev += 1;\n }\n\n async function open() {\n draft = { key: '', value: '' };\n await tick();\n draftRow?.querySelector('input')?.focus();\n }\n function add() {\n if (!draft) return;\n const key = draft.key.trim();\n const value = draft.value.trim();\n draft = null;\n if (key) onadd?.({ key, value });\n }\n function draftKey(e: KeyboardEvent) {\n if (e.isComposing || e.keyCode === 229) return;\n if (e.key === 'Enter') {\n e.preventDefault();\n add();\n } else if (e.key === 'Escape') {\n e.preventDefault();\n // Escape drops the row here and does not reach a panel or a modal around it\n e.stopPropagation();\n draft = null;\n }\n }\n // Leaving the row adds the attribute; moving between its inputs does not\n function draftOut(e: FocusEvent) {\n const next = e.relatedTarget as Node | null;\n if (next && draftRow?.contains(next)) return;\n add();\n }\n</script>\n\n<div class=\"attributes\">\n {#if readonly || shown.length === 0}\n {#if shown.length === 0 && !draft}\n <Block><Text muted>{getMessages().noAttributes}</Text></Block>\n {:else if readonly}\n <Block><Kv items={shown.map((a) => ({ k: a.key, v: a.value }))} /></Block>\n {/if}\n {/if}\n {#if !readonly}\n {#each shown as a (`${a.index}:${rev}`)}\n {@const fixed = locked.includes(a.key)}\n {@const editable = !fixed && !!onchange}\n <div class=\"row\">\n <span class=\"k\">\n <InlineEdit\n value={a.key}\n {editable}\n placeholder={getMessages().attributeName}\n label={getMessages().attributeName}\n onCommit={(key) => change(a.index, { key, value: a.value })}\n />\n </span>\n <span class=\"v\">\n <InlineEdit\n value={a.value}\n {editable}\n placeholder={getMessages().addValue}\n label={a.key}\n onCommit={(value) => change(a.index, { key: a.key, value })}\n />\n </span>\n <span class=\"end\">\n {#if fixed}\n <span class=\"lock\" role=\"img\" aria-label={getMessages().locked}>\n <Icon name=\"lock\" tone=\"muted\" />\n </span>\n {:else if onremove}\n <Button\n variant=\"ghost\"\n icon\n aria-label={getMessages().removeAttribute({ key: a.key })}\n onclick={() => onremove?.(a.index)}\n >\n <Icon name=\"x\" />\n </Button>\n {/if}\n </span>\n </div>\n {/each}\n {#if draft}\n <div class=\"row draft\" bind:this={draftRow} onfocusout={draftOut}>\n <span class=\"k\">\n <TextInput\n bind:value={draft.key}\n placeholder={getMessages().attributeName}\n aria-label={getMessages().attributeName}\n onkeydown={draftKey}\n />\n </span>\n <span class=\"v\">\n <TextInput\n bind:value={draft.value}\n placeholder={getMessages().attributeValue}\n aria-label={getMessages().attributeValue}\n onkeydown={draftKey}\n />\n </span>\n <span class=\"end\">\n <!-- Pressing it keeps the focus in the row, so that leaving the row does not add it first -->\n <Button\n variant=\"ghost\"\n icon\n aria-label={getMessages().cancel}\n onmousedown={(e: MouseEvent) => e.preventDefault()}\n onclick={() => (draft = null)}\n >\n <Icon name=\"x\" />\n </Button>\n </span>\n </div>\n {:else if onadd}\n <Block>\n <LinkAction icon=\"plus\" onclick={open}>{getMessages().addAttribute}</LinkAction>\n </Block>\n {/if}\n {/if}\n</div>\n\n<style>.attributes {\n display: flex;\n flex-direction: column;\n min-width: 0;\n}\n\n.row {\n display: grid;\n grid-template-columns: 7.5rem minmax(0, 1fr) auto;\n align-items: center;\n column-gap: var(--kata-gap-sm);\n min-width: 0;\n flex: none;\n height: var(--kata-box, var(--kata-height-button));\n padding-inline: var(--kata-inset, 0px);\n}\n\n.k,\n.v,\n.end {\n display: flex;\n align-items: center;\n min-width: 0;\n}\n\n.k > :global(*),\n.v > :global(*) {\n flex: 1 1 auto;\n min-width: 0;\n}\n\n.draft {\n height: var(--kata-height-button);\n --kata-box: var(--kata-height-button-sm);\n}\n\n.lock {\n display: flex;\n}\n\n@container app (width < 24rem) {\n .row {\n grid-template-columns: minmax(0, 1fr) auto;\n grid-template-areas: \"k end\" \"v v\";\n height: auto;\n }\n .k {\n grid-area: k;\n }\n .v {\n grid-area: v;\n }\n .end {\n grid-area: end;\n }\n}</style>\n","<script lang=\"ts\">\n import '../styles/components.css';\n import type { Snippet } from 'svelte';\n import type { IconName } from '../icons.js';\n import Icon from './Icon.svelte';\n\n // Banner: a notice in the flow of a page or a panel. Its line takes the color of its tone (info\n // blue, warn yellow, error red, ok green) and so does its icon; the padding is pad-md. The icon\n // is centred on the first line of the text, which is not trimmed. An action (act) sits at the\n // right end; when it does not fit beside the text, it moves below it. A notice of several lines\n // puts them in a Stack. floating gives it the panel surface, for a notice over the stage; the\n // application places it.\n //\n // <Banner tone=\"warn\">The trial ends in 3 days{#snippet act()}<Button>Renew</Button>{/snippet}</Banner>\n let {\n tone,\n floating = false,\n label,\n children,\n act,\n }: {\n tone: 'info' | 'warn' | 'error' | 'ok';\n /** The panel surface, for a notice over the stage */\n floating?: boolean;\n /** The accessible name of the notice, when it is referred to by name */\n label?: string;\n children: Snippet;\n /** An action at the right end */\n act?: Snippet;\n } = $props();\n\n const MARK: Record<string, IconName> = {\n info: 'info',\n warn: 'triangle-alert',\n error: 'circle-alert',\n ok: 'circle-check',\n };\n</script>\n\n<div\n class=\"banner {tone}\"\n class:floating\n data-inset\n data-role=\"banner\"\n role={tone === 'error' ? 'alert' : 'status'}\n aria-label={label}\n>\n <div class=\"line\">\n <span class=\"mark\"><Icon name={MARK[tone]} /></span>\n <!-- A div, since the text can be a Stack of several lines -->\n <div class=\"text\">{@render children()}</div>\n </div>\n {#if act}<div class=\"act\">{@render act()}</div>{/if}\n</div>\n\n<style>.banner {\n border: var(--kata-border-width) solid var(--kata-color-line-strong);\n padding: var(--kata-pad-md);\n --kata-inset: 0px;\n --kata-at-start: 1;\n --kata-at-end: 1;\n display: flex;\n flex-wrap: wrap;\n align-items: flex-start;\n gap: var(--kata-gap-sm);\n color: var(--kata-color-text);\n min-width: 0;\n font-size: var(--kata-text-size-body);\n line-height: var(--kata-text-leading-body);\n letter-spacing: var(--kata-text-tracking-body);\n --kata-box: var(--kata-height-button);\n}\n\n.floating {\n background: var(--kata-color-panel);\n}\n\n.line {\n display: flex;\n align-items: flex-start;\n gap: var(--kata-gap-sm);\n flex: 1 1 12em;\n min-width: 0;\n}\n\n.mark {\n display: flex;\n align-items: center;\n flex: none;\n height: calc(var(--kata-text-size-body) * var(--kata-text-leading-body));\n}\n\n.text {\n flex: 1 1 auto;\n min-width: 0;\n}\n\n.act {\n margin-left: auto;\n flex: 0 1 auto;\n display: flex;\n align-items: center;\n flex-wrap: wrap;\n gap: var(--kata-gap-sm);\n min-width: 0;\n max-width: 100%;\n}\n.act > :global(*) {\n flex: 0 1 auto;\n min-width: 0;\n max-width: 100%;\n}\n\n.info {\n border-color: var(--kata-color-blue-ink);\n}\n.info .mark {\n color: var(--kata-color-blue-ink);\n}\n\n.warn {\n border-color: var(--kata-color-yellow-ink);\n}\n.warn .mark {\n color: var(--kata-color-yellow-ink);\n}\n\n.error {\n border-color: var(--kata-color-red-ink);\n}\n.error .mark {\n color: var(--kata-color-red-ink);\n}\n\n.ok {\n border-color: var(--kata-color-green-ink);\n}\n.ok .mark {\n color: var(--kata-color-green-ink);\n}</style>\n","<script lang=\"ts\">\n import '../styles/components.css';\n import type { Snippet } from 'svelte';\n\n // Stack: the vertical layout, and the only one that holds the distance between its children. The\n // author writes the distance as a gap step (the root times a power of φ); nothing is inferred. A\n // page uses 0, sm, md, lg and xl; 2xs and xs are for the inside of components. The distance runs\n // between the untrimmed line boxes of the children.\n //\n // <Stack gap=\"lg\">…</Stack>\n // <Stack gap=\"sm\" align=\"start\">…</Stack> children keep their own width (marks, badges)\n type Gap = 0 | '2xs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';\n let {\n gap,\n align = 'stretch',\n children,\n }: {\n /** The distance between children */\n gap: Gap;\n /** start keeps each child at its own width instead of the full width */\n align?: 'stretch' | 'start';\n children: Snippet;\n } = $props();\n</script>\n\n<div class=\"stack\" data-gap={gap} data-align={align} data-role=\"stack\">\n {@render children()}\n</div>\n\n<style>.stack {\n display: flex;\n flex-direction: column;\n min-width: 0;\n gap: 0;\n}\n\n.stack[data-align=start] {\n align-items: flex-start;\n}\n\n.stack[data-gap=\"2xs\"] {\n gap: var(--kata-gap-2xs);\n}\n\n.stack[data-gap=xs] {\n gap: var(--kata-gap-xs);\n}\n\n.stack[data-gap=sm] {\n gap: var(--kata-gap-sm);\n}\n\n.stack[data-gap=md] {\n gap: var(--kata-gap-md);\n}\n\n.stack[data-gap=lg] {\n gap: var(--kata-gap-lg);\n}\n\n.stack[data-gap=xl] {\n gap: var(--kata-gap-xl);\n}\n\n.stack[data-gap=\"2xl\"] {\n gap: var(--kata-gap-2xl);\n}</style>\n","<script lang=\"ts\">\n import '../styles/components.css';\n\n // ColorGrid: a grid of preset colors. The colors stand in columns (9 by default) gap-2xs\n // apart, and each color is itself the cell that is pressed; nothing is placed inside a cell. The\n // chosen cell shows one ring inside, two lines wide, with no surface or shadow added. A color\n // cannot be described by its look, so each cell is named by the color's name, and the group by\n // label.\n //\n // <ColorGrid colors={swatches} value={hex} label=\"Color\" onselect={pick} />\n let {\n colors,\n value,\n onselect,\n label,\n columns = 9,\n }: {\n colors: { hex: string; name: string }[];\n /** The chosen color (compared without regard to case) */\n value?: string;\n onselect: (hex: string) => void;\n /** The name of the group */\n label: string;\n /** The number of columns (9 by default) */\n columns?: number;\n } = $props();\n\n function on(hex: string): boolean {\n return value !== undefined && hex.toLowerCase() === value.toLowerCase();\n }\n</script>\n\n<div class=\"grid\" data-role=\"grid\" role=\"radiogroup\" aria-label={label} style:--kata-color-grid-columns={columns}>\n {#each colors as c (c.hex)}\n <button\n type=\"button\"\n class=\"cell\"\n class:on={on(c.hex)}\n role=\"radio\"\n aria-checked={on(c.hex)}\n aria-label={c.name}\n style:--kata-color-grid-color={c.hex}\n onclick={() => onselect(c.hex)}\n ></button>\n {/each}\n</div>\n\n<style>.grid {\n display: grid;\n grid-template-columns: repeat(var(--kata-color-grid-columns), minmax(0, 1fr));\n gap: var(--kata-gap-2xs);\n min-width: 0;\n}\n\n.cell {\n aspect-ratio: 1;\n width: 100%;\n border: 0;\n padding: 0;\n background: var(--kata-color-grid-color);\n box-shadow: inset 0 0 0 var(--kata-border-width) var(--kata-color-line);\n cursor: pointer;\n}\n\n.cell.on {\n box-shadow: inset 0 0 0 calc(var(--kata-border-width) * 2) var(--kata-color-focus), inset 0 0 0 calc(var(--kata-border-width) * 3) var(--kata-color-panel);\n}</style>\n","<script lang=\"ts\">\n import '../styles/components.css';\n\n // NumberInput: the input of a number. It is the same control as TextInput, with the value\n // aligned to the end and the unit, muted, on the right inside the control. The height is the one\n // the container declares. Only short values such as numbers and dates take a fixed width, and\n // only one of three: 6, 8 or 12rem.\n //\n // <Field label=\"Line width\" for=\"w\"><NumberInput id=\"w\" bind:value unit=\"px\" width=\"6rem\" /></Field>\n let {\n value = $bindable(null),\n unit,\n min,\n max,\n step,\n placeholder,\n id,\n ariaLabel,\n disabled = false,\n readonly = false,\n error = false,\n width,\n oninput,\n onchange,\n }: {\n /** The number, or null when the input is empty */\n value?: number | null;\n /** A unit (px, %, °) */\n unit?: string;\n min?: number;\n max?: number;\n /** The step; 'any' for an input that takes decimals */\n step?: number | 'any';\n /** A word shown when empty, where empty has a meaning (for example Auto) */\n placeholder?: string;\n id?: string;\n /** The accessible name where no <label for> names it */\n ariaLabel?: string;\n disabled?: boolean;\n /** Can be focused and selected, not changed */\n readonly?: boolean;\n error?: boolean;\n /** The width of the control; without it, it fills its container */\n width?: '6rem' | '8rem' | '12rem';\n /** Every key stroke (the raw value is e.currentTarget.value) */\n oninput?: (e: Event & { currentTarget: HTMLInputElement }) => void;\n /** The value is committed */\n onchange?: (e: Event & { currentTarget: HTMLInputElement }) => void;\n } = $props();\n</script>\n\n<label class=\"input\" class:err={error} class:disabled={disabled} data-role=\"box\" data-h=\"button\" style:width>\n <input\n type=\"number\"\n bind:value\n {min}\n {max}\n {step}\n {placeholder}\n {id}\n {disabled}\n {readonly}\n aria-label={ariaLabel}\n aria-invalid={error || undefined}\n {oninput}\n {onchange}\n />\n {#if unit}<span class=\"unit\">{unit}</span>{/if}\n</label>\n\n<style>.input {\n display: inline-flex;\n align-items: center;\n gap: var(--kata-gap-sm);\n height: var(--kata-box, var(--kata-height-button));\n padding-block: 0;\n padding-inline: var(--kata-pad-md);\n border: var(--kata-border-width) solid var(--kata-color-line-strong);\n border-radius: 0;\n background: transparent;\n color: var(--kata-color-text);\n white-space: nowrap;\n font: inherit;\n font-size: var(--kata-text-size-body);\n line-height: var(--kata-text-leading-body);\n letter-spacing: var(--kata-text-tracking-body);\n transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease;\n width: 100%;\n min-width: 0;\n justify-content: flex-start;\n cursor: text;\n}\n.input:focus-within {\n border-color: var(--kata-color-blue-ink);\n}\n\n.input input {\n border: 0;\n background: transparent;\n padding: 0;\n margin: 0;\n min-width: 0;\n outline: none;\n color: inherit;\n font: inherit;\n appearance: none;\n}\n.input input:focus-visible {\n outline: none;\n}\n.input input {\n flex: 1;\n align-self: stretch;\n text-align: end;\n font-variant-numeric: tabular-nums;\n}\n.input input::placeholder {\n color: var(--kata-color-faint);\n}\n\n.unit {\n color: var(--kata-color-muted);\n flex: none;\n text-box: trim-both cap alphabetic;\n padding-top: calc(var(--kata-ink-over) * 1em);\n padding-bottom: calc(var(--kata-ink-under) * 1em);\n}\n\n.err {\n border-color: var(--kata-color-red-ink);\n}\n\n.disabled {\n opacity: var(--kata-opacity-dim);\n cursor: default;\n}\n.disabled .unit {\n color: inherit;\n}</style>\n","<script lang=\"ts\">\n import '../styles/components.css';\n import type { Snippet } from 'svelte';\n\n // Row: the horizontal layout. The distance between neighbours is a gap step: 2xs between an icon\n // and its text, sm between controls, lg between groups, 0 between borderless icon buttons (their\n // hit area is the space). Text shrinks and wraps inside its own width while icons, marks and\n // controls keep theirs. A row of controls that may not fit takes wrap and moves whole items to\n // the next line.\n //\n // <Row gap=\"sm\" between wrap>…</Row>\n type Gap = '0' | '2xs' | 'sm' | 'md' | 'lg';\n let {\n gap = 'sm',\n between = false,\n wrap = false,\n align = 'center',\n justify = 'start',\n children,\n }: {\n /** The distance between items (default sm) */\n gap?: Gap;\n /** Push the first and the last item to the two ends */\n between?: boolean;\n /** Move items that do not fit to the next line */\n wrap?: boolean;\n /** Vertical alignment; stretch fills the height of the row (columns of a frame) */\n align?: 'center' | 'start' | 'end' | 'stretch';\n /** end moves the whole run to the right end */\n justify?: 'start' | 'end';\n children: Snippet;\n } = $props();\n</script>\n\n<div\n class=\"row\"\n data-gap={gap}\n data-align={align}\n data-justify={justify}\n class:between\n class:wrap\n data-role=\"row-inline\"\n data-edge-pass\n>\n {@render children()}\n</div>\n\n<style>.row {\n display: flex;\n align-items: center;\n min-width: 0;\n gap: var(--kata-gap-sm);\n}\n\n.row[data-gap=\"0\"] {\n gap: 0;\n}\n\n.row[data-gap=\"2xs\"] {\n gap: var(--kata-gap-2xs);\n}\n\n.row[data-gap=md] {\n gap: var(--kata-gap-md);\n}\n\n.row[data-gap=lg] {\n gap: var(--kata-gap-lg);\n}\n\n.row[data-align=start] {\n align-items: flex-start;\n}\n\n.row[data-align=end] {\n align-items: flex-end;\n}\n\n.row[data-align=stretch] {\n align-items: stretch;\n min-height: 0;\n}\n\n.row[data-justify=end] {\n justify-content: flex-end;\n}\n\n.between {\n justify-content: space-between;\n}\n\n.row > :global([data-role='mark']) {\n flex: none;\n}\n\n.wrap {\n flex-wrap: wrap;\n}\n.wrap > :global(*) {\n flex-shrink: 0;\n max-width: 100%;\n}\n\n.row:not(.between) > :global([data-role='caption']:last-child),\n.row:not(.between) > :global([data-role='p']:last-child) {\n flex: 1 1 auto;\n min-width: 0;\n}</style>\n","<script lang=\"ts\" generics=\"T extends string\">\n import '../styles/components.css';\n import { tick } from 'svelte';\n import Icon from './Icon.svelte';\n\n // Select: a select with a list of its own. The trigger is the control of a button with a chevron\n // on the right; the list opens below it, at least as wide as the trigger, with a check mark on\n // the left of the chosen option. Use it for five options or more, or options with a description\n // (Segmented for two to four, NativeSelect for long lists and phones). The height is the one the\n // container declares.\n //\n // The list is a popover, so it shows above everything, also inside a modal or a panel. It opens\n // upward when there is no room below and stays inside the window. The arrow keys move between\n // the options, Enter or Space chooses one, and a press outside, Escape or Tab closes the list;\n // Escape returns the focus to the trigger.\n //\n // <Select {options} bind:value onchange={apply} />\n let {\n options,\n value = $bindable(),\n placeholder = '',\n id,\n ariaLabel,\n disabled = false,\n error = false,\n onchange,\n }: {\n options: { value: T; label: string; description?: string }[];\n value?: T;\n /** The text on the trigger while nothing is chosen, faint */\n placeholder?: string;\n id?: string;\n /** The accessible name where no <label for> names it */\n ariaLabel?: string;\n disabled?: boolean;\n error?: boolean;\n onchange?: (value: T) => void;\n } = $props();\n\n const listId = $props.id();\n const current = $derived(options.find((o) => o.value === value));\n\n let open = $state(false);\n let placed = $state(false);\n let triggerEl = $state<HTMLButtonElement>();\n let listEl = $state<HTMLDivElement>();\n let pos = $state({ top: 0, left: 0, width: 0, maxHeight: 0 });\n\n // The distance from the trigger, the least distance from the window's edge, and the least height\n // below which the list opens on the other side\n const GAP = 4;\n const EDGE = 8;\n const MIN_HEIGHT = 120;\n\n // Without the popover API (a test environment) the list is a plain fixed element\n const canPopover =\n typeof HTMLElement !== 'undefined' && typeof HTMLElement.prototype.showPopover === 'function';\n\n function place() {\n if (!triggerEl || !listEl) return;\n const r = triggerEl.getBoundingClientRect();\n const keep = listEl.style.maxHeight;\n listEl.style.maxHeight = '';\n const natural = listEl.scrollHeight;\n listEl.style.maxHeight = keep;\n const below = window.innerHeight - r.bottom - GAP - EDGE;\n const above = r.top - GAP - EDGE;\n const up = below < Math.min(natural, MIN_HEIGHT) && above > below;\n const maxHeight = Math.max(MIN_HEIGHT, up ? above : below);\n const shown = Math.min(natural, maxHeight);\n const width = listEl.offsetWidth;\n const left = Math.max(\n EDGE,\n Math.min(r.left, window.innerWidth - Math.max(width, r.width) - EDGE),\n );\n pos = {\n top: Math.round(up ? r.top - GAP - shown : r.bottom + GAP),\n left: Math.round(left),\n width: Math.round(r.width),\n maxHeight: Math.round(maxHeight),\n };\n }\n\n function items(): HTMLElement[] {\n return listEl ? [...listEl.querySelectorAll<HTMLElement>('[role=\"option\"]')] : [];\n }\n function focusAt(index: number) {\n const all = items();\n if (all.length === 0) return;\n all[((index % all.length) + all.length) % all.length]?.focus();\n }\n\n function show() {\n if (disabled || open) return;\n placed = false;\n open = true;\n }\n function close(returnFocus: boolean) {\n open = false;\n if (returnFocus) triggerEl?.focus();\n }\n function choose(next: T) {\n value = next;\n onchange?.(next);\n close(true);\n }\n\n $effect(() => {\n if (!open || !listEl) return;\n const el = listEl;\n if (canPopover && !el.matches(':popover-open')) el.showPopover();\n void (async () => {\n await tick();\n place();\n placed = true;\n await tick();\n const i = options.findIndex((o) => o.value === value);\n focusAt(Math.max(0, i));\n })();\n });\n\n function onTriggerKey(e: KeyboardEvent) {\n if (e.key === 'ArrowDown' || e.key === 'ArrowUp') {\n e.preventDefault();\n show();\n }\n }\n function onListKey(e: KeyboardEvent) {\n const all = items();\n const at = all.indexOf(document.activeElement as HTMLElement);\n if (e.key === 'ArrowDown') {\n e.preventDefault();\n focusAt(at < 0 ? 0 : at + 1);\n } else if (e.key === 'ArrowUp') {\n e.preventDefault();\n focusAt(at < 0 ? all.length - 1 : at - 1);\n } else if (e.key === 'Home') {\n e.preventDefault();\n focusAt(0);\n } else if (e.key === 'End') {\n e.preventDefault();\n focusAt(all.length - 1);\n } else if (e.key === 'Escape') {\n // Escape closes the list and goes no further (a modal around it stays open)\n e.preventDefault();\n e.stopPropagation();\n close(true);\n } else if (e.key === 'Tab') {\n close(true);\n }\n }\n // A press outside the trigger and the list closes it; read in the capture phase, so that a\n // container that stops propagation does not keep it open\n function onPointerDown(e: PointerEvent) {\n if (!open) return;\n const target = e.target as Node;\n if (triggerEl?.contains(target) || listEl?.contains(target)) return;\n close(false);\n }\n</script>\n\n<svelte:window\n onpointerdowncapture={onPointerDown}\n onresize={() => open && place()}\n onscroll={() => open && place()}\n/>\n\n<button\n bind:this={triggerEl}\n type=\"button\"\n class=\"trigger\"\n class:err={error}\n class:disabled={disabled}\n data-role=\"box\"\n data-h=\"button\"\n {id}\n {disabled}\n aria-label={ariaLabel}\n aria-haspopup=\"listbox\"\n aria-expanded={open}\n aria-controls={open ? listId : undefined}\n onclick={() => (open ? close(false) : show())}\n onkeydown={onTriggerKey}\n>\n {#if current}<span class=\"v\">{current.label}</span>{:else}<span class=\"v ph\" data-kata-placeholder\n >{placeholder}</span\n >{/if}\n <Icon name=\"chevron-down\" />\n</button>\n{#if open}\n <div\n bind:this={listEl}\n id={listId}\n class=\"list\"\n class:placed\n role=\"listbox\"\n tabindex=\"-1\"\n aria-label={ariaLabel}\n popover={canPopover ? 'manual' : undefined}\n onkeydown={onListKey}\n style:top={`${pos.top}px`}\n style:left={`${pos.left}px`}\n style:min-width={pos.width ? `${pos.width}px` : undefined}\n style:max-height={pos.maxHeight ? `${pos.maxHeight}px` : undefined}\n >\n {#each options as opt (opt.value)}\n <button\n type=\"button\"\n class=\"option\"\n class:two={!!opt.description}\n role=\"option\"\n aria-selected={opt.value === value}\n tabindex=\"-1\"\n data-role=\"list-item\"\n data-h=\"list-item\"\n onclick={() => choose(opt.value)}\n >\n <span class=\"chk\">{#if opt.value === value}<Icon name=\"check\" />{/if}</span>\n {#if opt.description}\n <span class=\"text\">\n <span class=\"t\">{opt.label}</span>\n <span class=\"t desc\">{opt.description}</span>\n </span>\n {:else}\n <span class=\"t label\">{opt.label}</span>\n {/if}\n </button>\n {/each}\n </div>\n{/if}\n\n<style>.trigger {\n display: inline-flex;\n align-items: center;\n gap: var(--kata-gap-sm);\n height: var(--kata-box, var(--kata-height-button));\n padding-block: 0;\n padding-inline: var(--kata-pad-md);\n border: var(--kata-border-width) solid var(--kata-color-line-strong);\n border-radius: 0;\n background: transparent;\n color: var(--kata-color-text);\n white-space: nowrap;\n font: inherit;\n font-size: var(--kata-text-size-body);\n line-height: var(--kata-text-leading-body);\n letter-spacing: var(--kata-text-tracking-body);\n transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease;\n width: 100%;\n min-width: 0;\n justify-content: space-between;\n cursor: pointer;\n}\n.trigger[aria-expanded=true] {\n border-color: var(--kata-color-blue-ink);\n}\n\n.v {\n display: block;\n text-box: trim-both cap alphabetic;\n padding-top: calc(var(--kata-ink-over) * 1em);\n padding-bottom: calc(var(--kata-ink-under) * 1em);\n white-space: nowrap;\n overflow: clip;\n overflow-clip-margin: 0.382em;\n text-overflow: ellipsis;\n min-width: 0;\n}\n\n.ph {\n color: var(--kata-color-faint);\n}\n\n.trigger :global(svg) {\n flex: none;\n}\n\n.err {\n border-color: var(--kata-color-red-ink);\n}\n\n.disabled {\n opacity: var(--kata-opacity-dim);\n cursor: default;\n}\n\n.list {\n position: fixed;\n inset: auto;\n margin: 0;\n padding: 0;\n display: flex;\n flex-direction: column;\n overflow: auto;\n background: var(--kata-color-panel);\n border: var(--kata-border-width) solid var(--kata-color-line-strong);\n color: var(--kata-color-text);\n min-width: min(12rem, 100vw - var(--kata-gap-md) * 2);\n max-width: calc(100vw - var(--kata-gap-md) * 2);\n visibility: hidden;\n}\n\n.list.placed {\n visibility: visible;\n}\n\n.option {\n display: flex;\n align-items: center;\n gap: var(--kata-gap-sm);\n width: 100%;\n min-height: var(--kata-height-list-item);\n padding-inline: var(--kata-pad-md);\n border: 0;\n background: none;\n color: inherit;\n font-size: var(--kata-text-size-body);\n line-height: var(--kata-text-leading-body);\n letter-spacing: var(--kata-text-tracking-body);\n text-align: start;\n cursor: pointer;\n flex: none;\n}\n.option:hover {\n background: var(--kata-color-raise);\n}\n.option:focus-visible {\n outline: 2px solid var(--kata-color-focus);\n outline-offset: -2px;\n}\n\n.option.two {\n padding-block: var(--kata-pad-md);\n}\n\n.chk {\n display: flex;\n width: var(--kata-height-icon);\n flex: none;\n}\n\n.text {\n display: flex;\n flex-direction: column;\n gap: var(--kata-gap-xs);\n min-width: 0;\n}\n\n.t {\n display: block;\n min-width: 0;\n text-box: trim-both cap alphabetic;\n padding-top: calc(var(--kata-ink-over) * 1em);\n padding-bottom: calc(var(--kata-ink-under) * 1em);\n}\n\n.label {\n flex: 1;\n white-space: nowrap;\n overflow: clip;\n overflow-clip-margin: 0.382em;\n text-overflow: ellipsis;\n min-width: 0;\n}\n\n.desc {\n font-size: var(--kata-text-size-caption);\n line-height: var(--kata-text-leading-caption);\n letter-spacing: var(--kata-text-tracking-caption);\n}</style>\n","<script lang=\"ts\">\n import '../styles/components.css';\n import { untrack } from 'svelte';\n import { getMessages } from '../messages.js';\n import Button from './Button.svelte';\n import ColorGrid from './ColorGrid.svelte';\n import Icon from './Icon.svelte';\n import NumberInput from './NumberInput.svelte';\n import Row from './Row.svelte';\n import Select from './Select.svelte';\n import Stack from './Stack.svelte';\n import Text from './Text.svelte';\n import TextInput from './TextInput.svelte';\n\n // ColorPicker: a board to pick one color. It stacks, gap-sm apart, the title and a close button,\n // a grid of preset colors (ColorGrid), the plane of saturation and value, the strip of hues with\n // an eyedropper, and the fields of the value (hex, or the components) with a Select of the\n // format. Opened in the content, the board draws its own surface and line; floating in a slot that\n // draws them (bare), it keeps only its padding, so that no line is drawn twice.\n //\n // The plane and the strip are pictures of the color space, so their colors are values, not roles\n // of the design; only their size is layout, and the edges of the knobs take color roles. The\n // eyedropper works where the browser has the EyeDropper API.\n //\n // <ColorPicker bind:value onpick={apply} onclose={() => (open = false)} />\n let {\n value = $bindable('#E5484D'),\n swatches = defaultSwatches(),\n format = 'hex',\n bare = false,\n title = getMessages().color,\n onpick,\n onclose,\n }: {\n /** The chosen color (#RRGGBB) */\n value?: string;\n /** The preset colors and their names, which screen readers say */\n swatches?: { name: string; hex: string }[];\n /** The format the fields start in */\n format?: Fmt;\n /** The slot around it draws the surface and the line; the board keeps its padding only */\n bare?: boolean;\n /** The title (Color by default) */\n title?: string;\n /** Called with the color picked and its name (the hex when it has none) */\n onpick?: (hex: string, name: string) => void;\n /** Called by the close button */\n onclose?: () => void;\n } = $props();\n\n type Fmt = 'hex' | 'rgb' | 'hsl';\n /** Nine preset colors, named from the messages */\n function defaultSwatches(): { name: string; hex: string }[] {\n const m = getMessages();\n return [\n { name: m.colorRed, hex: '#E5484D' },\n { name: m.colorOrange, hex: '#D9730D' },\n { name: m.colorGold, hex: '#C29210' },\n { name: m.colorGreen, hex: '#2E9E5B' },\n { name: m.colorBlue, hex: '#2D7FF9' },\n { name: m.colorPurple, hex: '#8A5CF6' },\n { name: m.colorBlack, hex: '#1B1B1B' },\n { name: m.colorBrown, hex: '#9A6B43' },\n { name: m.colorWhite, hex: '#FFFFFF' },\n ];\n }\n const formats: { value: Fmt; label: string }[] = [\n { value: 'hex', label: 'Hex' },\n { value: 'rgb', label: 'RGB' },\n { value: 'hsl', label: 'HSL' },\n ];\n\n // ── Color conversion (hex ↔ HSV) ───────────────────────────\n function clamp01(n: number): number {\n return Math.min(1, Math.max(0, n));\n }\n function hexToRgb(input: string): [number, number, number] | null {\n let v = input.trim().replace(/^#/, '');\n if (v.length === 3)\n v = v\n .split('')\n .map((c) => c + c)\n .join('');\n if (!/^[0-9a-fA-F]{6}$/.test(v)) return null;\n return [parseInt(v.slice(0, 2), 16), parseInt(v.slice(2, 4), 16), parseInt(v.slice(4, 6), 16)];\n }\n function rgbToHsv(r: number, g: number, b: number): { h: number; s: number; v: number } {\n r /= 255;\n g /= 255;\n b /= 255;\n const max = Math.max(r, g, b);\n const min = Math.min(r, g, b);\n const d = max - min;\n let h = 0;\n if (d) {\n if (max === r) h = ((g - b) / d) % 6;\n else if (max === g) h = (b - r) / d + 2;\n else h = (r - g) / d + 4;\n h *= 60;\n if (h < 0) h += 360;\n }\n return { h, s: max === 0 ? 0 : d / max, v: max };\n }\n function hsvToHex(h: number, s: number, v: number): string {\n const c = v * s;\n const x = c * (1 - Math.abs(((h / 60) % 2) - 1));\n const m0 = v - c;\n let r = 0;\n let g = 0;\n let b = 0;\n if (h < 60) [r, g] = [c, x];\n else if (h < 120) [r, g] = [x, c];\n else if (h < 180) [g, b] = [c, x];\n else if (h < 240) [g, b] = [x, c];\n else if (h < 300) [r, b] = [x, c];\n else [r, b] = [c, x];\n const to2 = (n: number) =>\n Math.round((n + m0) * 255)\n .toString(16)\n .padStart(2, '0');\n return `#${to2(r)}${to2(g)}${to2(b)}`.toUpperCase();\n }\n function rgbToHex(r: number, g: number, b: number): string {\n const to2 = (n: number) => Math.round(n).toString(16).padStart(2, '0');\n return `#${to2(r)}${to2(g)}${to2(b)}`.toUpperCase();\n }\n function rgbToHsl(r: number, g: number, b: number): { h: number; s: number; l: number } {\n r /= 255;\n g /= 255;\n b /= 255;\n const max = Math.max(r, g, b);\n const min = Math.min(r, g, b);\n const d = max - min;\n const l = (max + min) / 2;\n let h = 0;\n let sl = 0;\n if (d) {\n sl = d / (1 - Math.abs(2 * l - 1));\n if (max === r) h = ((g - b) / d) % 6;\n else if (max === g) h = (b - r) / d + 2;\n else h = (r - g) / d + 4;\n h *= 60;\n if (h < 0) h += 360;\n }\n return { h: Math.round(h), s: Math.round(sl * 100), l: Math.round(l * 100) };\n }\n function hslToRgb(h: number, s: number, l: number): [number, number, number] {\n s /= 100;\n l /= 100;\n const c = (1 - Math.abs(2 * l - 1)) * s;\n const x = c * (1 - Math.abs(((h / 60) % 2) - 1));\n const m0 = l - c / 2;\n let r = 0;\n let g = 0;\n let b = 0;\n if (h < 60) [r, g] = [c, x];\n else if (h < 120) [r, g] = [x, c];\n else if (h < 180) [g, b] = [c, x];\n else if (h < 240) [g, b] = [x, c];\n else if (h < 300) [r, b] = [x, c];\n else [r, b] = [c, x];\n return [Math.round((r + m0) * 255), Math.round((g + m0) * 255), Math.round((b + m0) * 255)];\n }\n\n // hex (the normalized internal value) and HSV (for SV/Hue interaction). HSV is the primary state for\n // interaction and the two stay in sync.\n let hex = $state(untrack(() => value));\n let fmt = $state<Fmt>(untrack(() => format));\n let h = $state(0);\n let s = $state(0);\n let v = $state(0);\n untrack(() => {\n const c = hexToRgb(value);\n if (c) ({ h, s, v } = rgbToHsv(...c));\n });\n\n // Pure hue used as the base of the SV plane (saturation/value 100%).\n const hueColor = $derived(hsvToHex(h, 1, 1));\n\n // Split the current color into components for the fields (hex is the source of truth). fmt decides\n // whether the Hex, RGB or HSL fields are shown.\n const rgb = $derived(hexToRgb(hex) ?? ([0, 0, 0] as [number, number, number]));\n const hsl = $derived(rgbToHsl(...rgb));\n\n let svEl = $state<HTMLDivElement>();\n let hueEl = $state<HTMLDivElement>();\n let svDragging = $state(false);\n let hueDragging = $state(false);\n\n function clampInt(raw: string | number, lo: number, hi: number): number {\n const n = Math.round(Number(raw));\n if (Number.isNaN(n)) return lo;\n return Math.min(hi, Math.max(lo, n));\n }\n // Commit HSV → hex and notify (also while dragging SV/Hue). The fields follow through the rgb/hsl derivations.\n function emitHsv() {\n hex = hsvToHex(h, s, v);\n value = hex;\n onpick?.(hex, hex);\n }\n // hex → HSV. Makes SV/Hue follow when a preset or a field changes the color.\n function syncHsvFromHex() {\n const c = hexToRgb(hex);\n if (c) ({ h, s, v } = rgbToHsv(...c));\n }\n // Commit hex, make SV/Hue follow and notify (shared by the fields, presets and eyedropper).\n function applyHex(next: string) {\n hex = next;\n value = next;\n syncHsvFromHex();\n onpick?.(hex, hex);\n }\n\n function pick(sw: { name: string; hex: string }) {\n hex = sw.hex;\n value = sw.hex;\n syncHsvFromHex();\n onpick?.(sw.hex, sw.name);\n }\n // Commit the Hex field. Accepts only #RRGGBB / #RGB; invalid input reverts to the current value.\n function commitHex(e: Event) {\n const el = e.currentTarget as HTMLInputElement;\n const c = hexToRgb(el.value.trim());\n if (c) applyHex(rgbToHex(...c));\n else el.value = hex;\n }\n // Commit one RGB component (the others come from the current color). Clamped to 0..255.\n function commitRgb(i: number, raw: string) {\n const next: [number, number, number] = [...rgb];\n next[i] = clampInt(raw, 0, 255);\n applyHex(rgbToHex(...next));\n }\n // Commit one HSL component. H is clamped to 0..359, S/L to 0..100 (%).\n function commitHsl(part: 'h' | 's' | 'l', raw: string) {\n let { h: H, s: S, l: L } = hsl;\n if (part === 'h') H = clampInt(raw, 0, 360) % 360;\n else if (part === 's') S = clampInt(raw, 0, 100);\n else L = clampInt(raw, 0, 100);\n applyHex(rgbToHex(...hslToRgb(H, S, L)));\n }\n\n // ── SV (saturation = x, value = y) ─────────────────────────\n function svAt(clientX: number, clientY: number) {\n const el = svEl;\n if (!el) return;\n const r = el.getBoundingClientRect();\n s = clamp01((clientX - r.left) / r.width);\n v = 1 - clamp01((clientY - r.top) / r.height);\n emitHsv();\n }\n function svDown(e: PointerEvent) {\n svDragging = true;\n svEl?.setPointerCapture(e.pointerId);\n svAt(e.clientX, e.clientY);\n }\n function svMove(e: PointerEvent) {\n if (svDragging) svAt(e.clientX, e.clientY);\n }\n function svUp(e: PointerEvent) {\n svDragging = false;\n svEl?.releasePointerCapture(e.pointerId);\n }\n function svKey(e: KeyboardEvent) {\n const step = 0.02;\n if (e.key === 'ArrowLeft') s = clamp01(s - step);\n else if (e.key === 'ArrowRight') s = clamp01(s + step);\n else if (e.key === 'ArrowUp') v = clamp01(v + step);\n else if (e.key === 'ArrowDown') v = clamp01(v - step);\n else return;\n e.preventDefault();\n emitHsv();\n }\n\n // ── Hue (0..360) ────────────────────────────────────────────\n function hueAt(clientX: number) {\n const el = hueEl;\n if (!el) return;\n const r = el.getBoundingClientRect();\n h = clamp01((clientX - r.left) / r.width) * 360;\n emitHsv();\n }\n function hueDown(e: PointerEvent) {\n hueDragging = true;\n hueEl?.setPointerCapture(e.pointerId);\n hueAt(e.clientX);\n }\n function hueMove(e: PointerEvent) {\n if (hueDragging) hueAt(e.clientX);\n }\n function hueUp(e: PointerEvent) {\n hueDragging = false;\n hueEl?.releasePointerCapture(e.pointerId);\n }\n function hueKey(e: KeyboardEvent) {\n const step = 2;\n if (e.key === 'ArrowLeft') h = (h - step + 360) % 360;\n else if (e.key === 'ArrowRight') h = (h + step) % 360;\n else return;\n e.preventDefault();\n emitHsv();\n }\n\n // Eyedropper (Chrome's EyeDropper API; does nothing where unsupported).\n async function useEyedropper() {\n const w = window as unknown as {\n EyeDropper?: new () => { open: () => Promise<{ sRGBHex: string }> };\n };\n if (!w.EyeDropper) return;\n try {\n const res = await new w.EyeDropper().open();\n applyHex(res.sRGBHex.toUpperCase());\n } catch {\n // Ignore a canceled pick.\n }\n }\n</script>\n\n{#snippet board()}\n <Stack gap=\"sm\">\n <Row between>\n <Text role=\"h2\">{title}</Text>\n <Button variant=\"ghost\" icon aria-label={getMessages().close} onclick={onclose}>\n <Icon name=\"x\" />\n </Button>\n </Row>\n\n <ColorGrid\n colors={swatches}\n value={hex}\n label={title}\n onselect={(picked) => {\n const sw = swatches.find((c) => c.hex === picked);\n if (sw) pick(sw);\n }}\n />\n\n <!-- The plane takes the pure hue as its ground -->\n <div\n class=\"sv\"\n bind:this={svEl}\n style:--kata-color-picker-hue={hueColor}\n role=\"slider\"\n aria-label={getMessages().saturationValue}\n aria-valuemin={0}\n aria-valuemax={100}\n aria-valuenow={Math.round(s * 100)}\n aria-valuetext={getMessages().saturationValueText({\n s: Math.round(s * 100),\n v: Math.round(v * 100),\n })}\n tabindex=\"0\"\n onpointerdown={svDown}\n onpointermove={svMove}\n onpointerup={svUp}\n onkeydown={svKey}\n >\n <span class=\"knob\" style:left=\"{s * 100}%\" style:top=\"{(1 - v) * 100}%\"></span>\n </div>\n\n <Row gap=\"sm\">\n <div\n class=\"hue\"\n bind:this={hueEl}\n role=\"slider\"\n aria-label={getMessages().hue}\n aria-valuemin={0}\n aria-valuemax={360}\n aria-valuenow={Math.round(h)}\n tabindex=\"0\"\n onpointerdown={hueDown}\n onpointermove={hueMove}\n onpointerup={hueUp}\n onkeydown={hueKey}\n >\n <span class=\"knob\" style:left=\"{(h / 360) * 100}%\" style:top=\"50%\"></span>\n </div>\n <Button variant=\"ghost\" icon aria-label={getMessages().eyedropper} onclick={useEyedropper}>\n <Icon name=\"pipette\" />\n </Button>\n </Row>\n\n <!-- A row of controls, which wraps when it does not fit -->\n <Row gap=\"sm\" wrap>\n {#if fmt === 'rgb'}\n {#each ['R', 'G', 'B'] as label, i (label)}\n <NumberInput\n value={rgb[i]}\n unit={label}\n min={0}\n max={255}\n ariaLabel={label}\n onchange={(e) => commitRgb(i, e.currentTarget.value)}\n />\n {/each}\n {:else if fmt === 'hsl'}\n <NumberInput\n value={hsl.h}\n unit=\"H\"\n min={0}\n max={360}\n ariaLabel={getMessages().hue}\n onchange={(e) => commitHsl('h', e.currentTarget.value)}\n />\n <NumberInput\n value={hsl.s}\n unit=\"S\"\n min={0}\n max={100}\n ariaLabel={getMessages().saturation}\n onchange={(e) => commitHsl('s', e.currentTarget.value)}\n />\n <NumberInput\n value={hsl.l}\n unit=\"L\"\n min={0}\n max={100}\n ariaLabel={getMessages().lightness}\n onchange={(e) => commitHsl('l', e.currentTarget.value)}\n />\n {:else}\n <TextInput mono value={hex} onchange={commitHex} aria-label={getMessages().colorCode} />\n {/if}\n <div class=\"fmt\">\n <Select options={formats} bind:value={fmt} />\n </div>\n </Row>\n </Stack>\n{/snippet}\n\n<div class=\"cp\" class:bare data-inset data-role={bare ? 'block' : 'card'}>{@render board()}</div>\n\n<style>.cp {\n width: 15rem;\n max-width: 100%;\n flex: 0 0 auto;\n pointer-events: auto;\n background: var(--kata-color-panel);\n border: var(--kata-border-width) solid var(--kata-color-line-strong);\n padding: var(--kata-pad-md);\n --kata-inset: 0px;\n --kata-at-start: 1;\n --kata-at-end: 1;\n min-width: 0;\n --kata-box: var(--kata-height-button);\n}\n\n.cp.bare {\n background: none;\n border: 0;\n}\n\n.sv {\n position: relative;\n height: 7.5rem;\n background-image: linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, var(--kata-color-picker-hue, #0033ff));\n}\n\n.hue {\n position: relative;\n flex: 1 1 auto;\n min-width: 0;\n height: 0.5rem;\n background-image: linear-gradient(to right, #f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00);\n}\n\n.knob {\n position: absolute;\n width: var(--kata-height-icon);\n height: var(--kata-height-icon);\n border: calc(var(--kata-border-width) * 2) solid var(--kata-color-panel);\n box-shadow: 0 0 0 var(--kata-border-width) var(--kata-color-text);\n transform: translate(-50%, -50%);\n}\n\n.fmt {\n flex: 0 0 auto;\n}</style>\n","<script lang=\"ts\">\n import '../styles/components.css';\n\n // Spinner: a short wait. Three dots that pulse; nothing turns or blinks. It has no color or\n // size of its own: it follows the text around it. The dots are an icon ÷ φ² square, gap-2xs\n // apart, gap-sm from the label; the label is text that is not trimmed. With reduced motion the\n // dots rest at three strengths.\n //\n // <Spinner /> <Spinner label=\"Saving\" />\n let {\n label,\n }: {\n /** The words after the dots */\n label?: string;\n } = $props();\n</script>\n\n<span class=\"seat\" data-role=\"spinner\" data-edge-pass role=\"status\"\n ><span class=\"dots\" aria-hidden=\"true\"><i></i><i></i><i></i></span\n >{#if label}<span class=\"t\">{label}</span>{/if}</span\n>\n\n<style>.seat {\n display: inline-flex;\n align-items: center;\n gap: var(--kata-gap-sm);\n min-width: 0;\n}\n\n.dots {\n display: inline-flex;\n align-items: center;\n gap: var(--kata-gap-2xs);\n}\n\n.dots i {\n display: inline-block;\n width: var(--kata-size-xs-rem);\n height: var(--kata-size-xs-rem);\n background: var(--kata-color-muted);\n animation: pulse 1.2s ease-in-out infinite;\n}\n\n.dots i:nth-child(2) {\n opacity: 0.6;\n animation-delay: 0.15s;\n}\n\n.dots i:nth-child(3) {\n opacity: 0.3;\n animation-delay: 0.3s;\n}\n\n@keyframes pulse {\n 0%, 100% {\n opacity: 0.25;\n }\n 50% {\n opacity: 1;\n }\n}\n@media (prefers-reduced-motion: reduce) {\n .dots i {\n animation: none;\n }\n}</style>\n","<script lang=\"ts\">\n import '../styles/components.css';\n import type { Snippet } from 'svelte';\n import Actions from './Actions.svelte';\n import Spinner from './Spinner.svelte';\n import Stack from './Stack.svelte';\n\n // State: what a place shows when it is empty, loading or has failed: one sentence and at most\n // one note, at the start, and one action at the end (as in Actions); no picture and no heading.\n // No padding: the padding of the container it sits in applies. The sentence and the note are\n // not trimmed; sentence, note and action are gap-sm apart. A failure is a red sentence.\n //\n // <State text=\"Nothing is here yet.\" note=\"Drop a file, or…\">\n // {#snippet actions()}<Button>Add a file</Button>{/snippet}\n // </State>\n // <State loading text=\"Loading\" /> <State tone=\"error\" text=\"It could not be loaded.\" />\n let {\n text,\n note,\n tone,\n loading = false,\n actions,\n }: {\n /** The sentence */\n text: string;\n /** One sentence under it, as a caption */\n note?: string;\n /** error: a failure */\n tone?: 'error';\n /** Loading: a Spinner with the sentence as its label */\n loading?: boolean;\n /** One action */\n actions?: Snippet;\n } = $props();\n</script>\n\n<div class=\"state\" data-role=\"state\" data-pass>\n <Stack gap=\"sm\">\n {#if loading}\n <Spinner label={text} />\n {:else}\n <p class=\"t\" class:error={tone === 'error'} data-role=\"p\">{text}</p>\n {/if}\n {#if note}<span class=\"note\" data-role=\"caption\">{note}</span>{/if}\n {#if actions}<Actions primary={actions} />{/if}\n </Stack>\n</div>\n\n<style>.state {\n color: var(--kata-color-muted);\n min-width: 0;\n --kata-box: var(--kata-height-button);\n}\n\n.t {\n display: block;\n margin: 0;\n color: var(--kata-color-text);\n min-width: 0;\n font-size: var(--kata-text-size-body);\n line-height: var(--kata-text-leading-body);\n letter-spacing: var(--kata-text-tracking-body);\n}\n\n.t.error {\n color: var(--kata-color-red-ink);\n}\n\n.note {\n display: block;\n font-size: var(--kata-text-size-caption);\n line-height: var(--kata-text-leading-caption);\n letter-spacing: var(--kata-text-tracking-caption);\n color: var(--kata-color-muted);\n}</style>\n","<script lang=\"ts\">\n import '../styles/components.css';\n import type { Snippet } from 'svelte';\n\n // Footer: the actions at the bottom of a modal or a panel, in a fixed order: lead on the left,\n // then secondary, cancel and primary on the right. A destructive action does not go here (it is\n // the primary action of a confirmation). The height is a button plus pad-md above and below; the\n // sides are pad-md and a line runs along the top. When the actions do not fit beside the lead, the\n // whole group moves below it; below 48rem everything stacks at full width, primary first.\n //\n // <Footer>\n // {#snippet cancel()}…{/snippet}\n // {#snippet primary()}…{/snippet}\n // </Footer>\n let {\n lead,\n secondary,\n cancel,\n primary,\n }: {\n /** A status or an action on the left */\n lead?: Snippet;\n secondary?: Snippet;\n cancel?: Snippet;\n primary?: Snippet;\n } = $props();\n</script>\n\n<div class=\"footer\" data-role=\"footer\" data-h=\"footer\">\n {#if lead}<div class=\"lead\">{@render lead()}</div>{/if}\n <div class=\"actions\">\n {@render secondary?.()}\n {@render cancel?.()}\n {@render primary?.()}\n </div>\n</div>\n\n<style>.footer {\n display: flex;\n flex-wrap: wrap;\n justify-content: flex-end;\n align-items: center;\n gap: var(--kata-gap-sm);\n min-height: var(--kata-height-footer);\n padding: var(--kata-pad-md);\n border-top: var(--kata-border-width) solid var(--kata-color-line);\n flex: none;\n font-size: var(--kata-text-size-body);\n line-height: var(--kata-text-leading-body);\n letter-spacing: var(--kata-text-tracking-body);\n --kata-box: var(--kata-height-button);\n}\n\n.lead {\n margin-right: auto;\n display: flex;\n align-items: center;\n min-width: 0;\n flex: 1 1 auto;\n}\n\n.actions {\n display: flex;\n align-items: center;\n justify-content: flex-end;\n gap: var(--kata-gap-sm);\n margin-left: auto;\n flex: none;\n max-width: 100%;\n}\n\n@container app (width < 48rem) {\n .footer {\n flex-direction: column;\n align-items: stretch;\n }\n .actions {\n flex-direction: column-reverse;\n align-items: stretch;\n margin-left: 0;\n }\n .lead {\n order: 1;\n margin-right: 0;\n }\n}</style>\n","<script lang=\"ts\">\n import '../styles/components.css';\n import type { Snippet } from 'svelte';\n\n // Toolbar: the head of a container (a Panel, a modal, a sheet). Its height is fixed: a small\n // button with pad-md above and below, which is what it holds; pad-md at the sides. The title is\n // h2 on one line with an ellipsis, the actions sit at the right end. When the last action is an\n // icon button, tail makes the padding on the right pad-sm, so the icon's strokes line up with the\n // edge of the content below. two lets a title with a second line grow, with pad-md above and\n // below. Without a title the children are free. Tabs inside a Toolbar take its height and meet\n // its line on their own.\n //\n // <Toolbar title=\"Contents\" rule tail>\n // {#snippet end()}<Button variant=\"ghost\" icon aria-label=\"Add\"><Icon name=\"plus\" /></Button>{/snippet}\n // </Toolbar>\n let {\n title,\n titleId,\n rule = false,\n tail = false,\n two = false,\n start,\n end,\n children,\n }: {\n /** The title, h2 on one line */\n title?: string;\n /** The id of the title, for aria-labelledby */\n titleId?: string;\n /** A line along the bottom */\n rule?: boolean;\n /** The last action is an icon button */\n tail?: boolean;\n /** A title with a second line: the height grows with its content */\n two?: boolean;\n /** Before the title (back, close) */\n start?: Snippet;\n /** After the title, at the right end (the actions) */\n end?: Snippet;\n /** Free content, after the title */\n children?: Snippet;\n } = $props();\n</script>\n\n<div\n class=\"bar\"\n class:rule\n class:tail\n class:two\n data-role=\"toolbar\"\n data-h={two ? undefined : 'toolbar'}\n>\n {@render start?.()}\n {#if title}<h2 class=\"title\" id={titleId}>{title}</h2>{/if}\n {@render children?.()}\n {#if end}<div class=\"end\">{@render end()}</div>{/if}\n</div>\n\n<style>.bar {\n display: flex;\n align-items: center;\n gap: var(--kata-gap-sm);\n height: var(--kata-height-toolbar);\n padding-inline: var(--kata-pad-md);\n flex: none;\n min-width: 0;\n font-size: var(--kata-text-size-body);\n line-height: var(--kata-text-leading-body);\n letter-spacing: var(--kata-text-tracking-body);\n --kata-box: var(--kata-height-button-sm);\n}\n.bar > :global(*) {\n white-space: nowrap;\n}\n\n.tail {\n padding-inline-end: var(--kata-pad-sm);\n}\n\n.two {\n height: auto;\n min-height: var(--kata-height-toolbar);\n padding-block: var(--kata-pad-md);\n align-items: flex-start;\n}\n\n.two .title {\n white-space: normal;\n}\n\n.rule {\n border-bottom: var(--kata-border-width) solid var(--kata-color-line);\n}\n\n.title {\n flex: 1;\n font-size: var(--kata-text-size-h2);\n line-height: var(--kata-text-leading-h2);\n letter-spacing: var(--kata-text-tracking-h2);\n font-weight: 600;\n margin: 0;\n text-box: trim-both cap alphabetic;\n padding-top: calc(var(--kata-ink-over) * 1em);\n padding-bottom: calc(var(--kata-ink-under) * 1em);\n white-space: nowrap;\n overflow: clip;\n overflow-clip-margin: 0.382em;\n text-overflow: ellipsis;\n min-width: 0;\n}\n\n.end {\n display: flex;\n align-items: center;\n gap: 0;\n margin-left: auto;\n flex: none;\n}</style>\n","<script lang=\"ts\">\n import '../styles/components.css';\n import type { Snippet } from 'svelte';\n import { tick } from 'svelte';\n import { createNarrow } from '../lib/viewport.svelte.js';\n import { getMessages } from '../messages.js';\n import Actions from './Actions.svelte';\n import Button from './Button.svelte';\n import Footer from './Footer.svelte';\n import Icon from './Icon.svelte';\n import Stack from './Stack.svelte';\n import Text from './Text.svelte';\n import Toolbar from './Toolbar.svelte';\n\n // Modal: a container laid over the screen. From top to bottom: the head (a Toolbar with the title\n // and the close button, and a line below), an optional band for steps (sub), the body and the Footer. Only the\n // body shrinks and scrolls. The body has pad-md inside and stacks its children gap-md apart; flush\n // drops the padding, for content that reaches the edges and holds its own. The Footer fixes the\n // order of the actions, so the application only fills its slots.\n //\n // Below 48rem it fills the screen and the Footer's actions move into the head: the close button\n // (or back, with onback) at the start and the primary action (or the status) at the end; the\n // secondary action and the status move to Actions at the end of the body. A confirmation stays a\n // small dialog in the centre.\n //\n // Opening and closing, Escape, the scrim, the first focus and the ARIA attributes are fixed. It is\n // a <dialog> opened with showModal(): the focus stays inside and the page behind is inert.\n //\n // inline draws the same surface in the flow of a page, without a scrim, a <dialog> or a change of\n // size, for documentation.\n //\n // <Modal bind:open title=\"New document\">\n // <Field …>…</Field>\n // {#snippet cancel()}<Button onclick={() => (open = false)}>Cancel</Button>{/snippet}\n // {#snippet primary()}<Button variant=\"primary\" onclick={create}>Create</Button>{/snippet}\n // </Modal>\n let {\n open = $bindable(false),\n title,\n size = 'md',\n confirm = false,\n persistent = false,\n flush = false,\n inline = false,\n onclose,\n onback,\n children,\n sub,\n lead,\n secondary,\n cancel,\n primary,\n status,\n }: {\n open?: boolean;\n title: string;\n /** The width: sm 25rem, md 35rem, lg 45rem or xl 60rem. A confirmation is sm */\n size?: 'sm' | 'md' | 'lg' | 'xl';\n /** A confirmation: the scrim does not close it and it never fills the screen */\n confirm?: boolean;\n /** Cannot be closed: no close button, and neither Escape nor the scrim closes it */\n persistent?: boolean;\n /** The body reaches the edges; the content holds its own padding */\n flush?: boolean;\n /** The same surface in the flow of a page, for documentation (open is ignored) */\n inline?: boolean;\n /** Called once when the modal closes, however it closes */\n onclose?: () => void;\n /** On a full screen, the start of the head is back instead of close and calls this */\n onback?: () => void;\n children: Snippet;\n /** A band under the head, for steps; it does not scroll with the body */\n sub?: Snippet;\n /** The left end of the Footer: a status or a third outcome */\n lead?: Snippet;\n secondary?: Snippet;\n cancel?: Snippet;\n primary?: Snippet;\n /** The status of a modal that saves as it goes, at the left end of the Footer */\n status?: string;\n } = $props();\n\n let dialog = $state<HTMLDialogElement>();\n const titleId = $props.id();\n\n const narrow = createNarrow(48);\n $effect(narrow.start);\n const full = $derived(narrow.current && !confirm && !inline);\n\n const hasFoot = $derived(!!(lead || status || secondary || cancel || primary));\n // On a full screen with back, the secondary action is back itself; it does not show again\n const bodySecondary = $derived(full && onback ? undefined : secondary);\n // On a full screen the primary action takes the end of the head, so the status moves to the body\n const hasBodyActions = $derived(!!(lead || (status && primary) || bodySecondary));\n\n $effect(() => {\n const d = dialog;\n if (!d) return;\n if (open && !d.open) d.showModal();\n else if (!open && d.open) d.close();\n });\n\n // The first focus: cancel in a confirmation; otherwise the first input of the body, else the\n // primary action. showModal() would focus the close button of the head, so the focus is moved\n // after opening.\n $effect(() => {\n if (!open) return;\n const d = dialog;\n if (!d) return;\n tick().then(() => {\n const seats = [\n ...d.querySelectorAll<HTMLElement>(\n '[data-role=\"footer\"] button, [data-role=\"footer\"] a[href]',\n ),\n ];\n const target = confirm\n ? seats[0]\n : (d.querySelector<HTMLElement>(\n '.body input:not([type=\"hidden\"]), .body textarea, .body select',\n ) ??\n seats[seats.length - 1] ??\n d.querySelector<HTMLElement>(':scope > [data-role=\"toolbar\"] .end button'));\n target?.focus();\n });\n });\n\n // The close button and the scrim only ask to close. The modal closes on the dialog's close event,\n // the one place that calls onclose; Escape and open = false take the same path.\n function requestClose() {\n open = false;\n }\n\n function onDialogClose() {\n open = false;\n onclose?.();\n }\n</script>\n\n{#snippet statusLead()}<Text role=\"caption\">{status}</Text>{/snippet}\n\n{#snippet closeButton()}\n <Button variant=\"ghost\" icon aria-label={getMessages().close} onclick={requestClose}>\n <Icon name=\"x\" />\n </Button>\n{/snippet}\n\n{#snippet backButton()}\n <Button variant=\"ghost\" icon aria-label={getMessages().back} onclick={() => onback?.()}>\n <Icon name=\"arrow-left\" />\n </Button>\n{/snippet}\n\n{#snippet fullStart()}\n {#if onback}{@render backButton()}{:else if !persistent}{@render closeButton()}{/if}\n{/snippet}\n{#snippet fullEnd()}\n {#if primary}{@render primary()}{:else if status}{@render statusLead()}{/if}\n{/snippet}\n\n{#snippet surface()}\n {#if full}\n <Toolbar\n {title}\n {titleId}\n rule\n tail={!primary}\n start={fullStart}\n end={primary || status ? fullEnd : undefined}\n />\n {:else if persistent}\n <Toolbar {title} {titleId} rule />\n {:else}\n <Toolbar {title} {titleId} rule tail end={closeButton} />\n {/if}\n {#if sub}\n <div class=\"sub\">{@render sub()}</div>\n {/if}\n <div class=\"body\" data-inset={flush ? undefined : true} class:flush>\n {#if flush}\n {@render children()}\n {:else}\n <Stack gap=\"md\">\n {@render children()}\n {#if full && hasBodyActions}\n <Actions\n lead={lead ?? (status && primary ? statusLead : undefined)}\n secondary={bodySecondary}\n />\n {/if}\n </Stack>\n {/if}\n </div>\n {#if !full && hasFoot}\n <Footer lead={lead ?? (status ? statusLead : undefined)} {secondary} {cancel} {primary} />\n {/if}\n{/snippet}\n\n{#if inline}\n <div\n class=\"modal {size}\"\n class:confirm\n data-role=\"modal\"\n data-inline\n aria-labelledby={titleId}\n role={confirm ? 'alertdialog' : 'dialog'}\n >\n {@render surface()}\n </div>\n{:else}\n <dialog\n bind:this={dialog}\n class=\"modal {size}\"\n class:confirm\n class:full\n data-role=\"modal\"\n aria-labelledby={titleId}\n aria-modal=\"true\"\n role={confirm ? 'alertdialog' : 'dialog'}\n onclose={onDialogClose}\n oncancel={(e) => persistent && e.preventDefault()}\n onclick={(e) => e.target === dialog && !confirm && !persistent && requestClose()}\n >\n {@render surface()}\n </dialog>\n{/if}\n\n<style>.modal {\n margin: auto;\n padding: 0;\n max-width: none;\n max-height: calc(100% - var(--kata-gap-lg) * 2);\n color: var(--kata-color-text);\n background: var(--kata-color-panel);\n border: var(--kata-border-width) solid var(--kata-color-line-strong);\n display: flex;\n flex-direction: column;\n width: min(var(--kata-modal-width), 100% - var(--kata-gap-lg) * 2);\n --kata-box: var(--kata-height-button);\n}\n.modal:not([open]):not([data-inline]) {\n display: none;\n}\n.modal::backdrop {\n background: var(--kata-color-scrim);\n}\n\n.sm {\n --kata-modal-width: var(--kata-width-modal-sm);\n}\n\n.md {\n --kata-modal-width: var(--kata-width-modal-md);\n}\n\n.lg {\n --kata-modal-width: var(--kata-width-modal-lg);\n}\n\n.xl {\n --kata-modal-width: var(--kata-width-modal-xl);\n}\n\n.modal.confirm {\n width: min(var(--kata-width-modal-sm), 100% - var(--kata-gap-md) * 2);\n}\n\n.modal.full {\n width: 100%;\n max-width: 100%;\n height: 100%;\n max-height: 100%;\n border: 0;\n}\n\n.modal[data-inline] {\n margin: 0;\n max-height: none;\n width: min(var(--kata-modal-width), 100%);\n}\n\n.sub {\n padding: var(--kata-pad-sm) var(--kata-pad-md);\n border-bottom: var(--kata-border-width) solid var(--kata-color-line);\n flex: none;\n}\n\n.body {\n flex: 1 1 auto;\n min-height: 0;\n overflow: auto;\n display: flex;\n flex-direction: column;\n}\n.body > :global(*) {\n flex: none;\n}\n\n.body:not(.flush) {\n padding: var(--kata-pad-md);\n --kata-inset: 0px;\n --kata-at-start: 1;\n --kata-at-end: 1;\n}\n\n.body.flush {\n padding: 0;\n --kata-inset: var(--kata-pad-md);\n --kata-at-start: 0;\n --kata-at-end: 0;\n}</style>\n","// Which items of a bar of equal buttons fit in a width. The items are in groups: the buttons of a\n// group are itemGap apart and the groups groupGap apart. When the items do not all fit, a button\n// for the rest (\"More\") takes a group of its own at the end, the item at `keep` always shows, and\n// the others show from the start as long as they fit.\n/** The width of a bar that shows the given items, with or without the button for the rest */\nexport function barWidth(groups, shown, m, more) {\n const counts = new Map();\n for (const i of shown)\n counts.set(groups[i], (counts.get(groups[i]) ?? 0) + 1);\n let width = m.chrome;\n let n = 0;\n for (const count of counts.values()) {\n width += count * m.button + (count - 1) * m.itemGap;\n n += 1;\n }\n if (more) {\n width += m.button;\n n += 1;\n }\n return width + Math.max(0, n - 1) * m.groupGap;\n}\n/**\n * The indexes of the items that show, in order, or null when all of them fit.\n * @param groups the group of each item, in order\n * @param keep the index of the item that always shows, or -1\n */\nexport function fitBar(groups, keep, m) {\n const all = groups.map((_, i) => i);\n // Half a pixel of room for rounding\n const room = m.available + 0.5;\n if (barWidth(groups, all, m, false) <= room)\n return null;\n const chosen = new Set();\n if (keep >= 0 && keep < groups.length)\n chosen.add(keep);\n for (const i of all) {\n if (chosen.has(i))\n continue;\n if (barWidth(groups, [...chosen, i], m, true) > room)\n break;\n chosen.add(i);\n }\n return [...chosen].sort((a, b) => a - b);\n}\n","<script lang=\"ts\" module>\n import type { IconSource } from '../icons.js';\n\n /** One tool of a Drawbar */\n export interface DrawbarTool {\n id: string;\n /** The name of the tool, read by assistive technology */\n label: string;\n icon: IconSource;\n /** The key that picks the tool, shown in its tooltip */\n kbd?: string;\n /** Tools with the same group sit together; groups are gap-md apart */\n group?: string;\n /** A tool that removes something: red on hover */\n tone?: 'danger';\n disabled?: boolean;\n }\n\n /** One switch of a Drawbar: an aid that is on or off (snapping, a grid), after the tools */\n export interface DrawbarToggle {\n id: string;\n /** The name of the switch, read by assistive technology and shown in its tooltip */\n label: string;\n icon: IconSource;\n on: boolean;\n /** Called with the state the switch asks for */\n onchange: (on: boolean) => void;\n /** The key that switches it, shown in its tooltip */\n kbd?: string;\n disabled?: boolean;\n }\n</script>\n\n<script lang=\"ts\">\n import '../styles/components.css';\n import { untrack } from 'svelte';\n import { fitBar } from '../lib/fitBar.js';\n import { getMessages } from '../messages.js';\n import Button from './Button.svelte';\n import Dropdown from './Dropdown.svelte';\n import Icon from './Icon.svelte';\n import MenuDivider from './MenuDivider.svelte';\n import MenuItem from './MenuItem.svelte';\n\n // Drawbar: the toolbar of drawing tools that floats at the bottom centre of the stage.\n // Each tool is a ghost icon button; the current tool is on. Tools with the same group sit side by\n // side and the groups are gap-md apart, with pad-sm inside and one line around the whole bar (no\n // lines between tools). A tool with tone=\"danger\" turns red on hover. The switches (toggles), such\n // as snapping, form one more group after the tools; a switch that is on is pressed.\n //\n // It is placed absolutely in its positioned container, centred; bottom is its distance from the\n // container's bottom edge, a step of the gap scale. When the bar does not fit the container, the\n // tools and switches that do not fit fold into a \"More\" menu at the right end: the current tool\n // always shows, then the others from the start as long as they fit. Pressing a tool calls\n // onselect with its id; the application decides what is current. Pressing a switch calls its\n // onchange with the state it asks for. Each button shows its name and its key in a Tooltip.\n //\n // <Drawbar label=\"Tools\" {tools} {toggles} current={tool} onselect={(id) => (tool = id)} />\n type Step = '2xs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl';\n let {\n tools,\n toggles = [],\n current,\n onselect,\n label,\n bottom = 'md',\n }: {\n /** The tools, in order */\n tools: DrawbarTool[];\n /** The switches after the tools, in order */\n toggles?: DrawbarToggle[];\n /** The id of the current tool */\n current?: string;\n /** Called with the id of the tool that is pressed */\n onselect?: (id: string) => void;\n /** The name of the bar */\n label?: string;\n /** The distance from the bottom edge of the container: 0 or a gap step */\n bottom?: 0 | Step;\n } = $props();\n\n type Item = { kind: 'tool'; tool: DrawbarTool } | { kind: 'toggle'; toggle: DrawbarToggle };\n\n // The items in order, and the group of each: consecutive tools of the same group form one group,\n // and the switches one more\n const items = $derived<Item[]>([\n ...tools.map((tool): Item => ({ kind: 'tool', tool })),\n ...toggles.map((toggle): Item => ({ kind: 'toggle', toggle })),\n ]);\n const groupOf = $derived.by(() => {\n const out: number[] = [];\n let g = -1;\n let last: string | undefined;\n for (const [i, t] of tools.entries()) {\n if (i === 0 || t.group !== last) g += 1;\n out.push(g);\n last = t.group;\n }\n return [...out, ...toggles.map(() => g + 1)];\n });\n const keep = $derived(tools.findIndex((t) => t.id === current));\n\n let bar = $state<HTMLElement>();\n // The indexes of the items that show, or null when all fit\n let shownIdx = $state<number[] | null>(null);\n $effect(() => {\n const el = bar;\n const container = el?.parentElement;\n if (!el || !container) return;\n const groups = groupOf;\n const k = keep;\n const px = (v: string) => Number.parseFloat(v) || 0;\n const read = () => {\n const cs = getComputedStyle(el);\n const group = el.querySelector<HTMLElement>('.group');\n const button = el.querySelector<HTMLElement>('[data-h=\"icon-button\"]');\n const next = fitBar(groups, k, {\n button: button?.getBoundingClientRect().width ?? 0,\n itemGap: group ? px(getComputedStyle(group).columnGap) : 0,\n groupGap: px(cs.columnGap),\n chrome:\n px(cs.paddingLeft) +\n px(cs.paddingRight) +\n px(cs.borderLeftWidth) +\n px(cs.borderRightWidth),\n // The bar keeps gap-md from each side of its container, the same as its gap\n available: container.clientWidth - 2 * px(cs.columnGap),\n });\n if (String(next) !== String(untrack(() => shownIdx))) shownIdx = next;\n };\n read();\n if (typeof ResizeObserver === 'undefined') return;\n // The container's width, and the bar's own size, which follows the text size\n const ro = new ResizeObserver(read);\n ro.observe(container);\n ro.observe(el);\n return () => ro.disconnect();\n });\n\n const shown = $derived.by(() => {\n const set = shownIdx ? new Set(shownIdx) : null;\n const out: Item[][] = [];\n let last = -1;\n for (const [i, item] of items.entries()) {\n if (set && !set.has(i)) continue;\n if (groupOf[i] !== last) out.push([]);\n out[out.length - 1].push(item);\n last = groupOf[i];\n }\n return out;\n });\n const hidden = $derived(shownIdx ? items.filter((_, i) => !shownIdx?.includes(i)) : []);\n const hiddenTools = $derived(hidden.flatMap((h) => (h.kind === 'tool' ? [h.tool] : [])));\n const hiddenToggles = $derived(hidden.flatMap((h) => (h.kind === 'toggle' ? [h.toggle] : [])));\n const key = (item: Item) => `${item.kind}:${item.kind === 'tool' ? item.tool.id : item.toggle.id}`;\n</script>\n\n<div\n class=\"drawbar\"\n data-role=\"drawbar\"\n role=\"toolbar\"\n aria-label={label}\n style:bottom={bottom === 0 ? '0' : `var(--kata-gap-${bottom})`}\n bind:this={bar}\n>\n {#each shown as group, g (g)}\n <div class=\"group\">\n {#each group as item (key(item))}\n {#if item.kind === 'tool'}\n {@const t = item.tool}\n <Button\n variant=\"ghost\"\n icon\n on={t.id === current}\n tone={t.tone}\n disabled={t.disabled}\n aria-label={t.label}\n aria-keyshortcuts={t.kbd}\n shortcut={t.kbd}\n aria-pressed={t.id === current}\n onclick={() => onselect?.(t.id)}><Icon name={t.icon} /></Button\n >\n {:else}\n {@const s = item.toggle}\n <Button\n variant=\"ghost\"\n icon\n on={s.on}\n disabled={s.disabled}\n aria-label={s.label}\n aria-keyshortcuts={s.kbd}\n shortcut={s.kbd}\n aria-pressed={s.on}\n onclick={() => s.onchange(!s.on)}><Icon name={s.icon} /></Button\n >\n {/if}\n {/each}\n </div>\n {/each}\n {#if hidden.length}\n <div class=\"group\">\n <Dropdown align=\"end\" menu role=\"icon-button\">\n {#snippet trigger(toggle, open)}\n <Button\n variant=\"ghost\"\n icon\n aria-label={getMessages().more}\n aria-haspopup=\"menu\"\n aria-expanded={open}\n onclick={toggle}><Icon name=\"ellipsis\" /></Button\n >\n {/snippet}\n {#snippet panel(close)}\n {#each hiddenTools as t (t.id)}\n <MenuItem\n icon={t.icon}\n kbd={t.kbd}\n danger={t.tone === 'danger'}\n disabled={t.disabled}\n onclick={() => {\n onselect?.(t.id);\n close();\n }}>{t.label}</MenuItem\n >\n {/each}\n {#if hiddenTools.length && hiddenToggles.length}<MenuDivider />{/if}\n {#each hiddenToggles as s (s.id)}\n <MenuItem\n checked={s.on}\n kbd={s.kbd}\n disabled={s.disabled}\n onclick={() => {\n s.onchange(!s.on);\n close();\n }}>{s.label}</MenuItem\n >\n {/each}\n {/snippet}\n </Dropdown>\n </div>\n {/if}\n</div>\n\n<style>.drawbar {\n position: absolute;\n left: 50%;\n transform: translateX(-50%);\n z-index: var(--kata-z-floating);\n display: flex;\n align-items: center;\n gap: var(--kata-gap-md);\n padding: var(--kata-pad-sm);\n background: var(--kata-color-panel);\n color: var(--kata-color-text);\n border: var(--kata-border-width) solid var(--kata-color-line-strong);\n max-width: calc(100% - var(--kata-gap-md) * 2);\n overflow-x: auto;\n --kata-box: var(--kata-height-button);\n}\n.drawbar > :global(*) {\n flex: none;\n}\n\n.group {\n display: flex;\n align-items: center;\n gap: var(--kata-gap-2xs);\n}</style>\n","<script lang=\"ts\">\n import '../styles/components.css';\n import type { Snippet } from 'svelte';\n import Pair from './Pair.svelte';\n\n // InspectorRow: one setting of an inspector, a Pair of a name and a value. The name column is the\n // Pair's (7.5rem, muted); the value is a control, or a value read (ReadValue). With align=\"start\"\n // (the default) the control fills the value column; with align=\"end\" it keeps its own width at\n // the right end (a switch, a count). small is for a control of a small button's height (a Slider,\n // a Toggle): the row takes that height, so that the name and the control stay level and the row\n // is as tall as what it shows. hint is a caption under the value.\n //\n // <InspectorRow label=\"Width\"><NumberInput value={2} unit=\"px\" ariaLabel=\"Width\" /></InspectorRow>\n // <InspectorRow label=\"Visible\" align=\"end\" small><Toggle ariaLabel=\"Visible\" /></InspectorRow>\n let {\n label,\n for: htmlFor,\n hint,\n align = 'start',\n small = false,\n children,\n }: {\n /** The name */\n label: string;\n /** The id of the control that the name labels */\n for?: string;\n /** A caption under the value */\n hint?: string;\n /** start fills the value column; end keeps the value's width at the right end */\n align?: 'start' | 'end';\n /** The value is a control of a small button's height */\n small?: boolean;\n /** The control or the value */\n children: Snippet;\n } = $props();\n</script>\n\n<div class=\"inspector-row\" class:small>\n <Pair {label} for={htmlFor} note={hint}>\n {#if align === 'end'}\n <span class=\"end\">{@render children()}</span>\n {:else}\n {@render children()}\n {/if}\n </Pair>\n</div>\n\n<style>.inspector-row {\n display: flex;\n flex-direction: column;\n min-width: 0;\n flex: none;\n}\n\n.small {\n --kata-box: var(--kata-height-button-sm);\n}\n\n.end {\n display: flex;\n justify-content: flex-end;\n align-items: center;\n min-width: 0;\n}</style>\n","<script lang=\"ts\" generics=\"T extends string\">\n import '../styles/components.css';\n import Icon from './Icon.svelte';\n\n // NativeSelect: a select that looks like a trigger and opens the browser's own list. Use it on\n // phones and for long lists (languages, time zones); a Select, with its own list, is for five\n // options or more that carry a description. The control (a <label>) draws the line, holds the\n // height, the padding at the sides and the chevron on the right; the bare select inside is\n // transparent. The height is the one the container declares.\n //\n // <Field label=\"Language\" for=\"lang\"><NativeSelect id=\"lang\" {options} bind:value /></Field>\n let {\n options = [],\n groups,\n value = $bindable(),\n placeholder,\n id,\n ariaLabel,\n disabled = false,\n error = false,\n onchange,\n }: {\n /** An option that is disabled shows that it cannot be chosen now, without hiding it */\n options?: { value: T; label: string; disabled?: boolean }[];\n /** Options under headings, shown before options */\n groups?: { label: string; options: { value: T; label: string }[] }[];\n value?: T;\n /** The first line while nothing is chosen, shown faint; it goes once a value is chosen */\n placeholder?: string;\n id?: string;\n /** The accessible name where no <label for> names it */\n ariaLabel?: string;\n disabled?: boolean;\n error?: boolean;\n onchange?: (value: T) => void;\n } = $props();\n</script>\n\n<label class=\"trigger\" class:err={error} class:disabled={disabled} data-role=\"box\" data-h=\"button\">\n <select\n {id}\n {disabled}\n required={placeholder !== undefined}\n aria-label={ariaLabel}\n aria-invalid={error || undefined}\n bind:value\n onchange={(e) => onchange?.(e.currentTarget.value as T)}\n >\n {#if placeholder !== undefined}\n <option value=\"\" disabled data-kata-placeholder>{placeholder}</option>\n {/if}\n {#each groups ?? [] as group (group.label)}\n <optgroup label={group.label}>\n {#each group.options as opt (opt.value)}\n <option value={opt.value}>{opt.label}</option>\n {/each}\n </optgroup>\n {/each}\n {#each options as opt (opt.value)}\n <option value={opt.value} disabled={opt.disabled}>{opt.label}</option>\n {/each}\n </select>\n <Icon name=\"chevron-down\" />\n</label>\n\n<style>.trigger {\n display: inline-flex;\n align-items: center;\n gap: var(--kata-gap-sm);\n height: var(--kata-box, var(--kata-height-button));\n padding-block: 0;\n padding-inline: var(--kata-pad-md);\n border: var(--kata-border-width) solid var(--kata-color-line-strong);\n border-radius: 0;\n background: transparent;\n color: var(--kata-color-text);\n white-space: nowrap;\n font: inherit;\n font-size: var(--kata-text-size-body);\n line-height: var(--kata-text-leading-body);\n letter-spacing: var(--kata-text-tracking-body);\n transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease;\n width: 100%;\n min-width: 0;\n justify-content: space-between;\n cursor: pointer;\n}\n.trigger:focus-within {\n border-color: var(--kata-color-blue-ink);\n}\n\n.trigger select {\n border: 0;\n background: transparent;\n padding: 0;\n margin: 0;\n min-width: 0;\n outline: none;\n color: inherit;\n font: inherit;\n appearance: none;\n}\n.trigger select:focus-visible {\n outline: none;\n}\n.trigger select {\n flex: 1;\n align-self: stretch;\n cursor: pointer;\n}\n.trigger select:invalid {\n color: var(--kata-color-faint);\n}\n\n.trigger select option {\n background: var(--kata-color-panel);\n color: var(--kata-color-text);\n}\n\n.trigger :global(svg) {\n flex: none;\n}\n\n.err {\n border-color: var(--kata-color-red-ink);\n}\n\n.disabled {\n opacity: var(--kata-opacity-dim);\n cursor: default;\n}\n.disabled select {\n cursor: default;\n}</style>\n","<script lang=\"ts\">\n import '../styles/components.css';\n import { clampTip } from '../lib/clampTip.js';\n\n // ReadValue: a value that is read, not edited. It has no outline: it is text in the place of the\n // control of a Field or a Pair, which hold the distances. It stands in for an input on a screen\n // that is only viewed, or for a value that cannot be changed. Identifiers use mono.\n //\n // It trims its text the way Text does: inside a control (a pair or a list item) to its ink,\n // elsewhere not, and at the edge of a container on the side that touches the edge.\n //\n // <Field label=\"Handle\"><ReadValue value=\"studio\" mono /></Field>\n // <Field label=\"Email\"><Row between><ReadValue value={email} clamp /><Button>Change…</Button></Row></Field>\n let {\n value,\n mono = false,\n muted = false,\n clamp = false,\n }: {\n value: string;\n /** The monospace font, with figures of equal width */\n mono?: boolean;\n /** Not set, or left at the default (a sentence rather than a value) */\n muted?: boolean;\n /** One line with an ellipsis; the full text shows on hover when it is clipped */\n clamp?: boolean;\n } = $props();\n</script>\n\n{#if clamp}\n <span class=\"v clamp\" class:mono class:muted data-role=\"value\" use:clampTip>{value}</span>\n{:else}\n <span class=\"v\" class:mono class:muted data-role=\"value\">{value}</span>\n{/if}\n\n<style>.v {\n display: block;\n min-width: 0;\n font-size: var(--kata-text-size-body);\n line-height: var(--kata-text-leading-body);\n}\n\n@container style(--kata-in-control: 1) {\n .v {\n text-box: trim-both cap alphabetic;\n padding-top: calc(var(--kata-ink-over) * 1em);\n padding-bottom: calc(var(--kata-ink-under) * 1em);\n }\n}\n.mono {\n font-family: var(--kata-font-mono);\n font-variant-numeric: tabular-nums;\n}\n\n.muted {\n color: var(--kata-color-muted);\n}\n\n.clamp {\n white-space: nowrap;\n overflow: clip;\n overflow-clip-margin: 0.382em;\n text-overflow: ellipsis;\n min-width: 0;\n}</style>\n","<script lang=\"ts\" generics=\"T extends string\">\n import '../styles/components.css';\n import type { IconSource } from '../icons.js';\n import Icon from './Icon.svelte';\n\n // Segmented: an exclusive switch between two to four options. Each option is a control of the\n // height its container declares (a button's, or a small button's), and neighbours share one\n // line. The chosen option takes the solid surface; the outer line stays line-strong. The text is\n // trimmed to its ink and centred. Five options or more are a Select. The group is one control, so\n // its root is a box too. It does not wrap and does not shrink its padding: when it does not fit,\n // it scrolls sideways without a scrollbar.\n //\n // <Segmented bind:value options={[{ value: 'grid', label: 'Grid' }, …]} ariaLabel=\"View\" />\n //\n // An option with an icon and no label is square. When the value is derived from elsewhere, pass\n // value and onchange instead of binding it.\n let {\n options,\n value = $bindable(),\n ariaLabel,\n onchange,\n }: {\n options: {\n value: T;\n label?: string;\n icon?: IconSource;\n /** The accessible name of an option with an icon only */\n ariaLabel?: string;\n disabled?: boolean;\n }[];\n value: T;\n /** The name of the group (for example View) */\n ariaLabel?: string;\n onchange?: (value: T) => void;\n } = $props();\n</script>\n\n<div class=\"seg\" data-role=\"box\" role=\"group\" aria-label={ariaLabel}>\n {#each options as opt (opt.value)}\n <button\n class=\"opt\"\n class:on={value === opt.value}\n class:icon={!!opt.icon && !opt.label}\n type=\"button\"\n data-role=\"box\"\n data-h=\"button\"\n disabled={opt.disabled}\n aria-label={opt.ariaLabel}\n aria-pressed={value === opt.value}\n onclick={() => {\n value = opt.value;\n onchange?.(opt.value);\n }}\n >\n {#if opt.icon}<Icon name={opt.icon} />{/if}{#if opt.label}<span class=\"t\">{opt.label}</span>{/if}\n </button>\n {/each}\n</div>\n\n<style>.seg {\n display: inline-flex;\n flex: none;\n max-width: 100%;\n overflow-x: auto;\n scrollbar-width: none;\n}\n.seg::-webkit-scrollbar {\n display: none;\n}\n\n.opt {\n display: inline-flex;\n align-items: center;\n gap: var(--kata-gap-sm);\n height: var(--kata-box, var(--kata-height-button));\n padding-block: 0;\n padding-inline: var(--kata-pad-md);\n border: var(--kata-border-width) solid var(--kata-color-line-strong);\n border-radius: 0;\n background: transparent;\n color: var(--kata-color-text);\n white-space: nowrap;\n font: inherit;\n font-size: var(--kata-text-size-body);\n line-height: var(--kata-text-leading-body);\n letter-spacing: var(--kata-text-tracking-body);\n transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease;\n cursor: pointer;\n flex: none;\n min-width: 0;\n}\n.opt:hover:not(.on):not(:disabled) {\n background: var(--kata-color-raise);\n}\n.opt:active:not(:disabled) {\n background: var(--kata-color-raise-2);\n transition: none;\n}\n.opt:disabled {\n opacity: var(--kata-opacity-dim);\n cursor: default;\n}\n.opt + .opt {\n border-left-width: 0;\n}\n.opt > :global(svg) {\n flex: none;\n}\n.opt .t {\n display: block;\n min-width: 0;\n text-box: trim-both cap alphabetic;\n padding-top: calc(var(--kata-ink-over) * 1em);\n padding-bottom: calc(var(--kata-ink-under) * 1em);\n}\n\n.on {\n background: var(--kata-color-solid);\n color: var(--kata-color-on-solid);\n}\n\n.icon {\n width: var(--kata-box, var(--kata-height-button));\n padding: 0;\n justify-content: center;\n}\n\n.opt:focus-visible {\n outline: 2px solid var(--kata-color-focus);\n outline-offset: -2px;\n}</style>\n","<script lang=\"ts\">\n import '../styles/components.css';\n\n // Slider: the input of a value on a range. It is a control of the height of a small button, and\n // the whole control can be dragged. The track is two lines thick (solid on the side that has\n // been passed), the thumb is the square of an icon, and the value sits on the right in a slot of\n // fixed width, aligned to its end, so that the width does not change with the digits. It is a\n // native range input: dragging, the arrow keys and screen readers work as the browser does.\n //\n // <Slider value={opacity} display=\"70%\" ariaLabel=\"Opacity\" onchange={apply} />\n let {\n value,\n min = 0,\n max = 100,\n step = 1,\n display,\n id,\n disabled = false,\n ariaLabel,\n oninput,\n onchange,\n }: {\n value: number;\n min?: number;\n max?: number;\n step?: number;\n /** The value as shown on the right, with its unit (the number itself by default) */\n display?: string;\n id?: string;\n disabled?: boolean;\n ariaLabel?: string;\n /** Every change while dragging */\n oninput?: (value: number) => void;\n /** The value when it is let go or changed with a key */\n onchange?: (value: number) => void;\n } = $props();\n\n const pct = $derived(max > min ? ((value - min) / (max - min)) * 100 : 0);\n</script>\n\n<div class=\"slider\" class:disabled={disabled} data-role=\"switch\" data-h=\"button-sm\">\n <input\n type=\"range\"\n {min}\n {max}\n {step}\n {value}\n {id}\n {disabled}\n aria-label={ariaLabel}\n style:--kata-slider-fill={`${pct}%`}\n oninput={(e) => oninput?.(Number(e.currentTarget.value))}\n onchange={(e) => onchange?.(Number(e.currentTarget.value))}\n />\n <span class=\"val\">{display ?? String(value)}</span>\n</div>\n\n<style>.slider {\n display: flex;\n align-items: center;\n gap: var(--kata-gap-sm);\n height: var(--kata-height-button-sm);\n min-width: 0;\n}\n\ninput {\n appearance: none;\n flex: 1;\n min-width: 0;\n height: var(--kata-height-button-sm);\n margin: 0;\n padding: 0;\n border: 0;\n background: transparent;\n cursor: pointer;\n}\n\ninput::-webkit-slider-runnable-track {\n height: var(--kata-height-icon);\n background: linear-gradient(to right, var(--kata-color-solid) 0 var(--kata-slider-fill), var(--kata-color-line-strong) var(--kata-slider-fill) 100%) center/100% calc(var(--kata-border-width) * 2) no-repeat;\n}\n\ninput::-moz-range-track {\n height: var(--kata-height-icon);\n background: linear-gradient(to right, var(--kata-color-solid) 0 var(--kata-slider-fill), var(--kata-color-line-strong) var(--kata-slider-fill) 100%) center/100% calc(var(--kata-border-width) * 2) no-repeat;\n}\n\ninput::-webkit-slider-thumb {\n appearance: none;\n width: var(--kata-height-icon);\n height: var(--kata-height-icon);\n border: 0;\n border-radius: 0;\n background: var(--kata-color-text);\n}\n\ninput::-moz-range-thumb {\n appearance: none;\n width: var(--kata-height-icon);\n height: var(--kata-height-icon);\n border: 0;\n border-radius: 0;\n background: var(--kata-color-text);\n}\n\ninput:disabled {\n cursor: default;\n}\n\n.val {\n flex: none;\n width: 3.5rem;\n text-align: end;\n font-size: var(--kata-text-size-body);\n line-height: var(--kata-text-leading-body);\n letter-spacing: var(--kata-text-tracking-body);\n font-variant-numeric: tabular-nums;\n text-box: trim-both cap alphabetic;\n padding-top: calc(var(--kata-ink-over) * 1em);\n padding-bottom: calc(var(--kata-ink-under) * 1em);\n}\n\n.disabled {\n opacity: var(--kata-opacity-dim);\n}</style>\n","<script lang=\"ts\">\n import '../styles/components.css';\n import type { IconSource } from '../icons.js';\n import Icon from './Icon.svelte';\n\n // Swatch: a sample of a color, a mark of that color in the square of an icon. The color is a\n // value of the content (the color of a shape, a color scheme), not a role of the design, so it\n // is the one thing a component takes as a style (--kata-swatch-color). A line is drawn inside, so\n // that a pale color still shows its edge without growing the mark. In a list item it is centred\n // and does not change the item's height.\n //\n // The shape tells the kind of thing drawn: box (the default) a filled square, dot a point, line a\n // segment, area a small square with a line, ramp a continuous scheme (pass a gradient as the\n // color), and icon the tool's glyph in that color, over a halo of line-strong (the same glyph\n // drawn thicker) so that a light color still stands out. The sizes are fixed in rem.\n //\n // A swatch that is pressed goes inside an icon button.\n //\n // <Swatch color=\"#0033ff\" /> <Swatch shape=\"dot\" color={c} /> <Swatch shape=\"icon\" icon=\"polyline\" color={c} />\n let {\n color,\n shape = 'box',\n icon,\n fill = false,\n }: {\n /** A CSS color, or a background for ramp */\n color: string;\n /** The shape of the mark */\n shape?: 'box' | 'dot' | 'line' | 'area' | 'ramp' | 'icon';\n /** The glyph, with shape=\"icon\" */\n icon?: IconSource;\n /** Stretches to the width of its container */\n fill?: boolean;\n } = $props();\n</script>\n\n{#if shape === 'icon' && icon}\n <span data-role=\"mark\" class=\"swatch\" data-shape=\"icon\" style:--kata-swatch-color={color} aria-hidden=\"true\">\n <span class=\"halo\"><Icon name={icon} /></span>\n <span class=\"ink\" style:color><Icon name={icon} /></span>\n </span>\n{:else}\n <span\n data-role=\"mark\"\n class=\"swatch\"\n data-shape={shape}\n class:fill\n style:--kata-swatch-color={color}\n aria-hidden=\"true\"\n ></span>\n{/if}\n\n<style>.swatch {\n display: inline-block;\n width: var(--kata-height-icon);\n height: var(--kata-height-icon);\n background: var(--kata-swatch-color);\n box-shadow: inset 0 0 0 var(--kata-border-width) var(--kata-color-line);\n flex: none;\n}\n\n.swatch[data-shape=dot] {\n width: 0.5rem;\n height: 0.5rem;\n border-radius: 50%;\n}\n\n.swatch[data-shape=line] {\n width: 0.875rem;\n height: calc(var(--kata-border-width) * 2);\n box-shadow: none;\n}\n\n.swatch[data-shape=area] {\n width: 0.625rem;\n height: 0.625rem;\n box-shadow: inset 0 0 0 var(--kata-border-width) var(--kata-color-line-strong);\n}\n\n.swatch[data-shape=icon] {\n position: relative;\n background: none;\n box-shadow: none;\n}\n\n.halo,\n.ink {\n position: absolute;\n inset: 0;\n display: flex;\n}\n\n.halo {\n color: var(--kata-color-line-strong);\n}\n.halo :global(svg.kata-icon) {\n stroke-width: 3.5;\n}\n\n.swatch[data-shape=ramp] {\n width: 3rem;\n height: 0.5rem;\n box-shadow: none;\n}\n\n.swatch.fill {\n width: 100%;\n}</style>\n","<script lang=\"ts\">\n import '../styles/components.css';\n\n // Toggle: a switch for a setting that takes effect at once. It is a control of the height of a\n // small button, and the whole control is pressed. The switch is centred; its text on the right\n // (on the left with between) is trimmed to its ink and centred. It is a native checkbox with\n // role=\"switch\", so :checked holds the state, and the control is a <label>, so pressing the text\n // switches it too.\n //\n // <Toggle bind:checked={snap} label=\"Snap to grid\" />\n // <Toggle bind:checked={snap} label=\"Snap to grid\" between /> the switch at the right end\n let {\n checked = $bindable(false),\n label,\n ariaLabel,\n disabled = false,\n between = false,\n indent = false,\n id,\n onchange,\n }: {\n checked?: boolean;\n /** The text beside the switch, which is its name */\n label?: string;\n /** The text on the left and the switch at the right end (a row of settings) */\n between?: boolean;\n /** Under a parent switch: indented by pad-md */\n indent?: boolean;\n /** The accessible name when there is no text */\n ariaLabel?: string;\n disabled?: boolean;\n id?: string;\n onchange?: (checked: boolean) => void;\n } = $props();\n</script>\n\n<label class=\"ctl\" class:disabled={disabled} class:between class:indent data-role=\"switch\" data-control>\n {#if between && label}<span class=\"t grow\">{label}</span>{/if}\n <input\n type=\"checkbox\"\n role=\"switch\"\n class=\"toggle\"\n bind:checked\n {id}\n {disabled}\n aria-label={ariaLabel}\n onchange={() => onchange?.(checked)}\n />\n {#if label && !between}<span class=\"t\">{label}</span>{/if}\n</label>\n\n<style>.ctl {\n display: flex;\n align-items: center;\n gap: var(--kata-gap-sm);\n height: var(--kata-height-button-sm);\n padding-inline: var(--kata-inset, 0px);\n min-width: 0;\n cursor: pointer;\n font-size: var(--kata-text-size-body);\n line-height: var(--kata-text-leading-body);\n letter-spacing: var(--kata-text-tracking-body);\n}\n\n.between {\n justify-content: space-between;\n}\n\n.indent {\n padding-left: var(--kata-pad-md);\n}\n\n.t {\n display: block;\n min-width: 0;\n text-box: trim-both cap alphabetic;\n padding-top: calc(var(--kata-ink-over) * 1em);\n padding-bottom: calc(var(--kata-ink-under) * 1em);\n white-space: nowrap;\n overflow: clip;\n overflow-clip-margin: 0.382em;\n text-overflow: ellipsis;\n min-width: 0;\n}\n\n.grow {\n flex: 1 1 auto;\n}\n\n.toggle {\n appearance: none;\n margin: 0;\n padding: 0;\n flex: none;\n width: var(--kata-height-button);\n height: var(--kata-height-badge);\n border: var(--kata-border-width) solid var(--kata-color-line-strong);\n border-radius: 0;\n cursor: pointer;\n background-color: transparent;\n background-image: linear-gradient(var(--kata-color-muted) 0 0);\n background-repeat: no-repeat;\n background-size: calc(var(--kata-height-badge) - var(--kata-border-width) * 6) calc(var(--kata-height-badge) - var(--kata-border-width) * 6);\n background-position: left calc(var(--kata-border-width) * 2) center;\n transition: background-color 0.12s ease, border-color 0.12s ease;\n}\n\n.toggle:checked {\n background-color: var(--kata-color-solid);\n background-image: linear-gradient(var(--kata-color-on-solid) 0 0);\n background-position: right calc(var(--kata-border-width) * 2) center;\n border-color: var(--kata-color-solid);\n}\n\n.disabled {\n opacity: var(--kata-opacity-dim);\n cursor: default;\n}\n.disabled .toggle {\n cursor: default;\n}</style>\n","<script lang=\"ts\" module>\n /** The kinds of field a FieldList draws, each with its control */\n export type FieldKind =\n | 'text'\n | 'number'\n | 'select'\n | 'color'\n | 'toggle'\n | 'slider'\n | 'segmented'\n | 'custom';\n\n /** One field of a FieldList: what it edits, how, and its current value */\n export interface FieldSpec {\n /** The key the change is reported with */\n key: string;\n /** The control that edits it */\n kind: FieldKind;\n /** The name shown before the control */\n label: string;\n /** The current value, as the application holds it */\n value?: unknown;\n /** The things selected do not share one value; value is not shown */\n mixed?: boolean;\n /** The choices of select and segmented */\n options?: { value: string; label: string }[];\n min?: number;\n max?: number;\n step?: number;\n /** A unit shown after the value, as text only */\n unit?: string;\n /** A word shown while a text or a number is empty */\n placeholder?: string;\n disabled?: boolean;\n /** A caption under the control */\n hint?: string;\n }\n</script>\n\n<script lang=\"ts\">\n import '../styles/components.css';\n import type { Snippet } from 'svelte';\n import { SvelteMap } from 'svelte/reactivity';\n import { getMessages } from '../messages.js';\n import Button from './Button.svelte';\n import ColorPicker from './ColorPicker.svelte';\n import Dropdown from './Dropdown.svelte';\n import InspectorRow from './InspectorRow.svelte';\n import NativeSelect from './NativeSelect.svelte';\n import NumberInput from './NumberInput.svelte';\n import ReadValue from './ReadValue.svelte';\n import Segmented from './Segmented.svelte';\n import Slider from './Slider.svelte';\n import Stack from './Stack.svelte';\n import Swatch from './Swatch.svelte';\n import TextInput from './TextInput.svelte';\n import Toggle from './Toggle.svelte';\n\n // FieldList: the rows of settings drawn from a list of field specs. Each spec names a key, a\n // kind, a label and the current value; the list draws one InspectorRow per spec with the control\n // of its kind and reports a committed change with onchange(key, value). The values are the\n // application's: the list does not convert them, and a unit is text after the value.\n //\n // text TextInput; a string, on change (Enter or leaving the input)\n // number NumberInput; a number, or null when emptied, on change\n // select NativeSelect of the options; the option's value\n // color a button with a Swatch and the value, which opens a ColorPicker; #RRGGBB, per pick\n // toggle Toggle at the end of the row; a boolean\n // slider Slider with the value and its unit; a number, when it is let go\n // segmented Segmented of the options; the option's value\n // custom the field snippet, which receives the spec\n //\n // A field with mixed (a selection whose things differ) shows no value: an empty input, no chosen\n // option, a button without a swatch, the thumb at the start; the hint says Mixed. Any change sets\n // the one value.\n //\n // <FieldList fields={[{ key: 'width', kind: 'number', label: 'Width', value: 2, unit: 'px' }]}\n // onchange={(key, value) => apply(key, value)} />\n let {\n fields,\n onchange,\n field,\n }: {\n /** The fields, in order */\n fields: FieldSpec[];\n /** Called with the key and the value of a committed change */\n onchange?: (key: string, value: unknown) => void;\n /** Draws the control of a custom field (a snippet that receives the spec) */\n field?: Snippet<[FieldSpec]>;\n } = $props();\n\n const uid = $props.id();\n // The value of a slider while it is dragged, by key; it is reported when the slider is let go\n const dragging = new SvelteMap<string, number>();\n\n const report = (key: string, value: unknown) => onchange?.(key, value);\n const text = (f: FieldSpec) => (f.mixed || f.value == null ? '' : String(f.value));\n const num = (f: FieldSpec) =>\n !f.mixed && typeof f.value === 'number' && Number.isFinite(f.value) ? f.value : null;\n\n function commitNumber(f: FieldSpec, raw: string) {\n if (raw.trim() === '') {\n report(f.key, null);\n return;\n }\n const n = Number(raw);\n if (!Number.isNaN(n)) report(f.key, n);\n }\n\n function slide(f: FieldSpec) {\n const v = dragging.get(f.key) ?? num(f);\n return { value: v ?? f.min ?? 0, display: v === null ? '' : `${v}${f.unit ?? ''}` };\n }\n</script>\n\n<Stack gap=\"sm\">\n {#each fields as f, i (f.key)}\n {@const id = `${uid}-${i}`}\n {@const hint = f.mixed ? getMessages().mixed : f.hint}\n <InspectorRow\n label={f.label}\n for={f.kind === 'color' || f.kind === 'segmented' || f.kind === 'custom' ? undefined : id}\n {hint}\n align={f.kind === 'toggle' ? 'end' : 'start'}\n small={f.kind === 'toggle' || f.kind === 'slider'}\n >\n {#if f.kind === 'text'}\n <TextInput\n {id}\n value={text(f)}\n aria-label={f.label}\n unit={f.unit}\n placeholder={f.mixed ? getMessages().mixed : f.placeholder}\n disabled={f.disabled}\n onchange={(e) => report(f.key, e.currentTarget.value)}\n />\n {:else if f.kind === 'number'}\n <NumberInput\n {id}\n value={num(f)}\n ariaLabel={f.label}\n unit={f.unit}\n min={f.min}\n max={f.max}\n step={f.step ?? 'any'}\n placeholder={f.mixed ? getMessages().mixed : f.placeholder}\n disabled={f.disabled}\n onchange={(e) => commitNumber(f, e.currentTarget.value)}\n />\n {:else if f.kind === 'select'}\n <NativeSelect\n {id}\n options={f.options ?? []}\n value={f.mixed ? undefined : text(f)}\n ariaLabel={f.label}\n placeholder={f.mixed ? getMessages().mixed : f.placeholder}\n disabled={f.disabled}\n onchange={(v) => report(f.key, v)}\n />\n {:else if f.kind === 'color'}\n <Dropdown bare align=\"start\" role=\"box\">\n {#snippet trigger(toggle, open)}\n <Button\n trailing=\"chevron-down\"\n clamp\n mono={!f.mixed}\n disabled={f.disabled}\n aria-label={f.label}\n aria-haspopup=\"dialog\"\n aria-expanded={open}\n onclick={toggle}\n mark={f.mixed ? undefined : swatch}\n >\n {f.mixed ? getMessages().mixed : text(f)}\n </Button>\n {#snippet swatch()}<Swatch color={text(f)} />{/snippet}\n {/snippet}\n {#snippet panel(close)}\n <ColorPicker\n value={f.mixed ? '#000000' : text(f)}\n title={f.label}\n onpick={(hex) => report(f.key, hex)}\n onclose={close}\n />\n {/snippet}\n </Dropdown>\n {:else if f.kind === 'toggle'}\n <Toggle\n {id}\n checked={!f.mixed && f.value === true}\n ariaLabel={f.label}\n disabled={f.disabled}\n onchange={(v) => report(f.key, v)}\n />\n {:else if f.kind === 'slider'}\n {@const s = slide(f)}\n <Slider\n {id}\n value={s.value}\n display={s.display}\n ariaLabel={f.label}\n min={f.min}\n max={f.max}\n step={f.step}\n disabled={f.disabled}\n oninput={(v) => dragging.set(f.key, v)}\n onchange={(v) => {\n dragging.delete(f.key);\n report(f.key, v);\n }}\n />\n {:else if f.kind === 'segmented'}\n <Segmented\n options={(f.options ?? []).map((o) => ({ ...o, disabled: f.disabled }))}\n value={f.mixed ? '' : text(f)}\n ariaLabel={f.label}\n onchange={(v) => report(f.key, v)}\n />\n {:else if field}\n {@render field(f)}\n {:else}\n <ReadValue value={text(f)} />\n {/if}\n </InspectorRow>\n {/each}\n</Stack>\n","<script lang=\"ts\">\n import '../styles/components.css';\n import type { Snippet } from 'svelte';\n\n // Floating: a container that floats over the stage (a search, a navigation, a credit line), or a\n // small panel in a place that is already positioned. It has the panel color and one strong line,\n // no shadow, and floats on the floating layer. A panel placed inside needs no line of its own.\n //\n // Only its position comes from outside: the distance to each side it is pinned to. A step name\n // (2xs to xl) is that gap step; any other string is a CSS length, such as 50%. It is placed\n // absolutely in its frame, which must be a positioned element; with no side given it stands in\n // the flow and fills its place. It has no padding: list items hold their own and text goes in a\n // Block.\n //\n // <Floating left=\"md\" top=\"md\"><Block>…</Block></Floating>\n type Step = '2xs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl';\n type Place = 0 | Step | (string & {});\n const STEPS = new Set(['2xs', 'xs', 'sm', 'md', 'lg', 'xl']);\n let {\n top,\n right,\n bottom,\n left,\n children,\n }: {\n top?: Place;\n right?: Place;\n bottom?: Place;\n left?: Place;\n children: Snippet;\n } = $props();\n\n /** A step name is a gap step; 0 is 0; anything else is used as it is */\n function at(v: Place | undefined): string | undefined {\n if (v === undefined) return undefined;\n if (v === 0) return '0';\n return STEPS.has(v) ? `var(--kata-gap-${v})` : v;\n }\n</script>\n\n<div\n class=\"floating\"\n class:flow={top === undefined && right === undefined && bottom === undefined && left === undefined}\n data-role=\"floating\"\n style:top={at(top)}\n style:right={at(right)}\n style:bottom={at(bottom)}\n style:left={at(left)}\n>\n {@render children()}\n</div>\n\n<style>.floating {\n position: absolute;\n z-index: var(--kata-z-floating);\n background: var(--kata-color-panel);\n color: var(--kata-color-text);\n border: var(--kata-border-width) solid var(--kata-color-line-strong);\n min-width: 0;\n max-width: 100%;\n padding: 0;\n --kata-inset: var(--kata-pad-md);\n --kata-at-start: 0;\n --kata-at-end: 0;\n --kata-box: var(--kata-height-button);\n}\n\n.flow {\n position: static;\n display: flex;\n flex: 1 1 auto;\n min-height: 0;\n}</style>\n","<script lang=\"ts\">\n import '../styles/components.css';\n import type { Snippet } from 'svelte';\n\n // Panel: a container that stacks items reaching its edges (a side column, a left or right panel,\n // a dock). Its order is fixed: head (a Toolbar), content, foot (a Footer). The head and the foot\n // keep their size; only the content shrinks, and it scrolls when it overflows. The content has no\n // padding: lists, trees and section headers reach the edges and are stacked with Stack gap 0,\n // while text and fields go in a Block. The controls inside have a button's height.\n //\n // side: rail (the width of a side column), panel (the width of a panel) or fill (the rest of the\n // row: a dock). fit takes the height of the content only. A dock with resizable shows a grip along\n // its top edge; the grip has no look of its own, only the resize cursor. The panel reports the\n // height asked for with onresize; the application keeps it and applies its limits.\n //\n // <Panel side=\"panel\">\n // {#snippet head()}<Toolbar title=\"Contents\" rule tail>…</Toolbar>{/snippet}\n // <Stack gap={0}><SectionHeader …/><Block>…</Block></Stack>\n // {#snippet foot()}<Footer>…</Footer>{/snippet}\n // </Panel>\n let {\n side = 'panel',\n fit = false,\n resizable = false,\n onresize,\n resizeLabel,\n label,\n head,\n foot,\n children,\n }: {\n /** rail and panel are fixed widths; fill takes the rest of the row (a dock) */\n side?: 'rail' | 'panel' | 'fill';\n /** Takes the height of the content only, up to the height of its container */\n fit?: boolean;\n /** A grip along the top edge that changes the height (a dock) */\n resizable?: boolean;\n /** The height asked for by the grip, in px; the application applies its limits */\n onresize?: (height: number) => void;\n /** The name of the grip; required with resizable */\n resizeLabel?: string;\n /** The name of the panel as a region */\n label?: string;\n /** The head, a Toolbar */\n head?: Snippet;\n /** The foot, a Footer, for a panel with a main action */\n foot?: Snippet;\n /** The content; it scrolls when it overflows */\n children: Snippet;\n } = $props();\n\n // The grip. The panel measures its own height (the application sets it); onresize reports the\n // height asked for. The range it announces is the height of the element that holds the panel's\n // seat.\n let el = $state<HTMLElement>();\n let nowH = $state(0);\n let maxH = $state(0);\n let dragging = false;\n let startY = 0;\n let startH = 0;\n // One press of an arrow key, in px\n const STEP = 32;\n\n function stageHeight(): number {\n const seat = el?.parentElement;\n return seat?.parentElement?.clientHeight ?? seat?.clientHeight ?? 0;\n }\n $effect(() => {\n if (resizable) maxH = stageHeight();\n });\n function gripDown(e: PointerEvent) {\n maxH = stageHeight();\n startY = e.clientY;\n startH = nowH;\n dragging = true;\n (e.currentTarget as HTMLElement).setPointerCapture?.(e.pointerId);\n }\n function gripMove(e: PointerEvent) {\n if (!dragging) return;\n onresize?.(startH + (startY - e.clientY));\n }\n function gripUp() {\n dragging = false;\n }\n function gripKey(e: KeyboardEvent) {\n maxH = stageHeight();\n if (e.key === 'ArrowUp') onresize?.(nowH + STEP);\n else if (e.key === 'ArrowDown') onresize?.(nowH - STEP);\n else return;\n e.preventDefault();\n }\n</script>\n\n<section\n class=\"panel\"\n data-side={side}\n class:fit\n class:grip={resizable}\n data-role=\"panel\"\n aria-label={label}\n bind:this={el}\n bind:clientHeight={nowH}\n>\n {#if resizable}\n <div\n class=\"handle\"\n role=\"slider\"\n tabindex=\"0\"\n aria-label={resizeLabel}\n aria-orientation=\"vertical\"\n aria-valuenow={nowH}\n aria-valuemin={0}\n aria-valuemax={maxH}\n onpointerdown={gripDown}\n onpointermove={gripMove}\n onpointerup={gripUp}\n onpointercancel={gripUp}\n onkeydown={gripKey}\n ></div>\n {/if}\n {@render head?.()}\n <div class=\"scroll\">{@render children()}</div>\n {@render foot?.()}\n</section>\n\n<style>.panel {\n display: flex;\n flex-direction: column;\n min-height: 0;\n min-width: 0;\n background: var(--kata-color-panel);\n color: var(--kata-color-text);\n flex: none;\n --kata-box: var(--kata-height-button);\n}\n.panel > :global(*) {\n flex: none;\n}\n.panel > .scroll {\n flex: 1 1 auto;\n}\n\n.grip {\n position: relative;\n}\n\n.handle {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n height: var(--kata-pad-sm);\n z-index: 1;\n cursor: ns-resize;\n touch-action: none;\n}\n.handle:focus-visible {\n outline: 2px solid var(--kata-color-focus);\n outline-offset: -2px;\n}\n\n.fit {\n height: auto;\n max-height: 100%;\n align-self: flex-start;\n}\n\n.panel[data-side=rail] {\n width: var(--kata-width-rail);\n max-width: 100%;\n}\n\n.panel[data-side=panel] {\n width: var(--kata-width-panel);\n max-width: 100%;\n}\n\n.panel[data-side=fill] {\n flex: 1 1 auto;\n width: 100%;\n}\n\n.scroll {\n padding: 0;\n --kata-inset: var(--kata-pad-md);\n --kata-at-start: 0;\n --kata-at-end: 0;\n min-height: 0;\n min-width: 0;\n overflow: auto;\n}</style>\n","<script lang=\"ts\">\n import '../styles/components.css';\n import { getMessages } from '../messages.js';\n import Dropdown from './Dropdown.svelte';\n import Icon from './Icon.svelte';\n import MenuItem from './MenuItem.svelte';\n\n // Tabs: switches between views. A tab has the height of a list item with pad-md at the sides; the\n // current tab is underlined with a double line drawn inside it, so its height does not change.\n // Inside a Toolbar the tabs find the toolbar on their own: they take its height, and the\n // underline meets the toolbar's line (the tabs have no line of their own there).\n //\n // A tab with href is a link (it moves to another page, as the tabs of a settings page do); a tab\n // without is a button (it switches a view on the same page). Either way the current tab has\n // aria-current=\"page\". Only the current tab is in the tab order; the left and right arrow keys,\n // Home and End move the focus between the tabs, and Enter or Space opens the focused one.\n //\n // When the tabs do not fit, as many as fit show and the rest fold into a \"More\" menu at the right\n // end; nothing scrolls. The current tab always shows: its width is taken first, then the others\n // from the start as long as they fit. The widths are measured on a hidden copy of the tabs and\n // followed with a ResizeObserver.\n //\n // <Tabs {tabs} current=\"general\" onselect={(id) => (view = id)} label=\"Views\" />\n type Tab = { id: string; label: string; href?: string };\n let {\n tabs,\n current,\n label,\n onselect,\n }: {\n tabs: Tab[];\n /** The id of the current tab */\n current: string;\n /** The name of the set of tabs */\n label?: string;\n /** Called with the id of the tab that is opened */\n onselect?: (id: string) => void;\n } = $props();\n\n let root = $state<HTMLElement>();\n let measure = $state<HTMLElement>();\n // Inside a Toolbar the tabs follow its height and its line\n const bar = $derived(!!root?.parentElement?.closest('[data-role=\"toolbar\"]'));\n // The tab that is in the tab order: the current one, or the first when none is current\n const focusable = $derived(tabs.some((t) => t.id === current) ? current : tabs[0]?.id);\n\n // The indexes of the tabs that show, or null when all fit\n let shownIdx = $state<number[] | null>(null);\n $effect(() => {\n const r = root;\n const m = measure;\n if (!r || !m) return;\n void tabs;\n void current;\n const read = () => {\n const avail = r.clientWidth + 0.5;\n const widths = [...m.querySelectorAll<HTMLElement>('.tab:not(.more)')].map(\n (el) => el.getBoundingClientRect().width,\n );\n if (widths.reduce((a, b) => a + b, 0) <= avail) {\n shownIdx = null;\n return;\n }\n const ci = tabs.findIndex((t) => t.id === current);\n const chosen = new Set<number>();\n let sum = m.querySelector<HTMLElement>('.more')?.getBoundingClientRect().width ?? 0;\n if (ci >= 0) {\n chosen.add(ci);\n sum += widths[ci];\n }\n for (let i = 0; i < widths.length; i += 1) {\n if (chosen.has(i)) continue;\n if (sum + widths[i] > avail) break;\n chosen.add(i);\n sum += widths[i];\n }\n shownIdx = [...chosen].sort((a, b) => a - b);\n };\n read();\n if (typeof ResizeObserver === 'undefined') return;\n const ro = new ResizeObserver(read);\n ro.observe(r);\n return () => ro.disconnect();\n });\n const split = $derived.by(() => {\n if (!shownIdx) return { shown: tabs, hidden: [] as Tab[] };\n const set = new Set(shownIdx);\n return { shown: tabs.filter((_, i) => set.has(i)), hidden: tabs.filter((_, i) => !set.has(i)) };\n });\n\n function onkeydown(e: KeyboardEvent) {\n const all = root ? [...root.querySelectorAll<HTMLElement>('a.tab, button.tab')] : [];\n const at = all.indexOf(e.currentTarget as HTMLElement);\n if (at < 0) return;\n let next = -1;\n if (e.key === 'ArrowRight') next = (at + 1) % all.length;\n else if (e.key === 'ArrowLeft') next = (at - 1 + all.length) % all.length;\n else if (e.key === 'Home') next = 0;\n else if (e.key === 'End') next = all.length - 1;\n else return;\n e.preventDefault();\n all[next]?.focus();\n }\n</script>\n\n{#snippet tab(t: Tab)}\n {#if t.href}\n <a\n class=\"tab\"\n class:on={t.id === current}\n data-h={bar ? 'toolbar' : 'list-item'}\n href={t.href}\n tabindex={t.id === focusable ? 0 : -1}\n aria-current={t.id === current ? 'page' : undefined}\n {onkeydown}\n onclick={() => onselect?.(t.id)}><span class=\"t\">{t.label}</span></a\n >\n {:else}\n <button\n type=\"button\"\n class=\"tab\"\n class:on={t.id === current}\n data-h={bar ? 'toolbar' : 'list-item'}\n tabindex={t.id === focusable ? 0 : -1}\n aria-current={t.id === current ? 'page' : undefined}\n {onkeydown}\n onclick={() => onselect?.(t.id)}><span class=\"t\">{t.label}</span></button\n >\n {/if}\n{/snippet}\n\n<nav class=\"tabs\" class:bar aria-label={label} data-role=\"tabs\" bind:this={root}>\n {#each split.shown as t (t.id)}\n {@render tab(t)}\n {/each}\n {#if split.hidden.length}\n <Dropdown align=\"end\" menu>\n {#snippet trigger(toggle, open)}\n <button\n type=\"button\"\n class=\"tab more\"\n data-h={bar ? 'toolbar' : 'list-item'}\n tabindex=\"-1\"\n aria-haspopup=\"menu\"\n aria-expanded={open}\n {onkeydown}\n onclick={toggle}><span class=\"t\">{getMessages().more}</span><Icon name=\"chevron-down\" /></button\n >\n {/snippet}\n {#snippet panel(close)}\n {#each split.hidden as t (t.id)}\n <MenuItem\n href={t.href}\n onclick={() => {\n onselect?.(t.id);\n close();\n }}>{t.label}</MenuItem\n >\n {/each}\n {/snippet}\n </Dropdown>\n {/if}\n <!-- A hidden copy of every tab and of \"More\", to measure their widths -->\n <span class=\"measure\" aria-hidden=\"true\" data-kata-skip bind:this={measure}>\n {#each tabs as t (t.id)}\n <span class=\"tab\"><span class=\"t\">{t.label}</span></span>\n {/each}\n <span class=\"tab more\"><span class=\"t\">{getMessages().more}</span><Icon name=\"chevron-down\" /></span>\n </span>\n</nav>\n\n<style>.tabs {\n position: relative;\n display: flex;\n min-width: 0;\n flex: none;\n border-bottom: var(--kata-border-width) solid var(--kata-color-line);\n overflow: clip;\n}\n\n.tabs.bar {\n border-bottom: 0;\n flex: 1 1 auto;\n}\n.tabs.bar .tab {\n height: var(--kata-height-toolbar);\n}\n\n.tab {\n flex: none;\n display: inline-flex;\n align-items: center;\n gap: var(--kata-gap-2xs);\n height: var(--kata-height-list-item);\n padding-inline: var(--kata-pad-md);\n border: 0;\n background: none;\n color: var(--kata-color-muted);\n font: inherit;\n font-size: var(--kata-text-size-body);\n line-height: var(--kata-text-leading-body);\n letter-spacing: var(--kata-text-tracking-body);\n white-space: nowrap;\n text-decoration: none;\n cursor: pointer;\n transition: color 0.12s ease;\n}\n.tab:hover {\n color: var(--kata-color-text);\n background: var(--kata-color-raise);\n text-decoration: none;\n}\n.tab:focus-visible {\n outline: 2px solid var(--kata-color-focus);\n outline-offset: -2px;\n}\n\n.t {\n display: block;\n min-width: 0;\n text-box: trim-both cap alphabetic;\n padding-top: calc(var(--kata-ink-over) * 1em);\n padding-bottom: calc(var(--kata-ink-under) * 1em);\n}\n\n.on {\n color: var(--kata-color-text);\n box-shadow: inset 0 calc(var(--kata-border-width) * -2) 0 var(--kata-color-blue-ink);\n}\n\n.measure {\n position: absolute;\n inset-inline-start: 0;\n top: 0;\n display: flex;\n visibility: hidden;\n pointer-events: none;\n white-space: nowrap;\n}</style>\n","<script lang=\"ts\">\n import '../styles/components.css';\n import type { Snippet } from 'svelte';\n import type { IconSource } from '../icons.js';\n import { getMessages } from '../messages.js';\n import Button from './Button.svelte';\n import Icon from './Icon.svelte';\n import InlineEdit from './InlineEdit.svelte';\n import Panel from './Panel.svelte';\n import Stack from './Stack.svelte';\n import Tabs from './Tabs.svelte';\n import Text from './Text.svelte';\n import Toolbar from './Toolbar.svelte';\n\n // InspectorFrame: the panel that shows the thing selected and lets it be changed. The head is a\n // Toolbar with an optional icon, the name (changed where it stands with InlineEdit, or a title\n // when it cannot be changed), an optional second line, the application's controls (head) and a\n // close button. The tabs, when there are several views, are a second Toolbar under it; the\n // content is the sections of the current tab, stacked with gap 0; end is the foot (a Footer).\n //\n // The frame shows the name it is given. When the name is committed, ontitle receives it trimmed;\n // the application updates title (at once), or the name goes back to title, so a name the\n // application does not take (an empty one, say) is not left on screen.\n //\n // <InspectorFrame title={name} ontitle={rename} {tabs} bind:current onclose={close}>\n // {#if current === 'style'}<InspectorSection title=\"Fill\">…</InspectorSection>{/if}\n // </InspectorFrame>\n let {\n title,\n ontitle,\n titleEditable = true,\n placeholder,\n subtitle,\n icon,\n tabs = [],\n current = $bindable(tabs[0]?.id ?? ''),\n onselect,\n head,\n end,\n onclose,\n side = 'panel',\n children,\n }: {\n /** The name of the thing shown */\n title: string;\n /** Called with the name committed, trimmed; the name can be changed only with it */\n ontitle?: (name: string) => void;\n /** false shows the name as a title that cannot be changed */\n titleEditable?: boolean;\n /** The action shown while the name is empty (the addName message by default) */\n placeholder?: string;\n /** A second line under the name (the kind of the thing, a count) */\n subtitle?: string;\n /** An icon before the name */\n icon?: IconSource;\n /** The views of the thing; with none, the head has no tabs */\n tabs?: { id: string; label: string }[];\n /** The id of the current tab */\n current?: string;\n /** Called with the id of the tab that is opened */\n onselect?: (id: string) => void;\n /** More controls in the head, icon buttons before the close button (a snippet) */\n head?: Snippet;\n /** The foot of the panel, a Footer with the actions (a snippet) */\n end?: Snippet;\n /** Shows a close button in the head and is called when it is pressed */\n onclose?: () => void;\n /** The width of the panel, as Panel's side */\n side?: 'rail' | 'panel' | 'fill';\n /** The sections of the current tab */\n children: Snippet;\n } = $props();\n\n const editable = $derived(titleEditable && !!ontitle);\n const action = $derived(placeholder ?? getMessages().addName);\n // The name on screen. It follows title, and goes back to it after a commit the application did\n // not take.\n let name = $derived(title);\n\n function commit(next: string) {\n ontitle?.(next);\n if (title !== next) name = title;\n }\n\n function select(id: string) {\n current = id;\n onselect?.(id);\n }\n</script>\n\n{#snippet headEnd()}\n {@render head?.()}\n {#if onclose}\n <Button variant=\"ghost\" icon aria-label={getMessages().close} onclick={() => onclose?.()}>\n <Icon name=\"x\" />\n </Button>\n {/if}\n{/snippet}\n\n{#snippet lead()}{#if icon}<Icon name={icon} />{/if}{/snippet}\n\n{#snippet nameOf()}\n {#if editable}\n <span class=\"name\">\n <InlineEdit\n bind:value={name}\n title\n placeholder={action}\n label={name ? getMessages().rename : action}\n onCommit={commit}\n />\n </span>\n {:else}\n <Text role=\"h2\" as=\"h2\" clamp>{title}</Text>\n {/if}\n{/snippet}\n\n<Panel {side} foot={end} label={title || action}>\n {#snippet head()}\n <Toolbar\n title={!editable && !subtitle ? title : undefined}\n rule={tabs.length === 0}\n tail={!!(onclose || head)}\n two={!!subtitle}\n start={icon ? lead : undefined}\n end={onclose || head ? headEnd : undefined}\n >\n {#if subtitle}\n <span class=\"name\">\n <Stack gap=\"2xs\">\n {@render nameOf()}\n <Text role=\"caption\" muted>{subtitle}</Text>\n </Stack>\n </span>\n {:else if editable}\n {@render nameOf()}\n {/if}\n </Toolbar>\n {#if tabs.length > 0}\n <Toolbar rule><Tabs {tabs} {current} onselect={select} /></Toolbar>\n {/if}\n {/snippet}\n <Stack gap={0}>{@render children()}</Stack>\n</Panel>\n\n<style>.name {\n display: flex;\n flex-direction: column;\n flex: 1 1 auto;\n min-width: 0;\n}</style>\n","<script lang=\"ts\">\n import '../styles/components.css';\n import type { Snippet } from 'svelte';\n import Stack from './Stack.svelte';\n\n // SectionHeader: a titled group inside a panel. The head is the name (label role, trimmed to its\n // ink) with pad-md at the sides and, on the right, an optional action (a small button: an icon\n // button, or a bordered text button). The head has the height of its ink; the action overlaps it\n // without taking height.\n //\n // The head is closer to its own content than to what comes before: the break above is the lower\n // half of the previous group plus pad-sm (about pad-lg from the previous ink; pad-lg after a\n // line), and the head is pad-md from the content. The content has pad-md on its sides and bottom,\n // so text, fields and pairs go in directly, without a Block. Content that reaches the edges\n // (List, Tree, Table, Disclosure) takes flush (no padding).\n //\n // Section headers are stacked with gap 0. rule draws a line above, with the same distance from the\n // ink on both sides.\n //\n // <SectionHeader label=\"Layers\" flush>\n // {#snippet actions()}…{/snippet}\n // <List>…</List>\n // </SectionHeader>\n let {\n label,\n actions,\n flush = false,\n rule = false,\n gap = 'sm',\n children,\n }: {\n /** The name of the group */\n label: string;\n /** The action on the right of the head */\n actions?: Snippet;\n /** The content reaches the edges (List, Tree, Table, Disclosure) */\n flush?: boolean;\n /** Draw a line above */\n rule?: boolean;\n /** The distance between the content's children (default sm; not used with flush) */\n gap?: 0 | 'sm' | 'md';\n children: Snippet;\n } = $props();\n</script>\n\n<div class=\"kata-section-header\" class:flush class:rule data-role=\"section-header\">\n <div class=\"head\" data-role=\"section-head\">\n <span class=\"label\">{label}</span>\n {#if actions}<div class=\"side\">{@render actions()}</div>{/if}\n </div>\n <div class=\"body\" data-inset={flush ? undefined : true}>\n {#if flush}{@render children()}{:else}<Stack {gap}>{@render children()}</Stack>{/if}\n </div>\n</div>\n\n<style>.kata-section-header {\n padding: 0;\n --kata-inset: var(--kata-pad-md);\n --kata-at-start: 0;\n --kata-at-end: 0;\n display: flex;\n flex-direction: column;\n min-width: 0;\n flex: none;\n padding-block-start: var(--kata-pad-sm);\n --kata-box: var(--kata-height-button);\n}\n\n.kata-section-header:first-child,\n:global([data-role='rule']) + .kata-section-header {\n padding-block-start: var(--kata-pad-lg);\n}\n\n.rule {\n border-top: var(--kata-border-width) solid var(--kata-color-line);\n padding-block-start: var(--kata-pad-lg);\n}\n\n:global(.kata-section-header:has(+ .kata-section-header.rule)) > .body {\n padding-bottom: var(--kata-pad-lg);\n}\n\n:global(.kata-section-header.flush:has(+ .kata-section-header.rule)) > .body {\n padding-bottom: var(--kata-pad-sm);\n}\n\n.body {\n padding: var(--kata-pad-md);\n min-width: 0;\n --kata-inset: 0px;\n}\n\n.kata-section-header:not(.flush) > .body {\n --kata-at-start: 1;\n --kata-at-end: 1;\n}\n\n.flush > .body {\n padding: 0;\n --kata-inset: var(--kata-pad-md);\n}\n\n.flush > .body > :global([data-role='list-item']:last-child) {\n padding-bottom: var(--kata-pad-md);\n}\n\n.head {\n display: flex;\n align-items: center;\n gap: var(--kata-gap-sm);\n padding-inline: var(--kata-pad-md);\n min-width: 0;\n font-size: var(--kata-text-size-body);\n line-height: var(--kata-text-leading-body);\n letter-spacing: var(--kata-text-tracking-body);\n --kata-box: var(--kata-height-button-sm);\n}\n\n.label {\n flex: 1;\n font-size: var(--kata-text-size-label);\n line-height: var(--kata-text-leading-label);\n letter-spacing: var(--kata-text-tracking-label);\n font-weight: 600;\n text-box: trim-both cap alphabetic;\n padding-top: calc(var(--kata-ink-over) * 1em);\n padding-bottom: calc(var(--kata-ink-under) * 1em);\n white-space: nowrap;\n overflow: clip;\n overflow-clip-margin: 0.382em;\n text-overflow: ellipsis;\n min-width: 0;\n}\n\n.side {\n display: flex;\n align-items: center;\n gap: var(--kata-gap-sm);\n margin-left: auto;\n height: 0;\n overflow: visible;\n}</style>\n","<script lang=\"ts\">\n import '../styles/components.css';\n import type { Snippet } from 'svelte';\n import { getMessages } from '../messages.js';\n import Button from './Button.svelte';\n import Icon from './Icon.svelte';\n import SectionHeader from './SectionHeader.svelte';\n\n // InspectorSection: a titled group of an inspector, a SectionHeader that can fold. The head is\n // the title and, on the right, the application's actions (end) and, with collapsible, a small\n // ghost button with a chevron that opens and closes the group. Closed, only the head remains.\n // The rows (InspectorRow, a FieldList) go straight in; sections are stacked with gap 0.\n //\n // <InspectorSection title=\"Stroke\" collapsible bind:open>\n // <FieldList fields={stroke} onchange={apply} />\n // </InspectorSection>\n let {\n title,\n collapsible = false,\n open = $bindable(true),\n ontoggle,\n end,\n rule = false,\n flush = false,\n children,\n }: {\n /** The name of the group */\n title: string;\n /** The group can be closed and opened */\n collapsible?: boolean;\n /** Whether the content shows (open by default) */\n open?: boolean;\n /** Called with the new state when the chevron is pressed */\n ontoggle?: (open: boolean) => void;\n /** Actions on the right of the head, small buttons (a snippet) */\n end?: Snippet;\n /** Draws a line above the group */\n rule?: boolean;\n /** The content reaches the edges (a list, a tree) */\n flush?: boolean;\n /** The rows */\n children: Snippet;\n } = $props();\n\n const shown = $derived(!collapsible || open);\n\n function toggle() {\n open = !open;\n ontoggle?.(open);\n }\n</script>\n\n{#snippet actions()}\n {@render end?.()}\n {#if collapsible}\n <Button\n variant=\"ghost\"\n icon\n aria-label={open ? getMessages().collapse : getMessages().expand}\n aria-expanded={open}\n onclick={toggle}\n >\n <Icon name={open ? 'chevron-down' : 'chevron-right'} />\n </Button>\n {/if}\n{/snippet}\n\n<SectionHeader\n label={title}\n {rule}\n flush={flush || !shown}\n actions={end || collapsible ? actions : undefined}\n>\n {#if shown}{@render children()}{/if}\n</SectionHeader>\n","<script lang=\"ts\">\n import '../styles/components.css';\n import type { Snippet } from 'svelte';\n\n // Kbd: a key or a shortcut. It has two forms. With an outline (monospace caption, a line, pad-xs\n // at the sides, the height of a badge) it sits among words, in a tooltip or a sentence. bare is\n // the monospace text alone, for a column at the right end of a menu or a list of shortcuts. The\n // text is trimmed to its ink in both. One shortcut is one Kbd (\"⌘K\"), not one per key.\n //\n // <Kbd>⌘K</Kbd> <Kbd bare>⌘K</Kbd>\n let {\n bare = false,\n children,\n }: {\n /** Without the outline, for a column of shortcuts */\n bare?: boolean;\n children: Snippet;\n } = $props();\n</script>\n\n<kbd data-role=\"mark\" data-h={bare ? undefined : 'badge'} class=\"kbd\" class:bare\n ><span class=\"key\">{@render children()}</span></kbd\n>\n\n<style>.kbd {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n height: var(--kata-height-badge);\n padding-inline: var(--kata-pad-xs);\n border: var(--kata-border-width) solid var(--kata-color-line-strong);\n font-family: var(--kata-font-mono);\n font-size: var(--kata-text-size-caption);\n line-height: var(--kata-text-leading-caption);\n letter-spacing: var(--kata-text-tracking-caption);\n white-space: nowrap;\n flex: none;\n}\n\n.key {\n display: block;\n min-width: 0;\n text-box: trim-both cap alphabetic;\n padding-top: calc(var(--kata-ink-over) * 1em);\n padding-bottom: calc(var(--kata-ink-under) * 1em);\n}\n\n.bare {\n border: 0;\n padding: 0;\n height: auto;\n}</style>\n","/**!\n * Sortable 1.15.7\n * @author\tRubaXa <trash@rubaxa.org>\n * @author\towenm <owen23355@gmail.com>\n * @license MIT\n */\nfunction _arrayLikeToArray(r, a) {\n (null == a || a > r.length) && (a = r.length);\n for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];\n return n;\n}\nfunction _arrayWithoutHoles(r) {\n if (Array.isArray(r)) return _arrayLikeToArray(r);\n}\nfunction _defineProperty(e, r, t) {\n return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {\n value: t,\n enumerable: !0,\n configurable: !0,\n writable: !0\n }) : e[r] = t, e;\n}\nfunction _extends() {\n return _extends = Object.assign ? Object.assign.bind() : function (n) {\n for (var e = 1; e < arguments.length; e++) {\n var t = arguments[e];\n for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);\n }\n return n;\n }, _extends.apply(null, arguments);\n}\nfunction _iterableToArray(r) {\n if (\"undefined\" != typeof Symbol && null != r[Symbol.iterator] || null != r[\"@@iterator\"]) return Array.from(r);\n}\nfunction _nonIterableSpread() {\n throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\nfunction ownKeys(e, r) {\n var t = Object.keys(e);\n if (Object.getOwnPropertySymbols) {\n var o = Object.getOwnPropertySymbols(e);\n r && (o = o.filter(function (r) {\n return Object.getOwnPropertyDescriptor(e, r).enumerable;\n })), t.push.apply(t, o);\n }\n return t;\n}\nfunction _objectSpread2(e) {\n for (var r = 1; r < arguments.length; r++) {\n var t = null != arguments[r] ? arguments[r] : {};\n r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {\n _defineProperty(e, r, t[r]);\n }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {\n Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));\n });\n }\n return e;\n}\nfunction _objectWithoutProperties(e, t) {\n if (null == e) return {};\n var o,\n r,\n i = _objectWithoutPropertiesLoose(e, t);\n if (Object.getOwnPropertySymbols) {\n var n = Object.getOwnPropertySymbols(e);\n for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);\n }\n return i;\n}\nfunction _objectWithoutPropertiesLoose(r, e) {\n if (null == r) return {};\n var t = {};\n for (var n in r) if ({}.hasOwnProperty.call(r, n)) {\n if (-1 !== e.indexOf(n)) continue;\n t[n] = r[n];\n }\n return t;\n}\nfunction _toConsumableArray(r) {\n return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();\n}\nfunction _toPrimitive(t, r) {\n if (\"object\" != typeof t || !t) return t;\n var e = t[Symbol.toPrimitive];\n if (void 0 !== e) {\n var i = e.call(t, r || \"default\");\n if (\"object\" != typeof i) return i;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (\"string\" === r ? String : Number)(t);\n}\nfunction _toPropertyKey(t) {\n var i = _toPrimitive(t, \"string\");\n return \"symbol\" == typeof i ? i : i + \"\";\n}\nfunction _typeof(o) {\n \"@babel/helpers - typeof\";\n\n return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) {\n return typeof o;\n } : function (o) {\n return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o;\n }, _typeof(o);\n}\nfunction _unsupportedIterableToArray(r, a) {\n if (r) {\n if (\"string\" == typeof r) return _arrayLikeToArray(r, a);\n var t = {}.toString.call(r).slice(8, -1);\n return \"Object\" === t && r.constructor && (t = r.constructor.name), \"Map\" === t || \"Set\" === t ? Array.from(r) : \"Arguments\" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;\n }\n}\n\nvar version = \"1.15.7\";\n\nfunction userAgent(pattern) {\n if (typeof window !== 'undefined' && window.navigator) {\n return !! /*@__PURE__*/navigator.userAgent.match(pattern);\n }\n}\nvar IE11OrLess = userAgent(/(?:Trident.*rv[ :]?11\\.|msie|iemobile|Windows Phone)/i);\nvar Edge = userAgent(/Edge/i);\nvar FireFox = userAgent(/firefox/i);\nvar Safari = userAgent(/safari/i) && !userAgent(/chrome/i) && !userAgent(/android/i);\nvar IOS = userAgent(/iP(ad|od|hone)/i);\nvar ChromeForAndroid = userAgent(/chrome/i) && userAgent(/android/i);\n\nvar captureMode = {\n capture: false,\n passive: false\n};\nfunction on(el, event, fn) {\n el.addEventListener(event, fn, !IE11OrLess && captureMode);\n}\nfunction off(el, event, fn) {\n el.removeEventListener(event, fn, !IE11OrLess && captureMode);\n}\nfunction matches( /**HTMLElement*/el, /**String*/selector) {\n if (!selector) return;\n selector[0] === '>' && (selector = selector.substring(1));\n if (el) {\n try {\n if (el.matches) {\n return el.matches(selector);\n } else if (el.msMatchesSelector) {\n return el.msMatchesSelector(selector);\n } else if (el.webkitMatchesSelector) {\n return el.webkitMatchesSelector(selector);\n }\n } catch (_) {\n return false;\n }\n }\n return false;\n}\nfunction getParentOrHost(el) {\n return el.host && el !== document && el.host.nodeType && el.host !== el ? el.host : el.parentNode;\n}\nfunction closest( /**HTMLElement*/el, /**String*/selector, /**HTMLElement*/ctx, includeCTX) {\n if (el) {\n ctx = ctx || document;\n do {\n if (selector != null && (selector[0] === '>' ? el.parentNode === ctx && matches(el, selector) : matches(el, selector)) || includeCTX && el === ctx) {\n return el;\n }\n if (el === ctx) break;\n /* jshint boss:true */\n } while (el = getParentOrHost(el));\n }\n return null;\n}\nvar R_SPACE = /\\s+/g;\nfunction toggleClass(el, name, state) {\n if (el && name) {\n if (el.classList) {\n el.classList[state ? 'add' : 'remove'](name);\n } else {\n var className = (' ' + el.className + ' ').replace(R_SPACE, ' ').replace(' ' + name + ' ', ' ');\n el.className = (className + (state ? ' ' + name : '')).replace(R_SPACE, ' ');\n }\n }\n}\nfunction css(el, prop, val) {\n var style = el && el.style;\n if (style) {\n if (val === void 0) {\n if (document.defaultView && document.defaultView.getComputedStyle) {\n val = document.defaultView.getComputedStyle(el, '');\n } else if (el.currentStyle) {\n val = el.currentStyle;\n }\n return prop === void 0 ? val : val[prop];\n } else {\n if (!(prop in style) && prop.indexOf('webkit') === -1) {\n prop = '-webkit-' + prop;\n }\n style[prop] = val + (typeof val === 'string' ? '' : 'px');\n }\n }\n}\nfunction matrix(el, selfOnly) {\n var appliedTransforms = '';\n if (typeof el === 'string') {\n appliedTransforms = el;\n } else {\n do {\n var transform = css(el, 'transform');\n if (transform && transform !== 'none') {\n appliedTransforms = transform + ' ' + appliedTransforms;\n }\n /* jshint boss:true */\n } while (!selfOnly && (el = el.parentNode));\n }\n var matrixFn = window.DOMMatrix || window.WebKitCSSMatrix || window.CSSMatrix || window.MSCSSMatrix;\n /*jshint -W056 */\n return matrixFn && new matrixFn(appliedTransforms);\n}\nfunction find(ctx, tagName, iterator) {\n if (ctx) {\n var list = ctx.getElementsByTagName(tagName),\n i = 0,\n n = list.length;\n if (iterator) {\n for (; i < n; i++) {\n iterator(list[i], i);\n }\n }\n return list;\n }\n return [];\n}\nfunction getWindowScrollingElement() {\n var scrollingElement = document.scrollingElement;\n if (scrollingElement) {\n return scrollingElement;\n } else {\n return document.documentElement;\n }\n}\n\n/**\r\n * Returns the \"bounding client rect\" of given element\r\n * @param {HTMLElement} el The element whose boundingClientRect is wanted\r\n * @param {[Boolean]} relativeToContainingBlock Whether the rect should be relative to the containing block of (including) the container\r\n * @param {[Boolean]} relativeToNonStaticParent Whether the rect should be relative to the relative parent of (including) the contaienr\r\n * @param {[Boolean]} undoScale Whether the container's scale() should be undone\r\n * @param {[HTMLElement]} container The parent the element will be placed in\r\n * @return {Object} The boundingClientRect of el, with specified adjustments\r\n */\nfunction getRect(el, relativeToContainingBlock, relativeToNonStaticParent, undoScale, container) {\n if (!el.getBoundingClientRect && el !== window) return;\n var elRect, top, left, bottom, right, height, width;\n if (el !== window && el.parentNode && el !== getWindowScrollingElement()) {\n elRect = el.getBoundingClientRect();\n top = elRect.top;\n left = elRect.left;\n bottom = elRect.bottom;\n right = elRect.right;\n height = elRect.height;\n width = elRect.width;\n } else {\n top = 0;\n left = 0;\n bottom = window.innerHeight;\n right = window.innerWidth;\n height = window.innerHeight;\n width = window.innerWidth;\n }\n if ((relativeToContainingBlock || relativeToNonStaticParent) && el !== window) {\n // Adjust for translate()\n container = container || el.parentNode;\n\n // solves #1123 (see: https://stackoverflow.com/a/37953806/6088312)\n // Not needed on <= IE11\n if (!IE11OrLess) {\n do {\n if (container && container.getBoundingClientRect && (css(container, 'transform') !== 'none' || relativeToNonStaticParent && css(container, 'position') !== 'static')) {\n var containerRect = container.getBoundingClientRect();\n\n // Set relative to edges of padding box of container\n top -= containerRect.top + parseInt(css(container, 'border-top-width'));\n left -= containerRect.left + parseInt(css(container, 'border-left-width'));\n bottom = top + elRect.height;\n right = left + elRect.width;\n break;\n }\n /* jshint boss:true */\n } while (container = container.parentNode);\n }\n }\n if (undoScale && el !== window) {\n // Adjust for scale()\n var elMatrix = matrix(container || el),\n scaleX = elMatrix && elMatrix.a,\n scaleY = elMatrix && elMatrix.d;\n if (elMatrix) {\n top /= scaleY;\n left /= scaleX;\n width /= scaleX;\n height /= scaleY;\n bottom = top + height;\n right = left + width;\n }\n }\n return {\n top: top,\n left: left,\n bottom: bottom,\n right: right,\n width: width,\n height: height\n };\n}\n\n/**\r\n * Checks if a side of an element is scrolled past a side of its parents\r\n * @param {HTMLElement} el The element who's side being scrolled out of view is in question\r\n * @param {String} elSide Side of the element in question ('top', 'left', 'right', 'bottom')\r\n * @param {String} parentSide Side of the parent in question ('top', 'left', 'right', 'bottom')\r\n * @return {HTMLElement} The parent scroll element that the el's side is scrolled past, or null if there is no such element\r\n */\nfunction isScrolledPast(el, elSide, parentSide) {\n var parent = getParentAutoScrollElement(el, true),\n elSideVal = getRect(el)[elSide];\n\n /* jshint boss:true */\n while (parent) {\n var parentSideVal = getRect(parent)[parentSide],\n visible = void 0;\n if (parentSide === 'top' || parentSide === 'left') {\n visible = elSideVal >= parentSideVal;\n } else {\n visible = elSideVal <= parentSideVal;\n }\n if (!visible) return parent;\n if (parent === getWindowScrollingElement()) break;\n parent = getParentAutoScrollElement(parent, false);\n }\n return false;\n}\n\n/**\r\n * Gets nth child of el, ignoring hidden children, sortable's elements (does not ignore clone if it's visible)\r\n * and non-draggable elements\r\n * @param {HTMLElement} el The parent element\r\n * @param {Number} childNum The index of the child\r\n * @param {Object} options Parent Sortable's options\r\n * @return {HTMLElement} The child at index childNum, or null if not found\r\n */\nfunction getChild(el, childNum, options, includeDragEl) {\n var currentChild = 0,\n i = 0,\n children = el.children;\n while (i < children.length) {\n if (children[i].style.display !== 'none' && children[i] !== Sortable.ghost && (includeDragEl || children[i] !== Sortable.dragged) && closest(children[i], options.draggable, el, false)) {\n if (currentChild === childNum) {\n return children[i];\n }\n currentChild++;\n }\n i++;\n }\n return null;\n}\n\n/**\r\n * Gets the last child in the el, ignoring ghostEl or invisible elements (clones)\r\n * @param {HTMLElement} el Parent element\r\n * @param {selector} selector Any other elements that should be ignored\r\n * @return {HTMLElement} The last child, ignoring ghostEl\r\n */\nfunction lastChild(el, selector) {\n var last = el.lastElementChild;\n while (last && (last === Sortable.ghost || css(last, 'display') === 'none' || selector && !matches(last, selector))) {\n last = last.previousElementSibling;\n }\n return last || null;\n}\n\n/**\r\n * Returns the index of an element within its parent for a selected set of\r\n * elements\r\n * @param {HTMLElement} el\r\n * @param {selector} selector\r\n * @return {number}\r\n */\nfunction index(el, selector) {\n var index = 0;\n if (!el || !el.parentNode) {\n return -1;\n }\n\n /* jshint boss:true */\n while (el = el.previousElementSibling) {\n if (el.nodeName.toUpperCase() !== 'TEMPLATE' && el !== Sortable.clone && (!selector || matches(el, selector))) {\n index++;\n }\n }\n return index;\n}\n\n/**\r\n * Returns the scroll offset of the given element, added with all the scroll offsets of parent elements.\r\n * The value is returned in real pixels.\r\n * @param {HTMLElement} el\r\n * @return {Array} Offsets in the format of [left, top]\r\n */\nfunction getRelativeScrollOffset(el) {\n var offsetLeft = 0,\n offsetTop = 0,\n winScroller = getWindowScrollingElement();\n if (el) {\n do {\n var elMatrix = matrix(el),\n scaleX = elMatrix.a,\n scaleY = elMatrix.d;\n offsetLeft += el.scrollLeft * scaleX;\n offsetTop += el.scrollTop * scaleY;\n } while (el !== winScroller && (el = el.parentNode));\n }\n return [offsetLeft, offsetTop];\n}\n\n/**\r\n * Returns the index of the object within the given array\r\n * @param {Array} arr Array that may or may not hold the object\r\n * @param {Object} obj An object that has a key-value pair unique to and identical to a key-value pair in the object you want to find\r\n * @return {Number} The index of the object in the array, or -1\r\n */\nfunction indexOfObject(arr, obj) {\n for (var i in arr) {\n if (!arr.hasOwnProperty(i)) continue;\n for (var key in obj) {\n if (obj.hasOwnProperty(key) && obj[key] === arr[i][key]) return Number(i);\n }\n }\n return -1;\n}\nfunction getParentAutoScrollElement(el, includeSelf) {\n // skip to window\n if (!el || !el.getBoundingClientRect) return getWindowScrollingElement();\n var elem = el;\n var gotSelf = false;\n do {\n // we don't need to get elem css if it isn't even overflowing in the first place (performance)\n if (elem.clientWidth < elem.scrollWidth || elem.clientHeight < elem.scrollHeight) {\n var elemCSS = css(elem);\n if (elem.clientWidth < elem.scrollWidth && (elemCSS.overflowX == 'auto' || elemCSS.overflowX == 'scroll') || elem.clientHeight < elem.scrollHeight && (elemCSS.overflowY == 'auto' || elemCSS.overflowY == 'scroll')) {\n if (!elem.getBoundingClientRect || elem === document.body) return getWindowScrollingElement();\n if (gotSelf || includeSelf) return elem;\n gotSelf = true;\n }\n }\n /* jshint boss:true */\n } while (elem = elem.parentNode);\n return getWindowScrollingElement();\n}\nfunction extend(dst, src) {\n if (dst && src) {\n for (var key in src) {\n if (src.hasOwnProperty(key)) {\n dst[key] = src[key];\n }\n }\n }\n return dst;\n}\nfunction isRectEqual(rect1, rect2) {\n return Math.round(rect1.top) === Math.round(rect2.top) && Math.round(rect1.left) === Math.round(rect2.left) && Math.round(rect1.height) === Math.round(rect2.height) && Math.round(rect1.width) === Math.round(rect2.width);\n}\nvar _throttleTimeout;\nfunction throttle(callback, ms) {\n return function () {\n if (!_throttleTimeout) {\n var args = arguments,\n _this = this;\n if (args.length === 1) {\n callback.call(_this, args[0]);\n } else {\n callback.apply(_this, args);\n }\n _throttleTimeout = setTimeout(function () {\n _throttleTimeout = void 0;\n }, ms);\n }\n };\n}\nfunction cancelThrottle() {\n clearTimeout(_throttleTimeout);\n _throttleTimeout = void 0;\n}\nfunction scrollBy(el, x, y) {\n el.scrollLeft += x;\n el.scrollTop += y;\n}\nfunction clone(el) {\n var Polymer = window.Polymer;\n var $ = window.jQuery || window.Zepto;\n if (Polymer && Polymer.dom) {\n return Polymer.dom(el).cloneNode(true);\n } else if ($) {\n return $(el).clone(true)[0];\n } else {\n return el.cloneNode(true);\n }\n}\nfunction setRect(el, rect) {\n css(el, 'position', 'absolute');\n css(el, 'top', rect.top);\n css(el, 'left', rect.left);\n css(el, 'width', rect.width);\n css(el, 'height', rect.height);\n}\nfunction unsetRect(el) {\n css(el, 'position', '');\n css(el, 'top', '');\n css(el, 'left', '');\n css(el, 'width', '');\n css(el, 'height', '');\n}\nfunction getChildContainingRectFromElement(container, options, ghostEl) {\n var rect = {};\n Array.from(container.children).forEach(function (child) {\n var _rect$left, _rect$top, _rect$right, _rect$bottom;\n if (!closest(child, options.draggable, container, false) || child.animated || child === ghostEl) return;\n var childRect = getRect(child);\n rect.left = Math.min((_rect$left = rect.left) !== null && _rect$left !== void 0 ? _rect$left : Infinity, childRect.left);\n rect.top = Math.min((_rect$top = rect.top) !== null && _rect$top !== void 0 ? _rect$top : Infinity, childRect.top);\n rect.right = Math.max((_rect$right = rect.right) !== null && _rect$right !== void 0 ? _rect$right : -Infinity, childRect.right);\n rect.bottom = Math.max((_rect$bottom = rect.bottom) !== null && _rect$bottom !== void 0 ? _rect$bottom : -Infinity, childRect.bottom);\n });\n rect.width = rect.right - rect.left;\n rect.height = rect.bottom - rect.top;\n rect.x = rect.left;\n rect.y = rect.top;\n return rect;\n}\nvar expando = 'Sortable' + new Date().getTime();\n\nfunction AnimationStateManager() {\n var animationStates = [],\n animationCallbackId;\n return {\n captureAnimationState: function captureAnimationState() {\n animationStates = [];\n if (!this.options.animation) return;\n var children = [].slice.call(this.el.children);\n children.forEach(function (child) {\n if (css(child, 'display') === 'none' || child === Sortable.ghost) return;\n animationStates.push({\n target: child,\n rect: getRect(child)\n });\n var fromRect = _objectSpread2({}, animationStates[animationStates.length - 1].rect);\n\n // If animating: compensate for current animation\n if (child.thisAnimationDuration) {\n var childMatrix = matrix(child, true);\n if (childMatrix) {\n fromRect.top -= childMatrix.f;\n fromRect.left -= childMatrix.e;\n }\n }\n child.fromRect = fromRect;\n });\n },\n addAnimationState: function addAnimationState(state) {\n animationStates.push(state);\n },\n removeAnimationState: function removeAnimationState(target) {\n animationStates.splice(indexOfObject(animationStates, {\n target: target\n }), 1);\n },\n animateAll: function animateAll(callback) {\n var _this = this;\n if (!this.options.animation) {\n clearTimeout(animationCallbackId);\n if (typeof callback === 'function') callback();\n return;\n }\n var animating = false,\n animationTime = 0;\n animationStates.forEach(function (state) {\n var time = 0,\n target = state.target,\n fromRect = target.fromRect,\n toRect = getRect(target),\n prevFromRect = target.prevFromRect,\n prevToRect = target.prevToRect,\n animatingRect = state.rect,\n targetMatrix = matrix(target, true);\n if (targetMatrix) {\n // Compensate for current animation\n toRect.top -= targetMatrix.f;\n toRect.left -= targetMatrix.e;\n }\n target.toRect = toRect;\n if (target.thisAnimationDuration) {\n // Could also check if animatingRect is between fromRect and toRect\n if (isRectEqual(prevFromRect, toRect) && !isRectEqual(fromRect, toRect) &&\n // Make sure animatingRect is on line between toRect & fromRect\n (animatingRect.top - toRect.top) / (animatingRect.left - toRect.left) === (fromRect.top - toRect.top) / (fromRect.left - toRect.left)) {\n // If returning to same place as started from animation and on same axis\n time = calculateRealTime(animatingRect, prevFromRect, prevToRect, _this.options);\n }\n }\n\n // if fromRect != toRect: animate\n if (!isRectEqual(toRect, fromRect)) {\n target.prevFromRect = fromRect;\n target.prevToRect = toRect;\n if (!time) {\n time = _this.options.animation;\n }\n _this.animate(target, animatingRect, toRect, time);\n }\n if (time) {\n animating = true;\n animationTime = Math.max(animationTime, time);\n clearTimeout(target.animationResetTimer);\n target.animationResetTimer = setTimeout(function () {\n target.animationTime = 0;\n target.prevFromRect = null;\n target.fromRect = null;\n target.prevToRect = null;\n target.thisAnimationDuration = null;\n }, time);\n target.thisAnimationDuration = time;\n }\n });\n clearTimeout(animationCallbackId);\n if (!animating) {\n if (typeof callback === 'function') callback();\n } else {\n animationCallbackId = setTimeout(function () {\n if (typeof callback === 'function') callback();\n }, animationTime);\n }\n animationStates = [];\n },\n animate: function animate(target, currentRect, toRect, duration) {\n if (duration) {\n css(target, 'transition', '');\n css(target, 'transform', '');\n var elMatrix = matrix(this.el),\n scaleX = elMatrix && elMatrix.a,\n scaleY = elMatrix && elMatrix.d,\n translateX = (currentRect.left - toRect.left) / (scaleX || 1),\n translateY = (currentRect.top - toRect.top) / (scaleY || 1);\n target.animatingX = !!translateX;\n target.animatingY = !!translateY;\n css(target, 'transform', 'translate3d(' + translateX + 'px,' + translateY + 'px,0)');\n this.forRepaintDummy = repaint(target); // repaint\n\n css(target, 'transition', 'transform ' + duration + 'ms' + (this.options.easing ? ' ' + this.options.easing : ''));\n css(target, 'transform', 'translate3d(0,0,0)');\n typeof target.animated === 'number' && clearTimeout(target.animated);\n target.animated = setTimeout(function () {\n css(target, 'transition', '');\n css(target, 'transform', '');\n target.animated = false;\n target.animatingX = false;\n target.animatingY = false;\n }, duration);\n }\n }\n };\n}\nfunction repaint(target) {\n return target.offsetWidth;\n}\nfunction calculateRealTime(animatingRect, fromRect, toRect, options) {\n return Math.sqrt(Math.pow(fromRect.top - animatingRect.top, 2) + Math.pow(fromRect.left - animatingRect.left, 2)) / Math.sqrt(Math.pow(fromRect.top - toRect.top, 2) + Math.pow(fromRect.left - toRect.left, 2)) * options.animation;\n}\n\nvar plugins = [];\nvar defaults = {\n initializeByDefault: true\n};\nvar PluginManager = {\n mount: function mount(plugin) {\n // Set default static properties\n for (var option in defaults) {\n if (defaults.hasOwnProperty(option) && !(option in plugin)) {\n plugin[option] = defaults[option];\n }\n }\n plugins.forEach(function (p) {\n if (p.pluginName === plugin.pluginName) {\n throw \"Sortable: Cannot mount plugin \".concat(plugin.pluginName, \" more than once\");\n }\n });\n plugins.push(plugin);\n },\n pluginEvent: function pluginEvent(eventName, sortable, evt) {\n var _this = this;\n this.eventCanceled = false;\n evt.cancel = function () {\n _this.eventCanceled = true;\n };\n var eventNameGlobal = eventName + 'Global';\n plugins.forEach(function (plugin) {\n if (!sortable[plugin.pluginName]) return;\n // Fire global events if it exists in this sortable\n if (sortable[plugin.pluginName][eventNameGlobal]) {\n sortable[plugin.pluginName][eventNameGlobal](_objectSpread2({\n sortable: sortable\n }, evt));\n }\n\n // Only fire plugin event if plugin is enabled in this sortable,\n // and plugin has event defined\n if (sortable.options[plugin.pluginName] && sortable[plugin.pluginName][eventName]) {\n sortable[plugin.pluginName][eventName](_objectSpread2({\n sortable: sortable\n }, evt));\n }\n });\n },\n initializePlugins: function initializePlugins(sortable, el, defaults, options) {\n plugins.forEach(function (plugin) {\n var pluginName = plugin.pluginName;\n if (!sortable.options[pluginName] && !plugin.initializeByDefault) return;\n var initialized = new plugin(sortable, el, sortable.options);\n initialized.sortable = sortable;\n initialized.options = sortable.options;\n sortable[pluginName] = initialized;\n\n // Add default options from plugin\n _extends(defaults, initialized.defaults);\n });\n for (var option in sortable.options) {\n if (!sortable.options.hasOwnProperty(option)) continue;\n var modified = this.modifyOption(sortable, option, sortable.options[option]);\n if (typeof modified !== 'undefined') {\n sortable.options[option] = modified;\n }\n }\n },\n getEventProperties: function getEventProperties(name, sortable) {\n var eventProperties = {};\n plugins.forEach(function (plugin) {\n if (typeof plugin.eventProperties !== 'function') return;\n _extends(eventProperties, plugin.eventProperties.call(sortable[plugin.pluginName], name));\n });\n return eventProperties;\n },\n modifyOption: function modifyOption(sortable, name, value) {\n var modifiedValue;\n plugins.forEach(function (plugin) {\n // Plugin must exist on the Sortable\n if (!sortable[plugin.pluginName]) return;\n\n // If static option listener exists for this option, call in the context of the Sortable's instance of this plugin\n if (plugin.optionListeners && typeof plugin.optionListeners[name] === 'function') {\n modifiedValue = plugin.optionListeners[name].call(sortable[plugin.pluginName], value);\n }\n });\n return modifiedValue;\n }\n};\n\nfunction dispatchEvent(_ref) {\n var sortable = _ref.sortable,\n rootEl = _ref.rootEl,\n name = _ref.name,\n targetEl = _ref.targetEl,\n cloneEl = _ref.cloneEl,\n toEl = _ref.toEl,\n fromEl = _ref.fromEl,\n oldIndex = _ref.oldIndex,\n newIndex = _ref.newIndex,\n oldDraggableIndex = _ref.oldDraggableIndex,\n newDraggableIndex = _ref.newDraggableIndex,\n originalEvent = _ref.originalEvent,\n putSortable = _ref.putSortable,\n extraEventProperties = _ref.extraEventProperties;\n sortable = sortable || rootEl && rootEl[expando];\n if (!sortable) return;\n var evt,\n options = sortable.options,\n onName = 'on' + name.charAt(0).toUpperCase() + name.substr(1);\n // Support for new CustomEvent feature\n if (window.CustomEvent && !IE11OrLess && !Edge) {\n evt = new CustomEvent(name, {\n bubbles: true,\n cancelable: true\n });\n } else {\n evt = document.createEvent('Event');\n evt.initEvent(name, true, true);\n }\n evt.to = toEl || rootEl;\n evt.from = fromEl || rootEl;\n evt.item = targetEl || rootEl;\n evt.clone = cloneEl;\n evt.oldIndex = oldIndex;\n evt.newIndex = newIndex;\n evt.oldDraggableIndex = oldDraggableIndex;\n evt.newDraggableIndex = newDraggableIndex;\n evt.originalEvent = originalEvent;\n evt.pullMode = putSortable ? putSortable.lastPutMode : undefined;\n var allEventProperties = _objectSpread2(_objectSpread2({}, extraEventProperties), PluginManager.getEventProperties(name, sortable));\n for (var option in allEventProperties) {\n evt[option] = allEventProperties[option];\n }\n if (rootEl) {\n rootEl.dispatchEvent(evt);\n }\n if (options[onName]) {\n options[onName].call(sortable, evt);\n }\n}\n\nvar _excluded = [\"evt\"];\nvar pluginEvent = function pluginEvent(eventName, sortable) {\n var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},\n originalEvent = _ref.evt,\n data = _objectWithoutProperties(_ref, _excluded);\n PluginManager.pluginEvent.bind(Sortable)(eventName, sortable, _objectSpread2({\n dragEl: dragEl,\n parentEl: parentEl,\n ghostEl: ghostEl,\n rootEl: rootEl,\n nextEl: nextEl,\n lastDownEl: lastDownEl,\n cloneEl: cloneEl,\n cloneHidden: cloneHidden,\n dragStarted: moved,\n putSortable: putSortable,\n activeSortable: Sortable.active,\n originalEvent: originalEvent,\n oldIndex: oldIndex,\n oldDraggableIndex: oldDraggableIndex,\n newIndex: newIndex,\n newDraggableIndex: newDraggableIndex,\n hideGhostForTarget: _hideGhostForTarget,\n unhideGhostForTarget: _unhideGhostForTarget,\n cloneNowHidden: function cloneNowHidden() {\n cloneHidden = true;\n },\n cloneNowShown: function cloneNowShown() {\n cloneHidden = false;\n },\n dispatchSortableEvent: function dispatchSortableEvent(name) {\n _dispatchEvent({\n sortable: sortable,\n name: name,\n originalEvent: originalEvent\n });\n }\n }, data));\n};\nfunction _dispatchEvent(info) {\n dispatchEvent(_objectSpread2({\n putSortable: putSortable,\n cloneEl: cloneEl,\n targetEl: dragEl,\n rootEl: rootEl,\n oldIndex: oldIndex,\n oldDraggableIndex: oldDraggableIndex,\n newIndex: newIndex,\n newDraggableIndex: newDraggableIndex\n }, info));\n}\nvar dragEl,\n parentEl,\n ghostEl,\n rootEl,\n nextEl,\n lastDownEl,\n cloneEl,\n cloneHidden,\n oldIndex,\n newIndex,\n oldDraggableIndex,\n newDraggableIndex,\n activeGroup,\n putSortable,\n awaitingDragStarted = false,\n ignoreNextClick = false,\n sortables = [],\n tapEvt,\n touchEvt,\n lastDx,\n lastDy,\n tapDistanceLeft,\n tapDistanceTop,\n moved,\n lastTarget,\n lastDirection,\n pastFirstInvertThresh = false,\n isCircumstantialInvert = false,\n targetMoveDistance,\n // For positioning ghost absolutely\n ghostRelativeParent,\n ghostRelativeParentInitialScroll = [],\n // (left, top)\n\n _silent = false,\n savedInputChecked = [];\n\n/** @const */\nvar documentExists = typeof document !== 'undefined',\n PositionGhostAbsolutely = IOS,\n CSSFloatProperty = Edge || IE11OrLess ? 'cssFloat' : 'float',\n // This will not pass for IE9, because IE9 DnD only works on anchors\n supportDraggable = documentExists && !ChromeForAndroid && !IOS && 'draggable' in document.createElement('div'),\n supportCssPointerEvents = function () {\n if (!documentExists) return;\n // false when <= IE11\n if (IE11OrLess) {\n return false;\n }\n var el = document.createElement('x');\n el.style.cssText = 'pointer-events:auto';\n return el.style.pointerEvents === 'auto';\n }(),\n _detectDirection = function _detectDirection(el, options) {\n var elCSS = css(el),\n elWidth = parseInt(elCSS.width) - parseInt(elCSS.paddingLeft) - parseInt(elCSS.paddingRight) - parseInt(elCSS.borderLeftWidth) - parseInt(elCSS.borderRightWidth),\n child1 = getChild(el, 0, options),\n child2 = getChild(el, 1, options),\n firstChildCSS = child1 && css(child1),\n secondChildCSS = child2 && css(child2),\n firstChildWidth = firstChildCSS && parseInt(firstChildCSS.marginLeft) + parseInt(firstChildCSS.marginRight) + getRect(child1).width,\n secondChildWidth = secondChildCSS && parseInt(secondChildCSS.marginLeft) + parseInt(secondChildCSS.marginRight) + getRect(child2).width;\n if (elCSS.display === 'flex') {\n return elCSS.flexDirection === 'column' || elCSS.flexDirection === 'column-reverse' ? 'vertical' : 'horizontal';\n }\n if (elCSS.display === 'grid') {\n return elCSS.gridTemplateColumns.split(' ').length <= 1 ? 'vertical' : 'horizontal';\n }\n if (child1 && firstChildCSS[\"float\"] && firstChildCSS[\"float\"] !== 'none') {\n var touchingSideChild2 = firstChildCSS[\"float\"] === 'left' ? 'left' : 'right';\n return child2 && (secondChildCSS.clear === 'both' || secondChildCSS.clear === touchingSideChild2) ? 'vertical' : 'horizontal';\n }\n return child1 && (firstChildCSS.display === 'block' || firstChildCSS.display === 'flex' || firstChildCSS.display === 'table' || firstChildCSS.display === 'grid' || firstChildWidth >= elWidth && elCSS[CSSFloatProperty] === 'none' || child2 && elCSS[CSSFloatProperty] === 'none' && firstChildWidth + secondChildWidth > elWidth) ? 'vertical' : 'horizontal';\n },\n _dragElInRowColumn = function _dragElInRowColumn(dragRect, targetRect, vertical) {\n var dragElS1Opp = vertical ? dragRect.left : dragRect.top,\n dragElS2Opp = vertical ? dragRect.right : dragRect.bottom,\n dragElOppLength = vertical ? dragRect.width : dragRect.height,\n targetS1Opp = vertical ? targetRect.left : targetRect.top,\n targetS2Opp = vertical ? targetRect.right : targetRect.bottom,\n targetOppLength = vertical ? targetRect.width : targetRect.height;\n return dragElS1Opp === targetS1Opp || dragElS2Opp === targetS2Opp || dragElS1Opp + dragElOppLength / 2 === targetS1Opp + targetOppLength / 2;\n },\n /**\r\n * Detects first nearest empty sortable to X and Y position using emptyInsertThreshold.\r\n * @param {Number} x X position\r\n * @param {Number} y Y position\r\n * @return {HTMLElement} Element of the first found nearest Sortable\r\n */\n _detectNearestEmptySortable = function _detectNearestEmptySortable(x, y) {\n var ret;\n sortables.some(function (sortable) {\n var threshold = sortable[expando].options.emptyInsertThreshold;\n if (!threshold || lastChild(sortable)) return;\n var rect = getRect(sortable),\n insideHorizontally = x >= rect.left - threshold && x <= rect.right + threshold,\n insideVertically = y >= rect.top - threshold && y <= rect.bottom + threshold;\n if (insideHorizontally && insideVertically) {\n return ret = sortable;\n }\n });\n return ret;\n },\n _prepareGroup = function _prepareGroup(options) {\n function toFn(value, pull) {\n return function (to, from, dragEl, evt) {\n var sameGroup = to.options.group.name && from.options.group.name && to.options.group.name === from.options.group.name;\n if (value == null && (pull || sameGroup)) {\n // Default pull value\n // Default pull and put value if same group\n return true;\n } else if (value == null || value === false) {\n return false;\n } else if (pull && value === 'clone') {\n return value;\n } else if (typeof value === 'function') {\n return toFn(value(to, from, dragEl, evt), pull)(to, from, dragEl, evt);\n } else {\n var otherGroup = (pull ? to : from).options.group.name;\n return value === true || typeof value === 'string' && value === otherGroup || value.join && value.indexOf(otherGroup) > -1;\n }\n };\n }\n var group = {};\n var originalGroup = options.group;\n if (!originalGroup || _typeof(originalGroup) != 'object') {\n originalGroup = {\n name: originalGroup\n };\n }\n group.name = originalGroup.name;\n group.checkPull = toFn(originalGroup.pull, true);\n group.checkPut = toFn(originalGroup.put);\n group.revertClone = originalGroup.revertClone;\n options.group = group;\n },\n _hideGhostForTarget = function _hideGhostForTarget() {\n if (!supportCssPointerEvents && ghostEl) {\n css(ghostEl, 'display', 'none');\n }\n },\n _unhideGhostForTarget = function _unhideGhostForTarget() {\n if (!supportCssPointerEvents && ghostEl) {\n css(ghostEl, 'display', '');\n }\n };\n\n// #1184 fix - Prevent click event on fallback if dragged but item not changed position\nif (documentExists && !ChromeForAndroid) {\n document.addEventListener('click', function (evt) {\n if (ignoreNextClick) {\n evt.preventDefault();\n evt.stopPropagation && evt.stopPropagation();\n evt.stopImmediatePropagation && evt.stopImmediatePropagation();\n ignoreNextClick = false;\n return false;\n }\n }, true);\n}\nvar nearestEmptyInsertDetectEvent = function nearestEmptyInsertDetectEvent(evt) {\n if (dragEl) {\n evt = evt.touches ? evt.touches[0] : evt;\n var nearest = _detectNearestEmptySortable(evt.clientX, evt.clientY);\n if (nearest) {\n // Create imitation event\n var event = {};\n for (var i in evt) {\n if (evt.hasOwnProperty(i)) {\n event[i] = evt[i];\n }\n }\n event.target = event.rootEl = nearest;\n event.preventDefault = void 0;\n event.stopPropagation = void 0;\n nearest[expando]._onDragOver(event);\n }\n }\n};\nvar _checkOutsideTargetEl = function _checkOutsideTargetEl(evt) {\n if (dragEl) {\n dragEl.parentNode[expando]._isOutsideThisEl(evt.target);\n }\n};\n\n/**\r\n * @class Sortable\r\n * @param {HTMLElement} el\r\n * @param {Object} [options]\r\n */\nfunction Sortable(el, options) {\n if (!(el && el.nodeType && el.nodeType === 1)) {\n throw \"Sortable: `el` must be an HTMLElement, not \".concat({}.toString.call(el));\n }\n this.el = el; // root element\n this.options = options = _extends({}, options);\n\n // Export instance\n el[expando] = this;\n var defaults = {\n group: null,\n sort: true,\n disabled: false,\n store: null,\n handle: null,\n draggable: /^[uo]l$/i.test(el.nodeName) ? '>li' : '>*',\n swapThreshold: 1,\n // percentage; 0 <= x <= 1\n invertSwap: false,\n // invert always\n invertedSwapThreshold: null,\n // will be set to same as swapThreshold if default\n removeCloneOnHide: true,\n direction: function direction() {\n return _detectDirection(el, this.options);\n },\n ghostClass: 'sortable-ghost',\n chosenClass: 'sortable-chosen',\n dragClass: 'sortable-drag',\n ignore: 'a, img',\n filter: null,\n preventOnFilter: true,\n animation: 0,\n easing: null,\n setData: function setData(dataTransfer, dragEl) {\n dataTransfer.setData('Text', dragEl.textContent);\n },\n dropBubble: false,\n dragoverBubble: false,\n dataIdAttr: 'data-id',\n delay: 0,\n delayOnTouchOnly: false,\n touchStartThreshold: (Number.parseInt ? Number : window).parseInt(window.devicePixelRatio, 10) || 1,\n forceFallback: false,\n fallbackClass: 'sortable-fallback',\n fallbackOnBody: false,\n fallbackTolerance: 0,\n fallbackOffset: {\n x: 0,\n y: 0\n },\n // Disabled on Safari: #1571; Enabled on Safari IOS: #2244\n supportPointer: Sortable.supportPointer !== false && 'PointerEvent' in window && (!Safari || IOS),\n emptyInsertThreshold: 5\n };\n PluginManager.initializePlugins(this, el, defaults);\n\n // Set default options\n for (var name in defaults) {\n !(name in options) && (options[name] = defaults[name]);\n }\n _prepareGroup(options);\n\n // Bind all private methods\n for (var fn in this) {\n if (fn.charAt(0) === '_' && typeof this[fn] === 'function') {\n this[fn] = this[fn].bind(this);\n }\n }\n\n // Setup drag mode\n this.nativeDraggable = options.forceFallback ? false : supportDraggable;\n if (this.nativeDraggable) {\n // Touch start threshold cannot be greater than the native dragstart threshold\n this.options.touchStartThreshold = 1;\n }\n\n // Bind events\n if (options.supportPointer) {\n on(el, 'pointerdown', this._onTapStart);\n } else {\n on(el, 'mousedown', this._onTapStart);\n on(el, 'touchstart', this._onTapStart);\n }\n if (this.nativeDraggable) {\n on(el, 'dragover', this);\n on(el, 'dragenter', this);\n }\n sortables.push(this.el);\n\n // Restore sorting\n options.store && options.store.get && this.sort(options.store.get(this) || []);\n\n // Add animation state manager\n _extends(this, AnimationStateManager());\n}\nSortable.prototype = /** @lends Sortable.prototype */{\n constructor: Sortable,\n _isOutsideThisEl: function _isOutsideThisEl(target) {\n if (!this.el.contains(target) && target !== this.el) {\n lastTarget = null;\n }\n },\n _getDirection: function _getDirection(evt, target) {\n return typeof this.options.direction === 'function' ? this.options.direction.call(this, evt, target, dragEl) : this.options.direction;\n },\n _onTapStart: function _onTapStart( /** Event|TouchEvent */evt) {\n if (!evt.cancelable) return;\n var _this = this,\n el = this.el,\n options = this.options,\n preventOnFilter = options.preventOnFilter,\n type = evt.type,\n touch = evt.touches && evt.touches[0] || evt.pointerType && evt.pointerType === 'touch' && evt,\n target = (touch || evt).target,\n originalTarget = evt.target.shadowRoot && (evt.path && evt.path[0] || evt.composedPath && evt.composedPath()[0]) || target,\n filter = options.filter;\n _saveInputCheckedState(el);\n\n // Don't trigger start event when an element is been dragged, otherwise the evt.oldindex always wrong when set option.group.\n if (dragEl) {\n return;\n }\n if (/mousedown|pointerdown/.test(type) && evt.button !== 0 || options.disabled) {\n return; // only left button and enabled\n }\n\n // cancel dnd if original target is content editable\n if (originalTarget.isContentEditable) {\n return;\n }\n\n // Safari ignores further event handling after mousedown\n if (!this.nativeDraggable && Safari && target && target.tagName.toUpperCase() === 'SELECT') {\n return;\n }\n target = closest(target, options.draggable, el, false);\n if (target && target.animated) {\n return;\n }\n if (lastDownEl === target) {\n // Ignoring duplicate `down`\n return;\n }\n\n // Get the index of the dragged element within its parent\n oldIndex = index(target);\n oldDraggableIndex = index(target, options.draggable);\n\n // Check filter\n if (typeof filter === 'function') {\n if (filter.call(this, evt, target, this)) {\n _dispatchEvent({\n sortable: _this,\n rootEl: originalTarget,\n name: 'filter',\n targetEl: target,\n toEl: el,\n fromEl: el\n });\n pluginEvent('filter', _this, {\n evt: evt\n });\n preventOnFilter && evt.preventDefault();\n return; // cancel dnd\n }\n } else if (filter) {\n filter = filter.split(',').some(function (criteria) {\n criteria = closest(originalTarget, criteria.trim(), el, false);\n if (criteria) {\n _dispatchEvent({\n sortable: _this,\n rootEl: criteria,\n name: 'filter',\n targetEl: target,\n fromEl: el,\n toEl: el\n });\n pluginEvent('filter', _this, {\n evt: evt\n });\n return true;\n }\n });\n if (filter) {\n preventOnFilter && evt.preventDefault();\n return; // cancel dnd\n }\n }\n if (options.handle && !closest(originalTarget, options.handle, el, false)) {\n return;\n }\n\n // Prepare `dragstart`\n this._prepareDragStart(evt, touch, target);\n },\n _prepareDragStart: function _prepareDragStart( /** Event */evt, /** Touch */touch, /** HTMLElement */target) {\n var _this = this,\n el = _this.el,\n options = _this.options,\n ownerDocument = el.ownerDocument,\n dragStartFn;\n if (target && !dragEl && target.parentNode === el) {\n var dragRect = getRect(target);\n rootEl = el;\n dragEl = target;\n parentEl = dragEl.parentNode;\n nextEl = dragEl.nextSibling;\n lastDownEl = target;\n activeGroup = options.group;\n Sortable.dragged = dragEl;\n tapEvt = {\n target: dragEl,\n clientX: (touch || evt).clientX,\n clientY: (touch || evt).clientY\n };\n tapDistanceLeft = tapEvt.clientX - dragRect.left;\n tapDistanceTop = tapEvt.clientY - dragRect.top;\n this._lastX = (touch || evt).clientX;\n this._lastY = (touch || evt).clientY;\n dragEl.style['will-change'] = 'all';\n dragStartFn = function dragStartFn() {\n pluginEvent('delayEnded', _this, {\n evt: evt\n });\n if (Sortable.eventCanceled) {\n _this._onDrop();\n return;\n }\n // Delayed drag has been triggered\n // we can re-enable the events: touchmove/mousemove\n _this._disableDelayedDragEvents();\n if (!FireFox && _this.nativeDraggable) {\n dragEl.draggable = true;\n }\n\n // Bind the events: dragstart/dragend\n _this._triggerDragStart(evt, touch);\n\n // Drag start event\n _dispatchEvent({\n sortable: _this,\n name: 'choose',\n originalEvent: evt\n });\n\n // Chosen item\n toggleClass(dragEl, options.chosenClass, true);\n };\n\n // Disable \"draggable\"\n options.ignore.split(',').forEach(function (criteria) {\n find(dragEl, criteria.trim(), _disableDraggable);\n });\n on(ownerDocument, 'dragover', nearestEmptyInsertDetectEvent);\n on(ownerDocument, 'mousemove', nearestEmptyInsertDetectEvent);\n on(ownerDocument, 'touchmove', nearestEmptyInsertDetectEvent);\n if (options.supportPointer) {\n on(ownerDocument, 'pointerup', _this._onDrop);\n // Native D&D triggers pointercancel\n !this.nativeDraggable && on(ownerDocument, 'pointercancel', _this._onDrop);\n } else {\n on(ownerDocument, 'mouseup', _this._onDrop);\n on(ownerDocument, 'touchend', _this._onDrop);\n on(ownerDocument, 'touchcancel', _this._onDrop);\n }\n\n // Make dragEl draggable (must be before delay for FireFox)\n if (FireFox && this.nativeDraggable) {\n this.options.touchStartThreshold = 4;\n dragEl.draggable = true;\n }\n pluginEvent('delayStart', this, {\n evt: evt\n });\n\n // Delay is impossible for native DnD in Edge or IE\n if (options.delay && (!options.delayOnTouchOnly || touch) && (!this.nativeDraggable || !(Edge || IE11OrLess))) {\n if (Sortable.eventCanceled) {\n this._onDrop();\n return;\n }\n // If the user moves the pointer or let go the click or touch\n // before the delay has been reached:\n // disable the delayed drag\n if (options.supportPointer) {\n on(ownerDocument, 'pointerup', _this._disableDelayedDrag);\n on(ownerDocument, 'pointercancel', _this._disableDelayedDrag);\n } else {\n on(ownerDocument, 'mouseup', _this._disableDelayedDrag);\n on(ownerDocument, 'touchend', _this._disableDelayedDrag);\n on(ownerDocument, 'touchcancel', _this._disableDelayedDrag);\n }\n on(ownerDocument, 'mousemove', _this._delayedDragTouchMoveHandler);\n on(ownerDocument, 'touchmove', _this._delayedDragTouchMoveHandler);\n options.supportPointer && on(ownerDocument, 'pointermove', _this._delayedDragTouchMoveHandler);\n _this._dragStartTimer = setTimeout(dragStartFn, options.delay);\n } else {\n dragStartFn();\n }\n }\n },\n _delayedDragTouchMoveHandler: function _delayedDragTouchMoveHandler( /** TouchEvent|PointerEvent **/e) {\n var touch = e.touches ? e.touches[0] : e;\n if (Math.max(Math.abs(touch.clientX - this._lastX), Math.abs(touch.clientY - this._lastY)) >= Math.floor(this.options.touchStartThreshold / (this.nativeDraggable && window.devicePixelRatio || 1))) {\n this._disableDelayedDrag();\n }\n },\n _disableDelayedDrag: function _disableDelayedDrag() {\n dragEl && _disableDraggable(dragEl);\n clearTimeout(this._dragStartTimer);\n this._disableDelayedDragEvents();\n },\n _disableDelayedDragEvents: function _disableDelayedDragEvents() {\n var ownerDocument = this.el.ownerDocument;\n off(ownerDocument, 'mouseup', this._disableDelayedDrag);\n off(ownerDocument, 'touchend', this._disableDelayedDrag);\n off(ownerDocument, 'touchcancel', this._disableDelayedDrag);\n off(ownerDocument, 'pointerup', this._disableDelayedDrag);\n off(ownerDocument, 'pointercancel', this._disableDelayedDrag);\n off(ownerDocument, 'mousemove', this._delayedDragTouchMoveHandler);\n off(ownerDocument, 'touchmove', this._delayedDragTouchMoveHandler);\n off(ownerDocument, 'pointermove', this._delayedDragTouchMoveHandler);\n },\n _triggerDragStart: function _triggerDragStart( /** Event */evt, /** Touch */touch) {\n touch = touch || evt.pointerType == 'touch' && evt;\n if (!this.nativeDraggable || touch) {\n if (this.options.supportPointer) {\n on(document, 'pointermove', this._onTouchMove);\n } else if (touch) {\n on(document, 'touchmove', this._onTouchMove);\n } else {\n on(document, 'mousemove', this._onTouchMove);\n }\n } else {\n on(dragEl, 'dragend', this);\n on(rootEl, 'dragstart', this._onDragStart);\n }\n try {\n if (document.selection) {\n _nextTick(function () {\n document.selection.empty();\n });\n } else {\n window.getSelection().removeAllRanges();\n }\n } catch (err) {}\n },\n _dragStarted: function _dragStarted(fallback, evt) {\n awaitingDragStarted = false;\n if (rootEl && dragEl) {\n pluginEvent('dragStarted', this, {\n evt: evt\n });\n if (this.nativeDraggable) {\n on(document, 'dragover', _checkOutsideTargetEl);\n }\n var options = this.options;\n\n // Apply effect\n !fallback && toggleClass(dragEl, options.dragClass, false);\n toggleClass(dragEl, options.ghostClass, true);\n Sortable.active = this;\n fallback && this._appendGhost();\n\n // Drag start event\n _dispatchEvent({\n sortable: this,\n name: 'start',\n originalEvent: evt\n });\n } else {\n this._nulling();\n }\n },\n _emulateDragOver: function _emulateDragOver() {\n if (touchEvt) {\n this._lastX = touchEvt.clientX;\n this._lastY = touchEvt.clientY;\n _hideGhostForTarget();\n var target = document.elementFromPoint(touchEvt.clientX, touchEvt.clientY);\n var parent = target;\n while (target && target.shadowRoot) {\n target = target.shadowRoot.elementFromPoint(touchEvt.clientX, touchEvt.clientY);\n if (target === parent) break;\n parent = target;\n }\n dragEl.parentNode[expando]._isOutsideThisEl(target);\n if (parent) {\n do {\n if (parent[expando]) {\n var inserted = void 0;\n inserted = parent[expando]._onDragOver({\n clientX: touchEvt.clientX,\n clientY: touchEvt.clientY,\n target: target,\n rootEl: parent\n });\n if (inserted && !this.options.dragoverBubble) {\n break;\n }\n }\n target = parent; // store last element\n }\n /* jshint boss:true */ while (parent = getParentOrHost(parent));\n }\n _unhideGhostForTarget();\n }\n },\n _onTouchMove: function _onTouchMove( /**TouchEvent*/evt) {\n if (tapEvt) {\n var options = this.options,\n fallbackTolerance = options.fallbackTolerance,\n fallbackOffset = options.fallbackOffset,\n touch = evt.touches ? evt.touches[0] : evt,\n ghostMatrix = ghostEl && matrix(ghostEl, true),\n scaleX = ghostEl && ghostMatrix && ghostMatrix.a,\n scaleY = ghostEl && ghostMatrix && ghostMatrix.d,\n relativeScrollOffset = PositionGhostAbsolutely && ghostRelativeParent && getRelativeScrollOffset(ghostRelativeParent),\n dx = (touch.clientX - tapEvt.clientX + fallbackOffset.x) / (scaleX || 1) + (relativeScrollOffset ? relativeScrollOffset[0] - ghostRelativeParentInitialScroll[0] : 0) / (scaleX || 1),\n dy = (touch.clientY - tapEvt.clientY + fallbackOffset.y) / (scaleY || 1) + (relativeScrollOffset ? relativeScrollOffset[1] - ghostRelativeParentInitialScroll[1] : 0) / (scaleY || 1);\n\n // only set the status to dragging, when we are actually dragging\n if (!Sortable.active && !awaitingDragStarted) {\n if (fallbackTolerance && Math.max(Math.abs(touch.clientX - this._lastX), Math.abs(touch.clientY - this._lastY)) < fallbackTolerance) {\n return;\n }\n this._onDragStart(evt, true);\n }\n if (ghostEl) {\n if (ghostMatrix) {\n ghostMatrix.e += dx - (lastDx || 0);\n ghostMatrix.f += dy - (lastDy || 0);\n } else {\n ghostMatrix = {\n a: 1,\n b: 0,\n c: 0,\n d: 1,\n e: dx,\n f: dy\n };\n }\n var cssMatrix = \"matrix(\".concat(ghostMatrix.a, \",\").concat(ghostMatrix.b, \",\").concat(ghostMatrix.c, \",\").concat(ghostMatrix.d, \",\").concat(ghostMatrix.e, \",\").concat(ghostMatrix.f, \")\");\n css(ghostEl, 'webkitTransform', cssMatrix);\n css(ghostEl, 'mozTransform', cssMatrix);\n css(ghostEl, 'msTransform', cssMatrix);\n css(ghostEl, 'transform', cssMatrix);\n lastDx = dx;\n lastDy = dy;\n touchEvt = touch;\n }\n evt.cancelable && evt.preventDefault();\n }\n },\n _appendGhost: function _appendGhost() {\n // Bug if using scale(): https://stackoverflow.com/questions/2637058\n // Not being adjusted for\n if (!ghostEl) {\n var container = this.options.fallbackOnBody ? document.body : rootEl,\n rect = getRect(dragEl, true, PositionGhostAbsolutely, true, container),\n options = this.options;\n\n // Position absolutely\n if (PositionGhostAbsolutely) {\n // Get relatively positioned parent\n ghostRelativeParent = container;\n while (css(ghostRelativeParent, 'position') === 'static' && css(ghostRelativeParent, 'transform') === 'none' && ghostRelativeParent !== document) {\n ghostRelativeParent = ghostRelativeParent.parentNode;\n }\n if (ghostRelativeParent !== document.body && ghostRelativeParent !== document.documentElement) {\n if (ghostRelativeParent === document) ghostRelativeParent = getWindowScrollingElement();\n rect.top += ghostRelativeParent.scrollTop;\n rect.left += ghostRelativeParent.scrollLeft;\n } else {\n ghostRelativeParent = getWindowScrollingElement();\n }\n ghostRelativeParentInitialScroll = getRelativeScrollOffset(ghostRelativeParent);\n }\n ghostEl = dragEl.cloneNode(true);\n toggleClass(ghostEl, options.ghostClass, false);\n toggleClass(ghostEl, options.fallbackClass, true);\n toggleClass(ghostEl, options.dragClass, true);\n css(ghostEl, 'transition', '');\n css(ghostEl, 'transform', '');\n css(ghostEl, 'box-sizing', 'border-box');\n css(ghostEl, 'margin', 0);\n css(ghostEl, 'top', rect.top);\n css(ghostEl, 'left', rect.left);\n css(ghostEl, 'width', rect.width);\n css(ghostEl, 'height', rect.height);\n css(ghostEl, 'opacity', '0.8');\n css(ghostEl, 'position', PositionGhostAbsolutely ? 'absolute' : 'fixed');\n css(ghostEl, 'zIndex', '100000');\n css(ghostEl, 'pointerEvents', 'none');\n Sortable.ghost = ghostEl;\n container.appendChild(ghostEl);\n\n // Set transform-origin\n css(ghostEl, 'transform-origin', tapDistanceLeft / parseInt(ghostEl.style.width) * 100 + '% ' + tapDistanceTop / parseInt(ghostEl.style.height) * 100 + '%');\n }\n },\n _onDragStart: function _onDragStart( /**Event*/evt, /**boolean*/fallback) {\n var _this = this;\n var dataTransfer = evt.dataTransfer;\n var options = _this.options;\n pluginEvent('dragStart', this, {\n evt: evt\n });\n if (Sortable.eventCanceled) {\n this._onDrop();\n return;\n }\n pluginEvent('setupClone', this);\n if (!Sortable.eventCanceled) {\n cloneEl = clone(dragEl);\n cloneEl.removeAttribute(\"id\");\n cloneEl.draggable = false;\n cloneEl.style['will-change'] = '';\n this._hideClone();\n toggleClass(cloneEl, this.options.chosenClass, false);\n Sortable.clone = cloneEl;\n }\n\n // #1143: IFrame support workaround\n _this.cloneId = _nextTick(function () {\n pluginEvent('clone', _this);\n if (Sortable.eventCanceled) return;\n if (!_this.options.removeCloneOnHide) {\n rootEl.insertBefore(cloneEl, dragEl);\n }\n _this._hideClone();\n _dispatchEvent({\n sortable: _this,\n name: 'clone'\n });\n });\n !fallback && toggleClass(dragEl, options.dragClass, true);\n\n // Set proper drop events\n if (fallback) {\n ignoreNextClick = true;\n _this._loopId = setInterval(_this._emulateDragOver, 50);\n } else {\n // Undo what was set in _prepareDragStart before drag started\n off(document, 'mouseup', _this._onDrop);\n off(document, 'touchend', _this._onDrop);\n off(document, 'touchcancel', _this._onDrop);\n if (dataTransfer) {\n dataTransfer.effectAllowed = 'move';\n options.setData && options.setData.call(_this, dataTransfer, dragEl);\n }\n on(document, 'drop', _this);\n\n // #1276 fix:\n css(dragEl, 'transform', 'translateZ(0)');\n }\n awaitingDragStarted = true;\n _this._dragStartId = _nextTick(_this._dragStarted.bind(_this, fallback, evt));\n on(document, 'selectstart', _this);\n moved = true;\n window.getSelection().removeAllRanges();\n if (Safari) {\n css(document.body, 'user-select', 'none');\n }\n },\n // Returns true - if no further action is needed (either inserted or another condition)\n _onDragOver: function _onDragOver( /**Event*/evt) {\n var el = this.el,\n target = evt.target,\n dragRect,\n targetRect,\n revert,\n options = this.options,\n group = options.group,\n activeSortable = Sortable.active,\n isOwner = activeGroup === group,\n canSort = options.sort,\n fromSortable = putSortable || activeSortable,\n vertical,\n _this = this,\n completedFired = false;\n if (_silent) return;\n function dragOverEvent(name, extra) {\n pluginEvent(name, _this, _objectSpread2({\n evt: evt,\n isOwner: isOwner,\n axis: vertical ? 'vertical' : 'horizontal',\n revert: revert,\n dragRect: dragRect,\n targetRect: targetRect,\n canSort: canSort,\n fromSortable: fromSortable,\n target: target,\n completed: completed,\n onMove: function onMove(target, after) {\n return _onMove(rootEl, el, dragEl, dragRect, target, getRect(target), evt, after);\n },\n changed: changed\n }, extra));\n }\n\n // Capture animation state\n function capture() {\n dragOverEvent('dragOverAnimationCapture');\n _this.captureAnimationState();\n if (_this !== fromSortable) {\n fromSortable.captureAnimationState();\n }\n }\n\n // Return invocation when dragEl is inserted (or completed)\n function completed(insertion) {\n dragOverEvent('dragOverCompleted', {\n insertion: insertion\n });\n if (insertion) {\n // Clones must be hidden before folding animation to capture dragRectAbsolute properly\n if (isOwner) {\n activeSortable._hideClone();\n } else {\n activeSortable._showClone(_this);\n }\n if (_this !== fromSortable) {\n // Set ghost class to new sortable's ghost class\n toggleClass(dragEl, putSortable ? putSortable.options.ghostClass : activeSortable.options.ghostClass, false);\n toggleClass(dragEl, options.ghostClass, true);\n }\n if (putSortable !== _this && _this !== Sortable.active) {\n putSortable = _this;\n } else if (_this === Sortable.active && putSortable) {\n putSortable = null;\n }\n\n // Animation\n if (fromSortable === _this) {\n _this._ignoreWhileAnimating = target;\n }\n _this.animateAll(function () {\n dragOverEvent('dragOverAnimationComplete');\n _this._ignoreWhileAnimating = null;\n });\n if (_this !== fromSortable) {\n fromSortable.animateAll();\n fromSortable._ignoreWhileAnimating = null;\n }\n }\n\n // Null lastTarget if it is not inside a previously swapped element\n if (target === dragEl && !dragEl.animated || target === el && !target.animated) {\n lastTarget = null;\n }\n\n // no bubbling and not fallback\n if (!options.dragoverBubble && !evt.rootEl && target !== document) {\n dragEl.parentNode[expando]._isOutsideThisEl(evt.target);\n\n // Do not detect for empty insert if already inserted\n !insertion && nearestEmptyInsertDetectEvent(evt);\n }\n !options.dragoverBubble && evt.stopPropagation && evt.stopPropagation();\n return completedFired = true;\n }\n\n // Call when dragEl has been inserted\n function changed() {\n newIndex = index(dragEl);\n newDraggableIndex = index(dragEl, options.draggable);\n _dispatchEvent({\n sortable: _this,\n name: 'change',\n toEl: el,\n newIndex: newIndex,\n newDraggableIndex: newDraggableIndex,\n originalEvent: evt\n });\n }\n if (evt.preventDefault !== void 0) {\n evt.cancelable && evt.preventDefault();\n }\n target = closest(target, options.draggable, el, true);\n dragOverEvent('dragOver');\n if (Sortable.eventCanceled) return completedFired;\n if (dragEl.contains(evt.target) || target.animated && target.animatingX && target.animatingY || _this._ignoreWhileAnimating === target) {\n return completed(false);\n }\n ignoreNextClick = false;\n if (activeSortable && !options.disabled && (isOwner ? canSort || (revert = parentEl !== rootEl) // Reverting item into the original list\n : putSortable === this || (this.lastPutMode = activeGroup.checkPull(this, activeSortable, dragEl, evt)) && group.checkPut(this, activeSortable, dragEl, evt))) {\n vertical = this._getDirection(evt, target) === 'vertical';\n dragRect = getRect(dragEl);\n dragOverEvent('dragOverValid');\n if (Sortable.eventCanceled) return completedFired;\n if (revert) {\n parentEl = rootEl; // actualization\n capture();\n this._hideClone();\n dragOverEvent('revert');\n if (!Sortable.eventCanceled) {\n if (nextEl) {\n rootEl.insertBefore(dragEl, nextEl);\n } else {\n rootEl.appendChild(dragEl);\n }\n }\n return completed(true);\n }\n var elLastChild = lastChild(el, options.draggable);\n if (!elLastChild || _ghostIsLast(evt, vertical, this) && !elLastChild.animated) {\n // Insert to end of list\n\n // If already at end of list: Do not insert\n if (elLastChild === dragEl) {\n return completed(false);\n }\n\n // if there is a last element, it is the target\n if (elLastChild && el === evt.target) {\n target = elLastChild;\n }\n if (target) {\n targetRect = getRect(target);\n }\n if (_onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, !!target) !== false) {\n capture();\n if (elLastChild && elLastChild.nextSibling) {\n // the last draggable element is not the last node\n el.insertBefore(dragEl, elLastChild.nextSibling);\n } else {\n el.appendChild(dragEl);\n }\n parentEl = el; // actualization\n\n changed();\n return completed(true);\n }\n } else if (elLastChild && _ghostIsFirst(evt, vertical, this)) {\n // Insert to start of list\n var firstChild = getChild(el, 0, options, true);\n if (firstChild === dragEl) {\n return completed(false);\n }\n target = firstChild;\n targetRect = getRect(target);\n if (_onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, false) !== false) {\n capture();\n el.insertBefore(dragEl, firstChild);\n parentEl = el; // actualization\n\n changed();\n return completed(true);\n }\n } else if (target.parentNode === el) {\n targetRect = getRect(target);\n var direction = 0,\n targetBeforeFirstSwap,\n differentLevel = dragEl.parentNode !== el,\n differentRowCol = !_dragElInRowColumn(dragEl.animated && dragEl.toRect || dragRect, target.animated && target.toRect || targetRect, vertical),\n side1 = vertical ? 'top' : 'left',\n scrolledPastTop = isScrolledPast(target, 'top', 'top') || isScrolledPast(dragEl, 'top', 'top'),\n scrollBefore = scrolledPastTop ? scrolledPastTop.scrollTop : void 0;\n if (lastTarget !== target) {\n targetBeforeFirstSwap = targetRect[side1];\n pastFirstInvertThresh = false;\n isCircumstantialInvert = !differentRowCol && options.invertSwap || differentLevel;\n }\n direction = _getSwapDirection(evt, target, targetRect, vertical, differentRowCol ? 1 : options.swapThreshold, options.invertedSwapThreshold == null ? options.swapThreshold : options.invertedSwapThreshold, isCircumstantialInvert, lastTarget === target);\n var sibling;\n if (direction !== 0) {\n // Check if target is beside dragEl in respective direction (ignoring hidden elements)\n var dragIndex = index(dragEl);\n do {\n dragIndex -= direction;\n sibling = parentEl.children[dragIndex];\n } while (sibling && (css(sibling, 'display') === 'none' || sibling === ghostEl));\n }\n // If dragEl is already beside target: Do not insert\n if (direction === 0 || sibling === target) {\n return completed(false);\n }\n lastTarget = target;\n lastDirection = direction;\n var nextSibling = target.nextElementSibling,\n after = false;\n after = direction === 1;\n var moveVector = _onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, after);\n if (moveVector !== false) {\n if (moveVector === 1 || moveVector === -1) {\n after = moveVector === 1;\n }\n _silent = true;\n setTimeout(_unsilent, 30);\n capture();\n if (after && !nextSibling) {\n el.appendChild(dragEl);\n } else {\n target.parentNode.insertBefore(dragEl, after ? nextSibling : target);\n }\n\n // Undo chrome's scroll adjustment (has no effect on other browsers)\n if (scrolledPastTop) {\n scrollBy(scrolledPastTop, 0, scrollBefore - scrolledPastTop.scrollTop);\n }\n parentEl = dragEl.parentNode; // actualization\n\n // must be done before animation\n if (targetBeforeFirstSwap !== undefined && !isCircumstantialInvert) {\n targetMoveDistance = Math.abs(targetBeforeFirstSwap - getRect(target)[side1]);\n }\n changed();\n return completed(true);\n }\n }\n if (el.contains(dragEl)) {\n return completed(false);\n }\n }\n return false;\n },\n _ignoreWhileAnimating: null,\n _offMoveEvents: function _offMoveEvents() {\n off(document, 'mousemove', this._onTouchMove);\n off(document, 'touchmove', this._onTouchMove);\n off(document, 'pointermove', this._onTouchMove);\n off(document, 'dragover', nearestEmptyInsertDetectEvent);\n off(document, 'mousemove', nearestEmptyInsertDetectEvent);\n off(document, 'touchmove', nearestEmptyInsertDetectEvent);\n },\n _offUpEvents: function _offUpEvents() {\n var ownerDocument = this.el.ownerDocument;\n off(ownerDocument, 'mouseup', this._onDrop);\n off(ownerDocument, 'touchend', this._onDrop);\n off(ownerDocument, 'pointerup', this._onDrop);\n off(ownerDocument, 'pointercancel', this._onDrop);\n off(ownerDocument, 'touchcancel', this._onDrop);\n off(document, 'selectstart', this);\n },\n _onDrop: function _onDrop( /**Event*/evt) {\n var el = this.el,\n options = this.options;\n\n // Get the index of the dragged element within its parent\n newIndex = index(dragEl);\n newDraggableIndex = index(dragEl, options.draggable);\n pluginEvent('drop', this, {\n evt: evt\n });\n parentEl = dragEl && dragEl.parentNode;\n\n // Get again after plugin event\n newIndex = index(dragEl);\n newDraggableIndex = index(dragEl, options.draggable);\n if (Sortable.eventCanceled) {\n this._nulling();\n return;\n }\n awaitingDragStarted = false;\n isCircumstantialInvert = false;\n pastFirstInvertThresh = false;\n clearInterval(this._loopId);\n clearTimeout(this._dragStartTimer);\n _cancelNextTick(this.cloneId);\n _cancelNextTick(this._dragStartId);\n\n // Unbind events\n if (this.nativeDraggable) {\n off(document, 'drop', this);\n off(el, 'dragstart', this._onDragStart);\n }\n this._offMoveEvents();\n this._offUpEvents();\n if (Safari) {\n css(document.body, 'user-select', '');\n }\n css(dragEl, 'transform', '');\n if (evt) {\n if (moved) {\n evt.cancelable && evt.preventDefault();\n !options.dropBubble && evt.stopPropagation();\n }\n ghostEl && ghostEl.parentNode && ghostEl.parentNode.removeChild(ghostEl);\n if (rootEl === parentEl || putSortable && putSortable.lastPutMode !== 'clone') {\n // Remove clone(s)\n cloneEl && cloneEl.parentNode && cloneEl.parentNode.removeChild(cloneEl);\n }\n if (dragEl) {\n if (this.nativeDraggable) {\n off(dragEl, 'dragend', this);\n }\n _disableDraggable(dragEl);\n dragEl.style['will-change'] = '';\n\n // Remove classes\n // ghostClass is added in dragStarted\n if (moved && !awaitingDragStarted) {\n toggleClass(dragEl, putSortable ? putSortable.options.ghostClass : this.options.ghostClass, false);\n }\n toggleClass(dragEl, this.options.chosenClass, false);\n\n // Drag stop event\n _dispatchEvent({\n sortable: this,\n name: 'unchoose',\n toEl: parentEl,\n newIndex: null,\n newDraggableIndex: null,\n originalEvent: evt\n });\n if (rootEl !== parentEl) {\n if (newIndex >= 0) {\n // Add event\n _dispatchEvent({\n rootEl: parentEl,\n name: 'add',\n toEl: parentEl,\n fromEl: rootEl,\n originalEvent: evt\n });\n\n // Remove event\n _dispatchEvent({\n sortable: this,\n name: 'remove',\n toEl: parentEl,\n originalEvent: evt\n });\n\n // drag from one list and drop into another\n _dispatchEvent({\n rootEl: parentEl,\n name: 'sort',\n toEl: parentEl,\n fromEl: rootEl,\n originalEvent: evt\n });\n _dispatchEvent({\n sortable: this,\n name: 'sort',\n toEl: parentEl,\n originalEvent: evt\n });\n }\n putSortable && putSortable.save();\n } else {\n if (newIndex !== oldIndex) {\n if (newIndex >= 0) {\n // drag & drop within the same list\n _dispatchEvent({\n sortable: this,\n name: 'update',\n toEl: parentEl,\n originalEvent: evt\n });\n _dispatchEvent({\n sortable: this,\n name: 'sort',\n toEl: parentEl,\n originalEvent: evt\n });\n }\n }\n }\n if (Sortable.active) {\n /* jshint eqnull:true */\n if (newIndex == null || newIndex === -1) {\n newIndex = oldIndex;\n newDraggableIndex = oldDraggableIndex;\n }\n _dispatchEvent({\n sortable: this,\n name: 'end',\n toEl: parentEl,\n originalEvent: evt\n });\n\n // Save sorting\n this.save();\n }\n }\n }\n this._nulling();\n },\n _nulling: function _nulling() {\n pluginEvent('nulling', this);\n rootEl = dragEl = parentEl = ghostEl = nextEl = cloneEl = lastDownEl = cloneHidden = tapEvt = touchEvt = moved = newIndex = newDraggableIndex = oldIndex = oldDraggableIndex = lastTarget = lastDirection = putSortable = activeGroup = Sortable.dragged = Sortable.ghost = Sortable.clone = Sortable.active = null;\n var el = this.el;\n savedInputChecked.forEach(function (checkEl) {\n if (el.contains(checkEl)) {\n checkEl.checked = true;\n }\n });\n savedInputChecked.length = lastDx = lastDy = 0;\n },\n handleEvent: function handleEvent( /**Event*/evt) {\n switch (evt.type) {\n case 'drop':\n case 'dragend':\n this._onDrop(evt);\n break;\n case 'dragenter':\n case 'dragover':\n if (dragEl) {\n this._onDragOver(evt);\n _globalDragOver(evt);\n }\n break;\n case 'selectstart':\n evt.preventDefault();\n break;\n }\n },\n /**\r\n * Serializes the item into an array of string.\r\n * @returns {String[]}\r\n */\n toArray: function toArray() {\n var order = [],\n el,\n children = this.el.children,\n i = 0,\n n = children.length,\n options = this.options;\n for (; i < n; i++) {\n el = children[i];\n if (closest(el, options.draggable, this.el, false)) {\n order.push(el.getAttribute(options.dataIdAttr) || _generateId(el));\n }\n }\n return order;\n },\n /**\r\n * Sorts the elements according to the array.\r\n * @param {String[]} order order of the items\r\n */\n sort: function sort(order, useAnimation) {\n var items = {},\n rootEl = this.el;\n this.toArray().forEach(function (id, i) {\n var el = rootEl.children[i];\n if (closest(el, this.options.draggable, rootEl, false)) {\n items[id] = el;\n }\n }, this);\n useAnimation && this.captureAnimationState();\n order.forEach(function (id) {\n if (items[id]) {\n rootEl.removeChild(items[id]);\n rootEl.appendChild(items[id]);\n }\n });\n useAnimation && this.animateAll();\n },\n /**\r\n * Save the current sorting\r\n */\n save: function save() {\n var store = this.options.store;\n store && store.set && store.set(this);\n },\n /**\r\n * For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree.\r\n * @param {HTMLElement} el\r\n * @param {String} [selector] default: `options.draggable`\r\n * @returns {HTMLElement|null}\r\n */\n closest: function closest$1(el, selector) {\n return closest(el, selector || this.options.draggable, this.el, false);\n },\n /**\r\n * Set/get option\r\n * @param {string} name\r\n * @param {*} [value]\r\n * @returns {*}\r\n */\n option: function option(name, value) {\n var options = this.options;\n if (value === void 0) {\n return options[name];\n } else {\n var modifiedValue = PluginManager.modifyOption(this, name, value);\n if (typeof modifiedValue !== 'undefined') {\n options[name] = modifiedValue;\n } else {\n options[name] = value;\n }\n if (name === 'group') {\n _prepareGroup(options);\n }\n }\n },\n /**\r\n * Destroy\r\n */\n destroy: function destroy() {\n pluginEvent('destroy', this);\n var el = this.el;\n el[expando] = null;\n off(el, 'mousedown', this._onTapStart);\n off(el, 'touchstart', this._onTapStart);\n off(el, 'pointerdown', this._onTapStart);\n if (this.nativeDraggable) {\n off(el, 'dragover', this);\n off(el, 'dragenter', this);\n }\n // Remove draggable attributes\n Array.prototype.forEach.call(el.querySelectorAll('[draggable]'), function (el) {\n el.removeAttribute('draggable');\n });\n this._onDrop();\n this._disableDelayedDragEvents();\n sortables.splice(sortables.indexOf(this.el), 1);\n this.el = el = null;\n },\n _hideClone: function _hideClone() {\n if (!cloneHidden) {\n pluginEvent('hideClone', this);\n if (Sortable.eventCanceled) return;\n css(cloneEl, 'display', 'none');\n if (this.options.removeCloneOnHide && cloneEl.parentNode) {\n cloneEl.parentNode.removeChild(cloneEl);\n }\n cloneHidden = true;\n }\n },\n _showClone: function _showClone(putSortable) {\n if (putSortable.lastPutMode !== 'clone') {\n this._hideClone();\n return;\n }\n if (cloneHidden) {\n pluginEvent('showClone', this);\n if (Sortable.eventCanceled) return;\n\n // show clone at dragEl or original position\n if (dragEl.parentNode == rootEl && !this.options.group.revertClone) {\n rootEl.insertBefore(cloneEl, dragEl);\n } else if (nextEl) {\n rootEl.insertBefore(cloneEl, nextEl);\n } else {\n rootEl.appendChild(cloneEl);\n }\n if (this.options.group.revertClone) {\n this.animate(dragEl, cloneEl);\n }\n css(cloneEl, 'display', '');\n cloneHidden = false;\n }\n }\n};\nfunction _globalDragOver( /**Event*/evt) {\n if (evt.dataTransfer) {\n evt.dataTransfer.dropEffect = 'move';\n }\n evt.cancelable && evt.preventDefault();\n}\nfunction _onMove(fromEl, toEl, dragEl, dragRect, targetEl, targetRect, originalEvent, willInsertAfter) {\n var evt,\n sortable = fromEl[expando],\n onMoveFn = sortable.options.onMove,\n retVal;\n // Support for new CustomEvent feature\n if (window.CustomEvent && !IE11OrLess && !Edge) {\n evt = new CustomEvent('move', {\n bubbles: true,\n cancelable: true\n });\n } else {\n evt = document.createEvent('Event');\n evt.initEvent('move', true, true);\n }\n evt.to = toEl;\n evt.from = fromEl;\n evt.dragged = dragEl;\n evt.draggedRect = dragRect;\n evt.related = targetEl || toEl;\n evt.relatedRect = targetRect || getRect(toEl);\n evt.willInsertAfter = willInsertAfter;\n evt.originalEvent = originalEvent;\n fromEl.dispatchEvent(evt);\n if (onMoveFn) {\n retVal = onMoveFn.call(sortable, evt, originalEvent);\n }\n return retVal;\n}\nfunction _disableDraggable(el) {\n el.draggable = false;\n}\nfunction _unsilent() {\n _silent = false;\n}\nfunction _ghostIsFirst(evt, vertical, sortable) {\n var firstElRect = getRect(getChild(sortable.el, 0, sortable.options, true));\n var childContainingRect = getChildContainingRectFromElement(sortable.el, sortable.options, ghostEl);\n var spacer = 10;\n return vertical ? evt.clientX < childContainingRect.left - spacer || evt.clientY < firstElRect.top && evt.clientX < firstElRect.right : evt.clientY < childContainingRect.top - spacer || evt.clientY < firstElRect.bottom && evt.clientX < firstElRect.left;\n}\nfunction _ghostIsLast(evt, vertical, sortable) {\n var lastElRect = getRect(lastChild(sortable.el, sortable.options.draggable));\n var childContainingRect = getChildContainingRectFromElement(sortable.el, sortable.options, ghostEl);\n var spacer = 10;\n return vertical ? evt.clientX > childContainingRect.right + spacer || evt.clientY > lastElRect.bottom && evt.clientX > lastElRect.left : evt.clientY > childContainingRect.bottom + spacer || evt.clientX > lastElRect.right && evt.clientY > lastElRect.top;\n}\nfunction _getSwapDirection(evt, target, targetRect, vertical, swapThreshold, invertedSwapThreshold, invertSwap, isLastTarget) {\n var mouseOnAxis = vertical ? evt.clientY : evt.clientX,\n targetLength = vertical ? targetRect.height : targetRect.width,\n targetS1 = vertical ? targetRect.top : targetRect.left,\n targetS2 = vertical ? targetRect.bottom : targetRect.right,\n invert = false;\n if (!invertSwap) {\n // Never invert or create dragEl shadow when target movemenet causes mouse to move past the end of regular swapThreshold\n if (isLastTarget && targetMoveDistance < targetLength * swapThreshold) {\n // multiplied only by swapThreshold because mouse will already be inside target by (1 - threshold) * targetLength / 2\n // check if past first invert threshold on side opposite of lastDirection\n if (!pastFirstInvertThresh && (lastDirection === 1 ? mouseOnAxis > targetS1 + targetLength * invertedSwapThreshold / 2 : mouseOnAxis < targetS2 - targetLength * invertedSwapThreshold / 2)) {\n // past first invert threshold, do not restrict inverted threshold to dragEl shadow\n pastFirstInvertThresh = true;\n }\n if (!pastFirstInvertThresh) {\n // dragEl shadow (target move distance shadow)\n if (lastDirection === 1 ? mouseOnAxis < targetS1 + targetMoveDistance // over dragEl shadow\n : mouseOnAxis > targetS2 - targetMoveDistance) {\n return -lastDirection;\n }\n } else {\n invert = true;\n }\n } else {\n // Regular\n if (mouseOnAxis > targetS1 + targetLength * (1 - swapThreshold) / 2 && mouseOnAxis < targetS2 - targetLength * (1 - swapThreshold) / 2) {\n return _getInsertDirection(target);\n }\n }\n }\n invert = invert || invertSwap;\n if (invert) {\n // Invert of regular\n if (mouseOnAxis < targetS1 + targetLength * invertedSwapThreshold / 2 || mouseOnAxis > targetS2 - targetLength * invertedSwapThreshold / 2) {\n return mouseOnAxis > targetS1 + targetLength / 2 ? 1 : -1;\n }\n }\n return 0;\n}\n\n/**\r\n * Gets the direction dragEl must be swapped relative to target in order to make it\r\n * seem that dragEl has been \"inserted\" into that element's position\r\n * @param {HTMLElement} target The target whose position dragEl is being inserted at\r\n * @return {Number} Direction dragEl must be swapped\r\n */\nfunction _getInsertDirection(target) {\n if (index(dragEl) < index(target)) {\n return 1;\n } else {\n return -1;\n }\n}\n\n/**\r\n * Generate id\r\n * @param {HTMLElement} el\r\n * @returns {String}\r\n * @private\r\n */\nfunction _generateId(el) {\n var str = el.tagName + el.className + el.src + el.href + el.textContent,\n i = str.length,\n sum = 0;\n while (i--) {\n sum += str.charCodeAt(i);\n }\n return sum.toString(36);\n}\nfunction _saveInputCheckedState(root) {\n savedInputChecked.length = 0;\n var inputs = root.getElementsByTagName('input');\n var idx = inputs.length;\n while (idx--) {\n var el = inputs[idx];\n el.checked && savedInputChecked.push(el);\n }\n}\nfunction _nextTick(fn) {\n return setTimeout(fn, 0);\n}\nfunction _cancelNextTick(id) {\n return clearTimeout(id);\n}\n\n// Fixed #973:\nif (documentExists) {\n on(document, 'touchmove', function (evt) {\n if ((Sortable.active || awaitingDragStarted) && evt.cancelable) {\n evt.preventDefault();\n }\n });\n}\n\n// Export utils\nSortable.utils = {\n on: on,\n off: off,\n css: css,\n find: find,\n is: function is(el, selector) {\n return !!closest(el, selector, el, false);\n },\n extend: extend,\n throttle: throttle,\n closest: closest,\n toggleClass: toggleClass,\n clone: clone,\n index: index,\n nextTick: _nextTick,\n cancelNextTick: _cancelNextTick,\n detectDirection: _detectDirection,\n getChild: getChild,\n expando: expando\n};\n\n/**\r\n * Get the Sortable instance of an element\r\n * @param {HTMLElement} element The element\r\n * @return {Sortable|undefined} The instance of Sortable\r\n */\nSortable.get = function (element) {\n return element[expando];\n};\n\n/**\r\n * Mount a plugin to Sortable\r\n * @param {...SortablePlugin|SortablePlugin[]} plugins Plugins being mounted\r\n */\nSortable.mount = function () {\n for (var _len = arguments.length, plugins = new Array(_len), _key = 0; _key < _len; _key++) {\n plugins[_key] = arguments[_key];\n }\n if (plugins[0].constructor === Array) plugins = plugins[0];\n plugins.forEach(function (plugin) {\n if (!plugin.prototype || !plugin.prototype.constructor) {\n throw \"Sortable: Mounted plugin must be a constructor function, not \".concat({}.toString.call(plugin));\n }\n if (plugin.utils) Sortable.utils = _objectSpread2(_objectSpread2({}, Sortable.utils), plugin.utils);\n PluginManager.mount(plugin);\n });\n};\n\n/**\r\n * Create sortable instance\r\n * @param {HTMLElement} el\r\n * @param {Object} [options]\r\n */\nSortable.create = function (el, options) {\n return new Sortable(el, options);\n};\n\n// Export\nSortable.version = version;\n\nvar autoScrolls = [],\n scrollEl,\n scrollRootEl,\n scrolling = false,\n lastAutoScrollX,\n lastAutoScrollY,\n touchEvt$1,\n pointerElemChangedInterval;\nfunction AutoScrollPlugin() {\n function AutoScroll() {\n this.defaults = {\n scroll: true,\n forceAutoScrollFallback: false,\n scrollSensitivity: 30,\n scrollSpeed: 10,\n bubbleScroll: true\n };\n\n // Bind all private methods\n for (var fn in this) {\n if (fn.charAt(0) === '_' && typeof this[fn] === 'function') {\n this[fn] = this[fn].bind(this);\n }\n }\n }\n AutoScroll.prototype = {\n dragStarted: function dragStarted(_ref) {\n var originalEvent = _ref.originalEvent;\n if (this.sortable.nativeDraggable) {\n on(document, 'dragover', this._handleAutoScroll);\n } else {\n if (this.options.supportPointer) {\n on(document, 'pointermove', this._handleFallbackAutoScroll);\n } else if (originalEvent.touches) {\n on(document, 'touchmove', this._handleFallbackAutoScroll);\n } else {\n on(document, 'mousemove', this._handleFallbackAutoScroll);\n }\n }\n },\n dragOverCompleted: function dragOverCompleted(_ref2) {\n var originalEvent = _ref2.originalEvent;\n // For when bubbling is canceled and using fallback (fallback 'touchmove' always reached)\n if (!this.options.dragOverBubble && !originalEvent.rootEl) {\n this._handleAutoScroll(originalEvent);\n }\n },\n drop: function drop() {\n if (this.sortable.nativeDraggable) {\n off(document, 'dragover', this._handleAutoScroll);\n } else {\n off(document, 'pointermove', this._handleFallbackAutoScroll);\n off(document, 'touchmove', this._handleFallbackAutoScroll);\n off(document, 'mousemove', this._handleFallbackAutoScroll);\n }\n clearPointerElemChangedInterval();\n clearAutoScrolls();\n cancelThrottle();\n },\n nulling: function nulling() {\n touchEvt$1 = scrollRootEl = scrollEl = scrolling = pointerElemChangedInterval = lastAutoScrollX = lastAutoScrollY = null;\n autoScrolls.length = 0;\n },\n _handleFallbackAutoScroll: function _handleFallbackAutoScroll(evt) {\n this._handleAutoScroll(evt, true);\n },\n _handleAutoScroll: function _handleAutoScroll(evt, fallback) {\n var _this = this;\n var x = (evt.touches ? evt.touches[0] : evt).clientX,\n y = (evt.touches ? evt.touches[0] : evt).clientY,\n elem = document.elementFromPoint(x, y);\n touchEvt$1 = evt;\n\n // IE does not seem to have native autoscroll,\n // Edge's autoscroll seems too conditional,\n // MACOS Safari does not have autoscroll,\n // Firefox and Chrome are good\n if (fallback || this.options.forceAutoScrollFallback || Edge || IE11OrLess || Safari) {\n autoScroll(evt, this.options, elem, fallback);\n\n // Listener for pointer element change\n var ogElemScroller = getParentAutoScrollElement(elem, true);\n if (scrolling && (!pointerElemChangedInterval || x !== lastAutoScrollX || y !== lastAutoScrollY)) {\n pointerElemChangedInterval && clearPointerElemChangedInterval();\n // Detect for pointer elem change, emulating native DnD behaviour\n pointerElemChangedInterval = setInterval(function () {\n var newElem = getParentAutoScrollElement(document.elementFromPoint(x, y), true);\n if (newElem !== ogElemScroller) {\n ogElemScroller = newElem;\n clearAutoScrolls();\n }\n autoScroll(evt, _this.options, newElem, fallback);\n }, 10);\n lastAutoScrollX = x;\n lastAutoScrollY = y;\n }\n } else {\n // if DnD is enabled (and browser has good autoscrolling), first autoscroll will already scroll, so get parent autoscroll of first autoscroll\n if (!this.options.bubbleScroll || getParentAutoScrollElement(elem, true) === getWindowScrollingElement()) {\n clearAutoScrolls();\n return;\n }\n autoScroll(evt, this.options, getParentAutoScrollElement(elem, false), false);\n }\n }\n };\n return _extends(AutoScroll, {\n pluginName: 'scroll',\n initializeByDefault: true\n });\n}\nfunction clearAutoScrolls() {\n autoScrolls.forEach(function (autoScroll) {\n clearInterval(autoScroll.pid);\n });\n autoScrolls = [];\n}\nfunction clearPointerElemChangedInterval() {\n clearInterval(pointerElemChangedInterval);\n}\nvar autoScroll = throttle(function (evt, options, rootEl, isFallback) {\n // Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=505521\n if (!options.scroll) return;\n var x = (evt.touches ? evt.touches[0] : evt).clientX,\n y = (evt.touches ? evt.touches[0] : evt).clientY,\n sens = options.scrollSensitivity,\n speed = options.scrollSpeed,\n winScroller = getWindowScrollingElement();\n var scrollThisInstance = false,\n scrollCustomFn;\n\n // New scroll root, set scrollEl\n if (scrollRootEl !== rootEl) {\n scrollRootEl = rootEl;\n clearAutoScrolls();\n scrollEl = options.scroll;\n scrollCustomFn = options.scrollFn;\n if (scrollEl === true) {\n scrollEl = getParentAutoScrollElement(rootEl, true);\n }\n }\n var layersOut = 0;\n var currentParent = scrollEl;\n do {\n var el = currentParent,\n rect = getRect(el),\n top = rect.top,\n bottom = rect.bottom,\n left = rect.left,\n right = rect.right,\n width = rect.width,\n height = rect.height,\n canScrollX = void 0,\n canScrollY = void 0,\n scrollWidth = el.scrollWidth,\n scrollHeight = el.scrollHeight,\n elCSS = css(el),\n scrollPosX = el.scrollLeft,\n scrollPosY = el.scrollTop;\n if (el === winScroller) {\n canScrollX = width < scrollWidth && (elCSS.overflowX === 'auto' || elCSS.overflowX === 'scroll' || elCSS.overflowX === 'visible');\n canScrollY = height < scrollHeight && (elCSS.overflowY === 'auto' || elCSS.overflowY === 'scroll' || elCSS.overflowY === 'visible');\n } else {\n canScrollX = width < scrollWidth && (elCSS.overflowX === 'auto' || elCSS.overflowX === 'scroll');\n canScrollY = height < scrollHeight && (elCSS.overflowY === 'auto' || elCSS.overflowY === 'scroll');\n }\n var vx = canScrollX && (Math.abs(right - x) <= sens && scrollPosX + width < scrollWidth) - (Math.abs(left - x) <= sens && !!scrollPosX);\n var vy = canScrollY && (Math.abs(bottom - y) <= sens && scrollPosY + height < scrollHeight) - (Math.abs(top - y) <= sens && !!scrollPosY);\n if (!autoScrolls[layersOut]) {\n for (var i = 0; i <= layersOut; i++) {\n if (!autoScrolls[i]) {\n autoScrolls[i] = {};\n }\n }\n }\n if (autoScrolls[layersOut].vx != vx || autoScrolls[layersOut].vy != vy || autoScrolls[layersOut].el !== el) {\n autoScrolls[layersOut].el = el;\n autoScrolls[layersOut].vx = vx;\n autoScrolls[layersOut].vy = vy;\n clearInterval(autoScrolls[layersOut].pid);\n if (vx != 0 || vy != 0) {\n scrollThisInstance = true;\n /* jshint loopfunc:true */\n autoScrolls[layersOut].pid = setInterval(function () {\n // emulate drag over during autoscroll (fallback), emulating native DnD behaviour\n if (isFallback && this.layer === 0) {\n Sortable.active._onTouchMove(touchEvt$1); // To move ghost if it is positioned absolutely\n }\n var scrollOffsetY = autoScrolls[this.layer].vy ? autoScrolls[this.layer].vy * speed : 0;\n var scrollOffsetX = autoScrolls[this.layer].vx ? autoScrolls[this.layer].vx * speed : 0;\n if (typeof scrollCustomFn === 'function') {\n if (scrollCustomFn.call(Sortable.dragged.parentNode[expando], scrollOffsetX, scrollOffsetY, evt, touchEvt$1, autoScrolls[this.layer].el) !== 'continue') {\n return;\n }\n }\n scrollBy(autoScrolls[this.layer].el, scrollOffsetX, scrollOffsetY);\n }.bind({\n layer: layersOut\n }), 24);\n }\n }\n layersOut++;\n } while (options.bubbleScroll && currentParent !== winScroller && (currentParent = getParentAutoScrollElement(currentParent, false)));\n scrolling = scrollThisInstance; // in case another function catches scrolling as false in between when it is not\n}, 30);\n\nvar drop = function drop(_ref) {\n var originalEvent = _ref.originalEvent,\n putSortable = _ref.putSortable,\n dragEl = _ref.dragEl,\n activeSortable = _ref.activeSortable,\n dispatchSortableEvent = _ref.dispatchSortableEvent,\n hideGhostForTarget = _ref.hideGhostForTarget,\n unhideGhostForTarget = _ref.unhideGhostForTarget;\n if (!originalEvent) return;\n var toSortable = putSortable || activeSortable;\n hideGhostForTarget();\n var touch = originalEvent.changedTouches && originalEvent.changedTouches.length ? originalEvent.changedTouches[0] : originalEvent;\n var target = document.elementFromPoint(touch.clientX, touch.clientY);\n unhideGhostForTarget();\n if (toSortable && !toSortable.el.contains(target)) {\n dispatchSortableEvent('spill');\n this.onSpill({\n dragEl: dragEl,\n putSortable: putSortable\n });\n }\n};\nfunction Revert() {}\nRevert.prototype = {\n startIndex: null,\n dragStart: function dragStart(_ref2) {\n var oldDraggableIndex = _ref2.oldDraggableIndex;\n this.startIndex = oldDraggableIndex;\n },\n onSpill: function onSpill(_ref3) {\n var dragEl = _ref3.dragEl,\n putSortable = _ref3.putSortable;\n this.sortable.captureAnimationState();\n if (putSortable) {\n putSortable.captureAnimationState();\n }\n var nextSibling = getChild(this.sortable.el, this.startIndex, this.options);\n if (nextSibling) {\n this.sortable.el.insertBefore(dragEl, nextSibling);\n } else {\n this.sortable.el.appendChild(dragEl);\n }\n this.sortable.animateAll();\n if (putSortable) {\n putSortable.animateAll();\n }\n },\n drop: drop\n};\n_extends(Revert, {\n pluginName: 'revertOnSpill'\n});\nfunction Remove() {}\nRemove.prototype = {\n onSpill: function onSpill(_ref4) {\n var dragEl = _ref4.dragEl,\n putSortable = _ref4.putSortable;\n var parentSortable = putSortable || this.sortable;\n parentSortable.captureAnimationState();\n dragEl.parentNode && dragEl.parentNode.removeChild(dragEl);\n parentSortable.animateAll();\n },\n drop: drop\n};\n_extends(Remove, {\n pluginName: 'removeOnSpill'\n});\n\nvar lastSwapEl;\nfunction SwapPlugin() {\n function Swap() {\n this.defaults = {\n swapClass: 'sortable-swap-highlight'\n };\n }\n Swap.prototype = {\n dragStart: function dragStart(_ref) {\n var dragEl = _ref.dragEl;\n lastSwapEl = dragEl;\n },\n dragOverValid: function dragOverValid(_ref2) {\n var completed = _ref2.completed,\n target = _ref2.target,\n onMove = _ref2.onMove,\n activeSortable = _ref2.activeSortable,\n changed = _ref2.changed,\n cancel = _ref2.cancel;\n if (!activeSortable.options.swap) return;\n var el = this.sortable.el,\n options = this.options;\n if (target && target !== el) {\n var prevSwapEl = lastSwapEl;\n if (onMove(target) !== false) {\n toggleClass(target, options.swapClass, true);\n lastSwapEl = target;\n } else {\n lastSwapEl = null;\n }\n if (prevSwapEl && prevSwapEl !== lastSwapEl) {\n toggleClass(prevSwapEl, options.swapClass, false);\n }\n }\n changed();\n completed(true);\n cancel();\n },\n drop: function drop(_ref3) {\n var activeSortable = _ref3.activeSortable,\n putSortable = _ref3.putSortable,\n dragEl = _ref3.dragEl;\n var toSortable = putSortable || this.sortable;\n var options = this.options;\n lastSwapEl && toggleClass(lastSwapEl, options.swapClass, false);\n if (lastSwapEl && (options.swap || putSortable && putSortable.options.swap)) {\n if (dragEl !== lastSwapEl) {\n toSortable.captureAnimationState();\n if (toSortable !== activeSortable) activeSortable.captureAnimationState();\n swapNodes(dragEl, lastSwapEl);\n toSortable.animateAll();\n if (toSortable !== activeSortable) activeSortable.animateAll();\n }\n }\n },\n nulling: function nulling() {\n lastSwapEl = null;\n }\n };\n return _extends(Swap, {\n pluginName: 'swap',\n eventProperties: function eventProperties() {\n return {\n swapItem: lastSwapEl\n };\n }\n });\n}\nfunction swapNodes(n1, n2) {\n var p1 = n1.parentNode,\n p2 = n2.parentNode,\n i1,\n i2;\n if (!p1 || !p2 || p1.isEqualNode(n2) || p2.isEqualNode(n1)) return;\n i1 = index(n1);\n i2 = index(n2);\n if (p1.isEqualNode(p2) && i1 < i2) {\n i2++;\n }\n p1.insertBefore(n2, p1.children[i1]);\n p2.insertBefore(n1, p2.children[i2]);\n}\n\nvar multiDragElements = [],\n multiDragClones = [],\n lastMultiDragSelect,\n // for selection with modifier key down (SHIFT)\n multiDragSortable,\n initialFolding = false,\n // Initial multi-drag fold when drag started\n folding = false,\n // Folding any other time\n dragStarted = false,\n dragEl$1,\n clonesFromRect,\n clonesHidden;\nfunction MultiDragPlugin() {\n function MultiDrag(sortable) {\n // Bind all private methods\n for (var fn in this) {\n if (fn.charAt(0) === '_' && typeof this[fn] === 'function') {\n this[fn] = this[fn].bind(this);\n }\n }\n if (!sortable.options.avoidImplicitDeselect) {\n if (sortable.options.supportPointer) {\n on(document, 'pointerup', this._deselectMultiDrag);\n } else {\n on(document, 'mouseup', this._deselectMultiDrag);\n on(document, 'touchend', this._deselectMultiDrag);\n }\n }\n on(document, 'keydown', this._checkKeyDown);\n on(document, 'keyup', this._checkKeyUp);\n this.defaults = {\n selectedClass: 'sortable-selected',\n multiDragKey: null,\n avoidImplicitDeselect: false,\n setData: function setData(dataTransfer, dragEl) {\n var data = '';\n if (multiDragElements.length && multiDragSortable === sortable) {\n multiDragElements.forEach(function (multiDragElement, i) {\n data += (!i ? '' : ', ') + multiDragElement.textContent;\n });\n } else {\n data = dragEl.textContent;\n }\n dataTransfer.setData('Text', data);\n }\n };\n }\n MultiDrag.prototype = {\n multiDragKeyDown: false,\n isMultiDrag: false,\n delayStartGlobal: function delayStartGlobal(_ref) {\n var dragged = _ref.dragEl;\n dragEl$1 = dragged;\n },\n delayEnded: function delayEnded() {\n this.isMultiDrag = ~multiDragElements.indexOf(dragEl$1);\n },\n setupClone: function setupClone(_ref2) {\n var sortable = _ref2.sortable,\n cancel = _ref2.cancel;\n if (!this.isMultiDrag) return;\n for (var i = 0; i < multiDragElements.length; i++) {\n multiDragClones.push(clone(multiDragElements[i]));\n multiDragClones[i].sortableIndex = multiDragElements[i].sortableIndex;\n multiDragClones[i].draggable = false;\n multiDragClones[i].style['will-change'] = '';\n toggleClass(multiDragClones[i], this.options.selectedClass, false);\n multiDragElements[i] === dragEl$1 && toggleClass(multiDragClones[i], this.options.chosenClass, false);\n }\n sortable._hideClone();\n cancel();\n },\n clone: function clone(_ref3) {\n var sortable = _ref3.sortable,\n rootEl = _ref3.rootEl,\n dispatchSortableEvent = _ref3.dispatchSortableEvent,\n cancel = _ref3.cancel;\n if (!this.isMultiDrag) return;\n if (!this.options.removeCloneOnHide) {\n if (multiDragElements.length && multiDragSortable === sortable) {\n insertMultiDragClones(true, rootEl);\n dispatchSortableEvent('clone');\n cancel();\n }\n }\n },\n showClone: function showClone(_ref4) {\n var cloneNowShown = _ref4.cloneNowShown,\n rootEl = _ref4.rootEl,\n cancel = _ref4.cancel;\n if (!this.isMultiDrag) return;\n insertMultiDragClones(false, rootEl);\n multiDragClones.forEach(function (clone) {\n css(clone, 'display', '');\n });\n cloneNowShown();\n clonesHidden = false;\n cancel();\n },\n hideClone: function hideClone(_ref5) {\n var _this = this;\n var sortable = _ref5.sortable,\n cloneNowHidden = _ref5.cloneNowHidden,\n cancel = _ref5.cancel;\n if (!this.isMultiDrag) return;\n multiDragClones.forEach(function (clone) {\n css(clone, 'display', 'none');\n if (_this.options.removeCloneOnHide && clone.parentNode) {\n clone.parentNode.removeChild(clone);\n }\n });\n cloneNowHidden();\n clonesHidden = true;\n cancel();\n },\n dragStartGlobal: function dragStartGlobal(_ref6) {\n var sortable = _ref6.sortable;\n if (!this.isMultiDrag && multiDragSortable) {\n multiDragSortable.multiDrag._deselectMultiDrag();\n }\n multiDragElements.forEach(function (multiDragElement) {\n multiDragElement.sortableIndex = index(multiDragElement);\n });\n\n // Sort multi-drag elements\n multiDragElements = multiDragElements.sort(function (a, b) {\n return a.sortableIndex - b.sortableIndex;\n });\n dragStarted = true;\n },\n dragStarted: function dragStarted(_ref7) {\n var _this2 = this;\n var sortable = _ref7.sortable;\n if (!this.isMultiDrag) return;\n if (this.options.sort) {\n // Capture rects,\n // hide multi drag elements (by positioning them absolute),\n // set multi drag elements rects to dragRect,\n // show multi drag elements,\n // animate to rects,\n // unset rects & remove from DOM\n\n sortable.captureAnimationState();\n if (this.options.animation) {\n multiDragElements.forEach(function (multiDragElement) {\n if (multiDragElement === dragEl$1) return;\n css(multiDragElement, 'position', 'absolute');\n });\n var dragRect = getRect(dragEl$1, false, true, true);\n multiDragElements.forEach(function (multiDragElement) {\n if (multiDragElement === dragEl$1) return;\n setRect(multiDragElement, dragRect);\n });\n folding = true;\n initialFolding = true;\n }\n }\n sortable.animateAll(function () {\n folding = false;\n initialFolding = false;\n if (_this2.options.animation) {\n multiDragElements.forEach(function (multiDragElement) {\n unsetRect(multiDragElement);\n });\n }\n\n // Remove all auxiliary multidrag items from el, if sorting enabled\n if (_this2.options.sort) {\n removeMultiDragElements();\n }\n });\n },\n dragOver: function dragOver(_ref8) {\n var target = _ref8.target,\n completed = _ref8.completed,\n cancel = _ref8.cancel;\n if (folding && ~multiDragElements.indexOf(target)) {\n completed(false);\n cancel();\n }\n },\n revert: function revert(_ref9) {\n var fromSortable = _ref9.fromSortable,\n rootEl = _ref9.rootEl,\n sortable = _ref9.sortable,\n dragRect = _ref9.dragRect;\n if (multiDragElements.length > 1) {\n // Setup unfold animation\n multiDragElements.forEach(function (multiDragElement) {\n sortable.addAnimationState({\n target: multiDragElement,\n rect: folding ? getRect(multiDragElement) : dragRect\n });\n unsetRect(multiDragElement);\n multiDragElement.fromRect = dragRect;\n fromSortable.removeAnimationState(multiDragElement);\n });\n folding = false;\n insertMultiDragElements(!this.options.removeCloneOnHide, rootEl);\n }\n },\n dragOverCompleted: function dragOverCompleted(_ref10) {\n var sortable = _ref10.sortable,\n isOwner = _ref10.isOwner,\n insertion = _ref10.insertion,\n activeSortable = _ref10.activeSortable,\n parentEl = _ref10.parentEl,\n putSortable = _ref10.putSortable;\n var options = this.options;\n if (insertion) {\n // Clones must be hidden before folding animation to capture dragRectAbsolute properly\n if (isOwner) {\n activeSortable._hideClone();\n }\n initialFolding = false;\n // If leaving sort:false root, or already folding - Fold to new location\n if (options.animation && multiDragElements.length > 1 && (folding || !isOwner && !activeSortable.options.sort && !putSortable)) {\n // Fold: Set all multi drag elements's rects to dragEl's rect when multi-drag elements are invisible\n var dragRectAbsolute = getRect(dragEl$1, false, true, true);\n multiDragElements.forEach(function (multiDragElement) {\n if (multiDragElement === dragEl$1) return;\n setRect(multiDragElement, dragRectAbsolute);\n\n // Move element(s) to end of parentEl so that it does not interfere with multi-drag clones insertion if they are inserted\n // while folding, and so that we can capture them again because old sortable will no longer be fromSortable\n parentEl.appendChild(multiDragElement);\n });\n folding = true;\n }\n\n // Clones must be shown (and check to remove multi drags) after folding when interfering multiDragElements are moved out\n if (!isOwner) {\n // Only remove if not folding (folding will remove them anyways)\n if (!folding) {\n removeMultiDragElements();\n }\n if (multiDragElements.length > 1) {\n var clonesHiddenBefore = clonesHidden;\n activeSortable._showClone(sortable);\n\n // Unfold animation for clones if showing from hidden\n if (activeSortable.options.animation && !clonesHidden && clonesHiddenBefore) {\n multiDragClones.forEach(function (clone) {\n activeSortable.addAnimationState({\n target: clone,\n rect: clonesFromRect\n });\n clone.fromRect = clonesFromRect;\n clone.thisAnimationDuration = null;\n });\n }\n } else {\n activeSortable._showClone(sortable);\n }\n }\n }\n },\n dragOverAnimationCapture: function dragOverAnimationCapture(_ref11) {\n var dragRect = _ref11.dragRect,\n isOwner = _ref11.isOwner,\n activeSortable = _ref11.activeSortable;\n multiDragElements.forEach(function (multiDragElement) {\n multiDragElement.thisAnimationDuration = null;\n });\n if (activeSortable.options.animation && !isOwner && activeSortable.multiDrag.isMultiDrag) {\n clonesFromRect = _extends({}, dragRect);\n var dragMatrix = matrix(dragEl$1, true);\n clonesFromRect.top -= dragMatrix.f;\n clonesFromRect.left -= dragMatrix.e;\n }\n },\n dragOverAnimationComplete: function dragOverAnimationComplete() {\n if (folding) {\n folding = false;\n removeMultiDragElements();\n }\n },\n drop: function drop(_ref12) {\n var evt = _ref12.originalEvent,\n rootEl = _ref12.rootEl,\n parentEl = _ref12.parentEl,\n sortable = _ref12.sortable,\n dispatchSortableEvent = _ref12.dispatchSortableEvent,\n oldIndex = _ref12.oldIndex,\n putSortable = _ref12.putSortable;\n var toSortable = putSortable || this.sortable;\n if (!evt) return;\n var options = this.options,\n children = parentEl.children;\n\n // Multi-drag selection\n if (!dragStarted) {\n if (options.multiDragKey && !this.multiDragKeyDown) {\n this._deselectMultiDrag();\n }\n toggleClass(dragEl$1, options.selectedClass, !~multiDragElements.indexOf(dragEl$1));\n if (!~multiDragElements.indexOf(dragEl$1)) {\n multiDragElements.push(dragEl$1);\n dispatchEvent({\n sortable: sortable,\n rootEl: rootEl,\n name: 'select',\n targetEl: dragEl$1,\n originalEvent: evt\n });\n\n // Modifier activated, select from last to dragEl\n if (evt.shiftKey && lastMultiDragSelect && sortable.el.contains(lastMultiDragSelect)) {\n var lastIndex = index(lastMultiDragSelect),\n currentIndex = index(dragEl$1);\n if (~lastIndex && ~currentIndex && lastIndex !== currentIndex) {\n (function () {\n // Must include lastMultiDragSelect (select it), in case modified selection from no selection\n // (but previous selection existed)\n var n, i;\n if (currentIndex > lastIndex) {\n i = lastIndex;\n n = currentIndex;\n } else {\n i = currentIndex;\n n = lastIndex + 1;\n }\n var filter = options.filter;\n for (; i < n; i++) {\n if (~multiDragElements.indexOf(children[i])) continue;\n // Check if element is draggable\n if (!closest(children[i], options.draggable, parentEl, false)) continue;\n // Check if element is filtered\n var filtered = filter && (typeof filter === 'function' ? filter.call(sortable, evt, children[i], sortable) : filter.split(',').some(function (criteria) {\n return closest(children[i], criteria.trim(), parentEl, false);\n }));\n if (filtered) continue;\n toggleClass(children[i], options.selectedClass, true);\n multiDragElements.push(children[i]);\n dispatchEvent({\n sortable: sortable,\n rootEl: rootEl,\n name: 'select',\n targetEl: children[i],\n originalEvent: evt\n });\n }\n })();\n }\n } else {\n lastMultiDragSelect = dragEl$1;\n }\n multiDragSortable = toSortable;\n } else {\n multiDragElements.splice(multiDragElements.indexOf(dragEl$1), 1);\n lastMultiDragSelect = null;\n dispatchEvent({\n sortable: sortable,\n rootEl: rootEl,\n name: 'deselect',\n targetEl: dragEl$1,\n originalEvent: evt\n });\n }\n }\n\n // Multi-drag drop\n if (dragStarted && this.isMultiDrag) {\n folding = false;\n // Do not \"unfold\" after around dragEl if reverted\n if ((parentEl[expando].options.sort || parentEl !== rootEl) && multiDragElements.length > 1) {\n var dragRect = getRect(dragEl$1),\n multiDragIndex = index(dragEl$1, ':not(.' + this.options.selectedClass + ')');\n if (!initialFolding && options.animation) dragEl$1.thisAnimationDuration = null;\n toSortable.captureAnimationState();\n if (!initialFolding) {\n if (options.animation) {\n dragEl$1.fromRect = dragRect;\n multiDragElements.forEach(function (multiDragElement) {\n multiDragElement.thisAnimationDuration = null;\n if (multiDragElement !== dragEl$1) {\n var rect = folding ? getRect(multiDragElement) : dragRect;\n multiDragElement.fromRect = rect;\n\n // Prepare unfold animation\n toSortable.addAnimationState({\n target: multiDragElement,\n rect: rect\n });\n }\n });\n }\n\n // Multi drag elements are not necessarily removed from the DOM on drop, so to reinsert\n // properly they must all be removed\n removeMultiDragElements();\n multiDragElements.forEach(function (multiDragElement) {\n if (children[multiDragIndex]) {\n parentEl.insertBefore(multiDragElement, children[multiDragIndex]);\n } else {\n parentEl.appendChild(multiDragElement);\n }\n multiDragIndex++;\n });\n\n // If initial folding is done, the elements may have changed position because they are now\n // unfolding around dragEl, even though dragEl may not have his index changed, so update event\n // must be fired here as Sortable will not.\n if (oldIndex === index(dragEl$1)) {\n var update = false;\n multiDragElements.forEach(function (multiDragElement) {\n if (multiDragElement.sortableIndex !== index(multiDragElement)) {\n update = true;\n return;\n }\n });\n if (update) {\n dispatchSortableEvent('update');\n dispatchSortableEvent('sort');\n }\n }\n }\n\n // Must be done after capturing individual rects (scroll bar)\n multiDragElements.forEach(function (multiDragElement) {\n unsetRect(multiDragElement);\n });\n toSortable.animateAll();\n }\n multiDragSortable = toSortable;\n }\n\n // Remove clones if necessary\n if (rootEl === parentEl || putSortable && putSortable.lastPutMode !== 'clone') {\n multiDragClones.forEach(function (clone) {\n clone.parentNode && clone.parentNode.removeChild(clone);\n });\n }\n },\n nullingGlobal: function nullingGlobal() {\n this.isMultiDrag = dragStarted = false;\n multiDragClones.length = 0;\n },\n destroyGlobal: function destroyGlobal() {\n this._deselectMultiDrag();\n off(document, 'pointerup', this._deselectMultiDrag);\n off(document, 'mouseup', this._deselectMultiDrag);\n off(document, 'touchend', this._deselectMultiDrag);\n off(document, 'keydown', this._checkKeyDown);\n off(document, 'keyup', this._checkKeyUp);\n },\n _deselectMultiDrag: function _deselectMultiDrag(evt) {\n if (typeof dragStarted !== \"undefined\" && dragStarted) return;\n\n // Only deselect if selection is in this sortable\n if (multiDragSortable !== this.sortable) return;\n\n // Only deselect if target is not item in this sortable\n if (evt && closest(evt.target, this.options.draggable, this.sortable.el, false)) return;\n\n // Only deselect if left click\n if (evt && evt.button !== 0) return;\n while (multiDragElements.length) {\n var el = multiDragElements[0];\n toggleClass(el, this.options.selectedClass, false);\n multiDragElements.shift();\n dispatchEvent({\n sortable: this.sortable,\n rootEl: this.sortable.el,\n name: 'deselect',\n targetEl: el,\n originalEvent: evt\n });\n }\n },\n _checkKeyDown: function _checkKeyDown(evt) {\n if (evt.key === this.options.multiDragKey) {\n this.multiDragKeyDown = true;\n }\n },\n _checkKeyUp: function _checkKeyUp(evt) {\n if (evt.key === this.options.multiDragKey) {\n this.multiDragKeyDown = false;\n }\n }\n };\n return _extends(MultiDrag, {\n // Static methods & properties\n pluginName: 'multiDrag',\n utils: {\n /**\r\n * Selects the provided multi-drag item\r\n * @param {HTMLElement} el The element to be selected\r\n */\n select: function select(el) {\n var sortable = el.parentNode[expando];\n if (!sortable || !sortable.options.multiDrag || ~multiDragElements.indexOf(el)) return;\n if (multiDragSortable && multiDragSortable !== sortable) {\n multiDragSortable.multiDrag._deselectMultiDrag();\n multiDragSortable = sortable;\n }\n toggleClass(el, sortable.options.selectedClass, true);\n multiDragElements.push(el);\n },\n /**\r\n * Deselects the provided multi-drag item\r\n * @param {HTMLElement} el The element to be deselected\r\n */\n deselect: function deselect(el) {\n var sortable = el.parentNode[expando],\n index = multiDragElements.indexOf(el);\n if (!sortable || !sortable.options.multiDrag || !~index) return;\n toggleClass(el, sortable.options.selectedClass, false);\n multiDragElements.splice(index, 1);\n }\n },\n eventProperties: function eventProperties() {\n var _this3 = this;\n var oldIndicies = [],\n newIndicies = [];\n multiDragElements.forEach(function (multiDragElement) {\n oldIndicies.push({\n multiDragElement: multiDragElement,\n index: multiDragElement.sortableIndex\n });\n\n // multiDragElements will already be sorted if folding\n var newIndex;\n if (folding && multiDragElement !== dragEl$1) {\n newIndex = -1;\n } else if (folding) {\n newIndex = index(multiDragElement, ':not(.' + _this3.options.selectedClass + ')');\n } else {\n newIndex = index(multiDragElement);\n }\n newIndicies.push({\n multiDragElement: multiDragElement,\n index: newIndex\n });\n });\n return {\n items: _toConsumableArray(multiDragElements),\n clones: [].concat(multiDragClones),\n oldIndicies: oldIndicies,\n newIndicies: newIndicies\n };\n },\n optionListeners: {\n multiDragKey: function multiDragKey(key) {\n key = key.toLowerCase();\n if (key === 'ctrl') {\n key = 'Control';\n } else if (key.length > 1) {\n key = key.charAt(0).toUpperCase() + key.substr(1);\n }\n return key;\n }\n }\n });\n}\nfunction insertMultiDragElements(clonesInserted, rootEl) {\n multiDragElements.forEach(function (multiDragElement, i) {\n var target = rootEl.children[multiDragElement.sortableIndex + (clonesInserted ? Number(i) : 0)];\n if (target) {\n rootEl.insertBefore(multiDragElement, target);\n } else {\n rootEl.appendChild(multiDragElement);\n }\n });\n}\n\n/**\r\n * Insert multi-drag clones\r\n * @param {[Boolean]} elementsInserted Whether the multi-drag elements are inserted\r\n * @param {HTMLElement} rootEl\r\n */\nfunction insertMultiDragClones(elementsInserted, rootEl) {\n multiDragClones.forEach(function (clone, i) {\n var target = rootEl.children[clone.sortableIndex + (elementsInserted ? Number(i) : 0)];\n if (target) {\n rootEl.insertBefore(clone, target);\n } else {\n rootEl.appendChild(clone);\n }\n });\n}\nfunction removeMultiDragElements() {\n multiDragElements.forEach(function (multiDragElement) {\n if (multiDragElement === dragEl$1) return;\n multiDragElement.parentNode && multiDragElement.parentNode.removeChild(multiDragElement);\n });\n}\n\nSortable.mount(new AutoScrollPlugin());\nSortable.mount(Remove, Revert);\n\nexport default Sortable;\nexport { MultiDragPlugin as MultiDrag, Sortable, SwapPlugin as Swap };\n","// sortable: a Svelte action that lets the user reorder items by dragging them, within a container\n// and between containers. SortableJS handles the input (mouse, touch, nested containers); the\n// action reports the result as a move from one container and index to another, and the\n// application applies it to its own data. The data stays the only source of the order: right after\n// a drop the action puts the element back where it was, so that a keyed {#each} is never out of\n// step with the DOM, and the list is drawn again from the data.\n//\n// Put the action on each container. Containers with the same group exchange items. Each item\n// carries data-sortable-item and data-id; data-kind names its kind when containers accept only\n// some kinds. With handle, an item is picked up by that part only (a grip for touch screens);\n// without it, by the whole item.\n//\n// <div use:sortable={{ group: 'rows', containerId: 'root', onDrop: move }}>\n// {#each rows as row (row.id)}\n// <TreeRow data-sortable-item data-id={row.id}>{row.name}</TreeRow>\n// {/each}\n// </div>\nimport Sortable from 'sortablejs';\nexport function sortable(node, params) {\n let cur = params;\n let instance = null;\n // Where the item was when the drag began, to put it back after the drop\n let origParent = null;\n let origNext = null;\n // The item under the pointer, read from the document during a drag: SortableJS reports moves\n // only over containers that accept the item\n let docMove = null;\n node.setAttribute('data-container', params.containerId);\n // The value of a data attribute of an element, or ''\n const data = (el, name) => el?.getAttribute(`data-${name}`) ?? '';\n function stopWatching() {\n if (docMove) {\n document.removeEventListener('pointermove', docMove, true);\n docMove = null;\n }\n }\n function make() {\n if (cur.enabled === false)\n return null;\n return Sortable.create(node, {\n group: {\n name: cur.group,\n pull: true,\n put: (_to, _from, el) => (cur.accept ? cur.accept(data(el, 'kind'), data(el, 'id')) : true),\n },\n handle: cur.handle ?? undefined,\n filter: cur.filter,\n // A press on a filtered part (a button) stays a click\n preventOnFilter: false,\n draggable: '[data-sortable-item]',\n animation: 150,\n // The fallback drag behaves the same with a mouse and with touch, and keeps clicks\n forceFallback: true,\n // A smaller movement is a click, not a drag\n fallbackTolerance: 10,\n fallbackClass: 'sortfallback',\n // The classes of the item picked up, of the place it would drop and of the dragged copy\n ghostClass: 'sortghost',\n chosenClass: 'sortchosen',\n dragClass: 'sortdrag',\n scroll: true,\n scrollSensitivity: 40,\n scrollSpeed: 12,\n touchStartThreshold: 4,\n onMove(evt) {\n const dragged = evt.dragged;\n const related = evt.related;\n const hold = cur.onOver?.({\n dragId: data(dragged, 'id'),\n dragKind: data(dragged, 'kind'),\n overId: data(related, 'id'),\n overKind: data(related, 'kind'),\n });\n return hold !== true;\n },\n onStart(evt) {\n origParent = evt.from;\n origNext = evt.item.nextSibling;\n const dragId = data(evt.item, 'id');\n const dragKind = data(evt.item, 'kind');\n docMove = (e) => {\n const el = document.elementFromPoint?.(e.clientX, e.clientY);\n const over = el?.closest('[data-sortable-item]');\n const overId = data(over, 'id');\n const self = overId === dragId;\n cur.onOver?.({\n dragId,\n dragKind,\n overId: self ? '' : overId,\n overKind: self ? '' : data(over, 'kind'),\n });\n };\n document.addEventListener('pointermove', docMove, true);\n },\n onEnd(evt) {\n stopWatching();\n const item = evt.item;\n const oldIndex = evt.oldIndex ?? 0;\n const newIndex = evt.newIndex ?? 0;\n // Put the element back; the application's data decides the order\n if (origParent)\n origParent.insertBefore(item, origNext);\n origParent = null;\n origNext = null;\n cur.onOver?.(null);\n const from = data(evt.from, 'container');\n const to = data(evt.to, 'container');\n const itemId = data(item, 'id');\n if (!itemId || !from || !to)\n return;\n if (from === to && oldIndex === newIndex)\n return;\n cur.onDrop({ itemId, from, to, oldIndex, newIndex });\n },\n });\n }\n instance = make();\n return {\n update(p) {\n const remake = p.group !== cur.group ||\n p.handle !== cur.handle ||\n p.enabled !== cur.enabled ||\n p.containerId !== cur.containerId;\n cur = p;\n node.setAttribute('data-container', p.containerId);\n if (remake) {\n instance?.destroy();\n instance = make();\n }\n },\n destroy() {\n stopWatching();\n instance?.destroy();\n instance = null;\n },\n };\n}\n","<script lang=\"ts\">\n import '../styles/components.css';\n import type { Snippet } from 'svelte';\n\n // Markbox: the place of an icon. A square of an icon's size that centres what it holds (an\n // icon, an emoji, a color mark, a Swatch), so that the first column of a list stays in place\n // when the marks differ in size. It has no surface and no line, and it does not change the\n // height of a list item.\n //\n // <Markbox><Icon name=\"image\" /></Markbox> <Markbox glyph>🏔️</Markbox>\n let {\n glyph = false,\n children,\n }: {\n /** The content is an emoji; its font is --kata-glyph-font, set by the container */\n glyph?: boolean;\n children: Snippet;\n } = $props();\n</script>\n\n<span class=\"markbox\" class:glyph data-role=\"markbox\" data-h=\"icon\">{@render children()}</span>\n\n<style>.markbox {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: var(--kata-height-icon);\n height: var(--kata-height-icon);\n flex: none;\n}\n\n.glyph {\n font-family: var(--kata-glyph-font, inherit);\n}</style>\n","<script lang=\"ts\">\n import '../styles/components.css';\n import type { Snippet } from 'svelte';\n import { setContext } from 'svelte';\n import Stack from './Stack.svelte';\n\n // Tree: a list with depth. It stacks TreeRows and DropLines only; the rows touch, and the tree's\n // outline is the edges of its rows, so the distance to what is around it belongs to the Stack it\n // sits in. The depth of a row is its depth prop, so the elements inside a tree may be flat, or\n // nested in groups that a drag and drop reorders (see sortable); a group needs no distance of its\n // own.\n //\n // flat is for a tree where no row opens: the rows leave no room for the chevron, so their text\n // starts where the head of a SectionHeader does. A row takes its height from its content (the\n // content and pad-md above and below); rows raises the least height, so that rows with different\n // content in one tree are the same height: mark (a mark before the name), box (a control), thumb\n // (a thumbnail) or two (two lines).\n //\n // <Tree label=\"Contents\"><TreeRow …/><TreeRow depth={1} …/></Tree>\n let {\n label,\n flat = false,\n rows,\n children,\n }: {\n /** The name of the tree */\n label?: string;\n /** No row opens: no room for the chevron */\n flat?: boolean;\n /** The least height of every row */\n rows?: 'mark' | 'box' | 'thumb' | 'two';\n children: Snippet;\n } = $props();\n // The rows read whether the tree is flat\n setContext('kata-tree-flat', () => flat);\n</script>\n\n<div class=\"tree\" role=\"tree\" aria-label={label} data-role=\"list\" data-rows={rows}>\n <Stack gap={0}>{@render children()}</Stack>\n</div>\n\n<style>.tree {\n min-width: 0;\n flex: none;\n}\n.tree[data-rows=mark] {\n --kata-list-item-height: var(--kata-height-list-item-mark);\n}\n.tree[data-rows=box] {\n --kata-list-item-height: var(--kata-height-list-item-lg);\n}\n.tree[data-rows=thumb] {\n --kata-list-item-height: var(--kata-height-thumbnail-row);\n}\n.tree[data-rows=two] {\n --kata-list-item-height: var(--kata-height-list-item-two);\n}</style>\n","<script lang=\"ts\">\n import '../styles/components.css';\n import type { Snippet } from 'svelte';\n import type { HTMLAttributes } from 'svelte/elements';\n\n // ListItem: one entry of a list, a roster or a list of notifications. Its height comes from its\n // content: every visible thing in it (a mark, a picture, a control with a line or a surface,\n // stacked content) keeps md above and below, and the item grows to fit. The least height is the\n // ink of its text and md above and below; a list raises it with rows so that items holding\n // different things line up. The author declares no kind.\n //\n // The columns are a grid (columns, as grid-template-columns), gap-sm apart. pad-md at the sides,\n // or the inset its container declares; tail narrows the right side to pad-sm when the item ends\n // with an icon button, so that the icon's strokes line up with the edge of the text. It declares\n // the small button for the controls inside. The hover and selection surfaces, the line and the\n // area that is pressed all belong to this item.\n //\n // Items touch (no gap). rule draws a line under an item, between items only. An item that is\n // pressed takes onclick or href; one that is not takes plain.\n //\n // <ListItem columns=\"auto minmax(0, 1fr)\" onclick={open}><Icon name=\"image\" /><span>Photos</span></ListItem>\n // <ListItem columns=\"minmax(0, 1fr) auto\" tail plain><span>Name</span><Button …/></ListItem>\n let {\n columns,\n tail = false,\n sel = false,\n rule = false,\n plain = false,\n href,\n onclick,\n onkeydown,\n children,\n ...rest\n }: Omit<HTMLAttributes<HTMLElement>, 'class' | 'style' | 'onclick' | 'onkeydown'> & {\n /** The columns of the item's grid (grid-template-columns) */\n columns: string;\n /** The item ends with an icon button: pad-sm at the right */\n tail?: boolean;\n /** Selected: the raise surface and a blue line of two at the left */\n sel?: boolean;\n /** A line under the item (not under the last one) */\n rule?: boolean;\n /** An item that is not pressed: no hover surface */\n plain?: boolean;\n /** Renders a link */\n href?: string;\n /** Makes the item pressable (Enter and Space press it too) */\n onclick?: (e: MouseEvent) => void;\n onkeydown?: (e: KeyboardEvent) => void;\n children: Snippet;\n } = $props();\n\n const clickable = $derived(!plain && !!(onclick || href));\n function onKeyDown(e: KeyboardEvent) {\n onkeydown?.(e);\n if (e.defaultPrevented) return;\n if (e.key !== 'Enter' && e.key !== ' ') return;\n // The keys typed into a field inside the item stay the field's\n if ((e.target as HTMLElement).closest('input, textarea, select, [contenteditable]')) return;\n e.preventDefault();\n (e.currentTarget as HTMLElement).click();\n }\n</script>\n\n{#if href}\n <a\n class=\"row\"\n class:sel\n class:rule\n class:plain\n class:tail\n data-role=\"list-item\"\n data-h=\"list-item\"\n data-rule={rule ? '' : undefined}\n style:grid-template-columns={columns}\n {href}\n {onclick}\n {onkeydown}\n {...rest}\n >\n {@render children()}\n </a>\n{:else}\n <div\n class=\"row\"\n class:sel\n class:rule\n class:plain\n class:tail\n data-role=\"list-item\"\n data-h=\"list-item\"\n data-rule={rule ? '' : undefined}\n style:grid-template-columns={columns}\n {...clickable ? { role: 'button', tabindex: 0 } : {}}\n {onclick}\n onkeydown={clickable ? onKeyDown : onkeydown}\n {...rest}\n >\n {@render children()}\n </div>\n{/if}\n\n<style>.row {\n display: grid;\n align-items: center;\n gap: var(--kata-gap-sm);\n min-height: var(--kata-list-item-height, var(--kata-height-list-item));\n position: relative;\n padding-inline: var(--kata-inset, var(--kata-pad-md));\n min-width: 0;\n width: 100%;\n color: inherit;\n text-decoration: none;\n flex: none;\n cursor: default;\n font-size: var(--kata-text-size-body);\n line-height: var(--kata-text-leading-body);\n letter-spacing: var(--kata-text-tracking-body);\n --kata-box: var(--kata-height-button-sm);\n}\n.row :global([data-role='mark'][data-h]:not([data-h='icon'])),\n.row :global([data-role='mark'][data-kata-tall]),\n.row :global([data-role='box'][data-h]:not(.ghost)),\n.row :global(input:not([type='checkbox']):not([type='radio'])),\n.row :global(select),\n.row :global(textarea) {\n margin-block: var(--kata-text-size-body);\n}\n.row :global([data-role='stack']) {\n padding-block: var(--kata-text-size-body);\n}\n.row :global([data-role='stack'] [data-role='stack']) {\n padding-block: 0;\n}\n.row :global([data-role='stack'] [data-role='mark'][data-h]:not([data-h='icon'])),\n.row :global([data-role='stack'] [data-role='mark'][data-kata-tall]),\n.row :global([data-role='stack'] [data-role='box'][data-h]:not(.ghost)),\n.row :global([data-role='stack'] input:not([type='checkbox']):not([type='radio'])),\n.row :global([data-role='stack'] select),\n.row :global([data-role='stack'] textarea),\n.row :global([data-role='box'] input:not([type='checkbox']):not([type='radio'])),\n.row :global([data-role='box'] select),\n.row :global([data-role='box'] textarea) {\n margin-block: 0;\n}\n.row > :global(*) {\n min-width: 0;\n}\n.row > :global(:where(span, a, p):not([data-role]):not([data-h])) {\n text-box: trim-both cap alphabetic;\n padding-top: calc(var(--kata-ink-over) * 1em);\n padding-bottom: calc(var(--kata-ink-under) * 1em);\n white-space: nowrap;\n overflow: clip;\n overflow-clip-margin: 0.382em;\n text-overflow: ellipsis;\n min-width: 0;\n}\n.row:focus-visible {\n outline: 2px solid var(--kata-color-focus);\n outline-offset: -2px;\n}\n\n.tail {\n padding-inline-end: var(--kata-pad-sm);\n}\n\n.row[role=button],\na.row {\n cursor: pointer;\n}\n.row[role=button]:hover,\na.row:hover {\n background: var(--kata-color-raise);\n}\n\n.sel {\n background: var(--kata-color-raise);\n box-shadow: inset 2px 0 0 var(--kata-color-blue-ink);\n}\n\n.rule {\n border-bottom: var(--kata-border-width) solid var(--kata-color-line);\n}\n\n.rule:last-child {\n border-bottom: 0;\n}\n\n.plain,\n.plain:hover {\n cursor: default;\n background: transparent;\n}\n\n.sel.plain {\n background: var(--kata-color-raise);\n}</style>\n","<script lang=\"ts\">\n import '../styles/components.css';\n import type { Snippet } from 'svelte';\n import { getContext } from 'svelte';\n import type { HTMLAttributes } from 'svelte/elements';\n import { getMessages } from '../messages.js';\n import Icon from './Icon.svelte';\n import ListItem from './ListItem.svelte';\n\n // TreeRow: one row of a Tree, a ListItem indented by its depth: pad-md plus depth × pad-md on\n // the left. Its columns are fixed: the chevron, the name, the actions. The chevron's place (the\n // square of an icon button) is kept even when the row does not open, so nothing moves when a row\n // gains children; a flat Tree removes it. The chevron is a button of that square.\n //\n // The grip shows on hover and on focus, just left of the first thing the row shows (the chevron,\n // or the name), over the padding, so it takes no place. The actions on the right keep no place:\n // an action in a state other than its default (a hidden eye, a closed lock: data-keep on it)\n // always shows, the others only while the row is hovered or focused (data-open on the row keeps\n // them while a menu of the row is open).\n //\n // States: sel (selected: a double blue line on the left and the raise surface), hidden (the row\n // hides its content: dimmed), dimmed (a parent is hidden), dragging (the row is being dragged).\n // Attributes other than the props (data-id, data-kind, data-sortable-item for sortable) go to\n // the row. The right and left arrow keys open and close a row that has the focus.\n //\n // <TreeRow depth={1} expandable bind:expanded sel onclick={pick}>\n // Background\n // {#snippet end()}<Button variant=\"ghost\" icon aria-label=\"Hide\"><Icon name={Eye} /></Button>{/snippet}\n // </TreeRow>\n let {\n depth = 0,\n expandable = false,\n expanded = $bindable(false),\n ontoggle,\n grip = true,\n gripShow = false,\n sel = false,\n hidden = false,\n dimmed = false,\n dragging = false,\n onclick,\n children,\n end,\n ...rest\n }: Omit<HTMLAttributes<HTMLElement>, 'class' | 'style' | 'onclick' | 'ontoggle' | 'hidden'> & {\n /** The depth, from 0 */\n depth?: number;\n /** The row has children and shows the chevron */\n expandable?: boolean;\n /** The children show */\n expanded?: boolean;\n /** Called with the new state when the chevron is pressed */\n ontoggle?: (expanded: boolean) => void;\n /** Shows the grip (false in a tree that is not reordered) */\n grip?: boolean;\n /** Always shows the grip (screens without hover) */\n gripShow?: boolean;\n /** Selected */\n sel?: boolean;\n /** The row hides its content */\n hidden?: boolean;\n /** A parent is hidden */\n dimmed?: boolean;\n /** The row is being dragged */\n dragging?: boolean;\n /** Called when the row is pressed */\n onclick?: (e: MouseEvent) => void;\n /** The name, and a mark before it */\n children: Snippet;\n /** The actions on the right */\n end?: Snippet;\n } = $props();\n const flatTree = getContext<(() => boolean) | undefined>('kata-tree-flat');\n const noSeat = $derived(!!flatTree?.() && !expandable);\n\n function toggle() {\n expanded = !expanded;\n ontoggle?.(expanded);\n }\n // The arrow keys open and close the row (Enter and Space press it, as ListItem does)\n function onkeydown(e: KeyboardEvent) {\n const t = e.target as HTMLElement;\n if (t !== e.currentTarget && !t.classList.contains('chev')) return;\n if (!expandable) return;\n if ((e.key === 'ArrowRight' && !expanded) || (e.key === 'ArrowLeft' && expanded)) {\n e.preventDefault();\n toggle();\n }\n }\n const columns = $derived(\n [noSeat ? '' : 'auto', 'minmax(0, 1fr)', end ? 'auto' : ''].filter(Boolean).join(' '),\n );\n</script>\n\n<div\n class=\"tree-row\"\n class:hidden\n class:dimmed\n class:dragging\n data-dim={hidden || dimmed || dragging ? '' : undefined}\n style:--kata-tree-depth={depth}\n role=\"treeitem\"\n aria-selected={sel}\n aria-expanded={expandable ? expanded : undefined}\n aria-level={depth + 1}\n {...rest}\n>\n <ListItem {columns} {sel} tail={!!end} {onclick} {onkeydown}>\n {#if grip}\n <span class=\"grip\" class:beside={expandable || noSeat} class:show={gripShow} data-grip aria-hidden=\"true\"\n ><Icon name=\"grip-vertical\" /></span\n >\n {/if}\n {#if expandable}\n <button\n class=\"chev\"\n type=\"button\"\n data-h=\"icon-button\"\n tabindex={onclick ? -1 : 0}\n aria-label={expanded ? getMessages().collapse : getMessages().expand}\n onclick={(e) => {\n e.stopPropagation();\n toggle();\n }}\n >\n <Icon name={expanded ? 'chevron-down' : 'chevron-right'} />\n </button>\n {:else if !noSeat}\n <span class=\"seat\" aria-hidden=\"true\"></span>\n {/if}\n <span class=\"main\">{@render children()}</span>\n {#if end}\n <span class=\"end\">{@render end()}</span>\n {/if}\n </ListItem>\n</div>\n\n<style>.tree-row {\n min-width: 0;\n flex: none;\n}\n\n.tree-row > :global([data-role='list-item']) {\n padding-left: calc(var(--kata-pad-md) + var(--kata-tree-depth, 0) * var(--kata-pad-md));\n}\n\n.seat {\n width: var(--kata-height-icon-button);\n flex: none;\n}\n\n.grip {\n position: absolute;\n top: 50%;\n left: calc(var(--kata-pad-md) + var(--kata-tree-depth, 0) * var(--kata-pad-md) + var(--kata-height-icon-button) + var(--kata-pad-sm));\n translate: calc(-1 * (var(--kata-height-icon) + var(--kata-pad-2xs))) -50%;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: var(--kata-pad-md);\n height: var(--kata-height-icon-button);\n color: var(--kata-color-faint);\n cursor: grab;\n opacity: 0;\n transition: opacity 0.12s ease;\n}\n\n.grip.beside {\n left: calc(var(--kata-pad-md) + var(--kata-tree-depth, 0) * var(--kata-pad-md));\n}\n\n.tree-row:hover .grip,\n.tree-row:focus-within .grip,\n.grip.show {\n opacity: 1;\n}\n\n.chev {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: var(--kata-height-icon-button);\n height: var(--kata-height-icon-button);\n flex: none;\n border: 0;\n padding: 0;\n background: transparent;\n color: var(--kata-color-muted);\n cursor: pointer;\n}\n.chev:hover {\n background: var(--kata-color-raise-2);\n color: var(--kata-color-text);\n}\n.chev:focus-visible {\n outline: 2px solid var(--kata-color-focus);\n outline-offset: -2px;\n}\n\n.main {\n display: flex;\n align-items: center;\n gap: var(--kata-gap-sm);\n}\n\n.main > :global([data-role='stack']) {\n flex: 1 1 auto;\n min-width: 0;\n white-space: normal;\n}\n\n.end {\n display: flex;\n align-items: center;\n gap: 0;\n flex: none;\n}\n.end > :global(*:not([data-keep])) {\n opacity: 0;\n}\n\n.tree-row .end :global([data-role='mark'][data-h]) {\n margin-block: 0;\n}\n\n@container app (width < 24rem) {\n .end {\n position: absolute;\n right: var(--kata-pad-sm);\n top: 50%;\n transform: translateY(-50%);\n }\n}\n.tree-row:hover .end > :global(*),\n.tree-row:focus-within .end > :global(*),\n.tree-row[data-open] .end > :global(*) {\n opacity: 1;\n}\n\n.hidden,\n.dimmed,\n.dragging {\n opacity: var(--kata-opacity-dim);\n}\n\n:global(.sortghost) > .tree-row > :global([data-role='list-item']),\n.tree-row:global(.sortghost) > :global([data-role='list-item']) {\n background: var(--kata-color-raise-2);\n box-shadow: inset 0 0 0 calc(var(--kata-border-width) * 2) var(--kata-color-blue-ink);\n}\n\n:global(.sortchosen) > .tree-row > :global([data-role='list-item']),\n.tree-row:global(.sortchosen) > :global([data-role='list-item']) {\n background: var(--kata-color-raise-2);\n}</style>\n","<script lang=\"ts\" module>\n import type { IconSource } from '../icons.js';\n\n /** One node of a LayerTree. A node with children (an array, even empty) is a group. */\n export interface TreeNode {\n id: string;\n /** What the node is, in the application's words; the tree only passes it back */\n kind: string;\n name: string;\n /** The mark before the name */\n icon?: IconSource;\n /** The color of the mark (a CSS color) */\n iconColor?: string;\n visible: boolean;\n locked: boolean;\n children?: TreeNode[];\n /** The application's own fields */\n data?: unknown;\n }\n\n /** The keys held when a row was pressed: Shift (range) and ⌘ or Ctrl (toggle) */\n export interface TreeSelectModifiers {\n range: boolean;\n toggle: boolean;\n }\n\n /** A node dropped in a new place: its new parent (null for the root) and its index there */\n export interface TreeMove {\n id: string;\n parentId: string | null;\n index: number;\n }\n\n // Each tree drags within itself only\n let trees = 0;\n</script>\n\n<script lang=\"ts\">\n import '../styles/components.css';\n import type { Snippet } from 'svelte';\n import { tick } from 'svelte';\n import type { MenuModel } from '../lib/menuModel.js';\n import { getMessages } from '../messages.js';\n import { type SortableParams, type SortMove, type SortOver, sortable } from '../sortable.js';\n import Button from './Button.svelte';\n import Dropdown from './Dropdown.svelte';\n import Icon from './Icon.svelte';\n import InlineEdit from './InlineEdit.svelte';\n import Markbox from './Markbox.svelte';\n import MenuList from './MenuList.svelte';\n import SectionHeader from './SectionHeader.svelte';\n import Swatch from './Swatch.svelte';\n import Text from './Text.svelte';\n import Tree from './Tree.svelte';\n import TreeRow from './TreeRow.svelte';\n\n // LayerTree: the layers of a drawing and what they hold, as a tree: a Tree of TreeRows with a\n // head (a SectionHeader with the add menu). The nodes are data of one general shape (TreeNode);\n // the tree knows nothing of what a kind is. The application keeps the nodes, the selection and\n // the open groups, and applies what the tree reports.\n //\n // A row shows the node's mark and name, and on the right its actions, the eye and the lock (each\n // when its callback is given). row(node, name) draws the part before the actions for a kind of\n // its own, and renders name(node) where the name goes; actions(node) adds actions before the\n // eye. A press selects (Shift adds the range, ⌘ or Ctrl toggles), F2 or a double click renames in\n // place, and with onmove the rows are reordered by dragging: a node goes into any open group, but\n // a group keeps its depth unless allowNesting, so a group never enters another group.\n //\n // <LayerTree label=\"Layers\" {nodes} bind:selected bind:expanded\n // onvisible={show} onlock={lock} onrename={rename} onmove={move}\n // addMenu={[{ id: 'layer', label: 'Layer' }]} onadd={add} />\n let {\n nodes,\n label,\n head = true,\n selected = $bindable([]),\n onselect,\n expanded = $bindable([]),\n onexpand,\n onvisible,\n onlock,\n onrename,\n onmove,\n allowNesting = false,\n canDrop,\n gripOnly = false,\n addMenu,\n onadd,\n addLabel,\n row,\n actions,\n }: {\n /** The nodes at the root, in the order they show */\n nodes: TreeNode[];\n /** The name of the tree, and the title of its head */\n label: string;\n /** Shows the head (the title and the add menu) */\n head?: boolean;\n /** The ids of the selected nodes */\n selected?: string[];\n /** Called with the new selection and the keys held */\n onselect?: (ids: string[], modifiers: TreeSelectModifiers) => void;\n /** The ids of the open groups */\n expanded?: string[];\n /** Called when a group opens or closes */\n onexpand?: (id: string, open: boolean) => void;\n /** Shows the eye; called with the node's new visibility */\n onvisible?: (id: string, visible: boolean) => void;\n /** Shows the lock; called with the node's new state */\n onlock?: (id: string, locked: boolean) => void;\n /** Lets a name be changed in place; called with the new name */\n onrename?: (id: string, name: string) => void;\n /** Lets the rows be reordered by dragging; called after a drop */\n onmove?: (move: TreeMove) => void;\n /** A group may go into another group */\n allowNesting?: boolean;\n /** A rule of the application: whether a node may go into a parent (null for the root) */\n canDrop?: (node: TreeNode, parent: TreeNode | null) => boolean;\n /** Rows are picked up by their grip only, which always shows (screens without hover) */\n gripOnly?: boolean;\n /** The menu of the add button in the head */\n addMenu?: MenuModel[];\n /** Called with the id of the item of the add menu that was chosen */\n onadd?: (id: string) => void;\n /** The text of the add button (\"Add\" by default) */\n addLabel?: string;\n /** Draws the part of a row before its actions: the mark, name(node) and anything after it */\n row?: Snippet<[TreeNode, Snippet<[TreeNode]>]>;\n /** Actions of a row before the eye and the lock */\n actions?: Snippet<[TreeNode]>;\n } = $props();\n\n const group = `kata-layer-tree-${++trees}`;\n const ROOT = 'root';\n const zoneId = (parent: TreeNode | null) => (parent ? `node:${parent.id}` : ROOT);\n\n // Where each node is: the node, its parent and its depth\n const index = $derived.by(() => {\n const map = new Map<string, { node: TreeNode; parent: TreeNode | null; depth: number }>();\n const walk = (list: TreeNode[], parent: TreeNode | null, depth: number) => {\n for (const node of list) {\n map.set(node.id, { node, parent, depth });\n if (node.children) walk(node.children, node, depth + 1);\n }\n };\n walk(nodes, null, 0);\n return map;\n });\n const openSet = $derived(new Set(expanded));\n const selSet = $derived(new Set(selected));\n // The ids of the rows that show, in order\n const shown = $derived.by(() => {\n const ids: string[] = [];\n const walk = (list: TreeNode[]) => {\n for (const node of list) {\n ids.push(node.id);\n if (node.children && openSet.has(node.id)) walk(node.children);\n }\n };\n walk(nodes);\n return ids;\n });\n const hasEnd = $derived(!!(onvisible || onlock || actions));\n\n let root = $state<HTMLElement>();\n\n function setOpen(id: string, open: boolean) {\n if (open === openSet.has(id)) return;\n expanded = open ? [...expanded, id] : expanded.filter((x) => x !== id);\n onexpand?.(id, open);\n }\n\n // ---- Selection ----\n // The node a range starts from: the last one pressed without Shift\n let anchor: string | null = null;\n\n function pick(node: TreeNode, e?: MouseEvent) {\n const modifiers = { range: !!e?.shiftKey, toggle: !!(e?.metaKey || e?.ctrlKey) };\n let ids: string[];\n const from = anchor ? shown.indexOf(anchor) : -1;\n const to = shown.indexOf(node.id);\n if (modifiers.range && from !== -1 && to !== -1) {\n ids = shown.slice(Math.min(from, to), Math.max(from, to) + 1);\n } else if (modifiers.toggle) {\n ids = selSet.has(node.id) ? selected.filter((x) => x !== node.id) : [...selected, node.id];\n anchor = node.id;\n } else {\n ids = [node.id];\n anchor = node.id;\n }\n selected = ids;\n onselect?.(ids, modifiers);\n }\n\n // ---- Renaming ----\n let renaming = $state<string | null>(null);\n\n function startRename(id: string) {\n if (onrename) renaming = id;\n }\n function endRename(id: string) {\n if (renaming !== id) return;\n renaming = null;\n // The focus returns to the row, unless it went somewhere else\n void tick().then(() => {\n if (document.activeElement && document.activeElement !== document.body) return;\n rowOf(id)?.focus();\n });\n }\n // ---- Keys ----\n function rows(): HTMLElement[] {\n if (!root) return [];\n return [...root.querySelectorAll<HTMLElement>('[role=\"treeitem\"] > [data-role=\"list-item\"]')];\n }\n function rowOf(id: string): HTMLElement | undefined {\n return root?.querySelector<HTMLElement>(\n `[role=\"treeitem\"][data-node=\"${CSS.escape(id)}\"] > [data-role=\"list-item\"]`,\n ) ?? undefined;\n }\n\n // The up and down arrows, Home and End move between the rows; the right arrow goes into an open\n // group and the left one out to the parent (a row that opens or closes handles them first); F2\n // renames. Enter and Space press the row (ListItem).\n function onkeydown(e: KeyboardEvent) {\n const target = e.target as HTMLElement;\n if (!target.matches('[role=\"treeitem\"] > [data-role=\"list-item\"]')) return;\n const id = target.parentElement?.getAttribute('data-node');\n const at = id ? index.get(id) : undefined;\n if (!at || e.defaultPrevented) return;\n const list = rows();\n const i = list.indexOf(target);\n const go = (el: HTMLElement | undefined) => {\n e.preventDefault();\n el?.focus();\n };\n if (e.key === 'ArrowDown') go(list[i + 1]);\n else if (e.key === 'ArrowUp') go(list[i - 1]);\n else if (e.key === 'Home') go(list[0]);\n else if (e.key === 'End') go(list[list.length - 1]);\n else if (e.key === 'ArrowRight' && at.node.children?.length && openSet.has(at.node.id))\n go(list[i + 1]);\n else if (e.key === 'ArrowLeft' && at.parent) go(rowOf(at.parent.id));\n else if (e.key === 'F2' && onrename) {\n e.preventDefault();\n startRename(at.node.id);\n }\n }\n function keys(node: HTMLElement) {\n node.addEventListener('keydown', onkeydown);\n return { destroy: () => node.removeEventListener('keydown', onkeydown) };\n }\n\n // ---- Dragging ----\n // Whether a node may go into a parent: never into itself or below it; a group keeps its depth\n // unless allowNesting; then the application's rule\n function allowed(id: string, parent: TreeNode | null): boolean {\n const at = index.get(id);\n if (!at) return false;\n for (let p = parent; p; p = index.get(p.id)?.parent ?? null) if (p.id === id) return false;\n if (!allowNesting && at.node.children) {\n const depth = parent ? (index.get(parent.id)?.depth ?? 0) + 1 : 0;\n if (depth !== at.depth) return false;\n }\n return canDrop ? canDrop(at.node, parent) : true;\n }\n\n function drop(m: SortMove) {\n const parentId = m.to === ROOT ? null : m.to.slice('node:'.length);\n const parent = parentId ? (index.get(parentId)?.node ?? null) : null;\n if (!allowed(m.itemId, parent)) return;\n onmove?.({ id: m.itemId, parentId, index: m.newIndex });\n }\n\n // A closed group that the dragged node may enter opens after a moment under the pointer\n let springId: string | null = null;\n let springTimer = 0;\n function clearSpring() {\n if (springTimer) clearTimeout(springTimer);\n springTimer = 0;\n springId = null;\n }\n function over(info: SortOver | null): boolean {\n const target = info ? index.get(info.overId)?.node : undefined;\n if (!info || !target?.children || openSet.has(target.id) || !allowed(info.dragId, target)) {\n clearSpring();\n return false;\n }\n if (springId !== target.id) {\n clearSpring();\n springId = target.id;\n springTimer = window.setTimeout(() => {\n if (springId) setOpen(springId, true);\n clearSpring();\n }, 550);\n }\n return true;\n }\n\n function zone(parent: TreeNode | null): SortableParams {\n return {\n group,\n containerId: zoneId(parent),\n handle: gripOnly ? '[data-grip]' : null,\n filter: 'button, input, textarea',\n accept: (_kind, id) => allowed(id, parent),\n enabled: !!onmove,\n onDrop: drop,\n onOver: over,\n };\n }\n\n function rowProps(node: TreeNode, depth: number, parentHidden: boolean) {\n return {\n depth,\n expandable: !!node.children,\n expanded: openSet.has(node.id),\n ontoggle: (open: boolean) => setOpen(node.id, open),\n grip: !!onmove,\n gripShow: gripOnly && !!onmove,\n hidden: !node.visible,\n dimmed: parentHidden,\n sel: selSet.has(node.id),\n onclick: (e: MouseEvent) => pick(node, e),\n ondblclick: (e: MouseEvent) => {\n if (!(e.target as HTMLElement).closest('button')) startRename(node.id);\n },\n 'data-node': node.id,\n };\n }\n</script>\n\n{#snippet name(node: TreeNode)}\n {#if renaming === node.id}\n <span class=\"rename\">\n <InlineEdit\n value={node.name}\n placeholder={getMessages().rename}\n bind:editing={() => true, (v) => !v && endRename(node.id)}\n onCommit={(v) => onrename?.(node.id, v)}\n />\n </span>\n {:else}\n <Text clamp>{node.name}</Text>\n {/if}\n{/snippet}\n\n{#snippet mark(node: TreeNode)}\n {#if node.icon}\n <Markbox>\n {#if node.iconColor}\n <Swatch shape=\"icon\" icon={node.icon} color={node.iconColor} />\n {:else}\n <Icon name={node.icon} />\n {/if}\n </Markbox>\n {/if}\n{/snippet}\n\n{#snippet body(node: TreeNode)}\n {#if row}\n {@render row(node, name)}\n {:else}\n {@render mark(node)}\n {@render name(node)}\n {/if}\n{/snippet}\n\n{#snippet tools(node: TreeNode)}\n {@render actions?.(node)}\n {#if onvisible}\n <Button\n variant=\"ghost\"\n icon\n aria-label={node.visible ? getMessages().hide : getMessages().show}\n data-keep={node.visible ? undefined : ''}\n onclick={(e: MouseEvent) => {\n e.stopPropagation();\n onvisible?.(node.id, !node.visible);\n }}><Icon name={node.visible ? 'eye' : 'eye-off'} /></Button\n >\n {/if}\n {#if onlock}\n <Button\n variant=\"ghost\"\n icon\n aria-label={node.locked ? getMessages().unlock : getMessages().lock}\n data-keep={node.locked ? '' : undefined}\n onclick={(e: MouseEvent) => {\n e.stopPropagation();\n onlock?.(node.id, !node.locked);\n }}><Icon name={node.locked ? 'lock' : 'lock-open'} /></Button\n >\n {/if}\n{/snippet}\n\n{#snippet item(node: TreeNode, depth: number, parentHidden: boolean)}\n <div class=\"item\" role=\"none\" data-sortable-item data-id={node.id} data-kind={node.kind}>\n {#if hasEnd}\n <TreeRow {...rowProps(node, depth, parentHidden)}>\n {@render body(node)}\n {#snippet end()}{@render tools(node)}{/snippet}\n </TreeRow>\n {:else}\n <TreeRow {...rowProps(node, depth, parentHidden)}>{@render body(node)}</TreeRow>\n {/if}\n {#if node.children && openSet.has(node.id)}\n <div class=\"zone\" role=\"group\" aria-label={node.name} use:sortable={zone(node)}>\n {#each node.children as child (child.id)}\n {@render item(child, depth + 1, parentHidden || !node.visible)}\n {/each}\n </div>\n {/if}\n </div>\n{/snippet}\n\n{#snippet add()}\n <Dropdown menu align=\"end\" role=\"box\">\n {#snippet trigger(toggle, open)}\n <Button leading=\"plus\" aria-haspopup=\"menu\" aria-expanded={open} onclick={toggle}\n >{addLabel ?? getMessages().add}</Button\n >\n {/snippet}\n {#snippet panel(close)}\n <MenuList items={addMenu ?? []} onselect={onadd} onclose={close} />\n {/snippet}\n </Dropdown>\n{/snippet}\n\n{#snippet tree()}\n <Tree {label}>\n <div class=\"zone\" role=\"none\" use:sortable={zone(null)}>\n {#each nodes as node (node.id)}\n {@render item(node, 0, false)}\n {/each}\n </div>\n </Tree>\n{/snippet}\n\n<div class=\"layer-tree\" bind:this={root} use:keys>\n {#if head}\n <SectionHeader {label} flush actions={addMenu ? add : undefined}>{@render tree()}</SectionHeader>\n {:else}\n {@render tree()}\n {/if}\n</div>\n\n<style>.layer-tree,\n.item,\n.zone {\n display: flex;\n flex-direction: column;\n min-width: 0;\n flex: none;\n}\n\n.rename {\n display: flex;\n flex: 1 1 auto;\n min-width: 0;\n}</style>\n","<script lang=\"ts\">\n import '../styles/components.css';\n import type { Snippet } from 'svelte';\n import Stack from './Stack.svelte';\n\n // List: a column of list items and nothing else. The items touch; the list's outline runs from\n // the top of the first item to the bottom of the last, and the distance to what is outside is\n // the gap of the layout around it. A switch, a checkbox or a radio is not a list item and goes\n // in a Stack.\n //\n // An item's height comes from its content. When a list mixes items that hold different things\n // and they must line up, rows raises the least height: mark (a mark), box (a control with an\n // outline), thumb (a thumbnail) or two (a title and a caption).\n //\n // <List label=\"Documents\">{#each docs as d (d.id)}<ListItem …>…</ListItem>{/each}</List>\n let {\n label,\n role = 'list',\n rows,\n children,\n }: {\n /** The name of the list */\n label?: string;\n /** The role when the list has a name: group when its items are choices (icons, suggestions) */\n role?: 'list' | 'group';\n /** The least height of the items, named after what they hold */\n rows?: 'mark' | 'box' | 'thumb' | 'two';\n children: Snippet;\n } = $props();\n</script>\n\n<div\n class=\"list\"\n role={label ? role : undefined}\n aria-label={label}\n data-role=\"list\"\n data-rows={rows}\n>\n <Stack gap={0}>{@render children()}</Stack>\n</div>\n\n<style>.list {\n min-width: 0;\n}\n.list[data-rows=mark] {\n --kata-list-item-height: var(--kata-height-list-item-mark);\n}\n.list[data-rows=box] {\n --kata-list-item-height: var(--kata-height-list-item-lg);\n}\n.list[data-rows=thumb] {\n --kata-list-item-height: var(--kata-height-thumbnail-row);\n}\n.list[data-rows=two] {\n --kata-list-item-height: var(--kata-height-list-item-two);\n}</style>\n","<script lang=\"ts\">\n import '../styles/components.css';\n import type { Snippet } from 'svelte';\n import { getMessages } from '../messages.js';\n\n // Sheet: a panel that comes up from the bottom of a narrow screen, with a strong line along its\n // top. It has three heights: peek (the handle and the head), half and full. A press on the handle\n // steps up through them (from the highest it returns to the lowest), the arrow keys step up and\n // down, and a drag snaps to the nearest height on release. stages offers fewer heights.\n //\n // The order inside is fixed: the handle, the head, the content and the foot. Only the content\n // shrinks and scrolls. It has no padding. When the content is a panel with a head of its own,\n // pane gives it the full height and the panel's head becomes the sheet's head.\n //\n // It is placed absolutely at the bottom of its frame, which must be a positioned element. inline\n // draws it in the flow instead, for documentation.\n //\n // <Sheet bind:stage label=\"Details\">\n // {#snippet head()}…{/snippet}\n // <Stack gap=\"md\">…</Stack>\n // </Sheet>\n type Stage = 'peek' | 'half' | 'full';\n let {\n stage = $bindable('half'),\n stages = ['peek', 'half', 'full'],\n onstage,\n name,\n z,\n closable = false,\n onclose,\n pane = false,\n inline = false,\n label,\n head,\n foot,\n children,\n }: {\n /** The height: peek (the head only), half or full */\n stage?: Stage;\n /** The heights offered, lowest first */\n stages?: Stage[];\n /** Called when the height changes */\n onstage?: (stage: Stage) => void;\n /** Tells several sheets apart (data-sheet) */\n name?: string;\n /** The stacking order; the sheet layer by default */\n z?: number;\n /** A drag below the lowest height, or ArrowDown there, closes it */\n closable?: boolean;\n onclose?: () => void;\n /** The content is a panel with its own head and scrolling */\n pane?: boolean;\n /** In the flow of a page, for documentation */\n inline?: boolean;\n /** The accessible name of the sheet */\n label?: string;\n /** The head; it does not shrink */\n head?: Snippet;\n /** The foot, for a primary action */\n foot?: Snippet;\n /** The content; it scrolls */\n children: Snippet;\n } = $props();\n\n // The share of the frame's height of each stage. peek takes the height of its content; its value\n // only guides where a drag snaps.\n const FRAC: Record<Stage, number> = { peek: 0.14, half: 0.5, full: 1 };\n // The least height while dragging, in px\n const MIN_DRAG = 48;\n\n let el = $state<HTMLElement>();\n // The height in px while dragging; back to a stage on release\n let dragH = $state<number | null>(null);\n let dragging = $state(false);\n let startY = 0;\n let startH = 0;\n let parentH = 0;\n\n const index = $derived(Math.max(0, stages.indexOf(stage)));\n\n function go(next: Stage) {\n if (next === stage) return;\n stage = next;\n onstage?.(next);\n }\n\n function cycle() {\n if (dragging) return;\n go(stages[index >= stages.length - 1 ? 0 : index + 1]);\n }\n\n function down(e: PointerEvent) {\n if (!el) return;\n parentH = el.parentElement?.clientHeight ?? window.innerHeight;\n startY = e.clientY;\n // Start from the height at the moment of the grab; peek is not a share of the frame\n startH = el.getBoundingClientRect().height;\n dragH = startH;\n dragging = true;\n (e.currentTarget as HTMLElement).setPointerCapture?.(e.pointerId);\n }\n function move(e: PointerEvent) {\n if (!dragging) return;\n const h = startH + (startY - e.clientY);\n dragH = Math.max(MIN_DRAG, Math.min(parentH * 0.94, h));\n }\n function up() {\n if (!dragging) return;\n dragging = false;\n const frac = (dragH ?? 0) / (parentH || 1);\n dragH = null;\n if (closable && frac < FRAC[stages[0]] * 0.55) {\n onclose?.();\n return;\n }\n let best = stages[0];\n let bestD = Number.POSITIVE_INFINITY;\n for (const s of stages) {\n const d = Math.abs(FRAC[s] - frac);\n if (d < bestD) {\n bestD = d;\n best = s;\n }\n }\n go(best);\n }\n function onkeydown(e: KeyboardEvent) {\n if (e.key === 'ArrowUp') {\n e.preventDefault();\n go(stages[Math.min(stages.length - 1, index + 1)]);\n } else if (e.key === 'ArrowDown') {\n e.preventDefault();\n if (index === 0 && closable) onclose?.();\n else go(stages[Math.max(0, index - 1)]);\n }\n }\n</script>\n\n<aside\n class=\"sheet\"\n class:dragging\n data-stage={stage}\n data-inline={inline ? '' : undefined}\n data-sheet={name}\n aria-label={label}\n data-role=\"panel\"\n bind:this={el}\n style:z-index={z}\n style:height={dragH !== null ? `${dragH}px` : undefined}\n>\n <!-- The handle: a short bar that steps through the heights and can be dragged -->\n <button\n class=\"handle\"\n type=\"button\"\n aria-label={getMessages().sheetHeight}\n onclick={cycle}\n onpointerdown={down}\n onpointermove={move}\n onpointerup={up}\n onpointercancel={up}\n {onkeydown}\n ></button>\n {@render head?.()}\n <div class=\"scroll\" class:pane>{@render children()}</div>\n {@render foot?.()}\n</aside>\n\n<style>.sheet {\n position: absolute;\n left: 0;\n right: 0;\n bottom: 0;\n display: flex;\n flex-direction: column;\n min-width: 0;\n max-height: 100%;\n background: var(--kata-color-panel);\n color: var(--kata-color-text);\n border-top: var(--kata-border-width) solid var(--kata-color-line-strong);\n z-index: var(--kata-z-sheet);\n transition: height 0.24s cubic-bezier(0.2, 0.8, 0.2, 1);\n --kata-box: var(--kata-height-button);\n}\n.sheet > :global(*) {\n flex: none;\n}\n.sheet > .scroll {\n flex: 1 1 auto;\n}\n\naside.sheet[data-inline] {\n position: static;\n flex: none;\n}\n\n.sheet.dragging {\n transition: none;\n}\n\n.sheet[data-stage=peek] > .scroll:not(.pane) {\n display: none;\n}\n\n.sheet[data-stage=peek] > .scroll.pane :global(.scroll) {\n display: none;\n}\n\n.sheet[data-stage=half] {\n height: 50%;\n}\n\n.sheet[data-stage=full] {\n height: 100%;\n}\n\n.scroll {\n padding: 0;\n --kata-inset: var(--kata-pad-md);\n --kata-at-start: 0;\n --kata-at-end: 0;\n min-height: 0;\n min-width: 0;\n overflow: auto;\n}\n\n.scroll.pane {\n overflow: hidden;\n display: flex;\n}\n.scroll.pane > :global(*) {\n flex: 1 1 auto;\n width: 100%;\n max-width: none;\n min-height: 0;\n}\n\n.handle {\n height: var(--kata-gap-md);\n display: flex;\n align-items: center;\n justify-content: center;\n flex: none;\n border: 0;\n padding: 0;\n background: transparent;\n cursor: grab;\n touch-action: none;\n}\n.handle:active {\n cursor: grabbing;\n}\n.handle::before {\n content: \"\";\n width: calc(var(--kata-gap-md) * 2);\n height: calc(var(--kata-border-width) * 2);\n background: var(--kata-color-line-strong);\n}</style>\n","<script lang=\"ts\">\n import '../styles/components.css';\n\n // Progress: the progress of a task, a bar gap-2xs high. With a value the fill grows from the\n // left; without one (indeterminate) a block runs across. A sentence such as \"Importing 3 of 8\n // files\" goes above it, in a Stack. How much of a limit is used is a Meter.\n //\n // <Progress value={38} /> <Progress label=\"Uploading\" />\n let {\n value,\n max = 100,\n label,\n }: {\n /** The amount done; without it the bar is indeterminate */\n value?: number;\n max?: number;\n /** The accessible name of the bar */\n label?: string;\n } = $props();\n\n const indet = $derived(value === undefined);\n const pct = $derived(\n indet || max <= 0 ? 0 : Math.max(0, Math.min(100, ((value ?? 0) / max) * 100)),\n );\n</script>\n\n<div\n class=\"progress\"\n data-role=\"progress\"\n class:indet\n role=\"progressbar\"\n aria-label={label}\n aria-valuemin={0}\n aria-valuemax={max}\n aria-valuenow={value}\n>\n <div class=\"fill\" style:width={indet ? undefined : `${pct}%`}></div>\n</div>\n\n<style>.progress {\n position: relative;\n height: var(--kata-gap-2xs);\n background: var(--kata-color-line);\n overflow: hidden;\n min-width: 0;\n flex: none;\n}\n\n.fill {\n position: absolute;\n left: 0;\n top: 0;\n height: 100%;\n background: var(--kata-color-solid);\n}\n\n.indet .fill {\n width: 30%;\n left: 35%;\n animation: flow 1.6s ease-in-out infinite;\n}\n\n@keyframes flow {\n 0% {\n transform: translateX(-135%);\n }\n 100% {\n transform: translateX(135%);\n }\n}\n@media (prefers-reduced-motion: reduce) {\n .indet .fill {\n animation: none;\n }\n}</style>\n","<script lang=\"ts\">\n import '../styles/components.css';\n import type { Snippet } from 'svelte';\n import { getMessages } from '../messages.js';\n import Banner from './Banner.svelte';\n import Button from './Button.svelte';\n import Modal from './Modal.svelte';\n import Progress from './Progress.svelte';\n import Spinner from './Spinner.svelte';\n import Stack from './Stack.svelte';\n import Text from './Text.svelte';\n\n // ProcessDialog: the frame of a dialog that runs a process on what the application passes in (a\n // conversion, an export, an operation on a selection). It is a Modal whose body reads in a fixed\n // order: the error, the description, then the fields (children), gap-lg apart. The Footer holds\n // cancel and the run action, the primary one.\n //\n // While running, the body shows what is happening instead: a Spinner with the running text and a\n // Progress (with progress, how far it is; without, a block that runs across). The run action is\n // busy. Cancel, the close button and Escape call oncancel whenever they close the dialog, also\n // while running; when the application closes it (open = false after the run) oncancel is not\n // called.\n //\n // <ProcessDialog bind:open title=\"Simplify\" description=\"Removes points that change little.\"\n // runLabel=\"Simplify\" {running} onrun={simplify} oncancel={abort}>\n // <Field label=\"Tolerance\" for=\"tol\">…</Field>\n // </ProcessDialog>\n let {\n open = $bindable(false),\n title,\n description,\n error,\n runLabel,\n runningText,\n running = false,\n progress,\n disabled = false,\n onrun,\n oncancel,\n size = 'md',\n inline = false,\n children,\n }: {\n open?: boolean;\n title: string;\n /** What the process does, in a sentence or two, above the fields */\n description?: string;\n /** Why the last run failed, in a red notice at the top */\n error?: string;\n /** The run action; the run message by default */\n runLabel?: string;\n /** What shows while running; the running message by default */\n runningText?: string;\n /** The process runs: the body shows the progress and the run action is busy */\n running?: boolean;\n /** How far the process is, 0 to 100; without it the progress is indeterminate */\n progress?: number;\n /** The run action cannot be pressed (a field is missing) */\n disabled?: boolean;\n /** Called when the run action is pressed */\n onrun?: () => void;\n /** Called when the user closes the dialog without running it, or stops a run */\n oncancel?: () => void;\n /** The width, as Modal's size */\n size?: 'sm' | 'md' | 'lg' | 'xl';\n /** The same surface in the flow of a page, for documentation */\n inline?: boolean;\n /** The fields of the process */\n children?: Snippet;\n } = $props();\n\n const words = $derived(getMessages());\n\n function cancel() {\n open = false;\n oncancel?.();\n }\n // Every way of closing ends here; it is a cancel unless the application closed the dialog\n function onclose() {\n if (open) cancel();\n }\n</script>\n\n{#snippet cancelAction()}<Button onclick={cancel}>{words.cancel}</Button>{/snippet}\n{#snippet runAction()}\n <Button variant=\"primary\" busy={running} {disabled} onclick={() => onrun?.()}>\n {runLabel ?? words.run}\n </Button>\n{/snippet}\n\n<Modal {open} {title} {size} {inline} {onclose} cancel={cancelAction} primary={runAction}>\n {#if running}\n <Stack gap=\"sm\">\n <div aria-live=\"polite\"><Spinner label={runningText ?? words.running} /></div>\n <Progress value={progress} label={runningText ?? words.running} />\n </Stack>\n {:else}\n {#if error}<Banner tone=\"error\">{error}</Banner>{/if}\n {#if description}<Text>{description}</Text>{/if}\n {#if children}<Stack gap=\"lg\">{@render children()}</Stack>{/if}\n {/if}\n</Modal>\n","<script lang=\"ts\">\n import '../styles/components.css';\n import type { Snippet } from 'svelte';\n import Stack from './Stack.svelte';\n\n // Section: a titled part of a page (settings, forms). The head is the title (h2) with an optional\n // status on the right (saving, saved), gap-xs, then an optional note that applies to the whole\n // section. gap-lg separates the head from the content; it is never smaller than the gaps inside\n // the content. The content's children are gap apart (lg between fields, md for text and lists).\n //\n // The status is the only thing on the right of the title. Actions that create something go in a\n // Row at the start of the content, and a count goes in a caption at its end.\n //\n // Sections own the breaks between them, so they are stacked with gap 0: each has gap-lg below\n // (0 for the last one), and each one after the first draws a line above with pad-lg under it.\n // A section whose content ends with a List or a Tree is flush: the last item's lower padding is\n // part of the distance, so the section keeps only the rest (gap-sm).\n //\n // <Stack gap={0}>\n // <Section title=\"General\" status=\"Saved\">…</Section>\n // <Section title=\"Members\" gap=\"md\" flush>…</Section>\n // </Stack>\n type Gap = 0 | 'sm' | 'md' | 'lg';\n let {\n title,\n note,\n status,\n gap = 'lg',\n flush = false,\n children,\n }: {\n title: string;\n /** One sentence that applies to the whole section, under the title */\n note?: string;\n /** A short status on the right of the title */\n status?: string;\n /** The content ends with a List or a Tree */\n flush?: boolean;\n /** The distance between the content's children (default lg) */\n gap?: Gap;\n children: Snippet;\n } = $props();\n</script>\n\n<section class=\"kata-section\" class:flush data-role=\"section\">\n <Stack gap=\"lg\">\n <Stack gap=\"xs\">\n <div class=\"head\" data-role=\"row-inline\">\n <h2 class=\"title\">{title}</h2>\n {#if status}<span class=\"status\">{status}</span>{/if}\n </div>\n {#if note}<p class=\"note\" data-role=\"caption\">{note}</p>{/if}\n </Stack>\n <div class=\"body\" data-pass>\n <Stack {gap}>{@render children()}</Stack>\n </div>\n </Stack>\n</section>\n\n<style>.kata-section {\n display: flex;\n flex-direction: column;\n min-width: 0;\n padding-bottom: var(--kata-gap-lg); /* kata-allow-gap-padding */\n --kata-box: var(--kata-height-button);\n}\n\n.kata-section.flush {\n padding-bottom: var(--kata-gap-sm); /* kata-allow-gap-padding */\n}\n\n.kata-section:last-child {\n padding-bottom: 0;\n}\n\n.kata-section:not(:first-child) {\n padding-top: var(--kata-pad-lg);\n}\n\n.kata-section + :global(.kata-section) {\n border-top: var(--kata-border-width) solid var(--kata-color-line);\n}\n\n.title {\n font-size: var(--kata-text-size-h2);\n line-height: var(--kata-text-leading-h2);\n letter-spacing: var(--kata-text-tracking-h2);\n font-weight: 600;\n text-box: trim-start cap alphabetic;\n padding-top: var(--kata-edge-top);\n margin: 0;\n min-width: 0;\n}\n\n.body {\n min-width: 0;\n --kata-inset: 0px;\n --kata-at-start: 1;\n --kata-at-end: 1;\n}\n\n.head {\n display: flex;\n align-items: center;\n justify-content: space-between;\n flex-wrap: wrap;\n gap: var(--kata-gap-sm);\n min-width: 0;\n}\n\n.status {\n font-size: var(--kata-text-size-caption);\n line-height: var(--kata-text-leading-caption);\n letter-spacing: var(--kata-text-tracking-caption);\n color: var(--kata-color-muted);\n}\n\n.note {\n font-size: var(--kata-text-size-caption);\n line-height: var(--kata-text-leading-caption);\n letter-spacing: var(--kata-text-tracking-caption);\n color: var(--kata-color-muted);\n margin: 0;\n min-width: 0;\n}</style>\n","<script lang=\"ts\">\n import '../styles/components.css';\n import type { IconSource } from '../icons.js';\n import Icon from './Icon.svelte';\n\n // Stat: a figure (num) with its name (caption) below it. Neither text is trimmed, so the two sit\n // with no gap: the line heights are the distance. Figures have equal widths. Stats sets several\n // side by side.\n //\n // <Stat label=\"Documents\" value=\"128\" />\n let {\n label,\n value,\n icon,\n }: {\n /** The name */\n label: string;\n /** The figure, with its unit written by the application */\n value: string;\n /** An icon before the name, when an icon says what kind of figure it is */\n icon?: IconSource;\n } = $props();\n</script>\n\n<div class=\"stat\" data-role=\"stat\">\n <span class=\"v\">{value}</span>\n <span class=\"k\">{#if icon}<Icon name={icon} />{/if}<span class=\"t\">{label}</span></span>\n</div>\n\n<style>.stat {\n display: flex;\n flex-direction: column;\n min-width: 0;\n}\n\n.v {\n font-size: var(--kata-text-size-num);\n line-height: var(--kata-text-leading-num);\n letter-spacing: var(--kata-text-tracking-num);\n font-weight: 600;\n font-variant-numeric: tabular-nums;\n font-variant-numeric: tabular-nums;\n}\n\n.k {\n display: flex;\n align-items: center;\n gap: var(--kata-gap-2xs);\n min-width: 0;\n font-size: var(--kata-text-size-caption);\n line-height: var(--kata-text-leading-caption);\n letter-spacing: var(--kata-text-tracking-caption);\n color: var(--kata-color-muted);\n}\n\n.k > :global(svg) {\n flex: none;\n}\n\n.t {\n display: block;\n min-width: 0;\n white-space: nowrap;\n overflow: clip;\n overflow-clip-margin: 0.382em;\n text-overflow: ellipsis;\n min-width: 0;\n}</style>\n","<script lang=\"ts\">\n import '../styles/components.css';\n import type { Snippet } from 'svelte';\n\n // Stats: Stat side by side, gap-lg apart. When they do not fit (a narrow width, a large text\n // size) they wrap, gap-sm between the lines. It holds Stat only.\n //\n // <Stats><Stat label=\"Documents\" value=\"128\" /><Stat label=\"Storage\" value=\"1.2 GB\" /></Stats>\n let { children }: { children: Snippet } = $props();\n</script>\n\n<div class=\"stats\" data-role=\"stat\">{@render children()}</div>\n\n<style>.stats {\n display: flex;\n flex-wrap: wrap;\n gap: var(--kata-gap-sm) var(--kata-gap-lg);\n min-width: 0;\n}</style>\n","<script lang=\"ts\">\n import '../styles/components.css';\n import type { Snippet } from 'svelte';\n import { getMessages } from '../messages.js';\n import Block from './Block.svelte';\n import Button from './Button.svelte';\n import Icon from './Icon.svelte';\n import Panel from './Panel.svelte';\n import Stack from './Stack.svelte';\n import Stat from './Stat.svelte';\n import Stats from './Stats.svelte';\n import Toolbar from './Toolbar.svelte';\n\n // SelectionSummary: the panel of a selection of several things. The head is a Toolbar with the\n // number selected (the messages API writes it, or title), the actions of end and a close button\n // with onclose. The content is, in order: the count of each kind as Stats in a Block, the fields\n // that edit what the things share (a snippet, usually SectionHeader groups), and the actions on\n // the whole selection in a Block. The panel knows nothing of the kinds; the application counts\n // them and names them.\n //\n // <SelectionSummary count={5} kinds={[{ label: 'Shapes', count: 3 }, { label: 'Notes', count: 2 }]}>\n // {#snippet fields()}<SectionHeader label=\"Color\">…</SectionHeader>{/snippet}\n // {#snippet actions()}<Row wrap><Button>Group</Button></Row>{/snippet}\n // </SelectionSummary>\n let {\n count,\n kinds = [],\n title,\n fields,\n actions,\n end,\n onclose,\n side = 'panel',\n }: {\n /** The number of things selected */\n count: number;\n /** The number of each kind, in order */\n kinds?: { label: string; count: number }[];\n /** The title in the head; by default the number selected */\n title?: string;\n /** The editors of what the things share (a snippet) */\n fields?: Snippet;\n /** The actions on the whole selection (a snippet) */\n actions?: Snippet;\n /** Icon buttons at the end of the head, before the close button (a snippet) */\n end?: Snippet;\n /** Shows a close button in the head and is called when it is pressed */\n onclose?: () => void;\n /** The width of the panel, as Panel's side */\n side?: 'rail' | 'panel' | 'fill';\n } = $props();\n\n const name = $derived(title ?? getMessages().selected({ count }));\n</script>\n\n{#snippet headEnd()}\n {@render end?.()}\n {#if onclose}\n <Button variant=\"ghost\" icon aria-label={getMessages().close} onclick={() => onclose?.()}>\n <Icon name=\"x\" />\n </Button>\n {/if}\n{/snippet}\n\n<Panel {side} label={name}>\n {#snippet head()}\n <Toolbar title={name} rule tail={!!(onclose || end)} end={onclose || end ? headEnd : undefined} />\n {/snippet}\n <Stack gap={0}>\n {#if kinds.length}\n <Block>\n <Stats>\n {#each kinds as kind, i (i)}\n <Stat label={kind.label} value={String(kind.count)} />\n {/each}\n </Stats>\n </Block>\n {/if}\n {@render fields?.()}\n {#if actions}<Block>{@render actions()}</Block>{/if}\n </Stack>\n</Panel>\n","// Keyboard shortcuts: how a key is written, shown and matched. A key is written without regard to\n// the platform: modifiers joined with +, then one key, for example \"mod+z\", \"shift+mod+z\", \"alt+l\"\n// or \"?\". mod is ⌘ on a Mac and Ctrl elsewhere. The key is one character or a name: escape, enter,\n// tab, space, backspace, delete, plus, minus, the arrows (up, down, left, right), home, end,\n// pageup, pagedown and f1 to f12.\nconst NAMES = {\n escape: 'Esc',\n enter: 'Enter',\n tab: 'Tab',\n space: 'Space',\n backspace: 'Backspace',\n delete: 'Del',\n plus: '+',\n minus: '-',\n up: '↑',\n down: '↓',\n left: '←',\n right: '→',\n home: 'Home',\n end: 'End',\n pageup: 'PgUp',\n pagedown: 'PgDn',\n};\nconst MAC_NAMES = { backspace: '⌫', delete: '⌦', enter: '↩' };\n// The names of e.key for the named keys\nconst KEY_OF = {\n escape: ['Escape'],\n enter: ['Enter'],\n tab: ['Tab'],\n space: [' ', 'Spacebar'],\n backspace: ['Backspace'],\n delete: ['Delete'],\n plus: ['+', '='],\n minus: ['-', '_'],\n up: ['ArrowUp'],\n down: ['ArrowDown'],\n left: ['ArrowLeft'],\n right: ['ArrowRight'],\n home: ['Home'],\n end: ['End'],\n pageup: ['PageUp'],\n pagedown: ['PageDown'],\n};\nfunction parse(spec) {\n const combo = { mod: false, ctrl: false, shift: false, alt: false, key: '' };\n // A trailing + is the key itself (\"mod++\"); the other parts are modifiers\n const parts = spec.endsWith('++') ? [...spec.slice(0, -2).split('+'), '+'] : spec.split('+');\n for (const raw of parts) {\n const part = raw.trim().toLowerCase();\n if (part === 'mod' || part === 'cmd' || part === 'meta')\n combo.mod = true;\n else if (part === 'ctrl' || part === 'control')\n combo.ctrl = true;\n else if (part === 'shift')\n combo.shift = true;\n else if (part === 'alt' || part === 'option')\n combo.alt = true;\n else if (part)\n combo.key = part;\n }\n return combo;\n}\n/** Whether the platform is a Mac (or another Apple system), where mod is ⌘ */\nexport function isMacPlatform() {\n if (typeof navigator === 'undefined')\n return false;\n const data = navigator.userAgentData;\n return /mac|iphone|ipad|ipod/i.test(data?.platform ?? navigator.platform ?? '');\n}\nfunction keyText(key, mac) {\n if (mac && MAC_NAMES[key])\n return MAC_NAMES[key];\n if (NAMES[key])\n return NAMES[key];\n if (/^f\\d{1,2}$/.test(key))\n return key.toUpperCase();\n return key.length === 1 ? key.toUpperCase() : key;\n}\n/**\n * The key as the platform writes it: symbols on a Mac (⌃⌥⇧⌘ in that order, then the key), words\n * elsewhere (Ctrl+Alt+Shift+Z).\n *\n * formatShortcut('shift+mod+z') // \"⇧⌘Z\" on a Mac, \"Ctrl+Shift+Z\" elsewhere\n */\nexport function formatShortcut(key, mac = isMacPlatform()) {\n const c = parse(key);\n const k = keyText(c.key, mac);\n if (mac) {\n return `${c.ctrl ? '⌃' : ''}${c.alt ? '⌥' : ''}${c.shift ? '⇧' : ''}${c.mod ? '⌘' : ''}${k}`;\n }\n const mods = [];\n if (c.mod || c.ctrl)\n mods.push('Ctrl');\n if (c.alt)\n mods.push('Alt');\n if (c.shift)\n mods.push('Shift');\n return [...mods, k].join('+');\n}\n/** A character that needs Shift on some keyboards and not on others: Shift is not compared */\nconst symbol = (key) => key.length === 1 && !/[a-z0-9]/.test(key);\nfunction sameKey(key, e) {\n const named = KEY_OF[key];\n if (named)\n return named.includes(e.key);\n if (/^f\\d{1,2}$/.test(key))\n return e.key.toLowerCase() === key;\n if (key.length !== 1)\n return false;\n if (e.key.toLowerCase() === key)\n return true;\n // Alt on a Mac turns a letter into another character: the physical key still counts\n if (key >= 'a' && key <= 'z')\n return e.code === `Key${key.toUpperCase()}`;\n if (key >= '0' && key <= '9')\n return e.code === `Digit${key}`;\n return false;\n}\n/** Whether a key event is the given shortcut */\nexport function matchesShortcut(key, e, mac = isMacPlatform()) {\n const c = parse(key);\n if (!c.key)\n return false;\n if (e.metaKey !== (mac ? c.mod : false))\n return false;\n if (e.ctrlKey !== (mac ? c.ctrl : c.mod || c.ctrl))\n return false;\n if (e.altKey !== c.alt)\n return false;\n const named = c.key === 'plus' || c.key === 'minus';\n if (!symbol(c.key) && !named && e.shiftKey !== c.shift)\n return false;\n return sameKey(c.key, e);\n}\n/** Whether the element takes typed text, so that keys belong to it */\nexport function isEditable(el) {\n if (!(el instanceof Element))\n return false;\n if (el instanceof HTMLTextAreaElement || el instanceof HTMLSelectElement)\n return true;\n if (el instanceof HTMLInputElement) {\n return !['checkbox', 'radio', 'button', 'submit', 'reset', 'range', 'color', 'file'].includes(el.type.toLowerCase());\n }\n return el instanceof HTMLElement && el.isContentEditable;\n}\n/** The help key: ?, or the Help key of the keyboard, or F1 */\nexport function isHelpKey(e) {\n if (e.metaKey || e.ctrlKey || e.altKey)\n return false;\n return e.key === '?' || e.key === 'Help' || e.key === 'F1';\n}\n","<script lang=\"ts\">\n import '../styles/components.css';\n import { formatShortcut, isMacPlatform, type Shortcut } from '../lib/shortcuts.js';\n import { getMessages } from '../messages.js';\n import Kbd from './Kbd.svelte';\n import List from './List.svelte';\n import ListItem from './ListItem.svelte';\n import Modal from './Modal.svelte';\n import Section from './Section.svelte';\n import Stack from './Stack.svelte';\n import Text from './Text.svelte';\n\n // ShortcutsModal: the list of keyboard shortcuts, in a Modal. One row for each shortcut: what it\n // does on the left, the key on the right, written as the platform writes it (formatShortcut).\n // Shortcuts without a group come first, without a heading; then one Section for each group, in\n // the order the groups first appear. Only the label and the key are read; run and when are not.\n // A Shell opens it with the help key; an application can also open it from a menu.\n //\n // <ShortcutsModal bind:open {shortcuts} />\n let {\n open = $bindable(false),\n shortcuts,\n title,\n mac,\n inline = false,\n onclose,\n }: {\n open?: boolean;\n /** The shortcuts to list; only key, label and group are read */\n shortcuts: Pick<Shortcut, 'key' | 'label' | 'group'>[];\n /** The title; the keyboardShortcuts string by default */\n title?: string;\n /** Writes the keys as a Mac does; by default, as the platform does */\n mac?: boolean;\n /** The same surface in the flow of a page, for documentation */\n inline?: boolean;\n onclose?: () => void;\n } = $props();\n\n const onMac = $derived(mac ?? isMacPlatform());\n const loose = $derived(shortcuts.filter((s) => !s.group));\n const groups = $derived.by(() => {\n const out = new Map<string, typeof shortcuts>();\n for (const s of shortcuts) {\n if (!s.group) continue;\n out.set(s.group, [...(out.get(s.group) ?? []), s]);\n }\n return [...out];\n });\n</script>\n\n{#snippet rows(list: typeof shortcuts)}\n <List>\n {#each list as s, i (`${i}:${s.key}`)}\n <ListItem columns=\"minmax(0, 1fr) auto\" plain rule>\n <Text clamp>{s.label}</Text>\n <Kbd bare>{formatShortcut(s.key, onMac)}</Kbd>\n </ListItem>\n {/each}\n </List>\n{/snippet}\n\n<Modal bind:open title={title ?? getMessages().keyboardShortcuts} {inline} {onclose}>\n <Stack gap={0}>\n {#if loose.length > 0}{@render rows(loose)}{/if}\n {#each groups as [group, list] (group)}\n <Section title={group} flush>{@render rows(list)}</Section>\n {/each}\n </Stack>\n</Modal>\n","<script lang=\"ts\">\n import '../styles/components.css';\n import type { Snippet } from 'svelte';\n\n // Veil: a surface that covers its parent with the ground color and centres its content (a\n // loading state). It lies over a stage that must not show yet. It has a surface and a layer\n // only, no text and no spacing of its own. The parent must be a positioned element.\n //\n // <Veil busy><Text role=\"caption\">Loading</Text></Veil>\n let {\n busy = false,\n children,\n }: {\n /** Tells assistive technology that the content is loading (aria-busy) */\n busy?: boolean;\n children: Snippet;\n } = $props();\n</script>\n\n<div class=\"veil\" data-role=\"veil\" aria-busy={busy || undefined}>\n {@render children()}\n</div>\n\n<style>.veil {\n position: absolute;\n inset: 0;\n display: grid;\n place-items: center;\n z-index: var(--kata-z-modal);\n background: var(--kata-color-ground);\n}</style>\n","<script lang=\"ts\" module>\n /** The band of the window's width: wide (64rem and more), mid (48 to 64rem) or narrow */\n export type ShellWidth = 'wide' | 'mid' | 'narrow';\n /** Where a side region is: beside the stage, floating over it, or a sheet from the bottom */\n export type ShellMode = 'beside' | 'floating' | 'sheet';\n /** Where the side regions are above the narrow width: floating over the stage, or beside it */\n export type ShellSide = 'floating' | 'beside';\n /** What onlayout reports */\n export interface ShellLayout {\n width: ShellWidth;\n leftMode: ShellMode;\n rightMode: ShellMode;\n }\n</script>\n\n<script lang=\"ts\">\n import '../styles/components.css';\n import type { Snippet } from 'svelte';\n import { tick, untrack } from 'svelte';\n import type { Attachment } from 'svelte/attachments';\n import {\n isEditable,\n isHelpKey,\n isMacPlatform,\n matchesShortcut,\n type Shortcut,\n } from '../lib/shortcuts.js';\n import { createNarrow, setAppContainer, WIDTHS } from '../lib/viewport.svelte.js';\n import { getMessages } from '../messages.js';\n import Floating from './Floating.svelte';\n import Sheet from './Sheet.svelte';\n import ShortcutsModal from './ShortcutsModal.svelte';\n import Veil from './Veil.svelte';\n\n // Shell: the frame of a drawing application. The bar at the top, a region on the left and one on\n // the right, the stage (the drawing surface) in the middle, the toolbar over the bottom of the\n // stage, and a dock under it. Every region is a snippet and any may be absent; the shell knows\n // nothing of what they hold.\n //\n // The side regions follow the three widths of the shell's own element, which is the size container\n // `app` of everything inside it (so the container queries of the components in it, and the\n // components that measure in script, read the shell, not the window). From 48rem they float over\n // the stage (Floating, gap-md from its top and its side, a panel wide), both may be open at once,\n // each as tall as its content up to the stage's height less gap-md above and below, and the\n // stage takes the pointer wherever a pane is not. With side=\"beside\" they stand beside the stage\n // from 64rem instead, with a strong line between, and float from 48 to 64rem. Below 48rem they\n // are Sheets from the bottom of the stage and the toolbar rises to stay above them. leftOpen and\n // rightOpen open and close them; onlayout reports the width and where each region is.\n //\n // shortcuts are attached to the document while the shell is mounted, and the help key (?, Help or\n // F1) opens a ShortcutsModal that lists them. Escape closes the sheet opened last; when none is\n // open (and always while the regions float or stand beside the stage) it goes to onescape. Keys\n // typed into a field, and keys pressed while a modal dialog or a popover is open, belong to them.\n //\n // overlay lays the shell over a drawing surface that belongs to the page: the shell's root lets\n // the pointer through, and only the regions it draws take it.\n //\n // <Shell bind:leftOpen shortcuts={keys} onescape={clearSelection}>\n // {#snippet top()}<Topbar …/>{/snippet}\n // {#snippet left()}<Panel label=\"Contents\">…</Panel>{/snippet}\n // {#snippet stage()}<canvas …></canvas>{/snippet}\n // {#snippet bottom()}<Drawbar …/>{/snippet}\n // </Shell>\n type Side = 'left' | 'right';\n let {\n side: sides = 'floating',\n leftOpen = $bindable(true),\n rightOpen = $bindable(false),\n dockHeight = $bindable(),\n shortcutsOpen = $bindable(false),\n shortcuts = [],\n overlay = false,\n leftLabel,\n rightLabel,\n onlayout,\n onescape,\n top,\n left,\n right,\n bottom,\n dock,\n stage,\n veil,\n }: {\n /** Where the side regions are from 64rem: floating over the stage, or beside it */\n side?: ShellSide;\n /** Whether the left region shows */\n leftOpen?: boolean;\n /** Whether the right region shows */\n rightOpen?: boolean;\n /** The height of the dock in px; without it, 38.2% of the height under the bar */\n dockHeight?: number;\n /** Whether the list of shortcuts is open */\n shortcutsOpen?: boolean;\n /** The keyboard shortcuts, attached while the shell is mounted */\n shortcuts?: Shortcut[];\n /** Over a surface of the page: the root lets the pointer through, the regions take it */\n overlay?: boolean;\n /** The names of the sheets that hold the side regions on a narrow screen */\n leftLabel?: string;\n rightLabel?: string;\n /** Called with the width and the place of each side region, and again when they change */\n onlayout?: (layout: ShellLayout) => void;\n /** Escape when no sheet is left to close; returning false leaves the key to the browser */\n onescape?: (e: KeyboardEvent) => unknown;\n /** The bar at the top: a Topbar */\n top?: Snippet;\n /** The left region: a Panel */\n left?: Snippet;\n /** The right region: a Panel */\n right?: Snippet;\n /** The toolbar over the bottom of the stage: a Drawbar */\n bottom?: Snippet;\n /** The dock under the stage: a Panel with side fill */\n dock?: Snippet;\n /** The drawing surface; it fills the rest */\n stage?: Snippet;\n /** While given, a Veil covers the stage and shows it (a loading state) */\n veil?: Snippet;\n } = $props();\n\n // The shell measures its own element, and the components inside measure it too\n let root = $state<HTMLElement>();\n setAppContainer({\n get el() {\n return root;\n },\n });\n const narrow = createNarrow(WIDTHS.narrow);\n const mid = createNarrow(WIDTHS.mid);\n $effect(() => narrow.start(root));\n $effect(() => mid.start(root));\n\n const width: ShellWidth = $derived(narrow.current ? 'narrow' : mid.current ? 'mid' : 'wide');\n const mode: ShellMode = $derived(\n width === 'narrow' ? 'sheet' : width === 'wide' && sides === 'beside' ? 'beside' : 'floating',\n );\n\n $effect(() => {\n const layout: ShellLayout = { width, leftMode: mode, rightMode: mode };\n untrack(() => onlayout?.(layout));\n });\n\n // The side regions that are open, in the order they were opened: the last sheet is on top, and\n // Escape closes it first\n let order = $state<Side[]>([]);\n // What had the focus when a sheet opened, to return to when it closes\n const before: Partial<Record<Side, Element | null>> = {};\n function track(side: Side, open: boolean) {\n const rest = order.filter((s) => s !== side);\n if (open && !order.includes(side)) {\n before[side] = typeof document === 'undefined' ? null : document.activeElement;\n order = [...rest, side];\n } else if (!open && order.includes(side)) {\n order = rest;\n }\n }\n $effect(() => {\n const open = leftOpen && !!left;\n untrack(() => track('left', open));\n });\n $effect(() => {\n const open = rightOpen && !!right;\n untrack(() => track('right', open));\n });\n\n const region = (side: Side) => (side === 'left' ? left : right);\n const shown = (side: Side) => order.includes(side);\n // The floating panes, the left one first whatever the order they were opened in\n const floating = $derived((['left', 'right'] as const).filter(shown));\n\n /** Closes a side region, and returns the focus to where it was when the region opened */\n function close(side: Side) {\n if (side === 'left') leftOpen = false;\n else rightOpen = false;\n const back = before[side];\n before[side] = null;\n if (back instanceof HTMLElement && back.isConnected) tick().then(() => back.focus());\n }\n\n // The height of the sheets, which the toolbar rises above\n const sheetH = $state<Record<Side, number>>({ left: 0, right: 0 });\n const lift = $derived(\n mode === 'sheet' ? Math.max(0, ...order.map((side) => sheetH[side])) : 0,\n );\n function measure(side: Side): Attachment<HTMLElement> {\n return (seat) => {\n const sheet = seat.firstElementChild;\n if (!sheet || typeof ResizeObserver === 'undefined') return;\n const ro = new ResizeObserver(() => {\n sheetH[side] = sheet.getBoundingClientRect().height;\n });\n ro.observe(sheet);\n return () => {\n ro.disconnect();\n sheetH[side] = 0;\n };\n };\n }\n let sheetStage = $state<Record<Side, 'peek' | 'half' | 'full'>>({ left: 'half', right: 'half' });\n\n // ---- The dock's grip ----\n let dockEl = $state<HTMLElement>();\n let mainH = $state(0);\n let dockNow = $state(0);\n let dragging = false;\n let startY = 0;\n let startH = 0;\n // One press of an arrow key, in px (the same as a Panel's grip)\n const STEP = 32;\n /** Keeps the bound height to what the dock shows, after its limits */\n async function settle() {\n await tick();\n if (dockEl) dockHeight = Math.round(dockEl.getBoundingClientRect().height);\n }\n function gripDown(e: PointerEvent) {\n if (!dockEl) return;\n startY = e.clientY;\n startH = dockEl.getBoundingClientRect().height;\n dragging = true;\n (e.currentTarget as HTMLElement).setPointerCapture?.(e.pointerId);\n }\n function gripMove(e: PointerEvent) {\n if (!dragging) return;\n dockHeight = Math.round(startH + (startY - e.clientY));\n }\n function gripUp() {\n if (!dragging) return;\n dragging = false;\n settle();\n }\n function gripKey(e: KeyboardEvent) {\n const now = dockEl?.getBoundingClientRect().height ?? 0;\n if (e.key === 'ArrowUp') dockHeight = Math.round(now + STEP);\n else if (e.key === 'ArrowDown') dockHeight = Math.round(now - STEP);\n else return;\n e.preventDefault();\n settle();\n }\n\n // ---- The keys ----\n function modalOpen(): boolean {\n if (document.querySelector('dialog[open]')) return true;\n try {\n return !!document.querySelector(':popover-open');\n } catch {\n return false;\n }\n }\n function onkeydown(e: KeyboardEvent) {\n if (e.defaultPrevented || e.isComposing || shortcutsOpen || modalOpen()) return;\n if (isEditable(e.target) || isEditable(document.activeElement)) return;\n if (e.key === 'Escape' && !e.metaKey && !e.ctrlKey && !e.altKey) {\n // Only a sheet closes on Escape; the floating panes stay open, as the panels beside the stage\n const topmost = mode === 'sheet' ? order.at(-1) : undefined;\n if (topmost) {\n e.preventDefault();\n close(topmost);\n } else if (onescape && onescape(e) !== false) {\n e.preventDefault();\n }\n return;\n }\n const mac = isMacPlatform();\n for (const s of shortcuts) {\n if (s.when && !s.when()) continue;\n if (!matchesShortcut(s.key, e, mac)) continue;\n if (s.run(e) === false) continue;\n e.preventDefault();\n return;\n }\n if (shortcuts.length > 0 && isHelpKey(e)) {\n e.preventDefault();\n shortcutsOpen = true;\n }\n }\n</script>\n\n<svelte:document {onkeydown} />\n\n{#snippet seat(side: Side)}\n {@render region(side)?.()}\n{/snippet}\n\n<div\n bind:this={root}\n class=\"shell\"\n class:overlay\n data-role=\"shell\"\n data-width={width}\n style:--kata-shell-lift=\"{lift}px\"\n style:--kata-shell-dock={dockHeight === undefined ? undefined : `${dockHeight}px`}\n>\n {#if top}<div class=\"top\">{@render top()}</div>{/if}\n <div class=\"body\">\n {#if mode === 'beside' && shown('left')}\n <div class=\"side left\" data-region=\"left\">{@render seat('left')}</div>\n {/if}\n <div class=\"main\" bind:clientHeight={mainH}>\n <div class=\"stage\" data-region=\"stage\">\n {#if stage}<div class=\"surface\">{@render stage()}</div>{/if}\n {#if bottom}<div class=\"bottom\" data-region=\"bottom\">{@render bottom()}</div>{/if}\n {#if mode === 'floating'}\n {#each floating as side (side)}\n <Floating\n top=\"md\"\n left={side === 'left' ? 'md' : undefined}\n right={side === 'right' ? 'md' : undefined}\n >\n <div class=\"pane\" data-region={side}>{@render seat(side)}</div>\n </Floating>\n {/each}\n {:else if mode === 'sheet'}\n {#each order as side (side)}\n <div class=\"sheet-seat\" data-region={side} {@attach measure(side)}>\n <Sheet\n pane\n closable\n name={side}\n label={side === 'left' ? leftLabel : rightLabel}\n bind:stage={sheetStage[side]}\n onclose={() => close(side)}\n >\n {@render seat(side)}\n </Sheet>\n </div>\n {/each}\n {/if}\n {#if veil}<Veil busy>{@render veil()}</Veil>{/if}\n </div>\n {#if dock}\n <div class=\"dock\" data-region=\"dock\" bind:this={dockEl} bind:clientHeight={dockNow}>\n <div\n class=\"grip\"\n role=\"slider\"\n tabindex=\"0\"\n aria-label={getMessages().dockHeight}\n aria-orientation=\"vertical\"\n aria-valuenow={Math.round(dockNow)}\n aria-valuemin={0}\n aria-valuemax={Math.round(mainH)}\n onpointerdown={gripDown}\n onpointermove={gripMove}\n onpointerup={gripUp}\n onpointercancel={gripUp}\n onkeydown={gripKey}\n ></div>\n {@render dock()}\n </div>\n {/if}\n </div>\n {#if mode === 'beside' && shown('right')}\n <div class=\"side right\" data-region=\"right\">{@render seat('right')}</div>\n {/if}\n </div>\n <!-- Inside the root, so that it measures the shell as the components in the regions do -->\n <ShortcutsModal bind:open={shortcutsOpen} {shortcuts} />\n</div>\n\n<style>.shell {\n container: app/inline-size;\n position: relative;\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n min-width: 0;\n min-height: 0;\n overflow: hidden;\n color: var(--kata-color-text);\n}\n.shell > .top {\n flex: none;\n min-width: 0;\n}\n\n.body {\n flex: 1 1 auto;\n display: flex;\n min-height: 0;\n min-width: 0;\n}\n\n.side {\n flex: none;\n display: flex;\n min-height: 0;\n max-width: 50%;\n}\n.side > :global(*) {\n flex: 1 1 auto;\n min-height: 0;\n}\n\n.side.left {\n border-right: var(--kata-border-width) solid var(--kata-color-line-strong);\n}\n\n.side.right {\n border-left: var(--kata-border-width) solid var(--kata-color-line-strong);\n}\n\n.main {\n flex: 1 1 auto;\n display: flex;\n flex-direction: column;\n min-width: 0;\n min-height: 0;\n}\n\n.stage {\n position: relative;\n flex: 1 1 auto;\n min-height: 0;\n overflow: hidden;\n}\n\n.surface {\n position: absolute;\n inset: 0;\n}\n\n.bottom {\n position: absolute;\n left: 0;\n right: 0;\n bottom: var(--kata-shell-lift, 0px);\n height: 0;\n}\n\n.stage > :global([data-role='floating']) {\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n width: var(--kata-width-panel);\n max-width: calc(100% - var(--kata-gap-md) * 2);\n max-height: calc(100% - var(--kata-gap-md) * 2);\n}\n\n.stage .pane {\n display: flex;\n flex-direction: column;\n flex: 0 1 auto;\n min-height: 0;\n}\n.stage .pane > :global(*) {\n flex: 0 1 auto;\n min-height: 0;\n}\n\n.sheet-seat {\n position: absolute;\n inset: 0;\n pointer-events: none;\n}\n.sheet-seat > :global(*) {\n pointer-events: auto;\n}\n\n.dock {\n position: relative;\n flex: none;\n display: flex;\n min-height: 0;\n height: clamp(var(--kata-height-toolbar), var(--kata-shell-dock, 38.2%), 100% - var(--kata-height-toolbar));\n border-top: var(--kata-border-width) solid var(--kata-color-line-strong);\n}\n.dock > :global(*) {\n flex: 1 1 auto;\n min-height: 0;\n}\n\n.shell.overlay {\n pointer-events: none;\n}\n.shell.overlay > .top,\n.shell.overlay > .body > .side,\n.shell.overlay > .body > .main > .dock,\n.shell.overlay > .body > .main > .stage > .bottom,\n.shell.overlay > .body > .main > .stage > :global([data-role='floating']),\n.shell.overlay > .body > .main > .stage > :global([data-role='veil']),\n.shell.overlay > :global(dialog) {\n pointer-events: auto;\n}\n\n.grip {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n height: var(--kata-pad-sm);\n z-index: 1;\n flex: none;\n cursor: ns-resize;\n touch-action: none;\n}\n.grip:focus-visible {\n outline: 2px solid var(--kata-color-focus);\n outline-offset: -2px;\n}</style>\n","<!--\n@lucide/svelte v1.49.0 - ISC\n\nThis source code is licensed under the ISC license.\nSee the LICENSE file in the root directory of this source tree.\n-->\n\n\n<script lang=\"ts\">import Icon from '../Icon.svelte';\nlet props = $props();\nconst iconData = { \"name\": \"circle\", \"size\": 24, \"node\": [[\"circle\", { \"cx\": \"12\", \"cy\": \"12\", \"r\": \"10\" }]] };\n</script>\n\n<!--\n@component\n\nLucide SVG icon component, renders SVG Element with children.\n\n@preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8Y2lyY2xlIGN4PSIxMiIgY3k9IjEyIiByPSIxMCIgLz4KPC9zdmc+Cg==) - https://lucide.dev/icons/circle\n@see https://lucide.dev/guide/packages/lucide-svelte - Documentation\n-->\n\n<Icon {...props} icon={iconData} />\n","<!--\n@lucide/svelte v1.49.0 - ISC\n\nThis source code is licensed under the ISC license.\nSee the LICENSE file in the root directory of this source tree.\n-->\n\n\n<script lang=\"ts\">import Icon from '../Icon.svelte';\nlet props = $props();\nconst iconData = { \"name\": \"magnet\", \"size\": 24, \"node\": [[\"path\", { \"d\": \"m12 15 4 4\" }], [\"path\", { \"d\": \"M2.352 10.648a1.205 1.205 0 0 0 0 1.704l2.296 2.296a1.205 1.205 0 0 0 1.704 0l6.029-6.029a1 1 0 1 1 3 3l-6.029 6.029a1.205 1.205 0 0 0 0 1.704l2.296 2.296a1.205 1.205 0 0 0 1.704 0l6.365-6.367A1 1 0 0 0 8.716 4.282z\" }], [\"path\", { \"d\": \"m5 8 4 4\" }]] };\n</script>\n\n<!--\n@component\n\nLucide SVG icon component, renders SVG Element with children.\n\n@preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJtMTIgMTUgNCA0IiAvPgogIDxwYXRoIGQ9Ik0yLjM1MiAxMC42NDhhMS4yMDUgMS4yMDUgMCAwIDAgMCAxLjcwNGwyLjI5NiAyLjI5NmExLjIwNSAxLjIwNSAwIDAgMCAxLjcwNCAwbDYuMDI5LTYuMDI5YTEgMSAwIDEgMSAzIDNsLTYuMDI5IDYuMDI5YTEuMjA1IDEuMjA1IDAgMCAwIDAgMS43MDRsMi4yOTYgMi4yOTZhMS4yMDUgMS4yMDUgMCAwIDAgMS43MDQgMGw2LjM2NS02LjM2N0ExIDEgMCAwIDAgOC43MTYgNC4yODJ6IiAvPgogIDxwYXRoIGQ9Im01IDggNCA0IiAvPgo8L3N2Zz4K) - https://lucide.dev/icons/magnet\n@see https://lucide.dev/guide/packages/lucide-svelte - Documentation\n-->\n\n<Icon {...props} icon={iconData} />\n","<!--\n@lucide/svelte v1.49.0 - ISC\n\nThis source code is licensed under the ISC license.\nSee the LICENSE file in the root directory of this source tree.\n-->\n\n\n<script lang=\"ts\">import Icon from '../Icon.svelte';\nlet props = $props();\nconst iconData = { \"name\": \"mouse-pointer-2\", \"size\": 24, \"node\": [[\"path\", { \"d\": \"M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z\" }]] };\n</script>\n\n<!--\n@component\n\nLucide SVG icon component, renders SVG Element with children.\n\n@preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNNC4wMzcgNC42ODhhLjQ5NS40OTUgMCAwIDEgLjY1MS0uNjUxbDE2IDYuNWEuNS41IDAgMCAxLS4wNjMuOTQ3bC02LjEyNCAxLjU4YTIgMiAwIDAgMC0xLjQzOCAxLjQzNWwtMS41NzkgNi4xMjZhLjUuNSAwIDAgMS0uOTQ3LjA2M3oiIC8+Cjwvc3ZnPgo=) - https://lucide.dev/icons/mouse-pointer-2\n@see https://lucide.dev/guide/packages/lucide-svelte - Documentation\n-->\n\n<Icon {...props} icon={iconData} />\n","<!--\n SPDX-FileCopyrightText: 2026 SAKAIDA Atsushi\n SPDX-License-Identifier: AGPL-3.0-only\n-->\n<script lang=\"ts\">\n // MarkupIcon: an icon given as SVG markup by the application (the icon of a tool it adds),\n // drawn at the size of kata's icons. The markup is the application's own and is inserted as it\n // is.\n let { svg, class: className }: { svg: string; class?: string } = $props();\n</script>\n\n<span class={['markup', className]} aria-hidden=\"true\">{@html svg}</span>\n\n<style>\n .markup {\n display: block;\n flex: none;\n width: var(--kata-height-icon);\n height: var(--kata-height-icon);\n }\n .markup > :global(svg) {\n display: block;\n width: 100%;\n height: 100%;\n }\n</style>\n","// SPDX-FileCopyrightText: 2026 SAKAIDA Atsushi\n// SPDX-License-Identifier: AGPL-3.0-only\n\n// The tools of the toolbar: the seven built-in tools, one for each built-in mode of core, and\n// the tools an application adds. A tool only calls `draw.setMode` with its mode; the mode itself\n// belongs to core (a mode an application adds is registered with `draw.extensions.modes.add`\n// before its tool is added).\n\nimport Circle from '@lucide/svelte/icons/circle';\nimport Magnet from '@lucide/svelte/icons/magnet';\nimport MousePointer2 from '@lucide/svelte/icons/mouse-pointer-2';\nimport {\n type DrawbarTool,\n formatShortcut,\n type IconComponent,\n type IconSource,\n} from '@sakuzu/kata/svelte';\nimport type { Mode } from '@sakuzu/maplibre-gl-draw';\nimport MarkupIcon from './components/MarkupIcon.svelte';\nimport type { Messages } from './messages.js';\nimport type { ToolEntry, ToolId, ToolSpec } from './types.js';\n\n/** The built-in tools, in the order of the toolbar */\nexport const TOOL_IDS: readonly ToolId[] = Object.freeze([\n 'select',\n 'point',\n 'line',\n 'polygon',\n 'circle',\n 'freehand',\n 'image',\n]);\n\n/** The mode, the key and the group of each built-in tool */\nexport const BUILTIN_TOOLS: Readonly<\n Record<ToolId, { mode: Mode; shortcut: string; group: string }>\n> = Object.freeze({\n select: { mode: 'select', shortcut: 'V', group: 'select' },\n point: { mode: 'draw_point', shortcut: 'P', group: 'draw' },\n line: { mode: 'draw_line', shortcut: 'L', group: 'draw' },\n polygon: { mode: 'draw_polygon', shortcut: 'A', group: 'draw' },\n circle: { mode: 'draw_circle', shortcut: 'C', group: 'draw' },\n freehand: { mode: 'draw_freehand', shortcut: 'F', group: 'draw' },\n image: { mode: 'draw_image', shortcut: 'I', group: 'draw' },\n});\n\n/** The IDs that the toolbar keeps for its own buttons */\nexport const DELETE_ID = 'delete';\nexport const SNAPPING_ID = 'snapping';\n\n/** The built-in icons, by name: kata's icons where it has them, Lucide's for the rest */\nexport const BUILTIN_ICONS: Readonly<Record<string, IconSource>> = Object.freeze({\n select: MousePointer2 as unknown as IconComponent,\n point: 'point',\n line: 'polyline',\n polygon: 'polygon',\n circle: Circle as unknown as IconComponent,\n freehand: 'pencil',\n image: 'image',\n [DELETE_ID]: 'trash-2',\n [SNAPPING_ID]: Magnet as unknown as IconComponent,\n});\n\n/** Whether a name is the ID of a built-in tool */\nexport function isToolId(value: unknown): value is ToolId {\n return typeof value === 'string' && (TOOL_IDS as readonly string[]).includes(value);\n}\n\n/** Whether an icon is SVG markup rather than the name of a built-in icon */\nfunction isMarkup(icon: string): boolean {\n return icon.trimStart().startsWith('<');\n}\n\n/**\n * Checks a tool of the application\n *\n * @throws Error when a field is missing or has the wrong type, or the icon is neither markup\n * nor the name of a built-in icon\n */\nexport function checkSpec(spec: ToolSpec): void {\n for (const key of ['id', 'mode', 'label', 'icon'] as const) {\n if (typeof spec?.[key] !== 'string' || spec[key] === '') {\n throw new Error(`A tool needs a ${key} (a string that is not empty)`);\n }\n }\n if (spec.id === DELETE_ID || spec.id === SNAPPING_ID) {\n throw new Error(`The tool ID \"${spec.id}\" is kept for the toolbar's own button`);\n }\n if (!isMarkup(spec.icon) && !(spec.icon in BUILTIN_ICONS)) {\n throw new Error(`The icon of the tool \"${spec.id}\" is neither SVG markup nor a built-in icon`);\n }\n}\n\n/**\n * The tools of the options, checked\n *\n * @throws Error when a name is not a built-in tool, a tool is not valid, or two tools share an ID\n */\nexport function normalizeTools(tools: readonly ToolEntry[] = TOOL_IDS): ToolEntry[] {\n const out: ToolEntry[] = [];\n const ids = new Set<string>();\n for (const entry of tools) {\n if (typeof entry === 'string') {\n if (!isToolId(entry)) throw new Error(`There is no built-in tool \"${entry}\"`);\n } else {\n checkSpec(entry);\n }\n const id = entryId(entry);\n if (ids.has(id)) throw new Error(`Two tools have the ID \"${id}\"`);\n ids.add(id);\n out.push(typeof entry === 'string' ? entry : { ...entry });\n }\n return out;\n}\n\n/** The ID of a tool */\nexport function entryId(entry: ToolEntry): string {\n return typeof entry === 'string' ? entry : entry.id;\n}\n\n/** The group of a tool; a tool without one is in a group named after its ID */\nfunction entryGroup(entry: ToolEntry): string {\n if (typeof entry === 'string') return BUILTIN_TOOLS[entry].group;\n return entry.group ?? `tool:${entry.id}`;\n}\n\n/**\n * The tools with one more: after the last tool of its group, or at the end when no tool is in\n * its group\n */\nexport function insertTool(entries: readonly ToolEntry[], spec: ToolSpec): ToolEntry[] {\n const group = entryGroup(spec);\n let at = entries.length;\n for (let i = entries.length - 1; i >= 0; i--) {\n if (entryGroup(entries[i]) === group) {\n at = i + 1;\n break;\n }\n }\n return [...entries.slice(0, at), { ...spec }, ...entries.slice(at)];\n}\n\n/** A tool as `tools.list()` returns it: a built-in tool with its words and the name of its icon */\nexport function toSpec(entry: ToolEntry, messages: Messages): ToolSpec {\n if (typeof entry !== 'string') return { ...entry };\n const { mode, shortcut, group } = BUILTIN_TOOLS[entry];\n return { id: entry, mode, label: messages[entry], icon: entry, shortcut, group };\n}\n\nconst markupIcons = new Map<string, IconComponent>();\n\n/**\n * An icon component that draws SVG markup, made once for each markup. It receives the class of\n * kata's icons and passes it on, so the markup is sized like the built-in icons\n */\nexport function markupIcon(svg: string): IconComponent {\n let icon = markupIcons.get(svg);\n if (!icon) {\n icon = ((internals, props) =>\n MarkupIcon(internals, {\n svg,\n get class() {\n return props.class;\n },\n })) as IconComponent;\n markupIcons.set(svg, icon);\n }\n return icon;\n}\n\n/** The icon of a tool */\nexport function specIcon(spec: ToolSpec): IconSource {\n return isMarkup(spec.icon) ? markupIcon(spec.icon) : (BUILTIN_ICONS[spec.icon] ?? 'circle-alert');\n}\n\n/** The key of a shortcut as kata writes it: modifiers and keys in lowercase */\nexport function shortcutKey(shortcut: string): string {\n return shortcut.toLowerCase();\n}\n\n/**\n * The tools of the Drawbar of kata\n *\n * @param keys Whether the keys are shown in the tooltips (only when the shortcuts are on)\n */\nexport function drawbarTools(specs: readonly ToolSpec[], keys: boolean): DrawbarTool[] {\n return specs.map((spec) => ({\n id: spec.id,\n label: spec.label,\n icon: specIcon(spec),\n kbd: keys && spec.shortcut ? formatShortcut(shortcutKey(spec.shortcut)) : undefined,\n group: spec.group ?? `tool:${spec.id}`,\n }));\n}\n","// SPDX-FileCopyrightText: 2026 SAKAIDA Atsushi\n// SPDX-License-Identifier: AGPL-3.0-only\n\n// The keyboard shortcuts of the interface: the key of each tool and Delete and Backspace for the\n// selection. kata's Shell listens for them on the document.\n//\n// Core listens for its own keys on the map's canvas (Delete, Backspace and Escape among them),\n// and those events go on to the document. A shortcut that core also has declines an event from\n// the canvas, so that the key does not act twice.\n\nimport type { Shortcut } from '@sakuzu/kata/svelte';\nimport type { Messages } from './messages.js';\nimport { shortcutKey } from './tools.js';\nimport type { DrawUIDraw, ToolSpec } from './types.js';\n\n/** Whether a key event comes from the map's canvas, where core has handled it already */\nexport function fromMapCanvas(draw: Pick<DrawUIDraw, 'getMap'>, e: KeyboardEvent): boolean {\n return e.target === draw.getMap().getCanvas();\n}\n\n/** The shortcuts of the tools and of the delete button */\nexport function toolbarShortcuts(\n draw: DrawUIDraw,\n specs: readonly ToolSpec[],\n messages: Messages,\n deletable: boolean,\n): Shortcut[] {\n const out: Shortcut[] = [];\n for (const spec of specs) {\n if (!spec.shortcut) continue;\n out.push({\n key: shortcutKey(spec.shortcut),\n label: spec.label,\n group: messages.toolsGroup,\n // setMode returns false when the mode cannot be entered now: the key goes on\n run: () => draw.setMode(spec.mode),\n });\n }\n if (deletable) {\n for (const key of ['delete', 'backspace']) {\n out.push({\n key,\n label: messages.deleteSelection,\n group: messages.editGroup,\n when: () => draw.selection.get().ids.length > 0,\n run: (e) => !fromMapCanvas(draw, e) && draw.selection.delete(),\n });\n }\n }\n return out;\n}\n","// SPDX-FileCopyrightText: 2026 SAKAIDA Atsushi\n// SPDX-License-Identifier: AGPL-3.0-only\n\n// The two ways the components follow a value that lives outside them.\n//\n// - follow(): a value of the draw instance, read again whenever one of its events fires. The\n// draw instance stays the only source of truth; nothing is copied\n// - Box: a setting of the interface itself (the tools shown, the words), which the functions of\n// the API change and the components read\n\nimport type { Draw, DrawEvents } from '@sakuzu/maplibre-gl-draw';\nimport { createSubscriber } from 'svelte/reactivity';\n\n/** The members of a draw instance that subscribing needs */\nexport type DrawEventSource = Pick<Draw, 'on'>;\n\n/**\n * A value of the draw instance that the components follow. Read inside a component (or an\n * effect), it is read again after each of the events; elsewhere it is a plain read.\n *\n * `refresh` reads it again without an event, for a value that core changes without one.\n */\nexport function follow<T>(\n draw: DrawEventSource,\n events: readonly (keyof DrawEvents)[],\n read: () => T,\n): { get(): T; refresh(): void } {\n const updates = new Set<() => void>();\n const subscribe = createSubscriber((update) => {\n updates.add(update);\n const offs = events.map((event) => draw.on(event, update));\n return () => {\n updates.delete(update);\n for (const off of offs) off();\n };\n });\n return {\n get() {\n subscribe();\n return read();\n },\n refresh() {\n for (const update of updates) update();\n },\n };\n}\n\n/** A setting of the interface that the components follow */\nexport class Box<T> {\n #value: T;\n readonly #updates = new Set<() => void>();\n readonly #subscribe = createSubscriber((update) => {\n this.#updates.add(update);\n return () => {\n this.#updates.delete(update);\n };\n });\n\n constructor(value: T) {\n this.#value = value;\n }\n\n /** The value; inside a component it is followed */\n get(): T {\n this.#subscribe();\n return this.#value;\n }\n\n set(value: T): void {\n this.#value = value;\n for (const update of this.#updates) update();\n }\n}\n","// SPDX-FileCopyrightText: 2026 SAKAIDA Atsushi\n// SPDX-License-Identifier: AGPL-3.0-only\n\n// The options of the inspector, and the sections an application adds to it.\n\nimport type { Feature } from '@sakuzu/maplibre-gl-draw';\nimport type { Box } from '../store.js';\nimport type {\n InspectorOptions,\n InspectorSectionSpec,\n InspectorSectionsHandle,\n InspectorSettings,\n InspectorTab,\n Units,\n} from './types.js';\n\nconst TABS: readonly InspectorTab[] = ['style', 'attributes'];\n\n/**\n * The options of the inspector with their defaults\n *\n * @param units - The units when the options name none (those of `createDrawUI`)\n * @throws Error when a tab is not `style` or `attributes`\n */\nexport function inspectorSettings(\n options: InspectorOptions = {},\n units: Units = 'metric',\n): InspectorSettings {\n const tabs = options.tabs ?? [...TABS];\n for (const tab of tabs) {\n if (!TABS.includes(tab)) throw new Error(`There is no inspector tab \"${tab}\"`);\n }\n return {\n tabs: [...new Set(tabs)],\n measurements: options.measurements !== false,\n operations: options.operations !== false,\n units: options.units ?? units,\n };\n}\n\n/**\n * Checks a section of the application\n *\n * @throws Error when the ID or the title is missing, or `appliesTo` is not a function\n */\nexport function checkSection(spec: InspectorSectionSpec): void {\n for (const key of ['id', 'title'] as const) {\n if (typeof spec?.[key] !== 'string' || spec[key] === '') {\n throw new Error(`An inspector section needs a ${key} (a string that is not empty)`);\n }\n }\n if (typeof spec.appliesTo !== 'function') {\n throw new Error(`The inspector section \"${spec.id}\" needs appliesTo (a function)`);\n }\n}\n\n/** The sections that apply to features; a section whose appliesTo throws does not */\nexport function applicableSections(\n sections: readonly InspectorSectionSpec[],\n features: readonly Feature[],\n): InspectorSectionSpec[] {\n return sections.filter((spec) => {\n try {\n return spec.appliesTo(features);\n } catch {\n return false;\n }\n });\n}\n\n/** The sections of an inspector, to add to and to remove from */\nexport function sectionsHandle(sections: Box<InspectorSectionSpec[]>): InspectorSectionsHandle {\n const remove = (id: string): boolean => {\n const now = sections.get();\n const next = now.filter((spec) => spec.id !== id);\n if (next.length === now.length) return false;\n sections.set(next);\n return true;\n };\n return {\n add(spec) {\n checkSection(spec);\n if (sections.get().some((s) => s.id === spec.id)) {\n throw new Error(`There is an inspector section with the ID \"${spec.id}\" already`);\n }\n const own = { ...spec };\n sections.set([...sections.get(), own]);\n let removed = false;\n return () => {\n if (removed) return;\n removed = true;\n const now = sections.get();\n if (now.includes(own)) sections.set(now.filter((s) => s !== own));\n };\n },\n remove,\n list() {\n return sections.get().map((spec) => ({ ...spec }));\n },\n };\n}\n","// SPDX-FileCopyrightText: 2026 SAKAIDA Atsushi\n// SPDX-License-Identifier: AGPL-3.0-only\n\n// The name, the description and the attributes of a feature, and the patches their changes make.\n//\n// Core has no name for a feature. The interface keeps it, and the description, in two\n// attributes of `properties`: `name` (the title of the inspector) and `description` (a field of\n// its own). The Attributes tab lists every other key of `properties`, except the keys of the\n// library (isDrawProperty).\n//\n// A value is shown as a string (an object or an array as JSON). A value the user types is kept\n// as the string typed: \"12\" stays the string \"12\" and is not turned into a number, so that what\n// is typed is what is stored, whatever it looks like. An application that wants typed values\n// converts them itself (feature.updated tells it of each change).\n\nimport { type Feature, type FeaturePatch, isDrawProperty } from '@sakuzu/maplibre-gl-draw';\n\n/** The attribute that holds the name of a feature */\nexport const NAME_KEY = 'name';\n/** The attribute that holds the description of a feature */\nexport const DESCRIPTION_KEY = 'description';\n\n/** An attribute as the list shows it */\nexport interface AttributeRow {\n key: string;\n value: string;\n}\n\n/** Whether a key of `properties` is kept out of the list of attributes */\nexport function isReservedKey(key: string): boolean {\n return key === NAME_KEY || key === DESCRIPTION_KEY || isDrawProperty(key);\n}\n\n/** A value of `properties` as a string */\nexport function showValue(value: unknown): string {\n if (value === null || value === undefined) return '';\n if (typeof value === 'string') return value;\n if (typeof value === 'number' || typeof value === 'boolean' || typeof value === 'bigint') {\n return String(value);\n }\n try {\n return JSON.stringify(value) ?? '';\n } catch {\n return String(value);\n }\n}\n\n/** The name of a feature, or an empty string */\nexport function featureName(feature: Pick<Feature, 'properties'>): string {\n const name = feature.properties?.[NAME_KEY];\n return typeof name === 'string' ? name : '';\n}\n\n/** The description of a feature, or an empty string */\nexport function featureDescription(feature: Pick<Feature, 'properties'>): string {\n const text = feature.properties?.[DESCRIPTION_KEY];\n return typeof text === 'string' ? text : '';\n}\n\n/** The attributes of a feature, in the order of `properties` */\nexport function attributeRows(feature: Pick<Feature, 'properties'>): AttributeRow[] {\n return Object.entries(feature.properties ?? {})\n .filter(([key]) => !isReservedKey(key))\n .map(([key, value]) => ({ key, value: showValue(value) }));\n}\n\n/** The patch that sets a text attribute, or removes it when the text is empty after trimming */\nfunction textPatch(key: string, text: string): FeaturePatch {\n const value = text.trim();\n return { properties: { [key]: value === '' ? undefined : value } };\n}\n\n/** The patch that names a feature; an empty name removes the attribute */\nexport function namePatch(name: string): FeaturePatch {\n return textPatch(NAME_KEY, name);\n}\n\n/** The patch that describes a feature; an empty description removes the attribute */\nexport function descriptionPatch(text: string): FeaturePatch {\n const value = text.trim() === '' ? undefined : text;\n return { properties: { [DESCRIPTION_KEY]: value } };\n}\n\n/** Whether a name can be given to an attribute of the feature, other than the one at `except` */\nfunction freeKey(feature: Pick<Feature, 'properties'>, key: string, except?: string): boolean {\n if (key === '' || isReservedKey(key)) return false;\n return key === except || !Object.hasOwn(feature.properties ?? {}, key);\n}\n\n/**\n * The patch of a change of the attribute at `index` of {@link attributeRows}: a new value, a\n * new name (the old key removed and the new one set), or both. When only the name changes, the\n * value keeps its type.\n *\n * @returns The patch, or null when nothing changes, there is no attribute at `index`, or the\n * new name is empty, is the name of another attribute, or is kept (`name`, `description`, a\n * key of the library)\n */\nexport function attributePatch(\n feature: Pick<Feature, 'properties'>,\n index: number,\n next: AttributeRow,\n): FeaturePatch | null {\n const row = attributeRows(feature)[index];\n if (!row) return null;\n const key = next.key.trim();\n if (key === row.key && next.value === row.value) return null;\n if (!freeKey(feature, key, row.key)) return null;\n const raw = feature.properties[row.key];\n const value = next.value === row.value ? raw : next.value;\n if (key === row.key) return { properties: { [key]: value } };\n return { properties: { [row.key]: undefined, [key]: value } };\n}\n\n/**\n * The patch that adds an attribute\n *\n * @returns The patch, or null when the name is empty, is taken, or is kept\n */\nexport function attributeAdd(\n feature: Pick<Feature, 'properties'>,\n item: AttributeRow,\n): FeaturePatch | null {\n const key = item.key.trim();\n if (!freeKey(feature, key)) return null;\n return { properties: { [key]: item.value } };\n}\n\n/**\n * The patch that removes the attribute at `index` of {@link attributeRows}\n *\n * @returns The patch, or null when there is no attribute at `index`\n */\nexport function attributeRemove(\n feature: Pick<Feature, 'properties'>,\n index: number,\n): FeaturePatch | null {\n const row = attributeRows(feature)[index];\n return row ? { properties: { [row.key]: undefined } } : null;\n}\n","// SPDX-FileCopyrightText: 2026 SAKAIDA Atsushi\n// SPDX-License-Identifier: AGPL-3.0-only\n\n// The measurements of a feature, written in metric or imperial units.\n//\n// Lengths and areas come from core's geometry entry (meters and square meters on the sphere); a\n// circle, whose geometry is its center, is measured from its radius. A Multi geometry gives the\n// totals of its parts.\n//\n// Units: a length is in meters below 1 000 m and in kilometers from there; an area in square\n// meters below 1 ha (10 000 m²), in hectares below 1 km², and in square kilometers from there.\n// In imperial units a length is in feet below 1 mile (5 280 ft), an area in square feet below\n// 1 acre (43 560 ft²), in acres below 1 square mile (640 ac), and in square miles from there.\n// The small unit is written with at most one decimal, the large ones with two.\n\nimport type { Feature } from '@sakuzu/maplibre-gl-draw';\nimport { area, length, perimeter } from '@sakuzu/maplibre-gl-draw/geometry';\nimport type { Units } from './types.js';\n\n/** What a row of the measurements is */\nexport type MeasureKey =\n | 'longitude'\n | 'latitude'\n | 'length'\n | 'area'\n | 'perimeter'\n | 'radius'\n | 'points';\n\n/** A row of the measurements: what it is and the value, written out */\nexport interface MeasureRow {\n key: MeasureKey;\n value: string;\n}\n\nconst FOOT = 0.3048;\nconst FEET_PER_MILE = 5280;\nconst SQUARE_FOOT = FOOT * FOOT;\nconst SQUARE_FEET_PER_ACRE = 43_560;\nconst ACRES_PER_SQUARE_MILE = 640;\n\n/** The property of core that holds the radius of a circle, in meters */\nconst RADIUS_KEY = 'maplibre-gl-draw:radiusMeters';\n\nfunction number(value: number, locale: string, digits: { min: number; max: number }): string {\n return new Intl.NumberFormat(locale, {\n minimumFractionDigits: digits.min,\n maximumFractionDigits: digits.max,\n }).format(value);\n}\n\nconst SMALL = { min: 0, max: 1 };\nconst LARGE = { min: 2, max: 2 };\n\n/** A length in meters, written in the units */\nexport function formatLength(meters: number, units: Units, locale = 'en'): string {\n if (units === 'imperial') {\n const feet = meters / FOOT;\n if (feet < FEET_PER_MILE) return `${number(feet, locale, SMALL)} ft`;\n return `${number(feet / FEET_PER_MILE, locale, LARGE)} mi`;\n }\n if (meters < 1000) return `${number(meters, locale, SMALL)} m`;\n return `${number(meters / 1000, locale, LARGE)} km`;\n}\n\n/** An area in square meters, written in the units */\nexport function formatArea(squareMeters: number, units: Units, locale = 'en'): string {\n if (units === 'imperial') {\n const squareFeet = squareMeters / SQUARE_FOOT;\n if (squareFeet < SQUARE_FEET_PER_ACRE) return `${number(squareFeet, locale, SMALL)} ft²`;\n const acres = squareFeet / SQUARE_FEET_PER_ACRE;\n if (acres < ACRES_PER_SQUARE_MILE) return `${number(acres, locale, LARGE)} ac`;\n return `${number(acres / ACRES_PER_SQUARE_MILE, locale, LARGE)} mi²`;\n }\n if (squareMeters < 10_000) return `${number(squareMeters, locale, SMALL)} m²`;\n if (squareMeters < 1_000_000) return `${number(squareMeters / 10_000, locale, LARGE)} ha`;\n return `${number(squareMeters / 1_000_000, locale, LARGE)} km²`;\n}\n\n/** A longitude or a latitude in degrees, with six decimals */\nexport function formatDegrees(degrees: number, locale = 'en'): string {\n return `${number(degrees, locale, { min: 6, max: 6 })}°`;\n}\n\n/** The radius of a circle in meters, or undefined */\nfunction radiusOf(feature: Feature): number | undefined {\n const r = feature.properties?.[RADIUS_KEY];\n return typeof r === 'number' && Number.isFinite(r) && r > 0 ? r : undefined;\n}\n\n/** Runs a measurement of core, which throws on a geometry it does not take */\nfunction tryMeasure(run: () => number): number | undefined {\n try {\n const value = run();\n return Number.isFinite(value) ? value : undefined;\n } catch {\n return undefined;\n }\n}\n\n/**\n * The measurements of a feature: the coordinates of a point, the length of a line, the area and\n * the perimeter of an area (and the radius of a circle), the number of points of a MultiPoint.\n * An image and a custom type have none.\n *\n * @param feature - The feature\n * @param units - Metric or imperial\n * @param locale - The language tag the numbers are written in\n */\nexport function measure(feature: Feature, units: Units, locale = 'en'): MeasureRow[] {\n const { geometry } = feature;\n const len = (meters: number | undefined): MeasureRow[] =>\n meters === undefined ? [] : [{ key: 'length', value: formatLength(meters, units, locale) }];\n switch (feature.type) {\n case 'Point': {\n if (geometry.type !== 'Point') return [];\n const [lng, lat] = geometry.coordinates;\n return [\n { key: 'longitude', value: formatDegrees(lng, locale) },\n { key: 'latitude', value: formatDegrees(lat, locale) },\n ];\n }\n case 'MultiPoint': {\n if (geometry.type !== 'MultiPoint') return [];\n const count = new Intl.NumberFormat(locale).format(geometry.coordinates.length);\n return [{ key: 'points', value: count }];\n }\n case 'LineString':\n case 'MultiLineString':\n case 'Freehand':\n return len(tryMeasure(() => length(geometry as Parameters<typeof length>[0])));\n case 'Polygon':\n case 'MultiPolygon': {\n const a = tryMeasure(() => area(geometry as Parameters<typeof area>[0]));\n const p = tryMeasure(() => perimeter(geometry as Parameters<typeof perimeter>[0]));\n const rows: MeasureRow[] = [];\n if (a !== undefined) rows.push({ key: 'area', value: formatArea(a, units, locale) });\n if (p !== undefined) rows.push({ key: 'perimeter', value: formatLength(p, units, locale) });\n return rows;\n }\n case 'Circle': {\n const r = radiusOf(feature);\n if (r === undefined) return [];\n return [\n { key: 'area', value: formatArea(Math.PI * r * r, units, locale) },\n { key: 'perimeter', value: formatLength(2 * Math.PI * r, units, locale) },\n { key: 'radius', value: formatLength(r, units, locale) },\n ];\n }\n default:\n return [];\n }\n}\n","// SPDX-FileCopyrightText: 2026 SAKAIDA Atsushi\n// SPDX-License-Identifier: AGPL-3.0-only\n\n// The operations on the features selected, and which of them apply.\n//\n// They are core's (draw.features.union and the rest), which check the features again and throw\n// on any they do not take; the interface only offers an operation for features it would take:\n//\n// - union and intersection: two areas or more (Polygon, MultiPolygon, or a Circle with a radius)\n// - difference: two areas or more, the first selected minus the others\n// - split: one area and one line (LineString, MultiLineString or Freehand) to cut it along\n// - buffer: one feature or more, each a point, a line or an area (not a freehand line, an image\n// or a custom type, which core does not buffer)\n//\n// The features an operation makes become the selection.\n\nimport type { Feature } from '@sakuzu/maplibre-gl-draw';\nimport type { InspectorDraw, Units } from './types.js';\n\n/** An operation on the features selected */\nexport type OperationId = 'union' | 'intersection' | 'difference' | 'split' | 'buffer';\n\n/** The operations, in the order they are offered */\nexport const OPERATION_IDS: readonly OperationId[] = Object.freeze([\n 'union',\n 'intersection',\n 'difference',\n 'split',\n 'buffer',\n]);\n\nconst RADIUS_KEY = 'maplibre-gl-draw:radiusMeters';\n\nfunction hasRadius(feature: Pick<Feature, 'properties'>): boolean {\n const r = feature.properties?.[RADIUS_KEY];\n return typeof r === 'number' && r > 0;\n}\n\n/** Whether a feature is an area that union, intersection, difference and split take */\nexport function isArea(feature: Pick<Feature, 'type' | 'properties'>): boolean {\n if (feature.type === 'Circle') return hasRadius(feature);\n return feature.type === 'Polygon' || feature.type === 'MultiPolygon';\n}\n\n/** Whether a feature is a line that a split cuts along */\nexport function isCuttingLine(feature: Pick<Feature, 'type'>): boolean {\n return (\n feature.type === 'LineString' ||\n feature.type === 'MultiLineString' ||\n feature.type === 'Freehand'\n );\n}\n\nconst BUFFERABLE = new Set(['Point', 'MultiPoint', 'LineString', 'MultiLineString']);\n\n/** Whether a feature is one that buffer takes */\nexport function isBufferable(feature: Pick<Feature, 'type' | 'properties'>): boolean {\n return isArea(feature) || BUFFERABLE.has(feature.type);\n}\n\n/** The area and the line of a split, or null when the features are not one of each */\nexport function splitPair<T extends Pick<Feature, 'type' | 'properties'>>(\n features: readonly T[],\n): { area: T; line: T } | null {\n if (features.length !== 2) return null;\n const [a, b] = features;\n if (isArea(a) && isCuttingLine(b)) return { area: a, line: b };\n if (isArea(b) && isCuttingLine(a)) return { area: b, line: a };\n return null;\n}\n\n/** The operations that apply to features, in order */\nexport function applicableOperations(\n features: readonly Pick<Feature, 'type' | 'properties'>[],\n): OperationId[] {\n const out: OperationId[] = [];\n const areas = features.length >= 2 && features.every(isArea);\n if (areas) out.push('union', 'intersection', 'difference');\n if (splitPair(features)) out.push('split');\n if (features.length >= 1 && features.every(isBufferable)) out.push('buffer');\n return out;\n}\n\n/** The units of the distance of a buffer */\nexport type DistanceUnit = 'm' | 'km' | 'ft' | 'mi';\n\n/** The units of the distance offered for a system of units, the first being the default */\nexport function distanceUnits(units: Units): DistanceUnit[] {\n return units === 'imperial' ? ['ft', 'mi'] : ['m', 'km'];\n}\n\nconst METERS: Record<DistanceUnit, number> = { m: 1, km: 1000, ft: 0.3048, mi: 1609.344 };\n\n/** A distance in meters */\nexport function toMeters(value: number, unit: DistanceUnit): number {\n return value * METERS[unit];\n}\n\n/** Selects the features an operation made, when it made any */\nfunction selectResults(draw: InspectorDraw, features: readonly Feature[] | null): string[] | null {\n if (!features) return null;\n const ids = features.map((f) => f.id);\n if (ids.length > 0) draw.selection.set('feature', ids);\n return ids;\n}\n\n/**\n * Runs union, intersection, difference or split on features, and selects what it made\n *\n * @param features - The features, in the order of the selection (difference subtracts the\n * others from the first)\n * @returns The IDs of the features made (empty when the line did not cut the area), or null when\n * core refused the operation (read-only, a lock) or its result is empty\n * @throws `DrawError` of core when the features do not suit the operation\n */\nexport function runOperation(\n draw: InspectorDraw,\n op: Exclude<OperationId, 'buffer'>,\n features: readonly Feature[],\n): string[] | null {\n const ids = features.map((f) => f.id);\n return draw.transact(() => {\n switch (op) {\n case 'union': {\n const made = draw.features.union(ids);\n return selectResults(draw, made ? [made] : null);\n }\n case 'intersection': {\n const made = draw.features.intersection(ids);\n return selectResults(draw, made ? [made] : null);\n }\n case 'difference': {\n const [first, ...rest] = ids;\n const made = draw.features.difference(first, rest);\n return selectResults(draw, made ? [made] : null);\n }\n case 'split': {\n const pair = splitPair(features);\n if (!pair) return null;\n return selectResults(draw, draw.features.split(pair.area.id, pair.line.id));\n }\n }\n });\n}\n\n/**\n * Makes the buffers of features and selects them\n *\n * @param distanceMeters - The distance of the outline from the features, in meters\n * @param segments - The segments of a full circle; core's default when left out\n * @returns The IDs of the features made, or null when core refused the operation\n * @throws `DrawError` of core when a feature cannot be buffered or the distance is not finite\n */\nexport function runBuffer(\n draw: InspectorDraw,\n features: readonly Feature[],\n distanceMeters: number,\n segments?: number,\n): string[] | null {\n const ids = features.map((f) => f.id);\n const options = segments === undefined ? { distanceMeters } : { distanceMeters, segments };\n return draw.transact(() => selectResults(draw, draw.features.buffer(ids, options)));\n}\n","// SPDX-FileCopyrightText: 2026 SAKAIDA Atsushi\n// SPDX-License-Identifier: AGPL-3.0-only\n\n// The fields of the style of features, and the patches their changes make.\n//\n// Each type reads its own keys of the style (the table of FeatureStyle in core): a point its\n// marker, a line its stroke, an area its fill and its stroke, an image its opacity. A custom type\n// has no field here. The values shown are those the feature is drawn with\n// (draw.features.getAppliedStyle: the default, the layer rule and the style of the feature on top\n// of each other); a change writes the key into the style of the features.\n//\n// The opacities are fractions from 0 to 1 in core and percentages from 0 to 100 on screen.\n\nimport type {\n Feature,\n FeatureStyle,\n FeatureStyleResolved,\n FeatureType,\n LineStyle,\n PointShape,\n} from '@sakuzu/maplibre-gl-draw';\nimport type { Messages } from '../messages.js';\nimport type { InspectorDraw, InspectorField } from './types.js';\n\n/** A key of the style that the inspector edits */\nexport type StyleKey = keyof FeatureStyleResolved;\n\n/** The kind of style a type reads */\nexport type StyleKind = 'point' | 'line' | 'area' | 'image';\n\n/** The values of the line style, as core's LineStyle has them */\nexport const LINE_STYLES = ['solid', 'dashed', 'dotted'] as const satisfies readonly LineStyle[];\n\n/** The shapes of a point marker, as core's PointShape has them */\nexport const POINT_SHAPES = [\n 'circle',\n 'square',\n 'triangle',\n 'star',\n] as const satisfies readonly PointShape[];\n\nconst STROKE: readonly StyleKey[] = ['strokeColor', 'strokeWidth', 'strokeOpacity', 'lineStyle'];\n\n/** The keys of each kind, in the order of the fields */\nexport const STYLE_KEYS: Readonly<Record<StyleKind, readonly StyleKey[]>> = Object.freeze({\n point: [\n 'pointColor',\n 'pointRadius',\n 'pointShape',\n 'pointOpacity',\n 'pointStrokeColor',\n 'pointStrokeWidth',\n ],\n line: STROKE,\n area: ['fillColor', 'fillOpacity', ...STROKE],\n image: ['imageOpacity'],\n});\n\n/** The kind of style of a type, or null for a custom type */\nexport function styleKind(type: FeatureType): StyleKind | null {\n switch (type) {\n case 'Point':\n case 'MultiPoint':\n return 'point';\n case 'LineString':\n case 'MultiLineString':\n case 'Freehand':\n return 'line';\n case 'Polygon':\n case 'MultiPolygon':\n case 'Circle':\n return 'area';\n case 'Image':\n return 'image';\n default:\n return null;\n }\n}\n\n/** The keys a type reads, in order; none for a custom type */\nexport function styleKeys(type: FeatureType): readonly StyleKey[] {\n const kind = styleKind(type);\n return kind ? STYLE_KEYS[kind] : [];\n}\n\n/** The keys that are opacities: 0 to 1 in core, percentages on screen */\nconst PERCENT: ReadonlySet<StyleKey> = new Set([\n 'fillOpacity',\n 'strokeOpacity',\n 'pointOpacity',\n 'imageOpacity',\n]);\n\n/** Whether a key is an opacity, shown as a percentage */\nexport function isPercentKey(key: string): boolean {\n return PERCENT.has(key as StyleKey);\n}\n\n/** The control of each key, without its name and its value */\ntype FieldShape = Omit<InspectorField, 'key' | 'label' | 'value' | 'mixed'>;\n\nconst COLOR: FieldShape = { kind: 'color' };\nconst PERCENT_SLIDER: FieldShape = { kind: 'slider', min: 0, max: 100, step: 1, unit: '%' };\n\nfunction shapes(m: Messages): Record<StyleKey, FieldShape> {\n return {\n fillColor: COLOR,\n fillOpacity: PERCENT_SLIDER,\n strokeColor: COLOR,\n strokeWidth: { kind: 'slider', min: 0.5, max: 20, step: 0.5, unit: 'px' },\n strokeOpacity: PERCENT_SLIDER,\n lineStyle: {\n kind: 'select',\n options: [\n { value: 'solid', label: m.lineSolid },\n { value: 'dashed', label: m.lineDashed },\n { value: 'dotted', label: m.lineDotted },\n ] satisfies { value: (typeof LINE_STYLES)[number]; label: string }[],\n },\n pointColor: COLOR,\n pointRadius: { kind: 'slider', min: 1, max: 40, step: 1, unit: 'px' },\n pointShape: {\n kind: 'select',\n options: [\n { value: 'circle', label: m.shapeCircle },\n { value: 'square', label: m.shapeSquare },\n { value: 'triangle', label: m.shapeTriangle },\n { value: 'star', label: m.shapeStar },\n ] satisfies { value: (typeof POINT_SHAPES)[number]; label: string }[],\n },\n pointOpacity: PERCENT_SLIDER,\n pointStrokeColor: COLOR,\n pointStrokeWidth: { kind: 'slider', min: 0, max: 10, step: 1, unit: 'px' },\n imageOpacity: PERCENT_SLIDER,\n };\n}\n\n/** The name of each key */\nfunction labels(m: Messages): Record<StyleKey, string> {\n return {\n fillColor: m.styleFillColor,\n fillOpacity: m.styleFillOpacity,\n strokeColor: m.styleStrokeColor,\n strokeWidth: m.styleStrokeWidth,\n strokeOpacity: m.styleStrokeOpacity,\n lineStyle: m.styleLineStyle,\n pointColor: m.stylePointColor,\n pointRadius: m.stylePointRadius,\n pointShape: m.stylePointShape,\n pointOpacity: m.stylePointOpacity,\n pointStrokeColor: m.stylePointStrokeColor,\n pointStrokeWidth: m.stylePointStrokeWidth,\n imageOpacity: m.styleImageOpacity,\n };\n}\n\n/** A value of the style as the field shows it: an opacity as a whole percentage */\nexport function displayValue(key: StyleKey, value: unknown): unknown {\n if (isPercentKey(key) && typeof value === 'number') return Math.round(value * 100);\n if (typeof value === 'string' && key.endsWith('Color')) return value.toLowerCase();\n return value;\n}\n\n/**\n * The keys the features share, in the order of the first one's: the keys of every type of the\n * selection. Empty when one of them is of a custom type, or when there is no feature\n */\nexport function sharedStyleKeys(features: readonly Pick<Feature, 'type'>[]): StyleKey[] {\n if (features.length === 0) return [];\n const [first, ...rest] = features;\n return styleKeys(first.type).filter((key) => rest.every((f) => styleKeys(f.type).includes(key)));\n}\n\n/**\n * The fields of the style of features: the keys they share, each with the value they are drawn\n * with, or `mixed` when their values differ.\n *\n * @param features - The features selected\n * @param applied - The look of a feature as core resolves it (`draw.features.getAppliedStyle`);\n * a feature it gives nothing for shows the keys of its own style\n * @param messages - The words\n * @param disabled - Whether the fields cannot be changed (read-only, a lock)\n */\nexport function styleFields(\n features: readonly Feature[],\n applied: (id: string) => FeatureStyleResolved | undefined,\n messages: Messages,\n disabled = false,\n): InspectorField[] {\n const keys = sharedStyleKeys(features);\n if (keys.length === 0) return [];\n const looks = features.map((f) => applied(f.id) ?? (f.style as Partial<FeatureStyleResolved>));\n const shape = shapes(messages);\n const label = labels(messages);\n return keys.map((key) => {\n const values = looks.map((look) => displayValue(key, look[key]));\n const mixed = values.some((v) => v !== values[0]);\n const field: InspectorField = { key, label: label[key], ...shape[key] };\n if (mixed) field.mixed = true;\n else field.value = values[0];\n if (disabled) field.disabled = true;\n return field;\n });\n}\n\n/**\n * The style that a change of a field writes: an opacity from a percentage to a fraction (clamped\n * to 0..1), a number as it is, a color or a choice as a string. An empty value (a number\n * input emptied) removes the key, so the feature takes the layer rule or the default again.\n */\nexport function stylePatch(key: string, value: unknown): FeatureStyle {\n const k = key as StyleKey;\n if (value === null || value === undefined || value === '') return { [k]: undefined };\n if (isPercentKey(k)) {\n const n = Number(value);\n return { [k]: Number.isFinite(n) ? Math.min(1, Math.max(0, n / 100)) : undefined };\n }\n if (typeof value === 'number') return { [k]: value } as FeatureStyle;\n return { [k]: String(value) } as FeatureStyle;\n}\n\n/**\n * The keys of the inspector's fields that the features set in their own style, over the layer\n * rule and the defaults. Keys the features share no field for (keys of an extension) are left\n * out, so a reset does not touch them\n */\nexport function ownStyleKeys(features: readonly Pick<Feature, 'type' | 'style'>[]): StyleKey[] {\n const fields = new Set(sharedStyleKeys(features));\n const out = new Set<StyleKey>();\n for (const f of features) {\n for (const [key, value] of Object.entries(f.style ?? {})) {\n if (value !== undefined && fields.has(key as StyleKey)) out.add(key as StyleKey);\n }\n }\n return [...out];\n}\n\n/** The style that removes keys, so the features take the layer rule or the defaults again */\nexport function resetPatch(keys: readonly string[]): FeatureStyle {\n const out: Record<string, undefined> = {};\n for (const key of keys) out[key] = undefined;\n return out as FeatureStyle;\n}\n\n/**\n * Writes a style into features, in one transaction\n *\n * @returns The features after the change, or null when core refused it (read-only, a lock)\n */\nexport function applyStyle(\n draw: Pick<InspectorDraw, 'transact' | 'features'>,\n ids: readonly string[],\n style: FeatureStyle,\n): Feature[] | null {\n return draw.transact(() => draw.features.updateMany(ids.map((id) => ({ id, patch: { style } }))));\n}\n","// SPDX-FileCopyrightText: 2026 SAKAIDA Atsushi\n// SPDX-License-Identifier: AGPL-3.0-only\n\n// What the inspector shows, read from the draw instance: nothing, one feature, several, a layer,\n// a group, or several layers or groups. It is read again after each event the inspector follows,\n// so what it shows is always what the draw instance holds.\n//\n// The inspector of one feature is laid out from top to bottom as featureLayout gives it: the head\n// (the name and the subtitle), the rows under it with no tab (the measurements and the\n// description), then the tabs. The Style tab holds the fields of the style, the sections of the\n// application and the operations; the Attributes tab the list of the attributes.\n\nimport type {\n Feature,\n FeatureStyleResolved,\n FeatureType,\n Group,\n Layer,\n} from '@sakuzu/maplibre-gl-draw';\nimport type { Messages } from '../messages.js';\nimport { featureDescription } from './attributes.js';\nimport { type MeasureRow, measure } from './measure.js';\nimport { applicableOperations } from './operations.js';\nimport { sharedStyleKeys } from './style.js';\nimport type { InspectorDraw, InspectorSettings, InspectorTab } from './types.js';\n\n/** The events after which the inspector reads the draw instance again */\nexport const INSPECTOR_EVENTS = [\n 'selection.changed',\n 'document.changed',\n 'hidden.changed',\n 'readOnly.changed',\n] as const;\n\n/** One feature, with what its inspector needs */\nexport interface FeatureView {\n kind: 'feature';\n feature: Feature;\n /** The look it is drawn with */\n applied: FeatureStyleResolved | undefined;\n /** Its layer */\n layer: Layer | undefined;\n /** Whether it can be edited now (not read-only, no lock on it, its group or its layer) */\n editable: boolean;\n /** Whether the document is read-only */\n readOnly: boolean;\n /** Whether this client hides it */\n hidden: boolean;\n}\n\n/** What the inspector shows */\nexport type InspectorView =\n | { kind: 'empty' }\n | FeatureView\n | {\n kind: 'features';\n features: Feature[];\n applied: (FeatureStyleResolved | undefined)[];\n editable: boolean;\n readOnly: boolean;\n }\n | { kind: 'layer'; layer: Layer; onlyLayer: boolean; readOnly: boolean }\n | { kind: 'group'; group: Group; layer: Layer | undefined; readOnly: boolean }\n | { kind: 'items'; type: 'layer' | 'group'; count: number; readOnly: boolean };\n\n/** Reads what the inspector shows */\nexport function readView(draw: InspectorDraw): InspectorView {\n const { type, ids } = draw.selection.get();\n const readOnly = draw.isReadOnly();\n if (type === 'feature') {\n const features = draw.features.getMany(ids).filter((f): f is Feature => f !== undefined);\n if (features.length === 0) return { kind: 'empty' };\n const editable = features.every((f) => draw.features.isEditable(f.id));\n if (features.length === 1) {\n const [feature] = features;\n return {\n kind: 'feature',\n feature,\n applied: draw.features.getAppliedStyle(feature.id),\n layer: draw.layers.get(feature.layerId),\n editable,\n readOnly,\n hidden: draw.hidden.has(feature.id),\n };\n }\n const applied = features.map((f) => draw.features.getAppliedStyle(f.id));\n return { kind: 'features', features, applied, editable, readOnly };\n }\n if (type === 'layer') {\n const layers = ids.map((id) => draw.layers.get(id)).filter((l): l is Layer => !!l);\n if (layers.length === 0) return { kind: 'empty' };\n if (layers.length > 1) return { kind: 'items', type, count: layers.length, readOnly };\n return { kind: 'layer', layer: layers[0], onlyLayer: draw.layers.count() <= 1, readOnly };\n }\n if (type === 'group') {\n const groups = ids.map((id) => draw.groups.get(id)).filter((g): g is Group => !!g);\n if (groups.length === 0) return { kind: 'empty' };\n if (groups.length > 1) return { kind: 'items', type, count: groups.length, readOnly };\n const [group] = groups;\n return { kind: 'group', group, layer: draw.layers.get(group.layerId), readOnly };\n }\n return { kind: 'empty' };\n}\n\n/** What the inspector of one feature shows under its head and in its tabs */\nexport interface FeatureLayout {\n /** The measurements under the head, before the tabs; none when the options leave them out */\n measurements: MeasureRow[];\n /**\n * The description under the head, before the tabs: its text, and whether it can be changed\n * (an empty one then shows the action that adds it). Null when it is empty and cannot be\n * changed\n */\n description: { text: string; editable: boolean } | null;\n /** The tabs, in the order of the options; the Style tab only when it has something to show */\n tabs: InspectorTab[];\n /** Whether the Style tab has the fields of the style */\n style: boolean;\n /** Whether the Style tab has the buffer, at its end */\n buffer: boolean;\n}\n\n/**\n * Lays out the inspector of one feature\n *\n * @param view - The feature, as readView gives it\n * @param settings - The options of the inspector\n * @param sections - The number of the sections of the application that apply to the feature\n * @param locale - The language tag the numbers of the measurements are written in\n */\nexport function featureLayout(\n view: Pick<FeatureView, 'feature' | 'editable'>,\n settings: InspectorSettings,\n sections: number,\n locale = 'en',\n): FeatureLayout {\n const { feature, editable } = view;\n const text = featureDescription(feature);\n const style = sharedStyleKeys([feature]).length > 0;\n const buffer = settings.operations && applicableOperations([feature]).includes('buffer');\n const styleTab = style || sections > 0 || buffer;\n return {\n measurements: settings.measurements ? measure(feature, settings.units, locale) : [],\n description: editable || text !== '' ? { text, editable } : null,\n tabs: settings.tabs.filter((tab) => tab !== 'style' || styleTab),\n style,\n buffer,\n };\n}\n\n/** The name of a type: the words of the built-in types, and a custom type as it is named */\nexport function typeLabel(type: FeatureType, m: Messages): string {\n switch (type) {\n case 'Point':\n return m.point;\n case 'LineString':\n return m.line;\n case 'Polygon':\n return m.polygon;\n case 'Circle':\n return m.circle;\n case 'Freehand':\n return m.freehand;\n case 'Image':\n return m.image;\n case 'MultiPoint':\n return m.multiPoint;\n case 'MultiLineString':\n return m.multiLine;\n case 'MultiPolygon':\n return m.multiPolygon;\n default:\n return type;\n }\n}\n\n/** The number of features of each type, in the order the types first appear */\nexport function kindCounts(\n features: readonly Pick<Feature, 'type'>[],\n m: Messages,\n): { label: string; count: number }[] {\n const counts = new Map<string, number>();\n for (const f of features) counts.set(f.type, (counts.get(f.type) ?? 0) + 1);\n return [...counts].map(([type, count]) => ({ label: typeLabel(type, m), count }));\n}\n","// SPDX-FileCopyrightText: 2026 SAKAIDA Atsushi\n// SPDX-License-Identifier: AGPL-3.0-only\n\nimport type { Messages } from '../messages.js';\n\n/** The English words, the default */\nexport const en: Readonly<Messages> = Object.freeze({\n toolbar: 'Drawing tools',\n select: 'Select',\n point: 'Point',\n line: 'Line',\n polygon: 'Polygon',\n circle: 'Circle',\n freehand: 'Freehand',\n image: 'Image',\n delete: 'Delete',\n snapping: 'Snapping',\n toolsGroup: 'Tools',\n editGroup: 'Edit',\n deleteSelection: 'Delete the selection',\n more: 'More',\n keyboardShortcuts: 'Keyboard shortcuts',\n close: 'Close',\n back: 'Back',\n closePanes: 'Close the panels',\n dockHeight: 'Dock height',\n sheetHeight: 'Sheet height',\n layers: 'Layers',\n legend: 'Legend',\n newLayer: 'New layer',\n newGroup: 'New group from selection',\n activeLayer: 'Active layer',\n panelsGroup: 'Panels',\n toggleLayers: 'Show or hide the layers',\n multiPoint: 'Points',\n multiLine: 'Lines',\n multiPolygon: 'Polygons',\n legendAll: 'All',\n legendOther: 'Other',\n legendBelow: 'Below {upper}',\n legendAtLeast: '{lower} or more',\n legendRange: '{lower} to below {upper}',\n noLegend: 'No layer has a style rule.',\n hide: 'Hide',\n show: 'Show',\n lock: 'Lock',\n unlock: 'Unlock',\n rename: 'Name',\n add: 'Add',\n expand: 'Expand',\n collapse: 'Collapse',\n inspector: 'Inspector',\n nothingSelected: 'Nothing is selected',\n nothingSelectedNote: 'Select a feature, a group or a layer to see it here.',\n numberLocale: 'en',\n styleTab: 'Style',\n attributesTab: 'Attributes',\n addDescription: 'Add a description',\n description: 'Description',\n resetStyle: 'Reset the style',\n styleFillColor: 'Fill color',\n styleFillOpacity: 'Fill opacity',\n styleStrokeColor: 'Line color',\n styleStrokeWidth: 'Line width',\n styleStrokeOpacity: 'Line opacity',\n styleLineStyle: 'Line style',\n stylePointColor: 'Color',\n stylePointRadius: 'Radius',\n stylePointShape: 'Shape',\n stylePointOpacity: 'Opacity',\n stylePointStrokeColor: 'Outline color',\n stylePointStrokeWidth: 'Outline width',\n styleImageOpacity: 'Opacity',\n lineSolid: 'Solid',\n lineDashed: 'Dashed',\n lineDotted: 'Dotted',\n shapeCircle: 'Circle',\n shapeSquare: 'Square',\n shapeTriangle: 'Triangle',\n shapeStar: 'Star',\n measureLongitude: 'Longitude',\n measureLatitude: 'Latitude',\n measureLength: 'Length',\n measureArea: 'Area',\n measurePerimeter: 'Perimeter',\n measureRadius: 'Radius',\n measurePoints: 'Points',\n typeLayer: 'Layer',\n typeGroup: 'Group',\n hiddenState: 'Hidden',\n selectedCount: '{count} selected',\n groupAction: 'Group',\n ungroupAction: 'Ungroup',\n operations: 'Operations',\n opUnion: 'Union',\n opIntersection: 'Intersection',\n opDifference: 'Difference',\n opSplit: 'Split',\n opBuffer: 'Buffer',\n bufferDescription:\n 'Creates the area within a distance of the features. A negative distance shrinks an area.',\n bufferDistance: 'Distance',\n bufferUnit: 'Unit',\n bufferSegments: 'Segments',\n bufferSegmentsHint: 'The segments of a full circle; empty for the default',\n bufferRun: 'Create',\n bufferFailed: 'The buffer could not be made.',\n opacityField: 'Opacity',\n visibleField: 'Visible',\n lockedField: 'Locked',\n styleRule: 'Style rule',\n ruleKind: 'Rule',\n ruleProperty: 'Attribute',\n ruleNone: 'None',\n ruleSingle: 'One color',\n ruleCategorical: 'By category',\n ruleGraduated: 'By class',\n ruleContinuous: 'Gradient',\n ruleHint: 'In this version a rule is set with layers.update.',\n deleteLayer: 'Delete layer',\n addName: 'Add a name',\n mixed: 'Mixed',\n cancelLabel: 'Cancel',\n noAttributes: 'No attributes.',\n attributeName: 'Attribute name',\n attributeValue: 'Value',\n addValue: 'Add a value',\n addAttribute: 'Add an attribute',\n removeAttribute: 'Remove {key}',\n locked: 'Locked',\n color: 'Color',\n colorRed: 'Red',\n colorOrange: 'Orange',\n colorGold: 'Gold',\n colorGreen: 'Green',\n colorBlue: 'Blue',\n colorPurple: 'Purple',\n colorBlack: 'Black',\n colorBrown: 'Brown',\n colorWhite: 'White',\n colorCode: 'Color code',\n eyedropper: 'Eyedropper',\n hue: 'Hue',\n saturation: 'Saturation',\n lightness: 'Lightness',\n saturationValue: 'Saturation and value',\n saturationValueText: 'Saturation {s}%, value {v}%',\n running: 'Running',\n toLight: 'Switch to light',\n toDark: 'Switch to dark',\n});\n","// SPDX-FileCopyrightText: 2026 SAKAIDA Atsushi\n// SPDX-License-Identifier: AGPL-3.0-only\n\nimport type { Messages } from '../messages.js';\n\n/** The Japanese words */\nexport const ja: Readonly<Messages> = Object.freeze({\n toolbar: '描画の道具',\n select: '選択',\n point: '点',\n line: '線',\n polygon: '面',\n circle: '円',\n freehand: 'フリーハンド',\n image: '画像',\n delete: '削除',\n snapping: '吸着',\n toolsGroup: '道具',\n editGroup: '編集',\n deleteSelection: '選んだものを削除',\n more: 'その他',\n keyboardShortcuts: 'キーボードショートカット',\n close: '閉じる',\n back: '戻る',\n closePanes: 'パネルを閉じる',\n dockHeight: 'ドックの高さ',\n sheetHeight: 'シートの高さ',\n layers: 'レイヤー',\n legend: '凡例',\n newLayer: '新しいレイヤー',\n newGroup: '選んだものからグループを作る',\n activeLayer: '描き込むレイヤー',\n panelsGroup: 'パネル',\n toggleLayers: 'レイヤーのパネルを開く、閉じる',\n multiPoint: '複数の点',\n multiLine: '複数の線',\n multiPolygon: '複数の面',\n legendAll: 'すべて',\n legendOther: 'その他',\n legendBelow: '{upper} 未満',\n legendAtLeast: '{lower} 以上',\n legendRange: '{lower} 以上 {upper} 未満',\n noLegend: 'スタイルの規則を持つレイヤーはありません。',\n hide: '隠す',\n show: '表示する',\n lock: 'ロックする',\n unlock: 'ロックを解除する',\n rename: '名前',\n add: '追加',\n expand: '開く',\n collapse: '閉じる',\n inspector: 'インスペクター',\n nothingSelected: '何も選んでいません',\n nothingSelectedNote: '地物、グループ、レイヤーを選ぶとここに出ます。',\n numberLocale: 'ja',\n styleTab: 'スタイル',\n attributesTab: '属性',\n addDescription: '説明を追加',\n description: '説明',\n resetStyle: 'スタイルを戻す',\n styleFillColor: '塗りの色',\n styleFillOpacity: '塗りの不透明度',\n styleStrokeColor: '線の色',\n styleStrokeWidth: '線の太さ',\n styleStrokeOpacity: '線の不透明度',\n styleLineStyle: '線種',\n stylePointColor: '色',\n stylePointRadius: '半径',\n stylePointShape: '形',\n stylePointOpacity: '不透明度',\n stylePointStrokeColor: '縁の色',\n stylePointStrokeWidth: '縁の太さ',\n styleImageOpacity: '不透明度',\n lineSolid: '実線',\n lineDashed: '破線',\n lineDotted: '点線',\n shapeCircle: '円',\n shapeSquare: '四角',\n shapeTriangle: '三角',\n shapeStar: '星',\n measureLongitude: '経度',\n measureLatitude: '緯度',\n measureLength: '長さ',\n measureArea: '面積',\n measurePerimeter: '周長',\n measureRadius: '半径',\n measurePoints: '点の数',\n typeLayer: 'レイヤー',\n typeGroup: 'グループ',\n hiddenState: '非表示',\n selectedCount: '{count} 件を選択中',\n groupAction: 'グループにする',\n ungroupAction: 'グループを解除',\n operations: '演算',\n opUnion: '結合',\n opIntersection: '交差',\n opDifference: '差',\n opSplit: '分割',\n opBuffer: 'バッファー',\n bufferDescription: '地物から一定の距離の範囲を作ります。負の距離は面を縮めます。',\n bufferDistance: '距離',\n bufferUnit: '単位',\n bufferSegments: '分割数',\n bufferSegmentsHint: '円 1 周の辺の数。空なら既定値',\n bufferRun: '作る',\n bufferFailed: 'バッファーを作れませんでした。',\n opacityField: '不透明度',\n visibleField: '表示',\n lockedField: 'ロック',\n styleRule: 'スタイルの規則',\n ruleKind: '規則',\n ruleProperty: '属性',\n ruleNone: 'なし',\n ruleSingle: '単色',\n ruleCategorical: 'カテゴリー別',\n ruleGraduated: '階級別',\n ruleContinuous: 'グラデーション',\n ruleHint: 'この版では規則を layers.update で設定します。',\n deleteLayer: 'レイヤーを削除',\n addName: '名前を付ける',\n mixed: '混在',\n cancelLabel: 'キャンセル',\n noAttributes: '属性はありません。',\n attributeName: '属性の名前',\n attributeValue: '値',\n addValue: '値を入れる',\n addAttribute: '属性を足す',\n removeAttribute: '{key} を削除',\n locked: 'ロック中',\n color: '色',\n colorRed: '赤',\n colorOrange: '橙',\n colorGold: '金',\n colorGreen: '緑',\n colorBlue: '青',\n colorPurple: '紫',\n colorBlack: '黒',\n colorBrown: '茶',\n colorWhite: '白',\n colorCode: 'カラーコード',\n eyedropper: 'スポイト',\n hue: '色相',\n saturation: '彩度',\n lightness: '明度',\n saturationValue: '彩度と明度',\n saturationValueText: '彩度 {s}%、明度 {v}%',\n running: '実行中',\n toLight: 'ライトに切り替える',\n toDark: 'ダークに切り替える',\n});\n","// SPDX-FileCopyrightText: 2026 SAKAIDA Atsushi\n// SPDX-License-Identifier: AGPL-3.0-only\n\n// The words of the interface. English and Japanese come with it; an application can replace any\n// of them by passing a partial set, which is laid over English.\n//\n// Some words are shown by the components of kata the interface is built from (the More menu of\n// the toolbar, the list of the keyboard shortcuts). They are part of this set too, and applying a\n// locale passes them on to kata. kata keeps them for the whole page: every interface on one page\n// shows the words of the locale that was applied last.\n\nimport { type Messages as KataMessages, setMessages as setKataMessages } from '@sakuzu/kata/svelte';\nimport { en } from './locales/en.js';\nimport { ja } from './locales/ja.js';\n\n/** The words of the interface */\nexport interface Messages {\n /** The name of the toolbar, read by assistive technology */\n toolbar: string;\n /** The names of the built-in tools */\n select: string;\n point: string;\n line: string;\n polygon: string;\n circle: string;\n freehand: string;\n image: string;\n /** The delete button of the toolbar */\n delete: string;\n /** The snapping switch of the toolbar */\n snapping: string;\n /** In the list of the keyboard shortcuts: the heading of the tools and of the editing keys */\n toolsGroup: string;\n editGroup: string;\n /** In the list of the keyboard shortcuts: what Delete and Backspace do */\n deleteSelection: string;\n /** The trigger of the menu that holds the tools that do not fit */\n more: string;\n /** The title of the list of the keyboard shortcuts */\n keyboardShortcuts: string;\n /** The close and back buttons of a dialog */\n close: string;\n back: string;\n /** The scrim that closes the panels floating over the map */\n closePanes: string;\n /** The handles that resize a dock and a sheet */\n dockHeight: string;\n sheetHeight: string;\n /** The tab of the layer panel, and the name of its tree */\n layers: string;\n /** The tab of the legend */\n legend: string;\n /** The items of the add menu of the layer panel */\n newLayer: string;\n newGroup: string;\n /** The mark of the layer that drawn features go into */\n activeLayer: string;\n /** In the list of the keyboard shortcuts: the heading of the panels, and the key of the left one */\n panelsGroup: string;\n toggleLayers: string;\n /** The names of the types that have no tool, for a feature without a name */\n multiPoint: string;\n multiLine: string;\n multiPolygon: string;\n /**\n * The labels of the legend that are not values of the data: every feature, the features the\n * rule does not resolve, and the classes of a graduated rule, with `{lower}` and `{upper}` for\n * their bounds\n */\n legendAll: string;\n legendOther: string;\n legendBelow: string;\n legendAtLeast: string;\n legendRange: string;\n /** What the legend shows when no layer has a style rule */\n noLegend: string;\n /** In the layer tree of kata: the eye, the lock, the name's input, the add button and the chevron */\n hide: string;\n show: string;\n lock: string;\n unlock: string;\n rename: string;\n add: string;\n expand: string;\n collapse: string;\n /** The inspector: its name, read by assistive technology, and what it says with nothing selected */\n inspector: string;\n nothingSelected: string;\n nothingSelectedNote: string;\n /** The language tag the numbers of the inspector are written in (Intl.NumberFormat) */\n numberLocale: string;\n /** The tabs of the inspector of a feature; the first is also the title of the style's section */\n styleTab: string;\n attributesTab: string;\n /** The row of the description of a feature, and its action while it is empty */\n description: string;\n addDescription: string;\n /** The button that removes the style of the features, back to the layer rule and the defaults */\n resetStyle: string;\n /** The names of the fields of the style */\n styleFillColor: string;\n styleFillOpacity: string;\n styleStrokeColor: string;\n styleStrokeWidth: string;\n styleStrokeOpacity: string;\n styleLineStyle: string;\n stylePointColor: string;\n stylePointRadius: string;\n stylePointShape: string;\n stylePointOpacity: string;\n stylePointStrokeColor: string;\n stylePointStrokeWidth: string;\n styleImageOpacity: string;\n /** The choices of the line style and of the shape of a point */\n lineSolid: string;\n lineDashed: string;\n lineDotted: string;\n shapeCircle: string;\n shapeSquare: string;\n shapeTriangle: string;\n shapeStar: string;\n /** The names of the measurements */\n measureLongitude: string;\n measureLatitude: string;\n measureLength: string;\n measureArea: string;\n measurePerimeter: string;\n measureRadius: string;\n measurePoints: string;\n /** The names of a layer and of a group */\n typeLayer: string;\n typeGroup: string;\n /** What the inspector says of a feature this client hides */\n hiddenState: string;\n /** The title of a selection of several things; {count} is their number */\n selectedCount: string;\n /** The actions on a selection */\n groupAction: string;\n ungroupAction: string;\n /** The operations on features, and the title of their section */\n operations: string;\n opUnion: string;\n opIntersection: string;\n opDifference: string;\n opSplit: string;\n opBuffer: string;\n /** The dialog of the buffer */\n bufferDescription: string;\n bufferDistance: string;\n bufferUnit: string;\n bufferSegments: string;\n bufferSegmentsHint: string;\n bufferRun: string;\n bufferFailed: string;\n /** The fields of a layer and of a group */\n opacityField: string;\n visibleField: string;\n lockedField: string;\n /** The section of the style rule of a layer, which is only read */\n styleRule: string;\n ruleKind: string;\n ruleProperty: string;\n ruleNone: string;\n ruleSingle: string;\n ruleCategorical: string;\n ruleGraduated: string;\n ruleContinuous: string;\n ruleHint: string;\n deleteLayer: string;\n /**\n * Words kata's components of the inspector show: the action of an empty name, a field whose\n * values differ, the list of attributes and the color picker. `removeAttribute` has {key} for\n * the name of the attribute, and `saturationValueText` {s} and {v} for the two percentages\n */\n addName: string;\n mixed: string;\n cancelLabel: string;\n noAttributes: string;\n attributeName: string;\n attributeValue: string;\n addValue: string;\n addAttribute: string;\n removeAttribute: string;\n locked: string;\n color: string;\n colorRed: string;\n colorOrange: string;\n colorGold: string;\n colorGreen: string;\n colorBlue: string;\n colorPurple: string;\n colorBlack: string;\n colorBrown: string;\n colorWhite: string;\n colorCode: string;\n eyedropper: string;\n hue: string;\n saturation: string;\n lightness: string;\n saturationValue: string;\n saturationValueText: string;\n running: string;\n /** The button that switches the theme: what pressing it does, to the light and to the dark */\n toLight: string;\n toDark: string;\n}\n\n/** A locale: one of the sets that come with the interface, or words laid over English */\nexport type Locale = 'en' | 'ja' | Partial<Messages>;\n\n/** The words of the components of kata, taken from the set */\nconst KATA_KEYS = [\n 'more',\n 'keyboardShortcuts',\n 'close',\n 'back',\n 'closePanes',\n 'dockHeight',\n 'sheetHeight',\n 'hide',\n 'show',\n 'lock',\n 'unlock',\n 'rename',\n 'add',\n 'expand',\n 'collapse',\n] as const satisfies readonly (keyof Messages)[];\n\n/** The full set of words for a locale */\nexport function resolveMessages(locale: Locale = 'en'): Messages {\n if (locale === 'en') return { ...en };\n if (locale === 'ja') return { ...ja };\n const out: Messages = { ...en };\n for (const [key, value] of Object.entries(locale) as [keyof Messages, unknown][]) {\n if (typeof value === 'string' && key in en) out[key] = value;\n }\n return out;\n}\n\n/** The language of a locale, for the lang attribute of the root element, when it is known */\nexport function localeLanguage(locale: Locale = 'en'): string | null {\n return typeof locale === 'string' ? locale : null;\n}\n\n/** The words of the set that kata shows */\nexport function kataMessages(messages: Messages): Pick<Messages, (typeof KATA_KEYS)[number]> {\n const out = {} as Pick<Messages, (typeof KATA_KEYS)[number]>;\n for (const key of KATA_KEYS) out[key] = messages[key];\n return out;\n}\n\n/** Passes the words that kata shows on to kata (for the whole page) */\nexport function applyKataMessages(messages: Messages): void {\n setKataMessages({\n ...kataMessages(messages),\n ...(inspectorKataMessages(messages) as Partial<KataMessages>),\n });\n}\n\n/**\n * The words of kata's components of the inspector, by kata's key: the key of the set that holds\n * each, where the two names differ (the words kata's layer tree shows too are in KATA_KEYS)\n */\nconst INSPECTOR_KATA_WORDS = {\n addName: 'addName',\n mixed: 'mixed',\n cancel: 'cancelLabel',\n noAttributes: 'noAttributes',\n attributeName: 'attributeName',\n attributeValue: 'attributeValue',\n addValue: 'addValue',\n addAttribute: 'addAttribute',\n locked: 'locked',\n color: 'color',\n colorRed: 'colorRed',\n colorOrange: 'colorOrange',\n colorGold: 'colorGold',\n colorGreen: 'colorGreen',\n colorBlue: 'colorBlue',\n colorPurple: 'colorPurple',\n colorBlack: 'colorBlack',\n colorBrown: 'colorBrown',\n colorWhite: 'colorWhite',\n colorCode: 'colorCode',\n eyedropper: 'eyedropper',\n hue: 'hue',\n saturation: 'saturation',\n lightness: 'lightness',\n saturationValue: 'saturationValue',\n running: 'running',\n} as const satisfies Partial<Record<keyof KataMessages, keyof Messages>>;\n\n/** Fills the {name} places of a word with values */\nexport function fillWord(word: string, values: Record<string, string | number>): string {\n return word.replace(/\\{(\\w+)\\}/g, (all, name: string) =>\n name in values ? String(values[name]) : all,\n );\n}\n\n/**\n * The words of the set that kata's components of the inspector show, by kata's keys, as kata\n * takes them (a word with values as a function of them)\n */\nexport function inspectorKataMessages(messages: Messages): Record<string, unknown> {\n const out: Partial<Record<keyof KataMessages, unknown>> = {};\n for (const [kata, own] of Object.entries(INSPECTOR_KATA_WORDS)) {\n out[kata as keyof KataMessages] = messages[own];\n }\n out.removeAttribute = ({ key }: { key: string }) => fillWord(messages.removeAttribute, { key });\n out.saturationValueText = ({ s, v }: { s: number; v: number }) =>\n fillWord(messages.saturationValueText, { s, v });\n return out;\n}\n","<!--\n SPDX-FileCopyrightText: 2026 SAKAIDA Atsushi\n SPDX-License-Identifier: AGPL-3.0-only\n-->\n<script lang=\"ts\">\n import { InspectorRow, NativeSelect, NumberInput, ProcessDialog } from '@sakuzu/kata/svelte';\n import type { Feature } from '@sakuzu/maplibre-gl-draw';\n import {\n type DistanceUnit,\n distanceUnits,\n runBuffer,\n toMeters,\n } from '../inspector/operations.js';\n import type { InspectorDraw, Units } from '../inspector/types.js';\n import type { Messages } from '../messages.js';\n\n // BufferDialog: kata's ProcessDialog that asks the distance of a buffer (a number and a unit of\n // the units of the inspector) and, optionally, the segments of a full circle, then makes the\n // buffers with draw.features.buffer and selects them. Core's error shows in the dialog.\n let {\n open = $bindable(false),\n draw,\n features,\n units,\n m,\n }: {\n open?: boolean;\n draw: InspectorDraw;\n /** The features to surround */\n features: Feature[];\n units: Units;\n m: Messages;\n } = $props();\n\n const uid = $props.id();\n const unitChoices = $derived(distanceUnits(units));\n let distance = $state<number | null>(null);\n let unit = $state<DistanceUnit | undefined>();\n let segments = $state<number | null>(null);\n let error = $state<string | undefined>();\n\n const currentUnit = $derived(unit && unitChoices.includes(unit) ? unit : unitChoices[0]);\n const ready = $derived(\n distance !== null &&\n Number.isFinite(distance) &&\n distance !== 0 &&\n (segments === null || segments > 0),\n );\n\n function run() {\n if (!ready || distance === null) return;\n try {\n const made = runBuffer(\n draw,\n features,\n toMeters(distance, currentUnit),\n segments === null ? undefined : segments,\n );\n if (made === null || made.length === 0) {\n error = m.bufferFailed;\n return;\n }\n error = undefined;\n open = false;\n } catch (e) {\n error = e instanceof Error ? e.message : m.bufferFailed;\n }\n }\n</script>\n\n<ProcessDialog\n bind:open\n title={m.opBuffer}\n description={m.bufferDescription}\n runLabel={m.bufferRun}\n {error}\n disabled={!ready}\n onrun={run}\n oncancel={() => (error = undefined)}\n size=\"sm\"\n>\n <InspectorRow label={m.bufferDistance} for=\"{uid}-distance\">\n <NumberInput id=\"{uid}-distance\" bind:value={distance} step=\"any\" />\n </InspectorRow>\n <InspectorRow label={m.bufferUnit} for=\"{uid}-unit\">\n <NativeSelect\n id=\"{uid}-unit\"\n options={unitChoices.map((u) => ({ value: u, label: u }))}\n value={currentUnit}\n onchange={(u) => (unit = u)}\n />\n </InspectorRow>\n <InspectorRow label={m.bufferSegments} for=\"{uid}-segments\" hint={m.bufferSegmentsHint}>\n <NumberInput id=\"{uid}-segments\" bind:value={segments} min={1} step={1} />\n </InspectorRow>\n</ProcessDialog>\n","<!--\n SPDX-FileCopyrightText: 2026 SAKAIDA Atsushi\n SPDX-License-Identifier: AGPL-3.0-only\n-->\n<script lang=\"ts\">\n import { FieldList, InspectorSection } from '@sakuzu/kata/svelte';\n import type { Feature } from '@sakuzu/maplibre-gl-draw';\n import type { Attachment } from 'svelte/attachments';\n import type { InspectorField, InspectorSectionSpec } from '../inspector/types.js';\n\n // CustomSection: a section the application added. Its fields are drawn by kata's FieldList\n // and their changes go to the section's onchange; what render draws goes under them. render\n // runs again with the features whenever they change, after the function it returned is called.\n let {\n spec,\n features,\n editable,\n }: {\n spec: InspectorSectionSpec;\n features: Feature[];\n /** Whether the features can be edited now; the fields are disabled when they cannot */\n editable: boolean;\n } = $props();\n\n const fields = $derived.by((): InspectorField[] => {\n let out: InspectorField[] = [];\n try {\n out = spec.fields?.(features) ?? [];\n } catch (error) {\n console.error(`The inspector section \"${spec.id}\" failed to give its fields`, error);\n }\n return editable ? out : out.map((f) => ({ ...f, disabled: true }));\n });\n\n function draw(spec: InspectorSectionSpec, features: Feature[]): Attachment<HTMLElement> {\n return (element) => spec.render?.(element, features);\n }\n</script>\n\n<InspectorSection title={spec.title}>\n {#if fields.length > 0}\n <FieldList {fields} onchange={(key, value) => spec.onchange?.(key, value, features)} />\n {/if}\n {#if spec.render}\n <div data-section={spec.id} {@attach draw(spec, features)}></div>\n {/if}\n</InspectorSection>\n","<!--\n SPDX-FileCopyrightText: 2026 SAKAIDA Atsushi\n SPDX-License-Identifier: AGPL-3.0-only\n-->\n<script lang=\"ts\">\n import { Button, FieldList, Icon, InspectorSection } from '@sakuzu/kata/svelte';\n import type { Feature, FeatureStyleResolved } from '@sakuzu/maplibre-gl-draw';\n import {\n applyStyle,\n ownStyleKeys,\n resetPatch,\n styleFields,\n stylePatch,\n } from '../inspector/style.js';\n import type { InspectorDraw, InspectorSectionSpec } from '../inspector/types.js';\n import type { Messages } from '../messages.js';\n import CustomSection from './CustomSection.svelte';\n\n // StyleFields: the section of the style of features, and the sections the application added\n // that apply to them. The fields are those the features share, with the values they are drawn\n // with; a change is written into the style of every feature in one transaction, and the reset\n // removes the keys the features set themselves.\n let {\n draw,\n features,\n applied,\n editable,\n m,\n sections = [],\n }: {\n draw: InspectorDraw;\n features: Feature[];\n /** The look of each feature, in the order of features */\n applied: (FeatureStyleResolved | undefined)[];\n /** Whether the features can be edited now */\n editable: boolean;\n m: Messages;\n /** The sections of the application that apply to the features */\n sections?: InspectorSectionSpec[];\n } = $props();\n\n const fields = $derived.by(() => {\n const looks = new Map(features.map((f, i) => [f.id, applied[i]]));\n return styleFields(features, (id) => looks.get(id), m, !editable);\n });\n const own = $derived(ownStyleKeys(features));\n const ids = $derived(features.map((f) => f.id));\n\n function onchange(key: string, value: unknown) {\n applyStyle(draw, ids, stylePatch(key, value));\n }\n\n function reset() {\n applyStyle(draw, ids, resetPatch(own));\n }\n</script>\n\n{#snippet resetButton()}\n <Button variant=\"ghost\" icon aria-label={m.resetStyle} onclick={reset}>\n <Icon name=\"undo-2\" />\n </Button>\n{/snippet}\n\n{#if fields.length > 0}\n <InspectorSection\n title={m.styleTab}\n end={editable && own.length > 0 ? resetButton : undefined}\n >\n <FieldList {fields} {onchange} />\n </InspectorSection>\n{/if}\n{#each sections as spec (spec.id)}\n <CustomSection {spec} {features} {editable} />\n{/each}\n","<!--\n SPDX-FileCopyrightText: 2026 SAKAIDA Atsushi\n SPDX-License-Identifier: AGPL-3.0-only\n-->\n<script lang=\"ts\">\n import {\n AttributeList,\n Block,\n Button,\n Footer,\n InlineEdit,\n InspectorFrame,\n InspectorSection,\n Kv,\n Pair,\n Row,\n Stack,\n Tabs,\n } from '@sakuzu/kata/svelte';\n import type { FeaturePatch } from '@sakuzu/maplibre-gl-draw';\n import {\n attributeAdd,\n attributePatch,\n attributeRemove,\n attributeRows,\n descriptionPatch,\n featureName,\n namePatch,\n } from '../inspector/attributes.js';\n import type { MeasureKey } from '../inspector/measure.js';\n import type {\n InspectorDraw,\n InspectorSectionSpec,\n InspectorSettings,\n InspectorTab,\n } from '../inspector/types.js';\n import { type FeatureView, featureLayout, typeLabel } from '../inspector/view.js';\n import type { Messages } from '../messages.js';\n import BufferDialog from './BufferDialog.svelte';\n import StyleFields from './StyleFields.svelte';\n\n // FeatureInspector: the inspector of one feature in kata's InspectorFrame, laid out as\n // featureLayout gives it. The head is its name (properties.name), changed where it stands, and\n // a subtitle (its type, its layer and whether this client hides it). Under the head, with no\n // tab, are its measurements and its description (properties.description), changed where it\n // stands. Then the tabs: Style has the fields of its style, the sections of the application and\n // the buffer; Attributes the list of its other attributes. The foot deletes it, locks or\n // unlocks it, and hides or shows it in this client.\n let {\n draw,\n view,\n m,\n settings,\n sections = [],\n tab = $bindable('style'),\n onclose,\n }: {\n draw: InspectorDraw;\n view: FeatureView;\n m: Messages;\n settings: InspectorSettings;\n /** The sections of the application that apply to the feature */\n sections?: InspectorSectionSpec[];\n /** The tab chosen last, kept while the selection changes */\n tab?: InspectorTab;\n onclose?: () => void;\n } = $props();\n\n const feature = $derived(view.feature);\n const editable = $derived(view.editable);\n const layout = $derived(featureLayout(view, settings, sections.length, m.numberLocale));\n const tabs = $derived(\n layout.tabs.map((id) => ({ id, label: id === 'style' ? m.styleTab : m.attributesTab })),\n );\n const current = $derived(tabs.some((t) => t.id === tab) ? tab : tabs[0]?.id);\n const subtitle = $derived(\n [typeLabel(feature.type, m), view.layer?.name, view.hidden ? m.hiddenState : '']\n .filter(Boolean)\n .join(' · '),\n );\n const name = $derived(featureName(feature));\n const attributes = $derived(attributeRows(feature));\n const both = $derived(`${m.styleTab}, ${m.attributesTab}`);\n let bufferOpen = $state(false);\n\n const MEASURE_LABELS: Record<MeasureKey, keyof Messages> = {\n longitude: 'measureLongitude',\n latitude: 'measureLatitude',\n length: 'measureLength',\n area: 'measureArea',\n perimeter: 'measurePerimeter',\n radius: 'measureRadius',\n points: 'measurePoints',\n };\n const measurements = $derived(\n layout.measurements.map((row) => ({ k: m[MEASURE_LABELS[row.key]], v: row.value, mono: true })),\n );\n\n function update(patch: FeaturePatch | null) {\n if (patch) draw.features.update(feature.id, patch);\n }\n\n function toggleHidden() {\n if (view.hidden) draw.hidden.remove(feature.id);\n else draw.hidden.add(feature.id);\n }\n</script>\n\n{#snippet foot()}\n <Footer>\n {#snippet lead()}\n <Button variant=\"danger\" disabled={!editable} onclick={() => draw.selection.delete()}>\n {m.delete}\n </Button>\n {/snippet}\n {#snippet secondary()}\n <Button\n disabled={view.readOnly}\n onclick={() => draw.features.update(feature.id, { locked: !feature.locked })}\n >\n {feature.locked ? m.unlock : m.lock}\n </Button>\n <Button onclick={toggleHidden}>{view.hidden ? m.show : m.hide}</Button>\n {/snippet}\n </Footer>\n{/snippet}\n\n<InspectorFrame\n title={editable ? name : name || typeLabel(feature.type, m)}\n ontitle={editable ? (next) => update(namePatch(next)) : undefined}\n {subtitle}\n {onclose}\n end={foot}\n>\n {#if measurements.length > 0 || layout.description}\n <Block>\n <Stack gap=\"sm\">\n {#if measurements.length > 0}\n <Kv items={measurements} />\n {/if}\n {#if layout.description}\n <Pair label={m.description} top>\n <InlineEdit\n value={layout.description.text}\n placeholder={m.addDescription}\n label={layout.description.text ? m.description : m.addDescription}\n multiline\n editable={layout.description.editable}\n onCommit={(next) => update(descriptionPatch(next))}\n />\n </Pair>\n {/if}\n </Stack>\n </Block>\n {/if}\n {#if tabs.length > 1 && current}\n <Tabs {tabs} {current} label={both} onselect={(id) => (tab = id as InspectorTab)} />\n {/if}\n {#if current === 'style'}\n <StyleFields\n {draw}\n features={[feature]}\n applied={[view.applied]}\n {editable}\n {m}\n {sections}\n />\n {#if layout.buffer}\n <InspectorSection title={m.operations}>\n <Row wrap>\n <Button disabled={!editable} onclick={() => (bufferOpen = true)}>{m.opBuffer}</Button>\n </Row>\n </InspectorSection>\n {/if}\n {:else if current === 'attributes'}\n <AttributeList\n items={attributes}\n readonly={!editable}\n onchange={(index, item) => update(attributePatch(feature, index, item))}\n onadd={editable ? (item) => update(attributeAdd(feature, item)) : undefined}\n onremove={editable ? (index) => update(attributeRemove(feature, index)) : undefined}\n />\n {/if}\n</InspectorFrame>\n\n{#if layout.buffer}\n <BufferDialog bind:open={bufferOpen} {draw} features={[feature]} units={settings.units} {m} />\n{/if}\n","<!--\n SPDX-FileCopyrightText: 2026 SAKAIDA Atsushi\n SPDX-License-Identifier: AGPL-3.0-only\n-->\n<script lang=\"ts\">\n import {\n Button,\n FieldList,\n type FieldSpec,\n Footer,\n InspectorFrame,\n InspectorSection,\n } from '@sakuzu/kata/svelte';\n import type { Group, Layer } from '@sakuzu/maplibre-gl-draw';\n import type { InspectorDraw } from '../inspector/types.js';\n import type { Messages } from '../messages.js';\n\n // GroupInspector: a group in kata's InspectorFrame: its name, changed where it stands, whether\n // it is visible and whether it is locked. The foot takes its features out of it (the group\n // goes) or deletes it with its features.\n let {\n draw,\n group,\n layer,\n readOnly,\n m,\n onclose,\n }: {\n draw: InspectorDraw;\n group: Group;\n /** The layer it is in */\n layer: Layer | undefined;\n readOnly: boolean;\n m: Messages;\n onclose?: () => void;\n } = $props();\n\n const lockedHere = $derived(group.locked || layer?.locked === true);\n const fields = $derived<FieldSpec[]>([\n {\n key: 'visible',\n kind: 'toggle',\n label: m.visibleField,\n value: group.visible,\n disabled: readOnly,\n },\n {\n key: 'locked',\n kind: 'toggle',\n label: m.lockedField,\n value: group.locked,\n disabled: readOnly,\n },\n ]);\n\n function onchange(key: string, value: unknown) {\n if (key === 'visible' || key === 'locked') {\n draw.groups.update(group.id, { [key]: value === true });\n }\n }\n\n function rename(name: string) {\n if (name !== '') draw.groups.update(group.id, { name });\n }\n</script>\n\n{#snippet foot()}\n <Footer>\n {#snippet lead()}\n <Button\n variant=\"danger\"\n disabled={readOnly || lockedHere}\n onclick={() => draw.selection.delete()}\n >\n {m.delete}\n </Button>\n {/snippet}\n {#snippet secondary()}\n <Button disabled={readOnly} onclick={() => draw.selection.ungroup()}>\n {m.ungroupAction}\n </Button>\n {/snippet}\n </Footer>\n{/snippet}\n\n<InspectorFrame\n title={group.name}\n ontitle={readOnly || lockedHere ? undefined : rename}\n subtitle={[m.typeGroup, layer?.name].filter(Boolean).join(' · ')}\n {onclose}\n end={foot}\n>\n <InspectorSection title={m.typeGroup}>\n <FieldList {fields} {onchange} />\n </InspectorSection>\n</InspectorFrame>\n","<!--\n SPDX-FileCopyrightText: 2026 SAKAIDA Atsushi\n SPDX-License-Identifier: AGPL-3.0-only\n-->\n<script lang=\"ts\">\n import {\n Button,\n FieldList,\n type FieldSpec,\n Footer,\n InspectorFrame,\n InspectorRow,\n InspectorSection,\n ReadValue,\n } from '@sakuzu/kata/svelte';\n import type { Layer, StyleRule } from '@sakuzu/maplibre-gl-draw';\n import type { InspectorDraw } from '../inspector/types.js';\n import type { Messages } from '../messages.js';\n\n // LayerInspector: a layer in kata's InspectorFrame: its name, changed where it stands, its\n // opacity, whether it is visible and whether it is locked. Its style rule is shown and not\n // edited here (an application sets it with draw.layers.update). The foot deletes it, unless it\n // is the only layer.\n let {\n draw,\n layer,\n onlyLayer,\n readOnly,\n m,\n onclose,\n }: {\n draw: InspectorDraw;\n layer: Layer;\n /** Whether it is the only layer of the document, which is not deleted */\n onlyLayer: boolean;\n readOnly: boolean;\n m: Messages;\n onclose?: () => void;\n } = $props();\n\n const fields = $derived<FieldSpec[]>([\n {\n key: 'opacity',\n kind: 'slider',\n label: m.opacityField,\n value: Math.round(layer.opacity * 100),\n min: 0,\n max: 100,\n step: 1,\n unit: '%',\n disabled: readOnly || layer.locked,\n },\n {\n key: 'visible',\n kind: 'toggle',\n label: m.visibleField,\n value: layer.visible,\n disabled: readOnly,\n },\n {\n key: 'locked',\n kind: 'toggle',\n label: m.lockedField,\n value: layer.locked,\n disabled: readOnly,\n },\n ]);\n\n const RULES: Record<StyleRule['kind'], keyof Messages> = {\n single: 'ruleSingle',\n categorical: 'ruleCategorical',\n graduated: 'ruleGraduated',\n continuous: 'ruleContinuous',\n };\n const rule = $derived(layer.styleRule);\n\n function onchange(key: string, value: unknown) {\n if (key === 'opacity' && typeof value === 'number') {\n draw.layers.update(layer.id, { opacity: Math.min(1, Math.max(0, value / 100)) });\n } else if (key === 'visible' || key === 'locked') {\n draw.layers.update(layer.id, { [key]: value === true });\n }\n }\n\n function rename(name: string) {\n if (name !== '') draw.layers.update(layer.id, { name });\n }\n</script>\n\n{#snippet foot()}\n <Footer>\n {#snippet lead()}\n <Button\n variant=\"danger\"\n disabled={readOnly || onlyLayer || layer.locked}\n onclick={() => draw.selection.delete()}\n >\n {m.deleteLayer}\n </Button>\n {/snippet}\n </Footer>\n{/snippet}\n\n<InspectorFrame\n title={layer.name}\n ontitle={readOnly || layer.locked ? undefined : rename}\n subtitle={m.typeLayer}\n {onclose}\n end={foot}\n>\n <InspectorSection title={m.typeLayer}>\n <FieldList {fields} {onchange} />\n </InspectorSection>\n <InspectorSection title={m.styleRule}>\n <InspectorRow label={m.ruleKind} hint={m.ruleHint}>\n <ReadValue value={rule ? m[RULES[rule.kind]] : m.ruleNone} muted={!rule} />\n </InspectorRow>\n {#if rule && rule.kind !== 'single'}\n <InspectorRow label={m.ruleProperty}>\n <ReadValue value={rule.property} mono />\n </InspectorRow>\n {/if}\n </InspectorSection>\n</InspectorFrame>\n","<!--\n SPDX-FileCopyrightText: 2026 SAKAIDA Atsushi\n SPDX-License-Identifier: AGPL-3.0-only\n-->\n<script lang=\"ts\">\n import { Button, Row, SelectionSummary } from '@sakuzu/kata/svelte';\n import type { Feature, FeatureStyleResolved } from '@sakuzu/maplibre-gl-draw';\n import { applicableOperations, type OperationId, runOperation } from '../inspector/operations.js';\n import type {\n InspectorDraw,\n InspectorSectionSpec,\n InspectorSettings,\n } from '../inspector/types.js';\n import { kindCounts } from '../inspector/view.js';\n import { fillWord, type Messages } from '../messages.js';\n import BufferDialog from './BufferDialog.svelte';\n import StyleFields from './StyleFields.svelte';\n\n // SelectionInspector: several features in kata's SelectionSummary. It counts them by type,\n // shows the fields of the style they share (a field whose values differ is mixed) and the\n // sections of the application that apply to all of them, and offers the operations that apply,\n // grouping and deleting.\n let {\n draw,\n features,\n applied,\n editable,\n readOnly,\n m,\n settings,\n sections = [],\n onclose,\n }: {\n draw: InspectorDraw;\n features: Feature[];\n applied: (FeatureStyleResolved | undefined)[];\n editable: boolean;\n readOnly: boolean;\n m: Messages;\n settings: InspectorSettings;\n sections?: InspectorSectionSpec[];\n onclose?: () => void;\n } = $props();\n\n const operations = $derived(settings.operations ? applicableOperations(features) : []);\n const oneLayer = $derived(features.every((f) => f.layerId === features[0]?.layerId));\n let bufferOpen = $state(false);\n\n const LABELS: Record<OperationId, keyof Messages> = {\n union: 'opUnion',\n intersection: 'opIntersection',\n difference: 'opDifference',\n split: 'opSplit',\n buffer: 'opBuffer',\n };\n\n function run(op: OperationId) {\n if (op === 'buffer') {\n bufferOpen = true;\n return;\n }\n try {\n runOperation(draw, op, features);\n } catch (error) {\n console.error(error);\n }\n }\n</script>\n\n{#snippet fields()}\n <StyleFields {draw} {features} {applied} {editable} {m} {sections} />\n{/snippet}\n\n{#snippet actions()}\n <Row wrap>\n {#each operations as op (op)}\n <Button disabled={!editable} onclick={() => run(op)}>{m[LABELS[op]]}</Button>\n {/each}\n <Button disabled={readOnly || !oneLayer} onclick={() => draw.selection.group()}>\n {m.groupAction}\n </Button>\n <Button variant=\"danger\" disabled={readOnly} onclick={() => draw.selection.delete()}>\n {m.delete}\n </Button>\n </Row>\n{/snippet}\n\n<SelectionSummary\n count={features.length}\n kinds={kindCounts(features, m)}\n title={fillWord(m.selectedCount, { count: features.length })}\n {fields}\n {actions}\n {onclose}\n/>\n\n{#if operations.includes('buffer')}\n <BufferDialog bind:open={bufferOpen} {draw} {features} units={settings.units} {m} />\n{/if}\n","<!--\n SPDX-FileCopyrightText: 2026 SAKAIDA Atsushi\n SPDX-License-Identifier: AGPL-3.0-only\n-->\n<script lang=\"ts\">\n import { Button, Panel, Row, SelectionSummary, State } from '@sakuzu/kata/svelte';\n import type { Feature } from '@sakuzu/maplibre-gl-draw';\n import { applicableSections } from '../inspector/sections.js';\n import type {\n InspectorDraw,\n InspectorSectionSpec,\n InspectorSettings,\n InspectorTab,\n } from '../inspector/types.js';\n import { INSPECTOR_EVENTS, readView } from '../inspector/view.js';\n import { fillWord, type Messages } from '../messages.js';\n import { type Box, follow } from '../store.js';\n import FeatureInspector from './FeatureInspector.svelte';\n import GroupInspector from './GroupInspector.svelte';\n import LayerInspector from './LayerInspector.svelte';\n import SelectionInspector from './SelectionInspector.svelte';\n\n // Inspector: the panel of what is selected. It keeps nothing of the drawing: what it shows is\n // read from the draw instance (readView) again after each change of the selection, of the\n // document, of what this client hides and of read-only, so a change made anywhere shows at\n // once. Nothing selected shows an empty state; one feature its inspector, several features a\n // summary, a layer or a group theirs. Every change calls the public API of the draw instance.\n let {\n draw,\n messages,\n settings,\n sections,\n onclose,\n }: {\n draw: InspectorDraw;\n messages: Box<Messages>;\n settings: InspectorSettings;\n /** The sections the application added */\n sections: Box<InspectorSectionSpec[]>;\n /** Called by the close button; clears the selection when left out */\n onclose?: () => void;\n } = $props();\n\n const view = $derived(follow(draw, INSPECTOR_EVENTS, () => readView(draw)));\n const v = $derived(view.get());\n const m = $derived(messages.get());\n // The tab chosen last, kept from one feature to the next\n let tab = $state<InspectorTab>('style');\n\n const close = () => (onclose ? onclose() : draw.selection.clear());\n const applying = (features: Feature[]) => applicableSections(sections.get(), features);\n</script>\n\n<div class=\"inspector\" data-role=\"inspector\">\n {#if v.kind === 'feature'}\n <FeatureInspector\n {draw}\n view={v}\n {m}\n {settings}\n sections={applying([v.feature])}\n bind:tab\n onclose={close}\n />\n {:else if v.kind === 'features'}\n <SelectionInspector\n {draw}\n features={v.features}\n applied={v.applied}\n editable={v.editable}\n readOnly={v.readOnly}\n {m}\n {settings}\n sections={applying(v.features)}\n onclose={close}\n />\n {:else if v.kind === 'layer'}\n <LayerInspector\n {draw}\n layer={v.layer}\n onlyLayer={v.onlyLayer}\n readOnly={v.readOnly}\n {m}\n onclose={close}\n />\n {:else if v.kind === 'group'}\n <GroupInspector {draw} group={v.group} layer={v.layer} readOnly={v.readOnly} {m} onclose={close} />\n {:else if v.kind === 'items'}\n {@const label = v.type === 'layer' ? m.typeLayer : m.typeGroup}\n <SelectionSummary\n count={v.count}\n kinds={[{ label, count: v.count }]}\n title={fillWord(m.selectedCount, { count: v.count })}\n onclose={close}\n >\n {#snippet actions()}\n <Row wrap>\n <Button variant=\"danger\" disabled={v.readOnly} onclick={() => draw.selection.delete()}>\n {m.delete}\n </Button>\n </Row>\n {/snippet}\n </SelectionSummary>\n {:else}\n <Panel label={m.inspector}>\n <State text={m.nothingSelected} note={m.nothingSelectedNote} />\n </Panel>\n {/if}\n</div>\n\n<style>\n .inspector {\n display: flex;\n min-width: 0;\n min-height: 0;\n height: 100%;\n max-height: 100%;\n }\n</style>\n","<!--\n@lucide/svelte v1.49.0 - ISC\n\nThis source code is licensed under the ISC license.\nSee the LICENSE file in the root directory of this source tree.\n-->\n\n\n<script lang=\"ts\">import Icon from '../Icon.svelte';\nlet props = $props();\nconst iconData = { \"name\": \"pen-line\", \"size\": 24, \"node\": [[\"path\", { \"d\": \"M13 21h8\" }], [\"path\", { \"d\": \"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z\" }]], \"aliases\": [\"edit-3\"] };\n</script>\n\n<!--\n@component\n\nLucide SVG icon component, renders SVG Element with children.\n\n@preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMTMgMjFoOCIgLz4KICA8cGF0aCBkPSJNMjEuMTc0IDYuODEyYTEgMSAwIDAgMC0zLjk4Ni0zLjk4N0wzLjg0MiAxNi4xNzRhMiAyIDAgMCAwLS41LjgzbC0xLjMyMSA0LjM1MmEuNS41IDAgMCAwIC42MjMuNjIybDQuMzUzLTEuMzJhMiAyIDAgMCAwIC44My0uNDk3eiIgLz4KPC9zdmc+Cg==) - https://lucide.dev/icons/pen-line\n@see https://lucide.dev/guide/packages/lucide-svelte - Documentation\n-->\n\n<Icon {...props} icon={iconData} />\n","<!--\n@lucide/svelte v1.49.0 - ISC\n\nThis source code is licensed under the ISC license.\nSee the LICENSE file in the root directory of this source tree.\n-->\n\n\n<script lang=\"ts\">import Icon from '../Icon.svelte';\nlet props = $props();\nconst iconData = { \"name\": \"group\", \"size\": 24, \"node\": [[\"path\", { \"d\": \"M3 7V5c0-1.1.9-2 2-2h2\" }], [\"path\", { \"d\": \"M17 3h2c1.1 0 2 .9 2 2v2\" }], [\"path\", { \"d\": \"M21 17v2c0 1.1-.9 2-2 2h-2\" }], [\"path\", { \"d\": \"M7 21H5c-1.1 0-2-.9-2-2v-2\" }], [\"rect\", { \"width\": \"7\", \"height\": \"5\", \"x\": \"7\", \"y\": \"7\", \"rx\": \"1\" }], [\"rect\", { \"width\": \"7\", \"height\": \"5\", \"x\": \"10\", \"y\": \"12\", \"rx\": \"1\" }]] };\n</script>\n\n<!--\n@component\n\nLucide SVG icon component, renders SVG Element with children.\n\n@preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMyA3VjVjMC0xLjEuOS0yIDItMmgyIiAvPgogIDxwYXRoIGQ9Ik0xNyAzaDJjMS4xIDAgMiAuOSAyIDJ2MiIgLz4KICA8cGF0aCBkPSJNMjEgMTd2MmMwIDEuMS0uOSAyLTIgMmgtMiIgLz4KICA8cGF0aCBkPSJNNyAyMUg1Yy0xLjEgMC0yLS45LTItMnYtMiIgLz4KICA8cmVjdCB3aWR0aD0iNyIgaGVpZ2h0PSI1IiB4PSI3IiB5PSI3IiByeD0iMSIgLz4KICA8cmVjdCB3aWR0aD0iNyIgaGVpZ2h0PSI1IiB4PSIxMCIgeT0iMTIiIHJ4PSIxIiAvPgo8L3N2Zz4K) - https://lucide.dev/icons/group\n@see https://lucide.dev/guide/packages/lucide-svelte - Documentation\n-->\n\n<Icon {...props} icon={iconData} />\n","<!--\n@lucide/svelte v1.49.0 - ISC\n\nThis source code is licensed under the ISC license.\nSee the LICENSE file in the root directory of this source tree.\n-->\n\n\n<script lang=\"ts\">import Icon from '../Icon.svelte';\nlet props = $props();\nconst iconData = { \"name\": \"shapes\", \"size\": 24, \"node\": [[\"path\", { \"d\": \"M8.3 10a.7.7 0 0 1-.626-1.079L11.4 3a.7.7 0 0 1 1.198-.043L16.3 8.9a.7.7 0 0 1-.572 1.1Z\" }], [\"rect\", { \"x\": \"3\", \"y\": \"14\", \"width\": \"7\", \"height\": \"7\", \"rx\": \"1\" }], [\"circle\", { \"cx\": \"17.5\", \"cy\": \"17.5\", \"r\": \"3.5\" }]] };\n</script>\n\n<!--\n@component\n\nLucide SVG icon component, renders SVG Element with children.\n\n@preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNOC4zIDEwYS43LjcgMCAwIDEtLjYyNi0xLjA3OUwxMS40IDNhLjcuNyAwIDAgMSAxLjE5OC0uMDQzTDE2LjMgOC45YS43LjcgMCAwIDEtLjU3MiAxLjFaIiAvPgogIDxyZWN0IHg9IjMiIHk9IjE0IiB3aWR0aD0iNyIgaGVpZ2h0PSI3IiByeD0iMSIgLz4KICA8Y2lyY2xlIGN4PSIxNy41IiBjeT0iMTcuNSIgcj0iMy41IiAvPgo8L3N2Zz4K) - https://lucide.dev/icons/shapes\n@see https://lucide.dev/guide/packages/lucide-svelte - Documentation\n-->\n\n<Icon {...props} icon={iconData} />\n","// SPDX-FileCopyrightText: 2026 SAKAIDA Atsushi\n// SPDX-License-Identifier: AGPL-3.0-only\n\n// The nodes of the layer tree, built from the draw instance each time it changes.\n//\n// The tree reads like a stack: the front comes first. Core lists everything from the back (the\n// stacking order of the layers, the items of a layer, the features of a group), so every list is\n// reversed here, and a move in the tree is converted back (move.ts).\n//\n// A node is one of three kinds: a layer, a group or a feature. Its `data` is the entity of core as\n// it was read, so the handlers of the panel know what was pressed without reading it again.\n\nimport Circle from '@lucide/svelte/icons/circle';\nimport Group from '@lucide/svelte/icons/group';\nimport Layers from '@lucide/svelte/icons/layers';\nimport Shapes from '@lucide/svelte/icons/shapes';\nimport type { IconComponent, IconSource, TreeNode } from '@sakuzu/kata/svelte';\nimport {\n type Group as DrawGroup,\n type Feature,\n type FeatureStyleResolved,\n getStyleRuleChannel,\n type Layer,\n type Selection,\n type SelectionType,\n} from '@sakuzu/maplibre-gl-draw';\nimport type { Messages } from '../messages.js';\n\n/** The kinds of the nodes, which are the types of the selection of core */\nexport type NodeKind = SelectionType;\n\n/** A node of the tree, with the entity of core it was built from */\nexport type LayerTreeNode = TreeNode & { kind: NodeKind; data: Layer | DrawGroup | Feature };\n\n/** What building the nodes reads from the draw instance */\nexport interface TreeSource {\n readonly layers: {\n get(id: string): Layer | undefined;\n getOrder(): readonly string[];\n };\n readonly groups: { get(id: string): DrawGroup | undefined };\n readonly features: {\n get(id: string): Feature | undefined;\n getAppliedStyle(id: string): FeatureStyleResolved | undefined;\n };\n /** What this client hides; a node it hides shows as hidden */\n readonly hidden?: { has(id: string): boolean };\n}\n\n/** Whether a node shows as visible: visible in the document, and not hidden by this client */\nfunction shown(source: TreeSource, entity: { id: string; visible: boolean }): boolean {\n return entity.visible && !source.hidden?.has(entity.id);\n}\n\n/** What the tree shows */\nexport interface TreeOptions {\n /** Whether the features show under the layers and the groups */\n features: boolean;\n}\n\n/** The icons of the built-in feature types: kata's drawing glyphs where it has them */\nconst TYPE_ICONS: Readonly<Record<string, IconSource>> = Object.freeze({\n Point: 'point',\n MultiPoint: 'point',\n LineString: 'polyline',\n MultiLineString: 'polyline',\n Polygon: 'polygon',\n MultiPolygon: 'polygon',\n Circle: Circle as unknown as IconComponent,\n Freehand: 'pencil',\n Image: 'image',\n});\n\n/** The icon of a layer and of a group */\nexport const LAYER_ICON = Layers as unknown as IconComponent;\nexport const GROUP_ICON = Group as unknown as IconComponent;\n/** The icon of a feature of a custom type */\nconst CUSTOM_ICON = Shapes as unknown as IconComponent;\n\n/** The icon of a feature type */\nexport function typeIcon(type: string): IconSource {\n return TYPE_ICONS[type] ?? CUSTOM_ICON;\n}\n\n/** The words for each built-in feature type, from the set of the interface */\nexport function typeLabel(type: string, m: Messages): string {\n switch (type) {\n case 'Point':\n return m.point;\n case 'MultiPoint':\n return m.multiPoint;\n case 'LineString':\n return m.line;\n case 'MultiLineString':\n return m.multiLine;\n case 'Polygon':\n return m.polygon;\n case 'MultiPolygon':\n return m.multiPolygon;\n case 'Circle':\n return m.circle;\n case 'Freehand':\n return m.freehand;\n case 'Image':\n return m.image;\n default:\n // A custom type is named by the application\n return type;\n }\n}\n\n/**\n * The name of a feature: `properties.name` (the name the interface shows and edits, by the\n * convention of the interface; core has no name of its own for a feature), or the word of its\n * type when it has none\n */\nexport function featureName(feature: Feature, m: Messages): string {\n const name = feature.properties?.name;\n if (typeof name === 'string' && name.trim() !== '') return name;\n if (typeof name === 'number') return String(name);\n return typeLabel(feature.type, m);\n}\n\n/**\n * The color of the mark of a feature: the color it is drawn with, of the part a style rule colors\n * (the marker of a point, the line of a line, the fill of an area). An image has none\n */\nexport function featureColor(\n feature: Feature,\n style: FeatureStyleResolved | undefined,\n): string | undefined {\n if (!style || feature.type === 'Image') return undefined;\n const channel = getStyleRuleChannel(feature.type);\n if (channel === 'point') return style.pointColor;\n if (channel === 'stroke') return style.strokeColor;\n return style.fillColor;\n}\n\nfunction featureNode(source: TreeSource, feature: Feature, m: Messages): LayerTreeNode {\n return {\n id: feature.id,\n kind: 'feature',\n name: featureName(feature, m),\n icon: typeIcon(feature.type),\n iconColor: featureColor(feature, source.features.getAppliedStyle(feature.id)),\n visible: shown(source, feature),\n locked: feature.locked,\n data: feature,\n };\n}\n\n/**\n * The nodes of the tree: the layers from the front, each with its groups and features from the\n * front, and the features of each group from the front.\n *\n * An ID of the stacking order that is not a layer (a dataset placed among the layers) is left\n * out, and so is an item of a layer that is neither a group nor a feature. A feature shows once,\n * under its group when it is in one.\n */\nexport function buildNodes(\n source: TreeSource,\n m: Messages,\n options: TreeOptions = { features: true },\n): LayerTreeNode[] {\n const seen = new Set<string>();\n const nodes: LayerTreeNode[] = [];\n for (const layerId of [...source.layers.getOrder()].reverse()) {\n const layer = source.layers.get(layerId);\n if (!layer || seen.has(layer.id)) continue;\n seen.add(layer.id);\n const children: LayerTreeNode[] = [];\n for (const itemId of [...layer.items].reverse()) {\n if (seen.has(itemId)) continue;\n const group = source.groups.get(itemId);\n if (group) {\n seen.add(group.id);\n const node: LayerTreeNode = {\n id: group.id,\n kind: 'group',\n name: group.name,\n icon: GROUP_ICON,\n visible: shown(source, group),\n locked: group.locked,\n data: group,\n };\n if (options.features) {\n node.children = [];\n for (const featureId of [...group.featureIds].reverse()) {\n const feature = seen.has(featureId) ? undefined : source.features.get(featureId);\n if (!feature) continue;\n seen.add(feature.id);\n node.children.push(featureNode(source, feature, m));\n }\n }\n children.push(node);\n continue;\n }\n if (!options.features) continue;\n const feature = source.features.get(itemId);\n // A feature in a group shows under the group\n if (!feature || (feature.groupId !== undefined && source.groups.get(feature.groupId))) {\n continue;\n }\n seen.add(feature.id);\n children.push(featureNode(source, feature, m));\n }\n nodes.push({\n id: layer.id,\n kind: 'layer',\n name: layer.name,\n icon: LAYER_ICON,\n visible: shown(source, layer),\n locked: layer.locked,\n children,\n data: layer,\n });\n }\n return nodes;\n}\n\n/** Every node of the tree by its ID, with the ID of its parent */\nexport function indexNodes(\n nodes: readonly LayerTreeNode[],\n): Map<string, { node: LayerTreeNode; parentId: string | null }> {\n const index = new Map<string, { node: LayerTreeNode; parentId: string | null }>();\n const walk = (list: readonly TreeNode[], parentId: string | null) => {\n for (const node of list as LayerTreeNode[]) {\n index.set(node.id, { node, parentId });\n if (node.children) walk(node.children, node.id);\n }\n };\n walk(nodes, null);\n return index;\n}\n\n/** The rows the tree shows as selected: what draw has selected, of any of the three types */\nexport function selectedIds(selection: Selection): string[] {\n return selection.type ? [...selection.ids] : [];\n}\n\n/**\n * What a press in the tree selects in draw, which holds one type at a time: the IDs of the new\n * selection that are of the kind of the node pressed last. With no node pressed (a key, a range\n * without a pointer), the kind of the last ID.\n *\n * @returns The type and the IDs, or null to clear the selection\n */\nexport function selectionOf(\n ids: readonly string[],\n kindOf: (id: string) => NodeKind | undefined,\n pressed?: NodeKind,\n): { type: NodeKind; ids: string[] } | null {\n const known = ids.filter((id) => kindOf(id) !== undefined);\n if (known.length === 0) return null;\n const type = pressed ?? (kindOf(known[known.length - 1]) as NodeKind);\n const same = known.filter((id) => kindOf(id) === type);\n return same.length > 0 ? { type, ids: same } : null;\n}\n\n/**\n * Whether a node may be dropped into a parent (null for the root): a layer only at the root, a\n * group only into a layer, a feature into a layer or a group\n */\nexport function canDropInto(node: TreeNode, parent: TreeNode | null): boolean {\n if (node.kind === 'layer') return parent === null;\n if (node.kind === 'group') return parent?.kind === 'layer';\n if (node.kind === 'feature') return parent?.kind === 'layer' || parent?.kind === 'group';\n return false;\n}\n\n/**\n * Whether the selected features can make a new group: two or more, all in one layer\n */\nexport function canGroup(\n selection: Selection,\n getFeature: (id: string) => Feature | undefined,\n): boolean {\n if (selection.type !== 'feature' || selection.ids.length < 2) return false;\n let layerId: string | undefined;\n for (const id of selection.ids) {\n const feature = getFeature(id);\n if (!feature) return false;\n if (layerId === undefined) layerId = feature.layerId;\n else if (feature.layerId !== layerId) return false;\n }\n return true;\n}\n","// SPDX-FileCopyrightText: 2026 SAKAIDA Atsushi\n// SPDX-License-Identifier: AGPL-3.0-only\n\n// A drop in the layer tree, converted to a call of core.\n//\n// The tree reports the node, its new parent and its index among the parent's children after the\n// move, counted from the front (the top of the tree). Core counts from the back, and its lists\n// can hold IDs the tree does not show (a dataset in the stacking order; the features of a layer\n// when the tree shows only the groups). So the index is not mirrored by arithmetic: the node is\n// placed just in front of the node that is behind it in the tree (the one below it after the\n// move), at that node's position in core's list plus one, or at the back (0) when nothing in the\n// tree is behind it.\n//\n// - a layer: `layers.reorder` with the layers in their new order from the back. The entries of\n// the stacking order that are not layers are left out of it, and core keeps their positions\n// - a group: `groups.move` to `{ layerId, index }`\n// - a feature: `features.move` to `{ layerId, index }`, or to `{ groupId, index }` in a group\n\nimport type { TreeMove } from '@sakuzu/kata/svelte';\nimport type { Group, Layer, MoveTarget } from '@sakuzu/maplibre-gl-draw';\nimport { canDropInto, indexNodes, type LayerTreeNode } from './tree.js';\n\n/** The call of core a drop makes */\nexport type MovePlan =\n | { kind: 'layers'; order: string[] }\n | { kind: 'group'; id: string; to: MoveTarget }\n | { kind: 'feature'; id: string; to: MoveTarget };\n\n/** A list with an ID taken out and put back at an index */\nfunction placed(ids: readonly string[], id: string, index: number): string[] {\n const out = ids.filter((x) => x !== id);\n out.splice(Math.max(0, Math.min(index, out.length)), 0, id);\n return out;\n}\n\n/**\n * The position in a list of core, from the back, of an item that goes just in front of `behind`\n * (a node of the tree, or undefined when the item goes to the back)\n */\nexport function coreIndex(\n coreList: readonly string[],\n id: string,\n behind: string | undefined,\n): number {\n if (behind === undefined) return 0;\n const at = coreList.filter((x) => x !== id).indexOf(behind);\n return at === -1 ? 0 : at + 1;\n}\n\n/**\n * The call of core for a drop in the tree\n *\n * @param move - What the tree reported: the node, its new parent (null for the root) and its\n * index among the parent's children after the move, from the front\n * @param nodes - The nodes the tree showed when the node was dropped\n * @returns The call, or null when the drop is not one the tree allows\n */\nexport function planMove(move: TreeMove, nodes: readonly LayerTreeNode[]): MovePlan | null {\n const index = indexNodes(nodes);\n const at = index.get(move.id);\n if (!at) return null;\n const parent = move.parentId === null ? null : (index.get(move.parentId)?.node ?? null);\n if (move.parentId !== null && !parent) return null;\n if (!canDropInto(at.node, parent)) return null;\n\n if (at.node.kind === 'layer') {\n const front = placed(\n nodes.map((n) => n.id),\n move.id,\n move.index,\n );\n return { kind: 'layers', order: front.reverse() };\n }\n if (!parent) return null;\n\n // The children of the new parent from the front, after the move; the one after the node is\n // the one behind it\n const shown = placed(\n (parent.children ?? []).map((n) => n.id),\n move.id,\n move.index,\n );\n const behind = shown[shown.indexOf(move.id) + 1];\n if (parent.kind === 'layer') {\n const layer = parent.data as Layer;\n const to = { layerId: layer.id, index: coreIndex(layer.items, move.id, behind) };\n return at.node.kind === 'group'\n ? { kind: 'group', id: move.id, to }\n : { kind: 'feature', id: move.id, to };\n }\n const group = parent.data as Group;\n return {\n kind: 'feature',\n id: move.id,\n to: { groupId: group.id, index: coreIndex(group.featureIds, move.id, behind) },\n };\n}\n","<!--\n SPDX-FileCopyrightText: 2026 SAKAIDA Atsushi\n SPDX-License-Identifier: AGPL-3.0-only\n-->\n<script lang=\"ts\">\n import PenLine from '@lucide/svelte/icons/pen-line';\n import {\n Icon,\n type IconComponent,\n LayerTree,\n Markbox,\n type MenuModel,\n Swatch,\n type TreeMove,\n type TreeNode,\n } from '@sakuzu/kata/svelte';\n import type { Feature } from '@sakuzu/maplibre-gl-draw';\n import type { Snippet } from 'svelte';\n import { planMove } from '../layers/move.js';\n import {\n buildNodes,\n canDropInto,\n canGroup,\n indexNodes,\n type NodeKind,\n selectedIds,\n selectionOf,\n } from '../layers/tree.js';\n import type { Messages } from '../messages.js';\n import { type Box, follow } from '../store.js';\n import type { LayerPanelDraw } from '../types.js';\n\n // LayerPanel: kata's LayerTree of the layers, their groups and their features, from the front.\n //\n // It keeps nothing of the drawing. The nodes are built from draw again on document.changed,\n // hidden.changed and options.changed, the selected rows are draw.selection.get(), read again on selection.changed,\n // and the active layer is draw.layers.getActive(). Every action calls the public API of draw:\n // the eye `update({ visible })` (and shows again what this client hid), the lock\n // `update({ locked })`, renaming the name (`properties.name` for a feature), a drop\n // `layers.reorder`, `groups.move` or `features.move`, a press `selection.set` (and\n // `layers.setActive` for a layer), the add menu `layers.create` and `selection.group`.\n let {\n draw,\n messages,\n features = true,\n add = true,\n reorder = true,\n }: {\n draw: LayerPanelDraw;\n messages: Box<Messages>;\n /** Whether the features show under the layers and the groups */\n features?: boolean;\n /** Whether the add menu shows */\n add?: boolean;\n /** Whether the rows can be dragged */\n reorder?: boolean;\n } = $props();\n\n const m = $derived(messages.get());\n const tree = $derived(\n // options.changed: the default look of each type gives the color of the marks\n follow(draw, ['document.changed', 'hidden.changed', 'options.changed'], () =>\n buildNodes(draw, messages.get(), { features }),\n ),\n );\n const selection = $derived(follow(draw, ['selection.changed'], () => draw.selection.get()));\n // Core has no event for a change of the active layer alone: it is read again on a change of the\n // document, and after the panel changes it\n const active = $derived(\n follow(draw, ['document.changed'], () => draw.layers.getActive()?.id ?? null),\n );\n\n const nodes = $derived(tree.get());\n const index = $derived(indexNodes(nodes));\n const selected = $derived(selectedIds(selection.get()));\n const activeId = $derived(active.get());\n\n // The groups that are closed; every other group is open, so a new layer opens\n let collapsed = $state<string[]>([]);\n const expanded = $derived(\n [...index.values()]\n .filter(({ node }) => node.children && !collapsed.includes(node.id))\n .map(({ node }) => node.id),\n );\n function setExpanded(ids: string[]) {\n const open = new Set(ids);\n collapsed = [...index.values()]\n .filter(({ node }) => node.children && !open.has(node.id))\n .map(({ node }) => node.id);\n }\n // What is selected elsewhere (on the map) shows: the groups around it open\n $effect(() => {\n const around = new Set<string>();\n for (const id of selected) {\n for (let p = index.get(id)?.parentId ?? null; p; p = index.get(p)?.parentId ?? null) {\n around.add(p);\n }\n }\n if (around.size === 0) return;\n const next = collapsed.filter((id) => !around.has(id));\n if (next.length !== collapsed.length) collapsed = next;\n });\n\n const addMenu = $derived<MenuModel[] | undefined>(\n add\n ? [\n { id: 'layer', label: m.newLayer },\n {\n id: 'group',\n label: m.newGroup,\n disabled: !canGroup(selection.get(), (id) => draw.features.get(id)),\n },\n ]\n : undefined,\n );\n\n const kindOf = (id: string) => index.get(id)?.node.kind as NodeKind | undefined;\n\n // The kind of the row pressed last, read before the tree reports the new selection\n let pressed: { id: string; kind: NodeKind } | undefined;\n function onclickcapture(e: MouseEvent) {\n const item = (e.target as Element | null)?.closest?.('[data-sortable-item]');\n const id = item?.getAttribute('data-id');\n const kind = id ? kindOf(id) : undefined;\n pressed = id && kind ? { id, kind } : undefined;\n }\n\n function onselect(ids: string[]) {\n const last = pressed;\n pressed = undefined;\n const next = selectionOf(ids, kindOf, last?.kind);\n if (!next) {\n draw.selection.clear();\n return;\n }\n draw.selection.set(next.type, next.ids);\n if (next.type === 'layer') {\n const layerId = last?.kind === 'layer' ? last.id : next.ids[next.ids.length - 1];\n draw.layers.setActive(layerId);\n active.refresh();\n }\n }\n\n function onvisible(id: string, visible: boolean) {\n const kind = kindOf(id);\n if (!kind) return;\n if (visible && draw.hidden.has(id)) draw.hidden.remove(id);\n const entity = index.get(id)?.node.data as { visible: boolean } | undefined;\n if (entity?.visible === visible) return;\n if (kind === 'layer') draw.layers.update(id, { visible });\n else if (kind === 'group') draw.groups.update(id, { visible });\n else draw.features.update(id, { visible });\n }\n\n function onlock(id: string, locked: boolean) {\n const kind = kindOf(id);\n if (kind === 'layer') draw.layers.update(id, { locked });\n else if (kind === 'group') draw.groups.update(id, { locked });\n else if (kind === 'feature') draw.features.update(id, { locked });\n }\n\n function onrename(id: string, value: string) {\n const kind = kindOf(id);\n const name = value.trim();\n if (kind === 'feature') {\n // An empty name removes it: the feature is named by its type again\n const feature = index.get(id)?.node.data as Feature;\n if ((feature.properties?.name ?? '') === name) return;\n draw.features.update(id, { properties: { name: name === '' ? undefined : name } });\n return;\n }\n if (name === '') return;\n if (kind === 'layer') draw.layers.update(id, { name });\n else if (kind === 'group') draw.groups.update(id, { name });\n }\n\n function onmove(move: TreeMove) {\n const plan = planMove(move, nodes);\n if (!plan) return;\n if (plan.kind === 'layers') draw.layers.reorder(plan.order);\n else if (plan.kind === 'group') draw.groups.move(plan.id, plan.to);\n else draw.features.move(plan.id, plan.to);\n }\n\n function onadd(id: string) {\n if (id === 'layer') {\n const layer = draw.layers.create({});\n if (layer) {\n draw.layers.setActive(layer.id);\n active.refresh();\n }\n } else if (id === 'group') {\n draw.selection.group();\n }\n }\n\n const ACTIVE_ICON = PenLine as unknown as IconComponent;\n</script>\n\n{#snippet row(node: TreeNode, name: Snippet<[TreeNode]>)}\n {#if node.icon}\n <Markbox>\n {#if node.iconColor}\n <Swatch shape=\"icon\" icon={node.icon} color={node.iconColor} />\n {:else}\n <Icon name={node.icon} />\n {/if}\n </Markbox>\n {/if}\n {@render name(node)}\n {#if node.kind === 'layer' && node.id === activeId}\n <span class=\"active\" role=\"img\" aria-label={m.activeLayer} title={m.activeLayer}>\n <Icon name={ACTIVE_ICON} tone=\"blue\" />\n </span>\n {/if}\n{/snippet}\n\n<div class=\"layer-panel\" data-role=\"layer-panel\" onclickcapture={onclickcapture}>\n <LayerTree\n label={m.layers}\n {nodes}\n head={add}\n bind:expanded={() => expanded, setExpanded}\n bind:selected={() => selected, () => {}}\n {onselect}\n {onvisible}\n {onlock}\n {onrename}\n onmove={reorder ? onmove : undefined}\n canDrop={canDropInto}\n {addMenu}\n {onadd}\n addLabel={m.add}\n {row}\n />\n</div>\n\n<style>\n .layer-panel {\n display: flex;\n flex-direction: column;\n min-width: 0;\n }\n .active {\n display: inline-flex;\n flex: none;\n }\n</style>\n","// SPDX-FileCopyrightText: 2026 SAKAIDA Atsushi\n// SPDX-License-Identifier: AGPL-3.0-only\n\n// The rows of the legend: for each layer with a style rule, from the front, the rows core derives\n// from the rule (`deriveLegend`), with the words of the interface for the labels that are not\n// values of the data.\n//\n// A layer without a rule has no rows: the colors of its features come from the default look of\n// each type and from the style of each feature, which a legend of the layer cannot sum up.\n\nimport {\n type Messages as CoreMessages,\n deriveLegend,\n type Feature,\n getStyleRuleChannel,\n type Layer,\n type LegendEntry,\n} from '@sakuzu/maplibre-gl-draw';\nimport type { Messages } from '../messages.js';\n\n/** The shape of the swatches of a layer, after the kind of what its features draw */\nexport type LegendShape = 'box' | 'dot' | 'line' | 'area';\n\n/** The legend of one layer */\nexport interface LegendBlock {\n /** The ID of the layer */\n layerId: string;\n /** The name of the layer */\n name: string;\n /** The rows, in the order to show them */\n entries: LegendEntry[];\n /** The shape of the swatches */\n shape: LegendShape;\n}\n\n/** What the legend reads from the draw instance */\nexport interface LegendSource {\n readonly layers: {\n get(id: string): Layer | undefined;\n getOrder(): readonly string[];\n };\n readonly features: { list(filter?: { layerId?: string }): Feature[] };\n}\n\n/** Fills the placeholders `{name}` of a sentence */\nfunction fill(text: string, values: Record<string, string>): string {\n return text.replace(/\\{(\\w+)\\}/g, (all, key: string) => values[key] ?? all);\n}\n\n/** The words of the labels of a legend, for `deriveLegend` */\nexport function legendMessages(m: Messages): Partial<CoreMessages> {\n return {\n legendAll: m.legendAll,\n legendOther: m.legendOther,\n legendBelow: (upper) => fill(m.legendBelow, { upper }),\n legendAtLeast: (lower) => fill(m.legendAtLeast, { lower }),\n legendRange: (lower, upper) => fill(m.legendRange, { lower, upper }),\n };\n}\n\n/**\n * The shape of the swatches for the features of a layer: a dot for points, a line for lines, an\n * area for areas, and a box when they are mixed or there are none\n */\nexport function legendShape(features: readonly Feature[]): LegendShape {\n let channel: string | undefined;\n for (const feature of features) {\n if (feature.type === 'Image') continue;\n const next = getStyleRuleChannel(feature.type);\n if (channel === undefined) channel = next;\n else if (channel !== next) return 'box';\n }\n if (channel === 'point') return 'dot';\n if (channel === 'stroke') return 'line';\n if (channel === 'fill') return 'area';\n return 'box';\n}\n\n/** The legend of every layer with a style rule, from the front */\nexport function legendBlocks(source: LegendSource, m: Messages): LegendBlock[] {\n const words = legendMessages(m);\n const blocks: LegendBlock[] = [];\n for (const id of [...source.layers.getOrder()].reverse()) {\n const layer = source.layers.get(id);\n if (!layer?.styleRule) continue;\n blocks.push({\n layerId: layer.id,\n name: layer.name,\n entries: deriveLegend(layer.styleRule, words),\n shape: legendShape(source.features.list({ layerId: layer.id })),\n });\n }\n return blocks;\n}\n","<!--\n SPDX-FileCopyrightText: 2026 SAKAIDA Atsushi\n SPDX-License-Identifier: AGPL-3.0-only\n-->\n<script lang=\"ts\">\n import { List, ListItem, SectionHeader, Stack, State, Swatch, Text } from '@sakuzu/kata/svelte';\n import { legendBlocks } from '../layers/legend.js';\n import type { Messages } from '../messages.js';\n import { type Box, follow } from '../store.js';\n import type { LegendDraw } from '../types.js';\n\n // Legend: for each layer with a style rule, from the front, its name and the rows core derives\n // from the rule (deriveLegend), each a Swatch and a label. It only reads: the rules are changed\n // with draw.layers.update. It is built again on document.changed.\n let {\n draw,\n messages,\n }: {\n draw: LegendDraw;\n messages: Box<Messages>;\n } = $props();\n\n const m = $derived(messages.get());\n const legend = $derived(\n follow(draw, ['document.changed'], () => legendBlocks(draw, messages.get())),\n );\n const blocks = $derived(legend.get());\n</script>\n\n<div class=\"legend\" data-role=\"legend\">\n {#if blocks.length === 0}\n <State text={m.noLegend} />\n {:else}\n <Stack gap={0}>\n {#each blocks as block (block.layerId)}\n <SectionHeader label={block.name} flush>\n <List label={block.name}>\n {#each block.entries as entry, i (i)}\n <ListItem columns=\"auto minmax(0, 1fr)\" plain>\n <Swatch shape={block.shape} color={entry.color} />\n <Text clamp>{entry.label}</Text>\n </ListItem>\n {/each}\n </List>\n </SectionHeader>\n {/each}\n </Stack>\n {/if}\n</div>\n\n<style>\n .legend {\n display: flex;\n flex-direction: column;\n min-width: 0;\n }\n</style>\n","<!--\n SPDX-FileCopyrightText: 2026 SAKAIDA Atsushi\n SPDX-License-Identifier: AGPL-3.0-only\n-->\n<script lang=\"ts\">\n import { Button, Icon, Panel, Tabs, Toolbar } from '@sakuzu/kata/svelte';\n import type { Messages } from '../messages.js';\n import type { Box } from '../store.js';\n import type { LayerPanelDraw, LeftSettings, LegendDraw } from '../types.js';\n import LayerPanel from './LayerPanel.svelte';\n import Legend from './Legend.svelte';\n\n // LeftPanel: the left region of the interface, a Panel with the layer panel and the legend in\n // two tabs (Tabs in the Toolbar of its head). With one of them only, the head is its title.\n let {\n draw,\n messages,\n settings,\n onclose,\n }: {\n draw: LayerPanelDraw & LegendDraw;\n messages: Box<Messages>;\n settings: LeftSettings;\n /** Shows a close button at the end of the head; called when it is pressed */\n onclose?: () => void;\n } = $props();\n\n const m = $derived(messages.get());\n const tabs = $derived([\n ...(settings.layers ? [{ id: 'layers', label: m.layers }] : []),\n ...(settings.legend ? [{ id: 'legend', label: m.legend }] : []),\n ]);\n // The tab shown; the first one when the one chosen is gone\n let chosen = $state('layers');\n const current = $derived(tabs.some((t) => t.id === chosen) ? chosen : (tabs[0]?.id ?? ''));\n const both = $derived(`${m.layers}, ${m.legend}`);\n // The head: the tabs, or the title of the one view. The layer tree has a head of its own (its\n // title and the add menu), which then stands for the title\n // title. A close button needs the head whatever the view\n const titled = $derived(\n !!onclose || tabs.length > 1 || current !== 'layers' || !settings.layers?.add,\n );\n</script>\n\n{#snippet close()}\n {#if onclose}\n <Button variant=\"ghost\" icon aria-label={m.close} onclick={onclose}>\n <Icon name=\"x\" />\n </Button>\n {/if}\n{/snippet}\n\n{#snippet head()}\n {#if tabs.length > 1}\n <Toolbar rule tail={!!onclose} end={onclose ? close : undefined}>\n <Tabs {tabs} {current} label={both} onselect={(id) => (chosen = id)} />\n </Toolbar>\n {:else}\n <Toolbar title={tabs[0]?.label} rule tail={!!onclose} end={onclose ? close : undefined} />\n {/if}\n{/snippet}\n\n<Panel label={tabs.length === 1 ? tabs[0].label : both} head={titled ? head : undefined}>\n {#if current === 'layers' && settings.layers}\n <LayerPanel {draw} {messages} {...settings.layers} />\n {:else if current === 'legend'}\n <Legend {draw} {messages} />\n {/if}\n</Panel>\n","<!--\n SPDX-FileCopyrightText: 2026 SAKAIDA Atsushi\n SPDX-License-Identifier: AGPL-3.0-only\n-->\n<script lang=\"ts\">\n import {\n Drawbar,\n type DrawbarToggle,\n type DrawbarTool,\n formatShortcut,\n } from '@sakuzu/kata/svelte';\n import type { Messages } from '../messages.js';\n import { type Box, follow } from '../store.js';\n import { BUILTIN_ICONS, DELETE_ID, drawbarTools, SNAPPING_ID, toSpec } from '../tools.js';\n import type { ToolbarDraw, ToolEntry } from '../types.js';\n\n // Toolbar: kata's Drawbar with the tools, the delete button and the snapping switch.\n //\n // It keeps nothing of the drawing: the current tool is the one whose mode is draw.getMode(),\n // read again on mode.changed; the delete button is off while draw.selection.get() is empty,\n // read again on selection.changed; the switch shows draw.options.get(). Pressing a tool calls\n // draw.setMode, delete calls draw.selection.delete and the switch draw.options.update.\n let {\n draw,\n tools,\n messages,\n deletable = true,\n snapping = true,\n keys = false,\n }: {\n draw: ToolbarDraw;\n /** The tools, in order */\n tools: Box<ToolEntry[]>;\n messages: Box<Messages>;\n /** Whether the delete button shows */\n deletable?: boolean;\n /** Whether the snapping switch shows */\n snapping?: boolean;\n /** Whether the tooltips show the keys (when the keyboard shortcuts are on) */\n keys?: boolean;\n } = $props();\n\n const mode = $derived(follow(draw, ['mode.changed'], () => draw.getMode()));\n const selected = $derived(\n follow(draw, ['selection.changed'], () => draw.selection.get().ids.length),\n );\n // Core has no event for a change of the options: the switch reads them again after its own\n // change\n const snapOn = $derived(follow(draw, [], () => draw.options.get().snapping?.enabled !== false));\n\n const m = $derived(messages.get());\n const specs = $derived(tools.get().map((entry) => toSpec(entry, m)));\n const current = $derived.by(() => {\n const now = mode.get();\n return specs.find((spec) => spec.mode === now)?.id;\n });\n const barTools = $derived<DrawbarTool[]>([\n ...drawbarTools(specs, keys),\n ...(deletable\n ? [\n {\n id: DELETE_ID,\n label: m.delete,\n icon: BUILTIN_ICONS[DELETE_ID],\n kbd: keys ? formatShortcut('delete') : undefined,\n group: DELETE_ID,\n tone: 'danger' as const,\n disabled: selected.get() === 0,\n },\n ]\n : []),\n ]);\n const toggles = $derived<DrawbarToggle[]>(\n snapping\n ? [\n {\n id: SNAPPING_ID,\n label: m.snapping,\n icon: BUILTIN_ICONS[SNAPPING_ID],\n on: snapOn.get(),\n onchange: (on: boolean) => {\n draw.options.update({ snapping: { enabled: on } });\n snapOn.refresh();\n },\n },\n ]\n : [],\n );\n\n function onselect(id: string) {\n if (deletable && id === DELETE_ID) {\n draw.selection.delete();\n return;\n }\n const spec = specs.find((s) => s.id === id);\n if (spec) draw.setMode(spec.mode);\n }\n</script>\n\n<Drawbar label={m.toolbar} tools={barTools} {toggles} {current} {onselect} />\n","<!--\n SPDX-FileCopyrightText: 2026 SAKAIDA Atsushi\n SPDX-License-Identifier: AGPL-3.0-only\n-->\n<script lang=\"ts\">\n import Layers from '@lucide/svelte/icons/layers';\n import Moon from '@lucide/svelte/icons/moon';\n import Sun from '@lucide/svelte/icons/sun';\n import {\n Button,\n Floating,\n formatShortcut,\n Icon,\n type IconComponent,\n Shell,\n type ShellLayout,\n type Shortcut,\n } from '@sakuzu/kata/svelte';\n import { tick } from 'svelte';\n import type {\n InspectorDraw,\n InspectorSectionSpec,\n InspectorSettings,\n } from '../inspector/types.js';\n import type { Messages } from '../messages.js';\n import type { Beside } from '../padding.js';\n import { fromMapCanvas, toolbarShortcuts } from '../shortcuts.js';\n import { type Box, follow } from '../store.js';\n import { toSpec } from '../tools.js';\n import type {\n DrawUIDraw,\n LayerPanelDraw,\n LeftSettings,\n LegendDraw,\n ToolbarSettings,\n ToolEntry,\n } from '../types.js';\n import Inspector from './Inspector.svelte';\n import LeftPanel from './LeftPanel.svelte';\n import Toolbar from './Toolbar.svelte';\n\n // DrawUI: kata's Shell laid over the map (overlay). The stage is left empty, so the map shows\n // through and keeps its own pointer and keys; the regions of the shell take the pointer where\n // they are. The keyboard shortcuts are those of the toolbar's buttons. onbeside reports which\n // side regions stand beside the stage, open, once the shell has drawn them, so that the map's\n // padding can follow them. While the left region is closed, a small button floats at the top\n // left of the map to open it again. At the top right, a button switches the theme to the look\n // that is not shown now (light reads the look the root shows, which the theme control keeps).\n let {\n draw,\n tools,\n messages,\n toolbar,\n left,\n shortcuts = true,\n inspector,\n sections,\n onbeside,\n side: sideMode = 'floating',\n light,\n themeToggle = true,\n ontheme,\n }: {\n draw: DrawUIDraw & LayerPanelDraw & LegendDraw & InspectorDraw;\n tools: Box<ToolEntry[]>;\n messages: Box<Messages>;\n toolbar: Box<ToolbarSettings | null>;\n /** The left region: the layer panel and the legend */\n left: Box<LeftSettings | null>;\n /** Whether the keyboard shortcuts are on */\n shortcuts?: boolean;\n /** The inspector on the right, or null when there is none */\n inspector: Box<InspectorSettings | null>;\n /** The sections the application added to the inspector */\n sections: Box<InspectorSectionSpec[]>;\n /** Called with the side regions beside the stage after the layout or the open panes change */\n onbeside?: (beside: Beside) => void;\n /** Where the side regions go on a wide map: floating over it or beside it */\n side?: 'floating' | 'beside';\n /** Whether the root shows the light look now */\n light: Box<boolean>;\n /** Whether the button that switches the theme shows */\n themeToggle?: boolean;\n /** Called with the theme the button switches to */\n ontheme?: (theme: 'light' | 'dark') => void;\n } = $props();\n\n // The inspector is open while something is selected; closing it clears the selection\n const inspectorSettings = $derived(inspector.get());\n const selected = $derived(\n follow(draw, ['selection.changed'], () => draw.selection.get().ids.length > 0),\n );\n\n function closeInspector(open: boolean) {\n if (!open) draw.selection.clear();\n }\n\n const m = $derived(messages.get());\n const bar = $derived(toolbar.get());\n const keys = $derived<Shortcut[]>(\n shortcuts && bar\n ? toolbarShortcuts(\n draw,\n tools.get().map((entry) => toSpec(entry, m)),\n m,\n bar.deletable,\n )\n : [],\n );\n const side = $derived(left.get());\n // The left region is open at first; the shell closes it (Escape, the scrim, the sheet's close\n // button) and Shift+L opens and closes it\n let leftOpen = $state(true);\n const LAYERS_ICON = Layers as unknown as IconComponent;\n const leftKeys = $derived<Shortcut[]>(\n shortcuts && side\n ? [\n {\n key: 'shift+l',\n label: m.toggleLayers,\n group: m.panelsGroup,\n run: () => {\n leftOpen = !leftOpen;\n },\n },\n ]\n : [],\n );\n\n // Where the shell puts the side regions (beside the stage, floating or sheets), by its width\n let layout = $state<ShellLayout | null>(null);\n $effect(() => {\n const now: Beside = {\n left: !!side && leftOpen && layout?.leftMode === 'beside',\n right: !!inspectorSettings && selected.get() && layout?.rightMode === 'beside',\n };\n // Also when the toolbar comes or goes\n void bar;\n if (!onbeside) return;\n const report = onbeside;\n // After the shell has drawn the regions\n tick().then(() => report(now));\n });\n\n // The theme button: the look it switches to, and its place. While the inspector is open\n // floating or beside the map, it sits to the left of the inspector's pane, gap-md from it (the\n // pane is gap-md from the right and a panel wide, or a panel wide at the right edge); a sheet\n // comes from the bottom and leaves it at the corner\n const SUN_ICON = Sun as unknown as IconComponent;\n const MOON_ICON = Moon as unknown as IconComponent;\n const isLight = $derived(light.get());\n const besideInspector = $derived(\n !!inspectorSettings && selected.get() && !!layout && layout.rightMode !== 'sheet',\n );\n\n // Escape on the canvas is core's (it cancels the drawing or clears the selection). Elsewhere,\n // with no pane to close, it clears the selection\n function onescape(e: KeyboardEvent) {\n if (fromMapCanvas(draw, e) || draw.selection.get().ids.length === 0) return false;\n draw.selection.clear();\n }\n</script>\n\n{#snippet bottom()}\n {#if bar}\n <Toolbar\n {draw}\n {tools}\n {messages}\n deletable={bar.deletable}\n snapping={bar.snapping}\n keys={shortcuts}\n />\n {/if}\n{/snippet}\n\n{#snippet leftRegion()}\n {#if side}\n <LeftPanel\n {draw}\n {messages}\n settings={side}\n onclose={() => {\n leftOpen = false;\n }}\n />\n {/if}\n{/snippet}\n\n{#snippet right()}\n {#if inspectorSettings}\n <Inspector {draw} {messages} settings={inspectorSettings} {sections} />\n {/if}\n{/snippet}\n\n<Shell\n overlay\n side={sideMode}\n bind:leftOpen\n bind:rightOpen={() => selected.get(), closeInspector}\n leftLabel={m.layers}\n rightLabel={m.inspector}\n shortcuts={[...keys, ...leftKeys]}\n {onescape}\n onlayout={(next) => {\n layout = next;\n }}\n left={side ? leftRegion : undefined}\n right={inspectorSettings ? right : undefined}\n bottom={bar ? bottom : undefined}\n/>\n\n{#if side && !leftOpen}\n <!-- Outside the shell's regions: the root gives it the pointer (data-role=\"reopen\") -->\n <div data-role=\"reopen\">\n <Floating left=\"md\" top=\"md\">\n <Button\n variant=\"ghost\"\n icon\n aria-label={m.layers}\n shortcut={shortcuts ? formatShortcut('shift+l') : undefined}\n onclick={() => {\n leftOpen = true;\n }}\n >\n <Icon name={LAYERS_ICON} />\n </Button>\n </Floating>\n </div>\n{/if}\n\n{#if themeToggle}\n <!-- Outside the shell's regions: the root gives it the pointer (data-role=\"theme\") -->\n <div data-role=\"theme\">\n <Floating\n right={besideInspector ? 'calc(var(--kata-width-panel) + var(--kata-gap-md) * 2)' : 'md'}\n top=\"md\"\n >\n <Button\n variant=\"ghost\"\n icon\n aria-label={isLight ? m.toDark : m.toLight}\n onclick={() => ontheme?.(isLight ? 'dark' : 'light')}\n >\n <Icon name={isLight ? MOON_ICON : SUN_ICON} />\n </Button>\n </Floating>\n </div>\n{/if}\n","// SPDX-FileCopyrightText: 2026 SAKAIDA Atsushi\n// SPDX-License-Identifier: AGPL-3.0-only\n\n// maplibre-gl's own controls on the map, and the bottom corners of the map kept clear of the\n// toolbar.\n//\n// - mapControls() adds the controls as maplibre-gl draws them: at the bottom right, from the top,\n// the globe, the compass (with the pitch) and the zoom; at the bottom left, the scale. Their look\n// is maplibre-gl's style sheet, which the page imports\n// - cornerLift() lifts a bottom corner of the map (its controls and the attribution) above the\n// toolbar while the toolbar reaches it, as it does on a narrow map. The toolbar floats over the\n// map at the bottom centre, above the corners\n\nimport {\n type ControlPosition,\n GlobeControl,\n type IControl,\n NavigationControl,\n ScaleControl,\n} from 'maplibre-gl';\nimport type { MapControlsOptions } from './types.js';\n\n/** The members of the map the controls use */\nexport interface ControlsMap {\n addControl(control: IControl, position?: ControlPosition): unknown;\n removeControl(control: IControl): unknown;\n}\n\n/** The controls added to a map, to remove */\nexport interface MapControls {\n /** Removes the controls from the map. A second call does nothing */\n destroy(): void;\n}\n\n/**\n * Adds maplibre-gl's controls to a map: all four with `true` or `undefined`, none with `false`,\n * those not set to false with an object.\n *\n * maplibre-gl puts a control added to a bottom corner above those already there, so the controls\n * of the bottom right are added from the bottom: the zoom, the compass, then the globe.\n */\nexport function mapControls(\n map: ControlsMap,\n option: boolean | MapControlsOptions | undefined,\n): MapControls {\n const want: MapControlsOptions | null =\n option === false ? null : option === true || option === undefined ? {} : option;\n const added: IControl[] = [];\n const add = (control: IControl, position: ControlPosition) => {\n map.addControl(control, position);\n added.push(control);\n };\n if (want) {\n if (want.zoom !== false) {\n add(new NavigationControl({ showZoom: true, showCompass: false }), 'bottom-right');\n }\n if (want.compass !== false) {\n add(\n new NavigationControl({ showZoom: false, showCompass: true, visualizePitch: true }),\n 'bottom-right',\n );\n }\n if (want.globe !== false) add(new GlobeControl(), 'bottom-right');\n if (want.scale !== false) add(new ScaleControl(), 'bottom-left');\n }\n let destroyed = false;\n return {\n destroy() {\n if (destroyed) return;\n destroyed = true;\n for (const control of added) {\n try {\n map.removeControl(control);\n } catch {\n // The map is gone\n }\n }\n added.length = 0;\n },\n };\n}\n\n/** The attribute on the map's container while the interface lifts its bottom corners */\nexport const LIFT_ATTRIBUTE = 'data-mgd-ui-lift';\n\n/** The bottom corners of the map, lifted above the toolbar while it reaches them */\nexport interface CornerLift {\n /** Measures again after the toolbar came, went or changed */\n update(): void;\n /** Stops following and puts the corners back */\n destroy(): void;\n}\n\n/**\n * Lifts the bottom corners of maplibre-gl's controls in `container` (the map's container) above\n * the toolbar of the interface in `root`, each while the toolbar reaches it across: by the\n * distance from the top of the toolbar to the bottom of the map. root.css moves the corners by\n * the custom properties this sets on the container (--mgd-ui-lift-left and --mgd-ui-lift-right).\n */\nexport function cornerLift(container: HTMLElement, root: HTMLElement): CornerLift {\n let destroyed = false;\n let observer: ResizeObserver | undefined;\n let observed: Element[] = [];\n let last = '';\n container.setAttribute(LIFT_ATTRIBUTE, '');\n\n const corner = (side: 'left' | 'right') =>\n container.querySelector<HTMLElement>(\n `:scope > .maplibregl-control-container > .maplibregl-ctrl-bottom-${side}`,\n );\n const bar = () => root.querySelector<HTMLElement>('[data-region=\"bottom\"] [data-role=\"drawbar\"]');\n\n function set(left: number, right: number) {\n const key = `${left} ${right}`;\n if (key === last) return;\n last = key;\n container.style.setProperty('--mgd-ui-lift-left', `${left}px`);\n container.style.setProperty('--mgd-ui-lift-right', `${right}px`);\n }\n\n function apply() {\n if (destroyed) return;\n const toolbar = bar();\n if (!toolbar || !container.isConnected) {\n set(0, 0);\n return;\n }\n const box = container.getBoundingClientRect();\n const b = toolbar.getBoundingClientRect();\n if (b.width === 0 || b.height === 0) {\n set(0, 0);\n return;\n }\n const band = Math.round(Math.max(0, Math.min(box.bottom - b.top, box.height)));\n // A transform moves a corner up and down only, so across it stays where it is measured\n const reaches = (side: 'left' | 'right') => {\n const el = corner(side);\n if (!el) return false;\n const r = el.getBoundingClientRect();\n if (r.width === 0) return false;\n return side === 'left' ? r.right > b.left : r.left < b.right;\n };\n set(reaches('left') ? band : 0, reaches('right') ? band : 0);\n }\n\n function follow() {\n const next = [container, bar(), corner('left'), corner('right')].filter(\n (el): el is HTMLElement => !!el,\n );\n if (next.length === observed.length && next.every((el, i) => el === observed[i])) return;\n observer?.disconnect();\n observed = next;\n if (typeof ResizeObserver === 'undefined') return;\n observer ??= new ResizeObserver(apply);\n for (const el of observed) observer.observe(el);\n }\n\n return {\n update() {\n if (destroyed) return;\n follow();\n apply();\n },\n destroy() {\n if (destroyed) return;\n destroyed = true;\n observer?.disconnect();\n observer = undefined;\n observed = [];\n container.removeAttribute(LIFT_ATTRIBUTE);\n container.style.removeProperty('--mgd-ui-lift-left');\n container.style.removeProperty('--mgd-ui-lift-right');\n },\n };\n}\n","// SPDX-FileCopyrightText: 2026 SAKAIDA Atsushi\n// SPDX-License-Identifier: AGPL-3.0-only\n\n// The padding of the map under the interface. The side regions that stand beside the stage cover\n// the edges of the map, and the toolbar its bottom, so the map is told to keep its view (fitBounds,\n// easeTo, the centre) clear of them. A floating pane or a sheet lies over the map only for a\n// moment and leaves the padding at 0.\n\n/** The padding of a map in px, as maplibre-gl has it */\nexport interface PaddingOptions {\n top?: number;\n bottom?: number;\n left?: number;\n right?: number;\n}\n\n/** The members of the map the padding uses */\nexport interface PaddingMap {\n getContainer(): HTMLElement;\n getPadding(): PaddingOptions;\n setPadding(padding: PaddingOptions): unknown;\n}\n\n/** Which side regions stand beside the stage now, open */\nexport interface Beside {\n left: boolean;\n right: boolean;\n}\n\n/** The padding of a map, kept to the regions of the interface */\nexport interface MapPadding {\n /** Measures the regions again after the layout changed, and follows their sizes */\n update(beside: Beside): void;\n /** Stops following and gives the map back the padding it had before */\n destroy(): void;\n}\n\nconst ZERO: Beside = { left: false, right: false };\n\n/**\n * Keeps the padding of a map to the regions of the interface in `root`: the width of a side region\n * beside the stage on its side, and the height of the toolbar with its gap at the bottom.\n *\n * Every call to the map is guarded: once the map is removed, or its container leaves the page,\n * nothing is done.\n */\nexport function mapPadding(map: PaddingMap, root: HTMLElement): MapPadding {\n let before: PaddingOptions | null = null;\n try {\n before = { ...map.getPadding() };\n } catch {\n before = null;\n }\n let beside: Beside = ZERO;\n let last = '';\n let destroyed = false;\n let observer: ResizeObserver | undefined;\n let observed: Element[] = [];\n\n /** The element of a region of the shell, or null */\n const region = (name: string) =>\n root.querySelector<HTMLElement>(`[data-role=\"shell\"] [data-region=\"${name}\"]`);\n\n function sources() {\n return {\n left: beside.left ? region('left') : null,\n right: beside.right ? region('right') : null,\n bottom: region('bottom'),\n bar: root.querySelector<HTMLElement>('[data-region=\"bottom\"] [data-role=\"drawbar\"]'),\n };\n }\n\n function apply() {\n if (destroyed) return;\n try {\n const container = map.getContainer();\n if (!container.isConnected) return;\n const box = container.getBoundingClientRect();\n const { left, right, bottom, bar } = sources();\n const clamp = (v: number, max: number) => Math.round(Math.max(0, Math.min(v, max)));\n const next = {\n top: 0,\n left: left ? clamp(left.getBoundingClientRect().right - box.left, box.width) : 0,\n right: right ? clamp(box.right - right.getBoundingClientRect().left, box.width) : 0,\n // The toolbar's height and its gap: from the top of the bar to the bottom edge of the\n // toolbar's place (which rises over the sheets, so a sheet does not count)\n bottom:\n bottom && bar\n ? clamp(\n bottom.getBoundingClientRect().bottom - bar.getBoundingClientRect().top,\n box.height,\n )\n : 0,\n };\n const key = `${next.left} ${next.right} ${next.bottom}`;\n if (key === last) return;\n last = key;\n map.setPadding(next);\n } catch {\n // The map is gone\n }\n }\n\n function follow() {\n const { left, right, bar } = sources();\n let container: HTMLElement | undefined;\n try {\n container = map.getContainer();\n } catch {\n container = undefined;\n }\n const next = [left, right, bar, container].filter((el): el is HTMLElement => !!el);\n if (next.length === observed.length && next.every((el, i) => el === observed[i])) return;\n observer?.disconnect();\n observed = next;\n if (typeof ResizeObserver === 'undefined') return;\n observer ??= new ResizeObserver(apply);\n for (const el of observed) observer.observe(el);\n }\n\n return {\n update(now: Beside) {\n if (destroyed) return;\n beside = { ...now };\n follow();\n apply();\n },\n destroy() {\n if (destroyed) return;\n destroyed = true;\n observer?.disconnect();\n observer = undefined;\n observed = [];\n if (!before || last === '') return;\n try {\n if (!map.getContainer().isConnected) return;\n map.setPadding(before);\n } catch {\n // The map is gone\n }\n },\n };\n}\n","// SPDX-FileCopyrightText: 2026 SAKAIDA Atsushi\n// SPDX-License-Identifier: AGPL-3.0-only\n\n// The theme of the root element of the interface. kata's tokens are dark; data-color-mode=\"light\"\n// on the root element switches every one of them to kata's light theme (the build moves kata's\n// light block onto the root element), and the root's color-scheme with them.\n//\n// - light: data-color-mode=\"light\" on the root element\n// - dark: no attribute, kata's own theme\n// - auto: light while the system prefers light (prefers-color-scheme), and it follows a change\n// at once\n//\n// A page that sets data-color-mode=\"light\" on an element around the root turns it light too,\n// whatever the theme of the interface.\n\n/** The theme of the interface: `light`, `dark`, or `auto` to follow the system */\nexport type Theme = 'light' | 'dark' | 'auto';\n\n/** The query of the system's preference that `auto` follows */\nexport const LIGHT_QUERY = '(prefers-color-scheme: light)';\n\nconst THEMES: readonly Theme[] = ['light', 'dark', 'auto'];\n\n/** The theme of the options, `auto` when left out */\nexport function checkTheme(theme: Theme | undefined): Theme {\n if (theme === undefined) return 'auto';\n if (!THEMES.includes(theme)) throw new Error(`There is no theme \"${String(theme)}\"`);\n return theme;\n}\n\n/** The light or dark of a root element */\nfunction setLight(root: HTMLElement, light: boolean): void {\n if (light) root.setAttribute('data-color-mode', 'light');\n else root.removeAttribute('data-color-mode');\n}\n\n/** The theme of a root element, to change and to stop following the system */\nexport interface ThemeControl {\n /** Changes the theme */\n set(theme: Theme): void;\n /** Stops following the system. A second call does nothing */\n destroy(): void;\n}\n\n/**\n * Keeps the theme of a root element. With `auto`, it follows the system's preference while it\n * lasts; without `window.matchMedia`, `auto` is dark.\n *\n * `onlook` is called with the look applied (true for light) each time it is applied: at once,\n * on each change of the theme and, with `auto`, on each change of the system's preference.\n *\n * @throws Error when the theme is not `light`, `dark` or `auto`\n */\nexport function themeControl(\n root: HTMLElement,\n theme: Theme | undefined,\n onlook?: (light: boolean) => void,\n): ThemeControl {\n let query: MediaQueryList | null = null;\n const look = (light: boolean) => {\n setLight(root, light);\n onlook?.(light);\n };\n const onchange = (e: MediaQueryListEvent) => look(e.matches);\n const stop = () => {\n query?.removeEventListener('change', onchange);\n query = null;\n };\n const apply = (next: Theme) => {\n stop();\n if (next !== 'auto') {\n look(next === 'light');\n return;\n }\n const media = typeof window !== 'undefined' ? window.matchMedia : undefined;\n query = typeof media === 'function' ? media.call(window, LIGHT_QUERY) : null;\n query?.addEventListener('change', onchange);\n look(query?.matches ?? false);\n };\n apply(checkTheme(theme));\n let destroyed = false;\n return {\n set(next) {\n if (destroyed) return;\n apply(checkTheme(next));\n },\n destroy() {\n if (destroyed) return;\n destroyed = true;\n stop();\n },\n };\n}\n","// SPDX-FileCopyrightText: 2026 SAKAIDA Atsushi\n// SPDX-License-Identifier: AGPL-3.0-only\n\n/**\n * The standard user interface of `@sakuzu/maplibre-gl-draw`: a toolbar of the drawing tools at\n * the bottom of the map, with keyboard shortcuts.\n *\n * The interface keeps nothing of the drawing. It reads the draw instance and follows its events\n * (the current tool is `draw.getMode()`, the selection `draw.selection.get()`), and every button\n * calls the public API of the draw instance, so an application can mix it with controls of its\n * own and they never disagree.\n *\n * ```ts\n * import { createDraw } from '@sakuzu/maplibre-gl-draw';\n * import { createDrawUI } from '@sakuzu/maplibre-gl-draw-ui';\n * import '@sakuzu/maplibre-gl-draw-ui/style.css';\n *\n * const draw = createDraw(map);\n * const ui = createDrawUI(draw, { locale: 'ja' });\n * ```\n *\n * @module maplibre-gl-draw-ui\n */\n\nimport type { Draw } from '@sakuzu/maplibre-gl-draw';\nimport { flushSync, mount, unmount } from 'svelte';\nimport DrawUIView from './components/DrawUI.svelte';\nimport InspectorView from './components/Inspector.svelte';\nimport LayerPanelView from './components/LayerPanel.svelte';\nimport LegendView from './components/Legend.svelte';\nimport ToolbarView from './components/Toolbar.svelte';\nimport { cornerLift, mapControls } from './controls.js';\nimport { inspectorSettings, sectionsHandle } from './inspector/sections.js';\nimport type {\n InspectorHandle,\n InspectorOptions,\n InspectorSectionSpec,\n InspectorSettings,\n} from './inspector/types.js';\nimport {\n applyKataMessages,\n type Locale,\n localeLanguage,\n type Messages,\n resolveMessages,\n} from './messages.js';\nimport { type Beside, type MapPadding, mapPadding } from './padding.js';\nimport { Box } from './store.js';\nimport { checkTheme, type Theme, themeControl } from './theme.js';\nimport { checkSpec, entryId, insertTool, normalizeTools, toSpec } from './tools.js';\nimport type {\n AloneOptions,\n DrawUI,\n DrawUIOptions,\n LayerPanelHandle,\n LayerPanelOptions,\n LeftSettings,\n LegendHandle,\n ToolbarHandle,\n ToolbarOptions,\n ToolbarSettings,\n ToolEntry,\n ToolSpec,\n ToolsHandle,\n} from './types.js';\n\nexport type {\n InspectorField,\n InspectorFieldKind,\n InspectorHandle,\n InspectorOptions,\n InspectorSectionSpec,\n InspectorSectionsHandle,\n InspectorTab,\n Units,\n} from './inspector/types.js';\nexport type { Locale, Messages } from './messages.js';\nexport type { Theme } from './theme.js';\nexport type {\n AloneOptions,\n DrawUI,\n DrawUIOptions,\n LayerPanelHandle,\n LayerPanelOptions,\n LegendHandle,\n MapControlsOptions,\n ToolbarHandle,\n ToolbarOptions,\n ToolEntry,\n ToolId,\n ToolSpec,\n ToolsHandle,\n} from './types.js';\n\n/** The class of the root element of the interface */\nconst ROOT_CLASS = 'mgd-ui';\n\n/**\n * Creates the root element of the interface inside a container. It is kata's root in a page kata\n * does not own (data-kata-root): the tooltips and the probes of the tokens that kata appends go\n * into it, where the tokens, the language and the theme apply.\n */\nfunction createRoot(container: HTMLElement, overlay: boolean): HTMLElement {\n const root = document.createElement('div');\n root.className = ROOT_CLASS;\n root.setAttribute('data-kata-root', '');\n if (overlay) root.dataset.overlay = '';\n container.appendChild(root);\n return root;\n}\n\n/** Applies a locale: the words of the interface, those of kata, and the language of the root */\nfunction applyLocale(root: HTMLElement, messages: Box<Messages>, locale: Locale): void {\n const next = resolveMessages(locale);\n messages.set(next);\n applyKataMessages(next);\n const lang = localeLanguage(locale);\n if (lang) root.lang = lang;\n else root.removeAttribute('lang');\n}\n\n/** The tools of a toolbar, to add to and to remove from */\nfunction toolsHandle(tools: Box<ToolEntry[]>, messages: Box<Messages>): ToolsHandle {\n const remove = (id: string): boolean => {\n const entries = tools.get();\n const next = entries.filter((entry) => entryId(entry) !== id);\n if (next.length === entries.length) return false;\n tools.set(next);\n return true;\n };\n return {\n add(spec: ToolSpec) {\n checkSpec(spec);\n if (tools.get().some((entry) => entryId(entry) === spec.id)) {\n throw new Error(`There is a tool with the ID \"${spec.id}\" already`);\n }\n tools.set(insertTool(tools.get(), spec));\n let removed = false;\n return () => {\n if (removed) return;\n removed = true;\n remove(spec.id);\n };\n },\n remove,\n list() {\n const m = messages.get();\n return tools.get().map((entry) => toSpec(entry, m));\n },\n };\n}\n\n/**\n * Lays the interface over the map of a draw instance: kata's Shell with the toolbar at the\n * bottom and the keyboard shortcuts.\n *\n * It draws the toolbar, the shortcuts, the layer panel and the legend on the left, and the\n * inspector on the right while something is selected. The map's padding follows the interface:\n * the width of a panel that stands beside the map (on a wide container) and the toolbar's height\n * at the bottom, so that `fitBounds` and `easeTo` keep clear of them; `destroy()` gives the map\n * its padding back. A button at the top right switches between the light and the dark look, and\n * maplibre-gl's own controls go to the bottom corners of the map (the globe, the compass and the\n * zoom at the right, the scale at the left); `destroy()` removes them.\n *\n * @param draw - The draw instance\n * @param options - What to show, the words and the keys\n * @returns The interface, to change and to remove\n * @throws Error when a tool of `options.toolbar.tools` is not valid, a tab of\n * `options.inspector.tabs` is not `style` or `attributes`, or the theme is not `light`, `dark`\n * or `auto`\n */\nexport function createDrawUI(draw: Draw, options: DrawUIOptions = {}): DrawUI {\n const themeName = checkTheme(options.theme);\n const bar: ToolbarOptions | null =\n options.toolbar === false ? null : options.toolbar === true ? {} : (options.toolbar ?? {});\n const tools = new Box(normalizeTools(bar?.tools));\n const messages = new Box(resolveMessages(options.locale));\n const toolbar = new Box<ToolbarSettings | null>(\n bar ? { deletable: bar.delete !== false, snapping: bar.snapping !== false } : null,\n );\n const left = new Box<LeftSettings | null>(leftSettings(options));\n const inspector = new Box<InspectorSettings | null>(\n options.inspector === false\n ? null\n : inspectorSettings(options.inspector === true ? {} : options.inspector, options.units),\n );\n const sections = new Box<InspectorSectionSpec[]>([]);\n\n const map = draw.getMap();\n const root = createRoot(options.container ?? map.getContainer(), true);\n // The look the root shows, which the theme button follows\n const light = new Box(false);\n const theme = themeControl(root, themeName, (next) => light.set(next));\n applyLocale(root, messages, options.locale ?? 'en');\n // maplibre-gl's own controls at the bottom corners, lifted above the toolbar where it reaches\n // them\n const controls = mapControls(map, options.mapControls);\n const lift = cornerLift(map.getContainer(), root);\n // The map keeps its view clear of the panels beside the stage and of the toolbar\n const padding: MapPadding | null = options.padding === false ? null : mapPadding(map, root);\n const view = mount(DrawUIView, {\n target: root,\n props: {\n draw,\n tools,\n messages,\n toolbar,\n left,\n shortcuts: options.shortcuts !== false,\n inspector,\n sections,\n onbeside: (beside: Beside) => {\n padding?.update(beside);\n lift.update();\n },\n side: options.side,\n light,\n themeToggle: options.themeToggle !== false,\n ontheme: (next: Theme) => theme.set(next),\n },\n });\n // The shell opens the left region in an effect: run it now, so that the panels are there when\n // this returns\n flushSync();\n\n let destroyed = false;\n const dropLeft = (part: 'layers' | 'legend') => {\n const now = left.get();\n if (!now) return;\n const next = { ...now, [part]: part === 'layers' ? null : false };\n left.set(next.layers || next.legend ? next : null);\n };\n const layersHandle: LayerPanelHandle = {\n get element() {\n return root.querySelector<HTMLElement>('[data-role=\"layer-panel\"]') ?? root;\n },\n destroy() {\n dropLeft('layers');\n },\n };\n const legendHandle: LegendHandle = {\n get element() {\n return root.querySelector<HTMLElement>('[data-role=\"legend\"]') ?? root;\n },\n destroy() {\n dropLeft('legend');\n },\n };\n const toolbarHandle: ToolbarHandle = {\n get element() {\n return root.querySelector<HTMLElement>('[data-role=\"drawbar\"]') ?? root;\n },\n destroy() {\n toolbar.set(null);\n },\n };\n\n const inspectorHandle: InspectorHandle = {\n get element() {\n return root.querySelector<HTMLElement>('[data-role=\"inspector\"]') ?? root;\n },\n sections: sectionsHandle(sections),\n destroy() {\n inspector.set(null);\n },\n };\n\n return {\n element: root,\n get toolbar() {\n return !destroyed && toolbar.get() ? toolbarHandle : null;\n },\n get inspector() {\n return !destroyed && inspector.get() ? inspectorHandle : null;\n },\n tools: toolsHandle(tools, messages),\n get layers() {\n return !destroyed && left.get()?.layers ? layersHandle : null;\n },\n get legend() {\n return !destroyed && left.get()?.legend ? legendHandle : null;\n },\n setLocale(locale: Locale) {\n if (destroyed) return;\n applyLocale(root, messages, locale);\n },\n setTheme(next: Theme) {\n if (destroyed) return;\n theme.set(next);\n },\n destroy() {\n if (destroyed) return;\n destroyed = true;\n theme.destroy();\n padding?.destroy();\n lift.destroy();\n controls.destroy();\n unmount(view);\n root.remove();\n },\n };\n}\n\n/**\n * Puts the toolbar alone in an element: the tools, the delete button and the snapping switch,\n * without the keyboard shortcuts. The bar floats at the bottom centre of `target`, which must be\n * positioned (the map's container, or a positioned box over the map).\n *\n * @param draw - The draw instance\n * @param options - The element to put it in, what it shows, the words (`en` by default) and the\n * theme (`auto` by default)\n * @returns The toolbar, to remove\n * @throws Error when a tool of `options.tools` is not valid, or the theme is not `light`, `dark`\n * or `auto`\n */\nexport function createToolbar(draw: Draw, options: ToolbarOptions & AloneOptions): ToolbarHandle {\n const tools = new Box(normalizeTools(options.tools));\n const themeName = checkTheme(options.theme);\n const messages = new Box(resolveMessages(options.locale));\n const root = createRoot(options.target, true);\n const theme = themeControl(root, themeName);\n applyLocale(root, messages, options.locale ?? 'en');\n const view = mount(ToolbarView, {\n target: root,\n props: {\n draw,\n tools,\n messages,\n deletable: options.delete !== false,\n snapping: options.snapping !== false,\n },\n });\n let destroyed = false;\n return {\n get element() {\n return root.querySelector<HTMLElement>('[data-role=\"drawbar\"]') ?? root;\n },\n destroy() {\n if (destroyed) return;\n destroyed = true;\n theme.destroy();\n unmount(view);\n root.remove();\n },\n };\n}\n\n/** The layer panel with the options filled in */\nfunction layerSettings(options: LayerPanelOptions = {}): Required<LayerPanelOptions> {\n return {\n features: options.features !== false,\n add: options.add !== false,\n reorder: options.reorder !== false,\n };\n}\n\n/** What the left region of `createDrawUI` shows, or null for none */\nfunction leftSettings(options: DrawUIOptions): LeftSettings | null {\n const layers =\n options.layers === false\n ? null\n : layerSettings(options.layers === true ? {} : (options.layers ?? {}));\n const legend = options.legend !== false;\n return layers || legend ? { layers, legend } : null;\n}\n\n/** Puts a component alone in an element, in a root element of the interface */\nfunction mountAlone(\n { target, locale, theme: themeOption }: AloneOptions,\n component: typeof LayerPanelView | typeof LegendView,\n props: Record<string, unknown>,\n role: string,\n): { element: HTMLElement; destroy(): void } {\n const themeName = checkTheme(themeOption);\n const messages = new Box(resolveMessages(locale));\n const root = createRoot(target, false);\n const theme = themeControl(root, themeName);\n applyLocale(root, messages, locale ?? 'en');\n const view = mount(component as typeof LayerPanelView, {\n target: root,\n props: { ...props, messages } as never,\n });\n let destroyed = false;\n return {\n get element() {\n return root.querySelector<HTMLElement>(`[data-role=\"${role}\"]`) ?? root;\n },\n destroy() {\n if (destroyed) return;\n destroyed = true;\n theme.destroy();\n unmount(view);\n root.remove();\n },\n };\n}\n\n/**\n * Puts the layer panel alone in an element: the tree of the layers, their groups and their\n * features, from the front, with the eye, the lock, renaming, dragging and the add menu. It fills\n * `target`, which gives it its size and its scrolling.\n *\n * @param draw - The draw instance\n * @param options - The element to put it in, what it shows, the words (`en` by default) and the\n * theme (`auto` by default)\n * @returns The layer panel, to remove\n * @throws Error when the theme is not `light`, `dark` or `auto`\n */\nexport function createLayerPanel(\n draw: Draw,\n options: LayerPanelOptions & AloneOptions,\n): LayerPanelHandle {\n return mountAlone(options, LayerPanelView, { draw, ...layerSettings(options) }, 'layer-panel');\n}\n\n/**\n * Puts the legend alone in an element: the rows of the style rule of each layer that has one,\n * from the front. It only reads; the rules change with `draw.layers.update`.\n *\n * @param draw - The draw instance\n * @param options - The element to put it in, the words (`en` by default) and the theme (`auto` by\n * default)\n * @returns The legend, to remove\n * @throws Error when the theme is not `light`, `dark` or `auto`\n */\nexport function createLegend(draw: Draw, options: AloneOptions): LegendHandle {\n return mountAlone(options, LegendView, { draw }, 'legend');\n}\n\n/**\n * Puts the inspector alone in an element: the panel of what is selected (a feature, several\n * features, a layer or a group), with an empty state while nothing is. The panel fills the height\n * of `target`.\n *\n * @param draw - The draw instance\n * @param options - The element to put it in, the tabs, the measurements, the operations, the\n * units, the words (`en` by default) and the theme (`auto` by default)\n * @returns The inspector, to add sections to and to remove\n * @throws Error when a tab of `options.tabs` is not `style` or `attributes`, or the theme is not\n * `light`, `dark` or `auto`\n */\nexport function createInspector(\n draw: Draw,\n options: InspectorOptions & AloneOptions,\n): InspectorHandle {\n const settings = inspectorSettings(options);\n const themeName = checkTheme(options.theme);\n const messages = new Box(resolveMessages(options.locale));\n const sections = new Box<InspectorSectionSpec[]>([]);\n const root = createRoot(options.target, false);\n const theme = themeControl(root, themeName);\n root.dataset.panel = '';\n applyLocale(root, messages, options.locale ?? 'en');\n const view = mount(InspectorView, {\n target: root,\n props: { draw, messages, settings, sections },\n });\n let destroyed = false;\n return {\n get element() {\n return root.querySelector<HTMLElement>('[data-role=\"inspector\"]') ?? root;\n },\n sections: sectionsHandle(sections),\n destroy() {\n if (destroyed) return;\n destroyed = true;\n theme.destroy();\n unmount(view);\n root.remove();\n },\n };\n}\n"],"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,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,205,206,207],"mappings":";;;;AAEA,IAAW,IAAW,MAAM,SACjB,IAAW,MAAM,UAAU,SAC3B,IAAW,MAAM,UAAU,UAC3B,IAAa,MAAM,MAEnB,IAAkB,OAAO,gBACzB,IAAiB,OAAO,0BACxB,IAAkB,OAAO,2BACzB,IAAmB,OAAO,WAC1B,IAAkB,MAAM,WACxB,IAAmB,OAAO,gBAC1B,IAAgB,OAAO;AAOlC,SAAgB,EAAY,GAAO;CAClC,OAAO,OAAO,KAAU;AACzB;AAEA,IAAa,UAAa,CAAC;AAoB3B,SAAgB,EAAQ,GA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